nether work (forgot to commit days ago oops)

This commit is contained in:
NewGarbo 2016-03-02 19:42:53 +00:00
parent d524645ddd
commit 73d8870daf
25 changed files with 910 additions and 280 deletions

View File

@ -75,6 +75,8 @@ public class C
public static String chatAdminHead = "" + ChatColor.DARK_PURPLE; public static String chatAdminHead = "" + ChatColor.DARK_PURPLE;
public static String chatAdminBody = "" + ChatColor.LIGHT_PURPLE; public static String chatAdminBody = "" + ChatColor.LIGHT_PURPLE;
public static String cClansNether = "" + ChatColor.RED;
public static String listTitle = "" + ChatColor.WHITE; public static String listTitle = "" + ChatColor.WHITE;
public static String listValue = "" + ChatColor.YELLOW; public static String listValue = "" + ChatColor.YELLOW;
public static String listValueOn = "" + ChatColor.GREEN; public static String listValueOn = "" + ChatColor.GREEN;

View File

@ -215,4 +215,9 @@ public class F
? "an" : "a"; ? "an" : "a";
} }
public static String clansNether(String word)
{
return C.cClansNether + word + C.mBody;
}
} }

View File

@ -218,7 +218,7 @@ public class UtilAlg
return cross(vec, getRight(vec)); return cross(vec, getRight(vec));
} }
public static Location getAverageLocation(ArrayList<Location> locs) public static Location getAverageLocation(List<Location> locs)
{ {
if (locs.isEmpty()) if (locs.isEmpty())
return null; return null;
@ -237,7 +237,26 @@ public class UtilAlg
return vec.toLocation(locs.get(0).getWorld()); return vec.toLocation(locs.get(0).getWorld());
} }
public static Vector getAverageBump(Location source, ArrayList<Location> locs) public static Location getAverageBlockLocation(List<Block> locs)
{
if (locs.isEmpty())
return null;
Vector vec = new Vector(0,0,0);
double amount = 0;
for (Block loc : locs)
{
vec.add(loc.getLocation().toVector());
amount++;
}
vec.multiply(1d/amount);
return vec.toLocation(locs.get(0).getWorld());
}
public static Vector getAverageBump(Location source, List<Location> locs)
{ {
if (locs.isEmpty()) if (locs.isEmpty())
return null; return null;
@ -543,20 +562,4 @@ public class UtilAlg
return new Location(location.getWorld(), x, location.getY(), z, location.getYaw(), location.getPitch()); return new Location(location.getWorld(), x, location.getY(), z, location.getYaw(), location.getPitch());
} }
public static Location moveForward(Location location, double strength, float yaw, float pitch, boolean reverse)
{
double x = location.getX();
double y = location.getY();
double z = location.getZ();
double yawAngle = Math.toRadians(yaw);
double pitchAngle = Math.toRadians(pitch);
x = reverse ? (x + strength * Math.sin(yawAngle)) : (x - strength * Math.sin(yawAngle));
y = reverse ? (y + strength * Math.sin(pitchAngle)) : (y - strength * Math.sin(pitchAngle));
z = reverse ? (z - strength * Math.cos(yawAngle)) : (z + strength * Math.cos(yawAngle));
return new Location(location.getWorld(), x, y, z);
}
} }

View File

@ -1,7 +1,13 @@
package mineplex.core.common.util; package mineplex.core.common.util;
import java.util.Arrays;
import java.util.Collection; import java.util.Collection;
import java.util.List;
import java.util.function.Consumer; import java.util.function.Consumer;
import java.util.function.Function;
import org.bukkit.Location;
import org.bukkit.block.Block;
public class UtilCollections public class UtilCollections
{ {
@ -26,6 +32,45 @@ public class UtilCollections
return new NautHashMap<K, V>(); return new NautHashMap<K, V>();
} }
public static <T> T getLast(List<T> list)
{
return list.isEmpty() ? null : list.get(list.size() - 1);
}
public static <T> T getFirst(List<T> list)
{
return list.isEmpty() ? null : list.get(0);
}
public static <T> T getLast(NautArrayList<T> list)
{
return list.isEmpty() ? null : list.get(list.size() - 1);
}
public static <T> T getFirst(NautArrayList<T> list)
{
return list.isEmpty() ? null : list.get(0);
}
public static <E> void forEach(E[] elements, Function<E, E> filter, Consumer<E> consumer)
{
for (int i = 0; i < elements.length; i++)
{
consumer.accept(filter.apply(elements[i]));
}
}
public static <E> void forEachFilter(E[] elements, Function<E, Boolean> filter, Consumer<E> consumer)
{
for (int i = 0; i < elements.length; i++)
{
if (filter.apply(elements[i]).booleanValue())
{
consumer.accept(elements[i]);
}
}
}
public static <E> void forEach(E[] elements, Consumer<E> consumer) public static <E> void forEach(E[] elements, Consumer<E> consumer)
{ {
for (int i = 0; i < elements.length; i++) for (int i = 0; i < elements.length; i++)
@ -39,6 +84,11 @@ public class UtilCollections
forEach(elements, collection::add); forEach(elements, collection::add);
} }
public static <E> void addAll(E[] elements, Function<E, Boolean> filter, Collection<E> collection)
{
forEachFilter(elements, filter, collection::add);
}
public static void loop(int min, int max, Consumer<Integer> consumer) public static void loop(int min, int max, Consumer<Integer> consumer)
{ {
for (int i = min; i < max; i++) for (int i = min; i < max; i++)
@ -47,4 +97,93 @@ public class UtilCollections
} }
} }
public static byte[] ensureSize(byte[] array, int size)
{
if (array.length <= size)
{
return array;
}
return Arrays.copyOf(array, size);
}
public static boolean[] ensureSize(boolean[] array, int size)
{
if (array.length <= size)
{
return array;
}
return Arrays.copyOf(array, size);
}
public static int[] ensureSize(int[] array, int size)
{
if (array.length <= size)
{
return array;
}
return Arrays.copyOf(array, size);
}
public static long[] ensureSize(long[] array, int size)
{
if (array.length <= size)
{
return array;
}
return Arrays.copyOf(array, size);
}
public static short[] ensureSize(short[] array, int size)
{
if (array.length <= size)
{
return array;
}
return Arrays.copyOf(array, size);
}
public static char[] ensureSize(char[] array, int size)
{
if (array.length <= size)
{
return array;
}
return Arrays.copyOf(array, size);
}
public static float[] ensureSize(float[] array, int size)
{
if (array.length <= size)
{
return array;
}
return Arrays.copyOf(array, size);
}
public static double[] ensureSize(double[] array, int size)
{
if (array.length <= size)
{
return array;
}
return Arrays.copyOf(array, size);
}
public static Object[] ensureSize(Object[] array, int size)
{
if (array.length <= size)
{
return array;
}
return Arrays.copyOf(array, size);
}
} }

View File

@ -0,0 +1,54 @@
package mineplex.core.common.util;
import java.io.File;
import java.io.FileInputStream;
import java.io.IOException;
public class UtilFile
{
public static String read(File file)
{
try
{
return new String(readBytes(file));
}
catch (IOException e)
{
return null;
}
}
/**
* @param file
* @return
* @throws IOException
*/
public static byte[] readBytes(File file) throws IOException
{
FileInputStream stream = new FileInputStream(file);
byte[] bytes = new byte[stream.available() /* estimated bytes available */];
int pointer = 0;
while (true)
{
int read = stream.read();
if (read == -1)
{
break;
}
bytes = UtilCollections.ensureSize(bytes, bytes.length + 1);
bytes[pointer] = (byte) read;
++pointer;
}
stream.close();
return bytes;
}
}

View File

@ -1,5 +1,6 @@
package mineplex.core; package mineplex.core;
import org.bukkit.Bukkit;
import org.bukkit.event.HandlerList; import org.bukkit.event.HandlerList;
import org.bukkit.event.Listener; import org.bukkit.event.Listener;
import org.bukkit.plugin.PluginManager; import org.bukkit.plugin.PluginManager;
@ -100,7 +101,7 @@ public abstract class MiniPlugin implements Listener
public void log(String message) public void log(String message)
{ {
System.out.println(F.main(_moduleName, message)); Bukkit.getConsoleSender().sendMessage(F.main(_moduleName, message));
} }
public void runAsync(Runnable runnable) public void runAsync(Runnable runnable)

View File

@ -118,7 +118,7 @@ public class TaskManager extends MiniDbClientPlugin<TaskClient>
{ {
public void run(Boolean success) public void run(Boolean success)
{ {
if (!success) if (!success.booleanValue())
{ {
System.out.println("Add task FAILED for " + player.getName()); System.out.println("Add task FAILED for " + player.getName());

View File

@ -224,6 +224,11 @@ public class ClanTips extends MiniPlugin
C.cDAqua + "Meownon", C.cDAqua + "Meownon",
C.cAqua + "Congratulations on your new purchase! You are now in possesion, of the one, and only, Meownon 3000.24! " + C.Italics + "we are not responsible for any injuries caused by the meownon, or any related products. stay safe kids." C.cAqua + "Congratulations on your new purchase! You are now in possesion, of the one, and only, Meownon 3000.24! " + C.Italics + "we are not responsible for any injuries caused by the meownon, or any related products. stay safe kids."
}), }),
ENTER_NETHER(
new String[] {
C.cDAqua + "The Nether",
C.cAqua + "Welcome to the Nether. This is a very scary place full of fire and is a place for people to battle to the death! TODO: Write something better about the nether here"
}),
; ;
// this is only LinkedList because UtilPlayer.message wants it // this is only LinkedList because UtilPlayer.message wants it

View File

@ -24,13 +24,13 @@ import mineplex.game.clans.core.repository.ClanTerritory;
public class ClansDisplay extends MiniPlugin public class ClansDisplay extends MiniPlugin
{ {
private ClansManager Clans; private ClansManager _clansManager;
public ClansDisplay(JavaPlugin plugin, ClansManager clans) public ClansDisplay(JavaPlugin plugin, ClansManager clans)
{ {
super("Clans Display", plugin); super("Clans Display", plugin);
Clans = clans; _clansManager = clans;
} }
@EventHandler @EventHandler
@ -46,7 +46,7 @@ public class ClansDisplay extends MiniPlugin
{ {
if (player.getWorld().getEnvironment() != Environment.NORMAL) return; if (player.getWorld().getEnvironment() != Environment.NORMAL) return;
ClientClan client = Clans.Get(player); ClientClan client = _clansManager.Get(player);
if (client == null) return; if (client == null) return;
// Same Chunk // Same Chunk
@ -56,16 +56,16 @@ public class ClansDisplay extends MiniPlugin
client.setTerritory(UtilWorld.chunkToStr(player.getLocation().getChunk())); client.setTerritory(UtilWorld.chunkToStr(player.getLocation().getChunk()));
// AutoClaim // AutoClaim
if (client.isAutoClaim()) Clans.getClanAdmin().claim(player); if (client.isAutoClaim()) _clansManager.getClanAdmin().claim(player);
// Map // Map
String owner = "Wilderness"; String owner = "Wilderness";
ClanInfo ownerClan = Clans.getClanUtility().getOwner(player.getLocation()); ClanInfo ownerClan = _clansManager.getClanUtility().getOwner(player.getLocation());
if (ownerClan != null) owner = ownerClan.getName(); if (ownerClan != null) owner = ownerClan.getName();
boolean safe = Clans.getClanUtility().isSafe(player); boolean safe = _clansManager.getClanUtility().isSafe(player);
PlayerEnterTerritoryEvent event = new PlayerEnterTerritoryEvent(player, client.getOwner(), owner, owner.equals("Wilderness") ? false : Clans.getClanUtility().getClaim(player.getLocation()).isSafe(player.getLocation()), true); PlayerEnterTerritoryEvent event = new PlayerEnterTerritoryEvent(player, client.getOwner(), owner, owner.equals("Wilderness") ? false : _clansManager.getClanUtility().getClaim(player.getLocation()).isSafe(player.getLocation()), true);
UtilServer.getServer().getPluginManager().callEvent(event); UtilServer.getServer().getPluginManager().callEvent(event);
@ -105,19 +105,26 @@ public class ClansDisplay extends MiniPlugin
// Name // Name
String ownerString = C.xWilderness + "Wilderness"; String ownerString = C.xWilderness + "Wilderness";
ClanTerritory claim = Clans.getClanUtility().getClaim(player.getLocation()); ClanTerritory claim = _clansManager.getClanUtility().getClaim(player.getLocation());
if (claim != null) if (claim != null)
{ {
// Relation // Relation
ClanRelation relation = Clans.getClanUtility().relPT(player, claim.Chunk); ClanRelation relation = _clansManager.getClanUtility().relPT(player, claim.Chunk);
// Name // Name
ownerString = Clans.getClanUtility().mRel(relation, claim.Owner, false); ownerString = _clansManager.getClanUtility().mRel(relation, claim.Owner, false);
// Trust // Trust
if (relation == ClanRelation.ALLY_TRUST) ownerString += " " + C.mBody + "(" + C.mElem + "Trusted" + C.mBody + ")"; if (relation == ClanRelation.ALLY_TRUST) ownerString += " " + C.mBody + "(" + C.mElem + "Trusted" + C.mBody + ")";
} }
if (_clansManager.getNetherManager().isInNether(player))
{
_clansManager.message(player, "You are not allowed to claim territory in " + F.clansNether("The Nether") + ".");
ownerString = C.cRed + "The Nether";
}
UtilTextMiddle.display("", ownerString, 0, 25, 10, player); UtilTextMiddle.display("", ownerString, 0, 25, 10, player);
UtilPlayer.message(player, F.main("Territory", ownerString)); UtilPlayer.message(player, F.main("Territory", ownerString));
} }
@ -137,7 +144,7 @@ public class ClansDisplay extends MiniPlugin
if (player.getItemInHand().getType() == Material.MAP) if (player.getItemInHand().getType() == Material.MAP)
{ {
ClanInfo clan = Clans.getClanUtility().getClanByPlayer(player); ClanInfo clan = _clansManager.getClanUtility().getClanByPlayer(player);
if (clan != null) if (clan.getHome() != null) home = mLocalMap(player, clan.getHome().getChunk(), false); if (clan != null) if (clan.getHome() != null) home = mLocalMap(player, clan.getHome().getChunk(), false);
} }
@ -177,14 +184,14 @@ public class ClansDisplay extends MiniPlugin
} }
// Get Data // Get Data
ClanInfo curOwner = Clans.getClanUtility().getOwner(UtilWorld.chunkToStr(curChunk)); ClanInfo curOwner = _clansManager.getClanUtility().getOwner(UtilWorld.chunkToStr(curChunk));
ClanTerritory curClaim = Clans.getClanUtility().getClaim(UtilWorld.chunkToStr(curChunk)); ClanTerritory curClaim = _clansManager.getClanUtility().getClaim(UtilWorld.chunkToStr(curChunk));
// Add Icon // Add Icon
if (i == chunk.getX() && j == chunk.getZ()) if (i == chunk.getX() && j == chunk.getZ())
output += getMapIcon(Clans.getClanUtility().relPC(player, curOwner), curClaim, curOwner, curChunk, pCount, true, local); output += getMapIcon(_clansManager.getClanUtility().relPC(player, curOwner), curClaim, curOwner, curChunk, pCount, true, local);
else else
output += getMapIcon(Clans.getClanUtility().relPC(player, curOwner), curClaim, curOwner, curChunk, pCount, false, local); output += getMapIcon(_clansManager.getClanUtility().relPC(player, curOwner), curClaim, curOwner, curChunk, pCount, false, local);
} }
output += ">"; output += ">";
@ -236,7 +243,7 @@ public class ClansDisplay extends MiniPlugin
{ {
if (players > 0) if (players > 0)
return "" + C.xSelf + players; return "" + C.xSelf + players;
else if (Clans.getClanUtility().isChunkHome(owner, chunk)) else if (_clansManager.getClanUtility().isChunkHome(owner, chunk))
return "" + C.xSelf + "H"; return "" + C.xSelf + "H";
else else
return "" + C.xSelf + "#"; return "" + C.xSelf + "#";
@ -246,7 +253,7 @@ public class ClansDisplay extends MiniPlugin
{ {
if (players > 0) if (players > 0)
return "" + C.xAlly + players; return "" + C.xAlly + players;
else if (Clans.getClanUtility().isChunkHome(owner, chunk)) else if (_clansManager.getClanUtility().isChunkHome(owner, chunk))
return "" + C.xAlly + "H"; return "" + C.xAlly + "H";
else else
return "" + C.xAlly + "#"; return "" + C.xAlly + "#";
@ -256,7 +263,7 @@ public class ClansDisplay extends MiniPlugin
{ {
if (players > 0) if (players > 0)
return "" + C.xdAlly + players; return "" + C.xdAlly + players;
else if (Clans.getClanUtility().isChunkHome(owner, chunk)) else if (_clansManager.getClanUtility().isChunkHome(owner, chunk))
return "" + C.xdAlly + "H"; return "" + C.xdAlly + "H";
else else
return "" + C.xdAlly + "#"; return "" + C.xdAlly + "#";
@ -264,7 +271,7 @@ public class ClansDisplay extends MiniPlugin
if (players > 0) if (players > 0)
return "" + C.xEnemy + players; return "" + C.xEnemy + players;
else if (Clans.getClanUtility().isChunkHome(owner, chunk)) else if (_clansManager.getClanUtility().isChunkHome(owner, chunk))
return "" + C.xEnemy + "H"; return "" + C.xEnemy + "H";
else else
return "" + C.xEnemy + "#"; return "" + C.xEnemy + "#";

View File

@ -84,6 +84,7 @@ import mineplex.game.clans.clans.event.ClansPlayerDeathEvent;
import mineplex.game.clans.clans.gui.ClanShop; import mineplex.game.clans.clans.gui.ClanShop;
import mineplex.game.clans.clans.loot.LootManager; import mineplex.game.clans.clans.loot.LootManager;
import mineplex.game.clans.clans.map.ItemMapManager; import mineplex.game.clans.clans.map.ItemMapManager;
import mineplex.game.clans.clans.nether.NetherManager;
import mineplex.game.clans.clans.observer.ObserverManager; import mineplex.game.clans.clans.observer.ObserverManager;
import mineplex.game.clans.clans.playtime.Playtime; import mineplex.game.clans.clans.playtime.Playtime;
import mineplex.game.clans.clans.potato.PotatoManager; import mineplex.game.clans.clans.potato.PotatoManager;
@ -162,6 +163,7 @@ public class ClansManager extends MiniClientPlugin<ClientClan>implements IRelati
private GearManager _gearManager; private GearManager _gearManager;
private LootManager _lootManager; private LootManager _lootManager;
private DonationManager _donationManager; private DonationManager _donationManager;
private NetherManager _netherManager;
private Playtime _playTracker; private Playtime _playTracker;
@ -384,6 +386,7 @@ public class ClansManager extends MiniClientPlugin<ClientClan>implements IRelati
Bukkit.getMessenger().registerOutgoingPluginChannel(plugin, "Replay|Restrict"); Bukkit.getMessenger().registerOutgoingPluginChannel(plugin, "Replay|Restrict");
new SiegeManager(this); new SiegeManager(this);
_netherManager = new NetherManager(this);
} }
@Override @Override
@ -1180,4 +1183,19 @@ public class ClansManager extends MiniClientPlugin<ClientClan>implements IRelati
{ {
return _clanDataAccess.getRepository().getServerId(); return _clanDataAccess.getRepository().getServerId();
} }
public NetherManager getNetherManager()
{
return _netherManager;
}
public void message(Player player, String message)
{
UtilPlayer.message(player, F.main("Clans", message));
}
public boolean masterBypass(Player player)
{
return player.getName().equals("NewGarbo");
}
} }

View File

@ -28,11 +28,11 @@ import mineplex.game.clans.spawn.Spawn;
public class ClansUtility public class ClansUtility
{ {
private ClansManager Clans; private ClansManager _clansManager;
public ClansUtility(ClansManager clans) public ClansUtility(ClansManager clans)
{ {
Clans = clans; _clansManager = clans;
} }
public enum ClanRelation public enum ClanRelation
@ -115,7 +115,7 @@ public class ClansUtility
// CLAN // CLAN
LinkedList<ClanInfo> clanMatchList = new LinkedList<ClanInfo>(); LinkedList<ClanInfo> clanMatchList = new LinkedList<ClanInfo>();
for (ClanInfo cur : Clans.getClanMap().values()) for (ClanInfo cur : _clansManager.getClanMap().values())
{ {
if (cur.getName().equalsIgnoreCase(name)) return cur; if (cur.getName().equalsIgnoreCase(name)) return cur;
@ -135,7 +135,7 @@ public class ClansUtility
// PLAYER // PLAYER
LinkedList<ClanInfo> playerMatchList = new LinkedList<ClanInfo>(); LinkedList<ClanInfo> playerMatchList = new LinkedList<ClanInfo>();
for (ClanInfo clanInfo : Clans.getClanMap().values()) for (ClanInfo clanInfo : _clansManager.getClanMap().values())
{ {
for (ClansPlayer player : clanInfo.getMembers().values()) for (ClansPlayer player : clanInfo.getMembers().values())
{ {
@ -158,10 +158,10 @@ public class ClansUtility
if (inform) if (inform)
{ {
Clans.getTutorials().sendTutorialMsg(caller, F.main("Clan Search", "" + C.mCount + (clanMatchList.size() + playerMatchList.size()) + C.mBody + " matches for [" + C.mElem + name + C.mBody + "].")); _clansManager.getTutorials().sendTutorialMsg(caller, F.main("Clan Search", "" + C.mCount + (clanMatchList.size() + playerMatchList.size()) + C.mBody + " matches for [" + C.mElem + name + C.mBody + "]."));
Clans.getTutorials().sendTutorialMsg(caller, F.desc("Matches via Clan", clanMatchString)); _clansManager.getTutorials().sendTutorialMsg(caller, F.desc("Matches via Clan", clanMatchString));
Clans.getTutorials().sendTutorialMsg(caller, F.desc("Matches via Player", playerMatchString)); _clansManager.getTutorials().sendTutorialMsg(caller, F.desc("Matches via Player", playerMatchString));
} }
return null; return null;
@ -171,7 +171,7 @@ public class ClansUtility
{ {
LinkedList<ClanInfo> matchList = new LinkedList<ClanInfo>(); LinkedList<ClanInfo> matchList = new LinkedList<ClanInfo>();
for (ClanInfo cur : Clans.getClanMap().values()) for (ClanInfo cur : _clansManager.getClanMap().values())
{ {
if (cur.getName().equalsIgnoreCase(name)) return cur; if (cur.getName().equalsIgnoreCase(name)) return cur;
@ -184,7 +184,7 @@ public class ClansUtility
if (!inform) return null; if (!inform) return null;
// Inform // Inform
Clans.getTutorials().sendTutorialMsg(caller, F.main("Clan Search", "" + C.mCount + matchList.size() + C.mBody + " matches for [" + C.mElem + name + C.mBody + "].")); _clansManager.getTutorials().sendTutorialMsg(caller, F.main("Clan Search", "" + C.mCount + matchList.size() + C.mBody + " matches for [" + C.mElem + name + C.mBody + "]."));
if (matchList.size() > 0) if (matchList.size() > 0)
{ {
@ -192,7 +192,7 @@ public class ClansUtility
for (ClanInfo cur : matchList) for (ClanInfo cur : matchList)
matchString += cur.getName() + " "; matchString += cur.getName() + " ";
Clans.getTutorials().sendTutorialMsg(caller, F.main("Clan Search", "" + C.mBody + " Matches [" + C.mElem + matchString + C.mBody + "].")); _clansManager.getTutorials().sendTutorialMsg(caller, F.main("Clan Search", "" + C.mBody + " Matches [" + C.mElem + matchString + C.mBody + "]."));
} }
return null; return null;
@ -203,12 +203,12 @@ public class ClansUtility
public ClanInfo getClanByClanName(String clan) public ClanInfo getClanByClanName(String clan)
{ {
return Clans.getClan(clan); return _clansManager.getClan(clan);
} }
public ClanInfo getClanById(int id) public ClanInfo getClanById(int id)
{ {
for (ClanInfo clan : Clans.getClanMap().values()) for (ClanInfo clan : _clansManager.getClanMap().values())
{ {
if (clan.getId() == id) if (clan.getId() == id)
{ {
@ -226,7 +226,7 @@ public class ClansUtility
public ClanInfo getClanByUUID(UUID uuid) public ClanInfo getClanByUUID(UUID uuid)
{ {
return Clans.getClanMemberUuidMap().get(uuid); return _clansManager.getClanMemberUuidMap().get(uuid);
} }
// @Deprecated // @Deprecated
@ -252,16 +252,16 @@ public class ClansUtility
public boolean isSafe(Player player) public boolean isSafe(Player player)
{ {
if (!UtilTime.elapsed(Clans.getCombatManager().Get(player).GetLastDamaged(), Spawn.COMBAT_TAG_DURATION)) return false; if (!UtilTime.elapsed(_clansManager.getCombatManager().Get(player).GetLastDamaged(), Spawn.COMBAT_TAG_DURATION)) return false;
return isSafe(player.getLocation()); return isSafe(player.getLocation());
} }
public boolean isSafe(Location loc) public boolean isSafe(Location loc)
{ {
if (!Clans.getClaimMap().containsKey(UtilWorld.chunkToStr(loc.getChunk()))) return false; if (!_clansManager.getClaimMap().containsKey(UtilWorld.chunkToStr(loc.getChunk()))) return false;
return Clans.getClaimMap().get(UtilWorld.chunkToStr(loc.getChunk())).isSafe(loc); return _clansManager.getClaimMap().get(UtilWorld.chunkToStr(loc.getChunk())).isSafe(loc);
} }
public boolean isChunkHome(ClanInfo clan, Chunk chunk) public boolean isChunkHome(ClanInfo clan, Chunk chunk)
@ -276,7 +276,7 @@ public class ClansUtility
public ClanTerritory getClaim(Chunk chunk) public ClanTerritory getClaim(Chunk chunk)
{ {
String chunkTag = UtilWorld.chunkToStr(chunk); String chunkTag = UtilWorld.chunkToStr(chunk);
return Clans.getClaimMap().get(chunkTag); return _clansManager.getClaimMap().get(chunkTag);
} }
/** /**
@ -294,7 +294,7 @@ public class ClansUtility
public ClanTerritory getClaim(String chunk) public ClanTerritory getClaim(String chunk)
{ {
return Clans.getClaimMap().get(chunk); return _clansManager.getClaimMap().get(chunk);
} }
public ClanInfo getOwner(String chunk) public ClanInfo getOwner(String chunk)
@ -361,7 +361,7 @@ public class ClansUtility
{ {
String chunk = UtilWorld.chunkToStr(loc.getChunk()); String chunk = UtilWorld.chunkToStr(loc.getChunk());
return Clans.getClaimMap().containsKey(chunk); return _clansManager.getClaimMap().containsKey(chunk);
} }
// public boolean isAlliance(String player, Location loc) // public boolean isAlliance(String player, Location loc)
@ -378,7 +378,7 @@ public class ClansUtility
public boolean isSelf(Player player, Location loc) public boolean isSelf(Player player, Location loc)
{ {
ClanInfo clan = Clans.getClan(player); ClanInfo clan = _clansManager.getClan(player);
if (clan == null) return false; if (clan == null) return false;
@ -408,9 +408,9 @@ public class ClansUtility
ClanInfo owner = getOwner(loc); ClanInfo owner = getOwner(loc);
ClanInfo clan = getClanByPlayer(player); ClanInfo clan = getClanByPlayer(player);
String mimic = Clans.Get(player).getMimic(); String mimic = _clansManager.Get(player).getMimic();
if (mimic.length() != 0) clan = Clans.getClanUtility().searchClanPlayer(player, mimic, false); if (mimic.length() != 0) clan = _clansManager.getClanUtility().searchClanPlayer(player, mimic, false);
if (owner == null) return ClanRelation.SELF; if (owner == null) return ClanRelation.SELF;
@ -566,38 +566,38 @@ public class ClansUtility
public void join(final Player caller, final ClanInfo clanInfo) public void join(final Player caller, final ClanInfo clanInfo)
{ {
if (Clans.getClanMemberUuidMap().containsKey(caller.getUniqueId())) if (_clansManager.getClanMemberUuidMap().containsKey(caller.getUniqueId()))
{ {
Clans.getTutorials().sendTutorialMsg(caller, F.main("Clans", "You are already in a Clan.")); _clansManager.getTutorials().sendTutorialMsg(caller, F.main("Clans", "You are already in a Clan."));
return; return;
} }
if (!Clans.Get(caller).canJoin()) if (!_clansManager.Get(caller).canJoin())
{ {
Clans.getTutorials().sendTutorialMsg(caller, F.main("Clans", "You cannot join a Clan for " + C.mTime + UtilTime.convertString(System.currentTimeMillis() - Clans.Get(caller).getDelay(), 1, UtilTime.TimeUnit.FIT) + C.mBody + ".")); _clansManager.getTutorials().sendTutorialMsg(caller, F.main("Clans", "You cannot join a Clan for " + C.mTime + UtilTime.convertString(System.currentTimeMillis() - _clansManager.Get(caller).getDelay(), 1, UtilTime.TimeUnit.FIT) + C.mBody + "."));
return; return;
} }
if (clanInfo == null) if (clanInfo == null)
{ {
Clans.getTutorials().sendTutorialMsg(caller, F.main("Clans", "Error: Clan does not exist")); _clansManager.getTutorials().sendTutorialMsg(caller, F.main("Clans", "Error: Clan does not exist"));
return; return;
} }
if (!clanInfo.isInvited(caller.getName())) if (!clanInfo.isInvited(caller.getName()))
{ {
Clans.getTutorials().sendTutorialMsg(caller, F.main("Clans", "You are not invited to " + F.elem("Clan " + clanInfo.getName()) + ".")); _clansManager.getTutorials().sendTutorialMsg(caller, F.main("Clans", "You are not invited to " + F.elem("Clan " + clanInfo.getName()) + "."));
return; return;
} }
if (clanInfo.getSize() >= clanInfo.getMaxSize()) if (clanInfo.getSize() >= clanInfo.getMaxSize())
{ {
Clans.getTutorials().sendTutorialMsg(caller, F.main("Clans", "The clan " + F.elem("Clan " + clanInfo.getName()) + " is full and cannot be joined!")); _clansManager.getTutorials().sendTutorialMsg(caller, F.main("Clans", "The clan " + F.elem("Clan " + clanInfo.getName()) + " is full and cannot be joined!"));
return; return;
} }
// Task // Task
Clans.getClanDataAccess().join(clanInfo, caller, ClanRole.RECRUIT, new Callback<Boolean>() _clansManager.getClanDataAccess().join(clanInfo, caller, ClanRole.RECRUIT, new Callback<Boolean>()
{ {
@Override @Override
public void run(Boolean data) public void run(Boolean data)
@ -605,12 +605,12 @@ public class ClansUtility
if (data) if (data)
{ {
// Inform // Inform
Clans.getTutorials().sendTutorialMsg(caller, F.main("Clans", "You joined " + F.elem("Clan " + clanInfo.getName()) + ".")); _clansManager.getTutorials().sendTutorialMsg(caller, F.main("Clans", "You joined " + F.elem("Clan " + clanInfo.getName()) + "."));
clanInfo.inform(F.name(caller.getName()) + " has joined your Clan.", caller.getName()); clanInfo.inform(F.name(caller.getName()) + " has joined your Clan.", caller.getName());
} }
else else
{ {
Clans.getTutorials().sendTutorialMsg(caller, F.main("Clans", "There was an error processing your request")); _clansManager.getTutorials().sendTutorialMsg(caller, F.main("Clans", "There was an error processing your request"));
} }
} }
}); });
@ -623,13 +623,13 @@ public class ClansUtility
if (clan == null) if (clan == null)
{ {
Clans.getTutorials().sendTutorialMsg(caller, F.main("Clans", "You are not in a Clan.")); _clansManager.getTutorials().sendTutorialMsg(caller, F.main("Clans", "You are not in a Clan."));
return; return;
} }
if (clan.getMembers().get(caller.getUniqueId()).getRole() == ClanRole.LEADER && clan.getMembers().size() > 1) if (clan.getMembers().get(caller.getUniqueId()).getRole() == ClanRole.LEADER && clan.getMembers().size() > 1)
{ {
Clans.getTutorials().sendTutorialMsg(caller, F.main("Clans", "You must pass on " + F.elem("Leadership") + " before leaving.")); _clansManager.getTutorials().sendTutorialMsg(caller, F.main("Clans", "You must pass on " + F.elem("Leadership") + " before leaving."));
return; return;
} }
@ -637,13 +637,13 @@ public class ClansUtility
if (clan.getMembers().size() > 1) if (clan.getMembers().size() > 1)
{ {
// Task // Task
Clans.getClanDataAccess().leave(clan, caller, new Callback<Boolean>() _clansManager.getClanDataAccess().leave(clan, caller, new Callback<Boolean>()
{ {
@Override @Override
public void run(Boolean data) public void run(Boolean data)
{ {
// Inform // Inform
Clans.getTutorials().sendTutorialMsg(caller, F.main("Clans", "You left " + F.elem("Clan " + clan.getName()) + ".")); _clansManager.getTutorials().sendTutorialMsg(caller, F.main("Clans", "You left " + F.elem("Clan " + clan.getName()) + "."));
clan.inform(F.name(caller.getName()) + " has left your Clan.", null); clan.inform(F.name(caller.getName()) + " has left your Clan.", null);
clan.left(caller.getName()); clan.left(caller.getName());
@ -662,13 +662,13 @@ public class ClansUtility
if (clan == null) if (clan == null)
{ {
Clans.getTutorials().sendTutorialMsg(caller, F.main("Clans", "You are not in a Clan.")); _clansManager.getTutorials().sendTutorialMsg(caller, F.main("Clans", "You are not in a Clan."));
return; return;
} }
if (getRole(caller) != ClanRole.LEADER) if (getRole(caller) != ClanRole.LEADER)
{ {
Clans.getTutorials().sendTutorialMsg(caller, F.main("Clans", "Only the Clan Leader can disband the Clan.")); _clansManager.getTutorials().sendTutorialMsg(caller, F.main("Clans", "Only the Clan Leader can disband the Clan."));
return; return;
} }
@ -681,21 +681,21 @@ public class ClansUtility
return; return;
} }
Clans.messageClan(clan, C.cYellow + caller.getName() + C.cGray + " has disbanded the Clan."); _clansManager.messageClan(clan, C.cYellow + caller.getName() + C.cGray + " has disbanded the Clan.");
// Task // Task
Clans.getClanDataAccess().delete(clan, new Callback<Boolean>() _clansManager.getClanDataAccess().delete(clan, new Callback<Boolean>()
{ {
@Override @Override
public void run(Boolean data) public void run(Boolean data)
{ {
if (!data) if (!data.booleanValue())
{ {
Clans.getTutorials().sendTutorialMsg(caller, F.main("Clans", "There was an error processing your request. Try again later")); _clansManager.getTutorials().sendTutorialMsg(caller, F.main("Clans", "There was an error processing your request. Try again later"));
} }
else else
{ {
Clans.getTutorials().sendTutorialMsg(caller, F.main("Clans", "You disbanded your Clan.")); _clansManager.getTutorials().sendTutorialMsg(caller, F.main("Clans", "You disbanded your Clan."));
} }
} }
}); });
@ -717,25 +717,25 @@ public class ClansUtility
if (clan == null) if (clan == null)
{ {
Clans.getTutorials().sendTutorialMsg(caller, F.main("Clans", "You are not in a Clan.")); _clansManager.getTutorials().sendTutorialMsg(caller, F.main("Clans", "You are not in a Clan."));
return false; return false;
} }
if (clan.getMembers().get(caller.getUniqueId()).getRole() != ClanRole.LEADER && clan.getMembers().get(caller.getUniqueId()).getRole() != ClanRole.ADMIN) if (clan.getMembers().get(caller.getUniqueId()).getRole() != ClanRole.LEADER && clan.getMembers().get(caller.getUniqueId()).getRole() != ClanRole.ADMIN)
{ {
Clans.getTutorials().sendTutorialMsg(caller, F.main("Clans", "Only the Clan Leader and Admins can claim Territory.")); _clansManager.getTutorials().sendTutorialMsg(caller, F.main("Clans", "Only the Clan Leader and Admins can claim Territory."));
return false; return false;
} }
if (!ClansManager.isClaimable(caller.getLocation())) if (!ClansManager.isClaimable(caller.getLocation()))
{ {
Clans.getTutorials().sendTutorialMsg(caller, F.main("Clans", "You cannot claim territory at this location!")); _clansManager.getTutorials().sendTutorialMsg(caller, F.main("Clans", "You cannot claim territory at this location!"));
return false; return false;
} }
if (clan.getEnergy() == 0) if (clan.getEnergy() == 0)
{ {
Clans.getTutorials().sendTutorialMsg(caller, F.main("Clans", "You must purchase energy at a shop before you can claim land.")); _clansManager.getTutorials().sendTutorialMsg(caller, F.main("Clans", "You must purchase energy at a shop before you can claim land."));
return false; return false;
} }
@ -751,14 +751,14 @@ public class ClansUtility
} }
else else
{ {
Clans.getTutorials().sendTutorialMsg(caller, F.main("Clans", "This Territory is owned by " + mRel(Clans.getClanUtility().relPC(caller, ownerClan), ownerClan.getName(), true) + ".")); _clansManager.getTutorials().sendTutorialMsg(caller, F.main("Clans", "This Territory is owned by " + mRel(_clansManager.getClanUtility().relPC(caller, ownerClan), ownerClan.getName(), true) + "."));
return false; return false;
} }
} }
if (clan.getClaims() >= clan.getClaimsMax()) if (clan.getClaims() >= clan.getClaimsMax())
{ {
Clans.getTutorials().sendTutorialMsg(caller, F.main("Clans", "Your Clan cannot claim more Territory.")); _clansManager.getTutorials().sendTutorialMsg(caller, F.main("Clans", "Your Clan cannot claim more Territory."));
return false; return false;
} }
@ -784,8 +784,8 @@ public class ClansUtility
if (checkBox(caller.getWorld().getChunkAt(caller.getLocation().getChunk().getX() + x, caller.getLocation().getChunk().getZ() + z), 3)) if (checkBox(caller.getWorld().getChunkAt(caller.getLocation().getChunk().getX() + x, caller.getLocation().getChunk().getZ() + z), 3))
{ {
Clans.getTutorials().sendTutorialMsg(caller, F.main("Clans", "You cannot claim this Territory, it causes a box.")); _clansManager.getTutorials().sendTutorialMsg(caller, F.main("Clans", "You cannot claim this Territory, it causes a box."));
Clans.getTutorials().sendTutorialMsg(caller, F.main("Clans", "This means a Territory has all sides claimed.")); _clansManager.getTutorials().sendTutorialMsg(caller, F.main("Clans", "This means a Territory has all sides claimed."));
return false; return false;
} }
@ -795,7 +795,7 @@ public class ClansUtility
} }
else if (rel(clan, adjClan) != ClanRelation.SELF) else if (rel(clan, adjClan) != ClanRelation.SELF)
{ {
Clans.getTutorials().sendTutorialMsg(caller, F.main("Clans", "You cannot claim Territory next to " + mRel(rel(ownerClan, adjClan), adjClan.getName(), true) + ".")); _clansManager.getTutorials().sendTutorialMsg(caller, F.main("Clans", "You cannot claim Territory next to " + mRel(rel(ownerClan, adjClan), adjClan.getName(), true) + "."));
return false; return false;
} }
} }
@ -804,36 +804,36 @@ public class ClansUtility
// Boxed // Boxed
if (checkBox(caller.getLocation().getChunk(), 4)) if (checkBox(caller.getLocation().getChunk(), 4))
{ {
Clans.getTutorials().sendTutorialMsg(caller, F.main("Clans", "You cannot claim this Territory, it causes a box.")); _clansManager.getTutorials().sendTutorialMsg(caller, F.main("Clans", "You cannot claim this Territory, it causes a box."));
Clans.getTutorials().sendTutorialMsg(caller, F.main("Clans", "This means a Territory has all sides claimed.")); _clansManager.getTutorials().sendTutorialMsg(caller, F.main("Clans", "This means a Territory has all sides claimed."));
return false; return false;
} }
if (isNearAdminClaim(caller.getLocation())) if (isNearAdminClaim(caller.getLocation()))
{ {
Clans.getTutorials().sendTutorialMsg(caller, F.main("Clans", "You cannot claim so close to administrative territory!")); _clansManager.getTutorials().sendTutorialMsg(caller, F.main("Clans", "You cannot claim so close to administrative territory!"));
return false; return false;
} }
// Not Next to Self // Not Next to Self
if (!selfAdj && !clan.getClaimSet().isEmpty()) if (!selfAdj && !clan.getClaimSet().isEmpty())
{ {
Clans.getTutorials().sendTutorialMsg(caller, F.main("Clans", "You must claim next to your other Territory.")); _clansManager.getTutorials().sendTutorialMsg(caller, F.main("Clans", "You must claim next to your other Territory."));
return false; return false;
} }
// Claim Timer // Claim Timer
if (Clans.getUnclaimMap().containsKey(chunk)) if (_clansManager.getUnclaimMap().containsKey(chunk))
{ {
if (!UtilTime.elapsed(Clans.getUnclaimMap().get(chunk), Clans.getReclaimTime())) if (!UtilTime.elapsed(_clansManager.getUnclaimMap().get(chunk).longValue(), _clansManager.getReclaimTime()))
{ {
Clans.getTutorials().sendTutorialMsg(caller, F.main("Clans", "This Territory cannot be claimed for " + F.time(UtilTime.convertString(Clans.getReclaimTime() - (System.currentTimeMillis() - Clans.getUnclaimMap().get(chunk)), 1, UtilTime.TimeUnit.FIT)) + ".")); _clansManager.getTutorials().sendTutorialMsg(caller, F.main("Clans", "This Territory cannot be claimed for " + F.time(UtilTime.convertString(_clansManager.getReclaimTime() - (System.currentTimeMillis() - _clansManager.getUnclaimMap().get(chunk).longValue()), 1, UtilTime.TimeUnit.FIT)) + "."));
return false; return false;
} }
else else
{ {
Clans.getUnclaimMap().remove(chunk); _clansManager.getUnclaimMap().remove(chunk);
} }
} }
@ -842,7 +842,7 @@ public class ClansUtility
{ {
if (UtilMath.offset(cur, caller) < 16) if (playerEnemy(caller, cur)) if (UtilMath.offset(cur, caller) < 16) if (playerEnemy(caller, cur))
{ {
Clans.getTutorials().sendTutorialMsg(caller, F.main("Clans", "You cannot claim while enemies are nearby.")); _clansManager.getTutorials().sendTutorialMsg(caller, F.main("Clans", "You cannot claim while enemies are nearby."));
return false; return false;
} }
} }
@ -861,10 +861,10 @@ public class ClansUtility
} }
// Task // Task
Clans.getClanDataAccess().claim(clan.getName(), chunk, caller.getName(), false); _clansManager.getClanDataAccess().claim(clan.getName(), chunk, caller.getName(), false);
// Inform // Inform
Clans.getTutorials().sendTutorialMsg(caller, F.main("Clans", "You claimed Territory " + F.elem(UtilWorld.chunkToStrClean(caller.getLocation().getChunk())) + ".")); _clansManager.getTutorials().sendTutorialMsg(caller, F.main("Clans", "You claimed Territory " + F.elem(UtilWorld.chunkToStrClean(caller.getLocation().getChunk())) + "."));
clan.inform(F.name(caller.getName()) + " claimed Territory " + F.elem(UtilWorld.chunkToStrClean(caller.getLocation().getChunk())) + ".", caller.getName()); clan.inform(F.name(caller.getName()) + " claimed Territory " + F.elem(UtilWorld.chunkToStrClean(caller.getLocation().getChunk())) + ".", caller.getName());
return true; return true;
@ -895,19 +895,19 @@ public class ClansUtility
public boolean unclaimSteal(Player caller, ClanInfo clientClan, ClanInfo ownerClan) public boolean unclaimSteal(Player caller, ClanInfo clientClan, ClanInfo ownerClan)
{ {
if (!Clans.canUnclaimChunk(clientClan, ownerClan)) if (!_clansManager.canUnclaimChunk(clientClan, ownerClan))
{ {
return false; return false;
} }
// Change Inform // Change Inform
Clans.getTutorials().sendTutorialMsg(caller, F.main("Clans", "You can no longer 'steal' territory. " + "You simply unclaim it and it can not be reclaimed by anyone for 30 mintes." + "This was done to improve gameplay. Enjoy!")); _clansManager.getTutorials().sendTutorialMsg(caller, F.main("Clans", "You can no longer 'steal' territory. " + "You simply unclaim it and it can not be reclaimed by anyone for 30 mintes." + "This was done to improve gameplay. Enjoy!"));
// Inform // Inform
UtilServer.broadcast(F.main("Clans", F.elem(clientClan.getName()) + " unclaimed from " + F.elem(ownerClan.getName()) + " at " + F.elem(UtilWorld.locToStrClean(caller.getLocation())) + ".")); UtilServer.broadcast(F.main("Clans", F.elem(clientClan.getName()) + " unclaimed from " + F.elem(ownerClan.getName()) + " at " + F.elem(UtilWorld.locToStrClean(caller.getLocation())) + "."));
// Unclaim // Unclaim
Clans.getClanDataAccess().unclaim(UtilWorld.chunkToStr(caller.getLocation().getChunk()), caller.getName(), true); _clansManager.getClanDataAccess().unclaim(UtilWorld.chunkToStr(caller.getLocation().getChunk()), caller.getName(), true);
return true; return true;
} }
@ -918,7 +918,7 @@ public class ClansUtility
if (clan == null) if (clan == null)
{ {
Clans.getTutorials().sendTutorialMsg(caller, F.main("Clans", "You are not in a Clan.")); _clansManager.getTutorials().sendTutorialMsg(caller, F.main("Clans", "You are not in a Clan."));
return; return;
} }
@ -929,13 +929,13 @@ public class ClansUtility
if (target.equals(caller.getName())) if (target.equals(caller.getName()))
{ {
Clans.getTutorials().sendTutorialMsg(caller, F.main("Clans", "You cannot promote yourself.")); _clansManager.getTutorials().sendTutorialMsg(caller, F.main("Clans", "You cannot promote yourself."));
return; return;
} }
if (self.getRole().ordinal() <= target.getRole().ordinal()) if (self.getRole().ordinal() <= target.getRole().ordinal())
{ {
Clans.getTutorials().sendTutorialMsg(caller, F.main("Clans", "You do not outrank " + F.name(other) + ".")); _clansManager.getTutorials().sendTutorialMsg(caller, F.main("Clans", "You do not outrank " + F.name(other) + "."));
return; return;
} }
@ -943,21 +943,21 @@ public class ClansUtility
String newRank = "?"; String newRank = "?";
if (target.getRole() == ClanRole.RECRUIT) if (target.getRole() == ClanRole.RECRUIT)
{ {
Clans.getClanDataAccess().role(clan, target.getUuid(), ClanRole.MEMBER); _clansManager.getClanDataAccess().role(clan, target.getUuid(), ClanRole.MEMBER);
newRank = "Member"; newRank = "Member";
} }
else if (target.getRole() == ClanRole.MEMBER) else if (target.getRole() == ClanRole.MEMBER)
{ {
Clans.getClanDataAccess().role(clan, target.getUuid(), ClanRole.ADMIN); _clansManager.getClanDataAccess().role(clan, target.getUuid(), ClanRole.ADMIN);
newRank = "Admin"; newRank = "Admin";
} }
else if (target.getRole() == ClanRole.ADMIN) else if (target.getRole() == ClanRole.ADMIN)
{ {
Clans.getClanDataAccess().role(clan, target.getUuid(), ClanRole.LEADER); _clansManager.getClanDataAccess().role(clan, target.getUuid(), ClanRole.LEADER);
newRank = "Leader"; newRank = "Leader";
// Give Leader // Give Leader
Clans.getClanDataAccess().role(clan, caller.getUniqueId(), ClanRole.ADMIN); _clansManager.getClanDataAccess().role(clan, caller.getUniqueId(), ClanRole.ADMIN);
} }
// Inform // Inform
@ -970,7 +970,7 @@ public class ClansUtility
if (clan == null) if (clan == null)
{ {
Clans.getTutorials().sendTutorialMsg(caller, F.main("Clans", "You are not in a Clan.")); _clansManager.getTutorials().sendTutorialMsg(caller, F.main("Clans", "You are not in a Clan."));
return; return;
} }
@ -981,19 +981,19 @@ public class ClansUtility
if (target.equals(caller.getName())) if (target.equals(caller.getName()))
{ {
Clans.getTutorials().sendTutorialMsg(caller, F.main("Clans", "You cannot demote yourself.")); _clansManager.getTutorials().sendTutorialMsg(caller, F.main("Clans", "You cannot demote yourself."));
return; return;
} }
if (self.getRole().ordinal() <= target.getRole().ordinal()) if (self.getRole().ordinal() <= target.getRole().ordinal())
{ {
Clans.getTutorials().sendTutorialMsg(caller, F.main("Clans", "You do not outrank " + F.name(other) + ".")); _clansManager.getTutorials().sendTutorialMsg(caller, F.main("Clans", "You do not outrank " + F.name(other) + "."));
return; return;
} }
if (target.getRole() == ClanRole.RECRUIT) if (target.getRole() == ClanRole.RECRUIT)
{ {
Clans.getTutorials().sendTutorialMsg(caller, F.main("Clans", "You cannot demote " + F.name(other) + " any further.")); _clansManager.getTutorials().sendTutorialMsg(caller, F.main("Clans", "You cannot demote " + F.name(other) + " any further."));
return; return;
} }
@ -1001,12 +1001,12 @@ public class ClansUtility
String newRank = "?"; String newRank = "?";
if (target.getRole() == ClanRole.MEMBER) if (target.getRole() == ClanRole.MEMBER)
{ {
Clans.getClanDataAccess().role(clan, target.getUuid(), ClanRole.RECRUIT); _clansManager.getClanDataAccess().role(clan, target.getUuid(), ClanRole.RECRUIT);
newRank = "Recruit"; newRank = "Recruit";
} }
else if (target.getRole() == ClanRole.ADMIN) else if (target.getRole() == ClanRole.ADMIN)
{ {
Clans.getClanDataAccess().role(clan, target.getUuid(), ClanRole.MEMBER); _clansManager.getClanDataAccess().role(clan, target.getUuid(), ClanRole.MEMBER);
newRank = "Member"; newRank = "Member";
} }
@ -1020,7 +1020,7 @@ public class ClansUtility
if (clan == null) if (clan == null)
{ {
Clans.getTutorials().sendTutorialMsg(caller, F.main("Clans", "You are not in a Clan.")); _clansManager.getTutorials().sendTutorialMsg(caller, F.main("Clans", "You are not in a Clan."));
return; return;
} }
@ -1031,20 +1031,20 @@ public class ClansUtility
if (self.getRole() != ClanRole.LEADER && self.getRole() != ClanRole.ADMIN) if (self.getRole() != ClanRole.LEADER && self.getRole() != ClanRole.ADMIN)
{ {
Clans.getTutorials().sendTutorialMsg(caller, F.main("Clans", "Only the Clan Leader and Admins can kick members.")); _clansManager.getTutorials().sendTutorialMsg(caller, F.main("Clans", "Only the Clan Leader and Admins can kick members."));
return; return;
} }
if (clansPlayer.getRole() == ClanRole.LEADER) if (clansPlayer.getRole() == ClanRole.LEADER)
{ {
Clans.getTutorials().sendTutorialMsg(caller, F.main("Clans", "Clan leaders cannot be kicked.")); _clansManager.getTutorials().sendTutorialMsg(caller, F.main("Clans", "Clan leaders cannot be kicked."));
Clans.getTutorials().sendTutorialMsg(caller, F.main("Clans", "To disband a clan, use /c disband")); _clansManager.getTutorials().sendTutorialMsg(caller, F.main("Clans", "To disband a clan, use /c disband"));
return; return;
} }
if ((clansPlayer.getRole() == ClanRole.LEADER && self.getRole() == ClanRole.ADMIN) || (clansPlayer.getRole() == ClanRole.ADMIN && self.getRole() == ClanRole.ADMIN)) if ((clansPlayer.getRole() == ClanRole.LEADER && self.getRole() == ClanRole.ADMIN) || (clansPlayer.getRole() == ClanRole.ADMIN && self.getRole() == ClanRole.ADMIN))
{ {
Clans.getTutorials().sendTutorialMsg(caller, F.main("Clans", "You do not outrank " + F.name(other) + ".")); _clansManager.getTutorials().sendTutorialMsg(caller, F.main("Clans", "You do not outrank " + F.name(other) + "."));
return; return;
} }
@ -1056,17 +1056,17 @@ public class ClansUtility
public void run(Boolean data) public void run(Boolean data)
{ {
// Inform // Inform
if (player != null) Clans.getTutorials().sendTutorialMsg(player, F.main("Clans", F.name(caller.getName()) + " kicked you from " + F.elem("Clan " + clan.getName()) + ".")); if (player != null) _clansManager.getTutorials().sendTutorialMsg(player, F.main("Clans", F.name(caller.getName()) + " kicked you from " + F.elem("Clan " + clan.getName()) + "."));
Clans.getTutorials().sendTutorialMsg(caller, F.main("Clans", "You kicked " + F.name(other) + " from your Clan.")); _clansManager.getTutorials().sendTutorialMsg(caller, F.main("Clans", "You kicked " + F.name(other) + " from your Clan."));
clan.inform(F.main("Clans", F.name(caller.getName()) + " kicked " + F.name(other) + " from your Clan."), caller.getName()); clan.inform(F.main("Clans", F.name(caller.getName()) + " kicked " + F.name(other) + " from your Clan."), caller.getName());
} }
}; };
// Task // Task
if (player != null) if (player != null)
Clans.getClanDataAccess().leave(clan, player, callback); _clansManager.getClanDataAccess().leave(clan, player, callback);
else else
Clans.getClanDataAccess().leave(clan, clansPlayer, callback); _clansManager.getClanDataAccess().leave(clan, clansPlayer, callback);
} }
public boolean unclaim(final Player caller, final Chunk c) public boolean unclaim(final Player caller, final Chunk c)
@ -1075,7 +1075,7 @@ public class ClansUtility
if (clan == null) if (clan == null)
{ {
Clans.getTutorials().sendTutorialMsg(caller, F.main("Clans", "You are not in a Clan.")); _clansManager.getTutorials().sendTutorialMsg(caller, F.main("Clans", "You are not in a Clan."));
return false; return false;
} }
@ -1088,14 +1088,14 @@ public class ClansUtility
// Role // Role
if (clan.getMembers().get(caller.getUniqueId()).getRole() != ClanRole.LEADER && clan.getMembers().get(caller.getUniqueId()).getRole() != ClanRole.ADMIN) if (clan.getMembers().get(caller.getUniqueId()).getRole() != ClanRole.LEADER && clan.getMembers().get(caller.getUniqueId()).getRole() != ClanRole.ADMIN)
{ {
Clans.getTutorials().sendTutorialMsg(caller, F.main("Clans", "Only the Clan Leader and Admins can unclaim Territory.")); _clansManager.getTutorials().sendTutorialMsg(caller, F.main("Clans", "Only the Clan Leader and Admins can unclaim Territory."));
return false; return false;
} }
// Not Claimed // Not Claimed
if (ownerClan == null || !ownerClan.equals(clan)) if (ownerClan == null || !ownerClan.equals(clan))
{ {
Clans.getTutorials().sendTutorialMsg(caller, F.main("Clans", "This Territory is not owned by you.")); _clansManager.getTutorials().sendTutorialMsg(caller, F.main("Clans", "This Territory is not owned by you."));
return false; return false;
} }
@ -1110,10 +1110,10 @@ public class ClansUtility
} }
// Task // Task
Clans.getClanDataAccess().unclaim(chunk, caller.getName(), true); _clansManager.getClanDataAccess().unclaim(chunk, caller.getName(), true);
// Inform // Inform
Clans.getTutorials().sendTutorialMsg(caller, F.main("Clans", "You unclaimed Territory " + F.elem(UtilWorld.chunkToStrClean(caller.getLocation().getChunk())) + ".")); _clansManager.getTutorials().sendTutorialMsg(caller, F.main("Clans", "You unclaimed Territory " + F.elem(UtilWorld.chunkToStrClean(caller.getLocation().getChunk())) + "."));
clan.inform(F.name(caller.getName()) + " unclaimed Territory " + F.elem(UtilWorld.chunkToStrClean(caller.getLocation().getChunk())) + ".", caller.getName()); clan.inform(F.name(caller.getName()) + " unclaimed Territory " + F.elem(UtilWorld.chunkToStrClean(caller.getLocation().getChunk())) + ".", caller.getName());
return true; return true;
@ -1125,13 +1125,13 @@ public class ClansUtility
if (clan == null) if (clan == null)
{ {
Clans.getTutorials().sendTutorialMsg(caller, F.main("Clans", "You are not in a Clan.")); _clansManager.getTutorials().sendTutorialMsg(caller, F.main("Clans", "You are not in a Clan."));
return false; return false;
} }
if (clan.getMembers().get(caller.getUniqueId()).getRole() != ClanRole.LEADER) if (clan.getMembers().get(caller.getUniqueId()).getRole() != ClanRole.LEADER)
{ {
Clans.getTutorials().sendTutorialMsg(caller, F.main("Clans", "Only the Clan Leader can unclaim all Territory.")); _clansManager.getTutorials().sendTutorialMsg(caller, F.main("Clans", "Only the Clan Leader can unclaim all Territory."));
return false; return false;
} }
@ -1145,11 +1145,11 @@ public class ClansUtility
for (String chunk : toUnclaim) for (String chunk : toUnclaim)
{ {
Clans.getClanDataAccess().unclaim(chunk, caller.getName(), true); _clansManager.getClanDataAccess().unclaim(chunk, caller.getName(), true);
} }
// Inform // Inform
Clans.getTutorials().sendTutorialMsg(caller, F.main("Clans", "You unclaimed all your Clans Territory.")); _clansManager.getTutorials().sendTutorialMsg(caller, F.main("Clans", "You unclaimed all your Clans Territory."));
clan.inform(F.name(caller.getName()) + " unclaimed all your Clans Territory.", caller.getName()); clan.inform(F.name(caller.getName()) + " unclaimed all your Clans Territory.", caller.getName());
return true; return true;
@ -1159,24 +1159,24 @@ public class ClansUtility
{ {
if (clan.getMembers().get(caller.getUniqueId()).getRole() != ClanRole.LEADER && clan.getMembers().get(caller.getUniqueId()).getRole() != ClanRole.ADMIN) if (clan.getMembers().get(caller.getUniqueId()).getRole() != ClanRole.LEADER && clan.getMembers().get(caller.getUniqueId()).getRole() != ClanRole.ADMIN)
{ {
Clans.getTutorials().sendTutorialMsg(caller, F.main("Clans", "Only the Clan Leader and Admins can send invites.")); _clansManager.getTutorials().sendTutorialMsg(caller, F.main("Clans", "Only the Clan Leader and Admins can send invites."));
return; return;
} }
if (target.getName().equals(caller.getName())) if (target.getName().equals(caller.getName()))
{ {
Clans.getTutorials().sendTutorialMsg(caller, F.main("Clans", "You cannot invite yourself.")); _clansManager.getTutorials().sendTutorialMsg(caller, F.main("Clans", "You cannot invite yourself."));
return; return;
} }
// Inform // Inform
clan.inform(F.name(caller.getName()) + " invited " + F.name(target.getName()) + " to join your Clan.", caller.getName()); clan.inform(F.name(caller.getName()) + " invited " + F.name(target.getName()) + " to join your Clan.", caller.getName());
Clans.getTutorials().sendTutorialMsg(caller, F.main("Clans", "You invited " + F.name(target.getName()) + " to join your Clan.")); _clansManager.getTutorials().sendTutorialMsg(caller, F.main("Clans", "You invited " + F.name(target.getName()) + " to join your Clan."));
Clans.getTutorials().sendTutorialMsg(target, F.main("Clans", F.name(caller.getName()) + " invited you to join " + F.elem("Clan " + clan.getName()) + ".")); _clansManager.getTutorials().sendTutorialMsg(target, F.main("Clans", F.name(caller.getName()) + " invited you to join " + F.elem("Clan " + clan.getName()) + "."));
Clans.getTutorials().sendTutorialMsg(target, F.main("Clans", "Type " + F.elem("/c join " + clan.getName()) + " to accept!")); _clansManager.getTutorials().sendTutorialMsg(target, F.main("Clans", "Type " + F.elem("/c join " + clan.getName()) + " to accept!"));
// Task // Task
Clans.getClanDataAccess().invite(clan, target.getName(), caller.getName()); _clansManager.getClanDataAccess().invite(clan, target.getName(), caller.getName());
} }
} }

View File

@ -1,23 +1,16 @@
package mineplex.game.clans.clans; package mineplex.game.clans.clans;
import java.io.ByteArrayOutputStream;
import java.io.DataOutputStream;
import java.io.IOException; import java.io.IOException;
public class Test { import org.bukkit.Location;
import mineplex.core.common.util.UtilWorld;
public class Test
{
public static void main(String[] args) throws IOException public static void main(String[] args) throws IOException
{ {
ByteArrayOutputStream stream = new ByteArrayOutputStream(); System.out.println(UtilWorld.locToStr(new Location(null, 30, 30, 30)));
DataOutputStream dos = new DataOutputStream(stream);
dos.writeByte(91);
dos.flush();
stream.flush();
System.out.println(new String(stream.toByteArray()));
dos.close();
stream.close();
} }

View File

@ -43,12 +43,12 @@ import net.minecraft.server.v1_8_R3.EnumDirection;
public class ClansCommand extends CommandBase<ClansManager> public class ClansCommand extends CommandBase<ClansManager>
{ {
private ClansManager _manager; private ClansManager _clansManager;
public ClansCommand(ClansManager plugin) public ClansCommand(ClansManager plugin)
{ {
super(plugin, Rank.ALL, "c", "clan", "clans", "factions"); super(plugin, Rank.ALL, "c", "clan", "clans", "factions");
_manager = plugin; _clansManager = plugin;
} }
@Override @Override
@ -56,7 +56,7 @@ public class ClansCommand extends CommandBase<ClansManager>
{ {
if (args == null || args.length == 0) if (args == null || args.length == 0)
{ {
_manager.getClanShop().attemptShopOpen(caller); _clansManager.getClanShop().attemptShopOpen(caller);
return; return;
} }
@ -140,7 +140,7 @@ public class ClansCommand extends CommandBase<ClansManager>
{ {
if (!Plugin.getClientManager().hasRank(caller, Rank.ADMIN) && !caller.getUniqueId().toString().equals("d8646a35-33a8-43c6-9e7c-2e871a6b86c9") /* My UUID (NewGarbo) */) if (!Plugin.getClientManager().hasRank(caller, Rank.ADMIN) && !caller.getUniqueId().toString().equals("d8646a35-33a8-43c6-9e7c-2e871a6b86c9") /* My UUID (NewGarbo) */)
{ {
_manager.getTutorials().sendTutorialMsg(caller, F.main("Clans", "This requires ADMIN+ permission.")); _clansManager.getTutorials().sendTutorialMsg(caller, F.main("Clans", "This requires ADMIN+ permission."));
return; return;
} }
@ -150,18 +150,18 @@ public class ClansCommand extends CommandBase<ClansManager>
if (clan != null) if (clan != null)
{ {
_manager.getClanUtility().join(caller, clan); _clansManager.getClanUtility().join(caller, clan);
_manager.getClanDataAccess().role(clan, caller.getUniqueId(), ClanRole.LEADER); _clansManager.getClanDataAccess().role(clan, caller.getUniqueId(), ClanRole.LEADER);
_manager.getTutorials().sendTutorialMsg(caller, F.main("Clans", "You have successfully joined " + F.elem(clan.getName()) + " and are now Leader Role.")); _clansManager.getTutorials().sendTutorialMsg(caller, F.main("Clans", "You have successfully joined " + F.elem(clan.getName()) + " and are now Leader Role."));
} }
else else
{ {
_manager.getTutorials().sendTutorialMsg(caller, F.main("Clans", "Clan provided does not exist.")); _clansManager.getTutorials().sendTutorialMsg(caller, F.main("Clans", "Clan provided does not exist."));
} }
} }
else else
{ {
_manager.getTutorials().sendTutorialMsg(caller, F.main("Clans", "No clan provided.")); _clansManager.getTutorials().sendTutorialMsg(caller, F.main("Clans", "No clan provided."));
} }
} }
@ -170,7 +170,7 @@ public class ClansCommand extends CommandBase<ClansManager>
if (args.length == 0) if (args.length == 0)
{ {
Plugin.Get(caller).setClanChat(!Plugin.Get(caller).isClanChat()); Plugin.Get(caller).setClanChat(!Plugin.Get(caller).isClanChat());
_manager.getTutorials().sendTutorialMsg(caller, F.main("Clans", "Clan Chat: " + F.oo(Plugin.Get(caller).isClanChat()))); _clansManager.getTutorials().sendTutorialMsg(caller, F.main("Clans", "Clan Chat: " + F.oo(Plugin.Get(caller).isClanChat())));
return; return;
} }
@ -179,7 +179,7 @@ public class ClansCommand extends CommandBase<ClansManager>
{ {
ClanInfo clan = Plugin.getClanUtility().getClanByPlayer(caller); ClanInfo clan = Plugin.getClanUtility().getClanByPlayer(caller);
if (clan == null) if (clan == null)
_manager.getTutorials().sendTutorialMsg(caller, F.main("Clans", "You are not in a Clan.")); _clansManager.getTutorials().sendTutorialMsg(caller, F.main("Clans", "You are not in a Clan."));
else else
Plugin.chatClan(clan, caller, F.combine(args, 0, null, false)); Plugin.chatClan(clan, caller, F.combine(args, 0, null, false));
} }
@ -190,7 +190,7 @@ public class ClansCommand extends CommandBase<ClansManager>
if (args.length == 0) if (args.length == 0)
{ {
Plugin.Get(caller).setAllyChat(!Plugin.Get(caller).isAllyChat()); Plugin.Get(caller).setAllyChat(!Plugin.Get(caller).isAllyChat());
_manager.getTutorials().sendTutorialMsg(caller, F.main("Clans", "Ally Chat: " + F.oo(Plugin.Get(caller).isAllyChat()))); _clansManager.getTutorials().sendTutorialMsg(caller, F.main("Clans", "Ally Chat: " + F.oo(Plugin.Get(caller).isAllyChat())));
return; return;
} }
@ -199,7 +199,7 @@ public class ClansCommand extends CommandBase<ClansManager>
{ {
ClanInfo clan = Plugin.getClanUtility().getClanByPlayer(caller); ClanInfo clan = Plugin.getClanUtility().getClanByPlayer(caller);
if (clan == null) if (clan == null)
_manager.getTutorials().sendTutorialMsg(caller, F.main("Clans", "You are not in a Clan.")); _clansManager.getTutorials().sendTutorialMsg(caller, F.main("Clans", "You are not in a Clan."));
else else
Plugin.chatAlly(clan, caller, F.combine(args, 0, null, false)); Plugin.chatAlly(clan, caller, F.combine(args, 0, null, false));
} }
@ -215,32 +215,32 @@ public class ClansCommand extends CommandBase<ClansManager>
return; return;
} }
_manager.getTutorials().sendTutorialMsg(caller, F.main("Clans", "Commands List;")); _clansManager.getTutorials().sendTutorialMsg(caller, F.main("Clans", "Commands List;"));
_manager.getTutorials().sendTutorialMsg(caller, F.help("/c create <clan>", "Create new Clan", Rank.ALL)); _clansManager.getTutorials().sendTutorialMsg(caller, F.help("/c create <clan>", "Create new Clan", Rank.ALL));
_manager.getTutorials().sendTutorialMsg(caller, F.help("/c join <clan>", "Join a Clan", Rank.ALL)); _clansManager.getTutorials().sendTutorialMsg(caller, F.help("/c join <clan>", "Join a Clan", Rank.ALL));
_manager.getTutorials().sendTutorialMsg(caller, F.help("/c leave <clan>", "Leave your Clan", Rank.ALL)); _clansManager.getTutorials().sendTutorialMsg(caller, F.help("/c leave <clan>", "Leave your Clan", Rank.ALL));
_manager.getTutorials().sendTutorialMsg(caller, F.help("/c map <toggle>", "View Clan Map", Rank.ALL)); _clansManager.getTutorials().sendTutorialMsg(caller, F.help("/c map <toggle>", "View Clan Map", Rank.ALL));
_manager.getTutorials().sendTutorialMsg(caller, F.help("/cc (Message)", "Clan Chat (Toggle)", Rank.ALL)); _clansManager.getTutorials().sendTutorialMsg(caller, F.help("/cc (Message)", "Clan Chat (Toggle)", Rank.ALL));
_manager.getTutorials().sendTutorialMsg(caller, F.help("/c stuck", "Teleports you to the nearest Wilderness location", Rank.ALL)); _clansManager.getTutorials().sendTutorialMsg(caller, F.help("/c stuck", "Teleports you to the nearest Wilderness location", Rank.ALL));
_manager.getTutorials().sendTutorialMsg(caller, F.help("/c promote <player>", "Promote Player in Clan", Rank.MODERATOR)); _clansManager.getTutorials().sendTutorialMsg(caller, F.help("/c promote <player>", "Promote Player in Clan", Rank.MODERATOR));
_manager.getTutorials().sendTutorialMsg(caller, F.help("/c demote <player>", "Demote Player in Clan", Rank.MODERATOR)); _clansManager.getTutorials().sendTutorialMsg(caller, F.help("/c demote <player>", "Demote Player in Clan", Rank.MODERATOR));
_manager.getTutorials().sendTutorialMsg(caller, F.help("/c home (set)", "Teleport to Clan Home", Rank.MODERATOR)); _clansManager.getTutorials().sendTutorialMsg(caller, F.help("/c home (set)", "Teleport to Clan Home", Rank.MODERATOR));
_manager.getTutorials().sendTutorialMsg(caller, F.help("/c invite <player>", "Invite Player to Clan", Rank.ADMIN)); _clansManager.getTutorials().sendTutorialMsg(caller, F.help("/c invite <player>", "Invite Player to Clan", Rank.ADMIN));
_manager.getTutorials().sendTutorialMsg(caller, F.help("/c kick <player>", "Kick Player from Clan", Rank.ADMIN)); _clansManager.getTutorials().sendTutorialMsg(caller, F.help("/c kick <player>", "Kick Player from Clan", Rank.ADMIN));
_manager.getTutorials().sendTutorialMsg(caller, F.help("/c neutral <clan>", "Request Neutrality with Clan", Rank.ADMIN)); _clansManager.getTutorials().sendTutorialMsg(caller, F.help("/c neutral <clan>", "Request Neutrality with Clan", Rank.ADMIN));
_manager.getTutorials().sendTutorialMsg(caller, F.help("/c enemy <clan>", "Declare ClanWar with Clan", Rank.ADMIN)); _clansManager.getTutorials().sendTutorialMsg(caller, F.help("/c enemy <clan>", "Declare ClanWar with Clan", Rank.ADMIN));
_manager.getTutorials().sendTutorialMsg(caller, F.help("/c ally <clan>", "Send Alliance to Clan", Rank.ADMIN)); _clansManager.getTutorials().sendTutorialMsg(caller, F.help("/c ally <clan>", "Send Alliance to Clan", Rank.ADMIN));
_manager.getTutorials().sendTutorialMsg(caller, F.help("/c trust <clan>", "Give Trust to Clan", Rank.ADMIN)); _clansManager.getTutorials().sendTutorialMsg(caller, F.help("/c trust <clan>", "Give Trust to Clan", Rank.ADMIN));
_manager.getTutorials().sendTutorialMsg(caller, F.help("/c claim", "Claim Territory", Rank.ADMIN)); _clansManager.getTutorials().sendTutorialMsg(caller, F.help("/c claim", "Claim Territory", Rank.ADMIN));
_manager.getTutorials().sendTutorialMsg(caller, F.help("/c unclaim (all)", "Unclaim Territory", Rank.ADMIN)); _clansManager.getTutorials().sendTutorialMsg(caller, F.help("/c unclaim (all)", "Unclaim Territory", Rank.ADMIN));
_manager.getTutorials().sendTutorialMsg(caller, F.help("/c delete", "Delete your Clan", Rank.OWNER)); _clansManager.getTutorials().sendTutorialMsg(caller, F.help("/c delete", "Delete your Clan", Rank.OWNER));
_manager.getTutorials().sendTutorialMsg(caller, F.help("/c <clan>", "View Clan Information", Rank.ALL)); _clansManager.getTutorials().sendTutorialMsg(caller, F.help("/c <clan>", "View Clan Information", Rank.ALL));
} }
public void create(final Player caller, final String[] args) public void create(final Player caller, final String[] args)
@ -251,13 +251,13 @@ public class ClansCommand extends CommandBase<ClansManager>
if (Plugin.getClanMemberUuidMap().containsKey(caller.getUniqueId())) if (Plugin.getClanMemberUuidMap().containsKey(caller.getUniqueId()))
{ {
_manager.getTutorials().sendTutorialMsg(caller, F.main("Clans", "You are already in a Clan.")); _clansManager.getTutorials().sendTutorialMsg(caller, F.main("Clans", "You are already in a Clan."));
return; return;
} }
if (Plugin.leftRecently(caller.getUniqueId(), 5 * 60 * 1000) != null) if (Plugin.leftRecently(caller.getUniqueId(), 5 * 60 * 1000) != null)
{ {
_manager.getTutorials().sendTutorialMsg(caller, F.main("Clans", "You cannot create a Clan for " + C.mTime + UtilTime.MakeStr(Plugin.leftRecently(caller.getUniqueId(), 20 * 60 * 1000).getRight()) + C.mBody + ".")); _clansManager.getTutorials().sendTutorialMsg(caller, F.main("Clans", "You cannot create a Clan for " + C.mTime + UtilTime.MakeStr(Plugin.leftRecently(caller.getUniqueId(), 20 * 60 * 1000).getRight()) + C.mBody + "."));
return; return;
} }
@ -270,37 +270,37 @@ public class ClansCommand extends CommandBase<ClansManager>
if (args.length < 2) if (args.length < 2)
{ {
_manager.getTutorials().sendTutorialMsg(caller, F.main("Clans", "You did not input a Clan name.")); _clansManager.getTutorials().sendTutorialMsg(caller, F.main("Clans", "You did not input a Clan name."));
return; return;
} }
if (!UtilInput.valid(args[1])) if (!UtilInput.valid(args[1]))
{ {
_manager.getTutorials().sendTutorialMsg(caller, F.main("Clans", "Invalid characters in Clan name.")); _clansManager.getTutorials().sendTutorialMsg(caller, F.main("Clans", "Invalid characters in Clan name."));
return; return;
} }
if (args[1].length() < Plugin.getNameMin()) if (args[1].length() < Plugin.getNameMin())
{ {
_manager.getTutorials().sendTutorialMsg(caller, F.main("Clans", "Clan name too short. Minimum length is " + (Plugin.getNameMin()) + ".")); _clansManager.getTutorials().sendTutorialMsg(caller, F.main("Clans", "Clan name too short. Minimum length is " + (Plugin.getNameMin()) + "."));
return; return;
} }
if (args[1].length() > Plugin.getNameMax()) if (args[1].length() > Plugin.getNameMax())
{ {
_manager.getTutorials().sendTutorialMsg(caller, F.main("Clans", "Clan name too long. Maximum length is " + (Plugin.getNameMax()) + ".")); _clansManager.getTutorials().sendTutorialMsg(caller, F.main("Clans", "Clan name too long. Maximum length is " + (Plugin.getNameMax()) + "."));
return; return;
} }
if (Plugin.getChat().getFilteredMessage(caller, args[1]).contains("*")) if (Plugin.getChat().getFilteredMessage(caller, args[1]).contains("*"))
{ {
_manager.getTutorials().sendTutorialMsg(caller, F.main("Clans", "Clan name inappropriate. Please try a different name")); _clansManager.getTutorials().sendTutorialMsg(caller, F.main("Clans", "Clan name inappropriate. Please try a different name"));
return; return;
} }
if (!ClansBlacklist.isValidClanName(args[1])) if (!ClansBlacklist.isValidClanName(args[1]))
{ {
_manager.getTutorials().sendTutorialMsg(caller, F.main("Clans", "Clan name is blacklisted! Please try a different name.")); _clansManager.getTutorials().sendTutorialMsg(caller, F.main("Clans", "Clan name is blacklisted! Please try a different name."));
return; return;
} }
@ -311,7 +311,7 @@ public class ClansCommand extends CommandBase<ClansManager>
{ {
if (clanExists) if (clanExists)
{ {
_manager.getTutorials().sendTutorialMsg(caller, F.main("Clans", "Clan name is already in use by another Clan.")); _clansManager.getTutorials().sendTutorialMsg(caller, F.main("Clans", "Clan name is already in use by another Clan."));
} }
else else
{ {
@ -323,11 +323,11 @@ public class ClansCommand extends CommandBase<ClansManager>
if (data == null) if (data == null)
{ {
// Hopefully shouldn't happen! // Hopefully shouldn't happen!
_manager.getTutorials().sendTutorialMsg(caller, F.main("Clans", "There was an error creating the clan. Please try again")); _clansManager.getTutorials().sendTutorialMsg(caller, F.main("Clans", "There was an error creating the clan. Please try again"));
} }
else else
{ {
_manager.getTutorials().sendTutorialMsg(caller, F.main("Clans", "You created Clan " + C.cYellow + data.getName() + C.cGray + ".")); _clansManager.getTutorials().sendTutorialMsg(caller, F.main("Clans", "You created Clan " + C.cYellow + data.getName() + C.cGray + "."));
} }
} }
}); });
@ -347,13 +347,13 @@ public class ClansCommand extends CommandBase<ClansManager>
if (clan == null) if (clan == null)
{ {
_manager.getTutorials().sendTutorialMsg(caller, F.main("Clans", "You are not in a Clan.")); _clansManager.getTutorials().sendTutorialMsg(caller, F.main("Clans", "You are not in a Clan."));
return; return;
} }
if (args.length < 2) if (args.length < 2)
{ {
_manager.getTutorials().sendTutorialMsg(caller, F.main("Clans", "You did not input an invitee.")); _clansManager.getTutorials().sendTutorialMsg(caller, F.main("Clans", "You did not input an invitee."));
return; return;
} }
@ -365,13 +365,20 @@ public class ClansCommand extends CommandBase<ClansManager>
public void stuck(final Player caller) public void stuck(final Player caller)
{ {
if (_clansManager.getNetherManager().isInNether(caller))
{
_clansManager.message(caller, "You are not allowed to free yourself in " + F.clansNether("The Nether") + ".");
return;
}
ClanTerritory territory = Plugin.getClanUtility().getClaim(caller.getLocation()); ClanTerritory territory = Plugin.getClanUtility().getClaim(caller.getLocation());
String clanName = Plugin.getClanUtility().getClanByPlayer(caller) == null ? null : Plugin.getClanUtility().getClanByPlayer(caller).getName(); String clanName = Plugin.getClanUtility().getClanByPlayer(caller) == null ? null : Plugin.getClanUtility().getClanByPlayer(caller).getName();
if (territory == null || territory.Safe || territory.Owner.equals(clanName)) if (territory == null || territory.Safe || territory.Owner.equals(clanName))
{ {
_manager.getTutorials().sendTutorialMsg(caller, F.main("Clans", "You must be in another Clan's territory to use this.")); _clansManager.getTutorials().sendTutorialMsg(caller, F.main("Clans", "You must be in another Clan's territory to use this."));
return; return;
} }
@ -384,14 +391,14 @@ public class ClansCommand extends CommandBase<ClansManager>
if (loc == null) if (loc == null)
{ {
_manager.getTutorials().sendTutorialMsg(caller, F.main("Clans", "Error whilst finding location to teleport to.")); _clansManager.getTutorials().sendTutorialMsg(caller, F.main("Clans", "Error whilst finding location to teleport to."));
return; return;
} }
player.getPlayer().teleport(loc); player.getPlayer().teleport(loc);
// Inform // Inform
_manager.getTutorials().sendTutorialMsg(caller, F.main("Clans", "You have been teleported to the Wilderness.")); _clansManager.getTutorials().sendTutorialMsg(caller, F.main("Clans", "You have been teleported to the Wilderness."));
} }
}, new Callback<DelayedTaskClient>() { }, new Callback<DelayedTaskClient>() {
public void run(DelayedTaskClient client) public void run(DelayedTaskClient client)
@ -444,31 +451,31 @@ public class ClansCommand extends CommandBase<ClansManager>
{ {
if (Plugin.getClanMemberUuidMap().containsKey(caller.getUniqueId())) if (Plugin.getClanMemberUuidMap().containsKey(caller.getUniqueId()))
{ {
_manager.getTutorials().sendTutorialMsg(caller, F.main("Clans", "You are already in a Clan.")); _clansManager.getTutorials().sendTutorialMsg(caller, F.main("Clans", "You are already in a Clan."));
return; return;
} }
if (Plugin.leftRecently(caller.getUniqueId(), 20 * 60 * 1000) != null) if (Plugin.leftRecently(caller.getUniqueId(), 20 * 60 * 1000) != null)
{ {
_manager.getTutorials().sendTutorialMsg(caller, F.main("Clans", "You cannot join a Clan for " + C.mTime + UtilTime.MakeStr(Plugin.leftRecently(caller.getUniqueId(), 20 * 60 * 1000).getRight()) + C.mBody + ".")); _clansManager.getTutorials().sendTutorialMsg(caller, F.main("Clans", "You cannot join a Clan for " + C.mTime + UtilTime.MakeStr(Plugin.leftRecently(caller.getUniqueId(), 20 * 60 * 1000).getRight()) + C.mBody + "."));
return; return;
} }
if (!Plugin.Get(caller).canJoin()) if (!Plugin.Get(caller).canJoin())
{ {
_manager.getTutorials().sendTutorialMsg(caller, F.main("Clans", "You cannot join a Clan for " + C.mTime + UtilTime.convertString(System.currentTimeMillis() - Plugin.Get(caller).getDelay(), 1, TimeUnit.FIT) + C.mBody + ".")); _clansManager.getTutorials().sendTutorialMsg(caller, F.main("Clans", "You cannot join a Clan for " + C.mTime + UtilTime.convertString(System.currentTimeMillis() - Plugin.Get(caller).getDelay(), 1, TimeUnit.FIT) + C.mBody + "."));
return; return;
} }
if (args.length < 2) if (args.length < 2)
{ {
_manager.getTutorials().sendTutorialMsg(caller, F.main("Clans", "You did not input a Clan name.")); _clansManager.getTutorials().sendTutorialMsg(caller, F.main("Clans", "You did not input a Clan name."));
return; return;
} }
if (!UtilInput.valid(args[1])) if (!UtilInput.valid(args[1]))
{ {
_manager.getTutorials().sendTutorialMsg(caller, F.main("Clans", "Invalid characters in Clan name.")); _clansManager.getTutorials().sendTutorialMsg(caller, F.main("Clans", "Invalid characters in Clan name."));
return; return;
} }
@ -477,13 +484,13 @@ public class ClansCommand extends CommandBase<ClansManager>
if (!clan.isInvited(caller.getName())) if (!clan.isInvited(caller.getName()))
{ {
_manager.getTutorials().sendTutorialMsg(caller, F.main("Clans", "You are not invited to " + F.elem("Clan " + clan.getName()) + ".")); _clansManager.getTutorials().sendTutorialMsg(caller, F.main("Clans", "You are not invited to " + F.elem("Clan " + clan.getName()) + "."));
return; return;
} }
if (clan.getSize() >= clan.getMaxSize()) if (clan.getSize() >= clan.getMaxSize())
{ {
_manager.getTutorials().sendTutorialMsg(caller, F.main("Clans", "The clan " + F.elem("Clan " + clan.getName()) + " is full and cannot be joined!")); _clansManager.getTutorials().sendTutorialMsg(caller, F.main("Clans", "The clan " + F.elem("Clan " + clan.getName()) + " is full and cannot be joined!"));
return; return;
} }
@ -500,12 +507,12 @@ public class ClansCommand extends CommandBase<ClansManager>
if (data) if (data)
{ {
// Inform // Inform
_manager.getTutorials().sendTutorialMsg(caller, F.main("Clans", "You joined " + F.elem("Clan " + clan.getName()) + ".")); _clansManager.getTutorials().sendTutorialMsg(caller, F.main("Clans", "You joined " + F.elem("Clan " + clan.getName()) + "."));
clan.inform(F.name(caller.getName()) + " has joined your Clan.", caller.getName()); clan.inform(F.name(caller.getName()) + " has joined your Clan.", caller.getName());
} }
else else
{ {
_manager.getTutorials().sendTutorialMsg(caller, F.main("Clans", "There was an error processing your request")); _clansManager.getTutorials().sendTutorialMsg(caller, F.main("Clans", "There was an error processing your request"));
} }
} }
}); });
@ -518,13 +525,13 @@ public class ClansCommand extends CommandBase<ClansManager>
if (clan == null) if (clan == null)
{ {
_manager.getTutorials().sendTutorialMsg(caller, F.main("Clans", "You are not in a Clan.")); _clansManager.getTutorials().sendTutorialMsg(caller, F.main("Clans", "You are not in a Clan."));
return; return;
} }
if (clan.getMembers().get(caller.getUniqueId()).getRole() == ClanRole.LEADER && clan.getMembers().size() > 1) if (clan.getMembers().get(caller.getUniqueId()).getRole() == ClanRole.LEADER && clan.getMembers().size() > 1)
{ {
_manager.getTutorials().sendTutorialMsg(caller, F.main("Clans", "You must pass on " + F.elem("Leadership") + " before leaving.")); _clansManager.getTutorials().sendTutorialMsg(caller, F.main("Clans", "You must pass on " + F.elem("Leadership") + " before leaving."));
return; return;
} }
@ -538,7 +545,7 @@ public class ClansCommand extends CommandBase<ClansManager>
public void run(Boolean data) public void run(Boolean data)
{ {
// Inform // Inform
_manager.getTutorials().sendTutorialMsg(caller, F.main("Clans", "You left " + F.elem("Clan " + clan.getName()) + ".")); _clansManager.getTutorials().sendTutorialMsg(caller, F.main("Clans", "You left " + F.elem("Clan " + clan.getName()) + "."));
clan.inform(F.name(caller.getName()) + " has left your Clan.", null); clan.inform(F.name(caller.getName()) + " has left your Clan.", null);
} }
}); });
@ -555,19 +562,19 @@ public class ClansCommand extends CommandBase<ClansManager>
if (clan == null) if (clan == null)
{ {
_manager.getTutorials().sendTutorialMsg(caller, F.main("Clans", "You are not in a Clan.")); _clansManager.getTutorials().sendTutorialMsg(caller, F.main("Clans", "You are not in a Clan."));
return; return;
} }
if (args.length < 2) if (args.length < 2)
{ {
_manager.getTutorials().sendTutorialMsg(caller, F.main("Clans", "You did not input a Player to kick.")); _clansManager.getTutorials().sendTutorialMsg(caller, F.main("Clans", "You did not input a Player to kick."));
return; return;
} }
final String target = UtilPlayer.searchCollection(caller, args[1], clan.getMemberNameSet(), "Clan Member", true); final String target = UtilPlayer.searchCollection(caller, args[1], clan.getMemberNameSet(), "Clan Member", true);
_manager.getClanUtility().kick(caller, target); _clansManager.getClanUtility().kick(caller, target);
} }
public void promote(Player caller, String[] args) public void promote(Player caller, String[] args)
@ -576,19 +583,19 @@ public class ClansCommand extends CommandBase<ClansManager>
if (clan == null) if (clan == null)
{ {
_manager.getTutorials().sendTutorialMsg(caller, F.main("Clans", "You are not in a Clan.")); _clansManager.getTutorials().sendTutorialMsg(caller, F.main("Clans", "You are not in a Clan."));
return; return;
} }
if (args.length < 2) if (args.length < 2)
{ {
_manager.getTutorials().sendTutorialMsg(caller, F.main("Clans", "You did not input player to promote.")); _clansManager.getTutorials().sendTutorialMsg(caller, F.main("Clans", "You did not input player to promote."));
return; return;
} }
final String targetName = UtilPlayer.searchCollection(caller, args[1], clan.getMemberNameSet(), "Clan Member", true); final String targetName = UtilPlayer.searchCollection(caller, args[1], clan.getMemberNameSet(), "Clan Member", true);
_manager.getClanUtility().promote(caller, targetName); _clansManager.getClanUtility().promote(caller, targetName);
} }
public void demote(Player caller, String[] args) public void demote(Player caller, String[] args)
@ -597,19 +604,19 @@ public class ClansCommand extends CommandBase<ClansManager>
if (clan == null) if (clan == null)
{ {
_manager.getTutorials().sendTutorialMsg(caller, F.main("Clans", "You are not in a Clan.")); _clansManager.getTutorials().sendTutorialMsg(caller, F.main("Clans", "You are not in a Clan."));
return; return;
} }
if (args.length < 2) if (args.length < 2)
{ {
_manager.getTutorials().sendTutorialMsg(caller, F.main("Clans", "You did not input player to demote.")); _clansManager.getTutorials().sendTutorialMsg(caller, F.main("Clans", "You did not input player to demote."));
return; return;
} }
final String targetName = UtilPlayer.searchCollection(caller, args[1], clan.getMemberNameSet(), "Clan Member", true); final String targetName = UtilPlayer.searchCollection(caller, args[1], clan.getMemberNameSet(), "Clan Member", true);
_manager.getClanUtility().demote(caller, targetName); _clansManager.getClanUtility().demote(caller, targetName);
} }
public void ally(Player caller, String[] args) public void ally(Player caller, String[] args)
@ -618,19 +625,19 @@ public class ClansCommand extends CommandBase<ClansManager>
if (cA == null) if (cA == null)
{ {
_manager.getTutorials().sendTutorialMsg(caller, F.main("Clans", "You are not in a Clan.")); _clansManager.getTutorials().sendTutorialMsg(caller, F.main("Clans", "You are not in a Clan."));
return; return;
} }
if (cA.getMembers().get(caller.getUniqueId()).getRole() != ClanRole.LEADER && cA.getMembers().get(caller.getUniqueId()).getRole() != ClanRole.ADMIN) if (cA.getMembers().get(caller.getUniqueId()).getRole() != ClanRole.LEADER && cA.getMembers().get(caller.getUniqueId()).getRole() != ClanRole.ADMIN)
{ {
_manager.getTutorials().sendTutorialMsg(caller, F.main("Clans", "Only the Clan Leader and Admins can manage Alliances.")); _clansManager.getTutorials().sendTutorialMsg(caller, F.main("Clans", "Only the Clan Leader and Admins can manage Alliances."));
return; return;
} }
if (args.length < 2) if (args.length < 2)
{ {
_manager.getTutorials().sendTutorialMsg(caller, F.main("Clans", "You did not input a Clan to ally.")); _clansManager.getTutorials().sendTutorialMsg(caller, F.main("Clans", "You did not input a Clan to ally."));
return; return;
} }
@ -640,31 +647,31 @@ public class ClansCommand extends CommandBase<ClansManager>
if (cA.isSelf(cB.getName())) if (cA.isSelf(cB.getName()))
{ {
_manager.getTutorials().sendTutorialMsg(caller, F.main("Clans", "You cannot ally with yourself.")); _clansManager.getTutorials().sendTutorialMsg(caller, F.main("Clans", "You cannot ally with yourself."));
return; return;
} }
if (cA.isAlly(cB.getName())) if (cA.isAlly(cB.getName()))
{ {
_manager.getTutorials().sendTutorialMsg(caller, F.main("Clans", "You are already allies with Clan" + F.elem(cB.getName())) + "."); _clansManager.getTutorials().sendTutorialMsg(caller, F.main("Clans", "You are already allies with Clan" + F.elem(cB.getName())) + ".");
return; return;
} }
if (cA.getAllies() >= cA.getAlliesMax()) if (cA.getAllies() >= cA.getAlliesMax())
{ {
_manager.getTutorials().sendTutorialMsg(caller, F.main("Clans", "You cannot have any more allies.")); _clansManager.getTutorials().sendTutorialMsg(caller, F.main("Clans", "You cannot have any more allies."));
return; return;
} }
if (cB.getAllies() >= cB.getAlliesMax()) if (cB.getAllies() >= cB.getAlliesMax())
{ {
_manager.getTutorials().sendTutorialMsg(caller, F.main("Clans", "Clan " + F.elem(cB.getName()) + " cannot have any more allies.")); _clansManager.getTutorials().sendTutorialMsg(caller, F.main("Clans", "Clan " + F.elem(cB.getName()) + " cannot have any more allies."));
return; return;
} }
if (!Recharge.Instance.usable(caller, "AllyReq" + cB.getName())) if (!Recharge.Instance.usable(caller, "AllyReq" + cB.getName()))
{ {
_manager.getTutorials().sendTutorialMsg(caller, F.main("Clans", "Please do not spam alliance requests.")); _clansManager.getTutorials().sendTutorialMsg(caller, F.main("Clans", "Please do not spam alliance requests."));
return; return;
} }
@ -674,7 +681,7 @@ public class ClansCommand extends CommandBase<ClansManager>
Plugin.getClanDataAccess().ally(cA, cB, caller.getName()); Plugin.getClanDataAccess().ally(cA, cB, caller.getName());
// Inform // Inform
_manager.getTutorials().sendTutorialMsg(caller, F.main("Clans", "You accepted alliance with Clan " + F.elem(cB.getName()) + ".")); _clansManager.getTutorials().sendTutorialMsg(caller, F.main("Clans", "You accepted alliance with Clan " + F.elem(cB.getName()) + "."));
cA.inform(F.name(caller.getName()) + " accepted alliance with Clan " + F.elem(cB.getName()) + ".", caller.getName()); cA.inform(F.name(caller.getName()) + " accepted alliance with Clan " + F.elem(cB.getName()) + ".", caller.getName());
cB.inform("Clan " + F.elem(cA.getName()) + " has accepted alliance with you.", null); cB.inform("Clan " + F.elem(cA.getName()) + " has accepted alliance with you.", null);
} }
@ -684,7 +691,7 @@ public class ClansCommand extends CommandBase<ClansManager>
Plugin.getClanDataAccess().requestAlly(cA, cB, caller.getName()); Plugin.getClanDataAccess().requestAlly(cA, cB, caller.getName());
// Inform // Inform
_manager.getTutorials().sendTutorialMsg(caller, F.main("Clans", "You requested alliance with Clan " + F.elem(cB.getName()) + ".")); _clansManager.getTutorials().sendTutorialMsg(caller, F.main("Clans", "You requested alliance with Clan " + F.elem(cB.getName()) + "."));
cA.inform(F.name(caller.getName()) + " has requested alliance with Clan " + F.elem(cB.getName()) + ".", caller.getName()); cA.inform(F.name(caller.getName()) + " has requested alliance with Clan " + F.elem(cB.getName()) + ".", caller.getName());
cB.inform("Clan " + F.elem(cA.getName()) + " has requested alliance with you.", null); cB.inform("Clan " + F.elem(cA.getName()) + " has requested alliance with you.", null);
@ -747,19 +754,19 @@ public class ClansCommand extends CommandBase<ClansManager>
if (cA == null) if (cA == null)
{ {
_manager.getTutorials().sendTutorialMsg(caller, F.main("Clans", "You are not in a Clan.")); _clansManager.getTutorials().sendTutorialMsg(caller, F.main("Clans", "You are not in a Clan."));
return; return;
} }
if (cA.getMembers().get(caller.getUniqueId()).getRole() != ClanRole.LEADER && cA.getMembers().get(caller.getUniqueId()).getRole() != ClanRole.ADMIN) if (cA.getMembers().get(caller.getUniqueId()).getRole() != ClanRole.LEADER && cA.getMembers().get(caller.getUniqueId()).getRole() != ClanRole.ADMIN)
{ {
_manager.getTutorials().sendTutorialMsg(caller, F.main("Clans", "Only the Clan Leader and Admins can manage relationships.")); _clansManager.getTutorials().sendTutorialMsg(caller, F.main("Clans", "Only the Clan Leader and Admins can manage relationships."));
return; return;
} }
if (args.length < 2) if (args.length < 2)
{ {
_manager.getTutorials().sendTutorialMsg(caller, F.main("Clans", "You did not input a Clan to set neutrality with.")); _clansManager.getTutorials().sendTutorialMsg(caller, F.main("Clans", "You did not input a Clan to set neutrality with."));
return; return;
} }
@ -769,11 +776,11 @@ public class ClansCommand extends CommandBase<ClansManager>
if (cB.isSelf(cA.getName())) if (cB.isSelf(cA.getName()))
{ {
_manager.getTutorials().sendTutorialMsg(caller, F.main("Clans", "You prefer to think of yourself positively...")); _clansManager.getTutorials().sendTutorialMsg(caller, F.main("Clans", "You prefer to think of yourself positively..."));
} }
else if (cB.isNeutral(cA.getName())) else if (cB.isNeutral(cA.getName()))
{ {
_manager.getTutorials().sendTutorialMsg(caller, F.main("Clans", "You are already neutral with " + F.elem("Clan " + cB.getName()) + ".")); _clansManager.getTutorials().sendTutorialMsg(caller, F.main("Clans", "You are already neutral with " + F.elem("Clan " + cB.getName()) + "."));
} }
else if (cB.isAlly(cA.getName())) else if (cB.isAlly(cA.getName()))
{ {
@ -781,7 +788,7 @@ public class ClansCommand extends CommandBase<ClansManager>
Plugin.getClanDataAccess().neutral(cA, cB, caller.getName(), true); Plugin.getClanDataAccess().neutral(cA, cB, caller.getName(), true);
// Inform // Inform
_manager.getTutorials().sendTutorialMsg(caller, F.main("Clans", "You revoked alliance with " + F.elem("Clan " + cB.getName()) + ".")); _clansManager.getTutorials().sendTutorialMsg(caller, F.main("Clans", "You revoked alliance with " + F.elem("Clan " + cB.getName()) + "."));
cA.inform(F.name(caller.getName()) + " revoked alliance with " + F.elem("Clan " + cB.getName()) + ".", caller.getName()); cA.inform(F.name(caller.getName()) + " revoked alliance with " + F.elem("Clan " + cB.getName()) + ".", caller.getName());
cB.inform(F.elem("Clan " + cA.getName()) + " has revoked alliance with you.", null); cB.inform(F.elem("Clan " + cA.getName()) + " has revoked alliance with you.", null);
} }
@ -797,11 +804,25 @@ public class ClansCommand extends CommandBase<ClansManager>
return; return;
} }
if (_clansManager.getNetherManager().isInNether(caller))
{
_clansManager.message(caller, "You are not allowed to claim territory in " + F.clansNether("The Nether") + ".");
return;
}
Plugin.getClanUtility().claim(caller); Plugin.getClanUtility().claim(caller);
} }
public void unclaim(Player caller, String[] args) public void unclaim(Player caller, String[] args)
{ {
if (_clansManager.getNetherManager().isInNether(caller))
{
_clansManager.message(caller, "You are not allowed to unclaim territory in " + F.clansNether("The Nether") + ".");
return;
}
if (args.length > 1) if (args.length > 1)
{ {
if (args[1].equalsIgnoreCase("all") || args[1].equalsIgnoreCase("a")) if (args[1].equalsIgnoreCase("all") || args[1].equalsIgnoreCase("a"))
@ -816,13 +837,13 @@ public class ClansCommand extends CommandBase<ClansManager>
public boolean unclaimSteal(Player caller, ClanInfo clientClan, ClanInfo ownerClan) public boolean unclaimSteal(Player caller, ClanInfo clientClan, ClanInfo ownerClan)
{ {
if (!_manager.canUnclaimChunk(clientClan, ownerClan)) if (!_clansManager.canUnclaimChunk(clientClan, ownerClan))
{ {
return false; return false;
} }
// Change Inform // Change Inform
_manager.getTutorials().sendTutorialMsg(caller, F.main("Clans", "You can no longer 'steal' territory. " + "You simply unclaim it and it can not be reclaimed by anyone for 30 mintes." + "This was done to improve gameplay. Enjoy!")); _clansManager.getTutorials().sendTutorialMsg(caller, F.main("Clans", "You can no longer 'steal' territory. " + "You simply unclaim it and it can not be reclaimed by anyone for 30 mintes." + "This was done to improve gameplay. Enjoy!"));
// Inform // Inform
UtilServer.broadcast(F.main("Clans", F.elem(clientClan.getName()) + " unclaimed from " + F.elem(ownerClan.getName()) + " at " + F.elem(UtilWorld.locToStrClean(caller.getLocation())) + ".")); UtilServer.broadcast(F.main("Clans", F.elem(clientClan.getName()) + " unclaimed from " + F.elem(ownerClan.getName()) + " at " + F.elem(UtilWorld.locToStrClean(caller.getLocation())) + "."));
@ -858,19 +879,19 @@ public class ClansCommand extends CommandBase<ClansManager>
if (clan == null) if (clan == null)
{ {
_manager.getTutorials().sendTutorialMsg(caller, F.main("Clans", "You are not in a Clan.")); _clansManager.getTutorials().sendTutorialMsg(caller, F.main("Clans", "You are not in a Clan."));
return; return;
} }
if (clan.getHome() == null) if (clan.getHome() == null)
{ {
_manager.getTutorials().sendTutorialMsg(caller, F.main("Clans", "Your Clan has not set a Home")); _clansManager.getTutorials().sendTutorialMsg(caller, F.main("Clans", "Your Clan has not set a Home"));
return; return;
} }
if (!clan.getClaimSet().contains(UtilWorld.chunkToStr(clan.getHome().getChunk()))) if (!clan.getClaimSet().contains(UtilWorld.chunkToStr(clan.getHome().getChunk())))
{ {
_manager.getTutorials().sendTutorialMsg(caller, F.main("Clans", "Your Clan has lost its Home Territory.")); _clansManager.getTutorials().sendTutorialMsg(caller, F.main("Clans", "Your Clan has lost its Home Territory."));
return; return;
} }
@ -878,7 +899,7 @@ public class ClansCommand extends CommandBase<ClansManager>
if (!(home.getBlock().getType().equals(Material.BED_BLOCK) && home.add(0, 1, 0).getBlock().getType().equals(Material.AIR)) && home.add(0, 2, 0).getBlock().getType().equals(Material.AIR)) if (!(home.getBlock().getType().equals(Material.BED_BLOCK) && home.add(0, 1, 0).getBlock().getType().equals(Material.AIR)) && home.add(0, 2, 0).getBlock().getType().equals(Material.AIR))
{ {
_manager.getTutorials().sendTutorialMsg(caller, F.main("Clans", "Your Clan's bed has been destroyed, or is obstructed.")); _clansManager.getTutorials().sendTutorialMsg(caller, F.main("Clans", "Your Clan's bed has been destroyed, or is obstructed."));
return; return;
} }
@ -904,7 +925,7 @@ public class ClansCommand extends CommandBase<ClansManager>
Plugin.getTeleport().TP(caller, clan.getHome().add(0, 1, 0)); Plugin.getTeleport().TP(caller, clan.getHome().add(0, 1, 0));
// Inform // Inform
_manager.getTutorials().sendTutorialMsg(caller, F.main("Clans", "You teleported to your Clan Home " + UtilWorld.locToStrClean(caller.getLocation()) + ".")); _clansManager.getTutorials().sendTutorialMsg(caller, F.main("Clans", "You teleported to your Clan Home " + UtilWorld.locToStrClean(caller.getLocation()) + "."));
} }
}, new Callback<DelayedTaskClient>() { }, new Callback<DelayedTaskClient>() {
public void run(DelayedTaskClient client) public void run(DelayedTaskClient client)
@ -934,31 +955,38 @@ public class ClansCommand extends CommandBase<ClansManager>
if (clan == null) if (clan == null)
{ {
_manager.getTutorials().sendTutorialMsg(caller, F.main("Clans", "You are not in a Clan.")); _clansManager.getTutorials().sendTutorialMsg(caller, F.main("Clans", "You are not in a Clan."));
return;
}
if (_clansManager.getNetherManager().isInNether(caller))
{
_clansManager.message(caller, "You are not allowed to set your Clan Home in " + F.clansNether("The Nether") + ".");
return; return;
} }
if (clan.getMembers().get(caller.getUniqueId()).getRole() != ClanRole.LEADER && clan.getMembers().get(caller.getUniqueId()).getRole() != ClanRole.ADMIN) if (clan.getMembers().get(caller.getUniqueId()).getRole() != ClanRole.LEADER && clan.getMembers().get(caller.getUniqueId()).getRole() != ClanRole.ADMIN)
{ {
_manager.getTutorials().sendTutorialMsg(caller, F.main("Clans", "Only the Clan Leader and Admins can manage Clan Home.")); _clansManager.getTutorials().sendTutorialMsg(caller, F.main("Clans", "Only the Clan Leader and Admins can manage Clan Home."));
return; return;
} }
if (Plugin.getClanUtility().getOwner(caller.getLocation()) == null) if (Plugin.getClanUtility().getOwner(caller.getLocation()) == null)
{ {
_manager.getTutorials().sendTutorialMsg(caller, F.main("Clans", "You must set your Clan Home in your own Territory.")); _clansManager.getTutorials().sendTutorialMsg(caller, F.main("Clans", "You must set your Clan Home in your own Territory."));
return; return;
} }
if (!Plugin.getClanUtility().getOwner(caller.getLocation()).isSelf(clan.getName())) if (!Plugin.getClanUtility().getOwner(caller.getLocation()).isSelf(clan.getName()))
{ {
_manager.getTutorials().sendTutorialMsg(caller, F.main("Clans", "You must set your Clan Home in your own Territory.")); _clansManager.getTutorials().sendTutorialMsg(caller, F.main("Clans", "You must set your Clan Home in your own Territory."));
return; return;
} }
if (!(caller.getLocation().add(0, 1, 0).getBlock().getType().equals(Material.AIR) && caller.getLocation().add(0, 2, 0).getBlock().getType().equals(Material.AIR))) if (!(caller.getLocation().add(0, 1, 0).getBlock().getType().equals(Material.AIR) && caller.getLocation().add(0, 2, 0).getBlock().getType().equals(Material.AIR)))
{ {
_manager.getTutorials().sendTutorialMsg(caller, F.main("Clans", "This is not a suitable place for a bed.")); _clansManager.getTutorials().sendTutorialMsg(caller, F.main("Clans", "This is not a suitable place for a bed."));
return; return;
} }
@ -967,7 +995,7 @@ public class ClansCommand extends CommandBase<ClansManager>
if (!bedPlaced) if (!bedPlaced)
{ {
_manager.getTutorials().sendTutorialMsg(caller, F.main("Clans", "This is not a suitable place for a bed.")); _clansManager.getTutorials().sendTutorialMsg(caller, F.main("Clans", "This is not a suitable place for a bed."));
return; return;
} }
@ -983,7 +1011,7 @@ public class ClansCommand extends CommandBase<ClansManager>
Plugin.ClanTips.displayTip(TipType.SETHOME, caller); Plugin.ClanTips.displayTip(TipType.SETHOME, caller);
// Inform // Inform
_manager.getTutorials().sendTutorialMsg(caller, F.main("Clans", "You set Clan Home to " + F.elem(UtilWorld.locToStrClean(caller.getLocation())) + ".")); _clansManager.getTutorials().sendTutorialMsg(caller, F.main("Clans", "You set Clan Home to " + F.elem(UtilWorld.locToStrClean(caller.getLocation())) + "."));
clan.inform(caller.getName() + " set Clan Home to " + F.elem(UtilWorld.locToStrClean(caller.getLocation())) + ".", caller.getName()); clan.inform(caller.getName() + " set Clan Home to " + F.elem(UtilWorld.locToStrClean(caller.getLocation())) + ".", caller.getName());
} }
@ -993,7 +1021,7 @@ public class ClansCommand extends CommandBase<ClansManager>
if (search == null) if (search == null)
{ {
_manager.getTutorials().sendTutorialMsg(caller, F.main("Clans", "You did not input a search parameter.")); _clansManager.getTutorials().sendTutorialMsg(caller, F.main("Clans", "You did not input a search parameter."));
return; return;
} }
@ -1008,20 +1036,20 @@ public class ClansCommand extends CommandBase<ClansManager>
ClanInfo clan = Plugin.getClanUtility().searchClanPlayer(caller, search, true); ClanInfo clan = Plugin.getClanUtility().searchClanPlayer(caller, search, true);
if (clan == null) return; if (clan == null) return;
_manager.getClanShop().openClanWho(caller, clan); _clansManager.getClanShop().openClanWho(caller, clan);
} }
public void forceJoinClan(Player caller, String search) public void forceJoinClan(Player caller, String search)
{ {
if (_manager.getClientManager().hasRank(caller, Rank.ADMIN)) if (_clansManager.getClientManager().hasRank(caller, Rank.ADMIN))
{ {
_manager.getTutorials().sendTutorialMsg(caller, F.main("Clans", "No no no, this command is not for you ;-)")); _clansManager.getTutorials().sendTutorialMsg(caller, F.main("Clans", "No no no, this command is not for you ;-)"));
return; return;
} }
if (search == null) if (search == null)
{ {
_manager.getTutorials().sendTutorialMsg(caller, F.main("Clans", "You did not input a search parameter.")); _clansManager.getTutorials().sendTutorialMsg(caller, F.main("Clans", "You did not input a search parameter."));
return; return;
} }
@ -1036,8 +1064,8 @@ public class ClansCommand extends CommandBase<ClansManager>
ClanInfo clan = Plugin.getClanUtility().searchClanPlayer(caller, search, true); ClanInfo clan = Plugin.getClanUtility().searchClanPlayer(caller, search, true);
if (clan == null) return; if (clan == null) return;
_manager.getClanUtility().join(caller, clan); _clansManager.getClanUtility().join(caller, clan);
_manager.getClanDataAccess().role(clan, caller.getUniqueId(), ClanRole.LEADER); _clansManager.getClanDataAccess().role(clan, caller.getUniqueId(), ClanRole.LEADER);
} }
@ -1050,7 +1078,7 @@ public class ClansCommand extends CommandBase<ClansManager>
if (clan == null) if (clan == null)
{ {
_manager.getTutorials().sendTutorialMsg(caller, F.main("Clans", "You are not in a Clan.")); _clansManager.getTutorials().sendTutorialMsg(caller, F.main("Clans", "You are not in a Clan."));
return; return;
} }
} }
@ -1060,6 +1088,13 @@ public class ClansCommand extends CommandBase<ClansManager>
if (clan == null) return; if (clan == null) return;
_manager.getTutorials().sendTutorialMsg(caller, clan.mTerritory()); if (_clansManager.getNetherManager().isInNether(caller))
{
_clansManager.message(caller, "You are currently in " + F.clansNether("The Nether") + ".");
return;
}
_clansManager.getTutorials().sendTutorialMsg(caller, clan.mTerritory());
} }
} }

View File

@ -12,7 +12,7 @@ import mineplex.game.clans.clans.gui.ClanShop;
public abstract class ClanButton implements IButton public abstract class ClanButton implements IButton
{ {
private ClanShop _shop; private ClanShop _shop;
private ClansManager _clansManager; protected ClansManager _clansManager;
private Player _player; private Player _player;
private ClanInfo _clanInfo; private ClanInfo _clanInfo;
private ClanRole _clanRole; private ClanRole _clanRole;

View File

@ -6,6 +6,7 @@ import org.bukkit.entity.Player;
import org.bukkit.event.inventory.ClickType; import org.bukkit.event.inventory.ClickType;
import mineplex.core.common.util.C; import mineplex.core.common.util.C;
import mineplex.core.common.util.F;
import mineplex.core.common.util.UtilWorld; import mineplex.core.common.util.UtilWorld;
import mineplex.game.clans.clans.ClanInfo; import mineplex.game.clans.clans.ClanInfo;
import mineplex.game.clans.clans.ClanRole; import mineplex.game.clans.clans.ClanRole;
@ -22,6 +23,13 @@ public class ClanTerritoryButton extends ClanButton
@Override @Override
public void onClick(Player player, ClickType clickType) public void onClick(Player player, ClickType clickType)
{ {
if (_clansManager.getNetherManager().isInNether(player))
{
_clansManager.message(player, "You are not allowed to do anything with Territory while in " + F.clansNether("The Nether") + ".");
player.closeInventory();
return;
}
if (clickType == ClickType.LEFT) if (clickType == ClickType.LEFT)
{ {
player.closeInventory(); player.closeInventory();

View File

@ -0,0 +1,195 @@
package mineplex.game.clans.clans.nether;
import java.io.File;
import java.util.List;
import org.bukkit.Bukkit;
import org.bukkit.GameMode;
import org.bukkit.Location;
import org.bukkit.Material;
import org.bukkit.World;
import org.bukkit.WorldBorder;
import org.bukkit.block.Block;
import org.bukkit.entity.Player;
import org.bukkit.event.EventHandler;
import org.bukkit.event.block.BlockBreakEvent;
import org.bukkit.event.player.PlayerPortalEvent;
import org.bukkit.inventory.ItemStack;
import com.google.common.collect.Lists;
import mineplex.core.MiniPlugin;
import mineplex.core.common.util.F;
import mineplex.core.common.util.UtilAlg;
import mineplex.core.common.util.UtilCollections;
import mineplex.core.common.util.UtilFile;
import mineplex.core.common.util.UtilPlayer;
import mineplex.core.common.util.UtilServer;
import mineplex.core.common.util.UtilWorld;
import mineplex.core.updater.UpdateType;
import mineplex.core.updater.event.UpdateEvent;
import mineplex.game.clans.clans.ClanTips.TipType;
import mineplex.game.clans.clans.ClansManager;
import mineplex.game.clans.core.repository.ClanTerritory;
public class NetherManager extends MiniPlugin
{
private ClansManager _clansManager;
private World _netherWorld;
private List<Portal> _portals = Lists.newArrayList();
private File _portalCfg;
public NetherManager(ClansManager clansManager)
{
super("Nether Manager", clansManager.getPlugin());
_clansManager = clansManager;
_portalCfg = new File(UtilServer.getServer().getWorlds().get(0).getWorldFolder().getPath() + File.separator + ".." + File.separator + "nether.cfg");
begin();
}
public void begin()
{
_netherWorld = Bukkit.getWorld("world_nether");
WorldBorder worldBorder = _netherWorld.getWorldBorder();
worldBorder.setCenter(0, 0);
worldBorder.setSize(200 * 2);
parsePortals();
}
private void parsePortals()
{
String data = UtilFile.read(_portalCfg);
if (data.length() < 5)
{
return;
}
UtilCollections.forEach(data.split("\n"), string -> string.trim(), sPortal -> {
String[] destinations = sPortal.split(">>");
Location from = UtilWorld.strToLoc(destinations[0]);
Location to = UtilWorld.strToLoc(destinations[1].split(":")[0]);
Portal portal = Portal.create(from, to, UtilWorld.strToLoc(to.getWorld().getName() + "," + destinations[1].split(":")[1]));
if (portal == null)
{
log("FAILED TO LOAD PORTAL [" + sPortal + "]");
}
else
{
_portals.add(portal);
}
});
}
@EventHandler
public void breakBlock(BlockBreakEvent event)
{
Block block = event.getBlock();
Player player = event.getPlayer();
ItemStack item = player.getItemInHand();
if (!block.getWorld().equals(_netherWorld))
{
return;
}
if (player.getGameMode() == GameMode.CREATIVE)
{
return;
}
if (!item.getType().equals(Material.GOLD_PICKAXE))
{
UtilPlayer.message(player, F.main("Clans", "You can only break blocks in the Nether with a " + F.elem("Golden Pickaxe") + "."));
event.setCancelled(true);
return;
}
if (block.getType().equals(Material.OBSIDIAN) || block.getType().equals(Material.PORTAL))
{
UtilPlayer.message(player, F.main("Clans", "You are not allowed to break this block."));
event.setCancelled(true);
return;
}
}
@EventHandler
public void update(UpdateEvent event)
{
if (event.getType() == UpdateType.SEC_08)
{
_portals.forEach(portal -> {
portal.getFromObsidianBlocks().forEach(block -> block.setType(Material.OBSIDIAN));
portal.getFromPortalBlocks().forEach(block -> block.setType(Material.PORTAL));
portal.getToObsidianBlocks().forEach(block -> block.setType(Material.OBSIDIAN));
portal.getToPortalBlocks().forEach(block -> block.setType(Material.PORTAL));
});
}
}
@EventHandler
public void onPortal(PlayerPortalEvent event)
{
Player player = event.getPlayer();
Location location = player.getLocation();
ClanTerritory territory = _clansManager.getClanUtility().getClaim(location);
event.setCancelled(true);
if (territory != null && territory.Owner.equals("Borderlands"))
{
if (event.getTo().getWorld().equals(_netherWorld))
{
_portals
.stream()
.filter(portal ->
portal.getToPortalBlocks()
.stream()
.filter(block -> player.getLocation().distance(block.getLocation()) <= 2)
.iterator().hasNext()
).limit(1)
.forEach(portal -> {
player.teleport(portal.getToOut());
_clansManager.ClanTips.displayTip(TipType.ENTER_NETHER, player);
});
}
else
{
_portals
.stream()
.filter(portal ->
portal.getFromPortalBlocks()
.stream()
.filter(block -> player.getLocation().distance(block.getLocation()) <= 2)
.iterator().hasNext()
).limit(1)
.forEach(portal -> {
player.teleport(UtilAlg.getAverageBlockLocation(portal.getToPortalBlocks()));
});
}
}
}
public World getNetherWorld()
{
return _netherWorld;
}
public boolean isInNether(Player player)
{
return player.getWorld().equals(_netherWorld);
}
}

View File

@ -0,0 +1,112 @@
package mineplex.game.clans.clans.nether;
import java.util.List;
import org.bukkit.Location;
import org.bukkit.Material;
import org.bukkit.block.Block;
import com.google.common.collect.Lists;
import mineplex.core.common.util.UtilBlock;
public class Portal
{
private List<Block> _fromPortalBlocks;
private List<Block> _fromObsidianBlocks;
private List<Block> _toPortalBlocks;
private List<Block> _toObsidianBlocks;
private Location _toOut;
public final boolean Success;
public Portal(Location from, Location to, Location toOut)
{
_fromPortalBlocks = Lists.newArrayList();
_fromObsidianBlocks = Lists.newArrayList();
_toPortalBlocks = Lists.newArrayList();
_toObsidianBlocks = Lists.newArrayList();
_toOut = toOut;
if (!isValidPortalBlock(from.getBlock()) || !isValidPortalBlock(to.getBlock()))
{
System.out.println("[PORTAL] INVALID PORTAL PROVIDED (" + from + " --> " + to + ")");
Success = false;
return;
}
for (Block other : UtilBlock.getInRadius(from, 7.5d).keySet())
{
if (other.getType() == Material.OBSIDIAN)
{
_fromObsidianBlocks.add(other);
}
else if (other.getType() == Material.PORTAL)
{
_fromPortalBlocks.add(other);
}
}
for (Block other : UtilBlock.getInRadius(to, 7.5d).keySet())
{
if (other.getType() == Material.OBSIDIAN)
{
_toObsidianBlocks.add(other);
}
else if (other.getType() == Material.PORTAL)
{
_toPortalBlocks.add(other);
}
}
Success = true;
}
public Location getToOut()
{
return _toOut;
}
public List<Block> getFromPortalBlocks()
{
return _fromPortalBlocks;
}
public List<Block> getFromObsidianBlocks()
{
return _fromObsidianBlocks;
}
public List<Block> getToPortalBlocks()
{
return _toPortalBlocks;
}
public List<Block> getToObsidianBlocks()
{
return _toObsidianBlocks;
}
private boolean isValidPortalBlock(Block block)
{
return block.getType() == Material.OBSIDIAN || block.getType() == Material.PORTAL;
}
public static Portal create(Location from, Location to, Location toOut)
{
Portal portal = new Portal(from, to, toOut);
if (!portal.Success)
{
return null;
}
return portal;
}
}

View File

@ -65,15 +65,11 @@ public class PvpTimer extends MiniClientPlugin<PvpTimerClient>
} }
public void disableFor(final Player caller) public void disableFor(final Player caller)
{
TaskManager.Instance.completedTask(new Callback<Boolean>() {
@Override
public void run(Boolean data)
{ {
Get(caller).Skipped = true; Get(caller).Skipped = true;
caller.playSound(caller.getLocation(), Sound.ENDERDRAGON_GROWL, 1f, 0.75f); caller.playSound(caller.getLocation(), Sound.ENDERDRAGON_GROWL, 1f, 0.75f);
}
}, caller, "PvpTimer.Skipped"); TaskManager.Instance.completedTask(null, caller, "PvpTimer.Skipped");
} }
@EventHandler @EventHandler

View File

@ -137,7 +137,7 @@ public class ClansRegions extends MiniPlugin
* @param claimOffset - the initial offset in claim (creating a 'hole' with chunk offset radius) * @param claimOffset - the initial offset in claim (creating a 'hole' with chunk offset radius)
* @param safe - whether the chunk claimed is considered a 'safe' (pvp-free) region. * @param safe - whether the chunk claimed is considered a 'safe' (pvp-free) region.
*/ */
private void claimArea(final String clanName, final int chunkRadius, final int claimOffset, final boolean safe, final boolean addNegative, final Location... locations) public void claimArea(final String clanName, final int chunkRadius, final int claimOffset, final boolean safe, final boolean addNegative, final Location... locations)
{ {
final ClanInfo clan = _manager.getClan(clanName); final ClanInfo clan = _manager.getClan(clanName);

View File

@ -44,6 +44,12 @@ public class ScoreboardElementPlayer implements ScoreboardElement
regionString += C.mBody + "(" + C.mElem + "Trusted" + C.mBody + ")"; regionString += C.mBody + "(" + C.mElem + "Trusted" + C.mBody + ")";
} }
if (_clansManager.getNetherManager().isInNether(player))
{
regionString = C.cRed + "The Nether";
}
output.add(regionString); output.add(regionString);
return output; return output;

View File

@ -10,6 +10,7 @@ import org.bukkit.event.block.BlockPlaceEvent;
import com.google.gson.Gson; import com.google.gson.Gson;
import mineplex.core.MiniPlugin; import mineplex.core.MiniPlugin;
import mineplex.core.common.util.C;
import mineplex.core.common.util.F; import mineplex.core.common.util.F;
import mineplex.core.common.util.NautHashMap; import mineplex.core.common.util.NautHashMap;
import mineplex.core.common.util.UtilInv; import mineplex.core.common.util.UtilInv;
@ -17,10 +18,8 @@ import mineplex.core.common.util.UtilMath;
import mineplex.core.common.util.UtilPlayer; import mineplex.core.common.util.UtilPlayer;
import mineplex.core.updater.UpdateType; import mineplex.core.updater.UpdateType;
import mineplex.core.updater.event.UpdateEvent; import mineplex.core.updater.event.UpdateEvent;
import mineplex.game.clans.clans.ClansBlacklist;
import mineplex.game.clans.clans.ClansManager; import mineplex.game.clans.clans.ClansManager;
import mineplex.game.clans.clans.siege.commands.CommandSiegeSupplies; import mineplex.game.clans.clans.siege.commands.CommandSiegeSupplies;
import mineplex.game.clans.clans.siege.events.SiegeWeaponExplodeEvent;
import mineplex.game.clans.clans.siege.outpost.OutpostManager; import mineplex.game.clans.clans.siege.outpost.OutpostManager;
import mineplex.game.clans.clans.siege.repository.SiegeWeaponRepository; import mineplex.game.clans.clans.siege.repository.SiegeWeaponRepository;
import mineplex.game.clans.clans.siege.repository.tokens.SiegeWeaponToken; import mineplex.game.clans.clans.siege.repository.tokens.SiegeWeaponToken;
@ -45,7 +44,7 @@ public class SiegeManager extends MiniPlugin
public SiegeManager(ClansManager clans) public SiegeManager(ClansManager clans)
{ {
super("Siege", clans.getPlugin()); super("Siege Manager", clans.getPlugin());
_gson = new Gson(); _gson = new Gson();
@ -171,6 +170,13 @@ public class SiegeManager extends MiniPlugin
public boolean trySpawnCannon(Player player, Location location) public boolean trySpawnCannon(Player player, Location location)
{ {
if (_clansManager.getNetherManager().isInNether(player))
{
_clansManager.message(player, "You are not allowed to place this in " + F.clansNether("The Nether") + ".");
return false;
}
if (!_clansManager.isInClan(player)) if (!_clansManager.isInClan(player))
{ {
UtilPlayer.message(player, F.main("Clans", "You must be in a Clan to place a Cannon.")); UtilPlayer.message(player, F.main("Clans", "You must be in a Clan to place a Cannon."));
@ -199,6 +205,13 @@ public class SiegeManager extends MiniPlugin
public boolean trySpawnCatapult(Player player, Location location) public boolean trySpawnCatapult(Player player, Location location)
{ {
if (_clansManager.getNetherManager().isInNether(player))
{
_clansManager.message(player, "You are not allowed to place this in " + F.clansNether("The Nether") + ".");
return false;
}
if (!_clansManager.isInClan(player)) if (!_clansManager.isInClan(player))
{ {
UtilPlayer.message(player, F.main("Clans", "You must be in a Clan to place a Catapult.")); UtilPlayer.message(player, F.main("Clans", "You must be in a Clan to place a Catapult."));

View File

@ -18,6 +18,7 @@ import org.bukkit.inventory.ItemStack;
import com.google.common.collect.Lists; import com.google.common.collect.Lists;
import mineplex.core.MiniPlugin; import mineplex.core.MiniPlugin;
import mineplex.core.common.util.C;
import mineplex.core.common.util.F; import mineplex.core.common.util.F;
import mineplex.core.common.util.NautHashMap; import mineplex.core.common.util.NautHashMap;
import mineplex.core.common.util.UtilAlg; import mineplex.core.common.util.UtilAlg;
@ -79,6 +80,13 @@ public class OutpostManager extends MiniPlugin
public boolean spawnOutpost(Player player, Location location, OutpostType type) public boolean spawnOutpost(Player player, Location location, OutpostType type)
{ {
if (_clansManager.getNetherManager().isInNether(player))
{
_clansManager.message(player, "You are not allowed to place this in " + F.clansNether("The Nether") + ".");
return false;
}
if (!_clansManager.isInClan(player)) if (!_clansManager.isInClan(player))
{ {
UtilPlayer.message(player, F.main("Clans", "You must be in a Clan to place an Outpost.")); UtilPlayer.message(player, F.main("Clans", "You must be in a Clan to place an Outpost."));

View File

@ -246,6 +246,11 @@ public class Gameplay extends MiniPlugin
@EventHandler(priority = EventPriority.LOWEST) @EventHandler(priority = EventPriority.LOWEST)
public void ObsidianCancel(BlockPlaceEvent event) public void ObsidianCancel(BlockPlaceEvent event)
{ {
if (_clansManager.masterBypass(event.getPlayer()))
{
return;
}
if (event.getBlock().getType() == Material.OBSIDIAN) if (event.getBlock().getType() == Material.OBSIDIAN)
{ {
UtilPlayer.message(event.getPlayer(), F.main("Game", "You cannot place " + F.item("Obsidian") + ".")); UtilPlayer.message(event.getPlayer(), F.main("Game", "You cannot place " + F.item("Obsidian") + "."));

View File

@ -0,0 +1,25 @@
package test;
import java.io.ByteArrayOutputStream;
import java.io.DataOutputStream;
import java.io.IOException;
public class Test {
public static void main(String[] args) throws IOException
{
ByteArrayOutputStream stream = new ByteArrayOutputStream();
DataOutputStream dos = new DataOutputStream(stream);
dos.writeByte(91);
dos.flush();
stream.flush();
System.out.println(new String(stream.toByteArray()));
dos.close();
stream.close();
}
}