Allowed commands to specify specific ranks
allowed youtube/build to start/set games
This commit is contained in:
parent
ac088e85b2
commit
97c087a28d
@ -35,11 +35,29 @@ public enum Rank
|
|||||||
}
|
}
|
||||||
|
|
||||||
public boolean Has(Player player, Rank rank, boolean inform)
|
public boolean Has(Player player, Rank rank, boolean inform)
|
||||||
|
{
|
||||||
|
return Has(player, rank, null, inform);
|
||||||
|
}
|
||||||
|
|
||||||
|
public boolean Has(Player player, Rank rank, Rank[] specific, boolean inform)
|
||||||
{
|
{
|
||||||
if (player != null)
|
if (player != null)
|
||||||
if (player.getName().equals("Chiss"))
|
if (player.getName().equals("Chiss"))
|
||||||
return true;
|
return true;
|
||||||
|
|
||||||
|
//Specific Rank
|
||||||
|
if (specific != null)
|
||||||
|
{
|
||||||
|
for (Rank curRank : specific)
|
||||||
|
{
|
||||||
|
if (compareTo(curRank) == 0)
|
||||||
|
{
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
//
|
||||||
if (compareTo(rank) <= 0)
|
if (compareTo(rank) <= 0)
|
||||||
return true;
|
return true;
|
||||||
|
|
||||||
|
@ -118,7 +118,7 @@ public class BlockRestore extends MiniPlugin
|
|||||||
return;
|
return;
|
||||||
|
|
||||||
//No Snow on Ice
|
//No Snow on Ice
|
||||||
if (block.getRelative(BlockFace.DOWN).getTypeId() == 79)
|
if (block.getRelative(BlockFace.DOWN).getTypeId() == 79 || block.getRelative(BlockFace.DOWN).getTypeId() == 174)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
//No Snow on Slabs
|
//No Snow on Slabs
|
||||||
@ -130,8 +130,8 @@ public class BlockRestore extends MiniPlugin
|
|||||||
return;
|
return;
|
||||||
|
|
||||||
//No Snow on Fence or Walls
|
//No Snow on Fence or Walls
|
||||||
if (block.getRelative(BlockFace.DOWN).getTypeId() == 85 ||
|
if (block.getRelative(BlockFace.DOWN).getType().name().toLowerCase().contains("fence") ||
|
||||||
block.getRelative(BlockFace.DOWN).getTypeId() == 139)
|
block.getRelative(BlockFace.DOWN).getType().name().toLowerCase().contains("wall"))
|
||||||
return;
|
return;
|
||||||
|
|
||||||
//Not Buildable
|
//Not Buildable
|
||||||
|
@ -10,6 +10,8 @@ import mineplex.core.common.Rank;
|
|||||||
public abstract class CommandBase<PluginType extends MiniPlugin> implements ICommand
|
public abstract class CommandBase<PluginType extends MiniPlugin> implements ICommand
|
||||||
{
|
{
|
||||||
private Rank _requiredRank;
|
private Rank _requiredRank;
|
||||||
|
private Rank[] _specificRank;
|
||||||
|
|
||||||
private List<String> _aliases;
|
private List<String> _aliases;
|
||||||
|
|
||||||
protected PluginType Plugin;
|
protected PluginType Plugin;
|
||||||
@ -23,6 +25,15 @@ public abstract class CommandBase<PluginType extends MiniPlugin> implements ICom
|
|||||||
_aliases = Arrays.asList(aliases);
|
_aliases = Arrays.asList(aliases);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public CommandBase(PluginType plugin, Rank requiredRank, Rank[] specificRank, String...aliases)
|
||||||
|
{
|
||||||
|
Plugin = plugin;
|
||||||
|
_requiredRank = requiredRank;
|
||||||
|
_specificRank = specificRank;
|
||||||
|
|
||||||
|
_aliases = Arrays.asList(aliases);
|
||||||
|
}
|
||||||
|
|
||||||
public Collection<String> Aliases()
|
public Collection<String> Aliases()
|
||||||
{
|
{
|
||||||
return _aliases;
|
return _aliases;
|
||||||
@ -38,6 +49,11 @@ public abstract class CommandBase<PluginType extends MiniPlugin> implements ICom
|
|||||||
return _requiredRank;
|
return _requiredRank;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public Rank[] GetSpecificRanks()
|
||||||
|
{
|
||||||
|
return _specificRank;
|
||||||
|
}
|
||||||
|
|
||||||
public void SetCommandCenter(CommandCenter commandCenter)
|
public void SetCommandCenter(CommandCenter commandCenter)
|
||||||
{
|
{
|
||||||
CommandCenter = commandCenter;
|
CommandCenter = commandCenter;
|
||||||
|
@ -55,7 +55,7 @@ public class CommandCenter implements Listener
|
|||||||
|
|
||||||
ICommand command = Commands.get(commandName.toLowerCase());
|
ICommand command = Commands.get(commandName.toLowerCase());
|
||||||
|
|
||||||
if (command != null && ClientManager.Get(event.getPlayer()).GetRank().Has(event.getPlayer(), command.GetRequiredRank(), true))
|
if (command != null && ClientManager.Get(event.getPlayer()).GetRank().Has(event.getPlayer(), command.GetRequiredRank(), command.GetSpecificRanks(), true))
|
||||||
{
|
{
|
||||||
if (!Recharge.Instance.use(event.getPlayer(), "Command", 500, false, false))
|
if (!Recharge.Instance.use(event.getPlayer(), "Command", 500, false, false))
|
||||||
{
|
{
|
||||||
|
@ -16,4 +16,5 @@ public interface ICommand
|
|||||||
void SetAliasUsed(String name);
|
void SetAliasUsed(String name);
|
||||||
|
|
||||||
Rank GetRequiredRank();
|
Rank GetRequiredRank();
|
||||||
|
Rank[] GetSpecificRanks();
|
||||||
}
|
}
|
||||||
|
@ -17,6 +17,13 @@ public abstract class MultiCommandBase<PluginType extends MiniPlugin> extends Co
|
|||||||
Commands = new NautHashMap<String, ICommand>();
|
Commands = new NautHashMap<String, ICommand>();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public MultiCommandBase(PluginType plugin, Rank rank, Rank[] specificRanks, String...aliases)
|
||||||
|
{
|
||||||
|
super(plugin, rank, specificRanks, aliases);
|
||||||
|
|
||||||
|
Commands = new NautHashMap<String, ICommand>();
|
||||||
|
}
|
||||||
|
|
||||||
public void AddCommand(ICommand command)
|
public void AddCommand(ICommand command)
|
||||||
{
|
{
|
||||||
for (String commandRoot : command.Aliases())
|
for (String commandRoot : command.Aliases())
|
||||||
@ -48,7 +55,7 @@ public abstract class MultiCommandBase<PluginType extends MiniPlugin> extends Co
|
|||||||
|
|
||||||
ICommand command = Commands.get(commandName);
|
ICommand command = Commands.get(commandName);
|
||||||
|
|
||||||
if (command != null && CommandCenter.ClientManager.Get(caller).GetRank().Has(caller, command.GetRequiredRank(), true))
|
if (command != null && CommandCenter.ClientManager.Get(caller).GetRank().Has(caller, command.GetRequiredRank(), command.GetSpecificRanks(), true))
|
||||||
{
|
{
|
||||||
command.SetAliasUsed(commandName);
|
command.SetAliasUsed(commandName);
|
||||||
|
|
||||||
|
@ -40,7 +40,7 @@ public class AdminMountManager extends MiniPlugin
|
|||||||
public void AddCommands()
|
public void AddCommands()
|
||||||
{
|
{
|
||||||
AddCommand(new HorseSpawn(this));
|
AddCommand(new HorseSpawn(this));
|
||||||
}
|
}
|
||||||
|
|
||||||
@EventHandler
|
@EventHandler
|
||||||
public void HorseInteract(PlayerInteractEntityEvent event)
|
public void HorseInteract(PlayerInteractEntityEvent event)
|
||||||
|
@ -89,6 +89,7 @@ public class ParkourManager extends MiniPlugin
|
|||||||
}, 4000, new Location(Manager.GetSpawn().getWorld(), -93,67,38),
|
}, 4000, new Location(Manager.GetSpawn().getWorld(), -93,67,38),
|
||||||
new Location(Manager.GetSpawn().getWorld(), -86,100,42), new Location(Manager.GetSpawn().getWorld(), -120,50,-17)));
|
new Location(Manager.GetSpawn().getWorld(), -86,100,42), new Location(Manager.GetSpawn().getWorld(), -120,50,-17)));
|
||||||
|
|
||||||
|
/*
|
||||||
_parkour.add(new ParkourSnake("Snake Parkour", new String[]
|
_parkour.add(new ParkourSnake("Snake Parkour", new String[]
|
||||||
{
|
{
|
||||||
"This parkour requires incredible timing",
|
"This parkour requires incredible timing",
|
||||||
@ -96,7 +97,7 @@ public class ParkourManager extends MiniPlugin
|
|||||||
"by the devil as a cruel joke!"
|
"by the devil as a cruel joke!"
|
||||||
}, 8000, new Location(Manager.GetSpawn().getWorld(), 22,70,-54),
|
}, 8000, new Location(Manager.GetSpawn().getWorld(), 22,70,-54),
|
||||||
new Location(Manager.GetSpawn().getWorld(), 28,-50,-88), new Location(Manager.GetSpawn().getWorld(), -24,90,-46)));
|
new Location(Manager.GetSpawn().getWorld(), 28,-50,-88), new Location(Manager.GetSpawn().getWorld(), -24,90,-46)));
|
||||||
|
*/
|
||||||
_lavaParkourReturn = new Location(Manager.GetSpawn().getWorld(), -89.5,68,36.5);
|
_lavaParkourReturn = new Location(Manager.GetSpawn().getWorld(), -89.5,68,36.5);
|
||||||
_lavaParkourReturn.setYaw(90);
|
_lavaParkourReturn.setYaw(90);
|
||||||
|
|
||||||
|
@ -69,7 +69,7 @@ public class WorldManager extends MiniPlugin
|
|||||||
Manager = manager;
|
Manager = manager;
|
||||||
}
|
}
|
||||||
|
|
||||||
@EventHandler
|
//@EventHandler
|
||||||
public void SpawnAnimals(UpdateEvent event)
|
public void SpawnAnimals(UpdateEvent event)
|
||||||
{
|
{
|
||||||
if (event.getType() != UpdateType.SLOW)
|
if (event.getType() != UpdateType.SLOW)
|
||||||
|
@ -56,8 +56,6 @@ public class ParkourSnake extends ParkourData
|
|||||||
{
|
{
|
||||||
e.printStackTrace();
|
e.printStackTrace();
|
||||||
}
|
}
|
||||||
|
|
||||||
System.out.println("Done");
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public SnakePart loadSnake(String locString)
|
public SnakePart loadSnake(String locString)
|
||||||
@ -207,6 +205,9 @@ public class ParkourSnake extends ParkourData
|
|||||||
|
|
||||||
public void Update()
|
public void Update()
|
||||||
{
|
{
|
||||||
|
if (_snakes == null)
|
||||||
|
return;
|
||||||
|
|
||||||
for (SnakePart snake : _snakes)
|
for (SnakePart snake : _snakes)
|
||||||
snake.Update();
|
snake.Update();
|
||||||
}
|
}
|
||||||
|
@ -10,7 +10,7 @@ public class GameCommand extends MultiCommandBase<ArcadeManager>
|
|||||||
{
|
{
|
||||||
public GameCommand(ArcadeManager plugin)
|
public GameCommand(ArcadeManager plugin)
|
||||||
{
|
{
|
||||||
super(plugin, Rank.ADMIN, "game");
|
super(plugin, Rank.ADMIN, new Rank[] {Rank.YOUTUBE, Rank.MAPDEV}, "game");
|
||||||
|
|
||||||
AddCommand(new StartCommand(Plugin));
|
AddCommand(new StartCommand(Plugin));
|
||||||
AddCommand(new StopCommand(Plugin));
|
AddCommand(new StopCommand(Plugin));
|
||||||
|
@ -12,22 +12,22 @@ import mineplex.core.common.Rank;
|
|||||||
import mineplex.core.common.util.C;
|
import mineplex.core.common.util.C;
|
||||||
|
|
||||||
public class SetCommand extends CommandBase<ArcadeManager>
|
public class SetCommand extends CommandBase<ArcadeManager>
|
||||||
{
|
{
|
||||||
public SetCommand(ArcadeManager plugin)
|
public SetCommand(ArcadeManager plugin)
|
||||||
{
|
{
|
||||||
super(plugin, Rank.ADMIN, "set");
|
super(plugin, Rank.ADMIN, new Rank[] {Rank.YOUTUBE, Rank.MAPDEV}, "set");
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void Execute(Player caller, String[] args)
|
public void Execute(Player caller, String[] args)
|
||||||
{
|
{
|
||||||
if (Plugin.GetGame() == null)
|
if (Plugin.GetGame() == null)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
if (args.length == 0)
|
if (args.length == 0)
|
||||||
{
|
{
|
||||||
caller.sendMessage("/game set <GameType> (Map)");
|
caller.sendMessage("/game set <GameType> (Map)");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
String game = args[0].toLowerCase();
|
String game = args[0].toLowerCase();
|
||||||
|
@ -12,7 +12,7 @@ public class StartCommand extends CommandBase<ArcadeManager>
|
|||||||
{
|
{
|
||||||
public StartCommand(ArcadeManager plugin)
|
public StartCommand(ArcadeManager plugin)
|
||||||
{
|
{
|
||||||
super(plugin, Rank.ADMIN, "start");
|
super(plugin, Rank.ADMIN, new Rank[] {Rank.YOUTUBE, Rank.MAPDEV}, "start");
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@ -30,7 +30,7 @@ public class StartCommand extends CommandBase<ArcadeManager>
|
|||||||
int seconds;
|
int seconds;
|
||||||
if(args != null && args.length > 0)
|
if(args != null && args.length > 0)
|
||||||
seconds = Integer.parseInt(args[0]);
|
seconds = Integer.parseInt(args[0]);
|
||||||
else
|
else
|
||||||
seconds = 10;
|
seconds = 10;
|
||||||
|
|
||||||
Plugin.GetGameManager().StateCountdown(Plugin.GetGame(), seconds, true);
|
Plugin.GetGameManager().StateCountdown(Plugin.GetGame(), seconds, true);
|
||||||
|
@ -1,10 +1,13 @@
|
|||||||
package nautilus.game.arcade.game.games.deathtag;
|
package nautilus.game.arcade.game.games.deathtag;
|
||||||
|
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
|
import java.util.Collections;
|
||||||
|
|
||||||
import org.bukkit.Bukkit;
|
import org.bukkit.Bukkit;
|
||||||
import org.bukkit.ChatColor;
|
import org.bukkit.ChatColor;
|
||||||
import org.bukkit.Location;
|
import org.bukkit.Location;
|
||||||
|
import org.bukkit.Material;
|
||||||
|
import org.bukkit.entity.EntityType;
|
||||||
import org.bukkit.entity.Player;
|
import org.bukkit.entity.Player;
|
||||||
import org.bukkit.event.EventHandler;
|
import org.bukkit.event.EventHandler;
|
||||||
import org.bukkit.event.entity.PlayerDeathEvent;
|
import org.bukkit.event.entity.PlayerDeathEvent;
|
||||||
@ -25,6 +28,7 @@ import nautilus.game.arcade.game.GameTeam;
|
|||||||
import nautilus.game.arcade.game.SoloGame;
|
import nautilus.game.arcade.game.SoloGame;
|
||||||
import nautilus.game.arcade.game.GameTeam.PlayerState;
|
import nautilus.game.arcade.game.GameTeam.PlayerState;
|
||||||
import nautilus.game.arcade.game.games.deathtag.kits.*;
|
import nautilus.game.arcade.game.games.deathtag.kits.*;
|
||||||
|
import nautilus.game.arcade.game.games.sneakyassassins.powerups.PowerUpManager;
|
||||||
import nautilus.game.arcade.kit.Kit;
|
import nautilus.game.arcade.kit.Kit;
|
||||||
import nautilus.game.arcade.kit.NullKit;
|
import nautilus.game.arcade.kit.NullKit;
|
||||||
|
|
||||||
@ -36,6 +40,8 @@ public class DeathTag extends SoloGame
|
|||||||
private NautHashMap<Player, Location> _deathLocation = new NautHashMap<Player, Location>();
|
private NautHashMap<Player, Location> _deathLocation = new NautHashMap<Player, Location>();
|
||||||
|
|
||||||
private int _currentSpeed = -1;
|
private int _currentSpeed = -1;
|
||||||
|
|
||||||
|
private ArrayList<Location> _lights = new ArrayList<Location>();
|
||||||
|
|
||||||
public DeathTag(ArcadeManager manager)
|
public DeathTag(ArcadeManager manager)
|
||||||
{
|
{
|
||||||
@ -65,6 +71,20 @@ public class DeathTag extends SoloGame
|
|||||||
|
|
||||||
this.PrepareFreeze = false;
|
this.PrepareFreeze = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void ParseData()
|
||||||
|
{
|
||||||
|
_lights = this.WorldData.GetCustomLocs("89");
|
||||||
|
|
||||||
|
for (Location loc : _lights)
|
||||||
|
{
|
||||||
|
if (Math.random() > 0.5)
|
||||||
|
loc.getBlock().setType(Material.GOLD_BLOCK);
|
||||||
|
else
|
||||||
|
loc.getBlock().setTypeIdAndData(35, (byte)15, false);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void RestrictKits()
|
public void RestrictKits()
|
||||||
@ -110,6 +130,25 @@ public class DeathTag extends SoloGame
|
|||||||
{
|
{
|
||||||
return _runners;
|
return _runners;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@EventHandler
|
||||||
|
public void UpdateLights(UpdateEvent event)
|
||||||
|
{
|
||||||
|
if (!IsLive())
|
||||||
|
return;
|
||||||
|
|
||||||
|
if (event.getType() != UpdateType.SEC)
|
||||||
|
return;
|
||||||
|
|
||||||
|
for (Location loc : _lights)
|
||||||
|
{
|
||||||
|
if (loc.getBlock().getType() == Material.GOLD_BLOCK)
|
||||||
|
loc.getBlock().setTypeIdAndData(35, (byte)15, false);
|
||||||
|
else
|
||||||
|
loc.getBlock().setType(Material.GOLD_BLOCK);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
@EventHandler
|
@EventHandler
|
||||||
public void UpdateSpeed(UpdateEvent event)
|
public void UpdateSpeed(UpdateEvent event)
|
||||||
|
@ -2,6 +2,8 @@ package nautilus.game.arcade.game.games.dragonescape;
|
|||||||
|
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.HashMap;
|
import java.util.HashMap;
|
||||||
|
import java.util.Iterator;
|
||||||
|
import java.util.Set;
|
||||||
|
|
||||||
import org.bukkit.Bukkit;
|
import org.bukkit.Bukkit;
|
||||||
import org.bukkit.ChatColor;
|
import org.bukkit.ChatColor;
|
||||||
@ -11,6 +13,8 @@ import org.bukkit.Location;
|
|||||||
import org.bukkit.Material;
|
import org.bukkit.Material;
|
||||||
import org.bukkit.Sound;
|
import org.bukkit.Sound;
|
||||||
import org.bukkit.FireworkEffect.Type;
|
import org.bukkit.FireworkEffect.Type;
|
||||||
|
import org.bukkit.block.Block;
|
||||||
|
import org.bukkit.block.BlockFace;
|
||||||
import org.bukkit.entity.EnderDragon;
|
import org.bukkit.entity.EnderDragon;
|
||||||
import org.bukkit.entity.Entity;
|
import org.bukkit.entity.Entity;
|
||||||
import org.bukkit.entity.Player;
|
import org.bukkit.entity.Player;
|
||||||
@ -171,18 +175,38 @@ public class DragonEscapeTeams extends TeamGame
|
|||||||
|
|
||||||
@EventHandler
|
@EventHandler
|
||||||
public void MoveDragon(UpdateEvent event)
|
public void MoveDragon(UpdateEvent event)
|
||||||
{
|
{
|
||||||
if (event.getType() != UpdateType.TICK)
|
if (event.getType() != UpdateType.TICK)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
if (_dragonData == null)
|
if (_dragonData == null)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
_dragonData.Target = _waypoints.get(Math.min(_waypoints.size()-1, (GetWaypointIndex(_dragonData.Location) + 1)));
|
_dragonData.Target = _waypoints.get(Math.min(_waypoints.size()-1, (GetWaypointIndex(_dragonData.Location) + 1)));
|
||||||
|
|
||||||
_dragonData.Move();
|
_dragonData.Move();
|
||||||
|
|
||||||
|
Set<Block> blocks = UtilBlock.getInRadius(_dragonData.Location, 10d).keySet();
|
||||||
|
|
||||||
|
Iterator<Block> blockIterator = blocks.iterator();
|
||||||
|
while (blockIterator.hasNext())
|
||||||
|
{
|
||||||
|
Block block = blockIterator.next();
|
||||||
|
|
||||||
|
if (block.isLiquid())
|
||||||
|
blockIterator.remove();
|
||||||
|
|
||||||
|
else if (block.getRelative(BlockFace.UP).isLiquid())
|
||||||
|
blockIterator.remove();
|
||||||
|
|
||||||
Manager.GetExplosion().BlockExplosion(UtilBlock.getInRadius(_dragonData.Location, 10d).keySet(), _dragonData.Location, false);
|
else if (WorldData.MapName.contains("Hell") && block.getY() < 30)
|
||||||
|
blockIterator.remove();
|
||||||
|
|
||||||
|
else if (WorldData.MapName.contains("Pirate") && (block.getY() < 6))
|
||||||
|
blockIterator.remove();
|
||||||
|
}
|
||||||
|
|
||||||
|
Manager.GetExplosion().BlockExplosion(blocks, _dragonData.Location, false);
|
||||||
}
|
}
|
||||||
|
|
||||||
@EventHandler
|
@EventHandler
|
||||||
|
@ -62,8 +62,11 @@ public class Micro extends TeamGame
|
|||||||
public void ParseData()
|
public void ParseData()
|
||||||
{
|
{
|
||||||
for (Location loc : WorldData.GetCustomLocs("20"))
|
for (Location loc : WorldData.GetCustomLocs("20"))
|
||||||
|
{
|
||||||
_glass.add(loc.getBlock());
|
_glass.add(loc.getBlock());
|
||||||
|
loc.getBlock().setType(Material.STAINED_GLASS);
|
||||||
|
}
|
||||||
|
|
||||||
for (int y= WorldData.MinY ; y < WorldData.MaxY ; y++)
|
for (int y= WorldData.MinY ; y < WorldData.MaxY ; y++)
|
||||||
for (int x= WorldData.MinX ; x < WorldData.MaxX ; x++)
|
for (int x= WorldData.MinX ; x < WorldData.MaxX ; x++)
|
||||||
for (int z= WorldData.MinZ ; z < WorldData.MaxZ ; z++)
|
for (int z= WorldData.MinZ ; z < WorldData.MaxZ ; z++)
|
||||||
|
@ -32,10 +32,9 @@ import nautilus.game.arcade.kit.Kit;
|
|||||||
public class QuiverTeams extends TeamGame
|
public class QuiverTeams extends TeamGame
|
||||||
{
|
{
|
||||||
private HashMap<GameTeam, Integer> _teamKills = new HashMap<GameTeam, Integer>();
|
private HashMap<GameTeam, Integer> _teamKills = new HashMap<GameTeam, Integer>();
|
||||||
private ArrayList<String> _lastScoreboard = new ArrayList<String>();
|
|
||||||
private HashMap<Player, Long> _deathTime = new HashMap<Player, Long>();
|
private HashMap<Player, Long> _deathTime = new HashMap<Player, Long>();
|
||||||
|
|
||||||
private int _reqKills = 100;
|
private int _reqKills = 6;
|
||||||
|
|
||||||
public QuiverTeams(ArcadeManager manager)
|
public QuiverTeams(ArcadeManager manager)
|
||||||
{
|
{
|
||||||
@ -52,7 +51,7 @@ public class QuiverTeams extends TeamGame
|
|||||||
"Bow and Arrow insta-kills.",
|
"Bow and Arrow insta-kills.",
|
||||||
"You receive 1 Arrow per kill.",
|
"You receive 1 Arrow per kill.",
|
||||||
"Glass blocks are breakable",
|
"Glass blocks are breakable",
|
||||||
"First team to 100 kills wins."
|
"First team to 60 kills wins."
|
||||||
});
|
});
|
||||||
|
|
||||||
this.HungerSet = 20;
|
this.HungerSet = 20;
|
||||||
@ -195,6 +194,10 @@ public class QuiverTeams extends TeamGame
|
|||||||
Scoreboard.Write(kills + "" + team.GetColor() + " Kills");
|
Scoreboard.Write(kills + "" + team.GetColor() + " Kills");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Scoreboard.WriteBlank();
|
||||||
|
Scoreboard.Write(C.Bold + "First To");
|
||||||
|
Scoreboard.Write(C.cGold + C.Bold + _reqKills + " Kills");
|
||||||
|
|
||||||
Scoreboard.Draw();
|
Scoreboard.Draw();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -258,7 +258,7 @@ public class Spleef extends SoloGame
|
|||||||
@EventHandler
|
@EventHandler
|
||||||
public void Hunger(UpdateEvent event)
|
public void Hunger(UpdateEvent event)
|
||||||
{
|
{
|
||||||
if (event.getType() != UpdateType.SEC)
|
if (event.getType() != UpdateType.SLOW)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
if (!IsLive())
|
if (!IsLive())
|
||||||
@ -275,7 +275,7 @@ public class Spleef extends SoloGame
|
|||||||
UtilPlayer.message(player, F.main("Game", "Break blocks to restore hunger!"));
|
UtilPlayer.message(player, F.main("Game", "Break blocks to restore hunger!"));
|
||||||
}
|
}
|
||||||
|
|
||||||
UtilPlayer.hunger(player, -1);
|
UtilPlayer.hunger(player, -2);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -3,10 +3,13 @@ package nautilus.game.arcade.game.games.spleef;
|
|||||||
import java.lang.reflect.Field;
|
import java.lang.reflect.Field;
|
||||||
|
|
||||||
import org.bukkit.Effect;
|
import org.bukkit.Effect;
|
||||||
|
import org.bukkit.Location;
|
||||||
|
import org.bukkit.Material;
|
||||||
import org.bukkit.block.Block;
|
import org.bukkit.block.Block;
|
||||||
import org.bukkit.craftbukkit.v1_7_R4.entity.CraftArrow;
|
import org.bukkit.craftbukkit.v1_7_R4.entity.CraftArrow;
|
||||||
import org.bukkit.entity.Arrow;
|
import org.bukkit.entity.Arrow;
|
||||||
import org.bukkit.entity.Player;
|
import org.bukkit.entity.Player;
|
||||||
|
import org.bukkit.entity.Snowball;
|
||||||
import org.bukkit.event.EventHandler;
|
import org.bukkit.event.EventHandler;
|
||||||
import org.bukkit.event.EventPriority;
|
import org.bukkit.event.EventPriority;
|
||||||
import org.bukkit.event.block.BlockDamageEvent;
|
import org.bukkit.event.block.BlockDamageEvent;
|
||||||
@ -16,7 +19,11 @@ import org.bukkit.event.entity.EntityDamageEvent.DamageCause;
|
|||||||
import mineplex.core.common.util.F;
|
import mineplex.core.common.util.F;
|
||||||
import mineplex.core.common.util.UtilBlock;
|
import mineplex.core.common.util.UtilBlock;
|
||||||
import mineplex.core.common.util.UtilEnt;
|
import mineplex.core.common.util.UtilEnt;
|
||||||
|
import mineplex.core.common.util.UtilInv;
|
||||||
|
import mineplex.core.common.util.UtilMath;
|
||||||
import mineplex.core.common.util.UtilPlayer;
|
import mineplex.core.common.util.UtilPlayer;
|
||||||
|
import mineplex.core.itemstack.ItemStackFactory;
|
||||||
|
import mineplex.core.recharge.Recharge;
|
||||||
import mineplex.core.updater.UpdateType;
|
import mineplex.core.updater.UpdateType;
|
||||||
import mineplex.core.updater.event.UpdateEvent;
|
import mineplex.core.updater.event.UpdateEvent;
|
||||||
import nautilus.game.arcade.ArcadeManager;
|
import nautilus.game.arcade.ArcadeManager;
|
||||||
@ -56,14 +63,59 @@ public class SpleefTeams extends TeamGame
|
|||||||
}
|
}
|
||||||
|
|
||||||
@EventHandler
|
@EventHandler
|
||||||
public void ArrowDamage(ProjectileHitEvent event)
|
public void SnowballDamage(ProjectileHitEvent event)
|
||||||
{
|
{
|
||||||
final Arrow arrow = (Arrow)event.getEntity();
|
if (!(event.getEntity() instanceof Snowball))
|
||||||
final double velocity = arrow.getVelocity().length();
|
return;
|
||||||
|
|
||||||
|
Snowball ball = (Snowball)event.getEntity();
|
||||||
|
|
||||||
if (!(arrow.getShooter() instanceof Player))
|
if (ball.getShooter() == null || !(ball.getShooter() instanceof Player))
|
||||||
return;
|
return;
|
||||||
|
|
||||||
|
Location loc = ball.getLocation().add(ball.getVelocity().multiply(0.8));
|
||||||
|
|
||||||
|
Block block = loc.getBlock();
|
||||||
|
|
||||||
|
//Find Nearest if hit nothing :O
|
||||||
|
if (block.getType() == Material.AIR)
|
||||||
|
{
|
||||||
|
Block closest = null;
|
||||||
|
double closestDist = 0;
|
||||||
|
|
||||||
|
for (Block other : UtilBlock.getSurrounding(block, true))
|
||||||
|
{
|
||||||
|
if (other.getType() == Material.AIR)
|
||||||
|
continue;
|
||||||
|
|
||||||
|
double dist = UtilMath.offset(loc, other.getLocation().add(0.5, 0.5, 0.5));
|
||||||
|
|
||||||
|
if (closest == null || dist < closestDist)
|
||||||
|
{
|
||||||
|
closest = other;
|
||||||
|
closestDist = dist;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (closest != null)
|
||||||
|
block = closest;
|
||||||
|
}
|
||||||
|
|
||||||
|
BlockFade(block, (Player)ball.getShooter(), false);
|
||||||
|
}
|
||||||
|
|
||||||
|
@EventHandler
|
||||||
|
public void ArrowDamage(ProjectileHitEvent event)
|
||||||
|
{
|
||||||
|
if (!(event.getEntity() instanceof Arrow))
|
||||||
|
return;
|
||||||
|
|
||||||
|
final Arrow arrow = (Arrow)event.getEntity();
|
||||||
|
final double velocity = arrow.getVelocity().length();
|
||||||
|
|
||||||
|
if (!(arrow.getShooter() instanceof Player))
|
||||||
|
return;
|
||||||
|
|
||||||
final Player player = (Player)arrow.getShooter();
|
final Player player = (Player)arrow.getShooter();
|
||||||
|
|
||||||
Manager.GetPlugin().getServer().getScheduler().scheduleSyncDelayedTask(Manager.GetPlugin(), new Runnable()
|
Manager.GetPlugin().getServer().getScheduler().scheduleSyncDelayedTask(Manager.GetPlugin(), new Runnable()
|
||||||
@ -89,14 +141,14 @@ public class SpleefTeams extends TeamGame
|
|||||||
Block block = arrow.getWorld().getBlockAt(x, y, z);
|
Block block = arrow.getWorld().getBlockAt(x, y, z);
|
||||||
|
|
||||||
double radius = 0.5 + velocity/1.6d;
|
double radius = 0.5 + velocity/1.6d;
|
||||||
|
|
||||||
BlockFade(block, player);
|
BlockFade(block, player, false);
|
||||||
|
|
||||||
for (Block other : UtilBlock.getInRadius(block.getLocation().add(0.5, 0.5, 0.5), radius).keySet())
|
for (Block other : UtilBlock.getInRadius(block.getLocation().add(0.5, 0.5, 0.5), radius).keySet())
|
||||||
{
|
{
|
||||||
BlockFade(other, player);
|
BlockFade(other, player, true);
|
||||||
}
|
}
|
||||||
|
|
||||||
arrow.remove();
|
arrow.remove();
|
||||||
}
|
}
|
||||||
catch (Exception e)
|
catch (Exception e)
|
||||||
@ -106,25 +158,41 @@ public class SpleefTeams extends TeamGame
|
|||||||
}
|
}
|
||||||
}, 0);
|
}, 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
@EventHandler(priority = EventPriority.LOW)
|
@EventHandler(priority = EventPriority.LOW)
|
||||||
public void BlockDamage(BlockDamageEvent event)
|
public void BlockDamage(BlockDamageEvent event)
|
||||||
{
|
{
|
||||||
if (!this.IsLive())
|
if (!this.IsLive())
|
||||||
return;
|
return;
|
||||||
|
|
||||||
if (!this.IsAlive(event.getPlayer()))
|
if (!this.IsAlive(event.getPlayer()))
|
||||||
return;
|
return;
|
||||||
|
|
||||||
event.setCancelled(true);
|
event.setCancelled(true);
|
||||||
|
|
||||||
BlockFade(event.getBlock(), event.getPlayer());
|
BlockFade(event.getBlock(), event.getPlayer(), false);
|
||||||
|
|
||||||
|
//Snowball
|
||||||
|
if (GetKit(event.getPlayer()) instanceof KitSnowballer)
|
||||||
|
if (!UtilInv.contains(event.getPlayer(), Material.SNOW_BALL, (byte)0, 16))
|
||||||
|
event.getPlayer().getInventory().addItem(ItemStackFactory.Instance.CreateStack(Material.SNOW_BALL));
|
||||||
}
|
}
|
||||||
|
|
||||||
public void BlockFade(Block block, Player player)
|
public void BlockFade(Block block, Player player, boolean slowDamage)
|
||||||
{
|
{
|
||||||
UtilPlayer.hunger(player, 1);
|
AddStat(player, "BlocksBroken", 1, false, false);
|
||||||
|
|
||||||
|
//Prevent Super Hunger from Bow
|
||||||
|
if (Recharge.Instance.use(player, GetName() + " Hunger", 50, false, false))
|
||||||
|
if (block.getTypeId() != 7)
|
||||||
|
UtilPlayer.hunger(player, 1);
|
||||||
|
|
||||||
|
if (!slowDamage)
|
||||||
|
{
|
||||||
|
Break(block);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
//Wool and Stained Clay
|
//Wool and Stained Clay
|
||||||
if (block.getTypeId() == 35 || block.getTypeId() == 159)
|
if (block.getTypeId() == 35 || block.getTypeId() == 159)
|
||||||
{
|
{
|
||||||
@ -155,7 +223,7 @@ public class SpleefTeams extends TeamGame
|
|||||||
else
|
else
|
||||||
Break(block);
|
Break(block);
|
||||||
}
|
}
|
||||||
|
|
||||||
//Grass
|
//Grass
|
||||||
else if (block.getTypeId() == 2)
|
else if (block.getTypeId() == 2)
|
||||||
{
|
{
|
||||||
@ -170,7 +238,7 @@ public class SpleefTeams extends TeamGame
|
|||||||
|
|
||||||
else if (block.getData() == 0)
|
else if (block.getData() == 0)
|
||||||
block.setData((byte)2);
|
block.setData((byte)2);
|
||||||
|
|
||||||
else
|
else
|
||||||
Break(block);
|
Break(block);
|
||||||
}
|
}
|
||||||
@ -181,25 +249,22 @@ public class SpleefTeams extends TeamGame
|
|||||||
Break(block);
|
Break(block);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public void Break(Block block)
|
public void Break(Block block)
|
||||||
{
|
{
|
||||||
block.getWorld().playEffect(block.getLocation(), Effect.STEP_SOUND, block.getTypeId());
|
block.getWorld().playEffect(block.getLocation(), Effect.STEP_SOUND, block.getTypeId());
|
||||||
block.setTypeId(0);
|
block.setTypeId(0);
|
||||||
}
|
}
|
||||||
|
|
||||||
@EventHandler
|
@EventHandler
|
||||||
public void Hunger(UpdateEvent event)
|
public void Hunger(UpdateEvent event)
|
||||||
{
|
{
|
||||||
if (Manager.IsTournamentServer())
|
if (event.getType() != UpdateType.SLOW)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
if (event.getType() != UpdateType.SEC)
|
|
||||||
return;
|
|
||||||
|
|
||||||
if (!IsLive())
|
if (!IsLive())
|
||||||
return;
|
return;
|
||||||
|
|
||||||
for (Player player : GetPlayers(true))
|
for (Player player : GetPlayers(true))
|
||||||
{
|
{
|
||||||
if (player.getFoodLevel() <= 0)
|
if (player.getFoodLevel() <= 0)
|
||||||
@ -207,11 +272,11 @@ public class SpleefTeams extends TeamGame
|
|||||||
Manager.GetDamage().NewDamageEvent(player, null, null,
|
Manager.GetDamage().NewDamageEvent(player, null, null,
|
||||||
DamageCause.STARVATION, 1, false, true, false,
|
DamageCause.STARVATION, 1, false, true, false,
|
||||||
"Starvation", GetName());
|
"Starvation", GetName());
|
||||||
|
|
||||||
UtilPlayer.message(player, F.main("Game", "Break blocks to restore hunger!"));
|
UtilPlayer.message(player, F.main("Game", "Break blocks to restore hunger!"));
|
||||||
}
|
}
|
||||||
|
|
||||||
UtilPlayer.hunger(player, -1);
|
UtilPlayer.hunger(player, -2);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -39,6 +39,7 @@ import org.bukkit.event.block.BlockFromToEvent;
|
|||||||
import org.bukkit.event.block.BlockIgniteEvent;
|
import org.bukkit.event.block.BlockIgniteEvent;
|
||||||
import org.bukkit.event.block.BlockIgniteEvent.IgniteCause;
|
import org.bukkit.event.block.BlockIgniteEvent.IgniteCause;
|
||||||
import org.bukkit.event.block.BlockPlaceEvent;
|
import org.bukkit.event.block.BlockPlaceEvent;
|
||||||
|
import org.bukkit.event.block.LeavesDecayEvent;
|
||||||
import org.bukkit.event.entity.CreatureSpawnEvent;
|
import org.bukkit.event.entity.CreatureSpawnEvent;
|
||||||
import org.bukkit.event.entity.PlayerDeathEvent;
|
import org.bukkit.event.entity.PlayerDeathEvent;
|
||||||
import org.bukkit.event.entity.EntityDamageEvent.DamageCause;
|
import org.bukkit.event.entity.EntityDamageEvent.DamageCause;
|
||||||
@ -921,7 +922,7 @@ public class GameFlagManager implements Listener
|
|||||||
}
|
}
|
||||||
|
|
||||||
@EventHandler
|
@EventHandler
|
||||||
public void WorldLeavesDecay(BlockFromToEvent event)
|
public void WorldLeavesDecay(LeavesDecayEvent event)
|
||||||
{
|
{
|
||||||
Game game = Manager.GetGame();
|
Game game = Manager.GetGame();
|
||||||
if (game == null) return;
|
if (game == null) return;
|
||||||
|
Loading…
Reference in New Issue
Block a user