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

This commit is contained in:
Jonathan Williams 2014-08-19 22:24:16 -05:00
commit 217ab51b40
30 changed files with 103 additions and 33 deletions

View File

@ -2,6 +2,6 @@
<classpath>
<classpathentry kind="src" path="src"/>
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-1.7"/>
<classpathentry kind="var" path="REPO_DIR/Plugins/bin/craftbukkit.jar"/>
<classpathentry kind="lib" path="Z:/Mineplex/master/Plugins/Libraries/craftbukkit.jar"/>
<classpathentry kind="output" path="bin"/>
</classpath>

View File

@ -8,7 +8,6 @@
<orderEntry type="inheritedJdk" />
<orderEntry type="sourceFolder" forTests="false" />
<orderEntry type="module" module-name="Nautilus.Core.CraftBukkit" />
<orderEntry type="library" name="bukkit" level="project" />
<orderEntry type="library" name="craftbukkit" level="project" />
</component>
</module>

View File

@ -9,7 +9,7 @@ public class UtilServer
{
public static Player[] getPlayers()
{
return getServer().getOnlinePlayers();
return getServer().getOnlinePlayers().toArray(new Player[0]);
}
public static Server getServer()

View File

@ -15,7 +15,6 @@
<orderEntry type="module" module-name="Mineplex.Core.Common" />
<orderEntry type="module" module-name="Nautilus.Core.CraftBukkit" />
<orderEntry type="module" module-name="Mineplex.ServerData" />
<orderEntry type="library" name="bukkit" level="project" />
<orderEntry type="library" name="craftbukkit" level="project" />
</component>
</module>

View File

@ -241,7 +241,7 @@ public class CoreClientManager extends MiniPlugin
client.SetPlayer(event.getPlayer());
// Reserved Slot Check
if (Bukkit.getOnlinePlayers().length >= Bukkit.getServer().getMaxPlayers())
if (Bukkit.getOnlinePlayers().size() >= Bukkit.getServer().getMaxPlayers())
{
if (client.GetRank().Has(event.getPlayer(), Rank.ULTRA, false))
{

View File

@ -357,7 +357,7 @@ public class AntiHack extends MiniPlugin
UtilServer.broadcast(F.main("MAC", player.getName() + " was kicked for suspicious movement."));
ServerListPingEvent event = new ServerListPingEvent(null, Bukkit.getServer().getMotd(), Bukkit.getServer().getOnlinePlayers().length, Bukkit.getServer().getMaxPlayers());
ServerListPingEvent event = new ServerListPingEvent(null, Bukkit.getServer().getMotd(), Bukkit.getServer().getOnlinePlayers().size(), Bukkit.getServer().getMaxPlayers());
GetPluginManager().callEvent(event);
String motd = event.getMotd();

View File

@ -94,7 +94,7 @@ public class FriendManager extends MiniClientPlugin<FriendData> implements IPack
@EventHandler
public void updateFriends(UpdateEvent event)
{
if (event.getType() != UpdateType.SLOW || Bukkit.getOnlinePlayers().length == 0)
if (event.getType() != UpdateType.SLOW || Bukkit.getOnlinePlayers().size() == 0)
return;
Bukkit.getServer().getScheduler().runTaskAsynchronously(_plugin, new Runnable()

View File

@ -153,7 +153,7 @@ public class Portal extends MiniPlugin
@EventHandler
public void checkForServerTransfers(UpdateEvent event)
{
if (event.getType() != UpdateType.SEC || Bukkit.getOnlinePlayers().length == 0)
if (event.getType() != UpdateType.SEC || Bukkit.getOnlinePlayers().size() == 0)
return;
_retrieve = !_retrieve;

View File

@ -131,11 +131,11 @@ public class ServerStatusManager extends MiniPlugin
*/
private MinecraftServer generateServerSnapshot()
{
ServerListPingEvent event = new ServerListPingEvent(null, GetPlugin().getServer().getMotd(), GetPlugin().getServer().getOnlinePlayers().length, GetPlugin().getServer().getMaxPlayers());
ServerListPingEvent event = new ServerListPingEvent(null, GetPlugin().getServer().getMotd(), GetPlugin().getServer().getOnlinePlayers().size(), GetPlugin().getServer().getMaxPlayers());
GetPluginManager().callEvent(event);
String motd = event.getMotd();
int playerCount = Bukkit.getOnlinePlayers().length;
int playerCount = Bukkit.getOnlinePlayers().size();
int maxPlayerCount = event.getMaxPlayers();
int tps = (int) _lagMeter.getTicksPerSecond();
String address = Bukkit.getServer().getIp().isEmpty() ? "localhost" : Bukkit.getServer().getIp();

View File

@ -14,7 +14,6 @@
<orderEntry type="module" module-name="Mineplex.Minecraft.Game.ClassCombat" />
<orderEntry type="module" module-name="Mineplex.Minecraft.Game.Core" />
<orderEntry type="module" module-name="Nautilus.Core.CraftBukkit" />
<orderEntry type="library" name="bukkit" level="project" />
<orderEntry type="library" name="craftbukkit" level="project" />
<orderEntry type="module" module-name="Mineplex.ServerData" />
</component>

View File

@ -447,7 +447,7 @@ public class HubManager extends MiniClientPlugin<HubClient>
CoreClient client = _clientManager.Get(event.getPlayer().getName());
// Reserved Slot Check
if (Bukkit.getOnlinePlayers().length - Bukkit.getServer().getMaxPlayers() >= 20)
if (Bukkit.getOnlinePlayers().size() - Bukkit.getServer().getMaxPlayers() >= 20)
{
if (!client.GetRank().Has(Rank.ULTRA))
{

View File

@ -8,7 +8,6 @@
<orderEntry type="inheritedJdk" />
<orderEntry type="sourceFolder" forTests="false" />
<orderEntry type="module" module-name="Mineplex.Core.Common" />
<orderEntry type="library" name="bukkit" level="project" />
<orderEntry type="library" name="craftbukkit" level="project" />
</component>
</module>

View File

@ -3,6 +3,8 @@ package mineplex.mapparser;
public enum GameType
{
//Mini
Other("Other"),
Unknown("Unknown"),
BaconBrawl("Bacon Brawl"),
Barbarians("A Barbarians Life"),
Bridge("The Bridges"),

View File

@ -15,7 +15,7 @@ public class MapData
{
public String MapFolder;
public GameType GameType = null;
public GameType MapGameType = null;
public String MapName = "null";
public String MapCreator = "null";
@ -64,9 +64,16 @@ public class MapData
}
else if (tokens[0].equalsIgnoreCase("GAME_TYPE"))
{
GameType = GameType.valueOf(tokens[1] == null ? "Null" : tokens[1]);
try
{
MapGameType = GameType.valueOf(tokens[1] == null ? "Unknown" : tokens[1]);
}
catch (Exception e)
{
MapGameType = GameType.Unknown;
}
}
else if (tokens[0].equalsIgnoreCase("ADMIN_LIST"))
else if (tokens[0].equalsIgnoreCase("ADMIN_LIST") || tokens[0].equalsIgnoreCase("BUILD_LIST"))
{
for (String cur : tokens[1].split(","))
AdminList.add(cur);
@ -94,7 +101,7 @@ public class MapData
out.write("\n");
out.write("MAP_AUTHOR:"+MapCreator);
out.write("\n");
out.write("GAME_TYPE:"+GameType);
out.write("GAME_TYPE:"+MapGameType);
String adminList = "";
for (String cur : AdminList)

View File

@ -506,7 +506,7 @@ public class Parse
public GameType getGameType()
{
return _mapData.GameType;
return _mapData.MapGameType;
}
public World getWorld()

View File

@ -100,7 +100,7 @@ public class WorldManager
}
MapData data = Host.GetData(world.getName().replace("parse", "map"));
GameType gameType = data.GameType;
GameType gameType = data.MapGameType;
String fileName = gameType + "_" + data.MapName + ".zip";
ZipUtil.ZipFolders(Paths.get(world.getName()).toAbsolutePath().toString(), fileName, dirList, fileList);

View File

@ -0,0 +1,68 @@
package mineplex.mapparser.command;
import org.bukkit.World;
import org.bukkit.entity.Player;
import mineplex.core.common.util.F;
import mineplex.core.common.util.UtilPlayer;
import mineplex.mapparser.MapData;
import mineplex.mapparser.MapParser;
/**
* Created by Shaun on 8/16/2014.
*/
public class AdminCommand extends BaseCommand
{
public AdminCommand(MapParser plugin)
{
super(plugin, "admin");
}
@Override
public boolean execute(Player player, String alias, String[] args)
{
if (args.length != 1)
{
message(player, "Invalid Input. " + F.elem("/admin <Name>"));
return true;
}
World world = player.getWorld();
if (world.getName().equals("world"))
{
message(player, "Cannot change Admin-List for Lobby.");
return true;
}
//Permission
if (!getPlugin().GetData(world.getName()).HasAccess(player))
{
message(player, "You are not on Admin-List for this Map.");
return true;
}
Player other = UtilPlayer.searchOnline(player, args[0], true);
if (player != null)
{
MapData data = getPlugin().GetData(world.getName());
if (data.AdminList.contains(other.getName()))
{
data.AdminList.remove(other.getName());
data.Write();
getPlugin().Announce("Admin-List for " + F.elem(world.getName()) + " (" + other.getName() + " = " + F.tf(false) + ")");
}
else
{
data.AdminList.add(other.getName());
data.Write();
getPlugin().Announce("Admin-List for " + F.elem(world.getName()) + " (" + other.getName() + " = " + F.tf(true) + ")");
}
}
return true;
}
}

View File

@ -62,12 +62,12 @@ public class CreateCommand extends BaseCommand
message(player, "Teleporting to World: " + F.elem(worldName));
player.teleport(getPlugin().getSpawnLocation());
player.teleport(new Location(world, 0, 100, 0));
//Give Access
MapData mapData = getPlugin().GetData(worldName);
mapData.AdminList.add(player.getName());
mapData.GameType = gameType;
mapData.MapGameType = gameType;
mapData.Write();
return true;

View File

@ -86,7 +86,7 @@ public class GameTypeCommand extends BaseCommand
MapData data = getPlugin().GetData(newName);
data.GameType = type;
data.MapGameType = type;
data.Write();
getPlugin().Announce("GameType for " + F.elem(newName) + " set to " + F.elem(args[0]) + ".");

View File

@ -109,7 +109,7 @@ public class MapCommand extends BaseCommand
UtilPlayer.message(player, F.value("Map Name", data.MapName));
UtilPlayer.message(player, F.value("Author", data.MapCreator));
UtilPlayer.message(player, F.value("Game Type", data.GameType.GetName()));
UtilPlayer.message(player, F.value("Game Type", data.MapGameType.GetName()));
return true;
}
}

View File

@ -34,7 +34,7 @@ public class ParseCommand extends BaseCommand
MapData data = getPlugin().GetData(world.getName());
if (data.MapName.equals("null") || data.MapCreator.equals("null") || data.GameType.equals("null"))
if (data.MapName.equals("null") || data.MapCreator.equals("null") || data.MapGameType.equals("null"))
{
message(player, "Map Name/Author/GameType are not set!");
return true;

View File

@ -55,7 +55,7 @@ public class RenameCommand extends BaseCommand
File mapFolder = new File(world.getName());
File newFolder = new File("map" + File.separator + data.GameType.GetName() + File.separator + newName);
File newFolder = new File("map" + File.separator + data.MapGameType.GetName() + File.separator + newName);
mapFolder.renameTo(newFolder);
message(player, "Map " + world.getName() + " renamed to " + newFolder.getName());

View File

@ -7,7 +7,7 @@
</content>
<orderEntry type="inheritedJdk" />
<orderEntry type="sourceFolder" forTests="false" />
<orderEntry type="library" name="bukkit" level="project" />
<orderEntry type="library" name="craftbukkit" level="project" />
</component>
</module>

View File

@ -11,7 +11,6 @@
<orderEntry type="module" module-name="Mineplex.Core.Common" />
<orderEntry type="module" module-name="Mineplex.Minecraft.Game.Core" />
<orderEntry type="module" module-name="Nautilus.Core.CraftBukkit" />
<orderEntry type="library" name="bukkit" level="project" />
<orderEntry type="library" name="craftbukkit" level="project" />
</component>
</module>

View File

@ -10,7 +10,6 @@
<orderEntry type="module" module-name="Mineplex.Core" />
<orderEntry type="module" module-name="Mineplex.Core.Common" />
<orderEntry type="module" module-name="Nautilus.Core.CraftBukkit" />
<orderEntry type="library" name="bukkit" level="project" />
<orderEntry type="library" name="craftbukkit" level="project" />
</component>
</module>

View File

@ -384,7 +384,7 @@ public class EntityPlayer extends EntityHuman implements ICrafting {
IChatBaseComponent chatmessage = this.aW().b();
String deathmessage = chatmessage.c();
org.bukkit.event.entity.PlayerDeathEvent event = CraftEventFactory.callPlayerDeathEvent(this, loot, deathmessage);
org.bukkit.event.entity.PlayerDeathEvent event = CraftEventFactory.callPlayerDeathEvent(this, loot, deathmessage, keepInventory);
String deathMessage = event.getDeathMessage();
@ -397,7 +397,7 @@ public class EntityPlayer extends EntityHuman implements ICrafting {
}
// we clean the player's inventory after the EntityDeathEvent is called so plugins can get the exact state of the inventory.
if (!keepInventory) {
if (!event.getKeepInventory()) {
for (int i = 0; i < this.inventory.items.length; ++i) {
this.inventory.items[i] = null;
}

View File

@ -12,7 +12,6 @@
<orderEntry type="module" module-name="Mineplex.Minecraft.Game.Core" />
<orderEntry type="module" module-name="Mineplex.Minecraft.Game.ClassCombat" />
<orderEntry type="module" module-name="Nautilus.Core.CraftBukkit" />
<orderEntry type="library" name="bukkit" level="project" />
<orderEntry type="library" name="craftbukkit" level="project" />
</component>
</module>

View File

@ -565,7 +565,7 @@ public class ArcadeManager extends MiniPlugin implements IRelation
}
// Reserved Slot Check
if (Bukkit.getOnlinePlayers().length >= Bukkit.getServer().getMaxPlayers())
if (Bukkit.getOnlinePlayers().size() >= Bukkit.getServer().getMaxPlayers())
{
if (_serverStatusManager.getCurrentServerName().contains("BETA"))
{

View File

@ -226,7 +226,7 @@ public class PowerUpManager implements Listener
if (getGame().GetState() != GameState.Live)
return;
Player[] players = Bukkit.getOnlinePlayers();
Collection<? extends Player> players = Bukkit.getOnlinePlayers();
for (Player player : players)
{