Merge remote-tracking branch 'remotes/origin/master' into Bonus

This commit is contained in:
Shaun Bennett 2015-08-12 00:56:04 -05:00
commit 8e4ae35256
4 changed files with 110 additions and 67 deletions

View File

@ -18,9 +18,15 @@ import org.bukkit.event.EventHandler;
import org.bukkit.event.entity.ProjectileHitEvent; import org.bukkit.event.entity.ProjectileHitEvent;
import org.bukkit.event.player.PlayerTeleportEvent; import org.bukkit.event.player.PlayerTeleportEvent;
import org.bukkit.event.player.PlayerTeleportEvent.TeleportCause; import org.bukkit.event.player.PlayerTeleportEvent.TeleportCause;
import org.bukkit.util.Vector;
import mineplex.core.common.util.C; import mineplex.core.common.util.C;
import mineplex.core.common.util.UtilBlock; 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.GadgetManager;
import mineplex.core.gadget.event.GadgetBlockEvent; import mineplex.core.gadget.event.GadgetBlockEvent;
import mineplex.core.gadget.types.ItemGadget; import mineplex.core.gadget.types.ItemGadget;
@ -30,16 +36,17 @@ import mineplex.core.updater.event.UpdateEvent;
public class ItemPaintballGun extends ItemGadget public class ItemPaintballGun extends ItemGadget
{ {
private HashSet<Projectile> _balls = new HashSet<Projectile>(); private HashSet<Projectile> _balls = new HashSet<Projectile>();
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!", C.cWhite + "PEW PEW PEW PEW!",
}, }, -1, Material.GOLD_BARDING, (byte) 0, 200, new Ammo("Paintball Gun", "100 Paintballs", Material.GOLD_BARDING,
-1, (byte) 0, new String[]
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)); C.cWhite + "100 Paintballs for you to shoot!"
}, 500, 100));
} }
@Override @Override
@ -48,38 +55,56 @@ public class ItemPaintballGun extends ItemGadget
Projectile proj = player.launchProjectile(EnderPearl.class); Projectile proj = player.launchProjectile(EnderPearl.class);
proj.setVelocity(proj.getVelocity().multiply(2)); proj.setVelocity(proj.getVelocity().multiply(2));
_balls.add(proj); _balls.add(proj);
//Sound // Sound
player.getWorld().playSound(player.getLocation(), Sound.CHICKEN_EGG_POP, 1.5f, 1.2f); player.getWorld().playSound(player.getLocation(), Sound.CHICKEN_EGG_POP, 1.5f, 1.2f);
} }
@EventHandler @EventHandler
public void Paint(ProjectileHitEvent event) public void Paint(ProjectileHitEvent event)
{ {
if (!_balls.remove(event.getEntity())) if (!_balls.remove(event.getEntity()))
return; return;
Location loc = event.getEntity().getLocation().add(event.getEntity().getVelocity()); Location loc = event.getEntity().getLocation();
loc.getWorld().playEffect(loc, Effect.STEP_SOUND, 49);
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 @EventHandler
public void Teleport(PlayerTeleportEvent event) public void Teleport(PlayerTeleportEvent event)
{ {
if (event.getCause() == TeleportCause.ENDER_PEARL) if (event.getCause() == TeleportCause.ENDER_PEARL)
event.setCancelled(true); event.setCancelled(true);
} }
@EventHandler @EventHandler
public void cleanupBalls(UpdateEvent event) public void cleanupBalls(UpdateEvent event)
{ {
if (event.getType() != UpdateType.SLOW) if (event.getType() != UpdateType.SLOW)
return; return;
for (Iterator<Projectile> ballIterator = _balls.iterator(); ballIterator.hasNext();) for (Iterator<Projectile> ballIterator = _balls.iterator(); ballIterator.hasNext();)
{ {
Projectile ball = ballIterator.next(); Projectile ball = ballIterator.next();
if (ball.isDead() || !ball.isValid()) if (ball.isDead() || !ball.isValid())
ballIterator.remove(); ballIterator.remove();
} }

View File

@ -849,8 +849,11 @@ public class ArcadeManager extends MiniPlugin implements IRelation
{ {
// Give developers operator on their servers // Give developers operator on their servers
boolean testServer = _plugin.getConfig().getString("serverstatus.group").equalsIgnoreCase("Testing"); boolean testServer = _plugin.getConfig().getString("serverstatus.group").equalsIgnoreCase("Testing");
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)))
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); event.getPlayer().setOp(true);
else else
event.getPlayer().setOp(false); event.getPlayer().setOp(false);

View File

@ -82,7 +82,11 @@ public class EventModule extends MiniPlugin
if (!event.getMessage().toLowerCase().startsWith("/sethost ")) if (!event.getMessage().toLowerCase().startsWith("/sethost "))
return; 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; return;
Manager.GetServerConfig().HostName = event.getMessage().split(" ")[1]; Manager.GetServerConfig().HostName = event.getMessage().split(" ")[1];
@ -177,7 +181,9 @@ public class EventModule extends MiniPlugin
if (!event.getMessage().toLowerCase().startsWith("/e ")) if (!event.getMessage().toLowerCase().startsWith("/e "))
return; return;
if(!Manager.GetGameHostManager().isEventServer()) boolean eventTestServer = _plugin.getConfig().getString("serverstatus.name").equalsIgnoreCase("SMTestServer-1");
if(!Manager.GetGameHostManager().isEventServer() && !eventTestServer)
return; return;
event.setCancelled(true); event.setCancelled(true);

View File

@ -378,7 +378,7 @@ public class GameHostManager implements Listener
if (!isPrivateServer()) if (!isPrivateServer())
return; 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; return;
giveAdmin(event.getPlayer()); 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")) if (!event.getMessage().toLowerCase().startsWith("/e set ") && !event.getMessage().toLowerCase().equals("/e set"))
return; return;
Player caller = event.getPlayer();
String[] args = event.getMessage().split(" "); String[] args = event.getMessage().split(" ");
//Parse Game String game = args[2].toLowerCase();
if (args.length >= 3)
{
ArrayList<GameType> matches = new ArrayList<GameType>();
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);
}
//Map Pref
if (args.length >= 4) if (args.length >= 4)
{ {
Manager.GetGameCreationManager().MapPref = args[3]; String map = "";
UtilPlayer.message(event.getPlayer(), C.cAqua + C.Bold + "Map Preference: " + ChatColor.RESET + args[2]); 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<GameType> 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); event.setCancelled(true);
} }