From 9857bc5bd50821d804dc6176cf5d1c9d1e15a6ac Mon Sep 17 00:00:00 2001 From: NorbiPeti Date: Sun, 20 Nov 2016 22:29:31 +0100 Subject: [PATCH] Removed Minigames stuff --- pom.xml | 7 +- .../commands/ucmds/KittycannonCommand.java | 90 ------------------- .../chat/listener/PlayerListener.java | 54 +---------- src/main/resources/plugin.yml | 73 ++++++++------- 4 files changed, 45 insertions(+), 179 deletions(-) delete mode 100644 src/main/java/buttondevteam/chat/commands/ucmds/KittycannonCommand.java diff --git a/pom.xml b/pom.xml index 8bbeeb6..7654e31 100644 --- a/pom.xml +++ b/pom.xml @@ -152,11 +152,8 @@ votifier 1.9 - - au.com.mineauz - Minigames - 1.8.0 - + net.milkbowl.vault VaultAPI diff --git a/src/main/java/buttondevteam/chat/commands/ucmds/KittycannonCommand.java b/src/main/java/buttondevteam/chat/commands/ucmds/KittycannonCommand.java deleted file mode 100644 index af4276c..0000000 --- a/src/main/java/buttondevteam/chat/commands/ucmds/KittycannonCommand.java +++ /dev/null @@ -1,90 +0,0 @@ -package buttondevteam.chat.commands.ucmds; - -import java.util.ArrayList; -import java.util.Random; - -import org.bukkit.Bukkit; -import org.bukkit.Location; -import org.bukkit.Material; -import org.bukkit.command.CommandSender; -import org.bukkit.entity.Ocelot; -import org.bukkit.entity.Player; -import org.bukkit.inventory.ItemStack; -import org.bukkit.inventory.meta.SkullMeta; -import org.bukkit.potion.PotionEffect; -import org.bukkit.potion.PotionEffectType; - -import au.com.mineauz.minigames.MinigamePlayer; -import au.com.mineauz.minigames.Minigames; -import buttondevteam.chat.PluginMain; - -import com.earth2me.essentials.Mob; -import com.earth2me.essentials.Mob.MobException; - -public class KittycannonCommand extends UCommandBase { - - private static Random random = new Random(); - - public static String KittyCannonMinigame = "KittyCannon"; - - @Override - public String[] GetHelpText(String alias) { - return new String[] { "§6---- Kittycannon ----", - "This command is designed for the Kittycannon minigame" }; - } - - @Override - public boolean OnCommand(CommandSender sender, String alias, String[] args) { - Player player = (Player) sender; - MinigamePlayer mp = Minigames.plugin.pdata.getMinigamePlayer(player); - if (!(mp.isInMinigame() && mp.getMinigame().getName(false) - .equalsIgnoreCase(KittyCannonMinigame))) { - sender.sendMessage("§cYou can only use KittyCannon in it's minigame!"); - return true; - } - try { - final Mob cat = Mob.OCELOT; - final Ocelot ocelot = (Ocelot) cat.spawn(player.getWorld(), - player.getServer(), player.getEyeLocation()); - if (ocelot == null) { - return true; - } - final ArrayList lore = new ArrayList<>(); - lore.add(player.getName()); - final int i = random.nextInt(Ocelot.Type.values().length); - ocelot.setCatType(Ocelot.Type.values()[i]); - ocelot.setTamed(true); - ocelot.setBaby(); - ocelot.addPotionEffect(new PotionEffect( - PotionEffectType.DAMAGE_RESISTANCE, 5, 5)); - ocelot.setVelocity(player.getEyeLocation().getDirection() - .multiply(2)); - Bukkit.getScheduler().scheduleSyncDelayedTask(PluginMain.Instance, - new Runnable() { - @SuppressWarnings("deprecation") - @Override - public void run() { - final Location loc = ocelot.getLocation(); - ocelot.remove(); - loc.getWorld().createExplosion(loc, 0F); - final ItemStack head = new ItemStack( - Material.SKULL_ITEM, 1, (short) 3, (byte) 3); - SkullMeta im = (SkullMeta) head.getItemMeta(); - im.setDisplayName("§rOcelot Head"); - im.setOwner("MHF_Ocelot"); - im.setLore(lore); - head.setItemMeta(im); - loc.getWorld().dropItem(loc, head); - } - }, 20); - } catch (MobException e) { - } - return true; - } - - @Override - public String GetUCommandPath() { - return "kittycannon"; - } - -} diff --git a/src/main/java/buttondevteam/chat/listener/PlayerListener.java b/src/main/java/buttondevteam/chat/listener/PlayerListener.java index 4b6bd37..89b8b1d 100644 --- a/src/main/java/buttondevteam/chat/listener/PlayerListener.java +++ b/src/main/java/buttondevteam/chat/listener/PlayerListener.java @@ -10,8 +10,6 @@ import com.palmergames.bukkit.towny.Towny; import org.bukkit.Bukkit; import org.bukkit.Location; -import org.bukkit.Material; -import org.bukkit.block.Block; import org.bukkit.entity.Player; import org.bukkit.event.EventHandler; import org.bukkit.event.EventPriority; @@ -20,22 +18,15 @@ import org.bukkit.event.entity.PlayerDeathEvent; import org.bukkit.event.player.AsyncPlayerChatEvent; import org.bukkit.event.player.PlayerChatTabCompleteEvent; import org.bukkit.event.player.PlayerCommandPreprocessEvent; -import org.bukkit.event.player.PlayerInteractEvent; import org.bukkit.event.player.PlayerMoveEvent; -import org.bukkit.event.player.PlayerPickupItemEvent; import org.bukkit.event.player.PlayerTeleportEvent; import org.bukkit.event.server.ServerCommandEvent; import org.bukkit.help.HelpTopic; -import org.bukkit.inventory.ItemStack; -import org.bukkit.inventory.meta.SkullMeta; import org.bukkit.potion.PotionEffect; import org.bukkit.potion.PotionEffectType; -import au.com.mineauz.minigames.MinigamePlayer; -import au.com.mineauz.minigames.Minigames; import buttondevteam.chat.ChatPlayer; import buttondevteam.chat.ChatProcessing; import buttondevteam.chat.PluginMain; -import buttondevteam.chat.commands.ucmds.KittycannonCommand; import buttondevteam.lib.TBMCPlayer; import buttondevteam.lib.TBMCPlayer.InfoTarget; import buttondevteam.lib.chat.Channel; @@ -210,8 +201,8 @@ public class PlayerListener implements Listener { public void onPlayerDeath(PlayerDeathEvent e) { if (e.getEntity().getName().equals("Alpha_Bacca44")) AlphaDeaths++; - MinigamePlayer mgp = Minigames.plugin.pdata.getMinigamePlayer(e.getEntity()); - if ((mgp != null && !mgp.isInMinigame()) && new Random().nextBoolean()) { // Don't store Fs for NPCs + // MinigamePlayer mgp = Minigames.plugin.pdata.getMinigamePlayer(e.getEntity()); + if (/* (mgp != null && !mgp.isInMinigame()) && */ new Random().nextBoolean()) { // Don't store Fs for NPCs if (Ftimer != null) Ftimer.cancel(); ActiveF = true; @@ -240,29 +231,6 @@ public class PlayerListener implements Listener { } } - @EventHandler - public void onPlayerItemPickup(PlayerPickupItemEvent e) { - MinigamePlayer mp = Minigames.plugin.pdata.getMinigamePlayer(e.getPlayer()); - - if (!(mp.isInMinigame() - && mp.getMinigame().getName(false).equalsIgnoreCase(KittycannonCommand.KittyCannonMinigame))) - return; - ItemStack item = e.getItem().getItemStack(); - if (!item.getType().equals(Material.SKULL_ITEM) && !item.getType().equals(Material.SKULL)) - return; - SkullMeta meta = (SkullMeta) item.getItemMeta(); - if (!meta.getDisplayName().equals("§rOcelot Head") || !meta.getOwner().equals("MHF_Ocelot")) - return; - if (meta.getLore() == null || meta.getLore().size() == 0) - return; - ItemStack hat = e.getPlayer().getInventory().getHelmet(); - if (!(hat != null && (hat.getType().equals(Material.SKULL) || hat.getType().equals(Material.SKULL_ITEM)) - && ((SkullMeta) hat.getItemMeta()).getDisplayName().equals("§rWolf Head"))) - e.getPlayer().damage(1f * item.getAmount(), Bukkit.getPlayer(meta.getLore().get(0))); - e.getItem().remove(); - e.setCancelled(true); - } - @EventHandler @SuppressWarnings("deprecation") public void onVotifierEvent(VotifierEvent event) { @@ -293,24 +261,6 @@ public class PlayerListener implements Listener { } } - @EventHandler - public void onPlayerInteract(PlayerInteractEvent e) { - MinigamePlayer mp = Minigames.plugin.pdata.getMinigamePlayer(e.getPlayer()); - if (mp == null) - return; - if (mp.isInMinigame() && mp.getMinigame().getName(false).equalsIgnoreCase("twohundred")) { - Block block = e.getClickedBlock(); - if (block == null) - return; - if (block.getType() == Material.ENDER_CHEST) { - e.setCancelled(true); - e.getPlayer().sendMessage("§You are not allowed to use enderchests here."); - PluginMain.Instance.getLogger() - .warning(e.getPlayer().getName() + " tried to use an enderchest in twohundred."); - } - } - } - public static Channel ConsoleChannel = Channel.GlobalChat; @EventHandler(priority = EventPriority.HIGHEST) diff --git a/src/main/resources/plugin.yml b/src/main/resources/plugin.yml index 7e8f603..0358249 100644 --- a/src/main/resources/plugin.yml +++ b/src/main/resources/plugin.yml @@ -1,32 +1,41 @@ -name: ButtonChat -main: buttondevteam.chat.PluginMain -version: 4.0 -commands: - u: - description: Auto-flair system. Accept or ignore flair. - ooc: - description: Send message in Out-of-Character. - alias: nrp - unlol: - description: Unlaugh the last laugh. - alias: unlaugh - mwiki: - description: Search the wiki. - dontrunthiscmd: - tableflip: - description: Flip a table. - unflip: - description: Unflip a flip. - chatonly: - description: Enable chat only mode. Useful for chat clients. - shrug: - description: Shrug. - yeehaw: - description: This command makes you yeehaw. -author: NorbiPeti -depend: [Essentials, Towny, Minigames, Votifier, WorldGuard, WorldEdit, ProtocolLib, Vault, ButtonCore] -permissions: - tbmc.admin: - description: Gives access to /un- commands and /u admin commands - tbmc.rainbow: - description: Gives access to rainbow colors (/u c). +name: ButtonChat +main: buttondevteam.chat.PluginMain +version: 4.0 +commands: + u: + description: Auto-flair system. Accept or ignore flair. + ooc: + description: Send message in Out-of-Character. + alias: nrp + unlol: + description: Unlaugh the last laugh. + alias: unlaugh + mwiki: + description: Search the wiki. + dontrunthiscmd: null + tableflip: + description: Flip a table. + unflip: + description: Unflip a flip. + chatonly: + description: Enable chat only mode. Useful for chat clients. + shrug: + description: Shrug. + yeehaw: + description: This command makes you yeehaw. +author: NorbiPeti +depend: +- Essentials +- Towny +- Votifier +- WorldGuard +- WorldEdit +- Vault +- ButtonCore +soft-depend: +- Minigames +permissions: + tbmc.admin: + description: Gives access to /un- commands and /u admin commands + tbmc.rainbow: + description: Gives access to rainbow colors (/u c). \ No newline at end of file