diff --git a/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/ItemPaintballGun.java b/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/ItemPaintballGun.java index e1b1b6c39..68fba27a0 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/ItemPaintballGun.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/ItemPaintballGun.java @@ -18,9 +18,15 @@ import org.bukkit.event.EventHandler; import org.bukkit.event.entity.ProjectileHitEvent; import org.bukkit.event.player.PlayerTeleportEvent; import org.bukkit.event.player.PlayerTeleportEvent.TeleportCause; +import org.bukkit.util.Vector; import mineplex.core.common.util.C; import mineplex.core.common.util.UtilBlock; +import mineplex.core.common.util.UtilMath; +import mineplex.core.common.util.UtilParticle; +import mineplex.core.common.util.UtilParticle.ParticleType; +import mineplex.core.common.util.UtilParticle.ViewDist; +import mineplex.core.common.util.UtilServer; import mineplex.core.gadget.GadgetManager; import mineplex.core.gadget.event.GadgetBlockEvent; import mineplex.core.gadget.types.ItemGadget; @@ -30,16 +36,17 @@ import mineplex.core.updater.event.UpdateEvent; public class ItemPaintballGun extends ItemGadget { private HashSet _balls = new HashSet(); - - public ItemPaintballGun(GadgetManager manager) + + public ItemPaintballGun(GadgetManager manager) { - super(manager, "Paintball Gun", new String[] - { + super(manager, "Paintball Gun", new String[] + { C.cWhite + "PEW PEW PEW PEW!", - }, - -1, - Material.GOLD_BARDING, (byte)0, - 200, new Ammo("Paintball Gun", "100 Paintballs", Material.GOLD_BARDING, (byte)0, new String[] { C.cWhite + "100 Paintballs for you to shoot!" }, 500, 100)); + }, -1, Material.GOLD_BARDING, (byte) 0, 200, new Ammo("Paintball Gun", "100 Paintballs", Material.GOLD_BARDING, + (byte) 0, new String[] + { + C.cWhite + "100 Paintballs for you to shoot!" + }, 500, 100)); } @Override @@ -48,38 +55,56 @@ public class ItemPaintballGun extends ItemGadget Projectile proj = player.launchProjectile(EnderPearl.class); proj.setVelocity(proj.getVelocity().multiply(2)); _balls.add(proj); - - //Sound + + // Sound player.getWorld().playSound(player.getLocation(), Sound.CHICKEN_EGG_POP, 1.5f, 1.2f); } - + @EventHandler public void Paint(ProjectileHitEvent event) { if (!_balls.remove(event.getEntity())) return; - - Location loc = event.getEntity().getLocation().add(event.getEntity().getVelocity()); - loc.getWorld().playEffect(loc, Effect.STEP_SOUND, 49); + + Location loc = event.getEntity().getLocation(); + + Vector vec = event.getEntity().getVelocity().normalize().multiply(0.05); + + if (vec.length() > 0) + { + int i = 0; + + while (UtilBlock.airFoliage(loc.getBlock())) + { + loc.add(vec); + + if (i++ > 50) + break; + } + } + + loc.getWorld().playSound(loc, Sound.DIG_STONE, 1.3F, 1.3F); + + UtilParticle.PlayParticle(ParticleType.RED_DUST, loc, 0.2F, 0.2F, 0.2F, 1, 70, ViewDist.LONG, UtilServer.getPlayers()); } - + @EventHandler public void Teleport(PlayerTeleportEvent event) { if (event.getCause() == TeleportCause.ENDER_PEARL) event.setCancelled(true); } - + @EventHandler public void cleanupBalls(UpdateEvent event) { if (event.getType() != UpdateType.SLOW) return; - + for (Iterator ballIterator = _balls.iterator(); ballIterator.hasNext();) { Projectile ball = ballIterator.next(); - + if (ball.isDead() || !ball.isValid()) ballIterator.remove(); } diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/ArcadeManager.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/ArcadeManager.java index cc264d1e6..5aeba4d0c 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/ArcadeManager.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/ArcadeManager.java @@ -849,8 +849,11 @@ public class ArcadeManager extends MiniPlugin implements IRelation { // Give developers operator on their servers boolean testServer = _plugin.getConfig().getString("serverstatus.group").equalsIgnoreCase("Testing"); - - if (_clientManager.Get(event.getPlayer()).GetRank().Has(Rank.OWNER) || (testServer && (_clientManager.Get(event.getPlayer()).GetRank().Has(Rank.DEVELOPER) || _clientManager.Get(event.getPlayer()).GetRank() == Rank.JNR_DEV))) + boolean eventTestServer = _plugin.getConfig().getString("serverstatus.name").equalsIgnoreCase("SMTestServer-1"); + + if (_clientManager.Get(event.getPlayer()).GetRank().Has(Rank.OWNER) + || (testServer && (_clientManager.Get(event.getPlayer()).GetRank().Has(Rank.DEVELOPER) || _clientManager.Get(event.getPlayer()).GetRank() == Rank.JNR_DEV)) + || eventTestServer && _clientManager.Get(event.getPlayer()).GetRank().Has(Rank.JNR_DEV)) event.getPlayer().setOp(true); else event.getPlayer().setOp(false); diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/event/EventModule.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/event/EventModule.java index 6b77dd967..83c0c0801 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/event/EventModule.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/event/EventModule.java @@ -82,7 +82,11 @@ public class EventModule extends MiniPlugin if (!event.getMessage().toLowerCase().startsWith("/sethost ")) return; - if (!Manager.GetClients().Get(event.getPlayer()).GetRank().Has(event.getPlayer(), Rank.JNR_DEV, true)) + boolean eventTestServer = _plugin.getConfig().getString("serverstatus.name").equalsIgnoreCase("SMTestServer-1"); + + if (!Manager.GetClients().Get(event.getPlayer()).GetRank().Has(event.getPlayer(), Rank.JNR_DEV, true) + && !event.getPlayer().isOp() && + (!eventTestServer && !Manager.GetClients().Get(event.getPlayer()).GetRank().Has(event.getPlayer(), Rank.SNR_MODERATOR, true))) return; Manager.GetServerConfig().HostName = event.getMessage().split(" ")[1]; @@ -177,7 +181,9 @@ public class EventModule extends MiniPlugin if (!event.getMessage().toLowerCase().startsWith("/e ")) return; - if(!Manager.GetGameHostManager().isEventServer()) + boolean eventTestServer = _plugin.getConfig().getString("serverstatus.name").equalsIgnoreCase("SMTestServer-1"); + + if(!Manager.GetGameHostManager().isEventServer() && !eventTestServer) return; event.setCancelled(true); diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/managers/GameHostManager.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/managers/GameHostManager.java index 20a10ed71..a5f9fab74 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/managers/GameHostManager.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/managers/GameHostManager.java @@ -378,7 +378,7 @@ public class GameHostManager implements Listener if (!isPrivateServer()) return; - if (!Manager.GetClients().Get(event.getPlayer()).GetRank().Has(event.getPlayer(), Rank.JNR_DEV, true)) + if (!Manager.GetClients().Get(event.getPlayer()).GetRank().Has(event.getPlayer(), Rank.JNR_DEV, true) && !event.getPlayer().isOp()) return; giveAdmin(event.getPlayer()); @@ -717,57 +717,66 @@ public class GameHostManager implements Listener if (!event.getMessage().toLowerCase().startsWith("/e set ") && !event.getMessage().toLowerCase().equals("/e set")) return; + Player caller = event.getPlayer(); String[] args = event.getMessage().split(" "); - //Parse Game - if (args.length >= 3) - { - ArrayList matches = new ArrayList(); - for (GameType type : GameType.values()) - { - if (type.toString().toLowerCase().equals(args[2])) - { - matches.clear(); - matches.add(type); - break; - } - - if (type.toString().toLowerCase().contains(args[2])) - { - matches.add(type); - } - } - - if (matches.size() == 0) - { - event.getPlayer().sendMessage("No results for: " + args[2]); - return; - } - - if (matches.size() > 1) - { - event.getPlayer().sendMessage("Matched multiple games;"); - for (GameType cur : matches) - event.getPlayer().sendMessage(cur.toString()); - return; - } - - GameType type = matches.get(0); - Manager.GetGame().setGame(type, event.getPlayer(), true); - } - else - { - Manager.GetGame().setGame(GameType.Event, event.getPlayer(), true); - } + String game = args[2].toLowerCase(); - - //Map Pref if (args.length >= 4) { - Manager.GetGameCreationManager().MapPref = args[3]; - UtilPlayer.message(event.getPlayer(), C.cAqua + C.Bold + "Map Preference: " + ChatColor.RESET + args[2]); + String map = ""; + String source = ""; + if(args.length == 5) + { + Manager.GetGameCreationManager().MapSource = args[3]; + Manager.GetGameCreationManager().MapPref = args[4]; + source = args[3]; + map = args[4]; + } + else + { + Manager.GetGameCreationManager().MapSource = args[2]; + Manager.GetGameCreationManager().MapPref = args[3]; + source = args[2]; + map = args[3]; + } + UtilPlayer.message(caller, C.cAqua + C.Bold + "Map Preference: " + ChatColor.RESET + source + ":" + map); } + //Parse Game + ArrayList matches = new ArrayList<>(); + for (GameType type : GameType.values()) + { + if (type.toString().toLowerCase().equals(game)) + { + matches.clear(); + matches.add(type); + break; + } + + if (type.toString().toLowerCase().contains(game)) + { + matches.add(type); + } + } + + if (matches.size() == 0) + { + caller.sendMessage("No results for: " + game); + return; + } + + if (matches.size() > 1) + { + caller.sendMessage("Matched multiple games;"); + for (GameType cur : matches) + caller.sendMessage(cur.toString()); + return; + } + + GameType type = matches.get(0); + Manager.GetGame().setGame(type, event.getPlayer(), true); + event.setCancelled(true); }