diff --git a/Plugins/Mineplex.Hub/src/mineplex/hub/HubRepository.java b/Plugins/Mineplex.Hub/src/mineplex/hub/HubRepository.java index 80e9c0501..e8dffc1b3 100644 --- a/Plugins/Mineplex.Hub/src/mineplex/hub/HubRepository.java +++ b/Plugins/Mineplex.Hub/src/mineplex/hub/HubRepository.java @@ -30,9 +30,11 @@ public class HubRepository private static String RETRIEVE_NEWS_ENTRIES = "SELECT newsString, newsPosition FROM newsList;"; private static String RETRIEVE_MAX_NEWS_POSITION = "SELECT MAX(newsPosition) AS newsPosition FROM newsList;"; private static String ADD_NEWS_ENTRY = "INSERT INTO newsList (newsString, newsPosition) VALUES(?,?);"; + //private static String ADD_NEWS_ENTRY = "SET @max = (SELECT MAX(newsPosition) AS newsPosition FROM newsList);INSERT INTO newsList (newsString, newsPosition) VALUES(?,@max + 1);"; private static String SET_NEWS_ENTRY = "UPDATE newsList SET newsString = ? WHERE newsPosition = ?;"; private static String DELETE_NEWS_ENTRY = "DELETE FROM newsList WHERE newsPosition = ?;"; private static String RECALC_NEWS_POSITIONS = "UPDATE newsList SET newsPosition = newsPosition - 1 WHERE newsPosition > ?;"; + //private static String DELETE_RECALC_NEWS_ENTRY = "SET @pos = ?;SET @max = (SELECT MAX(newsPosition) AS newsPosition FROM newsList);DELETE FROM newsList WHERE newsPosition = @pos;UPDATE newsList SET newsPosition = IF(@max <> @pos, newsPosition - 1, newsPosition) WHERE newsPosition > @pos;"; private Connection _connection = null; @@ -279,6 +281,7 @@ public class HubRepository _connection = DriverManager.getConnection(_connectionString, _userName, _password); } + //preparedStatement = _connection.prepareStatement(DELETE_RECALC_NEWS_ENTRY); preparedStatement = _connection.prepareStatement(DELETE_NEWS_ENTRY); preparedStatement.setInt(1, newsPosition); result = preparedStatement.executeUpdate(); diff --git a/Plugins/Mineplex.Hub/src/mineplex/hub/commands/NewsCommand.java b/Plugins/Mineplex.Hub/src/mineplex/hub/commands/NewsCommand.java index f8084f3ab..71067f06a 100644 --- a/Plugins/Mineplex.Hub/src/mineplex/hub/commands/NewsCommand.java +++ b/Plugins/Mineplex.Hub/src/mineplex/hub/commands/NewsCommand.java @@ -11,6 +11,7 @@ import mineplex.core.common.util.C; import mineplex.core.common.util.Callback; import mineplex.core.common.util.F; import mineplex.core.common.util.UtilPlayer; +import mineplex.core.common.util.UtilServer; import mineplex.hub.HubManager; import mineplex.hub.modules.NewsManager; @@ -35,8 +36,8 @@ public class NewsCommand extends CommandBase UtilPlayer.message(caller, F.main(Plugin.GetName(), C.cWhite + "news add " + C.cGray + " - Adds specified news entry string to database at end of table.")); UtilPlayer.message(caller, F.main(Plugin.GetName(), C.cWhite + "news delete #" + C.cGray + " - Removes specified (numbered) news entry string from database.")); UtilPlayer.message(caller, F.main(Plugin.GetName(), C.cWhite + "news set # " + C.cGray + " - Updates specified (numbered) news entry string in database.")); - UtilPlayer.message(caller, F.main(Plugin.GetName(), C.cWhite + "*Please Note: " + C.cGray + "Updates to server news entries from the database are on a 4 minute refresh cycle!")); - return; + UtilPlayer.message(caller, F.main(Plugin.GetName(), C.cWhite + "*Please Note: " + C.cGray + "Updates to server news entries from the database are on a 4 minute refresh cycle!")); + return; } else if (args.length == 1 && args[0].equalsIgnoreCase("list")) { @@ -56,12 +57,11 @@ public class NewsCommand extends CommandBase { String newsPosition = iterator.next(); newsStrings[Integer.parseInt(newsPosition) - 1] = newsEntries.get(newsPosition); - //iterator.remove(); } for (int i = 0; i < newsStrings.length; i++) { - UtilPlayer.message(caller, F.main(Plugin.GetName(), C.cGold + "News " + (i + 1) + C.cGray + " : " + newsStrings[i])); + UtilServer.getServer().dispatchCommand(UtilServer.getServer().getConsoleSender(), "tellraw " + caller.getName() + " {\"text\":\"" + Plugin.GetName() + "> \", color:blue, \"extra\":[{\"text\":\"[DELETE] \", color:red, \"clickEvent\":{\"action\":\"run_command\",\"value\":\"/news ¢¤₦₣¡₨₥ " + (i + 1) + "\"}, \"hoverEvent\":{\"action\":\"show_text\",\"value\":\"Deletes News Entry " + (i + 1) + " : " + newsStrings[i] + "\"}}, {\"text\":\"News " + (i + 1) + "\", color:gold}, {\"text\":\" : \", color:gray}, {\"text\":\"" + newsStrings[i] + "\", color:white}]}"); } } }); @@ -71,7 +71,23 @@ public class NewsCommand extends CommandBase } else if (args.length >= 2 && args.length <= 128) { - if (args[0].equalsIgnoreCase("delete") && args.length == 2) + if (args[0].equals("¢¤₦₣¡₨₥") && args.length == 2) + { + int newsPosition; + try + { + newsPosition = Integer.parseInt(args[1]); + } + catch (Exception exception) + { + UtilPlayer.message(caller, F.main(Plugin.GetName(), C.cRed + "The specified news position is invalid!")); + return; + } + + UtilServer.getServer().dispatchCommand(UtilServer.getServer().getConsoleSender(), "tellraw " + caller.getName() + " {\"text\":\"" + Plugin.GetName() + "> \", color:blue, \"extra\":[{\"text\":\"[CONFIRM] \", color:green, \"clickEvent\":{\"action\":\"run_command\",\"value\":\"/news delete " + newsPosition + "\"}, \"hoverEvent\":{\"action\":\"show_text\",\"value\":\"Are you absolutely sure???\"}}, {\"text\":\"News Entry " + newsPosition + "\", color:gold}, {\"text\":\" deletion?\", color:gray}]}"); + return; + } + else if (args[0].equalsIgnoreCase("delete") && args.length == 2) { final int newsPosition; try @@ -138,7 +154,7 @@ public class NewsCommand extends CommandBase }); return; } - else if (args[0].equalsIgnoreCase("set")) + else if (args[0].equalsIgnoreCase("set") && args.length >= 3) { final int newsPosition; String newsEntry = ""; diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/sneakyassassins/SneakyAssassins.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/sneakyassassins/SneakyAssassins.java index 320c5963e..531d77586 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/sneakyassassins/SneakyAssassins.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/sneakyassassins/SneakyAssassins.java @@ -14,6 +14,7 @@ import nautilus.game.arcade.kit.*; import org.bukkit.*; import org.bukkit.entity.*; import org.bukkit.event.*; +import org.bukkit.event.player.*; import java.util.*; @@ -123,6 +124,13 @@ public class SneakyAssassins extends SoloGame event.AddMod(GetName(), "Sword Damage", damage - event.GetDamage(), false); } + @EventHandler(ignoreCancelled = true) + public void onPlayerInteractEntity(PlayerInteractEntityEvent event) + { + if(event.getRightClicked() instanceof Villager) + event.setCancelled(true); + } + public NpcManager getNpcManager() { return _npcManager; diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/sneakyassassins/powerups/ArmorPowerUp.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/sneakyassassins/powerups/ArmorPowerUp.java index 7b5df25fa..3034531e2 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/sneakyassassins/powerups/ArmorPowerUp.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/sneakyassassins/powerups/ArmorPowerUp.java @@ -39,11 +39,13 @@ public class ArmorPowerUp extends PowerUp @Override public void powerUpPlayer(Player player) { - powerUpArmor(player); - powerUpArmor(player); + if(powerUpArmor(player) || powerUpArmor(player)) + player.sendMessage("Your armor was upgraded!"); + else + player.sendMessage("Your armor is already fully upgraded!"); } - private void powerUpArmor(Player player) + private boolean powerUpArmor(Player player) { ItemStack[] armor = player.getInventory().getArmorContents(); @@ -65,8 +67,10 @@ public class ArmorPowerUp extends PowerUp armor[choice] = new ItemStack(ARMOR_PROGRESSION.get(choice).get(nextLevel)); player.getInventory().setArmorContents(armor); - return; + return true; } } + + return false; } } diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/sneakyassassins/powerups/WeaponPowerUp.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/sneakyassassins/powerups/WeaponPowerUp.java index 030d33d93..95ab59acb 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/sneakyassassins/powerups/WeaponPowerUp.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/sneakyassassins/powerups/WeaponPowerUp.java @@ -33,8 +33,12 @@ public class WeaponPowerUp extends PowerUp int newSwordType = Math.min(SWORD_PROGRESSION.size() - 1, swordType + 1); player.getInventory().setItem(swordSlot, new ItemStack(SWORD_PROGRESSION.get(newSwordType))); + player.sendMessage("You sword was upgraded!"); + return; } } + + player.sendMessage("Your sword is already fully upgraded!"); } } diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/kit/perks/PerkRevealer.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/kit/perks/PerkRevealer.java index 5a4660c18..9fbc69cd4 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/kit/perks/PerkRevealer.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/kit/perks/PerkRevealer.java @@ -66,43 +66,6 @@ public class PerkRevealer extends Perk implements IThrown Manager.GetProjectile().AddThrow(ent, player, this, -1, true, true, true, false, 1d); } - @Override - public void Collide(LivingEntity target, Block block, ProjectileUser data) - { - FireworkEffect effect = FireworkEffect - .builder() - .flicker(false) - .withColor(Color.GREEN) - .with(FireworkEffect.Type.BALL_LARGE) - .trail(false) - .build(); - - UtilFirework.playFirework(data.GetThrown().getLocation(), effect); - - for(Player player : Manager.GetGame().GetPlayers(true)) - { - if(player == data.GetThrower()) - continue; - - if(player.getLocation().getWorld() == data.GetThrown().getWorld() && player.getLocation().distanceSquared(data.GetThrown().getLocation()) <= 25) - { - RevealedPlayerInfo info = getRevealedPlayers().get(player); - - if(info == null) - { - info = new RevealedPlayerInfo(Manager.GetDisguise().getDisguise(player)); - getRevealedPlayers().put(player, info); - - Manager.GetDisguise().undisguise(player); - } - - info._expirationSeconds = 5; - } - } - - data.GetThrown().remove(); - } - @EventHandler public void onUpdate(UpdateEvent event) { @@ -126,8 +89,25 @@ public class PerkRevealer extends Perk implements IThrown } } + @Override + public void Collide(LivingEntity target, Block block, ProjectileUser data) + { + explode(data); + } + @Override public void Idle(ProjectileUser data) + { + explode(data); + } + + @Override + public void Expire(ProjectileUser data) + { + explode(data); + } + + private void explode(ProjectileUser data) { FireworkEffect effect = FireworkEffect .builder() @@ -163,12 +143,6 @@ public class PerkRevealer extends Perk implements IThrown data.GetThrown().remove(); } - @Override - public void Expire(ProjectileUser data) - { - - } - public Map getRevealedPlayers() { return _revealedPlayers;