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

This commit is contained in:
libraryaddict 2015-01-27 21:09:31 +13:00
commit 1da873ab8f
20 changed files with 312 additions and 138 deletions

View File

@ -15,6 +15,7 @@ public enum Rank
MODERATOR("Mod", ChatColor.GOLD),
HELPER("Helper", ChatColor.DARK_AQUA),
MAPDEV("Mapper", ChatColor.BLUE),
MAPLEAD("MapKing", ChatColor.DARK_PURPLE),
//Staff ^^

View File

@ -37,8 +37,16 @@ public class UtilTextBottom
public static void displayProgress(String prefix, double amount, String suffix, Player... players)
{
displayProgress(prefix, amount, suffix, false, players);
}
public static void displayProgress(String prefix, double amount, String suffix, boolean progressDirectionSwap, Player... players)
{
if (progressDirectionSwap)
amount = 1 - amount;
//Generate Bar
int bars = 12;
int bars = 24;
String progressBar = C.cGreen + "";
boolean colorChange = false;
for (int i=0 ; i<bars ; i++)
@ -49,7 +57,7 @@ public class UtilTextBottom
colorChange = true;
}
progressBar += "";
progressBar += "";
}
//Send to Player

View File

@ -464,4 +464,13 @@ public class CoreClientManager extends MiniPlugin
{
_loginProcessors.put(processor.getName(), processor);
}
public boolean hasRank(Player player, Rank rank)
{
CoreClient client = Get(player);
if (client == null)
return false;
return client.GetRank().Has(rank);
}
}

View File

@ -62,6 +62,8 @@ public class AntiHack extends MiniPlugin
//Player Info
private HashSet<Player> _velocityEvent = new HashSet<Player>();
private HashMap<Player, Long> _lastMoveEvent = new HashMap<Player, Long>();
private HashSet<Player> _hubAttempted = new HashSet<Player>();
//Hack Requirements
public int FloatHackTicks = 10;
@ -347,7 +349,7 @@ public class AntiHack extends MiniPlugin
{
player.playSound(player.getLocation(), Sound.ENDERDRAGON_GROWL, 2f, 0.5f);
if (_kick)
if (_kick || _hubAttempted.remove(player))
{
player.kickPlayer(
C.cGold + "Mineplex Anti-Cheat" + "\n" +
@ -358,6 +360,8 @@ public class AntiHack extends MiniPlugin
}
else
{
_hubAttempted.add(player);
UtilPlayer.message(player, C.cGold + C.Strike + "---------------------------------------------");
UtilPlayer.message(player, "");
UtilPlayer.message(player, C.cGold + "Mineplex Anti-Cheat");
@ -452,6 +456,17 @@ public class AntiHack extends MiniPlugin
detector.Reset(player);
}
}
for (Iterator<Player> playerIterator = _hubAttempted.iterator(); playerIterator.hasNext();)
{
Player player = playerIterator.next();
if (!player.isOnline() || !player.isValid())
{
playerIterator.remove();
}
}
}
public void setEnabled(boolean b)

View File

@ -6,7 +6,6 @@ import java.util.LinkedList;
import org.bukkit.entity.Player;
import org.bukkit.event.EventHandler;
import org.bukkit.event.entity.PlayerDeathEvent;
import org.bukkit.event.player.PlayerQuitEvent;
import org.bukkit.plugin.java.JavaPlugin;
import mineplex.core.MiniPlugin;
@ -204,6 +203,17 @@ public class Recharge extends MiniPlugin
_recharge.get(player.getName()).get(ability).DisplayForce = displayForce;
}
public void setCountdown(Player player, String ability, boolean countdown)
{
if (!_recharge.containsKey(player.getName()))
return;
if (!_recharge.get(player.getName()).containsKey(ability))
return;
_recharge.get(player.getName()).get(ability).Countdown = countdown;
}
public void Reset(Player player)
{
_recharge.put(player.getName(), new NautHashMap<String, RechargeData>());

View File

@ -30,6 +30,7 @@ public class RechargeData
public ItemStack Item;
public boolean DisplayForce = false;
public boolean Countdown = false; //This will make the output a countdown, instead of a recharge.
public boolean AttachItem;
public boolean AttachDurability;
@ -62,11 +63,15 @@ public class RechargeData
{
if (!UtilTime.elapsed(Time, Recharge))
{
UtilTextBottom.displayProgress(C.Bold + Name, percent, UtilTime.MakeStr(Recharge - (System.currentTimeMillis() - Time)), Player);
UtilTextBottom.displayProgress(C.Bold + Name, percent, UtilTime.MakeStr(Recharge - (System.currentTimeMillis() - Time)), Countdown, Player);
}
else
{
UtilTextBottom.display(C.cGreen + C.Bold + Name + " Recharged", Player);
if (!Countdown)
UtilTextBottom.display(C.cGreen + C.Bold + Name + " Recharged", Player);
else
UtilTextBottom.display(C.cRed + C.Bold + Name + " Ended", Player);
//PLING!
if (Recharge > 4000)

View File

@ -1,13 +0,0 @@
package mineplex.core.scoreboard;
import org.bukkit.plugin.java.JavaPlugin;
import mineplex.core.MiniPlugin;
public class EasyScoreboard extends MiniPlugin
{
public EasyScoreboard(JavaPlugin plugin)
{
super("EasyScoreboard", plugin);
}
}

View File

@ -5,6 +5,8 @@ public enum GameType
//Mini
Other("Other"),
Unknown("Unknown"),
Lobby("Lobby"),
BaconBrawl("Bacon Brawl"),
Barbarians("A Barbarians Life"),
Bridge("The Bridges"),
@ -54,6 +56,11 @@ public enum GameType
WitherAssault("Wither Assault"),
Wizards("Wizards"),
ZombieSurvival("Zombie Survival"),
Upload("Upload"),
InProgress("In Progress"),
None("None");
String _name;

View File

@ -66,7 +66,7 @@ import mineplex.mapparser.command.HubCommand;
import mineplex.mapparser.command.ListCommand;
import mineplex.mapparser.command.MapCommand;
import mineplex.mapparser.command.NameCommand;
import mineplex.mapparser.command.ParseCommand;
import mineplex.mapparser.command.ParseCommand600;
import mineplex.mapparser.command.RenameCommand;
import mineplex.mapparser.command.SaveCommand;
import mineplex.mapparser.command.WorldsCommand;
@ -81,6 +81,8 @@ public class MapParser extends JavaPlugin implements Listener
private List<BaseCommand> _commands = new ArrayList<BaseCommand>();
private Location _spawnLocation;
private HashMap<Player, Boolean> _permissionMap = new HashMap<Player, Boolean>();
@Override
public void onEnable()
{
@ -104,7 +106,7 @@ public class MapParser extends JavaPlugin implements Listener
_commands.add(new ListCommand(this));
_commands.add(new MapCommand(this));
_commands.add(new NameCommand(this));
_commands.add(new ParseCommand(this));
_commands.add(new ParseCommand600(this));
_commands.add(new RenameCommand(this));
_commands.add(new SaveCommand(this));
_commands.add(new WorldsCommand(this));
@ -127,11 +129,37 @@ public class MapParser extends JavaPlugin implements Listener
ResetInventory(event.getPlayer());
DisplayHelp(player);
for (Plugin plugin : Bukkit.getPluginManager().getPlugins())
player.addAttachment(plugin, "worldedit.*", true);
}
@EventHandler
public void permissionUpdate(TickEvent event)
{
for (Player player : UtilServer.getPlayers())
{
permissionSet(player);
}
}
public void permissionSet(Player player)
{
boolean hasPermission = GetData(player.getWorld().getName()).HasAccess(player);
if (!_permissionMap.containsKey(player) || _permissionMap.get(player) != hasPermission)
{
for (Plugin plugin : Bukkit.getPluginManager().getPlugins())
{
player.addAttachment(plugin, "worldedit.*", hasPermission);
player.addAttachment(plugin, "voxelsniper.sniper", hasPermission);
player.addAttachment(plugin, "voxelsniper.brush.*", hasPermission);
}
_permissionMap.put(player, hasPermission);
UtilPlayer.message(player, "Plugin Permissions: " + F.tf(hasPermission));
}
}
public void DisplayHelp(Player player)
{
UtilPlayer.message(player, F.main("Parser", "Listing Commands;"));
@ -491,7 +519,7 @@ public class MapParser extends JavaPlugin implements Listener
System.out.println(world + ChatColor.RESET + " " + name + ChatColor.RESET + " " + event.getMessage());
}
@EventHandler
@EventHandler(priority = EventPriority.LOWEST)
public void InteractCancel(PlayerInteractEvent event)
{
//Permission
@ -501,17 +529,23 @@ public class MapParser extends JavaPlugin implements Listener
}
}
@EventHandler
public void WorldeditCancel(PlayerCommandPreprocessEvent event)
@EventHandler(priority = EventPriority.LOWEST)
public void commandCancel(PlayerCommandPreprocessEvent event)
{
if (event.getMessage().startsWith("//"))
if (event.getMessage().startsWith("/tp") ||
event.getMessage().startsWith("/hub") ||
event.getMessage().startsWith("/list") ||
event.getMessage().startsWith("/map") ||
event.getMessage().startsWith("/create") ||
event.getMessage().startsWith("/copy") ||
event.getMessage().startsWith("/delete"))
return;
//Permission
if (!GetData(event.getPlayer().getWorld().getName()).HasAccess(event.getPlayer()))
{
//Permission
if (!GetData(event.getPlayer().getWorld().getName()).HasAccess(event.getPlayer()))
{
UtilPlayer.message(event.getPlayer(), F.main("Parser", "You do not have Build-Access for this Map."));
event.setCancelled(true);
}
UtilPlayer.message(event.getPlayer(), F.main("Parser", "You do not have Build-Access for this Map."));
event.setCancelled(true);
}
}

View File

@ -46,7 +46,7 @@ public class Parse
private int _processed = 0;
public Parse(MapParser host, World world, String[] args, Location loc, MapData data)
public Parse(MapParser host, World world, String[] args, Location loc, MapData data, int size)
{
Host = host;
@ -56,6 +56,8 @@ public class Parse
_mapData = data;
_size = size;
for (String arg : args)
Host.Announce("Parse Arg: " + F.elem(arg));

View File

@ -26,22 +26,13 @@ public class CreateCommand extends BaseCommand
@Override
public boolean execute(Player player, String alias, String[] args)
{
if (args.length < 2)
if (args.length < 1)
{
message(player, "Invalid Input. " + F.elem("/create <MapName> <GameType>"));
message(player, "Invalid Input. " + F.elem("/create <MapName>"));
return true;
}
GameType gameType = null;
try
{
gameType = GameType.valueOf(args[1]);
}
catch (Exception e)
{
getPlugin().sendValidGameTypes(player);
}
GameType gameType = GameType.InProgress;
String worldName = "map/" + gameType.GetName() + "/" + args[0];

View File

@ -5,6 +5,7 @@ import java.io.File;
import org.bukkit.ChatColor;
import org.bukkit.entity.Player;
import mineplex.core.common.util.C;
import mineplex.core.common.util.F;
import mineplex.core.common.util.UtilPlayer;
import mineplex.mapparser.GameType;
@ -15,6 +16,8 @@ import mineplex.mapparser.MapParser;
*/
public class ListCommand extends BaseCommand
{
private boolean _colorSwitch = false;
public ListCommand(MapParser plugin)
{
super(plugin, "list");
@ -27,9 +30,12 @@ public class ListCommand extends BaseCommand
{
UtilPlayer.message(player, F.main("Parser", "Listing Maps;"));
boolean colorSwitch = false;
for (GameType gameType : GameType.values())
{
listMaps(player, gameType);
if (listMaps(player, gameType, colorSwitch))
colorSwitch = !colorSwitch;
}
}
else if (args.length == 1)
@ -46,20 +52,22 @@ public class ListCommand extends BaseCommand
UtilPlayer.message(player, F.main("Parser", "Listing Maps for gametype " + F.elem(gameType.GetName())));
listMaps(player, gameType);
listMaps(player, gameType, false);
}
return true;
}
private void listMaps(Player player, GameType gameType)
private boolean listMaps(Player player, GameType gameType, boolean colorSwitch)
{
String maps = "";
ChatColor color = ChatColor.YELLOW;
ChatColor color = ChatColor.AQUA;
if (colorSwitch)
color = ChatColor.GREEN;
File mapsFolder = new File("map" + File.separator + gameType.GetName());
if (!mapsFolder.exists())
return;
return false;
for (File file : mapsFolder.listFiles())
{
@ -68,17 +76,26 @@ public class ListCommand extends BaseCommand
maps += color + file.getName() + " ";
if (color == ChatColor.YELLOW)
color = ChatColor.GOLD;
else
color = ChatColor.YELLOW;
if (color == ChatColor.AQUA)
color = ChatColor.DARK_AQUA;
else if (color == ChatColor.DARK_AQUA)
color = ChatColor.AQUA;
else if (color == ChatColor.GREEN)
color = ChatColor.DARK_GREEN;
else if (color == ChatColor.DARK_GREEN)
color = ChatColor.GREEN;
}
// Print line of maps for specific gametype
if (maps.length() > 0)
{
maps = F.elem(gameType.name()) + "> " + maps;
maps = F.elem(ChatColor.RESET + C.Scramble + "!" + ChatColor.RESET + C.Bold + gameType.name()) + "> " + maps;
player.sendMessage(maps);
return true;
}
return false;
}
}

View File

@ -12,11 +12,11 @@ import mineplex.mapparser.Parse;
/**
* Created by Shaun on 8/15/2014.
*/
public class ParseCommand extends BaseCommand
public class ParseCommand200 extends BaseCommand
{
public ParseCommand(MapParser plugin)
public ParseCommand200(MapParser plugin)
{
super(plugin, "parse");
super(plugin, "parse200");
}
@Override
@ -57,7 +57,7 @@ public class ParseCommand extends BaseCommand
}
//Parse the World
getPlugin().setCurrentParse(new Parse(getPlugin(), parseableWorld, args, parseLoc, getPlugin().GetData(parseLoc.getWorld().getName())));
getPlugin().setCurrentParse(new Parse(getPlugin(), parseableWorld, args, parseLoc, getPlugin().GetData(parseLoc.getWorld().getName()), 200));
return true;
}

View File

@ -0,0 +1,64 @@
package mineplex.mapparser.command;
import org.bukkit.Location;
import org.bukkit.World;
import org.bukkit.entity.Player;
import mineplex.core.common.util.F;
import mineplex.mapparser.MapData;
import mineplex.mapparser.MapParser;
import mineplex.mapparser.Parse;
/**
* Created by Shaun on 8/15/2014.
*/
public class ParseCommand400 extends BaseCommand
{
public ParseCommand400(MapParser plugin)
{
super(plugin, "parse400");
}
@Override
public boolean execute(Player player, String alias, String[] args)
{
if (!player.isOp())
{
message(player, "Only OPs can parse maps!");
return true;
}
Location parseLoc = player.getLocation();
World world = parseLoc.getWorld();
MapData data = getPlugin().GetData(world.getName());
if (data.MapName.equals("null") || data.MapCreator.equals("null") || data.MapGameType.equals("null"))
{
message(player, "Map Name/Author/GameType are not set!");
return true;
}
//Teleport Players Out
for (Player worldPlayer : world.getPlayers())
{
worldPlayer.teleport(getPlugin().getSpawnLocation());
message(player, "World " + F.elem(world.getName()) + " is preparing to be parsed.");
}
//Unload World > Copy
World parseableWorld = getPlugin().getWorldManager().prepMapParse(world);
if (parseableWorld == null)
{
message(player, "Could not prepare world for parsing!");
return true;
}
//Parse the World
getPlugin().setCurrentParse(new Parse(getPlugin(), parseableWorld, args, parseLoc, getPlugin().GetData(parseLoc.getWorld().getName()), 400));
return true;
}
}

View File

@ -0,0 +1,64 @@
package mineplex.mapparser.command;
import org.bukkit.Location;
import org.bukkit.World;
import org.bukkit.entity.Player;
import mineplex.core.common.util.F;
import mineplex.mapparser.MapData;
import mineplex.mapparser.MapParser;
import mineplex.mapparser.Parse;
/**
* Created by Shaun on 8/15/2014.
*/
public class ParseCommand600 extends BaseCommand
{
public ParseCommand600(MapParser plugin)
{
super(plugin, "parse","parse600");
}
@Override
public boolean execute(Player player, String alias, String[] args)
{
if (!player.isOp())
{
message(player, "Only OPs can parse maps!");
return true;
}
Location parseLoc = player.getLocation();
World world = parseLoc.getWorld();
MapData data = getPlugin().GetData(world.getName());
if (data.MapName.equals("null") || data.MapCreator.equals("null") || data.MapGameType.equals("null"))
{
message(player, "Map Name/Author/GameType are not set!");
return true;
}
//Teleport Players Out
for (Player worldPlayer : world.getPlayers())
{
worldPlayer.teleport(getPlugin().getSpawnLocation());
message(player, "World " + F.elem(world.getName()) + " is preparing to be parsed.");
}
//Unload World > Copy
World parseableWorld = getPlugin().getWorldManager().prepMapParse(world);
if (parseableWorld == null)
{
message(player, "Could not prepare world for parsing!");
return true;
}
//Parse the World
getPlugin().setCurrentParse(new Parse(getPlugin(), parseableWorld, args, parseLoc, getPlugin().GetData(parseLoc.getWorld().getName()), 600));
return true;
}
}

View File

@ -110,9 +110,9 @@ import nautilus.game.arcade.managers.GameWorldManager;
import nautilus.game.arcade.managers.IdleManager;
import nautilus.game.arcade.managers.MiscManager;
import nautilus.game.arcade.shop.ArcadeShop;
public class ArcadeManager extends MiniPlugin implements IRelation
{
{
// Modules
private BlockRestore _blockRestore;
private Blood _blood;
@ -129,7 +129,7 @@ public class ArcadeManager extends MiniPlugin implements IRelation
private Fire _fire;
private ProjectileManager _projectileManager;
private Portal _portal;
private ArcadeShop _arcadeShop;
@ -594,19 +594,9 @@ public class ArcadeManager extends MiniPlugin implements IRelation
@EventHandler
public void MessageJoin(PlayerJoinEvent event)
{
if (_game == null || _game.AnnounceJoinQuit)
{
Player player = event.getPlayer();
if (_clientManager.Get(player).GetRank() != Rank.LEGEND)
event.setJoinMessage(null);
else
{
event.setJoinMessage(C.cGreen + C.Bold + "Legend " + player.getName() + " has joined!");
UtilFirework.playFirework(player.getEyeLocation(), org.bukkit.FireworkEffect.Type.BALL_LARGE, Color.LIME, true, true);
player.getWorld().playSound(player.getEyeLocation(), Sound.WITHER_SPAWN, 2f, 1f);
}
}
if (_game != null && _game.AnnounceJoinQuit)
event.setJoinMessage(F.sys("Join", GetColor(event.getPlayer()) + event.getPlayer().getName()));
else
event.setJoinMessage(null);
}

View File

@ -149,6 +149,8 @@ public class Bridge extends TeamGame implements OreObsfucation
"The last team alive wins!"
});
this.CompassSpectatorMenu = false;
_ore = new OreHider();
// Flags

View File

@ -1,36 +0,0 @@
package nautilus.game.arcade.game.games.smash.kits;
import org.bukkit.Material;
import org.bukkit.entity.EntityType;
import org.bukkit.entity.Player;
import org.bukkit.inventory.ItemStack;
import mineplex.core.common.util.C;
import nautilus.game.arcade.ArcadeManager;
import nautilus.game.arcade.kit.KitAvailability;
import nautilus.game.arcade.kit.Perk;
import nautilus.game.arcade.kit.SmashKit;
public class KitComingSoon extends SmashKit
{
public KitComingSoon(ArcadeManager manager)
{
super(manager, C.cRed + "Coming Soon", KitAvailability.Gem, 5000,
new String[]
{
},
new Perk[]
{
},
EntityType.VILLAGER,
new ItemStack(Material.IRON_SWORD));
}
@Override
public void GiveItems(Player player)
{
}
}

View File

@ -1012,30 +1012,29 @@ public class UHC extends TeamGame
if (event.getMessage().startsWith("/kill"))
event.setCancelled(true);
if (event.getMessage().startsWith("/uhc time day"))
{
this.WorldTimeSet = 4000;
event.setCancelled(true);
Announce(event.getPlayer().getName() + " set time to Always Day!");
}
if (event.getMessage().startsWith("/uhc time night"))
{
this.WorldTimeSet = 16000;
event.setCancelled(true);
Announce(event.getPlayer().getName() + " set time to Always Night!");
}
if (event.getMessage().startsWith("/uhc time cycle"))
{
this.WorldTimeSet = -1;
event.setCancelled(true);
Announce(event.getPlayer().getName() + " set time to Day and Night!");
}
// if (event.getMessage().startsWith("/uhc time day"))
// {
// this.WorldTimeSet = 4000;
// event.setCancelled(true);
//
// Announce(event.getPlayer().getName() + " set time to Always Day!");
// }
//
// if (event.getMessage().startsWith("/uhc time night"))
// {
// this.WorldTimeSet = 16000;
// event.setCancelled(true);
//
// Announce(event.getPlayer().getName() + " set time to Always Night!");
// }
//
// if (event.getMessage().startsWith("/uhc time cycle"))
// {
// this.WorldTimeSet = -1;
// event.setCancelled(true);
//
// Announce(event.getPlayer().getName() + " set time to Day and Night!");
// }
}
@EventHandler(priority = EventPriority.LOWEST)

View File

@ -28,6 +28,7 @@ import org.bukkit.entity.Player;
import org.bukkit.event.EventHandler;
import org.bukkit.event.HandlerList;
import org.bukkit.event.Listener;
import org.bukkit.event.inventory.InventoryType;
import org.bukkit.event.player.PlayerCommandPreprocessEvent;
import org.bukkit.event.player.PlayerInteractEvent;
import org.bukkit.event.player.PlayerJoinEvent;
@ -207,7 +208,11 @@ public class GameHostManager implements Listener
if (Manager.GetGame() == null)
return;
if (UtilGear.isMat(player.getInventory().getItem(5), Material.SPECKLED_MELON))
if (UtilGear.isMat(player.getInventory().getItem(7), Material.SPECKLED_MELON))
return;
if (player.getOpenInventory().getType() != InventoryType.CRAFTING &&
player.getOpenInventory().getType() != InventoryType.CREATIVE)
return;
player.getInventory().setItem(7, ItemStackFactory.Instance.CreateStack(Material.SPECKLED_MELON, (byte)0, 1, C.cGreen + C.Bold + "/menu"));