Merge branch 'master' of ssh://184.154.0.242:7999/min/Mineplex

This commit is contained in:
Jonathan Williams 2014-08-22 10:48:27 -05:00
commit 83b3e49151
20 changed files with 239 additions and 60 deletions

View File

@ -35,11 +35,29 @@ public enum Rank
}
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.getName().equals("Chiss"))
return true;
//Specific Rank
if (specific != null)
{
for (Rank curRank : specific)
{
if (compareTo(curRank) == 0)
{
return true;
}
}
}
//
if (compareTo(rank) <= 0)
return true;

View File

@ -118,7 +118,7 @@ public class BlockRestore extends MiniPlugin
return;
//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;
//No Snow on Slabs
@ -130,8 +130,8 @@ public class BlockRestore extends MiniPlugin
return;
//No Snow on Fence or Walls
if (block.getRelative(BlockFace.DOWN).getTypeId() == 85 ||
block.getRelative(BlockFace.DOWN).getTypeId() == 139)
if (block.getRelative(BlockFace.DOWN).getType().name().toLowerCase().contains("fence") ||
block.getRelative(BlockFace.DOWN).getType().name().toLowerCase().contains("wall"))
return;
//Not Buildable

View File

@ -13,6 +13,8 @@ import mineplex.core.recharge.Recharge;
public abstract class CommandBase<PluginType extends MiniPlugin> implements ICommand
{
private Rank _requiredRank;
private Rank[] _specificRank;
private List<String> _aliases;
protected PluginType Plugin;
@ -26,6 +28,15 @@ public abstract class CommandBase<PluginType extends MiniPlugin> implements ICom
_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()
{
return _aliases;
@ -41,6 +52,11 @@ public abstract class CommandBase<PluginType extends MiniPlugin> implements ICom
return _requiredRank;
}
public Rank[] GetSpecificRanks()
{
return _specificRank;
}
public void SetCommandCenter(CommandCenter commandCenter)
{
CommandCenter = commandCenter;

View File

@ -55,7 +55,7 @@ public class CommandCenter implements Listener
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))
{

View File

@ -16,4 +16,5 @@ public interface ICommand
void SetAliasUsed(String name);
Rank GetRequiredRank();
Rank[] GetSpecificRanks();
}

View File

@ -17,6 +17,13 @@ public abstract class MultiCommandBase<PluginType extends MiniPlugin> extends Co
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)
{
for (String commandRoot : command.Aliases())
@ -48,7 +55,7 @@ public abstract class MultiCommandBase<PluginType extends MiniPlugin> extends Co
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);

View File

@ -89,6 +89,7 @@ public class ParkourManager extends MiniPlugin
}, 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)));
/*
_parkour.add(new ParkourSnake("Snake Parkour", new String[]
{
"This parkour requires incredible timing",
@ -96,7 +97,7 @@ public class ParkourManager extends MiniPlugin
"by the devil as a cruel joke!"
}, 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)));
*/
_lavaParkourReturn = new Location(Manager.GetSpawn().getWorld(), -89.5,68,36.5);
_lavaParkourReturn.setYaw(90);

View File

@ -69,7 +69,7 @@ public class WorldManager extends MiniPlugin
Manager = manager;
}
@EventHandler
//@EventHandler
public void SpawnAnimals(UpdateEvent event)
{
if (event.getType() != UpdateType.SLOW)

View File

@ -56,8 +56,6 @@ public class ParkourSnake extends ParkourData
{
e.printStackTrace();
}
System.out.println("Done");
}
public SnakePart loadSnake(String locString)
@ -207,6 +205,9 @@ public class ParkourSnake extends ParkourData
public void Update()
{
if (_snakes == null)
return;
for (SnakePart snake : _snakes)
snake.Update();
}

View File

@ -10,7 +10,7 @@ public class GameCommand extends MultiCommandBase<ArcadeManager>
{
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 StopCommand(Plugin));

View File

@ -15,7 +15,7 @@ public class SetCommand extends CommandBase<ArcadeManager>
{
public SetCommand(ArcadeManager plugin)
{
super(plugin, Rank.ADMIN, "set");
super(plugin, Rank.ADMIN, new Rank[] {Rank.YOUTUBE, Rank.MAPDEV}, "set");
}
@Override

View File

@ -12,7 +12,7 @@ public class StartCommand extends CommandBase<ArcadeManager>
{
public StartCommand(ArcadeManager plugin)
{
super(plugin, Rank.ADMIN, "start");
super(plugin, Rank.ADMIN, new Rank[] {Rank.YOUTUBE, Rank.MAPDEV}, "start");
}
@Override

View File

@ -1,10 +1,13 @@
package nautilus.game.arcade.game.games.deathtag;
import java.util.ArrayList;
import java.util.Collections;
import org.bukkit.Bukkit;
import org.bukkit.ChatColor;
import org.bukkit.Location;
import org.bukkit.Material;
import org.bukkit.entity.EntityType;
import org.bukkit.entity.Player;
import org.bukkit.event.EventHandler;
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.GameTeam.PlayerState;
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.NullKit;
@ -37,6 +41,8 @@ public class DeathTag extends SoloGame
private int _currentSpeed = -1;
private ArrayList<Location> _lights = new ArrayList<Location>();
public DeathTag(ArcadeManager manager)
{
super(manager, GameType.DeathTag,
@ -66,6 +72,20 @@ public class DeathTag extends SoloGame
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
public void RestrictKits()
{
@ -111,6 +131,25 @@ public class DeathTag extends SoloGame
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
public void UpdateSpeed(UpdateEvent event)
{

View File

@ -2,6 +2,8 @@ package nautilus.game.arcade.game.games.dragonescape;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.Iterator;
import java.util.Set;
import org.bukkit.Bukkit;
import org.bukkit.ChatColor;
@ -11,6 +13,8 @@ import org.bukkit.Location;
import org.bukkit.Material;
import org.bukkit.Sound;
import org.bukkit.FireworkEffect.Type;
import org.bukkit.block.Block;
import org.bukkit.block.BlockFace;
import org.bukkit.entity.EnderDragon;
import org.bukkit.entity.Entity;
import org.bukkit.entity.Player;
@ -182,7 +186,27 @@ public class DragonEscapeTeams extends TeamGame
_dragonData.Move();
Manager.GetExplosion().BlockExplosion(UtilBlock.getInRadius(_dragonData.Location, 10d).keySet(), _dragonData.Location, false);
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();
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

View File

@ -62,7 +62,10 @@ public class Micro extends TeamGame
public void ParseData()
{
for (Location loc : WorldData.GetCustomLocs("20"))
{
_glass.add(loc.getBlock());
loc.getBlock().setType(Material.STAINED_GLASS);
}
for (int y= WorldData.MinY ; y < WorldData.MaxY ; y++)
for (int x= WorldData.MinX ; x < WorldData.MaxX ; x++)

View File

@ -32,10 +32,9 @@ import nautilus.game.arcade.kit.Kit;
public class QuiverTeams extends TeamGame
{
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 int _reqKills = 100;
private int _reqKills = 6;
public QuiverTeams(ArcadeManager manager)
{
@ -52,7 +51,7 @@ public class QuiverTeams extends TeamGame
"Bow and Arrow insta-kills.",
"You receive 1 Arrow per kill.",
"Glass blocks are breakable",
"First team to 100 kills wins."
"First team to 60 kills wins."
});
this.HungerSet = 20;
@ -195,6 +194,10 @@ public class QuiverTeams extends TeamGame
Scoreboard.Write(kills + "" + team.GetColor() + " Kills");
}
Scoreboard.WriteBlank();
Scoreboard.Write(C.Bold + "First To");
Scoreboard.Write(C.cGold + C.Bold + _reqKills + " Kills");
Scoreboard.Draw();
}

View File

@ -258,7 +258,7 @@ public class Spleef extends SoloGame
@EventHandler
public void Hunger(UpdateEvent event)
{
if (event.getType() != UpdateType.SEC)
if (event.getType() != UpdateType.SLOW)
return;
if (!IsLive())
@ -275,7 +275,7 @@ public class Spleef extends SoloGame
UtilPlayer.message(player, F.main("Game", "Break blocks to restore hunger!"));
}
UtilPlayer.hunger(player, -1);
UtilPlayer.hunger(player, -2);
}
}
}

View File

@ -3,10 +3,13 @@ package nautilus.game.arcade.game.games.spleef;
import java.lang.reflect.Field;
import org.bukkit.Effect;
import org.bukkit.Location;
import org.bukkit.Material;
import org.bukkit.block.Block;
import org.bukkit.craftbukkit.v1_7_R4.entity.CraftArrow;
import org.bukkit.entity.Arrow;
import org.bukkit.entity.Player;
import org.bukkit.entity.Snowball;
import org.bukkit.event.EventHandler;
import org.bukkit.event.EventPriority;
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.UtilBlock;
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.itemstack.ItemStackFactory;
import mineplex.core.recharge.Recharge;
import mineplex.core.updater.UpdateType;
import mineplex.core.updater.event.UpdateEvent;
import nautilus.game.arcade.ArcadeManager;
@ -55,9 +62,54 @@ public class SpleefTeams extends TeamGame
this.TeamArmorHotbar = true;
}
@EventHandler
public void SnowballDamage(ProjectileHitEvent event)
{
if (!(event.getEntity() instanceof Snowball))
return;
Snowball ball = (Snowball)event.getEntity();
if (ball.getShooter() == null || !(ball.getShooter() instanceof Player))
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();
@ -90,11 +142,11 @@ public class SpleefTeams extends TeamGame
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())
{
BlockFade(other, player);
BlockFade(other, player, true);
}
arrow.remove();
@ -118,12 +170,28 @@ public class SpleefTeams extends TeamGame
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
if (block.getTypeId() == 35 || block.getTypeId() == 159)
@ -191,10 +259,7 @@ public class SpleefTeams extends TeamGame
@EventHandler
public void Hunger(UpdateEvent event)
{
if (Manager.IsTournamentServer())
return;
if (event.getType() != UpdateType.SEC)
if (event.getType() != UpdateType.SLOW)
return;
if (!IsLive())
@ -211,7 +276,7 @@ public class SpleefTeams extends TeamGame
UtilPlayer.message(player, F.main("Game", "Break blocks to restore hunger!"));
}
UtilPlayer.hunger(player, -1);
UtilPlayer.hunger(player, -2);
}
}
}

View File

@ -39,6 +39,7 @@ import org.bukkit.event.block.BlockFromToEvent;
import org.bukkit.event.block.BlockIgniteEvent;
import org.bukkit.event.block.BlockIgniteEvent.IgniteCause;
import org.bukkit.event.block.BlockPlaceEvent;
import org.bukkit.event.block.LeavesDecayEvent;
import org.bukkit.event.entity.CreatureSpawnEvent;
import org.bukkit.event.entity.PlayerDeathEvent;
import org.bukkit.event.entity.EntityDamageEvent.DamageCause;
@ -921,7 +922,7 @@ public class GameFlagManager implements Listener
}
@EventHandler
public void WorldLeavesDecay(BlockFromToEvent event)
public void WorldLeavesDecay(LeavesDecayEvent event)
{
Game game = Manager.GetGame();
if (game == null) return;