diff --git a/TheButtonAutoFlair.jar b/TheButtonAutoFlair.jar index 349b812..859c736 100644 Binary files a/TheButtonAutoFlair.jar and b/TheButtonAutoFlair.jar differ diff --git a/TheButtonAutoFlair/bin/tk/sznp/thebuttonautoflair/Commands$1.class b/TheButtonAutoFlair/bin/tk/sznp/thebuttonautoflair/Commands$1.class new file mode 100644 index 0000000..07ebc6a Binary files /dev/null and b/TheButtonAutoFlair/bin/tk/sznp/thebuttonautoflair/Commands$1.class differ diff --git a/TheButtonAutoFlair/bin/tk/sznp/thebuttonautoflair/Commands.class b/TheButtonAutoFlair/bin/tk/sznp/thebuttonautoflair/Commands.class index 3ff99d2..915823f 100644 Binary files a/TheButtonAutoFlair/bin/tk/sznp/thebuttonautoflair/Commands.class and b/TheButtonAutoFlair/bin/tk/sznp/thebuttonautoflair/Commands.class differ diff --git a/TheButtonAutoFlair/bin/tk/sznp/thebuttonautoflair/PlayerListener$1.class b/TheButtonAutoFlair/bin/tk/sznp/thebuttonautoflair/PlayerListener$1.class index aa7c1a2..4b2d92a 100644 Binary files a/TheButtonAutoFlair/bin/tk/sznp/thebuttonautoflair/PlayerListener$1.class and b/TheButtonAutoFlair/bin/tk/sznp/thebuttonautoflair/PlayerListener$1.class differ diff --git a/TheButtonAutoFlair/bin/tk/sznp/thebuttonautoflair/PlayerListener$2.class b/TheButtonAutoFlair/bin/tk/sznp/thebuttonautoflair/PlayerListener$2.class index 362c965..52a7305 100644 Binary files a/TheButtonAutoFlair/bin/tk/sznp/thebuttonautoflair/PlayerListener$2.class and b/TheButtonAutoFlair/bin/tk/sznp/thebuttonautoflair/PlayerListener$2.class differ diff --git a/TheButtonAutoFlair/bin/tk/sznp/thebuttonautoflair/PlayerListener.class b/TheButtonAutoFlair/bin/tk/sznp/thebuttonautoflair/PlayerListener.class index 441e545..ac9cce3 100644 Binary files a/TheButtonAutoFlair/bin/tk/sznp/thebuttonautoflair/PlayerListener.class and b/TheButtonAutoFlair/bin/tk/sznp/thebuttonautoflair/PlayerListener.class differ diff --git a/TheButtonAutoFlair/bin/tk/sznp/thebuttonautoflair/PluginMain$1.class b/TheButtonAutoFlair/bin/tk/sznp/thebuttonautoflair/PluginMain$1.class index d76af82..92a062f 100644 Binary files a/TheButtonAutoFlair/bin/tk/sznp/thebuttonautoflair/PluginMain$1.class and b/TheButtonAutoFlair/bin/tk/sznp/thebuttonautoflair/PluginMain$1.class differ diff --git a/TheButtonAutoFlair/bin/tk/sznp/thebuttonautoflair/PluginMain$2.class b/TheButtonAutoFlair/bin/tk/sznp/thebuttonautoflair/PluginMain$2.class index c0bdf92..c814479 100644 Binary files a/TheButtonAutoFlair/bin/tk/sznp/thebuttonautoflair/PluginMain$2.class and b/TheButtonAutoFlair/bin/tk/sznp/thebuttonautoflair/PluginMain$2.class differ diff --git a/TheButtonAutoFlair/bin/tk/sznp/thebuttonautoflair/PluginMain.class b/TheButtonAutoFlair/bin/tk/sznp/thebuttonautoflair/PluginMain.class index 2c5df84..6f549f0 100644 Binary files a/TheButtonAutoFlair/bin/tk/sznp/thebuttonautoflair/PluginMain.class and b/TheButtonAutoFlair/bin/tk/sznp/thebuttonautoflair/PluginMain.class differ diff --git a/TheButtonAutoFlair/plugin.yml b/TheButtonAutoFlair/plugin.yml index ad60e44..b09eba5 100644 --- a/TheButtonAutoFlair/plugin.yml +++ b/TheButtonAutoFlair/plugin.yml @@ -11,7 +11,5 @@ commands: ooc: description: Send message in Out-of-Character usage: "&cUsage: /ooc &r" - skype: - description: Get the Skype conversation link author: NorbiPeti depend: [Essentials, Towny, TownyChat, Minigames] diff --git a/TheButtonAutoFlair/src/tk/sznp/thebuttonautoflair/Commands.java b/TheButtonAutoFlair/src/tk/sznp/thebuttonautoflair/Commands.java index 6ef6608..a03b647 100644 --- a/TheButtonAutoFlair/src/tk/sznp/thebuttonautoflair/Commands.java +++ b/TheButtonAutoFlair/src/tk/sznp/thebuttonautoflair/Commands.java @@ -2,17 +2,31 @@ package tk.sznp.thebuttonautoflair; import org.apache.commons.io.FileUtils; import org.bukkit.Bukkit; +import org.bukkit.Location; +import org.bukkit.Material; import org.bukkit.command.BlockCommandSender; import org.bukkit.command.Command; import org.bukkit.command.CommandExecutor; 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 com.earth2me.essentials.Mob; +import com.earth2me.essentials.Mob.MobException; + +import au.com.mineauz.minigames.MinigamePlayer; +import au.com.mineauz.minigames.Minigames; import java.io.File; import java.io.IOException; import java.net.MalformedURLException; import java.net.URL; import java.util.ArrayList; +import java.util.Random; public class Commands implements CommandExecutor { @@ -137,6 +151,9 @@ public class Commands implements CommandExecutor { case "quiz": DoQuiz(player, args, null); break; + case "kittycannon": + DoKittyCannon(player, args); + break; default: return false; } @@ -155,9 +172,6 @@ public class Commands implements CommandExecutor { MaybeOfflinePlayer.AddPlayerIfNeeded(player.getUniqueId()).RPMode = true; } return true; - case "skype": - // "skype:?chat&blob=Y_5Ob1BEcw0ZlstdUHyf0ENS5n1Xz2Huhx-5b-pB2JyMSRO5QMEALkJuTSuUaAb3-XfWXwCndwhGex_UpXDbyQ"; - return true; default: player.sendMessage("Unknown command: " + cmd.getName()); break; @@ -580,4 +594,60 @@ public class Commands implements CommandExecutor { } } + private static Random random = new Random(); + + public static String KittyCannonMinigame = "KittyCannon"; + + private static void DoKittyCannon(Player player, String[] args) { + if (player == null) { + SendMessage(player, + "§cThis command can only be used by a player.§r"); + return; + } + MinigamePlayer mp = Minigames.plugin.pdata.getMinigamePlayer(player); + if (!player.isOp() + && (!mp.isInMinigame() || mp.getMinigame().getName(false) + .equalsIgnoreCase(KittyCannonMinigame))) { + SendMessage(player, + "§You can only use KittyCannon in it's minigame!"); + return; + } + try { + final Mob cat = Mob.OCELOT; + final Ocelot ocelot = (Ocelot) cat.spawn(player.getWorld(), + player.getServer(), player.getEyeLocation()); + if (ocelot == null) { + return; + } + 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) { + } + } } diff --git a/TheButtonAutoFlair/src/tk/sznp/thebuttonautoflair/PlayerListener.java b/TheButtonAutoFlair/src/tk/sznp/thebuttonautoflair/PlayerListener.java index e7a59ca..a84bf34 100644 --- a/TheButtonAutoFlair/src/tk/sznp/thebuttonautoflair/PlayerListener.java +++ b/TheButtonAutoFlair/src/tk/sznp/thebuttonautoflair/PlayerListener.java @@ -1,6 +1,7 @@ package tk.sznp.thebuttonautoflair; import org.bukkit.Bukkit; +import org.bukkit.Material; import org.bukkit.Sound; import org.bukkit.configuration.InvalidConfigurationException; import org.bukkit.configuration.file.YamlConfiguration; @@ -11,8 +12,12 @@ import org.bukkit.event.entity.PlayerDeathEvent; import org.bukkit.event.player.AsyncPlayerChatEvent; import org.bukkit.event.player.PlayerChatTabCompleteEvent; import org.bukkit.event.player.PlayerJoinEvent; +import org.bukkit.event.player.PlayerPickupItemEvent; import org.bukkit.event.player.PlayerQuitEvent; +import org.bukkit.inventory.ItemStack; +import org.bukkit.inventory.meta.SkullMeta; +import au.com.mineauz.minigames.MinigamePlayer; import au.com.mineauz.minigames.Minigames; import java.io.File; @@ -91,9 +96,6 @@ public class PlayerListener implements Listener { // 2015.07.16. } mp.RPMode = true; // 2015.08.25. - - if (p.getName().equals("FigyTuna") && Commands.PluginUpdated) - p.sendMessage("§bThe The Button MC plugin got updated. Please restart the server. :P§r"); } @EventHandler @@ -325,4 +327,40 @@ public class PlayerListener implements Listener { // 2015.07.16. Ftimer.schedule(tt, 15 * 1000); } } + + @EventHandler + public void onPlayerItemPickup(PlayerPickupItemEvent e) { + // System.out.println("A"); + MinigamePlayer mp = Minigames.plugin.pdata.getMinigamePlayer(e + .getPlayer()); + // System.out.println("B"); + if (!e.getPlayer().isOp() + && (!mp.isInMinigame() || mp.getMinigame().getName(false) + .equalsIgnoreCase(Commands.KittyCannonMinigame))) + return; + // System.out.println("C"); + ItemStack item = e.getItem().getItemStack(); + if (!item.getType().equals(Material.SKULL_ITEM) + && !item.getType().equals(Material.SKULL)) + return; + // System.out.println("D"); + SkullMeta meta = (SkullMeta) item.getItemMeta(); + if (!meta.getDisplayName().equals("§rOcelot Head") + || !meta.getOwner().equals("MHF_Ocelot")) + return; + // System.out.println("E"); + if (meta.getLore() == null || meta.getLore().size() == 0) + return; + // System.out.println("F"); + 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, Bukkit.getPlayer(meta.getLore().get(0))); + e.getItem().remove(); + // System.out.println("G"); + e.setCancelled(true); + // System.out.println("H"); + } } diff --git a/TheButtonAutoFlair/src/tk/sznp/thebuttonautoflair/PluginMain.java b/TheButtonAutoFlair/src/tk/sznp/thebuttonautoflair/PluginMain.java index f20e089..e645b44 100644 --- a/TheButtonAutoFlair/src/tk/sznp/thebuttonautoflair/PluginMain.java +++ b/TheButtonAutoFlair/src/tk/sznp/thebuttonautoflair/PluginMain.java @@ -43,7 +43,6 @@ public class PluginMain extends JavaPlugin { // Translated to Java: 2015.07.15. this.getCommand("ooc").setExecutor(comm); this.getCommand("ooc").setUsage( this.getCommand("ooc").getUsage().replace('&', '§')); - this.getCommand("skype").setExecutor(comm); Instance = this; // 2015.08.08. Console = this.getServer().getConsoleSender(); // 2015.08.12. LoadFiles(false); // 2015.08.09.