0

Added clear module

This commit is contained in:
Pepich 2017-03-02 19:39:48 +01:00
parent 44281b3cc0
commit b0358d6235
2 changed files with 63 additions and 1 deletions

View File

@ -13,6 +13,7 @@ import com.redstoner.modules.challenge.Challenge;
import com.redstoner.modules.chatalias.Chatalias;
import com.redstoner.modules.chatgroups.Chatgroups;
import com.redstoner.modules.check.Check;
import com.redstoner.modules.clear.Clear;
import com.redstoner.modules.clearonjoin.ClearOnJoin;
import com.redstoner.modules.cycle.Cycle;
import com.redstoner.modules.damnspam.DamnSpam;
@ -38,7 +39,7 @@ import com.redstoner.modules.webtoken.WebToken;
/** Main class. Duh.
*
* @author Pepich */
@Version(major = 1, minor = 4, revision = 1, compatible = -1)
@Version(major = 1, minor = 4, revision = 2, compatible = -1)
public class Main extends JavaPlugin
{
public static JavaPlugin plugin;
@ -56,6 +57,7 @@ public class Main extends JavaPlugin
// TODO: ModuleLoader.addModule(BlockplaceMods.class);
// TODO: ModuleLoader.addModule(Calc.class);
ModuleLoader.addModule(Challenge.class);
ModuleLoader.addModule(Clear.class);
ModuleLoader.addModule(ClearOnJoin.class);
ModuleLoader.addModule(Chatalias.class);
ModuleLoader.addModule(Cycle.class);

View File

@ -0,0 +1,60 @@
package com.redstoner.modules.clear;
import org.bukkit.command.CommandSender;
import org.bukkit.entity.Player;
import org.bukkit.inventory.Inventory;
import com.nemez.cmdmgr.Command;
import com.redstoner.annotations.Version;
import com.redstoner.misc.Utils;
import com.redstoner.modules.Module;
@Version(major = 1, minor = 0, revision = 0, compatible = 1)
public class Clear implements Module
{
boolean enabled;
@Override
public void onEnable()
{
enabled = true;
}
@Override
public void onDisable()
{
enabled = false;
}
@Override
public boolean enabled()
{
return enabled;
}
@Command(hook = "clear")
public boolean clearInventory(CommandSender sender)
{
Player player = (Player) sender;
Inventory inv = player.getInventory();
for (int i = 0; i < 36; i++)
inv.clear(i);
Utils.sendMessage(sender, null, "Cleared your inventory!");
return true;
}
// @noformat
@Override
public String getCommandString()
{
return "command clear{\n" +
" [empty] {\n" +
" help clears your inventory;\n" +
" type player;\n" +
" perm utils.clear;\n" +
" run clear;\n" +
" }\n" +
"}";
}
// @format
}