Merge branch 'master' of ssh://184.154.0.242:7999/min/mineplex
This commit is contained in:
commit
c5a873ffab
@ -38,7 +38,7 @@ public class Scheduler extends MiniPlugin
|
||||
@Override
|
||||
public void AddCommands()
|
||||
{
|
||||
AddCommand(new ForceDailyCommand(this));
|
||||
addCommand(new ForceDailyCommand(this));
|
||||
}
|
||||
|
||||
@EventHandler
|
||||
|
@ -40,10 +40,10 @@ public class Server extends MiniPlugin
|
||||
@Override
|
||||
public void AddCommands()
|
||||
{
|
||||
AddCommand(new BroadcastCommand(this));
|
||||
AddCommand(new ListCommand(this));
|
||||
AddCommand(new SpawnSetCommand(this));
|
||||
AddCommand(new WaterSpreadCommand(this));
|
||||
addCommand(new BroadcastCommand(this));
|
||||
addCommand(new ListCommand(this));
|
||||
addCommand(new SpawnSetCommand(this));
|
||||
addCommand(new WaterSpreadCommand(this));
|
||||
}
|
||||
|
||||
@EventHandler
|
||||
@ -95,7 +95,7 @@ public class Server extends MiniPlugin
|
||||
for (Player cur : UtilServer.getPlayers())
|
||||
cur.saveData();
|
||||
|
||||
Log("Saved Clients to Disk. Took " + (System.currentTimeMillis()-epoch) + " milliseconds.");
|
||||
log("Saved Clients to Disk. Took " + (System.currentTimeMillis()-epoch) + " milliseconds.");
|
||||
}
|
||||
|
||||
public void saveWorlds()
|
||||
@ -110,20 +110,20 @@ public class Server extends MiniPlugin
|
||||
F.time(UtilTime.convertString((System.currentTimeMillis()-epoch), 1, TimeUnit.FIT)) +
|
||||
"].");
|
||||
|
||||
Log("Saved Worlds to Disk. Took " + (System.currentTimeMillis()-epoch) + " milliseconds.");
|
||||
log("Saved Worlds to Disk. Took " + (System.currentTimeMillis()-epoch) + " milliseconds.");
|
||||
}
|
||||
|
||||
public void reload()
|
||||
{
|
||||
UtilServer.broadcast(F.main(_moduleName, "Reloading Plugins..."));
|
||||
Log("Reloading Plugins...");
|
||||
log("Reloading Plugins...");
|
||||
UtilServer.getServer().dispatchCommand(UtilServer.getServer().getConsoleSender(), "reload");
|
||||
}
|
||||
|
||||
public void restart()
|
||||
{
|
||||
UtilServer.broadcast(F.main(_moduleName, "Restarting Server..."));
|
||||
Log("Restarting Server...");
|
||||
log("Restarting Server...");
|
||||
|
||||
for (Player cur : UtilServer.getPlayers())
|
||||
UtilPlayer.kick(cur, _moduleName, "Server Restarting");
|
||||
|
@ -20,7 +20,7 @@ public class ListCommand extends CommandBase<Server>
|
||||
@Override
|
||||
public void Execute(Player caller, String[] args)
|
||||
{
|
||||
UtilPlayer.message(caller, F.main(Plugin.GetName(), "Listing Online Players:"));
|
||||
UtilPlayer.message(caller, F.main(Plugin.getName(), "Listing Online Players:"));
|
||||
|
||||
String staff = "";
|
||||
String other = "";
|
||||
|
@ -46,7 +46,7 @@ public class VoteManager extends MiniPlugin
|
||||
if (player == client.GetPlayer())
|
||||
continue;
|
||||
|
||||
player.sendMessage(F.main(GetName(), ChatColor.YELLOW + event.GetPlayerName() + ChatColor.GRAY + " voted at bettermc.com/Vote for " + ChatColor.YELLOW + event.GetPointsReceived() + C.cGray + " points! "));
|
||||
player.sendMessage(F.main(getName(), ChatColor.YELLOW + event.GetPlayerName() + ChatColor.GRAY + " voted at bettermc.com/Vote for " + ChatColor.YELLOW + event.GetPointsReceived() + C.cGray + " points! "));
|
||||
}
|
||||
|
||||
client.GetPlayer().updateInventory();
|
||||
|
@ -22,7 +22,7 @@ public class WeaponCommand extends CommandBase<WeaponFactory>
|
||||
{
|
||||
if (args == null || args.length == 0)
|
||||
{
|
||||
UtilPlayer.message(caller, F.main(Plugin.GetName(), "Listing Weapons:"));
|
||||
UtilPlayer.message(caller, F.main(Plugin.getName(), "Listing Weapons:"));
|
||||
|
||||
for (IWeapon cur : Plugin.GetWeapons())
|
||||
{
|
||||
|
@ -40,7 +40,7 @@ public class WeaponFactory extends MiniPlugin implements IWeaponFactory
|
||||
@Override
|
||||
public void AddCommands()
|
||||
{
|
||||
AddCommand(new WeaponCommand(this));
|
||||
addCommand(new WeaponCommand(this));
|
||||
}
|
||||
|
||||
private void PopulateWeapons()
|
||||
|
@ -2,6 +2,7 @@ package mineplex.bungee.motd;
|
||||
|
||||
import java.util.concurrent.TimeUnit;
|
||||
|
||||
import net.md_5.bungee.api.event.PreLoginEvent;
|
||||
import net.md_5.bungee.api.event.ProxyPingEvent;
|
||||
import net.md_5.bungee.api.plugin.Listener;
|
||||
import net.md_5.bungee.api.plugin.Plugin;
|
||||
|
@ -55,17 +55,17 @@ public abstract class MiniPlugin implements Listener
|
||||
public final void onEnable()
|
||||
{
|
||||
long epoch = System.currentTimeMillis();
|
||||
Log("Initializing...");
|
||||
log("Initializing...");
|
||||
Enable();
|
||||
AddCommands();
|
||||
Log("Enabled in " + UtilTime.convertString(System.currentTimeMillis() - epoch, 1, TimeUnit.FIT) + ".");
|
||||
log("Enabled in " + UtilTime.convertString(System.currentTimeMillis() - epoch, 1, TimeUnit.FIT) + ".");
|
||||
}
|
||||
|
||||
public final void onDisable()
|
||||
{
|
||||
Disable();
|
||||
|
||||
Log("Disabled.");
|
||||
log("Disabled.");
|
||||
}
|
||||
|
||||
public void Enable() { }
|
||||
@ -74,23 +74,28 @@ public abstract class MiniPlugin implements Listener
|
||||
|
||||
public void AddCommands() { }
|
||||
|
||||
public final String GetName()
|
||||
public final String getName()
|
||||
{
|
||||
return _moduleName;
|
||||
}
|
||||
|
||||
public final void AddCommand(ICommand command)
|
||||
public final void addCommand(ICommand command)
|
||||
{
|
||||
CommandCenter.Instance.AddCommand(command);
|
||||
}
|
||||
|
||||
public final void RemoveCommand(ICommand command)
|
||||
public final void removeCommand(ICommand command)
|
||||
{
|
||||
CommandCenter.Instance.RemoveCommand(command);
|
||||
}
|
||||
|
||||
protected void Log(String message)
|
||||
protected void log(String message)
|
||||
{
|
||||
System.out.println(F.main(_moduleName, message));
|
||||
}
|
||||
|
||||
protected void runAsync(Runnable runnable)
|
||||
{
|
||||
_plugin.getServer().getScheduler().runTaskAsynchronously(_plugin, runnable);
|
||||
}
|
||||
}
|
||||
|
@ -68,7 +68,7 @@ public class CoreClientManager extends MiniPlugin
|
||||
@Override
|
||||
public void AddCommands()
|
||||
{
|
||||
AddCommand(new UpdateRank(this));
|
||||
addCommand(new UpdateRank(this));
|
||||
}
|
||||
|
||||
public CoreClient Add(String name)
|
||||
|
@ -25,13 +25,13 @@ public class UpdateRank extends CommandBase<CoreClientManager>
|
||||
{
|
||||
if (args == null)
|
||||
{
|
||||
UtilPlayer.message(caller, F.main(Plugin.GetName(), "/" + AliasUsed + " joeschmo MODERATOR"));
|
||||
UtilPlayer.message(caller, F.main(Plugin.getName(), "/" + AliasUsed + " joeschmo MODERATOR"));
|
||||
}
|
||||
else
|
||||
{
|
||||
if (args.length == 0)
|
||||
{
|
||||
UtilPlayer.message(caller, F.main(Plugin.GetName(), "Player argument missing."));
|
||||
UtilPlayer.message(caller, F.main(Plugin.getName(), "Player argument missing."));
|
||||
return;
|
||||
}
|
||||
|
||||
@ -44,7 +44,7 @@ public class UpdateRank extends CommandBase<CoreClientManager>
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
UtilPlayer.message(caller, F.main(Plugin.GetName(), ChatColor.RED + "" + ChatColor.BOLD + "Invalid rank!"));
|
||||
UtilPlayer.message(caller, F.main(Plugin.getName(), ChatColor.RED + "" + ChatColor.BOLD + "Invalid rank!"));
|
||||
return;
|
||||
}
|
||||
|
||||
@ -90,7 +90,7 @@ public class UpdateRank extends CommandBase<CoreClientManager>
|
||||
{
|
||||
public void run(Rank rank)
|
||||
{
|
||||
caller.sendMessage(F.main(Plugin.GetName(), target + "'s rank has been updated to " + rank.Name + "!"));
|
||||
caller.sendMessage(F.main(Plugin.getName(), target + "'s rank has been updated to " + rank.Name + "!"));
|
||||
}
|
||||
}, target, rank, true);
|
||||
|
||||
|
@ -114,7 +114,7 @@ public class AchievementManager extends MiniPlugin
|
||||
@Override
|
||||
public void AddCommands()
|
||||
{
|
||||
AddCommand(new StatsCommand(this));
|
||||
addCommand(new StatsCommand(this));
|
||||
}
|
||||
|
||||
public void openShop(Player player)
|
||||
|
@ -82,8 +82,8 @@ public class Chat extends MiniPlugin
|
||||
@Override
|
||||
public void AddCommands()
|
||||
{
|
||||
AddCommand(new SilenceCommand(this));
|
||||
AddCommand(new BroadcastCommand(this));
|
||||
addCommand(new SilenceCommand(this));
|
||||
addCommand(new BroadcastCommand(this));
|
||||
}
|
||||
|
||||
public void Silence(long duration, boolean inform)
|
||||
@ -113,7 +113,7 @@ public class Chat extends MiniPlugin
|
||||
if (event.getMessage().toLowerCase().startsWith("/me")
|
||||
|| event.getMessage().toLowerCase().startsWith("/bukkit"))
|
||||
{
|
||||
event.getPlayer().sendMessage(F.main(GetName(), "No, you!"));
|
||||
event.getPlayer().sendMessage(F.main(getName(), "No, you!"));
|
||||
event.setCancelled(true);
|
||||
}
|
||||
}
|
||||
@ -123,7 +123,7 @@ public class Chat extends MiniPlugin
|
||||
{
|
||||
if (event.getMessage().equals("lag") || event.getMessage().equals("ping"))
|
||||
{
|
||||
event.getPlayer().sendMessage(F.main(GetName(), "PONG!"));
|
||||
event.getPlayer().sendMessage(F.main(getName(), "PONG!"));
|
||||
event.setCancelled(true);
|
||||
}
|
||||
}
|
||||
@ -157,11 +157,11 @@ public class Chat extends MiniPlugin
|
||||
return false;
|
||||
|
||||
if (_silenced == -1)
|
||||
UtilPlayer.message(player, F.main(GetName(), "Chat is silenced permanently."));
|
||||
UtilPlayer.message(player, F.main(getName(), "Chat is silenced permanently."));
|
||||
else
|
||||
UtilPlayer.message(
|
||||
player,
|
||||
F.main(GetName(),
|
||||
F.main(getName(),
|
||||
"Chat is silenced for "
|
||||
+ F.time(UtilTime.MakeStr(_silenced - System.currentTimeMillis(), 1)) + "."));
|
||||
|
||||
|
@ -65,8 +65,8 @@ public class GadgetPage extends ShopPageBase<CosmeticManager, CosmeticShop>
|
||||
{
|
||||
if (gadget instanceof MorphNotch)
|
||||
{
|
||||
setItem(slot, new ShopItem(gadget.GetDisplayMaterial(), gadget.GetDisplayData(), "Disabled " + gadget.GetName(), new String[] { "Sorry! Currently disabled until fix is made for 1.8 players!" }, 1, false, false));
|
||||
return;
|
||||
//setItem(slot, new ShopItem(gadget.GetDisplayMaterial(), gadget.GetDisplayData(), "Disabled " + gadget.GetName(), new String[] { "Sorry! Currently disabled until fix is made for 1.8 players!" }, 1, false, false));
|
||||
//return;
|
||||
}
|
||||
List<String> itemLore = new ArrayList<String>();
|
||||
|
||||
|
@ -67,7 +67,7 @@ public class PetTagPage extends ShopPageBase<CosmeticManager, CosmeticShop>
|
||||
|
||||
if (_tagName.length() > 16)
|
||||
{
|
||||
UtilPlayer.message(Player, F.main(Plugin.GetName(), ChatColor.RED + "Pet name cannot be longer than 16 characters."));
|
||||
UtilPlayer.message(Player, F.main(Plugin.getName(), ChatColor.RED + "Pet name cannot be longer than 16 characters."));
|
||||
PlayDenySound(Player);
|
||||
|
||||
Shop.OpenPageForPlayer(Player, new PetPage(Plugin, Shop, ClientManager, DonationManager, "Pets", Player));
|
||||
|
@ -43,7 +43,7 @@ public class Creature extends MiniPlugin
|
||||
@Override
|
||||
public void AddCommands()
|
||||
{
|
||||
AddCommand(new MobCommand(this));
|
||||
addCommand(new MobCommand(this));
|
||||
}
|
||||
|
||||
public Entity SpawnEntity(Location location, EntityType entityType)
|
||||
|
@ -17,7 +17,7 @@ public class HelpCommand extends CommandBase<Creature>
|
||||
@Override
|
||||
public void Execute(Player caller, String[] args)
|
||||
{
|
||||
UtilPlayer.message(caller, F.main(Plugin.GetName(), "Commands List;"));
|
||||
UtilPlayer.message(caller, F.main(Plugin.getName(), "Commands List;"));
|
||||
UtilPlayer.message(caller, F.help("/mob", "List Entities", Rank.MODERATOR));
|
||||
UtilPlayer.message(caller, F.help("/mob kill <Type>", "Remove Entities of Type", Rank.ADMIN));
|
||||
UtilPlayer.message(caller, F.help("/mob <Type> (# baby lock angry s# <Prof>)", "Create", Rank.ADMIN));
|
||||
|
@ -29,7 +29,7 @@ public class KillCommand extends CommandBase<Creature>
|
||||
{
|
||||
if (args == null || args.length == 0)
|
||||
{
|
||||
UtilPlayer.message(caller, F.main(Plugin.GetName(), "Missing Entity Type Parameter."));
|
||||
UtilPlayer.message(caller, F.main(Plugin.getName(), "Missing Entity Type Parameter."));
|
||||
return;
|
||||
}
|
||||
|
||||
@ -68,6 +68,6 @@ public class KillCommand extends CommandBase<Creature>
|
||||
if (type != null)
|
||||
target = UtilEnt.getName(type);
|
||||
|
||||
UtilPlayer.message(caller, F.main(Plugin.GetName(), "Killed " + target + ". " + count + " Removed."));
|
||||
UtilPlayer.message(caller, F.main(Plugin.getName(), "Killed " + target + ". " + count + " Removed."));
|
||||
}
|
||||
}
|
||||
|
@ -54,7 +54,7 @@ public class MobCommand extends MultiCommandBase<Creature>
|
||||
}
|
||||
}
|
||||
|
||||
UtilPlayer.message(caller, F.main(Plugin.GetName(), "Listing Entities:"));
|
||||
UtilPlayer.message(caller, F.main(Plugin.getName(), "Listing Entities:"));
|
||||
for (EntityType cur : entMap.keySet())
|
||||
{
|
||||
UtilPlayer.message(caller, F.desc(UtilEnt.getName(cur), entMap.get(cur)+""));
|
||||
@ -69,7 +69,7 @@ public class MobCommand extends MultiCommandBase<Creature>
|
||||
if (type == null)
|
||||
return;
|
||||
|
||||
UtilPlayer.message(caller, F.main(Plugin.GetName(), "Spawning Creature(s);"));
|
||||
UtilPlayer.message(caller, F.main(Plugin.getName(), "Spawning Creature(s);"));
|
||||
|
||||
//Store Args
|
||||
HashSet<String> argSet = new HashSet<String>();
|
||||
@ -245,7 +245,7 @@ public class MobCommand extends MultiCommandBase<Creature>
|
||||
UtilPlayer.message(caller, F.desc("Unhandled", arg));
|
||||
|
||||
//Inform
|
||||
UtilPlayer.message(caller, F.main(Plugin.GetName(), "Spawned " + count + " " + UtilEnt.getName(type) + "."));
|
||||
UtilPlayer.message(caller, F.main(Plugin.getName(), "Spawned " + count + " " + UtilEnt.getName(type) + "."));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -0,0 +1,43 @@
|
||||
package mineplex.core.database.column;
|
||||
|
||||
import java.sql.PreparedStatement;
|
||||
import java.sql.ResultSet;
|
||||
import java.sql.SQLException;
|
||||
|
||||
public class ColumnByte extends Column<Byte>
|
||||
{
|
||||
public ColumnByte(String name)
|
||||
{
|
||||
super(name);
|
||||
Value = (byte)0;
|
||||
}
|
||||
|
||||
public ColumnByte(String name, Byte value)
|
||||
{
|
||||
super(name, value);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getCreateString()
|
||||
{
|
||||
return Name + " TINYINT";
|
||||
}
|
||||
|
||||
@Override
|
||||
public Byte getValue(ResultSet resultSet) throws SQLException
|
||||
{
|
||||
return resultSet.getByte(Name);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setValue(PreparedStatement preparedStatement, int columnNumber) throws SQLException
|
||||
{
|
||||
preparedStatement.setLong(columnNumber, Value);
|
||||
}
|
||||
|
||||
@Override
|
||||
public ColumnByte clone()
|
||||
{
|
||||
return new ColumnByte(Name, Value);
|
||||
}
|
||||
}
|
@ -0,0 +1,43 @@
|
||||
package mineplex.core.database.column;
|
||||
|
||||
import java.sql.PreparedStatement;
|
||||
import java.sql.ResultSet;
|
||||
import java.sql.SQLException;
|
||||
|
||||
public class ColumnDouble extends Column<Double>
|
||||
{
|
||||
public ColumnDouble(String name)
|
||||
{
|
||||
super(name);
|
||||
Value = 0.0;
|
||||
}
|
||||
|
||||
public ColumnDouble(String name, Double value)
|
||||
{
|
||||
super(name, value);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getCreateString()
|
||||
{
|
||||
return Name + " DOUBLE";
|
||||
}
|
||||
|
||||
@Override
|
||||
public Double getValue(ResultSet resultSet) throws SQLException
|
||||
{
|
||||
return resultSet.getDouble(Name);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setValue(PreparedStatement preparedStatement, int columnNumber) throws SQLException
|
||||
{
|
||||
preparedStatement.setDouble(columnNumber, Value);
|
||||
}
|
||||
|
||||
@Override
|
||||
public ColumnDouble clone()
|
||||
{
|
||||
return new ColumnDouble(Name, Value);
|
||||
}
|
||||
}
|
@ -11,6 +11,7 @@ import net.minecraft.server.v1_7_R4.ChunkAddEntityEvent;
|
||||
import net.minecraft.server.v1_7_R4.EntityPlayer;
|
||||
import net.minecraft.server.v1_7_R4.Packet;
|
||||
import net.minecraft.server.v1_7_R4.PacketPlayOutNamedEntitySpawn;
|
||||
import net.minecraft.server.v1_7_R4.PacketPlayOutPlayerInfo;
|
||||
import net.minecraft.server.v1_7_R4.PacketPlayOutSpawnEntity;
|
||||
import net.minecraft.server.v1_7_R4.PacketPlayOutEntityVelocity;
|
||||
import net.minecraft.server.v1_7_R4.PacketPlayOutEntityDestroy;
|
||||
@ -40,6 +41,7 @@ import mineplex.core.common.util.NautHashMap;
|
||||
import mineplex.core.disguise.disguises.DisguiseBase;
|
||||
import mineplex.core.disguise.disguises.DisguiseBlock;
|
||||
import mineplex.core.disguise.disguises.DisguiseInsentient;
|
||||
import mineplex.core.disguise.disguises.DisguisePlayer;
|
||||
import mineplex.core.packethandler.IPacketHandler;
|
||||
import mineplex.core.packethandler.PacketHandler;
|
||||
import mineplex.core.packethandler.PacketVerifier;
|
||||
@ -58,10 +60,12 @@ public class DisguiseManager extends MiniPlugin implements IPacketHandler
|
||||
private NautHashMap<String, EntityType> _addTempList = new NautHashMap<String, EntityType>();
|
||||
private HashSet<String> _delTempList = new HashSet<String>();
|
||||
private NautHashMap<DisguiseBase, HashSet<Player>> _disguisePlayerMap = new NautHashMap<DisguiseBase, HashSet<Player>>();
|
||||
private HashSet<String> _blockedNames = new HashSet<String>();
|
||||
|
||||
private boolean _handlingPacket = false;
|
||||
|
||||
private Field _attributesA;
|
||||
private Field _attributesB;
|
||||
private Field _soundB;
|
||||
private Field _soundC;
|
||||
private Field _soundD;
|
||||
@ -76,6 +80,8 @@ public class DisguiseManager extends MiniPlugin implements IPacketHandler
|
||||
{
|
||||
_attributesA = PacketPlayOutUpdateAttributes.class.getDeclaredField("a");
|
||||
_attributesA.setAccessible(true);
|
||||
_attributesB = PacketPlayOutUpdateAttributes.class.getDeclaredField("b");
|
||||
_attributesB.setAccessible(true);
|
||||
_soundB = PacketPlayOutNamedSoundEffect.class.getDeclaredField("b");
|
||||
_soundB.setAccessible(true);
|
||||
_soundC = PacketPlayOutNamedSoundEffect.class.getDeclaredField("c");
|
||||
@ -144,6 +150,14 @@ public class DisguiseManager extends MiniPlugin implements IPacketHandler
|
||||
|
||||
_spawnPacketMap.put(disguise.GetEntityId(), disguise);
|
||||
_disguisePlayerMap.put(disguise, new HashSet<Player>());
|
||||
|
||||
if (disguise.GetEntity() instanceof Player && disguise instanceof DisguisePlayer)
|
||||
{
|
||||
if (!((Player)disguise.GetEntity()).getName().equalsIgnoreCase(((DisguisePlayer)disguise).getName()))
|
||||
{
|
||||
_blockedNames.add(((Player)disguise.GetEntity()).getName());
|
||||
}
|
||||
}
|
||||
|
||||
reApplyDisguise(disguise);
|
||||
}
|
||||
@ -166,9 +180,10 @@ public class DisguiseManager extends MiniPlugin implements IPacketHandler
|
||||
|
||||
EntityPlayer entityPlayer = ((CraftPlayer)player).getHandle();
|
||||
entityPlayer.playerConnection.sendPacket(new PacketPlayOutEntityDestroy(entity.getEntityId()));
|
||||
|
||||
|
||||
if (entity instanceof Player)
|
||||
{
|
||||
_blockedNames.remove(((Player)entity).getName());
|
||||
player.hidePlayer((Player)entity);
|
||||
player.showPlayer((Player)entity);
|
||||
}
|
||||
@ -229,6 +244,17 @@ public class DisguiseManager extends MiniPlugin implements IPacketHandler
|
||||
continue;
|
||||
|
||||
EntityPlayer entityPlayer = ((CraftPlayer)player).getHandle();
|
||||
|
||||
if (disguise instanceof DisguisePlayer)
|
||||
{
|
||||
entityPlayer.playerConnection.sendPacket(((DisguisePlayer)disguise).getNewInfoPacket(true));
|
||||
|
||||
if (disguise.GetEntity() instanceof EntityPlayer)
|
||||
{
|
||||
entityPlayer.playerConnection.sendPacket(((DisguisePlayer)disguise).getOldInfoPacket(false));
|
||||
}
|
||||
}
|
||||
|
||||
entityPlayer.playerConnection.sendPacket(disguise.GetSpawnPacket());
|
||||
|
||||
for (Packet packet : armorPackets)
|
||||
@ -368,20 +394,79 @@ public class DisguiseManager extends MiniPlugin implements IPacketHandler
|
||||
}
|
||||
|
||||
public void handle(PacketInfo packetInfo)
|
||||
{
|
||||
{
|
||||
if (_handlingPacket)
|
||||
return;
|
||||
|
||||
/*
|
||||
if (packetInfo.getPlayer().getName().equalsIgnoreCase("jRayx")
|
||||
&& !(packetInfo.getPacket() instanceof PacketPlayOutEntityVelocity)
|
||||
&& !(packetInfo.getPacket() instanceof PacketPlayOutEntityHeadRotation)
|
||||
&& !(packetInfo.getPacket() instanceof PacketPlayOutRelEntityMove)
|
||||
&& !(packetInfo.getPacket() instanceof PacketPlayOutRelEntityMoveLook)
|
||||
&& !(packetInfo.getPacket() instanceof PacketPlayOutTileEntityData)
|
||||
&& !(packetInfo.getPacket() instanceof PacketPlayOutUpdateTime)
|
||||
&& !(packetInfo.getPacket() instanceof PacketPlayOutAbilities)
|
||||
&& !(packetInfo.getPacket() instanceof PacketPlayOutSpawnEntityLiving)
|
||||
&& !(packetInfo.getPacket() instanceof PacketPlayOutEntityMetadata)
|
||||
&& !(packetInfo.getPacket() instanceof PacketPlayOutEntityEquipment)
|
||||
&& !(packetInfo.getPacket() instanceof PacketPlayOutEntityLook)
|
||||
&& !(packetInfo.getPacket() instanceof PacketPlayOutEntityDestroy)
|
||||
&& !(packetInfo.getPacket() instanceof PacketPlayOutScoreboardScore)
|
||||
&& !(packetInfo.getPacket() instanceof PacketPlayOutScoreboardObjective)
|
||||
&& !(packetInfo.getPacket() instanceof PacketPlayOutKeepAlive)
|
||||
&& !(packetInfo.getPacket() instanceof PacketPlayOutEntityTeleport)
|
||||
&& !(packetInfo.getPacket() instanceof PacketPlayOutBlockChange)
|
||||
&& !(packetInfo.getPacket() instanceof PacketPlayOutMapChunkBulk)
|
||||
&& !(packetInfo.getPacket() instanceof PacketPlayOutNamedSoundEffect)
|
||||
&& !(packetInfo.getPacket() instanceof PacketPlayOutUpdateSign)
|
||||
&& !(packetInfo.getPacket() instanceof PacketPlayOutWorldEvent))
|
||||
{
|
||||
System.out.println(packetInfo.getPacket().getClass().toString());
|
||||
|
||||
if (packetInfo.getPacket() instanceof PacketPlayOutUpdateAttributes)
|
||||
{
|
||||
try
|
||||
{
|
||||
for (Object attrObject : (List)_attributesB.get(packetInfo.getPacket()))
|
||||
{
|
||||
AttributeSnapshot attribute = (AttributeSnapshot)attrObject;
|
||||
System.out.println(attribute.a());
|
||||
System.out.println(attribute.b());
|
||||
System.out.println(attribute.c());
|
||||
}
|
||||
}
|
||||
catch (IllegalArgumentException | IllegalAccessException e)
|
||||
{
|
||||
// TODO Auto-generated catch block
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
}
|
||||
*/
|
||||
|
||||
final Packet packet = packetInfo.getPacket();
|
||||
Player owner = packetInfo.getPlayer();
|
||||
final PacketVerifier packetVerifier = packetInfo.getVerifier();
|
||||
|
||||
if (packet instanceof PacketPlayOutNamedEntitySpawn)
|
||||
if (packet instanceof PacketPlayOutPlayerInfo)
|
||||
{
|
||||
if (_blockedNames.contains(((PacketPlayOutPlayerInfo)packet).username))
|
||||
{
|
||||
packetInfo.setCancelled(true);
|
||||
}
|
||||
}
|
||||
else if (packet instanceof PacketPlayOutNamedEntitySpawn)
|
||||
{
|
||||
int entityId = ((PacketPlayOutNamedEntitySpawn)packet).a;
|
||||
|
||||
if (_spawnPacketMap.containsKey(entityId) && (_spawnPacketMap.get(entityId).Global || _disguisePlayerMap.get(_spawnPacketMap.get(entityId)).contains(owner)))
|
||||
{
|
||||
if (_spawnPacketMap.get(entityId) instanceof DisguisePlayer)
|
||||
{
|
||||
handlePacket(((DisguisePlayer)_spawnPacketMap.get(entityId)).getNewInfoPacket(true), packetVerifier);
|
||||
}
|
||||
|
||||
handlePacket(_spawnPacketMap.get(entityId).GetSpawnPacket(), packetVerifier);
|
||||
packetInfo.setCancelled(true);
|
||||
}
|
||||
|
@ -1,10 +1,12 @@
|
||||
package mineplex.core.disguise.disguises;
|
||||
|
||||
import org.spigotmc.ProtocolData;
|
||||
import org.bukkit.craftbukkit.v1_7_R4.entity.CraftPlayer;
|
||||
import org.bukkit.entity.Player;
|
||||
|
||||
import net.minecraft.server.v1_7_R4.MathHelper;
|
||||
import net.minecraft.server.v1_7_R4.Packet;
|
||||
import net.minecraft.server.v1_7_R4.PacketPlayOutNamedEntitySpawn;
|
||||
import net.minecraft.server.v1_7_R4.PacketPlayOutPlayerInfo;
|
||||
import net.minecraft.util.com.mojang.authlib.GameProfile;
|
||||
|
||||
public class DisguisePlayer extends DisguiseHuman
|
||||
@ -34,6 +36,35 @@ public class DisguisePlayer extends DisguiseHuman
|
||||
_sneaking = sneaking;
|
||||
}
|
||||
|
||||
public Packet getOldInfoPacket(boolean add)
|
||||
{
|
||||
PacketPlayOutPlayerInfo playerInfo = new PacketPlayOutPlayerInfo();
|
||||
|
||||
if (Entity instanceof Player)
|
||||
{
|
||||
playerInfo.username = Entity.getName();
|
||||
playerInfo.action = add ? 0 : 4;
|
||||
playerInfo.ping = 90;
|
||||
playerInfo.player = ((CraftPlayer)(Player)Entity).getProfile();
|
||||
playerInfo.gamemode = 0;
|
||||
}
|
||||
|
||||
return playerInfo;
|
||||
}
|
||||
|
||||
public Packet getNewInfoPacket(boolean add)
|
||||
{
|
||||
PacketPlayOutPlayerInfo newDisguiseInfo = new PacketPlayOutPlayerInfo();
|
||||
newDisguiseInfo.username = _profile.getName();
|
||||
newDisguiseInfo.action = add ? 0 : 4;
|
||||
newDisguiseInfo.ping = 90;
|
||||
newDisguiseInfo.player = _profile;
|
||||
newDisguiseInfo.gamemode = 0;
|
||||
|
||||
|
||||
return newDisguiseInfo;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void UpdateDataWatcher()
|
||||
{
|
||||
@ -62,4 +93,9 @@ public class DisguisePlayer extends DisguiseHuman
|
||||
|
||||
return packet;
|
||||
}
|
||||
|
||||
public String getName()
|
||||
{
|
||||
return _profile.getName();
|
||||
}
|
||||
}
|
||||
|
@ -15,6 +15,7 @@ import mineplex.core.common.util.Callback;
|
||||
import mineplex.core.common.util.NautHashMap;
|
||||
import mineplex.core.donation.repository.DonationRepository;
|
||||
import mineplex.core.donation.repository.token.DonorTokenWrapper;
|
||||
import mineplex.core.server.remotecall.JsonWebCall;
|
||||
import mineplex.core.server.util.TransactionResponse;
|
||||
import mineplex.core.updater.UpdateType;
|
||||
import mineplex.core.updater.event.UpdateEvent;
|
||||
@ -42,8 +43,8 @@ public class DonationManager extends MiniPlugin
|
||||
@Override
|
||||
public void AddCommands()
|
||||
{
|
||||
AddCommand(new GemCommand(this));
|
||||
AddCommand(new CoinCommand(this));
|
||||
addCommand(new GemCommand(this));
|
||||
addCommand(new CoinCommand(this));
|
||||
}
|
||||
|
||||
@EventHandler
|
||||
@ -300,4 +301,9 @@ public class DonationManager extends MiniPlugin
|
||||
//Clean
|
||||
_coinQueue.clear();
|
||||
}
|
||||
|
||||
public void applyKits(String playerName)
|
||||
{
|
||||
_repository.applyKits(playerName);
|
||||
}
|
||||
}
|
||||
|
@ -13,6 +13,7 @@ import mineplex.core.database.column.ColumnVarChar;
|
||||
import mineplex.core.donation.repository.token.GemRewardToken;
|
||||
import mineplex.core.donation.repository.token.PurchaseToken;
|
||||
import mineplex.core.donation.repository.token.UnknownPurchaseToken;
|
||||
import mineplex.core.server.remotecall.AsyncJsonWebCall;
|
||||
import mineplex.core.server.remotecall.JsonWebCall;
|
||||
import mineplex.core.server.util.TransactionResponse;
|
||||
|
||||
@ -184,4 +185,9 @@ public class DonationRepository extends RepositoryBase
|
||||
}
|
||||
}), "Error updating player's null gems and coins DonationRepository : ");
|
||||
}
|
||||
|
||||
public void applyKits(String playerName)
|
||||
{
|
||||
new AsyncJsonWebCall(_webAddress + "PlayerAccount/ApplyKits").Execute(playerName);
|
||||
}
|
||||
}
|
@ -51,8 +51,8 @@ public class FriendManager extends MiniClientPlugin<FriendData>
|
||||
@Override
|
||||
public void AddCommands()
|
||||
{
|
||||
AddCommand(new AddFriend(this));
|
||||
AddCommand(new DeleteFriend(this));
|
||||
addCommand(new AddFriend(this));
|
||||
addCommand(new DeleteFriend(this));
|
||||
}
|
||||
|
||||
@Override
|
||||
@ -124,17 +124,17 @@ public class FriendManager extends MiniClientPlugin<FriendData>
|
||||
}
|
||||
else if (status.Status == FriendStatusType.Denied)
|
||||
{
|
||||
caller.sendMessage(F.main(GetName(), ChatColor.GREEN + name + ChatColor.GRAY + " has denied your friend request."));
|
||||
caller.sendMessage(F.main(getName(), ChatColor.GREEN + name + ChatColor.GRAY + " has denied your friend request."));
|
||||
return;
|
||||
}
|
||||
else if (status.Status == FriendStatusType.Accepted)
|
||||
{
|
||||
caller.sendMessage(F.main(GetName(), "You are already friends with " + ChatColor.GREEN + name));
|
||||
caller.sendMessage(F.main(getName(), "You are already friends with " + ChatColor.GREEN + name));
|
||||
return;
|
||||
}
|
||||
else if (status.Status == FriendStatusType.Sent)
|
||||
{
|
||||
caller.sendMessage(F.main(GetName(), ChatColor.GREEN + name + ChatColor.GRAY + " has yet to respond to your friend request."));
|
||||
caller.sendMessage(F.main(getName(), ChatColor.GREEN + name + ChatColor.GRAY + " has yet to respond to your friend request."));
|
||||
return;
|
||||
}
|
||||
}
|
||||
@ -195,9 +195,9 @@ public class FriendManager extends MiniClientPlugin<FriendData>
|
||||
public void run()
|
||||
{
|
||||
if (updateFinal)
|
||||
caller.sendMessage(F.main(GetName(), "You and " + ChatColor.GREEN + name + ChatColor.GRAY + " are now friends!"));
|
||||
caller.sendMessage(F.main(getName(), "You and " + ChatColor.GREEN + name + ChatColor.GRAY + " are now friends!"));
|
||||
else
|
||||
caller.sendMessage(F.main(GetName(), "Added " + ChatColor.GREEN + name + ChatColor.GRAY + " to your friends list!"));
|
||||
caller.sendMessage(F.main(getName(), "Added " + ChatColor.GREEN + name + ChatColor.GRAY + " to your friends list!"));
|
||||
}
|
||||
});
|
||||
}
|
||||
@ -253,7 +253,7 @@ public class FriendManager extends MiniClientPlugin<FriendData>
|
||||
}
|
||||
}
|
||||
|
||||
caller.sendMessage(F.main(GetName(), "Deleted " + ChatColor.GREEN + name + ChatColor.GRAY + " from your friends list!"));
|
||||
caller.sendMessage(F.main(getName(), "Deleted " + ChatColor.GREEN + name + ChatColor.GRAY + " from your friends list!"));
|
||||
}
|
||||
});
|
||||
}
|
||||
|
@ -19,7 +19,7 @@ public class DeleteFriend extends CommandBase<FriendManager>
|
||||
public void Execute(final Player caller, final String[] args)
|
||||
{
|
||||
if (args == null)
|
||||
F.main(Plugin.GetName(), "You need to include a player's name.");
|
||||
F.main(Plugin.getName(), "You need to include a player's name.");
|
||||
else
|
||||
{
|
||||
CommandCenter.GetClientManager().checkPlayerName(caller, args[0], new Callback<Boolean>()
|
||||
|
@ -112,7 +112,7 @@ public class GadgetManager extends MiniPlugin
|
||||
addGadget(new MorphBlock(this));
|
||||
addGadget(new MorphEnderman(this));
|
||||
addGadget(new MorphBat(this));
|
||||
//addGadget(new MorphNotch(this));
|
||||
addGadget(new MorphNotch(this));
|
||||
addGadget(new MorphPumpkinKing(this));
|
||||
addGadget(new MorphPig(this));
|
||||
addGadget(new MorphCreeper(this));
|
||||
|
@ -152,6 +152,6 @@ public class InventoryManager extends MiniClientPlugin<ClientInventory>
|
||||
@Override
|
||||
public void AddCommands()
|
||||
{
|
||||
AddCommand(new GiveItemCommand(this));
|
||||
addCommand(new GiveItemCommand(this));
|
||||
}
|
||||
}
|
||||
|
@ -36,7 +36,7 @@ public class Map extends MiniPlugin
|
||||
@Override
|
||||
public void AddCommands()
|
||||
{
|
||||
AddCommand(new MapImage(this));
|
||||
addCommand(new MapImage(this));
|
||||
}
|
||||
|
||||
public ItemStack GetMap()
|
||||
|
@ -29,7 +29,7 @@ public class AdminCommand extends CommandBase<MessageManager>
|
||||
{
|
||||
if (args.length == 0)
|
||||
{
|
||||
UtilPlayer.message(caller, F.main(Plugin.GetName(), "Message argument missing."));
|
||||
UtilPlayer.message(caller, F.main(Plugin.getName(), "Message argument missing."));
|
||||
return;
|
||||
}
|
||||
|
||||
@ -56,7 +56,7 @@ public class AdminCommand extends CommandBase<MessageManager>
|
||||
}
|
||||
|
||||
if (!staff)
|
||||
UtilPlayer.message(caller, F.main(Plugin.GetName(), "There are no Staff Members online."));
|
||||
UtilPlayer.message(caller, F.main(Plugin.getName(), "There are no Staff Members online."));
|
||||
|
||||
//Log XXX
|
||||
//Logger().logChat("Staff Chat", from, staff, message);
|
||||
|
@ -29,7 +29,7 @@ public class MessageAdminCommand extends CommandBase<MessageManager>
|
||||
|
||||
if (args.length == 0)
|
||||
{
|
||||
UtilPlayer.message(caller, F.main(Plugin.GetName(), "Player argument missing."));
|
||||
UtilPlayer.message(caller, F.main(Plugin.getName(), "Player argument missing."));
|
||||
return;
|
||||
}
|
||||
|
||||
@ -41,7 +41,7 @@ public class MessageAdminCommand extends CommandBase<MessageManager>
|
||||
//Parse Message
|
||||
if (args.length < 2)
|
||||
{
|
||||
UtilPlayer.message(caller, F.main(Plugin.GetName(), "Message argument missing."));
|
||||
UtilPlayer.message(caller, F.main(Plugin.getName(), "Message argument missing."));
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -26,7 +26,7 @@ public class MessageCommand extends CommandBase<MessageManager>
|
||||
{
|
||||
if (args.length == 0)
|
||||
{
|
||||
UtilPlayer.message(caller, F.main(Plugin.GetName(), "Player argument missing."));
|
||||
UtilPlayer.message(caller, F.main(Plugin.getName(), "Player argument missing."));
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -30,21 +30,21 @@ public class ResendAdminCommand extends CommandBase<MessageManager>
|
||||
//Get To
|
||||
if (Plugin.Get(caller).LastAdminTo == null)
|
||||
{
|
||||
UtilPlayer.message(caller, F.main(Plugin.GetName(), "You have not admin messaged anyone recently."));
|
||||
UtilPlayer.message(caller, F.main(Plugin.getName(), "You have not admin messaged anyone recently."));
|
||||
return;
|
||||
}
|
||||
|
||||
Player to = UtilPlayer.searchOnline(caller, Plugin.Get(caller).LastAdminTo, false);
|
||||
if (to == null)
|
||||
{
|
||||
UtilPlayer.message(caller, F.main(Plugin.GetName(), F.name(Plugin.Get(caller).LastAdminTo) + " is no longer online."));
|
||||
UtilPlayer.message(caller, F.main(Plugin.getName(), F.name(Plugin.Get(caller).LastAdminTo) + " is no longer online."));
|
||||
return;
|
||||
}
|
||||
|
||||
//Parse Message
|
||||
if (args.length < 1)
|
||||
{
|
||||
UtilPlayer.message(caller, F.main(Plugin.GetName(), "Message argument missing."));
|
||||
UtilPlayer.message(caller, F.main(Plugin.getName(), "Message argument missing."));
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -27,14 +27,14 @@ public class ResendCommand extends CommandBase<MessageManager>
|
||||
//Get To
|
||||
if (Plugin.Get(caller).LastTo == null)
|
||||
{
|
||||
UtilPlayer.message(caller, F.main(Plugin.GetName(), "You have not messaged anyone recently."));
|
||||
UtilPlayer.message(caller, F.main(Plugin.getName(), "You have not messaged anyone recently."));
|
||||
return;
|
||||
}
|
||||
|
||||
Player to = UtilPlayer.searchOnline(caller, Plugin.Get(caller).LastTo, false);
|
||||
if (to == null)
|
||||
{
|
||||
UtilPlayer.message(caller, F.main(Plugin.GetName(), F.name(Plugin.Get(caller).LastTo) + " is no longer online."));
|
||||
UtilPlayer.message(caller, F.main(Plugin.getName(), F.name(Plugin.Get(caller).LastTo) + " is no longer online."));
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -78,14 +78,14 @@ public class MessageManager extends MiniClientPlugin<ClientMessage>
|
||||
|
||||
public void AddCommands()
|
||||
{
|
||||
AddCommand(new MessageCommand(this));
|
||||
AddCommand(new ResendCommand(this));
|
||||
addCommand(new MessageCommand(this));
|
||||
addCommand(new ResendCommand(this));
|
||||
|
||||
AddCommand(new MessageAdminCommand(this));
|
||||
AddCommand(new ResendAdminCommand(this));
|
||||
addCommand(new MessageAdminCommand(this));
|
||||
addCommand(new ResendAdminCommand(this));
|
||||
|
||||
|
||||
AddCommand(new AdminCommand(this));
|
||||
addCommand(new AdminCommand(this));
|
||||
}
|
||||
|
||||
public void Help(Player caller, String message)
|
||||
|
@ -106,10 +106,10 @@ public class LagMeter extends MiniPlugin
|
||||
player.sendMessage(" ");
|
||||
player.sendMessage(" ");
|
||||
player.sendMessage(" ");
|
||||
player.sendMessage(F.main(GetName(), ChatColor.GRAY + "Live-------" + ChatColor.YELLOW + String.format("%.00f", _ticksPerSecond)));
|
||||
player.sendMessage(F.main(GetName(), ChatColor.GRAY + "Avg--------" + ChatColor.YELLOW + String.format("%.00f", _ticksPerSecondAverage * 20)));
|
||||
player.sendMessage(F.main(GetName(), ChatColor.YELLOW + "MEM"));
|
||||
player.sendMessage(F.main(GetName(), ChatColor.GRAY + "Free-------" + ChatColor.YELLOW + (Runtime.getRuntime().freeMemory() / 1048576) + "MB"));
|
||||
player.sendMessage(F.main(GetName(), ChatColor.GRAY + "Max--------" + ChatColor.YELLOW + (Runtime.getRuntime().maxMemory() / 1048576)) + "MB");
|
||||
player.sendMessage(F.main(getName(), ChatColor.GRAY + "Live-------" + ChatColor.YELLOW + String.format("%.00f", _ticksPerSecond)));
|
||||
player.sendMessage(F.main(getName(), ChatColor.GRAY + "Avg--------" + ChatColor.YELLOW + String.format("%.00f", _ticksPerSecondAverage * 20)));
|
||||
player.sendMessage(F.main(getName(), ChatColor.YELLOW + "MEM"));
|
||||
player.sendMessage(F.main(getName(), ChatColor.GRAY + "Free-------" + ChatColor.YELLOW + (Runtime.getRuntime().freeMemory() / 1048576) + "MB"));
|
||||
player.sendMessage(F.main(getName(), ChatColor.GRAY + "Max--------" + ChatColor.YELLOW + (Runtime.getRuntime().maxMemory() / 1048576)) + "MB");
|
||||
}
|
||||
}
|
||||
|
@ -132,7 +132,7 @@ public class NpcManager extends MiniPlugin
|
||||
@Override
|
||||
public void AddCommands()
|
||||
{
|
||||
AddCommand(new NpcCommand(this));
|
||||
addCommand(new NpcCommand(this));
|
||||
}
|
||||
|
||||
public void help(Player caller, String message)
|
||||
@ -236,9 +236,9 @@ public class NpcManager extends MiniPlugin
|
||||
try
|
||||
{
|
||||
if (deleteNpc(event.getRightClicked()))
|
||||
event.getPlayer().sendMessage(F.main(GetName(), "Deleted npc."));
|
||||
event.getPlayer().sendMessage(F.main(getName(), "Deleted npc."));
|
||||
else
|
||||
event.getPlayer().sendMessage(F.main(GetName(), "Failed to delete npc. That one isn't in the list."));
|
||||
event.getPlayer().sendMessage(F.main(getName(), "Failed to delete npc. That one isn't in the list."));
|
||||
}
|
||||
catch (SQLException e)
|
||||
{
|
||||
|
@ -28,7 +28,7 @@ public class ClearCommand extends CommandBase<NpcManager>
|
||||
{
|
||||
Plugin.clearNpcs(true);
|
||||
|
||||
UtilPlayer.message(caller, F.main(Plugin.GetName(), "Cleared NPCs."));
|
||||
UtilPlayer.message(caller, F.main(Plugin.getName(), "Cleared NPCs."));
|
||||
}
|
||||
catch (SQLException e)
|
||||
{
|
||||
|
@ -24,7 +24,7 @@ public class DeleteCommand extends CommandBase<NpcManager>
|
||||
{
|
||||
Plugin.prepDeleteNpc(caller);
|
||||
|
||||
UtilPlayer.message(caller, F.main(Plugin.GetName(), "Now right click npc."));
|
||||
UtilPlayer.message(caller, F.main(Plugin.getName(), "Now right click npc."));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -24,7 +24,7 @@ public class HomeCommand extends CommandBase<NpcManager>
|
||||
{
|
||||
Plugin.teleportNpcsHome();
|
||||
|
||||
UtilPlayer.message(caller, F.main(Plugin.GetName(), "Npcs teleported to home locations."));
|
||||
UtilPlayer.message(caller, F.main(Plugin.getName(), "Npcs teleported to home locations."));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -29,7 +29,7 @@ public class RefreshCommand extends CommandBase<NpcManager>
|
||||
Plugin.clearNpcs(false);
|
||||
Plugin.loadNpcs();
|
||||
|
||||
UtilPlayer.message(caller, F.main(Plugin.GetName(), "Refreshed NPCs."));
|
||||
UtilPlayer.message(caller, F.main(Plugin.getName(), "Refreshed NPCs."));
|
||||
}
|
||||
catch (SQLException e)
|
||||
{
|
||||
|
@ -22,7 +22,7 @@ public class SendCommand extends CommandBase<Portal>
|
||||
{
|
||||
if(args == null || args.length == 0)
|
||||
{
|
||||
UtilPlayer.message(player, F.main(Plugin.GetName(), C.cRed + "Your arguments are inappropriate for this command!"));
|
||||
UtilPlayer.message(player, F.main(Plugin.getName(), C.cRed + "Your arguments are inappropriate for this command!"));
|
||||
return;
|
||||
}
|
||||
else if(args.length == 2)
|
||||
@ -36,7 +36,7 @@ public class SendCommand extends CommandBase<Portal>
|
||||
{
|
||||
if (!playerExists)
|
||||
{
|
||||
UtilPlayer.message(player, F.main(Plugin.GetName(), C.cGray + "Player " + C.cGold + playerTarget + C.cGray + " does not exist!"));
|
||||
UtilPlayer.message(player, F.main(Plugin.getName(), C.cGray + "Player " + C.cGold + playerTarget + C.cGray + " does not exist!"));
|
||||
return;
|
||||
}
|
||||
|
||||
@ -46,13 +46,13 @@ public class SendCommand extends CommandBase<Portal>
|
||||
{
|
||||
if (!serverExists)
|
||||
{
|
||||
UtilPlayer.message(player, F.main(Plugin.GetName(), C.cGray + "Server " + C.cGold + serverTarget + C.cGray + " does not exist!"));
|
||||
UtilPlayer.message(player, F.main(Plugin.getName(), C.cGray + "Server " + C.cGold + serverTarget + C.cGray + " does not exist!"));
|
||||
return;
|
||||
}
|
||||
|
||||
Portal.transferPlayer(playerTarget, serverTarget);
|
||||
|
||||
UtilPlayer.message(player, F.main(Plugin.GetName(), C.cGray + "You have sent player: " + C.cGold + playerTarget + C.cGray + " to server: " + C.cGold + serverTarget + C.cGray + "!"));
|
||||
UtilPlayer.message(player, F.main(Plugin.getName(), C.cGray + "You have sent player: " + C.cGold + playerTarget + C.cGray + " to server: " + C.cGold + serverTarget + C.cGray + "!"));
|
||||
return;
|
||||
}
|
||||
});
|
||||
@ -61,7 +61,7 @@ public class SendCommand extends CommandBase<Portal>
|
||||
}
|
||||
else
|
||||
{
|
||||
UtilPlayer.message(player, F.main(Plugin.GetName(), C.cRed + "Your arguments are inappropriate for this command!"));
|
||||
UtilPlayer.message(player, F.main(Plugin.getName(), C.cRed + "Your arguments are inappropriate for this command!"));
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
@ -26,7 +26,7 @@ public class ServerCommand extends CommandBase<Portal>
|
||||
if (args == null || args.length == 0)
|
||||
{
|
||||
UtilPlayer.message(player,
|
||||
F.main(Plugin.GetName(), C.cGray + "You are currently on server: " + C.cGold + serverName));
|
||||
F.main(Plugin.getName(), C.cGray + "You are currently on server: " + C.cGold + serverName));
|
||||
return;
|
||||
}
|
||||
else if (args.length == 1)
|
||||
@ -35,7 +35,7 @@ public class ServerCommand extends CommandBase<Portal>
|
||||
{
|
||||
UtilPlayer.message(
|
||||
player,
|
||||
F.main(Plugin.GetName(), "You are already on " + C.cGold + serverName + C.cGray
|
||||
F.main(Plugin.getName(), "You are already on " + C.cGold + serverName + C.cGray
|
||||
+ "!"));
|
||||
}
|
||||
else
|
||||
@ -48,7 +48,7 @@ public class ServerCommand extends CommandBase<Portal>
|
||||
{
|
||||
UtilPlayer.message(
|
||||
player,
|
||||
F.main(Plugin.GetName(), "Server " + C.cGold + args[0]
|
||||
F.main(Plugin.getName(), "Server " + C.cGold + args[0]
|
||||
+ C.cGray + " does not exist!"));
|
||||
return;
|
||||
}
|
||||
@ -93,7 +93,7 @@ public class ServerCommand extends CommandBase<Portal>
|
||||
{
|
||||
UtilPlayer.message(
|
||||
player,
|
||||
F.main(Plugin.GetName(), C.cRed + "You don't have permission to join " + C.cGold + args[0]));
|
||||
F.main(Plugin.getName(), C.cRed + "You don't have permission to join " + C.cGold + args[0]));
|
||||
}
|
||||
}
|
||||
});
|
||||
@ -102,7 +102,7 @@ public class ServerCommand extends CommandBase<Portal>
|
||||
else
|
||||
{
|
||||
UtilPlayer.message(player,
|
||||
F.main(Plugin.GetName(), C.cRed + "Your arguments are inappropriate for this command!"));
|
||||
F.main(Plugin.getName(), C.cRed + "Your arguments are inappropriate for this command!"));
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
@ -44,7 +44,7 @@ public class Portal extends MiniPlugin
|
||||
Bukkit.getMessenger().registerOutgoingPluginChannel(GetPlugin(), "BungeeCord");
|
||||
|
||||
// Register the server command type for future use
|
||||
//ServerCommandManager.getInstance().registerCommandType(TransferCommand.class.getSimpleName(), TransferCommand.class);
|
||||
ServerCommandManager.getInstance().registerCommandType(TransferCommand.class, new TransferHandler());
|
||||
}
|
||||
|
||||
public void SendAllPlayers(String serverName)
|
||||
@ -64,7 +64,7 @@ public class Portal extends MiniPlugin
|
||||
UtilPlayer
|
||||
.message(
|
||||
player,
|
||||
F.main(GetName(), C.cGray + "You have been sent to server: " + C.cGold + serverName
|
||||
F.main(getName(), C.cGray + "You have been sent to server: " + C.cGold + serverName
|
||||
+ C.cGray + "!"));
|
||||
}
|
||||
|
||||
@ -140,7 +140,7 @@ public class Portal extends MiniPlugin
|
||||
|
||||
public void AddCommands()
|
||||
{
|
||||
AddCommand(new ServerCommand(this));
|
||||
AddCommand(new SendCommand(this));
|
||||
addCommand(new ServerCommand(this));
|
||||
addCommand(new SendCommand(this));
|
||||
}
|
||||
}
|
||||
|
@ -41,7 +41,7 @@ public class PreferencesManager extends MiniClientPlugin<UserPreferences>
|
||||
_repository = new PreferencesRepository(plugin, plugin.getConfig().getString("preferences.connectionurl"));
|
||||
_shop = new PreferencesShop(this, clientManager, donationManager);
|
||||
|
||||
AddCommand(new PreferencesCommand(this));
|
||||
addCommand(new PreferencesCommand(this));
|
||||
}
|
||||
|
||||
private void setupConfigValues()
|
||||
|
@ -54,7 +54,7 @@ public class Punish extends MiniPlugin
|
||||
@Override
|
||||
public void AddCommands()
|
||||
{
|
||||
AddCommand(new PunishCommand(this));
|
||||
addCommand(new PunishCommand(this));
|
||||
}
|
||||
|
||||
@EventHandler
|
||||
@ -102,7 +102,7 @@ public class Punish extends MiniPlugin
|
||||
|
||||
if (client != null && client.IsMuted())
|
||||
{
|
||||
event.getPlayer().sendMessage(F.main(GetName(), "Shh, you're muted because " + client.GetPunishment(PunishmentSentence.Mute).GetReason() + " by " + client.GetPunishment(PunishmentSentence.Mute).GetAdmin() + " for " + C.cGreen + UtilTime.convertString(client.GetPunishment(PunishmentSentence.Mute).GetRemaining(), 1, TimeUnit.FIT) + "."));
|
||||
event.getPlayer().sendMessage(F.main(getName(), "Shh, you're muted because " + client.GetPunishment(PunishmentSentence.Mute).GetReason() + " by " + client.GetPunishment(PunishmentSentence.Mute).GetAdmin() + " for " + C.cGreen + UtilTime.convertString(client.GetPunishment(PunishmentSentence.Mute).GetRemaining(), 1, TimeUnit.FIT) + "."));
|
||||
event.setCancelled(true);
|
||||
}
|
||||
}
|
||||
@ -114,7 +114,7 @@ public class Punish extends MiniPlugin
|
||||
|
||||
if (client != null && client.IsMuted())
|
||||
{
|
||||
event.getPlayer().sendMessage(F.main(GetName(), "Shh, you're muted because " + client.GetPunishment(PunishmentSentence.Mute).GetReason() + " by " + client.GetPunishment(PunishmentSentence.Mute).GetAdmin() + " for " + C.cGreen + UtilTime.convertString(client.GetPunishment(PunishmentSentence.Mute).GetRemaining(), 1, TimeUnit.FIT) + "."));
|
||||
event.getPlayer().sendMessage(F.main(getName(), "Shh, you're muted because " + client.GetPunishment(PunishmentSentence.Mute).GetReason() + " by " + client.GetPunishment(PunishmentSentence.Mute).GetAdmin() + " for " + C.cGreen + UtilTime.convertString(client.GetPunishment(PunishmentSentence.Mute).GetRemaining(), 1, TimeUnit.FIT) + "."));
|
||||
event.setMessage(" ");
|
||||
event.setCancelled(true);
|
||||
}
|
||||
@ -146,16 +146,16 @@ public class Punish extends MiniPlugin
|
||||
if (banResult == PunishmentResponse.AccountDoesNotExist)
|
||||
{
|
||||
if (caller != null)
|
||||
caller.sendMessage(F.main(GetName(), "Account with name " + F.elem(playerName) + " does not exist."));
|
||||
caller.sendMessage(F.main(getName(), "Account with name " + F.elem(playerName) + " does not exist."));
|
||||
else
|
||||
System.out.println(F.main(GetName(), "Account with name " + F.elem(playerName) + " does not exist."));
|
||||
System.out.println(F.main(getName(), "Account with name " + F.elem(playerName) + " does not exist."));
|
||||
}
|
||||
else if (banResult == PunishmentResponse.InsufficientPrivileges)
|
||||
{
|
||||
if (caller != null)
|
||||
caller.sendMessage(F.main(GetName(), "You have insufficient rights to punish " + F.elem(playerName) + "."));
|
||||
caller.sendMessage(F.main(getName(), "You have insufficient rights to punish " + F.elem(playerName) + "."));
|
||||
else
|
||||
System.out.println(F.main(GetName(), "You have insufficient rights to punish " + F.elem(playerName) + "."));
|
||||
System.out.println(F.main(getName(), "You have insufficient rights to punish " + F.elem(playerName) + "."));
|
||||
}
|
||||
else if (banResult == PunishmentResponse.Punished)
|
||||
{
|
||||
@ -164,7 +164,7 @@ public class Punish extends MiniPlugin
|
||||
if (sentence == PunishmentSentence.Ban)
|
||||
{
|
||||
if (caller == null)
|
||||
System.out.println(F.main(GetName(), F.elem(caller == null ? "Mineplex Anti-Cheat" : caller.getName()) + " banned " + F.elem(playerName) + " because of " + F.elem(reason) + " for " + durationString + "."));
|
||||
System.out.println(F.main(getName(), F.elem(caller == null ? "Mineplex Anti-Cheat" : caller.getName()) + " banned " + F.elem(playerName) + " because of " + F.elem(reason) + " for " + durationString + "."));
|
||||
|
||||
Bukkit.getServer().getScheduler().scheduleSyncDelayedTask(GetPlugin(), new Runnable()
|
||||
{
|
||||
@ -181,19 +181,19 @@ public class Punish extends MiniPlugin
|
||||
}
|
||||
});
|
||||
|
||||
informOfPunish(playerName, F.main(GetName(), caller == null ? "Mineplex Anti-Cheat" : caller.getName() + " banned " + playerName + " for " + durationString + "."));
|
||||
informOfPunish(playerName, F.main(getName(), caller == null ? "Mineplex Anti-Cheat" : caller.getName() + " banned " + playerName + " for " + durationString + "."));
|
||||
}
|
||||
else
|
||||
{
|
||||
if (caller == null)
|
||||
System.out.println(F.main(GetName(), F.elem(caller == null ? "Mineplex Anti-Cheat" : caller.getName()) + " muted " + F.elem(playerName) + " because of " + F.elem(reason) + " for " +
|
||||
System.out.println(F.main(getName(), F.elem(caller == null ? "Mineplex Anti-Cheat" : caller.getName()) + " muted " + F.elem(playerName) + " because of " + F.elem(reason) + " for " +
|
||||
durationString + "."));
|
||||
|
||||
//Warning
|
||||
if (finalDuration == 0)
|
||||
informOfPunish(playerName, F.main(GetName(), caller == null ? "Mineplex Anti-Cheat" : caller.getName() + " issued a friendly warning to " + playerName + "."));
|
||||
informOfPunish(playerName, F.main(getName(), caller == null ? "Mineplex Anti-Cheat" : caller.getName() + " issued a friendly warning to " + playerName + "."));
|
||||
else
|
||||
informOfPunish(playerName, F.main(GetName(), caller == null ? "Mineplex Anti-Cheat" : caller.getName() + " muted " + playerName + " for " + durationString + "."));
|
||||
informOfPunish(playerName, F.main(getName(), caller == null ? "Mineplex Anti-Cheat" : caller.getName() + " muted " + playerName + " for " + durationString + "."));
|
||||
|
||||
//Inform
|
||||
Player target = UtilPlayer.searchExact(playerName);
|
||||
|
@ -461,7 +461,7 @@ public class PunishPage extends CraftInventoryCustom implements Listener
|
||||
|
||||
if (punishResponse != PunishmentResponse.PunishmentRemoved)
|
||||
{
|
||||
_player.sendMessage(F.main(_plugin.GetName(), "There was a problem removing the punishment."));
|
||||
_player.sendMessage(F.main(_plugin.getName(), "There was a problem removing the punishment."));
|
||||
}
|
||||
else
|
||||
{
|
||||
|
@ -23,9 +23,9 @@ public class ReportPlugin extends MiniPlugin
|
||||
@Override
|
||||
public void AddCommands()
|
||||
{
|
||||
AddCommand(new ReportCommand(this));
|
||||
AddCommand(new ReportHandleCommand(this));
|
||||
AddCommand(new ReportCloseCommand(this));
|
||||
addCommand(new ReportCommand(this));
|
||||
addCommand(new ReportHandleCommand(this));
|
||||
addCommand(new ReportCloseCommand(this));
|
||||
//AddCommand(new ReportDebugCommand(this));
|
||||
}
|
||||
}
|
||||
|
@ -25,7 +25,7 @@ public class ReportCloseCommand extends CommandBase<ReportPlugin>
|
||||
{
|
||||
if(args == null || args.length < 2)
|
||||
{
|
||||
UtilPlayer.message(player, F.main(Plugin.GetName(), C.cRed + "Your arguments are inappropriate for this command!"));
|
||||
UtilPlayer.message(player, F.main(Plugin.getName(), C.cRed + "Your arguments are inappropriate for this command!"));
|
||||
return;
|
||||
}
|
||||
else
|
||||
|
@ -25,7 +25,7 @@ public class ReportCommand extends CommandBase<ReportPlugin>
|
||||
{
|
||||
if(args == null || args.length < 2)
|
||||
{
|
||||
UtilPlayer.message(player, F.main(Plugin.GetName(), C.cRed + "Your arguments are inappropriate for this command!"));
|
||||
UtilPlayer.message(player, F.main(Plugin.getName(), C.cRed + "Your arguments are inappropriate for this command!"));
|
||||
return;
|
||||
}
|
||||
else
|
||||
@ -40,7 +40,7 @@ public class ReportCommand extends CommandBase<ReportPlugin>
|
||||
}
|
||||
else
|
||||
{
|
||||
UtilPlayer.message(player, F.main(Plugin.GetName(), C.cRed + "Unable to find player '"
|
||||
UtilPlayer.message(player, F.main(Plugin.getName(), C.cRed + "Unable to find player '"
|
||||
+ playerName + "'!"));
|
||||
}
|
||||
}
|
||||
|
@ -25,7 +25,7 @@ public class ReportHandleCommand extends CommandBase<ReportPlugin>
|
||||
{
|
||||
if(args == null || args.length < 1)
|
||||
{
|
||||
UtilPlayer.message(player, F.main(Plugin.GetName(), C.cRed + "Your arguments are inappropriate for this command!"));
|
||||
UtilPlayer.message(player, F.main(Plugin.getName(), C.cRed + "Your arguments are inappropriate for this command!"));
|
||||
return;
|
||||
}
|
||||
else
|
||||
|
@ -38,7 +38,7 @@ public class Spawn extends MiniPlugin
|
||||
@Override
|
||||
public void AddCommands()
|
||||
{
|
||||
AddCommand(new SpawnCommand(this));
|
||||
addCommand(new SpawnCommand(this));
|
||||
}
|
||||
|
||||
public Location getSpawn()
|
||||
@ -67,7 +67,7 @@ public class Spawn extends MiniPlugin
|
||||
UtilPlayer.message(player, F.main(_moduleName, "You added a Spawn Node."));
|
||||
|
||||
//Log
|
||||
Log("Added Spawn [" + UtilWorld.locToStr(loc) + "] by [" + player.getName() + "].");
|
||||
log("Added Spawn [" + UtilWorld.locToStr(loc) + "] by [" + player.getName() + "].");
|
||||
}
|
||||
|
||||
public void ClearSpawn(Player player)
|
||||
@ -82,7 +82,7 @@ public class Spawn extends MiniPlugin
|
||||
UtilPlayer.message(player, F.main(_moduleName, "You cleared all Spawn Nodes."));
|
||||
|
||||
//Log
|
||||
Log("Cleared Spawn [ALL] by [" + player.getName() + "].");
|
||||
log("Cleared Spawn [ALL] by [" + player.getName() + "].");
|
||||
}
|
||||
|
||||
@EventHandler
|
||||
|
@ -182,7 +182,7 @@ public class StatsManager extends MiniClientPlugin<PlayerStats>
|
||||
@Override
|
||||
public void AddCommands()
|
||||
{
|
||||
AddCommand(new TimeCommand(this));
|
||||
AddCommand(new GiveStatCommand(this));
|
||||
addCommand(new TimeCommand(this));
|
||||
addCommand(new GiveStatCommand(this));
|
||||
}
|
||||
}
|
||||
|
@ -1,10 +1,13 @@
|
||||
package mineplex.core.stats.command;
|
||||
|
||||
import java.util.UUID;
|
||||
|
||||
import org.bukkit.entity.Player;
|
||||
|
||||
import mineplex.core.command.CommandBase;
|
||||
import mineplex.core.common.Rank;
|
||||
import mineplex.core.common.util.F;
|
||||
import mineplex.core.common.util.UUIDFetcher;
|
||||
import mineplex.core.common.util.UtilPlayer;
|
||||
import mineplex.core.stats.StatsManager;
|
||||
|
||||
@ -27,12 +30,28 @@ public class GiveStatCommand extends CommandBase<StatsManager>
|
||||
try
|
||||
{
|
||||
Player player = UtilPlayer.searchOnline(caller, args[0], true);
|
||||
|
||||
String statName = args[1];
|
||||
|
||||
for (int i = 2; i < args.length - 1; i++)
|
||||
{
|
||||
statName += " " + args[i];
|
||||
}
|
||||
|
||||
if (player == null)
|
||||
return;
|
||||
{
|
||||
UUID uuid = UUIDFetcher.getUUIDOf(args[0]);
|
||||
if (uuid != null)
|
||||
{
|
||||
Plugin.incrementStat(uuid.toString(), statName, Integer.parseInt(args[args.length - 1]));
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
Plugin.incrementStat(player, statName, Integer.parseInt(args[args.length - 1]));
|
||||
}
|
||||
|
||||
Plugin.incrementStat(player, args[1], Integer.parseInt(args[2]));
|
||||
|
||||
UtilPlayer.message(caller, F.main("Stats", "Applied " + F.elem(Integer.parseInt(args[2]) + " " + args[1]) + " to " + F.elem(player.getName()) + "."));
|
||||
UtilPlayer.message(caller, F.main("Stats", "Applied " + F.elem(Integer.parseInt(args[args.length - 1]) + " " + statName) + " to " + F.elem(player.getName()) + "."));
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
|
@ -41,7 +41,7 @@ public class Teleport extends MiniPlugin
|
||||
@Override
|
||||
public void AddCommands()
|
||||
{
|
||||
AddCommand(new TeleportCommand(this));
|
||||
addCommand(new TeleportCommand(this));
|
||||
}
|
||||
|
||||
@EventHandler
|
||||
|
@ -44,7 +44,7 @@ public class TeleportCommand extends MultiCommandBase<Teleport>
|
||||
Plugin.playerToLoc(caller, args[0], args[1], args[2], args[3]);
|
||||
else
|
||||
{
|
||||
UtilPlayer.message(caller, F.main(Plugin.GetName(), "Commands List:"));
|
||||
UtilPlayer.message(caller, F.main(Plugin.getName(), "Commands List:"));
|
||||
UtilPlayer.message(caller, F.help("/tp <target>", "Teleport to Player", Rank.MODERATOR));
|
||||
UtilPlayer.message(caller, F.help("/tp b(ack) (amount) (player)", "Undo Teleports", Rank.MODERATOR));
|
||||
UtilPlayer.message(caller, F.help("/tp here <player>", "Teleport Player to Self", Rank.ADMIN));
|
||||
|
@ -136,7 +136,7 @@ public class FileUpdater extends MiniPlugin
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
System.out.println(F.main(GetName(), "Error parsing jar md5's"));
|
||||
System.out.println(F.main(getName(), "Error parsing jar md5's"));
|
||||
ex.printStackTrace();
|
||||
}
|
||||
finally
|
||||
@ -186,7 +186,7 @@ public class FileUpdater extends MiniPlugin
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
System.out.println(F.main(GetName(), "Error parsing jar md5's"));
|
||||
System.out.println(F.main(getName(), "Error parsing jar md5's"));
|
||||
ex.printStackTrace();
|
||||
}
|
||||
finally
|
||||
|
12
Plugins/Mineplex.Game.Clans/.classpath
Normal file
12
Plugins/Mineplex.Game.Clans/.classpath
Normal file
@ -0,0 +1,12 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<classpath>
|
||||
<classpathentry kind="src" path="src"/>
|
||||
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/jre7"/>
|
||||
<classpathentry combineaccessrules="false" kind="src" path="/Mineplex.Core"/>
|
||||
<classpathentry combineaccessrules="false" kind="src" path="/Mineplex.Core.Common"/>
|
||||
<classpathentry combineaccessrules="false" kind="src" path="/Mineplex.ServerData"/>
|
||||
<classpathentry combineaccessrules="false" kind="src" path="/Mineplex.Minecraft.Game.ClassCombat"/>
|
||||
<classpathentry combineaccessrules="false" kind="src" path="/Mineplex.Minecraft.Game.Core"/>
|
||||
<classpathentry kind="var" path="REPO_DIR/Plugins/Libraries/craftbukkit.jar" sourcepath="/REPO_DIR/GitHubLibraries/CraftBukkit/src"/>
|
||||
<classpathentry kind="output" path="bin"/>
|
||||
</classpath>
|
@ -0,0 +1,13 @@
|
||||
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
|
||||
<launchConfiguration type="org.eclipse.ant.AntBuilderLaunchConfigurationType">
|
||||
<booleanAttribute key="org.eclipse.ant.ui.ATTR_TARGETS_UPDATED" value="true"/>
|
||||
<booleanAttribute key="org.eclipse.ant.ui.DEFAULT_VM_INSTALL" value="false"/>
|
||||
<booleanAttribute key="org.eclipse.debug.ui.ATTR_LAUNCH_IN_BACKGROUND" value="false"/>
|
||||
<stringAttribute key="org.eclipse.jdt.launching.CLASSPATH_PROVIDER" value="org.eclipse.ant.ui.AntClasspathProvider"/>
|
||||
<booleanAttribute key="org.eclipse.jdt.launching.DEFAULT_CLASSPATH" value="true"/>
|
||||
<stringAttribute key="org.eclipse.jdt.launching.PROJECT_ATTR" value=""/>
|
||||
<stringAttribute key="org.eclipse.ui.externaltools.ATTR_LOCATION" value="${BUILD_FILES}/common.xml"/>
|
||||
<stringAttribute key="org.eclipse.ui.externaltools.ATTR_RUN_BUILD_KINDS" value=""/>
|
||||
<booleanAttribute key="org.eclipse.ui.externaltools.ATTR_TRIGGERS_CONFIGURED" value="true"/>
|
||||
<stringAttribute key="org.eclipse.ui.externaltools.ATTR_WORKING_DIRECTORY" value="${workspace_loc:/Mineplex.Game.Clans}"/>
|
||||
</launchConfiguration>
|
27
Plugins/Mineplex.Game.Clans/.project
Normal file
27
Plugins/Mineplex.Game.Clans/.project
Normal file
@ -0,0 +1,27 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<projectDescription>
|
||||
<name>Mineplex.Game.Clans</name>
|
||||
<comment></comment>
|
||||
<projects>
|
||||
</projects>
|
||||
<buildSpec>
|
||||
<buildCommand>
|
||||
<name>org.eclipse.jdt.core.javabuilder</name>
|
||||
<arguments>
|
||||
</arguments>
|
||||
</buildCommand>
|
||||
<buildCommand>
|
||||
<name>org.eclipse.ui.externaltools.ExternalToolBuilder</name>
|
||||
<triggers>full,incremental,</triggers>
|
||||
<arguments>
|
||||
<dictionary>
|
||||
<key>LaunchConfigHandle</key>
|
||||
<value><project>/.externalToolBuilders/ClansBuilder.launch</value>
|
||||
</dictionary>
|
||||
</arguments>
|
||||
</buildCommand>
|
||||
</buildSpec>
|
||||
<natures>
|
||||
<nature>org.eclipse.jdt.core.javanature</nature>
|
||||
</natures>
|
||||
</projectDescription>
|
@ -0,0 +1,11 @@
|
||||
eclipse.preferences.version=1
|
||||
org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled
|
||||
org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.7
|
||||
org.eclipse.jdt.core.compiler.codegen.unusedLocal=preserve
|
||||
org.eclipse.jdt.core.compiler.compliance=1.7
|
||||
org.eclipse.jdt.core.compiler.debug.lineNumber=generate
|
||||
org.eclipse.jdt.core.compiler.debug.localVariable=generate
|
||||
org.eclipse.jdt.core.compiler.debug.sourceFile=generate
|
||||
org.eclipse.jdt.core.compiler.problem.assertIdentifier=error
|
||||
org.eclipse.jdt.core.compiler.problem.enumIdentifier=error
|
||||
org.eclipse.jdt.core.compiler.source=1.7
|
147
Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/Clans.java
Normal file
147
Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/Clans.java
Normal file
@ -0,0 +1,147 @@
|
||||
package mineplex.game.clans;
|
||||
|
||||
import java.io.File;
|
||||
|
||||
import mineplex.core.CustomTagFix;
|
||||
import mineplex.core.account.CoreClientManager;
|
||||
import mineplex.core.antihack.AntiHack;
|
||||
import mineplex.core.antistack.AntiStack;
|
||||
import mineplex.core.blockrestore.BlockRestore;
|
||||
import mineplex.core.command.CommandCenter;
|
||||
import mineplex.core.common.util.FileUtil;
|
||||
import mineplex.core.cosmetic.CosmeticManager;
|
||||
import mineplex.core.creature.Creature;
|
||||
import mineplex.core.disguise.DisguiseManager;
|
||||
import mineplex.core.donation.DonationManager;
|
||||
import mineplex.core.friend.FriendManager;
|
||||
import mineplex.core.gadget.GadgetManager;
|
||||
import mineplex.core.inventory.InventoryManager;
|
||||
import mineplex.core.itemstack.ItemStackFactory;
|
||||
import mineplex.core.logger.Logger;
|
||||
import mineplex.core.memory.MemoryFix;
|
||||
import mineplex.core.message.MessageManager;
|
||||
import mineplex.core.monitor.LagMeter;
|
||||
import mineplex.core.mount.MountManager;
|
||||
import mineplex.core.npc.NpcManager;
|
||||
import mineplex.core.packethandler.PacketHandler;
|
||||
import mineplex.core.pet.PetManager;
|
||||
import mineplex.core.portal.Portal;
|
||||
import mineplex.core.preferences.PreferencesManager;
|
||||
import mineplex.core.projectile.ProjectileManager;
|
||||
import mineplex.core.punish.Punish;
|
||||
import mineplex.core.recharge.Recharge;
|
||||
import mineplex.core.serverConfig.ServerConfiguration;
|
||||
import mineplex.core.spawn.Spawn;
|
||||
import mineplex.core.status.ServerStatusManager;
|
||||
import mineplex.core.teleport.Teleport;
|
||||
import mineplex.core.updater.FileUpdater;
|
||||
import mineplex.core.updater.Updater;
|
||||
import mineplex.minecraft.game.core.combat.CombatManager;
|
||||
import mineplex.minecraft.game.core.damage.DamageManager;
|
||||
import net.minecraft.server.v1_7_R4.MinecraftServer;
|
||||
|
||||
import org.bukkit.plugin.java.JavaPlugin;
|
||||
|
||||
public class Clans extends JavaPlugin
|
||||
{
|
||||
private String WEB_CONFIG = "webServer";
|
||||
|
||||
//Modules
|
||||
private CoreClientManager _clientManager;
|
||||
private DonationManager _donationManager;
|
||||
private DamageManager _damageManager;
|
||||
|
||||
private ServerConfiguration _serverConfiguration;
|
||||
|
||||
@Override
|
||||
public void onEnable()
|
||||
{
|
||||
//Delete Old Games Folders
|
||||
DeleteFolders();
|
||||
|
||||
//Configs
|
||||
getConfig().addDefault(WEB_CONFIG, "http://accounts.mineplex.com/");
|
||||
getConfig().set(WEB_CONFIG, getConfig().getString(WEB_CONFIG));
|
||||
saveConfig();
|
||||
|
||||
String webServerAddress = getConfig().getString(WEB_CONFIG);
|
||||
|
||||
Logger.initialize(this);
|
||||
|
||||
//Static Modules
|
||||
CommandCenter.Initialize(this);
|
||||
_clientManager = new CoreClientManager(this, webServerAddress);
|
||||
CommandCenter.Instance.setClientManager(_clientManager);
|
||||
|
||||
ItemStackFactory.Initialize(this, false);
|
||||
Recharge.Initialize(this);
|
||||
|
||||
_donationManager = new DonationManager(this, webServerAddress);
|
||||
|
||||
_serverConfiguration = new ServerConfiguration(this);
|
||||
|
||||
PreferencesManager preferenceManager = new PreferencesManager(this, _clientManager, _donationManager);
|
||||
new MessageManager(this, _clientManager, preferenceManager);
|
||||
|
||||
AntiStack antistack = new AntiStack(this);
|
||||
Creature creature = new Creature(this);
|
||||
Spawn spawn = new Spawn(this);
|
||||
Teleport teleport = new Teleport(this, _clientManager, spawn);
|
||||
ServerStatusManager serverStatusManager = new ServerStatusManager(this, new LagMeter(this, _clientManager));
|
||||
Portal portal = new Portal(this, serverStatusManager.getCurrentServerName());
|
||||
new FileUpdater(this, portal);
|
||||
PacketHandler packetHandler = new PacketHandler(this);
|
||||
|
||||
DisguiseManager disguiseManager = new DisguiseManager(this, packetHandler);
|
||||
|
||||
_damageManager = new DamageManager(this, new CombatManager(this), new NpcManager(this, creature), disguiseManager);
|
||||
|
||||
Punish punish = new Punish(this, webServerAddress, _clientManager);
|
||||
AntiHack.Initialize(this, punish, portal, preferenceManager, _clientManager);
|
||||
AntiHack.Instance.setKick(false);
|
||||
|
||||
BlockRestore blockRestore = new BlockRestore(this);
|
||||
|
||||
ProjectileManager projectileManager = new ProjectileManager(this);
|
||||
|
||||
//Inventory
|
||||
InventoryManager inventoryManager = new InventoryManager(this);
|
||||
PetManager petManager = new PetManager(this, _clientManager, _donationManager, creature, webServerAddress);
|
||||
MountManager mountManager = new MountManager(this, _clientManager, _donationManager, blockRestore, disguiseManager);
|
||||
GadgetManager gadgetManager = new GadgetManager(this, _clientManager, _donationManager, inventoryManager, mountManager, petManager, preferenceManager, disguiseManager, blockRestore, projectileManager);
|
||||
CosmeticManager cosmeticManager = new CosmeticManager(this, _clientManager, _donationManager, inventoryManager, gadgetManager, mountManager, petManager, true);
|
||||
cosmeticManager.setInterfaceSlot(7);
|
||||
|
||||
new MemoryFix(this);
|
||||
new CustomTagFix(this, packetHandler);
|
||||
|
||||
new FriendManager(this, _clientManager, preferenceManager);
|
||||
|
||||
//Updates
|
||||
getServer().getScheduler().scheduleSyncRepeatingTask(this, new Updater(this), 1, 1);
|
||||
|
||||
MinecraftServer.getServer().getPropertyManager().setProperty("debug", true);
|
||||
}
|
||||
|
||||
private void DeleteFolders()
|
||||
{
|
||||
File curDir = new File(".");
|
||||
|
||||
File[] filesList = curDir.listFiles();
|
||||
for(File file : filesList)
|
||||
{
|
||||
if (!file.isDirectory())
|
||||
continue;
|
||||
|
||||
if (file.getName().length() < 4)
|
||||
continue;
|
||||
|
||||
if (!file.getName().substring(0, 4).equalsIgnoreCase("Game"))
|
||||
continue;
|
||||
|
||||
FileUtil.DeleteFolder(file);
|
||||
|
||||
System.out.println("Deleted Old Game: " + file.getName());
|
||||
}
|
||||
}
|
||||
}
|
@ -0,0 +1,469 @@
|
||||
package mineplex.game.clans.clans;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashSet;
|
||||
import java.util.LinkedList;
|
||||
|
||||
import mineplex.core.account.CoreClient;
|
||||
import mineplex.core.common.util.C;
|
||||
import mineplex.core.common.util.F;
|
||||
import mineplex.core.common.util.NautHashMap;
|
||||
import mineplex.core.common.util.UtilAlg;
|
||||
import mineplex.core.common.util.UtilMath;
|
||||
import mineplex.core.common.util.UtilPlayer;
|
||||
import mineplex.core.common.util.UtilTime;
|
||||
import mineplex.core.common.util.UtilWorld;
|
||||
import mineplex.core.common.util.UtilTime.TimeUnit;
|
||||
import mineplex.core.itemstack.ItemStackFactory;
|
||||
import mineplex.game.clans.clans.repository.tokens.ClanAllianceToken;
|
||||
import mineplex.game.clans.clans.repository.tokens.ClanToken;
|
||||
|
||||
import org.bukkit.Location;
|
||||
import org.bukkit.Material;
|
||||
import org.bukkit.Sound;
|
||||
import org.bukkit.entity.Player;
|
||||
|
||||
public class ClanInfo
|
||||
{
|
||||
public enum Role
|
||||
{
|
||||
LEADER(4), ADMIN(3), MEMBER(2), RECRUIT(1), NONE(0);
|
||||
|
||||
private int i;
|
||||
|
||||
private Role(int value)
|
||||
{
|
||||
this.i = value;
|
||||
}
|
||||
|
||||
public int toInt()
|
||||
{
|
||||
return i;
|
||||
}
|
||||
}
|
||||
|
||||
private String _name = "";
|
||||
private String _desc = "";
|
||||
private Location _home = null;
|
||||
|
||||
private boolean _admin = false;
|
||||
|
||||
private long _dateCreated = 0;
|
||||
private long _lastOnline = 0;
|
||||
|
||||
private NautHashMap<String, Boolean> _allyMap = new NautHashMap<String, Boolean>();
|
||||
|
||||
// Loaded from Client
|
||||
private NautHashMap<String, Role> _memberMap = new NautHashMap<String, Role>();
|
||||
private HashSet<String> _claimSet = new HashSet<String>();
|
||||
|
||||
// Temporary
|
||||
private NautHashMap<String, Long> _inviteeMap = new NautHashMap<String, Long>();
|
||||
private NautHashMap<String, String> _inviterMap = new NautHashMap<String, String>();
|
||||
|
||||
private NautHashMap<String, Long> _requestMap = new NautHashMap<String, Long>();
|
||||
|
||||
public ClansManager Clans;
|
||||
|
||||
public ClanInfo(ClansManager clans, ClanToken token)
|
||||
{
|
||||
Clans = clans;
|
||||
|
||||
_name = token.Name;
|
||||
_desc = token.Description;
|
||||
|
||||
try
|
||||
{
|
||||
_home = UtilWorld.strToLoc(token.Home);
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
|
||||
}
|
||||
_admin = token.Admin;
|
||||
|
||||
_dateCreated = token.DateCreated;
|
||||
_lastOnline = token.LastOnline;
|
||||
}
|
||||
|
||||
public int getClaims()
|
||||
{
|
||||
return getClaimSet().size();
|
||||
}
|
||||
|
||||
public int getClaimsMax()
|
||||
{
|
||||
if (ssAdmin())
|
||||
return 1000;
|
||||
|
||||
return 2 + getMembers().size();
|
||||
}
|
||||
|
||||
public int getAllies()
|
||||
{
|
||||
return getAllyMap().size();
|
||||
}
|
||||
|
||||
public int getAlliesMax()
|
||||
{
|
||||
if (ssAdmin())
|
||||
return 1000;
|
||||
|
||||
return Math.max(2, 9 - _memberMap.size());
|
||||
}
|
||||
|
||||
public boolean isRequested(String clan)
|
||||
{
|
||||
if (!getRequestMap().containsKey(clan))
|
||||
return false;
|
||||
|
||||
if (System.currentTimeMillis() > getRequestMap().get(clan) + (Clans.getInviteExpire() * 60000))
|
||||
return false;
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
public boolean isInvited(String player)
|
||||
{
|
||||
if (!getInviteeMap().containsKey(player))
|
||||
return false;
|
||||
|
||||
if (System.currentTimeMillis() > getInviteeMap().get(player) + (Clans.getInviteExpire() * 60000))
|
||||
return false;
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
public boolean isMember(String clan)
|
||||
{
|
||||
return getMembers().containsKey(clan);
|
||||
}
|
||||
|
||||
public boolean isAlly(String other)
|
||||
{
|
||||
return getAllyMap().containsKey(other);
|
||||
}
|
||||
|
||||
public boolean isSelf(String other)
|
||||
{
|
||||
return this.getName().equals(other);
|
||||
}
|
||||
|
||||
public boolean isNeutral(String other)
|
||||
{
|
||||
return (!isAlly(other) && !isSelf(other));
|
||||
}
|
||||
|
||||
public long getTimer()
|
||||
{
|
||||
int penalty = 0;
|
||||
return System.currentTimeMillis() + (penalty * 1000);
|
||||
}
|
||||
|
||||
public boolean getTrust(String clan)
|
||||
{
|
||||
if (!getAllyMap().containsKey(clan))
|
||||
return false;
|
||||
|
||||
return getAllyMap().get(clan);
|
||||
}
|
||||
|
||||
public LinkedList<String> mDetails(String caller)
|
||||
{
|
||||
LinkedList<String> stringList = new LinkedList<String>();
|
||||
|
||||
stringList.add(F.main("Clans", C.mRel(C.relPC(caller, this), getName() + " Information;", true)));
|
||||
// stringList.add(F.value("Desc", _desc));
|
||||
|
||||
// Age
|
||||
stringList.add(F.value("Age",
|
||||
UtilTime.convertString(System.currentTimeMillis() - _dateCreated, 1, TimeUnit.FIT)));
|
||||
|
||||
// Home
|
||||
if (C.relPC(caller, this) == ClanRelation.SELF)
|
||||
stringList.add(F.value("Home", UtilWorld.locToStrClean(getHome())));
|
||||
|
||||
// Land
|
||||
stringList.add(F.value("Territory", getClaims() + "/" + getClaimsMax()));
|
||||
|
||||
// Ally String
|
||||
String allySorted = "";
|
||||
HashSet<String> allyUnsorted = new HashSet<String>();
|
||||
|
||||
for (String allyName : getAllyMap().keySet())
|
||||
allyUnsorted.add(allyName);
|
||||
|
||||
for (String cur : UtilAlg.sortKey(allyUnsorted))
|
||||
allySorted += C.mRel(C.relPC(caller, Clans.getClanMap().get(cur)), cur, false)
|
||||
+ ", ";
|
||||
|
||||
stringList.add(F.value("Allies", allySorted));
|
||||
|
||||
// Members
|
||||
String members = "";
|
||||
for (String cur : UtilAlg.sortKey(getMembers().keySet()))
|
||||
{
|
||||
String name = C.listValueOff + cur;
|
||||
if (UtilPlayer.isOnline(cur))
|
||||
name = C.listValueOn + cur;
|
||||
|
||||
if (getMembers().get(cur) == Role.LEADER)
|
||||
members += C.listValue + "L." + name + C.mBody + ", ";
|
||||
|
||||
if (getMembers().get(cur) == Role.ADMIN)
|
||||
members += C.listValue + "A." + name + C.mBody + ", ";
|
||||
|
||||
if (getMembers().get(cur) == Role.MEMBER)
|
||||
members += C.listValue + "M." + name + C.mBody + ", ";
|
||||
|
||||
if (getMembers().get(cur) == Role.RECRUIT)
|
||||
members += C.listValue + "R." + name + C.mBody + ", ";
|
||||
}
|
||||
stringList.add(F.value("Members", members));
|
||||
|
||||
// Protected
|
||||
stringList.add(F.value("TNT Protection", getProtected()));
|
||||
|
||||
// Dominance
|
||||
ClanInfo callerClan = Clans.CUtil().getClanByPlayer(caller);
|
||||
if (callerClan != null)
|
||||
if (this.isEnemy(callerClan.getName()))
|
||||
stringList.add(F.value("Dominance", callerClan.getDominanceString(this)));
|
||||
|
||||
return stringList;
|
||||
}
|
||||
|
||||
public LinkedList<String> mTerritory()
|
||||
{
|
||||
LinkedList<String> stringList = new LinkedList<String>();
|
||||
|
||||
stringList.add(F.main("Clans", getName() + " Territory;"));
|
||||
|
||||
for (String cur : getClaimSet())
|
||||
{
|
||||
stringList.add(cur);
|
||||
}
|
||||
|
||||
return stringList;
|
||||
}
|
||||
|
||||
public void inform(String message, String ignore)
|
||||
{
|
||||
for (String cur : getMembers().keySet())
|
||||
{
|
||||
if (ignore != null && cur.equals(ignore))
|
||||
continue;
|
||||
|
||||
Player player = UtilPlayer.searchOnline(null, cur, false);
|
||||
|
||||
if (player == null)
|
||||
continue;
|
||||
|
||||
UtilPlayer.message(player, F.main("Clans", message));
|
||||
player.playSound(player.getLocation(), Sound.NOTE_PLING, 1f, 2f);
|
||||
}
|
||||
}
|
||||
|
||||
public void chat(Player sender, String message, String filteredMessage)
|
||||
{
|
||||
for (String cur : getMembers().keySet())
|
||||
{
|
||||
Player player = UtilPlayer.searchOnline(null, cur, false);
|
||||
|
||||
if (player == null)
|
||||
continue;
|
||||
|
||||
CoreClient client = Clans.Clients().Get(player);
|
||||
|
||||
if (client.Game().GetFilterChat())
|
||||
UtilPlayer.message(player, C.cAqua + sender.getName() + C.cDAqua + " " + filteredMessage);
|
||||
else
|
||||
UtilPlayer.message(player, C.cAqua + sender.getName() + C.cDAqua + " " + message);
|
||||
}
|
||||
}
|
||||
|
||||
public void allyChat(ClanInfo senderClan, Player sender, String message, String filteredMessage)
|
||||
{
|
||||
for (String cur : getMembers().keySet())
|
||||
{
|
||||
Player player = UtilPlayer.searchOnline(null, cur, false);
|
||||
|
||||
if (player == null)
|
||||
continue;
|
||||
|
||||
CoreClient client = Clans.Clients().Get(player);
|
||||
|
||||
// C.cDGreen + senderClan.GetName() + " " +
|
||||
|
||||
if (client.Game().GetFilterChat())
|
||||
UtilPlayer.message(player, C.cDGreen + sender.getName() + C.cGreen + " " + filteredMessage);
|
||||
else
|
||||
UtilPlayer.message(player, C.cDGreen + sender.getName() + C.cGreen + " " + message);
|
||||
}
|
||||
}
|
||||
|
||||
public String getName()
|
||||
{
|
||||
return _name;
|
||||
}
|
||||
|
||||
public String getDesc()
|
||||
{
|
||||
return _desc;
|
||||
}
|
||||
|
||||
public void setDesc(String desc)
|
||||
{
|
||||
_desc = desc;
|
||||
}
|
||||
|
||||
public NautHashMap<String, Role> getMembers()
|
||||
{
|
||||
return _memberMap;
|
||||
}
|
||||
|
||||
public HashSet<String> getClaimSet()
|
||||
{
|
||||
return _claimSet;
|
||||
}
|
||||
|
||||
public Location getHome()
|
||||
{
|
||||
return _home;
|
||||
}
|
||||
|
||||
public void setHome(Location loc)
|
||||
{
|
||||
_home = loc;
|
||||
}
|
||||
|
||||
public boolean ssAdmin()
|
||||
{
|
||||
return _admin;
|
||||
}
|
||||
|
||||
public void setAdmin(boolean admin)
|
||||
{
|
||||
_admin = admin;
|
||||
}
|
||||
|
||||
public NautHashMap<String, String> getInviterMap()
|
||||
{
|
||||
return _inviterMap;
|
||||
}
|
||||
|
||||
public NautHashMap<String, Long> getInviteeMap()
|
||||
{
|
||||
return _inviteeMap;
|
||||
}
|
||||
|
||||
public NautHashMap<String, Boolean> getAllyMap()
|
||||
{
|
||||
return _allyMap;
|
||||
}
|
||||
|
||||
public NautHashMap<String, Long> getRequestMap()
|
||||
{
|
||||
return _requestMap;
|
||||
}
|
||||
|
||||
public long getDateCreated()
|
||||
{
|
||||
return _dateCreated;
|
||||
}
|
||||
|
||||
public long getLastOnline()
|
||||
{
|
||||
return _lastOnline;
|
||||
}
|
||||
|
||||
public void setLastOnline(long lastOnline)
|
||||
{
|
||||
_lastOnline = lastOnline;
|
||||
}
|
||||
|
||||
public ClanToken GetToken()
|
||||
{
|
||||
// Update Members
|
||||
_token.Members = new ArrayList<ClanMemberToken>();
|
||||
for (String name : getMembers().keySet())
|
||||
{
|
||||
ClanMemberToken token = new ClanMemberToken();
|
||||
token.Name = name;
|
||||
token.ClanRole = getMembers().get(name).toString();
|
||||
|
||||
_token.Members.add(token);
|
||||
}
|
||||
|
||||
// Update Territory
|
||||
_token.Territories = new ArrayList<ClanTerritoryToken>();
|
||||
for (String chunk : getClaimSet())
|
||||
{
|
||||
ClanTerritoryToken token = new ClanTerritoryToken();
|
||||
token.ClanName = _token.Name;
|
||||
token.ClanId = _token.ClanId;
|
||||
token.ServerName = Clans.GetServerName();
|
||||
token.Chunk = chunk;
|
||||
|
||||
if (Clans.GetClaimMap().get(chunk) != null)
|
||||
token.Safe = Clans.GetClaimMap().get(chunk).safe;
|
||||
|
||||
_token.Territories.add(token);
|
||||
}
|
||||
|
||||
// Update Relations
|
||||
_token.Alliances = new ArrayList<AllianceToken>();
|
||||
for (String clanName : getAllyMap().keySet())
|
||||
{
|
||||
ClanInfo clan = Clans.getClan(clanName);
|
||||
ClanAllianceToken token = new ClanAllianceToken();
|
||||
token.ClanId = clan.GetTokenUnupdated().ClanId;
|
||||
token.ClanName = clan.GetTokenUnupdated().Name;
|
||||
|
||||
if (getAllyMap().get(clanName))
|
||||
token.Trusted = true;
|
||||
|
||||
_token.Alliances.add(token);
|
||||
}
|
||||
|
||||
return _token;
|
||||
}
|
||||
|
||||
public boolean isOnlineNow()
|
||||
{
|
||||
for (String cur : getMembers().keySet())
|
||||
if (UtilPlayer.isOnline(cur))
|
||||
return true;
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
public boolean isOnline()
|
||||
{
|
||||
for (String cur : getMembers().keySet())
|
||||
if (UtilPlayer.isOnline(cur))
|
||||
return true;
|
||||
|
||||
return System.currentTimeMillis() - _lastOnline < Clans.GetOnlineTime();
|
||||
}
|
||||
|
||||
public String getProtected()
|
||||
{
|
||||
for (String cur : getMembers().keySet())
|
||||
if (UtilPlayer.isOnline(cur))
|
||||
return C.cRed + "No - Clan Members are Online";
|
||||
|
||||
if (System.currentTimeMillis() - _lastOnline > Clans.GetOnlineTime())
|
||||
return C.cGreen + "Yes - Clan Members are Offline";
|
||||
|
||||
return C.cGold
|
||||
+ "No, "
|
||||
+ UtilTime.convertString(Clans.GetOnlineTime() - (System.currentTimeMillis() - _lastOnline), 1,
|
||||
TimeUnit.FIT) + " to Protection";
|
||||
}
|
||||
|
||||
public boolean isAdmin()
|
||||
{
|
||||
return _admin;
|
||||
}
|
||||
}
|
@ -0,0 +1,53 @@
|
||||
package mineplex.game.clans.clans;
|
||||
|
||||
import org.bukkit.plugin.java.JavaPlugin;
|
||||
|
||||
import mineplex.core.MiniPlugin;
|
||||
import mineplex.core.common.util.NautHashMap;
|
||||
import mineplex.game.clans.clans.repository.ClanTerritory;
|
||||
|
||||
public class ClansManager extends MiniPlugin
|
||||
{
|
||||
private int _dominanceLimit = 16;
|
||||
private int _inviteExpire = 2;
|
||||
private int _nameMin = 3;
|
||||
private int _nameMax = 10;
|
||||
private long _reclaimTime = 1800000;
|
||||
private long _onlineTime = 1200000;
|
||||
|
||||
//Clans
|
||||
private NautHashMap<String, ClanInfo> _clanMap = new NautHashMap<String, ClanInfo>();
|
||||
private NautHashMap<String, ClanInfo> _clanMemberMap = new NautHashMap<String, ClanInfo>();
|
||||
private NautHashMap<String, ClanTerritory> _claimMap = new NautHashMap<String, ClanTerritory>();
|
||||
private NautHashMap<String, Long> _unclaimMap = new NautHashMap<String, Long>();
|
||||
|
||||
public ClansManager(String moduleName, JavaPlugin plugin)
|
||||
{
|
||||
super(moduleName, plugin);
|
||||
}
|
||||
|
||||
public int getInviteExpire()
|
||||
{
|
||||
return _inviteExpire;
|
||||
}
|
||||
|
||||
public NautHashMap<String, ClanInfo> getClanMap()
|
||||
{
|
||||
return _clanMap;
|
||||
}
|
||||
|
||||
public NautHashMap<String, ClanInfo> getClanMemberMap()
|
||||
{
|
||||
return _clanMemberMap;
|
||||
}
|
||||
|
||||
public ClanInfo getClan(String clan)
|
||||
{
|
||||
return _clanMap.get(clan);
|
||||
}
|
||||
|
||||
public NautHashMap<String, ClanTerritory> getClaimMap()
|
||||
{
|
||||
return _claimMap;
|
||||
}
|
||||
}
|
@ -0,0 +1,551 @@
|
||||
package mineplex.game.clans.clans;
|
||||
|
||||
import java.util.LinkedList;
|
||||
import java.util.Map.Entry;
|
||||
|
||||
import org.bukkit.ChatColor;
|
||||
import org.bukkit.Chunk;
|
||||
import org.bukkit.Location;
|
||||
import org.bukkit.entity.Player;
|
||||
|
||||
import mineplex.core.account.CoreClient;
|
||||
import mineplex.core.common.util.C;
|
||||
import mineplex.core.common.util.F;
|
||||
import mineplex.core.common.util.UtilPlayer;
|
||||
import mineplex.core.common.util.UtilServer;
|
||||
import mineplex.core.common.util.UtilTime;
|
||||
import mineplex.core.common.util.UtilWorld;
|
||||
import mineplex.game.clans.clans.repository.ClanTerritory;
|
||||
import mineplex.game.clans.clans.repository.tokens.ClanTerritoryToken;
|
||||
|
||||
public class ClansUtility
|
||||
{
|
||||
private ClansManager Clans;
|
||||
|
||||
public ClansUtility(ClansManager clans)
|
||||
{
|
||||
Clans = clans;
|
||||
}
|
||||
|
||||
public enum ClanRelation
|
||||
{
|
||||
SELF,
|
||||
ALLY,
|
||||
ALLY_TRUST,
|
||||
NEUTRAL,
|
||||
ENEMY,
|
||||
PILLAGE,
|
||||
ADMIN,
|
||||
SAFE
|
||||
}
|
||||
|
||||
public ClanInfo searchClanPlayer(Player caller, String name, boolean inform)
|
||||
{
|
||||
//CLAN
|
||||
LinkedList<ClanInfo> clanMatchList = new LinkedList<ClanInfo>();
|
||||
|
||||
for (ClanInfo cur : Clans.getClanMap().values())
|
||||
{
|
||||
if (cur.getName().equalsIgnoreCase(name))
|
||||
return cur;
|
||||
|
||||
if (cur.getName().toLowerCase().contains(name.toLowerCase()))
|
||||
clanMatchList.add(cur);
|
||||
}
|
||||
|
||||
if (clanMatchList.size() == 1)
|
||||
return clanMatchList.get(0);
|
||||
|
||||
//No / Non-Unique
|
||||
String clanMatchString = "None";
|
||||
if (clanMatchList.size() > 1)
|
||||
{
|
||||
for (ClanInfo cur : clanMatchList)
|
||||
clanMatchString += cur.getName() + " ";
|
||||
}
|
||||
|
||||
//PLAYER
|
||||
LinkedList<ClanInfo> playerMatchList = new LinkedList<ClanInfo>();
|
||||
|
||||
for (Entry<String, ClanInfo> clanMemberEntry : Clans.getClanMemberMap().entrySet())
|
||||
{
|
||||
if (clanMemberEntry.getKey().equalsIgnoreCase(name))
|
||||
return clanMemberEntry.getValue();
|
||||
|
||||
if (clanMemberEntry.getKey().toLowerCase().contains(name.toLowerCase()))
|
||||
playerMatchList.add(clanMemberEntry.getValue());
|
||||
}
|
||||
|
||||
if (playerMatchList.size() == 1)
|
||||
return playerMatchList.get(0);
|
||||
|
||||
//No / Non-Unique
|
||||
String playerMatchString = "None";
|
||||
if (playerMatchList.size() > 1)
|
||||
{
|
||||
for (ClanInfo cur : playerMatchList)
|
||||
playerMatchString += cur.getName() + " ";
|
||||
}
|
||||
|
||||
if (inform)
|
||||
{
|
||||
UtilPlayer.message(caller, F.main("Clan Search", "" +
|
||||
C.mCount + (clanMatchList.size() + playerMatchList.size()) +
|
||||
C.mBody + " matches for [" +
|
||||
C.mElem + name +
|
||||
C.mBody + "]."), false);
|
||||
|
||||
UtilPlayer.message(caller, F.desc("Matches via Clan", clanMatchString), false);
|
||||
UtilPlayer.message(caller, F.desc("Matches via Player", playerMatchString), false);;
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
public ClanInfo searchClan(Player caller, String name, boolean inform)
|
||||
{
|
||||
LinkedList<ClanInfo> matchList = new LinkedList<ClanInfo>();
|
||||
|
||||
for (ClanInfo cur : Clans.getClanMap().values())
|
||||
{
|
||||
if (cur.getName().equalsIgnoreCase(name))
|
||||
return cur;
|
||||
|
||||
if (cur.getName().toLowerCase().contains(name.toLowerCase()))
|
||||
matchList.add(cur);
|
||||
}
|
||||
|
||||
//No / Non-Unique
|
||||
if (matchList.size() != 1)
|
||||
{
|
||||
if (!inform)
|
||||
return null;
|
||||
|
||||
//Inform
|
||||
UtilPlayer.message(caller, F.main("Clan Search", "" +
|
||||
C.mCount + matchList.size() +
|
||||
C.mBody + " matches for [" +
|
||||
C.mElem + name +
|
||||
C.mBody + "]."), false);
|
||||
|
||||
if (matchList.size() > 0)
|
||||
{
|
||||
String matchString = "";
|
||||
for (ClanInfo cur : matchList)
|
||||
matchString += cur.getName() + " ";
|
||||
|
||||
UtilPlayer.message(caller, F.main("Clan Search", "" +
|
||||
C.mBody + " Matches [" +
|
||||
C.mElem + matchString +
|
||||
C.mBody + "]."), false);
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
return matchList.get(0);
|
||||
}
|
||||
|
||||
public ClanInfo getClanByClanName(String clan)
|
||||
{
|
||||
return Clans.getClan(clan);
|
||||
}
|
||||
|
||||
public ClanInfo getClanByPlayer(Player player)
|
||||
{
|
||||
return getClanByPlayer(player.getName());
|
||||
}
|
||||
|
||||
public ClanInfo getClanByPlayer(String name)
|
||||
{
|
||||
if (!Clans.getClanMemberMap().containsKey(name))
|
||||
return null;
|
||||
|
||||
return Clans.getClanMemberMap().get(name);
|
||||
}
|
||||
|
||||
public Role getRole(Player player)
|
||||
{
|
||||
try
|
||||
{
|
||||
return getClanByPlayer(player).getMembers().get(player.getName());
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
return Role.NONE;
|
||||
}
|
||||
}
|
||||
|
||||
public boolean isSafe(Player player)
|
||||
{
|
||||
ClanInfo clan = getClanByPlayer(player);
|
||||
|
||||
if (!UtilTime.elapsed(Clans.Clients().Get(player).Player().GetLastDamager(), 15000))
|
||||
return false;
|
||||
|
||||
return isSafe(player.getLocation());
|
||||
}
|
||||
|
||||
public boolean isSafe(Location loc)
|
||||
{
|
||||
if (!Clans.getClaimMap().containsKey(UtilWorld.chunkToStr(loc.getChunk())))
|
||||
return false;
|
||||
|
||||
return Clans.getClaimMap().get(UtilWorld.chunkToStr(loc.getChunk())).Safe;
|
||||
}
|
||||
|
||||
public boolean isChunkHome(ClanInfo clan, Chunk chunk)
|
||||
{
|
||||
if (clan == null)
|
||||
return false;
|
||||
|
||||
if (clan.getHome() == null)
|
||||
return false;
|
||||
|
||||
return clan.getHome().getChunk().equals(chunk);
|
||||
}
|
||||
|
||||
public ClanTerritory getClaim(Location loc)
|
||||
{
|
||||
String chunk = UtilWorld.chunkToStr(loc.getChunk());
|
||||
return Clans.getClaimMap().get(chunk);
|
||||
}
|
||||
|
||||
public ClanTerritory getClaim(String chunk)
|
||||
{
|
||||
return Clans.getClaimMap().get(chunk);
|
||||
}
|
||||
|
||||
public ClanInfo getOwner(String chunk)
|
||||
{
|
||||
ClanTerritory claim = getClaim(chunk);
|
||||
|
||||
if (claim == null)
|
||||
return null;
|
||||
|
||||
return getOwner(claim);
|
||||
}
|
||||
|
||||
public ClanInfo getOwner(Location loc)
|
||||
{
|
||||
ClanTerritory claim = getClaim(loc);
|
||||
|
||||
if (claim != null)
|
||||
return getOwner(claim);
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
public ClanInfo getOwner(ClanTerritory claim)
|
||||
{
|
||||
return getClanByClanName(claim.Owner);
|
||||
}
|
||||
|
||||
public String getOwnerString(Location loc)
|
||||
{
|
||||
ClanInfo owner = getOwner(loc);
|
||||
|
||||
if (owner == null)
|
||||
return "Wilderness";
|
||||
|
||||
return owner.getName();
|
||||
}
|
||||
|
||||
public String getOwnerStringRel(Location loc, String player)
|
||||
{
|
||||
ClanRelation rel = relPT(player, UtilWorld.chunkToStr(loc.getChunk()));
|
||||
return mRel(rel, getOwnerString(loc), true);
|
||||
}
|
||||
|
||||
public boolean isClaimed(Location loc)
|
||||
{
|
||||
String chunk = UtilWorld.chunkToStr(loc.getChunk());
|
||||
|
||||
return Clans.getClaimMap().containsKey(chunk);
|
||||
}
|
||||
|
||||
public boolean isAlliance(String player, Location loc)
|
||||
{
|
||||
if (!Clans.getClanMemberMap().containsKey(player))
|
||||
return false;
|
||||
|
||||
if (!isClaimed(loc))
|
||||
return false;
|
||||
|
||||
return getOwner(getClaim(loc)).isAlly(Clans.getClanMemberMap().get(player).getName());
|
||||
}
|
||||
|
||||
public boolean isSelf(String player, Location loc)
|
||||
{
|
||||
if (!Clans.getClanMemberMap().containsKey(player))
|
||||
return false;
|
||||
|
||||
if (!isClaimed(loc))
|
||||
return false;
|
||||
|
||||
return getOwner(getClaim(loc)).isSelf(Clans.getClanMemberMap().get(player).getName());
|
||||
}
|
||||
|
||||
public boolean isAdmin(Location loc)
|
||||
{
|
||||
if (!isClaimed(loc))
|
||||
return false;
|
||||
|
||||
return getOwner(getClaim(loc)).isAdmin();
|
||||
}
|
||||
|
||||
public boolean isSpecial(Location loc, String special)
|
||||
{
|
||||
if (!isClaimed(loc))
|
||||
return false;
|
||||
|
||||
if (!isAdmin(loc))
|
||||
return false;
|
||||
|
||||
return getOwner(getClaim(loc)).getName().toLowerCase().contains(special.toLowerCase());
|
||||
}
|
||||
|
||||
public ClanRelation getAccess(Player player, Location loc)
|
||||
{
|
||||
//Observer Override
|
||||
if (Clans.Observer().isObserver(player, false))
|
||||
{
|
||||
if (Clans.Observer().isObserver(player, true))
|
||||
return ClanRelation.SELF;
|
||||
else
|
||||
return ClanRelation.NEUTRAL;
|
||||
}
|
||||
|
||||
ClanInfo owner = this.getOwner(loc);
|
||||
ClanInfo clan = getClanByPlayer(player);
|
||||
|
||||
if (owner == null)
|
||||
return ClanRelation.SELF;
|
||||
|
||||
if (owner.equals(Clans.CAdmin().getMimic(player, false)))
|
||||
return ClanRelation.SELF;
|
||||
|
||||
if (owner.equals(clan))
|
||||
return ClanRelation.SELF;
|
||||
|
||||
if (clan != null)
|
||||
if (owner.getTrust(clan.getName()))
|
||||
return ClanRelation.ALLY_TRUST;
|
||||
|
||||
if (clan != null)
|
||||
if (owner.isAlly(clan.getName()))
|
||||
return ClanRelation.ALLY;
|
||||
|
||||
if (clan != null)
|
||||
if (owner.isEnemy(clan.getName()))
|
||||
return ClanRelation.ENEMY;
|
||||
|
||||
return ClanRelation.NEUTRAL;
|
||||
}
|
||||
|
||||
//Player Player
|
||||
public ClanRelation relPP(String pA, String pB)
|
||||
{
|
||||
return rel(getClanByPlayer(pA), getClanByPlayer(pB));
|
||||
}
|
||||
|
||||
//Clan Clan
|
||||
public ClanRelation relCC(String cA, String cB)
|
||||
{
|
||||
return rel(searchClan(null, cA, false), searchClan(null, cB, false));
|
||||
}
|
||||
|
||||
//Territory Territory
|
||||
public ClanRelation relTT(String tA, String tB)
|
||||
{
|
||||
return rel(getOwner(tA), getOwner(tB));
|
||||
}
|
||||
|
||||
//Player Clan
|
||||
public ClanRelation relPC(String pA, String cB)
|
||||
{
|
||||
return rel(getClanByPlayer(pA), searchClan(null, cB, false));
|
||||
}
|
||||
|
||||
//Player Clan (Object)
|
||||
public ClanRelation relPC(String pA, ClanInfo cB)
|
||||
{
|
||||
return rel(getClanByPlayer(pA), cB);
|
||||
}
|
||||
|
||||
//Player Territory
|
||||
public ClanRelation relPT(String pA, String tB)
|
||||
{
|
||||
ClanTerritory claim = getClaim(tB);
|
||||
if (claim != null)
|
||||
if (claim.Safe)
|
||||
return ClanRelation.SAFE;
|
||||
|
||||
return rel(getClanByPlayer(pA), getOwner(tB));
|
||||
}
|
||||
|
||||
//Clan Territory
|
||||
public ClanRelation relCT(String cA, String tB)
|
||||
{
|
||||
ClanTerritory claim = getClaim(tB);
|
||||
if (claim != null)
|
||||
if (claim.Safe)
|
||||
return ClanRelation.SAFE;
|
||||
|
||||
return rel(searchClan(null, cA, false), getOwner(tB));
|
||||
}
|
||||
|
||||
public ClanRelation rel(ClanInfo cA, ClanInfo cB)
|
||||
{
|
||||
if (cA == null || cB == null)
|
||||
return ClanRelation.NEUTRAL;
|
||||
|
||||
//Self
|
||||
if (cA.isAdmin() || cB.isAdmin())
|
||||
return ClanRelation.ADMIN;
|
||||
|
||||
if (cA.getName().equals(cB.getName()))
|
||||
return ClanRelation.SELF;
|
||||
|
||||
//Ally
|
||||
if (cA.getTrust(cB.getName()))
|
||||
return ClanRelation.ALLY_TRUST;
|
||||
|
||||
if (cA.isAlly(cB.getName()))
|
||||
return ClanRelation.ALLY;
|
||||
|
||||
//Enemy
|
||||
return ClanRelation.NEUTRAL;
|
||||
}
|
||||
|
||||
public ChatColor relChatColor(ClanRelation relation, boolean dark)
|
||||
{
|
||||
if (relation == ClanRelation.SAFE) return C.xAdmin;
|
||||
if (relation == ClanRelation.ADMIN) return C.xAdmin;
|
||||
|
||||
if (!dark)
|
||||
{
|
||||
if (relation == ClanRelation.SELF) return C.xSelf;
|
||||
if (relation == ClanRelation.ALLY_TRUST) return C.xdAlly;
|
||||
if (relation == ClanRelation.ALLY) return C.xAlly;
|
||||
if (relation == ClanRelation.ENEMY) return C.xWar;
|
||||
if (relation == ClanRelation.PILLAGE) return C.xPillage;
|
||||
return C.xEnemy;
|
||||
}
|
||||
|
||||
if (relation == ClanRelation.SELF) return C.xdSelf;
|
||||
if (relation == ClanRelation.ALLY_TRUST) return C.xAlly;
|
||||
if (relation == ClanRelation.ALLY) return C.xdAlly;
|
||||
if (relation == ClanRelation.ENEMY) return C.xdWar;
|
||||
if (relation == ClanRelation.PILLAGE) return C.xdPillage;
|
||||
return C.xdEnemy;
|
||||
}
|
||||
|
||||
public String relColor(ClanRelation relation, boolean dark)
|
||||
{
|
||||
if (relation == ClanRelation.SAFE) return C.xAdmin + "(" + C.xSafe + "SAFE" + C.xAdmin + ") ";
|
||||
|
||||
return relChatColor(relation, dark) + "";
|
||||
}
|
||||
|
||||
public String mRel(ClanRelation relation, String message, boolean dark)
|
||||
{
|
||||
return relColor(relation, dark) + message + C.mChat;
|
||||
}
|
||||
|
||||
public boolean playerSelf(String pA, String pB)
|
||||
{
|
||||
ClanInfo cA = getClanByPlayer(pA);
|
||||
ClanInfo cB = getClanByPlayer(pB);
|
||||
|
||||
if (cA == null || cB == null)
|
||||
return false;
|
||||
|
||||
return cA.isSelf(cB.getName());
|
||||
}
|
||||
|
||||
public boolean playerAlly(String pA, String pB)
|
||||
{
|
||||
ClanInfo cA = getClanByPlayer(pA);
|
||||
ClanInfo cB = getClanByPlayer(pB);
|
||||
|
||||
if (cA == null || cB == null)
|
||||
return false;
|
||||
|
||||
return cA.isAlly(cB.getName());
|
||||
}
|
||||
|
||||
public boolean playerEnemy(String pA, String pB)
|
||||
{
|
||||
ClanInfo cA = getClanByPlayer(pA);
|
||||
ClanInfo cB = getClanByPlayer(pB);
|
||||
|
||||
if (cA == null || cB == null)
|
||||
return true;
|
||||
|
||||
return !(cA.isAlly(cB.getName()) || cA.isSelf(cB.getName()));
|
||||
}
|
||||
|
||||
public boolean canHurt(Player damagee, Player damager)
|
||||
{
|
||||
if (damagee == null)
|
||||
return false;
|
||||
|
||||
if (isSafe(damagee))
|
||||
return false;
|
||||
|
||||
if (damager == null)
|
||||
return true;
|
||||
|
||||
if (isSafe(damager))
|
||||
return false;
|
||||
|
||||
ClanRelation rel = Clans.CUtil().relPP(damagee.getName(), damager.getName());
|
||||
|
||||
if (rel == ClanRelation.ALLY || rel == ClanRelation.ALLY_TRUST || rel == ClanRelation.SELF)
|
||||
return false;
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
public void updateRelations(String name)
|
||||
{
|
||||
updateRelations(UtilPlayer.searchExact(name));
|
||||
}
|
||||
|
||||
public void updateRelations(Player player)
|
||||
{
|
||||
if (player == null)
|
||||
return;
|
||||
|
||||
CoreClient client = Clans.Clients().Get(player);
|
||||
|
||||
for (Player cur : UtilServer.getPlayers())
|
||||
{
|
||||
//For Player
|
||||
client.Clan().SetRelationship(
|
||||
cur.getName(), relPP(cur.getName(), player.getName()));
|
||||
|
||||
//For Other
|
||||
Clans.Clients().Get(cur.getName()).Clan().SetRelationship(
|
||||
player.getName(), relPP(player.getName(), cur.getName()));
|
||||
|
||||
if (player.canSee(cur))
|
||||
{
|
||||
player.hidePlayer(cur);
|
||||
player.showPlayer(cur);
|
||||
}
|
||||
|
||||
if (cur.canSee(player))
|
||||
{
|
||||
cur.hidePlayer(player);
|
||||
cur.showPlayer(player);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public boolean isBorderlands(Location loc)
|
||||
{
|
||||
return (Math.abs(loc.getX()) > 400 || Math.abs(loc.getZ()) > 400);
|
||||
}
|
||||
}
|
@ -0,0 +1,23 @@
|
||||
package mineplex.game.clans.clans.repository;
|
||||
|
||||
import org.bukkit.plugin.java.JavaPlugin;
|
||||
|
||||
import mineplex.core.database.RepositoryBase;
|
||||
|
||||
public class ClanRepository extends RepositoryBase
|
||||
{
|
||||
public ClanRepository(JavaPlugin plugin)
|
||||
{
|
||||
super(plugin, "jdbc:mysql://db.mineplex.com:3306/Account?autoReconnect=true&failOverReadOnly=false&maxReconnects=10", "root", "tAbechAk3wR7tuTh");
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void initialize()
|
||||
{
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void update()
|
||||
{
|
||||
}
|
||||
}
|
@ -0,0 +1,7 @@
|
||||
package mineplex.game.clans.clans.repository;
|
||||
|
||||
public class ClanTerritory
|
||||
{
|
||||
public boolean Safe;
|
||||
public String Owner;
|
||||
}
|
@ -0,0 +1,7 @@
|
||||
package mineplex.game.clans.clans.repository.tokens;
|
||||
|
||||
public class ClanAllianceToken
|
||||
{
|
||||
public String ClanName;
|
||||
public boolean Trusted;
|
||||
}
|
@ -0,0 +1,7 @@
|
||||
package mineplex.game.clans.clans.repository.tokens;
|
||||
|
||||
public class ClanMemberToken
|
||||
{
|
||||
public String Name;
|
||||
public String ClanRole;
|
||||
}
|
@ -0,0 +1,10 @@
|
||||
package mineplex.game.clans.clans.repository.tokens;
|
||||
|
||||
public class ClanTerritoryToken
|
||||
{
|
||||
public String ClanName;
|
||||
public int ClanId;
|
||||
public String ServerName;
|
||||
public String Chunk;
|
||||
public boolean Safe;
|
||||
}
|
@ -0,0 +1,17 @@
|
||||
package mineplex.game.clans.clans.repository.tokens;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
public class ClanToken
|
||||
{
|
||||
public String Name;
|
||||
public String Description;
|
||||
public String Home;
|
||||
public boolean Admin;
|
||||
public long DateCreated;
|
||||
public long LastOnline;
|
||||
|
||||
List<ClanMemberToken> Members;
|
||||
List<ClanTerritoryToken> Territories;
|
||||
List<ClanAllianceToken> Alliances;
|
||||
}
|
@ -0,0 +1,41 @@
|
||||
package mineplex.game.clans.fields;
|
||||
|
||||
import org.bukkit.plugin.java.JavaPlugin;
|
||||
|
||||
import mineplex.core.MiniPlugin;
|
||||
import mineplex.core.creature.Creature;
|
||||
import mineplex.core.energy.Energy;
|
||||
import mineplex.game.clans.fields.repository.FieldRepository;
|
||||
import mineplex.minecraft.game.core.condition.ConditionFactory;
|
||||
|
||||
public class Field extends MiniPlugin
|
||||
{
|
||||
private FieldBlock _block;
|
||||
private FieldOre _ore;
|
||||
private FieldMonster _mob;
|
||||
|
||||
public Field(JavaPlugin plugin, Creature creature, ConditionFactory condition, Energy energy, String serverName)
|
||||
{
|
||||
super("Field Factory", plugin);
|
||||
|
||||
FieldRepository repository = new FieldRepository(plugin);
|
||||
_block = new FieldBlock(plugin, condition, energy, repository, serverName);
|
||||
_ore = new FieldOre(plugin, repository, serverName);
|
||||
_mob = new FieldMonster(plugin, repository, creature, serverName);
|
||||
}
|
||||
|
||||
public FieldBlock GetBlock()
|
||||
{
|
||||
return _block;
|
||||
}
|
||||
|
||||
public FieldOre GetOre()
|
||||
{
|
||||
return _ore;
|
||||
}
|
||||
|
||||
public FieldMonster GetMonster()
|
||||
{
|
||||
return _mob;
|
||||
}
|
||||
}
|
@ -1,11 +1,9 @@
|
||||
package me.chiss.Core.Field;
|
||||
package mineplex.game.clans.fields;
|
||||
|
||||
import java.util.HashMap;
|
||||
import java.util.HashSet;
|
||||
import java.util.WeakHashMap;
|
||||
|
||||
import nautilus.minecraft.core.webserver.token.Server.FieldBlockToken;
|
||||
|
||||
import org.bukkit.Effect;
|
||||
import org.bukkit.Location;
|
||||
import org.bukkit.Material;
|
||||
@ -17,19 +15,26 @@ import org.bukkit.event.block.BlockBreakEvent;
|
||||
import org.bukkit.event.player.PlayerInteractEvent;
|
||||
import org.bukkit.plugin.java.JavaPlugin;
|
||||
|
||||
import me.chiss.Core.Module.AModule;
|
||||
import mineplex.core.server.IRepository;
|
||||
import mineplex.core.MiniPlugin;
|
||||
import mineplex.core.updater.event.UpdateEvent;
|
||||
import mineplex.core.updater.UpdateType;
|
||||
import mineplex.core.common.Rank;
|
||||
import mineplex.core.common.util.F;
|
||||
import mineplex.core.common.util.UtilMath;
|
||||
import mineplex.core.common.util.UtilEvent;
|
||||
import mineplex.core.common.util.UtilGear;
|
||||
import mineplex.core.common.util.UtilPlayer;
|
||||
import mineplex.core.common.util.UtilWorld;
|
||||
import mineplex.core.common.util.UtilEvent.ActionType;
|
||||
import mineplex.core.energy.Energy;
|
||||
import mineplex.game.clans.fields.repository.FieldBlockToken;
|
||||
import mineplex.game.clans.fields.repository.FieldRepository;
|
||||
import mineplex.minecraft.game.core.condition.ConditionFactory;
|
||||
|
||||
public class FieldBlock extends AModule
|
||||
public class FieldBlock extends MiniPlugin
|
||||
{
|
||||
private ConditionFactory _conditionFactory;
|
||||
private Energy _energy;
|
||||
private FieldRepository _repository;
|
||||
private HashMap<String, FieldBlockData> _blocks;
|
||||
|
||||
private HashSet<String> _active = new HashSet<String>();
|
||||
@ -44,183 +49,25 @@ public class FieldBlock extends AModule
|
||||
|
||||
private String _serverName;
|
||||
|
||||
public FieldBlock(JavaPlugin plugin, IRepository repository, String serverName)
|
||||
public FieldBlock(JavaPlugin plugin, ConditionFactory conditionFactory, Energy energy, FieldRepository repository, String serverName)
|
||||
{
|
||||
super("Field Block", plugin, repository);
|
||||
|
||||
super("Field Block", plugin);
|
||||
|
||||
_conditionFactory = conditionFactory;
|
||||
_energy = energy;
|
||||
_repository = repository;
|
||||
_blocks = new HashMap<String, FieldBlockData>();
|
||||
|
||||
_serverName = serverName;
|
||||
|
||||
load();
|
||||
}
|
||||
|
||||
//Module Functions
|
||||
@Override
|
||||
public void enable()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void disable()
|
||||
{
|
||||
clean();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void config()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void commands()
|
||||
{
|
||||
AddCommand("fb");
|
||||
}
|
||||
|
||||
@Override
|
||||
public void command(Player caller, String cmd, String[] args)
|
||||
{
|
||||
if (!Clients().Get(caller).Rank().Has(Rank.ADMIN, true))
|
||||
return;
|
||||
|
||||
if (args.length == 0)
|
||||
{
|
||||
showSettings(caller);
|
||||
return;
|
||||
}
|
||||
|
||||
if (args[0].equalsIgnoreCase("toggle"))
|
||||
{
|
||||
if (!_active.remove(caller.getName()))
|
||||
_active.add(caller.getName());
|
||||
|
||||
UtilPlayer.message(caller, F.main(GetName(), "Interact Active: " + F.tf(_active.contains(caller.getName()))));
|
||||
}
|
||||
|
||||
else if (args[0].equalsIgnoreCase("load"))
|
||||
{
|
||||
load();
|
||||
UtilPlayer.message(caller, F.main(_moduleName, "Reloaded Field Blocks from Database."));
|
||||
}
|
||||
|
||||
else if (args[0].equalsIgnoreCase("wipe"))
|
||||
{
|
||||
wipe(caller);
|
||||
}
|
||||
|
||||
else if (args[0].equalsIgnoreCase("help"))
|
||||
{
|
||||
help(caller);
|
||||
}
|
||||
|
||||
else if (args.length <= 1)
|
||||
{
|
||||
help(caller);
|
||||
}
|
||||
|
||||
else if (args[0].equalsIgnoreCase("title"))
|
||||
{
|
||||
_title.put(caller, args[1]);
|
||||
showSettings(caller);
|
||||
}
|
||||
|
||||
else if (args[0].equalsIgnoreCase("stock"))
|
||||
{
|
||||
try
|
||||
{
|
||||
int count = Integer.parseInt(args[1]);
|
||||
if (count < 1) count = 1;
|
||||
_stock.put(caller, count);
|
||||
showSettings(caller);
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
UtilPlayer.message(caller, F.main(_moduleName, "Invalid Stock Max."));
|
||||
}
|
||||
}
|
||||
|
||||
else if (args[0].equalsIgnoreCase("regen"))
|
||||
{
|
||||
try
|
||||
{
|
||||
double regen = Double.parseDouble(args[1]);
|
||||
if (regen < 0) regen = 0;
|
||||
_regen.put(caller, UtilMath.trim(1, regen));
|
||||
showSettings(caller);
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
UtilPlayer.message(caller, F.main(_moduleName, "Invalid Stock Regeneration Time."));
|
||||
}
|
||||
}
|
||||
|
||||
else if (args[0].equalsIgnoreCase("empty"))
|
||||
{
|
||||
try
|
||||
{
|
||||
String[] toks = args[1].split(":");
|
||||
|
||||
int id = Integer.parseInt(toks[0]);
|
||||
byte data = Byte.parseByte(toks[1]);
|
||||
|
||||
_emptyId.put(caller, id);
|
||||
_emptyData.put(caller, data);
|
||||
showSettings(caller);
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
UtilPlayer.message(caller, F.main(_moduleName, "Invalid Empty Block."));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
else if (args[0].equalsIgnoreCase("loot"))
|
||||
{
|
||||
boolean error = false;
|
||||
for (String cur : args[1].split(","))
|
||||
{
|
||||
String[] loot = cur.split(":");
|
||||
|
||||
if (loot.length != 5)
|
||||
{
|
||||
error = true;
|
||||
break;
|
||||
}
|
||||
|
||||
try
|
||||
{
|
||||
Integer.parseInt(loot[0]);
|
||||
Byte.parseByte(loot[1]);
|
||||
Integer.parseInt(loot[2]);
|
||||
Integer.parseInt(loot[3]);
|
||||
Integer.parseInt(loot[4]);
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
error = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if (error)
|
||||
{
|
||||
UtilPlayer.message(caller, F.main(_moduleName, "Invalid Loot String."));
|
||||
return;
|
||||
}
|
||||
|
||||
_lootString.put(caller, args[1]);
|
||||
showSettings(caller);
|
||||
}
|
||||
}
|
||||
|
||||
private void showSettings(Player caller)
|
||||
|
||||
public void showSettings(Player caller)
|
||||
{
|
||||
populateSettings(caller);
|
||||
|
||||
UtilPlayer.message(caller, F.main(_moduleName, "Field Addition Settings;"));
|
||||
UtilPlayer.message(caller, F.main(getName(), "Field Addition Settings;"));
|
||||
UtilPlayer.message(caller, F.desc("Title", _title.get(caller)));
|
||||
UtilPlayer.message(caller, F.desc("Stock", _stock.get(caller)+""));
|
||||
UtilPlayer.message(caller, F.desc("Regen", _regen.get(caller)+""));
|
||||
@ -257,34 +104,31 @@ public class FieldBlock extends AModule
|
||||
|
||||
if (event.getPlayer().getItemInHand() != null && event.getPlayer().getItemInHand().getType().toString().contains("PICKAXE"))
|
||||
{
|
||||
if (Util().Event().isAction(event, ActionType.R_BLOCK))
|
||||
if (UtilEvent.isAction(event, ActionType.R_BLOCK))
|
||||
showBlock(event.getPlayer(), event);
|
||||
}
|
||||
|
||||
else if (Util().Gear().isMat(event.getPlayer().getItemInHand(), Material.GLOWSTONE_DUST))
|
||||
else if (UtilGear.isMat(event.getPlayer().getItemInHand(), Material.GLOWSTONE_DUST))
|
||||
{
|
||||
if (Util().Event().isAction(event, ActionType.L_BLOCK))
|
||||
if (UtilEvent.isAction(event, ActionType.L_BLOCK))
|
||||
addBlock(event.getPlayer(), event);
|
||||
|
||||
else if (Util().Event().isAction(event, ActionType.R))
|
||||
else if (UtilEvent.isAction(event, ActionType.R))
|
||||
glowBlocks(event.getPlayer(), event);
|
||||
}
|
||||
|
||||
else if (Util().Gear().isMat(event.getPlayer().getItemInHand(), Material.REDSTONE))
|
||||
else if (UtilGear.isMat(event.getPlayer().getItemInHand(), Material.REDSTONE))
|
||||
{
|
||||
if (Util().Event().isAction(event, ActionType.L_BLOCK))
|
||||
if (UtilEvent.isAction(event, ActionType.L_BLOCK))
|
||||
delBlock(event.getPlayer(), event);
|
||||
|
||||
else if (Util().Event().isAction(event, ActionType.R))
|
||||
else if (UtilEvent.isAction(event, ActionType.R))
|
||||
glowBlocks(event.getPlayer(), event);
|
||||
}
|
||||
}
|
||||
|
||||
private void glowBlocks(Player player, PlayerInteractEvent event)
|
||||
{
|
||||
if (!Clients().Get(player).Rank().Has(Rank.ADMIN, false))
|
||||
return;
|
||||
|
||||
load();
|
||||
|
||||
for (FieldBlockData cur : _blocks.values())
|
||||
@ -293,12 +137,12 @@ public class FieldBlock extends AModule
|
||||
event.setCancelled(true);
|
||||
}
|
||||
|
||||
private void wipe(Player player)
|
||||
public void wipe(Player player)
|
||||
{
|
||||
for (FieldBlockData cur : _blocks.values())
|
||||
{
|
||||
cur.setEmpty();
|
||||
GetRepository().DeleteFieldBlock(_serverName, UtilWorld.locToStr(cur.getLocation()));
|
||||
_repository.deleteFieldBlock(_serverName, UtilWorld.locToStr(cur.getLocation()));
|
||||
}
|
||||
|
||||
_blocks.clear();
|
||||
@ -308,10 +152,7 @@ public class FieldBlock extends AModule
|
||||
|
||||
private void delBlock(Player player, PlayerInteractEvent event)
|
||||
{
|
||||
if (!Clients().Get(player).Rank().Has(Rank.ADMIN, false))
|
||||
return;
|
||||
|
||||
GetRepository().DeleteFieldBlock(_serverName, UtilWorld.locToStr(event.getClickedBlock().getLocation()));
|
||||
_repository.deleteFieldBlock(_serverName, UtilWorld.locToStr(event.getClickedBlock().getLocation()));
|
||||
|
||||
//Inform
|
||||
event.getClickedBlock().getWorld().playEffect(event.getClickedBlock().getLocation(), Effect.STEP_SOUND, 42);
|
||||
@ -322,9 +163,6 @@ public class FieldBlock extends AModule
|
||||
|
||||
private void addBlock(Player player, PlayerInteractEvent event)
|
||||
{
|
||||
if (!Clients().Get(player).Rank().Has(Rank.ADMIN, false))
|
||||
return;
|
||||
|
||||
populateSettings(player);
|
||||
showSettings(player);
|
||||
|
||||
@ -340,7 +178,7 @@ public class FieldBlock extends AModule
|
||||
token.StockRegenTime = _regen.get(player);
|
||||
token.Loot = _lootString.get(player);
|
||||
|
||||
GetRepository().AddFieldBlock(token);
|
||||
_repository.addFieldBlock(token);
|
||||
|
||||
//Inform
|
||||
event.getClickedBlock().getWorld().playEffect(event.getClickedBlock().getLocation(), Effect.STEP_SOUND, 41);
|
||||
@ -388,7 +226,7 @@ public class FieldBlock extends AModule
|
||||
{
|
||||
clean();
|
||||
|
||||
for (FieldBlockToken token : GetRepository().GetFieldBlocks(_serverName))
|
||||
for (FieldBlockToken token : _repository.getFieldBlocks(_serverName))
|
||||
{
|
||||
Location loc = UtilWorld.strToLoc(token.Location);
|
||||
_blocks.put(token.Location, new FieldBlockData(this, loc, token.BlockId, token.BlockData, token.EmptyId, token.EmptyData, token.StockMax, token.StockRegenTime, token.Loot));
|
||||
@ -409,5 +247,50 @@ public class FieldBlock extends AModule
|
||||
return _blocks.get(UtilWorld.locToStr(block.getLocation()));
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
public Energy getEnergy()
|
||||
{
|
||||
return _energy;
|
||||
}
|
||||
|
||||
public HashSet<String> getActive()
|
||||
{
|
||||
return _active;
|
||||
}
|
||||
|
||||
public WeakHashMap<Player, String> getLootString()
|
||||
{
|
||||
return _lootString;
|
||||
}
|
||||
|
||||
public WeakHashMap<Player, Integer> getEmptyId()
|
||||
{
|
||||
return _emptyId;
|
||||
}
|
||||
|
||||
public WeakHashMap<Player, Byte> getEmptyData()
|
||||
{
|
||||
return _emptyData;
|
||||
}
|
||||
|
||||
public WeakHashMap<Player, Double> getRegen()
|
||||
{
|
||||
return _regen;
|
||||
}
|
||||
|
||||
public WeakHashMap<Player, Integer> getStock()
|
||||
{
|
||||
return _stock;
|
||||
}
|
||||
|
||||
public WeakHashMap<Player, String> getTitle()
|
||||
{
|
||||
return null;
|
||||
}
|
||||
|
||||
public ConditionFactory getCondition()
|
||||
{
|
||||
return _conditionFactory;
|
||||
}
|
||||
}
|
@ -1,4 +1,4 @@
|
||||
package me.chiss.Core.Field;
|
||||
package mineplex.game.clans.fields;
|
||||
|
||||
import java.util.ArrayList;
|
||||
|
||||
@ -53,7 +53,7 @@ public class FieldBlockData
|
||||
|
||||
if (loot.length != 5)
|
||||
{
|
||||
Field.Log("Loot Failure: " + cur);
|
||||
System.out.println("Loot Failure: " + cur);
|
||||
continue;
|
||||
}
|
||||
|
||||
@ -68,7 +68,7 @@ public class FieldBlockData
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
Field.Log("Loot Failure: " + cur);
|
||||
System.out.println("Loot Failure: " + cur);
|
||||
}
|
||||
}
|
||||
|
||||
@ -129,7 +129,7 @@ public class FieldBlockData
|
||||
|
||||
public void handleMined(Player player)
|
||||
{
|
||||
if (!Field.Energy().use(player, "Mine Field Block", 60, true, true))
|
||||
if (!Field.getEnergy().Use(player, "Mine Field Block", 60, true, true))
|
||||
return;
|
||||
|
||||
//Set Break Time - Avoid Instant Regen
|
||||
@ -151,7 +151,7 @@ public class FieldBlockData
|
||||
}
|
||||
|
||||
//Slow
|
||||
Field.Condition().Factory().Slow("Field Slow", player, player, 6, 1, false, true, false);
|
||||
Field.getCondition().Slow("Field Slow", player, player, 6, 1, false, true, false, false);
|
||||
}
|
||||
|
||||
public boolean tryMine()
|
@ -1,4 +1,4 @@
|
||||
package me.chiss.Core.Field;
|
||||
package mineplex.game.clans.fields;
|
||||
|
||||
import mineplex.core.common.util.F;
|
||||
import mineplex.core.common.util.UtilMath;
|
@ -0,0 +1,174 @@
|
||||
package mineplex.game.clans.fields;
|
||||
|
||||
import java.util.HashSet;
|
||||
import java.util.WeakHashMap;
|
||||
|
||||
import org.bukkit.Location;
|
||||
import org.bukkit.entity.EntityType;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.event.HandlerList;
|
||||
import org.bukkit.plugin.java.JavaPlugin;
|
||||
|
||||
import mineplex.core.MiniPlugin;
|
||||
import mineplex.core.common.Rank;
|
||||
import mineplex.core.common.util.F;
|
||||
import mineplex.core.common.util.UtilEnt;
|
||||
import mineplex.core.common.util.UtilPlayer;
|
||||
import mineplex.core.common.util.UtilServer;
|
||||
import mineplex.core.common.util.UtilWorld;
|
||||
import mineplex.core.creature.Creature;
|
||||
import mineplex.game.clans.fields.monsters.FieldMonsterBase;
|
||||
import mineplex.game.clans.fields.repository.FieldMonsterToken;
|
||||
import mineplex.game.clans.fields.repository.FieldRepository;
|
||||
|
||||
public class FieldMonster extends MiniPlugin
|
||||
{
|
||||
private Creature _creature;
|
||||
private FieldRepository _repository;
|
||||
private HashSet<FieldMonsterBase> _pits;
|
||||
private String _serverName;
|
||||
|
||||
private WeakHashMap<Player, FieldMonsterInput> _input = new WeakHashMap<Player, FieldMonsterInput>();
|
||||
|
||||
public FieldMonster(JavaPlugin plugin, FieldRepository repository, Creature creature, String serverName)
|
||||
{
|
||||
super("Field Monster", plugin);
|
||||
|
||||
_repository = repository;
|
||||
_creature = creature;
|
||||
_pits = new HashSet<FieldMonsterBase>();
|
||||
_serverName = serverName;
|
||||
|
||||
Load();
|
||||
}
|
||||
|
||||
public void Help(Player caller)
|
||||
{
|
||||
UtilPlayer.message(caller, F.main(getName(), "Commands List;"));
|
||||
UtilPlayer.message(caller, F.help("/fm type <Monster>", "Set Monster Type", Rank.ADMIN));
|
||||
UtilPlayer.message(caller, F.help("/fm max <#>", "Set Monster Limit", Rank.ADMIN));
|
||||
UtilPlayer.message(caller, F.help("/fm rate <Minutes>", "Set Monster Rate", Rank.ADMIN));
|
||||
UtilPlayer.message(caller, F.help("/fm radius <#>", "Set Area Radius", Rank.ADMIN));
|
||||
UtilPlayer.message(caller, F.help("/fm height <#>", "Set Area Height", Rank.ADMIN));
|
||||
UtilPlayer.message(caller, F.help("/fm create <Name>", "Create at your Location", Rank.ADMIN));
|
||||
UtilPlayer.message(caller, F.help("/fm delete <Name>", "Delete Field", Rank.ADMIN));
|
||||
UtilPlayer.message(caller, F.help("/fm list", "List Monster Fields", Rank.ADMIN));
|
||||
UtilPlayer.message(caller, F.help("/fm info <Name>", "Display Monster Field", Rank.ADMIN));
|
||||
UtilPlayer.message(caller, F.help("/fm kill", "Kills all Field Monsters", Rank.ADMIN));
|
||||
UtilPlayer.message(caller, F.help("/fm wipe", "Delete All Monster Field (Database)", Rank.ADMIN));
|
||||
}
|
||||
|
||||
public void Create(Player caller, String name)
|
||||
{
|
||||
FieldMonsterInput input = _input.get(caller);
|
||||
|
||||
if (input.type == null)
|
||||
{
|
||||
UtilPlayer.message(caller, F.main(getName(), "You have not set Monster Type."));
|
||||
return;
|
||||
}
|
||||
|
||||
for (FieldMonsterBase pit : _pits)
|
||||
{
|
||||
if (name.equalsIgnoreCase(pit.GetName()))
|
||||
{
|
||||
UtilPlayer.message(caller, F.main(getName(), "Monster Field with this name already exists."));
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
FieldMonsterBase pit = new FieldMonsterBase(this, name, _serverName, input.type, input.mobMax, input.mobRate, caller.getLocation(), input.radius, input.height);
|
||||
Add(pit, true);
|
||||
|
||||
UtilPlayer.message(caller, F.main(getName(), "You created Monster Field."));
|
||||
pit.Display(caller);
|
||||
}
|
||||
|
||||
private void Add(FieldMonsterBase pit, boolean repo)
|
||||
{
|
||||
UtilServer.getServer().getPluginManager().registerEvents(pit, GetPlugin());
|
||||
_pits.add(pit);
|
||||
|
||||
if (repo)
|
||||
_repository.addFieldMonster(pit.GetToken());
|
||||
}
|
||||
|
||||
public void Delete(Player caller, String name)
|
||||
{
|
||||
HashSet<FieldMonsterBase> remove = new HashSet<FieldMonsterBase>();
|
||||
|
||||
for (FieldMonsterBase pit : _pits)
|
||||
if (pit.GetName().equalsIgnoreCase(name))
|
||||
remove.add(pit);
|
||||
|
||||
int i = remove.size();
|
||||
|
||||
for (FieldMonsterBase pit : remove)
|
||||
Delete(pit, true);
|
||||
|
||||
UtilPlayer.message(caller, F.main(getName(), "Deleted " + i + " Monster Field(s)."));
|
||||
}
|
||||
|
||||
private void Delete(FieldMonsterBase pit, boolean repo)
|
||||
{
|
||||
_pits.remove(pit);
|
||||
pit.RemoveMonsters();
|
||||
HandlerList.unregisterAll(pit);
|
||||
|
||||
if (repo)
|
||||
_repository.deleteFieldMonster(_serverName, pit.GetToken().Name);
|
||||
}
|
||||
|
||||
public void Wipe(Player player, boolean repo)
|
||||
{
|
||||
HashSet<FieldMonsterBase> remove = new HashSet<FieldMonsterBase>();
|
||||
|
||||
for (FieldMonsterBase pit : _pits)
|
||||
remove.add(pit);
|
||||
|
||||
_pits.clear();
|
||||
|
||||
for (FieldMonsterBase pit : remove)
|
||||
Delete(pit, repo);
|
||||
|
||||
UtilPlayer.message(player, F.main(_moduleName, "Field Monsters Wiped."));
|
||||
}
|
||||
|
||||
private void Load()
|
||||
{
|
||||
Wipe(null, false);
|
||||
|
||||
for (FieldMonsterToken token : _repository.getFieldMonsters(_serverName))
|
||||
{
|
||||
EntityType type = UtilEnt.searchEntity(null, token.Type, false);
|
||||
if (type == null) continue;
|
||||
|
||||
Location loc = UtilWorld.strToLoc(token.Centre);
|
||||
if (loc == null) continue;
|
||||
|
||||
FieldMonsterBase pit = new FieldMonsterBase(this, token.Name, _serverName, type, token.MobMax, token.MobRate, loc, token.Radius, token.Height);
|
||||
Add(pit, false);
|
||||
}
|
||||
}
|
||||
|
||||
private void Clean()
|
||||
{
|
||||
for (FieldMonsterBase pit : _pits)
|
||||
pit.RemoveMonsters();
|
||||
}
|
||||
|
||||
public WeakHashMap<Player, FieldMonsterInput> getInput()
|
||||
{
|
||||
return _input;
|
||||
}
|
||||
|
||||
public HashSet<FieldMonsterBase> getPits()
|
||||
{
|
||||
return _pits;
|
||||
}
|
||||
|
||||
public Creature getCreature()
|
||||
{
|
||||
return _creature;
|
||||
}
|
||||
}
|
@ -1,4 +1,4 @@
|
||||
package me.chiss.Core.Field;
|
||||
package mineplex.game.clans.fields;
|
||||
|
||||
import mineplex.core.common.util.F;
|
||||
import mineplex.core.common.util.UtilPlayer;
|
@ -1,10 +1,8 @@
|
||||
package me.chiss.Core.Field;
|
||||
package mineplex.game.clans.fields;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashSet;
|
||||
|
||||
import nautilus.minecraft.core.webserver.token.Server.FieldOreToken;
|
||||
|
||||
import org.bukkit.Effect;
|
||||
import org.bukkit.Location;
|
||||
import org.bukkit.Material;
|
||||
@ -16,20 +14,24 @@ import org.bukkit.event.block.BlockBreakEvent;
|
||||
import org.bukkit.event.player.PlayerInteractEvent;
|
||||
import org.bukkit.plugin.java.JavaPlugin;
|
||||
|
||||
import me.chiss.Core.Module.AModule;
|
||||
import mineplex.core.server.IRepository;
|
||||
import mineplex.core.MiniPlugin;
|
||||
import mineplex.core.updater.event.UpdateEvent;
|
||||
import mineplex.core.updater.UpdateType;
|
||||
import mineplex.core.common.Rank;
|
||||
import mineplex.core.common.util.F;
|
||||
import mineplex.core.common.util.UtilEvent;
|
||||
import mineplex.core.common.util.UtilGear;
|
||||
import mineplex.core.common.util.UtilMath;
|
||||
import mineplex.core.common.util.UtilPlayer;
|
||||
import mineplex.core.common.util.UtilTime;
|
||||
import mineplex.core.common.util.UtilWorld;
|
||||
import mineplex.core.common.util.UtilEvent.ActionType;
|
||||
import mineplex.game.clans.fields.repository.FieldOreToken;
|
||||
import mineplex.game.clans.fields.repository.FieldRepository;
|
||||
|
||||
public class FieldOre extends AModule
|
||||
public class FieldOre extends MiniPlugin
|
||||
{
|
||||
private FieldRepository _repository;
|
||||
private HashSet<String> _active = new HashSet<String>();
|
||||
|
||||
private ArrayList<FieldOreData> _oreInactive = new ArrayList<FieldOreData>();
|
||||
@ -42,86 +44,15 @@ public class FieldOre extends AModule
|
||||
|
||||
private String _serverName;
|
||||
|
||||
public FieldOre(JavaPlugin plugin, IRepository repository, String serverName)
|
||||
public FieldOre(JavaPlugin plugin, FieldRepository repository, String serverName)
|
||||
{
|
||||
super("Field Ore", plugin, repository);
|
||||
super("Field Ore", plugin);
|
||||
|
||||
_repository = repository;
|
||||
_serverName = serverName;
|
||||
|
||||
load();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void enable()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void disable()
|
||||
{
|
||||
clean();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void config()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void commands()
|
||||
{
|
||||
AddCommand("fo");
|
||||
}
|
||||
|
||||
@Override
|
||||
public void command(Player caller, String cmd, String[] args)
|
||||
{
|
||||
if (!Clients().Get(caller).Rank().Has(Rank.ADMIN, true))
|
||||
return;
|
||||
|
||||
if (args.length == 0)
|
||||
{
|
||||
help(caller);
|
||||
return;
|
||||
}
|
||||
|
||||
if (args[0].equalsIgnoreCase("toggle"))
|
||||
{
|
||||
if (!_active.remove(caller.getName()))
|
||||
_active.add(caller.getName());
|
||||
|
||||
UtilPlayer.message(caller, F.main(GetName(), "Interact Active: " + F.tf(_active.contains(caller.getName()))));
|
||||
}
|
||||
|
||||
else if (args[0].equalsIgnoreCase("help"))
|
||||
{
|
||||
help(caller);
|
||||
}
|
||||
|
||||
else if (args[0].equalsIgnoreCase("reset"))
|
||||
{
|
||||
reset(caller);
|
||||
}
|
||||
|
||||
else if (args[0].equalsIgnoreCase("fill"))
|
||||
{
|
||||
fill(caller);
|
||||
}
|
||||
|
||||
else if (args[0].equalsIgnoreCase("list"))
|
||||
{
|
||||
list(caller);
|
||||
}
|
||||
|
||||
else if (args[0].equalsIgnoreCase("wipe"))
|
||||
{
|
||||
wipe(caller);
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
public void help(Player caller)
|
||||
{
|
||||
@ -139,17 +70,17 @@ public class FieldOre extends AModule
|
||||
if (!_active.contains(event.getPlayer().getName()))
|
||||
return;
|
||||
|
||||
if (Util().Gear().isMat(event.getPlayer().getItemInHand(), Material.DIAMOND))
|
||||
if (UtilGear.isMat(event.getPlayer().getItemInHand(), Material.DIAMOND))
|
||||
{
|
||||
if (Util().Event().isAction(event, ActionType.L))
|
||||
if (UtilEvent.isAction(event, ActionType.L))
|
||||
addBlock(event.getPlayer(), event);
|
||||
|
||||
else if (Util().Event().isAction(event, ActionType.R_BLOCK))
|
||||
else if (UtilEvent.isAction(event, ActionType.R_BLOCK))
|
||||
delBlock(event.getPlayer(), event);
|
||||
}
|
||||
}
|
||||
|
||||
private void reset(Player player)
|
||||
public void reset(Player player)
|
||||
{
|
||||
for (FieldOreData ore : _oreActive)
|
||||
{
|
||||
@ -162,7 +93,7 @@ public class FieldOre extends AModule
|
||||
UtilPlayer.message(player, F.main(_moduleName, "Field Ore Reset."));
|
||||
}
|
||||
|
||||
private void fill(Player player)
|
||||
public void fill(Player player)
|
||||
{
|
||||
while (!_oreInactive.isEmpty())
|
||||
_oreInactive.get(UtilMath.r(_oreInactive.size())).StartVein(2 + UtilMath.r(5));
|
||||
@ -170,20 +101,20 @@ public class FieldOre extends AModule
|
||||
UtilPlayer.message(player, F.main(_moduleName, "Field Ore Generated."));
|
||||
}
|
||||
|
||||
private void list(Player player)
|
||||
public void list(Player player)
|
||||
{
|
||||
UtilPlayer.message(player, F.main(_moduleName, F.value("Total", ""+_oreLocations.size())));
|
||||
UtilPlayer.message(player, F.main(_moduleName, F.value("Active", ""+_oreActive.size())));
|
||||
UtilPlayer.message(player, F.main(_moduleName, F.value("Inactive", ""+_oreInactive.size())));
|
||||
}
|
||||
|
||||
private void wipe(Player player)
|
||||
public void wipe(Player player)
|
||||
{
|
||||
reset(player);
|
||||
|
||||
for (Location loc : _oreLocations)
|
||||
{
|
||||
GetRepository().DeleteFieldOre(_serverName, UtilWorld.locToStr(loc));
|
||||
_repository.deleteFieldOre(_serverName, UtilWorld.locToStr(loc));
|
||||
}
|
||||
|
||||
_oreInactive.clear();
|
||||
@ -194,9 +125,6 @@ public class FieldOre extends AModule
|
||||
|
||||
private void addBlock(Player player, PlayerInteractEvent event)
|
||||
{
|
||||
if (!Clients().Get(player).Rank().Has(Rank.ADMIN, false))
|
||||
return;
|
||||
|
||||
Block block = player.getTargetBlock(null, 0);
|
||||
|
||||
if (Get(block.getLocation()) != null)
|
||||
@ -209,7 +137,7 @@ public class FieldOre extends AModule
|
||||
FieldOreToken token = new FieldOreToken();
|
||||
token.Server = _serverName;
|
||||
token.Location = UtilWorld.locToStr(block.getLocation());
|
||||
GetRepository().AddFieldOre(token);
|
||||
_repository.addFieldOre(token);
|
||||
|
||||
//Memory
|
||||
_oreInactive.add(new FieldOreData(this, block.getLocation()));
|
||||
@ -223,9 +151,6 @@ public class FieldOre extends AModule
|
||||
|
||||
private void delBlock(Player player, PlayerInteractEvent event)
|
||||
{
|
||||
if (!Clients().Get(player).Rank().Has(Rank.ADMIN, false))
|
||||
return;
|
||||
|
||||
event.setCancelled(true);
|
||||
|
||||
FieldOreData ore = Get(event.getPlayer().getTargetBlock(null, 0).getLocation());
|
||||
@ -236,7 +161,7 @@ public class FieldOre extends AModule
|
||||
return;
|
||||
}
|
||||
|
||||
GetRepository().DeleteFieldOre(_serverName, UtilWorld.locToStr(event.getClickedBlock().getLocation()));
|
||||
_repository.deleteFieldOre(_serverName, UtilWorld.locToStr(event.getClickedBlock().getLocation()));
|
||||
|
||||
ore.GetLocation().getBlock().setType(Material.STONE);
|
||||
|
||||
@ -320,7 +245,7 @@ public class FieldOre extends AModule
|
||||
{
|
||||
clean();
|
||||
|
||||
for (FieldOreToken token : GetRepository().GetFieldOres(_serverName))
|
||||
for (FieldOreToken token : _repository.getFieldOres(_serverName))
|
||||
{
|
||||
Location loc = UtilWorld.strToLoc(token.Location);
|
||||
|
||||
@ -337,4 +262,9 @@ public class FieldOre extends AModule
|
||||
_oreActive.clear();
|
||||
_oreLocations.clear();
|
||||
}
|
||||
|
||||
public HashSet<String> getActivePlayers()
|
||||
{
|
||||
return _active;
|
||||
}
|
||||
}
|
@ -1,4 +1,4 @@
|
||||
package me.chiss.Core.Field;
|
||||
package mineplex.game.clans.fields;
|
||||
|
||||
import java.util.HashSet;
|
||||
|
@ -1,4 +1,4 @@
|
||||
package me.chiss.Core.Field;
|
||||
package mineplex.game.clans.fields;
|
||||
|
||||
import mineplex.core.common.util.UtilServer;
|
||||
|
@ -0,0 +1,145 @@
|
||||
package mineplex.game.clans.fields.commands;
|
||||
|
||||
import org.bukkit.entity.Player;
|
||||
|
||||
import mineplex.core.command.CommandBase;
|
||||
import mineplex.core.common.Rank;
|
||||
import mineplex.core.common.util.F;
|
||||
import mineplex.core.common.util.UtilMath;
|
||||
import mineplex.core.common.util.UtilPlayer;
|
||||
import mineplex.game.clans.fields.FieldBlock;
|
||||
|
||||
public class FieldBlockCommand extends CommandBase<FieldBlock>
|
||||
{
|
||||
public FieldBlockCommand(FieldBlock plugin)
|
||||
{
|
||||
super(plugin, Rank.ADMIN, "fb");
|
||||
}
|
||||
|
||||
@Override
|
||||
public void Execute(Player caller, String[] args)
|
||||
{
|
||||
if (args[0].equalsIgnoreCase("toggle"))
|
||||
{
|
||||
if (!Plugin.getActive().remove(caller.getName()))
|
||||
Plugin.getActive().add(caller.getName());
|
||||
|
||||
UtilPlayer.message(caller, F.main(Plugin.getName(), "Interact Active: " + F.tf(Plugin.getActive().contains(caller.getName()))));
|
||||
}
|
||||
|
||||
else if (args[0].equalsIgnoreCase("load"))
|
||||
{
|
||||
Plugin.load();
|
||||
UtilPlayer.message(caller, F.main(Plugin.getName(), "Reloaded Field Blocks from Database."));
|
||||
}
|
||||
|
||||
else if (args[0].equalsIgnoreCase("wipe"))
|
||||
{
|
||||
Plugin.wipe(caller);
|
||||
}
|
||||
|
||||
else if (args[0].equalsIgnoreCase("help"))
|
||||
{
|
||||
Plugin.help(caller);
|
||||
}
|
||||
|
||||
else if (args.length <= 1)
|
||||
{
|
||||
Plugin.help(caller);
|
||||
}
|
||||
|
||||
else if (args[0].equalsIgnoreCase("title"))
|
||||
{
|
||||
Plugin.getTitle().put(caller, args[1]);
|
||||
Plugin.showSettings(caller);
|
||||
}
|
||||
|
||||
else if (args[0].equalsIgnoreCase("stock"))
|
||||
{
|
||||
try
|
||||
{
|
||||
int count = Integer.parseInt(args[1]);
|
||||
if (count < 1) count = 1;
|
||||
Plugin.getStock().put(caller, count);
|
||||
Plugin.showSettings(caller);
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
UtilPlayer.message(caller, F.main(Plugin.getName(), "Invalid Stock Max."));
|
||||
}
|
||||
}
|
||||
|
||||
else if (args[0].equalsIgnoreCase("regen"))
|
||||
{
|
||||
try
|
||||
{
|
||||
double regen = Double.parseDouble(args[1]);
|
||||
if (regen < 0) regen = 0;
|
||||
Plugin.getRegen().put(caller, UtilMath.trim(1, regen));
|
||||
Plugin.showSettings(caller);
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
UtilPlayer.message(caller, F.main(Plugin.getName(), "Invalid Stock Regeneration Time."));
|
||||
}
|
||||
}
|
||||
|
||||
else if (args[0].equalsIgnoreCase("empty"))
|
||||
{
|
||||
try
|
||||
{
|
||||
String[] toks = args[1].split(":");
|
||||
|
||||
int id = Integer.parseInt(toks[0]);
|
||||
byte data = Byte.parseByte(toks[1]);
|
||||
|
||||
Plugin.getEmptyId().put(caller, id);
|
||||
Plugin.getEmptyData().put(caller, data);
|
||||
Plugin.showSettings(caller);
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
UtilPlayer.message(caller, F.main(Plugin.getName(), "Invalid Empty Block."));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
else if (args[0].equalsIgnoreCase("loot"))
|
||||
{
|
||||
boolean error = false;
|
||||
for (String cur : args[1].split(","))
|
||||
{
|
||||
String[] loot = cur.split(":");
|
||||
|
||||
if (loot.length != 5)
|
||||
{
|
||||
error = true;
|
||||
break;
|
||||
}
|
||||
|
||||
try
|
||||
{
|
||||
Integer.parseInt(loot[0]);
|
||||
Byte.parseByte(loot[1]);
|
||||
Integer.parseInt(loot[2]);
|
||||
Integer.parseInt(loot[3]);
|
||||
Integer.parseInt(loot[4]);
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
error = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if (error)
|
||||
{
|
||||
UtilPlayer.message(caller, F.main(Plugin.getName(), "Invalid Loot String."));
|
||||
return;
|
||||
}
|
||||
|
||||
Plugin.getLootString().put(caller, args[1]);
|
||||
Plugin.showSettings(caller);
|
||||
}
|
||||
}
|
||||
}
|
@ -0,0 +1,170 @@
|
||||
package mineplex.game.clans.fields.commands;
|
||||
|
||||
import org.bukkit.entity.Player;
|
||||
|
||||
import mineplex.core.command.CommandBase;
|
||||
import mineplex.core.common.Rank;
|
||||
import mineplex.core.common.util.F;
|
||||
import mineplex.core.common.util.UtilEnt;
|
||||
import mineplex.core.common.util.UtilPlayer;
|
||||
import mineplex.game.clans.fields.FieldMonster;
|
||||
import mineplex.game.clans.fields.FieldMonsterInput;
|
||||
import mineplex.game.clans.fields.monsters.FieldMonsterBase;
|
||||
|
||||
public class FieldMonsterCommand extends CommandBase<FieldMonster>
|
||||
{
|
||||
public FieldMonsterCommand(FieldMonster plugin)
|
||||
{
|
||||
super(plugin, Rank.ADMIN, "fm");
|
||||
}
|
||||
|
||||
@Override
|
||||
public void Execute(Player caller, String[] args)
|
||||
{
|
||||
if (!Plugin.getInput().containsKey(caller))
|
||||
Plugin.getInput().put(caller, new FieldMonsterInput());
|
||||
|
||||
FieldMonsterInput input = Plugin.getInput().get(caller);
|
||||
|
||||
if (args.length == 0)
|
||||
{
|
||||
Plugin.getInput().get(caller).Display(caller);
|
||||
UtilPlayer.message(caller, F.main(Plugin.getName(), "Type " + F.elem("/fm help") + " for commands."));
|
||||
}
|
||||
|
||||
else if (args[0].equalsIgnoreCase("help"))
|
||||
{
|
||||
Plugin.Help(caller);
|
||||
}
|
||||
|
||||
else if (args[0].equalsIgnoreCase("type"))
|
||||
{
|
||||
try
|
||||
{
|
||||
input.type = UtilEnt.searchEntity(caller, args[1], true);
|
||||
if (input.type != null)
|
||||
input.Display(caller);
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
UtilPlayer.message(caller, F.main(Plugin.getName(), "Invalid Monster Type."));
|
||||
}
|
||||
}
|
||||
|
||||
else if (args[0].equalsIgnoreCase("max"))
|
||||
{
|
||||
try
|
||||
{
|
||||
int value = Integer.parseInt(args[1]);
|
||||
if (value < 1) value = 1;
|
||||
input.mobMax = value;
|
||||
input.Display(caller);
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
UtilPlayer.message(caller, F.main(Plugin.getName(), "Invalid Monster Max."));
|
||||
}
|
||||
}
|
||||
|
||||
else if (args[0].equalsIgnoreCase("rate"))
|
||||
{
|
||||
try
|
||||
{
|
||||
double value = Double.parseDouble(args[1]);
|
||||
if (value < 0) value = 0;
|
||||
input.mobRate = value;
|
||||
input.Display(caller);
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
UtilPlayer.message(caller, F.main(Plugin.getName(), "Invalid Monster Rate."));
|
||||
}
|
||||
}
|
||||
|
||||
else if (args[0].equalsIgnoreCase("radius"))
|
||||
{
|
||||
try
|
||||
{
|
||||
int integer = Integer.parseInt(args[1]);
|
||||
if (integer < 1) integer = 1;
|
||||
input.radius = integer;
|
||||
input.Display(caller);
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
UtilPlayer.message(caller, F.main(Plugin.getName(), "Invalid Area Radius."));
|
||||
}
|
||||
}
|
||||
|
||||
else if (args[0].equalsIgnoreCase("height"))
|
||||
{
|
||||
try
|
||||
{
|
||||
int integer = Integer.parseInt(args[1]);
|
||||
if (integer < 1) integer = 1;
|
||||
input.height = integer;
|
||||
input.Display(caller);
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
UtilPlayer.message(caller, F.main(Plugin.getName(), "Invalid Area Height."));
|
||||
}
|
||||
}
|
||||
|
||||
else if (args[0].equalsIgnoreCase("create"))
|
||||
{
|
||||
if (args.length < 2)
|
||||
{
|
||||
UtilPlayer.message(caller, F.main(Plugin.getName(), "Missing Monster Field Name."));
|
||||
}
|
||||
else
|
||||
{
|
||||
Plugin.Create(caller, args[1]);
|
||||
}
|
||||
}
|
||||
|
||||
else if (args[0].equalsIgnoreCase("delete"))
|
||||
{
|
||||
if (args.length < 2)
|
||||
{
|
||||
UtilPlayer.message(caller, F.main(Plugin.getName(), "Missing Monster Field Name."));
|
||||
}
|
||||
else
|
||||
{
|
||||
Plugin.Delete(caller, args[1]);
|
||||
}
|
||||
}
|
||||
|
||||
else if (args[0].equalsIgnoreCase("list"))
|
||||
{
|
||||
UtilPlayer.message(caller, F.main(Plugin.getName(), "Listing Monster Fields;"));
|
||||
|
||||
for (FieldMonsterBase pit : Plugin.getPits())
|
||||
pit.Display(caller);
|
||||
}
|
||||
|
||||
else if (args[0].equalsIgnoreCase("info"))
|
||||
{
|
||||
UtilPlayer.message(caller, F.main(Plugin.getName(), "Listing Monster Fields;"));
|
||||
|
||||
for (FieldMonsterBase pit : Plugin.getPits())
|
||||
pit.Display(caller);
|
||||
}
|
||||
|
||||
else if (args[0].equalsIgnoreCase("wipe"))
|
||||
{
|
||||
Plugin.Wipe(caller, true);
|
||||
}
|
||||
|
||||
else if (args[0].equalsIgnoreCase("kill"))
|
||||
{
|
||||
for (FieldMonsterBase pit : Plugin.getPits())
|
||||
pit.RemoveMonsters();
|
||||
}
|
||||
|
||||
else
|
||||
{
|
||||
UtilPlayer.message(caller, F.main(Plugin.getName(), "Invalid Command."));
|
||||
}
|
||||
}
|
||||
}
|
@ -0,0 +1,60 @@
|
||||
package mineplex.game.clans.fields.commands;
|
||||
|
||||
import org.bukkit.entity.Player;
|
||||
|
||||
import mineplex.core.command.CommandBase;
|
||||
import mineplex.core.common.Rank;
|
||||
import mineplex.core.common.util.F;
|
||||
import mineplex.core.common.util.UtilPlayer;
|
||||
import mineplex.game.clans.fields.FieldOre;
|
||||
|
||||
public class FieldOreCommand extends CommandBase<FieldOre>
|
||||
{
|
||||
public FieldOreCommand(FieldOre plugin)
|
||||
{
|
||||
super(plugin, Rank.ADMIN, "fo");
|
||||
}
|
||||
|
||||
@Override
|
||||
public void Execute(Player caller, String[] args)
|
||||
{
|
||||
if (args.length == 0)
|
||||
{
|
||||
Plugin.help(caller);
|
||||
return;
|
||||
}
|
||||
|
||||
if (args[0].equalsIgnoreCase("toggle"))
|
||||
{
|
||||
if (!Plugin.getActivePlayers().remove(caller.getName()))
|
||||
Plugin.getActivePlayers().add(caller.getName());
|
||||
|
||||
UtilPlayer.message(caller, F.main(Plugin.getName(), "Interact Active: " + F.tf(Plugin.getActivePlayers().contains(caller.getName()))));
|
||||
}
|
||||
|
||||
else if (args[0].equalsIgnoreCase("help"))
|
||||
{
|
||||
Plugin.help(caller);
|
||||
}
|
||||
|
||||
else if (args[0].equalsIgnoreCase("reset"))
|
||||
{
|
||||
Plugin.reset(caller);
|
||||
}
|
||||
|
||||
else if (args[0].equalsIgnoreCase("fill"))
|
||||
{
|
||||
Plugin.fill(caller);
|
||||
}
|
||||
|
||||
else if (args[0].equalsIgnoreCase("list"))
|
||||
{
|
||||
Plugin.list(caller);
|
||||
}
|
||||
|
||||
else if (args[0].equalsIgnoreCase("wipe"))
|
||||
{
|
||||
Plugin.wipe(caller);
|
||||
}
|
||||
}
|
||||
}
|
@ -1,11 +1,9 @@
|
||||
package me.chiss.Core.Field.Monsters;
|
||||
package mineplex.game.clans.fields.monsters;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashMap;
|
||||
import java.util.HashSet;
|
||||
|
||||
import me.chiss.Core.Field.FieldMonster;
|
||||
import me.chiss.Core.Field.UtilField;
|
||||
import mineplex.core.updater.event.UpdateEvent;
|
||||
import mineplex.core.updater.UpdateType;
|
||||
import mineplex.core.common.util.F;
|
||||
@ -14,13 +12,15 @@ import mineplex.core.common.util.UtilMath;
|
||||
import mineplex.core.common.util.UtilPlayer;
|
||||
import mineplex.core.common.util.UtilTime;
|
||||
import mineplex.core.common.util.UtilWorld;
|
||||
import nautilus.minecraft.core.webserver.token.Server.FieldMonsterToken;
|
||||
import net.minecraft.server.v1_6_R3.EntityCreature;
|
||||
import net.minecraft.server.v1_6_R3.Navigation;
|
||||
import mineplex.game.clans.fields.FieldMonster;
|
||||
import mineplex.game.clans.fields.UtilField;
|
||||
import mineplex.game.clans.fields.repository.FieldMonsterToken;
|
||||
import net.minecraft.server.v1_7_R4.EntityCreature;
|
||||
import net.minecraft.server.v1_7_R4.Navigation;
|
||||
|
||||
import org.bukkit.Location;
|
||||
import org.bukkit.block.Block;
|
||||
import org.bukkit.craftbukkit.v1_6_R3.entity.CraftCreature;
|
||||
import org.bukkit.craftbukkit.v1_7_R4.entity.CraftCreature;
|
||||
import org.bukkit.entity.Entity;
|
||||
import org.bukkit.entity.EntityType;
|
||||
import org.bukkit.entity.Player;
|
||||
@ -84,7 +84,7 @@ public class FieldMonsterBase implements Listener
|
||||
|
||||
_mobLast = System.currentTimeMillis();
|
||||
|
||||
Entity ent = Manager.Creature().SpawnEntity(SelectLocation(), _type);
|
||||
Entity ent = Manager.getCreature().SpawnEntity(SelectLocation(), _type);
|
||||
_mobs.put(ent, 0);
|
||||
}
|
||||
|
@ -0,0 +1,14 @@
|
||||
package mineplex.game.clans.fields.repository;
|
||||
|
||||
public class FieldBlockToken
|
||||
{
|
||||
public String Server;
|
||||
public String Location;
|
||||
public int BlockId;
|
||||
public byte BlockData;
|
||||
public int EmptyId;
|
||||
public byte EmptyData;
|
||||
public int StockMax;
|
||||
public double StockRegenTime;
|
||||
public String Loot;
|
||||
}
|
@ -0,0 +1,13 @@
|
||||
package mineplex.game.clans.fields.repository;
|
||||
|
||||
public class FieldMonsterToken
|
||||
{
|
||||
public String Name;
|
||||
public String Server;
|
||||
public String Type;
|
||||
public int MobMax;
|
||||
public double MobRate;
|
||||
public String Centre;
|
||||
public int Radius;
|
||||
public int Height;
|
||||
}
|
@ -0,0 +1,7 @@
|
||||
package mineplex.game.clans.fields.repository;
|
||||
|
||||
public class FieldOreToken
|
||||
{
|
||||
public String Server;
|
||||
public String Location;
|
||||
}
|
@ -0,0 +1,182 @@
|
||||
package mineplex.game.clans.fields.repository;
|
||||
|
||||
import java.sql.ResultSet;
|
||||
import java.sql.SQLException;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
import org.bukkit.plugin.java.JavaPlugin;
|
||||
|
||||
import mineplex.core.database.RepositoryBase;
|
||||
import mineplex.core.database.ResultSetCallable;
|
||||
import mineplex.core.database.column.ColumnByte;
|
||||
import mineplex.core.database.column.ColumnDouble;
|
||||
import mineplex.core.database.column.ColumnInt;
|
||||
import mineplex.core.database.column.ColumnVarChar;
|
||||
|
||||
public class FieldRepository extends RepositoryBase
|
||||
{
|
||||
private static String CREATE_FIELD_BLOCK_TABLE = "CREATE TABLE IF NOT EXISTS fieldBlock (id INT NOT NULL AUTO_INCREMENT, server VARCHAR(100), location VARCHAR(100), blockId INT, blockData TINYINT, emptyId INT, emptyData TINYINT, stockMax INT, stockRegenTime DOUBLE, loot VARCHAR(100) PRIMARY KEY (id), INDEX serverLocation (server, location));";
|
||||
private static String CREATE_FIELD_ORE_TABLE = "CREATE TABLE IF NOT EXISTS fieldOre (id INT NOT NULL AUTO_INCREMENT, server VARCHAR(100), location VARCHAR(100), PRIMARY KEY (id), INDEX serverLocation (server, location));";
|
||||
private static String CREATE_FIELD_MONSTER_TABLE = "CREATE TABLE IF NOT EXISTS fieldMonster (id INT NOT NULL AUTO_INCREMENT, server VARCHAR(100), name VARCHAR(100), type VARCHAR(100), mobMax INT, mobRate DOUBLE, center VARCHAR(100), radius INT, height INT PRIMARY KEY (id), INDEX serverName (server, name));";
|
||||
private static String RETRIEVE_FIELD_BLOCKS = "SELECT server, location, blockId, blockData, emptyId, emptyData, stockMax, stockRegen, loot FROM fieldBlock WHERE server = ?;";
|
||||
private static String ADD_FIELD_BLOCK = "INSERT INTO fieldBlock (server, location, blockId, blockData, emptyId, emptyData, stockMax, stockRegen, loot) VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?);";
|
||||
private static String DEL_FIELD_BLOCK = "DELETE FROM fieldBlock WHERE server = ? AND location = ?;";
|
||||
private static String RETRIEVE_FIELD_ORES = "SELECT server, location FROM fieldOre WHERE server = ?;";
|
||||
private static String ADD_FIELD_ORE = "INSERT INTO fieldBlock (server, location) VALUES (?, ?);";
|
||||
private static String DEL_FIELD_ORE = "DELETE FROM fieldOre WHERE server = ? AND location = ?;";
|
||||
private static String RETRIEVE_FIELD_MONSTERS = "SELECT server, name, type, mobMax, mobRate, center, radius, height FROM fieldMonster WHERE server = ?;";
|
||||
private static String ADD_FIELD_MONSTER = "INSERT INTO fieldBlock (server, name, type, mobMax, mobRate, center, radius, height) VALUES (?, ?, ?, ?, ?, ?, ?, ?);";
|
||||
private static String DEL_FIELD_MONSTER = "DELETE FROM fieldBlock WHERE server = ? AND name = ?;";
|
||||
|
||||
public FieldRepository(JavaPlugin plugin)
|
||||
{
|
||||
super(plugin, "jdbc:mysql://db.mineplex.com:3306/Account?autoReconnect=true&failOverReadOnly=false&maxReconnects=10", "root", "tAbechAk3wR7tuTh");
|
||||
}
|
||||
|
||||
public List<FieldBlockToken> getFieldBlocks(String server)
|
||||
{
|
||||
final List<FieldBlockToken> fieldBlocks = new ArrayList<FieldBlockToken>();
|
||||
|
||||
this.executeQuery(RETRIEVE_FIELD_BLOCKS, new ResultSetCallable()
|
||||
{
|
||||
@Override
|
||||
public void processResultSet(ResultSet resultSet) throws SQLException
|
||||
{
|
||||
while (resultSet.next())
|
||||
{
|
||||
FieldBlockToken token = new FieldBlockToken();
|
||||
token.Server = resultSet.getString(1);
|
||||
token.Location = resultSet.getString(2);
|
||||
token.BlockId = resultSet.getInt(3);
|
||||
token.BlockData = resultSet.getByte(4);
|
||||
token.EmptyId = resultSet.getInt(5);
|
||||
token.EmptyData = resultSet.getByte(6);
|
||||
token.StockMax = resultSet.getInt(7);
|
||||
token.StockRegenTime = resultSet.getLong(8);
|
||||
token.Loot = resultSet.getString(9);
|
||||
|
||||
fieldBlocks.add(token);
|
||||
}
|
||||
}
|
||||
}, new ColumnVarChar("server", 100, server));
|
||||
|
||||
return fieldBlocks;
|
||||
}
|
||||
|
||||
public void addFieldBlock(FieldBlockToken token)
|
||||
{
|
||||
executeUpdate(ADD_FIELD_BLOCK,
|
||||
new ColumnVarChar("server", 100, token.Server),
|
||||
new ColumnVarChar("location", 100, token.Location),
|
||||
new ColumnInt("blockId", token.BlockId),
|
||||
new ColumnByte("blockData", token.BlockData),
|
||||
new ColumnInt("emptyId", token.EmptyId),
|
||||
new ColumnByte("emptyData", token.EmptyData),
|
||||
new ColumnInt("stockMax", token.StockMax),
|
||||
new ColumnDouble("stockRegen", token.StockRegenTime),
|
||||
new ColumnVarChar("loot", 100, token.Loot)
|
||||
);
|
||||
}
|
||||
|
||||
public void deleteFieldBlock(String server, String location)
|
||||
{
|
||||
executeUpdate(DEL_FIELD_BLOCK, new ColumnVarChar("server", 100, server), new ColumnVarChar("location", 100, location));
|
||||
}
|
||||
|
||||
public List<FieldOreToken> getFieldOres(String server)
|
||||
{
|
||||
final List<FieldOreToken> fieldOres = new ArrayList<FieldOreToken>();
|
||||
|
||||
this.executeQuery(RETRIEVE_FIELD_ORES, new ResultSetCallable()
|
||||
{
|
||||
@Override
|
||||
public void processResultSet(ResultSet resultSet) throws SQLException
|
||||
{
|
||||
while (resultSet.next())
|
||||
{
|
||||
FieldOreToken token = new FieldOreToken();
|
||||
token.Server = resultSet.getString(1);
|
||||
token.Location = resultSet.getString(2);
|
||||
|
||||
fieldOres.add(token);
|
||||
}
|
||||
}
|
||||
}, new ColumnVarChar("server", 100, server));
|
||||
|
||||
return fieldOres;
|
||||
}
|
||||
|
||||
public void addFieldOre(FieldOreToken token)
|
||||
{
|
||||
executeUpdate(ADD_FIELD_ORE,
|
||||
new ColumnVarChar("server", 100, token.Server),
|
||||
new ColumnVarChar("location", 100, token.Location)
|
||||
);
|
||||
}
|
||||
|
||||
public void deleteFieldOre(String server, String location)
|
||||
{
|
||||
executeUpdate(DEL_FIELD_ORE, new ColumnVarChar("server", 100, server), new ColumnVarChar("location", 100, location));
|
||||
}
|
||||
|
||||
public List<FieldMonsterToken> getFieldMonsters(String server)
|
||||
{
|
||||
List<FieldMonsterToken> fieldMonsters = new ArrayList<FieldMonsterToken>();
|
||||
|
||||
this.executeQuery(RETRIEVE_FIELD_MONSTERS, new ResultSetCallable()
|
||||
{
|
||||
@Override
|
||||
public void processResultSet(ResultSet resultSet) throws SQLException
|
||||
{
|
||||
while (resultSet.next())
|
||||
{
|
||||
FieldMonsterToken token = new FieldMonsterToken();
|
||||
token.Name = resultSet.getString(1);
|
||||
token.Server = resultSet.getString(2);
|
||||
token.Type = resultSet.getString(3);
|
||||
token.MobMax = resultSet.getInt(4);
|
||||
token.MobRate = resultSet.getDouble(5);
|
||||
token.Centre = resultSet.getString(6);
|
||||
token.Radius = resultSet.getInt(7);
|
||||
token.Height = resultSet.getInt(8);
|
||||
}
|
||||
}
|
||||
}, new ColumnVarChar("server", 100, server));
|
||||
|
||||
return fieldMonsters;
|
||||
}
|
||||
|
||||
public void addFieldMonster(FieldMonsterToken token)
|
||||
{
|
||||
executeUpdate(ADD_FIELD_MONSTER,
|
||||
new ColumnVarChar("server", 100, token.Server),
|
||||
new ColumnVarChar("name", 100, token.Name),
|
||||
new ColumnVarChar("blockId", 100, token.Type),
|
||||
new ColumnInt("mobMax", token.MobMax),
|
||||
new ColumnDouble("mobRate", token.MobRate),
|
||||
new ColumnVarChar("center", 100, token.Centre),
|
||||
new ColumnInt("redius", token.Radius),
|
||||
new ColumnInt("height", token.Height)
|
||||
);
|
||||
}
|
||||
|
||||
public void deleteFieldMonster(String server, String name)
|
||||
{
|
||||
executeUpdate(DEL_FIELD_MONSTER, new ColumnVarChar("server", 100, server), new ColumnVarChar("name", 100, name));
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void initialize()
|
||||
{
|
||||
executeUpdate(CREATE_FIELD_BLOCK_TABLE);
|
||||
executeUpdate(CREATE_FIELD_ORE_TABLE);
|
||||
executeUpdate(CREATE_FIELD_MONSTER_TABLE);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void update()
|
||||
{
|
||||
}
|
||||
|
||||
}
|
@ -183,7 +183,7 @@ public class HubManager extends MiniClientPlugin<HubClient>
|
||||
_visibilityManager = new VisibilityManager(this);
|
||||
|
||||
_forcefieldManager = new ForcefieldManager(this);
|
||||
AddCommand(new ForcefieldRadius(_forcefieldManager));
|
||||
addCommand(new ForcefieldRadius(_forcefieldManager));
|
||||
|
||||
_statsManager = new StatsManager(plugin);
|
||||
_achievementManager = new AchievementManager(_statsManager, _clientManager, _donationManager);
|
||||
@ -329,9 +329,9 @@ public class HubManager extends MiniClientPlugin<HubClient>
|
||||
@Override
|
||||
public void AddCommands()
|
||||
{
|
||||
AddCommand(new GadgetToggle(this));
|
||||
AddCommand(new NewsCommand(this));
|
||||
AddCommand(new GameModeCommand(this));
|
||||
addCommand(new GadgetToggle(this));
|
||||
addCommand(new NewsCommand(this));
|
||||
addCommand(new GameModeCommand(this));
|
||||
}
|
||||
|
||||
@EventHandler(priority = EventPriority.HIGHEST)
|
||||
|
@ -23,7 +23,7 @@ public class NewsAddCommand extends CommandBase<HubManager>
|
||||
{
|
||||
if (args == null || args.length == 0 || args.length > 128)
|
||||
{
|
||||
UtilPlayer.message(caller, F.main(Plugin.GetName(), C.cRed + "Your arguments are inappropriate for this command!"));
|
||||
UtilPlayer.message(caller, F.main(Plugin.getName(), C.cRed + "Your arguments are inappropriate for this command!"));
|
||||
return;
|
||||
}
|
||||
else
|
||||
@ -40,7 +40,7 @@ public class NewsAddCommand extends CommandBase<HubManager>
|
||||
// Check for 256 character length for MySQL!
|
||||
if (newsEntry.length() > 256)
|
||||
{
|
||||
UtilPlayer.message(caller, F.main(Plugin.GetName(), C.cRed + "The specified news entry is too long [> 256 characters]!"));
|
||||
UtilPlayer.message(caller, F.main(Plugin.getName(), C.cRed + "The specified news entry is too long [> 256 characters]!"));
|
||||
return;
|
||||
}
|
||||
|
||||
@ -57,11 +57,11 @@ public class NewsAddCommand extends CommandBase<HubManager>
|
||||
}
|
||||
newsEntry = newsEntry.substring(0, newsEntry.length() - 1);
|
||||
|
||||
UtilPlayer.message(caller, F.main(Plugin.GetName(), C.cGray + "The news entry: " + C.cGold + newsEntry + C.cGray + " has been added to the database!"));
|
||||
UtilPlayer.message(caller, F.main(Plugin.getName(), C.cGray + "The news entry: " + C.cGold + newsEntry + C.cGray + " has been added to the database!"));
|
||||
}
|
||||
else
|
||||
{
|
||||
UtilPlayer.message(caller, F.main(Plugin.GetName(), C.cRed + "There was an error adding the news entry to the database!"));
|
||||
UtilPlayer.message(caller, F.main(Plugin.getName(), C.cRed + "There was an error adding the news entry to the database!"));
|
||||
}
|
||||
}
|
||||
});
|
||||
|
@ -22,7 +22,7 @@ public class NewsConfirmCommand extends CommandBase<HubManager>
|
||||
{
|
||||
if (args == null || args.length == 0 || args.length > 1)
|
||||
{
|
||||
UtilPlayer.message(caller, F.main(Plugin.GetName(), C.cRed + "Your arguments are inappropriate for this command!"));
|
||||
UtilPlayer.message(caller, F.main(Plugin.getName(), C.cRed + "Your arguments are inappropriate for this command!"));
|
||||
return;
|
||||
}
|
||||
else
|
||||
@ -34,11 +34,11 @@ public class NewsConfirmCommand extends CommandBase<HubManager>
|
||||
}
|
||||
catch (Exception exception)
|
||||
{
|
||||
UtilPlayer.message(caller, F.main(Plugin.GetName(), C.cRed + "The specified news position is invalid!"));
|
||||
UtilPlayer.message(caller, F.main(Plugin.getName(), C.cRed + "The specified news position is invalid!"));
|
||||
return;
|
||||
}
|
||||
|
||||
UtilServer.getServer().dispatchCommand(UtilServer.getServer().getConsoleSender(), "tellraw " + caller.getName() + " {\"text\":\"" + Plugin.GetName() + "> \", color:blue, \"extra\":[{\"text\":\"[CONFIRM] \", color:green, \"clickEvent\":{\"action\":\"run_command\",\"value\":\"/news delete " + newsPosition + "\"}, \"hoverEvent\":{\"action\":\"show_text\",\"value\":\"Are you absolutely sure???\"}}, {\"text\":\"News Entry " + newsPosition + "\", color:gold}, {\"text\":\" deletion?\", color:gray}]}");
|
||||
UtilServer.getServer().dispatchCommand(UtilServer.getServer().getConsoleSender(), "tellraw " + caller.getName() + " {\"text\":\"" + Plugin.getName() + "> \", color:blue, \"extra\":[{\"text\":\"[CONFIRM] \", color:green, \"clickEvent\":{\"action\":\"run_command\",\"value\":\"/news delete " + newsPosition + "\"}, \"hoverEvent\":{\"action\":\"show_text\",\"value\":\"Are you absolutely sure???\"}}, {\"text\":\"News Entry " + newsPosition + "\", color:gold}, {\"text\":\" deletion?\", color:gray}]}");
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
@ -23,7 +23,7 @@ public class NewsDeleteCommand extends CommandBase<HubManager>
|
||||
{
|
||||
if (args == null || args.length == 0 || args.length > 1)
|
||||
{
|
||||
UtilPlayer.message(caller, F.main(Plugin.GetName(), C.cRed + "Your arguments are inappropriate for this command!"));
|
||||
UtilPlayer.message(caller, F.main(Plugin.getName(), C.cRed + "Your arguments are inappropriate for this command!"));
|
||||
return;
|
||||
}
|
||||
else
|
||||
@ -36,7 +36,7 @@ public class NewsDeleteCommand extends CommandBase<HubManager>
|
||||
}
|
||||
catch (Exception exception)
|
||||
{
|
||||
UtilPlayer.message(caller, F.main(Plugin.GetName(), C.cRed + "The specified news position is invalid!"));
|
||||
UtilPlayer.message(caller, F.main(Plugin.getName(), C.cRed + "The specified news position is invalid!"));
|
||||
return;
|
||||
}
|
||||
newsMang.DeleteNewsEntry(newsPosition, new Callback<Boolean>()
|
||||
@ -45,11 +45,11 @@ public class NewsDeleteCommand extends CommandBase<HubManager>
|
||||
{
|
||||
if (success)
|
||||
{
|
||||
UtilPlayer.message(caller, F.main(Plugin.GetName(), C.cGray + "The news entry at position " + C.cGold + newsPosition + C.cGray + " has been deleted!"));
|
||||
UtilPlayer.message(caller, F.main(Plugin.getName(), C.cGray + "The news entry at position " + C.cGold + newsPosition + C.cGray + " has been deleted!"));
|
||||
}
|
||||
else
|
||||
{
|
||||
UtilPlayer.message(caller, F.main(Plugin.GetName(), C.cRed + "There was an error deleting the news entry; likely the specified news position was invalid!"));
|
||||
UtilPlayer.message(caller, F.main(Plugin.getName(), C.cRed + "There was an error deleting the news entry; likely the specified news position was invalid!"));
|
||||
}
|
||||
}
|
||||
});
|
||||
|
@ -29,7 +29,7 @@ public class NewsListCommand extends CommandBase<HubManager>
|
||||
{
|
||||
final NewsManager newsMang = Plugin.GetNewsManager();
|
||||
|
||||
UtilPlayer.message(caller, F.main(Plugin.GetName(), C.cGray + "Current server news messages:"));
|
||||
UtilPlayer.message(caller, F.main(Plugin.getName(), C.cGray + "Current server news messages:"));
|
||||
|
||||
newsMang.RetriveNewsEntries(new Callback<HashMap<String, String>>()
|
||||
{
|
||||
@ -49,7 +49,7 @@ public class NewsListCommand extends CommandBase<HubManager>
|
||||
|
||||
for (int i = 0; i < newsStrings.length; i++)
|
||||
{
|
||||
UtilServer.getServer().dispatchCommand(UtilServer.getServer().getConsoleSender(), "tellraw " + caller.getName() + " {\"text\":\"" + Plugin.GetName() + "> \", color:blue, \"extra\":[{\"text\":\"[DELETE] \", color:red, \"clickEvent\":{\"action\":\"run_command\",\"value\":\"/news ¢¤₦₣¡₨₥ " + (i + 1) + "\"}, \"hoverEvent\":{\"action\":\"show_text\",\"value\":\"Deletes News Entry " + (i + 1) + " : " + newsStrings[i] + "\"}}, {\"text\":\"News " + (i + 1) + "\", color:gold}, {\"text\":\" : \", color:gray}, {\"text\":\"" + newsStrings[i] + "\", color:white}]}");
|
||||
UtilServer.getServer().dispatchCommand(UtilServer.getServer().getConsoleSender(), "tellraw " + caller.getName() + " {\"text\":\"" + Plugin.getName() + "> \", color:blue, \"extra\":[{\"text\":\"[DELETE] \", color:red, \"clickEvent\":{\"action\":\"run_command\",\"value\":\"/news ¢¤₦₣¡₨₥ " + (i + 1) + "\"}, \"hoverEvent\":{\"action\":\"show_text\",\"value\":\"Deletes News Entry " + (i + 1) + " : " + newsStrings[i] + "\"}}, {\"text\":\"News " + (i + 1) + "\", color:gold}, {\"text\":\" : \", color:gray}, {\"text\":\"" + newsStrings[i] + "\", color:white}]}");
|
||||
}
|
||||
}
|
||||
});
|
||||
@ -59,7 +59,7 @@ public class NewsListCommand extends CommandBase<HubManager>
|
||||
}
|
||||
else
|
||||
{
|
||||
UtilPlayer.message(caller, F.main(Plugin.GetName(), C.cRed + "Your arguments are inappropriate for this command!"));
|
||||
UtilPlayer.message(caller, F.main(Plugin.getName(), C.cRed + "Your arguments are inappropriate for this command!"));
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
@ -23,7 +23,7 @@ public class NewsSetCommand extends CommandBase<HubManager>
|
||||
{
|
||||
if (args == null || args.length < 2 || args.length > 128)
|
||||
{
|
||||
UtilPlayer.message(caller, F.main(Plugin.GetName(), C.cRed + "Your arguments are inappropriate for this command!"));
|
||||
UtilPlayer.message(caller, F.main(Plugin.getName(), C.cRed + "Your arguments are inappropriate for this command!"));
|
||||
return;
|
||||
}
|
||||
else
|
||||
@ -41,7 +41,7 @@ public class NewsSetCommand extends CommandBase<HubManager>
|
||||
// Check for 256 character length for MySQL!
|
||||
if (newsEntry.length() > 256)
|
||||
{
|
||||
UtilPlayer.message(caller, F.main(Plugin.GetName(), C.cRed + "The specified news entry is too long [> 256 characters]!"));
|
||||
UtilPlayer.message(caller, F.main(Plugin.getName(), C.cRed + "The specified news entry is too long [> 256 characters]!"));
|
||||
return;
|
||||
}
|
||||
|
||||
@ -51,7 +51,7 @@ public class NewsSetCommand extends CommandBase<HubManager>
|
||||
}
|
||||
catch (Exception exception)
|
||||
{
|
||||
UtilPlayer.message(caller, F.main(Plugin.GetName(), C.cRed + "The specified news position is invalid!"));
|
||||
UtilPlayer.message(caller, F.main(Plugin.getName(), C.cRed + "The specified news position is invalid!"));
|
||||
return;
|
||||
}
|
||||
newsMang.SetNewsEntry(newsEntry, newsPosition, new Callback<Boolean>()
|
||||
@ -67,11 +67,11 @@ public class NewsSetCommand extends CommandBase<HubManager>
|
||||
}
|
||||
newsEntry = newsEntry.substring(0, newsEntry.length() - 1);
|
||||
|
||||
UtilPlayer.message(caller, F.main(Plugin.GetName(), C.cGray + "The news entry at position " + C.cGold + newsPosition + C.cGray + " has been updated to: " + C.cGold + newsEntry + C.cGray + "!"));
|
||||
UtilPlayer.message(caller, F.main(Plugin.getName(), C.cGray + "The news entry at position " + C.cGold + newsPosition + C.cGray + " has been updated to: " + C.cGold + newsEntry + C.cGray + "!"));
|
||||
}
|
||||
else
|
||||
{
|
||||
UtilPlayer.message(caller, F.main(Plugin.GetName(), C.cRed + "There was an error updating the news entry; likely the specified news position was invalid!"));
|
||||
UtilPlayer.message(caller, F.main(Plugin.getName(), C.cRed + "There was an error updating the news entry; likely the specified news position was invalid!"));
|
||||
}
|
||||
}
|
||||
});
|
||||
|
@ -39,7 +39,7 @@ public class AdminMountManager extends MiniPlugin
|
||||
@Override
|
||||
public void AddCommands()
|
||||
{
|
||||
AddCommand(new HorseSpawn(this));
|
||||
addCommand(new HorseSpawn(this));
|
||||
}
|
||||
|
||||
@EventHandler
|
||||
|
@ -36,7 +36,7 @@ public class PartyManager extends MiniPlugin
|
||||
@Override
|
||||
public void AddCommands()
|
||||
{
|
||||
AddCommand(new PartyCommand(this));
|
||||
addCommand(new PartyCommand(this));
|
||||
}
|
||||
|
||||
public CoreClientManager GetClients()
|
||||
|
@ -220,6 +220,6 @@ public class PollManager extends MiniClientPlugin<PlayerPollData>
|
||||
@Override
|
||||
public void AddCommands()
|
||||
{
|
||||
AddCommand(new PollCommand(this));
|
||||
addCommand(new PollCommand(this));
|
||||
}
|
||||
}
|
||||
|
@ -539,33 +539,33 @@ public class ServerManager extends MiniPlugin
|
||||
|
||||
public void ListServerNpcs(Player caller)
|
||||
{
|
||||
UtilPlayer.message(caller, F.main(GetName(), "Listing Server Npcs:"));
|
||||
UtilPlayer.message(caller, F.main(getName(), "Listing Server Npcs:"));
|
||||
|
||||
for (String serverNpc : _serverKeyInfoMap.keySet())
|
||||
{
|
||||
UtilPlayer.message(caller, F.main(GetName(), C.cYellow + serverNpc));
|
||||
UtilPlayer.message(caller, F.main(getName(), C.cYellow + serverNpc));
|
||||
}
|
||||
}
|
||||
|
||||
public void ListServers(Player caller, String serverNpcName)
|
||||
{
|
||||
UtilPlayer.message(caller, F.main(GetName(), "Listing Servers for '" + serverNpcName + "':"));
|
||||
UtilPlayer.message(caller, F.main(getName(), "Listing Servers for '" + serverNpcName + "':"));
|
||||
|
||||
for (ServerInfo serverNpc : _serverKeyInfoMap.get(serverNpcName))
|
||||
{
|
||||
UtilPlayer.message(caller, F.main(GetName(), C.cYellow + serverNpc.Name + C.cWhite + " - " + serverNpc.MOTD + " " + serverNpc.CurrentPlayers + "/" + serverNpc.MaxPlayers));
|
||||
UtilPlayer.message(caller, F.main(getName(), C.cYellow + serverNpc.Name + C.cWhite + " - " + serverNpc.MOTD + " " + serverNpc.CurrentPlayers + "/" + serverNpc.MaxPlayers));
|
||||
}
|
||||
}
|
||||
|
||||
public void ListOfflineServers(Player caller)
|
||||
{
|
||||
UtilPlayer.message(caller, F.main(GetName(), "Listing Offline Servers:"));
|
||||
UtilPlayer.message(caller, F.main(getName(), "Listing Offline Servers:"));
|
||||
|
||||
for (ServerInfo serverNpc : _serverInfoMap.values())
|
||||
{
|
||||
if (serverNpc.MOTD.equalsIgnoreCase(ChatColor.DARK_RED + "OFFLINE"))
|
||||
{
|
||||
UtilPlayer.message(caller, F.main(GetName(), C.cYellow + serverNpc.Name + C.cWhite + " - " + F.time(UtilTime.convertString(System.currentTimeMillis() - _serverUpdate.get(serverNpc.Name), 0, TimeUnit.FIT))));
|
||||
UtilPlayer.message(caller, F.main(getName(), C.cYellow + serverNpc.Name + C.cWhite + " - " + F.time(UtilTime.convertString(System.currentTimeMillis() - _serverUpdate.get(serverNpc.Name), 0, TimeUnit.FIT))));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -580,6 +580,6 @@ public class CombatManager extends MiniPlugin
|
||||
}
|
||||
}
|
||||
|
||||
player.sendMessage(F.main(GetName(), nameBuilder.toString()));
|
||||
player.sendMessage(F.main(getName(), nameBuilder.toString()));
|
||||
}
|
||||
}
|
||||
|
@ -56,7 +56,7 @@ public class StaffServer extends JavaPlugin
|
||||
new FileUpdater(this, portal);
|
||||
|
||||
new CustomerSupport(this, clientManager, donationManager, new SalesPackageManager(this, clientManager, donationManager, new InventoryManager(this), new StatsManager(this)));
|
||||
new Password(this);
|
||||
new Password(this, serverStatusManager.getCurrentServerName());
|
||||
|
||||
//Updates
|
||||
getServer().getScheduler().scheduleSyncRepeatingTask(this, new Updater(this), 1, 1);
|
||||
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue
Block a user