Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- package me.daansander.menuinv;
- import org.bukkit.Bukkit;
- import org.bukkit.command.Command;
- import org.bukkit.command.CommandSender;
- import org.bukkit.entity.Player;
- import org.bukkit.event.EventHandler;
- import org.bukkit.event.Listener;
- import org.bukkit.event.block.Action;
- import org.bukkit.event.player.PlayerInteractEvent;
- import org.bukkit.plugin.java.JavaPlugin;
- public class MenuInv extends JavaPlugin implements Listener {
- int number = 10;
- MyConfigManager manager;
- MyConfig intConfig;
- private Menu menu;
- public void onEnable() {
- menu = new Menu(this);
- Bukkit.getServer().getPluginManager().registerEvents(this, this);
- intConfig = manager.getNewConfig("Ints.yml", new String[] { "this is the variable config", "test int"});
- }
- public boolean onCommand(CommandSender sender, Command cmd, String CommandLabel, String[] args) {
- if(sender instanceof Player) {
- Player player = (Player) sender;
- if(CommandLabel.equalsIgnoreCase("variable")) {
- this.getConfig().set(number,10);
- player.sendMessage("Your Int has been set to 10!");
- }
- }
- return true;
- }
- @EventHandler
- public void onPlayerInteract(PlayerInteractEvent e) {
- if (!(e.getAction() == Action.RIGHT_CLICK_BLOCK)) return;
- menu.show(e.getPlayer());
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment