Fix merge-related errors

Fix, polish, and re-implement Elo code.
This commit is contained in:
Joseph Prezioso Jr. 2016-04-07 16:40:30 -04:00
parent 91e550bdcc
commit 59001bdef6
237 changed files with 2512 additions and 1913 deletions

View File

@ -56,12 +56,12 @@ public class MotdManager implements Listener, Runnable
//String motdLine = "§f§l◄ §c§lMaintenance§f§l ►"; //String motdLine = "§f§l◄ §c§lMaintenance§f§l ►";
//String motdLine = "§f§l◄ §a§lCarl the Creeper§f§l ►"; //String motdLine = "§f§l◄ §a§lCarl the Creeper§f§l ►";
// String motdLine = " §2§l§n M O N S T E R M A Z E B E T A §f"; // String motdLine = " §2§l§n M O N S T E R M A Z E B E T A §f";
String motdLine = " §f❄ §2§lMerry Christmas §f❄ §2§lElf Presents §f❄"; String motdLine = " §f> §4§lCLANS BETA §f- §c§lOpen to Everyone §f<";
// String motdLine = " §f❄ §2§lServer Maintenance §f❄ §2§lBe Back Soon §f❄"; // String motdLine = " §f❄ §2§lServer Maintenance §f❄ §2§lBe Back Soon §f❄";
//String motdLine = " §d§lRank Sale §a§l40% Off"); //String motdLine = " §d§lRank Sale §a§l40% Off");
//String motdLine = " §f§l◄§c§lMAINTENANCE§f§l►"); //String motdLine = " §f§l◄§c§lMAINTENANCE§f§l►");
updateMainMotd(" §c§m §f§m §c§m §f§m §2§l§m[ §r §c§lMineplex§r §f§lGames§r §2§l§m ]§f§m §c§m §f§m §c§m §r", motdLine); updateMainMotd(" §f§m §8§l§m[ §r §9§lMineplex§r §f§lGames§r §8§l§m ]§f§m §r", motdLine);
System.out.println("Updated Bungee MOTD"); System.out.println("Updated Bungee MOTD");
} }
} }

View File

@ -69,7 +69,7 @@ public class PlayerCache
PlayerInfo info = getPlayer(uuid); PlayerInfo info = getPlayer(uuid);
return info == null ? -1 : info.getAccountId(); return info == null ? -1 : info.getAccountId();
} }
public void clean() public void clean()
{ {
_repository.clean(); _repository.clean();

View File

@ -3,9 +3,9 @@ package mineplex.core.common.block.schematic;
import org.bukkit.DyeColor; import org.bukkit.DyeColor;
import org.bukkit.Location; import org.bukkit.Location;
import org.bukkit.Material; import org.bukkit.Material;
import org.bukkit.block.Block;
import mineplex.core.common.block.DataLocationMap; import mineplex.core.common.block.DataLocationMap;
import mineplex.core.common.util.UtilBlock;
public class Schematic public class Schematic
{ {
@ -24,7 +24,7 @@ public class Schematic
_blockData = blockData; _blockData = blockData;
} }
public DataLocationMap paste(Location originLocation) public DataLocationMap paste(Location originLocation, boolean ignoreAir)
{ {
DataLocationMap locationMap = new DataLocationMap(); DataLocationMap locationMap = new DataLocationMap();
@ -43,31 +43,46 @@ public class Schematic
// not sure why but the math.abs is my simple fix // not sure why but the math.abs is my simple fix
int materialId = Math.abs(_blocks[index]); int materialId = Math.abs(_blocks[index]);
Material material = Material.getMaterial(materialId); if (ignoreAir && materialId == 0) // Air
if (material == null)
{ {
System.err.println("Schematic: Could not find Material [id: " + materialId + " data: " + _blockData[index] + "]");
continue; continue;
} }
else if (material == Material.GOLD_PLATE) else if (materialId == 147) // Gold Plate
{ {
// Check for data wool at location below the gold plate // Check for data wool at location below the gold plate
if (addDataWool(locationMap, originLocation, x, y - 1, z)) if (addDataWool(locationMap, true, originLocation, x, y - 1, z))
continue; continue;
} }
else if (material == Material.WOOL) else if (materialId == 148) // Iron Plate
{
// Check for data wool at location below the gold plate
if (addDataWool(locationMap, false, originLocation, x, y - 1, z))
continue;
}
else if (materialId == Material.SPONGE.getId())
{
if (addSpongeLocation(locationMap, originLocation, x, y + 1, z))
continue;
}
else if (materialId == 35)
{ {
// Check if this is a dataloc so we can skip setting the block // Check if this is a dataloc so we can skip setting the block
int aboveIndex = getIndex(x, y + 1, z); int aboveIndex = getIndex(x, y + 1, z);
if (hasIndex(aboveIndex)) if (hasIndex(aboveIndex))
{ {
if (Math.abs(_blocks[aboveIndex]) == Material.GOLD_PLATE.getId()) if (Math.abs(_blocks[aboveIndex]) == Material.GOLD_PLATE.getId() || Math.abs(_blocks[aboveIndex]) == Material.IRON_PLATE.getId())
continue;
}
int belowIndex = getIndex(x, y - 1, z);
if (hasIndex(belowIndex))
{
if(Math.abs(_blocks[belowIndex]) == Material.SPONGE.getId())
continue; continue;
} }
} }
Block block = originLocation.getWorld().getBlockAt(startX + x, startY + y, startZ + z);
block.setTypeIdAndData(materialId, _blockData[index], false); UtilBlock.setQuick(originLocation.getWorld(), startX + x, startY + y, startZ + z, materialId, _blockData[index]);
} }
} }
} }
@ -80,7 +95,7 @@ public class Schematic
* *
* @return true if a location was added to the DataLocationMap * @return true if a location was added to the DataLocationMap
*/ */
private boolean addDataWool(DataLocationMap map, Location origin, int x, int y, int z) private boolean addDataWool(DataLocationMap map, boolean gold, Location origin, int x, int y, int z)
{ {
int index = getIndex(x, y, z); int index = getIndex(x, y, z);
if (hasIndex(index)) if (hasIndex(index))
@ -92,7 +107,34 @@ public class Schematic
DyeColor color = DyeColor.getByWoolData(data); DyeColor color = DyeColor.getByWoolData(data);
if (color != null) if (color != null)
{ {
map.addLocation(color, origin.clone().add(x + 0.5, y + 0.5, z + 0.5)); if (gold)
{
map.addGoldLocation(color, origin.clone().add(x, y, z));
}
else
{
map.addIronLocation(color, origin.clone().add(x, y, z));
}
return true;
}
}
}
return false;
}
private boolean addSpongeLocation(DataLocationMap map, Location origin, int x, int y, int z)
{
int index = getIndex(x, y, z);
if (hasIndex(index))
{
int materialId = Math.abs(_blocks[index]);
if (materialId == 35) // WOOL
{
byte data = _blockData[index];
DyeColor color = DyeColor.getByWoolData(data);
if (color != null)
{
map.addSpongeLocation(color, origin.clone().add(x, y - 1, z));
return true; return true;
} }
} }

View File

@ -19,7 +19,6 @@ import net.minecraft.server.v1_8_R3.NBTTagString;
public class SkinData public class SkinData
{ {
private static long _nameCount = -99999999999999L; private static long _nameCount = -99999999999999L;
public final static SkinData MOOSHROOM = new SkinData("eyJ0aW1lc3RhbXAiOjE0NDk4NzI0OTU0MTcsInByb2ZpbGVJZCI6ImE5ZDBjMDcyYmYxOTQwYTFhMTkzNjhkMDlkNTAwMjZlIiwicHJvZmlsZU5hbWUiOiJTcGlyaXR1c1NhbmN0dXMiLCJzaWduYXR1cmVSZXF1aXJlZCI6dHJ1ZSwidGV4dHVyZXMiOnsiU0tJTiI6eyJ1cmwiOiJodHRwOi8vdGV4dHVyZXMubWluZWNyYWZ0Lm5ldC90ZXh0dXJlLzIxOWJlYTU0Y2FkN2Q1OGFiNWRhNDA2YjBhOTJhYjNhODI0MjI1MjY2Nzc3ZTUzNGI3ZGI2YzM3MmRkZmY3ZiJ9fX0=","UoSif81+UyvkcaanU8KAMYBpw9mefAmWehE2liDUFvk+y0X/9NovsxTYVpIDCltTSpLW3sNgamvbj4Ybs+s6DbudPiEkvh0ER7Bv2v29UJw7RzIdr6/1g548X12zcnh5iPGz/P75uNRnSfTFQx0ed8P/GNkPIjWpDuJFxEj6KcPzrCAGMx+BVw1VwryBIYf9cCDHky8z0bxR89rjiIvPTBFI6MRhqI3vgpEBTySHDS+Ki0Hwl5oa3PwS6+jgYx/4RSfFsb+BawcvDk2Xpkt5UimvqZ5BceYLIfCt4KbShYipgLXLfYUZrntjPemd3SxthjxUuA07i44UxRdiC8uqy1twLT/HUS28gpk68lA/id9tKFwu1CUzshgcmvQPt3ghtNViNziR/2t7D/+5D31Vzmhf6n7Pnpdirt/5frMi2BKMMs7pLa0EF8CrrDU7QCwPav+EZVGFvVZbxSkCDq+n3IQ3PUWSCzy6KPxpdOlUjD0pAfLoiNj0P8u4+puQtID76r/St8ExchYl2dodUImu1ZETWeFUClF3ZGat62evx8uRQEI2W4dsVwj40VUfjaAuvyDzuouaKTrCzJXLQZZjR1B8URvuK61fGX0nhW607mEi6DE+nxP2ZoBrROEX4e37Ap6+TQn9Q8tKDPdcxtwSOpPO4Qkncjn/mGtP9lZU/DQ="); public final static SkinData MOOSHROOM = new SkinData("eyJ0aW1lc3RhbXAiOjE0NDk4NzI0OTU0MTcsInByb2ZpbGVJZCI6ImE5ZDBjMDcyYmYxOTQwYTFhMTkzNjhkMDlkNTAwMjZlIiwicHJvZmlsZU5hbWUiOiJTcGlyaXR1c1NhbmN0dXMiLCJzaWduYXR1cmVSZXF1aXJlZCI6dHJ1ZSwidGV4dHVyZXMiOnsiU0tJTiI6eyJ1cmwiOiJodHRwOi8vdGV4dHVyZXMubWluZWNyYWZ0Lm5ldC90ZXh0dXJlLzIxOWJlYTU0Y2FkN2Q1OGFiNWRhNDA2YjBhOTJhYjNhODI0MjI1MjY2Nzc3ZTUzNGI3ZGI2YzM3MmRkZmY3ZiJ9fX0=","UoSif81+UyvkcaanU8KAMYBpw9mefAmWehE2liDUFvk+y0X/9NovsxTYVpIDCltTSpLW3sNgamvbj4Ybs+s6DbudPiEkvh0ER7Bv2v29UJw7RzIdr6/1g548X12zcnh5iPGz/P75uNRnSfTFQx0ed8P/GNkPIjWpDuJFxEj6KcPzrCAGMx+BVw1VwryBIYf9cCDHky8z0bxR89rjiIvPTBFI6MRhqI3vgpEBTySHDS+Ki0Hwl5oa3PwS6+jgYx/4RSfFsb+BawcvDk2Xpkt5UimvqZ5BceYLIfCt4KbShYipgLXLfYUZrntjPemd3SxthjxUuA07i44UxRdiC8uqy1twLT/HUS28gpk68lA/id9tKFwu1CUzshgcmvQPt3ghtNViNziR/2t7D/+5D31Vzmhf6n7Pnpdirt/5frMi2BKMMs7pLa0EF8CrrDU7QCwPav+EZVGFvVZbxSkCDq+n3IQ3PUWSCzy6KPxpdOlUjD0pAfLoiNj0P8u4+puQtID76r/St8ExchYl2dodUImu1ZETWeFUClF3ZGat62evx8uRQEI2W4dsVwj40VUfjaAuvyDzuouaKTrCzJXLQZZjR1B8URvuK61fGX0nhW607mEi6DE+nxP2ZoBrROEX4e37Ap6+TQn9Q8tKDPdcxtwSOpPO4Qkncjn/mGtP9lZU/DQ=");
@ -33,6 +32,9 @@ public class SkinData
public final static SkinData LOVESTRUCK = new SkinData("eyJ0aW1lc3RhbXAiOjE0NTUxMTAyNDMyNjUsInByb2ZpbGVJZCI6ImE5ZDBjMDcyYmYxOTQwYTFhMTkzNjhkMDlkNTAwMjZlIiwicHJvZmlsZU5hbWUiOiJTcGlyaXR1c1NhbmN0dXMiLCJzaWduYXR1cmVSZXF1aXJlZCI6dHJ1ZSwidGV4dHVyZXMiOnsiU0tJTiI6eyJ1cmwiOiJodHRwOi8vdGV4dHVyZXMubWluZWNyYWZ0Lm5ldC90ZXh0dXJlLzczMTY5YWQwZTUyYjM1N2NiZGYxZDU0NGVkNGNmOWJmOTI4YmI0ZWNlMDhlY2YyY2M0YmYyYTlmMjJhODI4MmQifX19", "LL4RiSKQoTZamRQ4QG6izpvhgFu5gAqW4eZxcWAihk7GkhyxifpJpBTOzKrj5hH9fCUfYkkijVWUYTEcVSVRWhocp2HXW59TbKfxOeMvHU5vTMwgpwm6PnUfwuTsRPSLC7WMnEreI3cjOxPVmXbTniOSd+o8j4oOIgwFS+VLPiYLh5Jl16i5I/9ekafl3/x41NISKWl62geqO2jPWehlk+r3soiRJsxaKw20T61GSNLu19iA96Rz2T2tUHB4opm8hbLgoiNL2g1affTjq3cZPLHH4JWF3vPhqLB5uw6xb55vFLM/PP0YiEMIi7YZOfRGeaPp7uXbXgHeew+7PG9UDVMfqbwANQY4ndECijZoei54+xX3MDXkMhQsc5S+FLnGH6e4d008v81eEOyzJUPkKbGxLCBgTUb1s4IHwomCr30twPlo1IuFBOY1qeVvZUfAfPJsREuj5q/oCAoYFgupmb3ClWECnwwaH/T4wdHjfSBHoZQdLzcgDOAl0b5EXxWmYBECqk/WA4TrYIDVGdwkqjI0RkPLUoxTj6135KO+F7P7PwhU9WBGeW8hHq918DBL0fjQVHjrzvolTqwmw6nySSePnPOxFX/iwtHWzpBa9V6kUNNN+V7OGTgRr0H/yUxB+oq1F8UBqyqT4YpqxXCSD36derF/Xt5IdpTbEbGBpm0="); public final static SkinData LOVESTRUCK = new SkinData("eyJ0aW1lc3RhbXAiOjE0NTUxMTAyNDMyNjUsInByb2ZpbGVJZCI6ImE5ZDBjMDcyYmYxOTQwYTFhMTkzNjhkMDlkNTAwMjZlIiwicHJvZmlsZU5hbWUiOiJTcGlyaXR1c1NhbmN0dXMiLCJzaWduYXR1cmVSZXF1aXJlZCI6dHJ1ZSwidGV4dHVyZXMiOnsiU0tJTiI6eyJ1cmwiOiJodHRwOi8vdGV4dHVyZXMubWluZWNyYWZ0Lm5ldC90ZXh0dXJlLzczMTY5YWQwZTUyYjM1N2NiZGYxZDU0NGVkNGNmOWJmOTI4YmI0ZWNlMDhlY2YyY2M0YmYyYTlmMjJhODI4MmQifX19", "LL4RiSKQoTZamRQ4QG6izpvhgFu5gAqW4eZxcWAihk7GkhyxifpJpBTOzKrj5hH9fCUfYkkijVWUYTEcVSVRWhocp2HXW59TbKfxOeMvHU5vTMwgpwm6PnUfwuTsRPSLC7WMnEreI3cjOxPVmXbTniOSd+o8j4oOIgwFS+VLPiYLh5Jl16i5I/9ekafl3/x41NISKWl62geqO2jPWehlk+r3soiRJsxaKw20T61GSNLu19iA96Rz2T2tUHB4opm8hbLgoiNL2g1affTjq3cZPLHH4JWF3vPhqLB5uw6xb55vFLM/PP0YiEMIi7YZOfRGeaPp7uXbXgHeew+7PG9UDVMfqbwANQY4ndECijZoei54+xX3MDXkMhQsc5S+FLnGH6e4d008v81eEOyzJUPkKbGxLCBgTUb1s4IHwomCr30twPlo1IuFBOY1qeVvZUfAfPJsREuj5q/oCAoYFgupmb3ClWECnwwaH/T4wdHjfSBHoZQdLzcgDOAl0b5EXxWmYBECqk/WA4TrYIDVGdwkqjI0RkPLUoxTj6135KO+F7P7PwhU9WBGeW8hHq918DBL0fjQVHjrzvolTqwmw6nySSePnPOxFX/iwtHWzpBa9V6kUNNN+V7OGTgRr0H/yUxB+oq1F8UBqyqT4YpqxXCSD36derF/Xt5IdpTbEbGBpm0=");
public final static SkinData SECRET_PACKAGE = new SkinData("eyJ0aW1lc3RhbXAiOjE0NTUxMTAzNzE3OTIsInByb2ZpbGVJZCI6ImE5ZDBjMDcyYmYxOTQwYTFhMTkzNjhkMDlkNTAwMjZlIiwicHJvZmlsZU5hbWUiOiJTcGlyaXR1c1NhbmN0dXMiLCJzaWduYXR1cmVSZXF1aXJlZCI6dHJ1ZSwidGV4dHVyZXMiOnsiU0tJTiI6eyJ1cmwiOiJodHRwOi8vdGV4dHVyZXMubWluZWNyYWZ0Lm5ldC90ZXh0dXJlL2QyNWI5YTRjOWRhOThkZTliZmIwZDNjOWI1M2MzMjJhMjgxN2IyMTMxOTQzY2E1YWM2NTBjZThmMzEzZjdhIn19fQ==", "Wb5T0Zhp1RVt78V/i8dYrwZCNT0xZIRe3LvL0bngH498f8Jrl43KHgTi4f299zE9giVynkTogGhJ8inq/xqFCRctl7Nn9L3LVu78uQwt+fs+o+kw/Qc+lggFSjEIc+fc13AZndpec0Df46Kh/OGD7NXbtbLb6TE/0dU2RwQlvZrZ/QHYJb8OJ6aUcnHvAZim8NUtG/nlZtSClepHVSuKdNnfzoF9rFVFA/x4jTr6mZYPZ33YgQd2oTAPk+qE3iN+0InjZQNs2YLoKFmFrgzn+tGvNApC0siF0HEZGQCFIwJOtnBsasGoxujIrln/ZdOil+5ac4VWInXr8lKgY0Q3Ocy8/0cJl+E/XqB+ztG29zhB8B1zdHBfJr+MgeSIqBCPx4SCtY6r7gnMlQYG+uVx5NP3S5aJW/cEfDyXmpCykIcBPzeErnKC0SiAqXkCVNjWJpX6qRWvWMXqS69w6ht6qHvEY2GxlZUb5AP+JgFlsl3hJDms6EPvM4zNL0Ko4oWIBzwYRQXiemrP9TGgyo0aL1RcQ0JgBFO2hSo37PK0YL3tUPgteJXzm21wu0TiZLkLCWSgMUfYfvVnhTa+xzod0xvfujpN6Y1DUTdcf8WS8TRYw2JigSkWrRW0fXPBCtTtQN5jiwM5/HrTpNLzg03J6SpfZ+rr8Rhq0S/8beQOMas="); public final static SkinData SECRET_PACKAGE = new SkinData("eyJ0aW1lc3RhbXAiOjE0NTUxMTAzNzE3OTIsInByb2ZpbGVJZCI6ImE5ZDBjMDcyYmYxOTQwYTFhMTkzNjhkMDlkNTAwMjZlIiwicHJvZmlsZU5hbWUiOiJTcGlyaXR1c1NhbmN0dXMiLCJzaWduYXR1cmVSZXF1aXJlZCI6dHJ1ZSwidGV4dHVyZXMiOnsiU0tJTiI6eyJ1cmwiOiJodHRwOi8vdGV4dHVyZXMubWluZWNyYWZ0Lm5ldC90ZXh0dXJlL2QyNWI5YTRjOWRhOThkZTliZmIwZDNjOWI1M2MzMjJhMjgxN2IyMTMxOTQzY2E1YWM2NTBjZThmMzEzZjdhIn19fQ==", "Wb5T0Zhp1RVt78V/i8dYrwZCNT0xZIRe3LvL0bngH498f8Jrl43KHgTi4f299zE9giVynkTogGhJ8inq/xqFCRctl7Nn9L3LVu78uQwt+fs+o+kw/Qc+lggFSjEIc+fc13AZndpec0Df46Kh/OGD7NXbtbLb6TE/0dU2RwQlvZrZ/QHYJb8OJ6aUcnHvAZim8NUtG/nlZtSClepHVSuKdNnfzoF9rFVFA/x4jTr6mZYPZ33YgQd2oTAPk+qE3iN+0InjZQNs2YLoKFmFrgzn+tGvNApC0siF0HEZGQCFIwJOtnBsasGoxujIrln/ZdOil+5ac4VWInXr8lKgY0Q3Ocy8/0cJl+E/XqB+ztG29zhB8B1zdHBfJr+MgeSIqBCPx4SCtY6r7gnMlQYG+uVx5NP3S5aJW/cEfDyXmpCykIcBPzeErnKC0SiAqXkCVNjWJpX6qRWvWMXqS69w6ht6qHvEY2GxlZUb5AP+JgFlsl3hJDms6EPvM4zNL0Ko4oWIBzwYRQXiemrP9TGgyo0aL1RcQ0JgBFO2hSo37PK0YL3tUPgteJXzm21wu0TiZLkLCWSgMUfYfvVnhTa+xzod0xvfujpN6Y1DUTdcf8WS8TRYw2JigSkWrRW0fXPBCtTtQN5jiwM5/HrTpNLzg03J6SpfZ+rr8Rhq0S/8beQOMas=");
public final static SkinData CHISS = new SkinData("eyJ0aW1lc3RhbXAiOjE0NTk1NDI5NjgyNDEsInByb2ZpbGVJZCI6IjFkMmJmZTYxN2ViZDQ0NWRiYTdkODM1NGEwZmZkMWVhIiwicHJvZmlsZU5hbWUiOiJDaGlzcyIsInNpZ25hdHVyZVJlcXVpcmVkIjp0cnVlLCJ0ZXh0dXJlcyI6eyJTS0lOIjp7InVybCI6Imh0dHA6Ly90ZXh0dXJlcy5taW5lY3JhZnQubmV0L3RleHR1cmUvOTg3MmNkMzRjY2IzMTIxYjRjNmEzOGFjM2JmOGVkM2UwMzk3YmQ2YTg4NDI4YjdhZmM2ZTUyNTI4NTVhMzQzIiwibWV0YWRhdGEiOnsibW9kZWwiOiJzbGltIn19fX0=", "hNTLRA2acZYx2dM90lnJN8FMK/ceD3+AxKNdD5FrXzxGtYL4C1Jr/vbTE0UosmwFP3wScNEW/fuDOjeZRjZHMJdvgDZMlMK/5KDhOY6sj/RS9RckztsgummSyjH/hdDn7TWWfhZLMbiia/K0VReI9eq2yD6zGQpvMlz5hB/5SX5YHWXvCah3TL4UzYSlSVDlwY/Q3sVuIZUr8m/LIXJwniJKLGo6tUgtiJd9eseOsbBpVjzCUtLD8A9WBe2/eODgmLfqEvXESIoDRG8vL2nPSXWma/YolYHIl32/i+ZxVD7dRRaXQFYSiLI24EtzX1pPhMjyaTLazP9abH43J6J31w02pKM7N/xTa62020L/YfRRKGT5lygEDb1NMoSpAjszPxah+Ra2/L+yUWEI8cMES6I4mIJ00tclPjWK01xhIn3tqg+y2gqsGHwPhu/7vmF5NirNfKFw0qciKNBfbCAF7ae+mkUKjmAPuvBUBqQb7BOcpNVWsCo/XvzmiZZYsf5P4Uwz8LqUK4uH6V/5dg7lY2Xg3+IUylsrDqLGFDI8iy/NdjIQMbuRadh4IDO6DcmxBri2Ax4JNBPBTnRezge8uq37MZcft/IXQgFWKB9RtidVEACaTOkRj27k+Ojnkki+j44k0wZB47hiXFUHMCHl3a0SVdQe15ZbVsQj/HAvAS0=");
public final static SkinData DEFEK7 = new SkinData("eyJ0aW1lc3RhbXAiOjE0NTk1NDI3ODkwNTksInByb2ZpbGVJZCI6Ijg5ZDQ2M2Y3MjNlYzQ3MGE4MjQ0NDU3ZjBjOGQ4NjFjIiwicHJvZmlsZU5hbWUiOiJkZWZlazciLCJzaWduYXR1cmVSZXF1aXJlZCI6dHJ1ZSwidGV4dHVyZXMiOnsiU0tJTiI6eyJ1cmwiOiJodHRwOi8vdGV4dHVyZXMubWluZWNyYWZ0Lm5ldC90ZXh0dXJlL2JmYWNjOWM4ZjhlY2E1OWU0NTE4MTUxZmE4OGFiMDZjOTFmNjM3OTE2NzJmMTRlNGYzODY3YTI2OTVlN2NmYmYifSwiQ0FQRSI6eyJ1cmwiOiJodHRwOi8vdGV4dHVyZXMubWluZWNyYWZ0Lm5ldC90ZXh0dXJlLzIyYjljNWVhNzYzYzg2ZmM1Y2FlYTMzZDgyYjBmYTY1YTdjMjI4ZmQzMjFiYTU0NzY2ZWE5NWEzZDBiOTc5MyJ9fX0=", "jBoRvkhQXz+nap8yJJIZ+4HClMItWODumeSOYjXytP3WWKHK0UMq0xC/keXsnmvo89lMRdRbknPt2ZX5Flgyjgr4Rt0KtDvpL/hG4BUsTWryUZZMKxdd6DkZXYRtTogLUfHeDYIz+cZQ0aXGMtvX/ZYTXJfMi6FYbIHY/qEEDnWhDX5y+SPpaJaZByPsvzi+qbfcFGnJ6nqi9ccyZYnYpnI2IVBM/yO/VRXWHxfqvJ0VVvv5KsGmVbko2Jxo0SDCxUL2UTH2+eol53FxhkkC+m2geC14k1zsZQLHDF3BgAG9+kFJ4UEoYRKF2Gy1FxeDCJtjYNdrYR8fdaUKRMcpBgEs+ZGe2U9EVVS/ZcBCjB7S+1Ne2bPzPFzTQPuBoMgggo1xbxBmQ5NyhYo4gwgj/xjSLIhb+5h7ioN1URfSRcfYdVv6RRO9l/u9l09jEom8y/jGRviefpEr+/e9iAl5Dd/6nzQgosBQja3NSfqYZmyuet2eI9zu61CObDTpR6yaCbNgBe/lWofRfULdpJpgjb4UNTBom3q82FcCiOe02OekGPw4+YlilhICBhajF5JzN8FKAdqI1osDcX3KuJgikYIW3voNaOP5YN3GXgilJNdou20KFC8ICq68HglgX7/0rLrWKIEoswnINIM6HcJbQuXncVPwQhV6K34Hlt/Na60=");
private Property _skinProperty; private Property _skinProperty;
public SkinData(String value, String signature) public SkinData(String value, String signature)

View File

@ -88,7 +88,7 @@ public class ProfileLoader
} }
catch (Exception e) catch (Exception e)
{ {
; // Failed to load skin e.printStackTrace();
} }
} }

View File

@ -2,11 +2,14 @@ package mineplex.core.common.util;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.Collection; import java.util.Collection;
import java.util.Collections;
import java.util.Comparator; import java.util.Comparator;
import java.util.LinkedList; import java.util.LinkedList;
import java.util.List; import java.util.List;
import java.util.Random;
import java.util.Set; import java.util.Set;
import java.util.TreeSet; import java.util.TreeSet;
import java.util.stream.Stream;
import org.bukkit.Location; import org.bukkit.Location;
import org.bukkit.block.Block; import org.bukkit.block.Block;
@ -168,6 +171,34 @@ public class UtilAlg
return element; return element;
} }
public static List<Block> getBox(Block cornerA, Block cornerB)
{
if (cornerA == null || cornerB == null || (cornerA.getWorld() != cornerB.getWorld()))
return Collections.emptyList();
ArrayList<Block> list = new ArrayList<>();
int minX = Math.min(cornerA.getX(), cornerB.getX());
int minY = Math.min(cornerA.getY(), cornerB.getY());
int minZ = Math.min(cornerA.getZ(), cornerB.getZ());
int maxX = Math.max(cornerA.getX(), cornerB.getX());
int maxY = Math.max(cornerA.getY(), cornerB.getY());
int maxZ = Math.max(cornerA.getZ(), cornerB.getZ());
for (int x = minX; x <= maxX; x++)
{
for (int y = minY; y <= maxY; y++)
{
for (int z = minZ; z <= maxZ; z++)
{
list.add(cornerA.getWorld().getBlockAt(x, y, z));
}
}
}
return list;
}
public static boolean inBoundingBox(Location loc, Location cornerA, Location cornerB) public static boolean inBoundingBox(Location loc, Location cornerA, Location cornerB)
{ {
if (loc.getX() <= Math.min(cornerA.getX(), cornerB.getX())) return false; if (loc.getX() <= Math.min(cornerA.getX(), cornerB.getX())) return false;
@ -582,4 +613,13 @@ 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 getRandomLocation(Location center, int radius)
{
Random r = new Random();
int x = r.nextInt(radius * 2) - radius;
int y = r.nextInt(radius * 2) - radius;
int z = r.nextInt(radius * 2) - radius;
return center.clone().add(x, y, z);
}
} }

View File

@ -3,6 +3,7 @@ package mineplex.core.common.util;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.HashMap; import java.util.HashMap;
import java.util.HashSet; import java.util.HashSet;
import java.util.Queue;
import org.bukkit.Location; import org.bukkit.Location;
import org.bukkit.Material; import org.bukkit.Material;
@ -30,6 +31,7 @@ import org.bukkit.material.Bed;
import net.minecraft.server.v1_8_R3.BlockPosition; import net.minecraft.server.v1_8_R3.BlockPosition;
import net.minecraft.server.v1_8_R3.Blocks; import net.minecraft.server.v1_8_R3.Blocks;
import net.minecraft.server.v1_8_R3.EnumDirection; import net.minecraft.server.v1_8_R3.EnumDirection;
import net.minecraft.server.v1_8_R3.IBlockData;
import net.minecraft.server.v1_8_R3.Item; import net.minecraft.server.v1_8_R3.Item;
import net.minecraft.server.v1_8_R3.MathHelper; import net.minecraft.server.v1_8_R3.MathHelper;
import net.minecraft.server.v1_8_R3.MinecraftKey; import net.minecraft.server.v1_8_R3.MinecraftKey;
@ -1463,4 +1465,19 @@ public class UtilBlock
return state.update(false, false); return state.update(false, false);
} }
public static void setQuick(World world, int x, int y, int z, int type, byte data)
{
int cx = x >> 4;
int cz = z >> 4;
if (!world.isChunkLoaded(cx, cz))
{
world.loadChunk(cx, cz, true);
}
net.minecraft.server.v1_8_R3.Chunk chunk = ((CraftWorld) world).getHandle().getChunkAt(x >> 4, z >> 4);
BlockPosition pos = new BlockPosition(x, y, z);
IBlockData ibd = net.minecraft.server.v1_8_R3.Block.getById(type).fromLegacyData(data);
chunk.a(pos, ibd);
}
} }

View File

@ -5,24 +5,6 @@ import java.util.HashMap;
import java.util.LinkedList; import java.util.LinkedList;
import java.util.List; import java.util.List;
import net.minecraft.server.v1_8_R3.AxisAlignedBB;
import net.minecraft.server.v1_8_R3.EntityBat;
import net.minecraft.server.v1_8_R3.EntityCreature;
import net.minecraft.server.v1_8_R3.EntityEnderDragon;
import net.minecraft.server.v1_8_R3.EntityHuman;
import net.minecraft.server.v1_8_R3.EntityInsentient;
import net.minecraft.server.v1_8_R3.EntityLiving;
import net.minecraft.server.v1_8_R3.EntityTrackerEntry;
import net.minecraft.server.v1_8_R3.NavigationAbstract;
import net.minecraft.server.v1_8_R3.PacketPlayOutEntity;
import net.minecraft.server.v1_8_R3.PacketPlayOutEntityHeadRotation;
import net.minecraft.server.v1_8_R3.PathfinderGoal;
import net.minecraft.server.v1_8_R3.PathfinderGoalLookAtPlayer;
import net.minecraft.server.v1_8_R3.PathfinderGoalMoveTowardsRestriction;
import net.minecraft.server.v1_8_R3.PathfinderGoalRandomLookaround;
import net.minecraft.server.v1_8_R3.PathfinderGoalSelector;
import net.minecraft.server.v1_8_R3.WorldServer;
import org.bukkit.Bukkit; import org.bukkit.Bukkit;
import org.bukkit.Location; import org.bukkit.Location;
import org.bukkit.Material; import org.bukkit.Material;
@ -40,8 +22,29 @@ import org.bukkit.entity.EntityType;
import org.bukkit.entity.Giant; import org.bukkit.entity.Giant;
import org.bukkit.entity.LivingEntity; import org.bukkit.entity.LivingEntity;
import org.bukkit.entity.Player; import org.bukkit.entity.Player;
import org.bukkit.inventory.EntityEquipment;
import org.bukkit.inventory.ItemStack;
import org.bukkit.metadata.FixedMetadataValue;
import org.bukkit.util.Vector; import org.bukkit.util.Vector;
import net.minecraft.server.v1_8_R3.AxisAlignedBB;
import net.minecraft.server.v1_8_R3.EntityBat;
import net.minecraft.server.v1_8_R3.EntityCreature;
import net.minecraft.server.v1_8_R3.EntityEnderDragon;
import net.minecraft.server.v1_8_R3.EntityHuman;
import net.minecraft.server.v1_8_R3.EntityInsentient;
import net.minecraft.server.v1_8_R3.EntityLiving;
import net.minecraft.server.v1_8_R3.EntityTrackerEntry;
import net.minecraft.server.v1_8_R3.NavigationAbstract;
import net.minecraft.server.v1_8_R3.PacketPlayOutEntity;
import net.minecraft.server.v1_8_R3.PacketPlayOutEntityHeadRotation;
import net.minecraft.server.v1_8_R3.PathfinderGoal;
import net.minecraft.server.v1_8_R3.PathfinderGoalLookAtPlayer;
import net.minecraft.server.v1_8_R3.PathfinderGoalMoveTowardsRestriction;
import net.minecraft.server.v1_8_R3.PathfinderGoalRandomLookaround;
import net.minecraft.server.v1_8_R3.PathfinderGoalSelector;
import net.minecraft.server.v1_8_R3.WorldServer;
public class UtilEnt public class UtilEnt
{ {
@ -255,6 +258,34 @@ public class UtilEnt
} }
} }
public static void Rotate(LivingEntity entity, float yaw, float pitch)
{
EntityLiving handle = ((CraftLivingEntity) entity).getHandle();
while (yaw < -180.0F) yaw += 360.0F;
while (yaw >= 180.0F) yaw -= 360.0F;
handle.yaw = yaw;
handle.aK = yaw;
handle.aI = yaw;
handle.aL = yaw;
handle.pitch = pitch;
}
public static void LookAt(LivingEntity entity, Location location)
{
if (!(entity.getWorld().equals(location.getWorld())))
return;
Vector dir = entity.getEyeLocation().toVector().subtract(location.toVector()).normalize();
Location loc = entity.getEyeLocation().clone();
loc.setYaw(180 - (float) Math.toDegrees(Math.atan2(dir.getX(), dir.getZ())));
loc.setPitch(90 - (float) Math.toDegrees(Math.acos(dir.getY())));
Rotate(entity, loc.getYaw(), loc.getPitch());
}
public static void populate() public static void populate()
{ {
if (creatureMap.isEmpty()) if (creatureMap.isEmpty())
@ -825,4 +856,27 @@ public class UtilEnt
{ {
return ent.getLocation().getBlock().getTypeId() == 8 || ent.getLocation().getBlock().getTypeId() == 9; return ent.getLocation().getBlock().getTypeId() == 8 || ent.getLocation().getBlock().getTypeId() == 9;
} }
public static void SetMetadata(Entity entity, String key, Object value)
{
entity.setMetadata(key, new FixedMetadataValue(UtilServer.getPlugin(), value));
}
// Nicer than doing entity.getMetadata(key).get(0);
public static Object GetMetadata(Entity entity, String key)
{
if (!entity.hasMetadata(key))
{
return null;
}
return entity.getMetadata(key).get(0);
}
public static void SetItemInHand(LivingEntity entity, ItemStack item)
{
EntityEquipment equipment = entity.getEquipment();
equipment.setItemInHand(item);
}
} }

View File

@ -74,10 +74,10 @@ public class UtilFirework
public static void packetPlayFirework(Player player, Location loc, Type type, Color color, boolean flicker, boolean trail) public static void packetPlayFirework(Player player, Location loc, Type type, Color color, boolean flicker, boolean trail)
{ {
Firework firework = (Firework) loc.getWorld().spawn(loc, Firework.class); Firework firework = loc.getWorld().spawn(loc, Firework.class);
FireworkEffect effect = FireworkEffect.builder().flicker(flicker).withColor(color).with(type).trail(trail).build(); FireworkEffect effect = FireworkEffect.builder().flicker(flicker).withColor(color).with(type).trail(trail).build();
FireworkMeta data = (FireworkMeta) firework.getFireworkMeta(); FireworkMeta data = firework.getFireworkMeta();
data.clearEffects(); data.clearEffects();
data.setPower(1); data.setPower(1);
data.addEffect(effect); data.addEffect(effect);
@ -98,4 +98,14 @@ public class UtilFirework
UtilPlayer.sendPacket(viewing, packet); UtilPlayer.sendPacket(viewing, packet);
} }
} }
public static void spawnRandomFirework(Location location)
{
playFirework(location,
Type.values()[UtilMath.r(Type.values().length)],
Color.fromRGB(UtilMath.r(256), UtilMath.r(256), UtilMath.r(256)),
UtilMath.random.nextBoolean(),
UtilMath.random.nextBoolean()
);
}
} }

View File

@ -437,4 +437,20 @@ public class UtilInv
return false; return false;
} }
public static void give(Player player, Material material)
{
give(player, material, 1);
}
public static void give(Player player, Material material, int amount)
{
give(player, material, amount, (byte) 0);
}
public static void give(Player shooter, Material material, int amount, byte data)
{
shooter.getInventory().addItem(new ItemStack(material, amount, data));
}
} }

View File

@ -22,6 +22,8 @@ import org.bukkit.scheduler.BukkitRunnable;
import com.google.common.collect.Lists; import com.google.common.collect.Lists;
import mineplex.core.common.events.PlayerRecieveBroadcastEvent;
public class UtilServer public class UtilServer
{ {
// Quite hacky. would be nice if we could have a "MineplexPlugin" interface // Quite hacky. would be nice if we could have a "MineplexPlugin" interface
@ -68,7 +70,10 @@ public class UtilServer
public static void broadcast(String message) public static void broadcast(String message)
{ {
for (Player cur : getPlayers()) for (Player cur : getPlayers())
UtilPlayer.message(cur, message); {
if (!UtilServer.CallEvent(new PlayerRecieveBroadcastEvent(cur, message)).isCancelled())
UtilPlayer.message(cur, message);
}
} }
public static void broadcast(LinkedList<String> messages) public static void broadcast(LinkedList<String> messages)
@ -209,4 +214,9 @@ public class UtilServer
return _serverName; return _serverName;
} }
public static Collection<Player> GetPlayers()
{
return Lists.newArrayList(getPlayers());
}
} }

View File

@ -1,5 +1,8 @@
package mineplex.core; package mineplex.core;
import java.util.concurrent.ExecutorService;
import java.util.concurrent.Executors;
import org.bukkit.Bukkit; import org.bukkit.Bukkit;
import org.bukkit.event.HandlerList; import org.bukkit.event.HandlerList;
import org.bukkit.event.Listener; import org.bukkit.event.Listener;
@ -22,14 +25,14 @@ public abstract class MiniPlugin implements Listener
protected NautHashMap<String, ICommand> _commands; protected NautHashMap<String, ICommand> _commands;
protected long _initializedTime; protected long _initializedTime;
public MiniPlugin(String moduleName, JavaPlugin plugin) public MiniPlugin(String moduleName, JavaPlugin plugin)
{ {
_moduleName = moduleName; _moduleName = moduleName;
_plugin = plugin; _plugin = plugin;
_initializedTime = System.currentTimeMillis(); _initializedTime = System.currentTimeMillis();
_commands = new NautHashMap<String, ICommand>(); _commands = new NautHashMap<String, ICommand>();
onEnable(); onEnable();

View File

@ -375,6 +375,7 @@ public class CoreClientManager extends MiniPlugin
runAsync(new Runnable() runAsync(new Runnable()
{ {
@Override
public void run() public void run()
{ {
client.setAccountId(_repository.login(_loginProcessors, uuid, client.GetPlayerName())); client.setAccountId(_repository.login(_loginProcessors, uuid, client.GetPlayerName()));

View File

@ -60,17 +60,11 @@ public class AccountRepository extends MinecraftRepository
public int login(final List<ILoginProcessor> loginProcessors, final UUID uuid, final String name) public int login(final List<ILoginProcessor> loginProcessors, final UUID uuid, final String name)
{ {
// First we try to grab the account id from cache - this saves an extra trip to database // First we try to grab the account id from cache - this saves an extra trip to database
int accountId = -1; int accountId = PlayerCache.getInstance().getAccountId(uuid);
try (Connection connection = getConnection(); Statement statement = connection.createStatement()) try (Connection connection = getConnection(); Statement statement = connection.createStatement())
{ {
int cachedId = PlayerCache.getInstance().getAccountId(uuid); if (accountId <= 0)
if (cachedId > 0)
{
accountId = cachedId;
System.out.println("Loaded Account ID From Cache [" + name + " - " + accountId + "]");
}
else
{ {
// Player was not found in cache, we need to grab the account id from database // Player was not found in cache, we need to grab the account id from database
statement.execute("SELECT id FROM accounts WHERE accounts.uuid = '" + uuid + "' LIMIT 1;"); statement.execute("SELECT id FROM accounts WHERE accounts.uuid = '" + uuid + "' LIMIT 1;");
@ -100,6 +94,10 @@ public class AccountRepository extends MinecraftRepository
accountId = tempList.get(0); accountId = tempList.get(0);
} }
} }
else
{
System.out.println(name + " Loaded Account ID From Cache [" + name + " - " + accountId + "]");
}
final int finalId = accountId; final int finalId = accountId;
final String uuidString = uuid.toString(); final String uuidString = uuid.toString();
@ -109,7 +107,7 @@ public class AccountRepository extends MinecraftRepository
loginString += loginProcessors.parallelStream().map(processor -> processor.getQuery(finalId, uuidString, name)).collect(Collectors.joining()); loginString += loginProcessors.parallelStream().map(processor -> processor.getQuery(finalId, uuidString, name)).collect(Collectors.joining());
statement.execute(loginString); statement.execute(loginString);
statement.getUpdateCount(); statement.getUpdateCount();
statement.getMoreResults(); statement.getMoreResults();

View File

@ -33,6 +33,7 @@ import mineplex.core.donation.GiveDonorData;
import mineplex.core.facebook.FacebookManager; import mineplex.core.facebook.FacebookManager;
import mineplex.core.hologram.Hologram; import mineplex.core.hologram.Hologram;
import mineplex.core.hologram.HologramManager; import mineplex.core.hologram.HologramManager;
import mineplex.core.inventory.ClientItem;
import mineplex.core.inventory.InventoryManager; import mineplex.core.inventory.InventoryManager;
import mineplex.core.npc.Npc; import mineplex.core.npc.Npc;
import mineplex.core.npc.NpcManager; import mineplex.core.npc.NpcManager;
@ -474,6 +475,7 @@ public class BonusManager extends MiniClientPlugin<BonusClientData> implements I
{ {
if (timeTillRankBonus(player) > 0) if (timeTillRankBonus(player) > 0)
result.run(false); result.run(false);
getRepository().attemptRankBonus(player, new Callback<Boolean>() getRepository().attemptRankBonus(player, new Callback<Boolean>()
{ {
@Override @Override
@ -734,31 +736,35 @@ public class BonusManager extends MiniClientPlugin<BonusClientData> implements I
if (oldChests > 0) if (oldChests > 0)
{ {
_inventoryManager.addItemToInventory(player, TreasureType.OLD.getItemName(), oldChests); //_inventoryManager.addItemToInventory(player, TreasureType.OLD.getItemName(), oldChests);
UtilPlayer.message(player, F.main("Carl", "Rewarded " + F.elem(oldChests + " Old Chests"))); UtilPlayer.message(player, F.main("Carl", "Rewarded " + F.elem(oldChests + " Old Chests")));
_inventoryManager.Get(player).addItem(new ClientItem(_inventoryManager.getItem(TreasureType.OLD.getItemName()), mythicalChests));
} }
if (ancientChests > 0) if (ancientChests > 0)
{ {
UtilPlayer.message(player, F.main("Carl", "Rewarded " + F.elem(ancientChests + " Ancient Chests"))); UtilPlayer.message(player, F.main("Carl", "Rewarded " + F.elem(ancientChests + " Ancient Chests")));
_inventoryManager.addItemToInventory(player, TreasureType.ANCIENT.getItemName(), ancientChests); //_inventoryManager.addItemToInventory(player, TreasureType.ANCIENT.getItemName(), ancientChests);
_inventoryManager.Get(player).addItem(new ClientItem(_inventoryManager.getItem(TreasureType.ANCIENT.getItemName()), mythicalChests));
} }
if (mythicalChests > 0) if (mythicalChests > 0)
{ {
UtilPlayer.message(player, F.main("Carl", "Rewarded " + F.elem(mythicalChests + " Mythical Chests"))); UtilPlayer.message(player, F.main("Carl", "Rewarded " + F.elem(mythicalChests + " Mythical Chests")));
_inventoryManager.addItemToInventory(player, TreasureType.MYTHICAL.getItemName(), mythicalChests); //_inventoryManager.addItemToInventory(player, TreasureType.MYTHICAL.getItemName(), mythicalChests);
_inventoryManager.Get(player).addItem(new ClientItem(_inventoryManager.getItem(TreasureType.MYTHICAL.getItemName()), mythicalChests));
} }
if (gems > 0) if (gems > 0)
{ {
UtilPlayer.message(player, F.main("Carl", "Rewarded " + F.elem(gems + " Gems"))); UtilPlayer.message(player, F.main("Carl", "Rewarded " + F.elem(gems + " Gems")));
_gemQueue.add(new GiveDonorData(null, player.getName(), "Treasure", player.getUniqueId(), coreClient.getAccountId(), gems)); //_gemQueue.add(new GiveDonorData(null, player.getName(), "Treasure", player.getUniqueId(), coreClient.getAccountId(), gems));
} }
if (gold > 0) if (gold > 0)
{ {
UtilPlayer.message(player, F.main("Carl", "Rewarded " + F.elem(gold + " Gold"))); UtilPlayer.message(player, F.main("Carl", "Rewarded " + F.elem(gold + " Gold")));
/*
_donationManager.rewardGold(new Callback<Boolean>() _donationManager.rewardGold(new Callback<Boolean>()
{ {
@Override @Override
@ -773,12 +779,13 @@ public class BonusManager extends MiniClientPlugin<BonusClientData> implements I
} }
} }
}, "Earned", player.getName(), coreClient.getAccountId(), gold, true); }, "Earned", player.getName(), coreClient.getAccountId(), gold, true);
*/
} }
if (coins > 0) if (coins > 0)
{ {
UtilPlayer.message(player, F.main("Carl", "Rewarded " + F.elem(coins + " Treasure Shards"))); UtilPlayer.message(player, F.main("Carl", "Rewarded " + F.elem(coins + " Treasure Shards")));
_coinQueue.add(new GiveDonorData(null, player.getName(), "Treasure", player.getUniqueId(), coreClient.getAccountId(), coins)); //_coinQueue.add(new GiveDonorData(null, player.getName(), "Treasure", player.getUniqueId(), coreClient.getAccountId(), coins));
} }
if (tickets > 0) if (tickets > 0)

View File

@ -259,42 +259,48 @@ public class BonusRepository extends MinecraftRepository
public void attemptRankBonus(final Player player, final Callback<Boolean> result) public void attemptRankBonus(final Player player, final Callback<Boolean> result)
{ {
if (!Recharge.Instance.usable(player, "AttemptRankBonus")) { if (!Recharge.Instance.usable(player, "AttemptRankBonus"))
{
result.run(false); result.run(false);
return; return;
} }
final int accountId = _manager.getClientManager().Get(player).getAccountId(); final int accountId = _manager.getClientManager().Get(player).getAccountId();
final int coins = _manager.getRankBonusAmount(player).getCoins(); final int coins = _manager.getRankBonusAmount(player).getCoins();
final int gems = _manager.getRankBonusAmount(player).getGems();
final int mythicalChestChange = _manager.getRankBonusAmount(player).getMythicalChests();
if (!_manager.getRankBonusAmount(player).isGreaterThanZero()) { if (!_manager.getRankBonusAmount(player).isGreaterThanZero())
{
result.run(false); result.run(false);
return; return;
} }
final JavaPlugin plug = _manager.getPlugin(); final JavaPlugin plug = _manager.getPlugin();
Bukkit.getScheduler().runTaskAsynchronously(plug, new Runnable() { Bukkit.getScheduler().runTaskAsynchronously(plug, new Runnable()
{
@Override @Override
public void run() public void run()
{ {
try (Connection connection = getConnection(); try (Connection connection = getConnection();
CallableStatement callableStatement = connection.prepareCall("{call check_rank(?, ?, ?, ?, ?)}")) { CallableStatement callableStatement = connection.prepareCall("{call rankBonus(?, ?, ?, ?, ?, ?)}"))
{
callableStatement.setInt(1, accountId); callableStatement.setInt(1, accountId);
callableStatement.setInt(2, coins); callableStatement.setInt(2, coins);
callableStatement.setInt(3, 0); callableStatement.setInt(3, gems);
callableStatement.registerOutParameter(4, java.sql.Types.BOOLEAN); callableStatement.setInt(4, mythicalChestChange);
callableStatement.registerOutParameter(5, java.sql.Types.DATE); callableStatement.registerOutParameter(5, java.sql.Types.BOOLEAN);
callableStatement.registerOutParameter(6, java.sql.Types.DATE);
callableStatement.executeUpdate(); callableStatement.executeUpdate();
final boolean pass = callableStatement.getBoolean(4); final boolean pass = callableStatement.getBoolean(5);
final Date date = callableStatement.getDate(5); final Date date = callableStatement.getDate(6);
Bukkit.getScheduler().runTask(plug, new Runnable() {
Bukkit.getScheduler().runTask(plug, new Runnable()
{
@Override @Override
public void run() public void run()
{ {
@ -311,9 +317,12 @@ public class BonusRepository extends MinecraftRepository
} }
} }
}); });
} catch (Exception e) { }
catch (Exception e)
{
Recharge.Instance.use(player, "AttemptRankBonus", 1000 * 30, false, false); Recharge.Instance.use(player, "AttemptRankBonus", 1000 * 30, false, false);
e.printStackTrace(); e.printStackTrace();
System.out.println("Error : " + e.getMessage());
result.run(false); result.run(false);
} }
} }

View File

@ -58,6 +58,7 @@ public class Chat extends MiniPlugin
private CoreClientManager _clientManager; private CoreClientManager _clientManager;
private PreferencesManager _preferences; private PreferencesManager _preferences;
private AchievementManager _achievements; private AchievementManager _achievements;
private IncognitoManager _incognitoManager;
private String[] _hackusations = {"hack", "hax", "hacker", "hacking", "cheat", "cheater", "cheating", "forcefield", "flyhack", "flyhacking", "autoclick", "aimbot"}; private String[] _hackusations = {"hack", "hax", "hacker", "hacking", "cheat", "cheater", "cheating", "forcefield", "flyhack", "flyhacking", "autoclick", "aimbot"};
private String _filterUrl = "https://chat.mineplex.com:8003/content/item/moderate"; private String _filterUrl = "https://chat.mineplex.com:8003/content/item/moderate";
@ -74,10 +75,11 @@ public class Chat extends MiniPlugin
private HashMap<UUID, MessageData> _playerLastMessage = new HashMap<UUID, MessageData>(); private HashMap<UUID, MessageData> _playerLastMessage = new HashMap<UUID, MessageData>();
public Chat(JavaPlugin plugin, CoreClientManager clientManager, PreferencesManager preferences, AchievementManager achievements, String serverName) public Chat(JavaPlugin plugin, IncognitoManager incognitoManager, CoreClientManager clientManager, PreferencesManager preferences, AchievementManager achievements, String serverName)
{ {
super("Chat", plugin); super("Chat", plugin);
_incognitoManager = incognitoManager;
_clientManager = clientManager; _clientManager = clientManager;
_serverName = serverName; _serverName = serverName;
_preferences = preferences; _preferences = preferences;
@ -308,7 +310,7 @@ public class Chat extends MiniPlugin
Player sender = event.getPlayer(); Player sender = event.getPlayer();
if (IncognitoManager.Instance.Get(sender).Status) if (_incognitoManager != null && _incognitoManager.Get(sender).Status)
{ {
UtilPlayer.message(sender, C.cYellow + "You can not chat while incognito."); UtilPlayer.message(sender, C.cYellow + "You can not chat while incognito.");
event.setCancelled(true); event.setCancelled(true);

View File

@ -2,8 +2,6 @@ package mineplex.core.elo;
import java.sql.ResultSet; import java.sql.ResultSet;
import java.sql.SQLException; import java.sql.SQLException;
import java.util.ArrayList;
import java.util.Collections;
import java.util.UUID; import java.util.UUID;
import mineplex.core.MiniDbClientPlugin; import mineplex.core.MiniDbClientPlugin;
@ -32,7 +30,7 @@ public class EloManager extends MiniDbClientPlugin<EloClientData>
public int getElo(UUID uuid, String gameType) public int getElo(UUID uuid, String gameType)
{ {
int elo = 1400; int elo = 1000;
synchronized (_playerEloLock) synchronized (_playerEloLock)
{ {
@ -48,61 +46,6 @@ public class EloManager extends MiniDbClientPlugin<EloClientData>
return elo; return elo;
} }
//get a player's Division
public String getPlayerDivision(UUID uuid, String gameType)
{
//get playerElo for gameType (need to store this to check it against other Elo's)
int playerElo = getElo(uuid, gameType);
//this list will be filled with ELO's from other players (but only for the same game type
ArrayList<Integer> allElos = new ArrayList<Integer>();
for(int i = 0; i < _playerElos.size(); i++)
{
//we're only concerned with this Game Type
if(_playerElos.containsKey(gameType))
{
//add elo's to the list
allElos.add(_playerElos.get(uuid.toString()).get(gameType));
}
}
//sort list of Elos (needed for percentile calculations)
Collections.sort(allElos);
//Calculate how much going up one spot is worth
double individualValue = (100/allElos.size());
/* lastIndexOf gets the last instance of player's Elo
* Consequently, it should be easier for rank to go up than down
* and everyone at the same Elo should be in the same division
*/
double percentile = allElos.lastIndexOf(playerElo) * individualValue;
return CalculateDivision(playerElo, percentile);
}
public String CalculateDivision(int playerElo, double divPercent)
{
if (playerElo >= 3500 && divPercent > 99) return "Diamond";
if (playerElo >= 3500) return "Emerald 3";
if (playerElo < 3500 && playerElo >= 3300) return "Emerald 2";
if (playerElo < 3300 && playerElo >= 3100) return "Emerald 1";
if (playerElo < 3100 && playerElo >= 2900) return "Lapis 3";
if (playerElo < 2900 && playerElo >= 2700) return "Lapis 2";
if (playerElo < 2700 && playerElo >= 2500) return "Lapis 1";
if (playerElo < 2500 && playerElo >= 2300) return "Gold 3";
if (playerElo < 2300 && playerElo >= 2100) return "Gold 2";
if (playerElo < 2100 && playerElo >= 1900) return "Gold 1";
if (playerElo < 1900 && playerElo >= 1700) return "Iron 3";
if (playerElo < 1700 && playerElo >= 1500) return "Iron 2";
if (playerElo < 1500 && playerElo >= 1300) return "Iron 1";
if (playerElo < 1300 && playerElo >= 800) return "Coal 3";
if (playerElo < 800 && playerElo >= 600) return "Coal 2";
if (playerElo < 600 && playerElo >= 400) return "Coal 1";
return "Result not found";
}
public EloTeam getNewRatings(EloTeam teamA, EloTeam teamB, GameResult result) public EloTeam getNewRatings(EloTeam teamA, EloTeam teamB, GameResult result)
{ {
EloTeam newTeam = new EloTeam(); EloTeam newTeam = new EloTeam();

View File

@ -5,22 +5,8 @@ public class EloPlayer
public String UniqueId; public String UniqueId;
public int Rating; public int Rating;
//String to hold division player is currently in
private String _division;
public void printInfo() public void printInfo()
{ {
System.out.println(UniqueId + "'s elo is " + Rating); System.out.println(UniqueId + "'s elo is " + Rating);
} }
public void setDivision(String newDivision)
{
_division = newDivision;
}
public String getDivision()
{
return _division;
}
} }

View File

@ -3,8 +3,6 @@ package mineplex.core.game;
import org.bukkit.DyeColor; import org.bukkit.DyeColor;
import org.bukkit.Material; import org.bukkit.Material;
import mineplex.core.elo.EloSettings;
public enum GameDisplay public enum GameDisplay
{ {
//Mini //Mini
@ -91,8 +89,6 @@ public enum GameDisplay
private int _gameId; // Unique identifying id for this gamemode (used for statistics) private int _gameId; // Unique identifying id for this gamemode (used for statistics)
public int getGameId() { return _gameId; } public int getGameId() { return _gameId; }
private EloSettings EloSetting = new EloSettings(0);
GameDisplay(String name, Material mat, byte data, GameCategory gameCategory, int gameId) GameDisplay(String name, Material mat, byte data, GameCategory gameCategory, int gameId)
{ {
this(name, name, mat, data, gameCategory, gameId); this(name, name, mat, data, gameCategory, gameId);

View File

@ -17,6 +17,7 @@ import com.google.common.base.Function;
import mineplex.core.MiniDbClientPlugin; import mineplex.core.MiniDbClientPlugin;
import mineplex.core.account.CoreClientManager; import mineplex.core.account.CoreClientManager;
import mineplex.core.common.Rank;
import mineplex.core.common.util.C; import mineplex.core.common.util.C;
import mineplex.core.common.util.UtilPlayer; import mineplex.core.common.util.UtilPlayer;
import mineplex.core.common.util.UtilServer; import mineplex.core.common.util.UtilServer;
@ -90,30 +91,45 @@ public class IncognitoManager extends MiniDbClientPlugin<IncognitoClient>
@EventHandler(priority = EventPriority.HIGHEST) @EventHandler(priority = EventPriority.HIGHEST)
public void Join(PlayerJoinEvent event) public void Join(PlayerJoinEvent event)
{ {
Player player = event.getPlayer();
if (Get(event.getPlayer()).Status && !_clientManager.hasRank(event.getPlayer(), Rank.HELPER))
{
Get(event.getPlayer()).Status = false;
runAsync(() -> _repository.setStatus(_clientManager.getAccountId(player), false));
return;
}
if (Get(event.getPlayer()).Status) if (Get(event.getPlayer()).Status)
{ {
event.setJoinMessage(null); event.setJoinMessage(null);
informIncognito(event.getPlayer()); informIncognito(player);
} }
IncognitoHidePlayerEvent customEvent = UtilServer.CallEvent(new IncognitoHidePlayerEvent(event.getPlayer())); IncognitoHidePlayerEvent customEvent = null;
UtilServer.getPlayersCollection().forEach(player -> { if (Get(event.getPlayer()).Status)
if (!customEvent.isCancelled() && Get(event.getPlayer()).Status && !_clientManager.hasRank(player, _clientManager.Get(event.getPlayer()).GetRank())) {
customEvent = UtilServer.CallEvent(new IncognitoHidePlayerEvent(player));
}
for (Player other : UtilServer.getPlayers())
{
if (customEvent != null && !customEvent.isCancelled() && !_clientManager.hasRank(other, _clientManager.Get(player).GetRank()))
{ {
player.hidePlayer(event.getPlayer()); other.hidePlayer(player);
} }
if (Get(player).Status) if (Get(other).Status)
{ {
IncognitoHidePlayerEvent customEvent2 = UtilServer.CallEvent(new IncognitoHidePlayerEvent(player)); IncognitoHidePlayerEvent customEvent2 = UtilServer.CallEvent(new IncognitoHidePlayerEvent(other));
if (!customEvent2.isCancelled() && !_clientManager.hasRank(event.getPlayer(), _clientManager.Get(player).GetRank())) if (!customEvent2.isCancelled() && !_clientManager.hasRank(player, _clientManager.Get(other).GetRank()))
{ {
event.getPlayer().hidePlayer(player); player.hidePlayer(other);
} }
} }
}); }
} }
@EventHandler(priority = EventPriority.HIGHEST) @EventHandler(priority = EventPriority.HIGHEST)

View File

@ -0,0 +1,47 @@
package mineplex.core.incognito.events;
import org.bukkit.entity.Player;
import org.bukkit.event.Event;
import org.bukkit.event.HandlerList;
/**
* Called when an Incognito player is getting hidden from all other players.
*/
public class IncognitoHidePlayerEvent extends Event
{
private static final HandlerList handlers = new HandlerList();
private Player _player;
private boolean _cancelled;
public IncognitoHidePlayerEvent(Player player)
{
_player = player;
}
public Player getPlayer()
{
return _player;
}
public void setCancelled(boolean cancelled)
{
_cancelled = cancelled;
}
public boolean isCancelled()
{
return _cancelled;
}
public HandlerList getHandlers()
{
return handlers;
}
public static HandlerList getHandlerList()
{
return handlers;
}
}

View File

@ -27,7 +27,12 @@ import mineplex.core.friend.data.FriendData;
import mineplex.core.friend.data.FriendStatus; import mineplex.core.friend.data.FriendStatus;
import mineplex.core.ignore.IgnoreManager; import mineplex.core.ignore.IgnoreManager;
import mineplex.core.incognito.IncognitoManager; import mineplex.core.incognito.IncognitoManager;
import mineplex.core.message.commands.*; import mineplex.core.message.commands.AdminCommand;
import mineplex.core.message.commands.AnnounceCommand;
import mineplex.core.message.commands.MessageAdminCommand;
import mineplex.core.message.commands.MessageCommand;
import mineplex.core.message.commands.ResendAdminCommand;
import mineplex.core.message.commands.ResendCommand;
import mineplex.core.message.redis.AnnouncementHandler; import mineplex.core.message.redis.AnnouncementHandler;
import mineplex.core.message.redis.MessageHandler; import mineplex.core.message.redis.MessageHandler;
import mineplex.core.message.redis.RedisMessage; import mineplex.core.message.redis.RedisMessage;
@ -45,6 +50,8 @@ public class MessageManager extends MiniClientPlugin<ClientMessage>
private CoreClientManager _clientManager; private CoreClientManager _clientManager;
private FriendManager _friendsManager; private FriendManager _friendsManager;
private IgnoreManager _ignoreManager; private IgnoreManager _ignoreManager;
private IncognitoManager _incognitoManager;
private HashMap<UUID, BukkitRunnable> _messageTimeouts = new HashMap<UUID, BukkitRunnable>(); private HashMap<UUID, BukkitRunnable> _messageTimeouts = new HashMap<UUID, BukkitRunnable>();
private PreferencesManager _preferences; private PreferencesManager _preferences;
private Punish _punish; private Punish _punish;
@ -52,11 +59,12 @@ public class MessageManager extends MiniClientPlugin<ClientMessage>
private ArrayList<String> _randomMessage; private ArrayList<String> _randomMessage;
private String _serverName; private String _serverName;
public MessageManager(JavaPlugin plugin, CoreClientManager clientManager, PreferencesManager preferences, public MessageManager(JavaPlugin plugin, IncognitoManager incognitoManager, CoreClientManager clientManager, PreferencesManager preferences,
IgnoreManager ignoreManager, Punish punish, FriendManager friendManager, Chat chat) IgnoreManager ignoreManager, Punish punish, FriendManager friendManager, Chat chat)
{ {
super("Message", plugin); super("Message", plugin);
_incognitoManager = incognitoManager;
_clientManager = clientManager; _clientManager = clientManager;
_preferences = preferences; _preferences = preferences;
_ignoreManager = ignoreManager; _ignoreManager = ignoreManager;
@ -86,7 +94,7 @@ public class MessageManager extends MiniClientPlugin<ClientMessage>
addCommand(new AnnounceCommand(this)); addCommand(new AnnounceCommand(this));
//addCommand(new GlobalCommand(this)); //addCommand(new GlobalCommand(this));
addCommand(new AdminCommand(this)); addCommand(new AdminCommand(this, _incognitoManager));
} }
@Override @Override
@ -466,7 +474,6 @@ public class MessageManager extends MiniClientPlugin<ClientMessage>
if (!adminMessage) if (!adminMessage)
{ {
for (FriendStatus friendInfo : friends.getFriends()) for (FriendStatus friendInfo : friends.getFriends())
{ {
@ -524,7 +531,7 @@ public class MessageManager extends MiniClientPlugin<ClientMessage>
// If this is a message inside the server // If this is a message inside the server
if (to != null) if (to != null)
{ {
if (IncognitoManager.Instance.Get(to).Status) if (_incognitoManager.Get(to).Status)
{ {
UtilPlayer.message(sender, F.main("Online Player Search", F.elem("0") + " matches for [" + F.elem(target) + "].")); UtilPlayer.message(sender, F.main("Online Player Search", F.elem("0") + " matches for [" + F.elem(target) + "]."));
return; return;
@ -549,51 +556,63 @@ public class MessageManager extends MiniClientPlugin<ClientMessage>
// If this is a admin message, or the sender isn't muted/ignoring the target // If this is a admin message, or the sender isn't muted/ignoring the target
if (adminMessage || canSenderMessageThem(sender, playerTarget)) if (adminMessage || canSenderMessageThem(sender, playerTarget))
{ {
if (IncognitoManager.Instance.getRepository().GetStatus(playerTarget)) runAsync(new Runnable()
{
UtilPlayer.message(sender, F.main("Online Player Search", F.elem("0") + " matches for [" + F.elem(target) + "]."));
return;
}
// Construct the command to send to redis
RedisMessage globalMessage = new RedisMessage(_serverName,
sender.getName(),
adminMessage ? null : friend.ServerName,
playerTarget,
message,
// Include the sender's rank if this is a admin message. So we can format the receivers chat.
adminMessage ? F.rank(_clientManager.Get(sender).GetRank()) : null);
final UUID uuid = globalMessage.getUUID();
// A backup for the rare case where the message fails to deliver. Server doesn't respond
BukkitRunnable runnable = new BukkitRunnable()
{
public void run()
{ {
_messageTimeouts.remove(uuid); @Override
public void run()
// Inform the player that the message failed to deliver {
UtilPlayer.message( // TODO Newgarbo wrote this stuff inefficiently and for sake of time and thousands of players i'm going to just comment this out
sender, /*
F.main((adminMessage ? "Admin " : "") + "Message", C.mBody + " Failed to send message to [" if (IncognitoManager.Instance.getRepository().GetStatus(playerTarget))
+ C.mElem + playerTarget + C.mBody + "].")); {
UtilPlayer.message(sender, F.main("Online Player Search", F.elem("0") + " matches for [" + F.elem(target) + "]."));
return;
}
*/
runSync(new Runnable()
{
public void run()
{
// Construct the command to send to redis
RedisMessage globalMessage = new RedisMessage(_serverName,
sender.getName(),
adminMessage ? null : friend.ServerName,
playerTarget,
message,
// Include the sender's rank if this is a admin message. So we can format the receivers chat.
adminMessage ? F.rank(_clientManager.Get(sender).GetRank()) : null);
final UUID uuid = globalMessage.getUUID();
// A backup for the rare case where the message fails to deliver. Server doesn't respond
BukkitRunnable runnable = new BukkitRunnable()
{
public void run()
{
_messageTimeouts.remove(uuid);
// Inform the player that the message failed to deliver
UtilPlayer.message(
sender,
F.main((adminMessage ? "Admin " : "") + "Message", C.mBody + " Failed to send message to ["
+ C.mElem + playerTarget + C.mBody + "]."));
}
};
// This will activate in 2 seconds
runnable.runTaskLater(getPlugin(), 40);
// The key is the UUID its trading between servers
_messageTimeouts.put(uuid, runnable);
// Time to send the message!
globalMessage.publish();
}
});
}
} }
}; );
// This will activate in 2 seconds
runnable.runTaskLater(getPlugin(), 40);
// The key is the UUID its trading between servers
_messageTimeouts.put(uuid, runnable);
// Time to send the message!
globalMessage.publish();
} }
} }
} }

View File

@ -9,14 +9,18 @@ import mineplex.core.common.util.C;
import mineplex.core.common.util.F; import mineplex.core.common.util.F;
import mineplex.core.common.util.UtilPlayer; import mineplex.core.common.util.UtilPlayer;
import mineplex.core.common.util.UtilServer; import mineplex.core.common.util.UtilServer;
import mineplex.core.incognito.IncognitoManager;
import mineplex.core.message.MessageManager; import mineplex.core.message.MessageManager;
import mineplex.core.visibility.VisibilityManager;
public class AdminCommand extends CommandBase<MessageManager> public class AdminCommand extends CommandBase<MessageManager>
{ {
public AdminCommand(MessageManager plugin) private IncognitoManager _incognitoManager;
public AdminCommand(MessageManager plugin, IncognitoManager incognitoManager)
{ {
super(plugin, Rank.ALL, "a","admin"); super(plugin, Rank.ALL, "a","admin");
_incognitoManager = incognitoManager;
} }
@Override @Override
@ -51,6 +55,11 @@ public class AdminCommand extends CommandBase<MessageManager>
{ {
if (Plugin.GetClientManager().Get(to).GetRank().has(Rank.HELPER)) if (Plugin.GetClientManager().Get(to).GetRank().has(Rank.HELPER))
{ {
if (_incognitoManager.Get(to).Status)
{
continue;
}
if (!to.equals(caller)) if (!to.equals(caller))
UtilPlayer.message(to, F.rank(Plugin.GetClientManager().Get(caller).GetRank()) + " " + caller.getName() + " " + C.cPurple + message); UtilPlayer.message(to, F.rank(Plugin.GetClientManager().Get(caller).GetRank()) + " " + caller.getName() + " " + C.cPurple + message);

View File

@ -478,6 +478,17 @@ public class NpcManager extends MiniPlugin
} }
} }
public void addFakeNpc(Npc npc)
{
_npcs.add(npc);
}
public void removeFakeNpc(Npc npc)
{
_npcs.remove(npc);
npc.getEntity().remove();
}
public void loadNpcs() throws SQLException public void loadNpcs() throws SQLException
{ {
String serverType = getServerName(); String serverType = getServerName();

View File

@ -60,13 +60,11 @@ public class ResourcePackManager extends MiniPlugin implements CommandCallback
if (entry.getLeft() == version || entry.getLeft() == MinecraftVersion.ALL) if (entry.getLeft() == version || entry.getLeft() == MinecraftVersion.ALL)
{ {
player.setResourcePack(entry.getRight()); player.setResourcePack(entry.getRight());
player.sendMessage("A: " + entry.getRight());
return; return;
} }
} }
player.setResourcePack(_resourcePackUrls[0].getRight()); player.setResourcePack(_resourcePackUrls[0].getRight());
player.sendMessage("B: " + _resourcePackUrls[0].getRight());
} }
@EventHandler @EventHandler

View File

@ -53,9 +53,13 @@ public enum UpdateType
*/ */
SLOWEST(32000), SLOWEST(32000),
/** /**
* ONce every 30 seconds * Once every 30 seconds
*/ */
SEC_30(30000), SEC_30(30000),
/**
* Once every 20 seconds
*/
SEC_20(20000),
/** /**
* Once every 16 seconds * Once every 16 seconds
*/ */

View File

@ -3,7 +3,7 @@ package mineplex.game.clans.core.repository.tokens;
public class SimpleClanToken public class SimpleClanToken
{ {
private String _clanName; private String _clanName = "";
public String getClanName() { return _clanName; } public String getClanName() { return _clanName; }
private String _clanRole; private String _clanRole;
@ -22,4 +22,6 @@ public class SimpleClanToken
_homeServer = homeServer; _homeServer = homeServer;
_clanId = clanId; _clanId = clanId;
} }
public SimpleClanToken() { }
} }

View File

@ -7,16 +7,20 @@ import org.bukkit.plugin.java.JavaPlugin;
import mineplex.core.CustomTagFix; import mineplex.core.CustomTagFix;
import mineplex.core.FoodDupeFix; import mineplex.core.FoodDupeFix;
import mineplex.core.PacketsInteractionFix;
import mineplex.core.account.CoreClientManager; import mineplex.core.account.CoreClientManager;
import mineplex.core.achievement.AchievementManager; import mineplex.core.achievement.AchievementManager;
import mineplex.core.antihack.AntiHack; import mineplex.core.antihack.AntiHack;
import mineplex.core.blockrestore.BlockRestore; import mineplex.core.blockrestore.BlockRestore;
import mineplex.core.chat.Chat; import mineplex.core.chat.Chat;
import mineplex.core.command.CommandCenter; import mineplex.core.command.CommandCenter;
import mineplex.core.common.MinecraftVersion;
import mineplex.core.common.Pair;
import mineplex.core.common.events.ServerShutdownEvent; import mineplex.core.common.events.ServerShutdownEvent;
import mineplex.core.delayedtask.DelayedTask; import mineplex.core.delayedtask.DelayedTask;
import mineplex.core.donation.DonationManager; import mineplex.core.donation.DonationManager;
import mineplex.core.explosion.Explosion; import mineplex.core.explosion.Explosion;
import mineplex.core.fallingblock.FallingBlocks;
import mineplex.core.friend.FriendManager; import mineplex.core.friend.FriendManager;
import mineplex.core.give.Give; import mineplex.core.give.Give;
import mineplex.core.hologram.HologramManager; import mineplex.core.hologram.HologramManager;
@ -41,7 +45,6 @@ import mineplex.core.teleport.Teleport;
import mineplex.core.updater.FileUpdater; import mineplex.core.updater.FileUpdater;
import mineplex.core.updater.Updater; import mineplex.core.updater.Updater;
import mineplex.core.visibility.VisibilityManager; import mineplex.core.visibility.VisibilityManager;
import mineplex.game.clans.analytics.Profiler;
import mineplex.game.clans.clans.ClansManager; import mineplex.game.clans.clans.ClansManager;
import mineplex.game.clans.clans.ban.ClansBanManager; import mineplex.game.clans.clans.ban.ClansBanManager;
import mineplex.game.clans.items.GearManager; import mineplex.game.clans.items.GearManager;
@ -66,9 +69,6 @@ public class Clans extends JavaPlugin
@Override @Override
public void onEnable() public void onEnable()
{ {
// Initialize Profiler
new Profiler();
// Configs // Configs
getConfig().addDefault(WEB_CONFIG, "http://accounts.mineplex.com/"); getConfig().addDefault(WEB_CONFIG, "http://accounts.mineplex.com/");
getConfig().set(WEB_CONFIG, getConfig().getString(WEB_CONFIG)); getConfig().set(WEB_CONFIG, getConfig().getString(WEB_CONFIG));
@ -93,6 +93,8 @@ public class Clans extends JavaPlugin
_donationManager = new DonationManager(this, _clientManager, webServerAddress); _donationManager = new DonationManager(this, _clientManager, webServerAddress);
new FallingBlocks(this);
new ServerConfiguration(this, _clientManager); new ServerConfiguration(this, _clientManager);
PreferencesManager preferenceManager = new PreferencesManager(this, _clientManager, _donationManager); PreferencesManager preferenceManager = new PreferencesManager(this, _clientManager, _donationManager);
@ -107,7 +109,7 @@ public class Clans extends JavaPlugin
Portal portal = new Portal(this, _clientManager, serverStatusManager.getCurrentServerName()); Portal portal = new Portal(this, _clientManager, serverStatusManager.getCurrentServerName());
new FileUpdater(this, portal, serverStatusManager.getCurrentServerName(), serverStatusManager.getRegion()); new FileUpdater(this, portal, serverStatusManager.getCurrentServerName(), serverStatusManager.getRegion());
new ClansBanManager(this, _clientManager, _donationManager); // ClansBanManager clansBans = new ClansBanManager(this, _clientManager, _donationManager);
PacketHandler packetHandler = new PacketHandler(this); PacketHandler packetHandler = new PacketHandler(this);
Punish punish = new Punish(this, webServerAddress, _clientManager); Punish punish = new Punish(this, webServerAddress, _clientManager);
@ -122,23 +124,26 @@ public class Clans extends JavaPlugin
StatsManager statsManager = new StatsManager(this, _clientManager); StatsManager statsManager = new StatsManager(this, _clientManager);
AchievementManager achievementManager = new AchievementManager(statsManager, _clientManager, _donationManager); AchievementManager achievementManager = new AchievementManager(statsManager, _clientManager, _donationManager);
Chat chat = new Chat(this, _clientManager, preferenceManager, achievementManager, serverStatusManager.getCurrentServerName()); Chat chat = new Chat(this, incognito, _clientManager, preferenceManager, achievementManager, serverStatusManager.getCurrentServerName());
new MessageManager(this, _clientManager, preferenceManager, ignoreManager, punish, new FriendManager(this, _clientManager, preferenceManager, portal), chat); new MessageManager(this, incognito, _clientManager, preferenceManager, ignoreManager, punish, new FriendManager(this, _clientManager, preferenceManager, portal), chat);
new MemoryFix(this); new MemoryFix(this);
new FoodDupeFix(this); new FoodDupeFix(this);
new Explosion(this, blockRestore); new Explosion(this, blockRestore);
new FriendManager(this, _clientManager, preferenceManager, portal);
new InventoryManager(this, _clientManager); new InventoryManager(this, _clientManager);
ResourcePackManager resourcePackManager = new ResourcePackManager(this, portal); ResourcePackManager resourcePackManager = new ResourcePackManager(this, portal);
resourcePackManager.setResourcePack("http://garblox.com/b:ResClans.zip", "http://garblox.com/b:ResClans19.zip", true); resourcePackManager.setResourcePack(new Pair[]
{
Pair.create(MinecraftVersion.Version1_8, "http://phinary.ca/ResClans.zip"),
Pair.create(MinecraftVersion.Version1_9, "http://phinary.ca/ResClans19.zip")
}, true);
// Enable custom-gear related managers // Enable custom-gear related managers
new CustomTagFix(this, packetHandler); new CustomTagFix(this, packetHandler);
GearManager customGear = new GearManager(this, packetHandler, _clientManager, _donationManager); GearManager customGear = new GearManager(this, packetHandler, _clientManager, _donationManager);
HologramManager hologram = new HologramManager(this, packetHandler); HologramManager hologram = new HologramManager(this, packetHandler);
_clansManager = new ClansManager(this, serverStatusManager.getCurrentServerName(), packetHandler, punish, _clientManager, _donationManager, preferenceManager, blockRestore, teleport, chat, customGear, hologram, webServerAddress); _clansManager = new ClansManager(this, /*clansBans,*/ serverStatusManager.getCurrentServerName(), packetHandler, punish, _clientManager, _donationManager, preferenceManager, blockRestore, statsManager, teleport, chat, customGear, hologram, webServerAddress);
new Recipes(this); new Recipes(this);
new Farming(this); new Farming(this);
new BuildingShop(_clansManager, _clientManager, _donationManager); new BuildingShop(_clansManager, _clientManager, _donationManager);

View File

@ -61,7 +61,7 @@ public class ClanEnergyTracker extends MiniPlugin
Triple<Long, Long, String[]> energyBounds = _updateMap.get(type); Triple<Long, Long, String[]> energyBounds = _updateMap.get(type);
if (energyBounds != null && energyRemaining > energyBounds.getLeft() && energyRemaining < energyBounds.getMiddle()) if (energyBounds != null && energyRemaining > energyBounds.getLeft().longValue() && energyRemaining < energyBounds.getMiddle().longValue())
{ {
_clans.middleTextClan(clan, energyBounds.getRight()[0], energyBounds.getRight()[1], 20, 200, 80); _clans.middleTextClan(clan, energyBounds.getRight()[0], energyBounds.getRight()[1], 20, 200, 80);
_clans.sendTipToClan(clan, TipType.ENERGY); _clans.sendTipToClan(clan, TipType.ENERGY);

View File

@ -245,7 +245,7 @@ public class ClansAdmin
{ {
public void run() public void run()
{ {
if (nameExists) if (nameExists.booleanValue())
UtilPlayer.message(caller, F.main("Clans Admin", "Clan name cannot be a Player name.")); UtilPlayer.message(caller, F.main("Clans Admin", "Clan name cannot be a Player name."));
else else
{ {

View File

@ -16,6 +16,7 @@ import mineplex.core.common.util.UtilBlock;
import mineplex.core.common.util.UtilServer; import mineplex.core.common.util.UtilServer;
import mineplex.core.common.util.UtilWorld; import mineplex.core.common.util.UtilWorld;
import mineplex.game.clans.clans.event.ClanCreatedEvent; import mineplex.game.clans.clans.event.ClanCreatedEvent;
import mineplex.game.clans.clans.event.ClanCreationCompleteEvent;
import mineplex.game.clans.clans.event.ClanDeleteEvent; import mineplex.game.clans.clans.event.ClanDeleteEvent;
import mineplex.game.clans.clans.event.ClanJoinEvent; import mineplex.game.clans.clans.event.ClanJoinEvent;
import mineplex.game.clans.clans.event.ClanLeaveEvent; import mineplex.game.clans.clans.event.ClanLeaveEvent;
@ -195,6 +196,9 @@ public class ClansDataAccessLayer
} }
if (callback != null) callback.run(clanInfo); if (callback != null) callback.run(clanInfo);
ClanCreationCompleteEvent event = new ClanCreationCompleteEvent(token, Bukkit.getPlayer(creator));
UtilServer.getServer().getPluginManager().callEvent(event);
} }
}); });
} }
@ -781,8 +785,14 @@ public class ClansDataAccessLayer
// Memory // Memory
claim.Safe = !claim.Safe; claim.Safe = !claim.Safe;
// Save runAsync(new Runnable()
_repository.updateTerritoryClaim(claim.Chunk, claim.Safe); {
@Override
public void run()
{
_repository.updateTerritoryClaim(claim.Chunk, claim.Safe);
}
});
// Log // Log
_manager.log("Safe Zone at [" + claim.Chunk + "] set to [" + claim.Safe + "] by [" + player + "]."); _manager.log("Safe Zone at [" + claim.Chunk + "] set to [" + claim.Safe + "] by [" + player + "].");
@ -803,7 +813,28 @@ public class ClansDataAccessLayer
public void clanExists(String clanName, Callback<Boolean> callback) public void clanExists(String clanName, Callback<Boolean> callback)
{ {
_repository.clanExists(clanName, callback); runAsync(new Runnable()
{
@Override
public void run()
{
_repository.clanExists(clanName, new Callback<Boolean>()
{
@Override
public void run(Boolean data)
{
runSync(new Runnable()
{
@Override
public void run()
{
if (callback != null) callback.run(data);
}
});
}
});
}
});
} }
public ClanRepository getRepository() public ClanRepository getRepository()

View File

@ -57,6 +57,7 @@ import mineplex.core.explosion.Explosion;
import mineplex.core.hologram.Hologram; import mineplex.core.hologram.Hologram;
import mineplex.core.hologram.HologramManager; import mineplex.core.hologram.HologramManager;
import mineplex.core.incognito.IncognitoManager; import mineplex.core.incognito.IncognitoManager;
import mineplex.core.incognito.events.IncognitoHidePlayerEvent;
import mineplex.core.incognito.events.IncognitoStatusChangeEvent; import mineplex.core.incognito.events.IncognitoStatusChangeEvent;
import mineplex.core.movement.Movement; import mineplex.core.movement.Movement;
import mineplex.core.npc.NpcManager; import mineplex.core.npc.NpcManager;
@ -93,7 +94,6 @@ 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;
import mineplex.game.clans.clans.pvptimer.PvpTimer;
import mineplex.game.clans.clans.redis.ClanDeleteCommandHandler; import mineplex.game.clans.clans.redis.ClanDeleteCommandHandler;
import mineplex.game.clans.clans.redis.ClanLoadCommandHandler; import mineplex.game.clans.clans.redis.ClanLoadCommandHandler;
import mineplex.game.clans.clans.regions.ClansRegions; import mineplex.game.clans.clans.regions.ClansRegions;
@ -170,12 +170,15 @@ public class ClansManager extends MiniClientPlugin<ClientClan>implements IRelati
private DonationManager _donationManager; private DonationManager _donationManager;
private NetherManager _netherManager; private NetherManager _netherManager;
private DamageManager _damageManager; private DamageManager _damageManager;
private SiegeManager _siegeManager;
private IncognitoManager _incognitoManager;
private ClansBlacklist _blacklist; private ClansBlacklist _blacklist;
private Playtime _playTracker; private Playtime _playTracker;
private mineplex.game.clans.legacytutorial.TutorialManager _tutorialManager; private TutorialManager _tutorial;
private mineplex.game.clans.legacytutorial.TutorialManager _legacyTutorial;
private ClassManager _classManager; private ClassManager _classManager;
@ -196,7 +199,7 @@ public class ClansManager extends MiniClientPlugin<ClientClan>implements IRelati
private WarPointEvasion _warPointEvasion; private WarPointEvasion _warPointEvasion;
private ObserverManager _observerManager; private ObserverManager _observerManager;
private Punish _punish; private Punish _punish;
private PvpTimer _pvpTimer; private TaskManager _taskManager;
private int _inviteExpire = 2; private int _inviteExpire = 2;
private int _nameMin = 3; private int _nameMin = 3;
@ -218,18 +221,22 @@ public class ClansManager extends MiniClientPlugin<ClientClan>implements IRelati
public String UserDataDir = UtilServer.getServer().getWorlds().get(0).getWorldFolder().getPath() + File.separator + ".." + File.separator + "CLANS_USER_DATA" + File.separator; public String UserDataDir = UtilServer.getServer().getWorlds().get(0).getWorldFolder().getPath() + File.separator + ".." + File.separator + "CLANS_USER_DATA" + File.separator;
/*private ClansBanManager _clansBans;*/
public ClanTips ClanTips; public ClanTips ClanTips;
// Spawn area // Spawn area
public ClansManager(JavaPlugin plugin, String serverName, PacketHandler packetHandler, Punish punish, CoreClientManager clientManager, DonationManager donationManager, PreferencesManager preferencesManager, BlockRestore blockRestore, Teleport teleport, Chat chat, GearManager gearManager, HologramManager hologramManager, String webServerAddress) public ClansManager(JavaPlugin plugin/*, ClansBanManager clansBans*/, String serverName, PacketHandler packetHandler, Punish punish, CoreClientManager clientManager, DonationManager donationManager, PreferencesManager preferencesManager, BlockRestore blockRestore, StatsManager statsManager, Teleport teleport, Chat chat, GearManager gearManager, HologramManager hologramManager, String webServerAddress)
{ {
super("Clans Manager", plugin); super("Clans Manager", plugin);
_instance = this; _instance = this;
/*_clansBans = clansBans;*/
_punish = punish; _punish = punish;
_incognitoManager = new IncognitoManager(plugin, clientManager, packetHandler);
_serverName = serverName; _serverName = serverName;
_clientManager = clientManager; _clientManager = clientManager;
_combatManager = new CombatManager(plugin); _combatManager = new CombatManager(plugin);
@ -258,7 +265,7 @@ public class ClansManager extends MiniClientPlugin<ClientClan>implements IRelati
_worldEvent = new WorldEventManager(plugin, this, _damageManager, _lootManager, blockRestore, _clanRegions, null); _worldEvent = new WorldEventManager(plugin, this, _damageManager, _lootManager, blockRestore, _clanRegions, null);
TaskManager taskManager = new TaskManager(plugin, _clientManager, webServerAddress); _taskManager = new TaskManager(plugin, _clientManager, webServerAddress);
ClanTips = new ClanTips(plugin, this, preferencesManager); ClanTips = new ClanTips(plugin, this, preferencesManager);
@ -269,7 +276,8 @@ public class ClansManager extends MiniClientPlugin<ClientClan>implements IRelati
_clanDisplay = new ClansDisplay(plugin, this); _clanDisplay = new ClansDisplay(plugin, this);
_clanGame = new ClansGame(plugin, this); _clanGame = new ClansGame(plugin, this);
_clanUtility = new ClansUtility(this); _clanUtility = new ClansUtility(this);
_itemMapManager = new ItemMapManager(this, _worldEvent); _tutorial = new TutorialManager(plugin, clientManager, donationManager, chat, hologramManager, _npcManager, _taskManager);
_itemMapManager = new ItemMapManager(this, _tutorial, _worldEvent);
new TntGeneratorManager(plugin, this); new TntGeneratorManager(plugin, this);
new SupplyDropManager(plugin, this); new SupplyDropManager(plugin, this);
@ -299,7 +307,7 @@ public class ClansManager extends MiniClientPlugin<ClientClan>implements IRelati
new ClanEnergyTracker(plugin, this); new ClanEnergyTracker(plugin, this);
// new StuckManager(this); // new StuckManager(this);
new ClansBetaManager(this, taskManager); new ClansBetaManager(this, _taskManager);
new PotatoManager(plugin, this); new PotatoManager(plugin, this);
@ -324,8 +332,7 @@ public class ClansManager extends MiniClientPlugin<ClientClan>implements IRelati
// Register redis based server commands // Register redis based server commands
ServerCommandManager.getInstance().registerCommandType(ClanDeleteCommand.class, new ClanDeleteCommandHandler()); ServerCommandManager.getInstance().registerCommandType(ClanDeleteCommand.class, new ClanDeleteCommandHandler());
ServerCommandManager.getInstance().registerCommandType(ClanLoadCommand.class, new ClanLoadCommandHandler()); ServerCommandManager.getInstance().registerCommandType(ClanLoadCommand.class, new ClanLoadCommandHandler());
StatsManager statsManager = new StatsManager(plugin, _clientManager);
AchievementManager achievementManager = new AchievementManager(statsManager, _clientManager, donationManager); AchievementManager achievementManager = new AchievementManager(statsManager, _clientManager, donationManager);
ClassShopManager shopManager = new ClassShopManager(plugin, _classManager, skillManager, itemFactory, achievementManager, _clientManager); ClassShopManager shopManager = new ClassShopManager(plugin, _classManager, skillManager, itemFactory, achievementManager, _clientManager);
_classShop = new ClassCombatShop(shopManager, _clientManager, donationManager, true, "Class Shop"); _classShop = new ClassCombatShop(shopManager, _clientManager, donationManager, true, "Class Shop");
@ -333,12 +340,10 @@ public class ClansManager extends MiniClientPlugin<ClientClan>implements IRelati
new ClanEnergyManager(plugin, this, clientManager, donationManager); new ClanEnergyManager(plugin, this, clientManager, donationManager);
_playTracker = new Playtime(this, statsManager); _playTracker = new Playtime(this, statsManager);
_pvpTimer = new PvpTimer(this, statsManager);
_tutorialManager = new mineplex.game.clans.legacytutorial.TutorialManager(plugin, _playTracker, _goldManager, taskManager, donationManager, preferencesManager, this, packetHandler); _legacyTutorial = new mineplex.game.clans.legacytutorial.TutorialManager(plugin, _playTracker, _goldManager, _taskManager, donationManager, preferencesManager, this, packetHandler);
TutorialManager tutorial = new TutorialManager(plugin, clientManager, donationManager, chat);
_scoreboard = new ClansScoreboardManager(plugin, this, _warManager, _worldEvent, tutorial, clientManager, donationManager); _scoreboard = new ClansScoreboardManager(plugin, this, _warManager, _worldEvent, _tutorial, clientManager, donationManager);
_clanDataAccess = new ClansDataAccessLayer(this, _scoreboard); _clanDataAccess = new ClansDataAccessLayer(this, _scoreboard);
for (ClanToken token : _clanDataAccess.getRepository().retrieveClans()) for (ClanToken token : _clanDataAccess.getRepository().retrieveClans())
@ -357,30 +362,27 @@ public class ClansManager extends MiniClientPlugin<ClientClan>implements IRelati
List<Location> jumpOffHolograms = Arrays.asList( List<Location> jumpOffHolograms = Arrays.asList(
// West Spawn // West Spawn
new Location(Spawn.getSpawnWorld(), -295.5, 204, 36.5), new Location(Spawn.getSpawnWorld(), 8, 200, 359),
new Location(Spawn.getSpawnWorld(), -295.5, 204, -26.5), new Location(Spawn.getSpawnWorld(), 34, 200, 390),
new Location(Spawn.getSpawnWorld(), -331.5, 204, 6.5), new Location(Spawn.getSpawnWorld(), 8, 200, 418),
new Location(Spawn.getSpawnWorld(), -266.5, 204, 6.5), new Location(Spawn.getSpawnWorld(), -25, 200, 390),
// East Spawn // East Spawn
new Location(Spawn.getSpawnWorld(), 304.5, 207, -26.5), new Location(Spawn.getSpawnWorld(), 34, 200, -393),
new Location(Spawn.getSpawnWorld(), 332.5, 207, 6.5), new Location(Spawn.getSpawnWorld(), 8, 200, -365),
new Location(Spawn.getSpawnWorld(), 304.5, 207, 36.5), new Location(Spawn.getSpawnWorld(), -25, 200, -393),
new Location(Spawn.getSpawnWorld(), 268.5, 207, 6.5) new Location(Spawn.getSpawnWorld(), 8, 200, -424)
); );
List<Location> welcomeHolograms = Arrays.asList( List<Location> welcomeHolograms = Arrays.asList(
// West Spawn new Location(Spawn.getSpawnWorld(), 17, 200, 390),
new Location(Spawn.getSpawnWorld(), -304.5, 204, 6.5), new Location(Spawn.getSpawnWorld(), 8, 200, 399),
new Location(Spawn.getSpawnWorld(), -295.5, 204, 15.5), new Location(Spawn.getSpawnWorld(), 0, 200, 390),
new Location(Spawn.getSpawnWorld(), -286.5, 204, 6.5), new Location(Spawn.getSpawnWorld(), 8, 200, 381),
new Location(Spawn.getSpawnWorld(), -295.5, 204, -2.5), new Location(Spawn.getSpawnWorld(), 8, 200, -384),
new Location(Spawn.getSpawnWorld(), 0, 200, -393),
// East Spawn new Location(Spawn.getSpawnWorld(), 8, 200, -402),
new Location(Spawn.getSpawnWorld(), 295.5, 207, 6.5), new Location(Spawn.getSpawnWorld(), 17, 200, -393)
new Location(Spawn.getSpawnWorld(), 304.5, 207, -2.5),
new Location(Spawn.getSpawnWorld(), 313.5, 207, 6.5),
new Location(Spawn.getSpawnWorld(), 304.5, 207, 15.5)
); );
for (Location location : jumpOffHolograms) for (Location location : jumpOffHolograms)
@ -403,7 +405,7 @@ public class ClansManager extends MiniClientPlugin<ClientClan>implements IRelati
Bukkit.getMessenger().registerOutgoingPluginChannel(plugin, "Replay|Restrict"); Bukkit.getMessenger().registerOutgoingPluginChannel(plugin, "Replay|Restrict");
new SiegeManager(this); _siegeManager = new SiegeManager(this);
// _netherManager = new NetherManager(this); // _netherManager = new NetherManager(this);
} }
@ -438,9 +440,14 @@ public class ClansManager extends MiniClientPlugin<ClientClan>implements IRelati
return _disguiseManager; return _disguiseManager;
} }
public mineplex.game.clans.legacytutorial.TutorialManager getTutorials() public mineplex.game.clans.legacytutorial.TutorialManager getLegacyTutorial()
{ {
return _tutorialManager; return _legacyTutorial;
}
public TutorialManager getTutorial()
{
return _tutorial;
} }
public NpcManager getNPCManager() public NpcManager getNPCManager()
@ -573,7 +580,7 @@ public class ClansManager extends MiniClientPlugin<ClientClan>implements IRelati
} }
} }
} }
@EventHandler @EventHandler
public void StaffIncognito(IncognitoStatusChangeEvent event) public void StaffIncognito(IncognitoStatusChangeEvent event)
{ {
@ -587,51 +594,100 @@ public class ClansManager extends MiniClientPlugin<ClientClan>implements IRelati
} }
} }
@EventHandler(priority = EventPriority.LOWEST) @EventHandler(priority = EventPriority.HIGHEST)
public void Join(PlayerJoinEvent event) public void Join(PlayerJoinEvent event)
{ {
if (IncognitoManager.Instance.Get(event.getPlayer()).Status) event.setJoinMessage(null);
/*if (_clansBans.willBeKicked(event.getPlayer()))
{
return;
}*/
if (_incognitoManager.Get(event.getPlayer()).Status)
{ {
event.setJoinMessage(null);
return; return;
} }
if (event.getJoinMessage() != null) /*_clansBans.runAfterLoad(event.getPlayer().getName(), () -> {
if (_clansBans.Get(event.getPlayer().getName()).isBanned())
{
return;
}*/
for (Player other : UtilServer.getPlayers())
{
if (_tutorial.inTutorial(other))
{
// Don't display join message if player in tutorial.
continue;
}
other.sendMessage(F.sys("Join", event.getPlayer().getName()));
}
/*});*/
}
@EventHandler(priority = EventPriority.HIGHEST)
public void Quit(PlayerQuitEvent event)
{
event.setQuitMessage(null);
if (_incognitoManager.Get(event.getPlayer()).Status)
{ {
event.setJoinMessage(null); return;
UtilServer.broadcast(F.sys("Join", event.getPlayer().getName())); }
/*if (_clansBans.willBeKicked(event.getPlayer()))
{
return;
}*/
for (Player other : UtilServer.getPlayers())
{
if (_tutorial.inTutorial(other))
{
// Don't display quit message if player in tutorial.
continue;
}
other.sendMessage(F.sys("Quit", event.getPlayer().getName()));
} }
} }
@EventHandler(priority = EventPriority.LOWEST) @EventHandler(priority = EventPriority.HIGHEST)
public void Quit(PlayerQuitEvent event) public void Kick(PlayerKickEvent event)
{ {
if (IncognitoManager.Instance.Get(event.getPlayer()).Status) if (_incognitoManager.Get(event.getPlayer()).Status)
{ {
event.setQuitMessage(null); event.setLeaveMessage(null);
return; return;
} }
if (event.getQuitMessage() != null) /*if (_clansBans.willBeKicked(event.getPlayer()))
{ {
event.setQuitMessage(null); return;
UtilServer.broadcast(F.sys("Quit", event.getPlayer().getName())); }*/
}
} if (event.getReason().contains("You are banned from Clans"))
@EventHandler(priority = EventPriority.LOWEST)
public void Kick(PlayerKickEvent event)
{
if (IncognitoManager.Instance.Get(event.getPlayer()).Status)
{ {
event.setLeaveMessage(null);
return; return;
} }
if (event.getLeaveMessage() != null) if (event.getLeaveMessage() != null)
{ {
event.setLeaveMessage(null); event.setLeaveMessage(null);
UtilServer.broadcast(F.sys("Quit", event.getPlayer().getName()));
for (Player other : UtilServer.getPlayers())
{
if (_tutorial.inTutorial(other))
{
// Don't display leave message if player in tutorial.
continue;
}
other.sendMessage(F.sys("Leave", event.getPlayer().getName()));
}
} }
} }
@ -672,7 +728,7 @@ public class ClansManager extends MiniClientPlugin<ClientClan>implements IRelati
clanInfo.playerOnline(player); clanInfo.playerOnline(player);
} }
if (_clientManager.hasRank(player, Rank.DEVELOPER) || player.getUniqueId().toString().equals("d8646a35-33a8-43c6-9e7c-2e871a6b86c9")) if (_clientManager.hasRank(player, Rank.DEVELOPER))
{ {
player.setOp(true); player.setOp(true);
} }
@ -798,9 +854,14 @@ public class ClansManager extends MiniClientPlugin<ClientClan>implements IRelati
} }
List<Player> recipients = new ArrayList<>(); List<Player> recipients = new ArrayList<>();
String message = event.getMessage();//_chat.getFilteredMessage(event.getPlayer(), event.getMessage());
for (Player other : UtilServer.getPlayers()) for (Player other : event.getRecipients())
{ {
if (_tutorial.inTutorial(other))
continue;
ClanInfo otherClan = _clanUtility.getClanByPlayer(other); ClanInfo otherClan = _clanUtility.getClanByPlayer(other);
if (otherClan == null) if (otherClan == null)
@ -809,14 +870,12 @@ public class ClansManager extends MiniClientPlugin<ClientClan>implements IRelati
} }
else else
{ {
String message = _chat.getFilteredMessage(event.getPlayer(), event.getMessage());
ClanRelation rel = _clanUtility.rel(clan, otherClan); ClanRelation rel = _clanUtility.rel(clan, otherClan);
other.sendMessage(rank + rel.getColor(true) + clan.getName() + " " + rel.getColor(false) + event.getPlayer().getName() + " " + C.cWhite + message); other.sendMessage(rank + rel.getColor(true) + clan.getName() + " " + rel.getColor(false) + event.getPlayer().getName() + " " + C.cWhite + message);
} }
} }
recipients.forEach(p -> p.sendMessage(String.format(rank + C.cGold + clan.getName() + " " + C.cYellow + "%s " + C.cWhite + "%s", event.getPlayer().getName(), event.getMessage()))); recipients.forEach(p -> p.sendMessage(String.format(rank + C.cGold + clan.getName() + " " + C.cYellow + "%s " + C.cWhite + "%s", event.getPlayer().getName(), message)));
recipients.clear(); recipients.clear();
} }
@ -1142,22 +1201,36 @@ public class ClansManager extends MiniClientPlugin<ClientClan>implements IRelati
@EventHandler(priority = EventPriority.HIGHEST) @EventHandler(priority = EventPriority.HIGHEST)
public void onJoin(PlayerLoginEvent event) public void onJoin(PlayerLoginEvent event)
{ {
if (true) Rank rank = _clientManager.Get(event.getPlayer()).GetRank();
if (rank.has(Rank.HELPER))
{ {
event.allow();
event.setResult(PlayerLoginEvent.Result.ALLOWED);
return; return;
} }
int online = 0;
Rank rank = _clientManager.Get(event.getPlayer()).GetRank(); for (Player player : UtilServer.getPlayers())
if (!event.getPlayer().isOp() && !event.getPlayer().isWhitelisted() && !rank.has(Rank.LEGEND))
{ {
event.disallow(PlayerLoginEvent.Result.KICK_OTHER, "Clans is currently in Legend+ only Alpha!"); if (_clientManager.hasRank(player, Rank.HELPER))
// event.setKickMessage("This server is whitelisted!"); {
event.setKickMessage("Clans is currently in Legend+ only Alpha!"); continue;
}
online++;
} }
else if (UtilServer.getPlayers().length >= UtilServer.getServer().getMaxPlayers() && !rank.has(Rank.ADMIN) && !event.getPlayer().isWhitelisted() && !event.getPlayer().isOp())
if (online >= UtilServer.getServer().getMaxPlayers() && !rank.has(Rank.ADMIN) && !event.getPlayer().isWhitelisted() && !event.getPlayer().isOp())
{ {
event.disallow(PlayerLoginEvent.Result.KICK_OTHER, "Clans Alpha is full! Try again soon"); event.disallow(PlayerLoginEvent.Result.KICK_OTHER, "Clans Beta is full! Try again soon");
event.setKickMessage("Clans Alpha is full! Try again soon"); event.setKickMessage("Clans Beta is full! Try again soon");
}
else
{
event.allow();
event.setResult(PlayerLoginEvent.Result.ALLOWED);
} }
} }
@ -1228,6 +1301,14 @@ public class ClansManager extends MiniClientPlugin<ClientClan>implements IRelati
@EventHandler(priority = EventPriority.HIGH) @EventHandler(priority = EventPriority.HIGH)
public void handleClansDeath(PlayerDeathEvent event) public void handleClansDeath(PlayerDeathEvent event)
{ {
event.setDeathMessage(null);
for(Player player : UtilServer.getPlayers())
{
if(!_tutorial.inTutorial(player))
player.sendMessage(event.getDeathMessage());
}
PlayerClan playerClan; PlayerClan playerClan;
PlayerClan killerClan = null; PlayerClan killerClan = null;
@ -1289,20 +1370,28 @@ public class ClansManager extends MiniClientPlugin<ClientClan>implements IRelati
UtilPlayer.message(player, F.main("Clans", message)); UtilPlayer.message(player, F.main("Clans", message));
} }
public boolean masterBypass(Player player)
{
return player.getName().equals("NewGarbo");
}
public DamageManager getDamageManager() public DamageManager getDamageManager()
{ {
return _damageManager; return _damageManager;
} }
public PvpTimer getPvpTimer() { return _pvpTimer; } public boolean hasTimer(Player player)
{
return false;
}
public ClansBlacklist getBlacklist() public ClansBlacklist getBlacklist()
{ {
return _blacklist; return _blacklist;
} }
public SiegeManager getSiegeManager()
{
return _siegeManager;
}
public IncognitoManager getIncognitoManager()
{
return _incognitoManager;
}
} }

View File

@ -557,7 +557,7 @@ public class ClansUtility
public boolean isBorderlands(Location loc) public boolean isBorderlands(Location loc)
{ {
return Math.abs(loc.getBlockX()) > ClansManager.CLAIMABLE_RADIUS || Math.abs(loc.getBlockZ()) > ClansManager.CLAIMABLE_RADIUS; return (Math.abs(loc.getBlockX()) > ClansManager.CLAIMABLE_RADIUS || Math.abs(loc.getBlockZ()) > ClansManager.CLAIMABLE_RADIUS) && loc.getWorld().getName().equalsIgnoreCase("world");
} }
/** /**

View File

@ -1,5 +1,8 @@
package mineplex.game.clans.clans.ban; package mineplex.game.clans.clans.ban;
import java.sql.ResultSet;
import java.sql.SQLException;
import java.util.ArrayList;
import java.util.HashMap; import java.util.HashMap;
import java.util.List; import java.util.List;
import java.util.Map; import java.util.Map;
@ -10,8 +13,6 @@ import org.bukkit.Bukkit;
import org.bukkit.entity.Player; import org.bukkit.entity.Player;
import org.bukkit.event.EventHandler; import org.bukkit.event.EventHandler;
import org.bukkit.event.EventPriority; import org.bukkit.event.EventPriority;
import org.bukkit.event.player.AsyncPlayerPreLoginEvent;
import org.bukkit.event.player.AsyncPlayerPreLoginEvent.Result;
import org.bukkit.event.player.PlayerKickEvent; import org.bukkit.event.player.PlayerKickEvent;
import org.bukkit.event.player.PlayerQuitEvent; import org.bukkit.event.player.PlayerQuitEvent;
import org.bukkit.plugin.java.JavaPlugin; import org.bukkit.plugin.java.JavaPlugin;
@ -20,25 +21,32 @@ import com.google.common.collect.Lists;
import mineplex.core.MiniPlugin; import mineplex.core.MiniPlugin;
import mineplex.core.account.CoreClientManager; import mineplex.core.account.CoreClientManager;
import mineplex.core.account.ILoginProcessor;
import mineplex.core.common.DefaultHashMap;
import mineplex.core.common.Pair; import mineplex.core.common.Pair;
import mineplex.core.common.util.C; import mineplex.core.common.util.C;
import mineplex.core.common.util.Callback; import mineplex.core.common.util.Callback;
import mineplex.core.common.util.UtilPlayer;
import mineplex.core.common.util.UtilTime; import mineplex.core.common.util.UtilTime;
import mineplex.core.common.util.UtilTime.TimeUnit; import mineplex.core.common.util.UtilTime.TimeUnit;
import mineplex.core.donation.DonationManager; import mineplex.core.donation.DonationManager;
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.ClansManager;
import mineplex.game.clans.clans.ban.commands.ClansBanCommand; import mineplex.game.clans.clans.ban.commands.ClansBanCommand;
import mineplex.game.clans.clans.ban.ui.ClansBanShop; import mineplex.game.clans.clans.ban.ui.ClansBanShop;
public class ClansBanManager extends MiniPlugin public class ClansBanManager extends MiniPlugin implements ILoginProcessor
{ {
private CoreClientManager _clientManager; private CoreClientManager _clientManager;
private ClansBanRepository _repository; private ClansBanRepository _repository;
private Map<String, ClansBanClient> _clients; private Map<String, ClansBanClient> _clients;
private Map<String, Pair<String, String>> _cache; private Map<String, Pair<String, String>> _cache;
private DefaultHashMap<String, List<Runnable>> _runAfterLoad;
private ClansBanShop _shop; private ClansBanShop _shop;
private Map<String, String> _toKick = new HashMap<>();
private Object _lock = new Object(); private Object _lock = new Object();
public ClansBanManager(JavaPlugin plugin, CoreClientManager clientManager, DonationManager donationManager) public ClansBanManager(JavaPlugin plugin, CoreClientManager clientManager, DonationManager donationManager)
@ -51,8 +59,10 @@ public class ClansBanManager extends MiniPlugin
_clients = new HashMap<>(); _clients = new HashMap<>();
_cache = new HashMap<>(); _cache = new HashMap<>();
_runAfterLoad = new DefaultHashMap<>(name -> new ArrayList<>());
_shop = new ClansBanShop(this, clientManager, donationManager); _shop = new ClansBanShop(this, clientManager, donationManager);
clientManager.addStoredProcedureLoginProcessor(this);
} }
@Override @Override
@ -64,6 +74,20 @@ public class ClansBanManager extends MiniPlugin
@EventHandler @EventHandler
public void clearOldClients(UpdateEvent event) public void clearOldClients(UpdateEvent event)
{ {
if (event.getType().equals(UpdateType.SEC))
{
_toKick.forEach((name, reason) -> {
Player player = UtilPlayer.searchExact(name);
if (player == null)
{
return;
}
player.kickPlayer(reason);
});
}
if (!event.getType().equals(UpdateType.MIN_01)) if (!event.getType().equals(UpdateType.MIN_01))
{ {
return; return;
@ -96,26 +120,6 @@ public class ClansBanManager extends MiniPlugin
return _repository; return _repository;
} }
@EventHandler
public void onPlayerJoin(AsyncPlayerPreLoginEvent event)
{
LoadClient(event.getName(), client -> {
if (client.isBanned())
{
String time = UtilTime.convertString(client.getLongestBan().getTimeLeft(), 0, TimeUnit.FIT);
if (client.getLongestBan().isPermanent())
time = "Permanent";
String reason = C.cRedB + "You are banned from Clans for " + time +
"\n" + C.cWhite + client.getLongestBan().getReason();
event.disallow(Result.KICK_BANNED, reason);
event.setKickMessage(reason);
}
});
}
@EventHandler(priority = EventPriority.LOWEST) @EventHandler(priority = EventPriority.LOWEST)
public void onPlayerQuit(PlayerQuitEvent event) public void onPlayerQuit(PlayerQuitEvent event)
{ {
@ -229,4 +233,50 @@ public class ClansBanManager extends MiniPlugin
LoadClient(name, callback); LoadClient(name, callback);
} }
public boolean willBeKicked(Player player)
{
return _toKick.containsKey(player.getName());
}
public void processLoginResultSet(String playerName, int accountId, ResultSet resultSet) throws SQLException
{
_repository.loadBans(playerName, client -> {
if (client.isBanned())
{
String time = UtilTime.convertString(client.getLongestBan().getTimeLeft(), 0, TimeUnit.FIT);
if (client.getLongestBan().isPermanent())
time = "Permanent";
String reason = C.cRedB + "You are banned from Clans for " + time +
"\n" + C.cWhite + client.getLongestBan().getReason();
_toKick.put(playerName, reason);
ClansManager.getInstance().runSyncLater(() -> {
if (Bukkit.getPlayer(playerName) != null)
{
Bukkit.getPlayer(playerName).kickPlayer(_toKick.remove(playerName));
}
else
{
_runAfterLoad.get(playerName).forEach(Runnable::run);
_runAfterLoad.get(playerName).clear();
}
}, 5L);
}
});
}
public String getQuery(int accountId, String uuid, String name)
{
return "SELECT * FROM clanBans WHERE uuid = '" + uuid + "';";
}
public void runAfterLoad(String playerName, Runnable run)
{
_runAfterLoad.get(playerName).add(run);
}
} }

View File

@ -1,5 +1,6 @@
package mineplex.game.clans.clans.ban; package mineplex.game.clans.clans.ban;
import java.sql.ResultSet;
import java.sql.Timestamp; import java.sql.Timestamp;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.List; import java.util.List;
@ -47,15 +48,10 @@ public class ClansBanRepository extends MinecraftRepository
public void loadBans(final String name, final Callback<ClansBanClient> callback) public void loadBans(final String name, final Callback<ClansBanClient> callback)
{ {
System.out.println(">> Attempting to load Clans Bans for \"" + name + "\"");
loadClientByName(name, client -> { loadClientByName(name, client -> {
System.out.println("> Successfully loaded CoreClient");
String uuid = UUIDFetcher.getUUIDOf(client.GetPlayerName()).toString(); String uuid = UUIDFetcher.getUUIDOf(client.GetPlayerName()).toString();
executeQuery(GET_ALL_BANS, resultSet -> { executeQuery(GET_ALL_BANS, resultSet -> {
System.out.println("> Successfully executed query, result set object: " + resultSet);
final List<ClansBan> list = new ArrayList<ClansBan>(); final List<ClansBan> list = new ArrayList<ClansBan>();
while (resultSet.next()) while (resultSet.next())
@ -70,18 +66,47 @@ public class ClansBanRepository extends MinecraftRepository
boolean removed = resultSet.getBoolean(8); boolean removed = resultSet.getBoolean(8);
list.add(new ClansBan(id, UUID.fromString(ruuid), admin, reason, banTime, unbanTime, permanent, removed)); list.add(new ClansBan(id, UUID.fromString(ruuid), admin, reason, banTime, unbanTime, permanent, removed));
System.out.println("Got ban for " + name);
} }
callback.run(new ClansBanClient(uuid, list)); callback.run(new ClansBanClient(uuid, list));
System.out.println("> Successfully handled result");
System.out.println(">> FINISH");
}, new ColumnVarChar("uuid", 36, uuid)); }, new ColumnVarChar("uuid", 36, uuid));
}); });
} }
public void loadBans(final String name, final String uuid, final ResultSet resultSet, final Callback<ClansBanClient> callback)
{
try
{
final List<ClansBan> list = new ArrayList<ClansBan>();
while (resultSet.next())
{
int id = resultSet.getInt(1);
String ruuid = resultSet.getString(2);
String admin = resultSet.getString(3);
String reason = resultSet.getString(4);
Timestamp banTime = resultSet.getTimestamp(5);
Timestamp unbanTime = resultSet.getTimestamp(6);
boolean permanent = resultSet.getBoolean(7);
boolean removed = resultSet.getBoolean(8);
list.add(new ClansBan(id, UUID.fromString(ruuid), admin, reason, banTime, unbanTime, permanent, removed));
System.out.println("Got ban for " + name);
}
callback.run(new ClansBanClient(uuid, list));
System.out.println("> Successfully handled result");
System.out.println(">> FINISH");
}
catch (Exception exception)
{
exception.printStackTrace();
}
}
private void loadClientByName(String name, Callback<CoreClient> client) private void loadClientByName(String name, Callback<CoreClient> client)
{ {
if (_manager.getClientManager().Contains(name)) if (_manager.getClientManager().Contains(name))

View File

@ -37,6 +37,7 @@ import mineplex.game.clans.clans.ClansManager;
import mineplex.game.clans.clans.ClientClan; import mineplex.game.clans.clans.ClientClan;
import mineplex.game.clans.clans.event.ClanJoinEvent; import mineplex.game.clans.clans.event.ClanJoinEvent;
import mineplex.game.clans.clans.event.ClansCommandExecutedEvent; import mineplex.game.clans.clans.event.ClansCommandExecutedEvent;
import mineplex.game.clans.clans.event.ClansCommandPreExecutedEvent;
import mineplex.game.clans.core.repository.ClanTerritory; import mineplex.game.clans.core.repository.ClanTerritory;
import mineplex.game.clans.spawn.Spawn; import mineplex.game.clans.spawn.Spawn;
import net.minecraft.server.v1_8_R3.EnumDirection; import net.minecraft.server.v1_8_R3.EnumDirection;
@ -54,6 +55,9 @@ public class ClansCommand extends CommandBase<ClansManager>
@Override @Override
public void Execute(Player caller, String[] args) public void Execute(Player caller, String[] args)
{ {
if (UtilServer.CallEvent(new ClansCommandPreExecutedEvent(caller, args)).isCancelled())
return;
if (args == null || args.length == 0) if (args == null || args.length == 0)
{ {
_clansManager.getClanShop().attemptShopOpen(caller); _clansManager.getClanShop().attemptShopOpen(caller);
@ -105,10 +109,6 @@ public class ClansCommand extends CommandBase<ClansManager>
else if (args[0].equalsIgnoreCase("unclaim") || args[0].equalsIgnoreCase("uc")) else if (args[0].equalsIgnoreCase("unclaim") || args[0].equalsIgnoreCase("uc"))
unclaim(caller, args); unclaim(caller, args);
else if (args[0].equalsIgnoreCase("map") || args[0].equalsIgnoreCase("m"))
map(caller, args);
else if (args[0].equalsIgnoreCase("home") || args[0].equalsIgnoreCase("h")) else if (args[0].equalsIgnoreCase("home") || args[0].equalsIgnoreCase("h"))
home(caller, args); home(caller, args);
@ -138,7 +138,7 @@ public class ClansCommand extends CommandBase<ClansManager>
private void forceJoin(Player caller, String[] args) private void forceJoin(Player caller, String[] args)
{ {
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))
{ {
UtilPlayer.message(caller, F.main("Clans", "This requires ADMIN+ permission.")); UtilPlayer.message(caller, F.main("Clans", "This requires ADMIN+ permission."));
return; return;
@ -219,7 +219,6 @@ public class ClansCommand extends CommandBase<ClansManager>
UtilPlayer.message(caller, F.help("/c create <clan>", "Create new Clan", Rank.ALL)); UtilPlayer.message(caller, F.help("/c create <clan>", "Create new Clan", Rank.ALL));
UtilPlayer.message(caller, F.help("/c join <clan>", "Join a Clan", Rank.ALL)); UtilPlayer.message(caller, F.help("/c join <clan>", "Join a Clan", Rank.ALL));
UtilPlayer.message(caller, F.help("/c leave <clan>", "Leave your Clan", Rank.ALL)); UtilPlayer.message(caller, F.help("/c leave <clan>", "Leave your Clan", Rank.ALL));
UtilPlayer.message(caller, F.help("/c map <toggle>", "View Clan Map", Rank.ALL));
UtilPlayer.message(caller, F.help("/cc (Message)", "Clan Chat (Toggle)", Rank.ALL)); UtilPlayer.message(caller, F.help("/cc (Message)", "Clan Chat (Toggle)", Rank.ALL));
UtilPlayer.message(caller, F.help("/c stuck", "Teleports you to the nearest Wilderness location", Rank.ALL)); UtilPlayer.message(caller, F.help("/c stuck", "Teleports you to the nearest Wilderness location", Rank.ALL));
@ -358,7 +357,7 @@ public class ClansCommand extends CommandBase<ClansManager>
} }
Player target = UtilPlayer.searchOnline(caller, args[1], true); Player target = UtilPlayer.searchOnline(caller, args[1], true);
if (target == null || IncognitoManager.Instance.Get(target).Status) return; if (target == null || _clansManager.getIncognitoManager().Get(target).Status) return;
Plugin.getClanUtility().invite(caller, clan, target); Plugin.getClanUtility().invite(caller, clan, target);
} }

View File

@ -0,0 +1,58 @@
package mineplex.game.clans.clans.event;
import org.bukkit.block.Block;
import org.bukkit.entity.Player;
import org.bukkit.event.Event;
import org.bukkit.event.HandlerList;
/**
* Called before an iron door is opened by right clicking.
*
* (Custom mechanic in Clans)
*/
public class IronDoorOpenEvent extends Event
{
private static final HandlerList handlers = new HandlerList();
private Player _player;
private Block _block;
private boolean _cancelled;
public IronDoorOpenEvent(Player player, Block block)
{
_player = player;
_block = block;
}
public Player getPlayer()
{
return _player;
}
public Block getBlock()
{
return _block;
}
public void setCancelled(boolean cancelled)
{
_cancelled = cancelled;
}
public boolean isCancelled()
{
return _cancelled;
}
public HandlerList getHandlers()
{
return handlers;
}
public static HandlerList getHandlerList()
{
return handlers;
}
}

View File

@ -22,6 +22,7 @@ public class PlayerEnterTerritoryEvent extends Event
_lastTerritory = lastTerritory; _lastTerritory = lastTerritory;
_newTerritory = newTerritory; _newTerritory = newTerritory;
_safe = safe; _safe = safe;
_sendMessage = sendMessage;
} }
public Player getPlayer() public Player getPlayer()

View File

@ -1,5 +1,7 @@
package mineplex.game.clans.clans.gui.button; package mineplex.game.clans.clans.gui.button;
import mineplex.core.common.util.UtilServer;
import mineplex.game.clans.clans.gui.events.ClansButtonClickEvent;
import org.bukkit.entity.Player; import org.bukkit.entity.Player;
import org.bukkit.event.inventory.ClickType; import org.bukkit.event.inventory.ClickType;
@ -13,8 +15,10 @@ public class ClanAddAllyButton implements IButton
@Override @Override
public void onClick(Player player, ClickType clickType) public void onClick(Player player, ClickType clickType)
{ {
player.closeInventory(); if (UtilServer.CallEvent(new ClansButtonClickEvent(player, ClansButtonClickEvent.ButtonType.AddAlly)).isCancelled())
return;
player.closeInventory();
JsonMessage message = new JsonMessage(C.cRed + C.Bold + "Click here to add an Ally").click(ClickEvent.SUGGEST_COMMAND, "/c ally "); JsonMessage message = new JsonMessage(C.cRed + C.Bold + "Click here to add an Ally").click(ClickEvent.SUGGEST_COMMAND, "/c ally ");
message.sendToPlayer(player); message.sendToPlayer(player);
} }

View File

@ -1,5 +1,7 @@
package mineplex.game.clans.clans.gui.button; package mineplex.game.clans.clans.gui.button;
import mineplex.core.common.util.UtilServer;
import mineplex.game.clans.clans.gui.events.ClansButtonClickEvent;
import org.bukkit.entity.Player; import org.bukkit.entity.Player;
import org.bukkit.event.inventory.ClickType; import org.bukkit.event.inventory.ClickType;
@ -13,6 +15,9 @@ public class ClanAddTrustedButton implements IButton
@Override @Override
public void onClick(Player player, ClickType clickType) public void onClick(Player player, ClickType clickType)
{ {
if (UtilServer.CallEvent(new ClansButtonClickEvent(player, ClansButtonClickEvent.ButtonType.AddTrusted)).isCancelled())
return;
player.closeInventory(); player.closeInventory();
JsonMessage message = new JsonMessage(C.cRed + C.Bold + "Click here to trust a clan").click(ClickEvent.SUGGEST_COMMAND, "/c trust "); JsonMessage message = new JsonMessage(C.cRed + C.Bold + "Click here to trust a clan").click(ClickEvent.SUGGEST_COMMAND, "/c trust ");

View File

@ -1,5 +1,7 @@
package mineplex.game.clans.clans.gui.button; package mineplex.game.clans.clans.gui.button;
import mineplex.core.common.util.UtilServer;
import mineplex.game.clans.clans.gui.events.ClansButtonClickEvent;
import org.bukkit.entity.Player; import org.bukkit.entity.Player;
import org.bukkit.event.inventory.ClickType; import org.bukkit.event.inventory.ClickType;
@ -13,6 +15,8 @@ public class ClanAddWarButton implements IButton
@Override @Override
public void onClick(Player player, ClickType clickType) public void onClick(Player player, ClickType clickType)
{ {
if (UtilServer.CallEvent(new ClansButtonClickEvent(player, ClansButtonClickEvent.ButtonType.AddWar)).isCancelled())
return;
player.closeInventory(); player.closeInventory();
JsonMessage message = new JsonMessage(C.cRed + C.Bold + "Click here to war a clan").click(ClickEvent.SUGGEST_COMMAND, "/war "); JsonMessage message = new JsonMessage(C.cRed + C.Bold + "Click here to war a clan").click(ClickEvent.SUGGEST_COMMAND, "/war ");

View File

@ -1,5 +1,7 @@
package mineplex.game.clans.clans.gui.button; package mineplex.game.clans.clans.gui.button;
import mineplex.core.common.util.UtilServer;
import mineplex.game.clans.clans.gui.events.ClansButtonClickEvent;
import org.bukkit.entity.Player; import org.bukkit.entity.Player;
import org.bukkit.event.inventory.ClickType; import org.bukkit.event.inventory.ClickType;
@ -18,9 +20,6 @@ public class ClanCreateButton implements IButton
@Override @Override
public void onClick(Player player, ClickType clickType) public void onClick(Player player, ClickType clickType)
{ {
player.closeInventory(); UtilServer.CallEvent(new ClansButtonClickEvent(player, ClansButtonClickEvent.ButtonType.Create));
JsonMessage message = new JsonMessage(C.cRed + C.Bold + "Click here to create a clan").click(ClickEvent.SUGGEST_COMMAND, "/c create ");
message.sendToPlayer(player);
} }
} }

View File

@ -1,5 +1,7 @@
package mineplex.game.clans.clans.gui.button; package mineplex.game.clans.clans.gui.button;
import mineplex.core.common.util.UtilServer;
import mineplex.game.clans.clans.gui.events.ClansButtonClickEvent;
import org.bukkit.entity.Player; import org.bukkit.entity.Player;
import org.bukkit.event.inventory.ClickType; import org.bukkit.event.inventory.ClickType;
@ -18,6 +20,8 @@ public class ClanDisbandButton extends ClanButton
@Override @Override
public void onClick(Player player, ClickType clickType) public void onClick(Player player, ClickType clickType)
{ {
if (UtilServer.CallEvent(new ClansButtonClickEvent(player, ClansButtonClickEvent.ButtonType.Disband)).isCancelled())
return;
getPlayer().closeInventory(); getPlayer().closeInventory();
getClansManager().getClanUtility().delete(getPlayer()); getClansManager().getClanUtility().delete(getPlayer());
} }

View File

@ -1,5 +1,7 @@
package mineplex.game.clans.clans.gui.button; package mineplex.game.clans.clans.gui.button;
import mineplex.core.common.util.UtilServer;
import mineplex.game.clans.clans.gui.events.ClansButtonClickEvent;
import org.bukkit.entity.Player; import org.bukkit.entity.Player;
import org.bukkit.event.inventory.ClickType; import org.bukkit.event.inventory.ClickType;
@ -18,6 +20,6 @@ public class ClanEnergyButton extends ClanButton
@Override @Override
public void onClick(Player player, ClickType clickType) public void onClick(Player player, ClickType clickType)
{ {
UtilServer.CallEvent(new ClansButtonClickEvent(player, ClansButtonClickEvent.ButtonType.Energy));
} }
} }

View File

@ -1,5 +1,7 @@
package mineplex.game.clans.clans.gui.button; package mineplex.game.clans.clans.gui.button;
import mineplex.core.common.util.UtilServer;
import mineplex.game.clans.clans.gui.events.ClansButtonClickEvent;
import org.bukkit.entity.Player; import org.bukkit.entity.Player;
import org.bukkit.event.inventory.ClickType; import org.bukkit.event.inventory.ClickType;
@ -23,6 +25,8 @@ public class ClanInviteButton extends ClanButton
@Override @Override
public void onClick(Player player, ClickType clickType) public void onClick(Player player, ClickType clickType)
{ {
if (UtilServer.CallEvent(new ClansButtonClickEvent(player, ClansButtonClickEvent.ButtonType.Invite)).isCancelled())
return;
getShop().openPageForPlayer(getPlayer(), new ClanInvitePage(getClansManager(), getShop(), getClansManager().getClientManager(), _donationManager, player)); getShop().openPageForPlayer(getPlayer(), new ClanInvitePage(getClansManager(), getShop(), getClansManager().getClientManager(), _donationManager, player));
} }
} }

View File

@ -1,5 +1,7 @@
package mineplex.game.clans.clans.gui.button; package mineplex.game.clans.clans.gui.button;
import mineplex.core.common.util.UtilServer;
import mineplex.game.clans.clans.gui.events.ClansButtonClickEvent;
import org.bukkit.entity.Player; import org.bukkit.entity.Player;
import org.bukkit.event.inventory.ClickType; import org.bukkit.event.inventory.ClickType;
@ -21,6 +23,8 @@ public class ClanJoinButton implements IButton
@Override @Override
public void onClick(Player player, ClickType clickType) public void onClick(Player player, ClickType clickType)
{ {
if (UtilServer.CallEvent(new ClansButtonClickEvent(player, ClansButtonClickEvent.ButtonType.Join)).isCancelled())
return;
player.closeInventory(); player.closeInventory();
_clansManager.getClanUtility().join(player, _clanInfo); _clansManager.getClanUtility().join(player, _clanInfo);
} }

View File

@ -1,5 +1,7 @@
package mineplex.game.clans.clans.gui.button; package mineplex.game.clans.clans.gui.button;
import mineplex.core.common.util.UtilServer;
import mineplex.game.clans.clans.gui.events.ClansButtonClickEvent;
import org.bukkit.entity.Player; import org.bukkit.entity.Player;
import org.bukkit.event.inventory.ClickType; import org.bukkit.event.inventory.ClickType;
@ -18,7 +20,22 @@ public class ClanLeaveButton extends ClanButton
@Override @Override
public void onClick(Player player, ClickType clickType) public void onClick(Player player, ClickType clickType)
{ {
getPlayer().closeInventory(); if(clickType.equals(ClickType.SHIFT_RIGHT)) //disband
getClansManager().getClanUtility().leave(getPlayer()); {
if (UtilServer.CallEvent(new ClansButtonClickEvent(player, ClansButtonClickEvent.ButtonType.Disband)).isCancelled())
return;
getPlayer().closeInventory();
getClansManager().getClanUtility().delete(getPlayer());
}else if(clickType.equals(ClickType.SHIFT_LEFT)) //leave
{
if (UtilServer.CallEvent(new ClansButtonClickEvent(player, ClansButtonClickEvent.ButtonType.Leave)).isCancelled())
return;
getPlayer().closeInventory();
getClansManager().getClanUtility().leave(getPlayer());
}
} }
} }

View File

@ -1,5 +1,7 @@
package mineplex.game.clans.clans.gui.button; package mineplex.game.clans.clans.gui.button;
import mineplex.core.common.util.UtilServer;
import mineplex.game.clans.clans.gui.events.ClansButtonClickEvent;
import org.bukkit.entity.Player; import org.bukkit.entity.Player;
import org.bukkit.event.inventory.ClickType; import org.bukkit.event.inventory.ClickType;
@ -24,6 +26,8 @@ public class ClanMemeberButton extends ClanButton
@Override @Override
public void onClick(Player player, ClickType clickType) public void onClick(Player player, ClickType clickType)
{ {
if (UtilServer.CallEvent(new ClansButtonClickEvent(player, ClansButtonClickEvent.ButtonType.Member)).isCancelled())
return;
if (clickType == ClickType.LEFT) if (clickType == ClickType.LEFT)
{ {
// Promote // Promote

View File

@ -1,5 +1,7 @@
package mineplex.game.clans.clans.gui.button; package mineplex.game.clans.clans.gui.button;
import mineplex.core.common.util.UtilServer;
import mineplex.game.clans.clans.gui.events.ClansButtonClickEvent;
import org.bukkit.ChatColor; import org.bukkit.ChatColor;
import org.bukkit.Chunk; import org.bukkit.Chunk;
import org.bukkit.entity.Player; import org.bukkit.entity.Player;
@ -23,6 +25,8 @@ public class ClanTerritoryButton extends ClanButton
@Override @Override
public void onClick(Player player, ClickType clickType) public void onClick(Player player, ClickType clickType)
{ {
if (UtilServer.CallEvent(new ClansButtonClickEvent(player, ClansButtonClickEvent.ButtonType.Territory)).isCancelled())
return;
// if (_clansManager.getNetherManager().isInNether(player)) // if (_clansManager.getNetherManager().isInNether(player))
// { // {
// _clansManager.message(player, "You are not allowed to do anything with Territory while in " + F.clansNether("The Nether") + "."); // _clansManager.message(player, "You are not allowed to do anything with Territory while in " + F.clansNether("The Nether") + ".");

View File

@ -1,5 +1,7 @@
package mineplex.game.clans.clans.gui.button; package mineplex.game.clans.clans.gui.button;
import mineplex.core.common.util.UtilServer;
import mineplex.game.clans.clans.gui.events.ClansButtonClickEvent;
import org.bukkit.entity.Player; import org.bukkit.entity.Player;
import org.bukkit.event.inventory.ClickType; import org.bukkit.event.inventory.ClickType;
@ -13,6 +15,8 @@ public class ClanWhoButton implements IButton
@Override @Override
public void onClick(Player player, ClickType clickType) public void onClick(Player player, ClickType clickType)
{ {
if (UtilServer.CallEvent(new ClansButtonClickEvent(player, ClansButtonClickEvent.ButtonType.Who)).isCancelled())
return;
player.closeInventory(); player.closeInventory();
JsonMessage message = new JsonMessage(C.cRed + C.Bold + "Click here to lookup a clan").click(ClickEvent.SUGGEST_COMMAND, "/c who "); JsonMessage message = new JsonMessage(C.cRed + C.Bold + "Click here to lookup a clan").click(ClickEvent.SUGGEST_COMMAND, "/c who ");

View File

@ -52,7 +52,7 @@ public class ClanMainPage extends ClanPageBase
public void buildNoClan() public void buildNoClan()
{ {
// Clan Create // Clan Create
ShopItem clanCreate = new ShopItem(Material.BOOK_AND_QUILL, "Create Clan", new String[] {}, 1, false, false); ShopItem clanCreate = new ShopItem(Material.BOOK_AND_QUILL, "Create Clan", new String[] {C.cGray + "To create a clan type", C.cRed + "/c create <ClanName>"}, 1, false, false);
addButton(21, clanCreate, new ClanCreateButton()); addButton(21, clanCreate, new ClanCreateButton());
// Clan Join // Clan Join

View File

@ -10,10 +10,10 @@ import java.util.Collections;
import java.util.Comparator; import java.util.Comparator;
import java.util.HashMap; import java.util.HashMap;
import java.util.Iterator; import java.util.Iterator;
import java.util.List;
import java.util.Map;
import java.util.Map.Entry; import java.util.Map.Entry;
import mineplex.game.clans.tutorial.TutorialManager;
import mineplex.game.clans.tutorial.map.TutorialMapManager;
import org.apache.commons.io.FileUtils; import org.apache.commons.io.FileUtils;
import org.bukkit.Bukkit; import org.bukkit.Bukkit;
import org.bukkit.Chunk; import org.bukkit.Chunk;
@ -34,6 +34,7 @@ import org.bukkit.event.player.PlayerInteractEvent;
import org.bukkit.event.player.PlayerItemHeldEvent; import org.bukkit.event.player.PlayerItemHeldEvent;
import org.bukkit.event.player.PlayerJoinEvent; import org.bukkit.event.player.PlayerJoinEvent;
import org.bukkit.event.player.PlayerQuitEvent; import org.bukkit.event.player.PlayerQuitEvent;
import org.bukkit.event.player.PlayerTeleportEvent;
import org.bukkit.inventory.Inventory; import org.bukkit.inventory.Inventory;
import org.bukkit.inventory.ItemStack; import org.bukkit.inventory.ItemStack;
import org.bukkit.map.MapRenderer; import org.bukkit.map.MapRenderer;
@ -55,11 +56,11 @@ import mineplex.core.common.util.UtilTime;
import mineplex.core.common.util.UtilTime.TimeUnit; import mineplex.core.common.util.UtilTime.TimeUnit;
import mineplex.core.itemstack.ItemBuilder; import mineplex.core.itemstack.ItemBuilder;
import mineplex.core.portal.ServerTransferEvent; import mineplex.core.portal.ServerTransferEvent;
import mineplex.core.timing.TimingManager;
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.ClansManager; import mineplex.game.clans.clans.ClansManager;
import mineplex.game.clans.clans.ClansUtility; import mineplex.game.clans.clans.ClansUtility;
import mineplex.game.clans.clans.map.events.PlayerGetMapEvent;
import mineplex.game.clans.clans.worldevent.WorldEventManager; import mineplex.game.clans.clans.worldevent.WorldEventManager;
import net.minecraft.server.v1_8_R3.Block; import net.minecraft.server.v1_8_R3.Block;
import net.minecraft.server.v1_8_R3.BlockPosition; import net.minecraft.server.v1_8_R3.BlockPosition;
@ -83,13 +84,15 @@ public class ItemMapManager extends MiniPlugin
private ArrayList<Entry<Integer, Integer>> _scanList = new ArrayList<Entry<Integer, Integer>>(); private ArrayList<Entry<Integer, Integer>> _scanList = new ArrayList<Entry<Integer, Integer>>();
private World _world; private World _world;
private WorldEventManager _eventManager; private WorldEventManager _eventManager;
private TutorialManager _tutorial;
public ItemMapManager(ClansManager clansManager, WorldEventManager eventManager) public ItemMapManager(ClansManager clansManager, TutorialManager tutorial, WorldEventManager eventManager)
{ {
super("ItemMapManager", clansManager.getPlugin()); super("ItemMapManager", clansManager.getPlugin());
_clansUtility = clansManager.getClanUtility(); _clansUtility = clansManager.getClanUtility();
_eventManager = eventManager; _eventManager = eventManager;
_tutorial = tutorial;
_comparator = new Comparator<Entry<Integer, Integer>>() _comparator = new Comparator<Entry<Integer, Integer>>()
{ {
@ -244,7 +247,7 @@ public class ItemMapManager extends MiniPlugin
view.removeRenderer(renderer); view.removeRenderer(renderer);
} }
view.addRenderer(new ItemMapRenderer(this, _eventManager)); view.addRenderer(new ItemMapRenderer(this, _eventManager, _tutorial));
} }
@EventHandler @EventHandler
@ -616,9 +619,25 @@ public class ItemMapManager extends MiniPlugin
info.setInfo(1, calcMapCenter(zoom, loc.getBlockX()), calcMapCenter(zoom, loc.getBlockZ())); info.setInfo(1, calcMapCenter(zoom, loc.getBlockX()), calcMapCenter(zoom, loc.getBlockZ()));
_mapInfo.put(player.getName(), info); _mapInfo.put(player.getName(), info);
if (UtilInv.getItems(player).isEmpty()) // if (UtilInv.getItems(player).isEmpty())
// {
// setMap(player);
// }
}
@EventHandler
public void onWorldChange(PlayerTeleportEvent event)
{
if (event.getFrom().getWorld() != event.getTo().getWorld() && event.getTo().getWorld().equals("world"))
{ {
setMap(player); runSyncLater(new Runnable()
{
@Override
public void run()
{
setMap(event.getPlayer());
}
}, 20);
} }
} }
@ -745,6 +764,9 @@ public class ItemMapManager extends MiniPlugin
{ {
Collections.sort(_scanList, _comparator); Collections.sort(_scanList, _comparator);
} }
if (_scanList.isEmpty())
return;
Entry<Integer, Integer> entry = _scanList.remove(0); Entry<Integer, Integer> entry = _scanList.remove(0);
@ -866,6 +888,10 @@ public class ItemMapManager extends MiniPlugin
public void setMap(Player player) public void setMap(Player player)
{ {
PlayerGetMapEvent event = UtilServer.CallEvent(new PlayerGetMapEvent(player));
if (event.isCancelled())
return;
for (ItemStack item : UtilInv.getItems(player)) for (ItemStack item : UtilInv.getItems(player))
{ {
if (item.getType() == Material.MAP && (item.getDurability() >= _mapId && item.getDurability() <= _mapId + 100)) if (item.getType() == Material.MAP && (item.getDurability() >= _mapId && item.getDurability() <= _mapId + 100))

View File

@ -1,11 +1,18 @@
package mineplex.game.clans.clans.map; package mineplex.game.clans.clans.map;
import java.awt.Color; import java.awt.Color;
import java.util.List;
import mineplex.core.common.util.UtilTime; import mineplex.core.common.util.UtilTime;
import mineplex.core.recharge.Recharge;
import mineplex.game.clans.clans.ClanInfo; import mineplex.game.clans.clans.ClanInfo;
import mineplex.game.clans.clans.ClansUtility; import mineplex.game.clans.clans.ClansUtility;
import mineplex.game.clans.clans.worldevent.WorldEventManager; import mineplex.game.clans.clans.worldevent.WorldEventManager;
import mineplex.game.clans.tutorial.TutorialManager;
import mineplex.game.clans.tutorial.TutorialRegion;
import mineplex.game.clans.tutorial.TutorialType;
import mineplex.game.clans.tutorial.map.TutorialMapManager;
import mineplex.game.clans.tutorial.tutorials.clans.ClansMainTutorial;
import mineplex.minecraft.game.core.boss.EventState; import mineplex.minecraft.game.core.boss.EventState;
import mineplex.minecraft.game.core.boss.WorldEvent; import mineplex.minecraft.game.core.boss.WorldEvent;
@ -22,18 +29,38 @@ import org.bukkit.map.MapView;
public class ItemMapRenderer extends MapRenderer public class ItemMapRenderer extends MapRenderer
{ {
private ItemMapManager _manager; private ItemMapManager _manager;
private TutorialManager _tutorial;
private WorldEventManager _eventManager; private WorldEventManager _eventManager;
public ItemMapRenderer(ItemMapManager itemMapManager, WorldEventManager eventManager) public ItemMapRenderer(ItemMapManager itemMapManager, WorldEventManager eventManager, TutorialManager tutorial)
{ {
super(true); super(true);
_manager = itemMapManager; _manager = itemMapManager;
_tutorial = tutorial;
_eventManager = eventManager; _eventManager = eventManager;
} }
@Override @Override
public void render(MapView mapView, MapCanvas canvas, Player player) public void render(MapView mapView, MapCanvas canvas, Player player)
{
// if (_tutorial.inTutorial(player))
// {
// renderTutorialMap(mapView, canvas, player);
// }
// else
// {
renderNormalMap(mapView, canvas, player);
// }
}
private void renderTutorialMap(MapView mapView, MapCanvas canvas, Player player)
{
}
private void renderNormalMap(MapView mapView, MapCanvas canvas, Player player)
{ {
MapInfo info = _manager.getMap(player); MapInfo info = _manager.getMap(player);
@ -87,7 +114,7 @@ public class ItemMapRenderer extends MapRenderer
boolean colorAll = scale > 0; boolean colorAll = scale > 0;
Color clanColor = null; Color clanColor = null;
Color clanColor2 = null; Color clanColor2 = null;
if (owningClan == clan) if (owningClan == clan)
{ {
clanColor = Color.CYAN; clanColor = Color.CYAN;
@ -95,16 +122,16 @@ public class ItemMapRenderer extends MapRenderer
else else
{ {
ClansUtility.ClanRelation relation = _manager.getClansUtility().rel(clan, owningClan); ClansUtility.ClanRelation relation = _manager.getClansUtility().rel(clan, owningClan);
if (owningClan.isAdmin()) if (owningClan.isAdmin())
{ {
colorAll = false; colorAll = false;
if (owningClan.getName().equals("Shops")) if (owningClan.getName().equals("Shops"))
{ {
clanColor = Color.WHITE; clanColor = Color.WHITE;
clanColor2 = new Color(50, 150, 255); clanColor2 = new Color(50, 150, 255);
if (_manager.getClansUtility().relPT(player, chunk) == ClansUtility.ClanRelation.SAFE) if (_manager.getClansUtility().relPT(player, chunk) == ClansUtility.ClanRelation.SAFE)
clanColor2 = new Color(50, 150, 255); clanColor2 = new Color(50, 150, 255);
} }
@ -157,25 +184,25 @@ public class ItemMapRenderer extends MapRenderer
//Border //Border
if (colorAll || if (colorAll ||
((chunkBX == 0 || zoom == 13) && ((chunkBX == 0 || zoom == 13) &&
owningClan != _manager.getClansUtility().getOwner("world," + (chunkX1 - 1) + "," + chunkZ1)) owningClan != _manager.getClansUtility().getOwner("world," + (chunkX1 - 1) + "," + chunkZ1))
|| ((chunkBZ == 0 || zoom == 13) && || ((chunkBZ == 0 || zoom == 13) &&
owningClan != _manager.getClansUtility().getOwner("world," + chunkX1 + "," + (chunkZ1 - 1))) owningClan != _manager.getClansUtility().getOwner("world," + chunkX1 + "," + (chunkZ1 - 1)))
|| ((chunkBX + zoom > 15 || zoom == 13) && || ((chunkBX + zoom > 15 || zoom == 13) &&
owningClan != _manager.getClansUtility().getOwner("world," + (chunkX1 + 1) + "," + chunkZ1)) owningClan != _manager.getClansUtility().getOwner("world," + (chunkX1 + 1) + "," + chunkZ1))
|| ((chunkBZ + zoom > 15 || zoom == 13) && || ((chunkBZ + zoom > 15 || zoom == 13) &&
owningClan != _manager.getClansUtility().getOwner("world," + chunkX1 + "," + (chunkZ1 + 1)))) owningClan != _manager.getClansUtility().getOwner("world," + chunkX1 + "," + (chunkZ1 + 1))))
{ {
Color cColor = MapPalette.getColor(color); Color cColor = MapPalette.getColor(color);
double clans = colorAll ? 1 : 0.8;// 0.65; double clans = colorAll ? 1 : 0.8;// 0.65;
//Use clanColor2 no matter what for admins //Use clanColor2 no matter what for admins
Color drawColor = clanColor; Color drawColor = clanColor;
if (owningClan.isAdmin() && clanColor2 != null) if (owningClan.isAdmin() && clanColor2 != null)
@ -183,16 +210,15 @@ public class ItemMapRenderer extends MapRenderer
drawColor = clanColor2; drawColor = clanColor2;
clans = 1; clans = 1;
} }
double base = 1 - clans; double base = 1 - clans;
int r = (int) ((cColor.getRed() * base) + (drawColor.getRed() * clans)); int r = (int) ((cColor.getRed() * base) + (drawColor.getRed() * clans));
int b = (int) ((cColor.getBlue() * base) + (drawColor.getBlue() * clans)); int b = (int) ((cColor.getBlue() * base) + (drawColor.getBlue() * clans));
int g = (int) ((cColor.getGreen() * base) + (drawColor.getGreen() * clans)); int g = (int) ((cColor.getGreen() * base) + (drawColor.getGreen() * clans));
color = MapPalette.matchColor(r, g, b); color = MapPalette.matchColor(r, g, b);
} }
//Inside //Inside
@ -201,7 +227,7 @@ public class ItemMapRenderer extends MapRenderer
Color cColor = MapPalette.getColor(color); Color cColor = MapPalette.getColor(color);
double clans = 0.065; double clans = 0.065;
//Stripes //Stripes
boolean checker = (mapX + (mapZ % 4)) % 4 == 0; boolean checker = (mapX + (mapZ % 4)) % 4 == 0;
Color drawColor = clanColor; Color drawColor = clanColor;
@ -210,7 +236,7 @@ public class ItemMapRenderer extends MapRenderer
drawColor = clanColor2; drawColor = clanColor2;
clans = 1; clans = 1;
} }
double base = 1 - clans; double base = 1 - clans;
int r = (int) ((cColor.getRed() * base) + (drawColor.getRed() * clans)); int r = (int) ((cColor.getRed() * base) + (drawColor.getRed() * clans));

View File

@ -13,7 +13,6 @@ import mineplex.core.task.TaskManager;
import mineplex.game.clans.clans.ClansManager; import mineplex.game.clans.clans.ClansManager;
import mineplex.game.clans.clans.ClansPlayerStats; import mineplex.game.clans.clans.ClansPlayerStats;
import mineplex.game.clans.clans.playtime.command.PlayTimeCommand; import mineplex.game.clans.clans.playtime.command.PlayTimeCommand;
import mineplex.game.clans.clans.playtime.command.cemde;
public class Playtime extends MiniClientPlugin<PlayingClient> public class Playtime extends MiniClientPlugin<PlayingClient>
{ {

View File

@ -42,7 +42,7 @@ public class ClansRegions extends MiniPlugin
public final static int SPAWN_RADIUS = 3; // Radius of spawn claim area (measured in chunks) public final static int SPAWN_RADIUS = 3; // Radius of spawn claim area (measured in chunks)
public final static int SHOP_RADIUS = 5; // Radius of shop claim area (measured in chunks) public final static int SHOP_RADIUS = 5; // Radius of shop claim area (measured in chunks)
public final static int FIELDS_RADIUS = 7; // Radius of fields claim area (measured in chunks) public final static int FIELDS_RADIUS = 7; // Radius of fields claim area (measured in chunks)
public final static int BORDERLANDS_RADIUS = 50; // Radius of borderlands claim area (measured in chunks) public final static int BORDERLANDS_RADIUS = 85; // Radius of borderlands claim area (measured in chunks)
public static final int BORDER_RADIUS = 1319; public static final int BORDER_RADIUS = 1319;
private ClansManager _manager; private ClansManager _manager;
@ -69,7 +69,7 @@ public class ClansRegions extends MiniPlugin
claimArea("Spawn", SPAWN_RADIUS, 0, false, true, new Location[] { Spawn.getNorthSpawn(), Spawn.getSouthSpawn() }); claimArea("Spawn", SPAWN_RADIUS, 0, false, true, new Location[] { Spawn.getNorthSpawn(), Spawn.getSouthSpawn() });
claimArea("Shops", 2, 0, true, false, new Location[]{Spawn.getWestTownCenter(), Spawn.getEastTownCenter()}); claimArea("Shops", 2, 0, true, false, new Location[]{Spawn.getWestTownCenter(), Spawn.getEastTownCenter()});
claimArea("Shops", SHOP_RADIUS, 2, false, false, new Location[]{Spawn.getWestTownCenter(), Spawn.getEastTownCenter()}); claimArea("Shops", SHOP_RADIUS, 3, false, false, new Location[]{Spawn.getWestTownCenter(), Spawn.getEastTownCenter()});
// Initialize Fields and Borderlands factions and claims // Initialize Fields and Borderlands factions and claims
claimArea("Fields", FIELDS_RADIUS, 0, false, true, worldCenter); claimArea("Fields", FIELDS_RADIUS, 0, false, true, worldCenter);
@ -144,39 +144,8 @@ public class ClansRegions extends MiniPlugin
{ {
final ClanInfo clan = _manager.getClan(clanName); final ClanInfo clan = _manager.getClan(clanName);
// Only claim if the clan doesn't have claims. Speeds up startup time if (clan == null)
if (clan == null || clan.getClaimSet().size() == 0)
{ {
if (clan != null)
{
_manager.getClanDataAccess().delete(clan, status -> {
_manager.getClanDataAccess().create("ClansRegions", clanName, true, new Callback<ClanInfo>()
{
@Override
public void run(ClanInfo data)
{
if (data != null)
{
for (Location location : locations)
{
claimArea(data, location, chunkRadius, claimOffset, addNegative, safe);
log(String.format("Initialized %s faction territory and creation!", clanName));
}
debugClan(clanName);
}
else
{
System.out.println("Clans Regions error!");
System.out.println("Seek out help!");
}
}
});
});
return;
}
_manager.getClanDataAccess().create("ClansRegions", clanName, true, new Callback<ClanInfo>() _manager.getClanDataAccess().create("ClansRegions", clanName, true, new Callback<ClanInfo>()
{ {
@Override @Override
@ -189,7 +158,7 @@ public class ClansRegions extends MiniPlugin
claimArea(data, location, chunkRadius, claimOffset, addNegative, safe); claimArea(data, location, chunkRadius, claimOffset, addNegative, safe);
log(String.format("Initialized %s faction territory and creation!", clanName)); log(String.format("Initialized %s faction territory and creation!", clanName));
} }
debugClan(clanName); debugClan(clanName);
} }
else else
@ -200,6 +169,13 @@ public class ClansRegions extends MiniPlugin
} }
}); });
} }
else
{
for (Location location : locations)
{
claimArea(clan, location, chunkRadius, claimOffset, addNegative, safe);
}
}
} }
/*private void claimArea(String clanName, int chunkRadius, int claimOffset, boolean safe, Location... locations) /*private void claimArea(String clanName, int chunkRadius, int claimOffset, boolean safe, Location... locations)

View File

@ -53,6 +53,7 @@ import mineplex.core.updater.UpdateType;
import mineplex.core.updater.event.UpdateEvent; import mineplex.core.updater.event.UpdateEvent;
import mineplex.game.clans.clans.ClanInfo; import mineplex.game.clans.clans.ClanInfo;
import mineplex.game.clans.clans.event.ClansWaterPlaceEvent; import mineplex.game.clans.clans.event.ClansWaterPlaceEvent;
import mineplex.game.clans.clans.event.IronDoorOpenEvent;
import mineplex.game.clans.clans.event.PlayerClaimTerritoryEvent; import mineplex.game.clans.clans.event.PlayerClaimTerritoryEvent;
import mineplex.game.clans.clans.siege.events.SiegeWeaponExplodeEvent; import mineplex.game.clans.clans.siege.events.SiegeWeaponExplodeEvent;
import mineplex.game.clans.clans.siege.outpost.build.OutpostBlock; import mineplex.game.clans.clans.siege.outpost.build.OutpostBlock;
@ -561,6 +562,22 @@ public class Outpost implements Listener
_ownerClan.inform("Your Clan's Outpost has been destroyed.", null); _ownerClan.inform("Your Clan's Outpost has been destroyed.", null);
} }
@EventHandler
public void doorOpen(IronDoorOpenEvent event)
{
if (!UtilAlg.inBoundingBox(event.getBlock().getLocation(), _startCorner.clone().subtract(.5, 0, .5), _endCorner))
{
return;
}
if (_ownerClan.isMember(event.getPlayer()))
{
return;
}
event.setCancelled(true);
}
@EventHandler @EventHandler
public void onSiegeWeaponExplode(SiegeWeaponExplodeEvent event) public void onSiegeWeaponExplode(SiegeWeaponExplodeEvent event)
{ {

View File

@ -162,15 +162,16 @@ public abstract class SiegeWeapon implements Listener
_infoHologram = new Hologram(ClansManager.getInstance().getHologramManager(), _location.clone().add(.5, 3, .5), _name + " Health", getDisplayHealth()); _infoHologram = new Hologram(ClansManager.getInstance().getHologramManager(), _location.clone().add(.5, 3, .5), _name + " Health", getDisplayHealth());
_infoHologram.start(); _infoHologram.start();
// _infoHologram.setInteraction((player, type) -> { _infoHologram.setInteraction((player, type) -> {
// if (player.equals(_rider)) if (type.equals(ClickType.LEFT))
// { {
// if (type.equals(ClickType.LEFT)) handleLeftClick(player);
// { }
// handleLeftClick(player); else if (type.equals(ClickType.RIGHT))
// } {
// } handleRightClick(player);
// }); }
});
UtilServer.RegisterEvents(this); UtilServer.RegisterEvents(this);

View File

@ -12,7 +12,7 @@ import mineplex.game.clans.clans.ClansManager;
public class TntGeneratorManager extends MiniPlugin public class TntGeneratorManager extends MiniPlugin
{ {
public static final int SECONDS_PER_TNT = 30;//60 * 60 * 10; // 10 Hours public static final int SECONDS_PER_TNT = 60 * 60 * 12; // 12 Hours
public static final int MAX_GENERATOR_STOCK = 3; public static final int MAX_GENERATOR_STOCK = 3;
private ClansManager _clansManager; private ClansManager _clansManager;

View File

@ -3,8 +3,6 @@ package mineplex.game.clans.clans.warpoints;
import com.google.common.collect.Maps; import com.google.common.collect.Maps;
import mineplex.core.MiniPlugin; import mineplex.core.MiniPlugin;
import mineplex.core.common.util.F; import mineplex.core.common.util.F;
import mineplex.core.common.util.UtilPlayer;
import mineplex.core.common.util.UtilServer;
import mineplex.core.common.util.UtilTime; import mineplex.core.common.util.UtilTime;
import mineplex.core.updater.UpdateType; import mineplex.core.updater.UpdateType;
import mineplex.core.updater.event.UpdateEvent; import mineplex.core.updater.event.UpdateEvent;
@ -12,75 +10,102 @@ import mineplex.game.clans.clans.ClansManager;
import mineplex.game.clans.clans.event.*; import mineplex.game.clans.clans.event.*;
import org.bukkit.Bukkit; import org.bukkit.Bukkit;
import org.bukkit.Chunk; import org.bukkit.Chunk;
import org.bukkit.OfflinePlayer;
import org.bukkit.entity.Player; import org.bukkit.entity.Player;
import org.bukkit.event.EventHandler; import org.bukkit.event.EventHandler;
import org.bukkit.plugin.java.JavaPlugin; import org.bukkit.plugin.java.JavaPlugin;
import java.util.HashMap; import java.util.HashMap;
import java.util.Iterator;
import java.util.UUID; import java.util.UUID;
public class WarPointEvasion extends MiniPlugin{ public class WarPointEvasion extends MiniPlugin
{
private HashMap<Chunk, Long> _chunkCooldown; private HashMap<Chunk, Long> _chunkCooldown;
private HashMap<UUID, Long> _playerCooldown; private HashMap<UUID, Long> _playerCooldown;
private final long COOLDOWN_TIME = 1000 * 60 * 10; private final long COOLDOWN_TIME = 1000 * 60 * 10;
public WarPointEvasion(JavaPlugin plugin) { public WarPointEvasion(JavaPlugin plugin)
{
super("WP Evasion", plugin); super("WP Evasion", plugin);
_chunkCooldown = Maps.newHashMap(); _chunkCooldown = Maps.newHashMap();
_playerCooldown = Maps.newHashMap(); _playerCooldown = Maps.newHashMap();
} }
@EventHandler @EventHandler
public void updateCooldown(UpdateEvent event) { public void updateCooldown(UpdateEvent event)
{
if(!event.getType().equals(UpdateType.SEC)) return; if(!event.getType().equals(UpdateType.SEC)) return;
_chunkCooldown.keySet().stream().filter(chunk -> UtilTime.elapsed(_chunkCooldown.get(chunk), COOLDOWN_TIME)).forEach(chunk -> _chunkCooldown.remove(chunk)); for (Iterator<Chunk> chunkIterator = _chunkCooldown.keySet().iterator(); chunkIterator.hasNext();)
{
Chunk chunk = chunkIterator.next();
if (UtilTime.elapsed(_chunkCooldown.get(chunk), COOLDOWN_TIME))
chunkIterator.remove();
}
_playerCooldown.keySet().stream().filter(player -> UtilTime.elapsed(_playerCooldown.get(player), COOLDOWN_TIME)).forEach(player -> {
_playerCooldown.remove(player); for (Iterator<UUID> uuidIterator = _playerCooldown.keySet().iterator(); uuidIterator.hasNext();)
if(Bukkit.getOfflinePlayer(player).isOnline()) { {
if(ClansManager.getInstance().getClan(Bukkit.getPlayer(player)) == null) { UUID uuid = uuidIterator.next();
Bukkit.getPlayer(player).sendMessage(F.main("Clans", "You can now create a clan."));
if (UtilTime.elapsed(_playerCooldown.get(uuid), COOLDOWN_TIME))
{
uuidIterator.remove();
Player player = Bukkit.getPlayer(uuid);
if (player.isOnline())
{
if(ClansManager.getInstance().getClan(player) == null)
{
player.sendMessage(F.main("Clans", "You can now create a clan."));
}
} }
} }
}); }
} }
@EventHandler @EventHandler
public void onClaim(PlayerPreClaimTerritoryEvent event) { public void onClaim(PlayerPreClaimTerritoryEvent event)
{
Chunk chunk = event.getClaimedChunk(); Chunk chunk = event.getClaimedChunk();
if(_chunkCooldown.containsKey(chunk)) {
if(_chunkCooldown.containsKey(chunk))
{
event.setCancelled(true); event.setCancelled(true);
event.getClaimer().sendMessage(F.main("Clans", "You cannot claim this chunk for another " + UtilTime.convertString(COOLDOWN_TIME - (System.currentTimeMillis() - _chunkCooldown.get(chunk)), 1, UtilTime.TimeUnit.MINUTES))); event.getClaimer().sendMessage(F.main("Clans", "You cannot claim this chunk for another " + UtilTime.convertString(COOLDOWN_TIME - (System.currentTimeMillis() - _chunkCooldown.get(chunk)), 1, UtilTime.TimeUnit.MINUTES)));
} }
} }
@EventHandler @EventHandler
public void onunClaim(PlayerUnClaimTerritoryEvent event) { public void onunClaim(PlayerUnClaimTerritoryEvent event)
Chunk chunk = event.getUnClaimedChunk(); {
_chunkCooldown.put(chunk, System.currentTimeMillis()); _chunkCooldown.put(event.getUnClaimedChunk(), System.currentTimeMillis());
} }
@EventHandler @EventHandler
public void onClanDisband(ClanDisbandedEvent event) { public void onClanDisband(ClanDisbandedEvent event)
{
_playerCooldown.put(event.getDisbander().getUniqueId(), System.currentTimeMillis()); _playerCooldown.put(event.getDisbander().getUniqueId(), System.currentTimeMillis());
} }
@EventHandler @EventHandler
public void onClanLeave(ClanLeaveEvent event) { public void onClanLeave(ClanLeaveEvent event)
{
_playerCooldown.put(event.getPlayer().getUuid(), System.currentTimeMillis()); _playerCooldown.put(event.getPlayer().getUuid(), System.currentTimeMillis());
} }
@EventHandler @EventHandler
public void onClanCreate(ClanCreatedEvent event) { public void onClanCreate(ClanCreatedEvent event)
{
if (event.getFounder() == null) if (event.getFounder() == null)
return; return;
if (_playerCooldown.containsKey(event.getFounder().getUniqueId())) { if (_playerCooldown.containsKey(event.getFounder().getUniqueId()))
{
event.setCancelled(true); event.setCancelled(true);
event.getFounder().sendMessage(F.main("Clans", "You cannot create a clan for another " + UtilTime.convertString(COOLDOWN_TIME - (System.currentTimeMillis() - _playerCooldown.get(event.getFounder().getUniqueId())), 1, UtilTime.TimeUnit.MINUTES))); event.getFounder().sendMessage(F.main("Clans", "You cannot create a clan for another " + UtilTime.convertString(COOLDOWN_TIME - (System.currentTimeMillis() - _playerCooldown.get(event.getFounder().getUniqueId())), 1, UtilTime.TimeUnit.MINUTES)));
} }

View File

@ -6,14 +6,11 @@ import java.util.HashMap;
import java.util.List; import java.util.List;
import java.util.Map; import java.util.Map;
import mineplex.core.common.util.*;
import org.bukkit.Bukkit; import org.bukkit.Bukkit;
import org.bukkit.Location; import org.bukkit.Location;
import org.bukkit.entity.Player; import org.bukkit.entity.Player;
import mineplex.core.common.util.F;
import mineplex.core.common.util.UtilServer;
import mineplex.core.common.util.UtilTime;
import mineplex.core.common.util.UtilWorld;
import mineplex.core.scoreboard.ScoreboardManager; import mineplex.core.scoreboard.ScoreboardManager;
import mineplex.game.clans.clans.ClanInfo; import mineplex.game.clans.clans.ClanInfo;
import mineplex.game.clans.clans.ClansManager; import mineplex.game.clans.clans.ClansManager;
@ -184,4 +181,15 @@ public class KingHill extends WorldEvent
{ {
public int TicksOnHill; public int TicksOnHill;
} }
@Override
public void announceStart()
{
for(Player player : UtilServer.getPlayers()) {
if(_clansManager.getTutorial().inTutorial(player)) continue;
UtilTextMiddle.display(C.cGreen + getName(), UtilWorld.locToStrClean(getCenterLocation()), 10, 100, 40, player);
player.sendMessage(F.main("Event", F.elem(getName()) + " has started at coordinates " + F.elem(UtilWorld.locToStrClean(getCenterLocation()))));
}
}
} }

View File

@ -4,22 +4,18 @@ import java.util.HashSet;
import java.util.Iterator; import java.util.Iterator;
import java.util.Set; import java.util.Set;
import mineplex.core.common.util.*;
import mineplex.game.clans.clans.ClansManager; import mineplex.game.clans.clans.ClansManager;
import org.bukkit.Effect; import org.bukkit.Effect;
import org.bukkit.Location; import org.bukkit.Location;
import org.bukkit.Material; import org.bukkit.Material;
import org.bukkit.block.Block; import org.bukkit.block.Block;
import org.bukkit.block.BlockFace; import org.bukkit.block.BlockFace;
import org.bukkit.entity.Player;
import org.bukkit.event.EventHandler; import org.bukkit.event.EventHandler;
import org.bukkit.event.EventPriority; import org.bukkit.event.EventPriority;
import org.bukkit.event.player.PlayerInteractEvent; import org.bukkit.event.player.PlayerInteractEvent;
import mineplex.core.common.util.F;
import mineplex.core.common.util.UtilBlock;
import mineplex.core.common.util.UtilMath;
import mineplex.core.common.util.UtilPlayer;
import mineplex.core.common.util.UtilServer;
import mineplex.core.common.util.UtilWorld;
import mineplex.core.itemstack.ItemStackFactory; import mineplex.core.itemstack.ItemStackFactory;
import mineplex.core.recharge.Recharge; import mineplex.core.recharge.Recharge;
import mineplex.core.updater.UpdateType; import mineplex.core.updater.UpdateType;
@ -509,4 +505,16 @@ public class UndeadCamp extends WorldEvent
} }
} }
} }
@Override
public void announceStart()
{
for(Player player : UtilServer.getPlayers()) {
if(ClansManager.getInstance().getTutorial().inTutorial(player)) continue;
UtilTextMiddle.display(C.cGreen + getName(), UtilWorld.locToStrClean(getCenterLocation()), 10, 100, 40, player);
player.sendMessage(F.main("Event", F.elem(getName()) + " has started at coordinates " + F.elem(UtilWorld.locToStrClean(getCenterLocation()))));
}
}
} }

View File

@ -217,7 +217,9 @@ public class GoldManager extends MiniPlugin
public void deductGold(Callback<Boolean> resultCallback, Player player, int amount) public void deductGold(Callback<Boolean> resultCallback, Player player, int amount)
{ {
if (amount >= 0) if (amount == 0)
resultCallback.run(true);
if (amount > 0)
_donationManager.rewardGold(resultCallback, "GoldManager", player, -amount); _donationManager.rewardGold(resultCallback, "GoldManager", player, -amount);
} }

View File

@ -54,6 +54,7 @@ import mineplex.core.common.util.UtilEvent;
import mineplex.core.common.util.UtilEvent.ActionType; import mineplex.core.common.util.UtilEvent.ActionType;
import mineplex.core.common.util.UtilGear; import mineplex.core.common.util.UtilGear;
import mineplex.core.common.util.UtilInv; import mineplex.core.common.util.UtilInv;
import mineplex.core.common.util.UtilItem;
import mineplex.core.common.util.UtilMath; import mineplex.core.common.util.UtilMath;
import mineplex.core.common.util.UtilPlayer; import mineplex.core.common.util.UtilPlayer;
import mineplex.core.common.util.UtilServer; import mineplex.core.common.util.UtilServer;
@ -67,6 +68,7 @@ import mineplex.core.updater.event.UpdateEvent;
import mineplex.game.clans.clans.ClanInfo; import mineplex.game.clans.clans.ClanInfo;
import mineplex.game.clans.clans.ClansManager; import mineplex.game.clans.clans.ClansManager;
import mineplex.game.clans.clans.event.ClansWaterPlaceEvent; import mineplex.game.clans.clans.event.ClansWaterPlaceEvent;
import mineplex.game.clans.clans.event.IronDoorOpenEvent;
import mineplex.game.clans.core.repository.ClanTerritory; import mineplex.game.clans.core.repository.ClanTerritory;
import mineplex.minecraft.game.classcombat.Class.ClientClass; import mineplex.minecraft.game.classcombat.Class.ClientClass;
import mineplex.minecraft.game.classcombat.Class.IPvpClass.ClassType; import mineplex.minecraft.game.classcombat.Class.IPvpClass.ClassType;
@ -246,11 +248,6 @@ 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") + "."));
@ -436,7 +433,7 @@ public class Gameplay extends MiniPlugin
{ {
return; return;
} }
Block block = event.getClickedBlock(); Block block = event.getClickedBlock();
// Knock // Knock
@ -453,6 +450,13 @@ public class Gameplay extends MiniPlugin
// Open // Open
else else
{ {
IronDoorOpenEvent customEvent = UtilServer.CallEvent(new IronDoorOpenEvent(event.getPlayer(), block));
if (customEvent.isCancelled())
{
return;
}
if (block.getData() >= 8) block = block.getRelative(BlockFace.DOWN); if (block.getData() >= 8) block = block.getRelative(BlockFace.DOWN);
if (block.getData() < 4) if (block.getData() < 4)
@ -587,46 +591,50 @@ public class Gameplay extends MiniPlugin
} }
} }
// @EventHandler(priority = EventPriority.LOWEST) @EventHandler(priority = EventPriority.LOWEST)
// public void replantTree(BlockBreakEvent event) public void replantTree(BlockBreakEvent event)
// { {
// final Block block = event.getBlock(); final Block block = event.getBlock();
//
// if (_clansManager.getClanUtility().getClaim(block.getLocation()) != null) if (_clansManager.getClanUtility().getClaim(block.getLocation()) != null)
// { {
// return; return;
// } }
//
// if (!UtilItem.isLog(block.getType())) if (!UtilItem.isLog(block.getType()))
// { {
// return; return;
// } }
//
// if (UtilItem.isLog(block.getRelative(BlockFace.DOWN).getType())) if (UtilItem.isLog(block.getRelative(BlockFace.DOWN).getType()))
// { {
// return; return;
// } }
//
// if (UtilItem.isLeaf(block.getRelative(BlockFace.DOWN).getType())) if (UtilItem.isLeaf(block.getRelative(BlockFace.DOWN).getType()))
// { {
// return; return;
// } }
//
// if (block.getRelative(BlockFace.DOWN).getType() != Material.DIRT && block.getRelative(BlockFace.DOWN).getType() != Material.GRASS) if (block.getRelative(BlockFace.DOWN).getType() != Material.DIRT && block.getRelative(BlockFace.DOWN).getType() != Material.GRASS)
// { {
// return; return;
// } }
//
// final byte data = block.getData(); final byte data = block.getData();
//
// UtilServer.getServer().getScheduler().scheduleSyncDelayedTask(getPlugin(), new Runnable() { UtilServer.getServer().getScheduler().scheduleSyncDelayedTask(getPlugin(), new Runnable() {
// public void run() public void run()
// { {
// block.setType(Material.SAPLING); Material mat = block.getRelative(BlockFace.DOWN).getType();
// block.setData(data); if (mat == Material.DIRT || mat == Material.GRASS)
// } {
// }, 20 * 5); block.setType(Material.SAPLING);
// } block.setData(data);
}
}
}, 20 * 10);
}
@EventHandler @EventHandler
public void killRain(WeatherChangeEvent event) public void killRain(WeatherChangeEvent event)

View File

@ -364,6 +364,8 @@ public class GearManager extends MiniPlugin implements IPacketHandler, Runnable
attribute = sampleAttribute; // Select valid attribute to attribute = sampleAttribute; // Select valid attribute to
// add // add
} }
attempts++;
} }
container.addAttribute(attribute); container.addAttribute(attribute);

View File

@ -29,7 +29,7 @@ public class PvpItem extends ShopItem
super(type, data, name, new String[] { super(type, data, name, new String[] {
C.cWhite + " ", C.cWhite + " ",
LEFT_CLICK_BUY, LEFT_CLICK_BUY,
C.cWhite + "Costs " + C.cGreen + (buyPrice == 0 ? "Free" : buyPrice + "g"), C.cWhite + "Costs " + C.cGreen + (buyPrice == 0 ? "Free (Tutorial)" : buyPrice + "g"),
C.cWhite + " ", C.cWhite + " ",
UtilItem.isArmor(type) || UtilItem.isTool(type) ? "" : C.cYellow + "Shift Left-Click" + C.cWhite + " to Buy " + C.cGreen + bulkCount, UtilItem.isArmor(type) || UtilItem.isTool(type) ? "" : C.cYellow + "Shift Left-Click" + C.cWhite + " to Buy " + C.cGreen + bulkCount,
UtilItem.isArmor(type) || UtilItem.isTool(type) ? "" : C.cWhite + "Costs " + C.cGreen + (buyPrice * bulkCount) + "g", C.cWhite + " ", UtilItem.isArmor(type) || UtilItem.isTool(type) ? "" : C.cWhite + "Costs " + C.cGreen + (buyPrice * bulkCount) + "g", C.cWhite + " ",

View File

@ -133,6 +133,8 @@ public class ShopItemButton<T extends ShopPageBase<?, ?>> implements IButton
GoldManager.notify(player, "You cannot afford that item! Please relog to update your gold count."); GoldManager.notify(player, "You cannot afford that item! Please relog to update your gold count.");
_page.playDenySound(player); _page.playDenySound(player);
} }
_page.refresh();
} }
}, player, cost); }, player, cost);
} }

View File

@ -1,22 +1,16 @@
package mineplex.game.clans.shop.energy; package mineplex.game.clans.shop.energy;
import org.bukkit.Bukkit;
import org.bukkit.Sound;
import org.bukkit.entity.Player; import org.bukkit.entity.Player;
import org.bukkit.event.inventory.ClickType; import org.bukkit.event.inventory.ClickType;
import mineplex.core.common.CurrencyType; import mineplex.core.common.CurrencyType;
import mineplex.core.common.util.Callback;
import mineplex.core.common.util.F; import mineplex.core.common.util.F;
import mineplex.core.common.util.UtilTime; import mineplex.core.common.util.UtilServer;
import mineplex.core.donation.DonationManager;
import mineplex.core.energy.Energy;
import mineplex.core.shop.ShopBase;
import mineplex.core.shop.item.IButton; import mineplex.core.shop.item.IButton;
import mineplex.core.shop.page.ConfirmationPage; import mineplex.core.shop.page.ConfirmationPage;
import mineplex.game.clans.clans.ClanEnergyManager; import mineplex.game.clans.clans.ClanEnergyManager;
import mineplex.game.clans.clans.ClanInfo; import mineplex.game.clans.clans.ClanInfo;
import mineplex.game.clans.clans.ClansManager; import mineplex.game.clans.clans.event.PreEnergyShopBuyEvent;
public class EnergyShopButton implements IButton public class EnergyShopButton implements IButton
{ {
@ -38,6 +32,11 @@ public class EnergyShopButton implements IButton
@Override @Override
public void onClick(final Player player, ClickType clickType) public void onClick(final Player player, ClickType clickType)
{ {
if (UtilServer.CallEvent(new PreEnergyShopBuyEvent(player, _energyToPurchase, _cost)).isCancelled())
{
return;
}
_page.getShop().openPageForPlayer(player, new ConfirmationPage<ClanEnergyManager, EnergyShop>( _page.getShop().openPageForPlayer(player, new ConfirmationPage<ClanEnergyManager, EnergyShop>(
_page.getPlugin(), _page.getShop(), _page.getClientManager(), _page.getDonationManager(), new Runnable() _page.getPlugin(), _page.getShop(), _page.getClientManager(), _page.getDonationManager(), new Runnable()
{ {

View File

@ -281,10 +281,7 @@ public class Spawn extends MiniPlugin
event.setRespawnLocation(getSpawnLocation()); event.setRespawnLocation(getSpawnLocation());
} }
/** /*
* Ensure player spawns into a Spawn location if it's their first time on the server.
* @param event
*/
@EventHandler @EventHandler
public void onPlayerFirstJoin(PlayerJoinEvent event) public void onPlayerFirstJoin(PlayerJoinEvent event)
{ {
@ -293,6 +290,7 @@ public class Spawn extends MiniPlugin
teleport(event.getPlayer(), getSpawnLocation(), 2); // Teleport player to spawn after 2-tick delay to prevent on-join bug teleport(event.getPlayer(), getSpawnLocation(), 2); // Teleport player to spawn after 2-tick delay to prevent on-join bug
} }
} }
*/
/** /**
* Prevent creatures from spawning inside Spawn * Prevent creatures from spawning inside Spawn
@ -493,7 +491,7 @@ public class Spawn extends MiniPlugin
return _clansManager.getCondition().HasCondition(player, ConditionType.CUSTOM, COMBAT_TAG_NAME); return _clansManager.getCondition().HasCondition(player, ConditionType.CUSTOM, COMBAT_TAG_NAME);
} }
private void teleport(final Player player, final Location location, int delay) public void teleport(final Player player, final Location location, int delay)
{ {
Bukkit.getScheduler().scheduleSyncDelayedTask(getPlugin(), new Runnable() { Bukkit.getScheduler().scheduleSyncDelayedTask(getPlugin(), new Runnable() {
@Override @Override

View File

@ -58,6 +58,11 @@ public class TravelButton implements IButton
return; return;
} }
if (_location == null)
{
return;
}
if (player.getLocation().distance(_location) <= 64) if (player.getLocation().distance(_location) <= 64)
{ {
return; return;

View File

@ -12,7 +12,6 @@ import org.bukkit.inventory.meta.ItemMeta;
import mineplex.core.account.CoreClientManager; import mineplex.core.account.CoreClientManager;
import mineplex.core.common.util.C; import mineplex.core.common.util.C;
import mineplex.core.common.util.F;
import mineplex.core.common.util.UtilBlock; import mineplex.core.common.util.UtilBlock;
import mineplex.core.donation.DonationManager; import mineplex.core.donation.DonationManager;
import mineplex.core.itemstack.ItemBuilder; import mineplex.core.itemstack.ItemBuilder;
@ -23,6 +22,8 @@ import mineplex.game.clans.clans.ClanInfo;
import mineplex.game.clans.clans.ClanRole; import mineplex.game.clans.clans.ClanRole;
import mineplex.game.clans.clans.ClansManager; import mineplex.game.clans.clans.ClansManager;
import mineplex.game.clans.clans.gui.ClanIcon; import mineplex.game.clans.clans.gui.ClanIcon;
import mineplex.game.clans.clans.siege.outpost.Outpost;
import mineplex.game.clans.shop.ClansShopItem;
import mineplex.game.clans.spawn.Spawn; import mineplex.game.clans.spawn.Spawn;
public class TravelPage extends ShopPageBase<ClansManager, TravelShop> public class TravelPage extends ShopPageBase<ClansManager, TravelShop>
@ -37,7 +38,7 @@ public class TravelPage extends ShopPageBase<ClansManager, TravelShop>
@Override @Override
protected void buildPage() protected void buildPage()
{ {
addTravelLocation(Spawn.getNorthSpawn(), getPlayer().getLocation().distance(Spawn.getNorthSpawn()) <= 64 ? Material.SKULL_ITEM : Material.IRON_SWORD, (getPlayer().getLocation().distance(Spawn.getNorthSpawn()) <= 64 ? C.cRedB : C.cGreenB) + "East Spawn", new String[] { addTravelLocation(Spawn.getNorthSpawn(), getPlayer().getLocation().distance(Spawn.getNorthSpawn()) <= 64 ? Material.SKULL_ITEM : Material.IRON_SWORD, (getPlayer().getLocation().distance(Spawn.getNorthSpawn()) <= 64 ? C.cRedB : C.cGreenB) + "North Spawn", new String[] {
C.cWhite + "Spawns are locations where", C.cWhite + "Spawns are locations where",
C.cWhite + "you respawn after dying.", C.cWhite + "you respawn after dying.",
" ", " ",
@ -45,9 +46,9 @@ public class TravelPage extends ShopPageBase<ClansManager, TravelShop>
C.cWhite + "as they are Safe Zones.", C.cWhite + "as they are Safe Zones.",
getPlayer().getLocation().distance(Spawn.getSouthSpawn()) <= 64 ? " " : "", getPlayer().getLocation().distance(Spawn.getSouthSpawn()) <= 64 ? " " : "",
getPlayer().getLocation().distance(Spawn.getNorthSpawn()) <= 64 ? C.cRed + "You are already here." : "", getPlayer().getLocation().distance(Spawn.getNorthSpawn()) <= 64 ? C.cRed + "You are already here." : "",
}, 14 + 10, getPlayer().getLocation().distance(Spawn.getNorthSpawn()) <= 64 ? (byte) 3 : (byte) 0); }, 4, getPlayer().getLocation().distance(Spawn.getNorthSpawn()) <= 64 ? (byte) 3 : (byte) 0);
addTravelLocation(Spawn.getSouthSpawn(), getPlayer().getLocation().distance(Spawn.getSouthSpawn()) <= 64 ? Material.SKULL_ITEM : Material.IRON_SWORD, (getPlayer().getLocation().distance(Spawn.getSouthSpawn()) <= 64 ? C.cRedB : C.cGreenB) + "West Spawn", new String[] { addTravelLocation(Spawn.getSouthSpawn(), getPlayer().getLocation().distance(Spawn.getSouthSpawn()) <= 64 ? Material.SKULL_ITEM : Material.IRON_SWORD, (getPlayer().getLocation().distance(Spawn.getSouthSpawn()) <= 64 ? C.cRedB : C.cGreenB) + "South Spawn", new String[] {
C.cWhite + "Spawns are locations where", C.cWhite + "Spawns are locations where",
C.cWhite + "you respawn after dying.", C.cWhite + "you respawn after dying.",
" ", " ",
@ -55,27 +56,36 @@ public class TravelPage extends ShopPageBase<ClansManager, TravelShop>
C.cWhite + "as they are Safe Zones.", C.cWhite + "as they are Safe Zones.",
getPlayer().getLocation().distance(Spawn.getSouthSpawn()) <= 64 ? " " : "", getPlayer().getLocation().distance(Spawn.getSouthSpawn()) <= 64 ? " " : "",
getPlayer().getLocation().distance(Spawn.getSouthSpawn()) <= 64 ? C.cRed + "You are already here." : "", getPlayer().getLocation().distance(Spawn.getSouthSpawn()) <= 64 ? C.cRed + "You are already here." : "",
}, 12 + 8, getPlayer().getLocation().distance(Spawn.getSouthSpawn()) <= 64 ? (byte) 3 : (byte) 0); }, 22 + 9 + 9, getPlayer().getLocation().distance(Spawn.getSouthSpawn()) <= 64 ? (byte) 3 : (byte) 0);
addTravelLocation(Spawn.getWestTown(), ClanIcon.CASTLE.getMaterial(), C.cDGreenB + "North Shop", new String[] { addTravelLocation(Spawn.getWestTown(), ClanIcon.CASTLE.getMaterial(), C.cDGreenB + "West Shop", new String[] {
C.cWhite + "Shops are locations where you", C.cWhite + "Shops are locations where you",
C.cWhite + "can buy and sell all sorts of goods.", C.cWhite + "can buy and sell all sorts of goods.",
" ", " ",
C.cWhite + "You cannot be attacked here,", C.cWhite + "You cannot be attacked here,",
C.cWhite + "as they are Safe Zones.", C.cWhite + "as they are Safe Zones.",
}, 4, ClanIcon.CASTLE.getData()); }, 12 + 8, ClanIcon.CASTLE.getData());
addTravelLocation(Spawn.getEastTown(), ClanIcon.CASTLE.getMaterial(), C.cDGreenB + "South Shop", new String[] { addTravelLocation(Spawn.getEastTown(), ClanIcon.CASTLE.getMaterial(), C.cDGreenB + "East Shop", new String[] {
C.cWhite + "Shops are locations where you", C.cWhite + "Shops are locations where you",
C.cWhite + "can buy and sell all sorts of goods.", C.cWhite + "can buy and sell all sorts of goods.",
" ", " ",
C.cWhite + "You cannot be attacked here,", C.cWhite + "You cannot be attacked here,",
C.cWhite + "as they are Safe Zones.", C.cWhite + "as they are Safe Zones.",
}, 22 + 9 + 9, ClanIcon.CASTLE.getData()); }, 14 + 10, ClanIcon.CASTLE.getData());
final ClanInfo clan = _plugin.getClan(getPlayer());
Outpost outpost = _plugin.getSiegeManager().getOutpostManager().Get(clan);
addTravelLocation(outpost == null ? null : outpost.getCoreLocation().clone().add(0, 1, 0), ClansShopItem.OUTPOST.getMaterial(), (outpost == null ? C.cRedB : C.cDGreenB) + "Outpost", new String[] {
C.cWhite + "Teleport to your Clan's currently",
C.cWhite + "active Outpost.",
" ",
(outpost == null ? C.cRed + "Your Clan does not have an Outpost." : ""),
}, 8, ClanIcon.CASTLE.getData());
final ClanInfo clan = getPlugin().getClan(getPlayer());
final ItemStack item = new ItemStack(Material.BED, 1); final ItemStack item = new ItemStack(Material.BED, 1);
ItemMeta meta = item.getItemMeta(); ItemMeta meta = item.getItemMeta();

View File

@ -10,7 +10,7 @@ public class FinishCommand extends CommandBase<TutorialManager>
{ {
public FinishCommand(TutorialManager plugin) public FinishCommand(TutorialManager plugin)
{ {
super(plugin, Rank.DEVELOPER, "finish", "end"); super(plugin, Rank.JNR_DEV, "finish", "end");
} }
@Override @Override

View File

@ -13,7 +13,7 @@ public class TutorialCommand extends MultiCommandBase<TutorialManager>
{ {
public TutorialCommand(TutorialManager plugin) public TutorialCommand(TutorialManager plugin)
{ {
super(plugin, Rank.DEVELOPER, "tutorial", "tut"); super(plugin, Rank.JNR_DEV, "tutorial", "tut");
AddCommand(new StartCommand(plugin)); AddCommand(new StartCommand(plugin));
AddCommand(new FinishCommand(plugin)); AddCommand(new FinishCommand(plugin));

View File

@ -1,48 +0,0 @@
package mineplex.game.clans.tutorial.tutorials.clans.objective;
import org.bukkit.entity.Player;
import org.bukkit.event.EventHandler;
import org.bukkit.plugin.java.JavaPlugin;
import mineplex.core.common.objective.SingleObjective;
import mineplex.core.updater.UpdateType;
import mineplex.core.updater.event.UpdateEvent;
import mineplex.game.clans.tutorial.tutorials.clans.ClansMainTutorial;
public class LeaveSpawnObjective extends SingleObjective<ClansMainTutorial>
{
public LeaveSpawnObjective(ClansMainTutorial plugin, JavaPlugin javaPlugin)
{
super(plugin, javaPlugin, "Leave Spawn", "Exit the tutorial spawn area");
}
@Override
protected void customStart(Player player)
{
}
@Override
protected void customLeave(Player player)
{
}
@Override
protected void customFinish(Player player)
{
}
@EventHandler
public void checkRegion(UpdateEvent event)
{
if (event.getType() != UpdateType.FAST)
return;
for (Player player : getActivePlayers())
{
if (!getPlugin().isInSpawn(player))
{
finish(player);
}
}
}
}

View File

@ -101,16 +101,16 @@ public class BlowUpWallGoal extends ObjectiveGoal<AttackEnemyObjective>
FallingBlocks.Instance.Spawn(block.getLocation(), block.getType(), block.getData(), center); FallingBlocks.Instance.Spawn(block.getLocation(), block.getType(), block.getData(), center);
} }
}); });
event.setCancelled(true);
finish(shooter); finish(shooter);
} }
else else
{ {
UtilPlayer.message(shooter, F.main("Clans", "You missed! Try to hit the enemy's front wall, that should make a nice big hole!")); UtilPlayer.message(shooter, F.main("Clans", "You missed! Try to hit the enemy's front wall, that should make a nice big hole!"));
UtilInv.give(shooter, Material.TNT); UtilInv.give(shooter, Material.TNT);
event.setCancelled(true);
} }
event.setCancelled(true);
} }
@Override @Override

View File

@ -143,8 +143,8 @@ public class Hub extends JavaPlugin implements IRelation
IncognitoManager incognito = new IncognitoManager(this, clientManager, packetHandler); IncognitoManager incognito = new IncognitoManager(this, clientManager, packetHandler);
new ServerManager(this, clientManager, donationManager, portal, partyManager, serverStatusManager, hubManager, new StackerManager(hubManager), queueManager); new ServerManager(this, clientManager, donationManager, portal, partyManager, serverStatusManager, hubManager, new StackerManager(hubManager), queueManager);
Chat chat = new Chat(this, clientManager, preferenceManager, achievementManager, serverStatusManager.getCurrentServerName()); Chat chat = new Chat(this, incognito, clientManager, preferenceManager, achievementManager, serverStatusManager.getCurrentServerName());
new MessageManager(this, clientManager, preferenceManager, ignoreManager, punish, friendManager, chat); new MessageManager(this, incognito, clientManager, preferenceManager, ignoreManager, punish, friendManager, chat);
new MemoryFix(this); new MemoryFix(this);
new FileUpdater(this, portal, serverStatusManager.getCurrentServerName(), serverStatusManager.getRegion()); new FileUpdater(this, portal, serverStatusManager.getCurrentServerName(), serverStatusManager.getRegion());
new CustomTagFix(this, packetHandler); new CustomTagFix(this, packetHandler);

View File

@ -9,8 +9,6 @@ import java.util.HashMap;
import java.util.Iterator; import java.util.Iterator;
import java.util.Random; import java.util.Random;
import mineplex.core.reward.RewardManager;
import mineplex.core.valentines.ValentinesGiftManager;
import org.bukkit.Bukkit; import org.bukkit.Bukkit;
import org.bukkit.ChatColor; import org.bukkit.ChatColor;
import org.bukkit.GameMode; import org.bukkit.GameMode;
@ -74,8 +72,8 @@ import mineplex.core.gadget.GadgetManager;
import mineplex.core.gadget.event.GadgetCollideEntityEvent; import mineplex.core.gadget.event.GadgetCollideEntityEvent;
import mineplex.core.gadget.event.GadgetEnableEvent; import mineplex.core.gadget.event.GadgetEnableEvent;
import mineplex.core.gadget.types.GadgetType; import mineplex.core.gadget.types.GadgetType;
import mineplex.core.giveaway.GiveawayManager;
import mineplex.core.hologram.HologramManager; import mineplex.core.hologram.HologramManager;
import mineplex.core.incognito.events.IncognitoHidePlayerEvent;
import mineplex.core.inventory.InventoryManager; import mineplex.core.inventory.InventoryManager;
import mineplex.core.message.PrivateMessageEvent; import mineplex.core.message.PrivateMessageEvent;
import mineplex.core.mount.MountManager; import mineplex.core.mount.MountManager;
@ -97,12 +95,14 @@ import mineplex.core.portal.Portal;
import mineplex.core.preferences.PreferencesManager; import mineplex.core.preferences.PreferencesManager;
import mineplex.core.projectile.ProjectileManager; import mineplex.core.projectile.ProjectileManager;
import mineplex.core.punish.Punish; import mineplex.core.punish.Punish;
import mineplex.core.reward.RewardManager;
import mineplex.core.stats.StatsManager; import mineplex.core.stats.StatsManager;
import mineplex.core.status.ServerStatusManager; import mineplex.core.status.ServerStatusManager;
import mineplex.core.task.TaskManager; import mineplex.core.task.TaskManager;
import mineplex.core.treasure.TreasureManager; import mineplex.core.treasure.TreasureManager;
import mineplex.core.updater.UpdateType; import mineplex.core.updater.UpdateType;
import mineplex.core.updater.event.UpdateEvent; import mineplex.core.updater.event.UpdateEvent;
import mineplex.core.valentines.ValentinesGiftManager;
import mineplex.hub.commands.DisguiseCommand; import mineplex.hub.commands.DisguiseCommand;
import mineplex.hub.commands.ForcefieldRadius; import mineplex.hub.commands.ForcefieldRadius;
import mineplex.hub.commands.GadgetToggle; import mineplex.hub.commands.GadgetToggle;
@ -574,6 +574,15 @@ public class HubManager extends MiniClientPlugin<HubClient>
event.setCancelled(true); event.setCancelled(true);
} }
} }
@EventHandler
public void Incog(IncognitoHidePlayerEvent event)
{
if (!_clientManager.hasRank(event.getPlayer(), Rank.ADMIN))
{
event.setCancelled(true);
}
}
@EventHandler @EventHandler
public void PlayerChat(AsyncPlayerChatEvent event) public void PlayerChat(AsyncPlayerChatEvent event)

View File

@ -1,5 +1,7 @@
package mineplex.hub.server; package mineplex.hub.server;
import java.sql.ResultSet;
import java.sql.SQLException;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.Collection; import java.util.Collection;
import java.util.Collections; import java.util.Collections;
@ -26,7 +28,7 @@ import org.bukkit.event.player.PlayerQuitEvent;
import org.bukkit.plugin.java.JavaPlugin; import org.bukkit.plugin.java.JavaPlugin;
import org.bukkit.util.Vector; import org.bukkit.util.Vector;
import mineplex.core.MiniPlugin; import mineplex.core.MiniDbClientPlugin;
import mineplex.core.account.CoreClientManager; import mineplex.core.account.CoreClientManager;
import mineplex.core.common.Rank; import mineplex.core.common.Rank;
import mineplex.core.common.util.C; import mineplex.core.common.util.C;
@ -48,10 +50,10 @@ import mineplex.core.shop.ShopBase;
import mineplex.core.status.ServerStatusManager; import mineplex.core.status.ServerStatusManager;
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.core.repository.tokens.SimpleClanToken;
import mineplex.hub.HubManager; import mineplex.hub.HubManager;
import mineplex.hub.modules.StackerManager; import mineplex.hub.modules.StackerManager;
import mineplex.hub.queue.QueueManager; import mineplex.hub.queue.QueueManager;
import mineplex.hub.queue.ui.QueueShop;
import mineplex.hub.server.ui.LobbyShop; import mineplex.hub.server.ui.LobbyShop;
import mineplex.hub.server.ui.QuickShop; import mineplex.hub.server.ui.QuickShop;
import mineplex.hub.server.ui.ServerCountSorter; import mineplex.hub.server.ui.ServerCountSorter;
@ -61,7 +63,7 @@ import mineplex.serverdata.Region;
import mineplex.serverdata.data.MinecraftServer; import mineplex.serverdata.data.MinecraftServer;
import mineplex.serverdata.data.ServerGroup; import mineplex.serverdata.data.ServerGroup;
public class ServerManager extends MiniPlugin public class ServerManager extends MiniDbClientPlugin<SimpleClanToken>
{ {
private static final Long FREE_PORTAL_TIMER = 20000L; private static final Long FREE_PORTAL_TIMER = 20000L;
private static final Long BETA_PORTAL_TIMER = 120000L; private static final Long BETA_PORTAL_TIMER = 120000L;
@ -77,8 +79,6 @@ public class ServerManager extends MiniPlugin
private PartyManager _partyManager; private PartyManager _partyManager;
private ServerStatusManager _statusManager; private ServerStatusManager _statusManager;
private HubManager _hubManager; private HubManager _hubManager;
private StackerManager _stackerManager;
private QueueManager _queueManager;
private NautHashMap<String, Long> _queueCooldowns = new NautHashMap<String, Long>(); private NautHashMap<String, Long> _queueCooldowns = new NautHashMap<String, Long>();
private NautHashMap<String, HashSet<ServerInfo>> _serverKeyInfoMap = new NautHashMap<String, HashSet<ServerInfo>>(); private NautHashMap<String, HashSet<ServerInfo>> _serverKeyInfoMap = new NautHashMap<String, HashSet<ServerInfo>>();
@ -93,7 +93,6 @@ public class ServerManager extends MiniPlugin
// Join Time for Free Players Timer // Join Time for Free Players Timer
private NautHashMap<String, Long> _joinTime = new NautHashMap<String, Long>(); private NautHashMap<String, Long> _joinTime = new NautHashMap<String, Long>();
private QueueShop _domShop;
private QuickShop _quickShop; private QuickShop _quickShop;
private LobbyShop _lobbyShop; private LobbyShop _lobbyShop;
@ -103,7 +102,7 @@ public class ServerManager extends MiniPlugin
public ServerManager(JavaPlugin plugin, CoreClientManager clientManager, DonationManager donationManager, Portal portal, PartyManager partyManager, ServerStatusManager statusManager, HubManager hubManager, StackerManager stackerManager, QueueManager queueManager) public ServerManager(JavaPlugin plugin, CoreClientManager clientManager, DonationManager donationManager, Portal portal, PartyManager partyManager, ServerStatusManager statusManager, HubManager hubManager, StackerManager stackerManager, QueueManager queueManager)
{ {
super("Server Manager", plugin); super("Server Manager", plugin, clientManager);
_clientManager = clientManager; _clientManager = clientManager;
_donationManager = donationManager; _donationManager = donationManager;
@ -111,8 +110,6 @@ public class ServerManager extends MiniPlugin
_partyManager = partyManager; _partyManager = partyManager;
_statusManager = statusManager; _statusManager = statusManager;
_hubManager = hubManager; _hubManager = hubManager;
_stackerManager = stackerManager;
_queueManager = queueManager;
plugin.getServer().getMessenger().registerOutgoingPluginChannel(plugin, "BungeeCord"); plugin.getServer().getMessenger().registerOutgoingPluginChannel(plugin, "BungeeCord");
@ -120,7 +117,6 @@ public class ServerManager extends MiniPlugin
_quickShop = new QuickShop(this, clientManager, donationManager, "Quick Menu"); _quickShop = new QuickShop(this, clientManager, donationManager, "Quick Menu");
_lobbyShop = new LobbyShop(this, clientManager, donationManager, "Lobby Menu"); _lobbyShop = new LobbyShop(this, clientManager, donationManager, "Lobby Menu");
//_domShop = new new QueueShop(_queueManager, clientManager, donationManager, "Dominate");
// TODO: Find more appropriate place to initialize Clans server shop? // TODO: Find more appropriate place to initialize Clans server shop?
_clansShop = new ClansServerShop(this, _clientManager, _donationManager); _clansShop = new ClansServerShop(this, _clientManager, _donationManager);
@ -918,4 +914,33 @@ public class ServerManager extends MiniPlugin
{ {
return _serverNpcShopMap.get("Valentines Vendetta"); return _serverNpcShopMap.get("Valentines Vendetta");
} }
@Override
public String getQuery(int accountId, String uuid, String name)
{
return "SELECT clans.name, accountClan.clanRole, clanServer.serverName, clans.id FROM accountClan INNER JOIN clans ON clans.id = accountClan.clanId INNER JOIN clanServer ON clans.serverId = clanServer.id WHERE accountClan.accountId = " + accountId + ";";
}
@Override
public void processLoginResultSet(String playerName, int accountId, ResultSet resultSet) throws SQLException
{
SimpleClanToken clanToken = new SimpleClanToken();
while (resultSet.next())
{
String clanName = resultSet.getString(1);
String clanRole = resultSet.getString(2);
String homeServer = resultSet.getString(3);
int clanId = resultSet.getInt(4);
clanToken = new SimpleClanToken(clanName, clanRole, homeServer, clanId);
}
Set(playerName, clanToken);
}
@Override
protected SimpleClanToken AddPlayer(String player)
{
return new SimpleClanToken();
}
} }

View File

@ -52,6 +52,14 @@ public class ServerSorter implements Comparator<ServerInfo>
} }
} }
if (a.Name.contains("Clans") && b.Name.contains("Clans"))
{
if (Integer.parseInt(a.Name.split("-")[1]) < Integer.parseInt(b.Name.split("-")[1]))
return -1;
else if (Integer.parseInt(a.Name.split("-")[1]) > Integer.parseInt(b.Name.split("-")[1]))
return 1;
}
if (a.MaxPlayers - a.CurrentPlayers < _requiredSlots && b.MaxPlayers - b.CurrentPlayers >= _requiredSlots) if (a.MaxPlayers - a.CurrentPlayers < _requiredSlots && b.MaxPlayers - b.CurrentPlayers >= _requiredSlots)
return -1; return -1;

View File

@ -272,9 +272,9 @@ public class ServerGameMenu extends ShopPageBase<ServerManager, QuickShop>
C.Reset + "the games you want, when you want.", C.Reset + "the games you want, when you want.",
}).setHideInfo(true).build(), new SelectPLAYERButton(this)); }).setHideInfo(true).build(), new SelectPLAYERButton(this));
addButton(40, new ItemBuilder(Material.IRON_DOOR).setTitle(C.cYellowB + "Mineplex Clans " + C.cGray + "Champions Teams").addLore(new String[] addButton(40, new ItemBuilder(Material.IRON_DOOR).setTitle(C.cYellowB + "Mineplex Clans " + C.cGray + "Factions PvP").addLore(new String[]
{ {
(_extraValue ? C.cAquaB : C.cWhiteB) + "ALPHA RELEASE", (_extraValue ? C.cAquaB : C.cWhiteB) + "BETA RELEASE",
C.Reset + "", C.Reset + "",
C.Reset + "Equip custom skills and builds", C.Reset + "Equip custom skills and builds",
C.Reset + "and join your clan to destroy", C.Reset + "and join your clan to destroy",

View File

@ -4,7 +4,6 @@ import org.bukkit.Sound;
import org.bukkit.entity.Player; import org.bukkit.entity.Player;
import mineplex.core.account.CoreClientManager; import mineplex.core.account.CoreClientManager;
import mineplex.core.common.util.C;
import mineplex.core.common.util.F; import mineplex.core.common.util.F;
import mineplex.core.donation.DonationManager; import mineplex.core.donation.DonationManager;
import mineplex.core.party.Party; import mineplex.core.party.Party;

View File

@ -1,6 +1,8 @@
package mineplex.hub.server.ui.clans; package mineplex.hub.server.ui.clans;
import java.util.Collection; import java.util.Collection;
import java.util.Comparator;
import java.util.TreeSet;
import org.bukkit.ChatColor; import org.bukkit.ChatColor;
import org.bukkit.Material; import org.bukkit.Material;
@ -10,6 +12,7 @@ import org.bukkit.event.inventory.ClickType;
import mineplex.core.account.CoreClientManager; import mineplex.core.account.CoreClientManager;
import mineplex.core.common.util.C; import mineplex.core.common.util.C;
import mineplex.core.common.util.Callback; import mineplex.core.common.util.Callback;
import mineplex.core.common.util.UtilAlg;
import mineplex.core.donation.DonationManager; import mineplex.core.donation.DonationManager;
import mineplex.core.shop.item.DisplayButton; import mineplex.core.shop.item.DisplayButton;
import mineplex.core.shop.item.IButton; import mineplex.core.shop.item.IButton;
@ -24,18 +27,10 @@ import mineplex.serverdata.data.DataRepository;
public class ClansServerPage extends ShopPageBase<ServerManager, ClansServerShop> public class ClansServerPage extends ShopPageBase<ServerManager, ClansServerShop>
{ {
//private DataRepository<PlayerServerInfo> _repository; // Stores the name of the last Clans server a player was on
private ClanRepository _repository;
private int _accountId;
public ClansServerPage(ServerManager plugin, ClansServerShop shop, CoreClientManager clientManager, public ClansServerPage(ServerManager plugin, ClansServerShop shop, CoreClientManager clientManager,
DonationManager donationManager, Player player, ClanRepository repository) DonationManager donationManager, Player player)
{ {
super(plugin, shop, clientManager, donationManager, "Clans Alpha", player, 27); super(plugin, shop, clientManager, donationManager, "Clans Beta", player, 54);
_repository = repository;
_accountId = clientManager.getAccountId(player);
buildPage(); buildPage();
} }
@ -43,21 +38,14 @@ public class ClansServerPage extends ShopPageBase<ServerManager, ClansServerShop
@Override @Override
protected void buildPage() protected void buildPage()
{ {
_repository.retrievePlayersClan(_accountId, new Callback<SimpleClanToken>() if (!getPlugin().Get(_player).getClanName().isEmpty())
{ {
@Override buildClanPage(getPlugin().Get(_player));
public void run(SimpleClanToken data) }
{ else
if (data != null) {
{ buildNoClanPage();
buildClanPage(data); }
}
else
{
buildNoClanPage();
}
}
});
} }
private void buildClanPage(SimpleClanToken clan) private void buildClanPage(SimpleClanToken clan)
@ -72,7 +60,14 @@ public class ClansServerPage extends ShopPageBase<ServerManager, ClansServerShop
private void buildNoClanPage() private void buildNoClanPage()
{ {
Collection<ServerInfo> servers = getPlugin().getServerList("Clans"); Collection<ServerInfo> servers = UtilAlg.sortSet(getPlugin().getServerList("Clans"), new Comparator<ServerInfo>()
{
@Override
public int compare(ServerInfo o1, ServerInfo o2)
{
return o1.Name.compareTo(o2.Name);
}
});
int currentSlot = 9; int currentSlot = 9;
for (ServerInfo server : servers) for (ServerInfo server : servers)

View File

@ -2,29 +2,23 @@ package mineplex.hub.server.ui.clans;
import org.bukkit.Sound; import org.bukkit.Sound;
import org.bukkit.entity.Player; import org.bukkit.entity.Player;
import org.bukkit.event.EventHandler;
import org.bukkit.event.block.Action;
import org.bukkit.event.player.PlayerInteractEvent;
import mineplex.core.account.CoreClientManager; import mineplex.core.account.CoreClientManager;
import mineplex.core.common.util.C;
import mineplex.core.common.util.F; import mineplex.core.common.util.F;
import mineplex.core.donation.DonationManager; import mineplex.core.donation.DonationManager;
import mineplex.core.party.Party; import mineplex.core.party.Party;
import mineplex.core.shop.ShopBase; import mineplex.core.shop.ShopBase;
import mineplex.core.shop.page.ShopPageBase; import mineplex.core.shop.page.ShopPageBase;
import mineplex.game.clans.core.repository.ClanRepository; import mineplex.game.clans.core.repository.ClanRepository;
import mineplex.game.clans.core.repository.tokens.SimpleClanToken;
import mineplex.hub.server.ServerManager; import mineplex.hub.server.ServerManager;
public class ClansServerShop extends ShopBase<ServerManager> public class ClansServerShop extends ShopBase<ServerManager>
{ {
private ClanRepository _repository; private ClanRepository _repository;
public ClansServerShop(ServerManager plugin, CoreClientManager clientManager, DonationManager donationManager) public ClansServerShop(ServerManager plugin, CoreClientManager clientManager, DonationManager donationManager)
{ {
super(plugin, clientManager, donationManager, "Clans Alpha"); super(plugin, clientManager, donationManager, "Clans Beta");
_repository = new ClanRepository(plugin.getPlugin(), plugin.getStatusManager().getCurrentServerName()); _repository = new ClanRepository(plugin.getPlugin(), plugin.getStatusManager().getCurrentServerName());
} }
@ -32,7 +26,7 @@ public class ClansServerShop extends ShopBase<ServerManager>
@Override @Override
protected ShopPageBase<ServerManager, ? extends ShopBase<ServerManager>> buildPagesFor(Player player) protected ShopPageBase<ServerManager, ? extends ShopBase<ServerManager>> buildPagesFor(Player player)
{ {
return new ClansServerPage(getPlugin(), this, getClientManager(), getDonationManager(), player, _repository); return new ClansServerPage(getPlugin(), this, getClientManager(), getDonationManager(), player);
} }
@Override @Override

View File

@ -70,6 +70,7 @@ public class BlockToss extends SkillCharge implements IThrown
Material.STONE_BUTTON, Material.STONE_BUTTON,
Material.WOOD_BUTTON, Material.WOOD_BUTTON,
Material.LEVER, Material.LEVER,
Material.BARRIER,
}; };
public BlockToss(SkillFactory skills, String name, ClassType classType, SkillType skillType, int cost, int levels) public BlockToss(SkillFactory skills, String name, ClassType classType, SkillType skillType, int cost, int levels)

View File

@ -263,12 +263,12 @@ public abstract class WorldEvent implements Listener, ScoreboardElement
HandlerList.unregisterAll(creature); HandlerList.unregisterAll(creature);
_creatures.remove(creature); _creatures.remove(creature);
} }
public void announceStart() public void announceStart()
{ {
UtilTextMiddle.display(C.cGreen + getName(), UtilWorld.locToStrClean(getCenterLocation()), 10, 100, 40); UtilTextMiddle.display(C.cGreen + getName(), UtilWorld.locToStrClean(getCenterLocation()), 10, 100, 40);
Bukkit.broadcastMessage(F.main("Event", F.elem(getName()) + " has started at coordinates " + F.elem(UtilWorld.locToStrClean(getCenterLocation())))); UtilServer.broadcast(F.main("Event", F.elem(getName()) + " has started at coordinates " + F.elem(UtilWorld.locToStrClean(getCenterLocation()))));
} }
public void clearCreatures() public void clearCreatures()

View File

@ -379,7 +379,7 @@ public class ConditionEffect implements Listener
Manager.getDamagerManager().NewDamageEvent(ent, condition.GetSource(), null, Manager.getDamagerManager().NewDamageEvent(ent, condition.GetSource(), null,
DamageCause.CUSTOM, 0.1, false, true, false, DamageCause.CUSTOM, 0.1, false, true, false,
condition.GetSource().getName(), "Poison"); condition.GetSource() != null ? condition.GetSource().getName() : "The Mighty Defek7", "Poison");
} }
} }

View File

@ -24,13 +24,14 @@ public final class DBPool
BasicDataSource source = new BasicDataSource(); BasicDataSource source = new BasicDataSource();
source.addConnectionProperty("autoReconnect", "true"); source.addConnectionProperty("autoReconnect", "true");
source.addConnectionProperty("allowMultiQueries", "true"); source.addConnectionProperty("allowMultiQueries", "true");
source.addConnectionProperty("zeroDateTimeBehavior", "convertToNull");
source.setDefaultTransactionIsolation(Connection.TRANSACTION_READ_COMMITTED); source.setDefaultTransactionIsolation(Connection.TRANSACTION_READ_COMMITTED);
source.setDriverClassName("com.mysql.jdbc.Driver"); source.setDriverClassName("com.mysql.jdbc.Driver");
source.setUrl(url); source.setUrl(url);
source.setUsername(username); source.setUsername(username);
source.setPassword(password); source.setPassword(password);
source.setMaxTotal(3); source.setMaxTotal(4);
source.setMaxIdle(3); source.setMaxIdle(4);
source.setTimeBetweenEvictionRunsMillis(180 * 1000); source.setTimeBetweenEvictionRunsMillis(180 * 1000);
source.setSoftMinEvictableIdleTimeMillis(180 * 1000); source.setSoftMinEvictableIdleTimeMillis(180 * 1000);

View File

@ -143,7 +143,7 @@ public abstract class RepositoryBase
} }
protected void executeQuery(String query, ResultSetCallable callable, Column<?>...columns) protected void executeQuery(String query, ResultSetCallable callable, Column<?>...columns)
{ {
// Automatic resource management for handling/closing objects. // Automatic resource management for handling/closing objects.
try ( try (
Connection connection = getConnection(); Connection connection = getConnection();

View File

@ -2,6 +2,12 @@ package mineplex.staffServer;
import java.util.UUID; import java.util.UUID;
import org.bukkit.Bukkit;
import org.bukkit.craftbukkit.v1_8_R3.CraftServer;
import org.bukkit.plugin.java.JavaPlugin;
import com.mojang.authlib.GameProfile;
import mineplex.core.account.CoreClientManager; import mineplex.core.account.CoreClientManager;
import mineplex.core.achievement.AchievementManager; import mineplex.core.achievement.AchievementManager;
import mineplex.core.antihack.AntiHack; import mineplex.core.antihack.AntiHack;
@ -9,6 +15,7 @@ import mineplex.core.chat.Chat;
import mineplex.core.command.CommandCenter; import mineplex.core.command.CommandCenter;
import mineplex.core.creature.Creature; import mineplex.core.creature.Creature;
import mineplex.core.donation.DonationManager; import mineplex.core.donation.DonationManager;
import mineplex.core.incognito.IncognitoManager;
import mineplex.core.inventory.InventoryManager; import mineplex.core.inventory.InventoryManager;
import mineplex.core.memory.MemoryFix; import mineplex.core.memory.MemoryFix;
import mineplex.core.monitor.LagMeter; import mineplex.core.monitor.LagMeter;
@ -26,12 +33,6 @@ import mineplex.staffServer.customerSupport.CustomerSupport;
import mineplex.staffServer.salespackage.SalesPackageManager; import mineplex.staffServer.salespackage.SalesPackageManager;
import net.minecraft.server.v1_8_R3.MinecraftServer; import net.minecraft.server.v1_8_R3.MinecraftServer;
import org.bukkit.Bukkit;
import org.bukkit.craftbukkit.v1_8_R3.CraftServer;
import org.bukkit.plugin.java.JavaPlugin;
import com.mojang.authlib.GameProfile;
public class StaffServer extends JavaPlugin public class StaffServer extends JavaPlugin
{ {
private String WEB_CONFIG = "webServer"; private String WEB_CONFIG = "webServer";
@ -60,7 +61,7 @@ public class StaffServer extends JavaPlugin
preferenceManager.GiveItem = false; preferenceManager.GiveItem = false;
Portal portal = new Portal(this, clientManager, serverStatusManager.getCurrentServerName()); Portal portal = new Portal(this, clientManager, serverStatusManager.getCurrentServerName());
new Chat(this, clientManager, preferenceManager, new AchievementManager(new StatsManager(this, clientManager), clientManager, donationManager), serverStatusManager.getCurrentServerName()); new Chat(this, null, clientManager, preferenceManager, new AchievementManager(new StatsManager(this, clientManager), clientManager, donationManager), serverStatusManager.getCurrentServerName());
new MemoryFix(this); new MemoryFix(this);
new FileUpdater(this, portal, serverStatusManager.getCurrentServerName(), serverStatusManager.getRegion()); new FileUpdater(this, portal, serverStatusManager.getCurrentServerName(), serverStatusManager.getRegion());
AntiHack.Initialize(this, punish, portal, preferenceManager, clientManager); AntiHack.Initialize(this, punish, portal, preferenceManager, clientManager);

View File

@ -1,6 +1,10 @@
package mineplex.staffServer.customerSupport; package mineplex.staffServer.customerSupport;
import java.sql.ResultSet;
import java.sql.SQLException;
import java.util.ArrayList;
import java.util.HashSet; import java.util.HashSet;
import java.util.List;
import mineplex.core.MiniPlugin; import mineplex.core.MiniPlugin;
import mineplex.core.account.CoreClient; import mineplex.core.account.CoreClient;
@ -13,6 +17,7 @@ import mineplex.core.donation.DonationManager;
import mineplex.core.donation.Donor; import mineplex.core.donation.Donor;
import mineplex.core.donation.repository.token.CoinTransactionToken; import mineplex.core.donation.repository.token.CoinTransactionToken;
import mineplex.core.donation.repository.token.TransactionToken; import mineplex.core.donation.repository.token.TransactionToken;
import mineplex.serverdata.database.ResultSetCallable;
import mineplex.staffServer.salespackage.SalesPackageManager; import mineplex.staffServer.salespackage.SalesPackageManager;
import org.bukkit.GameMode; import org.bukkit.GameMode;
@ -27,13 +32,15 @@ import org.bukkit.event.player.PlayerJoinEvent;
import org.bukkit.event.player.PlayerQuitEvent; import org.bukkit.event.player.PlayerQuitEvent;
import org.bukkit.plugin.java.JavaPlugin; import org.bukkit.plugin.java.JavaPlugin;
public class CustomerSupport extends MiniPlugin public class CustomerSupport extends MiniPlugin implements ResultSetCallable
{ {
private CoreClientManager _clientManager; private CoreClientManager _clientManager;
private DonationManager _donationManager; private DonationManager _donationManager;
private SalesPackageManager _salesPackageManager; private SalesPackageManager _salesPackageManager;
private CustomerSupportRepository _repository;
private NautHashMap<Player, HashSet<String>> _agentCacheMap = new NautHashMap<Player, HashSet<String>>(); private NautHashMap<Player, HashSet<String>> _agentCacheMap = new NautHashMap<Player, HashSet<String>>();
private NautHashMap<Integer, List<String>> _accountBonusLog = new NautHashMap<>();
public CustomerSupport(JavaPlugin plugin, CoreClientManager clientManager, DonationManager donationManager, SalesPackageManager salesPackageManager) public CustomerSupport(JavaPlugin plugin, CoreClientManager clientManager, DonationManager donationManager, SalesPackageManager salesPackageManager)
{ {
@ -42,6 +49,7 @@ public class CustomerSupport extends MiniPlugin
_clientManager = clientManager; _clientManager = clientManager;
_donationManager = donationManager; _donationManager = donationManager;
_salesPackageManager = salesPackageManager; _salesPackageManager = salesPackageManager;
_repository = new CustomerSupportRepository(getPlugin());
} }
@EventHandler @EventHandler
@ -94,98 +102,124 @@ public class CustomerSupport extends MiniPlugin
{ {
CoreClient client = _clientManager.Get(playerName); CoreClient client = _clientManager.Get(playerName);
Donor donor = _donationManager.Get(playerName); Donor donor = _donationManager.Get(playerName);
CustomerSupport instance = this;
caller.sendMessage(C.cDGreen + C.Strike + "============================================="); runAsync(new Runnable()
caller.sendMessage(C.cBlue + "Name : " + C.cYellow + playerName);
caller.sendMessage(C.cBlue + "Rank : " + C.cYellow + (client.GetRank() == null ? C.cRed + "Error rank null!" : (client.GetRank().Name.isEmpty() ? "Regular" : client.GetRank().Name)));
caller.sendMessage(C.cBlue + "Coins : " + C.cYellow + donor.getCoins());
caller.sendMessage(C.cBlue + "Gems : " + C.cYellow + donor.GetGems());
int enjinCoinsReceived = 0;
int oldChestsReceived = 0;
int ancientChestsReceived = 0;
int mythicalChestsReceived = 0;
int winterChestsReceived = 0;
int valentinesGiftsReceived = 0;
for (CoinTransactionToken transaction : donor.getCoinTransactions())
{ {
if (transaction.Source.equalsIgnoreCase("Poll") || transaction.Source.equalsIgnoreCase("Halloween Pumpkin") || transaction.Source.equalsIgnoreCase("Treasure Chest") || transaction.Source.equalsIgnoreCase("Coin Party Bomb Pickup") || transaction.Source.contains("Reward") || transaction.Source.contains("purchase")) public void run()
{ {
if (transaction.Source.contains("purchase")) _repository.loadBonusLogForAccountId(client.getAccountId(), instance);
enjinCoinsReceived += transaction.Amount;
} runSync(new Runnable()
} {
public void run()
{
caller.sendMessage(C.cDGreen + C.Strike + "=============================================");
caller.sendMessage(C.cBlue + "Name : " + C.cYellow + playerName);
caller.sendMessage(C.cBlue + "Rank : " + C.cYellow + (client.GetRank() == null ? C.cRed + "Error rank null!" : (client.GetRank().Name.isEmpty() ? "Regular" : client.GetRank().Name)));
caller.sendMessage(C.cBlue + "Coins : " + C.cYellow + donor.getCoins());
caller.sendMessage(C.cBlue + "Gems : " + C.cYellow + donor.GetGems());
for (TransactionToken transaction : donor.getTransactions()) int enjinCoinsReceived = 0;
{ int oldChestsReceived = 0;
if (transaction.SalesPackageName.startsWith("Old Chest")) int ancientChestsReceived = 0;
{ int mythicalChestsReceived = 0;
if (transaction.Coins == 0 && transaction.Gems == 0) int winterChestsReceived = 0;
{ int valentinesGiftsReceived = 0;
if (transaction.SalesPackageName.split(" ").length == 3)
oldChestsReceived += Integer.parseInt(transaction.SalesPackageName.split(" ")[2]); for (CoinTransactionToken transaction : donor.getCoinTransactions())
else if (transaction.SalesPackageName.split(" ").length == 2) {
oldChestsReceived += 1; if (transaction.Source.equalsIgnoreCase("Poll") || transaction.Source.equalsIgnoreCase("Halloween Pumpkin") || transaction.Source.equalsIgnoreCase("Treasure Chest") || transaction.Source.equalsIgnoreCase("Coin Party Bomb Pickup") || transaction.Source.contains("Reward") || transaction.Source.contains("purchase"))
} {
if (transaction.Source.contains("purchase"))
} enjinCoinsReceived += transaction.Amount;
if (transaction.SalesPackageName.startsWith("Ancient Chest")) }
{ }
if (transaction.Coins == 0 && transaction.Gems == 0)
{
if (transaction.SalesPackageName.split(" ").length == 3)
ancientChestsReceived += Integer.parseInt(transaction.SalesPackageName.split(" ")[2]);
else if (transaction.SalesPackageName.split(" ").length == 2)
ancientChestsReceived += 1;
}
}
if (transaction.SalesPackageName.startsWith("Mythical Chest"))
{
if (transaction.Coins == 0 && transaction.Gems == 0)
{
if (transaction.SalesPackageName.split(" ").length == 3)
mythicalChestsReceived += Integer.parseInt(transaction.SalesPackageName.split(" ")[2]);
else if (transaction.SalesPackageName.split(" ").length == 2)
mythicalChestsReceived += 1;
}
}
if (transaction.SalesPackageName.startsWith("Winter Chest"))
{
if (transaction.Coins == 0 && transaction.Gems == 0)
{
if (transaction.SalesPackageName.split(" ").length == 3)
winterChestsReceived += Integer.parseInt(transaction.SalesPackageName.split(" ")[2]);
else if (transaction.SalesPackageName.split(" ").length == 2)
winterChestsReceived += 1;
}
} for (TransactionToken transaction : donor.getTransactions())
if (transaction.SalesPackageName.startsWith("Valentines Gift")) {
{ if (transaction.SalesPackageName.startsWith("Old Chest"))
if (transaction.Coins == 0 && transaction.Gems == 0) {
{ if (transaction.Coins == 0 && transaction.Gems == 0)
if (transaction.SalesPackageName.split(" ").length == 3) {
valentinesGiftsReceived += Integer.parseInt(transaction.SalesPackageName.split(" ")[2]); if (transaction.SalesPackageName.split(" ").length == 3)
else if (transaction.SalesPackageName.split(" ").length == 2) oldChestsReceived += Integer.parseInt(transaction.SalesPackageName.split(" ")[2]);
valentinesGiftsReceived += 1; else if (transaction.SalesPackageName.split(" ").length == 2)
} oldChestsReceived += 1;
}
}
if (transaction.SalesPackageName.startsWith("Ancient Chest"))
{
if (transaction.Coins == 0 && transaction.Gems == 0)
{
if (transaction.SalesPackageName.split(" ").length == 3)
ancientChestsReceived += Integer.parseInt(transaction.SalesPackageName.split(" ")[2]);
else if (transaction.SalesPackageName.split(" ").length == 2)
ancientChestsReceived += 1;
}
}
if (transaction.SalesPackageName.startsWith("Mythical Chest"))
{
if (transaction.Coins == 0 && transaction.Gems == 0)
{
if (transaction.SalesPackageName.split(" ").length == 3)
mythicalChestsReceived += Integer.parseInt(transaction.SalesPackageName.split(" ")[2]);
else if (transaction.SalesPackageName.split(" ").length == 2)
mythicalChestsReceived += 1;
}
}
if (transaction.SalesPackageName.startsWith("Winter Chest"))
{
if (transaction.Coins == 0 && transaction.Gems == 0)
{
if (transaction.SalesPackageName.split(" ").length == 3)
winterChestsReceived += Integer.parseInt(transaction.SalesPackageName.split(" ")[2]);
else if (transaction.SalesPackageName.split(" ").length == 2)
winterChestsReceived += 1;
}
}
if (transaction.SalesPackageName.startsWith("Valentines Gift"))
{
if (transaction.Coins == 0 && transaction.Gems == 0)
{
if (transaction.SalesPackageName.split(" ").length == 3)
valentinesGiftsReceived += Integer.parseInt(transaction.SalesPackageName.split(" ")[2]);
else if (transaction.SalesPackageName.split(" ").length == 2)
valentinesGiftsReceived += 1;
}
}
}
caller.sendMessage(C.cBlue + "Enjin Coin Total Received : " + C.cYellow + enjinCoinsReceived);
caller.sendMessage(C.cBlue + "Old Chests Received : " + C.cYellow + oldChestsReceived);
caller.sendMessage(C.cBlue + "Ancient Chests Received : " + C.cYellow + ancientChestsReceived);
caller.sendMessage(C.cBlue + "Mythical Chests Received : " + C.cYellow + mythicalChestsReceived);
caller.sendMessage(C.cBlue + "Winter Chests Received : " + C.cYellow + winterChestsReceived);
caller.sendMessage(C.cBlue + "Valentines Gifts Received : " + C.cYellow + valentinesGiftsReceived);
caller.sendMessage(C.cBlue + "Monthly Bonus Log (Last 6 entries):");
if (_accountBonusLog.containsKey(client.getAccountId()))
{
for (String logEntry : _accountBonusLog.get(client.getAccountId()))
{
caller.sendMessage(C.cYellow + logEntry);
}
}
caller.sendMessage(C.cDGreen + C.Strike + "=============================================");
_salesPackageManager.displaySalesPackages(caller, playerName);
caller.sendMessage(C.cDGreen + C.Strike + "=============================================");
_accountBonusLog.remove(client.getAccountId());
}
});
} }
} });
caller.sendMessage(C.cBlue + "Enjin Coin Total Received : " + C.cYellow + enjinCoinsReceived);
caller.sendMessage(C.cBlue + "Old Chests Received : " + C.cYellow + oldChestsReceived);
caller.sendMessage(C.cBlue + "Ancient Chests Received : " + C.cYellow + ancientChestsReceived);
caller.sendMessage(C.cBlue + "Mythical Chests Received : " + C.cYellow + mythicalChestsReceived);
caller.sendMessage(C.cBlue + "Winter Chests Received : " + C.cYellow + winterChestsReceived);
caller.sendMessage(C.cBlue + "Valentines Gifts Received : " + C.cYellow + valentinesGiftsReceived);
caller.sendMessage(C.cDGreen + C.Strike + "=============================================");
_salesPackageManager.displaySalesPackages(caller, playerName);
caller.sendMessage(C.cDGreen + C.Strike + "=============================================");
} }
@EventHandler @EventHandler
@ -215,4 +249,20 @@ public class CustomerSupport extends MiniPlugin
event.setCancelled(true); event.setCancelled(true);
} }
@Override
public void processResultSet(ResultSet resultSet) throws SQLException
{
List<String> log = new ArrayList<String>();
int accountId = 0;
while (resultSet.next() && log.size() < 6)
{
accountId = resultSet.getInt(1);
log.add("Received " + resultSet.getInt(3) + " " + resultSet.getString(2) + " on " + resultSet.getDate(4));
}
if (accountId != 0)
_accountBonusLog.put(accountId, log);
}
} }

View File

@ -34,8 +34,8 @@ public class checkCommand extends CommandBase<CustomerSupport>
{ {
public void run() public void run()
{ {
Plugin.addAgentMapping(caller, name);
Plugin.showPlayerInfo(caller, name); Plugin.showPlayerInfo(caller, name);
Plugin.addAgentMapping(caller, name);
} }
}); });
} }

View File

@ -134,8 +134,8 @@ public class Arcade extends JavaPlugin
StatsManager statsManager = new StatsManager(this, _clientManager); StatsManager statsManager = new StatsManager(this, _clientManager);
AchievementManager achievementManager = new AchievementManager(statsManager, _clientManager, _donationManager); AchievementManager achievementManager = new AchievementManager(statsManager, _clientManager, _donationManager);
FriendManager friendManager = new FriendManager(this, _clientManager, preferenceManager, portal); FriendManager friendManager = new FriendManager(this, _clientManager, preferenceManager, portal);
Chat chat = new Chat(this, _clientManager, preferenceManager, achievementManager, serverStatusManager.getCurrentServerName()); Chat chat = new Chat(this, incognito, _clientManager, preferenceManager, achievementManager, serverStatusManager.getCurrentServerName());
new MessageManager(this, _clientManager, preferenceManager, ignoreManager, punish, friendManager, chat); new MessageManager(this, incognito, _clientManager, preferenceManager, ignoreManager, punish, friendManager, chat);
BlockRestore blockRestore = new BlockRestore(this); BlockRestore blockRestore = new BlockRestore(this);
@ -157,7 +157,7 @@ public class Arcade extends JavaPlugin
//Arcade Manager //Arcade Manager
PollManager pollManager = new PollManager(this, _clientManager, _donationManager); PollManager pollManager = new PollManager(this, _clientManager, _donationManager);
_gameManager = new ArcadeManager(this, serverStatusManager, ReadServerConfig(), _clientManager, _donationManager, _damageManager, statsManager, achievementManager, disguiseManager, creature, teleport, new Blood(this), chat, portal, preferenceManager, inventoryManager, packetHandler, cosmeticManager, projectileManager, petManager, hologramManager, webServerAddress, pollManager, npcmanager, customDataManager, punish); _gameManager = new ArcadeManager(this, serverStatusManager, ReadServerConfig(), _clientManager, _donationManager, _damageManager, statsManager, incognito, achievementManager, disguiseManager, creature, teleport, new Blood(this), chat, portal, preferenceManager, inventoryManager, packetHandler, cosmeticManager, projectileManager, petManager, hologramManager, webServerAddress, pollManager, npcmanager, customDataManager, punish);
new MemoryFix(this); new MemoryFix(this);
new CustomTagFix(this, packetHandler); new CustomTagFix(this, packetHandler);

View File

@ -34,6 +34,8 @@ import mineplex.core.facebook.FacebookManager;
import mineplex.core.gadget.types.Gadget; import mineplex.core.gadget.types.Gadget;
import mineplex.core.gadget.types.GadgetType; import mineplex.core.gadget.types.GadgetType;
import mineplex.core.hologram.HologramManager; import mineplex.core.hologram.HologramManager;
import mineplex.core.incognito.IncognitoManager;
import mineplex.core.incognito.events.IncognitoStatusChangeEvent;
import mineplex.core.inventory.InventoryManager; import mineplex.core.inventory.InventoryManager;
import mineplex.core.itemstack.ItemStackFactory; import mineplex.core.itemstack.ItemStackFactory;
import mineplex.core.movement.Movement; import mineplex.core.movement.Movement;
@ -86,7 +88,6 @@ import nautilus.game.arcade.game.GameTeam;
import nautilus.game.arcade.game.games.event.EventModule; import nautilus.game.arcade.game.games.event.EventModule;
import nautilus.game.arcade.game.games.uhc.UHC; import nautilus.game.arcade.game.games.uhc.UHC;
import nautilus.game.arcade.managers.GameAchievementManager; import nautilus.game.arcade.managers.GameAchievementManager;
import nautilus.game.arcade.managers.chat.GameChatManager;
import nautilus.game.arcade.managers.GameCreationManager; import nautilus.game.arcade.managers.GameCreationManager;
import nautilus.game.arcade.managers.GameFlagManager; import nautilus.game.arcade.managers.GameFlagManager;
import nautilus.game.arcade.managers.GameGemManager; import nautilus.game.arcade.managers.GameGemManager;
@ -100,9 +101,9 @@ import nautilus.game.arcade.managers.GameStatManager;
import nautilus.game.arcade.managers.GameTestingManager; import nautilus.game.arcade.managers.GameTestingManager;
import nautilus.game.arcade.managers.GameTournamentManager; import nautilus.game.arcade.managers.GameTournamentManager;
import nautilus.game.arcade.managers.GameWorldManager; import nautilus.game.arcade.managers.GameWorldManager;
import nautilus.game.arcade.managers.HolidayManager;
import nautilus.game.arcade.managers.IdleManager; import nautilus.game.arcade.managers.IdleManager;
import nautilus.game.arcade.managers.MiscManager; import nautilus.game.arcade.managers.MiscManager;
import nautilus.game.arcade.managers.chat.GameChatManager;
import nautilus.game.arcade.player.ArcadePlayer; import nautilus.game.arcade.player.ArcadePlayer;
import nautilus.game.arcade.shop.ArcadeShop; import nautilus.game.arcade.shop.ArcadeShop;
import net.minecraft.server.v1_8_R3.EntityLiving; import net.minecraft.server.v1_8_R3.EntityLiving;
@ -190,6 +191,8 @@ public class ArcadeManager extends MiniPlugin implements IRelation
private ResourcePackManager _resourcePackManager; private ResourcePackManager _resourcePackManager;
private CustomDataManager _customDataManager; private CustomDataManager _customDataManager;
private Punish _punishmentManager; private Punish _punishmentManager;
private IncognitoManager _incognitoManager;
private TaskManager _taskManager; private TaskManager _taskManager;
private PacketHandler _packetHandler; private PacketHandler _packetHandler;
@ -211,7 +214,7 @@ public class ArcadeManager extends MiniPlugin implements IRelation
public ArcadeManager(Arcade plugin, ServerStatusManager serverStatusManager, GameServerConfig serverConfig, public ArcadeManager(Arcade plugin, ServerStatusManager serverStatusManager, GameServerConfig serverConfig,
CoreClientManager clientManager, DonationManager donationManager, DamageManager damageManager, CoreClientManager clientManager, DonationManager donationManager, DamageManager damageManager,
StatsManager statsManager, AchievementManager achievementManager, DisguiseManager disguiseManager, Creature creature, Teleport teleport, Blood blood, Chat chat, StatsManager statsManager, IncognitoManager incognitoManager, AchievementManager achievementManager, DisguiseManager disguiseManager, Creature creature, Teleport teleport, Blood blood, Chat chat,
Portal portal, PreferencesManager preferences, InventoryManager inventoryManager, PacketHandler packetHandler, Portal portal, PreferencesManager preferences, InventoryManager inventoryManager, PacketHandler packetHandler,
CosmeticManager cosmeticManager, ProjectileManager projectileManager, PetManager petManager, HologramManager hologramManager, String webAddress, PollManager pollManager, CosmeticManager cosmeticManager, ProjectileManager projectileManager, PetManager petManager, HologramManager hologramManager, String webAddress, PollManager pollManager,
NpcManager npcManager, CustomDataManager customDataManager, Punish punish) NpcManager npcManager, CustomDataManager customDataManager, Punish punish)
@ -223,6 +226,8 @@ public class ArcadeManager extends MiniPlugin implements IRelation
// Modules // Modules
_blockRestore = new BlockRestore(plugin); _blockRestore = new BlockRestore(plugin);
_incognitoManager = incognitoManager;
_blood = blood; _blood = blood;
_preferencesManager = preferences; _preferencesManager = preferences;
@ -610,6 +615,41 @@ public class ArcadeManager extends MiniPlugin implements IRelation
return true; return true;
} }
@EventHandler
public void StaffIncognito(IncognitoStatusChangeEvent event)
{
if (event.getNewState() && _game != null && _game.IsPlaying(event.getPlayer()) && _game.IsLive())
{
addSpectator(event.getPlayer(), true);
event.setCancelled(true);
return;
}
if (event.getNewState())
{
UtilServer.broadcast(F.sys("Quit", event.getPlayer().getName()));
if (_game == null || _game.GetState() != GameState.Live)
{
_specList.add(event.getPlayer());
}
}
else
{
UtilServer.broadcast(F.sys("Join", event.getPlayer().getName()));
if (_game != null && isSpectator(event.getPlayer()))
{
if (_game.GetState() != GameState.Live)
{
_specList.remove(event.getPlayer());
}
event.show(false);
}
}
}
@EventHandler @EventHandler
public void MessageMOTD(ServerListPingEvent event) public void MessageMOTD(ServerListPingEvent event)
{ {
@ -674,6 +714,15 @@ public class ArcadeManager extends MiniPlugin implements IRelation
{ {
String name = event.getPlayer().getName(); String name = event.getPlayer().getName();
if (_incognitoManager.Get(event.getPlayer()).Status)
{
event.setJoinMessage(null);
return;
}
if (event.getJoinMessage() == null)
return;
if (_game != null && _game.AnnounceJoinQuit) if (_game != null && _game.AnnounceJoinQuit)
event.setJoinMessage(F.sys("Join", GetColor(event.getPlayer()) + name)); event.setJoinMessage(F.sys("Join", GetColor(event.getPlayer()) + name));
@ -684,8 +733,17 @@ public class ArcadeManager extends MiniPlugin implements IRelation
@EventHandler @EventHandler
public void MessageQuit(PlayerQuitEvent event) public void MessageQuit(PlayerQuitEvent event)
{ {
if (_incognitoManager.Get(event.getPlayer()).Status)
{
event.setQuitMessage(null);
return;
}
String name = event.getPlayer().getName(); String name = event.getPlayer().getName();
if (event.getQuitMessage() == null)
return;
if (_game == null || _game.AnnounceJoinQuit) if (_game == null || _game.AnnounceJoinQuit)
event.setQuitMessage(F.sys("Quit", GetColor(event.getPlayer()) + name)); event.setQuitMessage(F.sys("Quit", GetColor(event.getPlayer()) + name));
else else
@ -1084,6 +1142,11 @@ public class ArcadeManager extends MiniPlugin implements IRelation
public boolean IsObserver(Player player) public boolean IsObserver(Player player)
{ {
if (_incognitoManager.Get(player).Status)
{
_specList.add(player);
}
return _specList.contains(player); return _specList.contains(player);
} }

View File

@ -264,5 +264,4 @@ public enum GameType
{ {
return _display.getKitGameName(); return _display.getKitGameName();
} }
} }

View File

@ -55,7 +55,6 @@ import mineplex.core.common.util.UtilTabTitle;
import mineplex.core.common.util.UtilTextMiddle; import mineplex.core.common.util.UtilTextMiddle;
import mineplex.core.common.util.UtilTime; import mineplex.core.common.util.UtilTime;
import mineplex.core.disguise.disguises.DisguisePlayer; import mineplex.core.disguise.disguises.DisguisePlayer;
import mineplex.core.elo.EloSettings;
import mineplex.core.itemstack.ItemBuilder; import mineplex.core.itemstack.ItemBuilder;
import mineplex.core.packethandler.IPacketHandler; import mineplex.core.packethandler.IPacketHandler;
import mineplex.core.packethandler.PacketInfo; import mineplex.core.packethandler.PacketInfo;
@ -162,106 +161,101 @@ public abstract class Game implements Listener
protected String[] _help; protected String[] _help;
// Gameplay Flags // Gameplay Flags
public long GameTimeout = 1200000;
public boolean Damage = true;
public boolean DamagePvP = true;
public boolean DamagePvE = true;
public boolean DamageEvP = true;
public boolean DamageSelf = true;
public boolean DamageFall = true;
public boolean DamageTeamSelf = false;
public boolean DamageTeamOther = true;
public boolean BlockBreak = false;
public boolean BlockBreakCreative = false;
public HashSet<Integer> BlockBreakAllow = new HashSet<Integer>();
public HashSet<Integer> BlockBreakDeny = new HashSet<Integer>();
public boolean BlockPlace = false;
public boolean BlockPlaceCreative = false;
public HashSet<Integer> BlockPlaceAllow = new HashSet<Integer>();
public HashSet<Integer> BlockPlaceDeny = new HashSet<Integer>();
public boolean ItemPickup = false;
public HashSet<Integer> ItemPickupAllow = new HashSet<Integer>();
public HashSet<Integer> ItemPickupDeny = new HashSet<Integer>();
public boolean ItemDrop = false;
public HashSet<Integer> ItemDropAllow = new HashSet<Integer>();
public HashSet<Integer> ItemDropDeny = new HashSet<Integer>();
public boolean InventoryOpenBlock = false;
public boolean InventoryOpenChest = false;
public boolean InventoryClick = false;
public boolean PrivateBlocks = false;
public boolean DeathOut = true;
public boolean DeathDropItems = false;
public boolean DeathMessages = true;
public boolean AutomaticRespawn = true;
public double DeathSpectateSecs = 0;
public boolean DeathTeleport = true;
//Note: If any descriptions are inaccurate, feel free to let me know and/or fix them. Thanks. ~Joe Prezioso public boolean QuitOut = true;
public GameOption<Long> GameTimeout = new GameOption<Long>((long)1200000.0, "Game Timeout", "Allotted time for game mode"); public boolean QuitDropItems = false;
public GameOption<Boolean> Damage = new GameOption<Boolean>(true, "Damage", "Does damage matter in this game mode?"); public boolean IdleKickz = true;
public GameOption<Boolean> DamagePvP = new GameOption<Boolean>(true, "Damage PVP", "Players allowed to damage other players?");
public GameOption<Boolean> DamagePvE = new GameOption<Boolean>(true, "Damage PVE", "Players allowed to damage monsters?");
public GameOption<Boolean> DamageEvP = new GameOption<Boolean>(true, "Damage EVP", "Monsters allowed to damage players?");
public GameOption<Boolean> DamageSelf = new GameOption<Boolean>(true, "Damage Self", "Players allowed to harm themselves?");
public GameOption<Boolean> DamageFall = new GameOption<Boolean>(true, "Damage Fall", "Can players be harmed by falling?");
public GameOption<Boolean> DamageTeamSelf = new GameOption<Boolean>(false, "Damage Team, Self", "Can players damage teammates?");
public GameOption<Boolean> DamageTeamOther = new GameOption<Boolean>(true, "Damage Team, Other", "Can players damage opposing team's players?");
public GameOption<Boolean> BlockBreak = new GameOption<Boolean>(false, "Block Break", "Can players break blocks?"); public boolean CreatureAllow = false;
//Really not sure about the description for this one... public boolean CreatureAllowOverride = false;
public GameOption<Boolean> BlockBreakCreative = new GameOption<Boolean>(false, "Block Break, Creative", "Can players break blocks in creative mode?");
public GameOption<HashSet<Integer>> BlockBreakAllow = new GameOption<HashSet<Integer>>(new HashSet<Integer>(), "Block Break Allow", "Set of blocks players can break");
public GameOption<HashSet<Integer>> BlockBreakDeny = new GameOption<HashSet<Integer>>(new HashSet<Integer>(), "Block Break Deny", "Set of blocks players can't break");
public GameOption<Boolean> BlockPlace = new GameOption<Boolean>(false, "Block Place", "Can players place blocks?"); public int WorldTimeSet = 12000;
public GameOption<Boolean> BlockPlaceCreative = new GameOption<Boolean>(false, "Block Place, Creative", "Can players place blocks in creative mode?"); public boolean WorldWeatherEnabled = false;
public GameOption<HashSet<Integer>> BlockPlaceAllow = new GameOption<HashSet<Integer>>(new HashSet<Integer>(), "Block Place Allow", "Set of blocks players can place"); public int WorldWaterDamage = 0;
public GameOption<HashSet<Integer>> BlockPlaceDeny = new GameOption<HashSet<Integer>>(new HashSet<Integer>(), "Block Place Deny", "Set of blocks players cannot place"); public boolean WorldBoundaryKill = true;
public boolean WorldBlockBurn = false;
public boolean WorldBlockGrow = false;
public boolean WorldFireSpread = false;
public boolean WorldLeavesDecay = false;
public boolean WorldSoilTrample = false;
public boolean WorldBoneMeal = false;
public GameOption<Boolean> ItemPickup = new GameOption<Boolean>(false, "Item Pickup", "Are there items to pickup?"); public int HungerSet = -1;
public GameOption<HashSet<Integer>> ItemPickupAllow = new GameOption<HashSet<Integer>>(new HashSet<Integer>(), "Item Pickup, Allow", "Items players can pick up"); public int HealthSet = -1;
public GameOption<HashSet<Integer>> ItemPickupDeny = new GameOption<HashSet<Integer>>(new HashSet<Integer>(), "Item Pickup, Deny", "Items players cannot pick up");
public GameOption<Boolean> ItemDrop = new GameOption<Boolean>(false, "Item Drop", "Can items drop?"); public boolean PrepareFreeze = true;
public GameOption<HashSet<Integer>> ItemDropAllow = new GameOption<HashSet<Integer>>(new HashSet<Integer>(), "Item Drop Allow", "Set of items that can drop");
public GameOption<HashSet<Integer>> ItemDropDeny = new GameOption<HashSet<Integer>>(new HashSet<Integer>(), "Item Drop Deny", "Set of items that cannot drop");
public GameOption<Boolean> InventoryOpenBlock = new GameOption<Boolean>(false, "Inventory Open Block", "Can players open inventory from a block?"); private double _itemMergeRadius = 0;
public GameOption<Boolean> InventoryOpenChest = new GameOption<Boolean>(false, "Inventory Open Chest", "Can players open inventory from a chest?");
public GameOption<Boolean> InventoryClick = new GameOption<Boolean>(false, "Inventory Click", "Can players click on their inventory?");
public GameOption<Boolean> PrivateBlocks = new GameOption<Boolean>(false, "Private Blocks", "Can private blocks exist?"); public boolean AnnounceStay = true;
public boolean AnnounceJoinQuit = true;
public boolean AnnounceSilence = true;
public GameOption<Boolean> DeathOut = new GameOption<Boolean>(true, "Death Out", "Are players out of the game upon death?"); public boolean DisplayLobbySide = true;
public GameOption<Boolean> DeathDropItems = new GameOption<Boolean>(false, "Death Drop Items", "Do players drop items upon death?");
public GameOption<Boolean> DeathMessages = new GameOption<Boolean>(true, "Death Messages", "Display message upon death?");
public GameOption<Boolean> AutomaticRespawn = new GameOption<Boolean>(true, "Automatic Respawn", "Do players automatically respawn on death?");
public GameOption<Double> DeathSpectateSecs = new GameOption<Double>(0.0, "Death Spectate Secs", "How many seconds players may spectate match while dead"); public GameState KitRegisterState = GameState.Live;
public GameOption<Boolean> DeathTeleport = new GameOption<Boolean>(true, "Death Teleport", "Do players teleport upon death?");
public GameOption<Boolean> QuitOut = new GameOption<Boolean>(true, "Quit Out", "Are players allowed to quit?");
public GameOption<Boolean> QuitDropItems = new GameOption<Boolean>(false, "Quit Drop Items", "Do players drop items if they quit?");
public GameOption<Boolean> IdleKickz = new GameOption<Boolean>(true, "Idle Kickz", "Are idle players kicked?"); public boolean JoinInProgress = false;
public GameOption<Boolean> CreatureAllow = new GameOption<Boolean>(false, "Creature Allow", "Allow creatures to spawn?"); public int TickPerTeleport = 1;
public GameOption<Boolean> CreatureAllowOverride = new GameOption<Boolean>(false, "Creature Allow Override", "Can creatures spawn where they normally wouldn't?");
//Still not quite sure what the descriptions for 'World Block Burn' and 'World Water Damage' should be
public GameOption<Integer> WorldTimeSet = new GameOption<Integer>(12000, "World Time Set", "Set time in the world");
public GameOption<Boolean> WorldWeatherEnabled = new GameOption<Boolean>(false, "Weather Enabled", "Is there weather in this game world?");
public GameOption<Integer> WorldWaterDamage = new GameOption<Integer>(0, "Water Damage", "Can water hurt players?");
public GameOption<Boolean> WorldBoundaryKill = new GameOption<Boolean>(true, "Boundary Kill", "Do players die when leaving the game's boundaries?");
public GameOption<Boolean> WorldBlockBurn = new GameOption<Boolean>(false, "Block Burn", "Can world blocks burn?");
public GameOption<Boolean> WorldBlockGrow = new GameOption<Boolean>(false, "Block Grow", "Do world blocks grow?");
public GameOption<Boolean> WorldFireSpread = new GameOption<Boolean>(false, "Fire Spread", "Does fire spread to world blocks?");
public GameOption<Boolean> WorldLeavesDecay = new GameOption<Boolean>(false, "Leaves Decay", "Do leaves decay?");
public GameOption<Boolean> WorldSoilTrample = new GameOption<Boolean>(false, "Soil Trample", "Can soil be trampled?");
public GameOption<Boolean> WorldBoneMeal = new GameOption<Boolean>(false, "Bone Meal", "Allow using bone meal?");
public GameOption<Integer> HungerSet = new GameOption<Integer>(-1, "Hunger Set", "Default hunger for players"); public int FillTeamsInOrderToCount = -1;
public GameOption<Integer> HealthSet = new GameOption<Integer>(-1, "Health Set", "Default Health for players");
public GameOption<Boolean> PrepareFreeze = new GameOption<Boolean>(true, "Prepare Freeze", "Freeze game while preparations are made?"); public boolean SpawnNearAllies = false;
public boolean SpawnNearEnemies = false;
private GameOption<Double> _itemMergeRadius = new GameOption<Double>(0.0, "Item Merge Radius", "Distance at which items merge"); public boolean StrictAntiHack = false;
//really not sure what the descriptions should be for announcements ~JP public boolean DisableKillCommand = true;
public GameOption<Boolean> AnnounceStay = new GameOption<Boolean>(true, "Announce Stay", "Send message to announce player is staying?");
public GameOption<Boolean> AnnounceJoinQuit = new GameOption<Boolean>(true, "Announce Join Quit", "Send message to announce player has quit?");
public GameOption<Boolean> AnnounceSilence = new GameOption<Boolean>(true, "Announce Silence", "Silence all announcements?");
public GameOption<Boolean> DisplayLobbySide = new GameOption<Boolean>(true, "Display Lobby Side", "Show which side players are on in lobby?"); public boolean GadgetsDisabled = true;
public GameOption<GameState> KitRegisterState = new GameOption<GameState>(GameState.Live, "Kit Register State", "State of registered kits"); public boolean TeleportsDisqualify = true;
public GameOption<Boolean> JoinInProgress = new GameOption<Boolean>(false, "Join In Progress", "Allow players to join a game in progress?"); public boolean DontAllowOverfill = false;
public GameOption<Integer> TickPerTeleport = new GameOption<Integer>(1, "Tick Per Teleport", "Number of ticks between teleports");
public GameOption<Integer> FillTeamsInOrderToCount = new GameOption<Integer>(-1, "Fill Teams In Order To Count", "Number to fill teams to in order to count players");
public GameOption<Boolean> SpawnNearAllies = new GameOption<Boolean>(false, "Spawn Near Allies", "Allow players to spawn near their allies?");
public GameOption<Boolean> SpawnNearEnemies = new GameOption<Boolean>(false, "Spawn Near Enemies", "Allow players to spawn near their enemies?");
public GameOption<Boolean> StrictAntiHack = new GameOption<Boolean>(false, "Strict Anti-Hack", "Turn on Strict Anti-Hack?");
public GameOption<Boolean> DisableKillCommand = new GameOption<Boolean>(true, "Disable Kill Command", "Turn off kill command");
public GameOption<Boolean> GadgetsDisabled = new GameOption<Boolean>(true, "Gadgets Disabled", "Disable gadgets?");
public GameOption<Boolean> TeleportsDisqualify = new GameOption<Boolean>(true, "Teleports Disqualify", "Teleporting disqualifies player?");
public GameOption<Boolean> DontAllowOverfill = new GameOption<Boolean>(false, "Don't Allow Overfill", "Don't let players overfill teams?");
// Addons // Addons
public boolean CompassEnabled = false; public boolean CompassEnabled = false;
@ -316,11 +310,8 @@ public abstract class Game implements Listener
public String Winner = "Nobody"; public String Winner = "Nobody";
public GameTeam WinnerTeam = null; public GameTeam WinnerTeam = null;
//EloSetting - experimental (0 = disabled, 1 = background, 2 = full)
public EloSettings EloSetting = new EloSettings(0);
public boolean EloRanking = false; public boolean EloRanking = false;
public int EloStart = 1400; public int EloStart = 1000;
public boolean CanAddStats = true; public boolean CanAddStats = true;
public boolean CanGiveLoot = true; public boolean CanGiveLoot = true;
@ -716,11 +707,11 @@ public abstract class Game implements Listener
public GameTeam ChooseTeam(Player player) public GameTeam ChooseTeam(Player player)
{ {
if (FillTeamsInOrderToCount.getOption() != -1) if (FillTeamsInOrderToCount != -1)
{ {
for (int i = 0; i < _teamList.size(); i++) for (int i = 0; i < _teamList.size(); i++)
{ {
if (_teamList.get(i).GetSize() < FillTeamsInOrderToCount.getOption()) if (_teamList.get(i).GetSize() < FillTeamsInOrderToCount)
{ {
return _teamList.get(i); return _teamList.get(i);
} }
@ -743,7 +734,7 @@ public abstract class Game implements Listener
public double GetKillsGems(Player killer, Player killed, boolean assist) public double GetKillsGems(Player killer, Player killed, boolean assist)
{ {
if (DeathOut.getOption()) if (DeathOut)
{ {
if (!assist) if (!assist)
{ {
@ -1058,10 +1049,10 @@ public abstract class Game implements Listener
public DeathMessageType GetDeathMessageType() public DeathMessageType GetDeathMessageType()
{ {
if (!DeathMessages.getOption()) if (!DeathMessages)
return DeathMessageType.None; return DeathMessageType.None;
if (this.DeathOut.getOption()) if (this.DeathOut)
return DeathMessageType.Detailed; return DeathMessageType.Detailed;
return DeathMessageType.Simple; return DeathMessageType.Simple;
@ -1131,7 +1122,7 @@ public abstract class Game implements Listener
for (Player player : UtilServer.getPlayers()) for (Player player : UtilServer.getPlayers())
AnnounceGame(player); AnnounceGame(player);
if (AnnounceSilence.getOption()) if (AnnounceSilence)
Manager.GetChat().Silence(PrepareTime, false); Manager.GetChat().Silence(PrepareTime, false);
} }
@ -1216,7 +1207,7 @@ public abstract class Game implements Listener
UtilTextMiddle.display(winnerText, subColor + "won the game", 20, 120, 20); UtilTextMiddle.display(winnerText, subColor + "won the game", 20, 120, 20);
if (AnnounceSilence.getOption()) if (AnnounceSilence)
Manager.GetChat().Silence(5000, false); Manager.GetChat().Silence(5000, false);
} }
@ -1272,166 +1263,10 @@ public abstract class Game implements Listener
} }
UtilTextMiddle.display(winnerText, subColor + "won the game", 20, 120, 20); UtilTextMiddle.display(winnerText, subColor + "won the game", 20, 120, 20);
adjustPlayerElo(places);
if (AnnounceSilence.getOption()) if (AnnounceSilence)
Manager.GetChat().Silence(5000, false); Manager.GetChat().Silence(5000, false);
} }
public int calculateEloMultiplier(int currentElo, int averageElo)
{
int eloDifference = averageElo - currentElo;
if (Math.abs(eloDifference) <= 50)
{
return 0;
}
if (eloDifference >= 200)
{
return 3;
}
if (eloDifference >= 100)
{
return 2;
}
if (eloDifference > 50)
{
return 1;
}
if (eloDifference <= -200)
{
return -3;
}
if (eloDifference <= -100)
{
return -2;
}
if (eloDifference < -50)
{
return -1;
}
return 0;
}
public void adjustPlayerElo(List<Player> places)
{
int averageElo = 0;
for (Player player : UtilServer.getPlayers())
{
averageElo += Manager.getEloManager().getElo(player.getUniqueId(), GetName());
}
//average Elo of all players
averageElo = averageElo/places.size();
for (Player player : UtilServer.getPlayers())
{
int currentElo = Manager.getEloManager().getElo(player.getUniqueId(), GetName());
int lossMultiplier = 1;
int sizeModifier = 3;
int eloMultiplier = calculateEloMultiplier(currentElo, averageElo);
//nobody won, add 10 points to all players
//Profitable enough see the match through to the end, but not enough for a stale-mate to be a more desirable outcome than 3rd place
if (places == null || places.isEmpty())
{
int newElo = currentElo + 10;
Manager.getEloManager().saveElo(player.getUniqueId(), GetName(), newElo);
}
//Top 3 players get 25, 20, and 15 points, respectively
else
{
if (places.size() >= 1)
{
if (player.getUniqueId() == places.get(0).getUniqueId())
{
int newElo = currentElo + 25 + (5 * eloMultiplier);
Manager.getEloManager().saveElo(player.getUniqueId(), GetName(), newElo);
}
}
if (places.size() >= 5)
{
if (player.getUniqueId() == places.get(1).getUniqueId())
{
int newElo = currentElo + 20 + (5 * eloMultiplier);
Manager.getEloManager().saveElo(player.getUniqueId(), GetName(), newElo);
}
}
if (places.size() >= 6)
{
if (player.getUniqueId() == places.get(2).getUniqueId())
{
if (eloMultiplier < -2)
{
eloMultiplier = -2;
}
int newElo = currentElo + 15 + (5 * eloMultiplier);
Manager.getEloManager().saveElo(player.getUniqueId(), GetName(), newElo);
}
}
if (places.size() > 6 && places.size() <= 7)
{
if (player.getUniqueId() == places.get(5).getUniqueId())
{
if(eloMultiplier > 1)
{
eloMultiplier = 0;
}
int newElo = currentElo - 5 + (5 * eloMultiplier);
Manager.getEloManager().saveElo(player.getUniqueId(), GetName(), newElo);
}
}
if (places.size() == 7)
{
if (player.getUniqueId() == places.get(6).getUniqueId())
{
if(eloMultiplier > 2)
{
eloMultiplier = 2;
}
int newElo = currentElo - 10 + (5 * eloMultiplier);
Manager.getEloManager().saveElo(player.getUniqueId(), GetName(), newElo);
}
}
if (places.size() >= 8)
{
//for games with 8+ players, this if statement is just going to run 3 times to check 3 different places
while(lossMultiplier != 0)
{
if (player.getUniqueId() == places.get(places.size() - sizeModifier).getUniqueId())
{
if(eloMultiplier > lossMultiplier)
{
eloMultiplier = lossMultiplier;
}
int newElo = currentElo - (5 * lossMultiplier) + (5 * eloMultiplier);
Manager.getEloManager().saveElo(player.getUniqueId(), GetName(), newElo);
if(sizeModifier >= 1)
{
lossMultiplier++;
sizeModifier--;
}
else
{
lossMultiplier = 0;
}
}
}
}
}
}
}
public void Announce(String message) public void Announce(String message)
{ {
@ -1650,7 +1485,7 @@ public abstract class Game implements Listener
@EventHandler @EventHandler
public void classCombatCreatureAllow(ClassCombatCreatureAllowSpawnEvent event) public void classCombatCreatureAllow(ClassCombatCreatureAllowSpawnEvent event)
{ {
CreatureAllowOverride.setOption(event.getAllowed()); CreatureAllowOverride = event.getAllowed();
} }
public boolean isInsideMap(Player player) public boolean isInsideMap(Player player)
@ -1671,17 +1506,17 @@ public abstract class Game implements Listener
public void setItemMergeRadius(double mergeRadius) public void setItemMergeRadius(double mergeRadius)
{ {
_itemMergeRadius.setOption(mergeRadius); _itemMergeRadius = mergeRadius;
if (WorldData.World != null) if (WorldData.World != null)
{ {
((CraftWorld) WorldData.World).getHandle().spigotConfig.itemMerge = _itemMergeRadius.getOption(); ((CraftWorld) WorldData.World).getHandle().spigotConfig.itemMerge = _itemMergeRadius;
} }
} }
public double getItemMergeRadius() public double getItemMergeRadius()
{ {
return _itemMergeRadius.getOption(); return _itemMergeRadius;
} }
@EventHandler @EventHandler
@ -1690,7 +1525,7 @@ public abstract class Game implements Listener
if (event.getWorld().getName().equals(WorldData.GetFolder())) if (event.getWorld().getName().equals(WorldData.GetFolder()))
{ {
System.out.println("Setting item merge radius for game to " + _itemMergeRadius); System.out.println("Setting item merge radius for game to " + _itemMergeRadius);
((CraftWorld) event.getWorld()).getHandle().spigotConfig.itemMerge = _itemMergeRadius.getOption(); ((CraftWorld) event.getWorld()).getHandle().spigotConfig.itemMerge = _itemMergeRadius;
} }
} }

View File

@ -132,7 +132,7 @@ public class GameTeam
public Location GetSpawn() public Location GetSpawn()
{ {
//Keep allies together //Keep allies together
if (!Host.IsLive() && Host.SpawnNearAllies.getOption()) if (!Host.IsLive() && Host.SpawnNearAllies)
{ {
//Find Location Nearest Ally //Find Location Nearest Ally
Location loc = UtilAlg.getLocationNearPlayers(_spawns, GetPlayers(true), Host.GetPlayers(true)); Location loc = UtilAlg.getLocationNearPlayers(_spawns, GetPlayers(true), Host.GetPlayers(true));
@ -142,7 +142,7 @@ public class GameTeam
//No allies existed spawned yet //No allies existed spawned yet
//Spawn near enemies (used for SG) //Spawn near enemies (used for SG)
if (Host.SpawnNearEnemies.getOption()) if (Host.SpawnNearEnemies)
{ {
loc = UtilAlg.getLocationNearPlayers(_spawns, Host.GetPlayers(true), Host.GetPlayers(true)); loc = UtilAlg.getLocationNearPlayers(_spawns, Host.GetPlayers(true), Host.GetPlayers(true));
if (loc != null) if (loc != null)
@ -159,7 +159,7 @@ public class GameTeam
else else
{ {
//Spawn near players //Spawn near players
if (Host.SpawnNearEnemies.getOption()) if (Host.SpawnNearEnemies)
{ {
Location loc = UtilAlg.getLocationNearPlayers(_spawns, Host.GetPlayers(true), Host.GetPlayers(true)); Location loc = UtilAlg.getLocationNearPlayers(_spawns, Host.GetPlayers(true), Host.GetPlayers(true));
if (loc != null) if (loc != null)

View File

@ -76,7 +76,7 @@ public abstract class TeamGame extends Game
if (player.getWorld().getName().equalsIgnoreCase("world")) if (player.getWorld().getName().equalsIgnoreCase("world"))
return; return;
if (!QuitOut.getOption()) if (!QuitOut)
{ {
//Store //Store
_rejoinTime.put(player.getName(), System.currentTimeMillis()); _rejoinTime.put(player.getName(), System.currentTimeMillis());
@ -97,7 +97,7 @@ public abstract class TeamGame extends Game
@EventHandler(priority = EventPriority.LOWEST) @EventHandler(priority = EventPriority.LOWEST)
public void PlayerLoginAllow(PlayerLoginEvent event) public void PlayerLoginAllow(PlayerLoginEvent event)
{ {
if (!InProgress() || QuitOut.getOption()) if (!InProgress() || QuitOut)
return; return;
//Rejoined //Rejoined
@ -135,7 +135,7 @@ public abstract class TeamGame extends Game
@EventHandler @EventHandler
public void playerRejoinGame(PlayerJoinEvent event) public void playerRejoinGame(PlayerJoinEvent event)
{ {
if (!InProgress() || QuitOut.getOption()) if (!InProgress() || QuitOut)
return; return;
Player player = event.getPlayer(); Player player = event.getPlayer();
@ -150,7 +150,7 @@ public abstract class TeamGame extends Game
@EventHandler @EventHandler
public void PlayerRejoinExpire(UpdateEvent event) public void PlayerRejoinExpire(UpdateEvent event)
{ {
if (event.getType() != UpdateType.SEC || QuitOut.getOption()) if (event.getType() != UpdateType.SEC || QuitOut)
return; return;
Iterator<String> rejoinIterator = _rejoinTime.keySet().iterator(); Iterator<String> rejoinIterator = _rejoinTime.keySet().iterator();
@ -177,7 +177,7 @@ public abstract class TeamGame extends Game
@EventHandler @EventHandler
public void RejoinCommand(PlayerCommandPreprocessEvent event) public void RejoinCommand(PlayerCommandPreprocessEvent event)
{ {
if (!QuitOut.getOption() && event.getPlayer().isOp() && event.getMessage().startsWith("/allowrejoin")) if (!QuitOut && event.getPlayer().isOp() && event.getMessage().startsWith("/allowrejoin"))
{ {
String[] toks = event.getMessage().split(" "); String[] toks = event.getMessage().split(" ");
@ -206,7 +206,7 @@ public abstract class TeamGame extends Game
if (team.GetPlayers(true).size() > 0) if (team.GetPlayers(true).size() > 0)
teamsAlive.add(team); teamsAlive.add(team);
if (!QuitOut.getOption()) if (!QuitOut)
{ {
//Offline Player Team //Offline Player Team
for (GameTeam team : RejoinTeam.values()) for (GameTeam team : RejoinTeam.values())

View File

@ -35,9 +35,9 @@ public class BaconBrawl extends SoloGame
"Last pig in the arena wins!" "Last pig in the arena wins!"
}); });
DamageTeamSelf.setOption(true); DamageTeamSelf = true;
HungerSet.setOption(20); HungerSet = 20;
PrepareFreeze.setOption(false); PrepareFreeze = false;
registerChatStats( registerChatStats(
Kills, Kills,

View File

@ -54,13 +54,13 @@ public class KitMamaPig extends Kit
disguise.setCustomNameVisible(false); disguise.setCustomNameVisible(false);
Manager.GetDisguise().disguise(disguise); Manager.GetDisguise().disguise(disguise);
Manager.GetGame().CreatureAllowOverride.setOption(true); Manager.GetGame().CreatureAllowOverride = true;
final Pig pig = player.getWorld().spawn(player.getEyeLocation(), Pig.class); final Pig pig = player.getWorld().spawn(player.getEyeLocation(), Pig.class);
pig.setBaby(); pig.setBaby();
pig.setAgeLock(true); pig.setAgeLock(true);
pig.setCustomName(C.cYellow + player.getName()); pig.setCustomName(C.cYellow + player.getName());
pig.setCustomNameVisible(false); pig.setCustomNameVisible(false);
Manager.GetGame().CreatureAllowOverride.setOption(false); Manager.GetGame().CreatureAllowOverride = false;
player.setPassenger(pig); player.setPassenger(pig);

View File

@ -39,27 +39,27 @@ public class Barbarians extends SoloGame
"Last player alive wins!" "Last player alive wins!"
}); });
this.DamageTeamSelf.setOption(true); this.DamageTeamSelf = true;
this.CompassEnabled = true; this.CompassEnabled = true;
this.BlockBreakAllow.getOption().add(5); this.BlockBreakAllow.add(5);
this.BlockBreakAllow.getOption().add(17); this.BlockBreakAllow.add(17);
this.BlockBreakAllow.getOption().add(18); this.BlockBreakAllow.add(18);
this.BlockBreakAllow.getOption().add(20); this.BlockBreakAllow.add(20);
this.BlockBreakAllow.getOption().add(30); this.BlockBreakAllow.add(30);
this.BlockBreakAllow.getOption().add(47); this.BlockBreakAllow.add(47);
this.BlockBreakAllow.getOption().add(53); this.BlockBreakAllow.add(53);
this.BlockBreakAllow.getOption().add(54); this.BlockBreakAllow.add(54);
this.BlockBreakAllow.getOption().add(58); this.BlockBreakAllow.add(58);
this.BlockBreakAllow.getOption().add(64); this.BlockBreakAllow.add(64);
this.BlockBreakAllow.getOption().add(83); this.BlockBreakAllow.add(83);
this.BlockBreakAllow.getOption().add(85); this.BlockBreakAllow.add(85);
this.BlockBreakAllow.getOption().add(96); this.BlockBreakAllow.add(96);
this.BlockBreakAllow.getOption().add(125); this.BlockBreakAllow.add(125);
this.BlockBreakAllow.getOption().add(126); this.BlockBreakAllow.add(126);
this.BlockBreakAllow.getOption().add(134); this.BlockBreakAllow.add(134);
this.BlockBreakAllow.getOption().add(135); this.BlockBreakAllow.add(135);
this.BlockBreakAllow.getOption().add(136); this.BlockBreakAllow.add(136);
registerStatTrackers( registerStatTrackers(
new BlockBreakStatTracker(this, true) new BlockBreakStatTracker(this, true)

Some files were not shown because too many files have changed in this diff Show More