diff --git a/Plugins/Mineplex.Bungee.Mineplexer/src/mineplex/bungee/lobbyBalancer/LobbyBalancer.java b/Plugins/Mineplex.Bungee.Mineplexer/src/mineplex/bungee/lobbyBalancer/LobbyBalancer.java index de8602e07..fca669fba 100644 --- a/Plugins/Mineplex.Bungee.Mineplexer/src/mineplex/bungee/lobbyBalancer/LobbyBalancer.java +++ b/Plugins/Mineplex.Bungee.Mineplexer/src/mineplex/bungee/lobbyBalancer/LobbyBalancer.java @@ -2,33 +2,34 @@ package mineplex.bungee.lobbyBalancer; import java.io.File; import java.net.InetSocketAddress; +import java.util.ArrayList; +import java.util.Arrays; import java.util.Collection; import java.util.Collections; +import java.util.EnumMap; import java.util.List; +import java.util.Map; import java.util.concurrent.TimeUnit; -import mineplex.serverdata.Region; -import mineplex.serverdata.data.MinecraftServer; -import mineplex.serverdata.servers.ServerManager; -import mineplex.serverdata.servers.ServerRepository; import net.md_5.bungee.api.event.ServerConnectEvent; import net.md_5.bungee.api.plugin.Listener; import net.md_5.bungee.api.plugin.Plugin; import net.md_5.bungee.event.EventHandler; -import com.google.common.collect.Lists; +import mineplex.serverdata.Region; +import mineplex.serverdata.data.MinecraftServer; +import mineplex.serverdata.servers.ServerManager; +import mineplex.serverdata.servers.ServerRepository; public class LobbyBalancer implements Listener, Runnable { private Plugin _plugin; private ServerRepository _repository; - - private List _sortedLobbies = Lists.newArrayList(); - private List _sortedClans = Lists.newArrayList(); - private static Object _serverLock = new Object(); - - private int _lobbyIndex = 0; - private int _clansIndex = 0; + + private final Map> _sortedLobbyMap = new EnumMap<>(LobbyType.class); + private final Map _nextIndexMap = new EnumMap<>(LobbyType.class); + private static final LobbySorter LOBBY_SORTER = new LobbySorter(); + private static final Object _serverLock = new Object(); public LobbyBalancer(Plugin plugin) { @@ -46,45 +47,42 @@ public class LobbyBalancer implements Listener, Runnable @EventHandler public void playerConnect(ServerConnectEvent event) { - if (event.getTarget().getName().equalsIgnoreCase("Lobby")) - { - synchronized (_serverLock) - { - if (_lobbyIndex >= _sortedLobbies.size() || _sortedLobbies.get(_lobbyIndex).getPlayerCount() >= _sortedLobbies.get(_lobbyIndex).getMaxPlayerCount()) - _lobbyIndex = 0; + Arrays.stream(LobbyType.values()) + .filter(type -> type.getConnectName().equalsIgnoreCase(event.getTarget().getName())) + .findFirst() + .ifPresent(lobbyType -> + { + synchronized (_serverLock) + { + List lobbies = _sortedLobbyMap.get(lobbyType); - event.setTarget(_plugin.getProxy().getServerInfo(_sortedLobbies.get(_lobbyIndex).getName())); - _sortedLobbies.get(_lobbyIndex).incrementPlayerCount(1); - System.out.println("Sending " + event.getPlayer().getName() + " to " + _sortedLobbies.get(_lobbyIndex).getName() + "(" + _sortedLobbies.get(_lobbyIndex).getPublicAddress() + ")"); - _lobbyIndex++; - } - } - if (event.getTarget().getName().equalsIgnoreCase("ClansHub")) - { - synchronized (_serverLock) - { - if (_clansIndex >= _sortedClans.size() || _sortedClans.get(_clansIndex).getPlayerCount() >= _sortedClans.get(_clansIndex).getMaxPlayerCount()) - _clansIndex = 0; + int nextIndex = _nextIndexMap.getOrDefault(lobbyType, 0); + if (nextIndex >= lobbies.size()) + { + nextIndex = 0; + } - event.setTarget(_plugin.getProxy().getServerInfo(_sortedClans.get(_clansIndex).getName())); - _sortedClans.get(_clansIndex).incrementPlayerCount(1); - System.out.println("Sending " + event.getPlayer().getName() + " to " + _sortedClans.get(_clansIndex).getName() + "(" + _sortedClans.get(_clansIndex).getPublicAddress() + ")"); - _clansIndex++; - } - } + MinecraftServer server = lobbies.get(nextIndex); + + event.setTarget(_plugin.getProxy().getServerInfo(server.getName())); + server.incrementPlayerCount(1); + System.out.println("Sending " + event.getPlayer().getName() + " to " + server.getName() + "(" + server.getPublicAddress() + ")"); + + _nextIndexMap.put(lobbyType, ++nextIndex); + } + }); } public void run() { loadServers(); - - if (!_plugin.getProxy().getServers().containsKey("ClansHub")) + + for (LobbyType type : LobbyType.values()) { - _plugin.getProxy().getServers().put("ClansHub", _plugin.getProxy().constructServerInfo("ClansHub", new InetSocketAddress("lobby.mineplex.com", 25565), "LobbyBalancer", false)); - } - if (!_plugin.getProxy().getServers().containsKey("Lobby")) - { - _plugin.getProxy().getServers().put("Lobby", _plugin.getProxy().constructServerInfo("Lobby", new InetSocketAddress("lobby.mineplex.com", 25565), "LobbyBalancer", false)); + if (!_plugin.getProxy().getServers().containsKey(type.getConnectName())) + { + _plugin.getProxy().getServers().put(type.getConnectName(), _plugin.getProxy().constructServerInfo(type.getConnectName(), new InetSocketAddress("lobby.mineplex.com", 25565), "LobbyBalancer", false)); + } } } @@ -95,9 +93,12 @@ public class LobbyBalancer implements Listener, Runnable synchronized (_serverLock) { long startTime = System.currentTimeMillis(); - _sortedLobbies.clear(); - _sortedClans.clear(); - + _sortedLobbyMap.clear(); + for (LobbyType type : LobbyType.values()) + { + _sortedLobbyMap.put(type, new ArrayList<>()); + } + for (MinecraftServer server : servers) { if (server.getName() == null) @@ -105,32 +106,26 @@ public class LobbyBalancer implements Listener, Runnable InetSocketAddress socketAddress = new InetSocketAddress(server.getPublicAddress(), server.getPort()); _plugin.getProxy().getServers().put(server.getName(), _plugin.getProxy().constructServerInfo(server.getName(), socketAddress, "LobbyBalancer", false)); - - if (server.getName().toUpperCase().startsWith("LOBBY-")) - { - if (server.getMotd() == null || !server.getMotd().contains("Restarting")) - { - _sortedLobbies.add(server); - } - } - if (server.getName().toUpperCase().startsWith("CLANSHUB-")) - { - if (server.getMotd() == null || !server.getMotd().contains("Restarting")) - { - _sortedClans.add(server); - } - } + + if (server.getMotd() != null && server.getMotd().contains("Restarting")) + { + continue; + } + + Arrays.stream(LobbyType.values()) + .filter(type -> server.getName().toUpperCase().startsWith(type.getUppercasePrefix())) + .findFirst() + .ifPresent(type -> _sortedLobbyMap.get(type).add(server)); } - - Collections.sort(_sortedLobbies, new LobbySorter()); - Collections.sort(_sortedClans, new LobbySorter()); - + + _sortedLobbyMap.values().forEach(lobbies -> Collections.sort(lobbies, LOBBY_SORTER)); + long timeSpentInLock = System.currentTimeMillis() - startTime; if (timeSpentInLock > 50) System.out.println("[==] TIMING [==] Locked loading servers for " + timeSpentInLock + "ms"); - - _lobbyIndex = 0; + + _nextIndexMap.clear(); } } } diff --git a/Plugins/Mineplex.Bungee.Mineplexer/src/mineplex/bungee/lobbyBalancer/LobbyType.java b/Plugins/Mineplex.Bungee.Mineplexer/src/mineplex/bungee/lobbyBalancer/LobbyType.java new file mode 100644 index 000000000..8b4e4fb5d --- /dev/null +++ b/Plugins/Mineplex.Bungee.Mineplexer/src/mineplex/bungee/lobbyBalancer/LobbyType.java @@ -0,0 +1,34 @@ +package mineplex.bungee.lobbyBalancer; + +public enum LobbyType +{ + NORMAL("Lobby", "LOBBY-", "MainMotd"), + CLANS("ClansHub", "CLANSHUB-", "ClansMotd"), + BETA("BetaHub","BETAHUB-", "BetaMotd"), + ; + private final String _connectName; // The name of the server the player is connecting to + private final String _uppercasePrefix; // The (toUpperCase()) prefix given to servers of this lobby type + private final String _redisMotdKey; + + LobbyType(String connectName, String uppercasePrefix, String redisMotdKey) + { + _connectName = connectName; + _uppercasePrefix = uppercasePrefix; + _redisMotdKey = redisMotdKey; + } + + public String getConnectName() + { + return _connectName; + } + + public String getUppercasePrefix() + { + return _uppercasePrefix; + } + + public String getRedisMotdKey() + { + return _redisMotdKey; + } +} diff --git a/Plugins/Mineplex.Bungee.Mineplexer/src/mineplex/bungee/motd/MotdManager.java b/Plugins/Mineplex.Bungee.Mineplexer/src/mineplex/bungee/motd/MotdManager.java index aa2565f27..4b556d2e2 100644 --- a/Plugins/Mineplex.Bungee.Mineplexer/src/mineplex/bungee/motd/MotdManager.java +++ b/Plugins/Mineplex.Bungee.Mineplexer/src/mineplex/bungee/motd/MotdManager.java @@ -1,138 +1,82 @@ package mineplex.bungee.motd; -import java.io.File; -import java.util.ArrayList; import java.util.Arrays; -import java.util.List; +import java.util.EnumMap; +import java.util.Map; +import java.util.Optional; import java.util.Random; import java.util.concurrent.TimeUnit; -import mineplex.serverdata.Region; -import mineplex.serverdata.data.DataRepository; -import mineplex.serverdata.redis.RedisDataRepository; -import mineplex.serverdata.servers.ConnectionData; -import mineplex.serverdata.servers.ConnectionData.ConnectionType; -import mineplex.serverdata.servers.ServerManager; import net.md_5.bungee.api.event.ProxyPingEvent; import net.md_5.bungee.api.plugin.Listener; import net.md_5.bungee.api.plugin.Plugin; import net.md_5.bungee.event.EventHandler; +import mineplex.bungee.lobbyBalancer.LobbyType; +import mineplex.serverdata.Region; +import mineplex.serverdata.data.DataRepository; +import mineplex.serverdata.redis.RedisDataRepository; +import mineplex.serverdata.servers.ServerManager; + public class MotdManager implements Listener, Runnable { - private Plugin _plugin; - - private DataRepository _repository; - private DataRepository _secondRepository; - private Region _region; - - private Random _random = new Random(); - private String _firstLine = " §b§l§m §8§l§m[ §r §9§lMineplex§r §f§lGames§r §8§l§m ]§b§l§m §r"; - private List _motdLines; - private String _firstCLine = " §b§l§m §8§l§m[ §r §9§lMineplex§r §f§lGames§r §8§l§m ]§b§l§m §r"; - private List _motdCLines; + private static final String DEFAULT_HEADLINE = " §b§l§m §8§l§m[ §r §9§lMineplex§r §f§lGames§r §8§l§m ]§b§l§m §r"; + + private final DataRepository _repository; + private final Random _random = new Random(); + private final Map motds = new EnumMap<>(LobbyType.class); public MotdManager(Plugin plugin) { - _plugin = plugin; - _region = !new File("eu.dat").exists() ? Region.US : Region.EU; - - _plugin.getProxy().getScheduler().schedule(_plugin, this, 5L, 30L, TimeUnit.SECONDS); - _plugin.getProxy().getPluginManager().registerListener(_plugin, this); + plugin.getProxy().getScheduler().schedule(plugin, this, 5L, 30L, TimeUnit.SECONDS); + plugin.getProxy().getPluginManager().registerListener(plugin, this); _repository = new RedisDataRepository(ServerManager.getConnection(true, ServerManager.SERVER_STATUS_LABEL), ServerManager.getConnection(false, ServerManager.SERVER_STATUS_LABEL), Region.ALL, GlobalMotd.class, "globalMotd"); run(); - - if (new File("updateMOTD.dat").exists()) - { - if (_region == Region.US) - _secondRepository = new RedisDataRepository(new ConnectionData("10.81.1.156", 6379, ConnectionType.MASTER, "ServerStatus"), new ConnectionData("10.81.1.156", 6377, ConnectionType.SLAVE, "ServerStatus"), - Region.ALL, GlobalMotd.class, "globalMotd"); - else - _secondRepository = new RedisDataRepository(new ConnectionData("10.33.53.16", 6379, ConnectionType.MASTER, "ServerStatus"), new ConnectionData("10.33.53.16", 6377, ConnectionType.SLAVE, "ServerStatus"), - Region.ALL, GlobalMotd.class, "globalMotd"); - - //String motdLine = "§f§l◄ §c§lMaintenance§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 = " §f> §4§lCLANS BETA §f- §c§lOpen to Everyone §f<"; -// String motdLine = " §f❄ §2§lServer Maintenance §f❄ §2§lBe Back Soon §f❄"; - //String motdLine = " §d§lRank Sale §a§l40% Off"); - //String motdLine = " §f§l◄§c§lMAINTENANCE§f§l►"); - - 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"); - } } @EventHandler public void serverPing(ProxyPingEvent event) { + net.md_5.bungee.api.ServerPing serverPing = event.getResponse(); - if (event.getConnection().getListener() != null && event.getConnection().getListener().getDefaultServer().equalsIgnoreCase("ClansHub")) + Optional maybeType = Optional.empty(); + + if (event.getConnection().getListener() != null) { - String motd = _firstCLine; - if (_motdCLines != null && _motdCLines.size() > 0) - { - motd += "\n" + _motdCLines.get(_random.nextInt(_motdCLines.size())); - } - event.setResponse(new net.md_5.bungee.api.ServerPing(serverPing.getVersion(), serverPing.getPlayers(), motd, serverPing.getFaviconObject())); + maybeType = Arrays.stream(LobbyType.values()) + .filter(type -> event.getConnection().getListener().getDefaultServer().equalsIgnoreCase(type.getConnectName())) + .findFirst(); } - else + + LobbyType lobbyType = maybeType.orElse(LobbyType.NORMAL); + GlobalMotd globalMotd = motds.get(lobbyType); + + String motd = DEFAULT_HEADLINE; + if (globalMotd != null && globalMotd.getHeadline() != null) { - String motd = _firstLine; - if (_motdLines != null && _motdLines.size() > 0) + motd = globalMotd.getHeadline() == null ? DEFAULT_HEADLINE : globalMotd.getHeadline(); + if (globalMotd.getMotd() != null) { - motd += "\n" + _motdLines.get(_random.nextInt(_motdLines.size())); + motd += "\n" + globalMotd.getMotd().get(_random.nextInt(globalMotd.getMotd().size())); } - event.setResponse(new net.md_5.bungee.api.ServerPing(serverPing.getVersion(), serverPing.getPlayers(), motd, serverPing.getFaviconObject())); } + + event.setResponse(new net.md_5.bungee.api.ServerPing(serverPing.getVersion(), serverPing.getPlayers(), motd, serverPing.getFaviconObject())); } @Override public void run() { + for (LobbyType type : LobbyType.values()) { - GlobalMotd motd = _repository.getElement("MainMotd"); + GlobalMotd motd = _repository.getElement(type.getRedisMotdKey()); if (motd != null) - { - _motdLines = motd.getMotd(); - _firstLine = motd.getHeadline(); - } - } - { - GlobalMotd motd = _repository.getElement("ClansMotd"); - - if (motd != null) - { - _motdCLines = motd.getMotd(); - _firstCLine = motd.getHeadline(); - } - else { - _repository.addElement(new GlobalMotd("ClansMotd", "§4§lMineplex Clans§r", Arrays.asList("Default MOTD"))); + motds.put(type, motd); } } } - - /** - * Update the main {@link GlobalMotd} determining the MOTD for Bungee instances. - * @param motdLines - the lines to update the MOTD to. - */ - public void updateMainMotd(String headline, String motdLine) - { - List motdLines = new ArrayList(); - - motdLines.add(motdLine); - - _repository.addElement(new GlobalMotd("MainMotd", headline, motdLines)); - _secondRepository.addElement(new GlobalMotd("MainMotd", headline, motdLines)); - } - - public List getMotdLines() - { - return _motdLines; - } } diff --git a/Plugins/Mineplex.Bungee.Mineplexer/src/mineplex/bungee/playerStats/PlayerStats.java b/Plugins/Mineplex.Bungee.Mineplexer/src/mineplex/bungee/playerStats/PlayerStats.java index cc805cbe2..525d201c7 100644 --- a/Plugins/Mineplex.Bungee.Mineplexer/src/mineplex/bungee/playerStats/PlayerStats.java +++ b/Plugins/Mineplex.Bungee.Mineplexer/src/mineplex/bungee/playerStats/PlayerStats.java @@ -28,7 +28,6 @@ public class PlayerStats implements Listener, Runnable _plugin.getProxy().getPluginManager().registerListener(_plugin, this); _repository = new PlayerStatsRepository(); - _repository.initialize(); } @EventHandler diff --git a/Plugins/Mineplex.Bungee.Mineplexer/src/mineplex/bungee/playerStats/PlayerStatsRepository.java b/Plugins/Mineplex.Bungee.Mineplexer/src/mineplex/bungee/playerStats/PlayerStatsRepository.java index 5e8a54c67..177972ad9 100644 --- a/Plugins/Mineplex.Bungee.Mineplexer/src/mineplex/bungee/playerStats/PlayerStatsRepository.java +++ b/Plugins/Mineplex.Bungee.Mineplexer/src/mineplex/bungee/playerStats/PlayerStatsRepository.java @@ -35,18 +35,6 @@ public class PlayerStatsRepository extends RepositoryBase super(DBPool.getPlayerStats()); } - @Override - public void initialize() - { - - } - - @Override - protected void update() - { - - } - public PlayerInfo getPlayer(UUID uuid, String name, int version) { PlayerInfo playerInfo = null; diff --git a/Plugins/Mineplex.Bungee.Mineplexer/src/mineplex/bungee/playerTracker/PlayerTracker.java b/Plugins/Mineplex.Bungee.Mineplexer/src/mineplex/bungee/playerTracker/PlayerTracker.java index 09c11dfff..a8370432b 100644 --- a/Plugins/Mineplex.Bungee.Mineplexer/src/mineplex/bungee/playerTracker/PlayerTracker.java +++ b/Plugins/Mineplex.Bungee.Mineplexer/src/mineplex/bungee/playerTracker/PlayerTracker.java @@ -4,6 +4,7 @@ import java.util.List; import java.util.UUID; import com.google.common.collect.Lists; +import com.google.gson.Gson; import mineplex.serverdata.Region; import mineplex.serverdata.commands.PlayerJoinCommand; @@ -42,7 +43,7 @@ public class PlayerTracker implements Listener _repository = new RedisDataRepository(ServerManager.getMasterConnection(), ServerManager.getSlaveConnection(), Region.currentRegion(), PlayerStatus.class, "playerStatus"); - ServerCommandManager.getInstance().initializeServer("BUNGEE ENABLE - " + System.currentTimeMillis()); + ServerCommandManager.getInstance().initializeServer("BUNGEE ENABLE - " + System.currentTimeMillis(), new Gson()); ServerCommandManager.getInstance().registerCommandType(mineplex.serverdata.commands.PlayerJoinCommand.class, new PlayerJoinHandler(this)); System.out.println("Initialized PlayerTracker."); @@ -60,7 +61,7 @@ public class PlayerTracker implements Listener { public void run() { - PlayerStatus snapshot = new PlayerStatus(event.getPlayer().getName(), event.getServer().getInfo().getName()); + PlayerStatus snapshot = new PlayerStatus(event.getPlayer().getUniqueId(), event.getPlayer().getName(), event.getServer().getInfo().getName()); _repository.addElement(snapshot, DEFAULT_STATUS_TIMEOUT); } }); @@ -73,7 +74,7 @@ public class PlayerTracker implements Listener { public void run() { - _repository.removeElement(event.getPlayer().getName().toLowerCase()); + _repository.removeElement(event.getPlayer().getUniqueId().toString()); } }); } @@ -82,7 +83,7 @@ public class PlayerTracker implements Listener public void playerConnect(final PostLoginEvent event) { _ignoreKick.add(event.getPlayer().getUniqueId()); - PlayerJoinCommand command = new PlayerJoinCommand(event.getPlayer().getUniqueId()); + PlayerJoinCommand command = new PlayerJoinCommand(event.getPlayer().getUniqueId(), event.getPlayer().getName()); command.publish(); } diff --git a/Plugins/Mineplex.BungeeRotator/pom.xml b/Plugins/Mineplex.BungeeRotator/pom.xml index 7fff9dd5a..3118cb502 100644 --- a/Plugins/Mineplex.BungeeRotator/pom.xml +++ b/Plugins/Mineplex.BungeeRotator/pom.xml @@ -20,12 +20,9 @@ ${project.version} - org.apache.cxf - cxf-bundle - - - org.apache.ws.security - wss4j + org.apache.httpcomponents + httpclient + 4.5.2 @@ -42,6 +39,36 @@ + + org.apache.maven.plugins + maven-shade-plugin + 2.4 + + + package + + shade + + + true + + + org.apache.commons:commons-pool2 + + ** + + + + commons-logging:commons-logging + + ** + + + + + + + diff --git a/Plugins/Mineplex.BungeeRotator/src/biz/neustar/ultra/client/ClientPasswordCallback.java b/Plugins/Mineplex.BungeeRotator/src/biz/neustar/ultra/client/ClientPasswordCallback.java deleted file mode 100644 index 05e2e4566..000000000 --- a/Plugins/Mineplex.BungeeRotator/src/biz/neustar/ultra/client/ClientPasswordCallback.java +++ /dev/null @@ -1,48 +0,0 @@ -package biz.neustar.ultra.client; - -import org.apache.ws.security.WSPasswordCallback; - -import javax.security.auth.callback.Callback; -import javax.security.auth.callback.CallbackHandler; -import javax.security.auth.callback.UnsupportedCallbackException; -import java.io.IOException; - -/* - * User: jbodner - * Date: 1/28/13 - * Time: 12:32 PM - * - * Copyright 2000-2013 NeuStar, Inc. All rights reserved. - * NeuStar, the Neustar logo and related names and logos are registered - * trademarks, service marks or tradenames of NeuStar, Inc. All other - * product names, company names, marks, logos and symbols may be trademarks - * of their respective owners. - */ -public class ClientPasswordCallback implements CallbackHandler { - private final String _username; - private final String _password; - - public ClientPasswordCallback(String username, String password) { - _username = username; - _password = password; - } - - public void handle(Callback[] callbacks) throws IOException, - UnsupportedCallbackException { - - for (Callback callback : callbacks) { - - WSPasswordCallback pc = (WSPasswordCallback) callback; - - if (pc.getUsage() == WSPasswordCallback.USERNAME_TOKEN) { - - //you can source the username and password from - //other sources like login context, LDAP, DB etc - - pc.setIdentifier(_username); - pc.setPassword(_password); - } - } - - } -} diff --git a/Plugins/Mineplex.BungeeRotator/src/biz/neustar/ultra/client/ResourceRecordTypes.java b/Plugins/Mineplex.BungeeRotator/src/biz/neustar/ultra/client/ResourceRecordTypes.java deleted file mode 100644 index 0213f2f9f..000000000 --- a/Plugins/Mineplex.BungeeRotator/src/biz/neustar/ultra/client/ResourceRecordTypes.java +++ /dev/null @@ -1,114 +0,0 @@ -package biz.neustar.ultra.client; - -import java.util.EnumSet; -import java.util.HashMap; -import java.util.Map; - - -/* - * User: jbodner - * Date: 1/28/13 - * Time: 12:32 PM - * - * Copyright 2000-2013 NeuStar, Inc. All rights reserved. - * NeuStar, the Neustar logo and related names and logos are registered - * trademarks, service marks or tradenames of NeuStar, Inc. All other - * product names, company names, marks, logos and symbols may be trademarks - * of their respective owners. - */ -public enum ResourceRecordTypes { - - ALL_TYPES(0), - A(1), - NS(2), - MD(3), - MF(4), - CNAME(5), - SOA(6), - MB(7), - MG(8), - MR(9), - NULL(10), - WKS(11), - PTR(12), - HINFO(13), - MINFO(14), - MX(15), - TXT(16), - RP(17), - AFSDB(18), - X25(19), - ISDN(20), - RT(21), - NSAP(22), - NSAP_PTR(23), - SIG (24), - KEY (25), - PX (26), - CPOS( 27), - AAAA ( 28), - LOC(29), - NXT(30), - EID( 31), - NIMLOC( 32), - SRV (33), - NAPTR(35), - DS (43), - SSHFP (44), - RRSIG (46), - NSEC (47), - DNSKEY (48), - NSEC3 (50), - NSEC3PARAM (51), - SPF(99), - UINFO(100), - UID (101), - GID (102), - AXFR ( 252), - MAILA (253), - MAILB (254), - ANY (255), - NORESPONSE (902), - DLV (32769), - SB (65280); - - private static final Map lookup = new HashMap(); - private static final Map reverseLookup = new HashMap(); - - static { - for(ResourceRecordTypes r : EnumSet.allOf(ResourceRecordTypes.class)){ - lookup.put(r.recType(), r); - reverseLookup.put(r, r.recType()); - } - } - - private int recType; - - /** - * @param code - * @param message - */ - ResourceRecordTypes(int code) { - this.recType = code; - } - - /** - * - * @return code - */ - public int recType() { - return recType; - } - - public static ResourceRecordTypes get(int code) { - return lookup.get(code); - } - - public static Integer get(ResourceRecordTypes rec){ - return reverseLookup.get(rec); - } - - public boolean equals(int code){ - return this.equals(lookup.get(code)); - } -} diff --git a/Plugins/Mineplex.BungeeRotator/src/biz/neustar/ultra/client/SampleMain.java b/Plugins/Mineplex.BungeeRotator/src/biz/neustar/ultra/client/SampleMain.java deleted file mode 100644 index 57d71da27..000000000 --- a/Plugins/Mineplex.BungeeRotator/src/biz/neustar/ultra/client/SampleMain.java +++ /dev/null @@ -1,65 +0,0 @@ -package biz.neustar.ultra.client; - -import com.neustar.ultraservice.schema.v01.AccountDetailsList; -import org.apache.commons.lang.RandomStringUtils; - -/* - * User: jbodner - * Date: 1/30/13 - * Time: 2:39 PM - * - * Copyright 2000-2013 NeuStar, Inc. All rights reserved. - * NeuStar, the Neustar logo and related names and logos are registered - * trademarks, service marks or tradenames of NeuStar, Inc. All other - * product names, company names, marks, logos and symbols may be trademarks - * of their respective owners. - */ -public class SampleMain { - /* - arg pos value - 0 wsdl url - 1 username - 2 password - 3 account id - */ - public static void main(String[] args) { - - if (args.length < 3 || args.length > 4) { - System.err.println("Required params: wsdlUrl userName password {accountId}"); - System.exit(1); - } - String wsdlUrl = args[0]; - String username = args[1]; - String password = args[2]; - String accountId = null; - if(args.length == 4) { - accountId = args[3]; - } - - System.out.println("url = " + wsdlUrl); - try { - UltraAPIClient ultraAPIClient = new UltraAPIClientImpl(username, password, wsdlUrl); - System.out.println(ultraAPIClient.getNeustarNetworkStatus()); - AccountDetailsList accountDetailsForUser = ultraAPIClient.getAccountDetailsForUser(); - System.out.println(accountDetailsForUser.getAccountDetailsData().get(0).getAccountID()); - if (accountId == null) { - accountId = accountDetailsForUser.getAccountDetailsData().get(0).getAccountID(); - } - String zoneName = RandomStringUtils.randomAlphanumeric(16).toLowerCase()+".com."; - try { - System.out.println(ultraAPIClient.deleteZone(zoneName)); - } catch (UltraAPIException e) { - e.printStackTrace(); - if (e.getCode() != 1801) { - System.exit(1); - } - } - System.out.println(ultraAPIClient.createPrimaryZone(accountId, zoneName)); - System.out.println(ultraAPIClient.getSecondaryZonesOfAccount(accountId)); - System.out.println(ultraAPIClient.createARecord(zoneName, "foo."+zoneName, "1.2.3.4", 86400)); - System.out.println(ultraAPIClient.deleteZone(zoneName)); - } catch (UltraAPIException e) { - e.printStackTrace(); - } - } -} diff --git a/Plugins/Mineplex.BungeeRotator/src/biz/neustar/ultra/client/UltraAPIClient.java b/Plugins/Mineplex.BungeeRotator/src/biz/neustar/ultra/client/UltraAPIClient.java deleted file mode 100644 index 4544e4045..000000000 --- a/Plugins/Mineplex.BungeeRotator/src/biz/neustar/ultra/client/UltraAPIClient.java +++ /dev/null @@ -1,42 +0,0 @@ -package biz.neustar.ultra.client; - -/* - * User: jbodner - * Date: 1/28/13 - * Time: 4:07 PM - * - * Copyright 2000-2013 NeuStar, Inc. All rights reserved. - * NeuStar, the Neustar logo and related names and logos are registered - * trademarks, service marks or tradenames of NeuStar, Inc. All other - * product names, company names, marks, logos and symbols may be trademarks - * of their respective owners. - */ - -import com.neustar.ultraservice.schema.v01.AccountDetailsList; -import com.neustar.ultraservice.schema.v01.ZoneList; - -public interface UltraAPIClient { - String createARecord(String zoneName, String domainName, String ipAddress, int ttl); - - String createTXTRecord(String zoneName, String domainName, String value, int ttl); - - String createCNAMERecord(String zoneName, String domainName, String name, int ttl); - - String createRecord(String zoneName, String domainName, ResourceRecordTypes recordType, int ttl, String... infoValues); - - String createPrimaryZone(String accountId, String zoneName); - - String deleteZone(String zoneName); - - AccountDetailsList getAccountDetailsForUser(); - - String getNeustarNetworkStatus(); - - ZoneList getSecondaryZonesOfAccount(String accountId); - - ZoneList getPrimaryZonesOfAccount(String accountId); - - ZoneList getAliasZonesOfAccount(String accountId); - - ZoneList getZonesOfAccount(String accountId); -} diff --git a/Plugins/Mineplex.BungeeRotator/src/biz/neustar/ultra/client/UltraAPIClientImpl.java b/Plugins/Mineplex.BungeeRotator/src/biz/neustar/ultra/client/UltraAPIClientImpl.java deleted file mode 100644 index 3f989184e..000000000 --- a/Plugins/Mineplex.BungeeRotator/src/biz/neustar/ultra/client/UltraAPIClientImpl.java +++ /dev/null @@ -1,164 +0,0 @@ -package biz.neustar.ultra.client; - -import com.neustar.ultra.api.webservice.v01.UltraDNS1; -import com.neustar.ultra.api.webservice.v01.UltraWSException_Exception; -import com.neustar.ultra.api.webservice.v01.UltraWebServiceV01Service; -import com.neustar.ultraservice.schema.v01.*; -import org.apache.cxf.endpoint.Client; -import org.apache.cxf.frontend.ClientProxy; -import org.apache.cxf.ws.security.wss4j.WSS4JOutInterceptor; -import org.apache.ws.security.handler.WSHandlerConstants; - -import javax.xml.ws.Service; -import java.lang.reflect.Method; -import java.net.MalformedURLException; -import java.net.URL; -import java.util.HashMap; -import java.util.Map; - -/* - * User: jbodner - * Date: 1/28/13 - * Time: 12:32 PM - * - * Copyright 2000-2013 NeuStar, Inc. All rights reserved. - * NeuStar, the Neustar logo and related names and logos are registered - * trademarks, service marks or tradenames of NeuStar, Inc. All other - * product names, company names, marks, logos and symbols may be trademarks - * of their respective owners. - */ -public class UltraAPIClientImpl implements UltraAPIClient { - private final UltraDNS1 _ultraDNS1; - - public UltraAPIClientImpl(String username, String password) { - this(username, password, UltraWebServiceV01Service.WSDL_LOCATION.toString()); - } - - public UltraAPIClientImpl(String username, String password, String url) { - try { - Service service = UltraWebServiceV01Service.create(new URL(url), UltraWebServiceV01Service.SERVICE); - _ultraDNS1 = service.getPort(UltraDNS1.class); - Client cxfClient = ClientProxy.getClient(_ultraDNS1); - WSS4JOutInterceptor wss4JOutInterceptor = new WSS4JOutInterceptor(); - Map properties = new HashMap(); - properties.put(WSHandlerConstants.ACTION, "UsernameToken"); - properties.put(WSHandlerConstants.USER, "dummy"); - properties.put(WSHandlerConstants.PASSWORD_TYPE, "PasswordText"); - properties.put(WSHandlerConstants.PW_CALLBACK_REF, new ClientPasswordCallback(username, password)); - wss4JOutInterceptor.setProperties(properties); - - cxfClient.getOutInterceptors().add(new org.apache.cxf.interceptor.LoggingOutInterceptor()); - cxfClient.getOutInterceptors().add(wss4JOutInterceptor); - } catch (MalformedURLException e) { - e.printStackTrace(); - throw new UltraAPIException(9999, e.getMessage()); - } - } - - @Override - public String createARecord(String zoneName, String domainName, String ipAddress, int ttl) { - return createRecord(zoneName, domainName, ResourceRecordTypes.A, ttl, ipAddress); - } - - @Override - public String createTXTRecord(String zoneName, String domainName, String value, int ttl) { - return createRecord(zoneName, domainName, ResourceRecordTypes.TXT, ttl, value); - } - - @Override - public String createCNAMERecord(String zoneName, String domainName, String name, int ttl) { - return createRecord(zoneName, domainName, ResourceRecordTypes.CNAME, ttl, name); - } - - @Override - public String createRecord(String zoneName, String domainName, ResourceRecordTypes recordType, int ttl, String... infoValues) { - try { - ResourceRecordToCreate resourceRecord = new ResourceRecordToCreate(); - resourceRecord.setDName(domainName); - resourceRecord.setType(recordType.recType()); - resourceRecord.setZoneName(zoneName); - resourceRecord.setTTL(Integer.toString(ttl)); - InfoValues infoValuesWrapper = new InfoValues(); - for (int i = 0; i < infoValues.length; i++) { - setInfoValue(i, infoValues[i], infoValuesWrapper); - } - resourceRecord.setInfoValues(infoValuesWrapper); - return _ultraDNS1.createResourceRecord("", resourceRecord); - } catch (UltraWSException_Exception e) { - throw new UltraAPIException(e.getFaultInfo()); - } - } - - private void setInfoValue(int i, String value, InfoValues infoValuesWrapper) { - try { - Method m = infoValuesWrapper.getClass().getMethod("setInfo"+(i+1)+"Value", String.class); - m.invoke(infoValuesWrapper,value); - } catch (Exception e) { - throw new UltraAPIException(9999, e.getMessage()); - } - } - - @Override - public String createPrimaryZone(String accountId, String zoneName) { - try { - return _ultraDNS1.createPrimaryZone("", accountId, zoneName, true); - } catch (UltraWSException_Exception e) { - throw new UltraAPIException(e.getFaultInfo()); - } - } - - @Override - public String deleteZone(String zoneName) { - try { - return _ultraDNS1.deleteZone("", zoneName); - } catch (UltraWSException_Exception e) { - throw new UltraAPIException(e.getFaultInfo()); - } - } - - @Override - public AccountDetailsList getAccountDetailsForUser() { - try { - return _ultraDNS1.getAccountDetailsOfUser("", ""); - } catch (UltraWSException_Exception e) { - throw new UltraAPIException(e.getFaultInfo()); - } - } - - @Override - public String getNeustarNetworkStatus() { - try { - return _ultraDNS1.getNeustarNetworkStatus(); - } catch (UltraWSException_Exception e) { - throw new UltraAPIException(e.getFaultInfo()); - } - } - - @Override - public ZoneList getSecondaryZonesOfAccount(String accountId) { - return getZonesOfAccount(accountId, ZoneType.SECONDARY); - } - - @Override - public ZoneList getPrimaryZonesOfAccount(String accountId) { - return getZonesOfAccount(accountId, ZoneType.PRIMARY); - } - - @Override - public ZoneList getAliasZonesOfAccount(String accountId) { - return getZonesOfAccount(accountId, ZoneType.ALIAS); - } - - @Override - public ZoneList getZonesOfAccount(String accountId) { - return getZonesOfAccount(accountId, ZoneType.ALL); - } - - private ZoneList getZonesOfAccount(String accountId, ZoneType zoneType) { - try { - return _ultraDNS1.getZonesOfAccount(accountId, zoneType); - } catch (UltraWSException_Exception e) { - throw new UltraAPIException(e.getFaultInfo()); - } - } -} diff --git a/Plugins/Mineplex.BungeeRotator/src/biz/neustar/ultra/client/UltraAPIException.java b/Plugins/Mineplex.BungeeRotator/src/biz/neustar/ultra/client/UltraAPIException.java deleted file mode 100644 index 09c8f92b6..000000000 --- a/Plugins/Mineplex.BungeeRotator/src/biz/neustar/ultra/client/UltraAPIException.java +++ /dev/null @@ -1,37 +0,0 @@ -package biz.neustar.ultra.client; - -import com.neustar.ultra.api.webservice.v01.UltraWSException; - -/* - * User: jbodner - * Date: 1/28/13 - * Time: 1:11 PM - * - * Copyright 2000-2013 NeuStar, Inc. All rights reserved. - * NeuStar, the Neustar logo and related names and logos are registered - * trademarks, service marks or tradenames of NeuStar, Inc. All other - * product names, company names, marks, logos and symbols may be trademarks - * of their respective owners. - */ -public class UltraAPIException extends RuntimeException { - private final int _code; - - public UltraAPIException(int code, String message) { - super(message); - _code = code; - } - - public UltraAPIException(UltraWSException e) { - super(e.getErrorDescription()); - _code = e.getErrorCode(); - } - - public int getCode() { - return _code; - } - - @Override - public String toString() { - return String.format("%d - %s", _code, getMessage()); - } -} diff --git a/Plugins/Mineplex.BungeeRotator/src/com/neustar/ultra/api/webservice/v01/Action.java b/Plugins/Mineplex.BungeeRotator/src/com/neustar/ultra/api/webservice/v01/Action.java deleted file mode 100644 index 998bc37e9..000000000 --- a/Plugins/Mineplex.BungeeRotator/src/com/neustar/ultra/api/webservice/v01/Action.java +++ /dev/null @@ -1,58 +0,0 @@ - -package com.neustar.ultra.api.webservice.v01; - -import javax.xml.bind.annotation.XmlEnum; -import javax.xml.bind.annotation.XmlType; - - -/** - *

Java class for action. - * - *

The following schema fragment specifies the expected content contained within this class. - *

- *

- * <simpleType name="action">
- *   <restriction base="{http://www.w3.org/2001/XMLSchema}string">
- *     <enumeration value="ADD"/>
- *     <enumeration value="MODIFY"/>
- *     <enumeration value="DELETE"/>
- *     <enumeration value="BULK_ADD"/>
- *     <enumeration value="BULK_MODIFY"/>
- *     <enumeration value="BULK_DELETE"/>
- *     <enumeration value="LOGIN"/>
- *     <enumeration value="SIGN"/>
- *     <enumeration value="UNSIGN"/>
- *     <enumeration value="FAILOVER"/>
- *     <enumeration value="FAILBACK"/>
- *     <enumeration value="MIGRATE_SBTC_TO_AR"/>
- *   </restriction>
- * </simpleType>
- * 
- * - */ -@XmlType(name = "action") -@XmlEnum -public enum Action { - - ADD, - MODIFY, - DELETE, - BULK_ADD, - BULK_MODIFY, - BULK_DELETE, - LOGIN, - SIGN, - UNSIGN, - FAILOVER, - FAILBACK, - MIGRATE_SBTC_TO_AR; - - public String value() { - return name(); - } - - public static Action fromValue(String v) { - return valueOf(v); - } - -} diff --git a/Plugins/Mineplex.BungeeRotator/src/com/neustar/ultra/api/webservice/v01/AliasZoneInfo.java b/Plugins/Mineplex.BungeeRotator/src/com/neustar/ultra/api/webservice/v01/AliasZoneInfo.java deleted file mode 100644 index 82bc847be..000000000 --- a/Plugins/Mineplex.BungeeRotator/src/com/neustar/ultra/api/webservice/v01/AliasZoneInfo.java +++ /dev/null @@ -1,60 +0,0 @@ - -package com.neustar.ultra.api.webservice.v01; - -import javax.xml.bind.annotation.XmlAccessType; -import javax.xml.bind.annotation.XmlAccessorType; -import javax.xml.bind.annotation.XmlType; - - -/** - *

Java class for aliasZoneInfo complex type. - * - *

The following schema fragment specifies the expected content contained within this class. - * - *

- * <complexType name="aliasZoneInfo">
- *   <complexContent>
- *     <restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
- *       <sequence>
- *         <element name="originalZoneName" type="{http://www.w3.org/2001/XMLSchema}string" minOccurs="0"/>
- *       </sequence>
- *     </restriction>
- *   </complexContent>
- * </complexType>
- * 
- * - * - */ -@XmlAccessorType(XmlAccessType.FIELD) -@XmlType(name = "aliasZoneInfo", propOrder = { - "originalZoneName" -}) -public class AliasZoneInfo { - - protected String originalZoneName; - - /** - * Gets the value of the originalZoneName property. - * - * @return - * possible object is - * {@link String } - * - */ - public String getOriginalZoneName() { - return originalZoneName; - } - - /** - * Sets the value of the originalZoneName property. - * - * @param value - * allowed object is - * {@link String } - * - */ - public void setOriginalZoneName(String value) { - this.originalZoneName = value; - } - -} diff --git a/Plugins/Mineplex.BungeeRotator/src/com/neustar/ultra/api/webservice/v01/ApplicationID.java b/Plugins/Mineplex.BungeeRotator/src/com/neustar/ultra/api/webservice/v01/ApplicationID.java deleted file mode 100644 index fdb2d793e..000000000 --- a/Plugins/Mineplex.BungeeRotator/src/com/neustar/ultra/api/webservice/v01/ApplicationID.java +++ /dev/null @@ -1,50 +0,0 @@ - -package com.neustar.ultra.api.webservice.v01; - -import javax.xml.bind.annotation.XmlEnum; -import javax.xml.bind.annotation.XmlType; - - -/** - *

Java class for applicationID. - * - *

The following schema fragment specifies the expected content contained within this class. - *

- *

- * <simpleType name="applicationID">
- *   <restriction base="{http://www.w3.org/2001/XMLSchema}string">
- *     <enumeration value="JAVA_UI"/>
- *     <enumeration value="SOAP_API"/>
- *     <enumeration value="MASQ_UI"/>
- *     <enumeration value="UA"/>
- *     <enumeration value="PHP_UI"/>
- *     <enumeration value="XML_API"/>
- *     <enumeration value="RPS_TIMER"/>
- *     <enumeration value="SMADS"/>
- *   </restriction>
- * </simpleType>
- * 
- * - */ -@XmlType(name = "applicationID") -@XmlEnum -public enum ApplicationID { - - JAVA_UI, - SOAP_API, - MASQ_UI, - UA, - PHP_UI, - XML_API, - RPS_TIMER, - SMADS; - - public String value() { - return name(); - } - - public static ApplicationID fromValue(String v) { - return valueOf(v); - } - -} diff --git a/Plugins/Mineplex.BungeeRotator/src/com/neustar/ultra/api/webservice/v01/AssetType.java b/Plugins/Mineplex.BungeeRotator/src/com/neustar/ultra/api/webservice/v01/AssetType.java deleted file mode 100644 index 47d21ca91..000000000 --- a/Plugins/Mineplex.BungeeRotator/src/com/neustar/ultra/api/webservice/v01/AssetType.java +++ /dev/null @@ -1,140 +0,0 @@ - -package com.neustar.ultra.api.webservice.v01; - -import javax.xml.bind.annotation.XmlEnum; -import javax.xml.bind.annotation.XmlType; - - -/** - *

Java class for assetType. - * - *

The following schema fragment specifies the expected content contained within this class. - *

- *

- * <simpleType name="assetType">
- *   <restriction base="{http://www.w3.org/2001/XMLSchema}string">
- *     <enumeration value="ACCOUNT"/>
- *     <enumeration value="EXTERNAL_SERVICES"/>
- *     <enumeration value="RECURSIVE"/>
- *     <enumeration value="ZONE"/>
- *     <enumeration value="RESOURCE_RECORD"/>
- *     <enumeration value="USER"/>
- *     <enumeration value="APPLIANCE"/>
- *     <enumeration value="DHCP"/>
- *     <enumeration value="REPORT"/>
- *     <enumeration value="SERVICE_PACKAGE"/>
- *     <enumeration value="DIRECTIONALDNS"/>
- *     <enumeration value="DIRECTIONALDNS_RECORD"/>
- *     <enumeration value="WEB_FORWARD"/>
- *     <enumeration value="MAIL_FORWARD"/>
- *     <enumeration value="TRAFFICCONTROLLER_POOL"/>
- *     <enumeration value="TC_POOL_RECORD"/>
- *     <enumeration value="ROUNDROBIN_POOL"/>
- *     <enumeration value="RD_POOL_RECORD"/>
- *     <enumeration value="PROPERTIES"/>
- *     <enumeration value="MAIL_MXBACKER"/>
- *     <enumeration value="ACCOUNT_PERMISSIONS"/>
- *     <enumeration value="ACCOUNT_PREFERENCES"/>
- *     <enumeration value="BILLING"/>
- *     <enumeration value="GROUPS_AND_USERS"/>
- *     <enumeration value="A"/>
- *     <enumeration value="AAAA"/>
- *     <enumeration value="CNAME"/>
- *     <enumeration value="TXT"/>
- *     <enumeration value="SRV"/>
- *     <enumeration value="NS"/>
- *     <enumeration value="PTR"/>
- *     <enumeration value="RP"/>
- *     <enumeration value="HINFO"/>
- *     <enumeration value="NAPTR"/>
- *     <enumeration value="MX"/>
- *     <enumeration value="OTHER_RR"/>
- *     <enumeration value="SITEBACKER_POOL"/>
- *     <enumeration value="SCHEDULER_TASK"/>
- *     <enumeration value="SITEBACKER_DISTRIBUTOR"/>
- *     <enumeration value="SITEBACKER_AGENT"/>
- *     <enumeration value="SITEBACKER_POOL_RECORD"/>
- *     <enumeration value="SITEBACKER_POOL_PROBE"/>
- *     <enumeration value="SOA"/>
- *     <enumeration value="ACCOUNT_LEVEL_DIRECTIONAL_GROUP"/>
- *     <enumeration value="RESOURCE_DISTRIBUTION_POOL"/>
- *     <enumeration value="ADAPTIVERESPONSE_POOL"/>
- *     <enumeration value="ADAPTIVERESPONSE_POOL_CONFIGURATION"/>
- *     <enumeration value="ADAPTIVERESPONSE_POOL_RECORD"/>
- *     <enumeration value="ADAPTIVERESPONSE_POOL_PROBE"/>
- *     <enumeration value="ADAPTIVERESPONSE_RECORD_PROBE"/>
- *     <enumeration value="ADAPTIVERESPONSE_PROBE_DEFINITION"/>
- *     <enumeration value="SIMPLEFAILOVER_POOL"/>
- *     <enumeration value="MONITORED_RD_POOL"/>
- *   </restriction>
- * </simpleType>
- * 
- * - */ -@XmlType(name = "assetType") -@XmlEnum -public enum AssetType { - - ACCOUNT, - EXTERNAL_SERVICES, - RECURSIVE, - ZONE, - RESOURCE_RECORD, - USER, - APPLIANCE, - DHCP, - REPORT, - SERVICE_PACKAGE, - DIRECTIONALDNS, - DIRECTIONALDNS_RECORD, - WEB_FORWARD, - MAIL_FORWARD, - TRAFFICCONTROLLER_POOL, - TC_POOL_RECORD, - ROUNDROBIN_POOL, - RD_POOL_RECORD, - PROPERTIES, - MAIL_MXBACKER, - ACCOUNT_PERMISSIONS, - ACCOUNT_PREFERENCES, - BILLING, - GROUPS_AND_USERS, - A, - AAAA, - CNAME, - TXT, - SRV, - NS, - PTR, - RP, - HINFO, - NAPTR, - MX, - OTHER_RR, - SITEBACKER_POOL, - SCHEDULER_TASK, - SITEBACKER_DISTRIBUTOR, - SITEBACKER_AGENT, - SITEBACKER_POOL_RECORD, - SITEBACKER_POOL_PROBE, - SOA, - ACCOUNT_LEVEL_DIRECTIONAL_GROUP, - RESOURCE_DISTRIBUTION_POOL, - ADAPTIVERESPONSE_POOL, - ADAPTIVERESPONSE_POOL_CONFIGURATION, - ADAPTIVERESPONSE_POOL_RECORD, - ADAPTIVERESPONSE_POOL_PROBE, - ADAPTIVERESPONSE_RECORD_PROBE, - ADAPTIVERESPONSE_PROBE_DEFINITION, - SIMPLEFAILOVER_POOL, - MONITORED_RD_POOL; - - public String value() { - return name(); - } - - public static AssetType fromValue(String v) { - return valueOf(v); - } - -} diff --git a/Plugins/Mineplex.BungeeRotator/src/com/neustar/ultra/api/webservice/v01/AuditSummary.java b/Plugins/Mineplex.BungeeRotator/src/com/neustar/ultra/api/webservice/v01/AuditSummary.java deleted file mode 100644 index aa8ddf38f..000000000 --- a/Plugins/Mineplex.BungeeRotator/src/com/neustar/ultra/api/webservice/v01/AuditSummary.java +++ /dev/null @@ -1,276 +0,0 @@ - -package com.neustar.ultra.api.webservice.v01; - -import javax.xml.bind.annotation.XmlAccessType; -import javax.xml.bind.annotation.XmlAccessorType; -import javax.xml.bind.annotation.XmlType; - - -/** - *

Java class for auditSummary complex type. - * - *

The following schema fragment specifies the expected content contained within this class. - * - *

- * <complexType name="auditSummary">
- *   <complexContent>
- *     <restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
- *       <sequence>
- *         <element name="accountID" type="{http://www.w3.org/2001/XMLSchema}string" minOccurs="0"/>
- *         <element name="action" type="{http://webservice.api.ultra.neustar.com/v01/}action" minOccurs="0"/>
- *         <element name="applicationID" type="{http://webservice.api.ultra.neustar.com/v01/}applicationID" minOccurs="0"/>
- *         <element name="assetType" type="{http://webservice.api.ultra.neustar.com/v01/}assetType" minOccurs="0"/>
- *         <element name="ipAddress" type="{http://www.w3.org/2001/XMLSchema}string" minOccurs="0"/>
- *         <element name="logDate" type="{http://www.w3.org/2001/XMLSchema}long" minOccurs="0"/>
- *         <element name="objectID" type="{http://www.w3.org/2001/XMLSchema}string" minOccurs="0"/>
- *         <element name="objectName" type="{http://www.w3.org/2001/XMLSchema}string" minOccurs="0"/>
- *         <element name="userID" type="{http://www.w3.org/2001/XMLSchema}string" minOccurs="0"/>
- *       </sequence>
- *     </restriction>
- *   </complexContent>
- * </complexType>
- * 
- * - * - */ -@XmlAccessorType(XmlAccessType.FIELD) -@XmlType(name = "auditSummary", propOrder = { - "accountID", - "action", - "applicationID", - "assetType", - "ipAddress", - "logDate", - "objectID", - "objectName", - "userID" -}) -public class AuditSummary { - - protected String accountID; - protected Action action; - protected ApplicationID applicationID; - protected AssetType assetType; - protected String ipAddress; - protected Long logDate; - protected String objectID; - protected String objectName; - protected String userID; - - /** - * Gets the value of the accountID property. - * - * @return - * possible object is - * {@link String } - * - */ - public String getAccountID() { - return accountID; - } - - /** - * Sets the value of the accountID property. - * - * @param value - * allowed object is - * {@link String } - * - */ - public void setAccountID(String value) { - this.accountID = value; - } - - /** - * Gets the value of the action property. - * - * @return - * possible object is - * {@link Action } - * - */ - public Action getAction() { - return action; - } - - /** - * Sets the value of the action property. - * - * @param value - * allowed object is - * {@link Action } - * - */ - public void setAction(Action value) { - this.action = value; - } - - /** - * Gets the value of the applicationID property. - * - * @return - * possible object is - * {@link ApplicationID } - * - */ - public ApplicationID getApplicationID() { - return applicationID; - } - - /** - * Sets the value of the applicationID property. - * - * @param value - * allowed object is - * {@link ApplicationID } - * - */ - public void setApplicationID(ApplicationID value) { - this.applicationID = value; - } - - /** - * Gets the value of the assetType property. - * - * @return - * possible object is - * {@link AssetType } - * - */ - public AssetType getAssetType() { - return assetType; - } - - /** - * Sets the value of the assetType property. - * - * @param value - * allowed object is - * {@link AssetType } - * - */ - public void setAssetType(AssetType value) { - this.assetType = value; - } - - /** - * Gets the value of the ipAddress property. - * - * @return - * possible object is - * {@link String } - * - */ - public String getIpAddress() { - return ipAddress; - } - - /** - * Sets the value of the ipAddress property. - * - * @param value - * allowed object is - * {@link String } - * - */ - public void setIpAddress(String value) { - this.ipAddress = value; - } - - /** - * Gets the value of the logDate property. - * - * @return - * possible object is - * {@link Long } - * - */ - public Long getLogDate() { - return logDate; - } - - /** - * Sets the value of the logDate property. - * - * @param value - * allowed object is - * {@link Long } - * - */ - public void setLogDate(Long value) { - this.logDate = value; - } - - /** - * Gets the value of the objectID property. - * - * @return - * possible object is - * {@link String } - * - */ - public String getObjectID() { - return objectID; - } - - /** - * Sets the value of the objectID property. - * - * @param value - * allowed object is - * {@link String } - * - */ - public void setObjectID(String value) { - this.objectID = value; - } - - /** - * Gets the value of the objectName property. - * - * @return - * possible object is - * {@link String } - * - */ - public String getObjectName() { - return objectName; - } - - /** - * Sets the value of the objectName property. - * - * @param value - * allowed object is - * {@link String } - * - */ - public void setObjectName(String value) { - this.objectName = value; - } - - /** - * Gets the value of the userID property. - * - * @return - * possible object is - * {@link String } - * - */ - public String getUserID() { - return userID; - } - - /** - * Sets the value of the userID property. - * - * @param value - * allowed object is - * {@link String } - * - */ - public void setUserID(String value) { - this.userID = value; - } - -} diff --git a/Plugins/Mineplex.BungeeRotator/src/com/neustar/ultra/api/webservice/v01/Code.java b/Plugins/Mineplex.BungeeRotator/src/com/neustar/ultra/api/webservice/v01/Code.java deleted file mode 100644 index 46e05c0ab..000000000 --- a/Plugins/Mineplex.BungeeRotator/src/com/neustar/ultra/api/webservice/v01/Code.java +++ /dev/null @@ -1,42 +0,0 @@ - -package com.neustar.ultra.api.webservice.v01; - -import javax.xml.bind.annotation.XmlEnum; -import javax.xml.bind.annotation.XmlType; - - -/** - *

Java class for code. - * - *

The following schema fragment specifies the expected content contained within this class. - *

- *

- * <simpleType name="code">
- *   <restriction base="{http://www.w3.org/2001/XMLSchema}string">
- *     <enumeration value="PENDING"/>
- *     <enumeration value="IN_PROCESS"/>
- *     <enumeration value="COMPLETE"/>
- *     <enumeration value="ERROR"/>
- *   </restriction>
- * </simpleType>
- * 
- * - */ -@XmlType(name = "code") -@XmlEnum -public enum Code { - - PENDING, - IN_PROCESS, - COMPLETE, - ERROR; - - public String value() { - return name(); - } - - public static Code fromValue(String v) { - return valueOf(v); - } - -} diff --git a/Plugins/Mineplex.BungeeRotator/src/com/neustar/ultra/api/webservice/v01/ConversionTypeEnum.java b/Plugins/Mineplex.BungeeRotator/src/com/neustar/ultra/api/webservice/v01/ConversionTypeEnum.java deleted file mode 100644 index ad48ade1f..000000000 --- a/Plugins/Mineplex.BungeeRotator/src/com/neustar/ultra/api/webservice/v01/ConversionTypeEnum.java +++ /dev/null @@ -1,42 +0,0 @@ - -package com.neustar.ultra.api.webservice.v01; - -import javax.xml.bind.annotation.XmlEnum; -import javax.xml.bind.annotation.XmlType; - - -/** - *

Java class for conversionTypeEnum. - * - *

The following schema fragment specifies the expected content contained within this class. - *

- *

- * <simpleType name="conversionTypeEnum">
- *   <restriction base="{http://www.w3.org/2001/XMLSchema}string">
- *     <enumeration value="A"/>
- *     <enumeration value="RD"/>
- *     <enumeration value="SIMPLE_FAILOVER"/>
- *     <enumeration value="ADAPTIVE_RESPONSE"/>
- *   </restriction>
- * </simpleType>
- * 
- * - */ -@XmlType(name = "conversionTypeEnum") -@XmlEnum -public enum ConversionTypeEnum { - - A, - RD, - SIMPLE_FAILOVER, - ADAPTIVE_RESPONSE; - - public String value() { - return name(); - } - - public static ConversionTypeEnum fromValue(String v) { - return valueOf(v); - } - -} diff --git a/Plugins/Mineplex.BungeeRotator/src/com/neustar/ultra/api/webservice/v01/ConvertTypeEnum.java b/Plugins/Mineplex.BungeeRotator/src/com/neustar/ultra/api/webservice/v01/ConvertTypeEnum.java deleted file mode 100644 index 027c1e025..000000000 --- a/Plugins/Mineplex.BungeeRotator/src/com/neustar/ultra/api/webservice/v01/ConvertTypeEnum.java +++ /dev/null @@ -1,40 +0,0 @@ - -package com.neustar.ultra.api.webservice.v01; - -import javax.xml.bind.annotation.XmlEnum; -import javax.xml.bind.annotation.XmlType; - - -/** - *

Java class for convertTypeEnum. - * - *

The following schema fragment specifies the expected content contained within this class. - *

- *

- * <simpleType name="convertTypeEnum">
- *   <restriction base="{http://www.w3.org/2001/XMLSchema}string">
- *     <enumeration value="A"/>
- *     <enumeration value="MRD"/>
- *     <enumeration value="ADAPTIVE_RESPONSE"/>
- *   </restriction>
- * </simpleType>
- * 
- * - */ -@XmlType(name = "convertTypeEnum") -@XmlEnum -public enum ConvertTypeEnum { - - A, - MRD, - ADAPTIVE_RESPONSE; - - public String value() { - return name(); - } - - public static ConvertTypeEnum fromValue(String v) { - return valueOf(v); - } - -} diff --git a/Plugins/Mineplex.BungeeRotator/src/com/neustar/ultra/api/webservice/v01/CreateType.java b/Plugins/Mineplex.BungeeRotator/src/com/neustar/ultra/api/webservice/v01/CreateType.java deleted file mode 100644 index cab7afd26..000000000 --- a/Plugins/Mineplex.BungeeRotator/src/com/neustar/ultra/api/webservice/v01/CreateType.java +++ /dev/null @@ -1,42 +0,0 @@ - -package com.neustar.ultra.api.webservice.v01; - -import javax.xml.bind.annotation.XmlEnum; -import javax.xml.bind.annotation.XmlType; - - -/** - *

Java class for createType. - * - *

The following schema fragment specifies the expected content contained within this class. - *

- *

- * <simpleType name="createType">
- *   <restriction base="{http://www.w3.org/2001/XMLSchema}string">
- *     <enumeration value="NEW"/>
- *     <enumeration value="COPY"/>
- *     <enumeration value="TRANSFER"/>
- *     <enumeration value="UPLOAD"/>
- *   </restriction>
- * </simpleType>
- * 
- * - */ -@XmlType(name = "createType") -@XmlEnum -public enum CreateType { - - NEW, - COPY, - TRANSFER, - UPLOAD; - - public String value() { - return name(); - } - - public static CreateType fromValue(String v) { - return valueOf(v); - } - -} diff --git a/Plugins/Mineplex.BungeeRotator/src/com/neustar/ultra/api/webservice/v01/DeleteZoneStatus.java b/Plugins/Mineplex.BungeeRotator/src/com/neustar/ultra/api/webservice/v01/DeleteZoneStatus.java deleted file mode 100644 index 4424494c1..000000000 --- a/Plugins/Mineplex.BungeeRotator/src/com/neustar/ultra/api/webservice/v01/DeleteZoneStatus.java +++ /dev/null @@ -1,87 +0,0 @@ - -package com.neustar.ultra.api.webservice.v01; - -import javax.xml.bind.annotation.XmlAccessType; -import javax.xml.bind.annotation.XmlAccessorType; -import javax.xml.bind.annotation.XmlAttribute; -import javax.xml.bind.annotation.XmlType; - - -/** - *

Java class for DeleteZoneStatus complex type. - * - *

The following schema fragment specifies the expected content contained within this class. - * - *

- * <complexType name="DeleteZoneStatus">
- *   <complexContent>
- *     <restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
- *       <sequence>
- *       </sequence>
- *       <attribute name="status" type="{http://www.w3.org/2001/XMLSchema}string" />
- *       <attribute name="taskId" type="{http://www.w3.org/2001/XMLSchema}string" />
- *     </restriction>
- *   </complexContent>
- * </complexType>
- * 
- * - * - */ -@XmlAccessorType(XmlAccessType.FIELD) -@XmlType(name = "DeleteZoneStatus") -public class DeleteZoneStatus { - - @XmlAttribute(name = "status") - protected String status; - @XmlAttribute(name = "taskId") - protected String taskId; - - /** - * Gets the value of the status property. - * - * @return - * possible object is - * {@link String } - * - */ - public String getStatus() { - return status; - } - - /** - * Sets the value of the status property. - * - * @param value - * allowed object is - * {@link String } - * - */ - public void setStatus(String value) { - this.status = value; - } - - /** - * Gets the value of the taskId property. - * - * @return - * possible object is - * {@link String } - * - */ - public String getTaskId() { - return taskId; - } - - /** - * Sets the value of the taskId property. - * - * @param value - * allowed object is - * {@link String } - * - */ - public void setTaskId(String value) { - this.taskId = value; - } - -} diff --git a/Plugins/Mineplex.BungeeRotator/src/com/neustar/ultra/api/webservice/v01/InternalZone.java b/Plugins/Mineplex.BungeeRotator/src/com/neustar/ultra/api/webservice/v01/InternalZone.java deleted file mode 100644 index d486787a8..000000000 --- a/Plugins/Mineplex.BungeeRotator/src/com/neustar/ultra/api/webservice/v01/InternalZone.java +++ /dev/null @@ -1,116 +0,0 @@ - -package com.neustar.ultra.api.webservice.v01; - -import javax.xml.bind.annotation.XmlAccessType; -import javax.xml.bind.annotation.XmlAccessorType; -import javax.xml.bind.annotation.XmlType; - - -/** - *

Java class for internalZone complex type. - * - *

The following schema fragment specifies the expected content contained within this class. - * - *

- * <complexType name="internalZone">
- *   <complexContent>
- *     <extension base="{http://webservice.api.ultra.neustar.com/v01/}zone">
- *       <sequence>
- *         <element name="auditSummary" type="{http://webservice.api.ultra.neustar.com/v01/}auditSummary" minOccurs="0"/>
- *         <element name="transferInfo" type="{http://webservice.api.ultra.neustar.com/v01/}transferInfo" minOccurs="0"/>
- *         <element name="transferStatus" type="{http://webservice.api.ultra.neustar.com/v01/}transferStatus" minOccurs="0"/>
- *       </sequence>
- *     </extension>
- *   </complexContent>
- * </complexType>
- * 
- * - * - */ -@XmlAccessorType(XmlAccessType.FIELD) -@XmlType(name = "internalZone", propOrder = { - "auditSummary", - "transferInfo", - "transferStatus" -}) -public class InternalZone - extends Zone -{ - - protected AuditSummary auditSummary; - protected TransferInfo transferInfo; - protected TransferStatus transferStatus; - - /** - * Gets the value of the auditSummary property. - * - * @return - * possible object is - * {@link AuditSummary } - * - */ - public AuditSummary getAuditSummary() { - return auditSummary; - } - - /** - * Sets the value of the auditSummary property. - * - * @param value - * allowed object is - * {@link AuditSummary } - * - */ - public void setAuditSummary(AuditSummary value) { - this.auditSummary = value; - } - - /** - * Gets the value of the transferInfo property. - * - * @return - * possible object is - * {@link TransferInfo } - * - */ - public TransferInfo getTransferInfo() { - return transferInfo; - } - - /** - * Sets the value of the transferInfo property. - * - * @param value - * allowed object is - * {@link TransferInfo } - * - */ - public void setTransferInfo(TransferInfo value) { - this.transferInfo = value; - } - - /** - * Gets the value of the transferStatus property. - * - * @return - * possible object is - * {@link TransferStatus } - * - */ - public TransferStatus getTransferStatus() { - return transferStatus; - } - - /** - * Sets the value of the transferStatus property. - * - * @param value - * allowed object is - * {@link TransferStatus } - * - */ - public void setTransferStatus(TransferStatus value) { - this.transferStatus = value; - } - -} diff --git a/Plugins/Mineplex.BungeeRotator/src/com/neustar/ultra/api/webservice/v01/NameServer.java b/Plugins/Mineplex.BungeeRotator/src/com/neustar/ultra/api/webservice/v01/NameServer.java deleted file mode 100644 index 8a0abcb66..000000000 --- a/Plugins/Mineplex.BungeeRotator/src/com/neustar/ultra/api/webservice/v01/NameServer.java +++ /dev/null @@ -1,114 +0,0 @@ - -package com.neustar.ultra.api.webservice.v01; - -import javax.xml.bind.annotation.XmlAccessType; -import javax.xml.bind.annotation.XmlAccessorType; -import javax.xml.bind.annotation.XmlType; - - -/** - *

Java class for nameServer complex type. - * - *

The following schema fragment specifies the expected content contained within this class. - * - *

- * <complexType name="nameServer">
- *   <complexContent>
- *     <restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
- *       <sequence>
- *         <element name="ip" type="{http://www.w3.org/2001/XMLSchema}string" minOccurs="0"/>
- *         <element name="tsigKey" type="{http://www.w3.org/2001/XMLSchema}string" minOccurs="0"/>
- *         <element name="tsigKeyValue" type="{http://www.w3.org/2001/XMLSchema}string" minOccurs="0"/>
- *       </sequence>
- *     </restriction>
- *   </complexContent>
- * </complexType>
- * 
- * - * - */ -@XmlAccessorType(XmlAccessType.FIELD) -@XmlType(name = "nameServer", propOrder = { - "ip", - "tsigKey", - "tsigKeyValue" -}) -public class NameServer { - - protected String ip; - protected String tsigKey; - protected String tsigKeyValue; - - /** - * Gets the value of the ip property. - * - * @return - * possible object is - * {@link String } - * - */ - public String getIp() { - return ip; - } - - /** - * Sets the value of the ip property. - * - * @param value - * allowed object is - * {@link String } - * - */ - public void setIp(String value) { - this.ip = value; - } - - /** - * Gets the value of the tsigKey property. - * - * @return - * possible object is - * {@link String } - * - */ - public String getTsigKey() { - return tsigKey; - } - - /** - * Sets the value of the tsigKey property. - * - * @param value - * allowed object is - * {@link String } - * - */ - public void setTsigKey(String value) { - this.tsigKey = value; - } - - /** - * Gets the value of the tsigKeyValue property. - * - * @return - * possible object is - * {@link String } - * - */ - public String getTsigKeyValue() { - return tsigKeyValue; - } - - /** - * Sets the value of the tsigKeyValue property. - * - * @param value - * allowed object is - * {@link String } - * - */ - public void setTsigKeyValue(String value) { - this.tsigKeyValue = value; - } - -} diff --git a/Plugins/Mineplex.BungeeRotator/src/com/neustar/ultra/api/webservice/v01/NameServerIpList.java b/Plugins/Mineplex.BungeeRotator/src/com/neustar/ultra/api/webservice/v01/NameServerIpList.java deleted file mode 100644 index a6ec153b7..000000000 --- a/Plugins/Mineplex.BungeeRotator/src/com/neustar/ultra/api/webservice/v01/NameServerIpList.java +++ /dev/null @@ -1,114 +0,0 @@ - -package com.neustar.ultra.api.webservice.v01; - -import javax.xml.bind.annotation.XmlAccessType; -import javax.xml.bind.annotation.XmlAccessorType; -import javax.xml.bind.annotation.XmlType; - - -/** - *

Java class for nameServerIpList complex type. - * - *

The following schema fragment specifies the expected content contained within this class. - * - *

- * <complexType name="nameServerIpList">
- *   <complexContent>
- *     <restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
- *       <sequence>
- *         <element name="nameServerIp1" type="{http://webservice.api.ultra.neustar.com/v01/}nameServer" minOccurs="0"/>
- *         <element name="nameServerIp2" type="{http://webservice.api.ultra.neustar.com/v01/}nameServer" minOccurs="0"/>
- *         <element name="nameServerIp3" type="{http://webservice.api.ultra.neustar.com/v01/}nameServer" minOccurs="0"/>
- *       </sequence>
- *     </restriction>
- *   </complexContent>
- * </complexType>
- * 
- * - * - */ -@XmlAccessorType(XmlAccessType.FIELD) -@XmlType(name = "nameServerIpList", propOrder = { - "nameServerIp1", - "nameServerIp2", - "nameServerIp3" -}) -public class NameServerIpList { - - protected NameServer nameServerIp1; - protected NameServer nameServerIp2; - protected NameServer nameServerIp3; - - /** - * Gets the value of the nameServerIp1 property. - * - * @return - * possible object is - * {@link NameServer } - * - */ - public NameServer getNameServerIp1() { - return nameServerIp1; - } - - /** - * Sets the value of the nameServerIp1 property. - * - * @param value - * allowed object is - * {@link NameServer } - * - */ - public void setNameServerIp1(NameServer value) { - this.nameServerIp1 = value; - } - - /** - * Gets the value of the nameServerIp2 property. - * - * @return - * possible object is - * {@link NameServer } - * - */ - public NameServer getNameServerIp2() { - return nameServerIp2; - } - - /** - * Sets the value of the nameServerIp2 property. - * - * @param value - * allowed object is - * {@link NameServer } - * - */ - public void setNameServerIp2(NameServer value) { - this.nameServerIp2 = value; - } - - /** - * Gets the value of the nameServerIp3 property. - * - * @return - * possible object is - * {@link NameServer } - * - */ - public NameServer getNameServerIp3() { - return nameServerIp3; - } - - /** - * Sets the value of the nameServerIp3 property. - * - * @param value - * allowed object is - * {@link NameServer } - * - */ - public void setNameServerIp3(NameServer value) { - this.nameServerIp3 = value; - } - -} diff --git a/Plugins/Mineplex.BungeeRotator/src/com/neustar/ultra/api/webservice/v01/ObjectFactory.java b/Plugins/Mineplex.BungeeRotator/src/com/neustar/ultra/api/webservice/v01/ObjectFactory.java deleted file mode 100644 index e13cd5e06..000000000 --- a/Plugins/Mineplex.BungeeRotator/src/com/neustar/ultra/api/webservice/v01/ObjectFactory.java +++ /dev/null @@ -1,165 +0,0 @@ - -package com.neustar.ultra.api.webservice.v01; - -import javax.xml.bind.JAXBElement; -import javax.xml.bind.annotation.XmlElementDecl; -import javax.xml.bind.annotation.XmlRegistry; -import javax.xml.namespace.QName; - - -/** - * This object contains factory methods for each - * Java content interface and Java element interface - * generated in the com.neustar.ultra.api.webservice.v01 package. - *

An ObjectFactory allows you to programatically - * construct new instances of the Java representation - * for XML content. The Java representation of XML - * content can consist of schema derived interfaces - * and classes representing the binding of schema - * type definitions, element declarations and model - * groups. Factory methods for each of these are - * provided in this class. - * - */ -@XmlRegistry -public class ObjectFactory { - - private final static QName _UltraWSException_QNAME = new QName("http://webservice.api.ultra.neustar.com/v01/", "UltraWSException"); - - /** - * Create a new ObjectFactory that can be used to create new instances of schema derived classes for package: com.neustar.ultra.api.webservice.v01 - * - */ - public ObjectFactory() { - } - - /** - * Create an instance of {@link UltraWSException } - * - */ - public UltraWSException createUltraWSException() { - return new UltraWSException(); - } - - /** - * Create an instance of {@link RestrictIP } - * - */ - public RestrictIP createRestrictIP() { - return new RestrictIP(); - } - - /** - * Create an instance of {@link DeleteZoneStatus } - * - */ - public DeleteZoneStatus createDeleteZoneStatus() { - return new DeleteZoneStatus(); - } - - /** - * Create an instance of {@link SecondaryZoneInfo } - * - */ - public SecondaryZoneInfo createSecondaryZoneInfo() { - return new SecondaryZoneInfo(); - } - - /** - * Create an instance of {@link NameServerIpList } - * - */ - public NameServerIpList createNameServerIpList() { - return new NameServerIpList(); - } - - /** - * Create an instance of {@link NameServer } - * - */ - public NameServer createNameServer() { - return new NameServer(); - } - - /** - * Create an instance of {@link PrimaryZoneInfo } - * - */ - public PrimaryZoneInfo createPrimaryZoneInfo() { - return new PrimaryZoneInfo(); - } - - /** - * Create an instance of {@link TransferInfo } - * - */ - public TransferInfo createTransferInfo() { - return new TransferInfo(); - } - - /** - * Create an instance of {@link TransferStatus } - * - */ - public TransferStatus createTransferStatus() { - return new TransferStatus(); - } - - /** - * Create an instance of {@link ZoneProperties } - * - */ - public ZoneProperties createZoneProperties() { - return new ZoneProperties(); - } - - /** - * Create an instance of {@link AuditSummary } - * - */ - public AuditSummary createAuditSummary() { - return new AuditSummary(); - } - - /** - * Create an instance of {@link InternalZone } - * - */ - public InternalZone createInternalZone() { - return new InternalZone(); - } - - /** - * Create an instance of {@link PrimaryNameServers } - * - */ - public PrimaryNameServers createPrimaryNameServers() { - return new PrimaryNameServers(); - } - - /** - * Create an instance of {@link AliasZoneInfo } - * - */ - public AliasZoneInfo createAliasZoneInfo() { - return new AliasZoneInfo(); - } - - /** - * Create an instance of {@link Zone } - * - */ - public Zone createZone() { - return new Zone(); - } - - /** - * Create an instance of {@link JAXBElement }{@code <}{@link UltraWSException }{@code >}} - * - */ - @XmlElementDecl(namespace = "http://webservice.api.ultra.neustar.com/v01/", name = "UltraWSException") - public JAXBElement createUltraWSException(UltraWSException value) { - return new JAXBElement(_UltraWSException_QNAME, UltraWSException.class, null, value); - } - -} diff --git a/Plugins/Mineplex.BungeeRotator/src/com/neustar/ultra/api/webservice/v01/PrimaryNameServers.java b/Plugins/Mineplex.BungeeRotator/src/com/neustar/ultra/api/webservice/v01/PrimaryNameServers.java deleted file mode 100644 index 40a3327b5..000000000 --- a/Plugins/Mineplex.BungeeRotator/src/com/neustar/ultra/api/webservice/v01/PrimaryNameServers.java +++ /dev/null @@ -1,60 +0,0 @@ - -package com.neustar.ultra.api.webservice.v01; - -import javax.xml.bind.annotation.XmlAccessType; -import javax.xml.bind.annotation.XmlAccessorType; -import javax.xml.bind.annotation.XmlType; - - -/** - *

Java class for primaryNameServers complex type. - * - *

The following schema fragment specifies the expected content contained within this class. - * - *

- * <complexType name="primaryNameServers">
- *   <complexContent>
- *     <restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
- *       <sequence>
- *         <element name="nameServerIpList" type="{http://webservice.api.ultra.neustar.com/v01/}nameServerIpList" minOccurs="0"/>
- *       </sequence>
- *     </restriction>
- *   </complexContent>
- * </complexType>
- * 
- * - * - */ -@XmlAccessorType(XmlAccessType.FIELD) -@XmlType(name = "primaryNameServers", propOrder = { - "nameServerIpList" -}) -public class PrimaryNameServers { - - protected NameServerIpList nameServerIpList; - - /** - * Gets the value of the nameServerIpList property. - * - * @return - * possible object is - * {@link NameServerIpList } - * - */ - public NameServerIpList getNameServerIpList() { - return nameServerIpList; - } - - /** - * Sets the value of the nameServerIpList property. - * - * @param value - * allowed object is - * {@link NameServerIpList } - * - */ - public void setNameServerIpList(NameServerIpList value) { - this.nameServerIpList = value; - } - -} diff --git a/Plugins/Mineplex.BungeeRotator/src/com/neustar/ultra/api/webservice/v01/PrimaryZoneInfo.java b/Plugins/Mineplex.BungeeRotator/src/com/neustar/ultra/api/webservice/v01/PrimaryZoneInfo.java deleted file mode 100644 index 66341d686..000000000 --- a/Plugins/Mineplex.BungeeRotator/src/com/neustar/ultra/api/webservice/v01/PrimaryZoneInfo.java +++ /dev/null @@ -1,177 +0,0 @@ - -package com.neustar.ultra.api.webservice.v01; - -import java.util.ArrayList; -import java.util.List; -import javax.xml.bind.annotation.XmlAccessType; -import javax.xml.bind.annotation.XmlAccessorType; -import javax.xml.bind.annotation.XmlElement; -import javax.xml.bind.annotation.XmlType; - - -/** - *

Java class for primaryZoneInfo complex type. - * - *

The following schema fragment specifies the expected content contained within this class. - * - *

- * <complexType name="primaryZoneInfo">
- *   <complexContent>
- *     <restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
- *       <sequence>
- *         <element name="createType" type="{http://webservice.api.ultra.neustar.com/v01/}createType" minOccurs="0"/>
- *         <element name="forceImport" type="{http://www.w3.org/2001/XMLSchema}boolean" minOccurs="0"/>
- *         <element name="nameServer" type="{http://webservice.api.ultra.neustar.com/v01/}nameServer" minOccurs="0"/>
- *         <element name="originalZoneName" type="{http://www.w3.org/2001/XMLSchema}string" minOccurs="0"/>
- *         <element name="restrictIPList" type="{http://webservice.api.ultra.neustar.com/v01/}restrictIP" maxOccurs="unbounded" minOccurs="0"/>
- *       </sequence>
- *     </restriction>
- *   </complexContent>
- * </complexType>
- * 
- * - * - */ -@XmlAccessorType(XmlAccessType.FIELD) -@XmlType(name = "primaryZoneInfo", propOrder = { - "createType", - "forceImport", - "nameServer", - "originalZoneName", - "restrictIPList" -}) -public class PrimaryZoneInfo { - - protected CreateType createType; - protected Boolean forceImport; - protected NameServer nameServer; - protected String originalZoneName; - @XmlElement(nillable = true) - protected List restrictIPList; - - /** - * Gets the value of the createType property. - * - * @return - * possible object is - * {@link CreateType } - * - */ - public CreateType getCreateType() { - return createType; - } - - /** - * Sets the value of the createType property. - * - * @param value - * allowed object is - * {@link CreateType } - * - */ - public void setCreateType(CreateType value) { - this.createType = value; - } - - /** - * Gets the value of the forceImport property. - * - * @return - * possible object is - * {@link Boolean } - * - */ - public Boolean isForceImport() { - return forceImport; - } - - /** - * Sets the value of the forceImport property. - * - * @param value - * allowed object is - * {@link Boolean } - * - */ - public void setForceImport(Boolean value) { - this.forceImport = value; - } - - /** - * Gets the value of the nameServer property. - * - * @return - * possible object is - * {@link NameServer } - * - */ - public NameServer getNameServer() { - return nameServer; - } - - /** - * Sets the value of the nameServer property. - * - * @param value - * allowed object is - * {@link NameServer } - * - */ - public void setNameServer(NameServer value) { - this.nameServer = value; - } - - /** - * Gets the value of the originalZoneName property. - * - * @return - * possible object is - * {@link String } - * - */ - public String getOriginalZoneName() { - return originalZoneName; - } - - /** - * Sets the value of the originalZoneName property. - * - * @param value - * allowed object is - * {@link String } - * - */ - public void setOriginalZoneName(String value) { - this.originalZoneName = value; - } - - /** - * Gets the value of the restrictIPList property. - * - *

- * This accessor method returns a reference to the live list, - * not a snapshot. Therefore any modification you make to the - * returned list will be present inside the JAXB object. - * This is why there is not a set method for the restrictIPList property. - * - *

- * For example, to add a new item, do as follows: - *

-     *    getRestrictIPList().add(newItem);
-     * 
- * - * - *

- * Objects of the following type(s) are allowed in the list - * {@link RestrictIP } - * - * - */ - public List getRestrictIPList() { - if (restrictIPList == null) { - restrictIPList = new ArrayList(); - } - return this.restrictIPList; - } - -} diff --git a/Plugins/Mineplex.BungeeRotator/src/com/neustar/ultra/api/webservice/v01/RestrictIP.java b/Plugins/Mineplex.BungeeRotator/src/com/neustar/ultra/api/webservice/v01/RestrictIP.java deleted file mode 100644 index d6a00f82c..000000000 --- a/Plugins/Mineplex.BungeeRotator/src/com/neustar/ultra/api/webservice/v01/RestrictIP.java +++ /dev/null @@ -1,168 +0,0 @@ - -package com.neustar.ultra.api.webservice.v01; - -import javax.xml.bind.annotation.XmlAccessType; -import javax.xml.bind.annotation.XmlAccessorType; -import javax.xml.bind.annotation.XmlType; - - -/** - *

Java class for restrictIP complex type. - * - *

The following schema fragment specifies the expected content contained within this class. - * - *

- * <complexType name="restrictIP">
- *   <complexContent>
- *     <restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
- *       <sequence>
- *         <element name="comment" type="{http://www.w3.org/2001/XMLSchema}string" minOccurs="0"/>
- *         <element name="endIP" type="{http://www.w3.org/2001/XMLSchema}string" minOccurs="0"/>
- *         <element name="startIP" type="{http://www.w3.org/2001/XMLSchema}string" minOccurs="0"/>
- *         <element name="tsigKey" type="{http://www.w3.org/2001/XMLSchema}string" minOccurs="0"/>
- *         <element name="tsigKeyValue" type="{http://www.w3.org/2001/XMLSchema}string" minOccurs="0"/>
- *       </sequence>
- *     </restriction>
- *   </complexContent>
- * </complexType>
- * 
- * - * - */ -@XmlAccessorType(XmlAccessType.FIELD) -@XmlType(name = "restrictIP", propOrder = { - "comment", - "endIP", - "startIP", - "tsigKey", - "tsigKeyValue" -}) -public class RestrictIP { - - protected String comment; - protected String endIP; - protected String startIP; - protected String tsigKey; - protected String tsigKeyValue; - - /** - * Gets the value of the comment property. - * - * @return - * possible object is - * {@link String } - * - */ - public String getComment() { - return comment; - } - - /** - * Sets the value of the comment property. - * - * @param value - * allowed object is - * {@link String } - * - */ - public void setComment(String value) { - this.comment = value; - } - - /** - * Gets the value of the endIP property. - * - * @return - * possible object is - * {@link String } - * - */ - public String getEndIP() { - return endIP; - } - - /** - * Sets the value of the endIP property. - * - * @param value - * allowed object is - * {@link String } - * - */ - public void setEndIP(String value) { - this.endIP = value; - } - - /** - * Gets the value of the startIP property. - * - * @return - * possible object is - * {@link String } - * - */ - public String getStartIP() { - return startIP; - } - - /** - * Sets the value of the startIP property. - * - * @param value - * allowed object is - * {@link String } - * - */ - public void setStartIP(String value) { - this.startIP = value; - } - - /** - * Gets the value of the tsigKey property. - * - * @return - * possible object is - * {@link String } - * - */ - public String getTsigKey() { - return tsigKey; - } - - /** - * Sets the value of the tsigKey property. - * - * @param value - * allowed object is - * {@link String } - * - */ - public void setTsigKey(String value) { - this.tsigKey = value; - } - - /** - * Gets the value of the tsigKeyValue property. - * - * @return - * possible object is - * {@link String } - * - */ - public String getTsigKeyValue() { - return tsigKeyValue; - } - - /** - * Sets the value of the tsigKeyValue property. - * - * @param value - * allowed object is - * {@link String } - * - */ - public void setTsigKeyValue(String value) { - this.tsigKeyValue = value; - } - -} diff --git a/Plugins/Mineplex.BungeeRotator/src/com/neustar/ultra/api/webservice/v01/SecondaryZoneInfo.java b/Plugins/Mineplex.BungeeRotator/src/com/neustar/ultra/api/webservice/v01/SecondaryZoneInfo.java deleted file mode 100644 index 8a87439dc..000000000 --- a/Plugins/Mineplex.BungeeRotator/src/com/neustar/ultra/api/webservice/v01/SecondaryZoneInfo.java +++ /dev/null @@ -1,87 +0,0 @@ - -package com.neustar.ultra.api.webservice.v01; - -import javax.xml.bind.annotation.XmlAccessType; -import javax.xml.bind.annotation.XmlAccessorType; -import javax.xml.bind.annotation.XmlType; - - -/** - *

Java class for secondaryZoneInfo complex type. - * - *

The following schema fragment specifies the expected content contained within this class. - * - *

- * <complexType name="secondaryZoneInfo">
- *   <complexContent>
- *     <restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
- *       <sequence>
- *         <element name="notificationEmailAddress" type="{http://www.w3.org/2001/XMLSchema}string" minOccurs="0"/>
- *         <element name="primaryNameServers" type="{http://webservice.api.ultra.neustar.com/v01/}primaryNameServers" minOccurs="0"/>
- *       </sequence>
- *     </restriction>
- *   </complexContent>
- * </complexType>
- * 
- * - * - */ -@XmlAccessorType(XmlAccessType.FIELD) -@XmlType(name = "secondaryZoneInfo", propOrder = { - "notificationEmailAddress", - "primaryNameServers" -}) -public class SecondaryZoneInfo { - - protected String notificationEmailAddress; - protected PrimaryNameServers primaryNameServers; - - /** - * Gets the value of the notificationEmailAddress property. - * - * @return - * possible object is - * {@link String } - * - */ - public String getNotificationEmailAddress() { - return notificationEmailAddress; - } - - /** - * Sets the value of the notificationEmailAddress property. - * - * @param value - * allowed object is - * {@link String } - * - */ - public void setNotificationEmailAddress(String value) { - this.notificationEmailAddress = value; - } - - /** - * Gets the value of the primaryNameServers property. - * - * @return - * possible object is - * {@link PrimaryNameServers } - * - */ - public PrimaryNameServers getPrimaryNameServers() { - return primaryNameServers; - } - - /** - * Sets the value of the primaryNameServers property. - * - * @param value - * allowed object is - * {@link PrimaryNameServers } - * - */ - public void setPrimaryNameServers(PrimaryNameServers value) { - this.primaryNameServers = value; - } - -} diff --git a/Plugins/Mineplex.BungeeRotator/src/com/neustar/ultra/api/webservice/v01/TransferInfo.java b/Plugins/Mineplex.BungeeRotator/src/com/neustar/ultra/api/webservice/v01/TransferInfo.java deleted file mode 100644 index b286c3326..000000000 --- a/Plugins/Mineplex.BungeeRotator/src/com/neustar/ultra/api/webservice/v01/TransferInfo.java +++ /dev/null @@ -1,202 +0,0 @@ - -package com.neustar.ultra.api.webservice.v01; - -import java.util.ArrayList; -import java.util.List; -import javax.xml.bind.annotation.XmlAccessType; -import javax.xml.bind.annotation.XmlAccessorType; -import javax.xml.bind.annotation.XmlElement; -import javax.xml.bind.annotation.XmlType; - - -/** - *

Java class for transferInfo complex type. - * - *

The following schema fragment specifies the expected content contained within this class. - * - *

- * <complexType name="transferInfo">
- *   <complexContent>
- *     <restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
- *       <sequence>
- *         <element name="accountId" type="{http://www.w3.org/2001/XMLSchema}string" minOccurs="0"/>
- *         <element name="nsHosts" type="{http://www.w3.org/2001/XMLSchema}string" maxOccurs="unbounded" minOccurs="0"/>
- *         <element name="sponsorId" type="{http://www.w3.org/2001/XMLSchema}string" minOccurs="0"/>
- *         <element name="suspended" type="{http://www.w3.org/2001/XMLSchema}boolean"/>
- *         <element name="toEmailIds" type="{http://www.w3.org/2001/XMLSchema}string" maxOccurs="unbounded" minOccurs="0"/>
- *         <element name="userId" type="{http://www.w3.org/2001/XMLSchema}string" minOccurs="0"/>
- *       </sequence>
- *     </restriction>
- *   </complexContent>
- * </complexType>
- * 
- * - * - */ -@XmlAccessorType(XmlAccessType.FIELD) -@XmlType(name = "transferInfo", propOrder = { - "accountId", - "nsHosts", - "sponsorId", - "suspended", - "toEmailIds", - "userId" -}) -public class TransferInfo { - - protected String accountId; - @XmlElement(nillable = true) - protected List nsHosts; - protected String sponsorId; - protected boolean suspended; - @XmlElement(nillable = true) - protected List toEmailIds; - protected String userId; - - /** - * Gets the value of the accountId property. - * - * @return - * possible object is - * {@link String } - * - */ - public String getAccountId() { - return accountId; - } - - /** - * Sets the value of the accountId property. - * - * @param value - * allowed object is - * {@link String } - * - */ - public void setAccountId(String value) { - this.accountId = value; - } - - /** - * Gets the value of the nsHosts property. - * - *

- * This accessor method returns a reference to the live list, - * not a snapshot. Therefore any modification you make to the - * returned list will be present inside the JAXB object. - * This is why there is not a set method for the nsHosts property. - * - *

- * For example, to add a new item, do as follows: - *

-     *    getNsHosts().add(newItem);
-     * 
- * - * - *

- * Objects of the following type(s) are allowed in the list - * {@link String } - * - * - */ - public List getNsHosts() { - if (nsHosts == null) { - nsHosts = new ArrayList(); - } - return this.nsHosts; - } - - /** - * Gets the value of the sponsorId property. - * - * @return - * possible object is - * {@link String } - * - */ - public String getSponsorId() { - return sponsorId; - } - - /** - * Sets the value of the sponsorId property. - * - * @param value - * allowed object is - * {@link String } - * - */ - public void setSponsorId(String value) { - this.sponsorId = value; - } - - /** - * Gets the value of the suspended property. - * - */ - public boolean isSuspended() { - return suspended; - } - - /** - * Sets the value of the suspended property. - * - */ - public void setSuspended(boolean value) { - this.suspended = value; - } - - /** - * Gets the value of the toEmailIds property. - * - *

- * This accessor method returns a reference to the live list, - * not a snapshot. Therefore any modification you make to the - * returned list will be present inside the JAXB object. - * This is why there is not a set method for the toEmailIds property. - * - *

- * For example, to add a new item, do as follows: - *

-     *    getToEmailIds().add(newItem);
-     * 
- * - * - *

- * Objects of the following type(s) are allowed in the list - * {@link String } - * - * - */ - public List getToEmailIds() { - if (toEmailIds == null) { - toEmailIds = new ArrayList(); - } - return this.toEmailIds; - } - - /** - * Gets the value of the userId property. - * - * @return - * possible object is - * {@link String } - * - */ - public String getUserId() { - return userId; - } - - /** - * Sets the value of the userId property. - * - * @param value - * allowed object is - * {@link String } - * - */ - public void setUserId(String value) { - this.userId = value; - } - -} diff --git a/Plugins/Mineplex.BungeeRotator/src/com/neustar/ultra/api/webservice/v01/TransferStatus.java b/Plugins/Mineplex.BungeeRotator/src/com/neustar/ultra/api/webservice/v01/TransferStatus.java deleted file mode 100644 index 6ce69605f..000000000 --- a/Plugins/Mineplex.BungeeRotator/src/com/neustar/ultra/api/webservice/v01/TransferStatus.java +++ /dev/null @@ -1,144 +0,0 @@ - -package com.neustar.ultra.api.webservice.v01; - -import javax.xml.bind.annotation.XmlAccessType; -import javax.xml.bind.annotation.XmlAccessorType; -import javax.xml.bind.annotation.XmlType; - - -/** - *

Java class for transferStatus complex type. - * - *

The following schema fragment specifies the expected content contained within this class. - * - *

- * <complexType name="transferStatus">
- *   <complexContent>
- *     <restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
- *       <sequence>
- *         <element name="lastUpdate" type="{http://www.w3.org/2001/XMLSchema}long"/>
- *         <element name="message" type="{http://www.w3.org/2001/XMLSchema}string" minOccurs="0"/>
- *         <element name="nextUpdate" type="{http://www.w3.org/2001/XMLSchema}long"/>
- *         <element name="soaSerial" type="{http://www.w3.org/2001/XMLSchema}long"/>
- *         <element name="transferStatusType" type="{http://webservice.api.ultra.neustar.com/v01/}transferStatusType" minOccurs="0"/>
- *       </sequence>
- *     </restriction>
- *   </complexContent>
- * </complexType>
- * 
- * - * - */ -@XmlAccessorType(XmlAccessType.FIELD) -@XmlType(name = "transferStatus", propOrder = { - "lastUpdate", - "message", - "nextUpdate", - "soaSerial", - "transferStatusType" -}) -public class TransferStatus { - - protected long lastUpdate; - protected String message; - protected long nextUpdate; - protected long soaSerial; - protected TransferStatusType transferStatusType; - - /** - * Gets the value of the lastUpdate property. - * - */ - public long getLastUpdate() { - return lastUpdate; - } - - /** - * Sets the value of the lastUpdate property. - * - */ - public void setLastUpdate(long value) { - this.lastUpdate = value; - } - - /** - * Gets the value of the message property. - * - * @return - * possible object is - * {@link String } - * - */ - public String getMessage() { - return message; - } - - /** - * Sets the value of the message property. - * - * @param value - * allowed object is - * {@link String } - * - */ - public void setMessage(String value) { - this.message = value; - } - - /** - * Gets the value of the nextUpdate property. - * - */ - public long getNextUpdate() { - return nextUpdate; - } - - /** - * Sets the value of the nextUpdate property. - * - */ - public void setNextUpdate(long value) { - this.nextUpdate = value; - } - - /** - * Gets the value of the soaSerial property. - * - */ - public long getSoaSerial() { - return soaSerial; - } - - /** - * Sets the value of the soaSerial property. - * - */ - public void setSoaSerial(long value) { - this.soaSerial = value; - } - - /** - * Gets the value of the transferStatusType property. - * - * @return - * possible object is - * {@link TransferStatusType } - * - */ - public TransferStatusType getTransferStatusType() { - return transferStatusType; - } - - /** - * Sets the value of the transferStatusType property. - * - * @param value - * allowed object is - * {@link TransferStatusType } - * - */ - public void setTransferStatusType(TransferStatusType value) { - this.transferStatusType = value; - } - -} diff --git a/Plugins/Mineplex.BungeeRotator/src/com/neustar/ultra/api/webservice/v01/TransferStatusType.java b/Plugins/Mineplex.BungeeRotator/src/com/neustar/ultra/api/webservice/v01/TransferStatusType.java deleted file mode 100644 index 4597ea121..000000000 --- a/Plugins/Mineplex.BungeeRotator/src/com/neustar/ultra/api/webservice/v01/TransferStatusType.java +++ /dev/null @@ -1,46 +0,0 @@ - -package com.neustar.ultra.api.webservice.v01; - -import javax.xml.bind.annotation.XmlEnum; -import javax.xml.bind.annotation.XmlType; - - -/** - *

Java class for transferStatusType. - * - *

The following schema fragment specifies the expected content contained within this class. - *

- *

- * <simpleType name="transferStatusType">
- *   <restriction base="{http://www.w3.org/2001/XMLSchema}string">
- *     <enumeration value="QUEUED"/>
- *     <enumeration value="IN_PROGRESS"/>
- *     <enumeration value="COMPLETED"/>
- *     <enumeration value="FAILED"/>
- *     <enumeration value="NOT_REQUESTED"/>
- *     <enumeration value="PENDING"/>
- *   </restriction>
- * </simpleType>
- * 
- * - */ -@XmlType(name = "transferStatusType") -@XmlEnum -public enum TransferStatusType { - - QUEUED, - IN_PROGRESS, - COMPLETED, - FAILED, - NOT_REQUESTED, - PENDING; - - public String value() { - return name(); - } - - public static TransferStatusType fromValue(String v) { - return valueOf(v); - } - -} diff --git a/Plugins/Mineplex.BungeeRotator/src/com/neustar/ultra/api/webservice/v01/UltraDNS1.java b/Plugins/Mineplex.BungeeRotator/src/com/neustar/ultra/api/webservice/v01/UltraDNS1.java deleted file mode 100644 index 792ff1918..000000000 --- a/Plugins/Mineplex.BungeeRotator/src/com/neustar/ultra/api/webservice/v01/UltraDNS1.java +++ /dev/null @@ -1,2104 +0,0 @@ -package com.neustar.ultra.api.webservice.v01; - -import javax.jws.WebMethod; -import javax.jws.WebParam; -import javax.jws.WebResult; -import javax.jws.WebService; -import javax.jws.soap.SOAPBinding; -import javax.xml.bind.annotation.XmlSeeAlso; - -/** - * This class was generated by Apache CXF 2.7.7 - * 2014-01-15T10:08:40.615-05:00 - * Generated source version: 2.7.7 - * - */ -@WebService(targetNamespace = "http://webservice.api.ultra.neustar.com/v01/", name = "UltraDNS1") -@XmlSeeAlso({ObjectFactory.class, com.neustar.ultraservice.schema.ObjectFactory.class, com.neustar.ultraservice.schema.v01.ObjectFactory.class, net.java.dev.jaxb.array.ObjectFactory.class}) -@SOAPBinding(style = SOAPBinding.Style.RPC) -public interface UltraDNS1 { - - @WebResult(name = "ResourceRecordList", targetNamespace = "http://webservice.api.ultra.neustar.com/v01/", partName = "ResourceRecordList") - @WebMethod - public com.neustar.ultraservice.schema.v01.ResourceRecordList getResourceRecordsOfDNameByType( - @WebParam(partName = "zoneName", name = "zoneName") - java.lang.String zoneName, - @WebParam(partName = "hostName", name = "hostName") - java.lang.String hostName, - @WebParam(partName = "rrType", name = "rrType") - int rrType - ) throws UltraWSException_Exception; - - @WebResult(name = "DirectionalPoolRecordID", targetNamespace = "http://webservice.api.ultra.neustar.com/v01/", partName = "DirectionalPoolRecordID") - @WebMethod - public java.lang.String addDirectionalPoolRecord( - @WebParam(partName = "transactionID", name = "transactionID") - java.lang.String transactionID, - @WebParam(partName = "AddDirectionalRecordData", name = "AddDirectionalRecordData") - com.neustar.ultraservice.schema.v01.AddDirectionalRecordData addDirectionalRecordData - ) throws UltraWSException_Exception; - - @WebResult(name = "result", targetNamespace = "http://webservice.api.ultra.neustar.com/v01/", partName = "result") - @WebMethod - public java.lang.String deletePoolProbe( - @WebParam(partName = "transactionID", name = "transactionID") - java.lang.String transactionID, - @WebParam(partName = "poolProbeID", name = "poolProbeID") - java.lang.String poolProbeID - ) throws UltraWSException_Exception; - - @WebResult(name = "AddressBookEntryList", targetNamespace = "http://webservice.api.ultra.neustar.com/v01/", partName = "AddressBookEntryList") - @WebMethod - public com.neustar.ultraservice.schema.v01.AddressBookEntryList getAllAddressBookEntries( - @WebParam(partName = "addressBookEntryListKey", name = "addressBookEntryListKey") - com.neustar.ultraservice.schema.v01.AddressBookEntryListKey addressBookEntryListKey - ) throws UltraWSException_Exception; - - @WebResult(name = "result", targetNamespace = "http://webservice.api.ultra.neustar.com/v01/", partName = "result") - @WebMethod - public java.lang.String getAutoSerialUpdate( - @WebParam(partName = "transactionID", name = "transactionID") - java.lang.String transactionID - ) throws UltraWSException_Exception; - - @WebResult(name = "PasswordVerificationQuestion", targetNamespace = "http://webservice.api.ultra.neustar.com/v01/", partName = "PasswordVerificationQuestion") - @WebMethod - public com.neustar.ultraservice.schema.v01.PasswordVerificationQuestionList getSecurityPreferencesForUser() throws UltraWSException_Exception; - - @WebResult(name = "guid", targetNamespace = "http://webservice.api.ultra.neustar.com/v01/", partName = "guid") - @WebMethod - public java.lang.String createResourceRecord( - @WebParam(partName = "transactionID", name = "transactionID") - java.lang.String transactionID, - @WebParam(partName = "resourceRecord", name = "resourceRecord") - com.neustar.ultraservice.schema.v01.ResourceRecordToCreate resourceRecord - ) throws UltraWSException_Exception; - - @WebResult(name = "Status", targetNamespace = "http://webservice.api.ultra.neustar.com/v01/", partName = "Status") - @WebMethod - public com.neustar.ultraservice.schema.v01.Status deleteARPoolRecordProbe( - @WebParam(partName = "id", name = "id") - com.neustar.ultraservice.schema.v01.PoolRecordProbeId id - ) throws UltraWSException_Exception; - - @WebResult(name = "ARPoolProbeList", targetNamespace = "http://webservice.api.ultra.neustar.com/v01/", partName = "ARPoolProbeList") - @WebMethod - public com.neustar.ultraservice.schema.v01.ARPoolProbeList getARProbes( - @WebParam(partName = "poolName", name = "poolName") - java.lang.String poolName, - @WebParam(partName = "probeListParams", name = "probeListParams") - com.neustar.ultraservice.schema.v01.ProbeListParams probeListParams - ) throws UltraWSException_Exception; - - @WebResult(name = "result", targetNamespace = "http://webservice.api.ultra.neustar.com/v01/", partName = "result") - @WebMethod - public java.lang.String createPrimaryZone( - @WebParam(partName = "transactionID", name = "transactionID") - java.lang.String transactionID, - @WebParam(partName = "accountId", name = "accountId") - java.lang.String accountId, - @WebParam(partName = "zoneName", name = "zoneName") - java.lang.String zoneName, - @WebParam(partName = "forceImport", name = "forceImport") - boolean forceImport - ) throws UltraWSException_Exception; - - @WebResult(name = "ZoneList", targetNamespace = "http://webservice.api.ultra.neustar.com/v01/", partName = "ZoneList") - @WebMethod - public com.neustar.ultraservice.schema.v01.ZoneList getZonesOfAccountRange( - @WebParam(partName = "accountId", name = "accountId") - java.lang.String accountId, - @WebParam(partName = "zoneType", name = "zoneType") - com.neustar.ultraservice.schema.v01.ZoneType zoneType, - @WebParam(partName = "offset", name = "offset") - int offset, - @WebParam(partName = "limit", name = "limit") - int limit - ) throws UltraWSException_Exception; - - @WebResult(name = "ARPoolAlertsList", targetNamespace = "http://webservice.api.ultra.neustar.com/v01/", partName = "ARPoolAlertsList") - @WebMethod - public com.neustar.ultraservice.schema.v01.ARPoolAlertsList getARPoolAlerts( - @WebParam(partName = "arPoolAlertKey", name = "arPoolAlertKey") - com.neustar.ultraservice.schema.v01.ARPoolAlertsKey arPoolAlertKey, - @WebParam(partName = "alertListParams", name = "alertListParams") - com.neustar.ultraservice.schema.v01.PoolAlertsListParams alertListParams - ) throws UltraWSException_Exception; - - @WebResult(name = "PoolDetailsList", targetNamespace = "http://webservice.api.ultra.neustar.com/v01/", partName = "PoolDetailsList") - @WebMethod - public com.neustar.ultraservice.schema.v01.PoolDetailsList getARPool( - @WebParam(partName = "zoneName", name = "zoneName") - java.lang.String zoneName, - @WebParam(partName = "poolName", name = "poolName") - java.lang.String poolName - ) throws UltraWSException_Exception; - - @WebResult(name = "DirectionalDNSAvailableRegionList", targetNamespace = "http://webservice.api.ultra.neustar.com/v01/", partName = "DirectionalDNSAvailableRegionList") - @WebMethod - public com.neustar.ultraservice.schema.v01.RegionList getAvailableRegions() throws UltraWSException_Exception; - - @WebResult(name = "HealthCheckList", targetNamespace = "http://webservice.api.ultra.neustar.com/v01/", partName = "HealthCheckList") - @WebMethod - public com.neustar.ultraservice.schema.v01.HealthCheckList healthCheck() throws UltraWSException_Exception; - - @WebResult(name = "result", targetNamespace = "http://webservice.api.ultra.neustar.com/v01/", partName = "result") - @WebMethod - public java.lang.String deleteMailMXBacker( - @WebParam(partName = "transactionId", name = "transactionId") - java.lang.String transactionId, - @WebParam(partName = "zoneName", name = "zoneName") - java.lang.String zoneName - ) throws UltraWSException_Exception; - - @WebResult(name = "result", targetNamespace = "http://webservice.api.ultra.neustar.com/v01/", partName = "result") - @WebMethod - public java.lang.String rollbackTransaction( - @WebParam(partName = "transactionID", name = "transactionID") - java.lang.String transactionID - ) throws UltraWSException_Exception; - - @WebResult(name = "result", targetNamespace = "http://webservice.api.ultra.neustar.com/v01/", partName = "result") - @WebMethod - public java.lang.String getMailMXBackerStatus( - @WebParam(partName = "zoneName", name = "zoneName") - java.lang.String zoneName - ) throws UltraWSException_Exception; - - @WebResult(name = "Password", targetNamespace = "http://webservice.api.ultra.neustar.com/v01/", partName = "Password") - @WebMethod - public java.lang.String resetLostPassword( - @WebParam(partName = "userName", name = "userName") - java.lang.String userName, - @WebParam(partName = "PasswordVerificationInfo", name = "PasswordVerificationInfo") - com.neustar.ultraservice.schema.v01.PasswordVerificationInfo passwordVerificationInfo, - @WebParam(partName = "newPassword", name = "newPassword") - java.lang.String newPassword - ) throws UltraWSException_Exception; - - @WebResult(name = "transactionId", targetNamespace = "http://webservice.api.ultra.neustar.com/v01/", partName = "transactionId") - @WebMethod - public java.lang.String startTransaction() throws UltraWSException_Exception; - - @WebResult(name = "DsRecordList", targetNamespace = "http://webservice.api.ultra.neustar.com/v01/", partName = "DsRecordList") - @WebMethod - public com.neustar.ultraservice.schema.v01.DsRecordList getDsRecords( - @WebParam(partName = "zoneName", name = "zoneName") - java.lang.String zoneName - ) throws UltraWSException_Exception; - - @WebResult(name = "return", targetNamespace = "http://webservice.api.ultra.neustar.com/v01/", partName = "return") - @WebMethod - public com.neustar.ultraservice.schema.v01.Status deleteMonitoredRDPool( - @WebParam(partName = "monitoredRDPoolKey", name = "monitoredRDPoolKey") - com.neustar.ultraservice.schema.v01.MonitoredRDPoolKey monitoredRDPoolKey - ) throws UltraWSException_Exception; - - @WebResult(name = "AccountsList", targetNamespace = "http://webservice.api.ultra.neustar.com/v01/", partName = "AccountsList") - @WebMethod - public com.neustar.ultraservice.schema.v01.AccountDetailsList getAccountsListOfUser() throws UltraWSException_Exception; - - @WebResult(name = "result", targetNamespace = "http://webservice.api.ultra.neustar.com/v01/", partName = "result") - @WebMethod - public java.lang.String unAliasZone( - @WebParam(partName = "transactionId", name = "transactionId") - java.lang.String transactionId, - @WebParam(partName = "aliasZoneName", name = "aliasZoneName") - java.lang.String aliasZoneName, - @WebParam(partName = "parentZoneName", name = "parentZoneName") - java.lang.String parentZoneName - ) throws UltraWSException_Exception; - - @WebResult(name = "Status", targetNamespace = "http://webservice.api.ultra.neustar.com/v01/", partName = "Status") - @WebMethod - public com.neustar.ultraservice.schema.v01.Status addWebForwardPoolRecord( - @WebParam(partName = "transactionID", name = "transactionID") - java.lang.String transactionID, - @WebParam(partName = "WebForwardPoolRecordData", name = "WebForwardPoolRecordData") - com.neustar.ultraservice.schema.v01.WebForwardPoolRecordData webForwardPoolRecordData - ) throws UltraWSException_Exception; - - @WebResult(name = "Status", targetNamespace = "http://webservice.api.ultra.neustar.com/v01/", partName = "Status") - @WebMethod - public com.neustar.ultraservice.schema.v01.Status updateARPoolProbe( - @WebParam(partName = "id", name = "id") - com.neustar.ultraservice.schema.v01.PoolProbeId id, - @WebParam(partName = "probe", name = "probe") - com.neustar.ultraservice.schema.v01.Probe probe - ) throws UltraWSException_Exception; - - @WebResult(name = "DashboardTypeOrderList", targetNamespace = "http://webservice.api.ultra.neustar.com/v01/", partName = "DashboardTypeOrderList") - @WebMethod - public com.neustar.ultraservice.schema.v01.DashboardTypeOrderInfoList getDashboardTypeOrderPreference() throws UltraWSException_Exception; - - @WebResult(name = "result", targetNamespace = "http://webservice.api.ultra.neustar.com/v01/", partName = "result") - @WebMethod - public java.lang.String copyPrimaryZone( - @WebParam(partName = "transactionId", name = "transactionId") - java.lang.String transactionId, - @WebParam(partName = "newZoneName", name = "newZoneName") - java.lang.String newZoneName, - @WebParam(partName = "parentZoneName", name = "parentZoneName") - java.lang.String parentZoneName - ) throws UltraWSException_Exception; - - @WebResult(name = "guid", targetNamespace = "http://webservice.api.ultra.neustar.com/v01/", partName = "guid") - @WebMethod - public java.lang.String addRecordToRRPool( - @WebParam(partName = "transactionID", name = "transactionID") - java.lang.String transactionID, - @WebParam(partName = "roundRobinRecord", name = "roundRobinRecord") - com.neustar.ultraservice.schema.v01.RoundRobinRecord roundRobinRecord - ) throws UltraWSException_Exception; - - @WebResult(name = "result", targetNamespace = "http://webservice.api.ultra.neustar.com/v01/", partName = "result") - @WebMethod - public java.lang.String deletePoolNotificationOfEmail( - @WebParam(partName = "transactionID", name = "transactionID") - java.lang.String transactionID, - @WebParam(partName = "guid", name = "guid") - java.lang.String guid - ) throws UltraWSException_Exception; - - @WebResult(name = "Status", targetNamespace = "http://webservice.api.ultra.neustar.com/v01/", partName = "Status") - @WebMethod - public com.neustar.ultraservice.schema.v01.Status addARPoolProbe( - @WebParam(partName = "id", name = "id") - com.neustar.ultraservice.schema.v01.PoolId id, - @WebParam(partName = "probe", name = "probe") - com.neustar.ultraservice.schema.v01.Probe probe - ) throws UltraWSException_Exception; - - @WebResult(name = "result", targetNamespace = "http://webservice.api.ultra.neustar.com/v01/", partName = "result") - @WebMethod - public java.lang.String autoSerialUpdate( - @WebParam(partName = "transactionID", name = "transactionID") - java.lang.String transactionID, - @WebParam(partName = "autoSerialUpdateValue", name = "autoSerialUpdateValue") - com.neustar.ultraservice.schema.v01.AutoSerialUpdateType autoSerialUpdateValue - ) throws UltraWSException_Exception; - - @WebResult(name = "result", targetNamespace = "http://webservice.api.ultra.neustar.com/v01/", partName = "result") - @WebMethod - public java.lang.String deleteLBPool( - @WebParam(partName = "transactionID", name = "transactionID") - java.lang.String transactionID, - @WebParam(partName = "lbPoolID", name = "lbPoolID") - java.lang.String lbPoolID, - @WebParam(partName = "DeleteAll", name = "DeleteAll") - java.lang.String deleteAll, - @WebParam(partName = "retainRecordId", name = "retainRecordId") - java.lang.String retainRecordId - ) throws UltraWSException_Exception; - - @WebResult(name = "Status", targetNamespace = "http://webservice.api.ultra.neustar.com/v01/", partName = "Status") - @WebMethod - public com.neustar.ultraservice.schema.v01.Status suspendZone( - @WebParam(partName = "suspendZone", name = "suspendZone") - com.neustar.ultraservice.schema.v01.SuspendZone suspendZone - ) throws UltraWSException_Exception; - - @WebResult(name = "result", targetNamespace = "http://webservice.api.ultra.neustar.com/v01/", partName = "result") - @WebMethod - public com.neustar.ultraservice.schema.v01.UserContactInfoValues getContactInformationOfUser() throws UltraWSException_Exception; - - @WebResult(name = "GroupsList", targetNamespace = "http://webservice.api.ultra.neustar.com/v01/", partName = "GroupsList") - @WebMethod - public com.neustar.ultraservice.schema.v01.AccountLevelGroupsList getAccountLevelDirectionalGroups( - @WebParam(partName = "accountId", name = "accountId") - java.lang.String accountId, - @WebParam(partName = "GroupType", name = "GroupType") - java.lang.String groupType - ) throws UltraWSException_Exception; - - @WebResult(name = "DomainDnssecPolicies", targetNamespace = "http://webservice.api.ultra.neustar.com/v01/", partName = "DomainDnssecPolicies") - @WebMethod - public com.neustar.ultraservice.schema.v01.DomainDnssecPolicies getDomainDnssecPolicies( - @WebParam(partName = "zoneName", name = "zoneName") - java.lang.String zoneName - ) throws UltraWSException_Exception; - - @WebResult(name = "ResourceRecordList", targetNamespace = "http://webservice.api.ultra.neustar.com/v01/", partName = "ResourceRecordList") - @WebMethod - public com.neustar.ultraservice.schema.v01.ResourceRecordList getResourceRecordList( - @WebParam(partName = "resourceRecord", name = "resourceRecord") - com.neustar.ultraservice.schema.v01.ResourceRecordToSearch resourceRecord - ) throws UltraWSException_Exception; - - @WebResult(name = "accountID", targetNamespace = "http://webservice.api.ultra.neustar.com/v01/", partName = "accountID") - @WebMethod - public java.lang.String updateContactInformationOfUser( - @WebParam(partName = "userName", name = "userName") - java.lang.String userName, - @WebParam(partName = "UserContactInfo", name = "UserContactInfo") - com.neustar.ultraservice.schema.v01.UserContactInfo userContactInfo - ) throws UltraWSException_Exception; - - @WebResult(name = "DirectionalPoolRecordID", targetNamespace = "http://webservice.api.ultra.neustar.com/v01/", partName = "DirectionalPoolRecordID") - @WebMethod - public java.lang.String createDirectionalRecordConfiguration( - @WebParam(partName = "transactionID", name = "transactionID") - java.lang.String transactionID, - @WebParam(partName = "dirPoolID", name = "dirPoolID") - java.lang.String dirPoolID, - @WebParam(partName = "createRegionGrouping", name = "createRegionGrouping") - java.lang.String createRegionGrouping, - @WebParam(partName = "DirectionalRecordConfiguration", name = "DirectionalRecordConfiguration") - com.neustar.ultraservice.schema.v01.DirectionalDNSRecord directionalRecordConfiguration, - @WebParam(partName = "CopyDirectionalGroup", name = "CopyDirectionalGroup") - com.neustar.ultraservice.schema.v01.CopyDirectionalGroup copyDirectionalGroup, - @WebParam(partName = "CopyAssignedDirectionalGroup", name = "CopyAssignedDirectionalGroup") - com.neustar.ultraservice.schema.v01.CopyAssignedDirDNSGroup copyAssignedDirectionalGroup, - @WebParam(partName = "DirectionalDNSGroupDetail", name = "DirectionalDNSGroupDetail") - com.neustar.ultraservice.schema.v01.DirectionalDNSGroupDetail directionalDNSGroupDetail - ) throws UltraWSException_Exception; - - @WebResult(name = "ProbesList", targetNamespace = "http://webservice.api.ultra.neustar.com/v01/", partName = "ProbesList") - @WebMethod - public com.neustar.ultraservice.schema.v01.ProbesList getProbesOfPoolRecord( - @WebParam(partName = "poolRecordID", name = "poolRecordID") - java.lang.String poolRecordID, - @WebParam(partName = "sortBy", name = "sortBy") - java.lang.String sortBy - ) throws UltraWSException_Exception; - - @WebResult(name = "AddressBookEntry", targetNamespace = "http://webservice.api.ultra.neustar.com/v01/", partName = "AddressBookEntry") - @WebMethod - public com.neustar.ultraservice.schema.v01.AddressBookEntryGet getAddressBookEntry( - @WebParam(partName = "addressBookEntryKey", name = "addressBookEntryKey") - com.neustar.ultraservice.schema.v01.AddressBookEntryKey addressBookEntryKey - ) throws UltraWSException_Exception; - - @WebResult(name = "Status", targetNamespace = "http://webservice.api.ultra.neustar.com/v01/", partName = "Status") - @WebMethod - public com.neustar.ultraservice.schema.v01.Status convertAccountGroupToPoolGroup( - @WebParam(partName = "transactionID", name = "transactionID") - java.lang.String transactionID, - @WebParam(partName = "GroupConversionDetails", name = "GroupConversionDetails") - com.neustar.ultraservice.schema.v01.AcctToPoolGroupConversionDetails groupConversionDetails - ) throws UltraWSException_Exception; - - @WebResult(name = "MailFwdRecordsList", targetNamespace = "http://webservice.api.ultra.neustar.com/v01/", partName = "MailFwdRecordsList") - @WebMethod - public com.neustar.ultraservice.schema.v01.MailFwdRecordsList queryMailForwards( - @WebParam(partName = "zoneName", name = "zoneName") - java.lang.String zoneName - ) throws UltraWSException_Exception; - - @WebResult(name = "GroupId", targetNamespace = "http://webservice.api.ultra.neustar.com/v01/", partName = "GroupId") - @WebMethod - public java.lang.String addAccountLevelDirectionalGroup( - @WebParam(partName = "transactionID", name = "transactionID") - java.lang.String transactionID, - @WebParam(partName = "CopyDirectionalGroup", name = "CopyDirectionalGroup") - com.neustar.ultraservice.schema.v01.CopyDirectionalGroup copyDirectionalGroup, - @WebParam(partName = "GlobalDirectionalGroupDetails", name = "GlobalDirectionalGroupDetails") - com.neustar.ultraservice.schema.v01.GlobalDirectionalGroupDetails globalDirectionalGroupDetails - ) throws UltraWSException_Exception; - - @WebResult(name = "ProbesList", targetNamespace = "http://webservice.api.ultra.neustar.com/v01/", partName = "ProbesList") - @WebMethod - public com.neustar.ultraservice.schema.v01.ProbesList getAllProbeNames() throws UltraWSException_Exception; - - @WebResult(name = "result", targetNamespace = "http://webservice.api.ultra.neustar.com/v01/", partName = "result") - @WebMethod - public DeleteZoneStatus deleteZoneReturningTaskId( - @WebParam(partName = "transactionID", name = "transactionID") - java.lang.String transactionID, - @WebParam(partName = "zoneName", name = "zoneName") - java.lang.String zoneName - ) throws UltraWSException_Exception; - - @WebResult(name = "TaskId", targetNamespace = "http://webservice.api.ultra.neustar.com/v01/", partName = "TaskId") - @WebMethod - public com.neustar.ultraservice.schema.v01.TaskId runTest( - @WebParam(partName = "value", name = "value") - java.lang.String value - ) throws UltraWSException_Exception; - - @WebResult(name = "Status", targetNamespace = "http://webservice.api.ultra.neustar.com/v01/", partName = "Status") - @WebMethod - public com.neustar.ultraservice.schema.v01.Status updateARPoolConfiguration( - @WebParam(partName = "id", name = "id") - com.neustar.ultraservice.schema.v01.ARPoolConfigurationKey id, - @WebParam(partName = "poolConfiguration", name = "poolConfiguration") - com.neustar.ultraservice.schema.v01.ARPoolConfigurationUpdate poolConfiguration - ) throws UltraWSException_Exception; - - @WebResult(name = "ARPoolRecordsList", targetNamespace = "http://webservice.api.ultra.neustar.com/v01/", partName = "ARPoolRecordsList") - @WebMethod - public com.neustar.ultraservice.schema.v01.ARPoolRecordsList getARPoolRecords( - @WebParam(partName = "poolRecordListKey", name = "poolRecordListKey") - com.neustar.ultraservice.schema.v01.ARPoolRecordListKey poolRecordListKey, - @WebParam(partName = "recordListParams", name = "recordListParams") - com.neustar.ultraservice.schema.v01.PoolRecordListParams recordListParams - ) throws UltraWSException_Exception; - - @WebResult(name = "result", targetNamespace = "http://webservice.api.ultra.neustar.com/v01/", partName = "result") - @WebMethod - public java.lang.String updateRecordOfRRPool( - @WebParam(partName = "transactionID", name = "transactionID") - java.lang.String transactionID, - @WebParam(partName = "resourceRecord", name = "resourceRecord") - com.neustar.ultraservice.schema.v01.UpdateRoundRobinRecord resourceRecord - ) throws UltraWSException_Exception; - - @WebResult(name = "Status", targetNamespace = "http://webservice.api.ultra.neustar.com/v01/", partName = "Status") - @WebMethod - public com.neustar.ultraservice.schema.v01.Status convertPoolGroupToAccountGroup( - @WebParam(partName = "transactionID", name = "transactionID") - java.lang.String transactionID, - @WebParam(partName = "GroupConversionDetails", name = "GroupConversionDetails") - com.neustar.ultraservice.schema.v01.PoolToAcctGroupConversionDetails groupConversionDetails - ) throws UltraWSException_Exception; - - @WebResult(name = "Status", targetNamespace = "http://webservice.api.ultra.neustar.com/v01/", partName = "Status") - @WebMethod - public com.neustar.ultraservice.schema.v01.Status updateARPoolRecordProbe( - @WebParam(partName = "id", name = "id") - com.neustar.ultraservice.schema.v01.PoolRecordProbeId id, - @WebParam(partName = "probe", name = "probe") - com.neustar.ultraservice.schema.v01.Probe probe - ) throws UltraWSException_Exception; - - @WebResult(name = "Status", targetNamespace = "http://webservice.api.ultra.neustar.com/v01/", partName = "Status") - @WebMethod - public com.neustar.ultraservice.schema.v01.Status unsuspendZone( - @WebParam(partName = "unsuspendZone", name = "unsuspendZone") - com.neustar.ultraservice.schema.v01.UnsuspendZone unsuspendZone - ) throws UltraWSException_Exception; - - @WebResult(name = "result", targetNamespace = "http://webservice.api.ultra.neustar.com/v01/", partName = "result") - @WebMethod - public java.lang.String deleteZone( - @WebParam(partName = "transactionID", name = "transactionID") - java.lang.String transactionID, - @WebParam(partName = "zoneName", name = "zoneName") - java.lang.String zoneName - ) throws UltraWSException_Exception; - - @WebResult(name = "result", targetNamespace = "http://webservice.api.ultra.neustar.com/v01/", partName = "result") - @WebMethod - public java.lang.String updatePoolRecord( - @WebParam(partName = "transactionID", name = "transactionID") - java.lang.String transactionID, - @WebParam(partName = "poolRecordID", name = "poolRecordID") - java.lang.String poolRecordID, - @WebParam(partName = "parentPoolId", name = "parentPoolId") - java.lang.String parentPoolId, - @WebParam(partName = "childPoolId", name = "childPoolId") - java.lang.String childPoolId, - @WebParam(partName = "pointsTo", name = "pointsTo") - java.lang.String pointsTo, - @WebParam(partName = "priority", name = "priority") - java.lang.String priority, - @WebParam(partName = "failOverDelay", name = "failOverDelay") - java.lang.String failOverDelay, - @WebParam(partName = "ttl", name = "ttl") - java.lang.String ttl, - @WebParam(partName = "weight", name = "weight") - java.lang.String weight, - @WebParam(partName = "mode", name = "mode") - java.lang.String mode, - @WebParam(partName = "threshold", name = "threshold") - java.lang.String threshold - ) throws UltraWSException_Exception; - - @WebResult(name = "RestrictIPList", targetNamespace = "http://webservice.api.ultra.neustar.com/v01/", partName = "RestrictIPList") - @WebMethod - public com.neustar.ultraservice.schema.v01.RestrictIPList getRestrictIP( - @WebParam(partName = "zoneName", name = "zoneName") - java.lang.String zoneName, - @WebParam(partName = "sortBy", name = "sortBy") - java.lang.String sortBy, - @WebParam(partName = "sortOrder", name = "sortOrder") - java.lang.String sortOrder - ) throws UltraWSException_Exception; - - @WebResult(name = "poolRecordID", targetNamespace = "http://webservice.api.ultra.neustar.com/v01/", partName = "poolRecordID") - @WebMethod - public java.lang.String addPoolRecord( - @WebParam(partName = "transactionID", name = "transactionID") - java.lang.String transactionID, - @WebParam(partName = "poolID", name = "poolID") - java.lang.String poolID, - @WebParam(partName = "pointsTo", name = "pointsTo") - java.lang.String pointsTo, - @WebParam(partName = "priority", name = "priority") - java.lang.String priority, - @WebParam(partName = "failOverDelay", name = "failOverDelay") - java.lang.String failOverDelay, - @WebParam(partName = "ttl", name = "ttl") - java.lang.String ttl, - @WebParam(partName = "weight", name = "weight") - java.lang.String weight, - @WebParam(partName = "mode", name = "mode") - java.lang.String mode, - @WebParam(partName = "threshold", name = "threshold") - java.lang.String threshold - ) throws UltraWSException_Exception; - - @WebResult(name = "Status", targetNamespace = "http://webservice.api.ultra.neustar.com/v01/", partName = "Status") - @WebMethod - public com.neustar.ultraservice.schema.v01.Status deleteARPoolProbe( - @WebParam(partName = "id", name = "id") - com.neustar.ultraservice.schema.v01.PoolProbeId id - ) throws UltraWSException_Exception; - - @WebResult(name = "result", targetNamespace = "http://webservice.api.ultra.neustar.com/v01/", partName = "result") - @WebMethod - public com.neustar.ultraservice.schema.v01.UserDefaultPreferences getUserDefaultPreferences() throws UltraWSException_Exception; - - @WebResult(name = "Status", targetNamespace = "http://webservice.api.ultra.neustar.com/v01/", partName = "Status") - @WebMethod - public com.neustar.ultraservice.schema.v01.Status deleteAddressBookEntry( - @WebParam(partName = "addressBookEntryKey", name = "addressBookEntryKey") - com.neustar.ultraservice.schema.v01.AddressBookEntryKey addressBookEntryKey - ) throws UltraWSException_Exception; - - @WebResult(name = "UsersOfAccount", targetNamespace = "http://webservice.api.ultra.neustar.com/v01/", partName = "UsersOfAccount") - @WebMethod - public com.neustar.ultraservice.schema.v01.UsersList getUsersOfAccount( - @WebParam(partName = "accountId", name = "accountId") - java.lang.String accountId - ) throws UltraWSException_Exception; - - @WebResult(name = "Status", targetNamespace = "http://webservice.api.ultra.neustar.com/v01/", partName = "Status") - @WebMethod - public com.neustar.ultraservice.schema.v01.Status deleteCustomHTTPHeaderOfAccount( - @WebParam(partName = "transactionID", name = "transactionID") - java.lang.String transactionID, - @WebParam(partName = "guid", name = "guid") - java.lang.String guid - ) throws UltraWSException_Exception; - - @WebResult(name = "Status", targetNamespace = "http://webservice.api.ultra.neustar.com/v01/", partName = "Status") - @WebMethod - public com.neustar.ultraservice.schema.v01.Status updateARProbeDefinition( - @WebParam(partName = "id", name = "id") - com.neustar.ultraservice.schema.v01.ProbeDefinitionId id, - @WebParam(partName = "probeDefinition", name = "probeDefinition") - com.neustar.ultraservice.schema.v01.ProbeDefinition probeDefinition - ) throws UltraWSException_Exception; - - @WebResult(name = "UltraZone", targetNamespace = "http://webservice.api.ultra.neustar.com/v01/", partName = "UltraZone") - @WebMethod - public InternalZone getSecondaryZone( - @WebParam(partName = "zoneName", name = "zoneName") - java.lang.String zoneName - ) throws UltraWSException_Exception; - - @WebResult(name = "result", targetNamespace = "http://webservice.api.ultra.neustar.com/v01/", partName = "result") - @WebMethod - public java.lang.String deleteWebForward( - @WebParam(partName = "transactionID", name = "transactionID") - java.lang.String transactionID, - @WebParam(partName = "guid", name = "guid") - java.lang.String guid - ) throws UltraWSException_Exception; - - @WebResult(name = "result", targetNamespace = "http://webservice.api.ultra.neustar.com/v01/", partName = "result") - @WebMethod - public java.lang.String setSecurityPreferences( - @WebParam(partName = "securityPreferences", name = "securityPreferences") - com.neustar.ultraservice.schema.v01.SecurityPreferences securityPreferences - ) throws UltraWSException_Exception; - - @WebResult(name = "MonitoredRDPool", targetNamespace = "http://webservice.api.ultra.neustar.com/v01/", partName = "MonitoredRDPool") - @WebMethod - public com.neustar.ultraservice.schema.v01.MonitoredRDPool getMonitoredRDPool( - @WebParam(partName = "monitoredRDPoolKey", name = "monitoredRDPoolKey") - com.neustar.ultraservice.schema.v01.MonitoredRDPoolKey monitoredRDPoolKey - ) throws UltraWSException_Exception; - - @WebResult(name = "result", targetNamespace = "http://webservice.api.ultra.neustar.com/v01/", partName = "result") - @WebMethod - public java.lang.String requestZoneTransfer( - @WebParam(partName = "transactionID", name = "transactionID") - java.lang.String transactionID, - @WebParam(partName = "zoneName", name = "zoneName") - java.lang.String zoneName, - @WebParam(partName = "primaryNameServer", name = "primaryNameServer") - java.lang.String primaryNameServer - ) throws UltraWSException_Exception; - - @WebResult(name = "RecentActivity", targetNamespace = "http://webservice.api.ultra.neustar.com/v01/", partName = "RecentActivity") - @WebMethod - public com.neustar.ultraservice.schema.v01.RecentActivityList getRecentActivityOfUser( - @WebParam(partName = "userName", name = "userName") - java.lang.String userName - ) throws UltraWSException_Exception; - - @WebResult(name = "DefaultHTTPHeaderDataList", targetNamespace = "http://webservice.api.ultra.neustar.com/v01/", partName = "DefaultHTTPHeaderDataList") - @WebMethod - public com.neustar.ultraservice.schema.v01.CustomHTTPHeaderDataList getDefaultHTTPHeaders() throws UltraWSException_Exception; - - @WebResult(name = "AllUserDetailsList", targetNamespace = "http://webservice.api.ultra.neustar.com/v01/", partName = "AllUserDetailsList") - @WebMethod - public com.neustar.ultraservice.schema.v01.AllUsersDetailsList getAllUserDetailsList() throws UltraWSException_Exception; - - @WebResult(name = "DirectionalDNSRecordDetailList", targetNamespace = "http://webservice.api.ultra.neustar.com/v01/", partName = "DirectionalDNSRecordDetailList") - @WebMethod - public com.neustar.ultraservice.schema.v01.DirectionalDNSRecordDetailList getDirectionalDNSRecordsForGroup( - @WebParam(partName = "groupName", name = "groupName") - java.lang.String groupName, - @WebParam(partName = "hostName", name = "hostName") - java.lang.String hostName, - @WebParam(partName = "zoneName", name = "zoneName") - java.lang.String zoneName, - @WebParam(partName = "poolRecordType", name = "poolRecordType") - java.lang.String poolRecordType - ) throws UltraWSException_Exception; - - @WebResult(name = "ProbeRegionList", targetNamespace = "http://webservice.api.ultra.neustar.com/v01/", partName = "ProbeRegionList") - @WebMethod - public com.neustar.ultraservice.schema.v01.ProbeRegionList getARProbeRegions() throws UltraWSException_Exception; - - @WebResult(name = "ZoneList", targetNamespace = "http://webservice.api.ultra.neustar.com/v01/", partName = "ZoneList") - @WebMethod - public com.neustar.ultraservice.schema.v01.ZoneList getZonesOfAccount( - @WebParam(partName = "accountId", name = "accountId") - java.lang.String accountId, - @WebParam(partName = "zoneType", name = "zoneType") - com.neustar.ultraservice.schema.v01.ZoneType zoneType - ) throws UltraWSException_Exception; - - @WebResult(name = "result", targetNamespace = "http://webservice.api.ultra.neustar.com/v01/", partName = "result") - @WebMethod - public java.lang.String updatePoolProbe( - @WebParam(partName = "transactionID", name = "transactionID") - java.lang.String transactionID, - @WebParam(partName = "poolProbeID", name = "poolProbeID") - java.lang.String poolProbeID, - @WebParam(partName = "probeDataType", name = "probeDataType") - java.lang.String probeDataType, - @WebParam(partName = "probeInterval", name = "probeInterval") - java.lang.String probeInterval, - @WebParam(partName = "agentThreshold", name = "agentThreshold") - java.lang.String agentThreshold, - @WebParam(partName = "agentsRunningProbeList", name = "agentsRunningProbeList") - com.neustar.ultraservice.schema.v01.AgentsRunningProbeList agentsRunningProbeList, - @WebParam(partName = "DNSProbeMaster", name = "DNSProbeMaster") - com.neustar.ultraservice.schema.v01.DNSProbeMaster dnsProbeMaster - ) throws UltraWSException_Exception; - - @WebResult(name = "result", targetNamespace = "http://webservice.api.ultra.neustar.com/v01/", partName = "result") - @WebMethod - public java.lang.String addMailMXBacker( - @WebParam(partName = "transactionId", name = "transactionId") - java.lang.String transactionId, - @WebParam(partName = "zoneName", name = "zoneName") - java.lang.String zoneName - ) throws UltraWSException_Exception; - - @WebResult(name = "Status", targetNamespace = "http://webservice.api.ultra.neustar.com/v01/", partName = "Status") - @WebMethod - public com.neustar.ultraservice.schema.v01.Status convertMonitoredRDPool( - @WebParam(partName = "conversionInfo", name = "conversionInfo") - com.neustar.ultraservice.schema.v01.MonitoredRDPoolConversionInfo conversionInfo - ) throws UltraWSException_Exception; - - @WebResult(name = "result", targetNamespace = "http://webservice.api.ultra.neustar.com/v01/", partName = "result") - @WebMethod - public java.lang.String changeRDRecordPriority( - @WebParam(partName = "transactionID", name = "transactionID") - java.lang.String transactionID, - @WebParam(partName = "rdPoolRecId", name = "rdPoolRecId") - java.lang.String rdPoolRecId, - @WebParam(partName = "newPriority", name = "newPriority") - java.lang.String newPriority - ) throws UltraWSException_Exception; - - @WebResult(name = "ResourceRecordGUIDList", targetNamespace = "http://webservice.api.ultra.neustar.com/v01/", partName = "ResourceRecordGUIDList") - @WebMethod - public com.neustar.ultraservice.schema.v01.ResourceRecordGUIDList getResourceRecordGUIDList( - @WebParam(partName = "resourceRecord", name = "resourceRecord") - com.neustar.ultraservice.schema.v01.ResourceRecordToSearch resourceRecord - ) throws UltraWSException_Exception; - - @WebResult(name = "ResourceRecordTemplate", targetNamespace = "http://webservice.api.ultra.neustar.com/v01/", partName = "ResourceRecordTemplate") - @WebMethod - public com.neustar.ultraservice.schema.v01.ResourceRecordTemplate getResourceRecordTemplate( - @WebParam(partName = "recordType", name = "recordType") - java.lang.String recordType - ) throws UltraWSException_Exception; - - @WebResult(name = "SBAgentsList", targetNamespace = "http://webservice.api.ultra.neustar.com/v01/", partName = "SBAgentsList") - @WebMethod - public com.neustar.ultraservice.schema.v01.SBAgentsList getSBAgentsForRegionName( - @WebParam(partName = "regionName", name = "regionName") - java.lang.String regionName, - @WebParam(partName = "probeName", name = "probeName") - java.lang.String probeName - ) throws UltraWSException_Exception; - - @WebResult(name = "DirPoolID", targetNamespace = "http://webservice.api.ultra.neustar.com/v01/", partName = "DirPoolID") - @WebMethod - public java.lang.String createDirectionalPool( - @WebParam(partName = "transactionID", name = "transactionID") - java.lang.String transactionID, - @WebParam(partName = "zoneName", name = "zoneName") - java.lang.String zoneName, - @WebParam(partName = "hostName", name = "hostName") - java.lang.String hostName, - @WebParam(partName = "poolRecordType", name = "poolRecordType") - java.lang.String poolRecordType, - @WebParam(partName = "rrGuid", name = "rrGuid") - java.lang.String rrGuid, - @WebParam(partName = "createRegionGrouping", name = "createRegionGrouping") - java.lang.String createRegionGrouping, - @WebParam(partName = "CopyDirectionalGroup", name = "CopyDirectionalGroup") - com.neustar.ultraservice.schema.v01.CopyDirectionalGroup copyDirectionalGroup, - @WebParam(partName = "DirectionalDNSGroupDetail", name = "DirectionalDNSGroupDetail") - com.neustar.ultraservice.schema.v01.DirectionalDNSGroupDetail directionalDNSGroupDetail - ) throws UltraWSException_Exception; - - @WebResult(name = "result", targetNamespace = "http://webservice.api.ultra.neustar.com/v01/", partName = "result") - @WebMethod - public com.neustar.ultraservice.schema.v01.NameServerIPs getPrimaryNameServerIPs( - @WebParam(partName = "zoneName", name = "zoneName") - java.lang.String zoneName - ) throws UltraWSException_Exception; - - @WebResult(name = "AliasedDomainInfo", targetNamespace = "http://webservice.api.ultra.neustar.com/v01/", partName = "AliasedDomainInfo") - @WebMethod - public com.neustar.ultraservice.schema.v01.AliasedDomainInfo getWHOISInfoForDomain( - @WebParam(partName = "zoneName", name = "zoneName") - java.lang.String zoneName - ) throws UltraWSException_Exception; - - @WebResult(name = "ProbesList", targetNamespace = "http://webservice.api.ultra.neustar.com/v01/", partName = "ProbesList") - @WebMethod - public com.neustar.ultraservice.schema.v01.ProbesList getProbesOfPool( - @WebParam(partName = "poolID", name = "poolID") - java.lang.String poolID, - @WebParam(partName = "probeType", name = "probeType") - com.neustar.ultraservice.schema.v01.ProbeType probeType, - @WebParam(partName = "sortBy", name = "sortBy") - java.lang.String sortBy - ) throws UltraWSException_Exception; - - @WebResult(name = "TaskStatusList", targetNamespace = "http://webservice.api.ultra.neustar.com/v01/", partName = "TaskStatusList") - @WebMethod - public com.neustar.ultraservice.schema.v01.TaskStatusList getAllTasks() throws UltraWSException_Exception; - - @WebResult(name = "poolProbeID", targetNamespace = "http://webservice.api.ultra.neustar.com/v01/", partName = "poolProbeID") - @WebMethod - public java.lang.String addPoolProbe( - @WebParam(partName = "transactionID", name = "transactionID") - java.lang.String transactionID, - @WebParam(partName = "poolID", name = "poolID") - java.lang.String poolID, - @WebParam(partName = "poolRecordID", name = "poolRecordID") - java.lang.String poolRecordID, - @WebParam(partName = "probeDataType", name = "probeDataType") - java.lang.String probeDataType, - @WebParam(partName = "probeInterval", name = "probeInterval") - java.lang.String probeInterval, - @WebParam(partName = "agentThreshold", name = "agentThreshold") - java.lang.String agentThreshold, - @WebParam(partName = "agentsRunningProbeList", name = "agentsRunningProbeList") - com.neustar.ultraservice.schema.v01.AgentsRunningProbeList agentsRunningProbeList, - @WebParam(partName = "DNSProbeMaster", name = "DNSProbeMaster") - com.neustar.ultraservice.schema.v01.DNSProbeMaster dnsProbeMaster - ) throws UltraWSException_Exception; - - @WebResult(name = "result", targetNamespace = "http://webservice.api.ultra.neustar.com/v01/", partName = "result") - @WebMethod - public java.lang.String removeRestrictIP( - @WebParam(partName = "transactionID", name = "transactionID") - java.lang.String transactionID, - @WebParam(partName = "zoneName", name = "zoneName") - java.lang.String zoneName, - @WebParam(partName = "startIP", name = "startIP") - java.lang.String startIP, - @WebParam(partName = "endIP", name = "endIP") - java.lang.String endIP - ) throws UltraWSException_Exception; - - @WebResult(name = "GeneralZoneProperties", targetNamespace = "http://webservice.api.ultra.neustar.com/v01/", partName = "GeneralZoneProperties") - @WebMethod - public com.neustar.ultraservice.schema.v01.GeneralZoneProperties getGeneralPropertiesForZone( - @WebParam(partName = "zoneName", name = "zoneName") - java.lang.String zoneName - ) throws UltraWSException_Exception; - - @WebResult(name = "result", targetNamespace = "http://webservice.api.ultra.neustar.com/v01/", partName = "result") - @WebMethod - public java.lang.String setAccountsNotificationStatus( - @WebParam(partName = "accountLevelNotificationList", name = "accountLevelNotificationList") - com.neustar.ultraservice.schema.v01.AccountLevelNotificationsList accountLevelNotificationList - ) throws UltraWSException_Exception; - - @WebResult(name = "Status", targetNamespace = "http://webservice.api.ultra.neustar.com/v01/", partName = "Status") - @WebMethod - public com.neustar.ultraservice.schema.v01.Status deleteARPool( - @WebParam(partName = "zoneName", name = "zoneName") - java.lang.String zoneName, - @WebParam(partName = "poolName", name = "poolName") - java.lang.String poolName - ) throws UltraWSException_Exception; - - @WebResult(name = "SimpleFailoverPool", targetNamespace = "http://webservice.api.ultra.neustar.com/v01/", partName = "SimpleFailoverPool") - @WebMethod - public com.neustar.ultraservice.schema.v01.SimpleFailoverPool getSimpleFailoverPool( - @WebParam(partName = "zoneName", name = "zoneName") - java.lang.String zoneName, - @WebParam(partName = "hostName", name = "hostName") - java.lang.String hostName - ) throws UltraWSException_Exception; - - @WebResult(name = "WebFwdRecordsList", targetNamespace = "http://webservice.api.ultra.neustar.com/v01/", partName = "WebFwdRecordsList") - @WebMethod - public com.neustar.ultraservice.schema.v01.WebFwdRecordsList queryWebForwards( - @WebParam(partName = "zoneName", name = "zoneName") - java.lang.String zoneName - ) throws UltraWSException_Exception; - - @WebResult(name = "result", targetNamespace = "http://webservice.api.ultra.neustar.com/v01/", partName = "result") - @WebMethod - public java.lang.String updateDirectionalPool( - @WebParam(partName = "transactionID", name = "transactionID") - java.lang.String transactionID, - @WebParam(partName = "UpdateDirectionalPoolData", name = "UpdateDirectionalPoolData") - com.neustar.ultraservice.schema.v01.UpdateDirectionalPoolData updateDirectionalPoolData - ) throws UltraWSException_Exception; - - @WebResult(name = "Status", targetNamespace = "http://webservice.api.ultra.neustar.com/v01/", partName = "Status") - @WebMethod - public com.neustar.ultraservice.schema.v01.Status deleteWebForwardPoolRecord( - @WebParam(partName = "transactionID", name = "transactionID") - java.lang.String transactionID, - @WebParam(partName = "guid", name = "guid") - java.lang.String guid - ) throws UltraWSException_Exception; - - @WebResult(name = "result", targetNamespace = "http://webservice.api.ultra.neustar.com/v01/", partName = "result") - @WebMethod - public java.lang.String updateLBPool( - @WebParam(partName = "transactionId", name = "transactionId") - java.lang.String transactionId, - @WebParam(partName = "lbPoolID", name = "lbPoolID") - java.lang.String lbPoolID, - @WebParam(partName = "description", name = "description") - java.lang.String description, - @WebParam(partName = "failOver", name = "failOver") - java.lang.String failOver, - @WebParam(partName = "probing", name = "probing") - java.lang.String probing, - @WebParam(partName = "maxActive", name = "maxActive") - java.lang.String maxActive, - @WebParam(partName = "poolType", name = "poolType") - java.lang.String poolType - ) throws UltraWSException_Exception; - - @WebResult(name = "result", targetNamespace = "http://webservice.api.ultra.neustar.com/v01/", partName = "result") - @WebMethod - public java.lang.String deleteRecordOfRRPool( - @WebParam(partName = "transactionID", name = "transactionID") - java.lang.String transactionID, - @WebParam(partName = "guid", name = "guid") - java.lang.String guid - ) throws UltraWSException_Exception; - - @WebResult(name = "Status", targetNamespace = "http://webservice.api.ultra.neustar.com/v01/", partName = "Status") - @WebMethod - public com.neustar.ultraservice.schema.v01.Status failoverSimpleFailoverPool( - @WebParam(partName = "zoneName", name = "zoneName") - java.lang.String zoneName, - @WebParam(partName = "hostName", name = "hostName") - java.lang.String hostName - ) throws UltraWSException_Exception; - - @WebResult(name = "result", targetNamespace = "http://webservice.api.ultra.neustar.com/v01/", partName = "result") - @WebMethod - public boolean unsignZone( - @WebParam(partName = "zoneName", name = "zoneName") - java.lang.String zoneName - ) throws UltraWSException_Exception; - - @WebMethod - public void updateAccountNameInfo( - @WebParam(partName = "transactionID", name = "transactionID") - java.lang.String transactionID, - @WebParam(partName = "accountID", mode = WebParam.Mode.INOUT, name = "accountID") - javax.xml.ws.Holder accountID, - @WebParam(partName = "accountName", name = "accountName") - java.lang.String accountName - ) throws UltraWSException_Exception; - - @WebResult(name = "result", targetNamespace = "http://webservice.api.ultra.neustar.com/v01/", partName = "result") - @WebMethod - public java.lang.String updateResourceRecord( - @WebParam(partName = "transactionID", name = "transactionID") - java.lang.String transactionID, - @WebParam(partName = "resourceRecord", name = "resourceRecord") - com.neustar.ultraservice.schema.v01.ResourceRecordToUpdate resourceRecord - ) throws UltraWSException_Exception; - - @WebResult(name = "result", targetNamespace = "http://webservice.api.ultra.neustar.com/v01/", partName = "result") - @WebMethod - public java.lang.String addPoolNotificationOfEmail( - @WebParam(partName = "transactionId", name = "transactionId") - java.lang.String transactionId, - @WebParam(partName = "poolID", name = "poolID") - java.lang.String poolID, - @WebParam(partName = "email", name = "email") - java.lang.String email - ) throws UltraWSException_Exception; - - @WebResult(name = "result", targetNamespace = "http://webservice.api.ultra.neustar.com/v01/", partName = "result") - @WebMethod - public boolean queryPendingChanges( - @WebParam(partName = "zoneName", name = "zoneName") - java.lang.String zoneName - ) throws UltraWSException_Exception; - - @WebResult(name = "Status", targetNamespace = "http://webservice.api.ultra.neustar.com/v01/", partName = "Status") - @WebMethod - public com.neustar.ultraservice.schema.v01.Status updateARAllFailPoolRecord( - @WebParam(partName = "id", name = "id") - com.neustar.ultraservice.schema.v01.PoolRecordId id, - @WebParam(partName = "update", name = "update") - com.neustar.ultraservice.schema.v01.PoolRecordUpdate update - ) throws UltraWSException_Exception; - - @WebResult(name = "Status", targetNamespace = "http://webservice.api.ultra.neustar.com/v01/", partName = "Status") - @WebMethod - public com.neustar.ultraservice.schema.v01.Status clearTask( - @WebParam(partName = "id", name = "id") - com.neustar.ultraservice.schema.v01.TaskId id - ) throws UltraWSException_Exception; - - @WebResult(name = "Status", targetNamespace = "http://webservice.api.ultra.neustar.com/v01/", partName = "Status") - @WebMethod - public com.neustar.ultraservice.schema.v01.Status convertRDPool( - @WebParam(partName = "rDPoolConversionInfo", name = "rDPoolConversionInfo") - com.neustar.ultraservice.schema.v01.RDPoolConversionInfo rDPoolConversionInfo - ) throws UltraWSException_Exception; - - @WebResult(name = "result", targetNamespace = "http://webservice.api.ultra.neustar.com/v01/", partName = "result") - @WebMethod - public java.lang.String createAliasZone( - @WebParam(partName = "transactionID", name = "transactionID") - java.lang.String transactionID, - @WebParam(partName = "accountId", name = "accountId") - java.lang.String accountId, - @WebParam(partName = "zoneName", name = "zoneName") - java.lang.String zoneName, - @WebParam(partName = "parentZoneName", name = "parentZoneName") - java.lang.String parentZoneName - ) throws UltraWSException_Exception; - - @WebResult(name = "NotificationList", targetNamespace = "http://webservice.api.ultra.neustar.com/v01/", partName = "NotificationList") - @WebMethod - public com.neustar.ultraservice.schema.v01.NotificationList getNotificationsOfPool( - @WebParam(partName = "poolId", name = "poolId") - java.lang.String poolId - ) throws UltraWSException_Exception; - - @WebResult(name = "DirectionalDNSGroupDetail", targetNamespace = "http://webservice.api.ultra.neustar.com/v01/", partName = "DirectionalDNSGroupDetail") - @WebMethod - public com.neustar.ultraservice.schema.v01.DirectionalDNSGroupDetail getDirectionalDNSGroupDetails( - @WebParam(partName = "GroupId", name = "GroupId") - java.lang.String groupId - ) throws UltraWSException_Exception; - - @WebResult(name = "Status", targetNamespace = "http://webservice.api.ultra.neustar.com/v01/", partName = "Status") - @WebMethod - public com.neustar.ultraservice.schema.v01.Status attachContactToARPoolRule( - @WebParam(partName = "contactARPoolRuleInfo", name = "contactARPoolRuleInfo") - com.neustar.ultraservice.schema.v01.ContactARPoolRuleInfo contactARPoolRuleInfo - ) throws UltraWSException_Exception; - - @WebResult(name = "result", targetNamespace = "http://webservice.api.ultra.neustar.com/v01/", partName = "result") - @WebMethod - public java.lang.String deleteMailForward( - @WebParam(partName = "transactionID", name = "transactionID") - java.lang.String transactionID, - @WebParam(partName = "guid", name = "guid") - java.lang.String guid - ) throws UltraWSException_Exception; - - @WebResult(name = "CustomHTTPHeaderDataList", targetNamespace = "http://webservice.api.ultra.neustar.com/v01/", partName = "CustomHTTPHeaderDataList") - @WebMethod - public com.neustar.ultraservice.schema.v01.CustomHTTPHeaderDataList getCustomHTTPHeadersOfAccount( - @WebParam(partName = "accountID", name = "accountID") - java.lang.String accountID - ) throws UltraWSException_Exception; - - @WebResult(name = "result", targetNamespace = "http://webservice.api.ultra.neustar.com/v01/", partName = "result") - @WebMethod - public boolean signZone( - @WebParam(partName = "zoneName", name = "zoneName") - java.lang.String zoneName - ) throws UltraWSException_Exception; - - @WebResult(name = "result", targetNamespace = "http://webservice.api.ultra.neustar.com/v01/", partName = "result") - @WebMethod - public java.lang.String createSecondaryZone( - @WebParam(partName = "transactionID", name = "transactionID") - java.lang.String transactionID, - @WebParam(partName = "accountId", name = "accountId") - java.lang.String accountId, - @WebParam(partName = "zoneName", name = "zoneName") - java.lang.String zoneName, - @WebParam(partName = "isTsigEnable", name = "isTsigEnable") - boolean isTsigEnable, - @WebParam(partName = "primaryNameServer", name = "primaryNameServer") - java.lang.String primaryNameServer, - @WebParam(partName = "tsigName1", name = "tsigName1") - java.lang.String tsigName1, - @WebParam(partName = "tsigSecret1", name = "tsigSecret1") - java.lang.String tsigSecret1, - @WebParam(partName = "primaryNameServerIP2", name = "primaryNameServerIP2") - java.lang.String primaryNameServerIP2, - @WebParam(partName = "tsigName2", name = "tsigName2") - java.lang.String tsigName2, - @WebParam(partName = "tsigSecret2", name = "tsigSecret2") - java.lang.String tsigSecret2, - @WebParam(partName = "primaryNameServerIP3", name = "primaryNameServerIP3") - java.lang.String primaryNameServerIP3, - @WebParam(partName = "tsigName3", name = "tsigName3") - java.lang.String tsigName3, - @WebParam(partName = "tsigSecret3", name = "tsigSecret3") - java.lang.String tsigSecret3 - ) throws UltraWSException_Exception; - - @WebResult(name = "Status", targetNamespace = "http://webservice.api.ultra.neustar.com/v01/", partName = "Status") - @WebMethod - public com.neustar.ultraservice.schema.v01.Status deleteARAllFailPoolRecord( - @WebParam(partName = "id", name = "id") - com.neustar.ultraservice.schema.v01.PoolRecordId id - ) throws UltraWSException_Exception; - - @WebResult(name = "ScheduledEvent", targetNamespace = "http://webservice.api.ultra.neustar.com/v01/", partName = "ScheduledEvent") - @WebMethod - public com.neustar.ultraservice.schema.v01.ScheduledEvent getScheduledEventDetailById( - @WebParam(partName = "guid", name = "guid") - java.lang.String guid - ) throws UltraWSException_Exception; - - @WebResult(name = "AccountInfoData", targetNamespace = "http://webservice.api.ultra.neustar.com/v01/", partName = "AccountInfoData") - @WebMethod - public com.neustar.ultraservice.schema.v01.AccountInfoData getAccountInfoDetails( - @WebParam(partName = "accountName", name = "accountName") - java.lang.String accountName - ) throws UltraWSException_Exception; - - @WebResult(name = "Status", targetNamespace = "http://webservice.api.ultra.neustar.com/v01/", partName = "Status") - @WebMethod - public com.neustar.ultraservice.schema.v01.Status updateSimpleFailoverPool( - @WebParam(partName = "zoneName", name = "zoneName") - java.lang.String zoneName, - @WebParam(partName = "hostName", name = "hostName") - java.lang.String hostName, - @WebParam(partName = "simpleFailoverPoolUpdate", name = "simpleFailoverPoolUpdate") - com.neustar.ultraservice.schema.v01.SimpleFailoverPoolUpdate simpleFailoverPoolUpdate - ) throws UltraWSException_Exception; - - @WebResult(name = "result", targetNamespace = "http://webservice.api.ultra.neustar.com/v01/", partName = "result") - @WebMethod - public java.lang.String updatePoolNotificationOfEmail( - @WebParam(partName = "transactionId", name = "transactionId") - java.lang.String transactionId, - @WebParam(partName = "poolId", name = "poolId") - java.lang.String poolId, - @WebParam(partName = "poolNotifyId", name = "poolNotifyId") - java.lang.String poolNotifyId, - @WebParam(partName = "notifyRecordList", name = "notifyRecordList") - com.neustar.ultraservice.schema.v01.NotifyRecordList notifyRecordList - ) throws UltraWSException_Exception; - - @WebResult(name = "result", targetNamespace = "http://webservice.api.ultra.neustar.com/v01/", partName = "result") - @WebMethod - public java.lang.String updateLBPoolRD( - @WebParam(partName = "transactionId", name = "transactionId") - java.lang.String transactionId, - @WebParam(partName = "lbPoolID", name = "lbPoolID") - java.lang.String lbPoolID, - @WebParam(partName = "description", name = "description") - java.lang.String description, - @WebParam(partName = "failOver", name = "failOver") - java.lang.String failOver, - @WebParam(partName = "probing", name = "probing") - java.lang.String probing, - @WebParam(partName = "responseMethod", name = "responseMethod") - java.lang.String responseMethod, - @WebParam(partName = "maxResponse", name = "maxResponse") - java.lang.String maxResponse, - @WebParam(partName = "maxActive", name = "maxActive") - java.lang.String maxActive, - @WebParam(partName = "poolType", name = "poolType") - java.lang.String poolType - ) throws UltraWSException_Exception; - - @WebResult(name = "result", targetNamespace = "http://webservice.api.ultra.neustar.com/v01/", partName = "result") - @WebMethod - public java.lang.String addRestrictIP( - @WebParam(partName = "transactionID", name = "transactionID") - java.lang.String transactionID, - @WebParam(partName = "zoneName", name = "zoneName") - java.lang.String zoneName, - @WebParam(partName = "startIP", name = "startIP") - java.lang.String startIP, - @WebParam(partName = "endIP", name = "endIP") - java.lang.String endIP, - @WebParam(partName = "tsigKey", name = "tsigKey") - java.lang.String tsigKey, - @WebParam(partName = "tsigKeyValue", name = "tsigKeyValue") - java.lang.String tsigKeyValue, - @WebParam(partName = "comment", name = "comment") - java.lang.String comment - ) throws UltraWSException_Exception; - - @WebResult(name = "Rules", targetNamespace = "http://webservice.api.ultra.neustar.com/v01/", partName = "Rules") - @WebMethod - public com.neustar.ultraservice.schema.v01.Rules getPoolConfigurationRules( - @WebParam(partName = "poolName", name = "poolName") - java.lang.String poolName, - @WebParam(partName = "configurationName", name = "configurationName") - java.lang.String configurationName - ) throws UltraWSException_Exception; - - @WebResult(name = "PoolRecordSpecData", targetNamespace = "http://webservice.api.ultra.neustar.com/v01/", partName = "PoolRecordSpecData") - @WebMethod - public com.neustar.ultraservice.schema.v01.PoolRecordSpecData getPoolRecordSpec( - @WebParam(partName = "poolRecordId", name = "poolRecordId") - java.lang.String poolRecordId - ) throws UltraWSException_Exception; - - @WebResult(name = "result", targetNamespace = "http://webservice.api.ultra.neustar.com/v01/", partName = "result") - @WebMethod - public java.lang.String getNumberOfRegionsUndefinedForHost( - @WebParam(partName = "hostName", name = "hostName") - java.lang.String hostName, - @WebParam(partName = "zoneName", name = "zoneName") - java.lang.String zoneName, - @WebParam(partName = "rrType", name = "rrType") - java.lang.String rrType - ) throws UltraWSException_Exception; - - @WebResult(name = "SBRegionsList", targetNamespace = "http://webservice.api.ultra.neustar.com/v01/", partName = "SBRegionsList") - @WebMethod - public com.neustar.ultraservice.schema.v01.SBRegionsList getSBRegions() throws UltraWSException_Exception; - - @WebResult(name = "ARProbeDefinitionList", targetNamespace = "http://webservice.api.ultra.neustar.com/v01/", partName = "ARProbeDefinitionList") - @WebMethod - public com.neustar.ultraservice.schema.v01.ProbeDefinitionList getARProbeDefinitions( - @WebParam(partName = "accountName", name = "accountName") - java.lang.String accountName - ) throws UltraWSException_Exception; - - @WebResult(name = "UltraZone", targetNamespace = "http://webservice.api.ultra.neustar.com/v01/", partName = "UltraZone") - @WebMethod - public com.neustar.ultraservice.schema.v01.UltraZone getZoneInfo( - @WebParam(partName = "zoneName", name = "zoneName") - java.lang.String zoneName - ) throws UltraWSException_Exception; - - @WebResult(name = "result", targetNamespace = "http://webservice.api.ultra.neustar.com/v01/", partName = "result") - @WebMethod - public java.lang.String deletePoolRecord( - @WebParam(partName = "transactionID", name = "transactionID") - java.lang.String transactionID, - @WebParam(partName = "poolRecordID", name = "poolRecordID") - java.lang.String poolRecordID, - @WebParam(partName = "parentPoolId", name = "parentPoolId") - java.lang.String parentPoolId, - @WebParam(partName = "childPoolId", name = "childPoolId") - java.lang.String childPoolId - ) throws UltraWSException_Exception; - - @WebResult(name = "guid", targetNamespace = "http://webservice.api.ultra.neustar.com/v01/", partName = "guid") - @WebMethod - public java.lang.String createNoneResourceRecord( - @WebParam(partName = "transactionID", name = "transactionID") - java.lang.String transactionID, - @WebParam(partName = "resourceRecord", name = "resourceRecord") - com.neustar.ultraservice.schema.v01.ResourceRecordToCreate resourceRecord - ) throws UltraWSException_Exception; - - @WebResult(name = "Status", targetNamespace = "http://webservice.api.ultra.neustar.com/v01/", partName = "Status") - @WebMethod - public com.neustar.ultraservice.schema.v01.Status deleteSimpleFailoverPool( - @WebParam(partName = "zoneName", name = "zoneName") - java.lang.String zoneName, - @WebParam(partName = "hostName", name = "hostName") - java.lang.String hostName - ) throws UltraWSException_Exception; - - @WebResult(name = "ResourceRecordList", targetNamespace = "http://webservice.api.ultra.neustar.com/v01/", partName = "ResourceRecordList") - @WebMethod - public com.neustar.ultraservice.schema.v01.ResourceRecordList getRRPoolRecords( - @WebParam(partName = "lbPoolId", name = "lbPoolId") - java.lang.String lbPoolId - ) throws UltraWSException_Exception; - - @WebResult(name = "result", targetNamespace = "http://webservice.api.ultra.neustar.com/v01/", partName = "result") - @WebMethod - public java.lang.String setGeneralNotificationStatus( - @WebParam(partName = "GeneralNotificationStatusList", name = "GeneralNotificationStatusList") - com.neustar.ultraservice.schema.v01.GeneralNotificationStatusList generalNotificationStatusList - ) throws UltraWSException_Exception; - - @WebResult(name = "SimpleFailoverPoolList", targetNamespace = "http://webservice.api.ultra.neustar.com/v01/", partName = "SimpleFailoverPoolList") - @WebMethod - public com.neustar.ultraservice.schema.v01.SimpleFailoverPoolList getAllSimpleFailoverPools( - @WebParam(partName = "zoneName", name = "zoneName") - java.lang.String zoneName, - @WebParam(partName = "poolListParams", name = "poolListParams") - com.neustar.ultraservice.schema.v01.PoolListParams poolListParams - ) throws UltraWSException_Exception; - - @WebResult(name = "result", targetNamespace = "http://webservice.api.ultra.neustar.com/v01/", partName = "result") - @WebMethod - public java.lang.String updateDirectionalPoolRecord( - @WebParam(partName = "transactionID", name = "transactionID") - java.lang.String transactionID, - @WebParam(partName = "UpdateDirectionalRecordData", name = "UpdateDirectionalRecordData") - com.neustar.ultraservice.schema.v01.UpdateDirectionalRecordData updateDirectionalRecordData - ) throws UltraWSException_Exception; - - @WebResult(name = "Status", targetNamespace = "http://webservice.api.ultra.neustar.com/v01/", partName = "Status") - @WebMethod - public com.neustar.ultraservice.schema.v01.Status deleteAccountLevelDirectionalGroup( - @WebParam(partName = "transactionID", name = "transactionID") - java.lang.String transactionID, - @WebParam(partName = "GroupId", name = "GroupId") - java.lang.String groupId - ) throws UltraWSException_Exception; - - @WebResult(name = "NeustarNetworkStatus", targetNamespace = "http://webservice.api.ultra.neustar.com/v01/", partName = "NeustarNetworkStatus") - @WebMethod - public java.lang.String getNeustarNetworkStatus() throws UltraWSException_Exception; - - @WebResult(name = "Status", targetNamespace = "http://webservice.api.ultra.neustar.com/v01/", partName = "Status") - @WebMethod - public com.neustar.ultraservice.schema.v01.Status addARPoolRecordProbe( - @WebParam(partName = "id", name = "id") - com.neustar.ultraservice.schema.v01.PoolRecordId id, - @WebParam(partName = "probe", name = "probe") - com.neustar.ultraservice.schema.v01.Probe probe - ) throws UltraWSException_Exception; - - @WebResult(name = "Status", targetNamespace = "http://webservice.api.ultra.neustar.com/v01/", partName = "Status") - @WebMethod - public com.neustar.ultraservice.schema.v01.Status addMonitoredRDPool( - @WebParam(partName = "monitoredRDPool", name = "monitoredRDPool") - com.neustar.ultraservice.schema.v01.MonitoredRDPoolAdd monitoredRDPool - ) throws UltraWSException_Exception; - - @WebResult(name = "result", targetNamespace = "http://webservice.api.ultra.neustar.com/v01/", partName = "result") - @WebMethod - public java.lang.String promoteSecondaryZoneToPrimaryZone( - @WebParam(partName = "transactionID", name = "transactionID") - java.lang.String transactionID, - @WebParam(partName = "zoneName", name = "zoneName") - java.lang.String zoneName - ) throws UltraWSException_Exception; - - @WebResult(name = "result", targetNamespace = "http://webservice.api.ultra.neustar.com/v01/", partName = "result") - @WebMethod - public java.lang.String updateMailForward( - @WebParam(partName = "transactionID", name = "transactionID") - java.lang.String transactionID, - @WebParam(partName = "guid", name = "guid") - java.lang.String guid, - @WebParam(partName = "emailTo", name = "emailTo") - java.lang.String emailTo, - @WebParam(partName = "forwardTo", name = "forwardTo") - java.lang.String forwardTo - ) throws UltraWSException_Exception; - - @WebResult(name = "result", targetNamespace = "http://webservice.api.ultra.neustar.com/v01/", partName = "result") - @WebMethod - public java.lang.String updateDirectionalDNSGroup( - @WebParam(partName = "transactionID", name = "transactionID") - java.lang.String transactionID, - @WebParam(partName = "dirPoolRecordId", name = "dirPoolRecordId") - java.lang.String dirPoolRecordId, - @WebParam(partName = "DirectionalDNSGroupDetail", name = "DirectionalDNSGroupDetail") - com.neustar.ultraservice.schema.v01.DirectionalDNSGroupDetail directionalDNSGroupDetail - ) throws UltraWSException_Exception; - - @WebResult(name = "AllStatesList", targetNamespace = "http://webservice.api.ultra.neustar.com/v01/", partName = "AllStatesList") - @WebMethod - public com.neustar.ultraservice.schema.v01.AllStatesList getStatesByCountry( - @WebParam(partName = "countryId", name = "countryId") - long countryId - ) throws UltraWSException_Exception; - - @WebResult(name = "DomainAlertsOfUser", targetNamespace = "http://webservice.api.ultra.neustar.com/v01/", partName = "DomainAlertsOfUser") - @WebMethod - public com.neustar.ultraservice.schema.v01.AlertSummaryList getDomainAlertsOfUser() throws UltraWSException_Exception; - - @WebResult(name = "DirectionalDNSRecordDetailList", targetNamespace = "http://webservice.api.ultra.neustar.com/v01/", partName = "DirectionalDNSRecordDetailList") - @WebMethod - public com.neustar.ultraservice.schema.v01.DirectionalDNSRecordDetailList getDirectionalDNSRecordsForAcctLvlGroup( - @WebParam(partName = "groupId", name = "groupId") - java.lang.String groupId - ) throws UltraWSException_Exception; - - @WebResult(name = "Status", targetNamespace = "http://webservice.api.ultra.neustar.com/v01/", partName = "Status") - @WebMethod - public com.neustar.ultraservice.schema.v01.Status addARPoolRecord( - @WebParam(partName = "poolRecord", name = "poolRecord") - com.neustar.ultraservice.schema.v01.ARPoolRecord poolRecord - ) throws UltraWSException_Exception; - - @WebResult(name = "result", targetNamespace = "http://webservice.api.ultra.neustar.com/v01/", partName = "result") - @WebMethod - public com.neustar.ultraservice.schema.v01.ZoneInfoList getRegistrarForDomain( - @WebParam(partName = "zoneName", name = "zoneName") - java.lang.String zoneName - ) throws UltraWSException_Exception; - - @WebResult(name = "ProbeAlertsList", targetNamespace = "http://webservice.api.ultra.neustar.com/v01/", partName = "ProbeAlertsList") - @WebMethod - public com.neustar.ultraservice.schema.v01.ProbeAlertsList getProbeAlerts( - @WebParam(partName = "poolId", name = "poolId") - java.lang.String poolId - ) throws UltraWSException_Exception; - - @WebResult(name = "Status", targetNamespace = "http://webservice.api.ultra.neustar.com/v01/", partName = "Status") - @WebMethod - public com.neustar.ultraservice.schema.v01.Status deleteARProbeDefinition( - @WebParam(partName = "id", name = "id") - com.neustar.ultraservice.schema.v01.ProbeDefinitionId id - ) throws UltraWSException_Exception; - - @WebResult(name = "RRPoolID", targetNamespace = "http://webservice.api.ultra.neustar.com/v01/", partName = "RRPoolID") - @WebMethod - public java.lang.String addRRLBPool( - @WebParam(partName = "transactionID", name = "transactionID") - java.lang.String transactionID, - @WebParam(partName = "zoneName", name = "zoneName") - java.lang.String zoneName, - @WebParam(partName = "hostName", name = "hostName") - java.lang.String hostName, - @WebParam(partName = "description", name = "description") - java.lang.String description, - @WebParam(partName = "poolRecordType", name = "poolRecordType") - java.lang.String poolRecordType, - @WebParam(partName = "rrGUID", name = "rrGUID") - java.lang.String rrGUID - ) throws UltraWSException_Exception; - - @WebResult(name = "WebForwardPoolRecordDataList", targetNamespace = "http://webservice.api.ultra.neustar.com/v01/", partName = "WebForwardPoolRecordDataList") - @WebMethod - public com.neustar.ultraservice.schema.v01.WebForwardPoolRecordDataList getWebForwardPoolRecords( - @WebParam(partName = "guid", name = "guid") - java.lang.String guid - ) throws UltraWSException_Exception; - - @WebResult(name = "ARProbeDefinitionList", targetNamespace = "http://webservice.api.ultra.neustar.com/v01/", partName = "ARProbeDefinitionList") - @WebMethod - public com.neustar.ultraservice.schema.v01.ProbeDefinitionList getARProbeDefinition( - @WebParam(partName = "id", name = "id") - com.neustar.ultraservice.schema.v01.ProbeDefinitionId id - ) throws UltraWSException_Exception; - - @WebResult(name = "UserDetails", targetNamespace = "http://webservice.api.ultra.neustar.com/v01/", partName = "UserDetails") - @WebMethod - public com.neustar.ultraservice.schema.v01.UserDetailsPermissionData getUserDetails( - @WebParam(partName = "userName", name = "userName") - java.lang.String userName, - @WebParam(partName = "accountId", name = "accountId") - java.lang.String accountId - ) throws UltraWSException_Exception; - - @WebResult(name = "result", targetNamespace = "http://webservice.api.ultra.neustar.com/v01/", partName = "result") - @WebMethod - public java.lang.String deleteMailBlock( - @WebParam(partName = "transactionID", name = "transactionID") - java.lang.String transactionID, - @WebParam(partName = "guid", name = "guid") - java.lang.String guid - ) throws UltraWSException_Exception; - - @WebResult(name = "result", targetNamespace = "http://webservice.api.ultra.neustar.com/v01/", partName = "result") - @WebMethod - public java.lang.String saveAccountPreferences( - @WebParam(partName = "accountID", name = "accountID") - java.lang.String accountID, - @WebParam(partName = "accountPreferencesList", name = "accountPreferencesList") - com.neustar.ultraservice.schema.v01.AccountPreferencesList accountPreferencesList, - @WebParam(partName = "safeUpdateEnabled", name = "safeUpdateEnabled") - boolean safeUpdateEnabled, - @WebParam(partName = "safeUpdateDuration", name = "safeUpdateDuration") - java.lang.String safeUpdateDuration - ) throws UltraWSException_Exception; - - @WebResult(name = "ScheduledEventList", targetNamespace = "http://webservice.api.ultra.neustar.com/v01/", partName = "ScheduledEventList") - @WebMethod - public com.neustar.ultraservice.schema.v01.ScheduledEventList getScheduledEventsOfPool( - @WebParam(partName = "poolId", name = "poolId") - java.lang.String poolId, - @WebParam(partName = "sortBy", name = "sortBy") - java.lang.String sortBy - ) throws UltraWSException_Exception; - - @WebResult(name = "DnssecKeyRecordList", targetNamespace = "http://webservice.api.ultra.neustar.com/v01/", partName = "DnssecKeyRecordList") - @WebMethod - public com.neustar.ultraservice.schema.v01.DnssecKeyRecordList getDnssecKeyRecordList( - @WebParam(partName = "zoneName", name = "zoneName") - java.lang.String zoneName, - @WebParam(partName = "dnssecKeyType", name = "dnssecKeyType") - java.lang.String dnssecKeyType - ) throws UltraWSException_Exception; - - @WebResult(name = "SBTCAlertsOfUser", targetNamespace = "http://webservice.api.ultra.neustar.com/v01/", partName = "SBTCAlertsOfUser") - @WebMethod - public com.neustar.ultraservice.schema.v01.AlertSummaryList getSBTCAlertsOfUser() throws UltraWSException_Exception; - - @WebResult(name = "Status", targetNamespace = "http://webservice.api.ultra.neustar.com/v01/", partName = "Status") - @WebMethod - public com.neustar.ultraservice.schema.v01.Status detachContactToARPoolRule( - @WebParam(partName = "contactARPoolRuleInfo", name = "contactARPoolRuleInfo") - com.neustar.ultraservice.schema.v01.ContactARPoolRuleInfo contactARPoolRuleInfo - ) throws UltraWSException_Exception; - - @WebResult(name = "Status", targetNamespace = "http://webservice.api.ultra.neustar.com/v01/", partName = "Status") - @WebMethod - public com.neustar.ultraservice.schema.v01.Status updateAddressBookEntry( - @WebParam(partName = "addressBookEntry", name = "addressBookEntry") - com.neustar.ultraservice.schema.v01.AddressBookEntry addressBookEntry - ) throws UltraWSException_Exception; - - @WebResult(name = "AccountDetailsList", targetNamespace = "http://webservice.api.ultra.neustar.com/v01/", partName = "AccountDetailsList") - @WebMethod - public com.neustar.ultraservice.schema.v01.AccountDetailsList getAccountDetailsOfUser( - @WebParam(partName = "sortBy", name = "sortBy") - java.lang.String sortBy, - @WebParam(partName = "sortOrder", name = "sortOrder") - java.lang.String sortOrder - ) throws UltraWSException_Exception; - - @WebResult(name = "accountLevelNotificationList", targetNamespace = "http://webservice.api.ultra.neustar.com/v01/", partName = "accountLevelNotificationList") - @WebMethod - public com.neustar.ultraservice.schema.v01.AccountLevelNotificationsList getAccountsNotificationStatus() throws UltraWSException_Exception; - - @WebResult(name = "result", targetNamespace = "http://webservice.api.ultra.neustar.com/v01/", partName = "result") - @WebMethod - public java.lang.String deleteScheduledEvent( - @WebParam(partName = "transactionID", name = "transactionID") - java.lang.String transactionID, - @WebParam(partName = "guid", name = "guid") - java.lang.String guid - ) throws UltraWSException_Exception; - - @WebResult(name = "DirectionalDNSRecordDetailList", targetNamespace = "http://webservice.api.ultra.neustar.com/v01/", partName = "DirectionalDNSRecordDetailList") - @WebMethod - public com.neustar.ultraservice.schema.v01.DirectionalDNSRecordDetailList getDirectionalDNSRecordsForHost( - @WebParam(partName = "zoneName", name = "zoneName") - java.lang.String zoneName, - @WebParam(partName = "hostName", name = "hostName") - java.lang.String hostName, - @WebParam(partName = "poolRecordType", name = "poolRecordType") - java.lang.String poolRecordType - ) throws UltraWSException_Exception; - - @WebResult(name = "result", targetNamespace = "http://webservice.api.ultra.neustar.com/v01/", partName = "result") - @WebMethod - public java.lang.String setUserDefaultPreferences( - @WebParam(partName = "userDefaultPreferences", name = "userDefaultPreferences") - com.neustar.ultraservice.schema.v01.UserDefaultPreferences userDefaultPreferences - ) throws UltraWSException_Exception; - - @WebResult(name = "Status", targetNamespace = "http://webservice.api.ultra.neustar.com/v01/", partName = "Status") - @WebMethod - public com.neustar.ultraservice.schema.v01.Status updateAccountLevelDirectionalGroup( - @WebParam(partName = "transactionID", name = "transactionID") - java.lang.String transactionID, - @WebParam(partName = "GlobalDirectionalGroupUpdateDetails", name = "GlobalDirectionalGroupUpdateDetails") - com.neustar.ultraservice.schema.v01.GlobalDirectionalGroupUpdateDetails globalDirectionalGroupUpdateDetails - ) throws UltraWSException_Exception; - - @WebResult(name = "MonitoredRDPools", targetNamespace = "http://webservice.api.ultra.neustar.com/v01/", partName = "MonitoredRDPools") - @WebMethod - public com.neustar.ultraservice.schema.v01.MonitoredRDPools getAllMonitoredRDPools( - @WebParam(partName = "monitoredRDPoolListKey", name = "monitoredRDPoolListKey") - com.neustar.ultraservice.schema.v01.MonitoredRDPoolListKey monitoredRDPoolListKey - ) throws UltraWSException_Exception; - - @WebResult(name = "LBPoolList", targetNamespace = "http://webservice.api.ultra.neustar.com/v01/", partName = "LBPoolList") - @WebMethod - public com.neustar.ultraservice.schema.v01.LBPoolList getLoadBalancingPoolsByZone( - @WebParam(partName = "zoneName", name = "zoneName") - java.lang.String zoneName, - @WebParam(partName = "lbPoolType", name = "lbPoolType") - java.lang.String lbPoolType - ) throws UltraWSException_Exception; - - @WebResult(name = "TaskStatus", targetNamespace = "http://webservice.api.ultra.neustar.com/v01/", partName = "TaskStatus") - @WebMethod - public com.neustar.ultraservice.schema.v01.TaskStatus getStatusForTask( - @WebParam(partName = "id", name = "id") - com.neustar.ultraservice.schema.v01.TaskId id - ) throws UltraWSException_Exception; - - @WebResult(name = "ARProbeDefinitionList", targetNamespace = "http://webservice.api.ultra.neustar.com/v01/", partName = "ARProbeDefinitionList") - @WebMethod - public com.neustar.ultraservice.schema.v01.PoolConfigurationList getARPoolConfigurationsByPoolName( - @WebParam(partName = "id", name = "id") - com.neustar.ultraservice.schema.v01.PoolId id - ) throws UltraWSException_Exception; - - @WebResult(name = "ProbeInfo", targetNamespace = "http://webservice.api.ultra.neustar.com/v01/", partName = "ProbeInfo") - @WebMethod - public com.neustar.ultraservice.schema.v01.ProbeInfo getProbeByID( - @WebParam(partName = "poolProbeID", name = "poolProbeID") - java.lang.String poolProbeID - ) throws UltraWSException_Exception; - - @WebResult(name = "result", targetNamespace = "http://webservice.api.ultra.neustar.com/v01/", partName = "result") - @WebMethod - public java.lang.String setRecordTypeOrderPreference( - @WebParam(partName = "ResourceRecordTypeOrderInfoList", name = "ResourceRecordTypeOrderInfoList") - com.neustar.ultraservice.schema.v01.ResourceRecordTypeOrderInfoList resourceRecordTypeOrderInfoList - ) throws UltraWSException_Exception; - - @WebResult(name = "Status", targetNamespace = "http://webservice.api.ultra.neustar.com/v01/", partName = "Status") - @WebMethod - public com.neustar.ultraservice.schema.v01.Status addARProbeDefinition( - @WebParam(partName = "accountName", name = "accountName") - java.lang.String accountName, - @WebParam(partName = "probeDefinition", name = "probeDefinition") - com.neustar.ultraservice.schema.v01.ProbeDefinition probeDefinition - ) throws UltraWSException_Exception; - - @WebResult(name = "RRPoolID", targetNamespace = "http://webservice.api.ultra.neustar.com/v01/", partName = "RRPoolID") - @WebMethod - public java.lang.String addRDLBPool( - @WebParam(partName = "transactionID", name = "transactionID") - java.lang.String transactionID, - @WebParam(partName = "zoneName", name = "zoneName") - java.lang.String zoneName, - @WebParam(partName = "hostName", name = "hostName") - java.lang.String hostName, - @WebParam(partName = "description", name = "description") - java.lang.String description, - @WebParam(partName = "poolRecordType", name = "poolRecordType") - java.lang.String poolRecordType, - @WebParam(partName = "responseMethod", name = "responseMethod") - java.lang.String responseMethod, - @WebParam(partName = "rrGUID", name = "rrGUID") - java.lang.String rrGUID - ) throws UltraWSException_Exception; - - @WebResult(name = "Status", targetNamespace = "http://webservice.api.ultra.neustar.com/v01/", partName = "Status") - @WebMethod - public com.neustar.ultraservice.schema.v01.Status addARPool( - @WebParam(partName = "pool", name = "pool") - com.neustar.ultraservice.schema.v01.Pool pool - ) throws UltraWSException_Exception; - - @WebResult(name = "Status", targetNamespace = "http://webservice.api.ultra.neustar.com/v01/", partName = "Status") - @WebMethod - public com.neustar.ultraservice.schema.v01.Status deleteARPoolRecord( - @WebParam(partName = "id", name = "id") - com.neustar.ultraservice.schema.v01.PoolRecordId id - ) throws UltraWSException_Exception; - - @WebResult(name = "ResourceRecordList", targetNamespace = "http://webservice.api.ultra.neustar.com/v01/", partName = "ResourceRecordList") - @WebMethod - public com.neustar.ultraservice.schema.v01.ResourceRecordList getResourceRecordsOfZone( - @WebParam(partName = "zoneName", name = "zoneName") - java.lang.String zoneName, - @WebParam(partName = "rrType", name = "rrType") - int rrType - ) throws UltraWSException_Exception; - - @WebResult(name = "result", targetNamespace = "http://webservice.api.ultra.neustar.com/v01/", partName = "result") - @WebMethod - public java.lang.String deleteDirectionalPool( - @WebParam(partName = "transactionID", name = "transactionID") - java.lang.String transactionID, - @WebParam(partName = "dirPoolID", name = "dirPoolID") - java.lang.String dirPoolID, - @WebParam(partName = "retainRecordID", name = "retainRecordID") - java.lang.String retainRecordID - ) throws UltraWSException_Exception; - - @WebResult(name = "NameServer", targetNamespace = "http://webservice.api.ultra.neustar.com/v01/", partName = "NameServer") - @WebMethod - public com.neustar.ultraservice.schema.v01.NameServerList getNameServers( - @WebParam(partName = "zoneName", name = "zoneName") - java.lang.String zoneName - ) throws UltraWSException_Exception; - - @WebResult(name = "result", targetNamespace = "http://webservice.api.ultra.neustar.com/v01/", partName = "result") - @WebMethod - public java.lang.String updateSecondaryZone( - @WebParam(partName = "transactionID", name = "transactionID") - java.lang.String transactionID, - @WebParam(partName = "zoneName", name = "zoneName") - java.lang.String zoneName, - @WebParam(partName = "isTsigEnable", name = "isTsigEnable") - boolean isTsigEnable, - @WebParam(partName = "primaryNameServer", name = "primaryNameServer") - java.lang.String primaryNameServer, - @WebParam(partName = "tsigName1", name = "tsigName1") - java.lang.String tsigName1, - @WebParam(partName = "tsigSecret1", name = "tsigSecret1") - java.lang.String tsigSecret1, - @WebParam(partName = "primaryNameServerIP2", name = "primaryNameServerIP2") - java.lang.String primaryNameServerIP2, - @WebParam(partName = "tsigName2", name = "tsigName2") - java.lang.String tsigName2, - @WebParam(partName = "tsigSecret2", name = "tsigSecret2") - java.lang.String tsigSecret2, - @WebParam(partName = "primaryNameServerIP3", name = "primaryNameServerIP3") - java.lang.String primaryNameServerIP3, - @WebParam(partName = "tsigName3", name = "tsigName3") - java.lang.String tsigName3, - @WebParam(partName = "tsigSecret3", name = "tsigSecret3") - java.lang.String tsigSecret3, - @WebParam(partName = "notificationEmail", name = "notificationEmail") - java.lang.String notificationEmail - ) throws UltraWSException_Exception; - - @WebResult(name = "result", targetNamespace = "http://webservice.api.ultra.neustar.com/v01/", partName = "result") - @WebMethod - public java.lang.String addMailBlock( - @WebParam(partName = "transactionId", name = "transactionId") - java.lang.String transactionId, - @WebParam(partName = "zoneName", name = "zoneName") - java.lang.String zoneName, - @WebParam(partName = "emailTo", name = "emailTo") - java.lang.String emailTo - ) throws UltraWSException_Exception; - - @WebResult(name = "Status", targetNamespace = "http://webservice.api.ultra.neustar.com/v01/", partName = "Status") - @WebMethod - public com.neustar.ultraservice.schema.v01.Status addCustomHTTPHeaderToAccount( - @WebParam(partName = "transactionID", name = "transactionID") - java.lang.String transactionID, - @WebParam(partName = "CustomHTTPHeaderData", name = "CustomHTTPHeaderData") - com.neustar.ultraservice.schema.v01.CustomHTTPHeaderData customHTTPHeaderData - ) throws UltraWSException_Exception; - - @WebResult(name = "AllCountriesList", targetNamespace = "http://webservice.api.ultra.neustar.com/v01/", partName = "AllCountriesList") - @WebMethod - public com.neustar.ultraservice.schema.v01.AllCountriesList getAllCountries() throws UltraWSException_Exception; - - @WebResult(name = "TCPoolID", targetNamespace = "http://webservice.api.ultra.neustar.com/v01/", partName = "TCPoolID") - @WebMethod - public java.lang.String addTCLBPool( - @WebParam(partName = "transactionID", name = "transactionID") - java.lang.String transactionID, - @WebParam(partName = "zoneName", name = "zoneName") - java.lang.String zoneName, - @WebParam(partName = "hostName", name = "hostName") - java.lang.String hostName, - @WebParam(partName = "poolRecordType", name = "poolRecordType") - java.lang.String poolRecordType, - @WebParam(partName = "description", name = "description") - java.lang.String description, - @WebParam(partName = "failOver", name = "failOver") - java.lang.String failOver, - @WebParam(partName = "probing", name = "probing") - java.lang.String probing, - @WebParam(partName = "maxActive", name = "maxActive") - java.lang.String maxActive, - @WebParam(partName = "rrGUID", name = "rrGUID") - java.lang.String rrGUID - ) throws UltraWSException_Exception; - - @WebResult(name = "result", targetNamespace = "http://webservice.api.ultra.neustar.com/v01/", partName = "result") - @WebMethod - public java.lang.String setDashboardTypeOrderPreference( - @WebParam(partName = "DashBoardTypeOrderList", name = "DashBoardTypeOrderList") - com.neustar.ultraservice.schema.v01.DashboardTypeOrderInfoList dashBoardTypeOrderList - ) throws UltraWSException_Exception; - - @WebResult(name = "result", targetNamespace = "http://webservice.api.ultra.neustar.com/v01/", partName = "result") - @WebMethod - public java.lang.String updateWebForward( - @WebParam(partName = "transactionID", name = "transactionID") - java.lang.String transactionID, - @WebParam(partName = "guid", name = "guid") - java.lang.String guid, - @WebParam(partName = "requestTo", name = "requestTo") - java.lang.String requestTo, - @WebParam(partName = "redirectTo", name = "redirectTo") - java.lang.String redirectTo, - @WebParam(partName = "forwardType", name = "forwardType") - java.lang.String forwardType - ) throws UltraWSException_Exception; - - @WebResult(name = "UserSummary", targetNamespace = "http://webservice.api.ultra.neustar.com/v01/", partName = "UserSummary") - @WebMethod - public com.neustar.ultraservice.schema.v01.UserSummaryList getServicePackageOfUser( - @WebParam(partName = "userName", name = "userName") - java.lang.String userName, - @WebParam(partName = "accountID", name = "accountID") - java.lang.String accountID - ) throws UltraWSException_Exception; - - @WebResult(name = "DirectionalPoolList", targetNamespace = "http://webservice.api.ultra.neustar.com/v01/", partName = "DirectionalPoolList") - @WebMethod - public com.neustar.ultraservice.schema.v01.DirectionalPoolList getDirectionalPoolsOfZone( - @WebParam(partName = "zoneName", name = "zoneName") - java.lang.String zoneName - ) throws UltraWSException_Exception; - - @WebMethod - public void updateAccountAddressInfo( - @WebParam(partName = "transactionID", name = "transactionID") - java.lang.String transactionID, - @WebParam(partName = "accountID", mode = WebParam.Mode.INOUT, name = "accountID") - javax.xml.ws.Holder accountID, - @WebParam(partName = "accountType", name = "accountType") - java.lang.String accountType, - @WebParam(partName = "accountAddressInfo", name = "accountAddressInfo") - com.neustar.ultraservice.schema.v01.AccountAddressInfo accountAddressInfo - ) throws UltraWSException_Exception; - - @WebResult(name = "result", targetNamespace = "http://webservice.api.ultra.neustar.com/v01/", partName = "result") - @WebMethod - public java.lang.String getLostUserID( - @WebParam(partName = "mailID", name = "mailID") - java.lang.String mailID - ) throws UltraWSException_Exception; - - @WebResult(name = "Status", targetNamespace = "http://webservice.api.ultra.neustar.com/v01/", partName = "Status") - @WebMethod - public com.neustar.ultraservice.schema.v01.Status updateMonitoredRDPool( - @WebParam(partName = "monitoredRDPool", name = "monitoredRDPool") - com.neustar.ultraservice.schema.v01.MonitoredRDPoolUpdate monitoredRDPool - ) throws UltraWSException_Exception; - - @WebResult(name = "ScheduledEventList", targetNamespace = "http://webservice.api.ultra.neustar.com/v01/", partName = "ScheduledEventList") - @WebMethod - public com.neustar.ultraservice.schema.v01.ScheduledEventList getScheduledEvents( - @WebParam(partName = "poolRecordId", name = "poolRecordId") - java.lang.String poolRecordId, - @WebParam(partName = "sortBy", name = "sortBy") - java.lang.String sortBy - ) throws UltraWSException_Exception; - - @WebResult(name = "result", targetNamespace = "http://webservice.api.ultra.neustar.com/v01/", partName = "result") - @WebMethod - public java.lang.String commitTransaction( - @WebParam(partName = "transactionID", name = "transactionID") - java.lang.String transactionID - ) throws UltraWSException_Exception; - - @WebResult(name = "Status", targetNamespace = "http://webservice.api.ultra.neustar.com/v01/", partName = "Status") - @WebMethod - public com.neustar.ultraservice.schema.v01.Status updateARPool( - @WebParam(partName = "zoneName", name = "zoneName") - java.lang.String zoneName, - @WebParam(partName = "poolName", name = "poolName") - java.lang.String poolName, - @WebParam(partName = "update", name = "update") - com.neustar.ultraservice.schema.v01.PoolUpdate update - ) throws UltraWSException_Exception; - - @WebResult(name = "result", targetNamespace = "http://webservice.api.ultra.neustar.com/v01/", partName = "result") - @WebMethod - public java.lang.String addMailForward( - @WebParam(partName = "transactionID", name = "transactionID") - java.lang.String transactionID, - @WebParam(partName = "emailTo", name = "emailTo") - java.lang.String emailTo, - @WebParam(partName = "forwardTo", name = "forwardTo") - java.lang.String forwardTo, - @WebParam(partName = "zoneName", name = "zoneName") - java.lang.String zoneName - ) throws UltraWSException_Exception; - - @WebResult(name = "Status", targetNamespace = "http://webservice.api.ultra.neustar.com/v01/", partName = "Status") - @WebMethod - public com.neustar.ultraservice.schema.v01.Status convertSimpleFailoverPool( - @WebParam(partName = "SimpleFailoverConversionInfo", name = "SimpleFailoverConversionInfo") - com.neustar.ultraservice.schema.v01.SimpleFailoverConversionInfo simpleFailoverConversionInfo - ) throws UltraWSException_Exception; - - @WebResult(name = "result", targetNamespace = "http://webservice.api.ultra.neustar.com/v01/", partName = "result") - @WebMethod - public com.neustar.ultraservice.schema.v01.ZoneTransferStatus createPrimaryZoneByZoneTransfer( - @WebParam(partName = "transactionId", name = "transactionId") - java.lang.String transactionId, - @WebParam(partName = "accountId", name = "accountId") - java.lang.String accountId, - @WebParam(partName = "zoneName", name = "zoneName") - java.lang.String zoneName, - @WebParam(partName = "primaryNameServer", name = "primaryNameServer") - java.lang.String primaryNameServer, - @WebParam(partName = "tsigName1", name = "tsigName1") - java.lang.String tsigName1, - @WebParam(partName = "tsigSecret1", name = "tsigSecret1") - java.lang.String tsigSecret1, - @WebParam(partName = "tsigEnable", name = "tsigEnable") - boolean tsigEnable - ) throws UltraWSException_Exception; - - @WebResult(name = "AccountPreferencesList", targetNamespace = "http://webservice.api.ultra.neustar.com/v01/", partName = "AccountPreferencesList") - @WebMethod - public com.neustar.ultraservice.schema.v01.AccountPreferencesList getAccountPreferencesDetails( - @WebParam(partName = "accountId", name = "accountId") - java.lang.String accountId - ) throws UltraWSException_Exception; - - @WebResult(name = "Status", targetNamespace = "http://webservice.api.ultra.neustar.com/v01/", partName = "Status") - @WebMethod - public com.neustar.ultraservice.schema.v01.Status updateCustomHTTPHeaderToAccount( - @WebParam(partName = "transactionID", name = "transactionID") - java.lang.String transactionID, - @WebParam(partName = "CustomHTTPHeaderData", name = "CustomHTTPHeaderData") - com.neustar.ultraservice.schema.v01.UpdateCustomHTTPHeaderData customHTTPHeaderData - ) throws UltraWSException_Exception; - - @WebResult(name = "Status", targetNamespace = "http://webservice.api.ultra.neustar.com/v01/", partName = "Status") - @WebMethod - public com.neustar.ultraservice.schema.v01.Status updateWebForwardPoolRecord( - @WebParam(partName = "transactionID", name = "transactionID") - java.lang.String transactionID, - @WebParam(partName = "WebForwardPoolRecordData", name = "WebForwardPoolRecordData") - com.neustar.ultraservice.schema.v01.UpdateWebForwardPoolRecordData webForwardPoolRecordData - ) throws UltraWSException_Exception; - - @WebResult(name = "LBPoolData", targetNamespace = "http://webservice.api.ultra.neustar.com/v01/", partName = "LBPoolData") - @WebMethod - public com.neustar.ultraservice.schema.v01.LBPoolData getPoolForPoolHostName( - @WebParam(partName = "hostName", name = "hostName") - java.lang.String hostName - ) throws UltraWSException_Exception; - - @WebResult(name = "PoolRecordsList", targetNamespace = "http://webservice.api.ultra.neustar.com/v01/", partName = "PoolRecordsList") - @WebMethod - public com.neustar.ultraservice.schema.v01.PoolRecordsList getPoolRecords( - @WebParam(partName = "poolId", name = "poolId") - java.lang.String poolId - ) throws UltraWSException_Exception; - - @WebResult(name = "result", targetNamespace = "http://webservice.api.ultra.neustar.com/v01/", partName = "result") - @WebMethod - public java.lang.String updateScheduleEvent( - @WebParam(partName = "transactionId", name = "transactionId") - java.lang.String transactionId, - @WebParam(partName = "guid", name = "guid") - java.lang.String guid, - @WebParam(partName = "eventType", name = "eventType") - java.lang.String eventType, - @WebParam(partName = "eventStartDate", name = "eventStartDate") - java.lang.String eventStartDate, - @WebParam(partName = "eventStartTime", name = "eventStartTime") - java.lang.String eventStartTime, - @WebParam(partName = "eventEndDate", name = "eventEndDate") - java.lang.String eventEndDate, - @WebParam(partName = "eventEndTime", name = "eventEndTime") - java.lang.String eventEndTime, - @WebParam(partName = "recurrenceEnd", name = "recurrenceEnd") - java.lang.String recurrenceEnd, - @WebParam(partName = "interval", name = "interval") - java.lang.String interval, - @WebParam(partName = "notifyOn", name = "notifyOn") - java.lang.String notifyOn - ) throws UltraWSException_Exception; - - @WebResult(name = "result", targetNamespace = "http://webservice.api.ultra.neustar.com/v01/", partName = "result") - @WebMethod - public java.lang.String deleteDirectionalPoolRecord( - @WebParam(partName = "transactionID", name = "transactionID") - java.lang.String transactionID, - @WebParam(partName = "dirPoolRecordId", name = "dirPoolRecordId") - java.lang.String dirPoolRecordId - ) throws UltraWSException_Exception; - - @WebResult(name = "PoolDetailsList", targetNamespace = "http://webservice.api.ultra.neustar.com/v01/", partName = "PoolDetailsList") - @WebMethod - public com.neustar.ultraservice.schema.v01.PoolDetailsList getAllARPools( - @WebParam(partName = "zoneName", name = "zoneName") - java.lang.String zoneName, - @WebParam(partName = "poolListParams", name = "poolListParams") - com.neustar.ultraservice.schema.v01.PoolListParams poolListParams - ) throws UltraWSException_Exception; - - @WebResult(name = "GeneralNotificationStatusList", targetNamespace = "http://webservice.api.ultra.neustar.com/v01/", partName = "GeneralNotificationStatusList") - @WebMethod - public com.neustar.ultraservice.schema.v01.GeneralNotificationStatusList getGeneralNotificationStatus() throws UltraWSException_Exception; - - @WebResult(name = "result", targetNamespace = "http://webservice.api.ultra.neustar.com/v01/", partName = "result") - @WebMethod - public java.lang.String addWebForward( - @WebParam(partName = "transactionID", name = "transactionID") - java.lang.String transactionID, - @WebParam(partName = "requestTo", name = "requestTo") - java.lang.String requestTo, - @WebParam(partName = "redirectTo", name = "redirectTo") - java.lang.String redirectTo, - @WebParam(partName = "forwardType", name = "forwardType") - java.lang.String forwardType, - @WebParam(partName = "advanced", name = "advanced") - boolean advanced, - @WebParam(partName = "zoneName", name = "zoneName") - java.lang.String zoneName - ) throws UltraWSException_Exception; - - @WebResult(name = "result", targetNamespace = "http://webservice.api.ultra.neustar.com/v01/", partName = "result") - @WebMethod - public java.lang.String deleteResourceRecord( - @WebParam(partName = "transactionID", name = "transactionID") - java.lang.String transactionID, - @WebParam(partName = "guid", name = "guid") - java.lang.String guid - ) throws UltraWSException_Exception; - - @WebResult(name = "DirPoolID", targetNamespace = "http://webservice.api.ultra.neustar.com/v01/", partName = "DirPoolID") - @WebMethod - public java.lang.String addDirectionalPool( - @WebParam(partName = "transactionID", name = "transactionID") - java.lang.String transactionID, - @WebParam(partName = "AddDirectionalPoolData", name = "AddDirectionalPoolData") - com.neustar.ultraservice.schema.v01.AddDirectionalPoolData addDirectionalPoolData - ) throws UltraWSException_Exception; - - @WebResult(name = "DashboardTypeOrderList", targetNamespace = "http://webservice.api.ultra.neustar.com/v01/", partName = "DashboardTypeOrderList") - @WebMethod - public com.neustar.ultraservice.schema.v01.ResourceRecordTypeOrderInfoList getRecordTypeOrderPreference() throws UltraWSException_Exception; - - @WebResult(name = "NameServerRecordList", targetNamespace = "http://webservice.api.ultra.neustar.com/v01/", partName = "NameServerRecordList") - @WebMethod - public com.neustar.ultraservice.schema.v01.NameServers getNameServersDetails( - @WebParam(partName = "accountId", name = "accountId") - java.lang.String accountId - ) throws UltraWSException_Exception; - - @WebResult(name = "Status", targetNamespace = "http://webservice.api.ultra.neustar.com/v01/", partName = "Status") - @WebMethod - public com.neustar.ultraservice.schema.v01.Status updateARPoolRecord( - @WebParam(partName = "id", name = "id") - com.neustar.ultraservice.schema.v01.PoolRecordId id, - @WebParam(partName = "update", name = "update") - com.neustar.ultraservice.schema.v01.PoolRecordUpdate update - ) throws UltraWSException_Exception; - - @WebResult(name = "EntryLabel", targetNamespace = "http://webservice.api.ultra.neustar.com/v01/", partName = "EntryLabel") - @WebMethod - public java.lang.String addAddressBookEntry( - @WebParam(partName = "addressBookEntry", name = "addressBookEntry") - com.neustar.ultraservice.schema.v01.AddressBookEntryCreate addressBookEntry - ) throws UltraWSException_Exception; - - @WebResult(name = "DirectionalDNSAvailableGroups", targetNamespace = "http://webservice.api.ultra.neustar.com/v01/", partName = "DirectionalDNSAvailableGroups") - @WebMethod - public net.java.dev.jaxb.array.StringArray getAvailableGroups( - @WebParam(partName = "poolName", name = "poolName") - java.lang.String poolName, - @WebParam(partName = "poolRecordType", name = "poolRecordType") - java.lang.String poolRecordType, - @WebParam(partName = "accountID", name = "accountID") - java.lang.String accountID, - @WebParam(partName = "groupType", name = "groupType") - java.lang.String groupType - ) throws UltraWSException_Exception; - - @WebResult(name = "result", targetNamespace = "http://webservice.api.ultra.neustar.com/v01/", partName = "result") - @WebMethod - public java.lang.String changeUserPassword( - @WebParam(partName = "transactionID", name = "transactionID") - java.lang.String transactionID, - @WebParam(partName = "userName", name = "userName") - java.lang.String userName, - @WebParam(partName = "oldPassword", name = "oldPassword") - java.lang.String oldPassword, - @WebParam(partName = "newPassword", name = "newPassword") - java.lang.String newPassword - ) throws UltraWSException_Exception; - - @WebResult(name = "SBPoolID", targetNamespace = "http://webservice.api.ultra.neustar.com/v01/", partName = "SBPoolID") - @WebMethod - public java.lang.String addSBLBPool( - @WebParam(partName = "transactionID", name = "transactionID") - java.lang.String transactionID, - @WebParam(partName = "zoneName", name = "zoneName") - java.lang.String zoneName, - @WebParam(partName = "hostName", name = "hostName") - java.lang.String hostName, - @WebParam(partName = "poolRecordType", name = "poolRecordType") - java.lang.String poolRecordType, - @WebParam(partName = "description", name = "description") - java.lang.String description, - @WebParam(partName = "failOver", name = "failOver") - java.lang.String failOver, - @WebParam(partName = "probing", name = "probing") - java.lang.String probing, - @WebParam(partName = "maxActive", name = "maxActive") - java.lang.String maxActive, - @WebParam(partName = "rrGUID", name = "rrGUID") - java.lang.String rrGUID - ) throws UltraWSException_Exception; - - @WebResult(name = "guid", targetNamespace = "http://webservice.api.ultra.neustar.com/v01/", partName = "guid") - @WebMethod - public java.lang.String scheduleEvent( - @WebParam(partName = "transactionID", name = "transactionID") - java.lang.String transactionID, - @WebParam(partName = "poolRecordID", name = "poolRecordID") - java.lang.String poolRecordID, - @WebParam(partName = "eventType", name = "eventType") - java.lang.String eventType, - @WebParam(partName = "eventStartDate", name = "eventStartDate") - java.lang.String eventStartDate, - @WebParam(partName = "eventStartTime", name = "eventStartTime") - java.lang.String eventStartTime, - @WebParam(partName = "eventEndDate", name = "eventEndDate") - java.lang.String eventEndDate, - @WebParam(partName = "eventEndTime", name = "eventEndTime") - java.lang.String eventEndTime, - @WebParam(partName = "recurrenceEnd", name = "recurrenceEnd") - java.lang.String recurrenceEnd, - @WebParam(partName = "interval", name = "interval") - java.lang.String interval, - @WebParam(partName = "notifyOn", name = "notifyOn") - java.lang.String notifyOn - ) throws UltraWSException_Exception; - - @WebResult(name = "Status", targetNamespace = "http://webservice.api.ultra.neustar.com/v01/", partName = "Status") - @WebMethod - public com.neustar.ultraservice.schema.v01.Status addSimpleFailoverPool( - @WebParam(partName = "simpleFailoverPool", name = "simpleFailoverPool") - com.neustar.ultraservice.schema.v01.SimpleFailoverPoolAdd simpleFailoverPool - ) throws UltraWSException_Exception; - - @WebResult(name = "result", targetNamespace = "http://webservice.api.ultra.neustar.com/v01/", partName = "result") - @WebMethod - public com.neustar.ultraservice.schema.v01.ZoneTransferStatus createSecondaryZoneReturningTaskId( - @WebParam(partName = "transactionID", name = "transactionID") - java.lang.String transactionID, - @WebParam(partName = "accountId", name = "accountId") - java.lang.String accountId, - @WebParam(partName = "zoneName", name = "zoneName") - java.lang.String zoneName, - @WebParam(partName = "isTsigEnable", name = "isTsigEnable") - boolean isTsigEnable, - @WebParam(partName = "primaryNameServer", name = "primaryNameServer") - java.lang.String primaryNameServer, - @WebParam(partName = "tsigName1", name = "tsigName1") - java.lang.String tsigName1, - @WebParam(partName = "tsigSecret1", name = "tsigSecret1") - java.lang.String tsigSecret1, - @WebParam(partName = "primaryNameServerIP2", name = "primaryNameServerIP2") - java.lang.String primaryNameServerIP2, - @WebParam(partName = "tsigName2", name = "tsigName2") - java.lang.String tsigName2, - @WebParam(partName = "tsigSecret2", name = "tsigSecret2") - java.lang.String tsigSecret2, - @WebParam(partName = "primaryNameServerIP3", name = "primaryNameServerIP3") - java.lang.String primaryNameServerIP3, - @WebParam(partName = "tsigName3", name = "tsigName3") - java.lang.String tsigName3, - @WebParam(partName = "tsigSecret3", name = "tsigSecret3") - java.lang.String tsigSecret3, - @WebParam(partName = "notificationEmail", name = "notificationEmail") - java.lang.String notificationEmail - ) throws UltraWSException_Exception; - - @WebResult(name = "ScheduledMaintenanceAlerts", targetNamespace = "http://webservice.api.ultra.neustar.com/v01/", partName = "ScheduledMaintenanceAlerts") - @WebMethod - public com.neustar.ultraservice.schema.v01.AlertSummaryList getScheduledMaintenanceAlerts() throws UltraWSException_Exception; -} diff --git a/Plugins/Mineplex.BungeeRotator/src/com/neustar/ultra/api/webservice/v01/UltraWSException.java b/Plugins/Mineplex.BungeeRotator/src/com/neustar/ultra/api/webservice/v01/UltraWSException.java deleted file mode 100644 index e76c80e4f..000000000 --- a/Plugins/Mineplex.BungeeRotator/src/com/neustar/ultra/api/webservice/v01/UltraWSException.java +++ /dev/null @@ -1,90 +0,0 @@ - -package com.neustar.ultra.api.webservice.v01; - -import javax.xml.bind.annotation.XmlAccessType; -import javax.xml.bind.annotation.XmlAccessorType; -import javax.xml.bind.annotation.XmlElement; -import javax.xml.bind.annotation.XmlType; - - -/** - *

Java class for UltraWSException complex type. - * - *

The following schema fragment specifies the expected content contained within this class. - * - *

- * <complexType name="UltraWSException">
- *   <complexContent>
- *     <restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
- *       <sequence>
- *         <element name="errorCode" type="{http://www.w3.org/2001/XMLSchema}int"/>
- *         <element name="errorDescription" type="{http://www.w3.org/2001/XMLSchema}string"/>
- *       </sequence>
- *     </restriction>
- *   </complexContent>
- * </complexType>
- * 
- * - * - */ -@XmlAccessorType(XmlAccessType.FIELD) -@XmlType(name = "UltraWSException", propOrder = { - "errorCode", - "errorDescription" -}) -public class UltraWSException { - - @XmlElement(required = true, type = Integer.class, nillable = true) - protected Integer errorCode; - @XmlElement(required = true, nillable = true) - protected String errorDescription; - - /** - * Gets the value of the errorCode property. - * - * @return - * possible object is - * {@link Integer } - * - */ - public Integer getErrorCode() { - return errorCode; - } - - /** - * Sets the value of the errorCode property. - * - * @param value - * allowed object is - * {@link Integer } - * - */ - public void setErrorCode(Integer value) { - this.errorCode = value; - } - - /** - * Gets the value of the errorDescription property. - * - * @return - * possible object is - * {@link String } - * - */ - public String getErrorDescription() { - return errorDescription; - } - - /** - * Sets the value of the errorDescription property. - * - * @param value - * allowed object is - * {@link String } - * - */ - public void setErrorDescription(String value) { - this.errorDescription = value; - } - -} diff --git a/Plugins/Mineplex.BungeeRotator/src/com/neustar/ultra/api/webservice/v01/UltraWSException_Exception.java b/Plugins/Mineplex.BungeeRotator/src/com/neustar/ultra/api/webservice/v01/UltraWSException_Exception.java deleted file mode 100644 index 38ede6515..000000000 --- a/Plugins/Mineplex.BungeeRotator/src/com/neustar/ultra/api/webservice/v01/UltraWSException_Exception.java +++ /dev/null @@ -1,43 +0,0 @@ - -package com.neustar.ultra.api.webservice.v01; - -import javax.xml.ws.WebFault; - - -/** - * This class was generated by Apache CXF 2.7.7 - * 2014-01-15T10:08:40.557-05:00 - * Generated source version: 2.7.7 - */ - -@WebFault(name = "UltraWSException", targetNamespace = "http://webservice.api.ultra.neustar.com/v01/") -public class UltraWSException_Exception extends Exception { - - private com.neustar.ultra.api.webservice.v01.UltraWSException ultraWSException; - - public UltraWSException_Exception() { - super(); - } - - public UltraWSException_Exception(String message) { - super(message); - } - - public UltraWSException_Exception(String message, Throwable cause) { - super(message, cause); - } - - public UltraWSException_Exception(String message, com.neustar.ultra.api.webservice.v01.UltraWSException ultraWSException) { - super(message); - this.ultraWSException = ultraWSException; - } - - public UltraWSException_Exception(String message, com.neustar.ultra.api.webservice.v01.UltraWSException ultraWSException, Throwable cause) { - super(message, cause); - this.ultraWSException = ultraWSException; - } - - public com.neustar.ultra.api.webservice.v01.UltraWSException getFaultInfo() { - return this.ultraWSException; - } -} diff --git a/Plugins/Mineplex.BungeeRotator/src/com/neustar/ultra/api/webservice/v01/UltraWebServiceV01Service.java b/Plugins/Mineplex.BungeeRotator/src/com/neustar/ultra/api/webservice/v01/UltraWebServiceV01Service.java deleted file mode 100644 index ad5ce2cf6..000000000 --- a/Plugins/Mineplex.BungeeRotator/src/com/neustar/ultra/api/webservice/v01/UltraWebServiceV01Service.java +++ /dev/null @@ -1,73 +0,0 @@ -package com.neustar.ultra.api.webservice.v01; - -import java.net.MalformedURLException; -import java.net.URL; -import javax.xml.namespace.QName; -import javax.xml.ws.WebEndpoint; -import javax.xml.ws.WebServiceClient; -import javax.xml.ws.WebServiceFeature; -import javax.xml.ws.Service; - -/** - * This class was generated by Apache CXF 2.7.7 - * 2014-01-15T10:08:40.739-05:00 - * Generated source version: 2.7.7 - * - */ -@WebServiceClient(name = "UltraWebServiceV01Service", - wsdlLocation = "http://ultra-api.ultradns.com/UltraDNS_WS/v01?wsdl", - targetNamespace = "http://webservice.api.ultra.neustar.com/v01/") -public class UltraWebServiceV01Service extends Service { - - public final static URL WSDL_LOCATION; - - public final static QName SERVICE = new QName("http://webservice.api.ultra.neustar.com/v01/", "UltraWebServiceV01Service"); - public final static QName UltraWebServiceV01Port = new QName("http://webservice.api.ultra.neustar.com/v01/", "UltraWebServiceV01Port"); - static { - URL url = null; - try { - url = new URL("http://ultra-api.ultradns.com/UltraDNS_WS/v01?wsdl"); - } catch (MalformedURLException e) { - java.util.logging.Logger.getLogger(UltraWebServiceV01Service.class.getName()) - .log(java.util.logging.Level.INFO, - "Can not initialize the default wsdl from {0}", "http://ultra-api.ultradns.com/UltraDNS_WS/v01?wsdl"); - } - WSDL_LOCATION = url; - } - - public UltraWebServiceV01Service(URL wsdlLocation) { - super(wsdlLocation, SERVICE); - } - - public UltraWebServiceV01Service(URL wsdlLocation, QName serviceName) { - super(wsdlLocation, serviceName); - } - - public UltraWebServiceV01Service() { - super(WSDL_LOCATION, SERVICE); - } - - - /** - * - * @return - * returns UltraDNS1 - */ - @WebEndpoint(name = "UltraWebServiceV01Port") - public UltraDNS1 getUltraWebServiceV01Port() { - return super.getPort(UltraWebServiceV01Port, UltraDNS1.class); - } - - /** - * - * @param features - * A list of {@link javax.xml.ws.WebServiceFeature} to configure on the proxy. Supported features not in the features parameter will have their default values. - * @return - * returns UltraDNS1 - */ - @WebEndpoint(name = "UltraWebServiceV01Port") - public UltraDNS1 getUltraWebServiceV01Port(WebServiceFeature... features) { - return super.getPort(UltraWebServiceV01Port, UltraDNS1.class, features); - } - -} diff --git a/Plugins/Mineplex.BungeeRotator/src/com/neustar/ultra/api/webservice/v01/Zone.java b/Plugins/Mineplex.BungeeRotator/src/com/neustar/ultra/api/webservice/v01/Zone.java deleted file mode 100644 index 543fe91a6..000000000 --- a/Plugins/Mineplex.BungeeRotator/src/com/neustar/ultra/api/webservice/v01/Zone.java +++ /dev/null @@ -1,145 +0,0 @@ - -package com.neustar.ultra.api.webservice.v01; - -import javax.xml.bind.annotation.XmlAccessType; -import javax.xml.bind.annotation.XmlAccessorType; -import javax.xml.bind.annotation.XmlSeeAlso; -import javax.xml.bind.annotation.XmlType; - - -/** - *

Java class for zone complex type. - * - *

The following schema fragment specifies the expected content contained within this class. - * - *

- * <complexType name="zone">
- *   <complexContent>
- *     <restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
- *       <sequence>
- *         <element name="aliasZoneInfo" type="{http://webservice.api.ultra.neustar.com/v01/}aliasZoneInfo" minOccurs="0"/>
- *         <element name="primaryZoneInfo" type="{http://webservice.api.ultra.neustar.com/v01/}primaryZoneInfo" minOccurs="0"/>
- *         <element name="secondaryZoneInfo" type="{http://webservice.api.ultra.neustar.com/v01/}secondaryZoneInfo" minOccurs="0"/>
- *         <element name="zoneProperties" type="{http://webservice.api.ultra.neustar.com/v01/}zoneProperties" minOccurs="0"/>
- *       </sequence>
- *     </restriction>
- *   </complexContent>
- * </complexType>
- * 
- * - * - */ -@XmlAccessorType(XmlAccessType.FIELD) -@XmlType(name = "zone", propOrder = { - "aliasZoneInfo", - "primaryZoneInfo", - "secondaryZoneInfo", - "zoneProperties" -}) -@XmlSeeAlso({ - InternalZone.class -}) -public class Zone { - - protected AliasZoneInfo aliasZoneInfo; - protected PrimaryZoneInfo primaryZoneInfo; - protected SecondaryZoneInfo secondaryZoneInfo; - protected ZoneProperties zoneProperties; - - /** - * Gets the value of the aliasZoneInfo property. - * - * @return - * possible object is - * {@link AliasZoneInfo } - * - */ - public AliasZoneInfo getAliasZoneInfo() { - return aliasZoneInfo; - } - - /** - * Sets the value of the aliasZoneInfo property. - * - * @param value - * allowed object is - * {@link AliasZoneInfo } - * - */ - public void setAliasZoneInfo(AliasZoneInfo value) { - this.aliasZoneInfo = value; - } - - /** - * Gets the value of the primaryZoneInfo property. - * - * @return - * possible object is - * {@link PrimaryZoneInfo } - * - */ - public PrimaryZoneInfo getPrimaryZoneInfo() { - return primaryZoneInfo; - } - - /** - * Sets the value of the primaryZoneInfo property. - * - * @param value - * allowed object is - * {@link PrimaryZoneInfo } - * - */ - public void setPrimaryZoneInfo(PrimaryZoneInfo value) { - this.primaryZoneInfo = value; - } - - /** - * Gets the value of the secondaryZoneInfo property. - * - * @return - * possible object is - * {@link SecondaryZoneInfo } - * - */ - public SecondaryZoneInfo getSecondaryZoneInfo() { - return secondaryZoneInfo; - } - - /** - * Sets the value of the secondaryZoneInfo property. - * - * @param value - * allowed object is - * {@link SecondaryZoneInfo } - * - */ - public void setSecondaryZoneInfo(SecondaryZoneInfo value) { - this.secondaryZoneInfo = value; - } - - /** - * Gets the value of the zoneProperties property. - * - * @return - * possible object is - * {@link ZoneProperties } - * - */ - public ZoneProperties getZoneProperties() { - return zoneProperties; - } - - /** - * Sets the value of the zoneProperties property. - * - * @param value - * allowed object is - * {@link ZoneProperties } - * - */ - public void setZoneProperties(ZoneProperties value) { - this.zoneProperties = value; - } - -} diff --git a/Plugins/Mineplex.BungeeRotator/src/com/neustar/ultra/api/webservice/v01/ZoneProperties.java b/Plugins/Mineplex.BungeeRotator/src/com/neustar/ultra/api/webservice/v01/ZoneProperties.java deleted file mode 100644 index 1501dcdb9..000000000 --- a/Plugins/Mineplex.BungeeRotator/src/com/neustar/ultra/api/webservice/v01/ZoneProperties.java +++ /dev/null @@ -1,241 +0,0 @@ - -package com.neustar.ultra.api.webservice.v01; - -import javax.xml.bind.annotation.XmlAccessType; -import javax.xml.bind.annotation.XmlAccessorType; -import javax.xml.bind.annotation.XmlType; - - -/** - *

Java class for zoneProperties complex type. - * - *

The following schema fragment specifies the expected content contained within this class. - * - *

- * <complexType name="zoneProperties">
- *   <complexContent>
- *     <restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
- *       <sequence>
- *         <element name="accountName" type="{http://www.w3.org/2001/XMLSchema}string" minOccurs="0"/>
- *         <element name="dnssecStatus" type="{http://www.w3.org/2001/XMLSchema}string" minOccurs="0"/>
- *         <element name="lastModifiedDateTime" type="{http://www.w3.org/2001/XMLSchema}string" minOccurs="0"/>
- *         <element name="name" type="{http://www.w3.org/2001/XMLSchema}string" minOccurs="0"/>
- *         <element name="owner" type="{http://www.w3.org/2001/XMLSchema}string" minOccurs="0"/>
- *         <element name="resourceRecordCount" type="{http://www.w3.org/2001/XMLSchema}long"/>
- *         <element name="type" type="{http://webservice.api.ultra.neustar.com/v01/}zoneType" minOccurs="0"/>
- *         <element name="zoneId" type="{http://www.w3.org/2001/XMLSchema}string" minOccurs="0"/>
- *       </sequence>
- *     </restriction>
- *   </complexContent>
- * </complexType>
- * 
- * - * - */ -@XmlAccessorType(XmlAccessType.FIELD) -@XmlType(name = "zoneProperties", propOrder = { - "accountName", - "dnssecStatus", - "lastModifiedDateTime", - "name", - "owner", - "resourceRecordCount", - "type", - "zoneId" -}) -public class ZoneProperties { - - protected String accountName; - protected String dnssecStatus; - protected String lastModifiedDateTime; - protected String name; - protected String owner; - protected long resourceRecordCount; - protected ZoneType type; - protected String zoneId; - - /** - * Gets the value of the accountName property. - * - * @return - * possible object is - * {@link String } - * - */ - public String getAccountName() { - return accountName; - } - - /** - * Sets the value of the accountName property. - * - * @param value - * allowed object is - * {@link String } - * - */ - public void setAccountName(String value) { - this.accountName = value; - } - - /** - * Gets the value of the dnssecStatus property. - * - * @return - * possible object is - * {@link String } - * - */ - public String getDnssecStatus() { - return dnssecStatus; - } - - /** - * Sets the value of the dnssecStatus property. - * - * @param value - * allowed object is - * {@link String } - * - */ - public void setDnssecStatus(String value) { - this.dnssecStatus = value; - } - - /** - * Gets the value of the lastModifiedDateTime property. - * - * @return - * possible object is - * {@link String } - * - */ - public String getLastModifiedDateTime() { - return lastModifiedDateTime; - } - - /** - * Sets the value of the lastModifiedDateTime property. - * - * @param value - * allowed object is - * {@link String } - * - */ - public void setLastModifiedDateTime(String value) { - this.lastModifiedDateTime = value; - } - - /** - * Gets the value of the name property. - * - * @return - * possible object is - * {@link String } - * - */ - public String getName() { - return name; - } - - /** - * Sets the value of the name property. - * - * @param value - * allowed object is - * {@link String } - * - */ - public void setName(String value) { - this.name = value; - } - - /** - * Gets the value of the owner property. - * - * @return - * possible object is - * {@link String } - * - */ - public String getOwner() { - return owner; - } - - /** - * Sets the value of the owner property. - * - * @param value - * allowed object is - * {@link String } - * - */ - public void setOwner(String value) { - this.owner = value; - } - - /** - * Gets the value of the resourceRecordCount property. - * - */ - public long getResourceRecordCount() { - return resourceRecordCount; - } - - /** - * Sets the value of the resourceRecordCount property. - * - */ - public void setResourceRecordCount(long value) { - this.resourceRecordCount = value; - } - - /** - * Gets the value of the type property. - * - * @return - * possible object is - * {@link ZoneType } - * - */ - public ZoneType getType() { - return type; - } - - /** - * Sets the value of the type property. - * - * @param value - * allowed object is - * {@link ZoneType } - * - */ - public void setType(ZoneType value) { - this.type = value; - } - - /** - * Gets the value of the zoneId property. - * - * @return - * possible object is - * {@link String } - * - */ - public String getZoneId() { - return zoneId; - } - - /** - * Sets the value of the zoneId property. - * - * @param value - * allowed object is - * {@link String } - * - */ - public void setZoneId(String value) { - this.zoneId = value; - } - -} diff --git a/Plugins/Mineplex.BungeeRotator/src/com/neustar/ultra/api/webservice/v01/ZoneType.java b/Plugins/Mineplex.BungeeRotator/src/com/neustar/ultra/api/webservice/v01/ZoneType.java deleted file mode 100644 index 1f0a12775..000000000 --- a/Plugins/Mineplex.BungeeRotator/src/com/neustar/ultra/api/webservice/v01/ZoneType.java +++ /dev/null @@ -1,40 +0,0 @@ - -package com.neustar.ultra.api.webservice.v01; - -import javax.xml.bind.annotation.XmlEnum; -import javax.xml.bind.annotation.XmlType; - - -/** - *

Java class for zoneType. - * - *

The following schema fragment specifies the expected content contained within this class. - *

- *

- * <simpleType name="zoneType">
- *   <restriction base="{http://www.w3.org/2001/XMLSchema}string">
- *     <enumeration value="PRIMARY"/>
- *     <enumeration value="SECONDARY"/>
- *     <enumeration value="ALIAS"/>
- *   </restriction>
- * </simpleType>
- * 
- * - */ -@XmlType(name = "zoneType") -@XmlEnum -public enum ZoneType { - - PRIMARY, - SECONDARY, - ALIAS; - - public String value() { - return name(); - } - - public static ZoneType fromValue(String v) { - return valueOf(v); - } - -} diff --git a/Plugins/Mineplex.BungeeRotator/src/com/neustar/ultra/api/webservice/v01/package-info.java b/Plugins/Mineplex.BungeeRotator/src/com/neustar/ultra/api/webservice/v01/package-info.java deleted file mode 100644 index fa07a8474..000000000 --- a/Plugins/Mineplex.BungeeRotator/src/com/neustar/ultra/api/webservice/v01/package-info.java +++ /dev/null @@ -1,2 +0,0 @@ -@javax.xml.bind.annotation.XmlSchema(namespace = "http://webservice.api.ultra.neustar.com/v01/") -package com.neustar.ultra.api.webservice.v01; diff --git a/Plugins/Mineplex.BungeeRotator/src/com/neustar/ultraservice/schema/AccountSegmentMapStatusType.java b/Plugins/Mineplex.BungeeRotator/src/com/neustar/ultraservice/schema/AccountSegmentMapStatusType.java deleted file mode 100644 index 936ee045c..000000000 --- a/Plugins/Mineplex.BungeeRotator/src/com/neustar/ultraservice/schema/AccountSegmentMapStatusType.java +++ /dev/null @@ -1,51 +0,0 @@ - -package com.neustar.ultraservice.schema; - -import javax.xml.bind.annotation.XmlEnum; -import javax.xml.bind.annotation.XmlEnumValue; -import javax.xml.bind.annotation.XmlType; - - -/** - *

Java class for AccountSegmentMapStatusType. - * - *

The following schema fragment specifies the expected content contained within this class. - *

- *

- * <simpleType name="AccountSegmentMapStatusType">
- *   <restriction base="{http://www.w3.org/2001/XMLSchema}string">
- *     <enumeration value="Pending"/>
- *     <enumeration value="Active"/>
- *   </restriction>
- * </simpleType>
- * 
- * - */ -@XmlType(name = "AccountSegmentMapStatusType", namespace = "http://schema.ultraservice.neustar.com/") -@XmlEnum -public enum AccountSegmentMapStatusType { - - @XmlEnumValue("Pending") - PENDING("Pending"), - @XmlEnumValue("Active") - ACTIVE("Active"); - private final String value; - - AccountSegmentMapStatusType(String v) { - value = v; - } - - public String value() { - return value; - } - - public static AccountSegmentMapStatusType fromValue(String v) { - for (AccountSegmentMapStatusType c: AccountSegmentMapStatusType.values()) { - if (c.value.equals(v)) { - return c; - } - } - throw new IllegalArgumentException(v); - } - -} diff --git a/Plugins/Mineplex.BungeeRotator/src/com/neustar/ultraservice/schema/ObjectFactory.java b/Plugins/Mineplex.BungeeRotator/src/com/neustar/ultraservice/schema/ObjectFactory.java deleted file mode 100644 index ef607d79e..000000000 --- a/Plugins/Mineplex.BungeeRotator/src/com/neustar/ultraservice/schema/ObjectFactory.java +++ /dev/null @@ -1,32 +0,0 @@ - -package com.neustar.ultraservice.schema; - -import javax.xml.bind.annotation.XmlRegistry; - - -/** - * This object contains factory methods for each - * Java content interface and Java element interface - * generated in the com.neustar.ultraservice.schema package. - *

An ObjectFactory allows you to programatically - * construct new instances of the Java representation - * for XML content. The Java representation of XML - * content can consist of schema derived interfaces - * and classes representing the binding of schema - * type definitions, element declarations and model - * groups. Factory methods for each of these are - * provided in this class. - * - */ -@XmlRegistry -public class ObjectFactory { - - - /** - * Create a new ObjectFactory that can be used to create new instances of schema derived classes for package: com.neustar.ultraservice.schema - * - */ - public ObjectFactory() { - } - -} diff --git a/Plugins/Mineplex.BungeeRotator/src/com/neustar/ultraservice/schema/v01/ARAlertRuleDetails.java b/Plugins/Mineplex.BungeeRotator/src/com/neustar/ultraservice/schema/v01/ARAlertRuleDetails.java deleted file mode 100644 index 2fb697a74..000000000 --- a/Plugins/Mineplex.BungeeRotator/src/com/neustar/ultraservice/schema/v01/ARAlertRuleDetails.java +++ /dev/null @@ -1,90 +0,0 @@ - -package com.neustar.ultraservice.schema.v01; - -import javax.xml.bind.annotation.XmlAccessType; -import javax.xml.bind.annotation.XmlAccessorType; -import javax.xml.bind.annotation.XmlElement; -import javax.xml.bind.annotation.XmlType; - - -/** - *

Java class for ARAlertRuleDetails complex type. - * - *

The following schema fragment specifies the expected content contained within this class. - * - *

- * <complexType name="ARAlertRuleDetails">
- *   <complexContent>
- *     <restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
- *       <sequence>
- *         <element name="oldRule" type="{http://www.w3.org/2001/XMLSchema}string"/>
- *         <element name="newRule" type="{http://www.w3.org/2001/XMLSchema}string"/>
- *       </sequence>
- *     </restriction>
- *   </complexContent>
- * </complexType>
- * 
- * - * - */ -@XmlAccessorType(XmlAccessType.FIELD) -@XmlType(name = "ARAlertRuleDetails", propOrder = { - "oldRule", - "newRule" -}) -public class ARAlertRuleDetails { - - @XmlElement(required = true) - protected String oldRule; - @XmlElement(required = true) - protected String newRule; - - /** - * Gets the value of the oldRule property. - * - * @return - * possible object is - * {@link String } - * - */ - public String getOldRule() { - return oldRule; - } - - /** - * Sets the value of the oldRule property. - * - * @param value - * allowed object is - * {@link String } - * - */ - public void setOldRule(String value) { - this.oldRule = value; - } - - /** - * Gets the value of the newRule property. - * - * @return - * possible object is - * {@link String } - * - */ - public String getNewRule() { - return newRule; - } - - /** - * Sets the value of the newRule property. - * - * @param value - * allowed object is - * {@link String } - * - */ - public void setNewRule(String value) { - this.newRule = value; - } - -} diff --git a/Plugins/Mineplex.BungeeRotator/src/com/neustar/ultraservice/schema/v01/ARAlertStateDetails.java b/Plugins/Mineplex.BungeeRotator/src/com/neustar/ultraservice/schema/v01/ARAlertStateDetails.java deleted file mode 100644 index 4b612582c..000000000 --- a/Plugins/Mineplex.BungeeRotator/src/com/neustar/ultraservice/schema/v01/ARAlertStateDetails.java +++ /dev/null @@ -1,173 +0,0 @@ - -package com.neustar.ultraservice.schema.v01; - -import javax.xml.bind.annotation.XmlAccessType; -import javax.xml.bind.annotation.XmlAccessorType; -import javax.xml.bind.annotation.XmlElement; -import javax.xml.bind.annotation.XmlType; - - -/** - *

Java class for ARAlertStateDetails complex type. - * - *

The following schema fragment specifies the expected content contained within this class. - * - *

- * <complexType name="ARAlertStateDetails">
- *   <complexContent>
- *     <restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
- *       <sequence>
- *         <element name="oldRecordState" type="{http://schema.ultraservice.neustar.com/v01/}RecordState"/>
- *         <element name="newRecordState" type="{http://schema.ultraservice.neustar.com/v01/}RecordState"/>
- *         <element name="prioritizedRecords" type="{http://schema.ultraservice.neustar.com/v01/}PrioritizedRecordsList"/>
- *         <element name="allFailDetails" type="{http://schema.ultraservice.neustar.com/v01/}AlertAllFailDetails"/>
- *         <element name="poolStatus" type="{http://schema.ultraservice.neustar.com/v01/}AlertPoolStatus" minOccurs="0"/>
- *       </sequence>
- *     </restriction>
- *   </complexContent>
- * </complexType>
- * 
- * - * - */ -@XmlAccessorType(XmlAccessType.FIELD) -@XmlType(name = "ARAlertStateDetails", propOrder = { - "oldRecordState", - "newRecordState", - "prioritizedRecords", - "allFailDetails", - "poolStatus" -}) -public class ARAlertStateDetails { - - @XmlElement(required = true) - protected RecordState oldRecordState; - @XmlElement(required = true) - protected RecordState newRecordState; - @XmlElement(required = true) - protected PrioritizedRecordsList prioritizedRecords; - @XmlElement(required = true) - protected AlertAllFailDetails allFailDetails; - protected AlertPoolStatus poolStatus; - - /** - * Gets the value of the oldRecordState property. - * - * @return - * possible object is - * {@link RecordState } - * - */ - public RecordState getOldRecordState() { - return oldRecordState; - } - - /** - * Sets the value of the oldRecordState property. - * - * @param value - * allowed object is - * {@link RecordState } - * - */ - public void setOldRecordState(RecordState value) { - this.oldRecordState = value; - } - - /** - * Gets the value of the newRecordState property. - * - * @return - * possible object is - * {@link RecordState } - * - */ - public RecordState getNewRecordState() { - return newRecordState; - } - - /** - * Sets the value of the newRecordState property. - * - * @param value - * allowed object is - * {@link RecordState } - * - */ - public void setNewRecordState(RecordState value) { - this.newRecordState = value; - } - - /** - * Gets the value of the prioritizedRecords property. - * - * @return - * possible object is - * {@link PrioritizedRecordsList } - * - */ - public PrioritizedRecordsList getPrioritizedRecords() { - return prioritizedRecords; - } - - /** - * Sets the value of the prioritizedRecords property. - * - * @param value - * allowed object is - * {@link PrioritizedRecordsList } - * - */ - public void setPrioritizedRecords(PrioritizedRecordsList value) { - this.prioritizedRecords = value; - } - - /** - * Gets the value of the allFailDetails property. - * - * @return - * possible object is - * {@link AlertAllFailDetails } - * - */ - public AlertAllFailDetails getAllFailDetails() { - return allFailDetails; - } - - /** - * Sets the value of the allFailDetails property. - * - * @param value - * allowed object is - * {@link AlertAllFailDetails } - * - */ - public void setAllFailDetails(AlertAllFailDetails value) { - this.allFailDetails = value; - } - - /** - * Gets the value of the poolStatus property. - * - * @return - * possible object is - * {@link AlertPoolStatus } - * - */ - public AlertPoolStatus getPoolStatus() { - return poolStatus; - } - - /** - * Sets the value of the poolStatus property. - * - * @param value - * allowed object is - * {@link AlertPoolStatus } - * - */ - public void setPoolStatus(AlertPoolStatus value) { - this.poolStatus = value; - } - -} diff --git a/Plugins/Mineplex.BungeeRotator/src/com/neustar/ultraservice/schema/v01/ARPoolAlert.java b/Plugins/Mineplex.BungeeRotator/src/com/neustar/ultraservice/schema/v01/ARPoolAlert.java deleted file mode 100644 index 6a1f02487..000000000 --- a/Plugins/Mineplex.BungeeRotator/src/com/neustar/ultraservice/schema/v01/ARPoolAlert.java +++ /dev/null @@ -1,62 +0,0 @@ - -package com.neustar.ultraservice.schema.v01; - -import javax.xml.bind.annotation.XmlAccessType; -import javax.xml.bind.annotation.XmlAccessorType; -import javax.xml.bind.annotation.XmlElement; -import javax.xml.bind.annotation.XmlType; - - -/** - *

Java class for ARPoolAlert complex type. - * - *

The following schema fragment specifies the expected content contained within this class. - * - *

- * <complexType name="ARPoolAlert">
- *   <complexContent>
- *     <restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
- *       <sequence>
- *         <element name="poolAlertDetails" type="{http://schema.ultraservice.neustar.com/v01/}PoolAlertDetails"/>
- *       </sequence>
- *     </restriction>
- *   </complexContent>
- * </complexType>
- * 
- * - * - */ -@XmlAccessorType(XmlAccessType.FIELD) -@XmlType(name = "ARPoolAlert", propOrder = { - "poolAlertDetails" -}) -public class ARPoolAlert { - - @XmlElement(required = true) - protected PoolAlertDetails poolAlertDetails; - - /** - * Gets the value of the poolAlertDetails property. - * - * @return - * possible object is - * {@link PoolAlertDetails } - * - */ - public PoolAlertDetails getPoolAlertDetails() { - return poolAlertDetails; - } - - /** - * Sets the value of the poolAlertDetails property. - * - * @param value - * allowed object is - * {@link PoolAlertDetails } - * - */ - public void setPoolAlertDetails(PoolAlertDetails value) { - this.poolAlertDetails = value; - } - -} diff --git a/Plugins/Mineplex.BungeeRotator/src/com/neustar/ultraservice/schema/v01/ARPoolAlerts.java b/Plugins/Mineplex.BungeeRotator/src/com/neustar/ultraservice/schema/v01/ARPoolAlerts.java deleted file mode 100644 index 16afd46d2..000000000 --- a/Plugins/Mineplex.BungeeRotator/src/com/neustar/ultraservice/schema/v01/ARPoolAlerts.java +++ /dev/null @@ -1,69 +0,0 @@ - -package com.neustar.ultraservice.schema.v01; - -import java.util.ArrayList; -import java.util.List; -import javax.xml.bind.annotation.XmlAccessType; -import javax.xml.bind.annotation.XmlAccessorType; -import javax.xml.bind.annotation.XmlElement; -import javax.xml.bind.annotation.XmlType; - - -/** - *

Java class for ARPoolAlerts complex type. - * - *

The following schema fragment specifies the expected content contained within this class. - * - *

- * <complexType name="ARPoolAlerts">
- *   <complexContent>
- *     <restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
- *       <sequence>
- *         <element name="poolAlert" type="{http://schema.ultraservice.neustar.com/v01/}ARPoolAlert" maxOccurs="unbounded"/>
- *       </sequence>
- *     </restriction>
- *   </complexContent>
- * </complexType>
- * 
- * - * - */ -@XmlAccessorType(XmlAccessType.FIELD) -@XmlType(name = "ARPoolAlerts", propOrder = { - "poolAlert" -}) -public class ARPoolAlerts { - - @XmlElement(required = true) - protected List poolAlert; - - /** - * Gets the value of the poolAlert property. - * - *

- * This accessor method returns a reference to the live list, - * not a snapshot. Therefore any modification you make to the - * returned list will be present inside the JAXB object. - * This is why there is not a set method for the poolAlert property. - * - *

- * For example, to add a new item, do as follows: - *

-     *    getPoolAlert().add(newItem);
-     * 
- * - * - *

- * Objects of the following type(s) are allowed in the list - * {@link ARPoolAlert } - * - * - */ - public List getPoolAlert() { - if (poolAlert == null) { - poolAlert = new ArrayList(); - } - return this.poolAlert; - } - -} diff --git a/Plugins/Mineplex.BungeeRotator/src/com/neustar/ultraservice/schema/v01/ARPoolAlertsKey.java b/Plugins/Mineplex.BungeeRotator/src/com/neustar/ultraservice/schema/v01/ARPoolAlertsKey.java deleted file mode 100644 index 1dc420c4c..000000000 --- a/Plugins/Mineplex.BungeeRotator/src/com/neustar/ultraservice/schema/v01/ARPoolAlertsKey.java +++ /dev/null @@ -1,62 +0,0 @@ - -package com.neustar.ultraservice.schema.v01; - -import javax.xml.bind.annotation.XmlAccessType; -import javax.xml.bind.annotation.XmlAccessorType; -import javax.xml.bind.annotation.XmlElement; -import javax.xml.bind.annotation.XmlType; - - -/** - *

Java class for ARPoolAlertsKey complex type. - * - *

The following schema fragment specifies the expected content contained within this class. - * - *

- * <complexType name="ARPoolAlertsKey">
- *   <complexContent>
- *     <restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
- *       <sequence>
- *         <element name="poolName" type="{http://www.w3.org/2001/XMLSchema}string"/>
- *       </sequence>
- *     </restriction>
- *   </complexContent>
- * </complexType>
- * 
- * - * - */ -@XmlAccessorType(XmlAccessType.FIELD) -@XmlType(name = "ARPoolAlertsKey", propOrder = { - "poolName" -}) -public class ARPoolAlertsKey { - - @XmlElement(required = true) - protected String poolName; - - /** - * Gets the value of the poolName property. - * - * @return - * possible object is - * {@link String } - * - */ - public String getPoolName() { - return poolName; - } - - /** - * Sets the value of the poolName property. - * - * @param value - * allowed object is - * {@link String } - * - */ - public void setPoolName(String value) { - this.poolName = value; - } - -} diff --git a/Plugins/Mineplex.BungeeRotator/src/com/neustar/ultraservice/schema/v01/ARPoolAlertsList.java b/Plugins/Mineplex.BungeeRotator/src/com/neustar/ultraservice/schema/v01/ARPoolAlertsList.java deleted file mode 100644 index 8f5418d97..000000000 --- a/Plugins/Mineplex.BungeeRotator/src/com/neustar/ultraservice/schema/v01/ARPoolAlertsList.java +++ /dev/null @@ -1,119 +0,0 @@ - -package com.neustar.ultraservice.schema.v01; - -import javax.xml.bind.annotation.XmlAccessType; -import javax.xml.bind.annotation.XmlAccessorType; -import javax.xml.bind.annotation.XmlElement; -import javax.xml.bind.annotation.XmlType; - - -/** - *

Java class for ARPoolAlertsList complex type. - * - *

The following schema fragment specifies the expected content contained within this class. - * - *

- * <complexType name="ARPoolAlertsList">
- *   <complexContent>
- *     <restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
- *       <sequence>
- *         <element name="arPoolAlerts" type="{http://schema.ultraservice.neustar.com/v01/}ARPoolAlerts"/>
- *         <element name="total" type="{http://www.w3.org/2001/XMLSchema}int"/>
- *         <element name="offset" type="{http://www.w3.org/2001/XMLSchema}int"/>
- *         <element name="count" type="{http://www.w3.org/2001/XMLSchema}int"/>
- *       </sequence>
- *     </restriction>
- *   </complexContent>
- * </complexType>
- * 
- * - * - */ -@XmlAccessorType(XmlAccessType.FIELD) -@XmlType(name = "ARPoolAlertsList", propOrder = { - "arPoolAlerts", - "total", - "offset", - "count" -}) -public class ARPoolAlertsList { - - @XmlElement(required = true) - protected ARPoolAlerts arPoolAlerts; - protected int total; - protected int offset; - protected int count; - - /** - * Gets the value of the arPoolAlerts property. - * - * @return - * possible object is - * {@link ARPoolAlerts } - * - */ - public ARPoolAlerts getArPoolAlerts() { - return arPoolAlerts; - } - - /** - * Sets the value of the arPoolAlerts property. - * - * @param value - * allowed object is - * {@link ARPoolAlerts } - * - */ - public void setArPoolAlerts(ARPoolAlerts value) { - this.arPoolAlerts = value; - } - - /** - * Gets the value of the total property. - * - */ - public int getTotal() { - return total; - } - - /** - * Sets the value of the total property. - * - */ - public void setTotal(int value) { - this.total = value; - } - - /** - * Gets the value of the offset property. - * - */ - public int getOffset() { - return offset; - } - - /** - * Sets the value of the offset property. - * - */ - public void setOffset(int value) { - this.offset = value; - } - - /** - * Gets the value of the count property. - * - */ - public int getCount() { - return count; - } - - /** - * Sets the value of the count property. - * - */ - public void setCount(int value) { - this.count = value; - } - -} diff --git a/Plugins/Mineplex.BungeeRotator/src/com/neustar/ultraservice/schema/v01/ARPoolConfigurationKey.java b/Plugins/Mineplex.BungeeRotator/src/com/neustar/ultraservice/schema/v01/ARPoolConfigurationKey.java deleted file mode 100644 index 8d8a8ce2f..000000000 --- a/Plugins/Mineplex.BungeeRotator/src/com/neustar/ultraservice/schema/v01/ARPoolConfigurationKey.java +++ /dev/null @@ -1,90 +0,0 @@ - -package com.neustar.ultraservice.schema.v01; - -import javax.xml.bind.annotation.XmlAccessType; -import javax.xml.bind.annotation.XmlAccessorType; -import javax.xml.bind.annotation.XmlElement; -import javax.xml.bind.annotation.XmlType; - - -/** - *

Java class for ARPoolConfigurationKey complex type. - * - *

The following schema fragment specifies the expected content contained within this class. - * - *

- * <complexType name="ARPoolConfigurationKey">
- *   <complexContent>
- *     <restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
- *       <sequence>
- *         <element name="poolName" type="{http://www.w3.org/2001/XMLSchema}string"/>
- *         <element name="configurationName" type="{http://www.w3.org/2001/XMLSchema}string"/>
- *       </sequence>
- *     </restriction>
- *   </complexContent>
- * </complexType>
- * 
- * - * - */ -@XmlAccessorType(XmlAccessType.FIELD) -@XmlType(name = "ARPoolConfigurationKey", propOrder = { - "poolName", - "configurationName" -}) -public class ARPoolConfigurationKey { - - @XmlElement(required = true) - protected String poolName; - @XmlElement(required = true) - protected String configurationName; - - /** - * Gets the value of the poolName property. - * - * @return - * possible object is - * {@link String } - * - */ - public String getPoolName() { - return poolName; - } - - /** - * Sets the value of the poolName property. - * - * @param value - * allowed object is - * {@link String } - * - */ - public void setPoolName(String value) { - this.poolName = value; - } - - /** - * Gets the value of the configurationName property. - * - * @return - * possible object is - * {@link String } - * - */ - public String getConfigurationName() { - return configurationName; - } - - /** - * Sets the value of the configurationName property. - * - * @param value - * allowed object is - * {@link String } - * - */ - public void setConfigurationName(String value) { - this.configurationName = value; - } - -} diff --git a/Plugins/Mineplex.BungeeRotator/src/com/neustar/ultraservice/schema/v01/ARPoolConfigurationUpdate.java b/Plugins/Mineplex.BungeeRotator/src/com/neustar/ultraservice/schema/v01/ARPoolConfigurationUpdate.java deleted file mode 100644 index 370aa617e..000000000 --- a/Plugins/Mineplex.BungeeRotator/src/com/neustar/ultraservice/schema/v01/ARPoolConfigurationUpdate.java +++ /dev/null @@ -1,276 +0,0 @@ - -package com.neustar.ultraservice.schema.v01; - -import javax.xml.bind.annotation.XmlAccessType; -import javax.xml.bind.annotation.XmlAccessorType; -import javax.xml.bind.annotation.XmlType; - - -/** - *

Java class for ARPoolConfigurationUpdate complex type. - * - *

The following schema fragment specifies the expected content contained within this class. - * - *

- * <complexType name="ARPoolConfigurationUpdate">
- *   <complexContent>
- *     <restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
- *       <sequence>
- *         <element name="failoverEnabled" type="{http://www.w3.org/2001/XMLSchema}boolean" minOccurs="0"/>
- *         <element name="probingEnabled" type="{http://www.w3.org/2001/XMLSchema}boolean" minOccurs="0"/>
- *         <element name="responseMethod" type="{http://schema.ultraservice.neustar.com/v01/}ResponseMethod" minOccurs="0"/>
- *         <element name="maxActive" type="{http://www.w3.org/2001/XMLSchema}long" minOccurs="0"/>
- *         <element name="maxResponse" type="{http://www.w3.org/2001/XMLSchema}long" minOccurs="0"/>
- *         <element name="effectiveMaxResponse" type="{http://www.w3.org/2001/XMLSchema}long" minOccurs="0"/>
- *         <element name="ttl" type="{http://www.w3.org/2001/XMLSchema}long" minOccurs="0"/>
- *         <element name="description" type="{http://www.w3.org/2001/XMLSchema}string" minOccurs="0"/>
- *         <element name="prioritizedRecords" type="{http://schema.ultraservice.neustar.com/v01/}PrioritizedRecordList" minOccurs="0"/>
- *       </sequence>
- *     </restriction>
- *   </complexContent>
- * </complexType>
- * 
- * - * - */ -@XmlAccessorType(XmlAccessType.FIELD) -@XmlType(name = "ARPoolConfigurationUpdate", propOrder = { - "failoverEnabled", - "probingEnabled", - "responseMethod", - "maxActive", - "maxResponse", - "effectiveMaxResponse", - "ttl", - "description", - "prioritizedRecords" -}) -public class ARPoolConfigurationUpdate { - - protected Boolean failoverEnabled; - protected Boolean probingEnabled; - protected ResponseMethod responseMethod; - protected Long maxActive; - protected Long maxResponse; - protected Long effectiveMaxResponse; - protected Long ttl; - protected String description; - protected PrioritizedRecordList prioritizedRecords; - - /** - * Gets the value of the failoverEnabled property. - * - * @return - * possible object is - * {@link Boolean } - * - */ - public Boolean isFailoverEnabled() { - return failoverEnabled; - } - - /** - * Sets the value of the failoverEnabled property. - * - * @param value - * allowed object is - * {@link Boolean } - * - */ - public void setFailoverEnabled(Boolean value) { - this.failoverEnabled = value; - } - - /** - * Gets the value of the probingEnabled property. - * - * @return - * possible object is - * {@link Boolean } - * - */ - public Boolean isProbingEnabled() { - return probingEnabled; - } - - /** - * Sets the value of the probingEnabled property. - * - * @param value - * allowed object is - * {@link Boolean } - * - */ - public void setProbingEnabled(Boolean value) { - this.probingEnabled = value; - } - - /** - * Gets the value of the responseMethod property. - * - * @return - * possible object is - * {@link ResponseMethod } - * - */ - public ResponseMethod getResponseMethod() { - return responseMethod; - } - - /** - * Sets the value of the responseMethod property. - * - * @param value - * allowed object is - * {@link ResponseMethod } - * - */ - public void setResponseMethod(ResponseMethod value) { - this.responseMethod = value; - } - - /** - * Gets the value of the maxActive property. - * - * @return - * possible object is - * {@link Long } - * - */ - public Long getMaxActive() { - return maxActive; - } - - /** - * Sets the value of the maxActive property. - * - * @param value - * allowed object is - * {@link Long } - * - */ - public void setMaxActive(Long value) { - this.maxActive = value; - } - - /** - * Gets the value of the maxResponse property. - * - * @return - * possible object is - * {@link Long } - * - */ - public Long getMaxResponse() { - return maxResponse; - } - - /** - * Sets the value of the maxResponse property. - * - * @param value - * allowed object is - * {@link Long } - * - */ - public void setMaxResponse(Long value) { - this.maxResponse = value; - } - - /** - * Gets the value of the effectiveMaxResponse property. - * - * @return - * possible object is - * {@link Long } - * - */ - public Long getEffectiveMaxResponse() { - return effectiveMaxResponse; - } - - /** - * Sets the value of the effectiveMaxResponse property. - * - * @param value - * allowed object is - * {@link Long } - * - */ - public void setEffectiveMaxResponse(Long value) { - this.effectiveMaxResponse = value; - } - - /** - * Gets the value of the ttl property. - * - * @return - * possible object is - * {@link Long } - * - */ - public Long getTtl() { - return ttl; - } - - /** - * Sets the value of the ttl property. - * - * @param value - * allowed object is - * {@link Long } - * - */ - public void setTtl(Long value) { - this.ttl = value; - } - - /** - * Gets the value of the description property. - * - * @return - * possible object is - * {@link String } - * - */ - public String getDescription() { - return description; - } - - /** - * Sets the value of the description property. - * - * @param value - * allowed object is - * {@link String } - * - */ - public void setDescription(String value) { - this.description = value; - } - - /** - * Gets the value of the prioritizedRecords property. - * - * @return - * possible object is - * {@link PrioritizedRecordList } - * - */ - public PrioritizedRecordList getPrioritizedRecords() { - return prioritizedRecords; - } - - /** - * Sets the value of the prioritizedRecords property. - * - * @param value - * allowed object is - * {@link PrioritizedRecordList } - * - */ - public void setPrioritizedRecords(PrioritizedRecordList value) { - this.prioritizedRecords = value; - } - -} diff --git a/Plugins/Mineplex.BungeeRotator/src/com/neustar/ultraservice/schema/v01/ARPoolProbeList.java b/Plugins/Mineplex.BungeeRotator/src/com/neustar/ultraservice/schema/v01/ARPoolProbeList.java deleted file mode 100644 index df10fde7d..000000000 --- a/Plugins/Mineplex.BungeeRotator/src/com/neustar/ultraservice/schema/v01/ARPoolProbeList.java +++ /dev/null @@ -1,60 +0,0 @@ - -package com.neustar.ultraservice.schema.v01; - -import javax.xml.bind.annotation.XmlAccessType; -import javax.xml.bind.annotation.XmlAccessorType; -import javax.xml.bind.annotation.XmlType; - - -/** - *

Java class for ARPoolProbeList complex type. - * - *

The following schema fragment specifies the expected content contained within this class. - * - *

- * <complexType name="ARPoolProbeList">
- *   <complexContent>
- *     <restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
- *       <sequence>
- *         <element name="arPoolProbes" type="{http://schema.ultraservice.neustar.com/v01/}ARPoolProbes" minOccurs="0"/>
- *       </sequence>
- *     </restriction>
- *   </complexContent>
- * </complexType>
- * 
- * - * - */ -@XmlAccessorType(XmlAccessType.FIELD) -@XmlType(name = "ARPoolProbeList", propOrder = { - "arPoolProbes" -}) -public class ARPoolProbeList { - - protected ARPoolProbes arPoolProbes; - - /** - * Gets the value of the arPoolProbes property. - * - * @return - * possible object is - * {@link ARPoolProbes } - * - */ - public ARPoolProbes getArPoolProbes() { - return arPoolProbes; - } - - /** - * Sets the value of the arPoolProbes property. - * - * @param value - * allowed object is - * {@link ARPoolProbes } - * - */ - public void setArPoolProbes(ARPoolProbes value) { - this.arPoolProbes = value; - } - -} diff --git a/Plugins/Mineplex.BungeeRotator/src/com/neustar/ultraservice/schema/v01/ARPoolProbes.java b/Plugins/Mineplex.BungeeRotator/src/com/neustar/ultraservice/schema/v01/ARPoolProbes.java deleted file mode 100644 index a7bb419cb..000000000 --- a/Plugins/Mineplex.BungeeRotator/src/com/neustar/ultraservice/schema/v01/ARPoolProbes.java +++ /dev/null @@ -1,67 +0,0 @@ - -package com.neustar.ultraservice.schema.v01; - -import java.util.ArrayList; -import java.util.List; -import javax.xml.bind.annotation.XmlAccessType; -import javax.xml.bind.annotation.XmlAccessorType; -import javax.xml.bind.annotation.XmlType; - - -/** - *

Java class for ARPoolProbes complex type. - * - *

The following schema fragment specifies the expected content contained within this class. - * - *

- * <complexType name="ARPoolProbes">
- *   <complexContent>
- *     <restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
- *       <sequence>
- *         <element name="arPoolProbe" type="{http://schema.ultraservice.neustar.com/v01/}ARProbeInfo" maxOccurs="unbounded" minOccurs="0"/>
- *       </sequence>
- *     </restriction>
- *   </complexContent>
- * </complexType>
- * 
- * - * - */ -@XmlAccessorType(XmlAccessType.FIELD) -@XmlType(name = "ARPoolProbes", propOrder = { - "arPoolProbe" -}) -public class ARPoolProbes { - - protected List arPoolProbe; - - /** - * Gets the value of the arPoolProbe property. - * - *

- * This accessor method returns a reference to the live list, - * not a snapshot. Therefore any modification you make to the - * returned list will be present inside the JAXB object. - * This is why there is not a set method for the arPoolProbe property. - * - *

- * For example, to add a new item, do as follows: - *

-     *    getArPoolProbe().add(newItem);
-     * 
- * - * - *

- * Objects of the following type(s) are allowed in the list - * {@link ARProbeInfo } - * - * - */ - public List getArPoolProbe() { - if (arPoolProbe == null) { - arPoolProbe = new ArrayList(); - } - return this.arPoolProbe; - } - -} diff --git a/Plugins/Mineplex.BungeeRotator/src/com/neustar/ultraservice/schema/v01/ARPoolRecord.java b/Plugins/Mineplex.BungeeRotator/src/com/neustar/ultraservice/schema/v01/ARPoolRecord.java deleted file mode 100644 index fb5f71ebf..000000000 --- a/Plugins/Mineplex.BungeeRotator/src/com/neustar/ultraservice/schema/v01/ARPoolRecord.java +++ /dev/null @@ -1,246 +0,0 @@ - -package com.neustar.ultraservice.schema.v01; - -import javax.xml.bind.annotation.XmlAccessType; -import javax.xml.bind.annotation.XmlAccessorType; -import javax.xml.bind.annotation.XmlElement; -import javax.xml.bind.annotation.XmlType; - - -/** - *

Java class for ARPoolRecord complex type. - * - *

The following schema fragment specifies the expected content contained within this class. - * - *

- * <complexType name="ARPoolRecord">
- *   <complexContent>
- *     <restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
- *       <sequence>
- *         <element name="poolName" type="{http://www.w3.org/2001/XMLSchema}string"/>
- *         <element name="description" type="{http://www.w3.org/2001/XMLSchema}string" minOccurs="0"/>
- *         <element name="poolRecordType" type="{http://schema.ultraservice.neustar.com/v01/}RecordType"/>
- *         <element name="poolRecordValue" type="{http://www.w3.org/2001/XMLSchema}string"/>
- *         <element name="forcedState" type="{http://schema.ultraservice.neustar.com/v01/}ForcedState"/>
- *         <element name="probesEnabled" type="{http://www.w3.org/2001/XMLSchema}boolean"/>
- *         <element name="weight" type="{http://www.w3.org/2001/XMLSchema}int" minOccurs="0"/>
- *         <element name="allFail" type="{http://www.w3.org/2001/XMLSchema}boolean" minOccurs="0"/>
- *       </sequence>
- *     </restriction>
- *   </complexContent>
- * </complexType>
- * 
- * - * - */ -@XmlAccessorType(XmlAccessType.FIELD) -@XmlType(name = "ARPoolRecord", propOrder = { - "poolName", - "description", - "poolRecordType", - "poolRecordValue", - "forcedState", - "probesEnabled", - "weight", - "allFail" -}) -public class ARPoolRecord { - - @XmlElement(required = true) - protected String poolName; - protected String description; - @XmlElement(required = true) - protected RecordType poolRecordType; - @XmlElement(required = true) - protected String poolRecordValue; - @XmlElement(required = true) - protected ForcedState forcedState; - protected boolean probesEnabled; - protected Integer weight; - protected Boolean allFail; - - /** - * Gets the value of the poolName property. - * - * @return - * possible object is - * {@link String } - * - */ - public String getPoolName() { - return poolName; - } - - /** - * Sets the value of the poolName property. - * - * @param value - * allowed object is - * {@link String } - * - */ - public void setPoolName(String value) { - this.poolName = value; - } - - /** - * Gets the value of the description property. - * - * @return - * possible object is - * {@link String } - * - */ - public String getDescription() { - return description; - } - - /** - * Sets the value of the description property. - * - * @param value - * allowed object is - * {@link String } - * - */ - public void setDescription(String value) { - this.description = value; - } - - /** - * Gets the value of the poolRecordType property. - * - * @return - * possible object is - * {@link RecordType } - * - */ - public RecordType getPoolRecordType() { - return poolRecordType; - } - - /** - * Sets the value of the poolRecordType property. - * - * @param value - * allowed object is - * {@link RecordType } - * - */ - public void setPoolRecordType(RecordType value) { - this.poolRecordType = value; - } - - /** - * Gets the value of the poolRecordValue property. - * - * @return - * possible object is - * {@link String } - * - */ - public String getPoolRecordValue() { - return poolRecordValue; - } - - /** - * Sets the value of the poolRecordValue property. - * - * @param value - * allowed object is - * {@link String } - * - */ - public void setPoolRecordValue(String value) { - this.poolRecordValue = value; - } - - /** - * Gets the value of the forcedState property. - * - * @return - * possible object is - * {@link ForcedState } - * - */ - public ForcedState getForcedState() { - return forcedState; - } - - /** - * Sets the value of the forcedState property. - * - * @param value - * allowed object is - * {@link ForcedState } - * - */ - public void setForcedState(ForcedState value) { - this.forcedState = value; - } - - /** - * Gets the value of the probesEnabled property. - * - */ - public boolean isProbesEnabled() { - return probesEnabled; - } - - /** - * Sets the value of the probesEnabled property. - * - */ - public void setProbesEnabled(boolean value) { - this.probesEnabled = value; - } - - /** - * Gets the value of the weight property. - * - * @return - * possible object is - * {@link Integer } - * - */ - public Integer getWeight() { - return weight; - } - - /** - * Sets the value of the weight property. - * - * @param value - * allowed object is - * {@link Integer } - * - */ - public void setWeight(Integer value) { - this.weight = value; - } - - /** - * Gets the value of the allFail property. - * - * @return - * possible object is - * {@link Boolean } - * - */ - public Boolean isAllFail() { - return allFail; - } - - /** - * Sets the value of the allFail property. - * - * @param value - * allowed object is - * {@link Boolean } - * - */ - public void setAllFail(Boolean value) { - this.allFail = value; - } - -} diff --git a/Plugins/Mineplex.BungeeRotator/src/com/neustar/ultraservice/schema/v01/ARPoolRecordListKey.java b/Plugins/Mineplex.BungeeRotator/src/com/neustar/ultraservice/schema/v01/ARPoolRecordListKey.java deleted file mode 100644 index a28d87f78..000000000 --- a/Plugins/Mineplex.BungeeRotator/src/com/neustar/ultraservice/schema/v01/ARPoolRecordListKey.java +++ /dev/null @@ -1,90 +0,0 @@ - -package com.neustar.ultraservice.schema.v01; - -import javax.xml.bind.annotation.XmlAccessType; -import javax.xml.bind.annotation.XmlAccessorType; -import javax.xml.bind.annotation.XmlElement; -import javax.xml.bind.annotation.XmlType; - - -/** - *

Java class for ARPoolRecordListKey complex type. - * - *

The following schema fragment specifies the expected content contained within this class. - * - *

- * <complexType name="ARPoolRecordListKey">
- *   <complexContent>
- *     <restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
- *       <sequence>
- *         <element name="poolName" type="{http://www.w3.org/2001/XMLSchema}string"/>
- *         <element name="configurationName" type="{http://www.w3.org/2001/XMLSchema}string"/>
- *       </sequence>
- *     </restriction>
- *   </complexContent>
- * </complexType>
- * 
- * - * - */ -@XmlAccessorType(XmlAccessType.FIELD) -@XmlType(name = "ARPoolRecordListKey", propOrder = { - "poolName", - "configurationName" -}) -public class ARPoolRecordListKey { - - @XmlElement(required = true) - protected String poolName; - @XmlElement(required = true) - protected String configurationName; - - /** - * Gets the value of the poolName property. - * - * @return - * possible object is - * {@link String } - * - */ - public String getPoolName() { - return poolName; - } - - /** - * Sets the value of the poolName property. - * - * @param value - * allowed object is - * {@link String } - * - */ - public void setPoolName(String value) { - this.poolName = value; - } - - /** - * Gets the value of the configurationName property. - * - * @return - * possible object is - * {@link String } - * - */ - public String getConfigurationName() { - return configurationName; - } - - /** - * Sets the value of the configurationName property. - * - * @param value - * allowed object is - * {@link String } - * - */ - public void setConfigurationName(String value) { - this.configurationName = value; - } - -} diff --git a/Plugins/Mineplex.BungeeRotator/src/com/neustar/ultraservice/schema/v01/ARPoolRecords.java b/Plugins/Mineplex.BungeeRotator/src/com/neustar/ultraservice/schema/v01/ARPoolRecords.java deleted file mode 100644 index 03e36e498..000000000 --- a/Plugins/Mineplex.BungeeRotator/src/com/neustar/ultraservice/schema/v01/ARPoolRecords.java +++ /dev/null @@ -1,67 +0,0 @@ - -package com.neustar.ultraservice.schema.v01; - -import java.util.ArrayList; -import java.util.List; -import javax.xml.bind.annotation.XmlAccessType; -import javax.xml.bind.annotation.XmlAccessorType; -import javax.xml.bind.annotation.XmlType; - - -/** - *

Java class for ARPoolRecords complex type. - * - *

The following schema fragment specifies the expected content contained within this class. - * - *

- * <complexType name="ARPoolRecords">
- *   <complexContent>
- *     <restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
- *       <sequence>
- *         <element name="poolRecord" type="{http://schema.ultraservice.neustar.com/v01/}PoolRecord" maxOccurs="unbounded" minOccurs="0"/>
- *       </sequence>
- *     </restriction>
- *   </complexContent>
- * </complexType>
- * 
- * - * - */ -@XmlAccessorType(XmlAccessType.FIELD) -@XmlType(name = "ARPoolRecords", propOrder = { - "poolRecord" -}) -public class ARPoolRecords { - - protected List poolRecord; - - /** - * Gets the value of the poolRecord property. - * - *

- * This accessor method returns a reference to the live list, - * not a snapshot. Therefore any modification you make to the - * returned list will be present inside the JAXB object. - * This is why there is not a set method for the poolRecord property. - * - *

- * For example, to add a new item, do as follows: - *

-     *    getPoolRecord().add(newItem);
-     * 
- * - * - *

- * Objects of the following type(s) are allowed in the list - * {@link PoolRecord } - * - * - */ - public List getPoolRecord() { - if (poolRecord == null) { - poolRecord = new ArrayList(); - } - return this.poolRecord; - } - -} diff --git a/Plugins/Mineplex.BungeeRotator/src/com/neustar/ultraservice/schema/v01/ARPoolRecordsList.java b/Plugins/Mineplex.BungeeRotator/src/com/neustar/ultraservice/schema/v01/ARPoolRecordsList.java deleted file mode 100644 index c222d0fbe..000000000 --- a/Plugins/Mineplex.BungeeRotator/src/com/neustar/ultraservice/schema/v01/ARPoolRecordsList.java +++ /dev/null @@ -1,117 +0,0 @@ - -package com.neustar.ultraservice.schema.v01; - -import javax.xml.bind.annotation.XmlAccessType; -import javax.xml.bind.annotation.XmlAccessorType; -import javax.xml.bind.annotation.XmlType; - - -/** - *

Java class for ARPoolRecordsList complex type. - * - *

The following schema fragment specifies the expected content contained within this class. - * - *

- * <complexType name="ARPoolRecordsList">
- *   <complexContent>
- *     <restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
- *       <sequence>
- *         <element name="arPoolRecords" type="{http://schema.ultraservice.neustar.com/v01/}ARPoolRecords" minOccurs="0"/>
- *         <element name="total" type="{http://www.w3.org/2001/XMLSchema}int"/>
- *         <element name="offset" type="{http://www.w3.org/2001/XMLSchema}int"/>
- *         <element name="count" type="{http://www.w3.org/2001/XMLSchema}int"/>
- *       </sequence>
- *     </restriction>
- *   </complexContent>
- * </complexType>
- * 
- * - * - */ -@XmlAccessorType(XmlAccessType.FIELD) -@XmlType(name = "ARPoolRecordsList", propOrder = { - "arPoolRecords", - "total", - "offset", - "count" -}) -public class ARPoolRecordsList { - - protected ARPoolRecords arPoolRecords; - protected int total; - protected int offset; - protected int count; - - /** - * Gets the value of the arPoolRecords property. - * - * @return - * possible object is - * {@link ARPoolRecords } - * - */ - public ARPoolRecords getArPoolRecords() { - return arPoolRecords; - } - - /** - * Sets the value of the arPoolRecords property. - * - * @param value - * allowed object is - * {@link ARPoolRecords } - * - */ - public void setArPoolRecords(ARPoolRecords value) { - this.arPoolRecords = value; - } - - /** - * Gets the value of the total property. - * - */ - public int getTotal() { - return total; - } - - /** - * Sets the value of the total property. - * - */ - public void setTotal(int value) { - this.total = value; - } - - /** - * Gets the value of the offset property. - * - */ - public int getOffset() { - return offset; - } - - /** - * Sets the value of the offset property. - * - */ - public void setOffset(int value) { - this.offset = value; - } - - /** - * Gets the value of the count property. - * - */ - public int getCount() { - return count; - } - - /** - * Sets the value of the count property. - * - */ - public void setCount(int value) { - this.count = value; - } - -} diff --git a/Plugins/Mineplex.BungeeRotator/src/com/neustar/ultraservice/schema/v01/ARPoolRuleKey.java b/Plugins/Mineplex.BungeeRotator/src/com/neustar/ultraservice/schema/v01/ARPoolRuleKey.java deleted file mode 100644 index 9e3534f7a..000000000 --- a/Plugins/Mineplex.BungeeRotator/src/com/neustar/ultraservice/schema/v01/ARPoolRuleKey.java +++ /dev/null @@ -1,90 +0,0 @@ - -package com.neustar.ultraservice.schema.v01; - -import javax.xml.bind.annotation.XmlAccessType; -import javax.xml.bind.annotation.XmlAccessorType; -import javax.xml.bind.annotation.XmlElement; -import javax.xml.bind.annotation.XmlType; - - -/** - *

Java class for ARPoolRuleKey complex type. - * - *

The following schema fragment specifies the expected content contained within this class. - * - *

- * <complexType name="ARPoolRuleKey">
- *   <complexContent>
- *     <restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
- *       <sequence>
- *         <element name="poolKey" type="{http://schema.ultraservice.neustar.com/v01/}PoolKey"/>
- *         <element name="ruleName" type="{http://www.w3.org/2001/XMLSchema}string"/>
- *       </sequence>
- *     </restriction>
- *   </complexContent>
- * </complexType>
- * 
- * - * - */ -@XmlAccessorType(XmlAccessType.FIELD) -@XmlType(name = "ARPoolRuleKey", propOrder = { - "poolKey", - "ruleName" -}) -public class ARPoolRuleKey { - - @XmlElement(required = true) - protected PoolKey poolKey; - @XmlElement(required = true) - protected String ruleName; - - /** - * Gets the value of the poolKey property. - * - * @return - * possible object is - * {@link PoolKey } - * - */ - public PoolKey getPoolKey() { - return poolKey; - } - - /** - * Sets the value of the poolKey property. - * - * @param value - * allowed object is - * {@link PoolKey } - * - */ - public void setPoolKey(PoolKey value) { - this.poolKey = value; - } - - /** - * Gets the value of the ruleName property. - * - * @return - * possible object is - * {@link String } - * - */ - public String getRuleName() { - return ruleName; - } - - /** - * Sets the value of the ruleName property. - * - * @param value - * allowed object is - * {@link String } - * - */ - public void setRuleName(String value) { - this.ruleName = value; - } - -} diff --git a/Plugins/Mineplex.BungeeRotator/src/com/neustar/ultraservice/schema/v01/ARProbeInfo.java b/Plugins/Mineplex.BungeeRotator/src/com/neustar/ultraservice/schema/v01/ARProbeInfo.java deleted file mode 100644 index 2a49e354f..000000000 --- a/Plugins/Mineplex.BungeeRotator/src/com/neustar/ultraservice/schema/v01/ARProbeInfo.java +++ /dev/null @@ -1,213 +0,0 @@ - -package com.neustar.ultraservice.schema.v01; - -import java.util.ArrayList; -import java.util.List; -import javax.xml.bind.annotation.XmlAccessType; -import javax.xml.bind.annotation.XmlAccessorType; -import javax.xml.bind.annotation.XmlType; - - -/** - *

Java class for ARProbeInfo complex type. - * - *

The following schema fragment specifies the expected content contained within this class. - * - *

- * <complexType name="ARProbeInfo">
- *   <complexContent>
- *     <restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
- *       <sequence>
- *         <element name="probeName" type="{http://www.w3.org/2001/XMLSchema}string" minOccurs="0"/>
- *         <element name="probeType" type="{http://schema.ultraservice.neustar.com/v01/}ProbeTypeEnum" minOccurs="0"/>
- *         <element name="probeLevel" type="{http://www.w3.org/2001/XMLSchema}string" minOccurs="0"/>
- *         <element name="interval" type="{http://www.w3.org/2001/XMLSchema}int"/>
- *         <element name="regionThreshold" type="{http://www.w3.org/2001/XMLSchema}int"/>
- *         <element name="regions" type="{http://www.w3.org/2001/XMLSchema}string" maxOccurs="unbounded" minOccurs="0"/>
- *         <element name="recordData" type="{http://www.w3.org/2001/XMLSchema}string" minOccurs="0"/>
- *       </sequence>
- *     </restriction>
- *   </complexContent>
- * </complexType>
- * 
- * - * - */ -@XmlAccessorType(XmlAccessType.FIELD) -@XmlType(name = "ARProbeInfo", propOrder = { - "probeName", - "probeType", - "probeLevel", - "interval", - "regionThreshold", - "regions", - "recordData" -}) -public class ARProbeInfo { - - protected String probeName; - protected ProbeTypeEnum probeType; - protected String probeLevel; - protected int interval; - protected int regionThreshold; - protected List regions; - protected String recordData; - - /** - * Gets the value of the probeName property. - * - * @return - * possible object is - * {@link String } - * - */ - public String getProbeName() { - return probeName; - } - - /** - * Sets the value of the probeName property. - * - * @param value - * allowed object is - * {@link String } - * - */ - public void setProbeName(String value) { - this.probeName = value; - } - - /** - * Gets the value of the probeType property. - * - * @return - * possible object is - * {@link ProbeTypeEnum } - * - */ - public ProbeTypeEnum getProbeType() { - return probeType; - } - - /** - * Sets the value of the probeType property. - * - * @param value - * allowed object is - * {@link ProbeTypeEnum } - * - */ - public void setProbeType(ProbeTypeEnum value) { - this.probeType = value; - } - - /** - * Gets the value of the probeLevel property. - * - * @return - * possible object is - * {@link String } - * - */ - public String getProbeLevel() { - return probeLevel; - } - - /** - * Sets the value of the probeLevel property. - * - * @param value - * allowed object is - * {@link String } - * - */ - public void setProbeLevel(String value) { - this.probeLevel = value; - } - - /** - * Gets the value of the interval property. - * - */ - public int getInterval() { - return interval; - } - - /** - * Sets the value of the interval property. - * - */ - public void setInterval(int value) { - this.interval = value; - } - - /** - * Gets the value of the regionThreshold property. - * - */ - public int getRegionThreshold() { - return regionThreshold; - } - - /** - * Sets the value of the regionThreshold property. - * - */ - public void setRegionThreshold(int value) { - this.regionThreshold = value; - } - - /** - * Gets the value of the regions property. - * - *

- * This accessor method returns a reference to the live list, - * not a snapshot. Therefore any modification you make to the - * returned list will be present inside the JAXB object. - * This is why there is not a set method for the regions property. - * - *

- * For example, to add a new item, do as follows: - *

-     *    getRegions().add(newItem);
-     * 
- * - * - *

- * Objects of the following type(s) are allowed in the list - * {@link String } - * - * - */ - public List getRegions() { - if (regions == null) { - regions = new ArrayList(); - } - return this.regions; - } - - /** - * Gets the value of the recordData property. - * - * @return - * possible object is - * {@link String } - * - */ - public String getRecordData() { - return recordData; - } - - /** - * Sets the value of the recordData property. - * - * @param value - * allowed object is - * {@link String } - * - */ - public void setRecordData(String value) { - this.recordData = value; - } - -} diff --git a/Plugins/Mineplex.BungeeRotator/src/com/neustar/ultraservice/schema/v01/ARStatusEnum.java b/Plugins/Mineplex.BungeeRotator/src/com/neustar/ultraservice/schema/v01/ARStatusEnum.java deleted file mode 100644 index 60a5c17ca..000000000 --- a/Plugins/Mineplex.BungeeRotator/src/com/neustar/ultraservice/schema/v01/ARStatusEnum.java +++ /dev/null @@ -1,40 +0,0 @@ - -package com.neustar.ultraservice.schema.v01; - -import javax.xml.bind.annotation.XmlEnum; -import javax.xml.bind.annotation.XmlType; - - -/** - *

Java class for ARStatusEnum. - * - *

The following schema fragment specifies the expected content contained within this class. - *

- *

- * <simpleType name="ARStatusEnum">
- *   <restriction base="{http://www.w3.org/2001/XMLSchema}string">
- *     <enumeration value="OK"/>
- *     <enumeration value="FAIL"/>
- *     <enumeration value="MANUAL"/>
- *   </restriction>
- * </simpleType>
- * 
- * - */ -@XmlType(name = "ARStatusEnum") -@XmlEnum -public enum ARStatusEnum { - - OK, - FAIL, - MANUAL; - - public String value() { - return name(); - } - - public static ARStatusEnum fromValue(String v) { - return valueOf(v); - } - -} diff --git a/Plugins/Mineplex.BungeeRotator/src/com/neustar/ultraservice/schema/v01/ARecord.java b/Plugins/Mineplex.BungeeRotator/src/com/neustar/ultraservice/schema/v01/ARecord.java deleted file mode 100644 index 5f74e7b59..000000000 --- a/Plugins/Mineplex.BungeeRotator/src/com/neustar/ultraservice/schema/v01/ARecord.java +++ /dev/null @@ -1,60 +0,0 @@ - -package com.neustar.ultraservice.schema.v01; - -import javax.xml.bind.annotation.XmlAccessType; -import javax.xml.bind.annotation.XmlAccessorType; -import javax.xml.bind.annotation.XmlAttribute; -import javax.xml.bind.annotation.XmlType; - - -/** - *

Java class for ARecord complex type. - * - *

The following schema fragment specifies the expected content contained within this class. - * - *

- * <complexType name="ARecord">
- *   <complexContent>
- *     <restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
- *       <sequence>
- *       </sequence>
- *       <attribute name="pointsTo" use="required" type="{http://www.w3.org/2001/XMLSchema}string" />
- *     </restriction>
- *   </complexContent>
- * </complexType>
- * 
- * - * - */ -@XmlAccessorType(XmlAccessType.FIELD) -@XmlType(name = "ARecord") -public class ARecord { - - @XmlAttribute(name = "pointsTo", required = true) - protected String pointsTo; - - /** - * Gets the value of the pointsTo property. - * - * @return - * possible object is - * {@link String } - * - */ - public String getPointsTo() { - return pointsTo; - } - - /** - * Sets the value of the pointsTo property. - * - * @param value - * allowed object is - * {@link String } - * - */ - public void setPointsTo(String value) { - this.pointsTo = value; - } - -} diff --git a/Plugins/Mineplex.BungeeRotator/src/com/neustar/ultraservice/schema/v01/AccountAddressInfo.java b/Plugins/Mineplex.BungeeRotator/src/com/neustar/ultraservice/schema/v01/AccountAddressInfo.java deleted file mode 100644 index cfdec5c4e..000000000 --- a/Plugins/Mineplex.BungeeRotator/src/com/neustar/ultraservice/schema/v01/AccountAddressInfo.java +++ /dev/null @@ -1,195 +0,0 @@ - -package com.neustar.ultraservice.schema.v01; - -import javax.xml.bind.annotation.XmlAccessType; -import javax.xml.bind.annotation.XmlAccessorType; -import javax.xml.bind.annotation.XmlAttribute; -import javax.xml.bind.annotation.XmlType; - - -/** - *

Java class for AccountAddressInfo complex type. - * - *

The following schema fragment specifies the expected content contained within this class. - * - *

- * <complexType name="AccountAddressInfo">
- *   <complexContent>
- *     <restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
- *       <sequence>
- *       </sequence>
- *       <attribute name="Address1" type="{http://www.w3.org/2001/XMLSchema}string" />
- *       <attribute name="Address2" type="{http://www.w3.org/2001/XMLSchema}string" />
- *       <attribute name="City" type="{http://www.w3.org/2001/XMLSchema}string" />
- *       <attribute name="State" type="{http://www.w3.org/2001/XMLSchema}string" />
- *       <attribute name="ZipCode" type="{http://www.w3.org/2001/XMLSchema}string" />
- *       <attribute name="Country" type="{http://www.w3.org/2001/XMLSchema}string" />
- *     </restriction>
- *   </complexContent>
- * </complexType>
- * 
- * - * - */ -@XmlAccessorType(XmlAccessType.FIELD) -@XmlType(name = "AccountAddressInfo") -public class AccountAddressInfo { - - @XmlAttribute(name = "Address1") - protected String address1; - @XmlAttribute(name = "Address2") - protected String address2; - @XmlAttribute(name = "City") - protected String city; - @XmlAttribute(name = "State") - protected String state; - @XmlAttribute(name = "ZipCode") - protected String zipCode; - @XmlAttribute(name = "Country") - protected String country; - - /** - * Gets the value of the address1 property. - * - * @return - * possible object is - * {@link String } - * - */ - public String getAddress1() { - return address1; - } - - /** - * Sets the value of the address1 property. - * - * @param value - * allowed object is - * {@link String } - * - */ - public void setAddress1(String value) { - this.address1 = value; - } - - /** - * Gets the value of the address2 property. - * - * @return - * possible object is - * {@link String } - * - */ - public String getAddress2() { - return address2; - } - - /** - * Sets the value of the address2 property. - * - * @param value - * allowed object is - * {@link String } - * - */ - public void setAddress2(String value) { - this.address2 = value; - } - - /** - * Gets the value of the city property. - * - * @return - * possible object is - * {@link String } - * - */ - public String getCity() { - return city; - } - - /** - * Sets the value of the city property. - * - * @param value - * allowed object is - * {@link String } - * - */ - public void setCity(String value) { - this.city = value; - } - - /** - * Gets the value of the state property. - * - * @return - * possible object is - * {@link String } - * - */ - public String getState() { - return state; - } - - /** - * Sets the value of the state property. - * - * @param value - * allowed object is - * {@link String } - * - */ - public void setState(String value) { - this.state = value; - } - - /** - * Gets the value of the zipCode property. - * - * @return - * possible object is - * {@link String } - * - */ - public String getZipCode() { - return zipCode; - } - - /** - * Sets the value of the zipCode property. - * - * @param value - * allowed object is - * {@link String } - * - */ - public void setZipCode(String value) { - this.zipCode = value; - } - - /** - * Gets the value of the country property. - * - * @return - * possible object is - * {@link String } - * - */ - public String getCountry() { - return country; - } - - /** - * Sets the value of the country property. - * - * @param value - * allowed object is - * {@link String } - * - */ - public void setCountry(String value) { - this.country = value; - } - -} diff --git a/Plugins/Mineplex.BungeeRotator/src/com/neustar/ultraservice/schema/v01/AccountDetailsData.java b/Plugins/Mineplex.BungeeRotator/src/com/neustar/ultraservice/schema/v01/AccountDetailsData.java deleted file mode 100644 index 2348eddd3..000000000 --- a/Plugins/Mineplex.BungeeRotator/src/com/neustar/ultraservice/schema/v01/AccountDetailsData.java +++ /dev/null @@ -1,249 +0,0 @@ - -package com.neustar.ultraservice.schema.v01; - -import javax.xml.bind.annotation.XmlAccessType; -import javax.xml.bind.annotation.XmlAccessorType; -import javax.xml.bind.annotation.XmlAttribute; -import javax.xml.bind.annotation.XmlType; - - -/** - *

Java class for AccountDetailsData complex type. - * - *

The following schema fragment specifies the expected content contained within this class. - * - *

- * <complexType name="AccountDetailsData">
- *   <complexContent>
- *     <restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
- *       <sequence>
- *       </sequence>
- *       <attribute name="accountID" use="required" type="{http://www.w3.org/2001/XMLSchema}string" />
- *       <attribute name="accountName" use="required" type="{http://www.w3.org/2001/XMLSchema}string" />
- *       <attribute name="accountHolderUserName" use="required" type="{http://www.w3.org/2001/XMLSchema}string" />
- *       <attribute name="primaryUserUserName" use="required" type="{http://www.w3.org/2001/XMLSchema}string" />
- *       <attribute name="numberOfUsers" use="required" type="{http://www.w3.org/2001/XMLSchema}string" />
- *       <attribute name="numberOfUserGroups" use="required" type="{http://www.w3.org/2001/XMLSchema}string" />
- *       <attribute name="accountHolderType" use="required" type="{http://www.w3.org/2001/XMLSchema}string" />
- *       <attribute name="accountType" use="required" type="{http://www.w3.org/2001/XMLSchema}string" />
- *     </restriction>
- *   </complexContent>
- * </complexType>
- * 
- * - * - */ -@XmlAccessorType(XmlAccessType.FIELD) -@XmlType(name = "AccountDetailsData") -public class AccountDetailsData { - - @XmlAttribute(name = "accountID", required = true) - protected String accountID; - @XmlAttribute(name = "accountName", required = true) - protected String accountName; - @XmlAttribute(name = "accountHolderUserName", required = true) - protected String accountHolderUserName; - @XmlAttribute(name = "primaryUserUserName", required = true) - protected String primaryUserUserName; - @XmlAttribute(name = "numberOfUsers", required = true) - protected String numberOfUsers; - @XmlAttribute(name = "numberOfUserGroups", required = true) - protected String numberOfUserGroups; - @XmlAttribute(name = "accountHolderType", required = true) - protected String accountHolderType; - @XmlAttribute(name = "accountType", required = true) - protected String accountType; - - /** - * Gets the value of the accountID property. - * - * @return - * possible object is - * {@link String } - * - */ - public String getAccountID() { - return accountID; - } - - /** - * Sets the value of the accountID property. - * - * @param value - * allowed object is - * {@link String } - * - */ - public void setAccountID(String value) { - this.accountID = value; - } - - /** - * Gets the value of the accountName property. - * - * @return - * possible object is - * {@link String } - * - */ - public String getAccountName() { - return accountName; - } - - /** - * Sets the value of the accountName property. - * - * @param value - * allowed object is - * {@link String } - * - */ - public void setAccountName(String value) { - this.accountName = value; - } - - /** - * Gets the value of the accountHolderUserName property. - * - * @return - * possible object is - * {@link String } - * - */ - public String getAccountHolderUserName() { - return accountHolderUserName; - } - - /** - * Sets the value of the accountHolderUserName property. - * - * @param value - * allowed object is - * {@link String } - * - */ - public void setAccountHolderUserName(String value) { - this.accountHolderUserName = value; - } - - /** - * Gets the value of the primaryUserUserName property. - * - * @return - * possible object is - * {@link String } - * - */ - public String getPrimaryUserUserName() { - return primaryUserUserName; - } - - /** - * Sets the value of the primaryUserUserName property. - * - * @param value - * allowed object is - * {@link String } - * - */ - public void setPrimaryUserUserName(String value) { - this.primaryUserUserName = value; - } - - /** - * Gets the value of the numberOfUsers property. - * - * @return - * possible object is - * {@link String } - * - */ - public String getNumberOfUsers() { - return numberOfUsers; - } - - /** - * Sets the value of the numberOfUsers property. - * - * @param value - * allowed object is - * {@link String } - * - */ - public void setNumberOfUsers(String value) { - this.numberOfUsers = value; - } - - /** - * Gets the value of the numberOfUserGroups property. - * - * @return - * possible object is - * {@link String } - * - */ - public String getNumberOfUserGroups() { - return numberOfUserGroups; - } - - /** - * Sets the value of the numberOfUserGroups property. - * - * @param value - * allowed object is - * {@link String } - * - */ - public void setNumberOfUserGroups(String value) { - this.numberOfUserGroups = value; - } - - /** - * Gets the value of the accountHolderType property. - * - * @return - * possible object is - * {@link String } - * - */ - public String getAccountHolderType() { - return accountHolderType; - } - - /** - * Sets the value of the accountHolderType property. - * - * @param value - * allowed object is - * {@link String } - * - */ - public void setAccountHolderType(String value) { - this.accountHolderType = value; - } - - /** - * Gets the value of the accountType property. - * - * @return - * possible object is - * {@link String } - * - */ - public String getAccountType() { - return accountType; - } - - /** - * Sets the value of the accountType property. - * - * @param value - * allowed object is - * {@link String } - * - */ - public void setAccountType(String value) { - this.accountType = value; - } - -} diff --git a/Plugins/Mineplex.BungeeRotator/src/com/neustar/ultraservice/schema/v01/AccountDetailsList.java b/Plugins/Mineplex.BungeeRotator/src/com/neustar/ultraservice/schema/v01/AccountDetailsList.java deleted file mode 100644 index 01360c5e6..000000000 --- a/Plugins/Mineplex.BungeeRotator/src/com/neustar/ultraservice/schema/v01/AccountDetailsList.java +++ /dev/null @@ -1,69 +0,0 @@ - -package com.neustar.ultraservice.schema.v01; - -import java.util.ArrayList; -import java.util.List; -import javax.xml.bind.annotation.XmlAccessType; -import javax.xml.bind.annotation.XmlAccessorType; -import javax.xml.bind.annotation.XmlElement; -import javax.xml.bind.annotation.XmlType; - - -/** - *

Java class for AccountDetailsList complex type. - * - *

The following schema fragment specifies the expected content contained within this class. - * - *

- * <complexType name="AccountDetailsList">
- *   <complexContent>
- *     <restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
- *       <sequence>
- *         <element name="AccountDetailsData" type="{http://schema.ultraservice.neustar.com/v01/}AccountDetailsData" maxOccurs="unbounded"/>
- *       </sequence>
- *     </restriction>
- *   </complexContent>
- * </complexType>
- * 
- * - * - */ -@XmlAccessorType(XmlAccessType.FIELD) -@XmlType(name = "AccountDetailsList", propOrder = { - "accountDetailsData" -}) -public class AccountDetailsList { - - @XmlElement(name = "AccountDetailsData", required = true) - protected List accountDetailsData; - - /** - * Gets the value of the accountDetailsData property. - * - *

- * This accessor method returns a reference to the live list, - * not a snapshot. Therefore any modification you make to the - * returned list will be present inside the JAXB object. - * This is why there is not a set method for the accountDetailsData property. - * - *

- * For example, to add a new item, do as follows: - *

-     *    getAccountDetailsData().add(newItem);
-     * 
- * - * - *

- * Objects of the following type(s) are allowed in the list - * {@link AccountDetailsData } - * - * - */ - public List getAccountDetailsData() { - if (accountDetailsData == null) { - accountDetailsData = new ArrayList(); - } - return this.accountDetailsData; - } - -} diff --git a/Plugins/Mineplex.BungeeRotator/src/com/neustar/ultraservice/schema/v01/AccountInfoData.java b/Plugins/Mineplex.BungeeRotator/src/com/neustar/ultraservice/schema/v01/AccountInfoData.java deleted file mode 100644 index 327576544..000000000 --- a/Plugins/Mineplex.BungeeRotator/src/com/neustar/ultraservice/schema/v01/AccountInfoData.java +++ /dev/null @@ -1,600 +0,0 @@ - -package com.neustar.ultraservice.schema.v01; - -import javax.xml.bind.annotation.XmlAccessType; -import javax.xml.bind.annotation.XmlAccessorType; -import javax.xml.bind.annotation.XmlAttribute; -import javax.xml.bind.annotation.XmlType; - - -/** - *

Java class for AccountInfoData complex type. - * - *

The following schema fragment specifies the expected content contained within this class. - * - *

- * <complexType name="AccountInfoData">
- *   <complexContent>
- *     <restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
- *       <sequence>
- *       </sequence>
- *       <attribute name="accountID" use="required" type="{http://www.w3.org/2001/XMLSchema}string" />
- *       <attribute name="accountName" use="required" type="{http://www.w3.org/2001/XMLSchema}string" />
- *       <attribute name="accountStatus" use="required" type="{http://www.w3.org/2001/XMLSchema}string" />
- *       <attribute name="totalUsers" use="required" type="{http://www.w3.org/2001/XMLSchema}string" />
- *       <attribute name="created" use="required" type="{http://www.w3.org/2001/XMLSchema}string" />
- *       <attribute name="orgAccountHolderUserName" use="required" type="{http://www.w3.org/2001/XMLSchema}string" />
- *       <attribute name="orgPrimaryUserUserName" use="required" type="{http://www.w3.org/2001/XMLSchema}string" />
- *       <attribute name="accountType" use="required" type="{http://www.w3.org/2001/XMLSchema}string" />
- *       <attribute name="indAccountHolderAndPrimaryUserName" use="required" type="{http://www.w3.org/2001/XMLSchema}string" />
- *       <attribute name="accountHolderAddress" use="required" type="{http://www.w3.org/2001/XMLSchema}string" />
- *       <attribute name="accountHolderAddress2" use="required" type="{http://www.w3.org/2001/XMLSchema}string" />
- *       <attribute name="accountHolderCity" use="required" type="{http://www.w3.org/2001/XMLSchema}string" />
- *       <attribute name="accountHolderState" use="required" type="{http://www.w3.org/2001/XMLSchema}string" />
- *       <attribute name="accountHolderZip" use="required" type="{http://www.w3.org/2001/XMLSchema}string" />
- *       <attribute name="accountHolderCountry" use="required" type="{http://www.w3.org/2001/XMLSchema}string" />
- *       <attribute name="orgPrimaryUserAddress" use="required" type="{http://www.w3.org/2001/XMLSchema}string" />
- *       <attribute name="orgPrimaryUserAddress2" use="required" type="{http://www.w3.org/2001/XMLSchema}string" />
- *       <attribute name="orgPrimaryUserCity" use="required" type="{http://www.w3.org/2001/XMLSchema}string" />
- *       <attribute name="orgPrimaryUserState" use="required" type="{http://www.w3.org/2001/XMLSchema}string" />
- *       <attribute name="orgPrimaryUserZip" use="required" type="{http://www.w3.org/2001/XMLSchema}string" />
- *       <attribute name="orgPrimaryUserCountry" use="required" type="{http://www.w3.org/2001/XMLSchema}string" />
- *     </restriction>
- *   </complexContent>
- * </complexType>
- * 
- * - * - */ -@XmlAccessorType(XmlAccessType.FIELD) -@XmlType(name = "AccountInfoData") -public class AccountInfoData { - - @XmlAttribute(name = "accountID", required = true) - protected String accountID; - @XmlAttribute(name = "accountName", required = true) - protected String accountName; - @XmlAttribute(name = "accountStatus", required = true) - protected String accountStatus; - @XmlAttribute(name = "totalUsers", required = true) - protected String totalUsers; - @XmlAttribute(name = "created", required = true) - protected String created; - @XmlAttribute(name = "orgAccountHolderUserName", required = true) - protected String orgAccountHolderUserName; - @XmlAttribute(name = "orgPrimaryUserUserName", required = true) - protected String orgPrimaryUserUserName; - @XmlAttribute(name = "accountType", required = true) - protected String accountType; - @XmlAttribute(name = "indAccountHolderAndPrimaryUserName", required = true) - protected String indAccountHolderAndPrimaryUserName; - @XmlAttribute(name = "accountHolderAddress", required = true) - protected String accountHolderAddress; - @XmlAttribute(name = "accountHolderAddress2", required = true) - protected String accountHolderAddress2; - @XmlAttribute(name = "accountHolderCity", required = true) - protected String accountHolderCity; - @XmlAttribute(name = "accountHolderState", required = true) - protected String accountHolderState; - @XmlAttribute(name = "accountHolderZip", required = true) - protected String accountHolderZip; - @XmlAttribute(name = "accountHolderCountry", required = true) - protected String accountHolderCountry; - @XmlAttribute(name = "orgPrimaryUserAddress", required = true) - protected String orgPrimaryUserAddress; - @XmlAttribute(name = "orgPrimaryUserAddress2", required = true) - protected String orgPrimaryUserAddress2; - @XmlAttribute(name = "orgPrimaryUserCity", required = true) - protected String orgPrimaryUserCity; - @XmlAttribute(name = "orgPrimaryUserState", required = true) - protected String orgPrimaryUserState; - @XmlAttribute(name = "orgPrimaryUserZip", required = true) - protected String orgPrimaryUserZip; - @XmlAttribute(name = "orgPrimaryUserCountry", required = true) - protected String orgPrimaryUserCountry; - - /** - * Gets the value of the accountID property. - * - * @return - * possible object is - * {@link String } - * - */ - public String getAccountID() { - return accountID; - } - - /** - * Sets the value of the accountID property. - * - * @param value - * allowed object is - * {@link String } - * - */ - public void setAccountID(String value) { - this.accountID = value; - } - - /** - * Gets the value of the accountName property. - * - * @return - * possible object is - * {@link String } - * - */ - public String getAccountName() { - return accountName; - } - - /** - * Sets the value of the accountName property. - * - * @param value - * allowed object is - * {@link String } - * - */ - public void setAccountName(String value) { - this.accountName = value; - } - - /** - * Gets the value of the accountStatus property. - * - * @return - * possible object is - * {@link String } - * - */ - public String getAccountStatus() { - return accountStatus; - } - - /** - * Sets the value of the accountStatus property. - * - * @param value - * allowed object is - * {@link String } - * - */ - public void setAccountStatus(String value) { - this.accountStatus = value; - } - - /** - * Gets the value of the totalUsers property. - * - * @return - * possible object is - * {@link String } - * - */ - public String getTotalUsers() { - return totalUsers; - } - - /** - * Sets the value of the totalUsers property. - * - * @param value - * allowed object is - * {@link String } - * - */ - public void setTotalUsers(String value) { - this.totalUsers = value; - } - - /** - * Gets the value of the created property. - * - * @return - * possible object is - * {@link String } - * - */ - public String getCreated() { - return created; - } - - /** - * Sets the value of the created property. - * - * @param value - * allowed object is - * {@link String } - * - */ - public void setCreated(String value) { - this.created = value; - } - - /** - * Gets the value of the orgAccountHolderUserName property. - * - * @return - * possible object is - * {@link String } - * - */ - public String getOrgAccountHolderUserName() { - return orgAccountHolderUserName; - } - - /** - * Sets the value of the orgAccountHolderUserName property. - * - * @param value - * allowed object is - * {@link String } - * - */ - public void setOrgAccountHolderUserName(String value) { - this.orgAccountHolderUserName = value; - } - - /** - * Gets the value of the orgPrimaryUserUserName property. - * - * @return - * possible object is - * {@link String } - * - */ - public String getOrgPrimaryUserUserName() { - return orgPrimaryUserUserName; - } - - /** - * Sets the value of the orgPrimaryUserUserName property. - * - * @param value - * allowed object is - * {@link String } - * - */ - public void setOrgPrimaryUserUserName(String value) { - this.orgPrimaryUserUserName = value; - } - - /** - * Gets the value of the accountType property. - * - * @return - * possible object is - * {@link String } - * - */ - public String getAccountType() { - return accountType; - } - - /** - * Sets the value of the accountType property. - * - * @param value - * allowed object is - * {@link String } - * - */ - public void setAccountType(String value) { - this.accountType = value; - } - - /** - * Gets the value of the indAccountHolderAndPrimaryUserName property. - * - * @return - * possible object is - * {@link String } - * - */ - public String getIndAccountHolderAndPrimaryUserName() { - return indAccountHolderAndPrimaryUserName; - } - - /** - * Sets the value of the indAccountHolderAndPrimaryUserName property. - * - * @param value - * allowed object is - * {@link String } - * - */ - public void setIndAccountHolderAndPrimaryUserName(String value) { - this.indAccountHolderAndPrimaryUserName = value; - } - - /** - * Gets the value of the accountHolderAddress property. - * - * @return - * possible object is - * {@link String } - * - */ - public String getAccountHolderAddress() { - return accountHolderAddress; - } - - /** - * Sets the value of the accountHolderAddress property. - * - * @param value - * allowed object is - * {@link String } - * - */ - public void setAccountHolderAddress(String value) { - this.accountHolderAddress = value; - } - - /** - * Gets the value of the accountHolderAddress2 property. - * - * @return - * possible object is - * {@link String } - * - */ - public String getAccountHolderAddress2() { - return accountHolderAddress2; - } - - /** - * Sets the value of the accountHolderAddress2 property. - * - * @param value - * allowed object is - * {@link String } - * - */ - public void setAccountHolderAddress2(String value) { - this.accountHolderAddress2 = value; - } - - /** - * Gets the value of the accountHolderCity property. - * - * @return - * possible object is - * {@link String } - * - */ - public String getAccountHolderCity() { - return accountHolderCity; - } - - /** - * Sets the value of the accountHolderCity property. - * - * @param value - * allowed object is - * {@link String } - * - */ - public void setAccountHolderCity(String value) { - this.accountHolderCity = value; - } - - /** - * Gets the value of the accountHolderState property. - * - * @return - * possible object is - * {@link String } - * - */ - public String getAccountHolderState() { - return accountHolderState; - } - - /** - * Sets the value of the accountHolderState property. - * - * @param value - * allowed object is - * {@link String } - * - */ - public void setAccountHolderState(String value) { - this.accountHolderState = value; - } - - /** - * Gets the value of the accountHolderZip property. - * - * @return - * possible object is - * {@link String } - * - */ - public String getAccountHolderZip() { - return accountHolderZip; - } - - /** - * Sets the value of the accountHolderZip property. - * - * @param value - * allowed object is - * {@link String } - * - */ - public void setAccountHolderZip(String value) { - this.accountHolderZip = value; - } - - /** - * Gets the value of the accountHolderCountry property. - * - * @return - * possible object is - * {@link String } - * - */ - public String getAccountHolderCountry() { - return accountHolderCountry; - } - - /** - * Sets the value of the accountHolderCountry property. - * - * @param value - * allowed object is - * {@link String } - * - */ - public void setAccountHolderCountry(String value) { - this.accountHolderCountry = value; - } - - /** - * Gets the value of the orgPrimaryUserAddress property. - * - * @return - * possible object is - * {@link String } - * - */ - public String getOrgPrimaryUserAddress() { - return orgPrimaryUserAddress; - } - - /** - * Sets the value of the orgPrimaryUserAddress property. - * - * @param value - * allowed object is - * {@link String } - * - */ - public void setOrgPrimaryUserAddress(String value) { - this.orgPrimaryUserAddress = value; - } - - /** - * Gets the value of the orgPrimaryUserAddress2 property. - * - * @return - * possible object is - * {@link String } - * - */ - public String getOrgPrimaryUserAddress2() { - return orgPrimaryUserAddress2; - } - - /** - * Sets the value of the orgPrimaryUserAddress2 property. - * - * @param value - * allowed object is - * {@link String } - * - */ - public void setOrgPrimaryUserAddress2(String value) { - this.orgPrimaryUserAddress2 = value; - } - - /** - * Gets the value of the orgPrimaryUserCity property. - * - * @return - * possible object is - * {@link String } - * - */ - public String getOrgPrimaryUserCity() { - return orgPrimaryUserCity; - } - - /** - * Sets the value of the orgPrimaryUserCity property. - * - * @param value - * allowed object is - * {@link String } - * - */ - public void setOrgPrimaryUserCity(String value) { - this.orgPrimaryUserCity = value; - } - - /** - * Gets the value of the orgPrimaryUserState property. - * - * @return - * possible object is - * {@link String } - * - */ - public String getOrgPrimaryUserState() { - return orgPrimaryUserState; - } - - /** - * Sets the value of the orgPrimaryUserState property. - * - * @param value - * allowed object is - * {@link String } - * - */ - public void setOrgPrimaryUserState(String value) { - this.orgPrimaryUserState = value; - } - - /** - * Gets the value of the orgPrimaryUserZip property. - * - * @return - * possible object is - * {@link String } - * - */ - public String getOrgPrimaryUserZip() { - return orgPrimaryUserZip; - } - - /** - * Sets the value of the orgPrimaryUserZip property. - * - * @param value - * allowed object is - * {@link String } - * - */ - public void setOrgPrimaryUserZip(String value) { - this.orgPrimaryUserZip = value; - } - - /** - * Gets the value of the orgPrimaryUserCountry property. - * - * @return - * possible object is - * {@link String } - * - */ - public String getOrgPrimaryUserCountry() { - return orgPrimaryUserCountry; - } - - /** - * Sets the value of the orgPrimaryUserCountry property. - * - * @param value - * allowed object is - * {@link String } - * - */ - public void setOrgPrimaryUserCountry(String value) { - this.orgPrimaryUserCountry = value; - } - -} diff --git a/Plugins/Mineplex.BungeeRotator/src/com/neustar/ultraservice/schema/v01/AccountLevelGroup.java b/Plugins/Mineplex.BungeeRotator/src/com/neustar/ultraservice/schema/v01/AccountLevelGroup.java deleted file mode 100644 index 2e4f49b5a..000000000 --- a/Plugins/Mineplex.BungeeRotator/src/com/neustar/ultraservice/schema/v01/AccountLevelGroup.java +++ /dev/null @@ -1,133 +0,0 @@ - -package com.neustar.ultraservice.schema.v01; - -import javax.xml.bind.annotation.XmlAccessType; -import javax.xml.bind.annotation.XmlAccessorType; -import javax.xml.bind.annotation.XmlAttribute; -import javax.xml.bind.annotation.XmlType; - - -/** - *

Java class for AccountLevelGroup complex type. - * - *

The following schema fragment specifies the expected content contained within this class. - * - *

- * <complexType name="AccountLevelGroup">
- *   <complexContent>
- *     <restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
- *       <sequence>
- *       </sequence>
- *       <attribute name="GroupId" type="{http://www.w3.org/2001/XMLSchema}string" />
- *       <attribute name="GroupName" type="{http://www.w3.org/2001/XMLSchema}string" />
- *       <attribute name="RecordsCount" use="required" type="{http://www.w3.org/2001/XMLSchema}int" />
- *       <attribute name="GroupType" type="{http://schema.ultraservice.neustar.com/v01/}DirPoolType" />
- *     </restriction>
- *   </complexContent>
- * </complexType>
- * 
- * - * - */ -@XmlAccessorType(XmlAccessType.FIELD) -@XmlType(name = "AccountLevelGroup") -public class AccountLevelGroup { - - @XmlAttribute(name = "GroupId") - protected String groupId; - @XmlAttribute(name = "GroupName") - protected String groupName; - @XmlAttribute(name = "RecordsCount", required = true) - protected int recordsCount; - @XmlAttribute(name = "GroupType") - protected DirPoolType groupType; - - /** - * Gets the value of the groupId property. - * - * @return - * possible object is - * {@link String } - * - */ - public String getGroupId() { - return groupId; - } - - /** - * Sets the value of the groupId property. - * - * @param value - * allowed object is - * {@link String } - * - */ - public void setGroupId(String value) { - this.groupId = value; - } - - /** - * Gets the value of the groupName property. - * - * @return - * possible object is - * {@link String } - * - */ - public String getGroupName() { - return groupName; - } - - /** - * Sets the value of the groupName property. - * - * @param value - * allowed object is - * {@link String } - * - */ - public void setGroupName(String value) { - this.groupName = value; - } - - /** - * Gets the value of the recordsCount property. - * - */ - public int getRecordsCount() { - return recordsCount; - } - - /** - * Sets the value of the recordsCount property. - * - */ - public void setRecordsCount(int value) { - this.recordsCount = value; - } - - /** - * Gets the value of the groupType property. - * - * @return - * possible object is - * {@link DirPoolType } - * - */ - public DirPoolType getGroupType() { - return groupType; - } - - /** - * Sets the value of the groupType property. - * - * @param value - * allowed object is - * {@link DirPoolType } - * - */ - public void setGroupType(DirPoolType value) { - this.groupType = value; - } - -} diff --git a/Plugins/Mineplex.BungeeRotator/src/com/neustar/ultraservice/schema/v01/AccountLevelGroupsList.java b/Plugins/Mineplex.BungeeRotator/src/com/neustar/ultraservice/schema/v01/AccountLevelGroupsList.java deleted file mode 100644 index 61d9ada23..000000000 --- a/Plugins/Mineplex.BungeeRotator/src/com/neustar/ultraservice/schema/v01/AccountLevelGroupsList.java +++ /dev/null @@ -1,69 +0,0 @@ - -package com.neustar.ultraservice.schema.v01; - -import java.util.ArrayList; -import java.util.List; -import javax.xml.bind.annotation.XmlAccessType; -import javax.xml.bind.annotation.XmlAccessorType; -import javax.xml.bind.annotation.XmlElement; -import javax.xml.bind.annotation.XmlType; - - -/** - *

Java class for AccountLevelGroupsList complex type. - * - *

The following schema fragment specifies the expected content contained within this class. - * - *

- * <complexType name="AccountLevelGroupsList">
- *   <complexContent>
- *     <restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
- *       <sequence>
- *         <element name="AccountLevelGroups" type="{http://schema.ultraservice.neustar.com/v01/}AccountLevelGroup" maxOccurs="unbounded"/>
- *       </sequence>
- *     </restriction>
- *   </complexContent>
- * </complexType>
- * 
- * - * - */ -@XmlAccessorType(XmlAccessType.FIELD) -@XmlType(name = "AccountLevelGroupsList", propOrder = { - "accountLevelGroups" -}) -public class AccountLevelGroupsList { - - @XmlElement(name = "AccountLevelGroups", required = true) - protected List accountLevelGroups; - - /** - * Gets the value of the accountLevelGroups property. - * - *

- * This accessor method returns a reference to the live list, - * not a snapshot. Therefore any modification you make to the - * returned list will be present inside the JAXB object. - * This is why there is not a set method for the accountLevelGroups property. - * - *

- * For example, to add a new item, do as follows: - *

-     *    getAccountLevelGroups().add(newItem);
-     * 
- * - * - *

- * Objects of the following type(s) are allowed in the list - * {@link AccountLevelGroup } - * - * - */ - public List getAccountLevelGroups() { - if (accountLevelGroups == null) { - accountLevelGroups = new ArrayList(); - } - return this.accountLevelGroups; - } - -} diff --git a/Plugins/Mineplex.BungeeRotator/src/com/neustar/ultraservice/schema/v01/AccountLevelNotificationsData.java b/Plugins/Mineplex.BungeeRotator/src/com/neustar/ultraservice/schema/v01/AccountLevelNotificationsData.java deleted file mode 100644 index 47deeda01..000000000 --- a/Plugins/Mineplex.BungeeRotator/src/com/neustar/ultraservice/schema/v01/AccountLevelNotificationsData.java +++ /dev/null @@ -1,141 +0,0 @@ - -package com.neustar.ultraservice.schema.v01; - -import javax.xml.bind.annotation.XmlAccessType; -import javax.xml.bind.annotation.XmlAccessorType; -import javax.xml.bind.annotation.XmlAttribute; -import javax.xml.bind.annotation.XmlType; - - -/** - *

Java class for AccountLevelNotificationsData complex type. - * - *

The following schema fragment specifies the expected content contained within this class. - * - *

- * <complexType name="AccountLevelNotificationsData">
- *   <complexContent>
- *     <restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
- *       <sequence>
- *       </sequence>
- *       <attribute name="accountName" use="required" type="{http://www.w3.org/2001/XMLSchema}string" />
- *       <attribute name="accountNotificationType" type="{http://www.w3.org/2001/XMLSchema}string" />
- *       <attribute name="accountStatus" type="{http://www.w3.org/2001/XMLSchema}string" />
- *       <attribute name="frequency" type="{http://www.w3.org/2001/XMLSchema}string" />
- *     </restriction>
- *   </complexContent>
- * </complexType>
- * 
- * - * - */ -@XmlAccessorType(XmlAccessType.FIELD) -@XmlType(name = "AccountLevelNotificationsData") -public class AccountLevelNotificationsData { - - @XmlAttribute(name = "accountName", required = true) - protected String accountName; - @XmlAttribute(name = "accountNotificationType") - protected String accountNotificationType; - @XmlAttribute(name = "accountStatus") - protected String accountStatus; - @XmlAttribute(name = "frequency") - protected String frequency; - - /** - * Gets the value of the accountName property. - * - * @return - * possible object is - * {@link String } - * - */ - public String getAccountName() { - return accountName; - } - - /** - * Sets the value of the accountName property. - * - * @param value - * allowed object is - * {@link String } - * - */ - public void setAccountName(String value) { - this.accountName = value; - } - - /** - * Gets the value of the accountNotificationType property. - * - * @return - * possible object is - * {@link String } - * - */ - public String getAccountNotificationType() { - return accountNotificationType; - } - - /** - * Sets the value of the accountNotificationType property. - * - * @param value - * allowed object is - * {@link String } - * - */ - public void setAccountNotificationType(String value) { - this.accountNotificationType = value; - } - - /** - * Gets the value of the accountStatus property. - * - * @return - * possible object is - * {@link String } - * - */ - public String getAccountStatus() { - return accountStatus; - } - - /** - * Sets the value of the accountStatus property. - * - * @param value - * allowed object is - * {@link String } - * - */ - public void setAccountStatus(String value) { - this.accountStatus = value; - } - - /** - * Gets the value of the frequency property. - * - * @return - * possible object is - * {@link String } - * - */ - public String getFrequency() { - return frequency; - } - - /** - * Sets the value of the frequency property. - * - * @param value - * allowed object is - * {@link String } - * - */ - public void setFrequency(String value) { - this.frequency = value; - } - -} diff --git a/Plugins/Mineplex.BungeeRotator/src/com/neustar/ultraservice/schema/v01/AccountLevelNotificationsList.java b/Plugins/Mineplex.BungeeRotator/src/com/neustar/ultraservice/schema/v01/AccountLevelNotificationsList.java deleted file mode 100644 index 494d15e9a..000000000 --- a/Plugins/Mineplex.BungeeRotator/src/com/neustar/ultraservice/schema/v01/AccountLevelNotificationsList.java +++ /dev/null @@ -1,69 +0,0 @@ - -package com.neustar.ultraservice.schema.v01; - -import java.util.ArrayList; -import java.util.List; -import javax.xml.bind.annotation.XmlAccessType; -import javax.xml.bind.annotation.XmlAccessorType; -import javax.xml.bind.annotation.XmlElement; -import javax.xml.bind.annotation.XmlType; - - -/** - *

Java class for AccountLevelNotificationsList complex type. - * - *

The following schema fragment specifies the expected content contained within this class. - * - *

- * <complexType name="AccountLevelNotificationsList">
- *   <complexContent>
- *     <restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
- *       <sequence>
- *         <element name="AccountLevelNotificationsData" type="{http://schema.ultraservice.neustar.com/v01/}AccountLevelNotificationsData" maxOccurs="unbounded"/>
- *       </sequence>
- *     </restriction>
- *   </complexContent>
- * </complexType>
- * 
- * - * - */ -@XmlAccessorType(XmlAccessType.FIELD) -@XmlType(name = "AccountLevelNotificationsList", propOrder = { - "accountLevelNotificationsData" -}) -public class AccountLevelNotificationsList { - - @XmlElement(name = "AccountLevelNotificationsData", required = true) - protected List accountLevelNotificationsData; - - /** - * Gets the value of the accountLevelNotificationsData property. - * - *

- * This accessor method returns a reference to the live list, - * not a snapshot. Therefore any modification you make to the - * returned list will be present inside the JAXB object. - * This is why there is not a set method for the accountLevelNotificationsData property. - * - *

- * For example, to add a new item, do as follows: - *

-     *    getAccountLevelNotificationsData().add(newItem);
-     * 
- * - * - *

- * Objects of the following type(s) are allowed in the list - * {@link AccountLevelNotificationsData } - * - * - */ - public List getAccountLevelNotificationsData() { - if (accountLevelNotificationsData == null) { - accountLevelNotificationsData = new ArrayList(); - } - return this.accountLevelNotificationsData; - } - -} diff --git a/Plugins/Mineplex.BungeeRotator/src/com/neustar/ultraservice/schema/v01/AccountPreferenceDetail.java b/Plugins/Mineplex.BungeeRotator/src/com/neustar/ultraservice/schema/v01/AccountPreferenceDetail.java deleted file mode 100644 index cd202d811..000000000 --- a/Plugins/Mineplex.BungeeRotator/src/com/neustar/ultraservice/schema/v01/AccountPreferenceDetail.java +++ /dev/null @@ -1,90 +0,0 @@ - -package com.neustar.ultraservice.schema.v01; - -import javax.xml.bind.annotation.XmlAccessType; -import javax.xml.bind.annotation.XmlAccessorType; -import javax.xml.bind.annotation.XmlAttribute; -import javax.xml.bind.annotation.XmlElement; -import javax.xml.bind.annotation.XmlType; - - -/** - *

Java class for AccountPreferenceDetail complex type. - * - *

The following schema fragment specifies the expected content contained within this class. - * - *

- * <complexType name="AccountPreferenceDetail">
- *   <complexContent>
- *     <restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
- *       <sequence>
- *         <element name="ExternalValues" type="{http://schema.ultraservice.neustar.com/v01/}ExternalValues"/>
- *       </sequence>
- *       <attribute name="RecordTypeTTL" use="required" type="{http://www.w3.org/2001/XMLSchema}string" />
- *     </restriction>
- *   </complexContent>
- * </complexType>
- * 
- * - * - */ -@XmlAccessorType(XmlAccessType.FIELD) -@XmlType(name = "AccountPreferenceDetail", propOrder = { - "externalValues" -}) -public class AccountPreferenceDetail { - - @XmlElement(name = "ExternalValues", required = true) - protected ExternalValues externalValues; - @XmlAttribute(name = "RecordTypeTTL", required = true) - protected String recordTypeTTL; - - /** - * Gets the value of the externalValues property. - * - * @return - * possible object is - * {@link ExternalValues } - * - */ - public ExternalValues getExternalValues() { - return externalValues; - } - - /** - * Sets the value of the externalValues property. - * - * @param value - * allowed object is - * {@link ExternalValues } - * - */ - public void setExternalValues(ExternalValues value) { - this.externalValues = value; - } - - /** - * Gets the value of the recordTypeTTL property. - * - * @return - * possible object is - * {@link String } - * - */ - public String getRecordTypeTTL() { - return recordTypeTTL; - } - - /** - * Sets the value of the recordTypeTTL property. - * - * @param value - * allowed object is - * {@link String } - * - */ - public void setRecordTypeTTL(String value) { - this.recordTypeTTL = value; - } - -} diff --git a/Plugins/Mineplex.BungeeRotator/src/com/neustar/ultraservice/schema/v01/AccountPreferencesList.java b/Plugins/Mineplex.BungeeRotator/src/com/neustar/ultraservice/schema/v01/AccountPreferencesList.java deleted file mode 100644 index 19c49140c..000000000 --- a/Plugins/Mineplex.BungeeRotator/src/com/neustar/ultraservice/schema/v01/AccountPreferencesList.java +++ /dev/null @@ -1,69 +0,0 @@ - -package com.neustar.ultraservice.schema.v01; - -import java.util.ArrayList; -import java.util.List; -import javax.xml.bind.annotation.XmlAccessType; -import javax.xml.bind.annotation.XmlAccessorType; -import javax.xml.bind.annotation.XmlElement; -import javax.xml.bind.annotation.XmlType; - - -/** - *

Java class for AccountPreferencesList complex type. - * - *

The following schema fragment specifies the expected content contained within this class. - * - *

- * <complexType name="AccountPreferencesList">
- *   <complexContent>
- *     <restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
- *       <sequence>
- *         <element name="AccountPreferenceDetail" type="{http://schema.ultraservice.neustar.com/v01/}AccountPreferenceDetail" maxOccurs="unbounded"/>
- *       </sequence>
- *     </restriction>
- *   </complexContent>
- * </complexType>
- * 
- * - * - */ -@XmlAccessorType(XmlAccessType.FIELD) -@XmlType(name = "AccountPreferencesList", propOrder = { - "accountPreferenceDetail" -}) -public class AccountPreferencesList { - - @XmlElement(name = "AccountPreferenceDetail", required = true) - protected List accountPreferenceDetail; - - /** - * Gets the value of the accountPreferenceDetail property. - * - *

- * This accessor method returns a reference to the live list, - * not a snapshot. Therefore any modification you make to the - * returned list will be present inside the JAXB object. - * This is why there is not a set method for the accountPreferenceDetail property. - * - *

- * For example, to add a new item, do as follows: - *

-     *    getAccountPreferenceDetail().add(newItem);
-     * 
- * - * - *

- * Objects of the following type(s) are allowed in the list - * {@link AccountPreferenceDetail } - * - * - */ - public List getAccountPreferenceDetail() { - if (accountPreferenceDetail == null) { - accountPreferenceDetail = new ArrayList(); - } - return this.accountPreferenceDetail; - } - -} diff --git a/Plugins/Mineplex.BungeeRotator/src/com/neustar/ultraservice/schema/v01/AcctToPoolGroupConversionDetails.java b/Plugins/Mineplex.BungeeRotator/src/com/neustar/ultraservice/schema/v01/AcctToPoolGroupConversionDetails.java deleted file mode 100644 index 26e040661..000000000 --- a/Plugins/Mineplex.BungeeRotator/src/com/neustar/ultraservice/schema/v01/AcctToPoolGroupConversionDetails.java +++ /dev/null @@ -1,114 +0,0 @@ - -package com.neustar.ultraservice.schema.v01; - -import javax.xml.bind.annotation.XmlAccessType; -import javax.xml.bind.annotation.XmlAccessorType; -import javax.xml.bind.annotation.XmlAttribute; -import javax.xml.bind.annotation.XmlType; - - -/** - *

Java class for AcctToPoolGroupConversionDetails complex type. - * - *

The following schema fragment specifies the expected content contained within this class. - * - *

- * <complexType name="AcctToPoolGroupConversionDetails">
- *   <complexContent>
- *     <restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
- *       <sequence>
- *       </sequence>
- *       <attribute name="accountLevelGroupId" use="required" type="{http://www.w3.org/2001/XMLSchema}string" />
- *       <attribute name="newGroupName" use="required" type="{http://www.w3.org/2001/XMLSchema}string" />
- *       <attribute name="dirPoolRecordId" use="required" type="{http://www.w3.org/2001/XMLSchema}string" />
- *     </restriction>
- *   </complexContent>
- * </complexType>
- * 
- * - * - */ -@XmlAccessorType(XmlAccessType.FIELD) -@XmlType(name = "AcctToPoolGroupConversionDetails") -public class AcctToPoolGroupConversionDetails { - - @XmlAttribute(name = "accountLevelGroupId", required = true) - protected String accountLevelGroupId; - @XmlAttribute(name = "newGroupName", required = true) - protected String newGroupName; - @XmlAttribute(name = "dirPoolRecordId", required = true) - protected String dirPoolRecordId; - - /** - * Gets the value of the accountLevelGroupId property. - * - * @return - * possible object is - * {@link String } - * - */ - public String getAccountLevelGroupId() { - return accountLevelGroupId; - } - - /** - * Sets the value of the accountLevelGroupId property. - * - * @param value - * allowed object is - * {@link String } - * - */ - public void setAccountLevelGroupId(String value) { - this.accountLevelGroupId = value; - } - - /** - * Gets the value of the newGroupName property. - * - * @return - * possible object is - * {@link String } - * - */ - public String getNewGroupName() { - return newGroupName; - } - - /** - * Sets the value of the newGroupName property. - * - * @param value - * allowed object is - * {@link String } - * - */ - public void setNewGroupName(String value) { - this.newGroupName = value; - } - - /** - * Gets the value of the dirPoolRecordId property. - * - * @return - * possible object is - * {@link String } - * - */ - public String getDirPoolRecordId() { - return dirPoolRecordId; - } - - /** - * Sets the value of the dirPoolRecordId property. - * - * @param value - * allowed object is - * {@link String } - * - */ - public void setDirPoolRecordId(String value) { - this.dirPoolRecordId = value; - } - -} diff --git a/Plugins/Mineplex.BungeeRotator/src/com/neustar/ultraservice/schema/v01/AddDirectionalPoolData.java b/Plugins/Mineplex.BungeeRotator/src/com/neustar/ultraservice/schema/v01/AddDirectionalPoolData.java deleted file mode 100644 index a47563e99..000000000 --- a/Plugins/Mineplex.BungeeRotator/src/com/neustar/ultraservice/schema/v01/AddDirectionalPoolData.java +++ /dev/null @@ -1,198 +0,0 @@ - -package com.neustar.ultraservice.schema.v01; - -import javax.xml.bind.annotation.XmlAccessType; -import javax.xml.bind.annotation.XmlAccessorType; -import javax.xml.bind.annotation.XmlAttribute; -import javax.xml.bind.annotation.XmlElement; -import javax.xml.bind.annotation.XmlType; - - -/** - *

Java class for AddDirectionalPoolData complex type. - * - *

The following schema fragment specifies the expected content contained within this class. - * - *

- * <complexType name="AddDirectionalPoolData">
- *   <complexContent>
- *     <restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
- *       <sequence>
- *         <element name="DirectionalRecordData" type="{http://schema.ultraservice.neustar.com/v01/}DirectionalRecordData"/>
- *       </sequence>
- *       <attribute name="dirPoolType" use="required" type="{http://schema.ultraservice.neustar.com/v01/}DirPoolType" />
- *       <attribute name="poolRecordType" use="required" type="{http://schema.ultraservice.neustar.com/v01/}DirPoolRecordType" />
- *       <attribute name="description" type="{http://www.w3.org/2001/XMLSchema}string" />
- *       <attribute name="zoneName" use="required" type="{http://www.w3.org/2001/XMLSchema}string" />
- *       <attribute name="hostName" use="required" type="{http://www.w3.org/2001/XMLSchema}string" />
- *     </restriction>
- *   </complexContent>
- * </complexType>
- * 
- * - * - */ -@XmlAccessorType(XmlAccessType.FIELD) -@XmlType(name = "AddDirectionalPoolData", propOrder = { - "directionalRecordData" -}) -public class AddDirectionalPoolData { - - @XmlElement(name = "DirectionalRecordData", required = true, nillable = true) - protected DirectionalRecordData directionalRecordData; - @XmlAttribute(name = "dirPoolType", required = true) - protected DirPoolType dirPoolType; - @XmlAttribute(name = "poolRecordType", required = true) - protected DirPoolRecordType poolRecordType; - @XmlAttribute(name = "description") - protected String description; - @XmlAttribute(name = "zoneName", required = true) - protected String zoneName; - @XmlAttribute(name = "hostName", required = true) - protected String hostName; - - /** - * Gets the value of the directionalRecordData property. - * - * @return - * possible object is - * {@link DirectionalRecordData } - * - */ - public DirectionalRecordData getDirectionalRecordData() { - return directionalRecordData; - } - - /** - * Sets the value of the directionalRecordData property. - * - * @param value - * allowed object is - * {@link DirectionalRecordData } - * - */ - public void setDirectionalRecordData(DirectionalRecordData value) { - this.directionalRecordData = value; - } - - /** - * Gets the value of the dirPoolType property. - * - * @return - * possible object is - * {@link DirPoolType } - * - */ - public DirPoolType getDirPoolType() { - return dirPoolType; - } - - /** - * Sets the value of the dirPoolType property. - * - * @param value - * allowed object is - * {@link DirPoolType } - * - */ - public void setDirPoolType(DirPoolType value) { - this.dirPoolType = value; - } - - /** - * Gets the value of the poolRecordType property. - * - * @return - * possible object is - * {@link DirPoolRecordType } - * - */ - public DirPoolRecordType getPoolRecordType() { - return poolRecordType; - } - - /** - * Sets the value of the poolRecordType property. - * - * @param value - * allowed object is - * {@link DirPoolRecordType } - * - */ - public void setPoolRecordType(DirPoolRecordType value) { - this.poolRecordType = value; - } - - /** - * Gets the value of the description property. - * - * @return - * possible object is - * {@link String } - * - */ - public String getDescription() { - return description; - } - - /** - * Sets the value of the description property. - * - * @param value - * allowed object is - * {@link String } - * - */ - public void setDescription(String value) { - this.description = value; - } - - /** - * Gets the value of the zoneName property. - * - * @return - * possible object is - * {@link String } - * - */ - public String getZoneName() { - return zoneName; - } - - /** - * Sets the value of the zoneName property. - * - * @param value - * allowed object is - * {@link String } - * - */ - public void setZoneName(String value) { - this.zoneName = value; - } - - /** - * Gets the value of the hostName property. - * - * @return - * possible object is - * {@link String } - * - */ - public String getHostName() { - return hostName; - } - - /** - * Sets the value of the hostName property. - * - * @param value - * allowed object is - * {@link String } - * - */ - public void setHostName(String value) { - this.hostName = value; - } - -} diff --git a/Plugins/Mineplex.BungeeRotator/src/com/neustar/ultraservice/schema/v01/AddDirectionalRecordData.java b/Plugins/Mineplex.BungeeRotator/src/com/neustar/ultraservice/schema/v01/AddDirectionalRecordData.java deleted file mode 100644 index 2f7168550..000000000 --- a/Plugins/Mineplex.BungeeRotator/src/com/neustar/ultraservice/schema/v01/AddDirectionalRecordData.java +++ /dev/null @@ -1,192 +0,0 @@ - -package com.neustar.ultraservice.schema.v01; - -import javax.xml.bind.annotation.XmlAccessType; -import javax.xml.bind.annotation.XmlAccessorType; -import javax.xml.bind.annotation.XmlAttribute; -import javax.xml.bind.annotation.XmlElement; -import javax.xml.bind.annotation.XmlType; - - -/** - *

Java class for AddDirectionalRecordData complex type. - * - *

The following schema fragment specifies the expected content contained within this class. - * - *

- * <complexType name="AddDirectionalRecordData">
- *   <complexContent>
- *     <restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
- *       <sequence>
- *         <element name="DirectionalRecordConfiguration" type="{http://schema.ultraservice.neustar.com/v01/}DirectionalDNSRecord"/>
- *         <element name="GeolocationGroupData" type="{http://schema.ultraservice.neustar.com/v01/}GeolocationGroupData"/>
- *         <element name="SourceIPGroupData" type="{http://schema.ultraservice.neustar.com/v01/}SourceIPGroupData"/>
- *         <element name="forceOverlapTransfer" type="{http://www.w3.org/2001/XMLSchema}boolean" minOccurs="0"/>
- *       </sequence>
- *       <attribute name="directionalPoolId" use="required" type="{http://www.w3.org/2001/XMLSchema}string" />
- *       <attribute name="createAllNonConfiguredGrp" use="required" type="{http://www.w3.org/2001/XMLSchema}boolean" />
- *     </restriction>
- *   </complexContent>
- * </complexType>
- * 
- * - * - */ -@XmlAccessorType(XmlAccessType.FIELD) -@XmlType(name = "AddDirectionalRecordData", propOrder = { - "directionalRecordConfiguration", - "geolocationGroupData", - "sourceIPGroupData", - "forceOverlapTransfer" -}) -public class AddDirectionalRecordData { - - @XmlElement(name = "DirectionalRecordConfiguration", required = true, nillable = true) - protected DirectionalDNSRecord directionalRecordConfiguration; - @XmlElement(name = "GeolocationGroupData", required = true, nillable = true) - protected GeolocationGroupData geolocationGroupData; - @XmlElement(name = "SourceIPGroupData", required = true, nillable = true) - protected SourceIPGroupData sourceIPGroupData; - protected Boolean forceOverlapTransfer; - @XmlAttribute(name = "directionalPoolId", required = true) - protected String directionalPoolId; - @XmlAttribute(name = "createAllNonConfiguredGrp", required = true) - protected boolean createAllNonConfiguredGrp; - - /** - * Gets the value of the directionalRecordConfiguration property. - * - * @return - * possible object is - * {@link DirectionalDNSRecord } - * - */ - public DirectionalDNSRecord getDirectionalRecordConfiguration() { - return directionalRecordConfiguration; - } - - /** - * Sets the value of the directionalRecordConfiguration property. - * - * @param value - * allowed object is - * {@link DirectionalDNSRecord } - * - */ - public void setDirectionalRecordConfiguration(DirectionalDNSRecord value) { - this.directionalRecordConfiguration = value; - } - - /** - * Gets the value of the geolocationGroupData property. - * - * @return - * possible object is - * {@link GeolocationGroupData } - * - */ - public GeolocationGroupData getGeolocationGroupData() { - return geolocationGroupData; - } - - /** - * Sets the value of the geolocationGroupData property. - * - * @param value - * allowed object is - * {@link GeolocationGroupData } - * - */ - public void setGeolocationGroupData(GeolocationGroupData value) { - this.geolocationGroupData = value; - } - - /** - * Gets the value of the sourceIPGroupData property. - * - * @return - * possible object is - * {@link SourceIPGroupData } - * - */ - public SourceIPGroupData getSourceIPGroupData() { - return sourceIPGroupData; - } - - /** - * Sets the value of the sourceIPGroupData property. - * - * @param value - * allowed object is - * {@link SourceIPGroupData } - * - */ - public void setSourceIPGroupData(SourceIPGroupData value) { - this.sourceIPGroupData = value; - } - - /** - * Gets the value of the forceOverlapTransfer property. - * - * @return - * possible object is - * {@link Boolean } - * - */ - public Boolean isForceOverlapTransfer() { - return forceOverlapTransfer; - } - - /** - * Sets the value of the forceOverlapTransfer property. - * - * @param value - * allowed object is - * {@link Boolean } - * - */ - public void setForceOverlapTransfer(Boolean value) { - this.forceOverlapTransfer = value; - } - - /** - * Gets the value of the directionalPoolId property. - * - * @return - * possible object is - * {@link String } - * - */ - public String getDirectionalPoolId() { - return directionalPoolId; - } - - /** - * Sets the value of the directionalPoolId property. - * - * @param value - * allowed object is - * {@link String } - * - */ - public void setDirectionalPoolId(String value) { - this.directionalPoolId = value; - } - - /** - * Gets the value of the createAllNonConfiguredGrp property. - * - */ - public boolean isCreateAllNonConfiguredGrp() { - return createAllNonConfiguredGrp; - } - - /** - * Sets the value of the createAllNonConfiguredGrp property. - * - */ - public void setCreateAllNonConfiguredGrp(boolean value) { - this.createAllNonConfiguredGrp = value; - } - -} diff --git a/Plugins/Mineplex.BungeeRotator/src/com/neustar/ultraservice/schema/v01/AddressBookEntry.java b/Plugins/Mineplex.BungeeRotator/src/com/neustar/ultraservice/schema/v01/AddressBookEntry.java deleted file mode 100644 index f7440d89e..000000000 --- a/Plugins/Mineplex.BungeeRotator/src/com/neustar/ultraservice/schema/v01/AddressBookEntry.java +++ /dev/null @@ -1,173 +0,0 @@ - -package com.neustar.ultraservice.schema.v01; - -import javax.xml.bind.annotation.XmlAccessType; -import javax.xml.bind.annotation.XmlAccessorType; -import javax.xml.bind.annotation.XmlElement; -import javax.xml.bind.annotation.XmlType; - - -/** - *

Java class for AddressBookEntry complex type. - * - *

The following schema fragment specifies the expected content contained within this class. - * - *

- * <complexType name="AddressBookEntry">
- *   <complexContent>
- *     <restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
- *       <sequence>
- *         <element name="addressBookEntryKey" type="{http://schema.ultraservice.neustar.com/v01/}AddressBookEntryKey"/>
- *         <element name="firstName" type="{http://www.w3.org/2001/XMLSchema}string"/>
- *         <element name="lastName" type="{http://www.w3.org/2001/XMLSchema}string"/>
- *         <element name="email" type="{http://www.w3.org/2001/XMLSchema}string"/>
- *         <element name="phone" type="{http://www.w3.org/2001/XMLSchema}string" minOccurs="0"/>
- *       </sequence>
- *     </restriction>
- *   </complexContent>
- * </complexType>
- * 
- * - * - */ -@XmlAccessorType(XmlAccessType.FIELD) -@XmlType(name = "AddressBookEntry", propOrder = { - "addressBookEntryKey", - "firstName", - "lastName", - "email", - "phone" -}) -public class AddressBookEntry { - - @XmlElement(required = true) - protected AddressBookEntryKey addressBookEntryKey; - @XmlElement(required = true) - protected String firstName; - @XmlElement(required = true) - protected String lastName; - @XmlElement(required = true) - protected String email; - protected String phone; - - /** - * Gets the value of the addressBookEntryKey property. - * - * @return - * possible object is - * {@link AddressBookEntryKey } - * - */ - public AddressBookEntryKey getAddressBookEntryKey() { - return addressBookEntryKey; - } - - /** - * Sets the value of the addressBookEntryKey property. - * - * @param value - * allowed object is - * {@link AddressBookEntryKey } - * - */ - public void setAddressBookEntryKey(AddressBookEntryKey value) { - this.addressBookEntryKey = value; - } - - /** - * Gets the value of the firstName property. - * - * @return - * possible object is - * {@link String } - * - */ - public String getFirstName() { - return firstName; - } - - /** - * Sets the value of the firstName property. - * - * @param value - * allowed object is - * {@link String } - * - */ - public void setFirstName(String value) { - this.firstName = value; - } - - /** - * Gets the value of the lastName property. - * - * @return - * possible object is - * {@link String } - * - */ - public String getLastName() { - return lastName; - } - - /** - * Sets the value of the lastName property. - * - * @param value - * allowed object is - * {@link String } - * - */ - public void setLastName(String value) { - this.lastName = value; - } - - /** - * Gets the value of the email property. - * - * @return - * possible object is - * {@link String } - * - */ - public String getEmail() { - return email; - } - - /** - * Sets the value of the email property. - * - * @param value - * allowed object is - * {@link String } - * - */ - public void setEmail(String value) { - this.email = value; - } - - /** - * Gets the value of the phone property. - * - * @return - * possible object is - * {@link String } - * - */ - public String getPhone() { - return phone; - } - - /** - * Sets the value of the phone property. - * - * @param value - * allowed object is - * {@link String } - * - */ - public void setPhone(String value) { - this.phone = value; - } - -} diff --git a/Plugins/Mineplex.BungeeRotator/src/com/neustar/ultraservice/schema/v01/AddressBookEntryCreate.java b/Plugins/Mineplex.BungeeRotator/src/com/neustar/ultraservice/schema/v01/AddressBookEntryCreate.java deleted file mode 100644 index 36953ad61..000000000 --- a/Plugins/Mineplex.BungeeRotator/src/com/neustar/ultraservice/schema/v01/AddressBookEntryCreate.java +++ /dev/null @@ -1,173 +0,0 @@ - -package com.neustar.ultraservice.schema.v01; - -import javax.xml.bind.annotation.XmlAccessType; -import javax.xml.bind.annotation.XmlAccessorType; -import javax.xml.bind.annotation.XmlElement; -import javax.xml.bind.annotation.XmlType; - - -/** - *

Java class for AddressBookEntryCreate complex type. - * - *

The following schema fragment specifies the expected content contained within this class. - * - *

- * <complexType name="AddressBookEntryCreate">
- *   <complexContent>
- *     <restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
- *       <sequence>
- *         <element name="addressBookEntryKey" type="{http://schema.ultraservice.neustar.com/v01/}AddressBookEntryCreateKey"/>
- *         <element name="firstName" type="{http://www.w3.org/2001/XMLSchema}string"/>
- *         <element name="lastName" type="{http://www.w3.org/2001/XMLSchema}string"/>
- *         <element name="email" type="{http://www.w3.org/2001/XMLSchema}string"/>
- *         <element name="phone" type="{http://www.w3.org/2001/XMLSchema}string" minOccurs="0"/>
- *       </sequence>
- *     </restriction>
- *   </complexContent>
- * </complexType>
- * 
- * - * - */ -@XmlAccessorType(XmlAccessType.FIELD) -@XmlType(name = "AddressBookEntryCreate", propOrder = { - "addressBookEntryKey", - "firstName", - "lastName", - "email", - "phone" -}) -public class AddressBookEntryCreate { - - @XmlElement(required = true) - protected AddressBookEntryCreateKey addressBookEntryKey; - @XmlElement(required = true) - protected String firstName; - @XmlElement(required = true) - protected String lastName; - @XmlElement(required = true) - protected String email; - protected String phone; - - /** - * Gets the value of the addressBookEntryKey property. - * - * @return - * possible object is - * {@link AddressBookEntryCreateKey } - * - */ - public AddressBookEntryCreateKey getAddressBookEntryKey() { - return addressBookEntryKey; - } - - /** - * Sets the value of the addressBookEntryKey property. - * - * @param value - * allowed object is - * {@link AddressBookEntryCreateKey } - * - */ - public void setAddressBookEntryKey(AddressBookEntryCreateKey value) { - this.addressBookEntryKey = value; - } - - /** - * Gets the value of the firstName property. - * - * @return - * possible object is - * {@link String } - * - */ - public String getFirstName() { - return firstName; - } - - /** - * Sets the value of the firstName property. - * - * @param value - * allowed object is - * {@link String } - * - */ - public void setFirstName(String value) { - this.firstName = value; - } - - /** - * Gets the value of the lastName property. - * - * @return - * possible object is - * {@link String } - * - */ - public String getLastName() { - return lastName; - } - - /** - * Sets the value of the lastName property. - * - * @param value - * allowed object is - * {@link String } - * - */ - public void setLastName(String value) { - this.lastName = value; - } - - /** - * Gets the value of the email property. - * - * @return - * possible object is - * {@link String } - * - */ - public String getEmail() { - return email; - } - - /** - * Sets the value of the email property. - * - * @param value - * allowed object is - * {@link String } - * - */ - public void setEmail(String value) { - this.email = value; - } - - /** - * Gets the value of the phone property. - * - * @return - * possible object is - * {@link String } - * - */ - public String getPhone() { - return phone; - } - - /** - * Sets the value of the phone property. - * - * @param value - * allowed object is - * {@link String } - * - */ - public void setPhone(String value) { - this.phone = value; - } - -} diff --git a/Plugins/Mineplex.BungeeRotator/src/com/neustar/ultraservice/schema/v01/AddressBookEntryCreateKey.java b/Plugins/Mineplex.BungeeRotator/src/com/neustar/ultraservice/schema/v01/AddressBookEntryCreateKey.java deleted file mode 100644 index 00ac5ca89..000000000 --- a/Plugins/Mineplex.BungeeRotator/src/com/neustar/ultraservice/schema/v01/AddressBookEntryCreateKey.java +++ /dev/null @@ -1,62 +0,0 @@ - -package com.neustar.ultraservice.schema.v01; - -import javax.xml.bind.annotation.XmlAccessType; -import javax.xml.bind.annotation.XmlAccessorType; -import javax.xml.bind.annotation.XmlElement; -import javax.xml.bind.annotation.XmlType; - - -/** - *

Java class for AddressBookEntryCreateKey complex type. - * - *

The following schema fragment specifies the expected content contained within this class. - * - *

- * <complexType name="AddressBookEntryCreateKey">
- *   <complexContent>
- *     <restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
- *       <sequence>
- *         <element name="accountName" type="{http://www.w3.org/2001/XMLSchema}string"/>
- *       </sequence>
- *     </restriction>
- *   </complexContent>
- * </complexType>
- * 
- * - * - */ -@XmlAccessorType(XmlAccessType.FIELD) -@XmlType(name = "AddressBookEntryCreateKey", propOrder = { - "accountName" -}) -public class AddressBookEntryCreateKey { - - @XmlElement(required = true) - protected String accountName; - - /** - * Gets the value of the accountName property. - * - * @return - * possible object is - * {@link String } - * - */ - public String getAccountName() { - return accountName; - } - - /** - * Sets the value of the accountName property. - * - * @param value - * allowed object is - * {@link String } - * - */ - public void setAccountName(String value) { - this.accountName = value; - } - -} diff --git a/Plugins/Mineplex.BungeeRotator/src/com/neustar/ultraservice/schema/v01/AddressBookEntryGet.java b/Plugins/Mineplex.BungeeRotator/src/com/neustar/ultraservice/schema/v01/AddressBookEntryGet.java deleted file mode 100644 index c656b76a0..000000000 --- a/Plugins/Mineplex.BungeeRotator/src/com/neustar/ultraservice/schema/v01/AddressBookEntryGet.java +++ /dev/null @@ -1,257 +0,0 @@ - -package com.neustar.ultraservice.schema.v01; - -import javax.xml.bind.annotation.XmlAccessType; -import javax.xml.bind.annotation.XmlAccessorType; -import javax.xml.bind.annotation.XmlElement; -import javax.xml.bind.annotation.XmlType; - - -/** - *

Java class for AddressBookEntryGet complex type. - * - *

The following schema fragment specifies the expected content contained within this class. - * - *

- * <complexType name="AddressBookEntryGet">
- *   <complexContent>
- *     <restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
- *       <sequence>
- *         <element name="entryLabel" type="{http://www.w3.org/2001/XMLSchema}string"/>
- *         <element name="accountName" type="{http://www.w3.org/2001/XMLSchema}string"/>
- *         <element name="firstName" type="{http://www.w3.org/2001/XMLSchema}string"/>
- *         <element name="lastName" type="{http://www.w3.org/2001/XMLSchema}string"/>
- *         <element name="email" type="{http://www.w3.org/2001/XMLSchema}string"/>
- *         <element name="phone" type="{http://www.w3.org/2001/XMLSchema}string" minOccurs="0"/>
- *         <element name="created" type="{http://www.w3.org/2001/XMLSchema}string"/>
- *         <element name="lastModified" type="{http://www.w3.org/2001/XMLSchema}string"/>
- *       </sequence>
- *     </restriction>
- *   </complexContent>
- * </complexType>
- * 
- * - * - */ -@XmlAccessorType(XmlAccessType.FIELD) -@XmlType(name = "AddressBookEntryGet", propOrder = { - "entryLabel", - "accountName", - "firstName", - "lastName", - "email", - "phone", - "created", - "lastModified" -}) -public class AddressBookEntryGet { - - @XmlElement(required = true) - protected String entryLabel; - @XmlElement(required = true) - protected String accountName; - @XmlElement(required = true) - protected String firstName; - @XmlElement(required = true) - protected String lastName; - @XmlElement(required = true) - protected String email; - protected String phone; - @XmlElement(required = true) - protected String created; - @XmlElement(required = true) - protected String lastModified; - - /** - * Gets the value of the entryLabel property. - * - * @return - * possible object is - * {@link String } - * - */ - public String getEntryLabel() { - return entryLabel; - } - - /** - * Sets the value of the entryLabel property. - * - * @param value - * allowed object is - * {@link String } - * - */ - public void setEntryLabel(String value) { - this.entryLabel = value; - } - - /** - * Gets the value of the accountName property. - * - * @return - * possible object is - * {@link String } - * - */ - public String getAccountName() { - return accountName; - } - - /** - * Sets the value of the accountName property. - * - * @param value - * allowed object is - * {@link String } - * - */ - public void setAccountName(String value) { - this.accountName = value; - } - - /** - * Gets the value of the firstName property. - * - * @return - * possible object is - * {@link String } - * - */ - public String getFirstName() { - return firstName; - } - - /** - * Sets the value of the firstName property. - * - * @param value - * allowed object is - * {@link String } - * - */ - public void setFirstName(String value) { - this.firstName = value; - } - - /** - * Gets the value of the lastName property. - * - * @return - * possible object is - * {@link String } - * - */ - public String getLastName() { - return lastName; - } - - /** - * Sets the value of the lastName property. - * - * @param value - * allowed object is - * {@link String } - * - */ - public void setLastName(String value) { - this.lastName = value; - } - - /** - * Gets the value of the email property. - * - * @return - * possible object is - * {@link String } - * - */ - public String getEmail() { - return email; - } - - /** - * Sets the value of the email property. - * - * @param value - * allowed object is - * {@link String } - * - */ - public void setEmail(String value) { - this.email = value; - } - - /** - * Gets the value of the phone property. - * - * @return - * possible object is - * {@link String } - * - */ - public String getPhone() { - return phone; - } - - /** - * Sets the value of the phone property. - * - * @param value - * allowed object is - * {@link String } - * - */ - public void setPhone(String value) { - this.phone = value; - } - - /** - * Gets the value of the created property. - * - * @return - * possible object is - * {@link String } - * - */ - public String getCreated() { - return created; - } - - /** - * Sets the value of the created property. - * - * @param value - * allowed object is - * {@link String } - * - */ - public void setCreated(String value) { - this.created = value; - } - - /** - * Gets the value of the lastModified property. - * - * @return - * possible object is - * {@link String } - * - */ - public String getLastModified() { - return lastModified; - } - - /** - * Sets the value of the lastModified property. - * - * @param value - * allowed object is - * {@link String } - * - */ - public void setLastModified(String value) { - this.lastModified = value; - } - -} diff --git a/Plugins/Mineplex.BungeeRotator/src/com/neustar/ultraservice/schema/v01/AddressBookEntryKey.java b/Plugins/Mineplex.BungeeRotator/src/com/neustar/ultraservice/schema/v01/AddressBookEntryKey.java deleted file mode 100644 index 01f50aec0..000000000 --- a/Plugins/Mineplex.BungeeRotator/src/com/neustar/ultraservice/schema/v01/AddressBookEntryKey.java +++ /dev/null @@ -1,90 +0,0 @@ - -package com.neustar.ultraservice.schema.v01; - -import javax.xml.bind.annotation.XmlAccessType; -import javax.xml.bind.annotation.XmlAccessorType; -import javax.xml.bind.annotation.XmlElement; -import javax.xml.bind.annotation.XmlType; - - -/** - *

Java class for AddressBookEntryKey complex type. - * - *

The following schema fragment specifies the expected content contained within this class. - * - *

- * <complexType name="AddressBookEntryKey">
- *   <complexContent>
- *     <restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
- *       <sequence>
- *         <element name="accountName" type="{http://www.w3.org/2001/XMLSchema}string"/>
- *         <element name="entryLabel" type="{http://www.w3.org/2001/XMLSchema}string"/>
- *       </sequence>
- *     </restriction>
- *   </complexContent>
- * </complexType>
- * 
- * - * - */ -@XmlAccessorType(XmlAccessType.FIELD) -@XmlType(name = "AddressBookEntryKey", propOrder = { - "accountName", - "entryLabel" -}) -public class AddressBookEntryKey { - - @XmlElement(required = true) - protected String accountName; - @XmlElement(required = true) - protected String entryLabel; - - /** - * Gets the value of the accountName property. - * - * @return - * possible object is - * {@link String } - * - */ - public String getAccountName() { - return accountName; - } - - /** - * Sets the value of the accountName property. - * - * @param value - * allowed object is - * {@link String } - * - */ - public void setAccountName(String value) { - this.accountName = value; - } - - /** - * Gets the value of the entryLabel property. - * - * @return - * possible object is - * {@link String } - * - */ - public String getEntryLabel() { - return entryLabel; - } - - /** - * Sets the value of the entryLabel property. - * - * @param value - * allowed object is - * {@link String } - * - */ - public void setEntryLabel(String value) { - this.entryLabel = value; - } - -} diff --git a/Plugins/Mineplex.BungeeRotator/src/com/neustar/ultraservice/schema/v01/AddressBookEntryKeys.java b/Plugins/Mineplex.BungeeRotator/src/com/neustar/ultraservice/schema/v01/AddressBookEntryKeys.java deleted file mode 100644 index 94a0fdc34..000000000 --- a/Plugins/Mineplex.BungeeRotator/src/com/neustar/ultraservice/schema/v01/AddressBookEntryKeys.java +++ /dev/null @@ -1,69 +0,0 @@ - -package com.neustar.ultraservice.schema.v01; - -import java.util.ArrayList; -import java.util.List; -import javax.xml.bind.annotation.XmlAccessType; -import javax.xml.bind.annotation.XmlAccessorType; -import javax.xml.bind.annotation.XmlElement; -import javax.xml.bind.annotation.XmlType; - - -/** - *

Java class for AddressBookEntryKeys complex type. - * - *

The following schema fragment specifies the expected content contained within this class. - * - *

- * <complexType name="AddressBookEntryKeys">
- *   <complexContent>
- *     <restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
- *       <sequence>
- *         <element name="addressBookEntryKey" type="{http://schema.ultraservice.neustar.com/v01/}AddressBookEntryKey" maxOccurs="unbounded"/>
- *       </sequence>
- *     </restriction>
- *   </complexContent>
- * </complexType>
- * 
- * - * - */ -@XmlAccessorType(XmlAccessType.FIELD) -@XmlType(name = "AddressBookEntryKeys", propOrder = { - "addressBookEntryKey" -}) -public class AddressBookEntryKeys { - - @XmlElement(required = true) - protected List addressBookEntryKey; - - /** - * Gets the value of the addressBookEntryKey property. - * - *

- * This accessor method returns a reference to the live list, - * not a snapshot. Therefore any modification you make to the - * returned list will be present inside the JAXB object. - * This is why there is not a set method for the addressBookEntryKey property. - * - *

- * For example, to add a new item, do as follows: - *

-     *    getAddressBookEntryKey().add(newItem);
-     * 
- * - * - *

- * Objects of the following type(s) are allowed in the list - * {@link AddressBookEntryKey } - * - * - */ - public List getAddressBookEntryKey() { - if (addressBookEntryKey == null) { - addressBookEntryKey = new ArrayList(); - } - return this.addressBookEntryKey; - } - -} diff --git a/Plugins/Mineplex.BungeeRotator/src/com/neustar/ultraservice/schema/v01/AddressBookEntryList.java b/Plugins/Mineplex.BungeeRotator/src/com/neustar/ultraservice/schema/v01/AddressBookEntryList.java deleted file mode 100644 index 133ef1ee2..000000000 --- a/Plugins/Mineplex.BungeeRotator/src/com/neustar/ultraservice/schema/v01/AddressBookEntryList.java +++ /dev/null @@ -1,105 +0,0 @@ - -package com.neustar.ultraservice.schema.v01; - -import java.util.ArrayList; -import java.util.List; -import javax.xml.bind.annotation.XmlAccessType; -import javax.xml.bind.annotation.XmlAccessorType; -import javax.xml.bind.annotation.XmlType; - - -/** - *

Java class for AddressBookEntryList complex type. - * - *

The following schema fragment specifies the expected content contained within this class. - * - *

- * <complexType name="AddressBookEntryList">
- *   <complexContent>
- *     <restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
- *       <sequence>
- *         <element name="addressBookEntries" type="{http://schema.ultraservice.neustar.com/v01/}AddressBookEntryGet" maxOccurs="unbounded" minOccurs="0"/>
- *         <element name="recordCount" type="{http://www.w3.org/2001/XMLSchema}int"/>
- *         <element name="startIndex" type="{http://www.w3.org/2001/XMLSchema}int"/>
- *       </sequence>
- *     </restriction>
- *   </complexContent>
- * </complexType>
- * 
- * - * - */ -@XmlAccessorType(XmlAccessType.FIELD) -@XmlType(name = "AddressBookEntryList", propOrder = { - "addressBookEntries", - "recordCount", - "startIndex" -}) -public class AddressBookEntryList { - - protected List addressBookEntries; - protected int recordCount; - protected int startIndex; - - /** - * Gets the value of the addressBookEntries property. - * - *

- * This accessor method returns a reference to the live list, - * not a snapshot. Therefore any modification you make to the - * returned list will be present inside the JAXB object. - * This is why there is not a set method for the addressBookEntries property. - * - *

- * For example, to add a new item, do as follows: - *

-     *    getAddressBookEntries().add(newItem);
-     * 
- * - * - *

- * Objects of the following type(s) are allowed in the list - * {@link AddressBookEntryGet } - * - * - */ - public List getAddressBookEntries() { - if (addressBookEntries == null) { - addressBookEntries = new ArrayList(); - } - return this.addressBookEntries; - } - - /** - * Gets the value of the recordCount property. - * - */ - public int getRecordCount() { - return recordCount; - } - - /** - * Sets the value of the recordCount property. - * - */ - public void setRecordCount(int value) { - this.recordCount = value; - } - - /** - * Gets the value of the startIndex property. - * - */ - public int getStartIndex() { - return startIndex; - } - - /** - * Sets the value of the startIndex property. - * - */ - public void setStartIndex(int value) { - this.startIndex = value; - } - -} diff --git a/Plugins/Mineplex.BungeeRotator/src/com/neustar/ultraservice/schema/v01/AddressBookEntryListKey.java b/Plugins/Mineplex.BungeeRotator/src/com/neustar/ultraservice/schema/v01/AddressBookEntryListKey.java deleted file mode 100644 index 66ea79ce8..000000000 --- a/Plugins/Mineplex.BungeeRotator/src/com/neustar/ultraservice/schema/v01/AddressBookEntryListKey.java +++ /dev/null @@ -1,89 +0,0 @@ - -package com.neustar.ultraservice.schema.v01; - -import javax.xml.bind.annotation.XmlAccessType; -import javax.xml.bind.annotation.XmlAccessorType; -import javax.xml.bind.annotation.XmlElement; -import javax.xml.bind.annotation.XmlType; - - -/** - *

Java class for AddressBookEntryListKey complex type. - * - *

The following schema fragment specifies the expected content contained within this class. - * - *

- * <complexType name="AddressBookEntryListKey">
- *   <complexContent>
- *     <restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
- *       <sequence>
- *         <element name="accountName" type="{http://www.w3.org/2001/XMLSchema}string"/>
- *         <element name="entryListParams" type="{http://schema.ultraservice.neustar.com/v01/}EntryListParams" minOccurs="0"/>
- *       </sequence>
- *     </restriction>
- *   </complexContent>
- * </complexType>
- * 
- * - * - */ -@XmlAccessorType(XmlAccessType.FIELD) -@XmlType(name = "AddressBookEntryListKey", propOrder = { - "accountName", - "entryListParams" -}) -public class AddressBookEntryListKey { - - @XmlElement(required = true) - protected String accountName; - protected EntryListParams entryListParams; - - /** - * Gets the value of the accountName property. - * - * @return - * possible object is - * {@link String } - * - */ - public String getAccountName() { - return accountName; - } - - /** - * Sets the value of the accountName property. - * - * @param value - * allowed object is - * {@link String } - * - */ - public void setAccountName(String value) { - this.accountName = value; - } - - /** - * Gets the value of the entryListParams property. - * - * @return - * possible object is - * {@link EntryListParams } - * - */ - public EntryListParams getEntryListParams() { - return entryListParams; - } - - /** - * Sets the value of the entryListParams property. - * - * @param value - * allowed object is - * {@link EntryListParams } - * - */ - public void setEntryListParams(EntryListParams value) { - this.entryListParams = value; - } - -} diff --git a/Plugins/Mineplex.BungeeRotator/src/com/neustar/ultraservice/schema/v01/AgentsRunningProbeList.java b/Plugins/Mineplex.BungeeRotator/src/com/neustar/ultraservice/schema/v01/AgentsRunningProbeList.java deleted file mode 100644 index c34f1e8f3..000000000 --- a/Plugins/Mineplex.BungeeRotator/src/com/neustar/ultraservice/schema/v01/AgentsRunningProbeList.java +++ /dev/null @@ -1,69 +0,0 @@ - -package com.neustar.ultraservice.schema.v01; - -import java.util.ArrayList; -import java.util.List; -import javax.xml.bind.annotation.XmlAccessType; -import javax.xml.bind.annotation.XmlAccessorType; -import javax.xml.bind.annotation.XmlElement; -import javax.xml.bind.annotation.XmlType; - - -/** - *

Java class for AgentsRunningProbeList complex type. - * - *

The following schema fragment specifies the expected content contained within this class. - * - *

- * <complexType name="AgentsRunningProbeList">
- *   <complexContent>
- *     <restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
- *       <sequence>
- *         <element name="regionAndAgent" type="{http://schema.ultraservice.neustar.com/v01/}RegionAndAgent" maxOccurs="unbounded"/>
- *       </sequence>
- *     </restriction>
- *   </complexContent>
- * </complexType>
- * 
- * - * - */ -@XmlAccessorType(XmlAccessType.FIELD) -@XmlType(name = "AgentsRunningProbeList", propOrder = { - "regionAndAgent" -}) -public class AgentsRunningProbeList { - - @XmlElement(required = true) - protected List regionAndAgent; - - /** - * Gets the value of the regionAndAgent property. - * - *

- * This accessor method returns a reference to the live list, - * not a snapshot. Therefore any modification you make to the - * returned list will be present inside the JAXB object. - * This is why there is not a set method for the regionAndAgent property. - * - *

- * For example, to add a new item, do as follows: - *

-     *    getRegionAndAgent().add(newItem);
-     * 
- * - * - *

- * Objects of the following type(s) are allowed in the list - * {@link RegionAndAgent } - * - * - */ - public List getRegionAndAgent() { - if (regionAndAgent == null) { - regionAndAgent = new ArrayList(); - } - return this.regionAndAgent; - } - -} diff --git a/Plugins/Mineplex.BungeeRotator/src/com/neustar/ultraservice/schema/v01/AlertAllFailDetails.java b/Plugins/Mineplex.BungeeRotator/src/com/neustar/ultraservice/schema/v01/AlertAllFailDetails.java deleted file mode 100644 index aaa48e21b..000000000 --- a/Plugins/Mineplex.BungeeRotator/src/com/neustar/ultraservice/schema/v01/AlertAllFailDetails.java +++ /dev/null @@ -1,117 +0,0 @@ - -package com.neustar.ultraservice.schema.v01; - -import javax.xml.bind.annotation.XmlAccessType; -import javax.xml.bind.annotation.XmlAccessorType; -import javax.xml.bind.annotation.XmlElement; -import javax.xml.bind.annotation.XmlType; - - -/** - *

Java class for AlertAllFailDetails complex type. - * - *

The following schema fragment specifies the expected content contained within this class. - * - *

- * <complexType name="AlertAllFailDetails">
- *   <complexContent>
- *     <restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
- *       <sequence>
- *         <element name="oldRecordState" type="{http://schema.ultraservice.neustar.com/v01/}RecordState"/>
- *         <element name="newRecordState" type="{http://schema.ultraservice.neustar.com/v01/}RecordState"/>
- *         <element name="allFailRecords" type="{http://schema.ultraservice.neustar.com/v01/}AlertAllFailRecordsList" minOccurs="0"/>
- *       </sequence>
- *     </restriction>
- *   </complexContent>
- * </complexType>
- * 
- * - * - */ -@XmlAccessorType(XmlAccessType.FIELD) -@XmlType(name = "AlertAllFailDetails", propOrder = { - "oldRecordState", - "newRecordState", - "allFailRecords" -}) -public class AlertAllFailDetails { - - @XmlElement(required = true) - protected RecordState oldRecordState; - @XmlElement(required = true) - protected RecordState newRecordState; - protected AlertAllFailRecordsList allFailRecords; - - /** - * Gets the value of the oldRecordState property. - * - * @return - * possible object is - * {@link RecordState } - * - */ - public RecordState getOldRecordState() { - return oldRecordState; - } - - /** - * Sets the value of the oldRecordState property. - * - * @param value - * allowed object is - * {@link RecordState } - * - */ - public void setOldRecordState(RecordState value) { - this.oldRecordState = value; - } - - /** - * Gets the value of the newRecordState property. - * - * @return - * possible object is - * {@link RecordState } - * - */ - public RecordState getNewRecordState() { - return newRecordState; - } - - /** - * Sets the value of the newRecordState property. - * - * @param value - * allowed object is - * {@link RecordState } - * - */ - public void setNewRecordState(RecordState value) { - this.newRecordState = value; - } - - /** - * Gets the value of the allFailRecords property. - * - * @return - * possible object is - * {@link AlertAllFailRecordsList } - * - */ - public AlertAllFailRecordsList getAllFailRecords() { - return allFailRecords; - } - - /** - * Sets the value of the allFailRecords property. - * - * @param value - * allowed object is - * {@link AlertAllFailRecordsList } - * - */ - public void setAllFailRecords(AlertAllFailRecordsList value) { - this.allFailRecords = value; - } - -} diff --git a/Plugins/Mineplex.BungeeRotator/src/com/neustar/ultraservice/schema/v01/AlertAllFailRecordsList.java b/Plugins/Mineplex.BungeeRotator/src/com/neustar/ultraservice/schema/v01/AlertAllFailRecordsList.java deleted file mode 100644 index 172a0081f..000000000 --- a/Plugins/Mineplex.BungeeRotator/src/com/neustar/ultraservice/schema/v01/AlertAllFailRecordsList.java +++ /dev/null @@ -1,69 +0,0 @@ - -package com.neustar.ultraservice.schema.v01; - -import java.util.ArrayList; -import java.util.List; -import javax.xml.bind.annotation.XmlAccessType; -import javax.xml.bind.annotation.XmlAccessorType; -import javax.xml.bind.annotation.XmlElement; -import javax.xml.bind.annotation.XmlType; - - -/** - *

Java class for AlertAllFailRecordsList complex type. - * - *

The following schema fragment specifies the expected content contained within this class. - * - *

- * <complexType name="AlertAllFailRecordsList">
- *   <complexContent>
- *     <restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
- *       <sequence>
- *         <element name="record" type="{http://schema.ultraservice.neustar.com/v01/}AlertRecord" maxOccurs="unbounded" minOccurs="0"/>
- *       </sequence>
- *     </restriction>
- *   </complexContent>
- * </complexType>
- * 
- * - * - */ -@XmlAccessorType(XmlAccessType.FIELD) -@XmlType(name = "AlertAllFailRecordsList", propOrder = { - "record" -}) -public class AlertAllFailRecordsList { - - @XmlElement(nillable = true) - protected List record; - - /** - * Gets the value of the record property. - * - *

- * This accessor method returns a reference to the live list, - * not a snapshot. Therefore any modification you make to the - * returned list will be present inside the JAXB object. - * This is why there is not a set method for the record property. - * - *

- * For example, to add a new item, do as follows: - *

-     *    getRecord().add(newItem);
-     * 
- * - * - *

- * Objects of the following type(s) are allowed in the list - * {@link AlertRecord } - * - * - */ - public List getRecord() { - if (record == null) { - record = new ArrayList(); - } - return this.record; - } - -} diff --git a/Plugins/Mineplex.BungeeRotator/src/com/neustar/ultraservice/schema/v01/AlertPoolDetails.java b/Plugins/Mineplex.BungeeRotator/src/com/neustar/ultraservice/schema/v01/AlertPoolDetails.java deleted file mode 100644 index f03a3fbac..000000000 --- a/Plugins/Mineplex.BungeeRotator/src/com/neustar/ultraservice/schema/v01/AlertPoolDetails.java +++ /dev/null @@ -1,87 +0,0 @@ - -package com.neustar.ultraservice.schema.v01; - -import javax.xml.bind.annotation.XmlAccessType; -import javax.xml.bind.annotation.XmlAccessorType; -import javax.xml.bind.annotation.XmlAttribute; -import javax.xml.bind.annotation.XmlType; - - -/** - *

Java class for AlertPoolDetails complex type. - * - *

The following schema fragment specifies the expected content contained within this class. - * - *

- * <complexType name="AlertPoolDetails">
- *   <complexContent>
- *     <restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
- *       <sequence>
- *       </sequence>
- *       <attribute name="hostName" use="required" type="{http://www.w3.org/2001/XMLSchema}string" />
- *       <attribute name="configurationName" use="required" type="{http://www.w3.org/2001/XMLSchema}string" />
- *     </restriction>
- *   </complexContent>
- * </complexType>
- * 
- * - * - */ -@XmlAccessorType(XmlAccessType.FIELD) -@XmlType(name = "AlertPoolDetails") -public class AlertPoolDetails { - - @XmlAttribute(name = "hostName", required = true) - protected String hostName; - @XmlAttribute(name = "configurationName", required = true) - protected String configurationName; - - /** - * Gets the value of the hostName property. - * - * @return - * possible object is - * {@link String } - * - */ - public String getHostName() { - return hostName; - } - - /** - * Sets the value of the hostName property. - * - * @param value - * allowed object is - * {@link String } - * - */ - public void setHostName(String value) { - this.hostName = value; - } - - /** - * Gets the value of the configurationName property. - * - * @return - * possible object is - * {@link String } - * - */ - public String getConfigurationName() { - return configurationName; - } - - /** - * Sets the value of the configurationName property. - * - * @param value - * allowed object is - * {@link String } - * - */ - public void setConfigurationName(String value) { - this.configurationName = value; - } - -} diff --git a/Plugins/Mineplex.BungeeRotator/src/com/neustar/ultraservice/schema/v01/AlertPoolStatus.java b/Plugins/Mineplex.BungeeRotator/src/com/neustar/ultraservice/schema/v01/AlertPoolStatus.java deleted file mode 100644 index 75335f74a..000000000 --- a/Plugins/Mineplex.BungeeRotator/src/com/neustar/ultraservice/schema/v01/AlertPoolStatus.java +++ /dev/null @@ -1,90 +0,0 @@ - -package com.neustar.ultraservice.schema.v01; - -import javax.xml.bind.annotation.XmlAccessType; -import javax.xml.bind.annotation.XmlAccessorType; -import javax.xml.bind.annotation.XmlElement; -import javax.xml.bind.annotation.XmlType; - - -/** - *

Java class for AlertPoolStatus complex type. - * - *

The following schema fragment specifies the expected content contained within this class. - * - *

- * <complexType name="AlertPoolStatus">
- *   <complexContent>
- *     <restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
- *       <sequence>
- *         <element name="oldStatus" type="{http://schema.ultraservice.neustar.com/v01/}StatusEnum"/>
- *         <element name="newStatus" type="{http://schema.ultraservice.neustar.com/v01/}StatusEnum"/>
- *       </sequence>
- *     </restriction>
- *   </complexContent>
- * </complexType>
- * 
- * - * - */ -@XmlAccessorType(XmlAccessType.FIELD) -@XmlType(name = "AlertPoolStatus", propOrder = { - "oldStatus", - "newStatus" -}) -public class AlertPoolStatus { - - @XmlElement(required = true) - protected StatusEnum oldStatus; - @XmlElement(required = true) - protected StatusEnum newStatus; - - /** - * Gets the value of the oldStatus property. - * - * @return - * possible object is - * {@link StatusEnum } - * - */ - public StatusEnum getOldStatus() { - return oldStatus; - } - - /** - * Sets the value of the oldStatus property. - * - * @param value - * allowed object is - * {@link StatusEnum } - * - */ - public void setOldStatus(StatusEnum value) { - this.oldStatus = value; - } - - /** - * Gets the value of the newStatus property. - * - * @return - * possible object is - * {@link StatusEnum } - * - */ - public StatusEnum getNewStatus() { - return newStatus; - } - - /** - * Sets the value of the newStatus property. - * - * @param value - * allowed object is - * {@link StatusEnum } - * - */ - public void setNewStatus(StatusEnum value) { - this.newStatus = value; - } - -} diff --git a/Plugins/Mineplex.BungeeRotator/src/com/neustar/ultraservice/schema/v01/AlertPrioritizedRecord.java b/Plugins/Mineplex.BungeeRotator/src/com/neustar/ultraservice/schema/v01/AlertPrioritizedRecord.java deleted file mode 100644 index e5a0c572a..000000000 --- a/Plugins/Mineplex.BungeeRotator/src/com/neustar/ultraservice/schema/v01/AlertPrioritizedRecord.java +++ /dev/null @@ -1,145 +0,0 @@ - -package com.neustar.ultraservice.schema.v01; - -import javax.xml.bind.annotation.XmlAccessType; -import javax.xml.bind.annotation.XmlAccessorType; -import javax.xml.bind.annotation.XmlAttribute; -import javax.xml.bind.annotation.XmlElement; -import javax.xml.bind.annotation.XmlType; - - -/** - *

Java class for AlertPrioritizedRecord complex type. - * - *

The following schema fragment specifies the expected content contained within this class. - * - *

- * <complexType name="AlertPrioritizedRecord">
- *   <complexContent>
- *     <restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
- *       <sequence>
- *         <element name="oldRecordState" type="{http://schema.ultraservice.neustar.com/v01/}RecordState"/>
- *         <element name="newRecordState" type="{http://schema.ultraservice.neustar.com/v01/}RecordState"/>
- *       </sequence>
- *       <attribute name="recordData" use="required" type="{http://www.w3.org/2001/XMLSchema}string" />
- *       <attribute name="recordType" use="required" type="{http://schema.ultraservice.neustar.com/v01/}RecordType" />
- *     </restriction>
- *   </complexContent>
- * </complexType>
- * 
- * - * - */ -@XmlAccessorType(XmlAccessType.FIELD) -@XmlType(name = "AlertPrioritizedRecord", propOrder = { - "oldRecordState", - "newRecordState" -}) -public class AlertPrioritizedRecord { - - @XmlElement(required = true) - protected RecordState oldRecordState; - @XmlElement(required = true) - protected RecordState newRecordState; - @XmlAttribute(name = "recordData", required = true) - protected String recordData; - @XmlAttribute(name = "recordType", required = true) - protected RecordType recordType; - - /** - * Gets the value of the oldRecordState property. - * - * @return - * possible object is - * {@link RecordState } - * - */ - public RecordState getOldRecordState() { - return oldRecordState; - } - - /** - * Sets the value of the oldRecordState property. - * - * @param value - * allowed object is - * {@link RecordState } - * - */ - public void setOldRecordState(RecordState value) { - this.oldRecordState = value; - } - - /** - * Gets the value of the newRecordState property. - * - * @return - * possible object is - * {@link RecordState } - * - */ - public RecordState getNewRecordState() { - return newRecordState; - } - - /** - * Sets the value of the newRecordState property. - * - * @param value - * allowed object is - * {@link RecordState } - * - */ - public void setNewRecordState(RecordState value) { - this.newRecordState = value; - } - - /** - * Gets the value of the recordData property. - * - * @return - * possible object is - * {@link String } - * - */ - public String getRecordData() { - return recordData; - } - - /** - * Sets the value of the recordData property. - * - * @param value - * allowed object is - * {@link String } - * - */ - public void setRecordData(String value) { - this.recordData = value; - } - - /** - * Gets the value of the recordType property. - * - * @return - * possible object is - * {@link RecordType } - * - */ - public RecordType getRecordType() { - return recordType; - } - - /** - * Sets the value of the recordType property. - * - * @param value - * allowed object is - * {@link RecordType } - * - */ - public void setRecordType(RecordType value) { - this.recordType = value; - } - -} diff --git a/Plugins/Mineplex.BungeeRotator/src/com/neustar/ultraservice/schema/v01/AlertProbeDetails.java b/Plugins/Mineplex.BungeeRotator/src/com/neustar/ultraservice/schema/v01/AlertProbeDetails.java deleted file mode 100644 index a965277ba..000000000 --- a/Plugins/Mineplex.BungeeRotator/src/com/neustar/ultraservice/schema/v01/AlertProbeDetails.java +++ /dev/null @@ -1,249 +0,0 @@ - -package com.neustar.ultraservice.schema.v01; - -import javax.xml.bind.annotation.XmlAccessType; -import javax.xml.bind.annotation.XmlAccessorType; -import javax.xml.bind.annotation.XmlAttribute; -import javax.xml.bind.annotation.XmlType; - - -/** - *

Java class for AlertProbeDetails complex type. - * - *

The following schema fragment specifies the expected content contained within this class. - * - *

- * <complexType name="AlertProbeDetails">
- *   <complexContent>
- *     <restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
- *       <sequence>
- *       </sequence>
- *       <attribute name="target" use="required" type="{http://www.w3.org/2001/XMLSchema}string" />
- *       <attribute name="logTime" use="required" type="{http://www.w3.org/2001/XMLSchema}string" />
- *       <attribute name="status" use="required" type="{http://schema.ultraservice.neustar.com/v01/}StatusEnum" />
- *       <attribute name="message" use="required" type="{http://www.w3.org/2001/XMLSchema}string" />
- *       <attribute name="startTime" use="required" type="{http://www.w3.org/2001/XMLSchema}string" />
- *       <attribute name="endTime" use="required" type="{http://www.w3.org/2001/XMLSchema}string" />
- *       <attribute name="definition" use="required" type="{http://www.w3.org/2001/XMLSchema}string" />
- *       <attribute name="region" use="required" type="{http://www.w3.org/2001/XMLSchema}string" />
- *     </restriction>
- *   </complexContent>
- * </complexType>
- * 
- * - * - */ -@XmlAccessorType(XmlAccessType.FIELD) -@XmlType(name = "AlertProbeDetails") -public class AlertProbeDetails { - - @XmlAttribute(name = "target", required = true) - protected String target; - @XmlAttribute(name = "logTime", required = true) - protected String logTime; - @XmlAttribute(name = "status", required = true) - protected StatusEnum status; - @XmlAttribute(name = "message", required = true) - protected String message; - @XmlAttribute(name = "startTime", required = true) - protected String startTime; - @XmlAttribute(name = "endTime", required = true) - protected String endTime; - @XmlAttribute(name = "definition", required = true) - protected String definition; - @XmlAttribute(name = "region", required = true) - protected String region; - - /** - * Gets the value of the target property. - * - * @return - * possible object is - * {@link String } - * - */ - public String getTarget() { - return target; - } - - /** - * Sets the value of the target property. - * - * @param value - * allowed object is - * {@link String } - * - */ - public void setTarget(String value) { - this.target = value; - } - - /** - * Gets the value of the logTime property. - * - * @return - * possible object is - * {@link String } - * - */ - public String getLogTime() { - return logTime; - } - - /** - * Sets the value of the logTime property. - * - * @param value - * allowed object is - * {@link String } - * - */ - public void setLogTime(String value) { - this.logTime = value; - } - - /** - * Gets the value of the status property. - * - * @return - * possible object is - * {@link StatusEnum } - * - */ - public StatusEnum getStatus() { - return status; - } - - /** - * Sets the value of the status property. - * - * @param value - * allowed object is - * {@link StatusEnum } - * - */ - public void setStatus(StatusEnum value) { - this.status = value; - } - - /** - * Gets the value of the message property. - * - * @return - * possible object is - * {@link String } - * - */ - public String getMessage() { - return message; - } - - /** - * Sets the value of the message property. - * - * @param value - * allowed object is - * {@link String } - * - */ - public void setMessage(String value) { - this.message = value; - } - - /** - * Gets the value of the startTime property. - * - * @return - * possible object is - * {@link String } - * - */ - public String getStartTime() { - return startTime; - } - - /** - * Sets the value of the startTime property. - * - * @param value - * allowed object is - * {@link String } - * - */ - public void setStartTime(String value) { - this.startTime = value; - } - - /** - * Gets the value of the endTime property. - * - * @return - * possible object is - * {@link String } - * - */ - public String getEndTime() { - return endTime; - } - - /** - * Sets the value of the endTime property. - * - * @param value - * allowed object is - * {@link String } - * - */ - public void setEndTime(String value) { - this.endTime = value; - } - - /** - * Gets the value of the definition property. - * - * @return - * possible object is - * {@link String } - * - */ - public String getDefinition() { - return definition; - } - - /** - * Sets the value of the definition property. - * - * @param value - * allowed object is - * {@link String } - * - */ - public void setDefinition(String value) { - this.definition = value; - } - - /** - * Gets the value of the region property. - * - * @return - * possible object is - * {@link String } - * - */ - public String getRegion() { - return region; - } - - /** - * Sets the value of the region property. - * - * @param value - * allowed object is - * {@link String } - * - */ - public void setRegion(String value) { - this.region = value; - } - -} diff --git a/Plugins/Mineplex.BungeeRotator/src/com/neustar/ultraservice/schema/v01/AlertRecord.java b/Plugins/Mineplex.BungeeRotator/src/com/neustar/ultraservice/schema/v01/AlertRecord.java deleted file mode 100644 index b4f9765f9..000000000 --- a/Plugins/Mineplex.BungeeRotator/src/com/neustar/ultraservice/schema/v01/AlertRecord.java +++ /dev/null @@ -1,87 +0,0 @@ - -package com.neustar.ultraservice.schema.v01; - -import javax.xml.bind.annotation.XmlAccessType; -import javax.xml.bind.annotation.XmlAccessorType; -import javax.xml.bind.annotation.XmlAttribute; -import javax.xml.bind.annotation.XmlType; - - -/** - *

Java class for AlertRecord complex type. - * - *

The following schema fragment specifies the expected content contained within this class. - * - *

- * <complexType name="AlertRecord">
- *   <complexContent>
- *     <restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
- *       <sequence>
- *       </sequence>
- *       <attribute name="recordData" type="{http://www.w3.org/2001/XMLSchema}string" />
- *       <attribute name="recordType" type="{http://schema.ultraservice.neustar.com/v01/}RecordType" />
- *     </restriction>
- *   </complexContent>
- * </complexType>
- * 
- * - * - */ -@XmlAccessorType(XmlAccessType.FIELD) -@XmlType(name = "AlertRecord") -public class AlertRecord { - - @XmlAttribute(name = "recordData") - protected String recordData; - @XmlAttribute(name = "recordType") - protected RecordType recordType; - - /** - * Gets the value of the recordData property. - * - * @return - * possible object is - * {@link String } - * - */ - public String getRecordData() { - return recordData; - } - - /** - * Sets the value of the recordData property. - * - * @param value - * allowed object is - * {@link String } - * - */ - public void setRecordData(String value) { - this.recordData = value; - } - - /** - * Gets the value of the recordType property. - * - * @return - * possible object is - * {@link RecordType } - * - */ - public RecordType getRecordType() { - return recordType; - } - - /** - * Sets the value of the recordType property. - * - * @param value - * allowed object is - * {@link RecordType } - * - */ - public void setRecordType(RecordType value) { - this.recordType = value; - } - -} diff --git a/Plugins/Mineplex.BungeeRotator/src/com/neustar/ultraservice/schema/v01/AlertSummaryList.java b/Plugins/Mineplex.BungeeRotator/src/com/neustar/ultraservice/schema/v01/AlertSummaryList.java deleted file mode 100644 index 23c51b512..000000000 --- a/Plugins/Mineplex.BungeeRotator/src/com/neustar/ultraservice/schema/v01/AlertSummaryList.java +++ /dev/null @@ -1,135 +0,0 @@ - -package com.neustar.ultraservice.schema.v01; - -import java.util.ArrayList; -import java.util.List; -import javax.xml.bind.annotation.XmlAccessType; -import javax.xml.bind.annotation.XmlAccessorType; -import javax.xml.bind.annotation.XmlElement; -import javax.xml.bind.annotation.XmlType; - - -/** - *

Java class for AlertSummaryList complex type. - * - *

The following schema fragment specifies the expected content contained within this class. - * - *

- * <complexType name="AlertSummaryList">
- *   <complexContent>
- *     <restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
- *       <sequence>
- *         <element name="DomainAlertData" type="{http://schema.ultraservice.neustar.com/v01/}DomainAlertData" maxOccurs="unbounded"/>
- *         <element name="ProbeAlertsData" type="{http://schema.ultraservice.neustar.com/v01/}ProbeAlertsData" maxOccurs="unbounded"/>
- *         <element name="MaintenanceAlertsData" type="{http://schema.ultraservice.neustar.com/v01/}MaintenanceAlertsData" maxOccurs="unbounded"/>
- *       </sequence>
- *     </restriction>
- *   </complexContent>
- * </complexType>
- * 
- * - * - */ -@XmlAccessorType(XmlAccessType.FIELD) -@XmlType(name = "AlertSummaryList", propOrder = { - "domainAlertData", - "probeAlertsData", - "maintenanceAlertsData" -}) -public class AlertSummaryList { - - @XmlElement(name = "DomainAlertData", required = true) - protected List domainAlertData; - @XmlElement(name = "ProbeAlertsData", required = true) - protected List probeAlertsData; - @XmlElement(name = "MaintenanceAlertsData", required = true) - protected List maintenanceAlertsData; - - /** - * Gets the value of the domainAlertData property. - * - *

- * This accessor method returns a reference to the live list, - * not a snapshot. Therefore any modification you make to the - * returned list will be present inside the JAXB object. - * This is why there is not a set method for the domainAlertData property. - * - *

- * For example, to add a new item, do as follows: - *

-     *    getDomainAlertData().add(newItem);
-     * 
- * - * - *

- * Objects of the following type(s) are allowed in the list - * {@link DomainAlertData } - * - * - */ - public List getDomainAlertData() { - if (domainAlertData == null) { - domainAlertData = new ArrayList(); - } - return this.domainAlertData; - } - - /** - * Gets the value of the probeAlertsData property. - * - *

- * This accessor method returns a reference to the live list, - * not a snapshot. Therefore any modification you make to the - * returned list will be present inside the JAXB object. - * This is why there is not a set method for the probeAlertsData property. - * - *

- * For example, to add a new item, do as follows: - *

-     *    getProbeAlertsData().add(newItem);
-     * 
- * - * - *

- * Objects of the following type(s) are allowed in the list - * {@link ProbeAlertsData } - * - * - */ - public List getProbeAlertsData() { - if (probeAlertsData == null) { - probeAlertsData = new ArrayList(); - } - return this.probeAlertsData; - } - - /** - * Gets the value of the maintenanceAlertsData property. - * - *

- * This accessor method returns a reference to the live list, - * not a snapshot. Therefore any modification you make to the - * returned list will be present inside the JAXB object. - * This is why there is not a set method for the maintenanceAlertsData property. - * - *

- * For example, to add a new item, do as follows: - *

-     *    getMaintenanceAlertsData().add(newItem);
-     * 
- * - * - *

- * Objects of the following type(s) are allowed in the list - * {@link MaintenanceAlertsData } - * - * - */ - public List getMaintenanceAlertsData() { - if (maintenanceAlertsData == null) { - maintenanceAlertsData = new ArrayList(); - } - return this.maintenanceAlertsData; - } - -} diff --git a/Plugins/Mineplex.BungeeRotator/src/com/neustar/ultraservice/schema/v01/AliasedDomainInfo.java b/Plugins/Mineplex.BungeeRotator/src/com/neustar/ultraservice/schema/v01/AliasedDomainInfo.java deleted file mode 100644 index 32235d6d9..000000000 --- a/Plugins/Mineplex.BungeeRotator/src/com/neustar/ultraservice/schema/v01/AliasedDomainInfo.java +++ /dev/null @@ -1,303 +0,0 @@ - -package com.neustar.ultraservice.schema.v01; - -import javax.xml.bind.annotation.XmlAccessType; -import javax.xml.bind.annotation.XmlAccessorType; -import javax.xml.bind.annotation.XmlAttribute; -import javax.xml.bind.annotation.XmlType; - - -/** - *

Java class for AliasedDomainInfo complex type. - * - *

The following schema fragment specifies the expected content contained within this class. - * - *

- * <complexType name="AliasedDomainInfo">
- *   <complexContent>
- *     <restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
- *       <sequence>
- *       </sequence>
- *       <attribute name="domainExpired" use="required" type="{http://www.w3.org/2001/XMLSchema}string" />
- *       <attribute name="registerarName" use="required" type="{http://www.w3.org/2001/XMLSchema}string" />
- *       <attribute name="nameServer" use="required" type="{http://www.w3.org/2001/XMLSchema}string" />
- *       <attribute name="guid" use="required" type="{http://www.w3.org/2001/XMLSchema}string" />
- *       <attribute name="zoneid" use="required" type="{http://www.w3.org/2001/XMLSchema}string" />
- *       <attribute name="zone" use="required" type="{http://www.w3.org/2001/XMLSchema}string" />
- *       <attribute name="systemid" use="required" type="{http://www.w3.org/2001/XMLSchema}string" />
- *       <attribute name="status" use="required" type="{http://www.w3.org/2001/XMLSchema}string" />
- *       <attribute name="scandate" use="required" type="{http://www.w3.org/2001/XMLSchema}string" />
- *       <attribute name="zoneHealthMask" use="required" type="{http://www.w3.org/2001/XMLSchema}string" />
- *     </restriction>
- *   </complexContent>
- * </complexType>
- * 
- * - * - */ -@XmlAccessorType(XmlAccessType.FIELD) -@XmlType(name = "AliasedDomainInfo") -public class AliasedDomainInfo { - - @XmlAttribute(name = "domainExpired", required = true) - protected String domainExpired; - @XmlAttribute(name = "registerarName", required = true) - protected String registerarName; - @XmlAttribute(name = "nameServer", required = true) - protected String nameServer; - @XmlAttribute(name = "guid", required = true) - protected String guid; - @XmlAttribute(name = "zoneid", required = true) - protected String zoneid; - @XmlAttribute(name = "zone", required = true) - protected String zone; - @XmlAttribute(name = "systemid", required = true) - protected String systemid; - @XmlAttribute(name = "status", required = true) - protected String status; - @XmlAttribute(name = "scandate", required = true) - protected String scandate; - @XmlAttribute(name = "zoneHealthMask", required = true) - protected String zoneHealthMask; - - /** - * Gets the value of the domainExpired property. - * - * @return - * possible object is - * {@link String } - * - */ - public String getDomainExpired() { - return domainExpired; - } - - /** - * Sets the value of the domainExpired property. - * - * @param value - * allowed object is - * {@link String } - * - */ - public void setDomainExpired(String value) { - this.domainExpired = value; - } - - /** - * Gets the value of the registerarName property. - * - * @return - * possible object is - * {@link String } - * - */ - public String getRegisterarName() { - return registerarName; - } - - /** - * Sets the value of the registerarName property. - * - * @param value - * allowed object is - * {@link String } - * - */ - public void setRegisterarName(String value) { - this.registerarName = value; - } - - /** - * Gets the value of the nameServer property. - * - * @return - * possible object is - * {@link String } - * - */ - public String getNameServer() { - return nameServer; - } - - /** - * Sets the value of the nameServer property. - * - * @param value - * allowed object is - * {@link String } - * - */ - public void setNameServer(String value) { - this.nameServer = value; - } - - /** - * Gets the value of the guid property. - * - * @return - * possible object is - * {@link String } - * - */ - public String getGuid() { - return guid; - } - - /** - * Sets the value of the guid property. - * - * @param value - * allowed object is - * {@link String } - * - */ - public void setGuid(String value) { - this.guid = value; - } - - /** - * Gets the value of the zoneid property. - * - * @return - * possible object is - * {@link String } - * - */ - public String getZoneid() { - return zoneid; - } - - /** - * Sets the value of the zoneid property. - * - * @param value - * allowed object is - * {@link String } - * - */ - public void setZoneid(String value) { - this.zoneid = value; - } - - /** - * Gets the value of the zone property. - * - * @return - * possible object is - * {@link String } - * - */ - public String getZone() { - return zone; - } - - /** - * Sets the value of the zone property. - * - * @param value - * allowed object is - * {@link String } - * - */ - public void setZone(String value) { - this.zone = value; - } - - /** - * Gets the value of the systemid property. - * - * @return - * possible object is - * {@link String } - * - */ - public String getSystemid() { - return systemid; - } - - /** - * Sets the value of the systemid property. - * - * @param value - * allowed object is - * {@link String } - * - */ - public void setSystemid(String value) { - this.systemid = value; - } - - /** - * Gets the value of the status property. - * - * @return - * possible object is - * {@link String } - * - */ - public String getStatus() { - return status; - } - - /** - * Sets the value of the status property. - * - * @param value - * allowed object is - * {@link String } - * - */ - public void setStatus(String value) { - this.status = value; - } - - /** - * Gets the value of the scandate property. - * - * @return - * possible object is - * {@link String } - * - */ - public String getScandate() { - return scandate; - } - - /** - * Sets the value of the scandate property. - * - * @param value - * allowed object is - * {@link String } - * - */ - public void setScandate(String value) { - this.scandate = value; - } - - /** - * Gets the value of the zoneHealthMask property. - * - * @return - * possible object is - * {@link String } - * - */ - public String getZoneHealthMask() { - return zoneHealthMask; - } - - /** - * Sets the value of the zoneHealthMask property. - * - * @param value - * allowed object is - * {@link String } - * - */ - public void setZoneHealthMask(String value) { - this.zoneHealthMask = value; - } - -} diff --git a/Plugins/Mineplex.BungeeRotator/src/com/neustar/ultraservice/schema/v01/AllCountriesList.java b/Plugins/Mineplex.BungeeRotator/src/com/neustar/ultraservice/schema/v01/AllCountriesList.java deleted file mode 100644 index 586b1a54b..000000000 --- a/Plugins/Mineplex.BungeeRotator/src/com/neustar/ultraservice/schema/v01/AllCountriesList.java +++ /dev/null @@ -1,69 +0,0 @@ - -package com.neustar.ultraservice.schema.v01; - -import java.util.ArrayList; -import java.util.List; -import javax.xml.bind.annotation.XmlAccessType; -import javax.xml.bind.annotation.XmlAccessorType; -import javax.xml.bind.annotation.XmlElement; -import javax.xml.bind.annotation.XmlType; - - -/** - *

Java class for AllCountriesList complex type. - * - *

The following schema fragment specifies the expected content contained within this class. - * - *

- * <complexType name="AllCountriesList">
- *   <complexContent>
- *     <restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
- *       <sequence>
- *         <element name="CountryInfo" type="{http://schema.ultraservice.neustar.com/v01/}CountryInfo" maxOccurs="unbounded"/>
- *       </sequence>
- *     </restriction>
- *   </complexContent>
- * </complexType>
- * 
- * - * - */ -@XmlAccessorType(XmlAccessType.FIELD) -@XmlType(name = "AllCountriesList", propOrder = { - "countryInfo" -}) -public class AllCountriesList { - - @XmlElement(name = "CountryInfo", required = true) - protected List countryInfo; - - /** - * Gets the value of the countryInfo property. - * - *

- * This accessor method returns a reference to the live list, - * not a snapshot. Therefore any modification you make to the - * returned list will be present inside the JAXB object. - * This is why there is not a set method for the countryInfo property. - * - *

- * For example, to add a new item, do as follows: - *

-     *    getCountryInfo().add(newItem);
-     * 
- * - * - *

- * Objects of the following type(s) are allowed in the list - * {@link CountryInfo } - * - * - */ - public List getCountryInfo() { - if (countryInfo == null) { - countryInfo = new ArrayList(); - } - return this.countryInfo; - } - -} diff --git a/Plugins/Mineplex.BungeeRotator/src/com/neustar/ultraservice/schema/v01/AllStatesList.java b/Plugins/Mineplex.BungeeRotator/src/com/neustar/ultraservice/schema/v01/AllStatesList.java deleted file mode 100644 index 47e1b073a..000000000 --- a/Plugins/Mineplex.BungeeRotator/src/com/neustar/ultraservice/schema/v01/AllStatesList.java +++ /dev/null @@ -1,69 +0,0 @@ - -package com.neustar.ultraservice.schema.v01; - -import java.util.ArrayList; -import java.util.List; -import javax.xml.bind.annotation.XmlAccessType; -import javax.xml.bind.annotation.XmlAccessorType; -import javax.xml.bind.annotation.XmlElement; -import javax.xml.bind.annotation.XmlType; - - -/** - *

Java class for AllStatesList complex type. - * - *

The following schema fragment specifies the expected content contained within this class. - * - *

- * <complexType name="AllStatesList">
- *   <complexContent>
- *     <restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
- *       <sequence>
- *         <element name="stateInfo" type="{http://schema.ultraservice.neustar.com/v01/}StatesInfo" maxOccurs="unbounded"/>
- *       </sequence>
- *     </restriction>
- *   </complexContent>
- * </complexType>
- * 
- * - * - */ -@XmlAccessorType(XmlAccessType.FIELD) -@XmlType(name = "AllStatesList", propOrder = { - "stateInfo" -}) -public class AllStatesList { - - @XmlElement(required = true) - protected List stateInfo; - - /** - * Gets the value of the stateInfo property. - * - *

- * This accessor method returns a reference to the live list, - * not a snapshot. Therefore any modification you make to the - * returned list will be present inside the JAXB object. - * This is why there is not a set method for the stateInfo property. - * - *

- * For example, to add a new item, do as follows: - *

-     *    getStateInfo().add(newItem);
-     * 
- * - * - *

- * Objects of the following type(s) are allowed in the list - * {@link StatesInfo } - * - * - */ - public List getStateInfo() { - if (stateInfo == null) { - stateInfo = new ArrayList(); - } - return this.stateInfo; - } - -} diff --git a/Plugins/Mineplex.BungeeRotator/src/com/neustar/ultraservice/schema/v01/AllUsersDetailsData.java b/Plugins/Mineplex.BungeeRotator/src/com/neustar/ultraservice/schema/v01/AllUsersDetailsData.java deleted file mode 100644 index f0deea4dd..000000000 --- a/Plugins/Mineplex.BungeeRotator/src/com/neustar/ultraservice/schema/v01/AllUsersDetailsData.java +++ /dev/null @@ -1,249 +0,0 @@ - -package com.neustar.ultraservice.schema.v01; - -import javax.xml.bind.annotation.XmlAccessType; -import javax.xml.bind.annotation.XmlAccessorType; -import javax.xml.bind.annotation.XmlAttribute; -import javax.xml.bind.annotation.XmlType; - - -/** - *

Java class for AllUsersDetailsData complex type. - * - *

The following schema fragment specifies the expected content contained within this class. - * - *

- * <complexType name="AllUsersDetailsData">
- *   <complexContent>
- *     <restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
- *       <sequence>
- *       </sequence>
- *       <attribute name="firstName" use="required" type="{http://www.w3.org/2001/XMLSchema}string" />
- *       <attribute name="lastName" use="required" type="{http://www.w3.org/2001/XMLSchema}string" />
- *       <attribute name="accountNamesList" use="required" type="{http://www.w3.org/2001/XMLSchema}string" />
- *       <attribute name="lastLoggedInTime" use="required" type="{http://www.w3.org/2001/XMLSchema}string" />
- *       <attribute name="accountName" use="required" type="{http://www.w3.org/2001/XMLSchema}string" />
- *       <attribute name="accountsCount" use="required" type="{http://www.w3.org/2001/XMLSchema}string" />
- *       <attribute name="lastLogged" use="required" type="{http://www.w3.org/2001/XMLSchema}string" />
- *       <attribute name="lastLoggedCount" use="required" type="{http://www.w3.org/2001/XMLSchema}string" />
- *     </restriction>
- *   </complexContent>
- * </complexType>
- * 
- * - * - */ -@XmlAccessorType(XmlAccessType.FIELD) -@XmlType(name = "AllUsersDetailsData") -public class AllUsersDetailsData { - - @XmlAttribute(name = "firstName", required = true) - protected String firstName; - @XmlAttribute(name = "lastName", required = true) - protected String lastName; - @XmlAttribute(name = "accountNamesList", required = true) - protected String accountNamesList; - @XmlAttribute(name = "lastLoggedInTime", required = true) - protected String lastLoggedInTime; - @XmlAttribute(name = "accountName", required = true) - protected String accountName; - @XmlAttribute(name = "accountsCount", required = true) - protected String accountsCount; - @XmlAttribute(name = "lastLogged", required = true) - protected String lastLogged; - @XmlAttribute(name = "lastLoggedCount", required = true) - protected String lastLoggedCount; - - /** - * Gets the value of the firstName property. - * - * @return - * possible object is - * {@link String } - * - */ - public String getFirstName() { - return firstName; - } - - /** - * Sets the value of the firstName property. - * - * @param value - * allowed object is - * {@link String } - * - */ - public void setFirstName(String value) { - this.firstName = value; - } - - /** - * Gets the value of the lastName property. - * - * @return - * possible object is - * {@link String } - * - */ - public String getLastName() { - return lastName; - } - - /** - * Sets the value of the lastName property. - * - * @param value - * allowed object is - * {@link String } - * - */ - public void setLastName(String value) { - this.lastName = value; - } - - /** - * Gets the value of the accountNamesList property. - * - * @return - * possible object is - * {@link String } - * - */ - public String getAccountNamesList() { - return accountNamesList; - } - - /** - * Sets the value of the accountNamesList property. - * - * @param value - * allowed object is - * {@link String } - * - */ - public void setAccountNamesList(String value) { - this.accountNamesList = value; - } - - /** - * Gets the value of the lastLoggedInTime property. - * - * @return - * possible object is - * {@link String } - * - */ - public String getLastLoggedInTime() { - return lastLoggedInTime; - } - - /** - * Sets the value of the lastLoggedInTime property. - * - * @param value - * allowed object is - * {@link String } - * - */ - public void setLastLoggedInTime(String value) { - this.lastLoggedInTime = value; - } - - /** - * Gets the value of the accountName property. - * - * @return - * possible object is - * {@link String } - * - */ - public String getAccountName() { - return accountName; - } - - /** - * Sets the value of the accountName property. - * - * @param value - * allowed object is - * {@link String } - * - */ - public void setAccountName(String value) { - this.accountName = value; - } - - /** - * Gets the value of the accountsCount property. - * - * @return - * possible object is - * {@link String } - * - */ - public String getAccountsCount() { - return accountsCount; - } - - /** - * Sets the value of the accountsCount property. - * - * @param value - * allowed object is - * {@link String } - * - */ - public void setAccountsCount(String value) { - this.accountsCount = value; - } - - /** - * Gets the value of the lastLogged property. - * - * @return - * possible object is - * {@link String } - * - */ - public String getLastLogged() { - return lastLogged; - } - - /** - * Sets the value of the lastLogged property. - * - * @param value - * allowed object is - * {@link String } - * - */ - public void setLastLogged(String value) { - this.lastLogged = value; - } - - /** - * Gets the value of the lastLoggedCount property. - * - * @return - * possible object is - * {@link String } - * - */ - public String getLastLoggedCount() { - return lastLoggedCount; - } - - /** - * Sets the value of the lastLoggedCount property. - * - * @param value - * allowed object is - * {@link String } - * - */ - public void setLastLoggedCount(String value) { - this.lastLoggedCount = value; - } - -} diff --git a/Plugins/Mineplex.BungeeRotator/src/com/neustar/ultraservice/schema/v01/AllUsersDetailsList.java b/Plugins/Mineplex.BungeeRotator/src/com/neustar/ultraservice/schema/v01/AllUsersDetailsList.java deleted file mode 100644 index a68264418..000000000 --- a/Plugins/Mineplex.BungeeRotator/src/com/neustar/ultraservice/schema/v01/AllUsersDetailsList.java +++ /dev/null @@ -1,69 +0,0 @@ - -package com.neustar.ultraservice.schema.v01; - -import java.util.ArrayList; -import java.util.List; -import javax.xml.bind.annotation.XmlAccessType; -import javax.xml.bind.annotation.XmlAccessorType; -import javax.xml.bind.annotation.XmlElement; -import javax.xml.bind.annotation.XmlType; - - -/** - *

Java class for AllUsersDetailsList complex type. - * - *

The following schema fragment specifies the expected content contained within this class. - * - *

- * <complexType name="AllUsersDetailsList">
- *   <complexContent>
- *     <restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
- *       <sequence>
- *         <element name="AllUsersDetailsData" type="{http://schema.ultraservice.neustar.com/v01/}AllUsersDetailsData" maxOccurs="unbounded"/>
- *       </sequence>
- *     </restriction>
- *   </complexContent>
- * </complexType>
- * 
- * - * - */ -@XmlAccessorType(XmlAccessType.FIELD) -@XmlType(name = "AllUsersDetailsList", propOrder = { - "allUsersDetailsData" -}) -public class AllUsersDetailsList { - - @XmlElement(name = "AllUsersDetailsData", required = true) - protected List allUsersDetailsData; - - /** - * Gets the value of the allUsersDetailsData property. - * - *

- * This accessor method returns a reference to the live list, - * not a snapshot. Therefore any modification you make to the - * returned list will be present inside the JAXB object. - * This is why there is not a set method for the allUsersDetailsData property. - * - *

- * For example, to add a new item, do as follows: - *

-     *    getAllUsersDetailsData().add(newItem);
-     * 
- * - * - *

- * Objects of the following type(s) are allowed in the list - * {@link AllUsersDetailsData } - * - * - */ - public List getAllUsersDetailsData() { - if (allUsersDetailsData == null) { - allUsersDetailsData = new ArrayList(); - } - return this.allUsersDetailsData; - } - -} diff --git a/Plugins/Mineplex.BungeeRotator/src/com/neustar/ultraservice/schema/v01/AutoSerialUpdateType.java b/Plugins/Mineplex.BungeeRotator/src/com/neustar/ultraservice/schema/v01/AutoSerialUpdateType.java deleted file mode 100644 index da82a2e1d..000000000 --- a/Plugins/Mineplex.BungeeRotator/src/com/neustar/ultraservice/schema/v01/AutoSerialUpdateType.java +++ /dev/null @@ -1,51 +0,0 @@ - -package com.neustar.ultraservice.schema.v01; - -import javax.xml.bind.annotation.XmlEnum; -import javax.xml.bind.annotation.XmlEnumValue; -import javax.xml.bind.annotation.XmlType; - - -/** - *

Java class for autoSerialUpdateType. - * - *

The following schema fragment specifies the expected content contained within this class. - *

- *

- * <simpleType name="autoSerialUpdateType">
- *   <restriction base="{http://www.w3.org/2001/XMLSchema}string">
- *     <enumeration value="enable"/>
- *     <enumeration value="disable"/>
- *   </restriction>
- * </simpleType>
- * 
- * - */ -@XmlType(name = "autoSerialUpdateType") -@XmlEnum -public enum AutoSerialUpdateType { - - @XmlEnumValue("enable") - ENABLE("enable"), - @XmlEnumValue("disable") - DISABLE("disable"); - private final String value; - - AutoSerialUpdateType(String v) { - value = v; - } - - public String value() { - return value; - } - - public static AutoSerialUpdateType fromValue(String v) { - for (AutoSerialUpdateType c: AutoSerialUpdateType.values()) { - if (c.value.equals(v)) { - return c; - } - } - throw new IllegalArgumentException(v); - } - -} diff --git a/Plugins/Mineplex.BungeeRotator/src/com/neustar/ultraservice/schema/v01/AutomaticPointerPreference.java b/Plugins/Mineplex.BungeeRotator/src/com/neustar/ultraservice/schema/v01/AutomaticPointerPreference.java deleted file mode 100644 index d7bba9400..000000000 --- a/Plugins/Mineplex.BungeeRotator/src/com/neustar/ultraservice/schema/v01/AutomaticPointerPreference.java +++ /dev/null @@ -1,87 +0,0 @@ - -package com.neustar.ultraservice.schema.v01; - -import javax.xml.bind.annotation.XmlAccessType; -import javax.xml.bind.annotation.XmlAccessorType; -import javax.xml.bind.annotation.XmlAttribute; -import javax.xml.bind.annotation.XmlType; - - -/** - *

Java class for AutomaticPointerPreference complex type. - * - *

The following schema fragment specifies the expected content contained within this class. - * - *

- * <complexType name="AutomaticPointerPreference">
- *   <complexContent>
- *     <restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
- *       <sequence>
- *       </sequence>
- *       <attribute name="ptrStatus" type="{http://www.w3.org/2001/XMLSchema}string" />
- *       <attribute name="isDefault" type="{http://www.w3.org/2001/XMLSchema}boolean" />
- *     </restriction>
- *   </complexContent>
- * </complexType>
- * 
- * - * - */ -@XmlAccessorType(XmlAccessType.FIELD) -@XmlType(name = "AutomaticPointerPreference") -public class AutomaticPointerPreference { - - @XmlAttribute(name = "ptrStatus") - protected String ptrStatus; - @XmlAttribute(name = "isDefault") - protected Boolean isDefault; - - /** - * Gets the value of the ptrStatus property. - * - * @return - * possible object is - * {@link String } - * - */ - public String getPtrStatus() { - return ptrStatus; - } - - /** - * Sets the value of the ptrStatus property. - * - * @param value - * allowed object is - * {@link String } - * - */ - public void setPtrStatus(String value) { - this.ptrStatus = value; - } - - /** - * Gets the value of the isDefault property. - * - * @return - * possible object is - * {@link Boolean } - * - */ - public Boolean isIsDefault() { - return isDefault; - } - - /** - * Sets the value of the isDefault property. - * - * @param value - * allowed object is - * {@link Boolean } - * - */ - public void setIsDefault(Boolean value) { - this.isDefault = value; - } - -} diff --git a/Plugins/Mineplex.BungeeRotator/src/com/neustar/ultraservice/schema/v01/CNAMERecord.java b/Plugins/Mineplex.BungeeRotator/src/com/neustar/ultraservice/schema/v01/CNAMERecord.java deleted file mode 100644 index b98f8fbd3..000000000 --- a/Plugins/Mineplex.BungeeRotator/src/com/neustar/ultraservice/schema/v01/CNAMERecord.java +++ /dev/null @@ -1,60 +0,0 @@ - -package com.neustar.ultraservice.schema.v01; - -import javax.xml.bind.annotation.XmlAccessType; -import javax.xml.bind.annotation.XmlAccessorType; -import javax.xml.bind.annotation.XmlAttribute; -import javax.xml.bind.annotation.XmlType; - - -/** - *

Java class for CNAMERecord complex type. - * - *

The following schema fragment specifies the expected content contained within this class. - * - *

- * <complexType name="CNAMERecord">
- *   <complexContent>
- *     <restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
- *       <sequence>
- *       </sequence>
- *       <attribute name="hostName" use="required" type="{http://www.w3.org/2001/XMLSchema}string" />
- *     </restriction>
- *   </complexContent>
- * </complexType>
- * 
- * - * - */ -@XmlAccessorType(XmlAccessType.FIELD) -@XmlType(name = "CNAMERecord") -public class CNAMERecord { - - @XmlAttribute(name = "hostName", required = true) - protected String hostName; - - /** - * Gets the value of the hostName property. - * - * @return - * possible object is - * {@link String } - * - */ - public String getHostName() { - return hostName; - } - - /** - * Sets the value of the hostName property. - * - * @param value - * allowed object is - * {@link String } - * - */ - public void setHostName(String value) { - this.hostName = value; - } - -} diff --git a/Plugins/Mineplex.BungeeRotator/src/com/neustar/ultraservice/schema/v01/ContactARPoolRuleInfo.java b/Plugins/Mineplex.BungeeRotator/src/com/neustar/ultraservice/schema/v01/ContactARPoolRuleInfo.java deleted file mode 100644 index a7ad7a6d4..000000000 --- a/Plugins/Mineplex.BungeeRotator/src/com/neustar/ultraservice/schema/v01/ContactARPoolRuleInfo.java +++ /dev/null @@ -1,90 +0,0 @@ - -package com.neustar.ultraservice.schema.v01; - -import javax.xml.bind.annotation.XmlAccessType; -import javax.xml.bind.annotation.XmlAccessorType; -import javax.xml.bind.annotation.XmlElement; -import javax.xml.bind.annotation.XmlType; - - -/** - *

Java class for ContactARPoolRuleInfo complex type. - * - *

The following schema fragment specifies the expected content contained within this class. - * - *

- * <complexType name="ContactARPoolRuleInfo">
- *   <complexContent>
- *     <restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
- *       <sequence>
- *         <element name="arPoolRuleKey" type="{http://schema.ultraservice.neustar.com/v01/}ARPoolRuleKey"/>
- *         <element name="addressBookEntryKeys" type="{http://schema.ultraservice.neustar.com/v01/}AddressBookEntryKeys"/>
- *       </sequence>
- *     </restriction>
- *   </complexContent>
- * </complexType>
- * 
- * - * - */ -@XmlAccessorType(XmlAccessType.FIELD) -@XmlType(name = "ContactARPoolRuleInfo", propOrder = { - "arPoolRuleKey", - "addressBookEntryKeys" -}) -public class ContactARPoolRuleInfo { - - @XmlElement(required = true) - protected ARPoolRuleKey arPoolRuleKey; - @XmlElement(required = true) - protected AddressBookEntryKeys addressBookEntryKeys; - - /** - * Gets the value of the arPoolRuleKey property. - * - * @return - * possible object is - * {@link ARPoolRuleKey } - * - */ - public ARPoolRuleKey getArPoolRuleKey() { - return arPoolRuleKey; - } - - /** - * Sets the value of the arPoolRuleKey property. - * - * @param value - * allowed object is - * {@link ARPoolRuleKey } - * - */ - public void setArPoolRuleKey(ARPoolRuleKey value) { - this.arPoolRuleKey = value; - } - - /** - * Gets the value of the addressBookEntryKeys property. - * - * @return - * possible object is - * {@link AddressBookEntryKeys } - * - */ - public AddressBookEntryKeys getAddressBookEntryKeys() { - return addressBookEntryKeys; - } - - /** - * Sets the value of the addressBookEntryKeys property. - * - * @param value - * allowed object is - * {@link AddressBookEntryKeys } - * - */ - public void setAddressBookEntryKeys(AddressBookEntryKeys value) { - this.addressBookEntryKeys = value; - } - -} diff --git a/Plugins/Mineplex.BungeeRotator/src/com/neustar/ultraservice/schema/v01/CopyAssignedDirDNSGroup.java b/Plugins/Mineplex.BungeeRotator/src/com/neustar/ultraservice/schema/v01/CopyAssignedDirDNSGroup.java deleted file mode 100644 index 3d51ce908..000000000 --- a/Plugins/Mineplex.BungeeRotator/src/com/neustar/ultraservice/schema/v01/CopyAssignedDirDNSGroup.java +++ /dev/null @@ -1,60 +0,0 @@ - -package com.neustar.ultraservice.schema.v01; - -import javax.xml.bind.annotation.XmlAccessType; -import javax.xml.bind.annotation.XmlAccessorType; -import javax.xml.bind.annotation.XmlAttribute; -import javax.xml.bind.annotation.XmlType; - - -/** - *

Java class for CopyAssignedDirDNSGroup complex type. - * - *

The following schema fragment specifies the expected content contained within this class. - * - *

- * <complexType name="CopyAssignedDirDNSGroup">
- *   <complexContent>
- *     <restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
- *       <sequence>
- *       </sequence>
- *       <attribute name="existingGroupID" use="required" type="{http://www.w3.org/2001/XMLSchema}string" />
- *     </restriction>
- *   </complexContent>
- * </complexType>
- * 
- * - * - */ -@XmlAccessorType(XmlAccessType.FIELD) -@XmlType(name = "CopyAssignedDirDNSGroup") -public class CopyAssignedDirDNSGroup { - - @XmlAttribute(name = "existingGroupID", required = true) - protected String existingGroupID; - - /** - * Gets the value of the existingGroupID property. - * - * @return - * possible object is - * {@link String } - * - */ - public String getExistingGroupID() { - return existingGroupID; - } - - /** - * Sets the value of the existingGroupID property. - * - * @param value - * allowed object is - * {@link String } - * - */ - public void setExistingGroupID(String value) { - this.existingGroupID = value; - } - -} diff --git a/Plugins/Mineplex.BungeeRotator/src/com/neustar/ultraservice/schema/v01/CopyDirectionalGroup.java b/Plugins/Mineplex.BungeeRotator/src/com/neustar/ultraservice/schema/v01/CopyDirectionalGroup.java deleted file mode 100644 index c74202544..000000000 --- a/Plugins/Mineplex.BungeeRotator/src/com/neustar/ultraservice/schema/v01/CopyDirectionalGroup.java +++ /dev/null @@ -1,87 +0,0 @@ - -package com.neustar.ultraservice.schema.v01; - -import javax.xml.bind.annotation.XmlAccessType; -import javax.xml.bind.annotation.XmlAccessorType; -import javax.xml.bind.annotation.XmlAttribute; -import javax.xml.bind.annotation.XmlType; - - -/** - *

Java class for CopyDirectionalGroup complex type. - * - *

The following schema fragment specifies the expected content contained within this class. - * - *

- * <complexType name="CopyDirectionalGroup">
- *   <complexContent>
- *     <restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
- *       <sequence>
- *       </sequence>
- *       <attribute name="existingGroupID" use="required" type="{http://www.w3.org/2001/XMLSchema}string" />
- *       <attribute name="newGroupName" use="required" type="{http://www.w3.org/2001/XMLSchema}string" />
- *     </restriction>
- *   </complexContent>
- * </complexType>
- * 
- * - * - */ -@XmlAccessorType(XmlAccessType.FIELD) -@XmlType(name = "CopyDirectionalGroup") -public class CopyDirectionalGroup { - - @XmlAttribute(name = "existingGroupID", required = true) - protected String existingGroupID; - @XmlAttribute(name = "newGroupName", required = true) - protected String newGroupName; - - /** - * Gets the value of the existingGroupID property. - * - * @return - * possible object is - * {@link String } - * - */ - public String getExistingGroupID() { - return existingGroupID; - } - - /** - * Sets the value of the existingGroupID property. - * - * @param value - * allowed object is - * {@link String } - * - */ - public void setExistingGroupID(String value) { - this.existingGroupID = value; - } - - /** - * Gets the value of the newGroupName property. - * - * @return - * possible object is - * {@link String } - * - */ - public String getNewGroupName() { - return newGroupName; - } - - /** - * Sets the value of the newGroupName property. - * - * @param value - * allowed object is - * {@link String } - * - */ - public void setNewGroupName(String value) { - this.newGroupName = value; - } - -} diff --git a/Plugins/Mineplex.BungeeRotator/src/com/neustar/ultraservice/schema/v01/CountryInfo.java b/Plugins/Mineplex.BungeeRotator/src/com/neustar/ultraservice/schema/v01/CountryInfo.java deleted file mode 100644 index d413d1cee..000000000 --- a/Plugins/Mineplex.BungeeRotator/src/com/neustar/ultraservice/schema/v01/CountryInfo.java +++ /dev/null @@ -1,79 +0,0 @@ - -package com.neustar.ultraservice.schema.v01; - -import javax.xml.bind.annotation.XmlAccessType; -import javax.xml.bind.annotation.XmlAccessorType; -import javax.xml.bind.annotation.XmlAttribute; -import javax.xml.bind.annotation.XmlType; - - -/** - *

Java class for CountryInfo complex type. - * - *

The following schema fragment specifies the expected content contained within this class. - * - *

- * <complexType name="CountryInfo">
- *   <complexContent>
- *     <restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
- *       <sequence>
- *       </sequence>
- *       <attribute name="CountryName" type="{http://www.w3.org/2001/XMLSchema}string" />
- *       <attribute name="CountryId" use="required" type="{http://www.w3.org/2001/XMLSchema}long" />
- *     </restriction>
- *   </complexContent>
- * </complexType>
- * 
- * - * - */ -@XmlAccessorType(XmlAccessType.FIELD) -@XmlType(name = "CountryInfo") -public class CountryInfo { - - @XmlAttribute(name = "CountryName") - protected String countryName; - @XmlAttribute(name = "CountryId", required = true) - protected long countryId; - - /** - * Gets the value of the countryName property. - * - * @return - * possible object is - * {@link String } - * - */ - public String getCountryName() { - return countryName; - } - - /** - * Sets the value of the countryName property. - * - * @param value - * allowed object is - * {@link String } - * - */ - public void setCountryName(String value) { - this.countryName = value; - } - - /** - * Gets the value of the countryId property. - * - */ - public long getCountryId() { - return countryId; - } - - /** - * Sets the value of the countryId property. - * - */ - public void setCountryId(long value) { - this.countryId = value; - } - -} diff --git a/Plugins/Mineplex.BungeeRotator/src/com/neustar/ultraservice/schema/v01/CustomHTTPHeaderData.java b/Plugins/Mineplex.BungeeRotator/src/com/neustar/ultraservice/schema/v01/CustomHTTPHeaderData.java deleted file mode 100644 index 22010a464..000000000 --- a/Plugins/Mineplex.BungeeRotator/src/com/neustar/ultraservice/schema/v01/CustomHTTPHeaderData.java +++ /dev/null @@ -1,91 +0,0 @@ - -package com.neustar.ultraservice.schema.v01; - -import javax.xml.bind.annotation.XmlAccessType; -import javax.xml.bind.annotation.XmlAccessorType; -import javax.xml.bind.annotation.XmlAttribute; -import javax.xml.bind.annotation.XmlSeeAlso; -import javax.xml.bind.annotation.XmlType; - - -/** - *

Java class for CustomHTTPHeaderData complex type. - * - *

The following schema fragment specifies the expected content contained within this class. - * - *

- * <complexType name="CustomHTTPHeaderData">
- *   <complexContent>
- *     <restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
- *       <sequence>
- *       </sequence>
- *       <attribute name="accountID" use="required" type="{http://www.w3.org/2001/XMLSchema}string" />
- *       <attribute name="customHeaderValue" use="required" type="{http://www.w3.org/2001/XMLSchema}string" />
- *     </restriction>
- *   </complexContent>
- * </complexType>
- * 
- * - * - */ -@XmlAccessorType(XmlAccessType.FIELD) -@XmlType(name = "CustomHTTPHeaderData") -@XmlSeeAlso({ - CustomHTTPHeaderDataGUID.class -}) -public class CustomHTTPHeaderData { - - @XmlAttribute(name = "accountID", required = true) - protected String accountID; - @XmlAttribute(name = "customHeaderValue", required = true) - protected String customHeaderValue; - - /** - * Gets the value of the accountID property. - * - * @return - * possible object is - * {@link String } - * - */ - public String getAccountID() { - return accountID; - } - - /** - * Sets the value of the accountID property. - * - * @param value - * allowed object is - * {@link String } - * - */ - public void setAccountID(String value) { - this.accountID = value; - } - - /** - * Gets the value of the customHeaderValue property. - * - * @return - * possible object is - * {@link String } - * - */ - public String getCustomHeaderValue() { - return customHeaderValue; - } - - /** - * Sets the value of the customHeaderValue property. - * - * @param value - * allowed object is - * {@link String } - * - */ - public void setCustomHeaderValue(String value) { - this.customHeaderValue = value; - } - -} diff --git a/Plugins/Mineplex.BungeeRotator/src/com/neustar/ultraservice/schema/v01/CustomHTTPHeaderDataGUID.java b/Plugins/Mineplex.BungeeRotator/src/com/neustar/ultraservice/schema/v01/CustomHTTPHeaderDataGUID.java deleted file mode 100644 index f2e8cd2a7..000000000 --- a/Plugins/Mineplex.BungeeRotator/src/com/neustar/ultraservice/schema/v01/CustomHTTPHeaderDataGUID.java +++ /dev/null @@ -1,62 +0,0 @@ - -package com.neustar.ultraservice.schema.v01; - -import javax.xml.bind.annotation.XmlAccessType; -import javax.xml.bind.annotation.XmlAccessorType; -import javax.xml.bind.annotation.XmlAttribute; -import javax.xml.bind.annotation.XmlType; - - -/** - *

Java class for CustomHTTPHeaderDataGUID complex type. - * - *

The following schema fragment specifies the expected content contained within this class. - * - *

- * <complexType name="CustomHTTPHeaderDataGUID">
- *   <complexContent>
- *     <extension base="{http://schema.ultraservice.neustar.com/v01/}CustomHTTPHeaderData">
- *       <sequence>
- *       </sequence>
- *       <attribute name="guid" type="{http://www.w3.org/2001/XMLSchema}string" />
- *     </extension>
- *   </complexContent>
- * </complexType>
- * 
- * - * - */ -@XmlAccessorType(XmlAccessType.FIELD) -@XmlType(name = "CustomHTTPHeaderDataGUID") -public class CustomHTTPHeaderDataGUID - extends CustomHTTPHeaderData -{ - - @XmlAttribute(name = "guid") - protected String guid; - - /** - * Gets the value of the guid property. - * - * @return - * possible object is - * {@link String } - * - */ - public String getGuid() { - return guid; - } - - /** - * Sets the value of the guid property. - * - * @param value - * allowed object is - * {@link String } - * - */ - public void setGuid(String value) { - this.guid = value; - } - -} diff --git a/Plugins/Mineplex.BungeeRotator/src/com/neustar/ultraservice/schema/v01/CustomHTTPHeaderDataList.java b/Plugins/Mineplex.BungeeRotator/src/com/neustar/ultraservice/schema/v01/CustomHTTPHeaderDataList.java deleted file mode 100644 index 4aa685b7b..000000000 --- a/Plugins/Mineplex.BungeeRotator/src/com/neustar/ultraservice/schema/v01/CustomHTTPHeaderDataList.java +++ /dev/null @@ -1,69 +0,0 @@ - -package com.neustar.ultraservice.schema.v01; - -import java.util.ArrayList; -import java.util.List; -import javax.xml.bind.annotation.XmlAccessType; -import javax.xml.bind.annotation.XmlAccessorType; -import javax.xml.bind.annotation.XmlElement; -import javax.xml.bind.annotation.XmlType; - - -/** - *

Java class for CustomHTTPHeaderDataList complex type. - * - *

The following schema fragment specifies the expected content contained within this class. - * - *

- * <complexType name="CustomHTTPHeaderDataList">
- *   <complexContent>
- *     <restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
- *       <sequence>
- *         <element name="CustomHTTPHeaderData" type="{http://schema.ultraservice.neustar.com/v01/}CustomHTTPHeaderDataGUID" maxOccurs="unbounded"/>
- *       </sequence>
- *     </restriction>
- *   </complexContent>
- * </complexType>
- * 
- * - * - */ -@XmlAccessorType(XmlAccessType.FIELD) -@XmlType(name = "CustomHTTPHeaderDataList", propOrder = { - "customHTTPHeaderData" -}) -public class CustomHTTPHeaderDataList { - - @XmlElement(name = "CustomHTTPHeaderData", required = true) - protected List customHTTPHeaderData; - - /** - * Gets the value of the customHTTPHeaderData property. - * - *

- * This accessor method returns a reference to the live list, - * not a snapshot. Therefore any modification you make to the - * returned list will be present inside the JAXB object. - * This is why there is not a set method for the customHTTPHeaderData property. - * - *

- * For example, to add a new item, do as follows: - *

-     *    getCustomHTTPHeaderData().add(newItem);
-     * 
- * - * - *

- * Objects of the following type(s) are allowed in the list - * {@link CustomHTTPHeaderDataGUID } - * - * - */ - public List getCustomHTTPHeaderData() { - if (customHTTPHeaderData == null) { - customHTTPHeaderData = new ArrayList(); - } - return this.customHTTPHeaderData; - } - -} diff --git a/Plugins/Mineplex.BungeeRotator/src/com/neustar/ultraservice/schema/v01/DNSProbeData.java b/Plugins/Mineplex.BungeeRotator/src/com/neustar/ultraservice/schema/v01/DNSProbeData.java deleted file mode 100644 index 400bcc0ef..000000000 --- a/Plugins/Mineplex.BungeeRotator/src/com/neustar/ultraservice/schema/v01/DNSProbeData.java +++ /dev/null @@ -1,438 +0,0 @@ - -package com.neustar.ultraservice.schema.v01; - -import javax.xml.bind.annotation.XmlAccessType; -import javax.xml.bind.annotation.XmlAccessorType; -import javax.xml.bind.annotation.XmlAttribute; -import javax.xml.bind.annotation.XmlType; - - -/** - *

Java class for DNSProbeData complex type. - * - *

The following schema fragment specifies the expected content contained within this class. - * - *

- * <complexType name="DNSProbeData">
- *   <complexContent>
- *     <restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
- *       <sequence>
- *       </sequence>
- *       <attribute name="port" type="{http://www.w3.org/2001/XMLSchema}string" />
- *       <attribute name="tcpOnly" type="{http://www.w3.org/2001/XMLSchema}string" />
- *       <attribute name="rrType" type="{http://www.w3.org/2001/XMLSchema}string" />
- *       <attribute name="nameToQuery" type="{http://www.w3.org/2001/XMLSchema}string" />
- *       <attribute name="response" type="{http://www.w3.org/2001/XMLSchema}string" />
- *       <attribute name="runtime" type="{http://www.w3.org/2001/XMLSchema}string" />
- *       <attribute name="failResponse" type="{http://www.w3.org/2001/XMLSchema}string" />
- *       <attribute name="criticalResponse" type="{http://www.w3.org/2001/XMLSchema}string" />
- *       <attribute name="warningResponse" type="{http://www.w3.org/2001/XMLSchema}string" />
- *       <attribute name="failAverageRunTime" type="{http://www.w3.org/2001/XMLSchema}string" />
- *       <attribute name="criticalAverageRunTime" type="{http://www.w3.org/2001/XMLSchema}string" />
- *       <attribute name="warningAverageRunTime" type="{http://www.w3.org/2001/XMLSchema}string" />
- *       <attribute name="failRuntime" type="{http://www.w3.org/2001/XMLSchema}string" />
- *       <attribute name="criticalRuntime" type="{http://www.w3.org/2001/XMLSchema}string" />
- *       <attribute name="warningRuntime" type="{http://www.w3.org/2001/XMLSchema}string" />
- *     </restriction>
- *   </complexContent>
- * </complexType>
- * 
- * - * - */ -@XmlAccessorType(XmlAccessType.FIELD) -@XmlType(name = "DNSProbeData") -public class DNSProbeData { - - @XmlAttribute(name = "port") - protected String port; - @XmlAttribute(name = "tcpOnly") - protected String tcpOnly; - @XmlAttribute(name = "rrType") - protected String rrType; - @XmlAttribute(name = "nameToQuery") - protected String nameToQuery; - @XmlAttribute(name = "response") - protected String response; - @XmlAttribute(name = "runtime") - protected String runtime; - @XmlAttribute(name = "failResponse") - protected String failResponse; - @XmlAttribute(name = "criticalResponse") - protected String criticalResponse; - @XmlAttribute(name = "warningResponse") - protected String warningResponse; - @XmlAttribute(name = "failAverageRunTime") - protected String failAverageRunTime; - @XmlAttribute(name = "criticalAverageRunTime") - protected String criticalAverageRunTime; - @XmlAttribute(name = "warningAverageRunTime") - protected String warningAverageRunTime; - @XmlAttribute(name = "failRuntime") - protected String failRuntime; - @XmlAttribute(name = "criticalRuntime") - protected String criticalRuntime; - @XmlAttribute(name = "warningRuntime") - protected String warningRuntime; - - /** - * Gets the value of the port property. - * - * @return - * possible object is - * {@link String } - * - */ - public String getPort() { - return port; - } - - /** - * Sets the value of the port property. - * - * @param value - * allowed object is - * {@link String } - * - */ - public void setPort(String value) { - this.port = value; - } - - /** - * Gets the value of the tcpOnly property. - * - * @return - * possible object is - * {@link String } - * - */ - public String getTcpOnly() { - return tcpOnly; - } - - /** - * Sets the value of the tcpOnly property. - * - * @param value - * allowed object is - * {@link String } - * - */ - public void setTcpOnly(String value) { - this.tcpOnly = value; - } - - /** - * Gets the value of the rrType property. - * - * @return - * possible object is - * {@link String } - * - */ - public String getRrType() { - return rrType; - } - - /** - * Sets the value of the rrType property. - * - * @param value - * allowed object is - * {@link String } - * - */ - public void setRrType(String value) { - this.rrType = value; - } - - /** - * Gets the value of the nameToQuery property. - * - * @return - * possible object is - * {@link String } - * - */ - public String getNameToQuery() { - return nameToQuery; - } - - /** - * Sets the value of the nameToQuery property. - * - * @param value - * allowed object is - * {@link String } - * - */ - public void setNameToQuery(String value) { - this.nameToQuery = value; - } - - /** - * Gets the value of the response property. - * - * @return - * possible object is - * {@link String } - * - */ - public String getResponse() { - return response; - } - - /** - * Sets the value of the response property. - * - * @param value - * allowed object is - * {@link String } - * - */ - public void setResponse(String value) { - this.response = value; - } - - /** - * Gets the value of the runtime property. - * - * @return - * possible object is - * {@link String } - * - */ - public String getRuntime() { - return runtime; - } - - /** - * Sets the value of the runtime property. - * - * @param value - * allowed object is - * {@link String } - * - */ - public void setRuntime(String value) { - this.runtime = value; - } - - /** - * Gets the value of the failResponse property. - * - * @return - * possible object is - * {@link String } - * - */ - public String getFailResponse() { - return failResponse; - } - - /** - * Sets the value of the failResponse property. - * - * @param value - * allowed object is - * {@link String } - * - */ - public void setFailResponse(String value) { - this.failResponse = value; - } - - /** - * Gets the value of the criticalResponse property. - * - * @return - * possible object is - * {@link String } - * - */ - public String getCriticalResponse() { - return criticalResponse; - } - - /** - * Sets the value of the criticalResponse property. - * - * @param value - * allowed object is - * {@link String } - * - */ - public void setCriticalResponse(String value) { - this.criticalResponse = value; - } - - /** - * Gets the value of the warningResponse property. - * - * @return - * possible object is - * {@link String } - * - */ - public String getWarningResponse() { - return warningResponse; - } - - /** - * Sets the value of the warningResponse property. - * - * @param value - * allowed object is - * {@link String } - * - */ - public void setWarningResponse(String value) { - this.warningResponse = value; - } - - /** - * Gets the value of the failAverageRunTime property. - * - * @return - * possible object is - * {@link String } - * - */ - public String getFailAverageRunTime() { - return failAverageRunTime; - } - - /** - * Sets the value of the failAverageRunTime property. - * - * @param value - * allowed object is - * {@link String } - * - */ - public void setFailAverageRunTime(String value) { - this.failAverageRunTime = value; - } - - /** - * Gets the value of the criticalAverageRunTime property. - * - * @return - * possible object is - * {@link String } - * - */ - public String getCriticalAverageRunTime() { - return criticalAverageRunTime; - } - - /** - * Sets the value of the criticalAverageRunTime property. - * - * @param value - * allowed object is - * {@link String } - * - */ - public void setCriticalAverageRunTime(String value) { - this.criticalAverageRunTime = value; - } - - /** - * Gets the value of the warningAverageRunTime property. - * - * @return - * possible object is - * {@link String } - * - */ - public String getWarningAverageRunTime() { - return warningAverageRunTime; - } - - /** - * Sets the value of the warningAverageRunTime property. - * - * @param value - * allowed object is - * {@link String } - * - */ - public void setWarningAverageRunTime(String value) { - this.warningAverageRunTime = value; - } - - /** - * Gets the value of the failRuntime property. - * - * @return - * possible object is - * {@link String } - * - */ - public String getFailRuntime() { - return failRuntime; - } - - /** - * Sets the value of the failRuntime property. - * - * @param value - * allowed object is - * {@link String } - * - */ - public void setFailRuntime(String value) { - this.failRuntime = value; - } - - /** - * Gets the value of the criticalRuntime property. - * - * @return - * possible object is - * {@link String } - * - */ - public String getCriticalRuntime() { - return criticalRuntime; - } - - /** - * Sets the value of the criticalRuntime property. - * - * @param value - * allowed object is - * {@link String } - * - */ - public void setCriticalRuntime(String value) { - this.criticalRuntime = value; - } - - /** - * Gets the value of the warningRuntime property. - * - * @return - * possible object is - * {@link String } - * - */ - public String getWarningRuntime() { - return warningRuntime; - } - - /** - * Sets the value of the warningRuntime property. - * - * @param value - * allowed object is - * {@link String } - * - */ - public void setWarningRuntime(String value) { - this.warningRuntime = value; - } - -} diff --git a/Plugins/Mineplex.BungeeRotator/src/com/neustar/ultraservice/schema/v01/DNSProbeMaster.java b/Plugins/Mineplex.BungeeRotator/src/com/neustar/ultraservice/schema/v01/DNSProbeMaster.java deleted file mode 100644 index 05807a8c3..000000000 --- a/Plugins/Mineplex.BungeeRotator/src/com/neustar/ultraservice/schema/v01/DNSProbeMaster.java +++ /dev/null @@ -1,258 +0,0 @@ - -package com.neustar.ultraservice.schema.v01; - -import javax.xml.bind.annotation.XmlAccessType; -import javax.xml.bind.annotation.XmlAccessorType; -import javax.xml.bind.annotation.XmlElement; -import javax.xml.bind.annotation.XmlType; - - -/** - *

Java class for DNSProbeMaster complex type. - * - *

The following schema fragment specifies the expected content contained within this class. - * - *

- * <complexType name="DNSProbeMaster">
- *   <complexContent>
- *     <restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
- *       <sequence>
- *         <element name="DNSProbeData" type="{http://schema.ultraservice.neustar.com/v01/}DNSProbeData"/>
- *         <element name="FTPProbeData" type="{http://schema.ultraservice.neustar.com/v01/}FTPProbeData"/>
- *         <element name="HTTPProbeData" type="{http://schema.ultraservice.neustar.com/v01/}HTTPProbeData"/>
- *         <element name="PINGProbeData" type="{http://schema.ultraservice.neustar.com/v01/}PINGProbeData"/>
- *         <element name="PROXYProbeData" type="{http://schema.ultraservice.neustar.com/v01/}PROXYProbeData"/>
- *         <element name="SMTPAvailabilityProbeData" type="{http://schema.ultraservice.neustar.com/v01/}SMTPAvailabilityProbeData"/>
- *         <element name="SMTPSendMailProbeData" type="{http://schema.ultraservice.neustar.com/v01/}SMTPSendMailProbeData"/>
- *         <element name="TCPProbeData" type="{http://schema.ultraservice.neustar.com/v01/}TCPProbeData"/>
- *       </sequence>
- *     </restriction>
- *   </complexContent>
- * </complexType>
- * 
- * - * - */ -@XmlAccessorType(XmlAccessType.FIELD) -@XmlType(name = "DNSProbeMaster", propOrder = { - "dnsProbeData", - "ftpProbeData", - "httpProbeData", - "pingProbeData", - "proxyProbeData", - "smtpAvailabilityProbeData", - "smtpSendMailProbeData", - "tcpProbeData" -}) -public class DNSProbeMaster { - - @XmlElement(name = "DNSProbeData", required = true) - protected DNSProbeData dnsProbeData; - @XmlElement(name = "FTPProbeData", required = true) - protected FTPProbeData ftpProbeData; - @XmlElement(name = "HTTPProbeData", required = true) - protected HTTPProbeData httpProbeData; - @XmlElement(name = "PINGProbeData", required = true) - protected PINGProbeData pingProbeData; - @XmlElement(name = "PROXYProbeData", required = true) - protected PROXYProbeData proxyProbeData; - @XmlElement(name = "SMTPAvailabilityProbeData", required = true) - protected SMTPAvailabilityProbeData smtpAvailabilityProbeData; - @XmlElement(name = "SMTPSendMailProbeData", required = true) - protected SMTPSendMailProbeData smtpSendMailProbeData; - @XmlElement(name = "TCPProbeData", required = true) - protected TCPProbeData tcpProbeData; - - /** - * Gets the value of the dnsProbeData property. - * - * @return - * possible object is - * {@link DNSProbeData } - * - */ - public DNSProbeData getDNSProbeData() { - return dnsProbeData; - } - - /** - * Sets the value of the dnsProbeData property. - * - * @param value - * allowed object is - * {@link DNSProbeData } - * - */ - public void setDNSProbeData(DNSProbeData value) { - this.dnsProbeData = value; - } - - /** - * Gets the value of the ftpProbeData property. - * - * @return - * possible object is - * {@link FTPProbeData } - * - */ - public FTPProbeData getFTPProbeData() { - return ftpProbeData; - } - - /** - * Sets the value of the ftpProbeData property. - * - * @param value - * allowed object is - * {@link FTPProbeData } - * - */ - public void setFTPProbeData(FTPProbeData value) { - this.ftpProbeData = value; - } - - /** - * Gets the value of the httpProbeData property. - * - * @return - * possible object is - * {@link HTTPProbeData } - * - */ - public HTTPProbeData getHTTPProbeData() { - return httpProbeData; - } - - /** - * Sets the value of the httpProbeData property. - * - * @param value - * allowed object is - * {@link HTTPProbeData } - * - */ - public void setHTTPProbeData(HTTPProbeData value) { - this.httpProbeData = value; - } - - /** - * Gets the value of the pingProbeData property. - * - * @return - * possible object is - * {@link PINGProbeData } - * - */ - public PINGProbeData getPINGProbeData() { - return pingProbeData; - } - - /** - * Sets the value of the pingProbeData property. - * - * @param value - * allowed object is - * {@link PINGProbeData } - * - */ - public void setPINGProbeData(PINGProbeData value) { - this.pingProbeData = value; - } - - /** - * Gets the value of the proxyProbeData property. - * - * @return - * possible object is - * {@link PROXYProbeData } - * - */ - public PROXYProbeData getPROXYProbeData() { - return proxyProbeData; - } - - /** - * Sets the value of the proxyProbeData property. - * - * @param value - * allowed object is - * {@link PROXYProbeData } - * - */ - public void setPROXYProbeData(PROXYProbeData value) { - this.proxyProbeData = value; - } - - /** - * Gets the value of the smtpAvailabilityProbeData property. - * - * @return - * possible object is - * {@link SMTPAvailabilityProbeData } - * - */ - public SMTPAvailabilityProbeData getSMTPAvailabilityProbeData() { - return smtpAvailabilityProbeData; - } - - /** - * Sets the value of the smtpAvailabilityProbeData property. - * - * @param value - * allowed object is - * {@link SMTPAvailabilityProbeData } - * - */ - public void setSMTPAvailabilityProbeData(SMTPAvailabilityProbeData value) { - this.smtpAvailabilityProbeData = value; - } - - /** - * Gets the value of the smtpSendMailProbeData property. - * - * @return - * possible object is - * {@link SMTPSendMailProbeData } - * - */ - public SMTPSendMailProbeData getSMTPSendMailProbeData() { - return smtpSendMailProbeData; - } - - /** - * Sets the value of the smtpSendMailProbeData property. - * - * @param value - * allowed object is - * {@link SMTPSendMailProbeData } - * - */ - public void setSMTPSendMailProbeData(SMTPSendMailProbeData value) { - this.smtpSendMailProbeData = value; - } - - /** - * Gets the value of the tcpProbeData property. - * - * @return - * possible object is - * {@link TCPProbeData } - * - */ - public TCPProbeData getTCPProbeData() { - return tcpProbeData; - } - - /** - * Sets the value of the tcpProbeData property. - * - * @param value - * allowed object is - * {@link TCPProbeData } - * - */ - public void setTCPProbeData(TCPProbeData value) { - this.tcpProbeData = value; - } - -} diff --git a/Plugins/Mineplex.BungeeRotator/src/com/neustar/ultraservice/schema/v01/DNSTransaction.java b/Plugins/Mineplex.BungeeRotator/src/com/neustar/ultraservice/schema/v01/DNSTransaction.java deleted file mode 100644 index 1a7bc9dc3..000000000 --- a/Plugins/Mineplex.BungeeRotator/src/com/neustar/ultraservice/schema/v01/DNSTransaction.java +++ /dev/null @@ -1,223 +0,0 @@ - -package com.neustar.ultraservice.schema.v01; - -import javax.xml.bind.annotation.XmlAccessType; -import javax.xml.bind.annotation.XmlAccessorType; -import javax.xml.bind.annotation.XmlAttribute; -import javax.xml.bind.annotation.XmlType; - - -/** - *

Java class for DNSTransaction complex type. - * - *

The following schema fragment specifies the expected content contained within this class. - * - *

- * <complexType name="DNSTransaction">
- *   <complexContent>
- *     <restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
- *       <sequence>
- *         <element name="warningCriteria" type="{http://schema.ultraservice.neustar.com/v01/}DnsCriteria" minOccurs="0"/>
- *         <element name="criticalCriteria" type="{http://schema.ultraservice.neustar.com/v01/}DnsCriteria" minOccurs="0"/>
- *         <element name="failCriteria" type="{http://schema.ultraservice.neustar.com/v01/}DnsCriteria" minOccurs="0"/>
- *       </sequence>
- *       <attribute name="port" type="{http://www.w3.org/2001/XMLSchema}int" />
- *       <attribute name="tcp" type="{http://www.w3.org/2001/XMLSchema}boolean" />
- *       <attribute name="recordType" type="{http://schema.ultraservice.neustar.com/v01/}RecordType" />
- *       <attribute name="name" type="{http://www.w3.org/2001/XMLSchema}string" />
- *     </restriction>
- *   </complexContent>
- * </complexType>
- * 
- * - * - */ -@XmlAccessorType(XmlAccessType.FIELD) -@XmlType(name = "DNSTransaction", propOrder = { - "warningCriteria", - "criticalCriteria", - "failCriteria" -}) -public class DNSTransaction { - - protected DnsCriteria warningCriteria; - protected DnsCriteria criticalCriteria; - protected DnsCriteria failCriteria; - @XmlAttribute(name = "port") - protected Integer port; - @XmlAttribute(name = "tcp") - protected Boolean tcp; - @XmlAttribute(name = "recordType") - protected RecordType recordType; - @XmlAttribute(name = "name") - protected String name; - - /** - * Gets the value of the warningCriteria property. - * - * @return - * possible object is - * {@link DnsCriteria } - * - */ - public DnsCriteria getWarningCriteria() { - return warningCriteria; - } - - /** - * Sets the value of the warningCriteria property. - * - * @param value - * allowed object is - * {@link DnsCriteria } - * - */ - public void setWarningCriteria(DnsCriteria value) { - this.warningCriteria = value; - } - - /** - * Gets the value of the criticalCriteria property. - * - * @return - * possible object is - * {@link DnsCriteria } - * - */ - public DnsCriteria getCriticalCriteria() { - return criticalCriteria; - } - - /** - * Sets the value of the criticalCriteria property. - * - * @param value - * allowed object is - * {@link DnsCriteria } - * - */ - public void setCriticalCriteria(DnsCriteria value) { - this.criticalCriteria = value; - } - - /** - * Gets the value of the failCriteria property. - * - * @return - * possible object is - * {@link DnsCriteria } - * - */ - public DnsCriteria getFailCriteria() { - return failCriteria; - } - - /** - * Sets the value of the failCriteria property. - * - * @param value - * allowed object is - * {@link DnsCriteria } - * - */ - public void setFailCriteria(DnsCriteria value) { - this.failCriteria = value; - } - - /** - * Gets the value of the port property. - * - * @return - * possible object is - * {@link Integer } - * - */ - public Integer getPort() { - return port; - } - - /** - * Sets the value of the port property. - * - * @param value - * allowed object is - * {@link Integer } - * - */ - public void setPort(Integer value) { - this.port = value; - } - - /** - * Gets the value of the tcp property. - * - * @return - * possible object is - * {@link Boolean } - * - */ - public Boolean isTcp() { - return tcp; - } - - /** - * Sets the value of the tcp property. - * - * @param value - * allowed object is - * {@link Boolean } - * - */ - public void setTcp(Boolean value) { - this.tcp = value; - } - - /** - * Gets the value of the recordType property. - * - * @return - * possible object is - * {@link RecordType } - * - */ - public RecordType getRecordType() { - return recordType; - } - - /** - * Sets the value of the recordType property. - * - * @param value - * allowed object is - * {@link RecordType } - * - */ - public void setRecordType(RecordType value) { - this.recordType = value; - } - - /** - * Gets the value of the name property. - * - * @return - * possible object is - * {@link String } - * - */ - public String getName() { - return name; - } - - /** - * Sets the value of the name property. - * - * @param value - * allowed object is - * {@link String } - * - */ - public void setName(String value) { - this.name = value; - } - -} diff --git a/Plugins/Mineplex.BungeeRotator/src/com/neustar/ultraservice/schema/v01/DashboardRecordType.java b/Plugins/Mineplex.BungeeRotator/src/com/neustar/ultraservice/schema/v01/DashboardRecordType.java deleted file mode 100644 index b0e1f39c6..000000000 --- a/Plugins/Mineplex.BungeeRotator/src/com/neustar/ultraservice/schema/v01/DashboardRecordType.java +++ /dev/null @@ -1,60 +0,0 @@ - -package com.neustar.ultraservice.schema.v01; - -import javax.xml.bind.annotation.XmlEnum; -import javax.xml.bind.annotation.XmlEnumValue; -import javax.xml.bind.annotation.XmlType; - - -/** - *

Java class for DashboardRecordType. - * - *

The following schema fragment specifies the expected content contained within this class. - *

- *

- * <simpleType name="DashboardRecordType">
- *   <restriction base="{http://www.w3.org/2001/XMLSchema}string">
- *     <enumeration value="Recent Activity"/>
- *     <enumeration value="Alerts"/>
- *     <enumeration value="My Reports"/>
- *     <enumeration value="News"/>
- *     <enumeration value="Open Service Requests"/>
- *   </restriction>
- * </simpleType>
- * 
- * - */ -@XmlType(name = "DashboardRecordType") -@XmlEnum -public enum DashboardRecordType { - - @XmlEnumValue("Recent Activity") - RECENT_ACTIVITY("Recent Activity"), - @XmlEnumValue("Alerts") - ALERTS("Alerts"), - @XmlEnumValue("My Reports") - MY_REPORTS("My Reports"), - @XmlEnumValue("News") - NEWS("News"), - @XmlEnumValue("Open Service Requests") - OPEN_SERVICE_REQUESTS("Open Service Requests"); - private final String value; - - DashboardRecordType(String v) { - value = v; - } - - public String value() { - return value; - } - - public static DashboardRecordType fromValue(String v) { - for (DashboardRecordType c: DashboardRecordType.values()) { - if (c.value.equals(v)) { - return c; - } - } - throw new IllegalArgumentException(v); - } - -} diff --git a/Plugins/Mineplex.BungeeRotator/src/com/neustar/ultraservice/schema/v01/DashboardTypeOrderInfo.java b/Plugins/Mineplex.BungeeRotator/src/com/neustar/ultraservice/schema/v01/DashboardTypeOrderInfo.java deleted file mode 100644 index 5e4a8e380..000000000 --- a/Plugins/Mineplex.BungeeRotator/src/com/neustar/ultraservice/schema/v01/DashboardTypeOrderInfo.java +++ /dev/null @@ -1,79 +0,0 @@ - -package com.neustar.ultraservice.schema.v01; - -import javax.xml.bind.annotation.XmlAccessType; -import javax.xml.bind.annotation.XmlAccessorType; -import javax.xml.bind.annotation.XmlAttribute; -import javax.xml.bind.annotation.XmlType; - - -/** - *

Java class for DashboardTypeOrderInfo complex type. - * - *

The following schema fragment specifies the expected content contained within this class. - * - *

- * <complexType name="DashboardTypeOrderInfo">
- *   <complexContent>
- *     <restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
- *       <sequence>
- *       </sequence>
- *       <attribute name="orderNumber" use="required" type="{http://www.w3.org/2001/XMLSchema}int" />
- *       <attribute name="recordType" use="required" type="{http://schema.ultraservice.neustar.com/v01/}DashboardRecordType" />
- *     </restriction>
- *   </complexContent>
- * </complexType>
- * 
- * - * - */ -@XmlAccessorType(XmlAccessType.FIELD) -@XmlType(name = "DashboardTypeOrderInfo") -public class DashboardTypeOrderInfo { - - @XmlAttribute(name = "orderNumber", required = true) - protected int orderNumber; - @XmlAttribute(name = "recordType", required = true) - protected DashboardRecordType recordType; - - /** - * Gets the value of the orderNumber property. - * - */ - public int getOrderNumber() { - return orderNumber; - } - - /** - * Sets the value of the orderNumber property. - * - */ - public void setOrderNumber(int value) { - this.orderNumber = value; - } - - /** - * Gets the value of the recordType property. - * - * @return - * possible object is - * {@link DashboardRecordType } - * - */ - public DashboardRecordType getRecordType() { - return recordType; - } - - /** - * Sets the value of the recordType property. - * - * @param value - * allowed object is - * {@link DashboardRecordType } - * - */ - public void setRecordType(DashboardRecordType value) { - this.recordType = value; - } - -} diff --git a/Plugins/Mineplex.BungeeRotator/src/com/neustar/ultraservice/schema/v01/DashboardTypeOrderInfoList.java b/Plugins/Mineplex.BungeeRotator/src/com/neustar/ultraservice/schema/v01/DashboardTypeOrderInfoList.java deleted file mode 100644 index a5df30616..000000000 --- a/Plugins/Mineplex.BungeeRotator/src/com/neustar/ultraservice/schema/v01/DashboardTypeOrderInfoList.java +++ /dev/null @@ -1,69 +0,0 @@ - -package com.neustar.ultraservice.schema.v01; - -import java.util.ArrayList; -import java.util.List; -import javax.xml.bind.annotation.XmlAccessType; -import javax.xml.bind.annotation.XmlAccessorType; -import javax.xml.bind.annotation.XmlElement; -import javax.xml.bind.annotation.XmlType; - - -/** - *

Java class for DashboardTypeOrderInfoList complex type. - * - *

The following schema fragment specifies the expected content contained within this class. - * - *

- * <complexType name="DashboardTypeOrderInfoList">
- *   <complexContent>
- *     <restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
- *       <sequence>
- *         <element name="DashboardTypeOrderInfo" type="{http://schema.ultraservice.neustar.com/v01/}DashboardTypeOrderInfo" maxOccurs="unbounded"/>
- *       </sequence>
- *     </restriction>
- *   </complexContent>
- * </complexType>
- * 
- * - * - */ -@XmlAccessorType(XmlAccessType.FIELD) -@XmlType(name = "DashboardTypeOrderInfoList", propOrder = { - "dashboardTypeOrderInfo" -}) -public class DashboardTypeOrderInfoList { - - @XmlElement(name = "DashboardTypeOrderInfo", required = true) - protected List dashboardTypeOrderInfo; - - /** - * Gets the value of the dashboardTypeOrderInfo property. - * - *

- * This accessor method returns a reference to the live list, - * not a snapshot. Therefore any modification you make to the - * returned list will be present inside the JAXB object. - * This is why there is not a set method for the dashboardTypeOrderInfo property. - * - *

- * For example, to add a new item, do as follows: - *

-     *    getDashboardTypeOrderInfo().add(newItem);
-     * 
- * - * - *

- * Objects of the following type(s) are allowed in the list - * {@link DashboardTypeOrderInfo } - * - * - */ - public List getDashboardTypeOrderInfo() { - if (dashboardTypeOrderInfo == null) { - dashboardTypeOrderInfo = new ArrayList(); - } - return this.dashboardTypeOrderInfo; - } - -} diff --git a/Plugins/Mineplex.BungeeRotator/src/com/neustar/ultraservice/schema/v01/DateFormat.java b/Plugins/Mineplex.BungeeRotator/src/com/neustar/ultraservice/schema/v01/DateFormat.java deleted file mode 100644 index 70570e225..000000000 --- a/Plugins/Mineplex.BungeeRotator/src/com/neustar/ultraservice/schema/v01/DateFormat.java +++ /dev/null @@ -1,63 +0,0 @@ - -package com.neustar.ultraservice.schema.v01; - -import javax.xml.bind.annotation.XmlEnum; -import javax.xml.bind.annotation.XmlEnumValue; -import javax.xml.bind.annotation.XmlType; - - -/** - *

Java class for DateFormat. - * - *

The following schema fragment specifies the expected content contained within this class. - *

- *

- * <simpleType name="DateFormat">
- *   <restriction base="{http://www.w3.org/2001/XMLSchema}string">
- *     <enumeration value="MM/DD/YYYY"/>
- *     <enumeration value="MM/DD/YY"/>
- *     <enumeration value="DD/MM/YYYY"/>
- *     <enumeration value="DD/MM/YY"/>
- *     <enumeration value="YYYY/MM/DD"/>
- *     <enumeration value="YY/MM/DD"/>
- *   </restriction>
- * </simpleType>
- * 
- * - */ -@XmlType(name = "DateFormat") -@XmlEnum -public enum DateFormat { - - @XmlEnumValue("MM/DD/YYYY") - MM_DD_YYYY("MM/DD/YYYY"), - @XmlEnumValue("MM/DD/YY") - MM_DD_YY("MM/DD/YY"), - @XmlEnumValue("DD/MM/YYYY") - DD_MM_YYYY("DD/MM/YYYY"), - @XmlEnumValue("DD/MM/YY") - DD_MM_YY("DD/MM/YY"), - @XmlEnumValue("YYYY/MM/DD") - YYYY_MM_DD("YYYY/MM/DD"), - @XmlEnumValue("YY/MM/DD") - YY_MM_DD("YY/MM/DD"); - private final String value; - - DateFormat(String v) { - value = v; - } - - public String value() { - return value; - } - - public static DateFormat fromValue(String v) { - for (DateFormat c: DateFormat.values()) { - if (c.value.equals(v)) { - return c; - } - } - throw new IllegalArgumentException(v); - } - -} diff --git a/Plugins/Mineplex.BungeeRotator/src/com/neustar/ultraservice/schema/v01/DefaultAccountPreference.java b/Plugins/Mineplex.BungeeRotator/src/com/neustar/ultraservice/schema/v01/DefaultAccountPreference.java deleted file mode 100644 index 778bdb911..000000000 --- a/Plugins/Mineplex.BungeeRotator/src/com/neustar/ultraservice/schema/v01/DefaultAccountPreference.java +++ /dev/null @@ -1,87 +0,0 @@ - -package com.neustar.ultraservice.schema.v01; - -import javax.xml.bind.annotation.XmlAccessType; -import javax.xml.bind.annotation.XmlAccessorType; -import javax.xml.bind.annotation.XmlAttribute; -import javax.xml.bind.annotation.XmlType; - - -/** - *

Java class for DefaultAccountPreference complex type. - * - *

The following schema fragment specifies the expected content contained within this class. - * - *

- * <complexType name="DefaultAccountPreference">
- *   <complexContent>
- *     <restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
- *       <sequence>
- *       </sequence>
- *       <attribute name="defaultAccount" type="{http://www.w3.org/2001/XMLSchema}string" />
- *       <attribute name="isDefault" type="{http://www.w3.org/2001/XMLSchema}boolean" />
- *     </restriction>
- *   </complexContent>
- * </complexType>
- * 
- * - * - */ -@XmlAccessorType(XmlAccessType.FIELD) -@XmlType(name = "DefaultAccountPreference") -public class DefaultAccountPreference { - - @XmlAttribute(name = "defaultAccount") - protected String defaultAccount; - @XmlAttribute(name = "isDefault") - protected Boolean isDefault; - - /** - * Gets the value of the defaultAccount property. - * - * @return - * possible object is - * {@link String } - * - */ - public String getDefaultAccount() { - return defaultAccount; - } - - /** - * Sets the value of the defaultAccount property. - * - * @param value - * allowed object is - * {@link String } - * - */ - public void setDefaultAccount(String value) { - this.defaultAccount = value; - } - - /** - * Gets the value of the isDefault property. - * - * @return - * possible object is - * {@link Boolean } - * - */ - public Boolean isIsDefault() { - return isDefault; - } - - /** - * Sets the value of the isDefault property. - * - * @param value - * allowed object is - * {@link Boolean } - * - */ - public void setIsDefault(Boolean value) { - this.isDefault = value; - } - -} diff --git a/Plugins/Mineplex.BungeeRotator/src/com/neustar/ultraservice/schema/v01/DefaultDateAndTimePreference.java b/Plugins/Mineplex.BungeeRotator/src/com/neustar/ultraservice/schema/v01/DefaultDateAndTimePreference.java deleted file mode 100644 index f4657d7b1..000000000 --- a/Plugins/Mineplex.BungeeRotator/src/com/neustar/ultraservice/schema/v01/DefaultDateAndTimePreference.java +++ /dev/null @@ -1,168 +0,0 @@ - -package com.neustar.ultraservice.schema.v01; - -import javax.xml.bind.annotation.XmlAccessType; -import javax.xml.bind.annotation.XmlAccessorType; -import javax.xml.bind.annotation.XmlAttribute; -import javax.xml.bind.annotation.XmlType; - - -/** - *

Java class for DefaultDateAndTimePreference complex type. - * - *

The following schema fragment specifies the expected content contained within this class. - * - *

- * <complexType name="DefaultDateAndTimePreference">
- *   <complexContent>
- *     <restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
- *       <sequence>
- *       </sequence>
- *       <attribute name="TimeZone" type="{http://schema.ultraservice.neustar.com/v01/}TimeZone" />
- *       <attribute name="DateFormat" type="{http://schema.ultraservice.neustar.com/v01/}DateFormat" />
- *       <attribute name="TimeFormat" type="{http://www.w3.org/2001/XMLSchema}string" />
- *       <attribute name="TTLFormat" type="{http://schema.ultraservice.neustar.com/v01/}TTLFormat" />
- *       <attribute name="isDefault" type="{http://www.w3.org/2001/XMLSchema}boolean" />
- *     </restriction>
- *   </complexContent>
- * </complexType>
- * 
- * - * - */ -@XmlAccessorType(XmlAccessType.FIELD) -@XmlType(name = "DefaultDateAndTimePreference") -public class DefaultDateAndTimePreference { - - @XmlAttribute(name = "TimeZone") - protected TimeZone timeZone; - @XmlAttribute(name = "DateFormat") - protected DateFormat dateFormat; - @XmlAttribute(name = "TimeFormat") - protected String timeFormat; - @XmlAttribute(name = "TTLFormat") - protected String ttlFormat; - @XmlAttribute(name = "isDefault") - protected Boolean isDefault; - - /** - * Gets the value of the timeZone property. - * - * @return - * possible object is - * {@link TimeZone } - * - */ - public TimeZone getTimeZone() { - return timeZone; - } - - /** - * Sets the value of the timeZone property. - * - * @param value - * allowed object is - * {@link TimeZone } - * - */ - public void setTimeZone(TimeZone value) { - this.timeZone = value; - } - - /** - * Gets the value of the dateFormat property. - * - * @return - * possible object is - * {@link DateFormat } - * - */ - public DateFormat getDateFormat() { - return dateFormat; - } - - /** - * Sets the value of the dateFormat property. - * - * @param value - * allowed object is - * {@link DateFormat } - * - */ - public void setDateFormat(DateFormat value) { - this.dateFormat = value; - } - - /** - * Gets the value of the timeFormat property. - * - * @return - * possible object is - * {@link String } - * - */ - public String getTimeFormat() { - return timeFormat; - } - - /** - * Sets the value of the timeFormat property. - * - * @param value - * allowed object is - * {@link String } - * - */ - public void setTimeFormat(String value) { - this.timeFormat = value; - } - - /** - * Gets the value of the ttlFormat property. - * - * @return - * possible object is - * {@link String } - * - */ - public String getTTLFormat() { - return ttlFormat; - } - - /** - * Sets the value of the ttlFormat property. - * - * @param value - * allowed object is - * {@link String } - * - */ - public void setTTLFormat(String value) { - this.ttlFormat = value; - } - - /** - * Gets the value of the isDefault property. - * - * @return - * possible object is - * {@link Boolean } - * - */ - public Boolean isIsDefault() { - return isDefault; - } - - /** - * Sets the value of the isDefault property. - * - * @param value - * allowed object is - * {@link Boolean } - * - */ - public void setIsDefault(Boolean value) { - this.isDefault = value; - } - -} diff --git a/Plugins/Mineplex.BungeeRotator/src/com/neustar/ultraservice/schema/v01/DefaultNumberOfrecordsPreference.java b/Plugins/Mineplex.BungeeRotator/src/com/neustar/ultraservice/schema/v01/DefaultNumberOfrecordsPreference.java deleted file mode 100644 index 364372d19..000000000 --- a/Plugins/Mineplex.BungeeRotator/src/com/neustar/ultraservice/schema/v01/DefaultNumberOfrecordsPreference.java +++ /dev/null @@ -1,114 +0,0 @@ - -package com.neustar.ultraservice.schema.v01; - -import javax.xml.bind.annotation.XmlAccessType; -import javax.xml.bind.annotation.XmlAccessorType; -import javax.xml.bind.annotation.XmlAttribute; -import javax.xml.bind.annotation.XmlType; - - -/** - *

Java class for DefaultNumberOfrecordsPreference complex type. - * - *

The following schema fragment specifies the expected content contained within this class. - * - *

- * <complexType name="DefaultNumberOfrecordsPreference">
- *   <complexContent>
- *     <restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
- *       <sequence>
- *       </sequence>
- *       <attribute name="LargeTable" type="{http://www.w3.org/2001/XMLSchema}string" />
- *       <attribute name="SmallTable" type="{http://www.w3.org/2001/XMLSchema}string" />
- *       <attribute name="isDefault" type="{http://www.w3.org/2001/XMLSchema}boolean" />
- *     </restriction>
- *   </complexContent>
- * </complexType>
- * 
- * - * - */ -@XmlAccessorType(XmlAccessType.FIELD) -@XmlType(name = "DefaultNumberOfrecordsPreference") -public class DefaultNumberOfrecordsPreference { - - @XmlAttribute(name = "LargeTable") - protected String largeTable; - @XmlAttribute(name = "SmallTable") - protected String smallTable; - @XmlAttribute(name = "isDefault") - protected Boolean isDefault; - - /** - * Gets the value of the largeTable property. - * - * @return - * possible object is - * {@link String } - * - */ - public String getLargeTable() { - return largeTable; - } - - /** - * Sets the value of the largeTable property. - * - * @param value - * allowed object is - * {@link String } - * - */ - public void setLargeTable(String value) { - this.largeTable = value; - } - - /** - * Gets the value of the smallTable property. - * - * @return - * possible object is - * {@link String } - * - */ - public String getSmallTable() { - return smallTable; - } - - /** - * Sets the value of the smallTable property. - * - * @param value - * allowed object is - * {@link String } - * - */ - public void setSmallTable(String value) { - this.smallTable = value; - } - - /** - * Gets the value of the isDefault property. - * - * @return - * possible object is - * {@link Boolean } - * - */ - public Boolean isIsDefault() { - return isDefault; - } - - /** - * Sets the value of the isDefault property. - * - * @param value - * allowed object is - * {@link Boolean } - * - */ - public void setIsDefault(Boolean value) { - this.isDefault = value; - } - -} diff --git a/Plugins/Mineplex.BungeeRotator/src/com/neustar/ultraservice/schema/v01/DefaultReportPrefPreference.java b/Plugins/Mineplex.BungeeRotator/src/com/neustar/ultraservice/schema/v01/DefaultReportPrefPreference.java deleted file mode 100644 index 0a66d9b37..000000000 --- a/Plugins/Mineplex.BungeeRotator/src/com/neustar/ultraservice/schema/v01/DefaultReportPrefPreference.java +++ /dev/null @@ -1,114 +0,0 @@ - -package com.neustar.ultraservice.schema.v01; - -import javax.xml.bind.annotation.XmlAccessType; -import javax.xml.bind.annotation.XmlAccessorType; -import javax.xml.bind.annotation.XmlAttribute; -import javax.xml.bind.annotation.XmlType; - - -/** - *

Java class for DefaultReportPrefPreference complex type. - * - *

The following schema fragment specifies the expected content contained within this class. - * - *

- * <complexType name="DefaultReportPrefPreference">
- *   <complexContent>
- *     <restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
- *       <sequence>
- *       </sequence>
- *       <attribute name="ReportType" type="{http://schema.ultraservice.neustar.com/v01/}reportType" />
- *       <attribute name="GraphType" type="{http://schema.ultraservice.neustar.com/v01/}graphType" />
- *       <attribute name="isDefault" type="{http://www.w3.org/2001/XMLSchema}boolean" />
- *     </restriction>
- *   </complexContent>
- * </complexType>
- * 
- * - * - */ -@XmlAccessorType(XmlAccessType.FIELD) -@XmlType(name = "DefaultReportPrefPreference") -public class DefaultReportPrefPreference { - - @XmlAttribute(name = "ReportType") - protected ReportType reportType; - @XmlAttribute(name = "GraphType") - protected GraphType graphType; - @XmlAttribute(name = "isDefault") - protected Boolean isDefault; - - /** - * Gets the value of the reportType property. - * - * @return - * possible object is - * {@link ReportType } - * - */ - public ReportType getReportType() { - return reportType; - } - - /** - * Sets the value of the reportType property. - * - * @param value - * allowed object is - * {@link ReportType } - * - */ - public void setReportType(ReportType value) { - this.reportType = value; - } - - /** - * Gets the value of the graphType property. - * - * @return - * possible object is - * {@link GraphType } - * - */ - public GraphType getGraphType() { - return graphType; - } - - /** - * Sets the value of the graphType property. - * - * @param value - * allowed object is - * {@link GraphType } - * - */ - public void setGraphType(GraphType value) { - this.graphType = value; - } - - /** - * Gets the value of the isDefault property. - * - * @return - * possible object is - * {@link Boolean } - * - */ - public Boolean isIsDefault() { - return isDefault; - } - - /** - * Sets the value of the isDefault property. - * - * @param value - * allowed object is - * {@link Boolean } - * - */ - public void setIsDefault(Boolean value) { - this.isDefault = value; - } - -} diff --git a/Plugins/Mineplex.BungeeRotator/src/com/neustar/ultraservice/schema/v01/DeleteConfirmPreference.java b/Plugins/Mineplex.BungeeRotator/src/com/neustar/ultraservice/schema/v01/DeleteConfirmPreference.java deleted file mode 100644 index a8f3eeaee..000000000 --- a/Plugins/Mineplex.BungeeRotator/src/com/neustar/ultraservice/schema/v01/DeleteConfirmPreference.java +++ /dev/null @@ -1,87 +0,0 @@ - -package com.neustar.ultraservice.schema.v01; - -import javax.xml.bind.annotation.XmlAccessType; -import javax.xml.bind.annotation.XmlAccessorType; -import javax.xml.bind.annotation.XmlAttribute; -import javax.xml.bind.annotation.XmlType; - - -/** - *

Java class for DeleteConfirmPreference complex type. - * - *

The following schema fragment specifies the expected content contained within this class. - * - *

- * <complexType name="DeleteConfirmPreference">
- *   <complexContent>
- *     <restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
- *       <sequence>
- *       </sequence>
- *       <attribute name="DeleteConfirmation" type="{http://www.w3.org/2001/XMLSchema}string" />
- *       <attribute name="isDefault" type="{http://www.w3.org/2001/XMLSchema}boolean" />
- *     </restriction>
- *   </complexContent>
- * </complexType>
- * 
- * - * - */ -@XmlAccessorType(XmlAccessType.FIELD) -@XmlType(name = "DeleteConfirmPreference") -public class DeleteConfirmPreference { - - @XmlAttribute(name = "DeleteConfirmation") - protected String deleteConfirmation; - @XmlAttribute(name = "isDefault") - protected Boolean isDefault; - - /** - * Gets the value of the deleteConfirmation property. - * - * @return - * possible object is - * {@link String } - * - */ - public String getDeleteConfirmation() { - return deleteConfirmation; - } - - /** - * Sets the value of the deleteConfirmation property. - * - * @param value - * allowed object is - * {@link String } - * - */ - public void setDeleteConfirmation(String value) { - this.deleteConfirmation = value; - } - - /** - * Gets the value of the isDefault property. - * - * @return - * possible object is - * {@link Boolean } - * - */ - public Boolean isIsDefault() { - return isDefault; - } - - /** - * Sets the value of the isDefault property. - * - * @param value - * allowed object is - * {@link Boolean } - * - */ - public void setIsDefault(Boolean value) { - this.isDefault = value; - } - -} diff --git a/Plugins/Mineplex.BungeeRotator/src/com/neustar/ultraservice/schema/v01/DirPoolRecordType.java b/Plugins/Mineplex.BungeeRotator/src/com/neustar/ultraservice/schema/v01/DirPoolRecordType.java deleted file mode 100644 index 20172a1ac..000000000 --- a/Plugins/Mineplex.BungeeRotator/src/com/neustar/ultraservice/schema/v01/DirPoolRecordType.java +++ /dev/null @@ -1,56 +0,0 @@ - -package com.neustar.ultraservice.schema.v01; - -import javax.xml.bind.annotation.XmlEnum; -import javax.xml.bind.annotation.XmlType; - - -/** - *

Java class for DirPoolRecordType. - * - *

The following schema fragment specifies the expected content contained within this class. - *

- *

- * <simpleType name="DirPoolRecordType">
- *   <restriction base="{http://www.w3.org/2001/XMLSchema}string">
- *     <enumeration value="A"/>
- *     <enumeration value="AAAA"/>
- *     <enumeration value="TXT"/>
- *     <enumeration value="SRV"/>
- *     <enumeration value="PTR"/>
- *     <enumeration value="HINFO"/>
- *     <enumeration value="RP"/>
- *     <enumeration value="NAPTR"/>
- *     <enumeration value="MX"/>
- *     <enumeration value="CNAME"/>
- *     <enumeration value="SPF"/>
- *   </restriction>
- * </simpleType>
- * 
- * - */ -@XmlType(name = "DirPoolRecordType") -@XmlEnum -public enum DirPoolRecordType { - - A, - AAAA, - TXT, - SRV, - PTR, - HINFO, - RP, - NAPTR, - MX, - CNAME, - SPF; - - public String value() { - return name(); - } - - public static DirPoolRecordType fromValue(String v) { - return valueOf(v); - } - -} diff --git a/Plugins/Mineplex.BungeeRotator/src/com/neustar/ultraservice/schema/v01/DirPoolType.java b/Plugins/Mineplex.BungeeRotator/src/com/neustar/ultraservice/schema/v01/DirPoolType.java deleted file mode 100644 index 0fed11665..000000000 --- a/Plugins/Mineplex.BungeeRotator/src/com/neustar/ultraservice/schema/v01/DirPoolType.java +++ /dev/null @@ -1,40 +0,0 @@ - -package com.neustar.ultraservice.schema.v01; - -import javax.xml.bind.annotation.XmlEnum; -import javax.xml.bind.annotation.XmlType; - - -/** - *

Java class for DirPoolType. - * - *

The following schema fragment specifies the expected content contained within this class. - *

- *

- * <simpleType name="DirPoolType">
- *   <restriction base="{http://www.w3.org/2001/XMLSchema}string">
- *     <enumeration value="GEOLOCATION"/>
- *     <enumeration value="SOURCEIP"/>
- *     <enumeration value="MIXED"/>
- *   </restriction>
- * </simpleType>
- * 
- * - */ -@XmlType(name = "DirPoolType") -@XmlEnum -public enum DirPoolType { - - GEOLOCATION, - SOURCEIP, - MIXED; - - public String value() { - return name(); - } - - public static DirPoolType fromValue(String v) { - return valueOf(v); - } - -} diff --git a/Plugins/Mineplex.BungeeRotator/src/com/neustar/ultraservice/schema/v01/DirectionalDNSGroupDetail.java b/Plugins/Mineplex.BungeeRotator/src/com/neustar/ultraservice/schema/v01/DirectionalDNSGroupDetail.java deleted file mode 100644 index c7ae7f5fe..000000000 --- a/Plugins/Mineplex.BungeeRotator/src/com/neustar/ultraservice/schema/v01/DirectionalDNSGroupDetail.java +++ /dev/null @@ -1,150 +0,0 @@ - -package com.neustar.ultraservice.schema.v01; - -import javax.xml.bind.annotation.XmlAccessType; -import javax.xml.bind.annotation.XmlAccessorType; -import javax.xml.bind.annotation.XmlAttribute; -import javax.xml.bind.annotation.XmlElement; -import javax.xml.bind.annotation.XmlSeeAlso; -import javax.xml.bind.annotation.XmlType; - - -/** - *

Java class for DirectionalDNSGroupDetail complex type. - * - *

The following schema fragment specifies the expected content contained within this class. - * - *

- * <complexType name="DirectionalDNSGroupDetail">
- *   <complexContent>
- *     <restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
- *       <sequence>
- *         <element name="DirectionalDNSRegion" type="{http://schema.ultraservice.neustar.com/v01/}RegionForNewGroupsList"/>
- *         <element name="DirectionalDNSSourceIPList" type="{http://schema.ultraservice.neustar.com/v01/}SourceIpGroupDefinitionList"/>
- *       </sequence>
- *       <attribute name="GroupName" use="required" type="{http://www.w3.org/2001/XMLSchema}string" />
- *       <attribute name="Description" type="{http://www.w3.org/2001/XMLSchema}string" />
- *     </restriction>
- *   </complexContent>
- * </complexType>
- * 
- * - * - */ -@XmlAccessorType(XmlAccessType.FIELD) -@XmlType(name = "DirectionalDNSGroupDetail", propOrder = { - "directionalDNSRegion", - "directionalDNSSourceIPList" -}) -@XmlSeeAlso({ - GlobalDirectionalGroupUpdateDetails.class, - GlobalDirectionalGroupDetails.class -}) -public class DirectionalDNSGroupDetail { - - @XmlElement(name = "DirectionalDNSRegion", required = true) - protected RegionForNewGroupsList directionalDNSRegion; - @XmlElement(name = "DirectionalDNSSourceIPList", required = true) - protected SourceIpGroupDefinitionList directionalDNSSourceIPList; - @XmlAttribute(name = "GroupName", required = true) - protected String groupName; - @XmlAttribute(name = "Description") - protected String description; - - /** - * Gets the value of the directionalDNSRegion property. - * - * @return - * possible object is - * {@link RegionForNewGroupsList } - * - */ - public RegionForNewGroupsList getDirectionalDNSRegion() { - return directionalDNSRegion; - } - - /** - * Sets the value of the directionalDNSRegion property. - * - * @param value - * allowed object is - * {@link RegionForNewGroupsList } - * - */ - public void setDirectionalDNSRegion(RegionForNewGroupsList value) { - this.directionalDNSRegion = value; - } - - /** - * Gets the value of the directionalDNSSourceIPList property. - * - * @return - * possible object is - * {@link SourceIpGroupDefinitionList } - * - */ - public SourceIpGroupDefinitionList getDirectionalDNSSourceIPList() { - return directionalDNSSourceIPList; - } - - /** - * Sets the value of the directionalDNSSourceIPList property. - * - * @param value - * allowed object is - * {@link SourceIpGroupDefinitionList } - * - */ - public void setDirectionalDNSSourceIPList(SourceIpGroupDefinitionList value) { - this.directionalDNSSourceIPList = value; - } - - /** - * Gets the value of the groupName property. - * - * @return - * possible object is - * {@link String } - * - */ - public String getGroupName() { - return groupName; - } - - /** - * Sets the value of the groupName property. - * - * @param value - * allowed object is - * {@link String } - * - */ - public void setGroupName(String value) { - this.groupName = value; - } - - /** - * Gets the value of the description property. - * - * @return - * possible object is - * {@link String } - * - */ - public String getDescription() { - return description; - } - - /** - * Sets the value of the description property. - * - * @param value - * allowed object is - * {@link String } - * - */ - public void setDescription(String value) { - this.description = value; - } - -} diff --git a/Plugins/Mineplex.BungeeRotator/src/com/neustar/ultraservice/schema/v01/DirectionalDNSRecord.java b/Plugins/Mineplex.BungeeRotator/src/com/neustar/ultraservice/schema/v01/DirectionalDNSRecord.java deleted file mode 100644 index 686ae49a3..000000000 --- a/Plugins/Mineplex.BungeeRotator/src/com/neustar/ultraservice/schema/v01/DirectionalDNSRecord.java +++ /dev/null @@ -1,136 +0,0 @@ - -package com.neustar.ultraservice.schema.v01; - -import javax.xml.bind.annotation.XmlAccessType; -import javax.xml.bind.annotation.XmlAccessorType; -import javax.xml.bind.annotation.XmlAttribute; -import javax.xml.bind.annotation.XmlElement; -import javax.xml.bind.annotation.XmlType; - - -/** - *

Java class for DirectionalDNSRecord complex type. - * - *

The following schema fragment specifies the expected content contained within this class. - * - *

- * <complexType name="DirectionalDNSRecord">
- *   <complexContent>
- *     <restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
- *       <sequence>
- *         <element name="InfoValues" type="{http://schema.ultraservice.neustar.com/v01/}InfoValues"/>
- *       </sequence>
- *       <attribute name="recordType" use="required" type="{http://schema.ultraservice.neustar.com/v01/}DirPoolRecordType" />
- *       <attribute name="TTL" type="{http://www.w3.org/2001/XMLSchema}string" />
- *       <attribute name="noResponseRecord" use="required" type="{http://www.w3.org/2001/XMLSchema}boolean" />
- *     </restriction>
- *   </complexContent>
- * </complexType>
- * 
- * - * - */ -@XmlAccessorType(XmlAccessType.FIELD) -@XmlType(name = "DirectionalDNSRecord", propOrder = { - "infoValues" -}) -public class DirectionalDNSRecord { - - @XmlElement(name = "InfoValues", required = true) - protected InfoValues infoValues; - @XmlAttribute(name = "recordType", required = true) - protected DirPoolRecordType recordType; - @XmlAttribute(name = "TTL") - protected String ttl; - @XmlAttribute(name = "noResponseRecord", required = true) - protected boolean noResponseRecord; - - /** - * Gets the value of the infoValues property. - * - * @return - * possible object is - * {@link InfoValues } - * - */ - public InfoValues getInfoValues() { - return infoValues; - } - - /** - * Sets the value of the infoValues property. - * - * @param value - * allowed object is - * {@link InfoValues } - * - */ - public void setInfoValues(InfoValues value) { - this.infoValues = value; - } - - /** - * Gets the value of the recordType property. - * - * @return - * possible object is - * {@link DirPoolRecordType } - * - */ - public DirPoolRecordType getRecordType() { - return recordType; - } - - /** - * Sets the value of the recordType property. - * - * @param value - * allowed object is - * {@link DirPoolRecordType } - * - */ - public void setRecordType(DirPoolRecordType value) { - this.recordType = value; - } - - /** - * Gets the value of the ttl property. - * - * @return - * possible object is - * {@link String } - * - */ - public String getTTL() { - return ttl; - } - - /** - * Sets the value of the ttl property. - * - * @param value - * allowed object is - * {@link String } - * - */ - public void setTTL(String value) { - this.ttl = value; - } - - /** - * Gets the value of the noResponseRecord property. - * - */ - public boolean isNoResponseRecord() { - return noResponseRecord; - } - - /** - * Sets the value of the noResponseRecord property. - * - */ - public void setNoResponseRecord(boolean value) { - this.noResponseRecord = value; - } - -} diff --git a/Plugins/Mineplex.BungeeRotator/src/com/neustar/ultraservice/schema/v01/DirectionalDNSRecordDetail.java b/Plugins/Mineplex.BungeeRotator/src/com/neustar/ultraservice/schema/v01/DirectionalDNSRecordDetail.java deleted file mode 100644 index f5772ba56..000000000 --- a/Plugins/Mineplex.BungeeRotator/src/com/neustar/ultraservice/schema/v01/DirectionalDNSRecordDetail.java +++ /dev/null @@ -1,414 +0,0 @@ - -package com.neustar.ultraservice.schema.v01; - -import javax.xml.bind.annotation.XmlAccessType; -import javax.xml.bind.annotation.XmlAccessorType; -import javax.xml.bind.annotation.XmlAttribute; -import javax.xml.bind.annotation.XmlElement; -import javax.xml.bind.annotation.XmlType; - - -/** - *

Java class for DirectionalDNSRecordDetail complex type. - * - *

The following schema fragment specifies the expected content contained within this class. - * - *

- * <complexType name="DirectionalDNSRecordDetail">
- *   <complexContent>
- *     <restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
- *       <sequence>
- *         <element name="DirectionalDNSRecord" type="{http://schema.ultraservice.neustar.com/v01/}DirectionalDNSRecord"/>
- *       </sequence>
- *       <attribute name="GeolocationGroupName" type="{http://www.w3.org/2001/XMLSchema}string" />
- *       <attribute name="GeolocationGroupId" type="{http://www.w3.org/2001/XMLSchema}string" />
- *       <attribute name="SourceIPGroupName" type="{http://www.w3.org/2001/XMLSchema}string" />
- *       <attribute name="SourceIPGroupId" type="{http://www.w3.org/2001/XMLSchema}string" />
- *       <attribute name="GeolocationDescription" type="{http://www.w3.org/2001/XMLSchema}string" />
- *       <attribute name="SourceIPDescription" type="{http://www.w3.org/2001/XMLSchema}string" />
- *       <attribute name="TerritoriesCount" type="{http://www.w3.org/2001/XMLSchema}string" />
- *       <attribute name="DirPoolRecordId" use="required" type="{http://www.w3.org/2001/XMLSchema}string" />
- *       <attribute name="GroupName" type="{http://www.w3.org/2001/XMLSchema}string" />
- *       <attribute name="GroupId" type="{http://www.w3.org/2001/XMLSchema}string" />
- *       <attribute name="Description" type="{http://www.w3.org/2001/XMLSchema}string" />
- *       <attribute name="ZoneName" type="{http://www.w3.org/2001/XMLSchema}string" />
- *       <attribute name="DName" type="{http://www.w3.org/2001/XMLSchema}string" />
- *     </restriction>
- *   </complexContent>
- * </complexType>
- * 
- * - * - */ -@XmlAccessorType(XmlAccessType.FIELD) -@XmlType(name = "DirectionalDNSRecordDetail", propOrder = { - "directionalDNSRecord" -}) -public class DirectionalDNSRecordDetail { - - @XmlElement(name = "DirectionalDNSRecord", required = true) - protected DirectionalDNSRecord directionalDNSRecord; - @XmlAttribute(name = "GeolocationGroupName") - protected String geolocationGroupName; - @XmlAttribute(name = "GeolocationGroupId") - protected String geolocationGroupId; - @XmlAttribute(name = "SourceIPGroupName") - protected String sourceIPGroupName; - @XmlAttribute(name = "SourceIPGroupId") - protected String sourceIPGroupId; - @XmlAttribute(name = "GeolocationDescription") - protected String geolocationDescription; - @XmlAttribute(name = "SourceIPDescription") - protected String sourceIPDescription; - @XmlAttribute(name = "TerritoriesCount") - protected String territoriesCount; - @XmlAttribute(name = "DirPoolRecordId", required = true) - protected String dirPoolRecordId; - @XmlAttribute(name = "GroupName") - protected String groupName; - @XmlAttribute(name = "GroupId") - protected String groupId; - @XmlAttribute(name = "Description") - protected String description; - @XmlAttribute(name = "ZoneName") - protected String zoneName; - @XmlAttribute(name = "DName") - protected String dName; - - /** - * Gets the value of the directionalDNSRecord property. - * - * @return - * possible object is - * {@link DirectionalDNSRecord } - * - */ - public DirectionalDNSRecord getDirectionalDNSRecord() { - return directionalDNSRecord; - } - - /** - * Sets the value of the directionalDNSRecord property. - * - * @param value - * allowed object is - * {@link DirectionalDNSRecord } - * - */ - public void setDirectionalDNSRecord(DirectionalDNSRecord value) { - this.directionalDNSRecord = value; - } - - /** - * Gets the value of the geolocationGroupName property. - * - * @return - * possible object is - * {@link String } - * - */ - public String getGeolocationGroupName() { - return geolocationGroupName; - } - - /** - * Sets the value of the geolocationGroupName property. - * - * @param value - * allowed object is - * {@link String } - * - */ - public void setGeolocationGroupName(String value) { - this.geolocationGroupName = value; - } - - /** - * Gets the value of the geolocationGroupId property. - * - * @return - * possible object is - * {@link String } - * - */ - public String getGeolocationGroupId() { - return geolocationGroupId; - } - - /** - * Sets the value of the geolocationGroupId property. - * - * @param value - * allowed object is - * {@link String } - * - */ - public void setGeolocationGroupId(String value) { - this.geolocationGroupId = value; - } - - /** - * Gets the value of the sourceIPGroupName property. - * - * @return - * possible object is - * {@link String } - * - */ - public String getSourceIPGroupName() { - return sourceIPGroupName; - } - - /** - * Sets the value of the sourceIPGroupName property. - * - * @param value - * allowed object is - * {@link String } - * - */ - public void setSourceIPGroupName(String value) { - this.sourceIPGroupName = value; - } - - /** - * Gets the value of the sourceIPGroupId property. - * - * @return - * possible object is - * {@link String } - * - */ - public String getSourceIPGroupId() { - return sourceIPGroupId; - } - - /** - * Sets the value of the sourceIPGroupId property. - * - * @param value - * allowed object is - * {@link String } - * - */ - public void setSourceIPGroupId(String value) { - this.sourceIPGroupId = value; - } - - /** - * Gets the value of the geolocationDescription property. - * - * @return - * possible object is - * {@link String } - * - */ - public String getGeolocationDescription() { - return geolocationDescription; - } - - /** - * Sets the value of the geolocationDescription property. - * - * @param value - * allowed object is - * {@link String } - * - */ - public void setGeolocationDescription(String value) { - this.geolocationDescription = value; - } - - /** - * Gets the value of the sourceIPDescription property. - * - * @return - * possible object is - * {@link String } - * - */ - public String getSourceIPDescription() { - return sourceIPDescription; - } - - /** - * Sets the value of the sourceIPDescription property. - * - * @param value - * allowed object is - * {@link String } - * - */ - public void setSourceIPDescription(String value) { - this.sourceIPDescription = value; - } - - /** - * Gets the value of the territoriesCount property. - * - * @return - * possible object is - * {@link String } - * - */ - public String getTerritoriesCount() { - return territoriesCount; - } - - /** - * Sets the value of the territoriesCount property. - * - * @param value - * allowed object is - * {@link String } - * - */ - public void setTerritoriesCount(String value) { - this.territoriesCount = value; - } - - /** - * Gets the value of the dirPoolRecordId property. - * - * @return - * possible object is - * {@link String } - * - */ - public String getDirPoolRecordId() { - return dirPoolRecordId; - } - - /** - * Sets the value of the dirPoolRecordId property. - * - * @param value - * allowed object is - * {@link String } - * - */ - public void setDirPoolRecordId(String value) { - this.dirPoolRecordId = value; - } - - /** - * Gets the value of the groupName property. - * - * @return - * possible object is - * {@link String } - * - */ - public String getGroupName() { - return groupName; - } - - /** - * Sets the value of the groupName property. - * - * @param value - * allowed object is - * {@link String } - * - */ - public void setGroupName(String value) { - this.groupName = value; - } - - /** - * Gets the value of the groupId property. - * - * @return - * possible object is - * {@link String } - * - */ - public String getGroupId() { - return groupId; - } - - /** - * Sets the value of the groupId property. - * - * @param value - * allowed object is - * {@link String } - * - */ - public void setGroupId(String value) { - this.groupId = value; - } - - /** - * Gets the value of the description property. - * - * @return - * possible object is - * {@link String } - * - */ - public String getDescription() { - return description; - } - - /** - * Sets the value of the description property. - * - * @param value - * allowed object is - * {@link String } - * - */ - public void setDescription(String value) { - this.description = value; - } - - /** - * Gets the value of the zoneName property. - * - * @return - * possible object is - * {@link String } - * - */ - public String getZoneName() { - return zoneName; - } - - /** - * Sets the value of the zoneName property. - * - * @param value - * allowed object is - * {@link String } - * - */ - public void setZoneName(String value) { - this.zoneName = value; - } - - /** - * Gets the value of the dName property. - * - * @return - * possible object is - * {@link String } - * - */ - public String getDName() { - return dName; - } - - /** - * Sets the value of the dName property. - * - * @param value - * allowed object is - * {@link String } - * - */ - public void setDName(String value) { - this.dName = value; - } - -} diff --git a/Plugins/Mineplex.BungeeRotator/src/com/neustar/ultraservice/schema/v01/DirectionalDNSRecordDetailList.java b/Plugins/Mineplex.BungeeRotator/src/com/neustar/ultraservice/schema/v01/DirectionalDNSRecordDetailList.java deleted file mode 100644 index 7ec0d5188..000000000 --- a/Plugins/Mineplex.BungeeRotator/src/com/neustar/ultraservice/schema/v01/DirectionalDNSRecordDetailList.java +++ /dev/null @@ -1,124 +0,0 @@ - -package com.neustar.ultraservice.schema.v01; - -import java.util.ArrayList; -import java.util.List; -import javax.xml.bind.annotation.XmlAccessType; -import javax.xml.bind.annotation.XmlAccessorType; -import javax.xml.bind.annotation.XmlAttribute; -import javax.xml.bind.annotation.XmlElement; -import javax.xml.bind.annotation.XmlType; - - -/** - *

Java class for DirectionalDNSRecordDetailList complex type. - * - *

The following schema fragment specifies the expected content contained within this class. - * - *

- * <complexType name="DirectionalDNSRecordDetailList">
- *   <complexContent>
- *     <restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
- *       <sequence>
- *         <element name="DirectionalDNSRecordDetail" type="{http://schema.ultraservice.neustar.com/v01/}DirectionalDNSRecordDetail" maxOccurs="unbounded"/>
- *       </sequence>
- *       <attribute name="ZoneName" use="required" type="{http://www.w3.org/2001/XMLSchema}string" />
- *       <attribute name="DName" use="required" type="{http://www.w3.org/2001/XMLSchema}string" />
- *     </restriction>
- *   </complexContent>
- * </complexType>
- * 
- * - * - */ -@XmlAccessorType(XmlAccessType.FIELD) -@XmlType(name = "DirectionalDNSRecordDetailList", propOrder = { - "directionalDNSRecordDetail" -}) -public class DirectionalDNSRecordDetailList { - - @XmlElement(name = "DirectionalDNSRecordDetail", required = true) - protected List directionalDNSRecordDetail; - @XmlAttribute(name = "ZoneName", required = true) - protected String zoneName; - @XmlAttribute(name = "DName", required = true) - protected String dName; - - /** - * Gets the value of the directionalDNSRecordDetail property. - * - *

- * This accessor method returns a reference to the live list, - * not a snapshot. Therefore any modification you make to the - * returned list will be present inside the JAXB object. - * This is why there is not a set method for the directionalDNSRecordDetail property. - * - *

- * For example, to add a new item, do as follows: - *

-     *    getDirectionalDNSRecordDetail().add(newItem);
-     * 
- * - * - *

- * Objects of the following type(s) are allowed in the list - * {@link DirectionalDNSRecordDetail } - * - * - */ - public List getDirectionalDNSRecordDetail() { - if (directionalDNSRecordDetail == null) { - directionalDNSRecordDetail = new ArrayList(); - } - return this.directionalDNSRecordDetail; - } - - /** - * Gets the value of the zoneName property. - * - * @return - * possible object is - * {@link String } - * - */ - public String getZoneName() { - return zoneName; - } - - /** - * Sets the value of the zoneName property. - * - * @param value - * allowed object is - * {@link String } - * - */ - public void setZoneName(String value) { - this.zoneName = value; - } - - /** - * Gets the value of the dName property. - * - * @return - * possible object is - * {@link String } - * - */ - public String getDName() { - return dName; - } - - /** - * Sets the value of the dName property. - * - * @param value - * allowed object is - * {@link String } - * - */ - public void setDName(String value) { - this.dName = value; - } - -} diff --git a/Plugins/Mineplex.BungeeRotator/src/com/neustar/ultraservice/schema/v01/DirectionalDNSRecordToUpdate.java b/Plugins/Mineplex.BungeeRotator/src/com/neustar/ultraservice/schema/v01/DirectionalDNSRecordToUpdate.java deleted file mode 100644 index f927a956d..000000000 --- a/Plugins/Mineplex.BungeeRotator/src/com/neustar/ultraservice/schema/v01/DirectionalDNSRecordToUpdate.java +++ /dev/null @@ -1,90 +0,0 @@ - -package com.neustar.ultraservice.schema.v01; - -import javax.xml.bind.annotation.XmlAccessType; -import javax.xml.bind.annotation.XmlAccessorType; -import javax.xml.bind.annotation.XmlAttribute; -import javax.xml.bind.annotation.XmlElement; -import javax.xml.bind.annotation.XmlType; - - -/** - *

Java class for DirectionalDNSRecordToUpdate complex type. - * - *

The following schema fragment specifies the expected content contained within this class. - * - *

- * <complexType name="DirectionalDNSRecordToUpdate">
- *   <complexContent>
- *     <restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
- *       <sequence>
- *         <element name="InfoValues" type="{http://schema.ultraservice.neustar.com/v01/}InfoValues"/>
- *       </sequence>
- *       <attribute name="TTL" type="{http://www.w3.org/2001/XMLSchema}string" />
- *     </restriction>
- *   </complexContent>
- * </complexType>
- * 
- * - * - */ -@XmlAccessorType(XmlAccessType.FIELD) -@XmlType(name = "DirectionalDNSRecordToUpdate", propOrder = { - "infoValues" -}) -public class DirectionalDNSRecordToUpdate { - - @XmlElement(name = "InfoValues", required = true) - protected InfoValues infoValues; - @XmlAttribute(name = "TTL") - protected String ttl; - - /** - * Gets the value of the infoValues property. - * - * @return - * possible object is - * {@link InfoValues } - * - */ - public InfoValues getInfoValues() { - return infoValues; - } - - /** - * Sets the value of the infoValues property. - * - * @param value - * allowed object is - * {@link InfoValues } - * - */ - public void setInfoValues(InfoValues value) { - this.infoValues = value; - } - - /** - * Gets the value of the ttl property. - * - * @return - * possible object is - * {@link String } - * - */ - public String getTTL() { - return ttl; - } - - /** - * Sets the value of the ttl property. - * - * @param value - * allowed object is - * {@link String } - * - */ - public void setTTL(String value) { - this.ttl = value; - } - -} diff --git a/Plugins/Mineplex.BungeeRotator/src/com/neustar/ultraservice/schema/v01/DirectionalPoolData.java b/Plugins/Mineplex.BungeeRotator/src/com/neustar/ultraservice/schema/v01/DirectionalPoolData.java deleted file mode 100644 index 9d5433244..000000000 --- a/Plugins/Mineplex.BungeeRotator/src/com/neustar/ultraservice/schema/v01/DirectionalPoolData.java +++ /dev/null @@ -1,276 +0,0 @@ - -package com.neustar.ultraservice.schema.v01; - -import javax.xml.bind.annotation.XmlAccessType; -import javax.xml.bind.annotation.XmlAccessorType; -import javax.xml.bind.annotation.XmlAttribute; -import javax.xml.bind.annotation.XmlType; - - -/** - *

Java class for DirectionalPoolData complex type. - * - *

The following schema fragment specifies the expected content contained within this class. - * - *

- * <complexType name="DirectionalPoolData">
- *   <complexContent>
- *     <restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
- *       <sequence>
- *       </sequence>
- *       <attribute name="dirpoolid" type="{http://www.w3.org/2001/XMLSchema}string" />
- *       <attribute name="Zoneid" type="{http://www.w3.org/2001/XMLSchema}string" />
- *       <attribute name="Poolname" type="{http://www.w3.org/2001/XMLSchema}string" />
- *       <attribute name="Pooldname" type="{http://www.w3.org/2001/XMLSchema}string" />
- *       <attribute name="Sponsorid" type="{http://www.w3.org/2001/XMLSchema}string" />
- *       <attribute name="accountid" type="{http://www.w3.org/2001/XMLSchema}string" />
- *       <attribute name="DirPoolType" type="{http://schema.ultraservice.neustar.com/v01/}DirPoolType" />
- *       <attribute name="TieBreak" type="{http://schema.ultraservice.neustar.com/v01/}TieBreak" />
- *       <attribute name="Description" type="{http://www.w3.org/2001/XMLSchema}string" />
- *     </restriction>
- *   </complexContent>
- * </complexType>
- * 
- * - * - */ -@XmlAccessorType(XmlAccessType.FIELD) -@XmlType(name = "DirectionalPoolData") -public class DirectionalPoolData { - - @XmlAttribute(name = "dirpoolid") - protected String dirpoolid; - @XmlAttribute(name = "Zoneid") - protected String zoneid; - @XmlAttribute(name = "Poolname") - protected String poolname; - @XmlAttribute(name = "Pooldname") - protected String pooldname; - @XmlAttribute(name = "Sponsorid") - protected String sponsorid; - @XmlAttribute(name = "accountid") - protected String accountid; - @XmlAttribute(name = "DirPoolType") - protected DirPoolType dirPoolType; - @XmlAttribute(name = "TieBreak") - protected TieBreak tieBreak; - @XmlAttribute(name = "Description") - protected String description; - - /** - * Gets the value of the dirpoolid property. - * - * @return - * possible object is - * {@link String } - * - */ - public String getDirpoolid() { - return dirpoolid; - } - - /** - * Sets the value of the dirpoolid property. - * - * @param value - * allowed object is - * {@link String } - * - */ - public void setDirpoolid(String value) { - this.dirpoolid = value; - } - - /** - * Gets the value of the zoneid property. - * - * @return - * possible object is - * {@link String } - * - */ - public String getZoneid() { - return zoneid; - } - - /** - * Sets the value of the zoneid property. - * - * @param value - * allowed object is - * {@link String } - * - */ - public void setZoneid(String value) { - this.zoneid = value; - } - - /** - * Gets the value of the poolname property. - * - * @return - * possible object is - * {@link String } - * - */ - public String getPoolname() { - return poolname; - } - - /** - * Sets the value of the poolname property. - * - * @param value - * allowed object is - * {@link String } - * - */ - public void setPoolname(String value) { - this.poolname = value; - } - - /** - * Gets the value of the pooldname property. - * - * @return - * possible object is - * {@link String } - * - */ - public String getPooldname() { - return pooldname; - } - - /** - * Sets the value of the pooldname property. - * - * @param value - * allowed object is - * {@link String } - * - */ - public void setPooldname(String value) { - this.pooldname = value; - } - - /** - * Gets the value of the sponsorid property. - * - * @return - * possible object is - * {@link String } - * - */ - public String getSponsorid() { - return sponsorid; - } - - /** - * Sets the value of the sponsorid property. - * - * @param value - * allowed object is - * {@link String } - * - */ - public void setSponsorid(String value) { - this.sponsorid = value; - } - - /** - * Gets the value of the accountid property. - * - * @return - * possible object is - * {@link String } - * - */ - public String getAccountid() { - return accountid; - } - - /** - * Sets the value of the accountid property. - * - * @param value - * allowed object is - * {@link String } - * - */ - public void setAccountid(String value) { - this.accountid = value; - } - - /** - * Gets the value of the dirPoolType property. - * - * @return - * possible object is - * {@link DirPoolType } - * - */ - public DirPoolType getDirPoolType() { - return dirPoolType; - } - - /** - * Sets the value of the dirPoolType property. - * - * @param value - * allowed object is - * {@link DirPoolType } - * - */ - public void setDirPoolType(DirPoolType value) { - this.dirPoolType = value; - } - - /** - * Gets the value of the tieBreak property. - * - * @return - * possible object is - * {@link TieBreak } - * - */ - public TieBreak getTieBreak() { - return tieBreak; - } - - /** - * Sets the value of the tieBreak property. - * - * @param value - * allowed object is - * {@link TieBreak } - * - */ - public void setTieBreak(TieBreak value) { - this.tieBreak = value; - } - - /** - * Gets the value of the description property. - * - * @return - * possible object is - * {@link String } - * - */ - public String getDescription() { - return description; - } - - /** - * Sets the value of the description property. - * - * @param value - * allowed object is - * {@link String } - * - */ - public void setDescription(String value) { - this.description = value; - } - -} diff --git a/Plugins/Mineplex.BungeeRotator/src/com/neustar/ultraservice/schema/v01/DirectionalPoolList.java b/Plugins/Mineplex.BungeeRotator/src/com/neustar/ultraservice/schema/v01/DirectionalPoolList.java deleted file mode 100644 index 270e917b4..000000000 --- a/Plugins/Mineplex.BungeeRotator/src/com/neustar/ultraservice/schema/v01/DirectionalPoolList.java +++ /dev/null @@ -1,69 +0,0 @@ - -package com.neustar.ultraservice.schema.v01; - -import java.util.ArrayList; -import java.util.List; -import javax.xml.bind.annotation.XmlAccessType; -import javax.xml.bind.annotation.XmlAccessorType; -import javax.xml.bind.annotation.XmlElement; -import javax.xml.bind.annotation.XmlType; - - -/** - *

Java class for DirectionalPoolList complex type. - * - *

The following schema fragment specifies the expected content contained within this class. - * - *

- * <complexType name="DirectionalPoolList">
- *   <complexContent>
- *     <restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
- *       <sequence>
- *         <element name="DirectionalPoolData" type="{http://schema.ultraservice.neustar.com/v01/}DirectionalPoolData" maxOccurs="unbounded"/>
- *       </sequence>
- *     </restriction>
- *   </complexContent>
- * </complexType>
- * 
- * - * - */ -@XmlAccessorType(XmlAccessType.FIELD) -@XmlType(name = "DirectionalPoolList", propOrder = { - "directionalPoolData" -}) -public class DirectionalPoolList { - - @XmlElement(name = "DirectionalPoolData", required = true) - protected List directionalPoolData; - - /** - * Gets the value of the directionalPoolData property. - * - *

- * This accessor method returns a reference to the live list, - * not a snapshot. Therefore any modification you make to the - * returned list will be present inside the JAXB object. - * This is why there is not a set method for the directionalPoolData property. - * - *

- * For example, to add a new item, do as follows: - *

-     *    getDirectionalPoolData().add(newItem);
-     * 
- * - * - *

- * Objects of the following type(s) are allowed in the list - * {@link DirectionalPoolData } - * - * - */ - public List getDirectionalPoolData() { - if (directionalPoolData == null) { - directionalPoolData = new ArrayList(); - } - return this.directionalPoolData; - } - -} diff --git a/Plugins/Mineplex.BungeeRotator/src/com/neustar/ultraservice/schema/v01/DirectionalRecordData.java b/Plugins/Mineplex.BungeeRotator/src/com/neustar/ultraservice/schema/v01/DirectionalRecordData.java deleted file mode 100644 index 43438878c..000000000 --- a/Plugins/Mineplex.BungeeRotator/src/com/neustar/ultraservice/schema/v01/DirectionalRecordData.java +++ /dev/null @@ -1,165 +0,0 @@ - -package com.neustar.ultraservice.schema.v01; - -import javax.xml.bind.annotation.XmlAccessType; -import javax.xml.bind.annotation.XmlAccessorType; -import javax.xml.bind.annotation.XmlAttribute; -import javax.xml.bind.annotation.XmlElement; -import javax.xml.bind.annotation.XmlType; - - -/** - *

Java class for DirectionalRecordData complex type. - * - *

The following schema fragment specifies the expected content contained within this class. - * - *

- * <complexType name="DirectionalRecordData">
- *   <complexContent>
- *     <restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
- *       <sequence>
- *         <element name="DirectionalRecordConfiguration" type="{http://schema.ultraservice.neustar.com/v01/}DirectionalDNSRecord"/>
- *         <element name="GeolocationGroupData" type="{http://schema.ultraservice.neustar.com/v01/}GeolocationGroupData"/>
- *         <element name="SourceIPGroupData" type="{http://schema.ultraservice.neustar.com/v01/}SourceIPGroupData"/>
- *       </sequence>
- *       <attribute name="existingResourceRecordId" type="{http://www.w3.org/2001/XMLSchema}string" />
- *       <attribute name="createAllNonConfiguredGrp" use="required" type="{http://www.w3.org/2001/XMLSchema}boolean" />
- *     </restriction>
- *   </complexContent>
- * </complexType>
- * 
- * - * - */ -@XmlAccessorType(XmlAccessType.FIELD) -@XmlType(name = "DirectionalRecordData", propOrder = { - "directionalRecordConfiguration", - "geolocationGroupData", - "sourceIPGroupData" -}) -public class DirectionalRecordData { - - @XmlElement(name = "DirectionalRecordConfiguration", required = true, nillable = true) - protected DirectionalDNSRecord directionalRecordConfiguration; - @XmlElement(name = "GeolocationGroupData", required = true, nillable = true) - protected GeolocationGroupData geolocationGroupData; - @XmlElement(name = "SourceIPGroupData", required = true, nillable = true) - protected SourceIPGroupData sourceIPGroupData; - @XmlAttribute(name = "existingResourceRecordId") - protected String existingResourceRecordId; - @XmlAttribute(name = "createAllNonConfiguredGrp", required = true) - protected boolean createAllNonConfiguredGrp; - - /** - * Gets the value of the directionalRecordConfiguration property. - * - * @return - * possible object is - * {@link DirectionalDNSRecord } - * - */ - public DirectionalDNSRecord getDirectionalRecordConfiguration() { - return directionalRecordConfiguration; - } - - /** - * Sets the value of the directionalRecordConfiguration property. - * - * @param value - * allowed object is - * {@link DirectionalDNSRecord } - * - */ - public void setDirectionalRecordConfiguration(DirectionalDNSRecord value) { - this.directionalRecordConfiguration = value; - } - - /** - * Gets the value of the geolocationGroupData property. - * - * @return - * possible object is - * {@link GeolocationGroupData } - * - */ - public GeolocationGroupData getGeolocationGroupData() { - return geolocationGroupData; - } - - /** - * Sets the value of the geolocationGroupData property. - * - * @param value - * allowed object is - * {@link GeolocationGroupData } - * - */ - public void setGeolocationGroupData(GeolocationGroupData value) { - this.geolocationGroupData = value; - } - - /** - * Gets the value of the sourceIPGroupData property. - * - * @return - * possible object is - * {@link SourceIPGroupData } - * - */ - public SourceIPGroupData getSourceIPGroupData() { - return sourceIPGroupData; - } - - /** - * Sets the value of the sourceIPGroupData property. - * - * @param value - * allowed object is - * {@link SourceIPGroupData } - * - */ - public void setSourceIPGroupData(SourceIPGroupData value) { - this.sourceIPGroupData = value; - } - - /** - * Gets the value of the existingResourceRecordId property. - * - * @return - * possible object is - * {@link String } - * - */ - public String getExistingResourceRecordId() { - return existingResourceRecordId; - } - - /** - * Sets the value of the existingResourceRecordId property. - * - * @param value - * allowed object is - * {@link String } - * - */ - public void setExistingResourceRecordId(String value) { - this.existingResourceRecordId = value; - } - - /** - * Gets the value of the createAllNonConfiguredGrp property. - * - */ - public boolean isCreateAllNonConfiguredGrp() { - return createAllNonConfiguredGrp; - } - - /** - * Sets the value of the createAllNonConfiguredGrp property. - * - */ - public void setCreateAllNonConfiguredGrp(boolean value) { - this.createAllNonConfiguredGrp = value; - } - -} diff --git a/Plugins/Mineplex.BungeeRotator/src/com/neustar/ultraservice/schema/v01/DnsCriteria.java b/Plugins/Mineplex.BungeeRotator/src/com/neustar/ultraservice/schema/v01/DnsCriteria.java deleted file mode 100644 index f8c88444d..000000000 --- a/Plugins/Mineplex.BungeeRotator/src/com/neustar/ultraservice/schema/v01/DnsCriteria.java +++ /dev/null @@ -1,114 +0,0 @@ - -package com.neustar.ultraservice.schema.v01; - -import javax.xml.bind.annotation.XmlAccessType; -import javax.xml.bind.annotation.XmlAccessorType; -import javax.xml.bind.annotation.XmlType; - - -/** - *

Java class for DnsCriteria complex type. - * - *

The following schema fragment specifies the expected content contained within this class. - * - *

- * <complexType name="DnsCriteria">
- *   <complexContent>
- *     <restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
- *       <sequence>
- *         <element name="runTime" type="{http://www.w3.org/2001/XMLSchema}int" minOccurs="0"/>
- *         <element name="runTimeAverage" type="{http://www.w3.org/2001/XMLSchema}int" minOccurs="0"/>
- *         <element name="response" type="{http://www.w3.org/2001/XMLSchema}string" minOccurs="0"/>
- *       </sequence>
- *     </restriction>
- *   </complexContent>
- * </complexType>
- * 
- * - * - */ -@XmlAccessorType(XmlAccessType.FIELD) -@XmlType(name = "DnsCriteria", propOrder = { - "runTime", - "runTimeAverage", - "response" -}) -public class DnsCriteria { - - protected Integer runTime; - protected Integer runTimeAverage; - protected String response; - - /** - * Gets the value of the runTime property. - * - * @return - * possible object is - * {@link Integer } - * - */ - public Integer getRunTime() { - return runTime; - } - - /** - * Sets the value of the runTime property. - * - * @param value - * allowed object is - * {@link Integer } - * - */ - public void setRunTime(Integer value) { - this.runTime = value; - } - - /** - * Gets the value of the runTimeAverage property. - * - * @return - * possible object is - * {@link Integer } - * - */ - public Integer getRunTimeAverage() { - return runTimeAverage; - } - - /** - * Sets the value of the runTimeAverage property. - * - * @param value - * allowed object is - * {@link Integer } - * - */ - public void setRunTimeAverage(Integer value) { - this.runTimeAverage = value; - } - - /** - * Gets the value of the response property. - * - * @return - * possible object is - * {@link String } - * - */ - public String getResponse() { - return response; - } - - /** - * Sets the value of the response property. - * - * @param value - * allowed object is - * {@link String } - * - */ - public void setResponse(String value) { - this.response = value; - } - -} diff --git a/Plugins/Mineplex.BungeeRotator/src/com/neustar/ultraservice/schema/v01/DnssecKey.java b/Plugins/Mineplex.BungeeRotator/src/com/neustar/ultraservice/schema/v01/DnssecKey.java deleted file mode 100644 index f1b747e06..000000000 --- a/Plugins/Mineplex.BungeeRotator/src/com/neustar/ultraservice/schema/v01/DnssecKey.java +++ /dev/null @@ -1,253 +0,0 @@ - -package com.neustar.ultraservice.schema.v01; - -import javax.xml.bind.annotation.XmlAccessType; -import javax.xml.bind.annotation.XmlAccessorType; -import javax.xml.bind.annotation.XmlAttribute; -import javax.xml.bind.annotation.XmlSchemaType; -import javax.xml.bind.annotation.XmlType; -import javax.xml.datatype.XMLGregorianCalendar; - - -/** - *

Java class for DnssecKey complex type. - * - *

The following schema fragment specifies the expected content contained within this class. - * - *

- * <complexType name="DnssecKey">
- *   <complexContent>
- *     <restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
- *       <sequence>
- *       </sequence>
- *       <attribute name="type" type="{http://www.w3.org/2001/XMLSchema}string" />
- *       <attribute name="status" type="{http://www.w3.org/2001/XMLSchema}string" />
- *       <attribute name="algorithm" type="{http://www.w3.org/2001/XMLSchema}string" />
- *       <attribute name="keySize" type="{http://www.w3.org/2001/XMLSchema}int" />
- *       <attribute name="effectivityPeriod" type="{http://www.w3.org/2001/XMLSchema}int" />
- *       <attribute name="created" type="{http://www.w3.org/2001/XMLSchema}dateTime" />
- *       <attribute name="nextRoll" type="{http://www.w3.org/2001/XMLSchema}dateTime" />
- *       <attribute name="keyID" type="{http://www.w3.org/2001/XMLSchema}long" />
- *     </restriction>
- *   </complexContent>
- * </complexType>
- * 
- * - * - */ -@XmlAccessorType(XmlAccessType.FIELD) -@XmlType(name = "DnssecKey") -public class DnssecKey { - - @XmlAttribute(name = "type") - protected String type; - @XmlAttribute(name = "status") - protected String status; - @XmlAttribute(name = "algorithm") - protected String algorithm; - @XmlAttribute(name = "keySize") - protected Integer keySize; - @XmlAttribute(name = "effectivityPeriod") - protected Integer effectivityPeriod; - @XmlAttribute(name = "created") - @XmlSchemaType(name = "dateTime") - protected XMLGregorianCalendar created; - @XmlAttribute(name = "nextRoll") - @XmlSchemaType(name = "dateTime") - protected XMLGregorianCalendar nextRoll; - @XmlAttribute(name = "keyID") - protected Long keyID; - - /** - * Gets the value of the type property. - * - * @return - * possible object is - * {@link String } - * - */ - public String getType() { - return type; - } - - /** - * Sets the value of the type property. - * - * @param value - * allowed object is - * {@link String } - * - */ - public void setType(String value) { - this.type = value; - } - - /** - * Gets the value of the status property. - * - * @return - * possible object is - * {@link String } - * - */ - public String getStatus() { - return status; - } - - /** - * Sets the value of the status property. - * - * @param value - * allowed object is - * {@link String } - * - */ - public void setStatus(String value) { - this.status = value; - } - - /** - * Gets the value of the algorithm property. - * - * @return - * possible object is - * {@link String } - * - */ - public String getAlgorithm() { - return algorithm; - } - - /** - * Sets the value of the algorithm property. - * - * @param value - * allowed object is - * {@link String } - * - */ - public void setAlgorithm(String value) { - this.algorithm = value; - } - - /** - * Gets the value of the keySize property. - * - * @return - * possible object is - * {@link Integer } - * - */ - public Integer getKeySize() { - return keySize; - } - - /** - * Sets the value of the keySize property. - * - * @param value - * allowed object is - * {@link Integer } - * - */ - public void setKeySize(Integer value) { - this.keySize = value; - } - - /** - * Gets the value of the effectivityPeriod property. - * - * @return - * possible object is - * {@link Integer } - * - */ - public Integer getEffectivityPeriod() { - return effectivityPeriod; - } - - /** - * Sets the value of the effectivityPeriod property. - * - * @param value - * allowed object is - * {@link Integer } - * - */ - public void setEffectivityPeriod(Integer value) { - this.effectivityPeriod = value; - } - - /** - * Gets the value of the created property. - * - * @return - * possible object is - * {@link XMLGregorianCalendar } - * - */ - public XMLGregorianCalendar getCreated() { - return created; - } - - /** - * Sets the value of the created property. - * - * @param value - * allowed object is - * {@link XMLGregorianCalendar } - * - */ - public void setCreated(XMLGregorianCalendar value) { - this.created = value; - } - - /** - * Gets the value of the nextRoll property. - * - * @return - * possible object is - * {@link XMLGregorianCalendar } - * - */ - public XMLGregorianCalendar getNextRoll() { - return nextRoll; - } - - /** - * Sets the value of the nextRoll property. - * - * @param value - * allowed object is - * {@link XMLGregorianCalendar } - * - */ - public void setNextRoll(XMLGregorianCalendar value) { - this.nextRoll = value; - } - - /** - * Gets the value of the keyID property. - * - * @return - * possible object is - * {@link Long } - * - */ - public Long getKeyID() { - return keyID; - } - - /** - * Sets the value of the keyID property. - * - * @param value - * allowed object is - * {@link Long } - * - */ - public void setKeyID(Long value) { - this.keyID = value; - } - -} diff --git a/Plugins/Mineplex.BungeeRotator/src/com/neustar/ultraservice/schema/v01/DnssecKeyRecordList.java b/Plugins/Mineplex.BungeeRotator/src/com/neustar/ultraservice/schema/v01/DnssecKeyRecordList.java deleted file mode 100644 index f476a977a..000000000 --- a/Plugins/Mineplex.BungeeRotator/src/com/neustar/ultraservice/schema/v01/DnssecKeyRecordList.java +++ /dev/null @@ -1,69 +0,0 @@ - -package com.neustar.ultraservice.schema.v01; - -import java.util.ArrayList; -import java.util.List; -import javax.xml.bind.annotation.XmlAccessType; -import javax.xml.bind.annotation.XmlAccessorType; -import javax.xml.bind.annotation.XmlElement; -import javax.xml.bind.annotation.XmlType; - - -/** - *

Java class for DnssecKeyRecordList complex type. - * - *

The following schema fragment specifies the expected content contained within this class. - * - *

- * <complexType name="DnssecKeyRecordList">
- *   <complexContent>
- *     <restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
- *       <sequence>
- *         <element name="DnssecKey" type="{http://schema.ultraservice.neustar.com/v01/}DnssecKey" maxOccurs="unbounded"/>
- *       </sequence>
- *     </restriction>
- *   </complexContent>
- * </complexType>
- * 
- * - * - */ -@XmlAccessorType(XmlAccessType.FIELD) -@XmlType(name = "DnssecKeyRecordList", propOrder = { - "dnssecKey" -}) -public class DnssecKeyRecordList { - - @XmlElement(name = "DnssecKey", required = true) - protected List dnssecKey; - - /** - * Gets the value of the dnssecKey property. - * - *

- * This accessor method returns a reference to the live list, - * not a snapshot. Therefore any modification you make to the - * returned list will be present inside the JAXB object. - * This is why there is not a set method for the dnssecKey property. - * - *

- * For example, to add a new item, do as follows: - *

-     *    getDnssecKey().add(newItem);
-     * 
- * - * - *

- * Objects of the following type(s) are allowed in the list - * {@link DnssecKey } - * - * - */ - public List getDnssecKey() { - if (dnssecKey == null) { - dnssecKey = new ArrayList(); - } - return this.dnssecKey; - } - -} diff --git a/Plugins/Mineplex.BungeeRotator/src/com/neustar/ultraservice/schema/v01/DomainAlertData.java b/Plugins/Mineplex.BungeeRotator/src/com/neustar/ultraservice/schema/v01/DomainAlertData.java deleted file mode 100644 index 67a70407b..000000000 --- a/Plugins/Mineplex.BungeeRotator/src/com/neustar/ultraservice/schema/v01/DomainAlertData.java +++ /dev/null @@ -1,195 +0,0 @@ - -package com.neustar.ultraservice.schema.v01; - -import javax.xml.bind.annotation.XmlAccessType; -import javax.xml.bind.annotation.XmlAccessorType; -import javax.xml.bind.annotation.XmlAttribute; -import javax.xml.bind.annotation.XmlType; - - -/** - *

Java class for DomainAlertData complex type. - * - *

The following schema fragment specifies the expected content contained within this class. - * - *

- * <complexType name="DomainAlertData">
- *   <complexContent>
- *     <restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
- *       <sequence>
- *       </sequence>
- *       <attribute name="AccountId" type="{http://www.w3.org/2001/XMLSchema}string" />
- *       <attribute name="AlertMessage" type="{http://www.w3.org/2001/XMLSchema}string" />
- *       <attribute name="AlertType" type="{http://www.w3.org/2001/XMLSchema}string" />
- *       <attribute name="Status" type="{http://www.w3.org/2001/XMLSchema}string" />
- *       <attribute name="DateAndTime" type="{http://www.w3.org/2001/XMLSchema}string" />
- *       <attribute name="DomainName" type="{http://www.w3.org/2001/XMLSchema}string" />
- *     </restriction>
- *   </complexContent>
- * </complexType>
- * 
- * - * - */ -@XmlAccessorType(XmlAccessType.FIELD) -@XmlType(name = "DomainAlertData") -public class DomainAlertData { - - @XmlAttribute(name = "AccountId") - protected String accountId; - @XmlAttribute(name = "AlertMessage") - protected String alertMessage; - @XmlAttribute(name = "AlertType") - protected String alertType; - @XmlAttribute(name = "Status") - protected String status; - @XmlAttribute(name = "DateAndTime") - protected String dateAndTime; - @XmlAttribute(name = "DomainName") - protected String domainName; - - /** - * Gets the value of the accountId property. - * - * @return - * possible object is - * {@link String } - * - */ - public String getAccountId() { - return accountId; - } - - /** - * Sets the value of the accountId property. - * - * @param value - * allowed object is - * {@link String } - * - */ - public void setAccountId(String value) { - this.accountId = value; - } - - /** - * Gets the value of the alertMessage property. - * - * @return - * possible object is - * {@link String } - * - */ - public String getAlertMessage() { - return alertMessage; - } - - /** - * Sets the value of the alertMessage property. - * - * @param value - * allowed object is - * {@link String } - * - */ - public void setAlertMessage(String value) { - this.alertMessage = value; - } - - /** - * Gets the value of the alertType property. - * - * @return - * possible object is - * {@link String } - * - */ - public String getAlertType() { - return alertType; - } - - /** - * Sets the value of the alertType property. - * - * @param value - * allowed object is - * {@link String } - * - */ - public void setAlertType(String value) { - this.alertType = value; - } - - /** - * Gets the value of the status property. - * - * @return - * possible object is - * {@link String } - * - */ - public String getStatus() { - return status; - } - - /** - * Sets the value of the status property. - * - * @param value - * allowed object is - * {@link String } - * - */ - public void setStatus(String value) { - this.status = value; - } - - /** - * Gets the value of the dateAndTime property. - * - * @return - * possible object is - * {@link String } - * - */ - public String getDateAndTime() { - return dateAndTime; - } - - /** - * Sets the value of the dateAndTime property. - * - * @param value - * allowed object is - * {@link String } - * - */ - public void setDateAndTime(String value) { - this.dateAndTime = value; - } - - /** - * Gets the value of the domainName property. - * - * @return - * possible object is - * {@link String } - * - */ - public String getDomainName() { - return domainName; - } - - /** - * Sets the value of the domainName property. - * - * @param value - * allowed object is - * {@link String } - * - */ - public void setDomainName(String value) { - this.domainName = value; - } - -} diff --git a/Plugins/Mineplex.BungeeRotator/src/com/neustar/ultraservice/schema/v01/DomainDnssecPolicies.java b/Plugins/Mineplex.BungeeRotator/src/com/neustar/ultraservice/schema/v01/DomainDnssecPolicies.java deleted file mode 100644 index 898d8134e..000000000 --- a/Plugins/Mineplex.BungeeRotator/src/com/neustar/ultraservice/schema/v01/DomainDnssecPolicies.java +++ /dev/null @@ -1,357 +0,0 @@ - -package com.neustar.ultraservice.schema.v01; - -import javax.xml.bind.annotation.XmlAccessType; -import javax.xml.bind.annotation.XmlAccessorType; -import javax.xml.bind.annotation.XmlAttribute; -import javax.xml.bind.annotation.XmlType; - - -/** - *

Java class for DomainDnssecPolicies complex type. - * - *

The following schema fragment specifies the expected content contained within this class. - * - *

- * <complexType name="DomainDnssecPolicies">
- *   <complexContent>
- *     <restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
- *       <sequence>
- *       </sequence>
- *       <attribute name="cryptoAlgorithm" type="{http://www.w3.org/2001/XMLSchema}string" />
- *       <attribute name="nextSecure" type="{http://www.w3.org/2001/XMLSchema}string" />
- *       <attribute name="rrsigSignatureDurationInDays" type="{http://www.w3.org/2001/XMLSchema}long" />
- *       <attribute name="kskBitLength" type="{http://www.w3.org/2001/XMLSchema}int" />
- *       <attribute name="zskBitLength" type="{http://www.w3.org/2001/XMLSchema}int" />
- *       <attribute name="kskRollOverPeriodInDays" type="{http://www.w3.org/2001/XMLSchema}int" />
- *       <attribute name="zskRollOverPeriodInDays" type="{http://www.w3.org/2001/XMLSchema}int" />
- *       <attribute name="nsec3Param" type="{http://www.w3.org/2001/XMLSchema}string" />
- *       <attribute name="hashAlgorithm" type="{http://www.w3.org/2001/XMLSchema}string" />
- *       <attribute name="optoutFlag" type="{http://www.w3.org/2001/XMLSchema}int" />
- *       <attribute name="iterations" type="{http://www.w3.org/2001/XMLSchema}int" />
- *       <attribute name="salt" type="{http://www.w3.org/2001/XMLSchema}string" />
- *     </restriction>
- *   </complexContent>
- * </complexType>
- * 
- * - * - */ -@XmlAccessorType(XmlAccessType.FIELD) -@XmlType(name = "DomainDnssecPolicies") -public class DomainDnssecPolicies { - - @XmlAttribute(name = "cryptoAlgorithm") - protected String cryptoAlgorithm; - @XmlAttribute(name = "nextSecure") - protected String nextSecure; - @XmlAttribute(name = "rrsigSignatureDurationInDays") - protected Long rrsigSignatureDurationInDays; - @XmlAttribute(name = "kskBitLength") - protected Integer kskBitLength; - @XmlAttribute(name = "zskBitLength") - protected Integer zskBitLength; - @XmlAttribute(name = "kskRollOverPeriodInDays") - protected Integer kskRollOverPeriodInDays; - @XmlAttribute(name = "zskRollOverPeriodInDays") - protected Integer zskRollOverPeriodInDays; - @XmlAttribute(name = "nsec3Param") - protected String nsec3Param; - @XmlAttribute(name = "hashAlgorithm") - protected String hashAlgorithm; - @XmlAttribute(name = "optoutFlag") - protected Integer optoutFlag; - @XmlAttribute(name = "iterations") - protected Integer iterations; - @XmlAttribute(name = "salt") - protected String salt; - - /** - * Gets the value of the cryptoAlgorithm property. - * - * @return - * possible object is - * {@link String } - * - */ - public String getCryptoAlgorithm() { - return cryptoAlgorithm; - } - - /** - * Sets the value of the cryptoAlgorithm property. - * - * @param value - * allowed object is - * {@link String } - * - */ - public void setCryptoAlgorithm(String value) { - this.cryptoAlgorithm = value; - } - - /** - * Gets the value of the nextSecure property. - * - * @return - * possible object is - * {@link String } - * - */ - public String getNextSecure() { - return nextSecure; - } - - /** - * Sets the value of the nextSecure property. - * - * @param value - * allowed object is - * {@link String } - * - */ - public void setNextSecure(String value) { - this.nextSecure = value; - } - - /** - * Gets the value of the rrsigSignatureDurationInDays property. - * - * @return - * possible object is - * {@link Long } - * - */ - public Long getRrsigSignatureDurationInDays() { - return rrsigSignatureDurationInDays; - } - - /** - * Sets the value of the rrsigSignatureDurationInDays property. - * - * @param value - * allowed object is - * {@link Long } - * - */ - public void setRrsigSignatureDurationInDays(Long value) { - this.rrsigSignatureDurationInDays = value; - } - - /** - * Gets the value of the kskBitLength property. - * - * @return - * possible object is - * {@link Integer } - * - */ - public Integer getKskBitLength() { - return kskBitLength; - } - - /** - * Sets the value of the kskBitLength property. - * - * @param value - * allowed object is - * {@link Integer } - * - */ - public void setKskBitLength(Integer value) { - this.kskBitLength = value; - } - - /** - * Gets the value of the zskBitLength property. - * - * @return - * possible object is - * {@link Integer } - * - */ - public Integer getZskBitLength() { - return zskBitLength; - } - - /** - * Sets the value of the zskBitLength property. - * - * @param value - * allowed object is - * {@link Integer } - * - */ - public void setZskBitLength(Integer value) { - this.zskBitLength = value; - } - - /** - * Gets the value of the kskRollOverPeriodInDays property. - * - * @return - * possible object is - * {@link Integer } - * - */ - public Integer getKskRollOverPeriodInDays() { - return kskRollOverPeriodInDays; - } - - /** - * Sets the value of the kskRollOverPeriodInDays property. - * - * @param value - * allowed object is - * {@link Integer } - * - */ - public void setKskRollOverPeriodInDays(Integer value) { - this.kskRollOverPeriodInDays = value; - } - - /** - * Gets the value of the zskRollOverPeriodInDays property. - * - * @return - * possible object is - * {@link Integer } - * - */ - public Integer getZskRollOverPeriodInDays() { - return zskRollOverPeriodInDays; - } - - /** - * Sets the value of the zskRollOverPeriodInDays property. - * - * @param value - * allowed object is - * {@link Integer } - * - */ - public void setZskRollOverPeriodInDays(Integer value) { - this.zskRollOverPeriodInDays = value; - } - - /** - * Gets the value of the nsec3Param property. - * - * @return - * possible object is - * {@link String } - * - */ - public String getNsec3Param() { - return nsec3Param; - } - - /** - * Sets the value of the nsec3Param property. - * - * @param value - * allowed object is - * {@link String } - * - */ - public void setNsec3Param(String value) { - this.nsec3Param = value; - } - - /** - * Gets the value of the hashAlgorithm property. - * - * @return - * possible object is - * {@link String } - * - */ - public String getHashAlgorithm() { - return hashAlgorithm; - } - - /** - * Sets the value of the hashAlgorithm property. - * - * @param value - * allowed object is - * {@link String } - * - */ - public void setHashAlgorithm(String value) { - this.hashAlgorithm = value; - } - - /** - * Gets the value of the optoutFlag property. - * - * @return - * possible object is - * {@link Integer } - * - */ - public Integer getOptoutFlag() { - return optoutFlag; - } - - /** - * Sets the value of the optoutFlag property. - * - * @param value - * allowed object is - * {@link Integer } - * - */ - public void setOptoutFlag(Integer value) { - this.optoutFlag = value; - } - - /** - * Gets the value of the iterations property. - * - * @return - * possible object is - * {@link Integer } - * - */ - public Integer getIterations() { - return iterations; - } - - /** - * Sets the value of the iterations property. - * - * @param value - * allowed object is - * {@link Integer } - * - */ - public void setIterations(Integer value) { - this.iterations = value; - } - - /** - * Gets the value of the salt property. - * - * @return - * possible object is - * {@link String } - * - */ - public String getSalt() { - return salt; - } - - /** - * Sets the value of the salt property. - * - * @param value - * allowed object is - * {@link String } - * - */ - public void setSalt(String value) { - this.salt = value; - } - -} diff --git a/Plugins/Mineplex.BungeeRotator/src/com/neustar/ultraservice/schema/v01/DsRecord.java b/Plugins/Mineplex.BungeeRotator/src/com/neustar/ultraservice/schema/v01/DsRecord.java deleted file mode 100644 index 7aeee171d..000000000 --- a/Plugins/Mineplex.BungeeRotator/src/com/neustar/ultraservice/schema/v01/DsRecord.java +++ /dev/null @@ -1,60 +0,0 @@ - -package com.neustar.ultraservice.schema.v01; - -import javax.xml.bind.annotation.XmlAccessType; -import javax.xml.bind.annotation.XmlAccessorType; -import javax.xml.bind.annotation.XmlAttribute; -import javax.xml.bind.annotation.XmlType; - - -/** - *

Java class for DsRecord complex type. - * - *

The following schema fragment specifies the expected content contained within this class. - * - *

- * <complexType name="DsRecord">
- *   <complexContent>
- *     <restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
- *       <sequence>
- *       </sequence>
- *       <attribute name="dsrecordtext" type="{http://www.w3.org/2001/XMLSchema}string" />
- *     </restriction>
- *   </complexContent>
- * </complexType>
- * 
- * - * - */ -@XmlAccessorType(XmlAccessType.FIELD) -@XmlType(name = "DsRecord") -public class DsRecord { - - @XmlAttribute(name = "dsrecordtext") - protected String dsrecordtext; - - /** - * Gets the value of the dsrecordtext property. - * - * @return - * possible object is - * {@link String } - * - */ - public String getDsrecordtext() { - return dsrecordtext; - } - - /** - * Sets the value of the dsrecordtext property. - * - * @param value - * allowed object is - * {@link String } - * - */ - public void setDsrecordtext(String value) { - this.dsrecordtext = value; - } - -} diff --git a/Plugins/Mineplex.BungeeRotator/src/com/neustar/ultraservice/schema/v01/DsRecordList.java b/Plugins/Mineplex.BungeeRotator/src/com/neustar/ultraservice/schema/v01/DsRecordList.java deleted file mode 100644 index 7dd68c290..000000000 --- a/Plugins/Mineplex.BungeeRotator/src/com/neustar/ultraservice/schema/v01/DsRecordList.java +++ /dev/null @@ -1,69 +0,0 @@ - -package com.neustar.ultraservice.schema.v01; - -import java.util.ArrayList; -import java.util.List; -import javax.xml.bind.annotation.XmlAccessType; -import javax.xml.bind.annotation.XmlAccessorType; -import javax.xml.bind.annotation.XmlElement; -import javax.xml.bind.annotation.XmlType; - - -/** - *

Java class for DsRecordList complex type. - * - *

The following schema fragment specifies the expected content contained within this class. - * - *

- * <complexType name="DsRecordList">
- *   <complexContent>
- *     <restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
- *       <sequence>
- *         <element name="DsRecord" type="{http://schema.ultraservice.neustar.com/v01/}DsRecord" maxOccurs="unbounded"/>
- *       </sequence>
- *     </restriction>
- *   </complexContent>
- * </complexType>
- * 
- * - * - */ -@XmlAccessorType(XmlAccessType.FIELD) -@XmlType(name = "DsRecordList", propOrder = { - "dsRecord" -}) -public class DsRecordList { - - @XmlElement(name = "DsRecord", required = true) - protected List dsRecord; - - /** - * Gets the value of the dsRecord property. - * - *

- * This accessor method returns a reference to the live list, - * not a snapshot. Therefore any modification you make to the - * returned list will be present inside the JAXB object. - * This is why there is not a set method for the dsRecord property. - * - *

- * For example, to add a new item, do as follows: - *

-     *    getDsRecord().add(newItem);
-     * 
- * - * - *

- * Objects of the following type(s) are allowed in the list - * {@link DsRecord } - * - * - */ - public List getDsRecord() { - if (dsRecord == null) { - dsRecord = new ArrayList(); - } - return this.dsRecord; - } - -} diff --git a/Plugins/Mineplex.BungeeRotator/src/com/neustar/ultraservice/schema/v01/EntryListParams.java b/Plugins/Mineplex.BungeeRotator/src/com/neustar/ultraservice/schema/v01/EntryListParams.java deleted file mode 100644 index 77a0d5798..000000000 --- a/Plugins/Mineplex.BungeeRotator/src/com/neustar/ultraservice/schema/v01/EntryListParams.java +++ /dev/null @@ -1,125 +0,0 @@ - -package com.neustar.ultraservice.schema.v01; - -import javax.xml.bind.annotation.XmlAccessType; -import javax.xml.bind.annotation.XmlAccessorType; -import javax.xml.bind.annotation.XmlType; - - -/** - *

Java class for EntryListParams complex type. - * - *

The following schema fragment specifies the expected content contained within this class. - * - *

- * <complexType name="EntryListParams">
- *   <complexContent>
- *     <restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
- *       <sequence>
- *         <element name="sortBy" type="{http://www.w3.org/2001/XMLSchema}string" minOccurs="0"/>
- *         <element name="sortOrder" type="{http://www.w3.org/2001/XMLSchema}string" minOccurs="0"/>
- *         <element name="offset" type="{http://www.w3.org/2001/XMLSchema}int"/>
- *         <element name="limit" type="{http://www.w3.org/2001/XMLSchema}int"/>
- *       </sequence>
- *     </restriction>
- *   </complexContent>
- * </complexType>
- * 
- * - * - */ -@XmlAccessorType(XmlAccessType.FIELD) -@XmlType(name = "EntryListParams", propOrder = { - "sortBy", - "sortOrder", - "offset", - "limit" -}) -public class EntryListParams { - - protected String sortBy; - protected String sortOrder; - protected int offset; - protected int limit; - - /** - * Gets the value of the sortBy property. - * - * @return - * possible object is - * {@link String } - * - */ - public String getSortBy() { - return sortBy; - } - - /** - * Sets the value of the sortBy property. - * - * @param value - * allowed object is - * {@link String } - * - */ - public void setSortBy(String value) { - this.sortBy = value; - } - - /** - * Gets the value of the sortOrder property. - * - * @return - * possible object is - * {@link String } - * - */ - public String getSortOrder() { - return sortOrder; - } - - /** - * Sets the value of the sortOrder property. - * - * @param value - * allowed object is - * {@link String } - * - */ - public void setSortOrder(String value) { - this.sortOrder = value; - } - - /** - * Gets the value of the offset property. - * - */ - public int getOffset() { - return offset; - } - - /** - * Sets the value of the offset property. - * - */ - public void setOffset(int value) { - this.offset = value; - } - - /** - * Gets the value of the limit property. - * - */ - public int getLimit() { - return limit; - } - - /** - * Sets the value of the limit property. - * - */ - public void setLimit(int value) { - this.limit = value; - } - -} diff --git a/Plugins/Mineplex.BungeeRotator/src/com/neustar/ultraservice/schema/v01/ExternalValues.java b/Plugins/Mineplex.BungeeRotator/src/com/neustar/ultraservice/schema/v01/ExternalValues.java deleted file mode 100644 index 1178979f3..000000000 --- a/Plugins/Mineplex.BungeeRotator/src/com/neustar/ultraservice/schema/v01/ExternalValues.java +++ /dev/null @@ -1,114 +0,0 @@ - -package com.neustar.ultraservice.schema.v01; - -import javax.xml.bind.annotation.XmlAccessType; -import javax.xml.bind.annotation.XmlAccessorType; -import javax.xml.bind.annotation.XmlAttribute; -import javax.xml.bind.annotation.XmlType; - - -/** - *

Java class for ExternalValues complex type. - * - *

The following schema fragment specifies the expected content contained within this class. - * - *

- * <complexType name="ExternalValues">
- *   <complexContent>
- *     <restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
- *       <sequence>
- *       </sequence>
- *       <attribute name="Default" type="{http://www.w3.org/2001/XMLSchema}string" />
- *       <attribute name="Min" type="{http://www.w3.org/2001/XMLSchema}string" />
- *       <attribute name="Max" type="{http://www.w3.org/2001/XMLSchema}string" />
- *     </restriction>
- *   </complexContent>
- * </complexType>
- * 
- * - * - */ -@XmlAccessorType(XmlAccessType.FIELD) -@XmlType(name = "ExternalValues") -public class ExternalValues { - - @XmlAttribute(name = "Default") - protected String _default; - @XmlAttribute(name = "Min") - protected String min; - @XmlAttribute(name = "Max") - protected String max; - - /** - * Gets the value of the default property. - * - * @return - * possible object is - * {@link String } - * - */ - public String getDefault() { - return _default; - } - - /** - * Sets the value of the default property. - * - * @param value - * allowed object is - * {@link String } - * - */ - public void setDefault(String value) { - this._default = value; - } - - /** - * Gets the value of the min property. - * - * @return - * possible object is - * {@link String } - * - */ - public String getMin() { - return min; - } - - /** - * Sets the value of the min property. - * - * @param value - * allowed object is - * {@link String } - * - */ - public void setMin(String value) { - this.min = value; - } - - /** - * Gets the value of the max property. - * - * @return - * possible object is - * {@link String } - * - */ - public String getMax() { - return max; - } - - /** - * Sets the value of the max property. - * - * @param value - * allowed object is - * {@link String } - * - */ - public void setMax(String value) { - this.max = value; - } - -} diff --git a/Plugins/Mineplex.BungeeRotator/src/com/neustar/ultraservice/schema/v01/FTPCriteria.java b/Plugins/Mineplex.BungeeRotator/src/com/neustar/ultraservice/schema/v01/FTPCriteria.java deleted file mode 100644 index f6e5a4583..000000000 --- a/Plugins/Mineplex.BungeeRotator/src/com/neustar/ultraservice/schema/v01/FTPCriteria.java +++ /dev/null @@ -1,156 +0,0 @@ - -package com.neustar.ultraservice.schema.v01; - -import javax.xml.bind.annotation.XmlAccessType; -import javax.xml.bind.annotation.XmlAccessorType; -import javax.xml.bind.annotation.XmlType; - - -/** - *

Java class for FTPCriteria complex type. - * - *

The following schema fragment specifies the expected content contained within this class. - * - *

- * <complexType name="FTPCriteria">
- *   <complexContent>
- *     <restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
- *       <all>
- *         <element name="runTime" type="{http://www.w3.org/2001/XMLSchema}int" minOccurs="0"/>
- *         <element name="runTimeAverage" type="{http://www.w3.org/2001/XMLSchema}int" minOccurs="0"/>
- *         <element name="connectTime" type="{http://www.w3.org/2001/XMLSchema}int"/>
- *         <element name="connectTimeAverage" type="{http://www.w3.org/2001/XMLSchema}int" minOccurs="0"/>
- *         <element name="search" type="{http://www.w3.org/2001/XMLSchema}string" minOccurs="0"/>
- *       </all>
- *     </restriction>
- *   </complexContent>
- * </complexType>
- * 
- * - * - */ -@XmlAccessorType(XmlAccessType.FIELD) -@XmlType(name = "FTPCriteria", propOrder = { - -}) -public class FTPCriteria { - - protected Integer runTime; - protected Integer runTimeAverage; - protected int connectTime; - protected Integer connectTimeAverage; - protected String search; - - /** - * Gets the value of the runTime property. - * - * @return - * possible object is - * {@link Integer } - * - */ - public Integer getRunTime() { - return runTime; - } - - /** - * Sets the value of the runTime property. - * - * @param value - * allowed object is - * {@link Integer } - * - */ - public void setRunTime(Integer value) { - this.runTime = value; - } - - /** - * Gets the value of the runTimeAverage property. - * - * @return - * possible object is - * {@link Integer } - * - */ - public Integer getRunTimeAverage() { - return runTimeAverage; - } - - /** - * Sets the value of the runTimeAverage property. - * - * @param value - * allowed object is - * {@link Integer } - * - */ - public void setRunTimeAverage(Integer value) { - this.runTimeAverage = value; - } - - /** - * Gets the value of the connectTime property. - * - */ - public int getConnectTime() { - return connectTime; - } - - /** - * Sets the value of the connectTime property. - * - */ - public void setConnectTime(int value) { - this.connectTime = value; - } - - /** - * Gets the value of the connectTimeAverage property. - * - * @return - * possible object is - * {@link Integer } - * - */ - public Integer getConnectTimeAverage() { - return connectTimeAverage; - } - - /** - * Sets the value of the connectTimeAverage property. - * - * @param value - * allowed object is - * {@link Integer } - * - */ - public void setConnectTimeAverage(Integer value) { - this.connectTimeAverage = value; - } - - /** - * Gets the value of the search property. - * - * @return - * possible object is - * {@link String } - * - */ - public String getSearch() { - return search; - } - - /** - * Sets the value of the search property. - * - * @param value - * allowed object is - * {@link String } - * - */ - public void setSearch(String value) { - this.search = value; - } - -} diff --git a/Plugins/Mineplex.BungeeRotator/src/com/neustar/ultraservice/schema/v01/FTPProbeData.java b/Plugins/Mineplex.BungeeRotator/src/com/neustar/ultraservice/schema/v01/FTPProbeData.java deleted file mode 100644 index c9f57d0c7..000000000 --- a/Plugins/Mineplex.BungeeRotator/src/com/neustar/ultraservice/schema/v01/FTPProbeData.java +++ /dev/null @@ -1,654 +0,0 @@ - -package com.neustar.ultraservice.schema.v01; - -import javax.xml.bind.annotation.XmlAccessType; -import javax.xml.bind.annotation.XmlAccessorType; -import javax.xml.bind.annotation.XmlAttribute; -import javax.xml.bind.annotation.XmlType; - - -/** - *

Java class for FTPProbeData complex type. - * - *

The following schema fragment specifies the expected content contained within this class. - * - *

- * <complexType name="FTPProbeData">
- *   <complexContent>
- *     <restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
- *       <sequence>
- *       </sequence>
- *       <attribute name="port" type="{http://www.w3.org/2001/XMLSchema}string" />
- *       <attribute name="passiveMode" type="{http://www.w3.org/2001/XMLSchema}string" />
- *       <attribute name="userName" type="{http://www.w3.org/2001/XMLSchema}string" />
- *       <attribute name="password" type="{http://www.w3.org/2001/XMLSchema}string" />
- *       <attribute name="pathToFile" type="{http://www.w3.org/2001/XMLSchema}string" />
- *       <attribute name="searchString" type="{http://www.w3.org/2001/XMLSchema}string" />
- *       <attribute name="connectTime" type="{http://www.w3.org/2001/XMLSchema}string" />
- *       <attribute name="runtime" type="{http://www.w3.org/2001/XMLSchema}string" />
- *       <attribute name="failSearchString" type="{http://www.w3.org/2001/XMLSchema}string" />
- *       <attribute name="criticalSearchString" type="{http://www.w3.org/2001/XMLSchema}string" />
- *       <attribute name="warningSearchString" type="{http://www.w3.org/2001/XMLSchema}string" />
- *       <attribute name="failAverageConnectTime" type="{http://www.w3.org/2001/XMLSchema}string" />
- *       <attribute name="criticalAverageConnectTime" type="{http://www.w3.org/2001/XMLSchema}string" />
- *       <attribute name="warningAverageConnectTime" type="{http://www.w3.org/2001/XMLSchema}string" />
- *       <attribute name="failAverageRunTime" type="{http://www.w3.org/2001/XMLSchema}string" />
- *       <attribute name="criticalAverageRunTime" type="{http://www.w3.org/2001/XMLSchema}string" />
- *       <attribute name="warningAverageRunTime" type="{http://www.w3.org/2001/XMLSchema}string" />
- *       <attribute name="failConnectTime" type="{http://www.w3.org/2001/XMLSchema}string" />
- *       <attribute name="criticalConnectTime" type="{http://www.w3.org/2001/XMLSchema}string" />
- *       <attribute name="warningConnectTime" type="{http://www.w3.org/2001/XMLSchema}string" />
- *       <attribute name="failRuntime" type="{http://www.w3.org/2001/XMLSchema}string" />
- *       <attribute name="criticalRuntime" type="{http://www.w3.org/2001/XMLSchema}string" />
- *       <attribute name="warningRuntime" type="{http://www.w3.org/2001/XMLSchema}string" />
- *     </restriction>
- *   </complexContent>
- * </complexType>
- * 
- * - * - */ -@XmlAccessorType(XmlAccessType.FIELD) -@XmlType(name = "FTPProbeData") -public class FTPProbeData { - - @XmlAttribute(name = "port") - protected String port; - @XmlAttribute(name = "passiveMode") - protected String passiveMode; - @XmlAttribute(name = "userName") - protected String userName; - @XmlAttribute(name = "password") - protected String password; - @XmlAttribute(name = "pathToFile") - protected String pathToFile; - @XmlAttribute(name = "searchString") - protected String searchString; - @XmlAttribute(name = "connectTime") - protected String connectTime; - @XmlAttribute(name = "runtime") - protected String runtime; - @XmlAttribute(name = "failSearchString") - protected String failSearchString; - @XmlAttribute(name = "criticalSearchString") - protected String criticalSearchString; - @XmlAttribute(name = "warningSearchString") - protected String warningSearchString; - @XmlAttribute(name = "failAverageConnectTime") - protected String failAverageConnectTime; - @XmlAttribute(name = "criticalAverageConnectTime") - protected String criticalAverageConnectTime; - @XmlAttribute(name = "warningAverageConnectTime") - protected String warningAverageConnectTime; - @XmlAttribute(name = "failAverageRunTime") - protected String failAverageRunTime; - @XmlAttribute(name = "criticalAverageRunTime") - protected String criticalAverageRunTime; - @XmlAttribute(name = "warningAverageRunTime") - protected String warningAverageRunTime; - @XmlAttribute(name = "failConnectTime") - protected String failConnectTime; - @XmlAttribute(name = "criticalConnectTime") - protected String criticalConnectTime; - @XmlAttribute(name = "warningConnectTime") - protected String warningConnectTime; - @XmlAttribute(name = "failRuntime") - protected String failRuntime; - @XmlAttribute(name = "criticalRuntime") - protected String criticalRuntime; - @XmlAttribute(name = "warningRuntime") - protected String warningRuntime; - - /** - * Gets the value of the port property. - * - * @return - * possible object is - * {@link String } - * - */ - public String getPort() { - return port; - } - - /** - * Sets the value of the port property. - * - * @param value - * allowed object is - * {@link String } - * - */ - public void setPort(String value) { - this.port = value; - } - - /** - * Gets the value of the passiveMode property. - * - * @return - * possible object is - * {@link String } - * - */ - public String getPassiveMode() { - return passiveMode; - } - - /** - * Sets the value of the passiveMode property. - * - * @param value - * allowed object is - * {@link String } - * - */ - public void setPassiveMode(String value) { - this.passiveMode = value; - } - - /** - * Gets the value of the userName property. - * - * @return - * possible object is - * {@link String } - * - */ - public String getUserName() { - return userName; - } - - /** - * Sets the value of the userName property. - * - * @param value - * allowed object is - * {@link String } - * - */ - public void setUserName(String value) { - this.userName = value; - } - - /** - * Gets the value of the password property. - * - * @return - * possible object is - * {@link String } - * - */ - public String getPassword() { - return password; - } - - /** - * Sets the value of the password property. - * - * @param value - * allowed object is - * {@link String } - * - */ - public void setPassword(String value) { - this.password = value; - } - - /** - * Gets the value of the pathToFile property. - * - * @return - * possible object is - * {@link String } - * - */ - public String getPathToFile() { - return pathToFile; - } - - /** - * Sets the value of the pathToFile property. - * - * @param value - * allowed object is - * {@link String } - * - */ - public void setPathToFile(String value) { - this.pathToFile = value; - } - - /** - * Gets the value of the searchString property. - * - * @return - * possible object is - * {@link String } - * - */ - public String getSearchString() { - return searchString; - } - - /** - * Sets the value of the searchString property. - * - * @param value - * allowed object is - * {@link String } - * - */ - public void setSearchString(String value) { - this.searchString = value; - } - - /** - * Gets the value of the connectTime property. - * - * @return - * possible object is - * {@link String } - * - */ - public String getConnectTime() { - return connectTime; - } - - /** - * Sets the value of the connectTime property. - * - * @param value - * allowed object is - * {@link String } - * - */ - public void setConnectTime(String value) { - this.connectTime = value; - } - - /** - * Gets the value of the runtime property. - * - * @return - * possible object is - * {@link String } - * - */ - public String getRuntime() { - return runtime; - } - - /** - * Sets the value of the runtime property. - * - * @param value - * allowed object is - * {@link String } - * - */ - public void setRuntime(String value) { - this.runtime = value; - } - - /** - * Gets the value of the failSearchString property. - * - * @return - * possible object is - * {@link String } - * - */ - public String getFailSearchString() { - return failSearchString; - } - - /** - * Sets the value of the failSearchString property. - * - * @param value - * allowed object is - * {@link String } - * - */ - public void setFailSearchString(String value) { - this.failSearchString = value; - } - - /** - * Gets the value of the criticalSearchString property. - * - * @return - * possible object is - * {@link String } - * - */ - public String getCriticalSearchString() { - return criticalSearchString; - } - - /** - * Sets the value of the criticalSearchString property. - * - * @param value - * allowed object is - * {@link String } - * - */ - public void setCriticalSearchString(String value) { - this.criticalSearchString = value; - } - - /** - * Gets the value of the warningSearchString property. - * - * @return - * possible object is - * {@link String } - * - */ - public String getWarningSearchString() { - return warningSearchString; - } - - /** - * Sets the value of the warningSearchString property. - * - * @param value - * allowed object is - * {@link String } - * - */ - public void setWarningSearchString(String value) { - this.warningSearchString = value; - } - - /** - * Gets the value of the failAverageConnectTime property. - * - * @return - * possible object is - * {@link String } - * - */ - public String getFailAverageConnectTime() { - return failAverageConnectTime; - } - - /** - * Sets the value of the failAverageConnectTime property. - * - * @param value - * allowed object is - * {@link String } - * - */ - public void setFailAverageConnectTime(String value) { - this.failAverageConnectTime = value; - } - - /** - * Gets the value of the criticalAverageConnectTime property. - * - * @return - * possible object is - * {@link String } - * - */ - public String getCriticalAverageConnectTime() { - return criticalAverageConnectTime; - } - - /** - * Sets the value of the criticalAverageConnectTime property. - * - * @param value - * allowed object is - * {@link String } - * - */ - public void setCriticalAverageConnectTime(String value) { - this.criticalAverageConnectTime = value; - } - - /** - * Gets the value of the warningAverageConnectTime property. - * - * @return - * possible object is - * {@link String } - * - */ - public String getWarningAverageConnectTime() { - return warningAverageConnectTime; - } - - /** - * Sets the value of the warningAverageConnectTime property. - * - * @param value - * allowed object is - * {@link String } - * - */ - public void setWarningAverageConnectTime(String value) { - this.warningAverageConnectTime = value; - } - - /** - * Gets the value of the failAverageRunTime property. - * - * @return - * possible object is - * {@link String } - * - */ - public String getFailAverageRunTime() { - return failAverageRunTime; - } - - /** - * Sets the value of the failAverageRunTime property. - * - * @param value - * allowed object is - * {@link String } - * - */ - public void setFailAverageRunTime(String value) { - this.failAverageRunTime = value; - } - - /** - * Gets the value of the criticalAverageRunTime property. - * - * @return - * possible object is - * {@link String } - * - */ - public String getCriticalAverageRunTime() { - return criticalAverageRunTime; - } - - /** - * Sets the value of the criticalAverageRunTime property. - * - * @param value - * allowed object is - * {@link String } - * - */ - public void setCriticalAverageRunTime(String value) { - this.criticalAverageRunTime = value; - } - - /** - * Gets the value of the warningAverageRunTime property. - * - * @return - * possible object is - * {@link String } - * - */ - public String getWarningAverageRunTime() { - return warningAverageRunTime; - } - - /** - * Sets the value of the warningAverageRunTime property. - * - * @param value - * allowed object is - * {@link String } - * - */ - public void setWarningAverageRunTime(String value) { - this.warningAverageRunTime = value; - } - - /** - * Gets the value of the failConnectTime property. - * - * @return - * possible object is - * {@link String } - * - */ - public String getFailConnectTime() { - return failConnectTime; - } - - /** - * Sets the value of the failConnectTime property. - * - * @param value - * allowed object is - * {@link String } - * - */ - public void setFailConnectTime(String value) { - this.failConnectTime = value; - } - - /** - * Gets the value of the criticalConnectTime property. - * - * @return - * possible object is - * {@link String } - * - */ - public String getCriticalConnectTime() { - return criticalConnectTime; - } - - /** - * Sets the value of the criticalConnectTime property. - * - * @param value - * allowed object is - * {@link String } - * - */ - public void setCriticalConnectTime(String value) { - this.criticalConnectTime = value; - } - - /** - * Gets the value of the warningConnectTime property. - * - * @return - * possible object is - * {@link String } - * - */ - public String getWarningConnectTime() { - return warningConnectTime; - } - - /** - * Sets the value of the warningConnectTime property. - * - * @param value - * allowed object is - * {@link String } - * - */ - public void setWarningConnectTime(String value) { - this.warningConnectTime = value; - } - - /** - * Gets the value of the failRuntime property. - * - * @return - * possible object is - * {@link String } - * - */ - public String getFailRuntime() { - return failRuntime; - } - - /** - * Sets the value of the failRuntime property. - * - * @param value - * allowed object is - * {@link String } - * - */ - public void setFailRuntime(String value) { - this.failRuntime = value; - } - - /** - * Gets the value of the criticalRuntime property. - * - * @return - * possible object is - * {@link String } - * - */ - public String getCriticalRuntime() { - return criticalRuntime; - } - - /** - * Sets the value of the criticalRuntime property. - * - * @param value - * allowed object is - * {@link String } - * - */ - public void setCriticalRuntime(String value) { - this.criticalRuntime = value; - } - - /** - * Gets the value of the warningRuntime property. - * - * @return - * possible object is - * {@link String } - * - */ - public String getWarningRuntime() { - return warningRuntime; - } - - /** - * Sets the value of the warningRuntime property. - * - * @param value - * allowed object is - * {@link String } - * - */ - public void setWarningRuntime(String value) { - this.warningRuntime = value; - } - -} diff --git a/Plugins/Mineplex.BungeeRotator/src/com/neustar/ultraservice/schema/v01/FTPTransaction.java b/Plugins/Mineplex.BungeeRotator/src/com/neustar/ultraservice/schema/v01/FTPTransaction.java deleted file mode 100644 index b39e17c03..000000000 --- a/Plugins/Mineplex.BungeeRotator/src/com/neustar/ultraservice/schema/v01/FTPTransaction.java +++ /dev/null @@ -1,234 +0,0 @@ - -package com.neustar.ultraservice.schema.v01; - -import javax.xml.bind.annotation.XmlAccessType; -import javax.xml.bind.annotation.XmlAccessorType; -import javax.xml.bind.annotation.XmlAttribute; -import javax.xml.bind.annotation.XmlType; - - -/** - *

Java class for FTPTransaction complex type. - * - *

The following schema fragment specifies the expected content contained within this class. - * - *

- * <complexType name="FTPTransaction">
- *   <complexContent>
- *     <restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
- *       <sequence>
- *         <element name="warningCriteria" type="{http://schema.ultraservice.neustar.com/v01/}FTPCriteria" minOccurs="0"/>
- *         <element name="criticalCriteria" type="{http://schema.ultraservice.neustar.com/v01/}FTPCriteria" minOccurs="0"/>
- *         <element name="failCriteria" type="{http://schema.ultraservice.neustar.com/v01/}FTPCriteria" minOccurs="0"/>
- *       </sequence>
- *       <attribute name="port" use="required" type="{http://www.w3.org/2001/XMLSchema}int" />
- *       <attribute name="passive" use="required" type="{http://www.w3.org/2001/XMLSchema}boolean" />
- *       <attribute name="username" type="{http://www.w3.org/2001/XMLSchema}string" />
- *       <attribute name="password" type="{http://www.w3.org/2001/XMLSchema}string" />
- *       <attribute name="path" use="required" type="{http://www.w3.org/2001/XMLSchema}string" />
- *     </restriction>
- *   </complexContent>
- * </complexType>
- * 
- * - * - */ -@XmlAccessorType(XmlAccessType.FIELD) -@XmlType(name = "FTPTransaction", propOrder = { - "warningCriteria", - "criticalCriteria", - "failCriteria" -}) -public class FTPTransaction { - - protected FTPCriteria warningCriteria; - protected FTPCriteria criticalCriteria; - protected FTPCriteria failCriteria; - @XmlAttribute(name = "port", required = true) - protected int port; - @XmlAttribute(name = "passive", required = true) - protected boolean passive; - @XmlAttribute(name = "username") - protected String username; - @XmlAttribute(name = "password") - protected String password; - @XmlAttribute(name = "path", required = true) - protected String path; - - /** - * Gets the value of the warningCriteria property. - * - * @return - * possible object is - * {@link FTPCriteria } - * - */ - public FTPCriteria getWarningCriteria() { - return warningCriteria; - } - - /** - * Sets the value of the warningCriteria property. - * - * @param value - * allowed object is - * {@link FTPCriteria } - * - */ - public void setWarningCriteria(FTPCriteria value) { - this.warningCriteria = value; - } - - /** - * Gets the value of the criticalCriteria property. - * - * @return - * possible object is - * {@link FTPCriteria } - * - */ - public FTPCriteria getCriticalCriteria() { - return criticalCriteria; - } - - /** - * Sets the value of the criticalCriteria property. - * - * @param value - * allowed object is - * {@link FTPCriteria } - * - */ - public void setCriticalCriteria(FTPCriteria value) { - this.criticalCriteria = value; - } - - /** - * Gets the value of the failCriteria property. - * - * @return - * possible object is - * {@link FTPCriteria } - * - */ - public FTPCriteria getFailCriteria() { - return failCriteria; - } - - /** - * Sets the value of the failCriteria property. - * - * @param value - * allowed object is - * {@link FTPCriteria } - * - */ - public void setFailCriteria(FTPCriteria value) { - this.failCriteria = value; - } - - /** - * Gets the value of the port property. - * - */ - public int getPort() { - return port; - } - - /** - * Sets the value of the port property. - * - */ - public void setPort(int value) { - this.port = value; - } - - /** - * Gets the value of the passive property. - * - */ - public boolean isPassive() { - return passive; - } - - /** - * Sets the value of the passive property. - * - */ - public void setPassive(boolean value) { - this.passive = value; - } - - /** - * Gets the value of the username property. - * - * @return - * possible object is - * {@link String } - * - */ - public String getUsername() { - return username; - } - - /** - * Sets the value of the username property. - * - * @param value - * allowed object is - * {@link String } - * - */ - public void setUsername(String value) { - this.username = value; - } - - /** - * Gets the value of the password property. - * - * @return - * possible object is - * {@link String } - * - */ - public String getPassword() { - return password; - } - - /** - * Sets the value of the password property. - * - * @param value - * allowed object is - * {@link String } - * - */ - public void setPassword(String value) { - this.password = value; - } - - /** - * Gets the value of the path property. - * - * @return - * possible object is - * {@link String } - * - */ - public String getPath() { - return path; - } - - /** - * Sets the value of the path property. - * - * @param value - * allowed object is - * {@link String } - * - */ - public void setPath(String value) { - this.path = value; - } - -} diff --git a/Plugins/Mineplex.BungeeRotator/src/com/neustar/ultraservice/schema/v01/FailoverMonitor.java b/Plugins/Mineplex.BungeeRotator/src/com/neustar/ultraservice/schema/v01/FailoverMonitor.java deleted file mode 100644 index befdb46a4..000000000 --- a/Plugins/Mineplex.BungeeRotator/src/com/neustar/ultraservice/schema/v01/FailoverMonitor.java +++ /dev/null @@ -1,144 +0,0 @@ - -package com.neustar.ultraservice.schema.v01; - -import javax.xml.bind.annotation.XmlAccessType; -import javax.xml.bind.annotation.XmlAccessorType; -import javax.xml.bind.annotation.XmlElement; -import javax.xml.bind.annotation.XmlType; - - -/** - *

Java class for FailoverMonitor complex type. - * - *

The following schema fragment specifies the expected content contained within this class. - * - *

- * <complexType name="FailoverMonitor">
- *   <complexContent>
- *     <restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
- *       <sequence>
- *         <element name="method" type="{http://schema.ultraservice.neustar.com/v01/}failoverMonitorMethod"/>
- *         <element name="url" type="{http://www.w3.org/2001/XMLSchema}string"/>
- *         <element name="transmittedData" type="{http://www.w3.org/2001/XMLSchema}string" minOccurs="0"/>
- *         <element name="searchString" type="{http://www.w3.org/2001/XMLSchema}string" minOccurs="0"/>
- *       </sequence>
- *     </restriction>
- *   </complexContent>
- * </complexType>
- * 
- * - * - */ -@XmlAccessorType(XmlAccessType.FIELD) -@XmlType(name = "FailoverMonitor", propOrder = { - "method", - "url", - "transmittedData", - "searchString" -}) -public class FailoverMonitor { - - @XmlElement(required = true) - protected FailoverMonitorMethod method; - @XmlElement(required = true) - protected String url; - protected String transmittedData; - protected String searchString; - - /** - * Gets the value of the method property. - * - * @return - * possible object is - * {@link FailoverMonitorMethod } - * - */ - public FailoverMonitorMethod getMethod() { - return method; - } - - /** - * Sets the value of the method property. - * - * @param value - * allowed object is - * {@link FailoverMonitorMethod } - * - */ - public void setMethod(FailoverMonitorMethod value) { - this.method = value; - } - - /** - * Gets the value of the url property. - * - * @return - * possible object is - * {@link String } - * - */ - public String getUrl() { - return url; - } - - /** - * Sets the value of the url property. - * - * @param value - * allowed object is - * {@link String } - * - */ - public void setUrl(String value) { - this.url = value; - } - - /** - * Gets the value of the transmittedData property. - * - * @return - * possible object is - * {@link String } - * - */ - public String getTransmittedData() { - return transmittedData; - } - - /** - * Sets the value of the transmittedData property. - * - * @param value - * allowed object is - * {@link String } - * - */ - public void setTransmittedData(String value) { - this.transmittedData = value; - } - - /** - * Gets the value of the searchString property. - * - * @return - * possible object is - * {@link String } - * - */ - public String getSearchString() { - return searchString; - } - - /** - * Sets the value of the searchString property. - * - * @param value - * allowed object is - * {@link String } - * - */ - public void setSearchString(String value) { - this.searchString = value; - } - -} diff --git a/Plugins/Mineplex.BungeeRotator/src/com/neustar/ultraservice/schema/v01/FailoverMonitorMethod.java b/Plugins/Mineplex.BungeeRotator/src/com/neustar/ultraservice/schema/v01/FailoverMonitorMethod.java deleted file mode 100644 index e0b842ead..000000000 --- a/Plugins/Mineplex.BungeeRotator/src/com/neustar/ultraservice/schema/v01/FailoverMonitorMethod.java +++ /dev/null @@ -1,38 +0,0 @@ - -package com.neustar.ultraservice.schema.v01; - -import javax.xml.bind.annotation.XmlEnum; -import javax.xml.bind.annotation.XmlType; - - -/** - *

Java class for failoverMonitorMethod. - * - *

The following schema fragment specifies the expected content contained within this class. - *

- *

- * <simpleType name="failoverMonitorMethod">
- *   <restriction base="{http://www.w3.org/2001/XMLSchema}string">
- *     <enumeration value="GET"/>
- *     <enumeration value="POST"/>
- *   </restriction>
- * </simpleType>
- * 
- * - */ -@XmlType(name = "failoverMonitorMethod") -@XmlEnum -public enum FailoverMonitorMethod { - - GET, - POST; - - public String value() { - return name(); - } - - public static FailoverMonitorMethod fromValue(String v) { - return valueOf(v); - } - -} diff --git a/Plugins/Mineplex.BungeeRotator/src/com/neustar/ultraservice/schema/v01/FailoverMonitorUpdate.java b/Plugins/Mineplex.BungeeRotator/src/com/neustar/ultraservice/schema/v01/FailoverMonitorUpdate.java deleted file mode 100644 index bc9c24d21..000000000 --- a/Plugins/Mineplex.BungeeRotator/src/com/neustar/ultraservice/schema/v01/FailoverMonitorUpdate.java +++ /dev/null @@ -1,141 +0,0 @@ - -package com.neustar.ultraservice.schema.v01; - -import javax.xml.bind.annotation.XmlAccessType; -import javax.xml.bind.annotation.XmlAccessorType; -import javax.xml.bind.annotation.XmlType; - - -/** - *

Java class for FailoverMonitorUpdate complex type. - * - *

The following schema fragment specifies the expected content contained within this class. - * - *

- * <complexType name="FailoverMonitorUpdate">
- *   <complexContent>
- *     <restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
- *       <sequence>
- *         <element name="method" type="{http://schema.ultraservice.neustar.com/v01/}failoverMonitorMethod" minOccurs="0"/>
- *         <element name="url" type="{http://www.w3.org/2001/XMLSchema}string" minOccurs="0"/>
- *         <element name="transmittedData" type="{http://www.w3.org/2001/XMLSchema}string" minOccurs="0"/>
- *         <element name="searchString" type="{http://www.w3.org/2001/XMLSchema}string" minOccurs="0"/>
- *       </sequence>
- *     </restriction>
- *   </complexContent>
- * </complexType>
- * 
- * - * - */ -@XmlAccessorType(XmlAccessType.FIELD) -@XmlType(name = "FailoverMonitorUpdate", propOrder = { - "method", - "url", - "transmittedData", - "searchString" -}) -public class FailoverMonitorUpdate { - - protected FailoverMonitorMethod method; - protected String url; - protected String transmittedData; - protected String searchString; - - /** - * Gets the value of the method property. - * - * @return - * possible object is - * {@link FailoverMonitorMethod } - * - */ - public FailoverMonitorMethod getMethod() { - return method; - } - - /** - * Sets the value of the method property. - * - * @param value - * allowed object is - * {@link FailoverMonitorMethod } - * - */ - public void setMethod(FailoverMonitorMethod value) { - this.method = value; - } - - /** - * Gets the value of the url property. - * - * @return - * possible object is - * {@link String } - * - */ - public String getUrl() { - return url; - } - - /** - * Sets the value of the url property. - * - * @param value - * allowed object is - * {@link String } - * - */ - public void setUrl(String value) { - this.url = value; - } - - /** - * Gets the value of the transmittedData property. - * - * @return - * possible object is - * {@link String } - * - */ - public String getTransmittedData() { - return transmittedData; - } - - /** - * Sets the value of the transmittedData property. - * - * @param value - * allowed object is - * {@link String } - * - */ - public void setTransmittedData(String value) { - this.transmittedData = value; - } - - /** - * Gets the value of the searchString property. - * - * @return - * possible object is - * {@link String } - * - */ - public String getSearchString() { - return searchString; - } - - /** - * Sets the value of the searchString property. - * - * @param value - * allowed object is - * {@link String } - * - */ - public void setSearchString(String value) { - this.searchString = value; - } - -} diff --git a/Plugins/Mineplex.BungeeRotator/src/com/neustar/ultraservice/schema/v01/FailoverRecord.java b/Plugins/Mineplex.BungeeRotator/src/com/neustar/ultraservice/schema/v01/FailoverRecord.java deleted file mode 100644 index a34f1baf5..000000000 --- a/Plugins/Mineplex.BungeeRotator/src/com/neustar/ultraservice/schema/v01/FailoverRecord.java +++ /dev/null @@ -1,89 +0,0 @@ - -package com.neustar.ultraservice.schema.v01; - -import javax.xml.bind.annotation.XmlAccessType; -import javax.xml.bind.annotation.XmlAccessorType; -import javax.xml.bind.annotation.XmlElement; -import javax.xml.bind.annotation.XmlType; - - -/** - *

Java class for FailoverRecord complex type. - * - *

The following schema fragment specifies the expected content contained within this class. - * - *

- * <complexType name="FailoverRecord">
- *   <complexContent>
- *     <restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
- *       <sequence>
- *         <element name="recordValue" type="{http://www.w3.org/2001/XMLSchema}string"/>
- *         <element name="description" type="{http://www.w3.org/2001/XMLSchema}string" minOccurs="0"/>
- *       </sequence>
- *     </restriction>
- *   </complexContent>
- * </complexType>
- * 
- * - * - */ -@XmlAccessorType(XmlAccessType.FIELD) -@XmlType(name = "FailoverRecord", propOrder = { - "recordValue", - "description" -}) -public class FailoverRecord { - - @XmlElement(required = true) - protected String recordValue; - protected String description; - - /** - * Gets the value of the recordValue property. - * - * @return - * possible object is - * {@link String } - * - */ - public String getRecordValue() { - return recordValue; - } - - /** - * Sets the value of the recordValue property. - * - * @param value - * allowed object is - * {@link String } - * - */ - public void setRecordValue(String value) { - this.recordValue = value; - } - - /** - * Gets the value of the description property. - * - * @return - * possible object is - * {@link String } - * - */ - public String getDescription() { - return description; - } - - /** - * Sets the value of the description property. - * - * @param value - * allowed object is - * {@link String } - * - */ - public void setDescription(String value) { - this.description = value; - } - -} diff --git a/Plugins/Mineplex.BungeeRotator/src/com/neustar/ultraservice/schema/v01/FailoverRecordUpdate.java b/Plugins/Mineplex.BungeeRotator/src/com/neustar/ultraservice/schema/v01/FailoverRecordUpdate.java deleted file mode 100644 index 90e9ab531..000000000 --- a/Plugins/Mineplex.BungeeRotator/src/com/neustar/ultraservice/schema/v01/FailoverRecordUpdate.java +++ /dev/null @@ -1,87 +0,0 @@ - -package com.neustar.ultraservice.schema.v01; - -import javax.xml.bind.annotation.XmlAccessType; -import javax.xml.bind.annotation.XmlAccessorType; -import javax.xml.bind.annotation.XmlType; - - -/** - *

Java class for FailoverRecordUpdate complex type. - * - *

The following schema fragment specifies the expected content contained within this class. - * - *

- * <complexType name="FailoverRecordUpdate">
- *   <complexContent>
- *     <restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
- *       <sequence>
- *         <element name="recordValue" type="{http://www.w3.org/2001/XMLSchema}string" minOccurs="0"/>
- *         <element name="description" type="{http://www.w3.org/2001/XMLSchema}string" minOccurs="0"/>
- *       </sequence>
- *     </restriction>
- *   </complexContent>
- * </complexType>
- * 
- * - * - */ -@XmlAccessorType(XmlAccessType.FIELD) -@XmlType(name = "FailoverRecordUpdate", propOrder = { - "recordValue", - "description" -}) -public class FailoverRecordUpdate { - - protected String recordValue; - protected String description; - - /** - * Gets the value of the recordValue property. - * - * @return - * possible object is - * {@link String } - * - */ - public String getRecordValue() { - return recordValue; - } - - /** - * Sets the value of the recordValue property. - * - * @param value - * allowed object is - * {@link String } - * - */ - public void setRecordValue(String value) { - this.recordValue = value; - } - - /** - * Gets the value of the description property. - * - * @return - * possible object is - * {@link String } - * - */ - public String getDescription() { - return description; - } - - /** - * Sets the value of the description property. - * - * @param value - * allowed object is - * {@link String } - * - */ - public void setDescription(String value) { - this.description = value; - } - -} diff --git a/Plugins/Mineplex.BungeeRotator/src/com/neustar/ultraservice/schema/v01/ForcedState.java b/Plugins/Mineplex.BungeeRotator/src/com/neustar/ultraservice/schema/v01/ForcedState.java deleted file mode 100644 index 7a43619a3..000000000 --- a/Plugins/Mineplex.BungeeRotator/src/com/neustar/ultraservice/schema/v01/ForcedState.java +++ /dev/null @@ -1,40 +0,0 @@ - -package com.neustar.ultraservice.schema.v01; - -import javax.xml.bind.annotation.XmlEnum; -import javax.xml.bind.annotation.XmlType; - - -/** - *

Java class for ForcedState. - * - *

The following schema fragment specifies the expected content contained within this class. - *

- *

- * <simpleType name="ForcedState">
- *   <restriction base="{http://www.w3.org/2001/XMLSchema}string">
- *     <enumeration value="FORCED_ACTIVE"/>
- *     <enumeration value="FORCED_INACTIVE"/>
- *     <enumeration value="NOT_FORCED"/>
- *   </restriction>
- * </simpleType>
- * 
- * - */ -@XmlType(name = "ForcedState") -@XmlEnum -public enum ForcedState { - - FORCED_ACTIVE, - FORCED_INACTIVE, - NOT_FORCED; - - public String value() { - return name(); - } - - public static ForcedState fromValue(String v) { - return valueOf(v); - } - -} diff --git a/Plugins/Mineplex.BungeeRotator/src/com/neustar/ultraservice/schema/v01/GeneralNotificationStatusData.java b/Plugins/Mineplex.BungeeRotator/src/com/neustar/ultraservice/schema/v01/GeneralNotificationStatusData.java deleted file mode 100644 index 650e1609f..000000000 --- a/Plugins/Mineplex.BungeeRotator/src/com/neustar/ultraservice/schema/v01/GeneralNotificationStatusData.java +++ /dev/null @@ -1,87 +0,0 @@ - -package com.neustar.ultraservice.schema.v01; - -import javax.xml.bind.annotation.XmlAccessType; -import javax.xml.bind.annotation.XmlAccessorType; -import javax.xml.bind.annotation.XmlAttribute; -import javax.xml.bind.annotation.XmlType; - - -/** - *

Java class for GeneralNotificationStatusData complex type. - * - *

The following schema fragment specifies the expected content contained within this class. - * - *

- * <complexType name="GeneralNotificationStatusData">
- *   <complexContent>
- *     <restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
- *       <sequence>
- *       </sequence>
- *       <attribute name="notificationType" type="{http://www.w3.org/2001/XMLSchema}string" />
- *       <attribute name="notificationEnabled" type="{http://www.w3.org/2001/XMLSchema}string" />
- *     </restriction>
- *   </complexContent>
- * </complexType>
- * 
- * - * - */ -@XmlAccessorType(XmlAccessType.FIELD) -@XmlType(name = "GeneralNotificationStatusData") -public class GeneralNotificationStatusData { - - @XmlAttribute(name = "notificationType") - protected String notificationType; - @XmlAttribute(name = "notificationEnabled") - protected String notificationEnabled; - - /** - * Gets the value of the notificationType property. - * - * @return - * possible object is - * {@link String } - * - */ - public String getNotificationType() { - return notificationType; - } - - /** - * Sets the value of the notificationType property. - * - * @param value - * allowed object is - * {@link String } - * - */ - public void setNotificationType(String value) { - this.notificationType = value; - } - - /** - * Gets the value of the notificationEnabled property. - * - * @return - * possible object is - * {@link String } - * - */ - public String getNotificationEnabled() { - return notificationEnabled; - } - - /** - * Sets the value of the notificationEnabled property. - * - * @param value - * allowed object is - * {@link String } - * - */ - public void setNotificationEnabled(String value) { - this.notificationEnabled = value; - } - -} diff --git a/Plugins/Mineplex.BungeeRotator/src/com/neustar/ultraservice/schema/v01/GeneralNotificationStatusList.java b/Plugins/Mineplex.BungeeRotator/src/com/neustar/ultraservice/schema/v01/GeneralNotificationStatusList.java deleted file mode 100644 index 4f1c4096c..000000000 --- a/Plugins/Mineplex.BungeeRotator/src/com/neustar/ultraservice/schema/v01/GeneralNotificationStatusList.java +++ /dev/null @@ -1,69 +0,0 @@ - -package com.neustar.ultraservice.schema.v01; - -import java.util.ArrayList; -import java.util.List; -import javax.xml.bind.annotation.XmlAccessType; -import javax.xml.bind.annotation.XmlAccessorType; -import javax.xml.bind.annotation.XmlElement; -import javax.xml.bind.annotation.XmlType; - - -/** - *

Java class for GeneralNotificationStatusList complex type. - * - *

The following schema fragment specifies the expected content contained within this class. - * - *

- * <complexType name="GeneralNotificationStatusList">
- *   <complexContent>
- *     <restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
- *       <sequence>
- *         <element name="generalNotificationStatusData" type="{http://schema.ultraservice.neustar.com/v01/}GeneralNotificationStatusData" maxOccurs="unbounded"/>
- *       </sequence>
- *     </restriction>
- *   </complexContent>
- * </complexType>
- * 
- * - * - */ -@XmlAccessorType(XmlAccessType.FIELD) -@XmlType(name = "GeneralNotificationStatusList", propOrder = { - "generalNotificationStatusData" -}) -public class GeneralNotificationStatusList { - - @XmlElement(required = true) - protected List generalNotificationStatusData; - - /** - * Gets the value of the generalNotificationStatusData property. - * - *

- * This accessor method returns a reference to the live list, - * not a snapshot. Therefore any modification you make to the - * returned list will be present inside the JAXB object. - * This is why there is not a set method for the generalNotificationStatusData property. - * - *

- * For example, to add a new item, do as follows: - *

-     *    getGeneralNotificationStatusData().add(newItem);
-     * 
- * - * - *

- * Objects of the following type(s) are allowed in the list - * {@link GeneralNotificationStatusData } - * - * - */ - public List getGeneralNotificationStatusData() { - if (generalNotificationStatusData == null) { - generalNotificationStatusData = new ArrayList(); - } - return this.generalNotificationStatusData; - } - -} diff --git a/Plugins/Mineplex.BungeeRotator/src/com/neustar/ultraservice/schema/v01/GeneralZoneProperties.java b/Plugins/Mineplex.BungeeRotator/src/com/neustar/ultraservice/schema/v01/GeneralZoneProperties.java deleted file mode 100644 index 3553c43e8..000000000 --- a/Plugins/Mineplex.BungeeRotator/src/com/neustar/ultraservice/schema/v01/GeneralZoneProperties.java +++ /dev/null @@ -1,133 +0,0 @@ - -package com.neustar.ultraservice.schema.v01; - -import javax.xml.bind.annotation.XmlAccessType; -import javax.xml.bind.annotation.XmlAccessorType; -import javax.xml.bind.annotation.XmlAttribute; -import javax.xml.bind.annotation.XmlType; - - -/** - *

Java class for GeneralZoneProperties complex type. - * - *

The following schema fragment specifies the expected content contained within this class. - * - *

- * <complexType name="GeneralZoneProperties">
- *   <complexContent>
- *     <restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
- *       <sequence>
- *       </sequence>
- *       <attribute name="resourceRecordCount" use="required" type="{http://www.w3.org/2001/XMLSchema}long" />
- *       <attribute name="name" type="{http://www.w3.org/2001/XMLSchema}string" />
- *       <attribute name="zoneType" type="{http://www.w3.org/2001/XMLSchema}string" />
- *       <attribute name="modified" type="{http://www.w3.org/2001/XMLSchema}string" />
- *     </restriction>
- *   </complexContent>
- * </complexType>
- * 
- * - * - */ -@XmlAccessorType(XmlAccessType.FIELD) -@XmlType(name = "GeneralZoneProperties") -public class GeneralZoneProperties { - - @XmlAttribute(name = "resourceRecordCount", required = true) - protected long resourceRecordCount; - @XmlAttribute(name = "name") - protected String name; - @XmlAttribute(name = "zoneType") - protected String zoneType; - @XmlAttribute(name = "modified") - protected String modified; - - /** - * Gets the value of the resourceRecordCount property. - * - */ - public long getResourceRecordCount() { - return resourceRecordCount; - } - - /** - * Sets the value of the resourceRecordCount property. - * - */ - public void setResourceRecordCount(long value) { - this.resourceRecordCount = value; - } - - /** - * Gets the value of the name property. - * - * @return - * possible object is - * {@link String } - * - */ - public String getName() { - return name; - } - - /** - * Sets the value of the name property. - * - * @param value - * allowed object is - * {@link String } - * - */ - public void setName(String value) { - this.name = value; - } - - /** - * Gets the value of the zoneType property. - * - * @return - * possible object is - * {@link String } - * - */ - public String getZoneType() { - return zoneType; - } - - /** - * Sets the value of the zoneType property. - * - * @param value - * allowed object is - * {@link String } - * - */ - public void setZoneType(String value) { - this.zoneType = value; - } - - /** - * Gets the value of the modified property. - * - * @return - * possible object is - * {@link String } - * - */ - public String getModified() { - return modified; - } - - /** - * Sets the value of the modified property. - * - * @param value - * allowed object is - * {@link String } - * - */ - public void setModified(String value) { - this.modified = value; - } - -} diff --git a/Plugins/Mineplex.BungeeRotator/src/com/neustar/ultraservice/schema/v01/GeolocationGroupData.java b/Plugins/Mineplex.BungeeRotator/src/com/neustar/ultraservice/schema/v01/GeolocationGroupData.java deleted file mode 100644 index c8c364794..000000000 --- a/Plugins/Mineplex.BungeeRotator/src/com/neustar/ultraservice/schema/v01/GeolocationGroupData.java +++ /dev/null @@ -1,90 +0,0 @@ - -package com.neustar.ultraservice.schema.v01; - -import javax.xml.bind.annotation.XmlAccessType; -import javax.xml.bind.annotation.XmlAccessorType; -import javax.xml.bind.annotation.XmlElement; -import javax.xml.bind.annotation.XmlType; - - -/** - *

Java class for GeolocationGroupData complex type. - * - *

The following schema fragment specifies the expected content contained within this class. - * - *

- * <complexType name="GeolocationGroupData">
- *   <complexContent>
- *     <restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
- *       <sequence>
- *         <element name="GroupData" type="{http://schema.ultraservice.neustar.com/v01/}GroupData"/>
- *         <element name="GeolocationGroupDetails" type="{http://schema.ultraservice.neustar.com/v01/}GeolocationGroupDetails"/>
- *       </sequence>
- *     </restriction>
- *   </complexContent>
- * </complexType>
- * 
- * - * - */ -@XmlAccessorType(XmlAccessType.FIELD) -@XmlType(name = "GeolocationGroupData", propOrder = { - "groupData", - "geolocationGroupDetails" -}) -public class GeolocationGroupData { - - @XmlElement(name = "GroupData", required = true) - protected GroupData groupData; - @XmlElement(name = "GeolocationGroupDetails", required = true, nillable = true) - protected GeolocationGroupDetails geolocationGroupDetails; - - /** - * Gets the value of the groupData property. - * - * @return - * possible object is - * {@link GroupData } - * - */ - public GroupData getGroupData() { - return groupData; - } - - /** - * Sets the value of the groupData property. - * - * @param value - * allowed object is - * {@link GroupData } - * - */ - public void setGroupData(GroupData value) { - this.groupData = value; - } - - /** - * Gets the value of the geolocationGroupDetails property. - * - * @return - * possible object is - * {@link GeolocationGroupDetails } - * - */ - public GeolocationGroupDetails getGeolocationGroupDetails() { - return geolocationGroupDetails; - } - - /** - * Sets the value of the geolocationGroupDetails property. - * - * @param value - * allowed object is - * {@link GeolocationGroupDetails } - * - */ - public void setGeolocationGroupDetails(GeolocationGroupDetails value) { - this.geolocationGroupDetails = value; - } - -} diff --git a/Plugins/Mineplex.BungeeRotator/src/com/neustar/ultraservice/schema/v01/GeolocationGroupDefinitionData.java b/Plugins/Mineplex.BungeeRotator/src/com/neustar/ultraservice/schema/v01/GeolocationGroupDefinitionData.java deleted file mode 100644 index 21b816893..000000000 --- a/Plugins/Mineplex.BungeeRotator/src/com/neustar/ultraservice/schema/v01/GeolocationGroupDefinitionData.java +++ /dev/null @@ -1,87 +0,0 @@ - -package com.neustar.ultraservice.schema.v01; - -import javax.xml.bind.annotation.XmlAccessType; -import javax.xml.bind.annotation.XmlAccessorType; -import javax.xml.bind.annotation.XmlAttribute; -import javax.xml.bind.annotation.XmlType; - - -/** - *

Java class for GeolocationGroupDefinitionData complex type. - * - *

The following schema fragment specifies the expected content contained within this class. - * - *

- * <complexType name="GeolocationGroupDefinitionData">
- *   <complexContent>
- *     <restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
- *       <sequence>
- *       </sequence>
- *       <attribute name="regionName" use="required" type="{http://www.w3.org/2001/XMLSchema}string" />
- *       <attribute name="territoryNames" use="required" type="{http://www.w3.org/2001/XMLSchema}string" />
- *     </restriction>
- *   </complexContent>
- * </complexType>
- * 
- * - * - */ -@XmlAccessorType(XmlAccessType.FIELD) -@XmlType(name = "GeolocationGroupDefinitionData") -public class GeolocationGroupDefinitionData { - - @XmlAttribute(name = "regionName", required = true) - protected String regionName; - @XmlAttribute(name = "territoryNames", required = true) - protected String territoryNames; - - /** - * Gets the value of the regionName property. - * - * @return - * possible object is - * {@link String } - * - */ - public String getRegionName() { - return regionName; - } - - /** - * Sets the value of the regionName property. - * - * @param value - * allowed object is - * {@link String } - * - */ - public void setRegionName(String value) { - this.regionName = value; - } - - /** - * Gets the value of the territoryNames property. - * - * @return - * possible object is - * {@link String } - * - */ - public String getTerritoryNames() { - return territoryNames; - } - - /** - * Sets the value of the territoryNames property. - * - * @param value - * allowed object is - * {@link String } - * - */ - public void setTerritoryNames(String value) { - this.territoryNames = value; - } - -} diff --git a/Plugins/Mineplex.BungeeRotator/src/com/neustar/ultraservice/schema/v01/GeolocationGroupDetails.java b/Plugins/Mineplex.BungeeRotator/src/com/neustar/ultraservice/schema/v01/GeolocationGroupDetails.java deleted file mode 100644 index 344c47f31..000000000 --- a/Plugins/Mineplex.BungeeRotator/src/com/neustar/ultraservice/schema/v01/GeolocationGroupDetails.java +++ /dev/null @@ -1,128 +0,0 @@ - -package com.neustar.ultraservice.schema.v01; - -import java.util.ArrayList; -import java.util.List; -import javax.xml.bind.annotation.XmlAccessType; -import javax.xml.bind.annotation.XmlAccessorType; -import javax.xml.bind.annotation.XmlAttribute; -import javax.xml.bind.annotation.XmlElement; -import javax.xml.bind.annotation.XmlSeeAlso; -import javax.xml.bind.annotation.XmlType; - - -/** - *

Java class for GeolocationGroupDetails complex type. - * - *

The following schema fragment specifies the expected content contained within this class. - * - *

- * <complexType name="GeolocationGroupDetails">
- *   <complexContent>
- *     <restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
- *       <sequence>
- *         <element name="GeolocationGroupDefinitionData" type="{http://schema.ultraservice.neustar.com/v01/}GeolocationGroupDefinitionData" maxOccurs="unbounded"/>
- *       </sequence>
- *       <attribute name="groupName" use="required" type="{http://www.w3.org/2001/XMLSchema}string" />
- *       <attribute name="description" type="{http://www.w3.org/2001/XMLSchema}string" />
- *     </restriction>
- *   </complexContent>
- * </complexType>
- * 
- * - * - */ -@XmlAccessorType(XmlAccessType.FIELD) -@XmlType(name = "GeolocationGroupDetails", propOrder = { - "geolocationGroupDefinitionData" -}) -@XmlSeeAlso({ - UpdateGeolocationGroupDetails.class -}) -public class GeolocationGroupDetails { - - @XmlElement(name = "GeolocationGroupDefinitionData", required = true) - protected List geolocationGroupDefinitionData; - @XmlAttribute(name = "groupName", required = true) - protected String groupName; - @XmlAttribute(name = "description") - protected String description; - - /** - * Gets the value of the geolocationGroupDefinitionData property. - * - *

- * This accessor method returns a reference to the live list, - * not a snapshot. Therefore any modification you make to the - * returned list will be present inside the JAXB object. - * This is why there is not a set method for the geolocationGroupDefinitionData property. - * - *

- * For example, to add a new item, do as follows: - *

-     *    getGeolocationGroupDefinitionData().add(newItem);
-     * 
- * - * - *

- * Objects of the following type(s) are allowed in the list - * {@link GeolocationGroupDefinitionData } - * - * - */ - public List getGeolocationGroupDefinitionData() { - if (geolocationGroupDefinitionData == null) { - geolocationGroupDefinitionData = new ArrayList(); - } - return this.geolocationGroupDefinitionData; - } - - /** - * Gets the value of the groupName property. - * - * @return - * possible object is - * {@link String } - * - */ - public String getGroupName() { - return groupName; - } - - /** - * Sets the value of the groupName property. - * - * @param value - * allowed object is - * {@link String } - * - */ - public void setGroupName(String value) { - this.groupName = value; - } - - /** - * Gets the value of the description property. - * - * @return - * possible object is - * {@link String } - * - */ - public String getDescription() { - return description; - } - - /** - * Sets the value of the description property. - * - * @param value - * allowed object is - * {@link String } - * - */ - public void setDescription(String value) { - this.description = value; - } - -} diff --git a/Plugins/Mineplex.BungeeRotator/src/com/neustar/ultraservice/schema/v01/GlobalDirectionalGroupDetails.java b/Plugins/Mineplex.BungeeRotator/src/com/neustar/ultraservice/schema/v01/GlobalDirectionalGroupDetails.java deleted file mode 100644 index 63100ae37..000000000 --- a/Plugins/Mineplex.BungeeRotator/src/com/neustar/ultraservice/schema/v01/GlobalDirectionalGroupDetails.java +++ /dev/null @@ -1,62 +0,0 @@ - -package com.neustar.ultraservice.schema.v01; - -import javax.xml.bind.annotation.XmlAccessType; -import javax.xml.bind.annotation.XmlAccessorType; -import javax.xml.bind.annotation.XmlAttribute; -import javax.xml.bind.annotation.XmlType; - - -/** - *

Java class for GlobalDirectionalGroupDetails complex type. - * - *

The following schema fragment specifies the expected content contained within this class. - * - *

- * <complexType name="GlobalDirectionalGroupDetails">
- *   <complexContent>
- *     <extension base="{http://schema.ultraservice.neustar.com/v01/}DirectionalDNSGroupDetail">
- *       <sequence>
- *       </sequence>
- *       <attribute name="accountId" use="required" type="{http://www.w3.org/2001/XMLSchema}string" />
- *     </extension>
- *   </complexContent>
- * </complexType>
- * 
- * - * - */ -@XmlAccessorType(XmlAccessType.FIELD) -@XmlType(name = "GlobalDirectionalGroupDetails") -public class GlobalDirectionalGroupDetails - extends DirectionalDNSGroupDetail -{ - - @XmlAttribute(name = "accountId", required = true) - protected String accountId; - - /** - * Gets the value of the accountId property. - * - * @return - * possible object is - * {@link String } - * - */ - public String getAccountId() { - return accountId; - } - - /** - * Sets the value of the accountId property. - * - * @param value - * allowed object is - * {@link String } - * - */ - public void setAccountId(String value) { - this.accountId = value; - } - -} diff --git a/Plugins/Mineplex.BungeeRotator/src/com/neustar/ultraservice/schema/v01/GlobalDirectionalGroupUpdateDetails.java b/Plugins/Mineplex.BungeeRotator/src/com/neustar/ultraservice/schema/v01/GlobalDirectionalGroupUpdateDetails.java deleted file mode 100644 index 3ff694fce..000000000 --- a/Plugins/Mineplex.BungeeRotator/src/com/neustar/ultraservice/schema/v01/GlobalDirectionalGroupUpdateDetails.java +++ /dev/null @@ -1,62 +0,0 @@ - -package com.neustar.ultraservice.schema.v01; - -import javax.xml.bind.annotation.XmlAccessType; -import javax.xml.bind.annotation.XmlAccessorType; -import javax.xml.bind.annotation.XmlAttribute; -import javax.xml.bind.annotation.XmlType; - - -/** - *

Java class for GlobalDirectionalGroupUpdateDetails complex type. - * - *

The following schema fragment specifies the expected content contained within this class. - * - *

- * <complexType name="GlobalDirectionalGroupUpdateDetails">
- *   <complexContent>
- *     <extension base="{http://schema.ultraservice.neustar.com/v01/}DirectionalDNSGroupDetail">
- *       <sequence>
- *       </sequence>
- *       <attribute name="GroupId" use="required" type="{http://www.w3.org/2001/XMLSchema}string" />
- *     </extension>
- *   </complexContent>
- * </complexType>
- * 
- * - * - */ -@XmlAccessorType(XmlAccessType.FIELD) -@XmlType(name = "GlobalDirectionalGroupUpdateDetails") -public class GlobalDirectionalGroupUpdateDetails - extends DirectionalDNSGroupDetail -{ - - @XmlAttribute(name = "GroupId", required = true) - protected String groupId; - - /** - * Gets the value of the groupId property. - * - * @return - * possible object is - * {@link String } - * - */ - public String getGroupId() { - return groupId; - } - - /** - * Sets the value of the groupId property. - * - * @param value - * allowed object is - * {@link String } - * - */ - public void setGroupId(String value) { - this.groupId = value; - } - -} diff --git a/Plugins/Mineplex.BungeeRotator/src/com/neustar/ultraservice/schema/v01/GraphType.java b/Plugins/Mineplex.BungeeRotator/src/com/neustar/ultraservice/schema/v01/GraphType.java deleted file mode 100644 index 150931475..000000000 --- a/Plugins/Mineplex.BungeeRotator/src/com/neustar/ultraservice/schema/v01/GraphType.java +++ /dev/null @@ -1,60 +0,0 @@ - -package com.neustar.ultraservice.schema.v01; - -import javax.xml.bind.annotation.XmlEnum; -import javax.xml.bind.annotation.XmlEnumValue; -import javax.xml.bind.annotation.XmlType; - - -/** - *

Java class for graphType. - * - *

The following schema fragment specifies the expected content contained within this class. - *

- *

- * <simpleType name="graphType">
- *   <restriction base="{http://www.w3.org/2001/XMLSchema}string">
- *     <enumeration value="Text"/>
- *     <enumeration value="Bar"/>
- *     <enumeration value="Step"/>
- *     <enumeration value="Line"/>
- *     <enumeration value="Area"/>
- *   </restriction>
- * </simpleType>
- * 
- * - */ -@XmlType(name = "graphType") -@XmlEnum -public enum GraphType { - - @XmlEnumValue("Text") - TEXT("Text"), - @XmlEnumValue("Bar") - BAR("Bar"), - @XmlEnumValue("Step") - STEP("Step"), - @XmlEnumValue("Line") - LINE("Line"), - @XmlEnumValue("Area") - AREA("Area"); - private final String value; - - GraphType(String v) { - value = v; - } - - public String value() { - return value; - } - - public static GraphType fromValue(String v) { - for (GraphType c: GraphType.values()) { - if (c.value.equals(v)) { - return c; - } - } - throw new IllegalArgumentException(v); - } - -} diff --git a/Plugins/Mineplex.BungeeRotator/src/com/neustar/ultraservice/schema/v01/GroupData.java b/Plugins/Mineplex.BungeeRotator/src/com/neustar/ultraservice/schema/v01/GroupData.java deleted file mode 100644 index 547c849b0..000000000 --- a/Plugins/Mineplex.BungeeRotator/src/com/neustar/ultraservice/schema/v01/GroupData.java +++ /dev/null @@ -1,168 +0,0 @@ - -package com.neustar.ultraservice.schema.v01; - -import javax.xml.bind.annotation.XmlAccessType; -import javax.xml.bind.annotation.XmlAccessorType; -import javax.xml.bind.annotation.XmlAttribute; -import javax.xml.bind.annotation.XmlType; - - -/** - *

Java class for GroupData complex type. - * - *

The following schema fragment specifies the expected content contained within this class. - * - *

- * <complexType name="GroupData">
- *   <complexContent>
- *     <restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
- *       <sequence>
- *       </sequence>
- *       <attribute name="groupingType" use="required" type="{http://schema.ultraservice.neustar.com/v01/}GroupingType" />
- *       <attribute name="copyExistingGroupId" type="{http://www.w3.org/2001/XMLSchema}string" />
- *       <attribute name="newCopiedGroupName" type="{http://www.w3.org/2001/XMLSchema}string" />
- *       <attribute name="assignExistingGroupId" type="{http://www.w3.org/2001/XMLSchema}string" />
- *       <attribute name="assignGlobalGroupId" type="{http://www.w3.org/2001/XMLSchema}string" />
- *     </restriction>
- *   </complexContent>
- * </complexType>
- * 
- * - * - */ -@XmlAccessorType(XmlAccessType.FIELD) -@XmlType(name = "GroupData") -public class GroupData { - - @XmlAttribute(name = "groupingType", required = true) - protected GroupingType groupingType; - @XmlAttribute(name = "copyExistingGroupId") - protected String copyExistingGroupId; - @XmlAttribute(name = "newCopiedGroupName") - protected String newCopiedGroupName; - @XmlAttribute(name = "assignExistingGroupId") - protected String assignExistingGroupId; - @XmlAttribute(name = "assignGlobalGroupId") - protected String assignGlobalGroupId; - - /** - * Gets the value of the groupingType property. - * - * @return - * possible object is - * {@link GroupingType } - * - */ - public GroupingType getGroupingType() { - return groupingType; - } - - /** - * Sets the value of the groupingType property. - * - * @param value - * allowed object is - * {@link GroupingType } - * - */ - public void setGroupingType(GroupingType value) { - this.groupingType = value; - } - - /** - * Gets the value of the copyExistingGroupId property. - * - * @return - * possible object is - * {@link String } - * - */ - public String getCopyExistingGroupId() { - return copyExistingGroupId; - } - - /** - * Sets the value of the copyExistingGroupId property. - * - * @param value - * allowed object is - * {@link String } - * - */ - public void setCopyExistingGroupId(String value) { - this.copyExistingGroupId = value; - } - - /** - * Gets the value of the newCopiedGroupName property. - * - * @return - * possible object is - * {@link String } - * - */ - public String getNewCopiedGroupName() { - return newCopiedGroupName; - } - - /** - * Sets the value of the newCopiedGroupName property. - * - * @param value - * allowed object is - * {@link String } - * - */ - public void setNewCopiedGroupName(String value) { - this.newCopiedGroupName = value; - } - - /** - * Gets the value of the assignExistingGroupId property. - * - * @return - * possible object is - * {@link String } - * - */ - public String getAssignExistingGroupId() { - return assignExistingGroupId; - } - - /** - * Sets the value of the assignExistingGroupId property. - * - * @param value - * allowed object is - * {@link String } - * - */ - public void setAssignExistingGroupId(String value) { - this.assignExistingGroupId = value; - } - - /** - * Gets the value of the assignGlobalGroupId property. - * - * @return - * possible object is - * {@link String } - * - */ - public String getAssignGlobalGroupId() { - return assignGlobalGroupId; - } - - /** - * Sets the value of the assignGlobalGroupId property. - * - * @param value - * allowed object is - * {@link String } - * - */ - public void setAssignGlobalGroupId(String value) { - this.assignGlobalGroupId = value; - } - -} diff --git a/Plugins/Mineplex.BungeeRotator/src/com/neustar/ultraservice/schema/v01/GroupingType.java b/Plugins/Mineplex.BungeeRotator/src/com/neustar/ultraservice/schema/v01/GroupingType.java deleted file mode 100644 index ead4c7736..000000000 --- a/Plugins/Mineplex.BungeeRotator/src/com/neustar/ultraservice/schema/v01/GroupingType.java +++ /dev/null @@ -1,42 +0,0 @@ - -package com.neustar.ultraservice.schema.v01; - -import javax.xml.bind.annotation.XmlEnum; -import javax.xml.bind.annotation.XmlType; - - -/** - *

Java class for GroupingType. - * - *

The following schema fragment specifies the expected content contained within this class. - *

- *

- * <simpleType name="GroupingType">
- *   <restriction base="{http://www.w3.org/2001/XMLSchema}string">
- *     <enumeration value="DEFINE_NEW_GROUP"/>
- *     <enumeration value="COPY_EXISTING_GROUP"/>
- *     <enumeration value="ASSIGN_EXISTING_GROUP"/>
- *     <enumeration value="ASSIGN_GLOBAL_GROUP"/>
- *   </restriction>
- * </simpleType>
- * 
- * - */ -@XmlType(name = "GroupingType") -@XmlEnum -public enum GroupingType { - - DEFINE_NEW_GROUP, - COPY_EXISTING_GROUP, - ASSIGN_EXISTING_GROUP, - ASSIGN_GLOBAL_GROUP; - - public String value() { - return name(); - } - - public static GroupingType fromValue(String v) { - return valueOf(v); - } - -} diff --git a/Plugins/Mineplex.BungeeRotator/src/com/neustar/ultraservice/schema/v01/HTTPProbeData.java b/Plugins/Mineplex.BungeeRotator/src/com/neustar/ultraservice/schema/v01/HTTPProbeData.java deleted file mode 100644 index ab59035ae..000000000 --- a/Plugins/Mineplex.BungeeRotator/src/com/neustar/ultraservice/schema/v01/HTTPProbeData.java +++ /dev/null @@ -1,843 +0,0 @@ - -package com.neustar.ultraservice.schema.v01; - -import javax.xml.bind.annotation.XmlAccessType; -import javax.xml.bind.annotation.XmlAccessorType; -import javax.xml.bind.annotation.XmlAttribute; -import javax.xml.bind.annotation.XmlType; - - -/** - *

Java class for HTTPProbeData complex type. - * - *

The following schema fragment specifies the expected content contained within this class. - * - *

- * <complexType name="HTTPProbeData">
- *   <complexContent>
- *     <restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
- *       <sequence>
- *       </sequence>
- *       <attribute name="addTransaction" type="{http://www.w3.org/2001/XMLSchema}string" />
- *       <attribute name="editTransactionStep" type="{http://www.w3.org/2001/XMLSchema}string" />
- *       <attribute name="port" type="{http://www.w3.org/2001/XMLSchema}string" />
- *       <attribute name="hostName" type="{http://www.w3.org/2001/XMLSchema}string" />
- *       <attribute name="webPage" type="{http://www.w3.org/2001/XMLSchema}string" />
- *       <attribute name="protocol" type="{http://www.w3.org/2001/XMLSchema}string" />
- *       <attribute name="method" type="{http://www.w3.org/2001/XMLSchema}string" />
- *       <attribute name="transmittedData" type="{http://www.w3.org/2001/XMLSchema}string" />
- *       <attribute name="searchString" type="{http://www.w3.org/2001/XMLSchema}string" />
- *       <attribute name="connectTime" type="{http://www.w3.org/2001/XMLSchema}string" />
- *       <attribute name="runtime" type="{http://www.w3.org/2001/XMLSchema}string" />
- *       <attribute name="totalRuntime" type="{http://www.w3.org/2001/XMLSchema}string" />
- *       <attribute name="failTotalRuntime" type="{http://www.w3.org/2001/XMLSchema}string" />
- *       <attribute name="criticalTotalRuntime" type="{http://www.w3.org/2001/XMLSchema}string" />
- *       <attribute name="warningTotalRuntime" type="{http://www.w3.org/2001/XMLSchema}string" />
- *       <attribute name="failConnectTime" type="{http://www.w3.org/2001/XMLSchema}string" />
- *       <attribute name="criticalConnectTime" type="{http://www.w3.org/2001/XMLSchema}string" />
- *       <attribute name="warningConnectTime" type="{http://www.w3.org/2001/XMLSchema}string" />
- *       <attribute name="failRuntime" type="{http://www.w3.org/2001/XMLSchema}string" />
- *       <attribute name="criticalRuntime" type="{http://www.w3.org/2001/XMLSchema}string" />
- *       <attribute name="warningRuntime" type="{http://www.w3.org/2001/XMLSchema}string" />
- *       <attribute name="failSearchString" type="{http://www.w3.org/2001/XMLSchema}string" />
- *       <attribute name="criticalSearchString" type="{http://www.w3.org/2001/XMLSchema}string" />
- *       <attribute name="warningSearchString" type="{http://www.w3.org/2001/XMLSchema}string" />
- *       <attribute name="failAverageConnectTime" type="{http://www.w3.org/2001/XMLSchema}string" />
- *       <attribute name="criticalAverageConnectTime" type="{http://www.w3.org/2001/XMLSchema}string" />
- *       <attribute name="warningAverageConnectTime" type="{http://www.w3.org/2001/XMLSchema}string" />
- *       <attribute name="failAverageRunTime" type="{http://www.w3.org/2001/XMLSchema}string" />
- *       <attribute name="criticalAverageRunTime" type="{http://www.w3.org/2001/XMLSchema}string" />
- *       <attribute name="warningAverageRunTime" type="{http://www.w3.org/2001/XMLSchema}string" />
- *     </restriction>
- *   </complexContent>
- * </complexType>
- * 
- * - * - */ -@XmlAccessorType(XmlAccessType.FIELD) -@XmlType(name = "HTTPProbeData") -public class HTTPProbeData { - - @XmlAttribute(name = "addTransaction") - protected String addTransaction; - @XmlAttribute(name = "editTransactionStep") - protected String editTransactionStep; - @XmlAttribute(name = "port") - protected String port; - @XmlAttribute(name = "hostName") - protected String hostName; - @XmlAttribute(name = "webPage") - protected String webPage; - @XmlAttribute(name = "protocol") - protected String protocol; - @XmlAttribute(name = "method") - protected String method; - @XmlAttribute(name = "transmittedData") - protected String transmittedData; - @XmlAttribute(name = "searchString") - protected String searchString; - @XmlAttribute(name = "connectTime") - protected String connectTime; - @XmlAttribute(name = "runtime") - protected String runtime; - @XmlAttribute(name = "totalRuntime") - protected String totalRuntime; - @XmlAttribute(name = "failTotalRuntime") - protected String failTotalRuntime; - @XmlAttribute(name = "criticalTotalRuntime") - protected String criticalTotalRuntime; - @XmlAttribute(name = "warningTotalRuntime") - protected String warningTotalRuntime; - @XmlAttribute(name = "failConnectTime") - protected String failConnectTime; - @XmlAttribute(name = "criticalConnectTime") - protected String criticalConnectTime; - @XmlAttribute(name = "warningConnectTime") - protected String warningConnectTime; - @XmlAttribute(name = "failRuntime") - protected String failRuntime; - @XmlAttribute(name = "criticalRuntime") - protected String criticalRuntime; - @XmlAttribute(name = "warningRuntime") - protected String warningRuntime; - @XmlAttribute(name = "failSearchString") - protected String failSearchString; - @XmlAttribute(name = "criticalSearchString") - protected String criticalSearchString; - @XmlAttribute(name = "warningSearchString") - protected String warningSearchString; - @XmlAttribute(name = "failAverageConnectTime") - protected String failAverageConnectTime; - @XmlAttribute(name = "criticalAverageConnectTime") - protected String criticalAverageConnectTime; - @XmlAttribute(name = "warningAverageConnectTime") - protected String warningAverageConnectTime; - @XmlAttribute(name = "failAverageRunTime") - protected String failAverageRunTime; - @XmlAttribute(name = "criticalAverageRunTime") - protected String criticalAverageRunTime; - @XmlAttribute(name = "warningAverageRunTime") - protected String warningAverageRunTime; - - /** - * Gets the value of the addTransaction property. - * - * @return - * possible object is - * {@link String } - * - */ - public String getAddTransaction() { - return addTransaction; - } - - /** - * Sets the value of the addTransaction property. - * - * @param value - * allowed object is - * {@link String } - * - */ - public void setAddTransaction(String value) { - this.addTransaction = value; - } - - /** - * Gets the value of the editTransactionStep property. - * - * @return - * possible object is - * {@link String } - * - */ - public String getEditTransactionStep() { - return editTransactionStep; - } - - /** - * Sets the value of the editTransactionStep property. - * - * @param value - * allowed object is - * {@link String } - * - */ - public void setEditTransactionStep(String value) { - this.editTransactionStep = value; - } - - /** - * Gets the value of the port property. - * - * @return - * possible object is - * {@link String } - * - */ - public String getPort() { - return port; - } - - /** - * Sets the value of the port property. - * - * @param value - * allowed object is - * {@link String } - * - */ - public void setPort(String value) { - this.port = value; - } - - /** - * Gets the value of the hostName property. - * - * @return - * possible object is - * {@link String } - * - */ - public String getHostName() { - return hostName; - } - - /** - * Sets the value of the hostName property. - * - * @param value - * allowed object is - * {@link String } - * - */ - public void setHostName(String value) { - this.hostName = value; - } - - /** - * Gets the value of the webPage property. - * - * @return - * possible object is - * {@link String } - * - */ - public String getWebPage() { - return webPage; - } - - /** - * Sets the value of the webPage property. - * - * @param value - * allowed object is - * {@link String } - * - */ - public void setWebPage(String value) { - this.webPage = value; - } - - /** - * Gets the value of the protocol property. - * - * @return - * possible object is - * {@link String } - * - */ - public String getProtocol() { - return protocol; - } - - /** - * Sets the value of the protocol property. - * - * @param value - * allowed object is - * {@link String } - * - */ - public void setProtocol(String value) { - this.protocol = value; - } - - /** - * Gets the value of the method property. - * - * @return - * possible object is - * {@link String } - * - */ - public String getMethod() { - return method; - } - - /** - * Sets the value of the method property. - * - * @param value - * allowed object is - * {@link String } - * - */ - public void setMethod(String value) { - this.method = value; - } - - /** - * Gets the value of the transmittedData property. - * - * @return - * possible object is - * {@link String } - * - */ - public String getTransmittedData() { - return transmittedData; - } - - /** - * Sets the value of the transmittedData property. - * - * @param value - * allowed object is - * {@link String } - * - */ - public void setTransmittedData(String value) { - this.transmittedData = value; - } - - /** - * Gets the value of the searchString property. - * - * @return - * possible object is - * {@link String } - * - */ - public String getSearchString() { - return searchString; - } - - /** - * Sets the value of the searchString property. - * - * @param value - * allowed object is - * {@link String } - * - */ - public void setSearchString(String value) { - this.searchString = value; - } - - /** - * Gets the value of the connectTime property. - * - * @return - * possible object is - * {@link String } - * - */ - public String getConnectTime() { - return connectTime; - } - - /** - * Sets the value of the connectTime property. - * - * @param value - * allowed object is - * {@link String } - * - */ - public void setConnectTime(String value) { - this.connectTime = value; - } - - /** - * Gets the value of the runtime property. - * - * @return - * possible object is - * {@link String } - * - */ - public String getRuntime() { - return runtime; - } - - /** - * Sets the value of the runtime property. - * - * @param value - * allowed object is - * {@link String } - * - */ - public void setRuntime(String value) { - this.runtime = value; - } - - /** - * Gets the value of the totalRuntime property. - * - * @return - * possible object is - * {@link String } - * - */ - public String getTotalRuntime() { - return totalRuntime; - } - - /** - * Sets the value of the totalRuntime property. - * - * @param value - * allowed object is - * {@link String } - * - */ - public void setTotalRuntime(String value) { - this.totalRuntime = value; - } - - /** - * Gets the value of the failTotalRuntime property. - * - * @return - * possible object is - * {@link String } - * - */ - public String getFailTotalRuntime() { - return failTotalRuntime; - } - - /** - * Sets the value of the failTotalRuntime property. - * - * @param value - * allowed object is - * {@link String } - * - */ - public void setFailTotalRuntime(String value) { - this.failTotalRuntime = value; - } - - /** - * Gets the value of the criticalTotalRuntime property. - * - * @return - * possible object is - * {@link String } - * - */ - public String getCriticalTotalRuntime() { - return criticalTotalRuntime; - } - - /** - * Sets the value of the criticalTotalRuntime property. - * - * @param value - * allowed object is - * {@link String } - * - */ - public void setCriticalTotalRuntime(String value) { - this.criticalTotalRuntime = value; - } - - /** - * Gets the value of the warningTotalRuntime property. - * - * @return - * possible object is - * {@link String } - * - */ - public String getWarningTotalRuntime() { - return warningTotalRuntime; - } - - /** - * Sets the value of the warningTotalRuntime property. - * - * @param value - * allowed object is - * {@link String } - * - */ - public void setWarningTotalRuntime(String value) { - this.warningTotalRuntime = value; - } - - /** - * Gets the value of the failConnectTime property. - * - * @return - * possible object is - * {@link String } - * - */ - public String getFailConnectTime() { - return failConnectTime; - } - - /** - * Sets the value of the failConnectTime property. - * - * @param value - * allowed object is - * {@link String } - * - */ - public void setFailConnectTime(String value) { - this.failConnectTime = value; - } - - /** - * Gets the value of the criticalConnectTime property. - * - * @return - * possible object is - * {@link String } - * - */ - public String getCriticalConnectTime() { - return criticalConnectTime; - } - - /** - * Sets the value of the criticalConnectTime property. - * - * @param value - * allowed object is - * {@link String } - * - */ - public void setCriticalConnectTime(String value) { - this.criticalConnectTime = value; - } - - /** - * Gets the value of the warningConnectTime property. - * - * @return - * possible object is - * {@link String } - * - */ - public String getWarningConnectTime() { - return warningConnectTime; - } - - /** - * Sets the value of the warningConnectTime property. - * - * @param value - * allowed object is - * {@link String } - * - */ - public void setWarningConnectTime(String value) { - this.warningConnectTime = value; - } - - /** - * Gets the value of the failRuntime property. - * - * @return - * possible object is - * {@link String } - * - */ - public String getFailRuntime() { - return failRuntime; - } - - /** - * Sets the value of the failRuntime property. - * - * @param value - * allowed object is - * {@link String } - * - */ - public void setFailRuntime(String value) { - this.failRuntime = value; - } - - /** - * Gets the value of the criticalRuntime property. - * - * @return - * possible object is - * {@link String } - * - */ - public String getCriticalRuntime() { - return criticalRuntime; - } - - /** - * Sets the value of the criticalRuntime property. - * - * @param value - * allowed object is - * {@link String } - * - */ - public void setCriticalRuntime(String value) { - this.criticalRuntime = value; - } - - /** - * Gets the value of the warningRuntime property. - * - * @return - * possible object is - * {@link String } - * - */ - public String getWarningRuntime() { - return warningRuntime; - } - - /** - * Sets the value of the warningRuntime property. - * - * @param value - * allowed object is - * {@link String } - * - */ - public void setWarningRuntime(String value) { - this.warningRuntime = value; - } - - /** - * Gets the value of the failSearchString property. - * - * @return - * possible object is - * {@link String } - * - */ - public String getFailSearchString() { - return failSearchString; - } - - /** - * Sets the value of the failSearchString property. - * - * @param value - * allowed object is - * {@link String } - * - */ - public void setFailSearchString(String value) { - this.failSearchString = value; - } - - /** - * Gets the value of the criticalSearchString property. - * - * @return - * possible object is - * {@link String } - * - */ - public String getCriticalSearchString() { - return criticalSearchString; - } - - /** - * Sets the value of the criticalSearchString property. - * - * @param value - * allowed object is - * {@link String } - * - */ - public void setCriticalSearchString(String value) { - this.criticalSearchString = value; - } - - /** - * Gets the value of the warningSearchString property. - * - * @return - * possible object is - * {@link String } - * - */ - public String getWarningSearchString() { - return warningSearchString; - } - - /** - * Sets the value of the warningSearchString property. - * - * @param value - * allowed object is - * {@link String } - * - */ - public void setWarningSearchString(String value) { - this.warningSearchString = value; - } - - /** - * Gets the value of the failAverageConnectTime property. - * - * @return - * possible object is - * {@link String } - * - */ - public String getFailAverageConnectTime() { - return failAverageConnectTime; - } - - /** - * Sets the value of the failAverageConnectTime property. - * - * @param value - * allowed object is - * {@link String } - * - */ - public void setFailAverageConnectTime(String value) { - this.failAverageConnectTime = value; - } - - /** - * Gets the value of the criticalAverageConnectTime property. - * - * @return - * possible object is - * {@link String } - * - */ - public String getCriticalAverageConnectTime() { - return criticalAverageConnectTime; - } - - /** - * Sets the value of the criticalAverageConnectTime property. - * - * @param value - * allowed object is - * {@link String } - * - */ - public void setCriticalAverageConnectTime(String value) { - this.criticalAverageConnectTime = value; - } - - /** - * Gets the value of the warningAverageConnectTime property. - * - * @return - * possible object is - * {@link String } - * - */ - public String getWarningAverageConnectTime() { - return warningAverageConnectTime; - } - - /** - * Sets the value of the warningAverageConnectTime property. - * - * @param value - * allowed object is - * {@link String } - * - */ - public void setWarningAverageConnectTime(String value) { - this.warningAverageConnectTime = value; - } - - /** - * Gets the value of the failAverageRunTime property. - * - * @return - * possible object is - * {@link String } - * - */ - public String getFailAverageRunTime() { - return failAverageRunTime; - } - - /** - * Sets the value of the failAverageRunTime property. - * - * @param value - * allowed object is - * {@link String } - * - */ - public void setFailAverageRunTime(String value) { - this.failAverageRunTime = value; - } - - /** - * Gets the value of the criticalAverageRunTime property. - * - * @return - * possible object is - * {@link String } - * - */ - public String getCriticalAverageRunTime() { - return criticalAverageRunTime; - } - - /** - * Sets the value of the criticalAverageRunTime property. - * - * @param value - * allowed object is - * {@link String } - * - */ - public void setCriticalAverageRunTime(String value) { - this.criticalAverageRunTime = value; - } - - /** - * Gets the value of the warningAverageRunTime property. - * - * @return - * possible object is - * {@link String } - * - */ - public String getWarningAverageRunTime() { - return warningAverageRunTime; - } - - /** - * Sets the value of the warningAverageRunTime property. - * - * @param value - * allowed object is - * {@link String } - * - */ - public void setWarningAverageRunTime(String value) { - this.warningAverageRunTime = value; - } - -} diff --git a/Plugins/Mineplex.BungeeRotator/src/com/neustar/ultraservice/schema/v01/HTTPTransaction.java b/Plugins/Mineplex.BungeeRotator/src/com/neustar/ultraservice/schema/v01/HTTPTransaction.java deleted file mode 100644 index decb84c8f..000000000 --- a/Plugins/Mineplex.BungeeRotator/src/com/neustar/ultraservice/schema/v01/HTTPTransaction.java +++ /dev/null @@ -1,304 +0,0 @@ - -package com.neustar.ultraservice.schema.v01; - -import javax.xml.bind.annotation.XmlAccessType; -import javax.xml.bind.annotation.XmlAccessorType; -import javax.xml.bind.annotation.XmlAttribute; -import javax.xml.bind.annotation.XmlType; - - -/** - *

Java class for HTTPTransaction complex type. - * - *

The following schema fragment specifies the expected content contained within this class. - * - *

- * <complexType name="HTTPTransaction">
- *   <complexContent>
- *     <restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
- *       <sequence>
- *         <element name="warningCriteria" type="{http://schema.ultraservice.neustar.com/v01/}HttpCriteria" minOccurs="0"/>
- *         <element name="criticalCriteria" type="{http://schema.ultraservice.neustar.com/v01/}HttpCriteria" minOccurs="0"/>
- *         <element name="failCriteria" type="{http://schema.ultraservice.neustar.com/v01/}HttpCriteria" minOccurs="0"/>
- *       </sequence>
- *       <attribute name="port" type="{http://www.w3.org/2001/XMLSchema}int" />
- *       <attribute name="hostName" type="{http://www.w3.org/2001/XMLSchema}string" />
- *       <attribute name="webPage" type="{http://www.w3.org/2001/XMLSchema}string" />
- *       <attribute name="protocol" type="{http://schema.ultraservice.neustar.com/v01/}protocol" />
- *       <attribute name="method" type="{http://schema.ultraservice.neustar.com/v01/}method" />
- *       <attribute name="transmittedData" type="{http://www.w3.org/2001/XMLSchema}string" />
- *       <attribute name="followRedirect" type="{http://www.w3.org/2001/XMLSchema}boolean" />
- *     </restriction>
- *   </complexContent>
- * </complexType>
- * 
- * - * - */ -@XmlAccessorType(XmlAccessType.FIELD) -@XmlType(name = "HTTPTransaction", propOrder = { - "warningCriteria", - "criticalCriteria", - "failCriteria" -}) -public class HTTPTransaction { - - protected HttpCriteria warningCriteria; - protected HttpCriteria criticalCriteria; - protected HttpCriteria failCriteria; - @XmlAttribute(name = "port") - protected Integer port; - @XmlAttribute(name = "hostName") - protected String hostName; - @XmlAttribute(name = "webPage") - protected String webPage; - @XmlAttribute(name = "protocol") - protected Protocol protocol; - @XmlAttribute(name = "method") - protected Method method; - @XmlAttribute(name = "transmittedData") - protected String transmittedData; - @XmlAttribute(name = "followRedirect") - protected Boolean followRedirect; - - /** - * Gets the value of the warningCriteria property. - * - * @return - * possible object is - * {@link HttpCriteria } - * - */ - public HttpCriteria getWarningCriteria() { - return warningCriteria; - } - - /** - * Sets the value of the warningCriteria property. - * - * @param value - * allowed object is - * {@link HttpCriteria } - * - */ - public void setWarningCriteria(HttpCriteria value) { - this.warningCriteria = value; - } - - /** - * Gets the value of the criticalCriteria property. - * - * @return - * possible object is - * {@link HttpCriteria } - * - */ - public HttpCriteria getCriticalCriteria() { - return criticalCriteria; - } - - /** - * Sets the value of the criticalCriteria property. - * - * @param value - * allowed object is - * {@link HttpCriteria } - * - */ - public void setCriticalCriteria(HttpCriteria value) { - this.criticalCriteria = value; - } - - /** - * Gets the value of the failCriteria property. - * - * @return - * possible object is - * {@link HttpCriteria } - * - */ - public HttpCriteria getFailCriteria() { - return failCriteria; - } - - /** - * Sets the value of the failCriteria property. - * - * @param value - * allowed object is - * {@link HttpCriteria } - * - */ - public void setFailCriteria(HttpCriteria value) { - this.failCriteria = value; - } - - /** - * Gets the value of the port property. - * - * @return - * possible object is - * {@link Integer } - * - */ - public Integer getPort() { - return port; - } - - /** - * Sets the value of the port property. - * - * @param value - * allowed object is - * {@link Integer } - * - */ - public void setPort(Integer value) { - this.port = value; - } - - /** - * Gets the value of the hostName property. - * - * @return - * possible object is - * {@link String } - * - */ - public String getHostName() { - return hostName; - } - - /** - * Sets the value of the hostName property. - * - * @param value - * allowed object is - * {@link String } - * - */ - public void setHostName(String value) { - this.hostName = value; - } - - /** - * Gets the value of the webPage property. - * - * @return - * possible object is - * {@link String } - * - */ - public String getWebPage() { - return webPage; - } - - /** - * Sets the value of the webPage property. - * - * @param value - * allowed object is - * {@link String } - * - */ - public void setWebPage(String value) { - this.webPage = value; - } - - /** - * Gets the value of the protocol property. - * - * @return - * possible object is - * {@link Protocol } - * - */ - public Protocol getProtocol() { - return protocol; - } - - /** - * Sets the value of the protocol property. - * - * @param value - * allowed object is - * {@link Protocol } - * - */ - public void setProtocol(Protocol value) { - this.protocol = value; - } - - /** - * Gets the value of the method property. - * - * @return - * possible object is - * {@link Method } - * - */ - public Method getMethod() { - return method; - } - - /** - * Sets the value of the method property. - * - * @param value - * allowed object is - * {@link Method } - * - */ - public void setMethod(Method value) { - this.method = value; - } - - /** - * Gets the value of the transmittedData property. - * - * @return - * possible object is - * {@link String } - * - */ - public String getTransmittedData() { - return transmittedData; - } - - /** - * Sets the value of the transmittedData property. - * - * @param value - * allowed object is - * {@link String } - * - */ - public void setTransmittedData(String value) { - this.transmittedData = value; - } - - /** - * Gets the value of the followRedirect property. - * - * @return - * possible object is - * {@link Boolean } - * - */ - public Boolean isFollowRedirect() { - return followRedirect; - } - - /** - * Sets the value of the followRedirect property. - * - * @param value - * allowed object is - * {@link Boolean } - * - */ - public void setFollowRedirect(Boolean value) { - this.followRedirect = value; - } - -} diff --git a/Plugins/Mineplex.BungeeRotator/src/com/neustar/ultraservice/schema/v01/HeaderRule.java b/Plugins/Mineplex.BungeeRotator/src/com/neustar/ultraservice/schema/v01/HeaderRule.java deleted file mode 100644 index e8c72b197..000000000 --- a/Plugins/Mineplex.BungeeRotator/src/com/neustar/ultraservice/schema/v01/HeaderRule.java +++ /dev/null @@ -1,133 +0,0 @@ - -package com.neustar.ultraservice.schema.v01; - -import javax.xml.bind.annotation.XmlAccessType; -import javax.xml.bind.annotation.XmlAccessorType; -import javax.xml.bind.annotation.XmlAttribute; -import javax.xml.bind.annotation.XmlType; - - -/** - *

Java class for HeaderRule complex type. - * - *

The following schema fragment specifies the expected content contained within this class. - * - *

- * <complexType name="HeaderRule">
- *   <complexContent>
- *     <restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
- *       <sequence>
- *       </sequence>
- *       <attribute name="headerField" use="required" type="{http://www.w3.org/2001/XMLSchema}string" />
- *       <attribute name="matchCriteria" use="required" type="{http://schema.ultraservice.neustar.com/v01/}MatchCriteria" />
- *       <attribute name="headerValue" use="required" type="{http://www.w3.org/2001/XMLSchema}string" />
- *       <attribute name="caseInsensitive" use="required" type="{http://www.w3.org/2001/XMLSchema}boolean" />
- *     </restriction>
- *   </complexContent>
- * </complexType>
- * 
- * - * - */ -@XmlAccessorType(XmlAccessType.FIELD) -@XmlType(name = "HeaderRule") -public class HeaderRule { - - @XmlAttribute(name = "headerField", required = true) - protected String headerField; - @XmlAttribute(name = "matchCriteria", required = true) - protected MatchCriteria matchCriteria; - @XmlAttribute(name = "headerValue", required = true) - protected String headerValue; - @XmlAttribute(name = "caseInsensitive", required = true) - protected boolean caseInsensitive; - - /** - * Gets the value of the headerField property. - * - * @return - * possible object is - * {@link String } - * - */ - public String getHeaderField() { - return headerField; - } - - /** - * Sets the value of the headerField property. - * - * @param value - * allowed object is - * {@link String } - * - */ - public void setHeaderField(String value) { - this.headerField = value; - } - - /** - * Gets the value of the matchCriteria property. - * - * @return - * possible object is - * {@link MatchCriteria } - * - */ - public MatchCriteria getMatchCriteria() { - return matchCriteria; - } - - /** - * Sets the value of the matchCriteria property. - * - * @param value - * allowed object is - * {@link MatchCriteria } - * - */ - public void setMatchCriteria(MatchCriteria value) { - this.matchCriteria = value; - } - - /** - * Gets the value of the headerValue property. - * - * @return - * possible object is - * {@link String } - * - */ - public String getHeaderValue() { - return headerValue; - } - - /** - * Sets the value of the headerValue property. - * - * @param value - * allowed object is - * {@link String } - * - */ - public void setHeaderValue(String value) { - this.headerValue = value; - } - - /** - * Gets the value of the caseInsensitive property. - * - */ - public boolean isCaseInsensitive() { - return caseInsensitive; - } - - /** - * Sets the value of the caseInsensitive property. - * - */ - public void setCaseInsensitive(boolean value) { - this.caseInsensitive = value; - } - -} diff --git a/Plugins/Mineplex.BungeeRotator/src/com/neustar/ultraservice/schema/v01/HealthCheckList.java b/Plugins/Mineplex.BungeeRotator/src/com/neustar/ultraservice/schema/v01/HealthCheckList.java deleted file mode 100644 index 3a8d2067b..000000000 --- a/Plugins/Mineplex.BungeeRotator/src/com/neustar/ultraservice/schema/v01/HealthCheckList.java +++ /dev/null @@ -1,114 +0,0 @@ - -package com.neustar.ultraservice.schema.v01; - -import javax.xml.bind.annotation.XmlAccessType; -import javax.xml.bind.annotation.XmlAccessorType; -import javax.xml.bind.annotation.XmlType; - - -/** - *

Java class for HealthCheckList complex type. - * - *

The following schema fragment specifies the expected content contained within this class. - * - *

- * <complexType name="HealthCheckList">
- *   <complexContent>
- *     <restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
- *       <sequence>
- *         <element name="currentAPIVersion" type="{http://www.w3.org/2001/XMLSchema}string" minOccurs="0"/>
- *         <element name="dbConnectionCheck" type="{http://www.w3.org/2001/XMLSchema}string" minOccurs="0"/>
- *         <element name="services" type="{http://schema.ultraservice.neustar.com/v01/}ServiceList" minOccurs="0"/>
- *       </sequence>
- *     </restriction>
- *   </complexContent>
- * </complexType>
- * 
- * - * - */ -@XmlAccessorType(XmlAccessType.FIELD) -@XmlType(name = "HealthCheckList", propOrder = { - "currentAPIVersion", - "dbConnectionCheck", - "services" -}) -public class HealthCheckList { - - protected String currentAPIVersion; - protected String dbConnectionCheck; - protected ServiceList services; - - /** - * Gets the value of the currentAPIVersion property. - * - * @return - * possible object is - * {@link String } - * - */ - public String getCurrentAPIVersion() { - return currentAPIVersion; - } - - /** - * Sets the value of the currentAPIVersion property. - * - * @param value - * allowed object is - * {@link String } - * - */ - public void setCurrentAPIVersion(String value) { - this.currentAPIVersion = value; - } - - /** - * Gets the value of the dbConnectionCheck property. - * - * @return - * possible object is - * {@link String } - * - */ - public String getDbConnectionCheck() { - return dbConnectionCheck; - } - - /** - * Sets the value of the dbConnectionCheck property. - * - * @param value - * allowed object is - * {@link String } - * - */ - public void setDbConnectionCheck(String value) { - this.dbConnectionCheck = value; - } - - /** - * Gets the value of the services property. - * - * @return - * possible object is - * {@link ServiceList } - * - */ - public ServiceList getServices() { - return services; - } - - /** - * Sets the value of the services property. - * - * @param value - * allowed object is - * {@link ServiceList } - * - */ - public void setServices(ServiceList value) { - this.services = value; - } - -} diff --git a/Plugins/Mineplex.BungeeRotator/src/com/neustar/ultraservice/schema/v01/HttpCriteria.java b/Plugins/Mineplex.BungeeRotator/src/com/neustar/ultraservice/schema/v01/HttpCriteria.java deleted file mode 100644 index a7a39b4ba..000000000 --- a/Plugins/Mineplex.BungeeRotator/src/com/neustar/ultraservice/schema/v01/HttpCriteria.java +++ /dev/null @@ -1,197 +0,0 @@ - -package com.neustar.ultraservice.schema.v01; - -import javax.xml.bind.annotation.XmlAccessType; -import javax.xml.bind.annotation.XmlAccessorType; -import javax.xml.bind.annotation.XmlElement; -import javax.xml.bind.annotation.XmlType; - - -/** - *

Java class for HttpCriteria complex type. - * - *

The following schema fragment specifies the expected content contained within this class. - * - *

- * <complexType name="HttpCriteria">
- *   <complexContent>
- *     <restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
- *       <sequence>
- *         <element name="connectTime" type="{http://www.w3.org/2001/XMLSchema}int" minOccurs="0"/>
- *         <element name="connectTimeAverage" type="{http://www.w3.org/2001/XMLSchema}int" minOccurs="0"/>
- *         <element name="runTime" type="{http://www.w3.org/2001/XMLSchema}int" minOccurs="0"/>
- *         <element name="runTimeAverage" type="{http://www.w3.org/2001/XMLSchema}int" minOccurs="0"/>
- *         <element name="runTimeTotal" type="{http://www.w3.org/2001/XMLSchema}int" minOccurs="0"/>
- *         <element name="searchString" type="{http://www.w3.org/2001/XMLSchema}string"/>
- *       </sequence>
- *     </restriction>
- *   </complexContent>
- * </complexType>
- * 
- * - * - */ -@XmlAccessorType(XmlAccessType.FIELD) -@XmlType(name = "HttpCriteria", propOrder = { - "connectTime", - "connectTimeAverage", - "runTime", - "runTimeAverage", - "runTimeTotal", - "searchString" -}) -public class HttpCriteria { - - protected Integer connectTime; - protected Integer connectTimeAverage; - protected Integer runTime; - protected Integer runTimeAverage; - protected Integer runTimeTotal; - @XmlElement(required = true) - protected String searchString; - - /** - * Gets the value of the connectTime property. - * - * @return - * possible object is - * {@link Integer } - * - */ - public Integer getConnectTime() { - return connectTime; - } - - /** - * Sets the value of the connectTime property. - * - * @param value - * allowed object is - * {@link Integer } - * - */ - public void setConnectTime(Integer value) { - this.connectTime = value; - } - - /** - * Gets the value of the connectTimeAverage property. - * - * @return - * possible object is - * {@link Integer } - * - */ - public Integer getConnectTimeAverage() { - return connectTimeAverage; - } - - /** - * Sets the value of the connectTimeAverage property. - * - * @param value - * allowed object is - * {@link Integer } - * - */ - public void setConnectTimeAverage(Integer value) { - this.connectTimeAverage = value; - } - - /** - * Gets the value of the runTime property. - * - * @return - * possible object is - * {@link Integer } - * - */ - public Integer getRunTime() { - return runTime; - } - - /** - * Sets the value of the runTime property. - * - * @param value - * allowed object is - * {@link Integer } - * - */ - public void setRunTime(Integer value) { - this.runTime = value; - } - - /** - * Gets the value of the runTimeAverage property. - * - * @return - * possible object is - * {@link Integer } - * - */ - public Integer getRunTimeAverage() { - return runTimeAverage; - } - - /** - * Sets the value of the runTimeAverage property. - * - * @param value - * allowed object is - * {@link Integer } - * - */ - public void setRunTimeAverage(Integer value) { - this.runTimeAverage = value; - } - - /** - * Gets the value of the runTimeTotal property. - * - * @return - * possible object is - * {@link Integer } - * - */ - public Integer getRunTimeTotal() { - return runTimeTotal; - } - - /** - * Sets the value of the runTimeTotal property. - * - * @param value - * allowed object is - * {@link Integer } - * - */ - public void setRunTimeTotal(Integer value) { - this.runTimeTotal = value; - } - - /** - * Gets the value of the searchString property. - * - * @return - * possible object is - * {@link String } - * - */ - public String getSearchString() { - return searchString; - } - - /** - * Sets the value of the searchString property. - * - * @param value - * allowed object is - * {@link String } - * - */ - public void setSearchString(String value) { - this.searchString = value; - } - -} diff --git a/Plugins/Mineplex.BungeeRotator/src/com/neustar/ultraservice/schema/v01/InactiveTimeOutPreference.java b/Plugins/Mineplex.BungeeRotator/src/com/neustar/ultraservice/schema/v01/InactiveTimeOutPreference.java deleted file mode 100644 index d9ff5d0e5..000000000 --- a/Plugins/Mineplex.BungeeRotator/src/com/neustar/ultraservice/schema/v01/InactiveTimeOutPreference.java +++ /dev/null @@ -1,60 +0,0 @@ - -package com.neustar.ultraservice.schema.v01; - -import javax.xml.bind.annotation.XmlAccessType; -import javax.xml.bind.annotation.XmlAccessorType; -import javax.xml.bind.annotation.XmlAttribute; -import javax.xml.bind.annotation.XmlType; - - -/** - *

Java class for InactiveTimeOutPreference complex type. - * - *

The following schema fragment specifies the expected content contained within this class. - * - *

- * <complexType name="InactiveTimeOutPreference">
- *   <complexContent>
- *     <restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
- *       <sequence>
- *       </sequence>
- *       <attribute name="InactiveTimeOut" type="{http://www.w3.org/2001/XMLSchema}string" />
- *     </restriction>
- *   </complexContent>
- * </complexType>
- * 
- * - * - */ -@XmlAccessorType(XmlAccessType.FIELD) -@XmlType(name = "InactiveTimeOutPreference") -public class InactiveTimeOutPreference { - - @XmlAttribute(name = "InactiveTimeOut") - protected String inactiveTimeOut; - - /** - * Gets the value of the inactiveTimeOut property. - * - * @return - * possible object is - * {@link String } - * - */ - public String getInactiveTimeOut() { - return inactiveTimeOut; - } - - /** - * Sets the value of the inactiveTimeOut property. - * - * @param value - * allowed object is - * {@link String } - * - */ - public void setInactiveTimeOut(String value) { - this.inactiveTimeOut = value; - } - -} diff --git a/Plugins/Mineplex.BungeeRotator/src/com/neustar/ultraservice/schema/v01/InfoTypes.java b/Plugins/Mineplex.BungeeRotator/src/com/neustar/ultraservice/schema/v01/InfoTypes.java deleted file mode 100644 index b12dad8d9..000000000 --- a/Plugins/Mineplex.BungeeRotator/src/com/neustar/ultraservice/schema/v01/InfoTypes.java +++ /dev/null @@ -1,276 +0,0 @@ - -package com.neustar.ultraservice.schema.v01; - -import javax.xml.bind.annotation.XmlAccessType; -import javax.xml.bind.annotation.XmlAccessorType; -import javax.xml.bind.annotation.XmlAttribute; -import javax.xml.bind.annotation.XmlType; -import javax.xml.bind.annotation.XmlValue; - - -/** - *

Java class for InfoTypes complex type. - * - *

The following schema fragment specifies the expected content contained within this class. - * - *

- * <complexType name="InfoTypes">
- *   <simpleContent>
- *     <extension base="<http://www.w3.org/2001/XMLSchema>string">
- *       <attribute name="Info1Type" type="{http://www.w3.org/2001/XMLSchema}string" />
- *       <attribute name="Info2Type" type="{http://www.w3.org/2001/XMLSchema}string" />
- *       <attribute name="Info3Type" type="{http://www.w3.org/2001/XMLSchema}string" />
- *       <attribute name="Info4Type" type="{http://www.w3.org/2001/XMLSchema}string" />
- *       <attribute name="Info5Type" type="{http://www.w3.org/2001/XMLSchema}string" />
- *       <attribute name="Info6Type" type="{http://www.w3.org/2001/XMLSchema}string" />
- *       <attribute name="Info7Type" type="{http://www.w3.org/2001/XMLSchema}string" />
- *       <attribute name="Info8Type" type="{http://www.w3.org/2001/XMLSchema}string" />
- *     </extension>
- *   </simpleContent>
- * </complexType>
- * 
- * - * - */ -@XmlAccessorType(XmlAccessType.FIELD) -@XmlType(name = "InfoTypes", propOrder = { - "value" -}) -public class InfoTypes { - - @XmlValue - protected String value; - @XmlAttribute(name = "Info1Type") - protected String info1Type; - @XmlAttribute(name = "Info2Type") - protected String info2Type; - @XmlAttribute(name = "Info3Type") - protected String info3Type; - @XmlAttribute(name = "Info4Type") - protected String info4Type; - @XmlAttribute(name = "Info5Type") - protected String info5Type; - @XmlAttribute(name = "Info6Type") - protected String info6Type; - @XmlAttribute(name = "Info7Type") - protected String info7Type; - @XmlAttribute(name = "Info8Type") - protected String info8Type; - - /** - * Gets the value of the value property. - * - * @return - * possible object is - * {@link String } - * - */ - public String getValue() { - return value; - } - - /** - * Sets the value of the value property. - * - * @param value - * allowed object is - * {@link String } - * - */ - public void setValue(String value) { - this.value = value; - } - - /** - * Gets the value of the info1Type property. - * - * @return - * possible object is - * {@link String } - * - */ - public String getInfo1Type() { - return info1Type; - } - - /** - * Sets the value of the info1Type property. - * - * @param value - * allowed object is - * {@link String } - * - */ - public void setInfo1Type(String value) { - this.info1Type = value; - } - - /** - * Gets the value of the info2Type property. - * - * @return - * possible object is - * {@link String } - * - */ - public String getInfo2Type() { - return info2Type; - } - - /** - * Sets the value of the info2Type property. - * - * @param value - * allowed object is - * {@link String } - * - */ - public void setInfo2Type(String value) { - this.info2Type = value; - } - - /** - * Gets the value of the info3Type property. - * - * @return - * possible object is - * {@link String } - * - */ - public String getInfo3Type() { - return info3Type; - } - - /** - * Sets the value of the info3Type property. - * - * @param value - * allowed object is - * {@link String } - * - */ - public void setInfo3Type(String value) { - this.info3Type = value; - } - - /** - * Gets the value of the info4Type property. - * - * @return - * possible object is - * {@link String } - * - */ - public String getInfo4Type() { - return info4Type; - } - - /** - * Sets the value of the info4Type property. - * - * @param value - * allowed object is - * {@link String } - * - */ - public void setInfo4Type(String value) { - this.info4Type = value; - } - - /** - * Gets the value of the info5Type property. - * - * @return - * possible object is - * {@link String } - * - */ - public String getInfo5Type() { - return info5Type; - } - - /** - * Sets the value of the info5Type property. - * - * @param value - * allowed object is - * {@link String } - * - */ - public void setInfo5Type(String value) { - this.info5Type = value; - } - - /** - * Gets the value of the info6Type property. - * - * @return - * possible object is - * {@link String } - * - */ - public String getInfo6Type() { - return info6Type; - } - - /** - * Sets the value of the info6Type property. - * - * @param value - * allowed object is - * {@link String } - * - */ - public void setInfo6Type(String value) { - this.info6Type = value; - } - - /** - * Gets the value of the info7Type property. - * - * @return - * possible object is - * {@link String } - * - */ - public String getInfo7Type() { - return info7Type; - } - - /** - * Sets the value of the info7Type property. - * - * @param value - * allowed object is - * {@link String } - * - */ - public void setInfo7Type(String value) { - this.info7Type = value; - } - - /** - * Gets the value of the info8Type property. - * - * @return - * possible object is - * {@link String } - * - */ - public String getInfo8Type() { - return info8Type; - } - - /** - * Sets the value of the info8Type property. - * - * @param value - * allowed object is - * {@link String } - * - */ - public void setInfo8Type(String value) { - this.info8Type = value; - } - -} diff --git a/Plugins/Mineplex.BungeeRotator/src/com/neustar/ultraservice/schema/v01/InfoValues.java b/Plugins/Mineplex.BungeeRotator/src/com/neustar/ultraservice/schema/v01/InfoValues.java deleted file mode 100644 index 4d3a90100..000000000 --- a/Plugins/Mineplex.BungeeRotator/src/com/neustar/ultraservice/schema/v01/InfoValues.java +++ /dev/null @@ -1,276 +0,0 @@ - -package com.neustar.ultraservice.schema.v01; - -import javax.xml.bind.annotation.XmlAccessType; -import javax.xml.bind.annotation.XmlAccessorType; -import javax.xml.bind.annotation.XmlAttribute; -import javax.xml.bind.annotation.XmlType; -import javax.xml.bind.annotation.XmlValue; - - -/** - *

Java class for InfoValues complex type. - * - *

The following schema fragment specifies the expected content contained within this class. - * - *

- * <complexType name="InfoValues">
- *   <simpleContent>
- *     <extension base="<http://www.w3.org/2001/XMLSchema>string">
- *       <attribute name="Info1Value" type="{http://www.w3.org/2001/XMLSchema}string" />
- *       <attribute name="Info2Value" type="{http://www.w3.org/2001/XMLSchema}string" />
- *       <attribute name="Info3Value" type="{http://www.w3.org/2001/XMLSchema}string" />
- *       <attribute name="Info4Value" type="{http://www.w3.org/2001/XMLSchema}string" />
- *       <attribute name="Info5Value" type="{http://www.w3.org/2001/XMLSchema}string" />
- *       <attribute name="Info6Value" type="{http://www.w3.org/2001/XMLSchema}string" />
- *       <attribute name="Info7Value" type="{http://www.w3.org/2001/XMLSchema}string" />
- *       <attribute name="Info8Value" type="{http://www.w3.org/2001/XMLSchema}string" />
- *     </extension>
- *   </simpleContent>
- * </complexType>
- * 
- * - * - */ -@XmlAccessorType(XmlAccessType.FIELD) -@XmlType(name = "InfoValues", propOrder = { - "value" -}) -public class InfoValues { - - @XmlValue - protected String value; - @XmlAttribute(name = "Info1Value") - protected String info1Value; - @XmlAttribute(name = "Info2Value") - protected String info2Value; - @XmlAttribute(name = "Info3Value") - protected String info3Value; - @XmlAttribute(name = "Info4Value") - protected String info4Value; - @XmlAttribute(name = "Info5Value") - protected String info5Value; - @XmlAttribute(name = "Info6Value") - protected String info6Value; - @XmlAttribute(name = "Info7Value") - protected String info7Value; - @XmlAttribute(name = "Info8Value") - protected String info8Value; - - /** - * Gets the value of the value property. - * - * @return - * possible object is - * {@link String } - * - */ - public String getValue() { - return value; - } - - /** - * Sets the value of the value property. - * - * @param value - * allowed object is - * {@link String } - * - */ - public void setValue(String value) { - this.value = value; - } - - /** - * Gets the value of the info1Value property. - * - * @return - * possible object is - * {@link String } - * - */ - public String getInfo1Value() { - return info1Value; - } - - /** - * Sets the value of the info1Value property. - * - * @param value - * allowed object is - * {@link String } - * - */ - public void setInfo1Value(String value) { - this.info1Value = value; - } - - /** - * Gets the value of the info2Value property. - * - * @return - * possible object is - * {@link String } - * - */ - public String getInfo2Value() { - return info2Value; - } - - /** - * Sets the value of the info2Value property. - * - * @param value - * allowed object is - * {@link String } - * - */ - public void setInfo2Value(String value) { - this.info2Value = value; - } - - /** - * Gets the value of the info3Value property. - * - * @return - * possible object is - * {@link String } - * - */ - public String getInfo3Value() { - return info3Value; - } - - /** - * Sets the value of the info3Value property. - * - * @param value - * allowed object is - * {@link String } - * - */ - public void setInfo3Value(String value) { - this.info3Value = value; - } - - /** - * Gets the value of the info4Value property. - * - * @return - * possible object is - * {@link String } - * - */ - public String getInfo4Value() { - return info4Value; - } - - /** - * Sets the value of the info4Value property. - * - * @param value - * allowed object is - * {@link String } - * - */ - public void setInfo4Value(String value) { - this.info4Value = value; - } - - /** - * Gets the value of the info5Value property. - * - * @return - * possible object is - * {@link String } - * - */ - public String getInfo5Value() { - return info5Value; - } - - /** - * Sets the value of the info5Value property. - * - * @param value - * allowed object is - * {@link String } - * - */ - public void setInfo5Value(String value) { - this.info5Value = value; - } - - /** - * Gets the value of the info6Value property. - * - * @return - * possible object is - * {@link String } - * - */ - public String getInfo6Value() { - return info6Value; - } - - /** - * Sets the value of the info6Value property. - * - * @param value - * allowed object is - * {@link String } - * - */ - public void setInfo6Value(String value) { - this.info6Value = value; - } - - /** - * Gets the value of the info7Value property. - * - * @return - * possible object is - * {@link String } - * - */ - public String getInfo7Value() { - return info7Value; - } - - /** - * Sets the value of the info7Value property. - * - * @param value - * allowed object is - * {@link String } - * - */ - public void setInfo7Value(String value) { - this.info7Value = value; - } - - /** - * Gets the value of the info8Value property. - * - * @return - * possible object is - * {@link String } - * - */ - public String getInfo8Value() { - return info8Value; - } - - /** - * Sets the value of the info8Value property. - * - * @param value - * allowed object is - * {@link String } - * - */ - public void setInfo8Value(String value) { - this.info8Value = value; - } - -} diff --git a/Plugins/Mineplex.BungeeRotator/src/com/neustar/ultraservice/schema/v01/LBPoolData.java b/Plugins/Mineplex.BungeeRotator/src/com/neustar/ultraservice/schema/v01/LBPoolData.java deleted file mode 100644 index da8702bf5..000000000 --- a/Plugins/Mineplex.BungeeRotator/src/com/neustar/ultraservice/schema/v01/LBPoolData.java +++ /dev/null @@ -1,97 +0,0 @@ - -package com.neustar.ultraservice.schema.v01; - -import java.util.ArrayList; -import java.util.List; -import javax.xml.bind.annotation.XmlAccessType; -import javax.xml.bind.annotation.XmlAccessorType; -import javax.xml.bind.annotation.XmlAttribute; -import javax.xml.bind.annotation.XmlElement; -import javax.xml.bind.annotation.XmlType; - - -/** - *

Java class for LBPoolData complex type. - * - *

The following schema fragment specifies the expected content contained within this class. - * - *

- * <complexType name="LBPoolData">
- *   <complexContent>
- *     <restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
- *       <sequence>
- *         <element name="PoolData" type="{http://schema.ultraservice.neustar.com/v01/}PoolData" maxOccurs="unbounded"/>
- *       </sequence>
- *       <attribute name="zoneid" use="required" type="{http://www.w3.org/2001/XMLSchema}string" />
- *     </restriction>
- *   </complexContent>
- * </complexType>
- * 
- * - * - */ -@XmlAccessorType(XmlAccessType.FIELD) -@XmlType(name = "LBPoolData", propOrder = { - "poolData" -}) -public class LBPoolData { - - @XmlElement(name = "PoolData", required = true) - protected List poolData; - @XmlAttribute(name = "zoneid", required = true) - protected String zoneid; - - /** - * Gets the value of the poolData property. - * - *

- * This accessor method returns a reference to the live list, - * not a snapshot. Therefore any modification you make to the - * returned list will be present inside the JAXB object. - * This is why there is not a set method for the poolData property. - * - *

- * For example, to add a new item, do as follows: - *

-     *    getPoolData().add(newItem);
-     * 
- * - * - *

- * Objects of the following type(s) are allowed in the list - * {@link PoolData } - * - * - */ - public List getPoolData() { - if (poolData == null) { - poolData = new ArrayList(); - } - return this.poolData; - } - - /** - * Gets the value of the zoneid property. - * - * @return - * possible object is - * {@link String } - * - */ - public String getZoneid() { - return zoneid; - } - - /** - * Sets the value of the zoneid property. - * - * @param value - * allowed object is - * {@link String } - * - */ - public void setZoneid(String value) { - this.zoneid = value; - } - -} diff --git a/Plugins/Mineplex.BungeeRotator/src/com/neustar/ultraservice/schema/v01/LBPoolList.java b/Plugins/Mineplex.BungeeRotator/src/com/neustar/ultraservice/schema/v01/LBPoolList.java deleted file mode 100644 index 4b0ad7077..000000000 --- a/Plugins/Mineplex.BungeeRotator/src/com/neustar/ultraservice/schema/v01/LBPoolList.java +++ /dev/null @@ -1,69 +0,0 @@ - -package com.neustar.ultraservice.schema.v01; - -import java.util.ArrayList; -import java.util.List; -import javax.xml.bind.annotation.XmlAccessType; -import javax.xml.bind.annotation.XmlAccessorType; -import javax.xml.bind.annotation.XmlElement; -import javax.xml.bind.annotation.XmlType; - - -/** - *

Java class for LBPoolList complex type. - * - *

The following schema fragment specifies the expected content contained within this class. - * - *

- * <complexType name="LBPoolList">
- *   <complexContent>
- *     <restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
- *       <sequence>
- *         <element name="LBPoolData" type="{http://schema.ultraservice.neustar.com/v01/}LBPoolData" maxOccurs="unbounded"/>
- *       </sequence>
- *     </restriction>
- *   </complexContent>
- * </complexType>
- * 
- * - * - */ -@XmlAccessorType(XmlAccessType.FIELD) -@XmlType(name = "LBPoolList", propOrder = { - "lbPoolData" -}) -public class LBPoolList { - - @XmlElement(name = "LBPoolData", required = true) - protected List lbPoolData; - - /** - * Gets the value of the lbPoolData property. - * - *

- * This accessor method returns a reference to the live list, - * not a snapshot. Therefore any modification you make to the - * returned list will be present inside the JAXB object. - * This is why there is not a set method for the lbPoolData property. - * - *

- * For example, to add a new item, do as follows: - *

-     *    getLBPoolData().add(newItem);
-     * 
- * - * - *

- * Objects of the following type(s) are allowed in the list - * {@link LBPoolData } - * - * - */ - public List getLBPoolData() { - if (lbPoolData == null) { - lbPoolData = new ArrayList(); - } - return this.lbPoolData; - } - -} diff --git a/Plugins/Mineplex.BungeeRotator/src/com/neustar/ultraservice/schema/v01/MailForwardRecord.java b/Plugins/Mineplex.BungeeRotator/src/com/neustar/ultraservice/schema/v01/MailForwardRecord.java deleted file mode 100644 index b8257c288..000000000 --- a/Plugins/Mineplex.BungeeRotator/src/com/neustar/ultraservice/schema/v01/MailForwardRecord.java +++ /dev/null @@ -1,141 +0,0 @@ - -package com.neustar.ultraservice.schema.v01; - -import javax.xml.bind.annotation.XmlAccessType; -import javax.xml.bind.annotation.XmlAccessorType; -import javax.xml.bind.annotation.XmlAttribute; -import javax.xml.bind.annotation.XmlType; - - -/** - *

Java class for Mail_Forward_Record complex type. - * - *

The following schema fragment specifies the expected content contained within this class. - * - *

- * <complexType name="Mail_Forward_Record">
- *   <complexContent>
- *     <restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
- *       <sequence>
- *       </sequence>
- *       <attribute name="ZoneName" use="required" type="{http://www.w3.org/2001/XMLSchema}string" />
- *       <attribute name="ForwardTo" use="required" type="{http://www.w3.org/2001/XMLSchema}string" />
- *       <attribute name="EmailTo" use="required" type="{http://www.w3.org/2001/XMLSchema}string" />
- *       <attribute name="Guid" use="required" type="{http://www.w3.org/2001/XMLSchema}string" />
- *     </restriction>
- *   </complexContent>
- * </complexType>
- * 
- * - * - */ -@XmlAccessorType(XmlAccessType.FIELD) -@XmlType(name = "Mail_Forward_Record") -public class MailForwardRecord { - - @XmlAttribute(name = "ZoneName", required = true) - protected String zoneName; - @XmlAttribute(name = "ForwardTo", required = true) - protected String forwardTo; - @XmlAttribute(name = "EmailTo", required = true) - protected String emailTo; - @XmlAttribute(name = "Guid", required = true) - protected String guid; - - /** - * Gets the value of the zoneName property. - * - * @return - * possible object is - * {@link String } - * - */ - public String getZoneName() { - return zoneName; - } - - /** - * Sets the value of the zoneName property. - * - * @param value - * allowed object is - * {@link String } - * - */ - public void setZoneName(String value) { - this.zoneName = value; - } - - /** - * Gets the value of the forwardTo property. - * - * @return - * possible object is - * {@link String } - * - */ - public String getForwardTo() { - return forwardTo; - } - - /** - * Sets the value of the forwardTo property. - * - * @param value - * allowed object is - * {@link String } - * - */ - public void setForwardTo(String value) { - this.forwardTo = value; - } - - /** - * Gets the value of the emailTo property. - * - * @return - * possible object is - * {@link String } - * - */ - public String getEmailTo() { - return emailTo; - } - - /** - * Sets the value of the emailTo property. - * - * @param value - * allowed object is - * {@link String } - * - */ - public void setEmailTo(String value) { - this.emailTo = value; - } - - /** - * Gets the value of the guid property. - * - * @return - * possible object is - * {@link String } - * - */ - public String getGuid() { - return guid; - } - - /** - * Sets the value of the guid property. - * - * @param value - * allowed object is - * {@link String } - * - */ - public void setGuid(String value) { - this.guid = value; - } - -} diff --git a/Plugins/Mineplex.BungeeRotator/src/com/neustar/ultraservice/schema/v01/MailFwdRecordsList.java b/Plugins/Mineplex.BungeeRotator/src/com/neustar/ultraservice/schema/v01/MailFwdRecordsList.java deleted file mode 100644 index c1e309ff4..000000000 --- a/Plugins/Mineplex.BungeeRotator/src/com/neustar/ultraservice/schema/v01/MailFwdRecordsList.java +++ /dev/null @@ -1,69 +0,0 @@ - -package com.neustar.ultraservice.schema.v01; - -import java.util.ArrayList; -import java.util.List; -import javax.xml.bind.annotation.XmlAccessType; -import javax.xml.bind.annotation.XmlAccessorType; -import javax.xml.bind.annotation.XmlElement; -import javax.xml.bind.annotation.XmlType; - - -/** - *

Java class for MailFwdRecordsList complex type. - * - *

The following schema fragment specifies the expected content contained within this class. - * - *

- * <complexType name="MailFwdRecordsList">
- *   <complexContent>
- *     <restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
- *       <sequence>
- *         <element name="Mail_Forward_Record" type="{http://schema.ultraservice.neustar.com/v01/}Mail_Forward_Record" maxOccurs="unbounded"/>
- *       </sequence>
- *     </restriction>
- *   </complexContent>
- * </complexType>
- * 
- * - * - */ -@XmlAccessorType(XmlAccessType.FIELD) -@XmlType(name = "MailFwdRecordsList", propOrder = { - "mailForwardRecord" -}) -public class MailFwdRecordsList { - - @XmlElement(name = "Mail_Forward_Record", required = true) - protected List mailForwardRecord; - - /** - * Gets the value of the mailForwardRecord property. - * - *

- * This accessor method returns a reference to the live list, - * not a snapshot. Therefore any modification you make to the - * returned list will be present inside the JAXB object. - * This is why there is not a set method for the mailForwardRecord property. - * - *

- * For example, to add a new item, do as follows: - *

-     *    getMailForwardRecord().add(newItem);
-     * 
- * - * - *

- * Objects of the following type(s) are allowed in the list - * {@link MailForwardRecord } - * - * - */ - public List getMailForwardRecord() { - if (mailForwardRecord == null) { - mailForwardRecord = new ArrayList(); - } - return this.mailForwardRecord; - } - -} diff --git a/Plugins/Mineplex.BungeeRotator/src/com/neustar/ultraservice/schema/v01/MaintenanceAlertsData.java b/Plugins/Mineplex.BungeeRotator/src/com/neustar/ultraservice/schema/v01/MaintenanceAlertsData.java deleted file mode 100644 index 01c0e6031..000000000 --- a/Plugins/Mineplex.BungeeRotator/src/com/neustar/ultraservice/schema/v01/MaintenanceAlertsData.java +++ /dev/null @@ -1,114 +0,0 @@ - -package com.neustar.ultraservice.schema.v01; - -import javax.xml.bind.annotation.XmlAccessType; -import javax.xml.bind.annotation.XmlAccessorType; -import javax.xml.bind.annotation.XmlAttribute; -import javax.xml.bind.annotation.XmlType; - - -/** - *

Java class for MaintenanceAlertsData complex type. - * - *

The following schema fragment specifies the expected content contained within this class. - * - *

- * <complexType name="MaintenanceAlertsData">
- *   <complexContent>
- *     <restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
- *       <sequence>
- *       </sequence>
- *       <attribute name="startDate" type="{http://www.w3.org/2001/XMLSchema}string" />
- *       <attribute name="endDate" type="{http://www.w3.org/2001/XMLSchema}string" />
- *       <attribute name="Description" type="{http://www.w3.org/2001/XMLSchema}string" />
- *     </restriction>
- *   </complexContent>
- * </complexType>
- * 
- * - * - */ -@XmlAccessorType(XmlAccessType.FIELD) -@XmlType(name = "MaintenanceAlertsData") -public class MaintenanceAlertsData { - - @XmlAttribute(name = "startDate") - protected String startDate; - @XmlAttribute(name = "endDate") - protected String endDate; - @XmlAttribute(name = "Description") - protected String description; - - /** - * Gets the value of the startDate property. - * - * @return - * possible object is - * {@link String } - * - */ - public String getStartDate() { - return startDate; - } - - /** - * Sets the value of the startDate property. - * - * @param value - * allowed object is - * {@link String } - * - */ - public void setStartDate(String value) { - this.startDate = value; - } - - /** - * Gets the value of the endDate property. - * - * @return - * possible object is - * {@link String } - * - */ - public String getEndDate() { - return endDate; - } - - /** - * Sets the value of the endDate property. - * - * @param value - * allowed object is - * {@link String } - * - */ - public void setEndDate(String value) { - this.endDate = value; - } - - /** - * Gets the value of the description property. - * - * @return - * possible object is - * {@link String } - * - */ - public String getDescription() { - return description; - } - - /** - * Sets the value of the description property. - * - * @param value - * allowed object is - * {@link String } - * - */ - public void setDescription(String value) { - this.description = value; - } - -} diff --git a/Plugins/Mineplex.BungeeRotator/src/com/neustar/ultraservice/schema/v01/MatchCriteria.java b/Plugins/Mineplex.BungeeRotator/src/com/neustar/ultraservice/schema/v01/MatchCriteria.java deleted file mode 100644 index 5c6fb7c93..000000000 --- a/Plugins/Mineplex.BungeeRotator/src/com/neustar/ultraservice/schema/v01/MatchCriteria.java +++ /dev/null @@ -1,42 +0,0 @@ - -package com.neustar.ultraservice.schema.v01; - -import javax.xml.bind.annotation.XmlEnum; -import javax.xml.bind.annotation.XmlType; - - -/** - *

Java class for MatchCriteria. - * - *

The following schema fragment specifies the expected content contained within this class. - *

- *

- * <simpleType name="MatchCriteria">
- *   <restriction base="{http://www.w3.org/2001/XMLSchema}string">
- *     <enumeration value="BEGINS_WITH"/>
- *     <enumeration value="CONTAINS"/>
- *     <enumeration value="ENDS_WITH"/>
- *     <enumeration value="MATCHES"/>
- *   </restriction>
- * </simpleType>
- * 
- * - */ -@XmlType(name = "MatchCriteria") -@XmlEnum -public enum MatchCriteria { - - BEGINS_WITH, - CONTAINS, - ENDS_WITH, - MATCHES; - - public String value() { - return name(); - } - - public static MatchCriteria fromValue(String v) { - return valueOf(v); - } - -} diff --git a/Plugins/Mineplex.BungeeRotator/src/com/neustar/ultraservice/schema/v01/Method.java b/Plugins/Mineplex.BungeeRotator/src/com/neustar/ultraservice/schema/v01/Method.java deleted file mode 100644 index 62e8eb3a9..000000000 --- a/Plugins/Mineplex.BungeeRotator/src/com/neustar/ultraservice/schema/v01/Method.java +++ /dev/null @@ -1,38 +0,0 @@ - -package com.neustar.ultraservice.schema.v01; - -import javax.xml.bind.annotation.XmlEnum; -import javax.xml.bind.annotation.XmlType; - - -/** - *

Java class for method. - * - *

The following schema fragment specifies the expected content contained within this class. - *

- *

- * <simpleType name="method">
- *   <restriction base="{http://www.w3.org/2001/XMLSchema}string">
- *     <enumeration value="GET"/>
- *     <enumeration value="POST"/>
- *   </restriction>
- * </simpleType>
- * 
- * - */ -@XmlType(name = "method") -@XmlEnum -public enum Method { - - GET, - POST; - - public String value() { - return name(); - } - - public static Method fromValue(String v) { - return valueOf(v); - } - -} diff --git a/Plugins/Mineplex.BungeeRotator/src/com/neustar/ultraservice/schema/v01/MonitoredRDPool.java b/Plugins/Mineplex.BungeeRotator/src/com/neustar/ultraservice/schema/v01/MonitoredRDPool.java deleted file mode 100644 index 1d03638db..000000000 --- a/Plugins/Mineplex.BungeeRotator/src/com/neustar/ultraservice/schema/v01/MonitoredRDPool.java +++ /dev/null @@ -1,255 +0,0 @@ - -package com.neustar.ultraservice.schema.v01; - -import javax.xml.bind.annotation.XmlAccessType; -import javax.xml.bind.annotation.XmlAccessorType; -import javax.xml.bind.annotation.XmlElement; -import javax.xml.bind.annotation.XmlType; - - -/** - *

Java class for MonitoredRDPool complex type. - * - *

The following schema fragment specifies the expected content contained within this class. - * - *

- * <complexType name="MonitoredRDPool">
- *   <complexContent>
- *     <restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
- *       <sequence>
- *         <element name="monitoredRDPoolKey" type="{http://schema.ultraservice.neustar.com/v01/}MonitoredRDPoolKey"/>
- *         <element name="description" type="{http://www.w3.org/2001/XMLSchema}string" minOccurs="0"/>
- *         <element name="poolRecords" type="{http://schema.ultraservice.neustar.com/v01/}MonitoredRDPoolRecords"/>
- *         <element name="allFailRecord" type="{http://schema.ultraservice.neustar.com/v01/}MonitoredRDPoolRecord" minOccurs="0"/>
- *         <element name="ttl" type="{http://www.w3.org/2001/XMLSchema}long"/>
- *         <element name="monitor" type="{http://schema.ultraservice.neustar.com/v01/}MonitoredRDPoolMonitor"/>
- *         <element name="regionThreshold" type="{http://schema.ultraservice.neustar.com/v01/}simpleFailoverPoolRegionThreshold"/>
- *         <element name="status" type="{http://schema.ultraservice.neustar.com/v01/}StatusEnum" minOccurs="0"/>
- *       </sequence>
- *     </restriction>
- *   </complexContent>
- * </complexType>
- * 
- * - * - */ -@XmlAccessorType(XmlAccessType.FIELD) -@XmlType(name = "MonitoredRDPool", propOrder = { - "monitoredRDPoolKey", - "description", - "poolRecords", - "allFailRecord", - "ttl", - "monitor", - "regionThreshold", - "status" -}) -public class MonitoredRDPool { - - @XmlElement(required = true) - protected MonitoredRDPoolKey monitoredRDPoolKey; - protected String description; - @XmlElement(required = true) - protected MonitoredRDPoolRecords poolRecords; - protected MonitoredRDPoolRecord allFailRecord; - @XmlElement(required = true, type = Long.class, nillable = true) - protected Long ttl; - @XmlElement(required = true) - protected MonitoredRDPoolMonitor monitor; - @XmlElement(required = true) - protected SimpleFailoverPoolRegionThreshold regionThreshold; - protected StatusEnum status; - - /** - * Gets the value of the monitoredRDPoolKey property. - * - * @return - * possible object is - * {@link MonitoredRDPoolKey } - * - */ - public MonitoredRDPoolKey getMonitoredRDPoolKey() { - return monitoredRDPoolKey; - } - - /** - * Sets the value of the monitoredRDPoolKey property. - * - * @param value - * allowed object is - * {@link MonitoredRDPoolKey } - * - */ - public void setMonitoredRDPoolKey(MonitoredRDPoolKey value) { - this.monitoredRDPoolKey = value; - } - - /** - * Gets the value of the description property. - * - * @return - * possible object is - * {@link String } - * - */ - public String getDescription() { - return description; - } - - /** - * Sets the value of the description property. - * - * @param value - * allowed object is - * {@link String } - * - */ - public void setDescription(String value) { - this.description = value; - } - - /** - * Gets the value of the poolRecords property. - * - * @return - * possible object is - * {@link MonitoredRDPoolRecords } - * - */ - public MonitoredRDPoolRecords getPoolRecords() { - return poolRecords; - } - - /** - * Sets the value of the poolRecords property. - * - * @param value - * allowed object is - * {@link MonitoredRDPoolRecords } - * - */ - public void setPoolRecords(MonitoredRDPoolRecords value) { - this.poolRecords = value; - } - - /** - * Gets the value of the allFailRecord property. - * - * @return - * possible object is - * {@link MonitoredRDPoolRecord } - * - */ - public MonitoredRDPoolRecord getAllFailRecord() { - return allFailRecord; - } - - /** - * Sets the value of the allFailRecord property. - * - * @param value - * allowed object is - * {@link MonitoredRDPoolRecord } - * - */ - public void setAllFailRecord(MonitoredRDPoolRecord value) { - this.allFailRecord = value; - } - - /** - * Gets the value of the ttl property. - * - * @return - * possible object is - * {@link Long } - * - */ - public Long getTtl() { - return ttl; - } - - /** - * Sets the value of the ttl property. - * - * @param value - * allowed object is - * {@link Long } - * - */ - public void setTtl(Long value) { - this.ttl = value; - } - - /** - * Gets the value of the monitor property. - * - * @return - * possible object is - * {@link MonitoredRDPoolMonitor } - * - */ - public MonitoredRDPoolMonitor getMonitor() { - return monitor; - } - - /** - * Sets the value of the monitor property. - * - * @param value - * allowed object is - * {@link MonitoredRDPoolMonitor } - * - */ - public void setMonitor(MonitoredRDPoolMonitor value) { - this.monitor = value; - } - - /** - * Gets the value of the regionThreshold property. - * - * @return - * possible object is - * {@link SimpleFailoverPoolRegionThreshold } - * - */ - public SimpleFailoverPoolRegionThreshold getRegionThreshold() { - return regionThreshold; - } - - /** - * Sets the value of the regionThreshold property. - * - * @param value - * allowed object is - * {@link SimpleFailoverPoolRegionThreshold } - * - */ - public void setRegionThreshold(SimpleFailoverPoolRegionThreshold value) { - this.regionThreshold = value; - } - - /** - * Gets the value of the status property. - * - * @return - * possible object is - * {@link StatusEnum } - * - */ - public StatusEnum getStatus() { - return status; - } - - /** - * Sets the value of the status property. - * - * @param value - * allowed object is - * {@link StatusEnum } - * - */ - public void setStatus(StatusEnum value) { - this.status = value; - } - -} diff --git a/Plugins/Mineplex.BungeeRotator/src/com/neustar/ultraservice/schema/v01/MonitoredRDPoolAdd.java b/Plugins/Mineplex.BungeeRotator/src/com/neustar/ultraservice/schema/v01/MonitoredRDPoolAdd.java deleted file mode 100644 index eddcb839a..000000000 --- a/Plugins/Mineplex.BungeeRotator/src/com/neustar/ultraservice/schema/v01/MonitoredRDPoolAdd.java +++ /dev/null @@ -1,228 +0,0 @@ - -package com.neustar.ultraservice.schema.v01; - -import javax.xml.bind.annotation.XmlAccessType; -import javax.xml.bind.annotation.XmlAccessorType; -import javax.xml.bind.annotation.XmlElement; -import javax.xml.bind.annotation.XmlType; - - -/** - *

Java class for MonitoredRDPoolAdd complex type. - * - *

The following schema fragment specifies the expected content contained within this class. - * - *

- * <complexType name="MonitoredRDPoolAdd">
- *   <complexContent>
- *     <restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
- *       <sequence>
- *         <element name="monitoredRDPoolKey" type="{http://schema.ultraservice.neustar.com/v01/}MonitoredRDPoolKey"/>
- *         <element name="description" type="{http://www.w3.org/2001/XMLSchema}string" minOccurs="0"/>
- *         <element name="poolRecords" type="{http://schema.ultraservice.neustar.com/v01/}MonitoredRDPoolRecordsAdd"/>
- *         <element name="allFailRecord" type="{http://schema.ultraservice.neustar.com/v01/}MonitoredRDPoolRecordAdd" minOccurs="0"/>
- *         <element name="ttl" type="{http://www.w3.org/2001/XMLSchema}long"/>
- *         <element name="monitor" type="{http://schema.ultraservice.neustar.com/v01/}MonitoredRDPoolMonitor"/>
- *         <element name="regionThreshold" type="{http://schema.ultraservice.neustar.com/v01/}simpleFailoverPoolRegionThreshold"/>
- *       </sequence>
- *     </restriction>
- *   </complexContent>
- * </complexType>
- * 
- * - * - */ -@XmlAccessorType(XmlAccessType.FIELD) -@XmlType(name = "MonitoredRDPoolAdd", propOrder = { - "monitoredRDPoolKey", - "description", - "poolRecords", - "allFailRecord", - "ttl", - "monitor", - "regionThreshold" -}) -public class MonitoredRDPoolAdd { - - @XmlElement(required = true) - protected MonitoredRDPoolKey monitoredRDPoolKey; - protected String description; - @XmlElement(required = true) - protected MonitoredRDPoolRecordsAdd poolRecords; - protected MonitoredRDPoolRecordAdd allFailRecord; - @XmlElement(required = true, type = Long.class, nillable = true) - protected Long ttl; - @XmlElement(required = true) - protected MonitoredRDPoolMonitor monitor; - @XmlElement(required = true) - protected SimpleFailoverPoolRegionThreshold regionThreshold; - - /** - * Gets the value of the monitoredRDPoolKey property. - * - * @return - * possible object is - * {@link MonitoredRDPoolKey } - * - */ - public MonitoredRDPoolKey getMonitoredRDPoolKey() { - return monitoredRDPoolKey; - } - - /** - * Sets the value of the monitoredRDPoolKey property. - * - * @param value - * allowed object is - * {@link MonitoredRDPoolKey } - * - */ - public void setMonitoredRDPoolKey(MonitoredRDPoolKey value) { - this.monitoredRDPoolKey = value; - } - - /** - * Gets the value of the description property. - * - * @return - * possible object is - * {@link String } - * - */ - public String getDescription() { - return description; - } - - /** - * Sets the value of the description property. - * - * @param value - * allowed object is - * {@link String } - * - */ - public void setDescription(String value) { - this.description = value; - } - - /** - * Gets the value of the poolRecords property. - * - * @return - * possible object is - * {@link MonitoredRDPoolRecordsAdd } - * - */ - public MonitoredRDPoolRecordsAdd getPoolRecords() { - return poolRecords; - } - - /** - * Sets the value of the poolRecords property. - * - * @param value - * allowed object is - * {@link MonitoredRDPoolRecordsAdd } - * - */ - public void setPoolRecords(MonitoredRDPoolRecordsAdd value) { - this.poolRecords = value; - } - - /** - * Gets the value of the allFailRecord property. - * - * @return - * possible object is - * {@link MonitoredRDPoolRecordAdd } - * - */ - public MonitoredRDPoolRecordAdd getAllFailRecord() { - return allFailRecord; - } - - /** - * Sets the value of the allFailRecord property. - * - * @param value - * allowed object is - * {@link MonitoredRDPoolRecordAdd } - * - */ - public void setAllFailRecord(MonitoredRDPoolRecordAdd value) { - this.allFailRecord = value; - } - - /** - * Gets the value of the ttl property. - * - * @return - * possible object is - * {@link Long } - * - */ - public Long getTtl() { - return ttl; - } - - /** - * Sets the value of the ttl property. - * - * @param value - * allowed object is - * {@link Long } - * - */ - public void setTtl(Long value) { - this.ttl = value; - } - - /** - * Gets the value of the monitor property. - * - * @return - * possible object is - * {@link MonitoredRDPoolMonitor } - * - */ - public MonitoredRDPoolMonitor getMonitor() { - return monitor; - } - - /** - * Sets the value of the monitor property. - * - * @param value - * allowed object is - * {@link MonitoredRDPoolMonitor } - * - */ - public void setMonitor(MonitoredRDPoolMonitor value) { - this.monitor = value; - } - - /** - * Gets the value of the regionThreshold property. - * - * @return - * possible object is - * {@link SimpleFailoverPoolRegionThreshold } - * - */ - public SimpleFailoverPoolRegionThreshold getRegionThreshold() { - return regionThreshold; - } - - /** - * Sets the value of the regionThreshold property. - * - * @param value - * allowed object is - * {@link SimpleFailoverPoolRegionThreshold } - * - */ - public void setRegionThreshold(SimpleFailoverPoolRegionThreshold value) { - this.regionThreshold = value; - } - -} diff --git a/Plugins/Mineplex.BungeeRotator/src/com/neustar/ultraservice/schema/v01/MonitoredRDPoolAllFailRecordUpdate.java b/Plugins/Mineplex.BungeeRotator/src/com/neustar/ultraservice/schema/v01/MonitoredRDPoolAllFailRecordUpdate.java deleted file mode 100644 index 3d2882ac5..000000000 --- a/Plugins/Mineplex.BungeeRotator/src/com/neustar/ultraservice/schema/v01/MonitoredRDPoolAllFailRecordUpdate.java +++ /dev/null @@ -1,89 +0,0 @@ - -package com.neustar.ultraservice.schema.v01; - -import javax.xml.bind.annotation.XmlAccessType; -import javax.xml.bind.annotation.XmlAccessorType; -import javax.xml.bind.annotation.XmlElement; -import javax.xml.bind.annotation.XmlType; - - -/** - *

Java class for MonitoredRDPoolAllFailRecordUpdate complex type. - * - *

The following schema fragment specifies the expected content contained within this class. - * - *

- * <complexType name="MonitoredRDPoolAllFailRecordUpdate">
- *   <complexContent>
- *     <restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
- *       <sequence>
- *         <element name="recordValue" type="{http://www.w3.org/2001/XMLSchema}string"/>
- *         <element name="description" type="{http://www.w3.org/2001/XMLSchema}string" minOccurs="0"/>
- *       </sequence>
- *     </restriction>
- *   </complexContent>
- * </complexType>
- * 
- * - * - */ -@XmlAccessorType(XmlAccessType.FIELD) -@XmlType(name = "MonitoredRDPoolAllFailRecordUpdate", propOrder = { - "recordValue", - "description" -}) -public class MonitoredRDPoolAllFailRecordUpdate { - - @XmlElement(required = true) - protected String recordValue; - protected String description; - - /** - * Gets the value of the recordValue property. - * - * @return - * possible object is - * {@link String } - * - */ - public String getRecordValue() { - return recordValue; - } - - /** - * Sets the value of the recordValue property. - * - * @param value - * allowed object is - * {@link String } - * - */ - public void setRecordValue(String value) { - this.recordValue = value; - } - - /** - * Gets the value of the description property. - * - * @return - * possible object is - * {@link String } - * - */ - public String getDescription() { - return description; - } - - /** - * Sets the value of the description property. - * - * @param value - * allowed object is - * {@link String } - * - */ - public void setDescription(String value) { - this.description = value; - } - -} diff --git a/Plugins/Mineplex.BungeeRotator/src/com/neustar/ultraservice/schema/v01/MonitoredRDPoolConversionInfo.java b/Plugins/Mineplex.BungeeRotator/src/com/neustar/ultraservice/schema/v01/MonitoredRDPoolConversionInfo.java deleted file mode 100644 index 53b114ead..000000000 --- a/Plugins/Mineplex.BungeeRotator/src/com/neustar/ultraservice/schema/v01/MonitoredRDPoolConversionInfo.java +++ /dev/null @@ -1,118 +0,0 @@ - -package com.neustar.ultraservice.schema.v01; - -import javax.xml.bind.annotation.XmlAccessType; -import javax.xml.bind.annotation.XmlAccessorType; -import javax.xml.bind.annotation.XmlElement; -import javax.xml.bind.annotation.XmlType; -import com.neustar.ultra.api.webservice.v01.ConversionTypeEnum; - - -/** - *

Java class for MonitoredRDPoolConversionInfo complex type. - * - *

The following schema fragment specifies the expected content contained within this class. - * - *

- * <complexType name="MonitoredRDPoolConversionInfo">
- *   <complexContent>
- *     <restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
- *       <sequence>
- *         <element name="monitoredRDPoolKey" type="{http://schema.ultraservice.neustar.com/v01/}MonitoredRDPoolKey"/>
- *         <element name="conversionType" type="{http://webservice.api.ultra.neustar.com/v01/}conversionTypeEnum"/>
- *         <element name="keptRecord" type="{http://www.w3.org/2001/XMLSchema}string" minOccurs="0"/>
- *       </sequence>
- *     </restriction>
- *   </complexContent>
- * </complexType>
- * 
- * - * - */ -@XmlAccessorType(XmlAccessType.FIELD) -@XmlType(name = "MonitoredRDPoolConversionInfo", propOrder = { - "monitoredRDPoolKey", - "conversionType", - "keptRecord" -}) -public class MonitoredRDPoolConversionInfo { - - @XmlElement(required = true) - protected MonitoredRDPoolKey monitoredRDPoolKey; - @XmlElement(required = true) - protected ConversionTypeEnum conversionType; - protected String keptRecord; - - /** - * Gets the value of the monitoredRDPoolKey property. - * - * @return - * possible object is - * {@link MonitoredRDPoolKey } - * - */ - public MonitoredRDPoolKey getMonitoredRDPoolKey() { - return monitoredRDPoolKey; - } - - /** - * Sets the value of the monitoredRDPoolKey property. - * - * @param value - * allowed object is - * {@link MonitoredRDPoolKey } - * - */ - public void setMonitoredRDPoolKey(MonitoredRDPoolKey value) { - this.monitoredRDPoolKey = value; - } - - /** - * Gets the value of the conversionType property. - * - * @return - * possible object is - * {@link ConversionTypeEnum } - * - */ - public ConversionTypeEnum getConversionType() { - return conversionType; - } - - /** - * Sets the value of the conversionType property. - * - * @param value - * allowed object is - * {@link ConversionTypeEnum } - * - */ - public void setConversionType(ConversionTypeEnum value) { - this.conversionType = value; - } - - /** - * Gets the value of the keptRecord property. - * - * @return - * possible object is - * {@link String } - * - */ - public String getKeptRecord() { - return keptRecord; - } - - /** - * Sets the value of the keptRecord property. - * - * @param value - * allowed object is - * {@link String } - * - */ - public void setKeptRecord(String value) { - this.keptRecord = value; - } - -} diff --git a/Plugins/Mineplex.BungeeRotator/src/com/neustar/ultraservice/schema/v01/MonitoredRDPoolKey.java b/Plugins/Mineplex.BungeeRotator/src/com/neustar/ultraservice/schema/v01/MonitoredRDPoolKey.java deleted file mode 100644 index d0648dd03..000000000 --- a/Plugins/Mineplex.BungeeRotator/src/com/neustar/ultraservice/schema/v01/MonitoredRDPoolKey.java +++ /dev/null @@ -1,117 +0,0 @@ - -package com.neustar.ultraservice.schema.v01; - -import javax.xml.bind.annotation.XmlAccessType; -import javax.xml.bind.annotation.XmlAccessorType; -import javax.xml.bind.annotation.XmlElement; -import javax.xml.bind.annotation.XmlType; - - -/** - *

Java class for MonitoredRDPoolKey complex type. - * - *

The following schema fragment specifies the expected content contained within this class. - * - *

- * <complexType name="MonitoredRDPoolKey">
- *   <complexContent>
- *     <restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
- *       <sequence>
- *         <element name="zoneName" type="{http://www.w3.org/2001/XMLSchema}string"/>
- *         <element name="hostName" type="{http://www.w3.org/2001/XMLSchema}string"/>
- *         <element name="type" type="{http://www.w3.org/2001/XMLSchema}string" minOccurs="0"/>
- *       </sequence>
- *     </restriction>
- *   </complexContent>
- * </complexType>
- * 
- * - * - */ -@XmlAccessorType(XmlAccessType.FIELD) -@XmlType(name = "MonitoredRDPoolKey", propOrder = { - "zoneName", - "hostName", - "type" -}) -public class MonitoredRDPoolKey { - - @XmlElement(required = true) - protected String zoneName; - @XmlElement(required = true) - protected String hostName; - protected String type; - - /** - * Gets the value of the zoneName property. - * - * @return - * possible object is - * {@link String } - * - */ - public String getZoneName() { - return zoneName; - } - - /** - * Sets the value of the zoneName property. - * - * @param value - * allowed object is - * {@link String } - * - */ - public void setZoneName(String value) { - this.zoneName = value; - } - - /** - * Gets the value of the hostName property. - * - * @return - * possible object is - * {@link String } - * - */ - public String getHostName() { - return hostName; - } - - /** - * Sets the value of the hostName property. - * - * @param value - * allowed object is - * {@link String } - * - */ - public void setHostName(String value) { - this.hostName = value; - } - - /** - * Gets the value of the type property. - * - * @return - * possible object is - * {@link String } - * - */ - public String getType() { - return type; - } - - /** - * Sets the value of the type property. - * - * @param value - * allowed object is - * {@link String } - * - */ - public void setType(String value) { - this.type = value; - } - -} diff --git a/Plugins/Mineplex.BungeeRotator/src/com/neustar/ultraservice/schema/v01/MonitoredRDPoolListKey.java b/Plugins/Mineplex.BungeeRotator/src/com/neustar/ultraservice/schema/v01/MonitoredRDPoolListKey.java deleted file mode 100644 index 39a34a5c1..000000000 --- a/Plugins/Mineplex.BungeeRotator/src/com/neustar/ultraservice/schema/v01/MonitoredRDPoolListKey.java +++ /dev/null @@ -1,90 +0,0 @@ - -package com.neustar.ultraservice.schema.v01; - -import javax.xml.bind.annotation.XmlAccessType; -import javax.xml.bind.annotation.XmlAccessorType; -import javax.xml.bind.annotation.XmlElement; -import javax.xml.bind.annotation.XmlType; - - -/** - *

Java class for MonitoredRDPoolListKey complex type. - * - *

The following schema fragment specifies the expected content contained within this class. - * - *

- * <complexType name="MonitoredRDPoolListKey">
- *   <complexContent>
- *     <restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
- *       <sequence>
- *         <element name="zoneName" type="{http://www.w3.org/2001/XMLSchema}string"/>
- *         <element name="poolListParams" type="{http://schema.ultraservice.neustar.com/v01/}PoolListParams"/>
- *       </sequence>
- *     </restriction>
- *   </complexContent>
- * </complexType>
- * 
- * - * - */ -@XmlAccessorType(XmlAccessType.FIELD) -@XmlType(name = "MonitoredRDPoolListKey", propOrder = { - "zoneName", - "poolListParams" -}) -public class MonitoredRDPoolListKey { - - @XmlElement(required = true) - protected String zoneName; - @XmlElement(required = true) - protected PoolListParams poolListParams; - - /** - * Gets the value of the zoneName property. - * - * @return - * possible object is - * {@link String } - * - */ - public String getZoneName() { - return zoneName; - } - - /** - * Sets the value of the zoneName property. - * - * @param value - * allowed object is - * {@link String } - * - */ - public void setZoneName(String value) { - this.zoneName = value; - } - - /** - * Gets the value of the poolListParams property. - * - * @return - * possible object is - * {@link PoolListParams } - * - */ - public PoolListParams getPoolListParams() { - return poolListParams; - } - - /** - * Sets the value of the poolListParams property. - * - * @param value - * allowed object is - * {@link PoolListParams } - * - */ - public void setPoolListParams(PoolListParams value) { - this.poolListParams = value; - } - -} diff --git a/Plugins/Mineplex.BungeeRotator/src/com/neustar/ultraservice/schema/v01/MonitoredRDPoolMonitor.java b/Plugins/Mineplex.BungeeRotator/src/com/neustar/ultraservice/schema/v01/MonitoredRDPoolMonitor.java deleted file mode 100644 index b95103501..000000000 --- a/Plugins/Mineplex.BungeeRotator/src/com/neustar/ultraservice/schema/v01/MonitoredRDPoolMonitor.java +++ /dev/null @@ -1,144 +0,0 @@ - -package com.neustar.ultraservice.schema.v01; - -import javax.xml.bind.annotation.XmlAccessType; -import javax.xml.bind.annotation.XmlAccessorType; -import javax.xml.bind.annotation.XmlElement; -import javax.xml.bind.annotation.XmlType; - - -/** - *

Java class for MonitoredRDPoolMonitor complex type. - * - *

The following schema fragment specifies the expected content contained within this class. - * - *

- * <complexType name="MonitoredRDPoolMonitor">
- *   <complexContent>
- *     <restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
- *       <sequence>
- *         <element name="method" type="{http://schema.ultraservice.neustar.com/v01/}failoverMonitorMethod"/>
- *         <element name="url" type="{http://www.w3.org/2001/XMLSchema}string"/>
- *         <element name="transmittedData" type="{http://www.w3.org/2001/XMLSchema}string" minOccurs="0"/>
- *         <element name="searchString" type="{http://www.w3.org/2001/XMLSchema}string" minOccurs="0"/>
- *       </sequence>
- *     </restriction>
- *   </complexContent>
- * </complexType>
- * 
- * - * - */ -@XmlAccessorType(XmlAccessType.FIELD) -@XmlType(name = "MonitoredRDPoolMonitor", propOrder = { - "method", - "url", - "transmittedData", - "searchString" -}) -public class MonitoredRDPoolMonitor { - - @XmlElement(required = true) - protected FailoverMonitorMethod method; - @XmlElement(required = true) - protected String url; - protected String transmittedData; - protected String searchString; - - /** - * Gets the value of the method property. - * - * @return - * possible object is - * {@link FailoverMonitorMethod } - * - */ - public FailoverMonitorMethod getMethod() { - return method; - } - - /** - * Sets the value of the method property. - * - * @param value - * allowed object is - * {@link FailoverMonitorMethod } - * - */ - public void setMethod(FailoverMonitorMethod value) { - this.method = value; - } - - /** - * Gets the value of the url property. - * - * @return - * possible object is - * {@link String } - * - */ - public String getUrl() { - return url; - } - - /** - * Sets the value of the url property. - * - * @param value - * allowed object is - * {@link String } - * - */ - public void setUrl(String value) { - this.url = value; - } - - /** - * Gets the value of the transmittedData property. - * - * @return - * possible object is - * {@link String } - * - */ - public String getTransmittedData() { - return transmittedData; - } - - /** - * Sets the value of the transmittedData property. - * - * @param value - * allowed object is - * {@link String } - * - */ - public void setTransmittedData(String value) { - this.transmittedData = value; - } - - /** - * Gets the value of the searchString property. - * - * @return - * possible object is - * {@link String } - * - */ - public String getSearchString() { - return searchString; - } - - /** - * Sets the value of the searchString property. - * - * @param value - * allowed object is - * {@link String } - * - */ - public void setSearchString(String value) { - this.searchString = value; - } - -} diff --git a/Plugins/Mineplex.BungeeRotator/src/com/neustar/ultraservice/schema/v01/MonitoredRDPoolMonitorUpdate.java b/Plugins/Mineplex.BungeeRotator/src/com/neustar/ultraservice/schema/v01/MonitoredRDPoolMonitorUpdate.java deleted file mode 100644 index adbfe224a..000000000 --- a/Plugins/Mineplex.BungeeRotator/src/com/neustar/ultraservice/schema/v01/MonitoredRDPoolMonitorUpdate.java +++ /dev/null @@ -1,141 +0,0 @@ - -package com.neustar.ultraservice.schema.v01; - -import javax.xml.bind.annotation.XmlAccessType; -import javax.xml.bind.annotation.XmlAccessorType; -import javax.xml.bind.annotation.XmlType; - - -/** - *

Java class for MonitoredRDPoolMonitorUpdate complex type. - * - *

The following schema fragment specifies the expected content contained within this class. - * - *

- * <complexType name="MonitoredRDPoolMonitorUpdate">
- *   <complexContent>
- *     <restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
- *       <sequence>
- *         <element name="method" type="{http://schema.ultraservice.neustar.com/v01/}failoverMonitorMethod" minOccurs="0"/>
- *         <element name="url" type="{http://www.w3.org/2001/XMLSchema}string" minOccurs="0"/>
- *         <element name="transmittedData" type="{http://www.w3.org/2001/XMLSchema}string" minOccurs="0"/>
- *         <element name="searchString" type="{http://www.w3.org/2001/XMLSchema}string" minOccurs="0"/>
- *       </sequence>
- *     </restriction>
- *   </complexContent>
- * </complexType>
- * 
- * - * - */ -@XmlAccessorType(XmlAccessType.FIELD) -@XmlType(name = "MonitoredRDPoolMonitorUpdate", propOrder = { - "method", - "url", - "transmittedData", - "searchString" -}) -public class MonitoredRDPoolMonitorUpdate { - - protected FailoverMonitorMethod method; - protected String url; - protected String transmittedData; - protected String searchString; - - /** - * Gets the value of the method property. - * - * @return - * possible object is - * {@link FailoverMonitorMethod } - * - */ - public FailoverMonitorMethod getMethod() { - return method; - } - - /** - * Sets the value of the method property. - * - * @param value - * allowed object is - * {@link FailoverMonitorMethod } - * - */ - public void setMethod(FailoverMonitorMethod value) { - this.method = value; - } - - /** - * Gets the value of the url property. - * - * @return - * possible object is - * {@link String } - * - */ - public String getUrl() { - return url; - } - - /** - * Sets the value of the url property. - * - * @param value - * allowed object is - * {@link String } - * - */ - public void setUrl(String value) { - this.url = value; - } - - /** - * Gets the value of the transmittedData property. - * - * @return - * possible object is - * {@link String } - * - */ - public String getTransmittedData() { - return transmittedData; - } - - /** - * Sets the value of the transmittedData property. - * - * @param value - * allowed object is - * {@link String } - * - */ - public void setTransmittedData(String value) { - this.transmittedData = value; - } - - /** - * Gets the value of the searchString property. - * - * @return - * possible object is - * {@link String } - * - */ - public String getSearchString() { - return searchString; - } - - /** - * Sets the value of the searchString property. - * - * @param value - * allowed object is - * {@link String } - * - */ - public void setSearchString(String value) { - this.searchString = value; - } - -} diff --git a/Plugins/Mineplex.BungeeRotator/src/com/neustar/ultraservice/schema/v01/MonitoredRDPoolRecord.java b/Plugins/Mineplex.BungeeRotator/src/com/neustar/ultraservice/schema/v01/MonitoredRDPoolRecord.java deleted file mode 100644 index 3189f3169..000000000 --- a/Plugins/Mineplex.BungeeRotator/src/com/neustar/ultraservice/schema/v01/MonitoredRDPoolRecord.java +++ /dev/null @@ -1,109 +0,0 @@ - -package com.neustar.ultraservice.schema.v01; - -import javax.xml.bind.annotation.XmlAccessType; -import javax.xml.bind.annotation.XmlAccessorType; -import javax.xml.bind.annotation.XmlAttribute; -import javax.xml.bind.annotation.XmlElement; -import javax.xml.bind.annotation.XmlType; - - -/** - *

Java class for MonitoredRDPoolRecord complex type. - * - *

The following schema fragment specifies the expected content contained within this class. - * - *

- * <complexType name="MonitoredRDPoolRecord">
- *   <complexContent>
- *     <restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
- *       <sequence>
- *         <element name="recordValue" type="{http://www.w3.org/2001/XMLSchema}string"/>
- *         <element name="description" type="{http://www.w3.org/2001/XMLSchema}string" minOccurs="0"/>
- *       </sequence>
- *       <attribute name="active" use="required" type="{http://www.w3.org/2001/XMLSchema}boolean" />
- *     </restriction>
- *   </complexContent>
- * </complexType>
- * 
- * - * - */ -@XmlAccessorType(XmlAccessType.FIELD) -@XmlType(name = "MonitoredRDPoolRecord", propOrder = { - "recordValue", - "description" -}) -public class MonitoredRDPoolRecord { - - @XmlElement(required = true) - protected String recordValue; - protected String description; - @XmlAttribute(name = "active", required = true) - protected boolean active; - - /** - * Gets the value of the recordValue property. - * - * @return - * possible object is - * {@link String } - * - */ - public String getRecordValue() { - return recordValue; - } - - /** - * Sets the value of the recordValue property. - * - * @param value - * allowed object is - * {@link String } - * - */ - public void setRecordValue(String value) { - this.recordValue = value; - } - - /** - * Gets the value of the description property. - * - * @return - * possible object is - * {@link String } - * - */ - public String getDescription() { - return description; - } - - /** - * Sets the value of the description property. - * - * @param value - * allowed object is - * {@link String } - * - */ - public void setDescription(String value) { - this.description = value; - } - - /** - * Gets the value of the active property. - * - */ - public boolean isActive() { - return active; - } - - /** - * Sets the value of the active property. - * - */ - public void setActive(boolean value) { - this.active = value; - } - -} diff --git a/Plugins/Mineplex.BungeeRotator/src/com/neustar/ultraservice/schema/v01/MonitoredRDPoolRecordAdd.java b/Plugins/Mineplex.BungeeRotator/src/com/neustar/ultraservice/schema/v01/MonitoredRDPoolRecordAdd.java deleted file mode 100644 index 1f98a52c5..000000000 --- a/Plugins/Mineplex.BungeeRotator/src/com/neustar/ultraservice/schema/v01/MonitoredRDPoolRecordAdd.java +++ /dev/null @@ -1,89 +0,0 @@ - -package com.neustar.ultraservice.schema.v01; - -import javax.xml.bind.annotation.XmlAccessType; -import javax.xml.bind.annotation.XmlAccessorType; -import javax.xml.bind.annotation.XmlElement; -import javax.xml.bind.annotation.XmlType; - - -/** - *

Java class for MonitoredRDPoolRecordAdd complex type. - * - *

The following schema fragment specifies the expected content contained within this class. - * - *

- * <complexType name="MonitoredRDPoolRecordAdd">
- *   <complexContent>
- *     <restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
- *       <sequence>
- *         <element name="recordValue" type="{http://www.w3.org/2001/XMLSchema}string"/>
- *         <element name="description" type="{http://www.w3.org/2001/XMLSchema}string" minOccurs="0"/>
- *       </sequence>
- *     </restriction>
- *   </complexContent>
- * </complexType>
- * 
- * - * - */ -@XmlAccessorType(XmlAccessType.FIELD) -@XmlType(name = "MonitoredRDPoolRecordAdd", propOrder = { - "recordValue", - "description" -}) -public class MonitoredRDPoolRecordAdd { - - @XmlElement(required = true) - protected String recordValue; - protected String description; - - /** - * Gets the value of the recordValue property. - * - * @return - * possible object is - * {@link String } - * - */ - public String getRecordValue() { - return recordValue; - } - - /** - * Sets the value of the recordValue property. - * - * @param value - * allowed object is - * {@link String } - * - */ - public void setRecordValue(String value) { - this.recordValue = value; - } - - /** - * Gets the value of the description property. - * - * @return - * possible object is - * {@link String } - * - */ - public String getDescription() { - return description; - } - - /** - * Sets the value of the description property. - * - * @param value - * allowed object is - * {@link String } - * - */ - public void setDescription(String value) { - this.description = value; - } - -} diff --git a/Plugins/Mineplex.BungeeRotator/src/com/neustar/ultraservice/schema/v01/MonitoredRDPoolRecords.java b/Plugins/Mineplex.BungeeRotator/src/com/neustar/ultraservice/schema/v01/MonitoredRDPoolRecords.java deleted file mode 100644 index bc65864d3..000000000 --- a/Plugins/Mineplex.BungeeRotator/src/com/neustar/ultraservice/schema/v01/MonitoredRDPoolRecords.java +++ /dev/null @@ -1,97 +0,0 @@ - -package com.neustar.ultraservice.schema.v01; - -import java.util.ArrayList; -import java.util.List; -import javax.xml.bind.annotation.XmlAccessType; -import javax.xml.bind.annotation.XmlAccessorType; -import javax.xml.bind.annotation.XmlAttribute; -import javax.xml.bind.annotation.XmlElement; -import javax.xml.bind.annotation.XmlType; - - -/** - *

Java class for MonitoredRDPoolRecords complex type. - * - *

The following schema fragment specifies the expected content contained within this class. - * - *

- * <complexType name="MonitoredRDPoolRecords">
- *   <complexContent>
- *     <restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
- *       <sequence>
- *         <element name="liveRecord" type="{http://schema.ultraservice.neustar.com/v01/}MonitoredRDPoolRecord" maxOccurs="unbounded"/>
- *       </sequence>
- *       <attribute name="responseMethod" use="required" type="{http://schema.ultraservice.neustar.com/v01/}ResponseMethod" />
- *     </restriction>
- *   </complexContent>
- * </complexType>
- * 
- * - * - */ -@XmlAccessorType(XmlAccessType.FIELD) -@XmlType(name = "MonitoredRDPoolRecords", propOrder = { - "liveRecord" -}) -public class MonitoredRDPoolRecords { - - @XmlElement(required = true) - protected List liveRecord; - @XmlAttribute(name = "responseMethod", required = true) - protected ResponseMethod responseMethod; - - /** - * Gets the value of the liveRecord property. - * - *

- * This accessor method returns a reference to the live list, - * not a snapshot. Therefore any modification you make to the - * returned list will be present inside the JAXB object. - * This is why there is not a set method for the liveRecord property. - * - *

- * For example, to add a new item, do as follows: - *

-     *    getLiveRecord().add(newItem);
-     * 
- * - * - *

- * Objects of the following type(s) are allowed in the list - * {@link MonitoredRDPoolRecord } - * - * - */ - public List getLiveRecord() { - if (liveRecord == null) { - liveRecord = new ArrayList(); - } - return this.liveRecord; - } - - /** - * Gets the value of the responseMethod property. - * - * @return - * possible object is - * {@link ResponseMethod } - * - */ - public ResponseMethod getResponseMethod() { - return responseMethod; - } - - /** - * Sets the value of the responseMethod property. - * - * @param value - * allowed object is - * {@link ResponseMethod } - * - */ - public void setResponseMethod(ResponseMethod value) { - this.responseMethod = value; - } - -} diff --git a/Plugins/Mineplex.BungeeRotator/src/com/neustar/ultraservice/schema/v01/MonitoredRDPoolRecordsAdd.java b/Plugins/Mineplex.BungeeRotator/src/com/neustar/ultraservice/schema/v01/MonitoredRDPoolRecordsAdd.java deleted file mode 100644 index 1d8685a9d..000000000 --- a/Plugins/Mineplex.BungeeRotator/src/com/neustar/ultraservice/schema/v01/MonitoredRDPoolRecordsAdd.java +++ /dev/null @@ -1,97 +0,0 @@ - -package com.neustar.ultraservice.schema.v01; - -import java.util.ArrayList; -import java.util.List; -import javax.xml.bind.annotation.XmlAccessType; -import javax.xml.bind.annotation.XmlAccessorType; -import javax.xml.bind.annotation.XmlAttribute; -import javax.xml.bind.annotation.XmlElement; -import javax.xml.bind.annotation.XmlType; - - -/** - *

Java class for MonitoredRDPoolRecordsAdd complex type. - * - *

The following schema fragment specifies the expected content contained within this class. - * - *

- * <complexType name="MonitoredRDPoolRecordsAdd">
- *   <complexContent>
- *     <restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
- *       <sequence>
- *         <element name="liveRecord" type="{http://schema.ultraservice.neustar.com/v01/}MonitoredRDPoolRecordAdd" maxOccurs="unbounded"/>
- *       </sequence>
- *       <attribute name="responseMethod" use="required" type="{http://schema.ultraservice.neustar.com/v01/}ResponseMethod" />
- *     </restriction>
- *   </complexContent>
- * </complexType>
- * 
- * - * - */ -@XmlAccessorType(XmlAccessType.FIELD) -@XmlType(name = "MonitoredRDPoolRecordsAdd", propOrder = { - "liveRecord" -}) -public class MonitoredRDPoolRecordsAdd { - - @XmlElement(required = true) - protected List liveRecord; - @XmlAttribute(name = "responseMethod", required = true) - protected ResponseMethod responseMethod; - - /** - * Gets the value of the liveRecord property. - * - *

- * This accessor method returns a reference to the live list, - * not a snapshot. Therefore any modification you make to the - * returned list will be present inside the JAXB object. - * This is why there is not a set method for the liveRecord property. - * - *

- * For example, to add a new item, do as follows: - *

-     *    getLiveRecord().add(newItem);
-     * 
- * - * - *

- * Objects of the following type(s) are allowed in the list - * {@link MonitoredRDPoolRecordAdd } - * - * - */ - public List getLiveRecord() { - if (liveRecord == null) { - liveRecord = new ArrayList(); - } - return this.liveRecord; - } - - /** - * Gets the value of the responseMethod property. - * - * @return - * possible object is - * {@link ResponseMethod } - * - */ - public ResponseMethod getResponseMethod() { - return responseMethod; - } - - /** - * Sets the value of the responseMethod property. - * - * @param value - * allowed object is - * {@link ResponseMethod } - * - */ - public void setResponseMethod(ResponseMethod value) { - this.responseMethod = value; - } - -} diff --git a/Plugins/Mineplex.BungeeRotator/src/com/neustar/ultraservice/schema/v01/MonitoredRDPoolUpdate.java b/Plugins/Mineplex.BungeeRotator/src/com/neustar/ultraservice/schema/v01/MonitoredRDPoolUpdate.java deleted file mode 100644 index 6a7ad61f1..000000000 --- a/Plugins/Mineplex.BungeeRotator/src/com/neustar/ultraservice/schema/v01/MonitoredRDPoolUpdate.java +++ /dev/null @@ -1,227 +0,0 @@ - -package com.neustar.ultraservice.schema.v01; - -import javax.xml.bind.JAXBElement; -import javax.xml.bind.annotation.XmlAccessType; -import javax.xml.bind.annotation.XmlAccessorType; -import javax.xml.bind.annotation.XmlElement; -import javax.xml.bind.annotation.XmlElementRef; -import javax.xml.bind.annotation.XmlType; - - -/** - *

Java class for MonitoredRDPoolUpdate complex type. - * - *

The following schema fragment specifies the expected content contained within this class. - * - *

- * <complexType name="MonitoredRDPoolUpdate">
- *   <complexContent>
- *     <restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
- *       <sequence>
- *         <element name="monitoredRDPoolKey" type="{http://schema.ultraservice.neustar.com/v01/}MonitoredRDPoolKey"/>
- *         <element name="description" type="{http://www.w3.org/2001/XMLSchema}string" minOccurs="0"/>
- *         <element name="poolRecords" type="{http://schema.ultraservice.neustar.com/v01/}MonitoredRDPoolRecords" minOccurs="0"/>
- *         <element name="allFailRecord" type="{http://schema.ultraservice.neustar.com/v01/}MonitoredRDPoolAllFailRecordUpdate" minOccurs="0"/>
- *         <element name="ttl" type="{http://www.w3.org/2001/XMLSchema}long" minOccurs="0"/>
- *         <element name="monitor" type="{http://schema.ultraservice.neustar.com/v01/}MonitoredRDPoolMonitorUpdate" minOccurs="0"/>
- *         <element name="regionThreshold" type="{http://schema.ultraservice.neustar.com/v01/}simpleFailoverPoolRegionThreshold" minOccurs="0"/>
- *       </sequence>
- *     </restriction>
- *   </complexContent>
- * </complexType>
- * 
- * - * - */ -@XmlAccessorType(XmlAccessType.FIELD) -@XmlType(name = "MonitoredRDPoolUpdate", propOrder = { - "monitoredRDPoolKey", - "description", - "poolRecords", - "allFailRecord", - "ttl", - "monitor", - "regionThreshold" -}) -public class MonitoredRDPoolUpdate { - - @XmlElement(required = true) - protected MonitoredRDPoolKey monitoredRDPoolKey; - protected String description; - protected MonitoredRDPoolRecords poolRecords; - protected MonitoredRDPoolAllFailRecordUpdate allFailRecord; - @XmlElementRef(name = "ttl", namespace = "http://schema.ultraservice.neustar.com/v01/", type = JAXBElement.class) - protected JAXBElement ttl; - protected MonitoredRDPoolMonitorUpdate monitor; - protected SimpleFailoverPoolRegionThreshold regionThreshold; - - /** - * Gets the value of the monitoredRDPoolKey property. - * - * @return - * possible object is - * {@link MonitoredRDPoolKey } - * - */ - public MonitoredRDPoolKey getMonitoredRDPoolKey() { - return monitoredRDPoolKey; - } - - /** - * Sets the value of the monitoredRDPoolKey property. - * - * @param value - * allowed object is - * {@link MonitoredRDPoolKey } - * - */ - public void setMonitoredRDPoolKey(MonitoredRDPoolKey value) { - this.monitoredRDPoolKey = value; - } - - /** - * Gets the value of the description property. - * - * @return - * possible object is - * {@link String } - * - */ - public String getDescription() { - return description; - } - - /** - * Sets the value of the description property. - * - * @param value - * allowed object is - * {@link String } - * - */ - public void setDescription(String value) { - this.description = value; - } - - /** - * Gets the value of the poolRecords property. - * - * @return - * possible object is - * {@link MonitoredRDPoolRecords } - * - */ - public MonitoredRDPoolRecords getPoolRecords() { - return poolRecords; - } - - /** - * Sets the value of the poolRecords property. - * - * @param value - * allowed object is - * {@link MonitoredRDPoolRecords } - * - */ - public void setPoolRecords(MonitoredRDPoolRecords value) { - this.poolRecords = value; - } - - /** - * Gets the value of the allFailRecord property. - * - * @return - * possible object is - * {@link MonitoredRDPoolAllFailRecordUpdate } - * - */ - public MonitoredRDPoolAllFailRecordUpdate getAllFailRecord() { - return allFailRecord; - } - - /** - * Sets the value of the allFailRecord property. - * - * @param value - * allowed object is - * {@link MonitoredRDPoolAllFailRecordUpdate } - * - */ - public void setAllFailRecord(MonitoredRDPoolAllFailRecordUpdate value) { - this.allFailRecord = value; - } - - /** - * Gets the value of the ttl property. - * - * @return - * possible object is - * {@link JAXBElement }{@code <}{@link Long }{@code >} - * - */ - public JAXBElement getTtl() { - return ttl; - } - - /** - * Sets the value of the ttl property. - * - * @param value - * allowed object is - * {@link JAXBElement }{@code <}{@link Long }{@code >} - * - */ - public void setTtl(JAXBElement value) { - this.ttl = value; - } - - /** - * Gets the value of the monitor property. - * - * @return - * possible object is - * {@link MonitoredRDPoolMonitorUpdate } - * - */ - public MonitoredRDPoolMonitorUpdate getMonitor() { - return monitor; - } - - /** - * Sets the value of the monitor property. - * - * @param value - * allowed object is - * {@link MonitoredRDPoolMonitorUpdate } - * - */ - public void setMonitor(MonitoredRDPoolMonitorUpdate value) { - this.monitor = value; - } - - /** - * Gets the value of the regionThreshold property. - * - * @return - * possible object is - * {@link SimpleFailoverPoolRegionThreshold } - * - */ - public SimpleFailoverPoolRegionThreshold getRegionThreshold() { - return regionThreshold; - } - - /** - * Sets the value of the regionThreshold property. - * - * @param value - * allowed object is - * {@link SimpleFailoverPoolRegionThreshold } - * - */ - public void setRegionThreshold(SimpleFailoverPoolRegionThreshold value) { - this.regionThreshold = value; - } - -} diff --git a/Plugins/Mineplex.BungeeRotator/src/com/neustar/ultraservice/schema/v01/MonitoredRDPools.java b/Plugins/Mineplex.BungeeRotator/src/com/neustar/ultraservice/schema/v01/MonitoredRDPools.java deleted file mode 100644 index da4588883..000000000 --- a/Plugins/Mineplex.BungeeRotator/src/com/neustar/ultraservice/schema/v01/MonitoredRDPools.java +++ /dev/null @@ -1,119 +0,0 @@ - -package com.neustar.ultraservice.schema.v01; - -import javax.xml.bind.annotation.XmlAccessType; -import javax.xml.bind.annotation.XmlAccessorType; -import javax.xml.bind.annotation.XmlElement; -import javax.xml.bind.annotation.XmlType; - - -/** - *

Java class for monitoredRDPools complex type. - * - *

The following schema fragment specifies the expected content contained within this class. - * - *

- * <complexType name="monitoredRDPools">
- *   <complexContent>
- *     <restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
- *       <sequence>
- *         <element name="poolDefinitions" type="{http://schema.ultraservice.neustar.com/v01/}PoolDefinitions"/>
- *         <element name="recordCount" type="{http://www.w3.org/2001/XMLSchema}int"/>
- *         <element name="startIndex" type="{http://www.w3.org/2001/XMLSchema}int"/>
- *         <element name="count" type="{http://www.w3.org/2001/XMLSchema}int"/>
- *       </sequence>
- *     </restriction>
- *   </complexContent>
- * </complexType>
- * 
- * - * - */ -@XmlAccessorType(XmlAccessType.FIELD) -@XmlType(name = "monitoredRDPools", propOrder = { - "poolDefinitions", - "recordCount", - "startIndex", - "count" -}) -public class MonitoredRDPools { - - @XmlElement(required = true) - protected PoolDefinitions poolDefinitions; - protected int recordCount; - protected int startIndex; - protected int count; - - /** - * Gets the value of the poolDefinitions property. - * - * @return - * possible object is - * {@link PoolDefinitions } - * - */ - public PoolDefinitions getPoolDefinitions() { - return poolDefinitions; - } - - /** - * Sets the value of the poolDefinitions property. - * - * @param value - * allowed object is - * {@link PoolDefinitions } - * - */ - public void setPoolDefinitions(PoolDefinitions value) { - this.poolDefinitions = value; - } - - /** - * Gets the value of the recordCount property. - * - */ - public int getRecordCount() { - return recordCount; - } - - /** - * Sets the value of the recordCount property. - * - */ - public void setRecordCount(int value) { - this.recordCount = value; - } - - /** - * Gets the value of the startIndex property. - * - */ - public int getStartIndex() { - return startIndex; - } - - /** - * Sets the value of the startIndex property. - * - */ - public void setStartIndex(int value) { - this.startIndex = value; - } - - /** - * Gets the value of the count property. - * - */ - public int getCount() { - return count; - } - - /** - * Sets the value of the count property. - * - */ - public void setCount(int value) { - this.count = value; - } - -} diff --git a/Plugins/Mineplex.BungeeRotator/src/com/neustar/ultraservice/schema/v01/NameServerData.java b/Plugins/Mineplex.BungeeRotator/src/com/neustar/ultraservice/schema/v01/NameServerData.java deleted file mode 100644 index 695c212e5..000000000 --- a/Plugins/Mineplex.BungeeRotator/src/com/neustar/ultraservice/schema/v01/NameServerData.java +++ /dev/null @@ -1,87 +0,0 @@ - -package com.neustar.ultraservice.schema.v01; - -import javax.xml.bind.annotation.XmlAccessType; -import javax.xml.bind.annotation.XmlAccessorType; -import javax.xml.bind.annotation.XmlAttribute; -import javax.xml.bind.annotation.XmlType; - - -/** - *

Java class for NameServerData complex type. - * - *

The following schema fragment specifies the expected content contained within this class. - * - *

- * <complexType name="NameServerData">
- *   <complexContent>
- *     <restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
- *       <sequence>
- *       </sequence>
- *       <attribute name="actualNameServer" use="required" type="{http://www.w3.org/2001/XMLSchema}string" />
- *       <attribute name="recomendedNameServer" use="required" type="{http://www.w3.org/2001/XMLSchema}string" />
- *     </restriction>
- *   </complexContent>
- * </complexType>
- * 
- * - * - */ -@XmlAccessorType(XmlAccessType.FIELD) -@XmlType(name = "NameServerData") -public class NameServerData { - - @XmlAttribute(name = "actualNameServer", required = true) - protected String actualNameServer; - @XmlAttribute(name = "recomendedNameServer", required = true) - protected String recomendedNameServer; - - /** - * Gets the value of the actualNameServer property. - * - * @return - * possible object is - * {@link String } - * - */ - public String getActualNameServer() { - return actualNameServer; - } - - /** - * Sets the value of the actualNameServer property. - * - * @param value - * allowed object is - * {@link String } - * - */ - public void setActualNameServer(String value) { - this.actualNameServer = value; - } - - /** - * Gets the value of the recomendedNameServer property. - * - * @return - * possible object is - * {@link String } - * - */ - public String getRecomendedNameServer() { - return recomendedNameServer; - } - - /** - * Sets the value of the recomendedNameServer property. - * - * @param value - * allowed object is - * {@link String } - * - */ - public void setRecomendedNameServer(String value) { - this.recomendedNameServer = value; - } - -} diff --git a/Plugins/Mineplex.BungeeRotator/src/com/neustar/ultraservice/schema/v01/NameServerIPs.java b/Plugins/Mineplex.BungeeRotator/src/com/neustar/ultraservice/schema/v01/NameServerIPs.java deleted file mode 100644 index 2bf1cb081..000000000 --- a/Plugins/Mineplex.BungeeRotator/src/com/neustar/ultraservice/schema/v01/NameServerIPs.java +++ /dev/null @@ -1,141 +0,0 @@ - -package com.neustar.ultraservice.schema.v01; - -import javax.xml.bind.annotation.XmlAccessType; -import javax.xml.bind.annotation.XmlAccessorType; -import javax.xml.bind.annotation.XmlAttribute; -import javax.xml.bind.annotation.XmlType; - - -/** - *

Java class for NameServerIPs complex type. - * - *

The following schema fragment specifies the expected content contained within this class. - * - *

- * <complexType name="NameServerIPs">
- *   <complexContent>
- *     <restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
- *       <sequence>
- *       </sequence>
- *       <attribute name="NameServerIP1" use="required" type="{http://www.w3.org/2001/XMLSchema}string" />
- *       <attribute name="NameServerIP2" type="{http://www.w3.org/2001/XMLSchema}string" />
- *       <attribute name="NameServerIP3" type="{http://www.w3.org/2001/XMLSchema}string" />
- *       <attribute name="TsigEnabled" type="{http://www.w3.org/2001/XMLSchema}string" />
- *     </restriction>
- *   </complexContent>
- * </complexType>
- * 
- * - * - */ -@XmlAccessorType(XmlAccessType.FIELD) -@XmlType(name = "NameServerIPs") -public class NameServerIPs { - - @XmlAttribute(name = "NameServerIP1", required = true) - protected String nameServerIP1; - @XmlAttribute(name = "NameServerIP2") - protected String nameServerIP2; - @XmlAttribute(name = "NameServerIP3") - protected String nameServerIP3; - @XmlAttribute(name = "TsigEnabled") - protected String tsigEnabled; - - /** - * Gets the value of the nameServerIP1 property. - * - * @return - * possible object is - * {@link String } - * - */ - public String getNameServerIP1() { - return nameServerIP1; - } - - /** - * Sets the value of the nameServerIP1 property. - * - * @param value - * allowed object is - * {@link String } - * - */ - public void setNameServerIP1(String value) { - this.nameServerIP1 = value; - } - - /** - * Gets the value of the nameServerIP2 property. - * - * @return - * possible object is - * {@link String } - * - */ - public String getNameServerIP2() { - return nameServerIP2; - } - - /** - * Sets the value of the nameServerIP2 property. - * - * @param value - * allowed object is - * {@link String } - * - */ - public void setNameServerIP2(String value) { - this.nameServerIP2 = value; - } - - /** - * Gets the value of the nameServerIP3 property. - * - * @return - * possible object is - * {@link String } - * - */ - public String getNameServerIP3() { - return nameServerIP3; - } - - /** - * Sets the value of the nameServerIP3 property. - * - * @param value - * allowed object is - * {@link String } - * - */ - public void setNameServerIP3(String value) { - this.nameServerIP3 = value; - } - - /** - * Gets the value of the tsigEnabled property. - * - * @return - * possible object is - * {@link String } - * - */ - public String getTsigEnabled() { - return tsigEnabled; - } - - /** - * Sets the value of the tsigEnabled property. - * - * @param value - * allowed object is - * {@link String } - * - */ - public void setTsigEnabled(String value) { - this.tsigEnabled = value; - } - -} diff --git a/Plugins/Mineplex.BungeeRotator/src/com/neustar/ultraservice/schema/v01/NameServerList.java b/Plugins/Mineplex.BungeeRotator/src/com/neustar/ultraservice/schema/v01/NameServerList.java deleted file mode 100644 index 21ff45094..000000000 --- a/Plugins/Mineplex.BungeeRotator/src/com/neustar/ultraservice/schema/v01/NameServerList.java +++ /dev/null @@ -1,69 +0,0 @@ - -package com.neustar.ultraservice.schema.v01; - -import java.util.ArrayList; -import java.util.List; -import javax.xml.bind.annotation.XmlAccessType; -import javax.xml.bind.annotation.XmlAccessorType; -import javax.xml.bind.annotation.XmlElement; -import javax.xml.bind.annotation.XmlType; - - -/** - *

Java class for NameServerList complex type. - * - *

The following schema fragment specifies the expected content contained within this class. - * - *

- * <complexType name="NameServerList">
- *   <complexContent>
- *     <restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
- *       <sequence>
- *         <element name="NameServerData" type="{http://schema.ultraservice.neustar.com/v01/}NameServerData" maxOccurs="unbounded"/>
- *       </sequence>
- *     </restriction>
- *   </complexContent>
- * </complexType>
- * 
- * - * - */ -@XmlAccessorType(XmlAccessType.FIELD) -@XmlType(name = "NameServerList", propOrder = { - "nameServerData" -}) -public class NameServerList { - - @XmlElement(name = "NameServerData", required = true) - protected List nameServerData; - - /** - * Gets the value of the nameServerData property. - * - *

- * This accessor method returns a reference to the live list, - * not a snapshot. Therefore any modification you make to the - * returned list will be present inside the JAXB object. - * This is why there is not a set method for the nameServerData property. - * - *

- * For example, to add a new item, do as follows: - *

-     *    getNameServerData().add(newItem);
-     * 
- * - * - *

- * Objects of the following type(s) are allowed in the list - * {@link NameServerData } - * - * - */ - public List getNameServerData() { - if (nameServerData == null) { - nameServerData = new ArrayList(); - } - return this.nameServerData; - } - -} diff --git a/Plugins/Mineplex.BungeeRotator/src/com/neustar/ultraservice/schema/v01/NameServerRecord.java b/Plugins/Mineplex.BungeeRotator/src/com/neustar/ultraservice/schema/v01/NameServerRecord.java deleted file mode 100644 index 25e68e62d..000000000 --- a/Plugins/Mineplex.BungeeRotator/src/com/neustar/ultraservice/schema/v01/NameServerRecord.java +++ /dev/null @@ -1,114 +0,0 @@ - -package com.neustar.ultraservice.schema.v01; - -import javax.xml.bind.annotation.XmlAccessType; -import javax.xml.bind.annotation.XmlAccessorType; -import javax.xml.bind.annotation.XmlAttribute; -import javax.xml.bind.annotation.XmlType; - - -/** - *

Java class for NameServerRecord complex type. - * - *

The following schema fragment specifies the expected content contained within this class. - * - *

- * <complexType name="NameServerRecord">
- *   <complexContent>
- *     <restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
- *       <sequence>
- *       </sequence>
- *       <attribute name="name" use="required" type="{http://www.w3.org/2001/XMLSchema}string" />
- *       <attribute name="ipv4Address" use="required" type="{http://www.w3.org/2001/XMLSchema}string" />
- *       <attribute name="ipv6Address" type="{http://www.w3.org/2001/XMLSchema}string" />
- *     </restriction>
- *   </complexContent>
- * </complexType>
- * 
- * - * - */ -@XmlAccessorType(XmlAccessType.FIELD) -@XmlType(name = "NameServerRecord") -public class NameServerRecord { - - @XmlAttribute(name = "name", required = true) - protected String name; - @XmlAttribute(name = "ipv4Address", required = true) - protected String ipv4Address; - @XmlAttribute(name = "ipv6Address") - protected String ipv6Address; - - /** - * Gets the value of the name property. - * - * @return - * possible object is - * {@link String } - * - */ - public String getName() { - return name; - } - - /** - * Sets the value of the name property. - * - * @param value - * allowed object is - * {@link String } - * - */ - public void setName(String value) { - this.name = value; - } - - /** - * Gets the value of the ipv4Address property. - * - * @return - * possible object is - * {@link String } - * - */ - public String getIpv4Address() { - return ipv4Address; - } - - /** - * Sets the value of the ipv4Address property. - * - * @param value - * allowed object is - * {@link String } - * - */ - public void setIpv4Address(String value) { - this.ipv4Address = value; - } - - /** - * Gets the value of the ipv6Address property. - * - * @return - * possible object is - * {@link String } - * - */ - public String getIpv6Address() { - return ipv6Address; - } - - /** - * Sets the value of the ipv6Address property. - * - * @param value - * allowed object is - * {@link String } - * - */ - public void setIpv6Address(String value) { - this.ipv6Address = value; - } - -} diff --git a/Plugins/Mineplex.BungeeRotator/src/com/neustar/ultraservice/schema/v01/NameServerRecordSet.java b/Plugins/Mineplex.BungeeRotator/src/com/neustar/ultraservice/schema/v01/NameServerRecordSet.java deleted file mode 100644 index cf11c7e41..000000000 --- a/Plugins/Mineplex.BungeeRotator/src/com/neustar/ultraservice/schema/v01/NameServerRecordSet.java +++ /dev/null @@ -1,98 +0,0 @@ - -package com.neustar.ultraservice.schema.v01; - -import java.util.ArrayList; -import java.util.List; -import javax.xml.bind.annotation.XmlAccessType; -import javax.xml.bind.annotation.XmlAccessorType; -import javax.xml.bind.annotation.XmlAttribute; -import javax.xml.bind.annotation.XmlElement; -import javax.xml.bind.annotation.XmlType; -import com.neustar.ultraservice.schema.AccountSegmentMapStatusType; - - -/** - *

Java class for NameServerRecordSet complex type. - * - *

The following schema fragment specifies the expected content contained within this class. - * - *

- * <complexType name="NameServerRecordSet">
- *   <complexContent>
- *     <restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
- *       <sequence>
- *         <element name="NameServerRecord" type="{http://schema.ultraservice.neustar.com/v01/}NameServerRecord" maxOccurs="unbounded"/>
- *       </sequence>
- *       <attribute name="type" use="required" type="{http://schema.ultraservice.neustar.com/}AccountSegmentMapStatusType" />
- *     </restriction>
- *   </complexContent>
- * </complexType>
- * 
- * - * - */ -@XmlAccessorType(XmlAccessType.FIELD) -@XmlType(name = "NameServerRecordSet", propOrder = { - "nameServerRecord" -}) -public class NameServerRecordSet { - - @XmlElement(name = "NameServerRecord", required = true) - protected List nameServerRecord; - @XmlAttribute(name = "type", required = true) - protected AccountSegmentMapStatusType type; - - /** - * Gets the value of the nameServerRecord property. - * - *

- * This accessor method returns a reference to the live list, - * not a snapshot. Therefore any modification you make to the - * returned list will be present inside the JAXB object. - * This is why there is not a set method for the nameServerRecord property. - * - *

- * For example, to add a new item, do as follows: - *

-     *    getNameServerRecord().add(newItem);
-     * 
- * - * - *

- * Objects of the following type(s) are allowed in the list - * {@link NameServerRecord } - * - * - */ - public List getNameServerRecord() { - if (nameServerRecord == null) { - nameServerRecord = new ArrayList(); - } - return this.nameServerRecord; - } - - /** - * Gets the value of the type property. - * - * @return - * possible object is - * {@link AccountSegmentMapStatusType } - * - */ - public AccountSegmentMapStatusType getType() { - return type; - } - - /** - * Sets the value of the type property. - * - * @param value - * allowed object is - * {@link AccountSegmentMapStatusType } - * - */ - public void setType(AccountSegmentMapStatusType value) { - this.type = value; - } - -} diff --git a/Plugins/Mineplex.BungeeRotator/src/com/neustar/ultraservice/schema/v01/NameServers.java b/Plugins/Mineplex.BungeeRotator/src/com/neustar/ultraservice/schema/v01/NameServers.java deleted file mode 100644 index 417d2beab..000000000 --- a/Plugins/Mineplex.BungeeRotator/src/com/neustar/ultraservice/schema/v01/NameServers.java +++ /dev/null @@ -1,81 +0,0 @@ - -package com.neustar.ultraservice.schema.v01; - -import java.util.ArrayList; -import java.util.List; -import javax.xml.bind.JAXBElement; -import javax.xml.bind.annotation.XmlAccessType; -import javax.xml.bind.annotation.XmlAccessorType; -import javax.xml.bind.annotation.XmlElementRef; -import javax.xml.bind.annotation.XmlType; - - -/** - *

Java class for NameServers complex type. - * - *

The following schema fragment specifies the expected content contained within this class. - * - *

- * <complexType name="NameServers">
- *   <complexContent>
- *     <restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
- *       <sequence>
- *         <element name="NameServerRecordSet" type="{http://schema.ultraservice.neustar.com/v01/}NameServerRecordSet" maxOccurs="unbounded"/>
- *         <element name="NameServerRecordSet" type="{http://schema.ultraservice.neustar.com/v01/}NameServerRecordSet" maxOccurs="unbounded"/>
- *       </sequence>
- *     </restriction>
- *   </complexContent>
- * </complexType>
- * 
- * - * - */ -@XmlAccessorType(XmlAccessType.FIELD) -@XmlType(name = "NameServers", propOrder = { - "content" -}) -public class NameServers { - - @XmlElementRef(name = "NameServerRecordSet", namespace = "http://schema.ultraservice.neustar.com/v01/", type = JAXBElement.class) - protected List> content; - - /** - * Gets the rest of the content model. - * - *

- * You are getting this "catch-all" property because of the following reason: - * The field name "NameServerRecordSet" is used by two different parts of a schema. See: - * line 2394 of http://ultra-api.ultradns.com/UltraDNS_WS/v01?wsdl - * line 2393 of http://ultra-api.ultradns.com/UltraDNS_WS/v01?wsdl - *

- * To get rid of this property, apply a property customization to one - * of both of the following declarations to change their names: - * Gets the value of the content property. - * - *

- * This accessor method returns a reference to the live list, - * not a snapshot. Therefore any modification you make to the - * returned list will be present inside the JAXB object. - * This is why there is not a set method for the content property. - * - *

- * For example, to add a new item, do as follows: - *

-     *    getContent().add(newItem);
-     * 
- * - * - *

- * Objects of the following type(s) are allowed in the list - * {@link JAXBElement }{@code <}{@link NameServerRecordSet }{@code >} - * - * - */ - public List> getContent() { - if (content == null) { - content = new ArrayList>(); - } - return this.content; - } - -} diff --git a/Plugins/Mineplex.BungeeRotator/src/com/neustar/ultraservice/schema/v01/NotificationData.java b/Plugins/Mineplex.BungeeRotator/src/com/neustar/ultraservice/schema/v01/NotificationData.java deleted file mode 100644 index 56f7c80b9..000000000 --- a/Plugins/Mineplex.BungeeRotator/src/com/neustar/ultraservice/schema/v01/NotificationData.java +++ /dev/null @@ -1,195 +0,0 @@ - -package com.neustar.ultraservice.schema.v01; - -import javax.xml.bind.annotation.XmlAccessType; -import javax.xml.bind.annotation.XmlAccessorType; -import javax.xml.bind.annotation.XmlAttribute; -import javax.xml.bind.annotation.XmlType; - - -/** - *

Java class for NotificationData complex type. - * - *

The following schema fragment specifies the expected content contained within this class. - * - *

- * <complexType name="NotificationData">
- *   <complexContent>
- *     <restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
- *       <sequence>
- *       </sequence>
- *       <attribute name="email" use="required" type="{http://www.w3.org/2001/XMLSchema}string" />
- *       <attribute name="poolRecordId" use="required" type="{http://www.w3.org/2001/XMLSchema}string" />
- *       <attribute name="poolNotifyId" use="required" type="{http://www.w3.org/2001/XMLSchema}string" />
- *       <attribute name="probeEvents" use="required" type="{http://www.w3.org/2001/XMLSchema}string" />
- *       <attribute name="recordEvents" use="required" type="{http://www.w3.org/2001/XMLSchema}string" />
- *       <attribute name="scheduleEvents" use="required" type="{http://www.w3.org/2001/XMLSchema}string" />
- *     </restriction>
- *   </complexContent>
- * </complexType>
- * 
- * - * - */ -@XmlAccessorType(XmlAccessType.FIELD) -@XmlType(name = "NotificationData") -public class NotificationData { - - @XmlAttribute(name = "email", required = true) - protected String email; - @XmlAttribute(name = "poolRecordId", required = true) - protected String poolRecordId; - @XmlAttribute(name = "poolNotifyId", required = true) - protected String poolNotifyId; - @XmlAttribute(name = "probeEvents", required = true) - protected String probeEvents; - @XmlAttribute(name = "recordEvents", required = true) - protected String recordEvents; - @XmlAttribute(name = "scheduleEvents", required = true) - protected String scheduleEvents; - - /** - * Gets the value of the email property. - * - * @return - * possible object is - * {@link String } - * - */ - public String getEmail() { - return email; - } - - /** - * Sets the value of the email property. - * - * @param value - * allowed object is - * {@link String } - * - */ - public void setEmail(String value) { - this.email = value; - } - - /** - * Gets the value of the poolRecordId property. - * - * @return - * possible object is - * {@link String } - * - */ - public String getPoolRecordId() { - return poolRecordId; - } - - /** - * Sets the value of the poolRecordId property. - * - * @param value - * allowed object is - * {@link String } - * - */ - public void setPoolRecordId(String value) { - this.poolRecordId = value; - } - - /** - * Gets the value of the poolNotifyId property. - * - * @return - * possible object is - * {@link String } - * - */ - public String getPoolNotifyId() { - return poolNotifyId; - } - - /** - * Sets the value of the poolNotifyId property. - * - * @param value - * allowed object is - * {@link String } - * - */ - public void setPoolNotifyId(String value) { - this.poolNotifyId = value; - } - - /** - * Gets the value of the probeEvents property. - * - * @return - * possible object is - * {@link String } - * - */ - public String getProbeEvents() { - return probeEvents; - } - - /** - * Sets the value of the probeEvents property. - * - * @param value - * allowed object is - * {@link String } - * - */ - public void setProbeEvents(String value) { - this.probeEvents = value; - } - - /** - * Gets the value of the recordEvents property. - * - * @return - * possible object is - * {@link String } - * - */ - public String getRecordEvents() { - return recordEvents; - } - - /** - * Sets the value of the recordEvents property. - * - * @param value - * allowed object is - * {@link String } - * - */ - public void setRecordEvents(String value) { - this.recordEvents = value; - } - - /** - * Gets the value of the scheduleEvents property. - * - * @return - * possible object is - * {@link String } - * - */ - public String getScheduleEvents() { - return scheduleEvents; - } - - /** - * Sets the value of the scheduleEvents property. - * - * @param value - * allowed object is - * {@link String } - * - */ - public void setScheduleEvents(String value) { - this.scheduleEvents = value; - } - -} diff --git a/Plugins/Mineplex.BungeeRotator/src/com/neustar/ultraservice/schema/v01/NotificationInfo.java b/Plugins/Mineplex.BungeeRotator/src/com/neustar/ultraservice/schema/v01/NotificationInfo.java deleted file mode 100644 index 6a49efd78..000000000 --- a/Plugins/Mineplex.BungeeRotator/src/com/neustar/ultraservice/schema/v01/NotificationInfo.java +++ /dev/null @@ -1,106 +0,0 @@ - -package com.neustar.ultraservice.schema.v01; - -import javax.xml.bind.annotation.XmlAccessType; -import javax.xml.bind.annotation.XmlAccessorType; -import javax.xml.bind.annotation.XmlType; - - -/** - *

Java class for NotificationInfo complex type. - * - *

The following schema fragment specifies the expected content contained within this class. - * - *

- * <complexType name="NotificationInfo">
- *   <complexContent>
- *     <restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
- *       <sequence>
- *         <element name="contactName" type="{http://www.w3.org/2001/XMLSchema}string" minOccurs="0"/>
- *         <element name="notificationType" type="{http://schema.ultraservice.neustar.com/v01/}notificationType" minOccurs="0"/>
- *         <element name="served" type="{http://www.w3.org/2001/XMLSchema}boolean"/>
- *       </sequence>
- *     </restriction>
- *   </complexContent>
- * </complexType>
- * 
- * - * - */ -@XmlAccessorType(XmlAccessType.FIELD) -@XmlType(name = "NotificationInfo", propOrder = { - "contactName", - "notificationType", - "served" -}) -public class NotificationInfo { - - protected String contactName; - protected NotificationType notificationType; - protected boolean served; - - /** - * Gets the value of the contactName property. - * - * @return - * possible object is - * {@link String } - * - */ - public String getContactName() { - return contactName; - } - - /** - * Sets the value of the contactName property. - * - * @param value - * allowed object is - * {@link String } - * - */ - public void setContactName(String value) { - this.contactName = value; - } - - /** - * Gets the value of the notificationType property. - * - * @return - * possible object is - * {@link NotificationType } - * - */ - public NotificationType getNotificationType() { - return notificationType; - } - - /** - * Sets the value of the notificationType property. - * - * @param value - * allowed object is - * {@link NotificationType } - * - */ - public void setNotificationType(NotificationType value) { - this.notificationType = value; - } - - /** - * Gets the value of the served property. - * - */ - public boolean isServed() { - return served; - } - - /** - * Sets the value of the served property. - * - */ - public void setServed(boolean value) { - this.served = value; - } - -} diff --git a/Plugins/Mineplex.BungeeRotator/src/com/neustar/ultraservice/schema/v01/NotificationList.java b/Plugins/Mineplex.BungeeRotator/src/com/neustar/ultraservice/schema/v01/NotificationList.java deleted file mode 100644 index 3844536f5..000000000 --- a/Plugins/Mineplex.BungeeRotator/src/com/neustar/ultraservice/schema/v01/NotificationList.java +++ /dev/null @@ -1,69 +0,0 @@ - -package com.neustar.ultraservice.schema.v01; - -import java.util.ArrayList; -import java.util.List; -import javax.xml.bind.annotation.XmlAccessType; -import javax.xml.bind.annotation.XmlAccessorType; -import javax.xml.bind.annotation.XmlElement; -import javax.xml.bind.annotation.XmlType; - - -/** - *

Java class for NotificationList complex type. - * - *

The following schema fragment specifies the expected content contained within this class. - * - *

- * <complexType name="NotificationList">
- *   <complexContent>
- *     <restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
- *       <sequence>
- *         <element name="NotificationData" type="{http://schema.ultraservice.neustar.com/v01/}NotificationData" maxOccurs="unbounded"/>
- *       </sequence>
- *     </restriction>
- *   </complexContent>
- * </complexType>
- * 
- * - * - */ -@XmlAccessorType(XmlAccessType.FIELD) -@XmlType(name = "NotificationList", propOrder = { - "notificationData" -}) -public class NotificationList { - - @XmlElement(name = "NotificationData", required = true) - protected List notificationData; - - /** - * Gets the value of the notificationData property. - * - *

- * This accessor method returns a reference to the live list, - * not a snapshot. Therefore any modification you make to the - * returned list will be present inside the JAXB object. - * This is why there is not a set method for the notificationData property. - * - *

- * For example, to add a new item, do as follows: - *

-     *    getNotificationData().add(newItem);
-     * 
- * - * - *

- * Objects of the following type(s) are allowed in the list - * {@link NotificationData } - * - * - */ - public List getNotificationData() { - if (notificationData == null) { - notificationData = new ArrayList(); - } - return this.notificationData; - } - -} diff --git a/Plugins/Mineplex.BungeeRotator/src/com/neustar/ultraservice/schema/v01/NotificationType.java b/Plugins/Mineplex.BungeeRotator/src/com/neustar/ultraservice/schema/v01/NotificationType.java deleted file mode 100644 index 80a5d5039..000000000 --- a/Plugins/Mineplex.BungeeRotator/src/com/neustar/ultraservice/schema/v01/NotificationType.java +++ /dev/null @@ -1,40 +0,0 @@ - -package com.neustar.ultraservice.schema.v01; - -import javax.xml.bind.annotation.XmlEnum; -import javax.xml.bind.annotation.XmlType; - - -/** - *

Java class for notificationType. - * - *

The following schema fragment specifies the expected content contained within this class. - *

- *

- * <simpleType name="notificationType">
- *   <restriction base="{http://www.w3.org/2001/XMLSchema}string">
- *     <enumeration value="EMAIL"/>
- *     <enumeration value="SMS"/>
- *     <enumeration value="SNMP"/>
- *   </restriction>
- * </simpleType>
- * 
- * - */ -@XmlType(name = "notificationType") -@XmlEnum -public enum NotificationType { - - EMAIL, - SMS, - SNMP; - - public String value() { - return name(); - } - - public static NotificationType fromValue(String v) { - return valueOf(v); - } - -} diff --git a/Plugins/Mineplex.BungeeRotator/src/com/neustar/ultraservice/schema/v01/Notifications.java b/Plugins/Mineplex.BungeeRotator/src/com/neustar/ultraservice/schema/v01/Notifications.java deleted file mode 100644 index f26fc5ce1..000000000 --- a/Plugins/Mineplex.BungeeRotator/src/com/neustar/ultraservice/schema/v01/Notifications.java +++ /dev/null @@ -1,67 +0,0 @@ - -package com.neustar.ultraservice.schema.v01; - -import java.util.ArrayList; -import java.util.List; -import javax.xml.bind.annotation.XmlAccessType; -import javax.xml.bind.annotation.XmlAccessorType; -import javax.xml.bind.annotation.XmlType; - - -/** - *

Java class for Notifications complex type. - * - *

The following schema fragment specifies the expected content contained within this class. - * - *

- * <complexType name="Notifications">
- *   <complexContent>
- *     <restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
- *       <sequence>
- *         <element name="notification" type="{http://schema.ultraservice.neustar.com/v01/}NotificationInfo" maxOccurs="unbounded" minOccurs="0"/>
- *       </sequence>
- *     </restriction>
- *   </complexContent>
- * </complexType>
- * 
- * - * - */ -@XmlAccessorType(XmlAccessType.FIELD) -@XmlType(name = "Notifications", propOrder = { - "notification" -}) -public class Notifications { - - protected List notification; - - /** - * Gets the value of the notification property. - * - *

- * This accessor method returns a reference to the live list, - * not a snapshot. Therefore any modification you make to the - * returned list will be present inside the JAXB object. - * This is why there is not a set method for the notification property. - * - *

- * For example, to add a new item, do as follows: - *

-     *    getNotification().add(newItem);
-     * 
- * - * - *

- * Objects of the following type(s) are allowed in the list - * {@link NotificationInfo } - * - * - */ - public List getNotification() { - if (notification == null) { - notification = new ArrayList(); - } - return this.notification; - } - -} diff --git a/Plugins/Mineplex.BungeeRotator/src/com/neustar/ultraservice/schema/v01/NotifyRecord.java b/Plugins/Mineplex.BungeeRotator/src/com/neustar/ultraservice/schema/v01/NotifyRecord.java deleted file mode 100644 index 45fbf1020..000000000 --- a/Plugins/Mineplex.BungeeRotator/src/com/neustar/ultraservice/schema/v01/NotifyRecord.java +++ /dev/null @@ -1,141 +0,0 @@ - -package com.neustar.ultraservice.schema.v01; - -import javax.xml.bind.annotation.XmlAccessType; -import javax.xml.bind.annotation.XmlAccessorType; -import javax.xml.bind.annotation.XmlAttribute; -import javax.xml.bind.annotation.XmlType; - - -/** - *

Java class for NotifyRecord complex type. - * - *

The following schema fragment specifies the expected content contained within this class. - * - *

- * <complexType name="NotifyRecord">
- *   <complexContent>
- *     <restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
- *       <sequence>
- *       </sequence>
- *       <attribute name="poolRecordId" use="required" type="{http://www.w3.org/2001/XMLSchema}string" />
- *       <attribute name="probeEvents" use="required" type="{http://www.w3.org/2001/XMLSchema}string" />
- *       <attribute name="recordEvents" use="required" type="{http://www.w3.org/2001/XMLSchema}string" />
- *       <attribute name="scheduledEvents" use="required" type="{http://www.w3.org/2001/XMLSchema}string" />
- *     </restriction>
- *   </complexContent>
- * </complexType>
- * 
- * - * - */ -@XmlAccessorType(XmlAccessType.FIELD) -@XmlType(name = "NotifyRecord") -public class NotifyRecord { - - @XmlAttribute(name = "poolRecordId", required = true) - protected String poolRecordId; - @XmlAttribute(name = "probeEvents", required = true) - protected String probeEvents; - @XmlAttribute(name = "recordEvents", required = true) - protected String recordEvents; - @XmlAttribute(name = "scheduledEvents", required = true) - protected String scheduledEvents; - - /** - * Gets the value of the poolRecordId property. - * - * @return - * possible object is - * {@link String } - * - */ - public String getPoolRecordId() { - return poolRecordId; - } - - /** - * Sets the value of the poolRecordId property. - * - * @param value - * allowed object is - * {@link String } - * - */ - public void setPoolRecordId(String value) { - this.poolRecordId = value; - } - - /** - * Gets the value of the probeEvents property. - * - * @return - * possible object is - * {@link String } - * - */ - public String getProbeEvents() { - return probeEvents; - } - - /** - * Sets the value of the probeEvents property. - * - * @param value - * allowed object is - * {@link String } - * - */ - public void setProbeEvents(String value) { - this.probeEvents = value; - } - - /** - * Gets the value of the recordEvents property. - * - * @return - * possible object is - * {@link String } - * - */ - public String getRecordEvents() { - return recordEvents; - } - - /** - * Sets the value of the recordEvents property. - * - * @param value - * allowed object is - * {@link String } - * - */ - public void setRecordEvents(String value) { - this.recordEvents = value; - } - - /** - * Gets the value of the scheduledEvents property. - * - * @return - * possible object is - * {@link String } - * - */ - public String getScheduledEvents() { - return scheduledEvents; - } - - /** - * Sets the value of the scheduledEvents property. - * - * @param value - * allowed object is - * {@link String } - * - */ - public void setScheduledEvents(String value) { - this.scheduledEvents = value; - } - -} diff --git a/Plugins/Mineplex.BungeeRotator/src/com/neustar/ultraservice/schema/v01/NotifyRecordList.java b/Plugins/Mineplex.BungeeRotator/src/com/neustar/ultraservice/schema/v01/NotifyRecordList.java deleted file mode 100644 index 02746cc67..000000000 --- a/Plugins/Mineplex.BungeeRotator/src/com/neustar/ultraservice/schema/v01/NotifyRecordList.java +++ /dev/null @@ -1,69 +0,0 @@ - -package com.neustar.ultraservice.schema.v01; - -import java.util.ArrayList; -import java.util.List; -import javax.xml.bind.annotation.XmlAccessType; -import javax.xml.bind.annotation.XmlAccessorType; -import javax.xml.bind.annotation.XmlElement; -import javax.xml.bind.annotation.XmlType; - - -/** - *

Java class for NotifyRecordList complex type. - * - *

The following schema fragment specifies the expected content contained within this class. - * - *

- * <complexType name="NotifyRecordList">
- *   <complexContent>
- *     <restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
- *       <sequence>
- *         <element name="NotifyRecord" type="{http://schema.ultraservice.neustar.com/v01/}NotifyRecord" maxOccurs="unbounded"/>
- *       </sequence>
- *     </restriction>
- *   </complexContent>
- * </complexType>
- * 
- * - * - */ -@XmlAccessorType(XmlAccessType.FIELD) -@XmlType(name = "NotifyRecordList", propOrder = { - "notifyRecord" -}) -public class NotifyRecordList { - - @XmlElement(name = "NotifyRecord", required = true) - protected List notifyRecord; - - /** - * Gets the value of the notifyRecord property. - * - *

- * This accessor method returns a reference to the live list, - * not a snapshot. Therefore any modification you make to the - * returned list will be present inside the JAXB object. - * This is why there is not a set method for the notifyRecord property. - * - *

- * For example, to add a new item, do as follows: - *

-     *    getNotifyRecord().add(newItem);
-     * 
- * - * - *

- * Objects of the following type(s) are allowed in the list - * {@link NotifyRecord } - * - * - */ - public List getNotifyRecord() { - if (notifyRecord == null) { - notifyRecord = new ArrayList(); - } - return this.notifyRecord; - } - -} diff --git a/Plugins/Mineplex.BungeeRotator/src/com/neustar/ultraservice/schema/v01/ObjectFactory.java b/Plugins/Mineplex.BungeeRotator/src/com/neustar/ultraservice/schema/v01/ObjectFactory.java deleted file mode 100644 index c6963c2c0..000000000 --- a/Plugins/Mineplex.BungeeRotator/src/com/neustar/ultraservice/schema/v01/ObjectFactory.java +++ /dev/null @@ -1,2304 +0,0 @@ - -package com.neustar.ultraservice.schema.v01; - -import javax.xml.bind.JAXBElement; -import javax.xml.bind.annotation.XmlElementDecl; -import javax.xml.bind.annotation.XmlRegistry; -import javax.xml.namespace.QName; - - -/** - * This object contains factory methods for each - * Java content interface and Java element interface - * generated in the com.neustar.ultraservice.schema.v01 package. - *

An ObjectFactory allows you to programatically - * construct new instances of the Java representation - * for XML content. The Java representation of XML - * content can consist of schema derived interfaces - * and classes representing the binding of schema - * type definitions, element declarations and model - * groups. Factory methods for each of these are - * provided in this class. - * - */ -@XmlRegistry -public class ObjectFactory { - - private final static QName _ProbeInfo2Ttl_QNAME = new QName("http://schema.ultraservice.neustar.com/v01/", "ttl"); - private final static QName _NameServersNameServerRecordSet_QNAME = new QName("http://schema.ultraservice.neustar.com/v01/", "NameServerRecordSet"); - - /** - * Create a new ObjectFactory that can be used to create new instances of schema derived classes for package: com.neustar.ultraservice.schema.v01 - * - */ - public ObjectFactory() { - } - - /** - * Create an instance of {@link ProbeAlertsList } - * - */ - public ProbeAlertsList createProbeAlertsList() { - return new ProbeAlertsList(); - } - - /** - * Create an instance of {@link DirectionalPoolList } - * - */ - public DirectionalPoolList createDirectionalPoolList() { - return new DirectionalPoolList(); - } - - /** - * Create an instance of {@link RegionAndAgent } - * - */ - public RegionAndAgent createRegionAndAgent() { - return new RegionAndAgent(); - } - - /** - * Create an instance of {@link PoolRecordsList } - * - */ - public PoolRecordsList createPoolRecordsList() { - return new PoolRecordsList(); - } - - /** - * Create an instance of {@link AddDirectionalRecordData } - * - */ - public AddDirectionalRecordData createAddDirectionalRecordData() { - return new AddDirectionalRecordData(); - } - - /** - * Create an instance of {@link MonitoredRDPools } - * - */ - public MonitoredRDPools createMonitoredRDPools() { - return new MonitoredRDPools(); - } - - /** - * Create an instance of {@link AddressBookEntryKeys } - * - */ - public AddressBookEntryKeys createAddressBookEntryKeys() { - return new AddressBookEntryKeys(); - } - - /** - * Create an instance of {@link PoolRecord } - * - */ - public PoolRecord createPoolRecord() { - return new PoolRecord(); - } - - /** - * Create an instance of {@link InfoValues } - * - */ - public InfoValues createInfoValues() { - return new InfoValues(); - } - - /** - * Create an instance of {@link PrioritizedRecordsList } - * - */ - public PrioritizedRecordsList createPrioritizedRecordsList() { - return new PrioritizedRecordsList(); - } - - /** - * Create an instance of {@link PoolRecordListParams } - * - */ - public PoolRecordListParams createPoolRecordListParams() { - return new PoolRecordListParams(); - } - - /** - * Create an instance of {@link UpdateRoundRobinRecord } - * - */ - public UpdateRoundRobinRecord createUpdateRoundRobinRecord() { - return new UpdateRoundRobinRecord(); - } - - /** - * Create an instance of {@link HealthCheckList } - * - */ - public HealthCheckList createHealthCheckList() { - return new HealthCheckList(); - } - - /** - * Create an instance of {@link MailFwdRecordsList } - * - */ - public MailFwdRecordsList createMailFwdRecordsList() { - return new MailFwdRecordsList(); - } - - /** - * Create an instance of {@link ARPoolRuleKey } - * - */ - public ARPoolRuleKey createARPoolRuleKey() { - return new ARPoolRuleKey(); - } - - /** - * Create an instance of {@link ARPoolAlertsList } - * - */ - public ARPoolAlertsList createARPoolAlertsList() { - return new ARPoolAlertsList(); - } - - /** - * Create an instance of {@link PoolProbeId } - * - */ - public PoolProbeId createPoolProbeId() { - return new PoolProbeId(); - } - - /** - * Create an instance of {@link AddressBookEntryCreateKey } - * - */ - public AddressBookEntryCreateKey createAddressBookEntryCreateKey() { - return new AddressBookEntryCreateKey(); - } - - /** - * Create an instance of {@link RecentActivityList } - * - */ - public RecentActivityList createRecentActivityList() { - return new RecentActivityList(); - } - - /** - * Create an instance of {@link AlertPoolStatus } - * - */ - public AlertPoolStatus createAlertPoolStatus() { - return new AlertPoolStatus(); - } - - /** - * Create an instance of {@link RegionForNewGroups } - * - */ - public RegionForNewGroups createRegionForNewGroups() { - return new RegionForNewGroups(); - } - - /** - * Create an instance of {@link RegionForNewGroupsList } - * - */ - public RegionForNewGroupsList createRegionForNewGroupsList() { - return new RegionForNewGroupsList(); - } - - /** - * Create an instance of {@link UnsuspendZone } - * - */ - public UnsuspendZone createUnsuspendZone() { - return new UnsuspendZone(); - } - - /** - * Create an instance of {@link PoolRecordId } - * - */ - public PoolRecordId createPoolRecordId() { - return new PoolRecordId(); - } - - /** - * Create an instance of {@link AddDirectionalPoolData } - * - */ - public AddDirectionalPoolData createAddDirectionalPoolData() { - return new AddDirectionalPoolData(); - } - - /** - * Create an instance of {@link Rules } - * - */ - public Rules createRules() { - return new Rules(); - } - - /** - * Create an instance of {@link AlertPoolDetails } - * - */ - public AlertPoolDetails createAlertPoolDetails() { - return new AlertPoolDetails(); - } - - /** - * Create an instance of {@link DefaultReportPrefPreference } - * - */ - public DefaultReportPrefPreference createDefaultReportPrefPreference() { - return new DefaultReportPrefPreference(); - } - - /** - * Create an instance of {@link TCPCriteria } - * - */ - public TCPCriteria createTCPCriteria() { - return new TCPCriteria(); - } - - /** - * Create an instance of {@link PoolData } - * - */ - public PoolData createPoolData() { - return new PoolData(); - } - - /** - * Create an instance of {@link ExternalValues } - * - */ - public ExternalValues createExternalValues() { - return new ExternalValues(); - } - - /** - * Create an instance of {@link SourceIpGroupDefinitionList } - * - */ - public SourceIpGroupDefinitionList createSourceIpGroupDefinitionList() { - return new SourceIpGroupDefinitionList(); - } - - /** - * Create an instance of {@link CountryInfo } - * - */ - public CountryInfo createCountryInfo() { - return new CountryInfo(); - } - - /** - * Create an instance of {@link UserDetailsPermissionData } - * - */ - public UserDetailsPermissionData createUserDetailsPermissionData() { - return new UserDetailsPermissionData(); - } - - /** - * Create an instance of {@link UnsuspendZoneRequest } - * - */ - public UnsuspendZoneRequest createUnsuspendZoneRequest() { - return new UnsuspendZoneRequest(); - } - - /** - * Create an instance of {@link ProbeRegionList } - * - */ - public ProbeRegionList createProbeRegionList() { - return new ProbeRegionList(); - } - - /** - * Create an instance of {@link StatesInfo } - * - */ - public StatesInfo createStatesInfo() { - return new StatesInfo(); - } - - /** - * Create an instance of {@link ScheduledEvent } - * - */ - public ScheduledEvent createScheduledEvent() { - return new ScheduledEvent(); - } - - /** - * Create an instance of {@link SMTPAvailabilityProbeData } - * - */ - public SMTPAvailabilityProbeData createSMTPAvailabilityProbeData() { - return new SMTPAvailabilityProbeData(); - } - - /** - * Create an instance of {@link MonitoredRDPoolRecordsAdd } - * - */ - public MonitoredRDPoolRecordsAdd createMonitoredRDPoolRecordsAdd() { - return new MonitoredRDPoolRecordsAdd(); - } - - /** - * Create an instance of {@link DirectionalDNSRecordDetailList } - * - */ - public DirectionalDNSRecordDetailList createDirectionalDNSRecordDetailList() { - return new DirectionalDNSRecordDetailList(); - } - - /** - * Create an instance of {@link FTPCriteria } - * - */ - public FTPCriteria createFTPCriteria() { - return new FTPCriteria(); - } - - /** - * Create an instance of {@link UserDefaultPreferences } - * - */ - public UserDefaultPreferences createUserDefaultPreferences() { - return new UserDefaultPreferences(); - } - - /** - * Create an instance of {@link AccountPreferencesList } - * - */ - public AccountPreferencesList createAccountPreferencesList() { - return new AccountPreferencesList(); - } - - /** - * Create an instance of {@link DsRecordList } - * - */ - public DsRecordList createDsRecordList() { - return new DsRecordList(); - } - - /** - * Create an instance of {@link HTTPProbeData } - * - */ - public HTTPProbeData createHTTPProbeData() { - return new HTTPProbeData(); - } - - /** - * Create an instance of {@link TaskId } - * - */ - public TaskId createTaskId() { - return new TaskId(); - } - - /** - * Create an instance of {@link SourceIpGroupDefinitionData } - * - */ - public SourceIpGroupDefinitionData createSourceIpGroupDefinitionData() { - return new SourceIpGroupDefinitionData(); - } - - /** - * Create an instance of {@link AddressBookEntryListKey } - * - */ - public AddressBookEntryListKey createAddressBookEntryListKey() { - return new AddressBookEntryListKey(); - } - - /** - * Create an instance of {@link NameServers } - * - */ - public NameServers createNameServers() { - return new NameServers(); - } - - /** - * Create an instance of {@link UpdateGeolocationGroupDetails } - * - */ - public UpdateGeolocationGroupDetails createUpdateGeolocationGroupDetails() { - return new UpdateGeolocationGroupDetails(); - } - - /** - * Create an instance of {@link MonitoredRDPoolConversionInfo } - * - */ - public MonitoredRDPoolConversionInfo createMonitoredRDPoolConversionInfo() { - return new MonitoredRDPoolConversionInfo(); - } - - /** - * Create an instance of {@link AgentsRunningProbeList } - * - */ - public AgentsRunningProbeList createAgentsRunningProbeList() { - return new AgentsRunningProbeList(); - } - - /** - * Create an instance of {@link GeolocationGroupDetails } - * - */ - public GeolocationGroupDetails createGeolocationGroupDetails() { - return new GeolocationGroupDetails(); - } - - /** - * Create an instance of {@link FTPTransaction } - * - */ - public FTPTransaction createFTPTransaction() { - return new FTPTransaction(); - } - - /** - * Create an instance of {@link ZoneInfoData } - * - */ - public ZoneInfoData createZoneInfoData() { - return new ZoneInfoData(); - } - - /** - * Create an instance of {@link PoolToAcctGroupConversionDetails } - * - */ - public PoolToAcctGroupConversionDetails createPoolToAcctGroupConversionDetails() { - return new PoolToAcctGroupConversionDetails(); - } - - /** - * Create an instance of {@link PoolDefinitions } - * - */ - public PoolDefinitions createPoolDefinitions() { - return new PoolDefinitions(); - } - - /** - * Create an instance of {@link AllStatesList } - * - */ - public AllStatesList createAllStatesList() { - return new AllStatesList(); - } - - /** - * Create an instance of {@link WebFwdRecordsList } - * - */ - public WebFwdRecordsList createWebFwdRecordsList() { - return new WebFwdRecordsList(); - } - - /** - * Create an instance of {@link HeaderRule } - * - */ - public HeaderRule createHeaderRule() { - return new HeaderRule(); - } - - /** - * Create an instance of {@link CNAMERecord } - * - */ - public CNAMERecord createCNAMERecord() { - return new CNAMERecord(); - } - - /** - * Create an instance of {@link SMTPCriteria } - * - */ - public SMTPCriteria createSMTPCriteria() { - return new SMTPCriteria(); - } - - /** - * Create an instance of {@link ProbeDefinitionId } - * - */ - public ProbeDefinitionId createProbeDefinitionId() { - return new ProbeDefinitionId(); - } - - /** - * Create an instance of {@link FailoverMonitorUpdate } - * - */ - public FailoverMonitorUpdate createFailoverMonitorUpdate() { - return new FailoverMonitorUpdate(); - } - - /** - * Create an instance of {@link ProbeData } - * - */ - public ProbeData createProbeData() { - return new ProbeData(); - } - - /** - * Create an instance of {@link PrioritizedRecord } - * - */ - public PrioritizedRecord createPrioritizedRecord() { - return new PrioritizedRecord(); - } - - /** - * Create an instance of {@link PROXYProbeData } - * - */ - public PROXYProbeData createPROXYProbeData() { - return new PROXYProbeData(); - } - - /** - * Create an instance of {@link InactiveTimeOutPreference } - * - */ - public InactiveTimeOutPreference createInactiveTimeOutPreference() { - return new InactiveTimeOutPreference(); - } - - /** - * Create an instance of {@link DnssecKeyRecordList } - * - */ - public DnssecKeyRecordList createDnssecKeyRecordList() { - return new DnssecKeyRecordList(); - } - - /** - * Create an instance of {@link SecurityQuestions } - * - */ - public SecurityQuestions createSecurityQuestions() { - return new SecurityQuestions(); - } - - /** - * Create an instance of {@link AddressBookEntryGet } - * - */ - public AddressBookEntryGet createAddressBookEntryGet() { - return new AddressBookEntryGet(); - } - - /** - * Create an instance of {@link UpdateSourceIPGroupDetails } - * - */ - public UpdateSourceIPGroupDetails createUpdateSourceIPGroupDetails() { - return new UpdateSourceIPGroupDetails(); - } - - /** - * Create an instance of {@link SimpleFailoverPoolList } - * - */ - public SimpleFailoverPoolList createSimpleFailoverPoolList() { - return new SimpleFailoverPoolList(); - } - - /** - * Create an instance of {@link MonitoredRDPoolRecordAdd } - * - */ - public MonitoredRDPoolRecordAdd createMonitoredRDPoolRecordAdd() { - return new MonitoredRDPoolRecordAdd(); - } - - /** - * Create an instance of {@link PoolRecordProbeId } - * - */ - public PoolRecordProbeId createPoolRecordProbeId() { - return new PoolRecordProbeId(); - } - - /** - * Create an instance of {@link PoolRecordUpdate } - * - */ - public PoolRecordUpdate createPoolRecordUpdate() { - return new PoolRecordUpdate(); - } - - /** - * Create an instance of {@link ZoneInfoList } - * - */ - public ZoneInfoList createZoneInfoList() { - return new ZoneInfoList(); - } - - /** - * Create an instance of {@link CustomHTTPHeaderDataList } - * - */ - public CustomHTTPHeaderDataList createCustomHTTPHeaderDataList() { - return new CustomHTTPHeaderDataList(); - } - - /** - * Create an instance of {@link SBAgentsData } - * - */ - public SBAgentsData createSBAgentsData() { - return new SBAgentsData(); - } - - /** - * Create an instance of {@link UpdateWebForwardPoolRecordData } - * - */ - public UpdateWebForwardPoolRecordData createUpdateWebForwardPoolRecordData() { - return new UpdateWebForwardPoolRecordData(); - } - - /** - * Create an instance of {@link PoolAlertDetails } - * - */ - public PoolAlertDetails createPoolAlertDetails() { - return new PoolAlertDetails(); - } - - /** - * Create an instance of {@link DomainAlertData } - * - */ - public DomainAlertData createDomainAlertData() { - return new DomainAlertData(); - } - - /** - * Create an instance of {@link GeneralNotificationStatusData } - * - */ - public GeneralNotificationStatusData createGeneralNotificationStatusData() { - return new GeneralNotificationStatusData(); - } - - /** - * Create an instance of {@link SimpleFailoverPool } - * - */ - public SimpleFailoverPool createSimpleFailoverPool() { - return new SimpleFailoverPool(); - } - - /** - * Create an instance of {@link RegionList } - * - */ - public RegionList createRegionList() { - return new RegionList(); - } - - /** - * Create an instance of {@link PingCriteria } - * - */ - public PingCriteria createPingCriteria() { - return new PingCriteria(); - } - - /** - * Create an instance of {@link HttpCriteria } - * - */ - public HttpCriteria createHttpCriteria() { - return new HttpCriteria(); - } - - /** - * Create an instance of {@link UpdateCustomHTTPHeaderData } - * - */ - public UpdateCustomHTTPHeaderData createUpdateCustomHTTPHeaderData() { - return new UpdateCustomHTTPHeaderData(); - } - - /** - * Create an instance of {@link Pool } - * - */ - public Pool createPool() { - return new Pool(); - } - - /** - * Create an instance of {@link ResourceRecordGUIDList } - * - */ - public ResourceRecordGUIDList createResourceRecordGUIDList() { - return new ResourceRecordGUIDList(); - } - - /** - * Create an instance of {@link ProbesList } - * - */ - public ProbesList createProbesList() { - return new ProbesList(); - } - - /** - * Create an instance of {@link ScheduledEventList } - * - */ - public ScheduledEventList createScheduledEventList() { - return new ScheduledEventList(); - } - - /** - * Create an instance of {@link UpdateDirectionalPoolData } - * - */ - public UpdateDirectionalPoolData createUpdateDirectionalPoolData() { - return new UpdateDirectionalPoolData(); - } - - /** - * Create an instance of {@link ARAlertRuleDetails } - * - */ - public ARAlertRuleDetails createARAlertRuleDetails() { - return new ARAlertRuleDetails(); - } - - /** - * Create an instance of {@link CustomHTTPHeaderData } - * - */ - public CustomHTTPHeaderData createCustomHTTPHeaderData() { - return new CustomHTTPHeaderData(); - } - - /** - * Create an instance of {@link MonitoredRDPoolUpdate } - * - */ - public MonitoredRDPoolUpdate createMonitoredRDPoolUpdate() { - return new MonitoredRDPoolUpdate(); - } - - /** - * Create an instance of {@link MonitoredRDPool } - * - */ - public MonitoredRDPool createMonitoredRDPool() { - return new MonitoredRDPool(); - } - - /** - * Create an instance of {@link PoolId } - * - */ - public PoolId createPoolId() { - return new PoolId(); - } - - /** - * Create an instance of {@link SimpleFailoverPoolAdd } - * - */ - public SimpleFailoverPoolAdd createSimpleFailoverPoolAdd() { - return new SimpleFailoverPoolAdd(); - } - - /** - * Create an instance of {@link ZoneTransferStatus } - * - */ - public ZoneTransferStatus createZoneTransferStatus() { - return new ZoneTransferStatus(); - } - - /** - * Create an instance of {@link TCPProbeData } - * - */ - public TCPProbeData createTCPProbeData() { - return new TCPProbeData(); - } - - /** - * Create an instance of {@link SuspendZone } - * - */ - public SuspendZone createSuspendZone() { - return new SuspendZone(); - } - - /** - * Create an instance of {@link TaskStatusList } - * - */ - public TaskStatusList createTaskStatusList() { - return new TaskStatusList(); - } - - /** - * Create an instance of {@link DirectionalDNSRecordDetail } - * - */ - public DirectionalDNSRecordDetail createDirectionalDNSRecordDetail() { - return new DirectionalDNSRecordDetail(); - } - - /** - * Create an instance of {@link DnsCriteria } - * - */ - public DnsCriteria createDnsCriteria() { - return new DnsCriteria(); - } - - /** - * Create an instance of {@link AccountPreferenceDetail } - * - */ - public AccountPreferenceDetail createAccountPreferenceDetail() { - return new AccountPreferenceDetail(); - } - - /** - * Create an instance of {@link DirectionalDNSRecordToUpdate } - * - */ - public DirectionalDNSRecordToUpdate createDirectionalDNSRecordToUpdate() { - return new DirectionalDNSRecordToUpdate(); - } - - /** - * Create an instance of {@link Probe } - * - */ - public Probe createProbe() { - return new Probe(); - } - - /** - * Create an instance of {@link PasswordVerificationQuestionList } - * - */ - public PasswordVerificationQuestionList createPasswordVerificationQuestionList() { - return new PasswordVerificationQuestionList(); - } - - /** - * Create an instance of {@link ARPoolRecords } - * - */ - public ARPoolRecords createARPoolRecords() { - return new ARPoolRecords(); - } - - /** - * Create an instance of {@link SMTP2Transaction } - * - */ - public SMTP2Transaction createSMTP2Transaction() { - return new SMTP2Transaction(); - } - - /** - * Create an instance of {@link AllUsersDetailsList } - * - */ - public AllUsersDetailsList createAllUsersDetailsList() { - return new AllUsersDetailsList(); - } - - /** - * Create an instance of {@link UserDetailsData } - * - */ - public UserDetailsData createUserDetailsData() { - return new UserDetailsData(); - } - - /** - * Create an instance of {@link NotificationData } - * - */ - public NotificationData createNotificationData() { - return new NotificationData(); - } - - /** - * Create an instance of {@link GlobalDirectionalGroupUpdateDetails } - * - */ - public GlobalDirectionalGroupUpdateDetails createGlobalDirectionalGroupUpdateDetails() { - return new GlobalDirectionalGroupUpdateDetails(); - } - - /** - * Create an instance of {@link ResourceRecordList } - * - */ - public ResourceRecordList createResourceRecordList() { - return new ResourceRecordList(); - } - - /** - * Create an instance of {@link PINGProbeData } - * - */ - public PINGProbeData createPINGProbeData() { - return new PINGProbeData(); - } - - /** - * Create an instance of {@link Region } - * - */ - public Region createRegion() { - return new Region(); - } - - /** - * Create an instance of {@link AliasedDomainInfo } - * - */ - public AliasedDomainInfo createAliasedDomainInfo() { - return new AliasedDomainInfo(); - } - - /** - * Create an instance of {@link NameServerRecord } - * - */ - public NameServerRecord createNameServerRecord() { - return new NameServerRecord(); - } - - /** - * Create an instance of {@link PoolDetails } - * - */ - public PoolDetails createPoolDetails() { - return new PoolDetails(); - } - - /** - * Create an instance of {@link DirectionalDNSGroupDetail } - * - */ - public DirectionalDNSGroupDetail createDirectionalDNSGroupDetail() { - return new DirectionalDNSGroupDetail(); - } - - /** - * Create an instance of {@link DefaultNumberOfrecordsPreference } - * - */ - public DefaultNumberOfrecordsPreference createDefaultNumberOfrecordsPreference() { - return new DefaultNumberOfrecordsPreference(); - } - - /** - * Create an instance of {@link NameServerList } - * - */ - public NameServerList createNameServerList() { - return new NameServerList(); - } - - /** - * Create an instance of {@link WebForwardPoolRecordData } - * - */ - public WebForwardPoolRecordData createWebForwardPoolRecordData() { - return new WebForwardPoolRecordData(); - } - - /** - * Create an instance of {@link ProbeDefinition } - * - */ - public ProbeDefinition createProbeDefinition() { - return new ProbeDefinition(); - } - - /** - * Create an instance of {@link PoolConfigurationList } - * - */ - public PoolConfigurationList createPoolConfigurationList() { - return new PoolConfigurationList(); - } - - /** - * Create an instance of {@link WebForwardRecord } - * - */ - public WebForwardRecord createWebForwardRecord() { - return new WebForwardRecord(); - } - - /** - * Create an instance of {@link AccountAddressInfo } - * - */ - public AccountAddressInfo createAccountAddressInfo() { - return new AccountAddressInfo(); - } - - /** - * Create an instance of {@link AllUsersDetailsData } - * - */ - public AllUsersDetailsData createAllUsersDetailsData() { - return new AllUsersDetailsData(); - } - - /** - * Create an instance of {@link ResourceRecord } - * - */ - public ResourceRecord createResourceRecord() { - return new ResourceRecord(); - } - - /** - * Create an instance of {@link ResourceRecordToUpdate } - * - */ - public ResourceRecordToUpdate createResourceRecordToUpdate() { - return new ResourceRecordToUpdate(); - } - - /** - * Create an instance of {@link AccountLevelNotificationsList } - * - */ - public AccountLevelNotificationsList createAccountLevelNotificationsList() { - return new AccountLevelNotificationsList(); - } - - /** - * Create an instance of {@link ProbeRegions } - * - */ - public ProbeRegions createProbeRegions() { - return new ProbeRegions(); - } - - /** - * Create an instance of {@link ARPoolProbeList } - * - */ - public ARPoolProbeList createARPoolProbeList() { - return new ARPoolProbeList(); - } - - /** - * Create an instance of {@link LBPoolData } - * - */ - public LBPoolData createLBPoolData() { - return new LBPoolData(); - } - - /** - * Create an instance of {@link AcctToPoolGroupConversionDetails } - * - */ - public AcctToPoolGroupConversionDetails createAcctToPoolGroupConversionDetails() { - return new AcctToPoolGroupConversionDetails(); - } - - /** - * Create an instance of {@link AlertAllFailDetails } - * - */ - public AlertAllFailDetails createAlertAllFailDetails() { - return new AlertAllFailDetails(); - } - - /** - * Create an instance of {@link DsRecord } - * - */ - public DsRecord createDsRecord() { - return new DsRecord(); - } - - /** - * Create an instance of {@link AccountLevelGroupsList } - * - */ - public AccountLevelGroupsList createAccountLevelGroupsList() { - return new AccountLevelGroupsList(); - } - - /** - * Create an instance of {@link FailoverMonitor } - * - */ - public FailoverMonitor createFailoverMonitor() { - return new FailoverMonitor(); - } - - /** - * Create an instance of {@link MonitoredRDPoolMonitor } - * - */ - public MonitoredRDPoolMonitor createMonitoredRDPoolMonitor() { - return new MonitoredRDPoolMonitor(); - } - - /** - * Create an instance of {@link PoolDetailsList } - * - */ - public PoolDetailsList createPoolDetailsList() { - return new PoolDetailsList(); - } - - /** - * Create an instance of {@link ARProbeInfo } - * - */ - public ARProbeInfo createARProbeInfo() { - return new ARProbeInfo(); - } - - /** - * Create an instance of {@link ProbeInfo } - * - */ - public ProbeInfo createProbeInfo() { - return new ProbeInfo(); - } - - /** - * Create an instance of {@link SecurityPreferences } - * - */ - public SecurityPreferences createSecurityPreferences() { - return new SecurityPreferences(); - } - - /** - * Create an instance of {@link ProbeRegion } - * - */ - public ProbeRegion createProbeRegion() { - return new ProbeRegion(); - } - - /** - * Create an instance of {@link DNSProbeMaster } - * - */ - public DNSProbeMaster createDNSProbeMaster() { - return new DNSProbeMaster(); - } - - /** - * Create an instance of {@link ProbeInfo2 } - * - */ - public ProbeInfo2 createProbeInfo2() { - return new ProbeInfo2(); - } - - /** - * Create an instance of {@link MonitoredRDPoolRecord } - * - */ - public MonitoredRDPoolRecord createMonitoredRDPoolRecord() { - return new MonitoredRDPoolRecord(); - } - - /** - * Create an instance of {@link SimpleFailoverPoolUpdate } - * - */ - public SimpleFailoverPoolUpdate createSimpleFailoverPoolUpdate() { - return new SimpleFailoverPoolUpdate(); - } - - /** - * Create an instance of {@link AddressBookEntry } - * - */ - public AddressBookEntry createAddressBookEntry() { - return new AddressBookEntry(); - } - - /** - * Create an instance of {@link RecentActivity } - * - */ - public RecentActivity createRecentActivity() { - return new RecentActivity(); - } - - /** - * Create an instance of {@link ResourceRecordTypeOrderInfoList } - * - */ - public ResourceRecordTypeOrderInfoList createResourceRecordTypeOrderInfoList() { - return new ResourceRecordTypeOrderInfoList(); - } - - /** - * Create an instance of {@link DashboardTypeOrderInfo } - * - */ - public DashboardTypeOrderInfo createDashboardTypeOrderInfo() { - return new DashboardTypeOrderInfo(); - } - - /** - * Create an instance of {@link NameServerData } - * - */ - public NameServerData createNameServerData() { - return new NameServerData(); - } - - /** - * Create an instance of {@link AutomaticPointerPreference } - * - */ - public AutomaticPointerPreference createAutomaticPointerPreference() { - return new AutomaticPointerPreference(); - } - - /** - * Create an instance of {@link ResourceRecordToSearch } - * - */ - public ResourceRecordToSearch createResourceRecordToSearch() { - return new ResourceRecordToSearch(); - } - - /** - * Create an instance of {@link MonitoredRDPoolListKey } - * - */ - public MonitoredRDPoolListKey createMonitoredRDPoolListKey() { - return new MonitoredRDPoolListKey(); - } - - /** - * Create an instance of {@link DefaultDateAndTimePreference } - * - */ - public DefaultDateAndTimePreference createDefaultDateAndTimePreference() { - return new DefaultDateAndTimePreference(); - } - - /** - * Create an instance of {@link ProbeDefinitionTransactions } - * - */ - public ProbeDefinitionTransactions createProbeDefinitionTransactions() { - return new ProbeDefinitionTransactions(); - } - - /** - * Create an instance of {@link AddressBookEntryCreate } - * - */ - public AddressBookEntryCreate createAddressBookEntryCreate() { - return new AddressBookEntryCreate(); - } - - /** - * Create an instance of {@link SMTPSendMailProbeData } - * - */ - public SMTPSendMailProbeData createSMTPSendMailProbeData() { - return new SMTPSendMailProbeData(); - } - - /** - * Create an instance of {@link SimpleFailoverConversionInfo } - * - */ - public SimpleFailoverConversionInfo createSimpleFailoverConversionInfo() { - return new SimpleFailoverConversionInfo(); - } - - /** - * Create an instance of {@link ARecord } - * - */ - public ARecord createARecord() { - return new ARecord(); - } - - /** - * Create an instance of {@link AlertRecord } - * - */ - public AlertRecord createAlertRecord() { - return new AlertRecord(); - } - - /** - * Create an instance of {@link AccountDetailsData } - * - */ - public AccountDetailsData createAccountDetailsData() { - return new AccountDetailsData(); - } - - /** - * Create an instance of {@link DeleteConfirmPreference } - * - */ - public DeleteConfirmPreference createDeleteConfirmPreference() { - return new DeleteConfirmPreference(); - } - - /** - * Create an instance of {@link MonitoredRDPoolMonitorUpdate } - * - */ - public MonitoredRDPoolMonitorUpdate createMonitoredRDPoolMonitorUpdate() { - return new MonitoredRDPoolMonitorUpdate(); - } - - /** - * Create an instance of {@link DefaultAccountPreference } - * - */ - public DefaultAccountPreference createDefaultAccountPreference() { - return new DefaultAccountPreference(); - } - - /** - * Create an instance of {@link InfoTypes } - * - */ - public InfoTypes createInfoTypes() { - return new InfoTypes(); - } - - /** - * Create an instance of {@link ARPoolConfigurationKey } - * - */ - public ARPoolConfigurationKey createARPoolConfigurationKey() { - return new ARPoolConfigurationKey(); - } - - /** - * Create an instance of {@link RoundRobinRecord } - * - */ - public RoundRobinRecord createRoundRobinRecord() { - return new RoundRobinRecord(); - } - - /** - * Create an instance of {@link FTPProbeData } - * - */ - public FTPProbeData createFTPProbeData() { - return new FTPProbeData(); - } - - /** - * Create an instance of {@link GeneralZoneProperties } - * - */ - public GeneralZoneProperties createGeneralZoneProperties() { - return new GeneralZoneProperties(); - } - - /** - * Create an instance of {@link UserContactInfo } - * - */ - public UserContactInfo createUserContactInfo() { - return new UserContactInfo(); - } - - /** - * Create an instance of {@link NotifyRecordList } - * - */ - public NotifyRecordList createNotifyRecordList() { - return new NotifyRecordList(); - } - - /** - * Create an instance of {@link DirectionalDNSRecord } - * - */ - public DirectionalDNSRecord createDirectionalDNSRecord() { - return new DirectionalDNSRecord(); - } - - /** - * Create an instance of {@link FailoverRecord } - * - */ - public FailoverRecord createFailoverRecord() { - return new FailoverRecord(); - } - - /** - * Create an instance of {@link SBRegionData } - * - */ - public SBRegionData createSBRegionData() { - return new SBRegionData(); - } - - /** - * Create an instance of {@link ARAlertStateDetails } - * - */ - public ARAlertStateDetails createARAlertStateDetails() { - return new ARAlertStateDetails(); - } - - /** - * Create an instance of {@link SUBPOOLRecord } - * - */ - public SUBPOOLRecord createSUBPOOLRecord() { - return new SUBPOOLRecord(); - } - - /** - * Create an instance of {@link UsersList } - * - */ - public UsersList createUsersList() { - return new UsersList(); - } - - /** - * Create an instance of {@link ARPoolProbes } - * - */ - public ARPoolProbes createARPoolProbes() { - return new ARPoolProbes(); - } - - /** - * Create an instance of {@link ContactARPoolRuleInfo } - * - */ - public ContactARPoolRuleInfo createContactARPoolRuleInfo() { - return new ContactARPoolRuleInfo(); - } - - /** - * Create an instance of {@link ARPoolRecord } - * - */ - public ARPoolRecord createARPoolRecord() { - return new ARPoolRecord(); - } - - /** - * Create an instance of {@link UltraZone } - * - */ - public UltraZone createUltraZone() { - return new UltraZone(); - } - - /** - * Create an instance of {@link UserSummary } - * - */ - public UserSummary createUserSummary() { - return new UserSummary(); - } - - /** - * Create an instance of {@link SimpleFailoverPoolKey } - * - */ - public SimpleFailoverPoolKey createSimpleFailoverPoolKey() { - return new SimpleFailoverPoolKey(); - } - - /** - * Create an instance of {@link ARPoolConfigurationUpdate } - * - */ - public ARPoolConfigurationUpdate createARPoolConfigurationUpdate() { - return new ARPoolConfigurationUpdate(); - } - - /** - * Create an instance of {@link MaintenanceAlertsData } - * - */ - public MaintenanceAlertsData createMaintenanceAlertsData() { - return new MaintenanceAlertsData(); - } - - /** - * Create an instance of {@link AddressBookEntryKey } - * - */ - public AddressBookEntryKey createAddressBookEntryKey() { - return new AddressBookEntryKey(); - } - - /** - * Create an instance of {@link GeolocationGroupDefinitionData } - * - */ - public GeolocationGroupDefinitionData createGeolocationGroupDefinitionData() { - return new GeolocationGroupDefinitionData(); - } - - /** - * Create an instance of {@link PasswordVerificationQuestion } - * - */ - public PasswordVerificationQuestion createPasswordVerificationQuestion() { - return new PasswordVerificationQuestion(); - } - - /** - * Create an instance of {@link GlobalDirectionalGroupDetails } - * - */ - public GlobalDirectionalGroupDetails createGlobalDirectionalGroupDetails() { - return new GlobalDirectionalGroupDetails(); - } - - /** - * Create an instance of {@link ARPoolAlertsKey } - * - */ - public ARPoolAlertsKey createARPoolAlertsKey() { - return new ARPoolAlertsKey(); - } - - /** - * Create an instance of {@link FailoverRecordUpdate } - * - */ - public FailoverRecordUpdate createFailoverRecordUpdate() { - return new FailoverRecordUpdate(); - } - - /** - * Create an instance of {@link NotificationList } - * - */ - public NotificationList createNotificationList() { - return new NotificationList(); - } - - /** - * Create an instance of {@link CopyAssignedDirDNSGroup } - * - */ - public CopyAssignedDirDNSGroup createCopyAssignedDirDNSGroup() { - return new CopyAssignedDirDNSGroup(); - } - - /** - * Create an instance of {@link PrioritizedRecordList } - * - */ - public PrioritizedRecordList createPrioritizedRecordList() { - return new PrioritizedRecordList(); - } - - /** - * Create an instance of {@link ProbeDefinitionHttpTransactions } - * - */ - public ProbeDefinitionHttpTransactions createProbeDefinitionHttpTransactions() { - return new ProbeDefinitionHttpTransactions(); - } - - /** - * Create an instance of {@link DashboardTypeOrderInfoList } - * - */ - public DashboardTypeOrderInfoList createDashboardTypeOrderInfoList() { - return new DashboardTypeOrderInfoList(); - } - - /** - * Create an instance of {@link ProbeDefinitionList } - * - */ - public ProbeDefinitionList createProbeDefinitionList() { - return new ProbeDefinitionList(); - } - - /** - * Create an instance of {@link AlertSummaryList } - * - */ - public AlertSummaryList createAlertSummaryList() { - return new AlertSummaryList(); - } - - /** - * Create an instance of {@link ServiceList } - * - */ - public ServiceList createServiceList() { - return new ServiceList(); - } - - /** - * Create an instance of {@link PoolConfiguration } - * - */ - public PoolConfiguration createPoolConfiguration() { - return new PoolConfiguration(); - } - - /** - * Create an instance of {@link AlertPrioritizedRecord } - * - */ - public AlertPrioritizedRecord createAlertPrioritizedRecord() { - return new AlertPrioritizedRecord(); - } - - /** - * Create an instance of {@link CopyDirectionalGroup } - * - */ - public CopyDirectionalGroup createCopyDirectionalGroup() { - return new CopyDirectionalGroup(); - } - - /** - * Create an instance of {@link MonitoredRDPoolAllFailRecordUpdate } - * - */ - public MonitoredRDPoolAllFailRecordUpdate createMonitoredRDPoolAllFailRecordUpdate() { - return new MonitoredRDPoolAllFailRecordUpdate(); - } - - /** - * Create an instance of {@link ARPoolAlerts } - * - */ - public ARPoolAlerts createARPoolAlerts() { - return new ARPoolAlerts(); - } - - /** - * Create an instance of {@link PoolConfigurationDetails } - * - */ - public PoolConfigurationDetails createPoolConfigurationDetails() { - return new PoolConfigurationDetails(); - } - - /** - * Create an instance of {@link DNSProbeData } - * - */ - public DNSProbeData createDNSProbeData() { - return new DNSProbeData(); - } - - /** - * Create an instance of {@link LBPoolList } - * - */ - public LBPoolList createLBPoolList() { - return new LBPoolList(); - } - - /** - * Create an instance of {@link PoolAlertsListParams } - * - */ - public PoolAlertsListParams createPoolAlertsListParams() { - return new PoolAlertsListParams(); - } - - /** - * Create an instance of {@link Notifications } - * - */ - public Notifications createNotifications() { - return new Notifications(); - } - - /** - * Create an instance of {@link SuspendZoneRequest } - * - */ - public SuspendZoneRequest createSuspendZoneRequest() { - return new SuspendZoneRequest(); - } - - /** - * Create an instance of {@link ARPoolAlert } - * - */ - public ARPoolAlert createARPoolAlert() { - return new ARPoolAlert(); - } - - /** - * Create an instance of {@link EntryListParams } - * - */ - public EntryListParams createEntryListParams() { - return new EntryListParams(); - } - - /** - * Create an instance of {@link DirectionalRecordData } - * - */ - public DirectionalRecordData createDirectionalRecordData() { - return new DirectionalRecordData(); - } - - /** - * Create an instance of {@link NotifyRecord } - * - */ - public NotifyRecord createNotifyRecord() { - return new NotifyRecord(); - } - - /** - * Create an instance of {@link AccountDetailsList } - * - */ - public AccountDetailsList createAccountDetailsList() { - return new AccountDetailsList(); - } - - /** - * Create an instance of {@link NameServerIPs } - * - */ - public NameServerIPs createNameServerIPs() { - return new NameServerIPs(); - } - - /** - * Create an instance of {@link TaskStatus } - * - */ - public TaskStatus createTaskStatus() { - return new TaskStatus(); - } - - /** - * Create an instance of {@link AllCountriesList } - * - */ - public AllCountriesList createAllCountriesList() { - return new AllCountriesList(); - } - - /** - * Create an instance of {@link DnssecKey } - * - */ - public DnssecKey createDnssecKey() { - return new DnssecKey(); - } - - /** - * Create an instance of {@link WebForwardPoolRecordDataGuid } - * - */ - public WebForwardPoolRecordDataGuid createWebForwardPoolRecordDataGuid() { - return new WebForwardPoolRecordDataGuid(); - } - - /** - * Create an instance of {@link SBRegionsList } - * - */ - public SBRegionsList createSBRegionsList() { - return new SBRegionsList(); - } - - /** - * Create an instance of {@link CustomHTTPHeaderDataGUID } - * - */ - public CustomHTTPHeaderDataGUID createCustomHTTPHeaderDataGUID() { - return new CustomHTTPHeaderDataGUID(); - } - - /** - * Create an instance of {@link ProbeListParams } - * - */ - public ProbeListParams createProbeListParams() { - return new ProbeListParams(); - } - - /** - * Create an instance of {@link GeolocationGroupData } - * - */ - public GeolocationGroupData createGeolocationGroupData() { - return new GeolocationGroupData(); - } - - /** - * Create an instance of {@link MonitoredRDPoolRecords } - * - */ - public MonitoredRDPoolRecords createMonitoredRDPoolRecords() { - return new MonitoredRDPoolRecords(); - } - - /** - * Create an instance of {@link HTTPTransaction } - * - */ - public HTTPTransaction createHTTPTransaction() { - return new HTTPTransaction(); - } - - /** - * Create an instance of {@link GroupData } - * - */ - public GroupData createGroupData() { - return new GroupData(); - } - - /** - * Create an instance of {@link ZoneList } - * - */ - public ZoneList createZoneList() { - return new ZoneList(); - } - - /** - * Create an instance of {@link SBAgentsList } - * - */ - public SBAgentsList createSBAgentsList() { - return new SBAgentsList(); - } - - /** - * Create an instance of {@link AlertAllFailRecordsList } - * - */ - public AlertAllFailRecordsList createAlertAllFailRecordsList() { - return new AlertAllFailRecordsList(); - } - - /** - * Create an instance of {@link AlertProbeDetails } - * - */ - public AlertProbeDetails createAlertProbeDetails() { - return new AlertProbeDetails(); - } - - /** - * Create an instance of {@link ResourceRecordTemplate } - * - */ - public ResourceRecordTemplate createResourceRecordTemplate() { - return new ResourceRecordTemplate(); - } - - /** - * Create an instance of {@link AccountLevelNotificationsData } - * - */ - public AccountLevelNotificationsData createAccountLevelNotificationsData() { - return new AccountLevelNotificationsData(); - } - - /** - * Create an instance of {@link DirectionalPoolData } - * - */ - public DirectionalPoolData createDirectionalPoolData() { - return new DirectionalPoolData(); - } - - /** - * Create an instance of {@link PoolUpdate } - * - */ - public PoolUpdate createPoolUpdate() { - return new PoolUpdate(); - } - - /** - * Create an instance of {@link PoolKey } - * - */ - public PoolKey createPoolKey() { - return new PoolKey(); - } - - /** - * Create an instance of {@link UserSummaryList } - * - */ - public UserSummaryList createUserSummaryList() { - return new UserSummaryList(); - } - - /** - * Create an instance of {@link ProbeAlertsData } - * - */ - public ProbeAlertsData createProbeAlertsData() { - return new ProbeAlertsData(); - } - - /** - * Create an instance of {@link PoolListParams } - * - */ - public PoolListParams createPoolListParams() { - return new PoolListParams(); - } - - /** - * Create an instance of {@link DNSTransaction } - * - */ - public DNSTransaction createDNSTransaction() { - return new DNSTransaction(); - } - - /** - * Create an instance of {@link UpdateDirectionalRecordData } - * - */ - public UpdateDirectionalRecordData createUpdateDirectionalRecordData() { - return new UpdateDirectionalRecordData(); - } - - /** - * Create an instance of {@link UserContactInfoValues } - * - */ - public UserContactInfoValues createUserContactInfoValues() { - return new UserContactInfoValues(); - } - - /** - * Create an instance of {@link GeneralNotificationStatusList } - * - */ - public GeneralNotificationStatusList createGeneralNotificationStatusList() { - return new GeneralNotificationStatusList(); - } - - /** - * Create an instance of {@link MonitoredRDPoolKey } - * - */ - public MonitoredRDPoolKey createMonitoredRDPoolKey() { - return new MonitoredRDPoolKey(); - } - - /** - * Create an instance of {@link ServiceInfo } - * - */ - public ServiceInfo createServiceInfo() { - return new ServiceInfo(); - } - - /** - * Create an instance of {@link DomainDnssecPolicies } - * - */ - public DomainDnssecPolicies createDomainDnssecPolicies() { - return new DomainDnssecPolicies(); - } - - /** - * Create an instance of {@link PINGTransaction } - * - */ - public PINGTransaction createPINGTransaction() { - return new PINGTransaction(); - } - - /** - * Create an instance of {@link RestrictIPList } - * - */ - public RestrictIPList createRestrictIPList() { - return new RestrictIPList(); - } - - /** - * Create an instance of {@link PoolRecordSpecData } - * - */ - public PoolRecordSpecData createPoolRecordSpecData() { - return new PoolRecordSpecData(); - } - - /** - * Create an instance of {@link AddressBookEntryList } - * - */ - public AddressBookEntryList createAddressBookEntryList() { - return new AddressBookEntryList(); - } - - /** - * Create an instance of {@link NameServerRecordSet } - * - */ - public NameServerRecordSet createNameServerRecordSet() { - return new NameServerRecordSet(); - } - - /** - * Create an instance of {@link RestrictIP } - * - */ - public RestrictIP createRestrictIP() { - return new RestrictIP(); - } - - /** - * Create an instance of {@link ResourceRecordTypeOrderInfo } - * - */ - public ResourceRecordTypeOrderInfo createResourceRecordTypeOrderInfo() { - return new ResourceRecordTypeOrderInfo(); - } - - /** - * Create an instance of {@link SourceIPGroupDetails } - * - */ - public SourceIPGroupDetails createSourceIPGroupDetails() { - return new SourceIPGroupDetails(); - } - - /** - * Create an instance of {@link WebForwardPoolRecordDataList } - * - */ - public WebForwardPoolRecordDataList createWebForwardPoolRecordDataList() { - return new WebForwardPoolRecordDataList(); - } - - /** - * Create an instance of {@link SMTPTransaction } - * - */ - public SMTPTransaction createSMTPTransaction() { - return new SMTPTransaction(); - } - - /** - * Create an instance of {@link AccountLevelGroup } - * - */ - public AccountLevelGroup createAccountLevelGroup() { - return new AccountLevelGroup(); - } - - /** - * Create an instance of {@link Regions } - * - */ - public Regions createRegions() { - return new Regions(); - } - - /** - * Create an instance of {@link Rule } - * - */ - public Rule createRule() { - return new Rule(); - } - - /** - * Create an instance of {@link PoolRecordData } - * - */ - public PoolRecordData createPoolRecordData() { - return new PoolRecordData(); - } - - /** - * Create an instance of {@link MonitoredRDPoolAdd } - * - */ - public MonitoredRDPoolAdd createMonitoredRDPoolAdd() { - return new MonitoredRDPoolAdd(); - } - - /** - * Create an instance of {@link PasswordVerificationInfo } - * - */ - public PasswordVerificationInfo createPasswordVerificationInfo() { - return new PasswordVerificationInfo(); - } - - /** - * Create an instance of {@link RDPoolConversionInfo } - * - */ - public RDPoolConversionInfo createRDPoolConversionInfo() { - return new RDPoolConversionInfo(); - } - - /** - * Create an instance of {@link ResourceRecordToCreate } - * - */ - public ResourceRecordToCreate createResourceRecordToCreate() { - return new ResourceRecordToCreate(); - } - - /** - * Create an instance of {@link SourceIPGroupData } - * - */ - public SourceIPGroupData createSourceIPGroupData() { - return new SourceIPGroupData(); - } - - /** - * Create an instance of {@link Record } - * - */ - public Record createRecord() { - return new Record(); - } - - /** - * Create an instance of {@link ARPoolRecordsList } - * - */ - public ARPoolRecordsList createARPoolRecordsList() { - return new ARPoolRecordsList(); - } - - /** - * Create an instance of {@link ARPoolRecordListKey } - * - */ - public ARPoolRecordListKey createARPoolRecordListKey() { - return new ARPoolRecordListKey(); - } - - /** - * Create an instance of {@link PasswordExpirationPreference } - * - */ - public PasswordExpirationPreference createPasswordExpirationPreference() { - return new PasswordExpirationPreference(); - } - - /** - * Create an instance of {@link AccountInfoData } - * - */ - public AccountInfoData createAccountInfoData() { - return new AccountInfoData(); - } - - /** - * Create an instance of {@link TCPTransaction } - * - */ - public TCPTransaction createTCPTransaction() { - return new TCPTransaction(); - } - - /** - * Create an instance of {@link NotificationInfo } - * - */ - public NotificationInfo createNotificationInfo() { - return new NotificationInfo(); - } - - /** - * Create an instance of {@link MailForwardRecord } - * - */ - public MailForwardRecord createMailForwardRecord() { - return new MailForwardRecord(); - } - - /** - * Create an instance of {@link JAXBElement }{@code <}{@link Long }{@code >}} - * - */ - @XmlElementDecl(namespace = "http://schema.ultraservice.neustar.com/v01/", name = "ttl", scope = ProbeInfo2 .class) - public JAXBElement createProbeInfo2Ttl(Long value) { - return new JAXBElement(_ProbeInfo2Ttl_QNAME, Long.class, ProbeInfo2 .class, value); - } - - /** - * Create an instance of {@link JAXBElement }{@code <}{@link NameServerRecordSet }{@code >}} - * - */ - @XmlElementDecl(namespace = "http://schema.ultraservice.neustar.com/v01/", name = "NameServerRecordSet", scope = NameServers.class) - public JAXBElement createNameServersNameServerRecordSet(NameServerRecordSet value) { - return new JAXBElement(_NameServersNameServerRecordSet_QNAME, NameServerRecordSet.class, NameServers.class, value); - } - - /** - * Create an instance of {@link JAXBElement }{@code <}{@link Long }{@code >}} - * - */ - @XmlElementDecl(namespace = "http://schema.ultraservice.neustar.com/v01/", name = "ttl", scope = MonitoredRDPoolUpdate.class) - public JAXBElement createMonitoredRDPoolUpdateTtl(Long value) { - return new JAXBElement(_ProbeInfo2Ttl_QNAME, Long.class, MonitoredRDPoolUpdate.class, value); - } - -} diff --git a/Plugins/Mineplex.BungeeRotator/src/com/neustar/ultraservice/schema/v01/PINGProbeData.java b/Plugins/Mineplex.BungeeRotator/src/com/neustar/ultraservice/schema/v01/PINGProbeData.java deleted file mode 100644 index 8a05ca92a..000000000 --- a/Plugins/Mineplex.BungeeRotator/src/com/neustar/ultraservice/schema/v01/PINGProbeData.java +++ /dev/null @@ -1,573 +0,0 @@ - -package com.neustar.ultraservice.schema.v01; - -import javax.xml.bind.annotation.XmlAccessType; -import javax.xml.bind.annotation.XmlAccessorType; -import javax.xml.bind.annotation.XmlAttribute; -import javax.xml.bind.annotation.XmlType; - - -/** - *

Java class for PINGProbeData complex type. - * - *

The following schema fragment specifies the expected content contained within this class. - * - *

- * <complexType name="PINGProbeData">
- *   <complexContent>
- *     <restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
- *       <sequence>
- *       </sequence>
- *       <attribute name="numberOfPackets" type="{http://www.w3.org/2001/XMLSchema}string" />
- *       <attribute name="sizeOfPackets" type="{http://www.w3.org/2001/XMLSchema}string" />
- *       <attribute name="percentageOfLostPackets" type="{http://www.w3.org/2001/XMLSchema}string" />
- *       <attribute name="roundTripTimeInMs" type="{http://www.w3.org/2001/XMLSchema}string" />
- *       <attribute name="runtime" type="{http://www.w3.org/2001/XMLSchema}string" />
- *       <attribute name="failPercentageOfLostPackets" type="{http://www.w3.org/2001/XMLSchema}string" />
- *       <attribute name="criticalPercentageOfLostPackets" type="{http://www.w3.org/2001/XMLSchema}string" />
- *       <attribute name="warningPercentageOfLostPackets" type="{http://www.w3.org/2001/XMLSchema}string" />
- *       <attribute name="failRoundTripTimeInMs" type="{http://www.w3.org/2001/XMLSchema}string" />
- *       <attribute name="criticalRoundTripTimeInMs" type="{http://www.w3.org/2001/XMLSchema}string" />
- *       <attribute name="warningRoundTripTimeInMs" type="{http://www.w3.org/2001/XMLSchema}string" />
- *       <attribute name="failRuntime" type="{http://www.w3.org/2001/XMLSchema}string" />
- *       <attribute name="criticalRuntime" type="{http://www.w3.org/2001/XMLSchema}string" />
- *       <attribute name="warningRuntime" type="{http://www.w3.org/2001/XMLSchema}string" />
- *       <attribute name="failAverageRTTInMs" type="{http://www.w3.org/2001/XMLSchema}string" />
- *       <attribute name="criticalAverageRTTInMs" type="{http://www.w3.org/2001/XMLSchema}string" />
- *       <attribute name="warningAverageRTTInMs" type="{http://www.w3.org/2001/XMLSchema}string" />
- *       <attribute name="failAverageRunTime" type="{http://www.w3.org/2001/XMLSchema}string" />
- *       <attribute name="criticalAverageRunTime" type="{http://www.w3.org/2001/XMLSchema}string" />
- *       <attribute name="warningAverageRunTime" type="{http://www.w3.org/2001/XMLSchema}string" />
- *     </restriction>
- *   </complexContent>
- * </complexType>
- * 
- * - * - */ -@XmlAccessorType(XmlAccessType.FIELD) -@XmlType(name = "PINGProbeData") -public class PINGProbeData { - - @XmlAttribute(name = "numberOfPackets") - protected String numberOfPackets; - @XmlAttribute(name = "sizeOfPackets") - protected String sizeOfPackets; - @XmlAttribute(name = "percentageOfLostPackets") - protected String percentageOfLostPackets; - @XmlAttribute(name = "roundTripTimeInMs") - protected String roundTripTimeInMs; - @XmlAttribute(name = "runtime") - protected String runtime; - @XmlAttribute(name = "failPercentageOfLostPackets") - protected String failPercentageOfLostPackets; - @XmlAttribute(name = "criticalPercentageOfLostPackets") - protected String criticalPercentageOfLostPackets; - @XmlAttribute(name = "warningPercentageOfLostPackets") - protected String warningPercentageOfLostPackets; - @XmlAttribute(name = "failRoundTripTimeInMs") - protected String failRoundTripTimeInMs; - @XmlAttribute(name = "criticalRoundTripTimeInMs") - protected String criticalRoundTripTimeInMs; - @XmlAttribute(name = "warningRoundTripTimeInMs") - protected String warningRoundTripTimeInMs; - @XmlAttribute(name = "failRuntime") - protected String failRuntime; - @XmlAttribute(name = "criticalRuntime") - protected String criticalRuntime; - @XmlAttribute(name = "warningRuntime") - protected String warningRuntime; - @XmlAttribute(name = "failAverageRTTInMs") - protected String failAverageRTTInMs; - @XmlAttribute(name = "criticalAverageRTTInMs") - protected String criticalAverageRTTInMs; - @XmlAttribute(name = "warningAverageRTTInMs") - protected String warningAverageRTTInMs; - @XmlAttribute(name = "failAverageRunTime") - protected String failAverageRunTime; - @XmlAttribute(name = "criticalAverageRunTime") - protected String criticalAverageRunTime; - @XmlAttribute(name = "warningAverageRunTime") - protected String warningAverageRunTime; - - /** - * Gets the value of the numberOfPackets property. - * - * @return - * possible object is - * {@link String } - * - */ - public String getNumberOfPackets() { - return numberOfPackets; - } - - /** - * Sets the value of the numberOfPackets property. - * - * @param value - * allowed object is - * {@link String } - * - */ - public void setNumberOfPackets(String value) { - this.numberOfPackets = value; - } - - /** - * Gets the value of the sizeOfPackets property. - * - * @return - * possible object is - * {@link String } - * - */ - public String getSizeOfPackets() { - return sizeOfPackets; - } - - /** - * Sets the value of the sizeOfPackets property. - * - * @param value - * allowed object is - * {@link String } - * - */ - public void setSizeOfPackets(String value) { - this.sizeOfPackets = value; - } - - /** - * Gets the value of the percentageOfLostPackets property. - * - * @return - * possible object is - * {@link String } - * - */ - public String getPercentageOfLostPackets() { - return percentageOfLostPackets; - } - - /** - * Sets the value of the percentageOfLostPackets property. - * - * @param value - * allowed object is - * {@link String } - * - */ - public void setPercentageOfLostPackets(String value) { - this.percentageOfLostPackets = value; - } - - /** - * Gets the value of the roundTripTimeInMs property. - * - * @return - * possible object is - * {@link String } - * - */ - public String getRoundTripTimeInMs() { - return roundTripTimeInMs; - } - - /** - * Sets the value of the roundTripTimeInMs property. - * - * @param value - * allowed object is - * {@link String } - * - */ - public void setRoundTripTimeInMs(String value) { - this.roundTripTimeInMs = value; - } - - /** - * Gets the value of the runtime property. - * - * @return - * possible object is - * {@link String } - * - */ - public String getRuntime() { - return runtime; - } - - /** - * Sets the value of the runtime property. - * - * @param value - * allowed object is - * {@link String } - * - */ - public void setRuntime(String value) { - this.runtime = value; - } - - /** - * Gets the value of the failPercentageOfLostPackets property. - * - * @return - * possible object is - * {@link String } - * - */ - public String getFailPercentageOfLostPackets() { - return failPercentageOfLostPackets; - } - - /** - * Sets the value of the failPercentageOfLostPackets property. - * - * @param value - * allowed object is - * {@link String } - * - */ - public void setFailPercentageOfLostPackets(String value) { - this.failPercentageOfLostPackets = value; - } - - /** - * Gets the value of the criticalPercentageOfLostPackets property. - * - * @return - * possible object is - * {@link String } - * - */ - public String getCriticalPercentageOfLostPackets() { - return criticalPercentageOfLostPackets; - } - - /** - * Sets the value of the criticalPercentageOfLostPackets property. - * - * @param value - * allowed object is - * {@link String } - * - */ - public void setCriticalPercentageOfLostPackets(String value) { - this.criticalPercentageOfLostPackets = value; - } - - /** - * Gets the value of the warningPercentageOfLostPackets property. - * - * @return - * possible object is - * {@link String } - * - */ - public String getWarningPercentageOfLostPackets() { - return warningPercentageOfLostPackets; - } - - /** - * Sets the value of the warningPercentageOfLostPackets property. - * - * @param value - * allowed object is - * {@link String } - * - */ - public void setWarningPercentageOfLostPackets(String value) { - this.warningPercentageOfLostPackets = value; - } - - /** - * Gets the value of the failRoundTripTimeInMs property. - * - * @return - * possible object is - * {@link String } - * - */ - public String getFailRoundTripTimeInMs() { - return failRoundTripTimeInMs; - } - - /** - * Sets the value of the failRoundTripTimeInMs property. - * - * @param value - * allowed object is - * {@link String } - * - */ - public void setFailRoundTripTimeInMs(String value) { - this.failRoundTripTimeInMs = value; - } - - /** - * Gets the value of the criticalRoundTripTimeInMs property. - * - * @return - * possible object is - * {@link String } - * - */ - public String getCriticalRoundTripTimeInMs() { - return criticalRoundTripTimeInMs; - } - - /** - * Sets the value of the criticalRoundTripTimeInMs property. - * - * @param value - * allowed object is - * {@link String } - * - */ - public void setCriticalRoundTripTimeInMs(String value) { - this.criticalRoundTripTimeInMs = value; - } - - /** - * Gets the value of the warningRoundTripTimeInMs property. - * - * @return - * possible object is - * {@link String } - * - */ - public String getWarningRoundTripTimeInMs() { - return warningRoundTripTimeInMs; - } - - /** - * Sets the value of the warningRoundTripTimeInMs property. - * - * @param value - * allowed object is - * {@link String } - * - */ - public void setWarningRoundTripTimeInMs(String value) { - this.warningRoundTripTimeInMs = value; - } - - /** - * Gets the value of the failRuntime property. - * - * @return - * possible object is - * {@link String } - * - */ - public String getFailRuntime() { - return failRuntime; - } - - /** - * Sets the value of the failRuntime property. - * - * @param value - * allowed object is - * {@link String } - * - */ - public void setFailRuntime(String value) { - this.failRuntime = value; - } - - /** - * Gets the value of the criticalRuntime property. - * - * @return - * possible object is - * {@link String } - * - */ - public String getCriticalRuntime() { - return criticalRuntime; - } - - /** - * Sets the value of the criticalRuntime property. - * - * @param value - * allowed object is - * {@link String } - * - */ - public void setCriticalRuntime(String value) { - this.criticalRuntime = value; - } - - /** - * Gets the value of the warningRuntime property. - * - * @return - * possible object is - * {@link String } - * - */ - public String getWarningRuntime() { - return warningRuntime; - } - - /** - * Sets the value of the warningRuntime property. - * - * @param value - * allowed object is - * {@link String } - * - */ - public void setWarningRuntime(String value) { - this.warningRuntime = value; - } - - /** - * Gets the value of the failAverageRTTInMs property. - * - * @return - * possible object is - * {@link String } - * - */ - public String getFailAverageRTTInMs() { - return failAverageRTTInMs; - } - - /** - * Sets the value of the failAverageRTTInMs property. - * - * @param value - * allowed object is - * {@link String } - * - */ - public void setFailAverageRTTInMs(String value) { - this.failAverageRTTInMs = value; - } - - /** - * Gets the value of the criticalAverageRTTInMs property. - * - * @return - * possible object is - * {@link String } - * - */ - public String getCriticalAverageRTTInMs() { - return criticalAverageRTTInMs; - } - - /** - * Sets the value of the criticalAverageRTTInMs property. - * - * @param value - * allowed object is - * {@link String } - * - */ - public void setCriticalAverageRTTInMs(String value) { - this.criticalAverageRTTInMs = value; - } - - /** - * Gets the value of the warningAverageRTTInMs property. - * - * @return - * possible object is - * {@link String } - * - */ - public String getWarningAverageRTTInMs() { - return warningAverageRTTInMs; - } - - /** - * Sets the value of the warningAverageRTTInMs property. - * - * @param value - * allowed object is - * {@link String } - * - */ - public void setWarningAverageRTTInMs(String value) { - this.warningAverageRTTInMs = value; - } - - /** - * Gets the value of the failAverageRunTime property. - * - * @return - * possible object is - * {@link String } - * - */ - public String getFailAverageRunTime() { - return failAverageRunTime; - } - - /** - * Sets the value of the failAverageRunTime property. - * - * @param value - * allowed object is - * {@link String } - * - */ - public void setFailAverageRunTime(String value) { - this.failAverageRunTime = value; - } - - /** - * Gets the value of the criticalAverageRunTime property. - * - * @return - * possible object is - * {@link String } - * - */ - public String getCriticalAverageRunTime() { - return criticalAverageRunTime; - } - - /** - * Sets the value of the criticalAverageRunTime property. - * - * @param value - * allowed object is - * {@link String } - * - */ - public void setCriticalAverageRunTime(String value) { - this.criticalAverageRunTime = value; - } - - /** - * Gets the value of the warningAverageRunTime property. - * - * @return - * possible object is - * {@link String } - * - */ - public String getWarningAverageRunTime() { - return warningAverageRunTime; - } - - /** - * Sets the value of the warningAverageRunTime property. - * - * @param value - * allowed object is - * {@link String } - * - */ - public void setWarningAverageRunTime(String value) { - this.warningAverageRunTime = value; - } - -} diff --git a/Plugins/Mineplex.BungeeRotator/src/com/neustar/ultraservice/schema/v01/PINGTransaction.java b/Plugins/Mineplex.BungeeRotator/src/com/neustar/ultraservice/schema/v01/PINGTransaction.java deleted file mode 100644 index f6f186030..000000000 --- a/Plugins/Mineplex.BungeeRotator/src/com/neustar/ultraservice/schema/v01/PINGTransaction.java +++ /dev/null @@ -1,169 +0,0 @@ - -package com.neustar.ultraservice.schema.v01; - -import javax.xml.bind.annotation.XmlAccessType; -import javax.xml.bind.annotation.XmlAccessorType; -import javax.xml.bind.annotation.XmlAttribute; -import javax.xml.bind.annotation.XmlType; - - -/** - *

Java class for PINGTransaction complex type. - * - *

The following schema fragment specifies the expected content contained within this class. - * - *

- * <complexType name="PINGTransaction">
- *   <complexContent>
- *     <restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
- *       <sequence>
- *         <element name="warningCriteria" type="{http://schema.ultraservice.neustar.com/v01/}PingCriteria" minOccurs="0"/>
- *         <element name="criticalCriteria" type="{http://schema.ultraservice.neustar.com/v01/}PingCriteria" minOccurs="0"/>
- *         <element name="failCriteria" type="{http://schema.ultraservice.neustar.com/v01/}PingCriteria" minOccurs="0"/>
- *       </sequence>
- *       <attribute name="packets" type="{http://www.w3.org/2001/XMLSchema}int" />
- *       <attribute name="size" type="{http://www.w3.org/2001/XMLSchema}int" />
- *     </restriction>
- *   </complexContent>
- * </complexType>
- * 
- * - * - */ -@XmlAccessorType(XmlAccessType.FIELD) -@XmlType(name = "PINGTransaction", propOrder = { - "warningCriteria", - "criticalCriteria", - "failCriteria" -}) -public class PINGTransaction { - - protected PingCriteria warningCriteria; - protected PingCriteria criticalCriteria; - protected PingCriteria failCriteria; - @XmlAttribute(name = "packets") - protected Integer packets; - @XmlAttribute(name = "size") - protected Integer size; - - /** - * Gets the value of the warningCriteria property. - * - * @return - * possible object is - * {@link PingCriteria } - * - */ - public PingCriteria getWarningCriteria() { - return warningCriteria; - } - - /** - * Sets the value of the warningCriteria property. - * - * @param value - * allowed object is - * {@link PingCriteria } - * - */ - public void setWarningCriteria(PingCriteria value) { - this.warningCriteria = value; - } - - /** - * Gets the value of the criticalCriteria property. - * - * @return - * possible object is - * {@link PingCriteria } - * - */ - public PingCriteria getCriticalCriteria() { - return criticalCriteria; - } - - /** - * Sets the value of the criticalCriteria property. - * - * @param value - * allowed object is - * {@link PingCriteria } - * - */ - public void setCriticalCriteria(PingCriteria value) { - this.criticalCriteria = value; - } - - /** - * Gets the value of the failCriteria property. - * - * @return - * possible object is - * {@link PingCriteria } - * - */ - public PingCriteria getFailCriteria() { - return failCriteria; - } - - /** - * Sets the value of the failCriteria property. - * - * @param value - * allowed object is - * {@link PingCriteria } - * - */ - public void setFailCriteria(PingCriteria value) { - this.failCriteria = value; - } - - /** - * Gets the value of the packets property. - * - * @return - * possible object is - * {@link Integer } - * - */ - public Integer getPackets() { - return packets; - } - - /** - * Sets the value of the packets property. - * - * @param value - * allowed object is - * {@link Integer } - * - */ - public void setPackets(Integer value) { - this.packets = value; - } - - /** - * Gets the value of the size property. - * - * @return - * possible object is - * {@link Integer } - * - */ - public Integer getSize() { - return size; - } - - /** - * Sets the value of the size property. - * - * @param value - * allowed object is - * {@link Integer } - * - */ - public void setSize(Integer value) { - this.size = value; - } - -} diff --git a/Plugins/Mineplex.BungeeRotator/src/com/neustar/ultraservice/schema/v01/PROXYProbeData.java b/Plugins/Mineplex.BungeeRotator/src/com/neustar/ultraservice/schema/v01/PROXYProbeData.java deleted file mode 100644 index b3b4fd77b..000000000 --- a/Plugins/Mineplex.BungeeRotator/src/com/neustar/ultraservice/schema/v01/PROXYProbeData.java +++ /dev/null @@ -1,573 +0,0 @@ - -package com.neustar.ultraservice.schema.v01; - -import javax.xml.bind.annotation.XmlAccessType; -import javax.xml.bind.annotation.XmlAccessorType; -import javax.xml.bind.annotation.XmlAttribute; -import javax.xml.bind.annotation.XmlType; - - -/** - *

Java class for PROXYProbeData complex type. - * - *

The following schema fragment specifies the expected content contained within this class. - * - *

- * <complexType name="PROXYProbeData">
- *   <complexContent>
- *     <restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
- *       <sequence>
- *       </sequence>
- *       <attribute name="proxyPort" type="{http://www.w3.org/2001/XMLSchema}string" />
- *       <attribute name="url" type="{http://www.w3.org/2001/XMLSchema}string" />
- *       <attribute name="totalRuntime" type="{http://www.w3.org/2001/XMLSchema}string" />
- *       <attribute name="connectTime" type="{http://www.w3.org/2001/XMLSchema}string" />
- *       <attribute name="runtime" type="{http://www.w3.org/2001/XMLSchema}string" />
- *       <attribute name="failTotalRuntime" type="{http://www.w3.org/2001/XMLSchema}string" />
- *       <attribute name="criticalTotalRuntime" type="{http://www.w3.org/2001/XMLSchema}string" />
- *       <attribute name="warningTotalRuntime" type="{http://www.w3.org/2001/XMLSchema}string" />
- *       <attribute name="failConnectTime" type="{http://www.w3.org/2001/XMLSchema}string" />
- *       <attribute name="criticalConnectTime" type="{http://www.w3.org/2001/XMLSchema}string" />
- *       <attribute name="warningConnectTime" type="{http://www.w3.org/2001/XMLSchema}string" />
- *       <attribute name="failRuntime" type="{http://www.w3.org/2001/XMLSchema}string" />
- *       <attribute name="criticalRuntime" type="{http://www.w3.org/2001/XMLSchema}string" />
- *       <attribute name="warningRuntime" type="{http://www.w3.org/2001/XMLSchema}string" />
- *       <attribute name="failAverageConnectTime" type="{http://www.w3.org/2001/XMLSchema}string" />
- *       <attribute name="criticalAverageConnectTime" type="{http://www.w3.org/2001/XMLSchema}string" />
- *       <attribute name="warningAverageConnectTime" type="{http://www.w3.org/2001/XMLSchema}string" />
- *       <attribute name="failAverageRunTime" type="{http://www.w3.org/2001/XMLSchema}string" />
- *       <attribute name="criticalAverageRunTime" type="{http://www.w3.org/2001/XMLSchema}string" />
- *       <attribute name="warningAverageRunTime" type="{http://www.w3.org/2001/XMLSchema}string" />
- *     </restriction>
- *   </complexContent>
- * </complexType>
- * 
- * - * - */ -@XmlAccessorType(XmlAccessType.FIELD) -@XmlType(name = "PROXYProbeData") -public class PROXYProbeData { - - @XmlAttribute(name = "proxyPort") - protected String proxyPort; - @XmlAttribute(name = "url") - protected String url; - @XmlAttribute(name = "totalRuntime") - protected String totalRuntime; - @XmlAttribute(name = "connectTime") - protected String connectTime; - @XmlAttribute(name = "runtime") - protected String runtime; - @XmlAttribute(name = "failTotalRuntime") - protected String failTotalRuntime; - @XmlAttribute(name = "criticalTotalRuntime") - protected String criticalTotalRuntime; - @XmlAttribute(name = "warningTotalRuntime") - protected String warningTotalRuntime; - @XmlAttribute(name = "failConnectTime") - protected String failConnectTime; - @XmlAttribute(name = "criticalConnectTime") - protected String criticalConnectTime; - @XmlAttribute(name = "warningConnectTime") - protected String warningConnectTime; - @XmlAttribute(name = "failRuntime") - protected String failRuntime; - @XmlAttribute(name = "criticalRuntime") - protected String criticalRuntime; - @XmlAttribute(name = "warningRuntime") - protected String warningRuntime; - @XmlAttribute(name = "failAverageConnectTime") - protected String failAverageConnectTime; - @XmlAttribute(name = "criticalAverageConnectTime") - protected String criticalAverageConnectTime; - @XmlAttribute(name = "warningAverageConnectTime") - protected String warningAverageConnectTime; - @XmlAttribute(name = "failAverageRunTime") - protected String failAverageRunTime; - @XmlAttribute(name = "criticalAverageRunTime") - protected String criticalAverageRunTime; - @XmlAttribute(name = "warningAverageRunTime") - protected String warningAverageRunTime; - - /** - * Gets the value of the proxyPort property. - * - * @return - * possible object is - * {@link String } - * - */ - public String getProxyPort() { - return proxyPort; - } - - /** - * Sets the value of the proxyPort property. - * - * @param value - * allowed object is - * {@link String } - * - */ - public void setProxyPort(String value) { - this.proxyPort = value; - } - - /** - * Gets the value of the url property. - * - * @return - * possible object is - * {@link String } - * - */ - public String getUrl() { - return url; - } - - /** - * Sets the value of the url property. - * - * @param value - * allowed object is - * {@link String } - * - */ - public void setUrl(String value) { - this.url = value; - } - - /** - * Gets the value of the totalRuntime property. - * - * @return - * possible object is - * {@link String } - * - */ - public String getTotalRuntime() { - return totalRuntime; - } - - /** - * Sets the value of the totalRuntime property. - * - * @param value - * allowed object is - * {@link String } - * - */ - public void setTotalRuntime(String value) { - this.totalRuntime = value; - } - - /** - * Gets the value of the connectTime property. - * - * @return - * possible object is - * {@link String } - * - */ - public String getConnectTime() { - return connectTime; - } - - /** - * Sets the value of the connectTime property. - * - * @param value - * allowed object is - * {@link String } - * - */ - public void setConnectTime(String value) { - this.connectTime = value; - } - - /** - * Gets the value of the runtime property. - * - * @return - * possible object is - * {@link String } - * - */ - public String getRuntime() { - return runtime; - } - - /** - * Sets the value of the runtime property. - * - * @param value - * allowed object is - * {@link String } - * - */ - public void setRuntime(String value) { - this.runtime = value; - } - - /** - * Gets the value of the failTotalRuntime property. - * - * @return - * possible object is - * {@link String } - * - */ - public String getFailTotalRuntime() { - return failTotalRuntime; - } - - /** - * Sets the value of the failTotalRuntime property. - * - * @param value - * allowed object is - * {@link String } - * - */ - public void setFailTotalRuntime(String value) { - this.failTotalRuntime = value; - } - - /** - * Gets the value of the criticalTotalRuntime property. - * - * @return - * possible object is - * {@link String } - * - */ - public String getCriticalTotalRuntime() { - return criticalTotalRuntime; - } - - /** - * Sets the value of the criticalTotalRuntime property. - * - * @param value - * allowed object is - * {@link String } - * - */ - public void setCriticalTotalRuntime(String value) { - this.criticalTotalRuntime = value; - } - - /** - * Gets the value of the warningTotalRuntime property. - * - * @return - * possible object is - * {@link String } - * - */ - public String getWarningTotalRuntime() { - return warningTotalRuntime; - } - - /** - * Sets the value of the warningTotalRuntime property. - * - * @param value - * allowed object is - * {@link String } - * - */ - public void setWarningTotalRuntime(String value) { - this.warningTotalRuntime = value; - } - - /** - * Gets the value of the failConnectTime property. - * - * @return - * possible object is - * {@link String } - * - */ - public String getFailConnectTime() { - return failConnectTime; - } - - /** - * Sets the value of the failConnectTime property. - * - * @param value - * allowed object is - * {@link String } - * - */ - public void setFailConnectTime(String value) { - this.failConnectTime = value; - } - - /** - * Gets the value of the criticalConnectTime property. - * - * @return - * possible object is - * {@link String } - * - */ - public String getCriticalConnectTime() { - return criticalConnectTime; - } - - /** - * Sets the value of the criticalConnectTime property. - * - * @param value - * allowed object is - * {@link String } - * - */ - public void setCriticalConnectTime(String value) { - this.criticalConnectTime = value; - } - - /** - * Gets the value of the warningConnectTime property. - * - * @return - * possible object is - * {@link String } - * - */ - public String getWarningConnectTime() { - return warningConnectTime; - } - - /** - * Sets the value of the warningConnectTime property. - * - * @param value - * allowed object is - * {@link String } - * - */ - public void setWarningConnectTime(String value) { - this.warningConnectTime = value; - } - - /** - * Gets the value of the failRuntime property. - * - * @return - * possible object is - * {@link String } - * - */ - public String getFailRuntime() { - return failRuntime; - } - - /** - * Sets the value of the failRuntime property. - * - * @param value - * allowed object is - * {@link String } - * - */ - public void setFailRuntime(String value) { - this.failRuntime = value; - } - - /** - * Gets the value of the criticalRuntime property. - * - * @return - * possible object is - * {@link String } - * - */ - public String getCriticalRuntime() { - return criticalRuntime; - } - - /** - * Sets the value of the criticalRuntime property. - * - * @param value - * allowed object is - * {@link String } - * - */ - public void setCriticalRuntime(String value) { - this.criticalRuntime = value; - } - - /** - * Gets the value of the warningRuntime property. - * - * @return - * possible object is - * {@link String } - * - */ - public String getWarningRuntime() { - return warningRuntime; - } - - /** - * Sets the value of the warningRuntime property. - * - * @param value - * allowed object is - * {@link String } - * - */ - public void setWarningRuntime(String value) { - this.warningRuntime = value; - } - - /** - * Gets the value of the failAverageConnectTime property. - * - * @return - * possible object is - * {@link String } - * - */ - public String getFailAverageConnectTime() { - return failAverageConnectTime; - } - - /** - * Sets the value of the failAverageConnectTime property. - * - * @param value - * allowed object is - * {@link String } - * - */ - public void setFailAverageConnectTime(String value) { - this.failAverageConnectTime = value; - } - - /** - * Gets the value of the criticalAverageConnectTime property. - * - * @return - * possible object is - * {@link String } - * - */ - public String getCriticalAverageConnectTime() { - return criticalAverageConnectTime; - } - - /** - * Sets the value of the criticalAverageConnectTime property. - * - * @param value - * allowed object is - * {@link String } - * - */ - public void setCriticalAverageConnectTime(String value) { - this.criticalAverageConnectTime = value; - } - - /** - * Gets the value of the warningAverageConnectTime property. - * - * @return - * possible object is - * {@link String } - * - */ - public String getWarningAverageConnectTime() { - return warningAverageConnectTime; - } - - /** - * Sets the value of the warningAverageConnectTime property. - * - * @param value - * allowed object is - * {@link String } - * - */ - public void setWarningAverageConnectTime(String value) { - this.warningAverageConnectTime = value; - } - - /** - * Gets the value of the failAverageRunTime property. - * - * @return - * possible object is - * {@link String } - * - */ - public String getFailAverageRunTime() { - return failAverageRunTime; - } - - /** - * Sets the value of the failAverageRunTime property. - * - * @param value - * allowed object is - * {@link String } - * - */ - public void setFailAverageRunTime(String value) { - this.failAverageRunTime = value; - } - - /** - * Gets the value of the criticalAverageRunTime property. - * - * @return - * possible object is - * {@link String } - * - */ - public String getCriticalAverageRunTime() { - return criticalAverageRunTime; - } - - /** - * Sets the value of the criticalAverageRunTime property. - * - * @param value - * allowed object is - * {@link String } - * - */ - public void setCriticalAverageRunTime(String value) { - this.criticalAverageRunTime = value; - } - - /** - * Gets the value of the warningAverageRunTime property. - * - * @return - * possible object is - * {@link String } - * - */ - public String getWarningAverageRunTime() { - return warningAverageRunTime; - } - - /** - * Sets the value of the warningAverageRunTime property. - * - * @param value - * allowed object is - * {@link String } - * - */ - public void setWarningAverageRunTime(String value) { - this.warningAverageRunTime = value; - } - -} diff --git a/Plugins/Mineplex.BungeeRotator/src/com/neustar/ultraservice/schema/v01/PasswordExpirationPreference.java b/Plugins/Mineplex.BungeeRotator/src/com/neustar/ultraservice/schema/v01/PasswordExpirationPreference.java deleted file mode 100644 index 598132220..000000000 --- a/Plugins/Mineplex.BungeeRotator/src/com/neustar/ultraservice/schema/v01/PasswordExpirationPreference.java +++ /dev/null @@ -1,60 +0,0 @@ - -package com.neustar.ultraservice.schema.v01; - -import javax.xml.bind.annotation.XmlAccessType; -import javax.xml.bind.annotation.XmlAccessorType; -import javax.xml.bind.annotation.XmlAttribute; -import javax.xml.bind.annotation.XmlType; - - -/** - *

Java class for PasswordExpirationPreference complex type. - * - *

The following schema fragment specifies the expected content contained within this class. - * - *

- * <complexType name="PasswordExpirationPreference">
- *   <complexContent>
- *     <restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
- *       <sequence>
- *       </sequence>
- *       <attribute name="PasswordExpiration" type="{http://www.w3.org/2001/XMLSchema}string" />
- *     </restriction>
- *   </complexContent>
- * </complexType>
- * 
- * - * - */ -@XmlAccessorType(XmlAccessType.FIELD) -@XmlType(name = "PasswordExpirationPreference") -public class PasswordExpirationPreference { - - @XmlAttribute(name = "PasswordExpiration") - protected String passwordExpiration; - - /** - * Gets the value of the passwordExpiration property. - * - * @return - * possible object is - * {@link String } - * - */ - public String getPasswordExpiration() { - return passwordExpiration; - } - - /** - * Sets the value of the passwordExpiration property. - * - * @param value - * allowed object is - * {@link String } - * - */ - public void setPasswordExpiration(String value) { - this.passwordExpiration = value; - } - -} diff --git a/Plugins/Mineplex.BungeeRotator/src/com/neustar/ultraservice/schema/v01/PasswordVerificationInfo.java b/Plugins/Mineplex.BungeeRotator/src/com/neustar/ultraservice/schema/v01/PasswordVerificationInfo.java deleted file mode 100644 index 571534ad7..000000000 --- a/Plugins/Mineplex.BungeeRotator/src/com/neustar/ultraservice/schema/v01/PasswordVerificationInfo.java +++ /dev/null @@ -1,106 +0,0 @@ - -package com.neustar.ultraservice.schema.v01; - -import javax.xml.bind.annotation.XmlAccessType; -import javax.xml.bind.annotation.XmlAccessorType; -import javax.xml.bind.annotation.XmlAttribute; -import javax.xml.bind.annotation.XmlType; - - -/** - *

Java class for PasswordVerificationInfo complex type. - * - *

The following schema fragment specifies the expected content contained within this class. - * - *

- * <complexType name="PasswordVerificationInfo">
- *   <complexContent>
- *     <restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
- *       <sequence>
- *       </sequence>
- *       <attribute name="QuestionId" use="required" type="{http://www.w3.org/2001/XMLSchema}long" />
- *       <attribute name="Question" use="required" type="{http://www.w3.org/2001/XMLSchema}string" />
- *       <attribute name="Answer" use="required" type="{http://www.w3.org/2001/XMLSchema}string" />
- *     </restriction>
- *   </complexContent>
- * </complexType>
- * 
- * - * - */ -@XmlAccessorType(XmlAccessType.FIELD) -@XmlType(name = "PasswordVerificationInfo") -public class PasswordVerificationInfo { - - @XmlAttribute(name = "QuestionId", required = true) - protected long questionId; - @XmlAttribute(name = "Question", required = true) - protected String question; - @XmlAttribute(name = "Answer", required = true) - protected String answer; - - /** - * Gets the value of the questionId property. - * - */ - public long getQuestionId() { - return questionId; - } - - /** - * Sets the value of the questionId property. - * - */ - public void setQuestionId(long value) { - this.questionId = value; - } - - /** - * Gets the value of the question property. - * - * @return - * possible object is - * {@link String } - * - */ - public String getQuestion() { - return question; - } - - /** - * Sets the value of the question property. - * - * @param value - * allowed object is - * {@link String } - * - */ - public void setQuestion(String value) { - this.question = value; - } - - /** - * Gets the value of the answer property. - * - * @return - * possible object is - * {@link String } - * - */ - public String getAnswer() { - return answer; - } - - /** - * Sets the value of the answer property. - * - * @param value - * allowed object is - * {@link String } - * - */ - public void setAnswer(String value) { - this.answer = value; - } - -} diff --git a/Plugins/Mineplex.BungeeRotator/src/com/neustar/ultraservice/schema/v01/PasswordVerificationQuestion.java b/Plugins/Mineplex.BungeeRotator/src/com/neustar/ultraservice/schema/v01/PasswordVerificationQuestion.java deleted file mode 100644 index 7d32df976..000000000 --- a/Plugins/Mineplex.BungeeRotator/src/com/neustar/ultraservice/schema/v01/PasswordVerificationQuestion.java +++ /dev/null @@ -1,114 +0,0 @@ - -package com.neustar.ultraservice.schema.v01; - -import javax.xml.bind.annotation.XmlAccessType; -import javax.xml.bind.annotation.XmlAccessorType; -import javax.xml.bind.annotation.XmlAttribute; -import javax.xml.bind.annotation.XmlType; - - -/** - *

Java class for PasswordVerificationQuestion complex type. - * - *

The following schema fragment specifies the expected content contained within this class. - * - *

- * <complexType name="PasswordVerificationQuestion">
- *   <complexContent>
- *     <restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
- *       <sequence>
- *       </sequence>
- *       <attribute name="answer" use="required" type="{http://www.w3.org/2001/XMLSchema}string" />
- *       <attribute name="question" use="required" type="{http://www.w3.org/2001/XMLSchema}string" />
- *       <attribute name="questionId" use="required" type="{http://www.w3.org/2001/XMLSchema}string" />
- *     </restriction>
- *   </complexContent>
- * </complexType>
- * 
- * - * - */ -@XmlAccessorType(XmlAccessType.FIELD) -@XmlType(name = "PasswordVerificationQuestion") -public class PasswordVerificationQuestion { - - @XmlAttribute(name = "answer", required = true) - protected String answer; - @XmlAttribute(name = "question", required = true) - protected String question; - @XmlAttribute(name = "questionId", required = true) - protected String questionId; - - /** - * Gets the value of the answer property. - * - * @return - * possible object is - * {@link String } - * - */ - public String getAnswer() { - return answer; - } - - /** - * Sets the value of the answer property. - * - * @param value - * allowed object is - * {@link String } - * - */ - public void setAnswer(String value) { - this.answer = value; - } - - /** - * Gets the value of the question property. - * - * @return - * possible object is - * {@link String } - * - */ - public String getQuestion() { - return question; - } - - /** - * Sets the value of the question property. - * - * @param value - * allowed object is - * {@link String } - * - */ - public void setQuestion(String value) { - this.question = value; - } - - /** - * Gets the value of the questionId property. - * - * @return - * possible object is - * {@link String } - * - */ - public String getQuestionId() { - return questionId; - } - - /** - * Sets the value of the questionId property. - * - * @param value - * allowed object is - * {@link String } - * - */ - public void setQuestionId(String value) { - this.questionId = value; - } - -} diff --git a/Plugins/Mineplex.BungeeRotator/src/com/neustar/ultraservice/schema/v01/PasswordVerificationQuestionList.java b/Plugins/Mineplex.BungeeRotator/src/com/neustar/ultraservice/schema/v01/PasswordVerificationQuestionList.java deleted file mode 100644 index 43a5a3a18..000000000 --- a/Plugins/Mineplex.BungeeRotator/src/com/neustar/ultraservice/schema/v01/PasswordVerificationQuestionList.java +++ /dev/null @@ -1,69 +0,0 @@ - -package com.neustar.ultraservice.schema.v01; - -import java.util.ArrayList; -import java.util.List; -import javax.xml.bind.annotation.XmlAccessType; -import javax.xml.bind.annotation.XmlAccessorType; -import javax.xml.bind.annotation.XmlElement; -import javax.xml.bind.annotation.XmlType; - - -/** - *

Java class for PasswordVerificationQuestionList complex type. - * - *

The following schema fragment specifies the expected content contained within this class. - * - *

- * <complexType name="PasswordVerificationQuestionList">
- *   <complexContent>
- *     <restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
- *       <sequence>
- *         <element name="PasswordVerificationQuestion" type="{http://schema.ultraservice.neustar.com/v01/}PasswordVerificationQuestion" maxOccurs="unbounded"/>
- *       </sequence>
- *     </restriction>
- *   </complexContent>
- * </complexType>
- * 
- * - * - */ -@XmlAccessorType(XmlAccessType.FIELD) -@XmlType(name = "PasswordVerificationQuestionList", propOrder = { - "passwordVerificationQuestion" -}) -public class PasswordVerificationQuestionList { - - @XmlElement(name = "PasswordVerificationQuestion", required = true) - protected List passwordVerificationQuestion; - - /** - * Gets the value of the passwordVerificationQuestion property. - * - *

- * This accessor method returns a reference to the live list, - * not a snapshot. Therefore any modification you make to the - * returned list will be present inside the JAXB object. - * This is why there is not a set method for the passwordVerificationQuestion property. - * - *

- * For example, to add a new item, do as follows: - *

-     *    getPasswordVerificationQuestion().add(newItem);
-     * 
- * - * - *

- * Objects of the following type(s) are allowed in the list - * {@link PasswordVerificationQuestion } - * - * - */ - public List getPasswordVerificationQuestion() { - if (passwordVerificationQuestion == null) { - passwordVerificationQuestion = new ArrayList(); - } - return this.passwordVerificationQuestion; - } - -} diff --git a/Plugins/Mineplex.BungeeRotator/src/com/neustar/ultraservice/schema/v01/PingCriteria.java b/Plugins/Mineplex.BungeeRotator/src/com/neustar/ultraservice/schema/v01/PingCriteria.java deleted file mode 100644 index d1e652c0f..000000000 --- a/Plugins/Mineplex.BungeeRotator/src/com/neustar/ultraservice/schema/v01/PingCriteria.java +++ /dev/null @@ -1,168 +0,0 @@ - -package com.neustar.ultraservice.schema.v01; - -import javax.xml.bind.annotation.XmlAccessType; -import javax.xml.bind.annotation.XmlAccessorType; -import javax.xml.bind.annotation.XmlType; - - -/** - *

Java class for PingCriteria complex type. - * - *

The following schema fragment specifies the expected content contained within this class. - * - *

- * <complexType name="PingCriteria">
- *   <complexContent>
- *     <restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
- *       <sequence>
- *         <element name="runTime" type="{http://www.w3.org/2001/XMLSchema}int" minOccurs="0"/>
- *         <element name="runTimeAverage" type="{http://www.w3.org/2001/XMLSchema}int" minOccurs="0"/>
- *         <element name="connectTime" type="{http://www.w3.org/2001/XMLSchema}int" minOccurs="0"/>
- *         <element name="connectTimeAverage" type="{http://www.w3.org/2001/XMLSchema}int" minOccurs="0"/>
- *         <element name="percentLost" type="{http://www.w3.org/2001/XMLSchema}int" minOccurs="0"/>
- *       </sequence>
- *     </restriction>
- *   </complexContent>
- * </complexType>
- * 
- * - * - */ -@XmlAccessorType(XmlAccessType.FIELD) -@XmlType(name = "PingCriteria", propOrder = { - "runTime", - "runTimeAverage", - "connectTime", - "connectTimeAverage", - "percentLost" -}) -public class PingCriteria { - - protected Integer runTime; - protected Integer runTimeAverage; - protected Integer connectTime; - protected Integer connectTimeAverage; - protected Integer percentLost; - - /** - * Gets the value of the runTime property. - * - * @return - * possible object is - * {@link Integer } - * - */ - public Integer getRunTime() { - return runTime; - } - - /** - * Sets the value of the runTime property. - * - * @param value - * allowed object is - * {@link Integer } - * - */ - public void setRunTime(Integer value) { - this.runTime = value; - } - - /** - * Gets the value of the runTimeAverage property. - * - * @return - * possible object is - * {@link Integer } - * - */ - public Integer getRunTimeAverage() { - return runTimeAverage; - } - - /** - * Sets the value of the runTimeAverage property. - * - * @param value - * allowed object is - * {@link Integer } - * - */ - public void setRunTimeAverage(Integer value) { - this.runTimeAverage = value; - } - - /** - * Gets the value of the connectTime property. - * - * @return - * possible object is - * {@link Integer } - * - */ - public Integer getConnectTime() { - return connectTime; - } - - /** - * Sets the value of the connectTime property. - * - * @param value - * allowed object is - * {@link Integer } - * - */ - public void setConnectTime(Integer value) { - this.connectTime = value; - } - - /** - * Gets the value of the connectTimeAverage property. - * - * @return - * possible object is - * {@link Integer } - * - */ - public Integer getConnectTimeAverage() { - return connectTimeAverage; - } - - /** - * Sets the value of the connectTimeAverage property. - * - * @param value - * allowed object is - * {@link Integer } - * - */ - public void setConnectTimeAverage(Integer value) { - this.connectTimeAverage = value; - } - - /** - * Gets the value of the percentLost property. - * - * @return - * possible object is - * {@link Integer } - * - */ - public Integer getPercentLost() { - return percentLost; - } - - /** - * Sets the value of the percentLost property. - * - * @param value - * allowed object is - * {@link Integer } - * - */ - public void setPercentLost(Integer value) { - this.percentLost = value; - } - -} diff --git a/Plugins/Mineplex.BungeeRotator/src/com/neustar/ultraservice/schema/v01/Pool.java b/Plugins/Mineplex.BungeeRotator/src/com/neustar/ultraservice/schema/v01/Pool.java deleted file mode 100644 index e85012e02..000000000 --- a/Plugins/Mineplex.BungeeRotator/src/com/neustar/ultraservice/schema/v01/Pool.java +++ /dev/null @@ -1,145 +0,0 @@ - -package com.neustar.ultraservice.schema.v01; - -import javax.xml.bind.annotation.XmlAccessType; -import javax.xml.bind.annotation.XmlAccessorType; -import javax.xml.bind.annotation.XmlElement; -import javax.xml.bind.annotation.XmlType; - - -/** - *

Java class for Pool complex type. - * - *

The following schema fragment specifies the expected content contained within this class. - * - *

- * <complexType name="Pool">
- *   <complexContent>
- *     <restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
- *       <sequence>
- *         <element name="zoneName" type="{http://www.w3.org/2001/XMLSchema}string"/>
- *         <element name="poolName" type="{http://www.w3.org/2001/XMLSchema}string"/>
- *         <element name="description" type="{http://www.w3.org/2001/XMLSchema}string" minOccurs="0"/>
- *         <element name="poolRecordType" type="{http://schema.ultraservice.neustar.com/v01/}PoolRecordType"/>
- *       </sequence>
- *     </restriction>
- *   </complexContent>
- * </complexType>
- * 
- * - * - */ -@XmlAccessorType(XmlAccessType.FIELD) -@XmlType(name = "Pool", propOrder = { - "zoneName", - "poolName", - "description", - "poolRecordType" -}) -public class Pool { - - @XmlElement(required = true) - protected String zoneName; - @XmlElement(required = true) - protected String poolName; - protected String description; - @XmlElement(required = true) - protected PoolRecordType poolRecordType; - - /** - * Gets the value of the zoneName property. - * - * @return - * possible object is - * {@link String } - * - */ - public String getZoneName() { - return zoneName; - } - - /** - * Sets the value of the zoneName property. - * - * @param value - * allowed object is - * {@link String } - * - */ - public void setZoneName(String value) { - this.zoneName = value; - } - - /** - * Gets the value of the poolName property. - * - * @return - * possible object is - * {@link String } - * - */ - public String getPoolName() { - return poolName; - } - - /** - * Sets the value of the poolName property. - * - * @param value - * allowed object is - * {@link String } - * - */ - public void setPoolName(String value) { - this.poolName = value; - } - - /** - * Gets the value of the description property. - * - * @return - * possible object is - * {@link String } - * - */ - public String getDescription() { - return description; - } - - /** - * Sets the value of the description property. - * - * @param value - * allowed object is - * {@link String } - * - */ - public void setDescription(String value) { - this.description = value; - } - - /** - * Gets the value of the poolRecordType property. - * - * @return - * possible object is - * {@link PoolRecordType } - * - */ - public PoolRecordType getPoolRecordType() { - return poolRecordType; - } - - /** - * Sets the value of the poolRecordType property. - * - * @param value - * allowed object is - * {@link PoolRecordType } - * - */ - public void setPoolRecordType(PoolRecordType value) { - this.poolRecordType = value; - } - -} diff --git a/Plugins/Mineplex.BungeeRotator/src/com/neustar/ultraservice/schema/v01/PoolAlertDetails.java b/Plugins/Mineplex.BungeeRotator/src/com/neustar/ultraservice/schema/v01/PoolAlertDetails.java deleted file mode 100644 index d0d21fa96..000000000 --- a/Plugins/Mineplex.BungeeRotator/src/com/neustar/ultraservice/schema/v01/PoolAlertDetails.java +++ /dev/null @@ -1,202 +0,0 @@ - -package com.neustar.ultraservice.schema.v01; - -import javax.xml.bind.annotation.XmlAccessType; -import javax.xml.bind.annotation.XmlAccessorType; -import javax.xml.bind.annotation.XmlElement; -import javax.xml.bind.annotation.XmlType; - - -/** - *

Java class for PoolAlertDetails complex type. - * - *

The following schema fragment specifies the expected content contained within this class. - * - *

- * <complexType name="PoolAlertDetails">
- *   <complexContent>
- *     <restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
- *       <sequence>
- *         <element name="alertTime" type="{http://www.w3.org/2001/XMLSchema}string"/>
- *         <element name="pool" type="{http://schema.ultraservice.neustar.com/v01/}AlertPoolDetails"/>
- *         <element name="poolRecord" type="{http://schema.ultraservice.neustar.com/v01/}AlertRecord"/>
- *         <element name="probeDetails" type="{http://schema.ultraservice.neustar.com/v01/}AlertProbeDetails"/>
- *         <element name="ruleTransitionDetails" type="{http://schema.ultraservice.neustar.com/v01/}ARAlertRuleDetails"/>
- *         <element name="stateTransitionDetails" type="{http://schema.ultraservice.neustar.com/v01/}ARAlertStateDetails"/>
- *       </sequence>
- *     </restriction>
- *   </complexContent>
- * </complexType>
- * 
- * - * - */ -@XmlAccessorType(XmlAccessType.FIELD) -@XmlType(name = "PoolAlertDetails", propOrder = { - "alertTime", - "pool", - "poolRecord", - "probeDetails", - "ruleTransitionDetails", - "stateTransitionDetails" -}) -public class PoolAlertDetails { - - @XmlElement(required = true) - protected String alertTime; - @XmlElement(required = true) - protected AlertPoolDetails pool; - @XmlElement(required = true) - protected AlertRecord poolRecord; - @XmlElement(required = true) - protected AlertProbeDetails probeDetails; - @XmlElement(required = true) - protected ARAlertRuleDetails ruleTransitionDetails; - @XmlElement(required = true) - protected ARAlertStateDetails stateTransitionDetails; - - /** - * Gets the value of the alertTime property. - * - * @return - * possible object is - * {@link String } - * - */ - public String getAlertTime() { - return alertTime; - } - - /** - * Sets the value of the alertTime property. - * - * @param value - * allowed object is - * {@link String } - * - */ - public void setAlertTime(String value) { - this.alertTime = value; - } - - /** - * Gets the value of the pool property. - * - * @return - * possible object is - * {@link AlertPoolDetails } - * - */ - public AlertPoolDetails getPool() { - return pool; - } - - /** - * Sets the value of the pool property. - * - * @param value - * allowed object is - * {@link AlertPoolDetails } - * - */ - public void setPool(AlertPoolDetails value) { - this.pool = value; - } - - /** - * Gets the value of the poolRecord property. - * - * @return - * possible object is - * {@link AlertRecord } - * - */ - public AlertRecord getPoolRecord() { - return poolRecord; - } - - /** - * Sets the value of the poolRecord property. - * - * @param value - * allowed object is - * {@link AlertRecord } - * - */ - public void setPoolRecord(AlertRecord value) { - this.poolRecord = value; - } - - /** - * Gets the value of the probeDetails property. - * - * @return - * possible object is - * {@link AlertProbeDetails } - * - */ - public AlertProbeDetails getProbeDetails() { - return probeDetails; - } - - /** - * Sets the value of the probeDetails property. - * - * @param value - * allowed object is - * {@link AlertProbeDetails } - * - */ - public void setProbeDetails(AlertProbeDetails value) { - this.probeDetails = value; - } - - /** - * Gets the value of the ruleTransitionDetails property. - * - * @return - * possible object is - * {@link ARAlertRuleDetails } - * - */ - public ARAlertRuleDetails getRuleTransitionDetails() { - return ruleTransitionDetails; - } - - /** - * Sets the value of the ruleTransitionDetails property. - * - * @param value - * allowed object is - * {@link ARAlertRuleDetails } - * - */ - public void setRuleTransitionDetails(ARAlertRuleDetails value) { - this.ruleTransitionDetails = value; - } - - /** - * Gets the value of the stateTransitionDetails property. - * - * @return - * possible object is - * {@link ARAlertStateDetails } - * - */ - public ARAlertStateDetails getStateTransitionDetails() { - return stateTransitionDetails; - } - - /** - * Sets the value of the stateTransitionDetails property. - * - * @param value - * allowed object is - * {@link ARAlertStateDetails } - * - */ - public void setStateTransitionDetails(ARAlertStateDetails value) { - this.stateTransitionDetails = value; - } - -} diff --git a/Plugins/Mineplex.BungeeRotator/src/com/neustar/ultraservice/schema/v01/PoolAlertsListParams.java b/Plugins/Mineplex.BungeeRotator/src/com/neustar/ultraservice/schema/v01/PoolAlertsListParams.java deleted file mode 100644 index 3a2fb643c..000000000 --- a/Plugins/Mineplex.BungeeRotator/src/com/neustar/ultraservice/schema/v01/PoolAlertsListParams.java +++ /dev/null @@ -1,87 +0,0 @@ - -package com.neustar.ultraservice.schema.v01; - -import javax.xml.bind.annotation.XmlAccessType; -import javax.xml.bind.annotation.XmlAccessorType; -import javax.xml.bind.annotation.XmlType; - - -/** - *

Java class for PoolAlertsListParams complex type. - * - *

The following schema fragment specifies the expected content contained within this class. - * - *

- * <complexType name="PoolAlertsListParams">
- *   <complexContent>
- *     <restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
- *       <sequence>
- *         <element name="offset" type="{http://www.w3.org/2001/XMLSchema}int" minOccurs="0"/>
- *         <element name="limit" type="{http://www.w3.org/2001/XMLSchema}int" minOccurs="0"/>
- *       </sequence>
- *     </restriction>
- *   </complexContent>
- * </complexType>
- * 
- * - * - */ -@XmlAccessorType(XmlAccessType.FIELD) -@XmlType(name = "PoolAlertsListParams", propOrder = { - "offset", - "limit" -}) -public class PoolAlertsListParams { - - protected Integer offset; - protected Integer limit; - - /** - * Gets the value of the offset property. - * - * @return - * possible object is - * {@link Integer } - * - */ - public Integer getOffset() { - return offset; - } - - /** - * Sets the value of the offset property. - * - * @param value - * allowed object is - * {@link Integer } - * - */ - public void setOffset(Integer value) { - this.offset = value; - } - - /** - * Gets the value of the limit property. - * - * @return - * possible object is - * {@link Integer } - * - */ - public Integer getLimit() { - return limit; - } - - /** - * Sets the value of the limit property. - * - * @param value - * allowed object is - * {@link Integer } - * - */ - public void setLimit(Integer value) { - this.limit = value; - } - -} diff --git a/Plugins/Mineplex.BungeeRotator/src/com/neustar/ultraservice/schema/v01/PoolConfiguration.java b/Plugins/Mineplex.BungeeRotator/src/com/neustar/ultraservice/schema/v01/PoolConfiguration.java deleted file mode 100644 index d9f271910..000000000 --- a/Plugins/Mineplex.BungeeRotator/src/com/neustar/ultraservice/schema/v01/PoolConfiguration.java +++ /dev/null @@ -1,296 +0,0 @@ - -package com.neustar.ultraservice.schema.v01; - -import javax.xml.bind.annotation.XmlAccessType; -import javax.xml.bind.annotation.XmlAccessorType; -import javax.xml.bind.annotation.XmlElement; -import javax.xml.bind.annotation.XmlType; - - -/** - *

Java class for PoolConfiguration complex type. - * - *

The following schema fragment specifies the expected content contained within this class. - * - *

- * <complexType name="PoolConfiguration">
- *   <complexContent>
- *     <restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
- *       <sequence>
- *         <element name="name" type="{http://www.w3.org/2001/XMLSchema}string"/>
- *         <element name="failoverEnabled" type="{http://www.w3.org/2001/XMLSchema}boolean"/>
- *         <element name="probingEnabled" type="{http://www.w3.org/2001/XMLSchema}boolean"/>
- *         <element name="responseMethod" type="{http://schema.ultraservice.neustar.com/v01/}ResponseMethod"/>
- *         <element name="maxActive" type="{http://www.w3.org/2001/XMLSchema}long"/>
- *         <element name="maxResponse" type="{http://www.w3.org/2001/XMLSchema}long"/>
- *         <element name="effectiveMaxResponse" type="{http://www.w3.org/2001/XMLSchema}long"/>
- *         <element name="probesShared" type="{http://www.w3.org/2001/XMLSchema}boolean"/>
- *         <element name="rulesShared" type="{http://www.w3.org/2001/XMLSchema}boolean"/>
- *         <element name="ttl" type="{http://www.w3.org/2001/XMLSchema}long"/>
- *         <element name="description" type="{http://www.w3.org/2001/XMLSchema}string" minOccurs="0"/>
- *         <element name="prioritizedRecords" type="{http://schema.ultraservice.neustar.com/v01/}PrioritizedRecordList" minOccurs="0"/>
- *       </sequence>
- *     </restriction>
- *   </complexContent>
- * </complexType>
- * 
- * - * - */ -@XmlAccessorType(XmlAccessType.FIELD) -@XmlType(name = "PoolConfiguration", propOrder = { - "name", - "failoverEnabled", - "probingEnabled", - "responseMethod", - "maxActive", - "maxResponse", - "effectiveMaxResponse", - "probesShared", - "rulesShared", - "ttl", - "description", - "prioritizedRecords" -}) -public class PoolConfiguration { - - @XmlElement(required = true) - protected String name; - protected boolean failoverEnabled; - protected boolean probingEnabled; - @XmlElement(required = true) - protected ResponseMethod responseMethod; - protected long maxActive; - protected long maxResponse; - protected long effectiveMaxResponse; - protected boolean probesShared; - protected boolean rulesShared; - protected long ttl; - protected String description; - protected PrioritizedRecordList prioritizedRecords; - - /** - * Gets the value of the name property. - * - * @return - * possible object is - * {@link String } - * - */ - public String getName() { - return name; - } - - /** - * Sets the value of the name property. - * - * @param value - * allowed object is - * {@link String } - * - */ - public void setName(String value) { - this.name = value; - } - - /** - * Gets the value of the failoverEnabled property. - * - */ - public boolean isFailoverEnabled() { - return failoverEnabled; - } - - /** - * Sets the value of the failoverEnabled property. - * - */ - public void setFailoverEnabled(boolean value) { - this.failoverEnabled = value; - } - - /** - * Gets the value of the probingEnabled property. - * - */ - public boolean isProbingEnabled() { - return probingEnabled; - } - - /** - * Sets the value of the probingEnabled property. - * - */ - public void setProbingEnabled(boolean value) { - this.probingEnabled = value; - } - - /** - * Gets the value of the responseMethod property. - * - * @return - * possible object is - * {@link ResponseMethod } - * - */ - public ResponseMethod getResponseMethod() { - return responseMethod; - } - - /** - * Sets the value of the responseMethod property. - * - * @param value - * allowed object is - * {@link ResponseMethod } - * - */ - public void setResponseMethod(ResponseMethod value) { - this.responseMethod = value; - } - - /** - * Gets the value of the maxActive property. - * - */ - public long getMaxActive() { - return maxActive; - } - - /** - * Sets the value of the maxActive property. - * - */ - public void setMaxActive(long value) { - this.maxActive = value; - } - - /** - * Gets the value of the maxResponse property. - * - */ - public long getMaxResponse() { - return maxResponse; - } - - /** - * Sets the value of the maxResponse property. - * - */ - public void setMaxResponse(long value) { - this.maxResponse = value; - } - - /** - * Gets the value of the effectiveMaxResponse property. - * - */ - public long getEffectiveMaxResponse() { - return effectiveMaxResponse; - } - - /** - * Sets the value of the effectiveMaxResponse property. - * - */ - public void setEffectiveMaxResponse(long value) { - this.effectiveMaxResponse = value; - } - - /** - * Gets the value of the probesShared property. - * - */ - public boolean isProbesShared() { - return probesShared; - } - - /** - * Sets the value of the probesShared property. - * - */ - public void setProbesShared(boolean value) { - this.probesShared = value; - } - - /** - * Gets the value of the rulesShared property. - * - */ - public boolean isRulesShared() { - return rulesShared; - } - - /** - * Sets the value of the rulesShared property. - * - */ - public void setRulesShared(boolean value) { - this.rulesShared = value; - } - - /** - * Gets the value of the ttl property. - * - */ - public long getTtl() { - return ttl; - } - - /** - * Sets the value of the ttl property. - * - */ - public void setTtl(long value) { - this.ttl = value; - } - - /** - * Gets the value of the description property. - * - * @return - * possible object is - * {@link String } - * - */ - public String getDescription() { - return description; - } - - /** - * Sets the value of the description property. - * - * @param value - * allowed object is - * {@link String } - * - */ - public void setDescription(String value) { - this.description = value; - } - - /** - * Gets the value of the prioritizedRecords property. - * - * @return - * possible object is - * {@link PrioritizedRecordList } - * - */ - public PrioritizedRecordList getPrioritizedRecords() { - return prioritizedRecords; - } - - /** - * Sets the value of the prioritizedRecords property. - * - * @param value - * allowed object is - * {@link PrioritizedRecordList } - * - */ - public void setPrioritizedRecords(PrioritizedRecordList value) { - this.prioritizedRecords = value; - } - -} diff --git a/Plugins/Mineplex.BungeeRotator/src/com/neustar/ultraservice/schema/v01/PoolConfigurationDetails.java b/Plugins/Mineplex.BungeeRotator/src/com/neustar/ultraservice/schema/v01/PoolConfigurationDetails.java deleted file mode 100644 index 5f218e25c..000000000 --- a/Plugins/Mineplex.BungeeRotator/src/com/neustar/ultraservice/schema/v01/PoolConfigurationDetails.java +++ /dev/null @@ -1,169 +0,0 @@ - -package com.neustar.ultraservice.schema.v01; - -import java.util.ArrayList; -import java.util.List; -import javax.xml.bind.annotation.XmlAccessType; -import javax.xml.bind.annotation.XmlAccessorType; -import javax.xml.bind.annotation.XmlAttribute; -import javax.xml.bind.annotation.XmlElement; -import javax.xml.bind.annotation.XmlType; - - -/** - *

Java class for PoolConfigurationDetails complex type. - * - *

The following schema fragment specifies the expected content contained within this class. - * - *

- * <complexType name="PoolConfigurationDetails">
- *   <complexContent>
- *     <restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
- *       <sequence>
- *         <element name="PoolConfiguration" type="{http://schema.ultraservice.neustar.com/v01/}PoolConfiguration"/>
- *         <element name="PoolRecord" type="{http://schema.ultraservice.neustar.com/v01/}PoolRecord" maxOccurs="unbounded" minOccurs="0"/>
- *         <element name="Probe" type="{http://schema.ultraservice.neustar.com/v01/}Probe" maxOccurs="unbounded" minOccurs="0"/>
- *       </sequence>
- *       <attribute name="isActive" use="required" type="{http://www.w3.org/2001/XMLSchema}boolean" />
- *       <attribute name="maxActive" use="required" type="{http://www.w3.org/2001/XMLSchema}int" />
- *     </restriction>
- *   </complexContent>
- * </complexType>
- * 
- * - * - */ -@XmlAccessorType(XmlAccessType.FIELD) -@XmlType(name = "PoolConfigurationDetails", propOrder = { - "poolConfiguration", - "poolRecord", - "probe" -}) -public class PoolConfigurationDetails { - - @XmlElement(name = "PoolConfiguration", required = true) - protected PoolConfiguration poolConfiguration; - @XmlElement(name = "PoolRecord", nillable = true) - protected List poolRecord; - @XmlElement(name = "Probe", nillable = true) - protected List probe; - @XmlAttribute(name = "isActive", required = true) - protected boolean isActive; - @XmlAttribute(name = "maxActive", required = true) - protected int maxActive; - - /** - * Gets the value of the poolConfiguration property. - * - * @return - * possible object is - * {@link PoolConfiguration } - * - */ - public PoolConfiguration getPoolConfiguration() { - return poolConfiguration; - } - - /** - * Sets the value of the poolConfiguration property. - * - * @param value - * allowed object is - * {@link PoolConfiguration } - * - */ - public void setPoolConfiguration(PoolConfiguration value) { - this.poolConfiguration = value; - } - - /** - * Gets the value of the poolRecord property. - * - *

- * This accessor method returns a reference to the live list, - * not a snapshot. Therefore any modification you make to the - * returned list will be present inside the JAXB object. - * This is why there is not a set method for the poolRecord property. - * - *

- * For example, to add a new item, do as follows: - *

-     *    getPoolRecord().add(newItem);
-     * 
- * - * - *

- * Objects of the following type(s) are allowed in the list - * {@link PoolRecord } - * - * - */ - public List getPoolRecord() { - if (poolRecord == null) { - poolRecord = new ArrayList(); - } - return this.poolRecord; - } - - /** - * Gets the value of the probe property. - * - *

- * This accessor method returns a reference to the live list, - * not a snapshot. Therefore any modification you make to the - * returned list will be present inside the JAXB object. - * This is why there is not a set method for the probe property. - * - *

- * For example, to add a new item, do as follows: - *

-     *    getProbe().add(newItem);
-     * 
- * - * - *

- * Objects of the following type(s) are allowed in the list - * {@link Probe } - * - * - */ - public List getProbe() { - if (probe == null) { - probe = new ArrayList(); - } - return this.probe; - } - - /** - * Gets the value of the isActive property. - * - */ - public boolean isIsActive() { - return isActive; - } - - /** - * Sets the value of the isActive property. - * - */ - public void setIsActive(boolean value) { - this.isActive = value; - } - - /** - * Gets the value of the maxActive property. - * - */ - public int getMaxActive() { - return maxActive; - } - - /** - * Sets the value of the maxActive property. - * - */ - public void setMaxActive(int value) { - this.maxActive = value; - } - -} diff --git a/Plugins/Mineplex.BungeeRotator/src/com/neustar/ultraservice/schema/v01/PoolConfigurationList.java b/Plugins/Mineplex.BungeeRotator/src/com/neustar/ultraservice/schema/v01/PoolConfigurationList.java deleted file mode 100644 index d2267b903..000000000 --- a/Plugins/Mineplex.BungeeRotator/src/com/neustar/ultraservice/schema/v01/PoolConfigurationList.java +++ /dev/null @@ -1,69 +0,0 @@ - -package com.neustar.ultraservice.schema.v01; - -import java.util.ArrayList; -import java.util.List; -import javax.xml.bind.annotation.XmlAccessType; -import javax.xml.bind.annotation.XmlAccessorType; -import javax.xml.bind.annotation.XmlElement; -import javax.xml.bind.annotation.XmlType; - - -/** - *

Java class for PoolConfigurationList complex type. - * - *

The following schema fragment specifies the expected content contained within this class. - * - *

- * <complexType name="PoolConfigurationList">
- *   <complexContent>
- *     <restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
- *       <sequence>
- *         <element name="poolDefinitions" type="{http://schema.ultraservice.neustar.com/v01/}PoolConfiguration" maxOccurs="unbounded"/>
- *       </sequence>
- *     </restriction>
- *   </complexContent>
- * </complexType>
- * 
- * - * - */ -@XmlAccessorType(XmlAccessType.FIELD) -@XmlType(name = "PoolConfigurationList", propOrder = { - "poolDefinitions" -}) -public class PoolConfigurationList { - - @XmlElement(required = true) - protected List poolDefinitions; - - /** - * Gets the value of the poolDefinitions property. - * - *

- * This accessor method returns a reference to the live list, - * not a snapshot. Therefore any modification you make to the - * returned list will be present inside the JAXB object. - * This is why there is not a set method for the poolDefinitions property. - * - *

- * For example, to add a new item, do as follows: - *

-     *    getPoolDefinitions().add(newItem);
-     * 
- * - * - *

- * Objects of the following type(s) are allowed in the list - * {@link PoolConfiguration } - * - * - */ - public List getPoolDefinitions() { - if (poolDefinitions == null) { - poolDefinitions = new ArrayList(); - } - return this.poolDefinitions; - } - -} diff --git a/Plugins/Mineplex.BungeeRotator/src/com/neustar/ultraservice/schema/v01/PoolData.java b/Plugins/Mineplex.BungeeRotator/src/com/neustar/ultraservice/schema/v01/PoolData.java deleted file mode 100644 index aa734cdb9..000000000 --- a/Plugins/Mineplex.BungeeRotator/src/com/neustar/ultraservice/schema/v01/PoolData.java +++ /dev/null @@ -1,465 +0,0 @@ - -package com.neustar.ultraservice.schema.v01; - -import javax.xml.bind.annotation.XmlAccessType; -import javax.xml.bind.annotation.XmlAccessorType; -import javax.xml.bind.annotation.XmlAttribute; -import javax.xml.bind.annotation.XmlType; - - -/** - *

Java class for PoolData complex type. - * - *

The following schema fragment specifies the expected content contained within this class. - * - *

- * <complexType name="PoolData">
- *   <complexContent>
- *     <restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
- *       <sequence>
- *       </sequence>
- *       <attribute name="PoolName" use="required" type="{http://www.w3.org/2001/XMLSchema}string" />
- *       <attribute name="LBPoolId" use="required" type="{http://www.w3.org/2001/XMLSchema}string" />
- *       <attribute name="PoolId" use="required" type="{http://www.w3.org/2001/XMLSchema}string" />
- *       <attribute name="PoolType" use="required" type="{http://www.w3.org/2001/XMLSchema}string" />
- *       <attribute name="PoolRecordType" use="required" type="{http://www.w3.org/2001/XMLSchema}string" />
- *       <attribute name="Bleid" use="required" type="{http://www.w3.org/2001/XMLSchema}string" />
- *       <attribute name="PoolStatus" use="required" type="{http://www.w3.org/2001/XMLSchema}string" />
- *       <attribute name="PoolDName" use="required" type="{http://www.w3.org/2001/XMLSchema}string" />
- *       <attribute name="FailOver" use="required" type="{http://www.w3.org/2001/XMLSchema}string" />
- *       <attribute name="Probing" use="required" type="{http://www.w3.org/2001/XMLSchema}string" />
- *       <attribute name="MinActiveServers" use="required" type="{http://www.w3.org/2001/XMLSchema}string" />
- *       <attribute name="MaxActiveServers" use="required" type="{http://www.w3.org/2001/XMLSchema}string" />
- *       <attribute name="ResponseMethod" type="{http://www.w3.org/2001/XMLSchema}string" />
- *       <attribute name="MaxResponse" type="{http://www.w3.org/2001/XMLSchema}string" />
- *       <attribute name="description" use="required" type="{http://www.w3.org/2001/XMLSchema}string" />
- *       <attribute name="configured" use="required" type="{http://www.w3.org/2001/XMLSchema}string" />
- *     </restriction>
- *   </complexContent>
- * </complexType>
- * 
- * - * - */ -@XmlAccessorType(XmlAccessType.FIELD) -@XmlType(name = "PoolData") -public class PoolData { - - @XmlAttribute(name = "PoolName", required = true) - protected String poolName; - @XmlAttribute(name = "LBPoolId", required = true) - protected String lbPoolId; - @XmlAttribute(name = "PoolId", required = true) - protected String poolId; - @XmlAttribute(name = "PoolType", required = true) - protected String poolType; - @XmlAttribute(name = "PoolRecordType", required = true) - protected String poolRecordType; - @XmlAttribute(name = "Bleid", required = true) - protected String bleid; - @XmlAttribute(name = "PoolStatus", required = true) - protected String poolStatus; - @XmlAttribute(name = "PoolDName", required = true) - protected String poolDName; - @XmlAttribute(name = "FailOver", required = true) - protected String failOver; - @XmlAttribute(name = "Probing", required = true) - protected String probing; - @XmlAttribute(name = "MinActiveServers", required = true) - protected String minActiveServers; - @XmlAttribute(name = "MaxActiveServers", required = true) - protected String maxActiveServers; - @XmlAttribute(name = "ResponseMethod") - protected String responseMethod; - @XmlAttribute(name = "MaxResponse") - protected String maxResponse; - @XmlAttribute(name = "description", required = true) - protected String description; - @XmlAttribute(name = "configured", required = true) - protected String configured; - - /** - * Gets the value of the poolName property. - * - * @return - * possible object is - * {@link String } - * - */ - public String getPoolName() { - return poolName; - } - - /** - * Sets the value of the poolName property. - * - * @param value - * allowed object is - * {@link String } - * - */ - public void setPoolName(String value) { - this.poolName = value; - } - - /** - * Gets the value of the lbPoolId property. - * - * @return - * possible object is - * {@link String } - * - */ - public String getLBPoolId() { - return lbPoolId; - } - - /** - * Sets the value of the lbPoolId property. - * - * @param value - * allowed object is - * {@link String } - * - */ - public void setLBPoolId(String value) { - this.lbPoolId = value; - } - - /** - * Gets the value of the poolId property. - * - * @return - * possible object is - * {@link String } - * - */ - public String getPoolId() { - return poolId; - } - - /** - * Sets the value of the poolId property. - * - * @param value - * allowed object is - * {@link String } - * - */ - public void setPoolId(String value) { - this.poolId = value; - } - - /** - * Gets the value of the poolType property. - * - * @return - * possible object is - * {@link String } - * - */ - public String getPoolType() { - return poolType; - } - - /** - * Sets the value of the poolType property. - * - * @param value - * allowed object is - * {@link String } - * - */ - public void setPoolType(String value) { - this.poolType = value; - } - - /** - * Gets the value of the poolRecordType property. - * - * @return - * possible object is - * {@link String } - * - */ - public String getPoolRecordType() { - return poolRecordType; - } - - /** - * Sets the value of the poolRecordType property. - * - * @param value - * allowed object is - * {@link String } - * - */ - public void setPoolRecordType(String value) { - this.poolRecordType = value; - } - - /** - * Gets the value of the bleid property. - * - * @return - * possible object is - * {@link String } - * - */ - public String getBleid() { - return bleid; - } - - /** - * Sets the value of the bleid property. - * - * @param value - * allowed object is - * {@link String } - * - */ - public void setBleid(String value) { - this.bleid = value; - } - - /** - * Gets the value of the poolStatus property. - * - * @return - * possible object is - * {@link String } - * - */ - public String getPoolStatus() { - return poolStatus; - } - - /** - * Sets the value of the poolStatus property. - * - * @param value - * allowed object is - * {@link String } - * - */ - public void setPoolStatus(String value) { - this.poolStatus = value; - } - - /** - * Gets the value of the poolDName property. - * - * @return - * possible object is - * {@link String } - * - */ - public String getPoolDName() { - return poolDName; - } - - /** - * Sets the value of the poolDName property. - * - * @param value - * allowed object is - * {@link String } - * - */ - public void setPoolDName(String value) { - this.poolDName = value; - } - - /** - * Gets the value of the failOver property. - * - * @return - * possible object is - * {@link String } - * - */ - public String getFailOver() { - return failOver; - } - - /** - * Sets the value of the failOver property. - * - * @param value - * allowed object is - * {@link String } - * - */ - public void setFailOver(String value) { - this.failOver = value; - } - - /** - * Gets the value of the probing property. - * - * @return - * possible object is - * {@link String } - * - */ - public String getProbing() { - return probing; - } - - /** - * Sets the value of the probing property. - * - * @param value - * allowed object is - * {@link String } - * - */ - public void setProbing(String value) { - this.probing = value; - } - - /** - * Gets the value of the minActiveServers property. - * - * @return - * possible object is - * {@link String } - * - */ - public String getMinActiveServers() { - return minActiveServers; - } - - /** - * Sets the value of the minActiveServers property. - * - * @param value - * allowed object is - * {@link String } - * - */ - public void setMinActiveServers(String value) { - this.minActiveServers = value; - } - - /** - * Gets the value of the maxActiveServers property. - * - * @return - * possible object is - * {@link String } - * - */ - public String getMaxActiveServers() { - return maxActiveServers; - } - - /** - * Sets the value of the maxActiveServers property. - * - * @param value - * allowed object is - * {@link String } - * - */ - public void setMaxActiveServers(String value) { - this.maxActiveServers = value; - } - - /** - * Gets the value of the responseMethod property. - * - * @return - * possible object is - * {@link String } - * - */ - public String getResponseMethod() { - return responseMethod; - } - - /** - * Sets the value of the responseMethod property. - * - * @param value - * allowed object is - * {@link String } - * - */ - public void setResponseMethod(String value) { - this.responseMethod = value; - } - - /** - * Gets the value of the maxResponse property. - * - * @return - * possible object is - * {@link String } - * - */ - public String getMaxResponse() { - return maxResponse; - } - - /** - * Sets the value of the maxResponse property. - * - * @param value - * allowed object is - * {@link String } - * - */ - public void setMaxResponse(String value) { - this.maxResponse = value; - } - - /** - * Gets the value of the description property. - * - * @return - * possible object is - * {@link String } - * - */ - public String getDescription() { - return description; - } - - /** - * Sets the value of the description property. - * - * @param value - * allowed object is - * {@link String } - * - */ - public void setDescription(String value) { - this.description = value; - } - - /** - * Gets the value of the configured property. - * - * @return - * possible object is - * {@link String } - * - */ - public String getConfigured() { - return configured; - } - - /** - * Sets the value of the configured property. - * - * @param value - * allowed object is - * {@link String } - * - */ - public void setConfigured(String value) { - this.configured = value; - } - -} diff --git a/Plugins/Mineplex.BungeeRotator/src/com/neustar/ultraservice/schema/v01/PoolDefinitions.java b/Plugins/Mineplex.BungeeRotator/src/com/neustar/ultraservice/schema/v01/PoolDefinitions.java deleted file mode 100644 index 9eb622f5a..000000000 --- a/Plugins/Mineplex.BungeeRotator/src/com/neustar/ultraservice/schema/v01/PoolDefinitions.java +++ /dev/null @@ -1,69 +0,0 @@ - -package com.neustar.ultraservice.schema.v01; - -import java.util.ArrayList; -import java.util.List; -import javax.xml.bind.annotation.XmlAccessType; -import javax.xml.bind.annotation.XmlAccessorType; -import javax.xml.bind.annotation.XmlElement; -import javax.xml.bind.annotation.XmlType; - - -/** - *

Java class for PoolDefinitions complex type. - * - *

The following schema fragment specifies the expected content contained within this class. - * - *

- * <complexType name="PoolDefinitions">
- *   <complexContent>
- *     <restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
- *       <sequence>
- *         <element name="monitoredRDPool" type="{http://schema.ultraservice.neustar.com/v01/}MonitoredRDPool" maxOccurs="unbounded"/>
- *       </sequence>
- *     </restriction>
- *   </complexContent>
- * </complexType>
- * 
- * - * - */ -@XmlAccessorType(XmlAccessType.FIELD) -@XmlType(name = "PoolDefinitions", propOrder = { - "monitoredRDPool" -}) -public class PoolDefinitions { - - @XmlElement(required = true) - protected List monitoredRDPool; - - /** - * Gets the value of the monitoredRDPool property. - * - *

- * This accessor method returns a reference to the live list, - * not a snapshot. Therefore any modification you make to the - * returned list will be present inside the JAXB object. - * This is why there is not a set method for the monitoredRDPool property. - * - *

- * For example, to add a new item, do as follows: - *

-     *    getMonitoredRDPool().add(newItem);
-     * 
- * - * - *

- * Objects of the following type(s) are allowed in the list - * {@link MonitoredRDPool } - * - * - */ - public List getMonitoredRDPool() { - if (monitoredRDPool == null) { - monitoredRDPool = new ArrayList(); - } - return this.monitoredRDPool; - } - -} diff --git a/Plugins/Mineplex.BungeeRotator/src/com/neustar/ultraservice/schema/v01/PoolDetails.java b/Plugins/Mineplex.BungeeRotator/src/com/neustar/ultraservice/schema/v01/PoolDetails.java deleted file mode 100644 index 420f82054..000000000 --- a/Plugins/Mineplex.BungeeRotator/src/com/neustar/ultraservice/schema/v01/PoolDetails.java +++ /dev/null @@ -1,97 +0,0 @@ - -package com.neustar.ultraservice.schema.v01; - -import java.util.ArrayList; -import java.util.List; -import javax.xml.bind.annotation.XmlAccessType; -import javax.xml.bind.annotation.XmlAccessorType; -import javax.xml.bind.annotation.XmlElement; -import javax.xml.bind.annotation.XmlType; - - -/** - *

Java class for PoolDetails complex type. - * - *

The following schema fragment specifies the expected content contained within this class. - * - *

- * <complexType name="PoolDetails">
- *   <complexContent>
- *     <restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
- *       <sequence>
- *         <element name="Pool" type="{http://schema.ultraservice.neustar.com/v01/}Pool"/>
- *         <element name="PoolConfigurationDetails" type="{http://schema.ultraservice.neustar.com/v01/}PoolConfigurationDetails" maxOccurs="unbounded" minOccurs="0"/>
- *       </sequence>
- *     </restriction>
- *   </complexContent>
- * </complexType>
- * 
- * - * - */ -@XmlAccessorType(XmlAccessType.FIELD) -@XmlType(name = "PoolDetails", propOrder = { - "pool", - "poolConfigurationDetails" -}) -public class PoolDetails { - - @XmlElement(name = "Pool", required = true, nillable = true) - protected Pool pool; - @XmlElement(name = "PoolConfigurationDetails", nillable = true) - protected List poolConfigurationDetails; - - /** - * Gets the value of the pool property. - * - * @return - * possible object is - * {@link Pool } - * - */ - public Pool getPool() { - return pool; - } - - /** - * Sets the value of the pool property. - * - * @param value - * allowed object is - * {@link Pool } - * - */ - public void setPool(Pool value) { - this.pool = value; - } - - /** - * Gets the value of the poolConfigurationDetails property. - * - *

- * This accessor method returns a reference to the live list, - * not a snapshot. Therefore any modification you make to the - * returned list will be present inside the JAXB object. - * This is why there is not a set method for the poolConfigurationDetails property. - * - *

- * For example, to add a new item, do as follows: - *

-     *    getPoolConfigurationDetails().add(newItem);
-     * 
- * - * - *

- * Objects of the following type(s) are allowed in the list - * {@link PoolConfigurationDetails } - * - * - */ - public List getPoolConfigurationDetails() { - if (poolConfigurationDetails == null) { - poolConfigurationDetails = new ArrayList(); - } - return this.poolConfigurationDetails; - } - -} diff --git a/Plugins/Mineplex.BungeeRotator/src/com/neustar/ultraservice/schema/v01/PoolDetailsList.java b/Plugins/Mineplex.BungeeRotator/src/com/neustar/ultraservice/schema/v01/PoolDetailsList.java deleted file mode 100644 index b5a81c868..000000000 --- a/Plugins/Mineplex.BungeeRotator/src/com/neustar/ultraservice/schema/v01/PoolDetailsList.java +++ /dev/null @@ -1,126 +0,0 @@ - -package com.neustar.ultraservice.schema.v01; - -import java.util.ArrayList; -import java.util.List; -import javax.xml.bind.annotation.XmlAccessType; -import javax.xml.bind.annotation.XmlAccessorType; -import javax.xml.bind.annotation.XmlElement; -import javax.xml.bind.annotation.XmlType; - - -/** - *

Java class for PoolDetailsList complex type. - * - *

The following schema fragment specifies the expected content contained within this class. - * - *

- * <complexType name="PoolDetailsList">
- *   <complexContent>
- *     <restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
- *       <sequence>
- *         <element name="PoolDetails" type="{http://schema.ultraservice.neustar.com/v01/}PoolDetails" maxOccurs="unbounded"/>
- *         <element name="total" type="{http://www.w3.org/2001/XMLSchema}int"/>
- *         <element name="offset" type="{http://www.w3.org/2001/XMLSchema}int"/>
- *         <element name="count" type="{http://www.w3.org/2001/XMLSchema}int"/>
- *       </sequence>
- *     </restriction>
- *   </complexContent>
- * </complexType>
- * 
- * - * - */ -@XmlAccessorType(XmlAccessType.FIELD) -@XmlType(name = "PoolDetailsList", propOrder = { - "poolDetails", - "total", - "offset", - "count" -}) -public class PoolDetailsList { - - @XmlElement(name = "PoolDetails", required = true) - protected List poolDetails; - protected int total; - protected int offset; - protected int count; - - /** - * Gets the value of the poolDetails property. - * - *

- * This accessor method returns a reference to the live list, - * not a snapshot. Therefore any modification you make to the - * returned list will be present inside the JAXB object. - * This is why there is not a set method for the poolDetails property. - * - *

- * For example, to add a new item, do as follows: - *

-     *    getPoolDetails().add(newItem);
-     * 
- * - * - *

- * Objects of the following type(s) are allowed in the list - * {@link PoolDetails } - * - * - */ - public List getPoolDetails() { - if (poolDetails == null) { - poolDetails = new ArrayList(); - } - return this.poolDetails; - } - - /** - * Gets the value of the total property. - * - */ - public int getTotal() { - return total; - } - - /** - * Sets the value of the total property. - * - */ - public void setTotal(int value) { - this.total = value; - } - - /** - * Gets the value of the offset property. - * - */ - public int getOffset() { - return offset; - } - - /** - * Sets the value of the offset property. - * - */ - public void setOffset(int value) { - this.offset = value; - } - - /** - * Gets the value of the count property. - * - */ - public int getCount() { - return count; - } - - /** - * Sets the value of the count property. - * - */ - public void setCount(int value) { - this.count = value; - } - -} diff --git a/Plugins/Mineplex.BungeeRotator/src/com/neustar/ultraservice/schema/v01/PoolId.java b/Plugins/Mineplex.BungeeRotator/src/com/neustar/ultraservice/schema/v01/PoolId.java deleted file mode 100644 index 61fd44713..000000000 --- a/Plugins/Mineplex.BungeeRotator/src/com/neustar/ultraservice/schema/v01/PoolId.java +++ /dev/null @@ -1,62 +0,0 @@ - -package com.neustar.ultraservice.schema.v01; - -import javax.xml.bind.annotation.XmlAccessType; -import javax.xml.bind.annotation.XmlAccessorType; -import javax.xml.bind.annotation.XmlElement; -import javax.xml.bind.annotation.XmlType; - - -/** - *

Java class for PoolId complex type. - * - *

The following schema fragment specifies the expected content contained within this class. - * - *

- * <complexType name="PoolId">
- *   <complexContent>
- *     <restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
- *       <sequence>
- *         <element name="poolName" type="{http://www.w3.org/2001/XMLSchema}string"/>
- *       </sequence>
- *     </restriction>
- *   </complexContent>
- * </complexType>
- * 
- * - * - */ -@XmlAccessorType(XmlAccessType.FIELD) -@XmlType(name = "PoolId", propOrder = { - "poolName" -}) -public class PoolId { - - @XmlElement(required = true) - protected String poolName; - - /** - * Gets the value of the poolName property. - * - * @return - * possible object is - * {@link String } - * - */ - public String getPoolName() { - return poolName; - } - - /** - * Sets the value of the poolName property. - * - * @param value - * allowed object is - * {@link String } - * - */ - public void setPoolName(String value) { - this.poolName = value; - } - -} diff --git a/Plugins/Mineplex.BungeeRotator/src/com/neustar/ultraservice/schema/v01/PoolIndexes.java b/Plugins/Mineplex.BungeeRotator/src/com/neustar/ultraservice/schema/v01/PoolIndexes.java deleted file mode 100644 index cefaca07a..000000000 --- a/Plugins/Mineplex.BungeeRotator/src/com/neustar/ultraservice/schema/v01/PoolIndexes.java +++ /dev/null @@ -1,50 +0,0 @@ - -package com.neustar.ultraservice.schema.v01; - -import javax.xml.bind.annotation.XmlEnum; -import javax.xml.bind.annotation.XmlType; - - -/** - *

Java class for poolIndexes. - * - *

The following schema fragment specifies the expected content contained within this class. - *

- *

- * <simpleType name="poolIndexes">
- *   <restriction base="{http://www.w3.org/2001/XMLSchema}string">
- *     <enumeration value="NAME"/>
- *     <enumeration value="TYPE"/>
- *     <enumeration value="DESCRIPTION"/>
- *     <enumeration value="RECORDSCOUNT"/>
- *     <enumeration value="RESPONSEMETHOD"/>
- *     <enumeration value="REQUEST"/>
- *     <enumeration value="LBPOOLTYPE"/>
- *     <enumeration value="STATE"/>
- *   </restriction>
- * </simpleType>
- * 
- * - */ -@XmlType(name = "poolIndexes") -@XmlEnum -public enum PoolIndexes { - - NAME, - TYPE, - DESCRIPTION, - RECORDSCOUNT, - RESPONSEMETHOD, - REQUEST, - LBPOOLTYPE, - STATE; - - public String value() { - return name(); - } - - public static PoolIndexes fromValue(String v) { - return valueOf(v); - } - -} diff --git a/Plugins/Mineplex.BungeeRotator/src/com/neustar/ultraservice/schema/v01/PoolKey.java b/Plugins/Mineplex.BungeeRotator/src/com/neustar/ultraservice/schema/v01/PoolKey.java deleted file mode 100644 index 1c33ee9b6..000000000 --- a/Plugins/Mineplex.BungeeRotator/src/com/neustar/ultraservice/schema/v01/PoolKey.java +++ /dev/null @@ -1,90 +0,0 @@ - -package com.neustar.ultraservice.schema.v01; - -import javax.xml.bind.annotation.XmlAccessType; -import javax.xml.bind.annotation.XmlAccessorType; -import javax.xml.bind.annotation.XmlElement; -import javax.xml.bind.annotation.XmlType; - - -/** - *

Java class for PoolKey complex type. - * - *

The following schema fragment specifies the expected content contained within this class. - * - *

- * <complexType name="PoolKey">
- *   <complexContent>
- *     <restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
- *       <sequence>
- *         <element name="hostName" type="{http://www.w3.org/2001/XMLSchema}string"/>
- *         <element name="poolName" type="{http://www.w3.org/2001/XMLSchema}string"/>
- *       </sequence>
- *     </restriction>
- *   </complexContent>
- * </complexType>
- * 
- * - * - */ -@XmlAccessorType(XmlAccessType.FIELD) -@XmlType(name = "PoolKey", propOrder = { - "hostName", - "poolName" -}) -public class PoolKey { - - @XmlElement(required = true) - protected String hostName; - @XmlElement(required = true) - protected String poolName; - - /** - * Gets the value of the hostName property. - * - * @return - * possible object is - * {@link String } - * - */ - public String getHostName() { - return hostName; - } - - /** - * Sets the value of the hostName property. - * - * @param value - * allowed object is - * {@link String } - * - */ - public void setHostName(String value) { - this.hostName = value; - } - - /** - * Gets the value of the poolName property. - * - * @return - * possible object is - * {@link String } - * - */ - public String getPoolName() { - return poolName; - } - - /** - * Sets the value of the poolName property. - * - * @param value - * allowed object is - * {@link String } - * - */ - public void setPoolName(String value) { - this.poolName = value; - } - -} diff --git a/Plugins/Mineplex.BungeeRotator/src/com/neustar/ultraservice/schema/v01/PoolListParams.java b/Plugins/Mineplex.BungeeRotator/src/com/neustar/ultraservice/schema/v01/PoolListParams.java deleted file mode 100644 index 7ed1ed09d..000000000 --- a/Plugins/Mineplex.BungeeRotator/src/com/neustar/ultraservice/schema/v01/PoolListParams.java +++ /dev/null @@ -1,141 +0,0 @@ - -package com.neustar.ultraservice.schema.v01; - -import javax.xml.bind.annotation.XmlAccessType; -import javax.xml.bind.annotation.XmlAccessorType; -import javax.xml.bind.annotation.XmlType; - - -/** - *

Java class for PoolListParams complex type. - * - *

The following schema fragment specifies the expected content contained within this class. - * - *

- * <complexType name="PoolListParams">
- *   <complexContent>
- *     <restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
- *       <sequence>
- *         <element name="sortBy" type="{http://schema.ultraservice.neustar.com/v01/}poolIndexes" minOccurs="0"/>
- *         <element name="sortOrder" type="{http://schema.ultraservice.neustar.com/v01/}sortOrder" minOccurs="0"/>
- *         <element name="offset" type="{http://www.w3.org/2001/XMLSchema}int" minOccurs="0"/>
- *         <element name="limit" type="{http://www.w3.org/2001/XMLSchema}int" minOccurs="0"/>
- *       </sequence>
- *     </restriction>
- *   </complexContent>
- * </complexType>
- * 
- * - * - */ -@XmlAccessorType(XmlAccessType.FIELD) -@XmlType(name = "PoolListParams", propOrder = { - "sortBy", - "sortOrder", - "offset", - "limit" -}) -public class PoolListParams { - - protected PoolIndexes sortBy; - protected SortOrder sortOrder; - protected Integer offset; - protected Integer limit; - - /** - * Gets the value of the sortBy property. - * - * @return - * possible object is - * {@link PoolIndexes } - * - */ - public PoolIndexes getSortBy() { - return sortBy; - } - - /** - * Sets the value of the sortBy property. - * - * @param value - * allowed object is - * {@link PoolIndexes } - * - */ - public void setSortBy(PoolIndexes value) { - this.sortBy = value; - } - - /** - * Gets the value of the sortOrder property. - * - * @return - * possible object is - * {@link SortOrder } - * - */ - public SortOrder getSortOrder() { - return sortOrder; - } - - /** - * Sets the value of the sortOrder property. - * - * @param value - * allowed object is - * {@link SortOrder } - * - */ - public void setSortOrder(SortOrder value) { - this.sortOrder = value; - } - - /** - * Gets the value of the offset property. - * - * @return - * possible object is - * {@link Integer } - * - */ - public Integer getOffset() { - return offset; - } - - /** - * Sets the value of the offset property. - * - * @param value - * allowed object is - * {@link Integer } - * - */ - public void setOffset(Integer value) { - this.offset = value; - } - - /** - * Gets the value of the limit property. - * - * @return - * possible object is - * {@link Integer } - * - */ - public Integer getLimit() { - return limit; - } - - /** - * Sets the value of the limit property. - * - * @param value - * allowed object is - * {@link Integer } - * - */ - public void setLimit(Integer value) { - this.limit = value; - } - -} diff --git a/Plugins/Mineplex.BungeeRotator/src/com/neustar/ultraservice/schema/v01/PoolProbeId.java b/Plugins/Mineplex.BungeeRotator/src/com/neustar/ultraservice/schema/v01/PoolProbeId.java deleted file mode 100644 index 21f6a1c46..000000000 --- a/Plugins/Mineplex.BungeeRotator/src/com/neustar/ultraservice/schema/v01/PoolProbeId.java +++ /dev/null @@ -1,90 +0,0 @@ - -package com.neustar.ultraservice.schema.v01; - -import javax.xml.bind.annotation.XmlAccessType; -import javax.xml.bind.annotation.XmlAccessorType; -import javax.xml.bind.annotation.XmlElement; -import javax.xml.bind.annotation.XmlType; - - -/** - *

Java class for PoolProbeId complex type. - * - *

The following schema fragment specifies the expected content contained within this class. - * - *

- * <complexType name="PoolProbeId">
- *   <complexContent>
- *     <restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
- *       <sequence>
- *         <element name="poolName" type="{http://www.w3.org/2001/XMLSchema}string"/>
- *         <element name="probeDefinitionName" type="{http://www.w3.org/2001/XMLSchema}string"/>
- *       </sequence>
- *     </restriction>
- *   </complexContent>
- * </complexType>
- * 
- * - * - */ -@XmlAccessorType(XmlAccessType.FIELD) -@XmlType(name = "PoolProbeId", propOrder = { - "poolName", - "probeDefinitionName" -}) -public class PoolProbeId { - - @XmlElement(required = true) - protected String poolName; - @XmlElement(required = true) - protected String probeDefinitionName; - - /** - * Gets the value of the poolName property. - * - * @return - * possible object is - * {@link String } - * - */ - public String getPoolName() { - return poolName; - } - - /** - * Sets the value of the poolName property. - * - * @param value - * allowed object is - * {@link String } - * - */ - public void setPoolName(String value) { - this.poolName = value; - } - - /** - * Gets the value of the probeDefinitionName property. - * - * @return - * possible object is - * {@link String } - * - */ - public String getProbeDefinitionName() { - return probeDefinitionName; - } - - /** - * Sets the value of the probeDefinitionName property. - * - * @param value - * allowed object is - * {@link String } - * - */ - public void setProbeDefinitionName(String value) { - this.probeDefinitionName = value; - } - -} diff --git a/Plugins/Mineplex.BungeeRotator/src/com/neustar/ultraservice/schema/v01/PoolRecord.java b/Plugins/Mineplex.BungeeRotator/src/com/neustar/ultraservice/schema/v01/PoolRecord.java deleted file mode 100644 index 567c2d75d..000000000 --- a/Plugins/Mineplex.BungeeRotator/src/com/neustar/ultraservice/schema/v01/PoolRecord.java +++ /dev/null @@ -1,298 +0,0 @@ - -package com.neustar.ultraservice.schema.v01; - -import javax.xml.bind.annotation.XmlAccessType; -import javax.xml.bind.annotation.XmlAccessorType; -import javax.xml.bind.annotation.XmlAttribute; -import javax.xml.bind.annotation.XmlElement; -import javax.xml.bind.annotation.XmlType; - - -/** - *

Java class for PoolRecord complex type. - * - *

The following schema fragment specifies the expected content contained within this class. - * - *

- * <complexType name="PoolRecord">
- *   <complexContent>
- *     <restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
- *       <sequence>
- *         <element name="Record" type="{http://schema.ultraservice.neustar.com/v01/}Record"/>
- *       </sequence>
- *       <attribute name="hostName" use="required" type="{http://www.w3.org/2001/XMLSchema}string" />
- *       <attribute name="configurationName" type="{http://www.w3.org/2001/XMLSchema}string" />
- *       <attribute name="description" type="{http://www.w3.org/2001/XMLSchema}string" />
- *       <attribute name="weight" type="{http://www.w3.org/2001/XMLSchema}int" />
- *       <attribute name="allFail" type="{http://www.w3.org/2001/XMLSchema}boolean" />
- *       <attribute name="forcedState" use="required" type="{http://schema.ultraservice.neustar.com/v01/}ForcedState" />
- *       <attribute name="recordState" type="{http://schema.ultraservice.neustar.com/v01/}RecordState" />
- *       <attribute name="probesEnabled" use="required" type="{http://www.w3.org/2001/XMLSchema}boolean" />
- *       <attribute name="recordStatus" type="{http://www.w3.org/2001/XMLSchema}string" />
- *     </restriction>
- *   </complexContent>
- * </complexType>
- * 
- * - * - */ -@XmlAccessorType(XmlAccessType.FIELD) -@XmlType(name = "PoolRecord", propOrder = { - "record" -}) -public class PoolRecord { - - @XmlElement(name = "Record", required = true) - protected Record record; - @XmlAttribute(name = "hostName", required = true) - protected String hostName; - @XmlAttribute(name = "configurationName") - protected String configurationName; - @XmlAttribute(name = "description") - protected String description; - @XmlAttribute(name = "weight") - protected Integer weight; - @XmlAttribute(name = "allFail") - protected Boolean allFail; - @XmlAttribute(name = "forcedState", required = true) - protected ForcedState forcedState; - @XmlAttribute(name = "recordState") - protected RecordState recordState; - @XmlAttribute(name = "probesEnabled", required = true) - protected boolean probesEnabled; - @XmlAttribute(name = "recordStatus") - protected String recordStatus; - - /** - * Gets the value of the record property. - * - * @return - * possible object is - * {@link Record } - * - */ - public Record getRecord() { - return record; - } - - /** - * Sets the value of the record property. - * - * @param value - * allowed object is - * {@link Record } - * - */ - public void setRecord(Record value) { - this.record = value; - } - - /** - * Gets the value of the hostName property. - * - * @return - * possible object is - * {@link String } - * - */ - public String getHostName() { - return hostName; - } - - /** - * Sets the value of the hostName property. - * - * @param value - * allowed object is - * {@link String } - * - */ - public void setHostName(String value) { - this.hostName = value; - } - - /** - * Gets the value of the configurationName property. - * - * @return - * possible object is - * {@link String } - * - */ - public String getConfigurationName() { - return configurationName; - } - - /** - * Sets the value of the configurationName property. - * - * @param value - * allowed object is - * {@link String } - * - */ - public void setConfigurationName(String value) { - this.configurationName = value; - } - - /** - * Gets the value of the description property. - * - * @return - * possible object is - * {@link String } - * - */ - public String getDescription() { - return description; - } - - /** - * Sets the value of the description property. - * - * @param value - * allowed object is - * {@link String } - * - */ - public void setDescription(String value) { - this.description = value; - } - - /** - * Gets the value of the weight property. - * - * @return - * possible object is - * {@link Integer } - * - */ - public Integer getWeight() { - return weight; - } - - /** - * Sets the value of the weight property. - * - * @param value - * allowed object is - * {@link Integer } - * - */ - public void setWeight(Integer value) { - this.weight = value; - } - - /** - * Gets the value of the allFail property. - * - * @return - * possible object is - * {@link Boolean } - * - */ - public Boolean isAllFail() { - return allFail; - } - - /** - * Sets the value of the allFail property. - * - * @param value - * allowed object is - * {@link Boolean } - * - */ - public void setAllFail(Boolean value) { - this.allFail = value; - } - - /** - * Gets the value of the forcedState property. - * - * @return - * possible object is - * {@link ForcedState } - * - */ - public ForcedState getForcedState() { - return forcedState; - } - - /** - * Sets the value of the forcedState property. - * - * @param value - * allowed object is - * {@link ForcedState } - * - */ - public void setForcedState(ForcedState value) { - this.forcedState = value; - } - - /** - * Gets the value of the recordState property. - * - * @return - * possible object is - * {@link RecordState } - * - */ - public RecordState getRecordState() { - return recordState; - } - - /** - * Sets the value of the recordState property. - * - * @param value - * allowed object is - * {@link RecordState } - * - */ - public void setRecordState(RecordState value) { - this.recordState = value; - } - - /** - * Gets the value of the probesEnabled property. - * - */ - public boolean isProbesEnabled() { - return probesEnabled; - } - - /** - * Sets the value of the probesEnabled property. - * - */ - public void setProbesEnabled(boolean value) { - this.probesEnabled = value; - } - - /** - * Gets the value of the recordStatus property. - * - * @return - * possible object is - * {@link String } - * - */ - public String getRecordStatus() { - return recordStatus; - } - - /** - * Sets the value of the recordStatus property. - * - * @param value - * allowed object is - * {@link String } - * - */ - public void setRecordStatus(String value) { - this.recordStatus = value; - } - -} diff --git a/Plugins/Mineplex.BungeeRotator/src/com/neustar/ultraservice/schema/v01/PoolRecordData.java b/Plugins/Mineplex.BungeeRotator/src/com/neustar/ultraservice/schema/v01/PoolRecordData.java deleted file mode 100644 index 702b0800b..000000000 --- a/Plugins/Mineplex.BungeeRotator/src/com/neustar/ultraservice/schema/v01/PoolRecordData.java +++ /dev/null @@ -1,357 +0,0 @@ - -package com.neustar.ultraservice.schema.v01; - -import javax.xml.bind.annotation.XmlAccessType; -import javax.xml.bind.annotation.XmlAccessorType; -import javax.xml.bind.annotation.XmlAttribute; -import javax.xml.bind.annotation.XmlType; - - -/** - *

Java class for PoolRecordData complex type. - * - *

The following schema fragment specifies the expected content contained within this class. - * - *

- * <complexType name="PoolRecordData">
- *   <complexContent>
- *     <restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
- *       <sequence>
- *       </sequence>
- *       <attribute name="subPoolId" type="{http://www.w3.org/2001/XMLSchema}string" />
- *       <attribute name="poolRecordID" use="required" type="{http://www.w3.org/2001/XMLSchema}string" />
- *       <attribute name="poolId" use="required" type="{http://www.w3.org/2001/XMLSchema}string" />
- *       <attribute name="pointsTo" use="required" type="{http://www.w3.org/2001/XMLSchema}string" />
- *       <attribute name="weight" type="{http://www.w3.org/2001/XMLSchema}string" />
- *       <attribute name="priority" use="required" type="{http://www.w3.org/2001/XMLSchema}string" />
- *       <attribute name="recordType" use="required" type="{http://www.w3.org/2001/XMLSchema}string" />
- *       <attribute name="forceAnswer" use="required" type="{http://www.w3.org/2001/XMLSchema}string" />
- *       <attribute name="probing" use="required" type="{http://www.w3.org/2001/XMLSchema}string" />
- *       <attribute name="status" use="required" type="{http://www.w3.org/2001/XMLSchema}string" />
- *       <attribute name="serving" use="required" type="{http://www.w3.org/2001/XMLSchema}string" />
- *       <attribute name="description" use="required" type="{http://www.w3.org/2001/XMLSchema}string" />
- *     </restriction>
- *   </complexContent>
- * </complexType>
- * 
- * - * - */ -@XmlAccessorType(XmlAccessType.FIELD) -@XmlType(name = "PoolRecordData") -public class PoolRecordData { - - @XmlAttribute(name = "subPoolId") - protected String subPoolId; - @XmlAttribute(name = "poolRecordID", required = true) - protected String poolRecordID; - @XmlAttribute(name = "poolId", required = true) - protected String poolId; - @XmlAttribute(name = "pointsTo", required = true) - protected String pointsTo; - @XmlAttribute(name = "weight") - protected String weight; - @XmlAttribute(name = "priority", required = true) - protected String priority; - @XmlAttribute(name = "recordType", required = true) - protected String recordType; - @XmlAttribute(name = "forceAnswer", required = true) - protected String forceAnswer; - @XmlAttribute(name = "probing", required = true) - protected String probing; - @XmlAttribute(name = "status", required = true) - protected String status; - @XmlAttribute(name = "serving", required = true) - protected String serving; - @XmlAttribute(name = "description", required = true) - protected String description; - - /** - * Gets the value of the subPoolId property. - * - * @return - * possible object is - * {@link String } - * - */ - public String getSubPoolId() { - return subPoolId; - } - - /** - * Sets the value of the subPoolId property. - * - * @param value - * allowed object is - * {@link String } - * - */ - public void setSubPoolId(String value) { - this.subPoolId = value; - } - - /** - * Gets the value of the poolRecordID property. - * - * @return - * possible object is - * {@link String } - * - */ - public String getPoolRecordID() { - return poolRecordID; - } - - /** - * Sets the value of the poolRecordID property. - * - * @param value - * allowed object is - * {@link String } - * - */ - public void setPoolRecordID(String value) { - this.poolRecordID = value; - } - - /** - * Gets the value of the poolId property. - * - * @return - * possible object is - * {@link String } - * - */ - public String getPoolId() { - return poolId; - } - - /** - * Sets the value of the poolId property. - * - * @param value - * allowed object is - * {@link String } - * - */ - public void setPoolId(String value) { - this.poolId = value; - } - - /** - * Gets the value of the pointsTo property. - * - * @return - * possible object is - * {@link String } - * - */ - public String getPointsTo() { - return pointsTo; - } - - /** - * Sets the value of the pointsTo property. - * - * @param value - * allowed object is - * {@link String } - * - */ - public void setPointsTo(String value) { - this.pointsTo = value; - } - - /** - * Gets the value of the weight property. - * - * @return - * possible object is - * {@link String } - * - */ - public String getWeight() { - return weight; - } - - /** - * Sets the value of the weight property. - * - * @param value - * allowed object is - * {@link String } - * - */ - public void setWeight(String value) { - this.weight = value; - } - - /** - * Gets the value of the priority property. - * - * @return - * possible object is - * {@link String } - * - */ - public String getPriority() { - return priority; - } - - /** - * Sets the value of the priority property. - * - * @param value - * allowed object is - * {@link String } - * - */ - public void setPriority(String value) { - this.priority = value; - } - - /** - * Gets the value of the recordType property. - * - * @return - * possible object is - * {@link String } - * - */ - public String getRecordType() { - return recordType; - } - - /** - * Sets the value of the recordType property. - * - * @param value - * allowed object is - * {@link String } - * - */ - public void setRecordType(String value) { - this.recordType = value; - } - - /** - * Gets the value of the forceAnswer property. - * - * @return - * possible object is - * {@link String } - * - */ - public String getForceAnswer() { - return forceAnswer; - } - - /** - * Sets the value of the forceAnswer property. - * - * @param value - * allowed object is - * {@link String } - * - */ - public void setForceAnswer(String value) { - this.forceAnswer = value; - } - - /** - * Gets the value of the probing property. - * - * @return - * possible object is - * {@link String } - * - */ - public String getProbing() { - return probing; - } - - /** - * Sets the value of the probing property. - * - * @param value - * allowed object is - * {@link String } - * - */ - public void setProbing(String value) { - this.probing = value; - } - - /** - * Gets the value of the status property. - * - * @return - * possible object is - * {@link String } - * - */ - public String getStatus() { - return status; - } - - /** - * Sets the value of the status property. - * - * @param value - * allowed object is - * {@link String } - * - */ - public void setStatus(String value) { - this.status = value; - } - - /** - * Gets the value of the serving property. - * - * @return - * possible object is - * {@link String } - * - */ - public String getServing() { - return serving; - } - - /** - * Sets the value of the serving property. - * - * @param value - * allowed object is - * {@link String } - * - */ - public void setServing(String value) { - this.serving = value; - } - - /** - * Gets the value of the description property. - * - * @return - * possible object is - * {@link String } - * - */ - public String getDescription() { - return description; - } - - /** - * Sets the value of the description property. - * - * @param value - * allowed object is - * {@link String } - * - */ - public void setDescription(String value) { - this.description = value; - } - -} diff --git a/Plugins/Mineplex.BungeeRotator/src/com/neustar/ultraservice/schema/v01/PoolRecordId.java b/Plugins/Mineplex.BungeeRotator/src/com/neustar/ultraservice/schema/v01/PoolRecordId.java deleted file mode 100644 index 668c7d6b5..000000000 --- a/Plugins/Mineplex.BungeeRotator/src/com/neustar/ultraservice/schema/v01/PoolRecordId.java +++ /dev/null @@ -1,118 +0,0 @@ - -package com.neustar.ultraservice.schema.v01; - -import javax.xml.bind.annotation.XmlAccessType; -import javax.xml.bind.annotation.XmlAccessorType; -import javax.xml.bind.annotation.XmlElement; -import javax.xml.bind.annotation.XmlType; - - -/** - *

Java class for PoolRecordId complex type. - * - *

The following schema fragment specifies the expected content contained within this class. - * - *

- * <complexType name="PoolRecordId">
- *   <complexContent>
- *     <restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
- *       <sequence>
- *         <element name="poolName" type="{http://www.w3.org/2001/XMLSchema}string"/>
- *         <element name="poolRecordType" type="{http://schema.ultraservice.neustar.com/v01/}RecordType"/>
- *         <element name="poolRecordValue" type="{http://www.w3.org/2001/XMLSchema}string"/>
- *       </sequence>
- *     </restriction>
- *   </complexContent>
- * </complexType>
- * 
- * - * - */ -@XmlAccessorType(XmlAccessType.FIELD) -@XmlType(name = "PoolRecordId", propOrder = { - "poolName", - "poolRecordType", - "poolRecordValue" -}) -public class PoolRecordId { - - @XmlElement(required = true) - protected String poolName; - @XmlElement(required = true) - protected RecordType poolRecordType; - @XmlElement(required = true) - protected String poolRecordValue; - - /** - * Gets the value of the poolName property. - * - * @return - * possible object is - * {@link String } - * - */ - public String getPoolName() { - return poolName; - } - - /** - * Sets the value of the poolName property. - * - * @param value - * allowed object is - * {@link String } - * - */ - public void setPoolName(String value) { - this.poolName = value; - } - - /** - * Gets the value of the poolRecordType property. - * - * @return - * possible object is - * {@link RecordType } - * - */ - public RecordType getPoolRecordType() { - return poolRecordType; - } - - /** - * Sets the value of the poolRecordType property. - * - * @param value - * allowed object is - * {@link RecordType } - * - */ - public void setPoolRecordType(RecordType value) { - this.poolRecordType = value; - } - - /** - * Gets the value of the poolRecordValue property. - * - * @return - * possible object is - * {@link String } - * - */ - public String getPoolRecordValue() { - return poolRecordValue; - } - - /** - * Sets the value of the poolRecordValue property. - * - * @param value - * allowed object is - * {@link String } - * - */ - public void setPoolRecordValue(String value) { - this.poolRecordValue = value; - } - -} diff --git a/Plugins/Mineplex.BungeeRotator/src/com/neustar/ultraservice/schema/v01/PoolRecordListParams.java b/Plugins/Mineplex.BungeeRotator/src/com/neustar/ultraservice/schema/v01/PoolRecordListParams.java deleted file mode 100644 index 22ea9256b..000000000 --- a/Plugins/Mineplex.BungeeRotator/src/com/neustar/ultraservice/schema/v01/PoolRecordListParams.java +++ /dev/null @@ -1,114 +0,0 @@ - -package com.neustar.ultraservice.schema.v01; - -import javax.xml.bind.annotation.XmlAccessType; -import javax.xml.bind.annotation.XmlAccessorType; -import javax.xml.bind.annotation.XmlType; - - -/** - *

Java class for PoolRecordListParams complex type. - * - *

The following schema fragment specifies the expected content contained within this class. - * - *

- * <complexType name="PoolRecordListParams">
- *   <complexContent>
- *     <restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
- *       <sequence>
- *         <element name="sortOrder" type="{http://schema.ultraservice.neustar.com/v01/}sortOrder" minOccurs="0"/>
- *         <element name="offset" type="{http://www.w3.org/2001/XMLSchema}int" minOccurs="0"/>
- *         <element name="limit" type="{http://www.w3.org/2001/XMLSchema}int" minOccurs="0"/>
- *       </sequence>
- *     </restriction>
- *   </complexContent>
- * </complexType>
- * 
- * - * - */ -@XmlAccessorType(XmlAccessType.FIELD) -@XmlType(name = "PoolRecordListParams", propOrder = { - "sortOrder", - "offset", - "limit" -}) -public class PoolRecordListParams { - - protected SortOrder sortOrder; - protected Integer offset; - protected Integer limit; - - /** - * Gets the value of the sortOrder property. - * - * @return - * possible object is - * {@link SortOrder } - * - */ - public SortOrder getSortOrder() { - return sortOrder; - } - - /** - * Sets the value of the sortOrder property. - * - * @param value - * allowed object is - * {@link SortOrder } - * - */ - public void setSortOrder(SortOrder value) { - this.sortOrder = value; - } - - /** - * Gets the value of the offset property. - * - * @return - * possible object is - * {@link Integer } - * - */ - public Integer getOffset() { - return offset; - } - - /** - * Sets the value of the offset property. - * - * @param value - * allowed object is - * {@link Integer } - * - */ - public void setOffset(Integer value) { - this.offset = value; - } - - /** - * Gets the value of the limit property. - * - * @return - * possible object is - * {@link Integer } - * - */ - public Integer getLimit() { - return limit; - } - - /** - * Sets the value of the limit property. - * - * @param value - * allowed object is - * {@link Integer } - * - */ - public void setLimit(Integer value) { - this.limit = value; - } - -} diff --git a/Plugins/Mineplex.BungeeRotator/src/com/neustar/ultraservice/schema/v01/PoolRecordProbeId.java b/Plugins/Mineplex.BungeeRotator/src/com/neustar/ultraservice/schema/v01/PoolRecordProbeId.java deleted file mode 100644 index 9eb6778ad..000000000 --- a/Plugins/Mineplex.BungeeRotator/src/com/neustar/ultraservice/schema/v01/PoolRecordProbeId.java +++ /dev/null @@ -1,118 +0,0 @@ - -package com.neustar.ultraservice.schema.v01; - -import javax.xml.bind.annotation.XmlAccessType; -import javax.xml.bind.annotation.XmlAccessorType; -import javax.xml.bind.annotation.XmlElement; -import javax.xml.bind.annotation.XmlType; - - -/** - *

Java class for PoolRecordProbeId complex type. - * - *

The following schema fragment specifies the expected content contained within this class. - * - *

- * <complexType name="PoolRecordProbeId">
- *   <complexContent>
- *     <restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
- *       <sequence>
- *         <element name="poolName" type="{http://www.w3.org/2001/XMLSchema}string"/>
- *         <element name="poolRecordValue" type="{http://www.w3.org/2001/XMLSchema}string"/>
- *         <element name="probeDefinitionName" type="{http://www.w3.org/2001/XMLSchema}string"/>
- *       </sequence>
- *     </restriction>
- *   </complexContent>
- * </complexType>
- * 
- * - * - */ -@XmlAccessorType(XmlAccessType.FIELD) -@XmlType(name = "PoolRecordProbeId", propOrder = { - "poolName", - "poolRecordValue", - "probeDefinitionName" -}) -public class PoolRecordProbeId { - - @XmlElement(required = true) - protected String poolName; - @XmlElement(required = true) - protected String poolRecordValue; - @XmlElement(required = true) - protected String probeDefinitionName; - - /** - * Gets the value of the poolName property. - * - * @return - * possible object is - * {@link String } - * - */ - public String getPoolName() { - return poolName; - } - - /** - * Sets the value of the poolName property. - * - * @param value - * allowed object is - * {@link String } - * - */ - public void setPoolName(String value) { - this.poolName = value; - } - - /** - * Gets the value of the poolRecordValue property. - * - * @return - * possible object is - * {@link String } - * - */ - public String getPoolRecordValue() { - return poolRecordValue; - } - - /** - * Sets the value of the poolRecordValue property. - * - * @param value - * allowed object is - * {@link String } - * - */ - public void setPoolRecordValue(String value) { - this.poolRecordValue = value; - } - - /** - * Gets the value of the probeDefinitionName property. - * - * @return - * possible object is - * {@link String } - * - */ - public String getProbeDefinitionName() { - return probeDefinitionName; - } - - /** - * Sets the value of the probeDefinitionName property. - * - * @param value - * allowed object is - * {@link String } - * - */ - public void setProbeDefinitionName(String value) { - this.probeDefinitionName = value; - } - -} diff --git a/Plugins/Mineplex.BungeeRotator/src/com/neustar/ultraservice/schema/v01/PoolRecordSpecData.java b/Plugins/Mineplex.BungeeRotator/src/com/neustar/ultraservice/schema/v01/PoolRecordSpecData.java deleted file mode 100644 index 65d067dff..000000000 --- a/Plugins/Mineplex.BungeeRotator/src/com/neustar/ultraservice/schema/v01/PoolRecordSpecData.java +++ /dev/null @@ -1,295 +0,0 @@ - -package com.neustar.ultraservice.schema.v01; - -import javax.xml.bind.annotation.XmlAccessType; -import javax.xml.bind.annotation.XmlAccessorType; -import javax.xml.bind.annotation.XmlAttribute; -import javax.xml.bind.annotation.XmlType; - - -/** - *

Java class for PoolRecordSpecData complex type. - * - *

The following schema fragment specifies the expected content contained within this class. - * - *

- * <complexType name="PoolRecordSpecData">
- *   <complexContent>
- *     <restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
- *       <sequence>
- *       </sequence>
- *       <attribute name="poolRecordID" use="required" type="{http://www.w3.org/2001/XMLSchema}string" />
- *       <attribute name="poolId" use="required" type="{http://www.w3.org/2001/XMLSchema}string" />
- *       <attribute name="description" use="required" type="{http://www.w3.org/2001/XMLSchema}string" />
- *       <attribute name="recordState" use="required" type="{http://www.w3.org/2001/XMLSchema}string" />
- *       <attribute name="probing" use="required" type="{http://www.w3.org/2001/XMLSchema}string" />
- *       <attribute name="allFail" use="required" type="{http://www.w3.org/2001/XMLSchema}string" />
- *       <attribute name="weight" use="required" type="{http://www.w3.org/2001/XMLSchema}string" />
- *       <attribute name="failOverDelay" use="required" type="{http://www.w3.org/2001/XMLSchema}long" />
- *       <attribute name="threshold" use="required" type="{http://www.w3.org/2001/XMLSchema}string" />
- *       <attribute name="ttl" use="required" type="{http://www.w3.org/2001/XMLSchema}string" />
- *     </restriction>
- *   </complexContent>
- * </complexType>
- * 
- * - * - */ -@XmlAccessorType(XmlAccessType.FIELD) -@XmlType(name = "PoolRecordSpecData") -public class PoolRecordSpecData { - - @XmlAttribute(name = "poolRecordID", required = true) - protected String poolRecordID; - @XmlAttribute(name = "poolId", required = true) - protected String poolId; - @XmlAttribute(name = "description", required = true) - protected String description; - @XmlAttribute(name = "recordState", required = true) - protected String recordState; - @XmlAttribute(name = "probing", required = true) - protected String probing; - @XmlAttribute(name = "allFail", required = true) - protected String allFail; - @XmlAttribute(name = "weight", required = true) - protected String weight; - @XmlAttribute(name = "failOverDelay", required = true) - protected long failOverDelay; - @XmlAttribute(name = "threshold", required = true) - protected String threshold; - @XmlAttribute(name = "ttl", required = true) - protected String ttl; - - /** - * Gets the value of the poolRecordID property. - * - * @return - * possible object is - * {@link String } - * - */ - public String getPoolRecordID() { - return poolRecordID; - } - - /** - * Sets the value of the poolRecordID property. - * - * @param value - * allowed object is - * {@link String } - * - */ - public void setPoolRecordID(String value) { - this.poolRecordID = value; - } - - /** - * Gets the value of the poolId property. - * - * @return - * possible object is - * {@link String } - * - */ - public String getPoolId() { - return poolId; - } - - /** - * Sets the value of the poolId property. - * - * @param value - * allowed object is - * {@link String } - * - */ - public void setPoolId(String value) { - this.poolId = value; - } - - /** - * Gets the value of the description property. - * - * @return - * possible object is - * {@link String } - * - */ - public String getDescription() { - return description; - } - - /** - * Sets the value of the description property. - * - * @param value - * allowed object is - * {@link String } - * - */ - public void setDescription(String value) { - this.description = value; - } - - /** - * Gets the value of the recordState property. - * - * @return - * possible object is - * {@link String } - * - */ - public String getRecordState() { - return recordState; - } - - /** - * Sets the value of the recordState property. - * - * @param value - * allowed object is - * {@link String } - * - */ - public void setRecordState(String value) { - this.recordState = value; - } - - /** - * Gets the value of the probing property. - * - * @return - * possible object is - * {@link String } - * - */ - public String getProbing() { - return probing; - } - - /** - * Sets the value of the probing property. - * - * @param value - * allowed object is - * {@link String } - * - */ - public void setProbing(String value) { - this.probing = value; - } - - /** - * Gets the value of the allFail property. - * - * @return - * possible object is - * {@link String } - * - */ - public String getAllFail() { - return allFail; - } - - /** - * Sets the value of the allFail property. - * - * @param value - * allowed object is - * {@link String } - * - */ - public void setAllFail(String value) { - this.allFail = value; - } - - /** - * Gets the value of the weight property. - * - * @return - * possible object is - * {@link String } - * - */ - public String getWeight() { - return weight; - } - - /** - * Sets the value of the weight property. - * - * @param value - * allowed object is - * {@link String } - * - */ - public void setWeight(String value) { - this.weight = value; - } - - /** - * Gets the value of the failOverDelay property. - * - */ - public long getFailOverDelay() { - return failOverDelay; - } - - /** - * Sets the value of the failOverDelay property. - * - */ - public void setFailOverDelay(long value) { - this.failOverDelay = value; - } - - /** - * Gets the value of the threshold property. - * - * @return - * possible object is - * {@link String } - * - */ - public String getThreshold() { - return threshold; - } - - /** - * Sets the value of the threshold property. - * - * @param value - * allowed object is - * {@link String } - * - */ - public void setThreshold(String value) { - this.threshold = value; - } - - /** - * Gets the value of the ttl property. - * - * @return - * possible object is - * {@link String } - * - */ - public String getTtl() { - return ttl; - } - - /** - * Sets the value of the ttl property. - * - * @param value - * allowed object is - * {@link String } - * - */ - public void setTtl(String value) { - this.ttl = value; - } - -} diff --git a/Plugins/Mineplex.BungeeRotator/src/com/neustar/ultraservice/schema/v01/PoolRecordType.java b/Plugins/Mineplex.BungeeRotator/src/com/neustar/ultraservice/schema/v01/PoolRecordType.java deleted file mode 100644 index 1a37596ce..000000000 --- a/Plugins/Mineplex.BungeeRotator/src/com/neustar/ultraservice/schema/v01/PoolRecordType.java +++ /dev/null @@ -1,40 +0,0 @@ - -package com.neustar.ultraservice.schema.v01; - -import javax.xml.bind.annotation.XmlEnum; -import javax.xml.bind.annotation.XmlType; - - -/** - *

Java class for PoolRecordType. - * - *

The following schema fragment specifies the expected content contained within this class. - *

- *

- * <simpleType name="PoolRecordType">
- *   <restriction base="{http://www.w3.org/2001/XMLSchema}string">
- *     <enumeration value="A"/>
- *     <enumeration value="AAAA"/>
- *     <enumeration value="SUBPOOL"/>
- *   </restriction>
- * </simpleType>
- * 
- * - */ -@XmlType(name = "PoolRecordType") -@XmlEnum -public enum PoolRecordType { - - A, - AAAA, - SUBPOOL; - - public String value() { - return name(); - } - - public static PoolRecordType fromValue(String v) { - return valueOf(v); - } - -} diff --git a/Plugins/Mineplex.BungeeRotator/src/com/neustar/ultraservice/schema/v01/PoolRecordUpdate.java b/Plugins/Mineplex.BungeeRotator/src/com/neustar/ultraservice/schema/v01/PoolRecordUpdate.java deleted file mode 100644 index 84ab8ec94..000000000 --- a/Plugins/Mineplex.BungeeRotator/src/com/neustar/ultraservice/schema/v01/PoolRecordUpdate.java +++ /dev/null @@ -1,222 +0,0 @@ - -package com.neustar.ultraservice.schema.v01; - -import javax.xml.bind.annotation.XmlAccessType; -import javax.xml.bind.annotation.XmlAccessorType; -import javax.xml.bind.annotation.XmlType; - - -/** - *

Java class for PoolRecordUpdate complex type. - * - *

The following schema fragment specifies the expected content contained within this class. - * - *

- * <complexType name="PoolRecordUpdate">
- *   <complexContent>
- *     <restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
- *       <sequence>
- *         <element name="allFail" type="{http://www.w3.org/2001/XMLSchema}boolean" minOccurs="0"/>
- *         <element name="description" type="{http://www.w3.org/2001/XMLSchema}string" minOccurs="0"/>
- *         <element name="poolRecordType" type="{http://schema.ultraservice.neustar.com/v01/}RecordType" minOccurs="0"/>
- *         <element name="poolRecordValue" type="{http://www.w3.org/2001/XMLSchema}string" minOccurs="0"/>
- *         <element name="forcedState" type="{http://schema.ultraservice.neustar.com/v01/}ForcedState" minOccurs="0"/>
- *         <element name="probesEnabled" type="{http://www.w3.org/2001/XMLSchema}boolean" minOccurs="0"/>
- *         <element name="weight" type="{http://www.w3.org/2001/XMLSchema}int" minOccurs="0"/>
- *       </sequence>
- *     </restriction>
- *   </complexContent>
- * </complexType>
- * 
- * - * - */ -@XmlAccessorType(XmlAccessType.FIELD) -@XmlType(name = "PoolRecordUpdate", propOrder = { - "allFail", - "description", - "poolRecordType", - "poolRecordValue", - "forcedState", - "probesEnabled", - "weight" -}) -public class PoolRecordUpdate { - - protected Boolean allFail; - protected String description; - protected RecordType poolRecordType; - protected String poolRecordValue; - protected ForcedState forcedState; - protected Boolean probesEnabled; - protected Integer weight; - - /** - * Gets the value of the allFail property. - * - * @return - * possible object is - * {@link Boolean } - * - */ - public Boolean isAllFail() { - return allFail; - } - - /** - * Sets the value of the allFail property. - * - * @param value - * allowed object is - * {@link Boolean } - * - */ - public void setAllFail(Boolean value) { - this.allFail = value; - } - - /** - * Gets the value of the description property. - * - * @return - * possible object is - * {@link String } - * - */ - public String getDescription() { - return description; - } - - /** - * Sets the value of the description property. - * - * @param value - * allowed object is - * {@link String } - * - */ - public void setDescription(String value) { - this.description = value; - } - - /** - * Gets the value of the poolRecordType property. - * - * @return - * possible object is - * {@link RecordType } - * - */ - public RecordType getPoolRecordType() { - return poolRecordType; - } - - /** - * Sets the value of the poolRecordType property. - * - * @param value - * allowed object is - * {@link RecordType } - * - */ - public void setPoolRecordType(RecordType value) { - this.poolRecordType = value; - } - - /** - * Gets the value of the poolRecordValue property. - * - * @return - * possible object is - * {@link String } - * - */ - public String getPoolRecordValue() { - return poolRecordValue; - } - - /** - * Sets the value of the poolRecordValue property. - * - * @param value - * allowed object is - * {@link String } - * - */ - public void setPoolRecordValue(String value) { - this.poolRecordValue = value; - } - - /** - * Gets the value of the forcedState property. - * - * @return - * possible object is - * {@link ForcedState } - * - */ - public ForcedState getForcedState() { - return forcedState; - } - - /** - * Sets the value of the forcedState property. - * - * @param value - * allowed object is - * {@link ForcedState } - * - */ - public void setForcedState(ForcedState value) { - this.forcedState = value; - } - - /** - * Gets the value of the probesEnabled property. - * - * @return - * possible object is - * {@link Boolean } - * - */ - public Boolean isProbesEnabled() { - return probesEnabled; - } - - /** - * Sets the value of the probesEnabled property. - * - * @param value - * allowed object is - * {@link Boolean } - * - */ - public void setProbesEnabled(Boolean value) { - this.probesEnabled = value; - } - - /** - * Gets the value of the weight property. - * - * @return - * possible object is - * {@link Integer } - * - */ - public Integer getWeight() { - return weight; - } - - /** - * Sets the value of the weight property. - * - * @param value - * allowed object is - * {@link Integer } - * - */ - public void setWeight(Integer value) { - this.weight = value; - } - -} diff --git a/Plugins/Mineplex.BungeeRotator/src/com/neustar/ultraservice/schema/v01/PoolRecordsList.java b/Plugins/Mineplex.BungeeRotator/src/com/neustar/ultraservice/schema/v01/PoolRecordsList.java deleted file mode 100644 index 6f582d966..000000000 --- a/Plugins/Mineplex.BungeeRotator/src/com/neustar/ultraservice/schema/v01/PoolRecordsList.java +++ /dev/null @@ -1,69 +0,0 @@ - -package com.neustar.ultraservice.schema.v01; - -import java.util.ArrayList; -import java.util.List; -import javax.xml.bind.annotation.XmlAccessType; -import javax.xml.bind.annotation.XmlAccessorType; -import javax.xml.bind.annotation.XmlElement; -import javax.xml.bind.annotation.XmlType; - - -/** - *

Java class for PoolRecordsList complex type. - * - *

The following schema fragment specifies the expected content contained within this class. - * - *

- * <complexType name="PoolRecordsList">
- *   <complexContent>
- *     <restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
- *       <sequence>
- *         <element name="PoolRecordData" type="{http://schema.ultraservice.neustar.com/v01/}PoolRecordData" maxOccurs="unbounded"/>
- *       </sequence>
- *     </restriction>
- *   </complexContent>
- * </complexType>
- * 
- * - * - */ -@XmlAccessorType(XmlAccessType.FIELD) -@XmlType(name = "PoolRecordsList", propOrder = { - "poolRecordData" -}) -public class PoolRecordsList { - - @XmlElement(name = "PoolRecordData", required = true) - protected List poolRecordData; - - /** - * Gets the value of the poolRecordData property. - * - *

- * This accessor method returns a reference to the live list, - * not a snapshot. Therefore any modification you make to the - * returned list will be present inside the JAXB object. - * This is why there is not a set method for the poolRecordData property. - * - *

- * For example, to add a new item, do as follows: - *

-     *    getPoolRecordData().add(newItem);
-     * 
- * - * - *

- * Objects of the following type(s) are allowed in the list - * {@link PoolRecordData } - * - * - */ - public List getPoolRecordData() { - if (poolRecordData == null) { - poolRecordData = new ArrayList(); - } - return this.poolRecordData; - } - -} diff --git a/Plugins/Mineplex.BungeeRotator/src/com/neustar/ultraservice/schema/v01/PoolToAcctGroupConversionDetails.java b/Plugins/Mineplex.BungeeRotator/src/com/neustar/ultraservice/schema/v01/PoolToAcctGroupConversionDetails.java deleted file mode 100644 index 9accf3bbe..000000000 --- a/Plugins/Mineplex.BungeeRotator/src/com/neustar/ultraservice/schema/v01/PoolToAcctGroupConversionDetails.java +++ /dev/null @@ -1,87 +0,0 @@ - -package com.neustar.ultraservice.schema.v01; - -import javax.xml.bind.annotation.XmlAccessType; -import javax.xml.bind.annotation.XmlAccessorType; -import javax.xml.bind.annotation.XmlAttribute; -import javax.xml.bind.annotation.XmlType; - - -/** - *

Java class for PoolToAcctGroupConversionDetails complex type. - * - *

The following schema fragment specifies the expected content contained within this class. - * - *

- * <complexType name="PoolToAcctGroupConversionDetails">
- *   <complexContent>
- *     <restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
- *       <sequence>
- *       </sequence>
- *       <attribute name="poolGroupId" use="required" type="{http://www.w3.org/2001/XMLSchema}string" />
- *       <attribute name="newGroupName" use="required" type="{http://www.w3.org/2001/XMLSchema}string" />
- *     </restriction>
- *   </complexContent>
- * </complexType>
- * 
- * - * - */ -@XmlAccessorType(XmlAccessType.FIELD) -@XmlType(name = "PoolToAcctGroupConversionDetails") -public class PoolToAcctGroupConversionDetails { - - @XmlAttribute(name = "poolGroupId", required = true) - protected String poolGroupId; - @XmlAttribute(name = "newGroupName", required = true) - protected String newGroupName; - - /** - * Gets the value of the poolGroupId property. - * - * @return - * possible object is - * {@link String } - * - */ - public String getPoolGroupId() { - return poolGroupId; - } - - /** - * Sets the value of the poolGroupId property. - * - * @param value - * allowed object is - * {@link String } - * - */ - public void setPoolGroupId(String value) { - this.poolGroupId = value; - } - - /** - * Gets the value of the newGroupName property. - * - * @return - * possible object is - * {@link String } - * - */ - public String getNewGroupName() { - return newGroupName; - } - - /** - * Sets the value of the newGroupName property. - * - * @param value - * allowed object is - * {@link String } - * - */ - public void setNewGroupName(String value) { - this.newGroupName = value; - } - -} diff --git a/Plugins/Mineplex.BungeeRotator/src/com/neustar/ultraservice/schema/v01/PoolUpdate.java b/Plugins/Mineplex.BungeeRotator/src/com/neustar/ultraservice/schema/v01/PoolUpdate.java deleted file mode 100644 index c00fe2ca8..000000000 --- a/Plugins/Mineplex.BungeeRotator/src/com/neustar/ultraservice/schema/v01/PoolUpdate.java +++ /dev/null @@ -1,60 +0,0 @@ - -package com.neustar.ultraservice.schema.v01; - -import javax.xml.bind.annotation.XmlAccessType; -import javax.xml.bind.annotation.XmlAccessorType; -import javax.xml.bind.annotation.XmlType; - - -/** - *

Java class for PoolUpdate complex type. - * - *

The following schema fragment specifies the expected content contained within this class. - * - *

- * <complexType name="PoolUpdate">
- *   <complexContent>
- *     <restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
- *       <sequence>
- *         <element name="description" type="{http://www.w3.org/2001/XMLSchema}string" minOccurs="0"/>
- *       </sequence>
- *     </restriction>
- *   </complexContent>
- * </complexType>
- * 
- * - * - */ -@XmlAccessorType(XmlAccessType.FIELD) -@XmlType(name = "PoolUpdate", propOrder = { - "description" -}) -public class PoolUpdate { - - protected String description; - - /** - * Gets the value of the description property. - * - * @return - * possible object is - * {@link String } - * - */ - public String getDescription() { - return description; - } - - /** - * Sets the value of the description property. - * - * @param value - * allowed object is - * {@link String } - * - */ - public void setDescription(String value) { - this.description = value; - } - -} diff --git a/Plugins/Mineplex.BungeeRotator/src/com/neustar/ultraservice/schema/v01/PrioritizedRecord.java b/Plugins/Mineplex.BungeeRotator/src/com/neustar/ultraservice/schema/v01/PrioritizedRecord.java deleted file mode 100644 index 33d3fd676..000000000 --- a/Plugins/Mineplex.BungeeRotator/src/com/neustar/ultraservice/schema/v01/PrioritizedRecord.java +++ /dev/null @@ -1,87 +0,0 @@ - -package com.neustar.ultraservice.schema.v01; - -import javax.xml.bind.annotation.XmlAccessType; -import javax.xml.bind.annotation.XmlAccessorType; -import javax.xml.bind.annotation.XmlAttribute; -import javax.xml.bind.annotation.XmlType; - - -/** - *

Java class for PrioritizedRecord complex type. - * - *

The following schema fragment specifies the expected content contained within this class. - * - *

- * <complexType name="PrioritizedRecord">
- *   <complexContent>
- *     <restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
- *       <sequence>
- *       </sequence>
- *       <attribute name="record" use="required" type="{http://www.w3.org/2001/XMLSchema}string" />
- *       <attribute name="type" use="required" type="{http://schema.ultraservice.neustar.com/v01/}RecordType" />
- *     </restriction>
- *   </complexContent>
- * </complexType>
- * 
- * - * - */ -@XmlAccessorType(XmlAccessType.FIELD) -@XmlType(name = "PrioritizedRecord") -public class PrioritizedRecord { - - @XmlAttribute(name = "record", required = true) - protected String record; - @XmlAttribute(name = "type", required = true) - protected RecordType type; - - /** - * Gets the value of the record property. - * - * @return - * possible object is - * {@link String } - * - */ - public String getRecord() { - return record; - } - - /** - * Sets the value of the record property. - * - * @param value - * allowed object is - * {@link String } - * - */ - public void setRecord(String value) { - this.record = value; - } - - /** - * Gets the value of the type property. - * - * @return - * possible object is - * {@link RecordType } - * - */ - public RecordType getType() { - return type; - } - - /** - * Sets the value of the type property. - * - * @param value - * allowed object is - * {@link RecordType } - * - */ - public void setType(RecordType value) { - this.type = value; - } - -} diff --git a/Plugins/Mineplex.BungeeRotator/src/com/neustar/ultraservice/schema/v01/PrioritizedRecordList.java b/Plugins/Mineplex.BungeeRotator/src/com/neustar/ultraservice/schema/v01/PrioritizedRecordList.java deleted file mode 100644 index 960b5641c..000000000 --- a/Plugins/Mineplex.BungeeRotator/src/com/neustar/ultraservice/schema/v01/PrioritizedRecordList.java +++ /dev/null @@ -1,69 +0,0 @@ - -package com.neustar.ultraservice.schema.v01; - -import java.util.ArrayList; -import java.util.List; -import javax.xml.bind.annotation.XmlAccessType; -import javax.xml.bind.annotation.XmlAccessorType; -import javax.xml.bind.annotation.XmlElement; -import javax.xml.bind.annotation.XmlType; - - -/** - *

Java class for PrioritizedRecordList complex type. - * - *

The following schema fragment specifies the expected content contained within this class. - * - *

- * <complexType name="PrioritizedRecordList">
- *   <complexContent>
- *     <restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
- *       <sequence>
- *         <element name="prioritizedRecord" type="{http://schema.ultraservice.neustar.com/v01/}PrioritizedRecord" maxOccurs="unbounded"/>
- *       </sequence>
- *     </restriction>
- *   </complexContent>
- * </complexType>
- * 
- * - * - */ -@XmlAccessorType(XmlAccessType.FIELD) -@XmlType(name = "PrioritizedRecordList", propOrder = { - "prioritizedRecord" -}) -public class PrioritizedRecordList { - - @XmlElement(required = true) - protected List prioritizedRecord; - - /** - * Gets the value of the prioritizedRecord property. - * - *

- * This accessor method returns a reference to the live list, - * not a snapshot. Therefore any modification you make to the - * returned list will be present inside the JAXB object. - * This is why there is not a set method for the prioritizedRecord property. - * - *

- * For example, to add a new item, do as follows: - *

-     *    getPrioritizedRecord().add(newItem);
-     * 
- * - * - *

- * Objects of the following type(s) are allowed in the list - * {@link PrioritizedRecord } - * - * - */ - public List getPrioritizedRecord() { - if (prioritizedRecord == null) { - prioritizedRecord = new ArrayList(); - } - return this.prioritizedRecord; - } - -} diff --git a/Plugins/Mineplex.BungeeRotator/src/com/neustar/ultraservice/schema/v01/PrioritizedRecordsList.java b/Plugins/Mineplex.BungeeRotator/src/com/neustar/ultraservice/schema/v01/PrioritizedRecordsList.java deleted file mode 100644 index 5b9df04cc..000000000 --- a/Plugins/Mineplex.BungeeRotator/src/com/neustar/ultraservice/schema/v01/PrioritizedRecordsList.java +++ /dev/null @@ -1,69 +0,0 @@ - -package com.neustar.ultraservice.schema.v01; - -import java.util.ArrayList; -import java.util.List; -import javax.xml.bind.annotation.XmlAccessType; -import javax.xml.bind.annotation.XmlAccessorType; -import javax.xml.bind.annotation.XmlElement; -import javax.xml.bind.annotation.XmlType; - - -/** - *

Java class for PrioritizedRecordsList complex type. - * - *

The following schema fragment specifies the expected content contained within this class. - * - *

- * <complexType name="PrioritizedRecordsList">
- *   <complexContent>
- *     <restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
- *       <sequence>
- *         <element name="prioritizedRecord" type="{http://schema.ultraservice.neustar.com/v01/}AlertPrioritizedRecord" maxOccurs="unbounded"/>
- *       </sequence>
- *     </restriction>
- *   </complexContent>
- * </complexType>
- * 
- * - * - */ -@XmlAccessorType(XmlAccessType.FIELD) -@XmlType(name = "PrioritizedRecordsList", propOrder = { - "prioritizedRecord" -}) -public class PrioritizedRecordsList { - - @XmlElement(required = true) - protected List prioritizedRecord; - - /** - * Gets the value of the prioritizedRecord property. - * - *

- * This accessor method returns a reference to the live list, - * not a snapshot. Therefore any modification you make to the - * returned list will be present inside the JAXB object. - * This is why there is not a set method for the prioritizedRecord property. - * - *

- * For example, to add a new item, do as follows: - *

-     *    getPrioritizedRecord().add(newItem);
-     * 
- * - * - *

- * Objects of the following type(s) are allowed in the list - * {@link AlertPrioritizedRecord } - * - * - */ - public List getPrioritizedRecord() { - if (prioritizedRecord == null) { - prioritizedRecord = new ArrayList(); - } - return this.prioritizedRecord; - } - -} diff --git a/Plugins/Mineplex.BungeeRotator/src/com/neustar/ultraservice/schema/v01/Probe.java b/Plugins/Mineplex.BungeeRotator/src/com/neustar/ultraservice/schema/v01/Probe.java deleted file mode 100644 index 2316c56dc..000000000 --- a/Plugins/Mineplex.BungeeRotator/src/com/neustar/ultraservice/schema/v01/Probe.java +++ /dev/null @@ -1,109 +0,0 @@ - -package com.neustar.ultraservice.schema.v01; - -import javax.xml.bind.annotation.XmlAccessType; -import javax.xml.bind.annotation.XmlAccessorType; -import javax.xml.bind.annotation.XmlElement; -import javax.xml.bind.annotation.XmlType; - - -/** - *

Java class for Probe complex type. - * - *

The following schema fragment specifies the expected content contained within this class. - * - *

- * <complexType name="Probe">
- *   <complexContent>
- *     <restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
- *       <sequence>
- *         <element name="probeDefinitionName" type="{http://www.w3.org/2001/XMLSchema}string"/>
- *         <element name="regionThreshold" type="{http://www.w3.org/2001/XMLSchema}int"/>
- *         <element name="regions" type="{http://schema.ultraservice.neustar.com/v01/}ProbeRegions"/>
- *       </sequence>
- *     </restriction>
- *   </complexContent>
- * </complexType>
- * 
- * - * - */ -@XmlAccessorType(XmlAccessType.FIELD) -@XmlType(name = "Probe", propOrder = { - "probeDefinitionName", - "regionThreshold", - "regions" -}) -public class Probe { - - @XmlElement(required = true) - protected String probeDefinitionName; - protected int regionThreshold; - @XmlElement(required = true) - protected ProbeRegions regions; - - /** - * Gets the value of the probeDefinitionName property. - * - * @return - * possible object is - * {@link String } - * - */ - public String getProbeDefinitionName() { - return probeDefinitionName; - } - - /** - * Sets the value of the probeDefinitionName property. - * - * @param value - * allowed object is - * {@link String } - * - */ - public void setProbeDefinitionName(String value) { - this.probeDefinitionName = value; - } - - /** - * Gets the value of the regionThreshold property. - * - */ - public int getRegionThreshold() { - return regionThreshold; - } - - /** - * Sets the value of the regionThreshold property. - * - */ - public void setRegionThreshold(int value) { - this.regionThreshold = value; - } - - /** - * Gets the value of the regions property. - * - * @return - * possible object is - * {@link ProbeRegions } - * - */ - public ProbeRegions getRegions() { - return regions; - } - - /** - * Sets the value of the regions property. - * - * @param value - * allowed object is - * {@link ProbeRegions } - * - */ - public void setRegions(ProbeRegions value) { - this.regions = value; - } - -} diff --git a/Plugins/Mineplex.BungeeRotator/src/com/neustar/ultraservice/schema/v01/ProbeAlertsData.java b/Plugins/Mineplex.BungeeRotator/src/com/neustar/ultraservice/schema/v01/ProbeAlertsData.java deleted file mode 100644 index 3d564245d..000000000 --- a/Plugins/Mineplex.BungeeRotator/src/com/neustar/ultraservice/schema/v01/ProbeAlertsData.java +++ /dev/null @@ -1,222 +0,0 @@ - -package com.neustar.ultraservice.schema.v01; - -import javax.xml.bind.annotation.XmlAccessType; -import javax.xml.bind.annotation.XmlAccessorType; -import javax.xml.bind.annotation.XmlAttribute; -import javax.xml.bind.annotation.XmlType; - - -/** - *

Java class for ProbeAlertsData complex type. - * - *

The following schema fragment specifies the expected content contained within this class. - * - *

- * <complexType name="ProbeAlertsData">
- *   <complexContent>
- *     <restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
- *       <sequence>
- *       </sequence>
- *       <attribute name="IpAddress" type="{http://www.w3.org/2001/XMLSchema}string" />
- *       <attribute name="ProbeType" type="{http://www.w3.org/2001/XMLSchema}string" />
- *       <attribute name="ProbeStatus" type="{http://www.w3.org/2001/XMLSchema}string" />
- *       <attribute name="AlertDate" type="{http://www.w3.org/2001/XMLSchema}string" />
- *       <attribute name="FailOverOccured" type="{http://www.w3.org/2001/XMLSchema}string" />
- *       <attribute name="PoolDName" type="{http://www.w3.org/2001/XMLSchema}string" />
- *       <attribute name="Status" type="{http://www.w3.org/2001/XMLSchema}string" />
- *     </restriction>
- *   </complexContent>
- * </complexType>
- * 
- * - * - */ -@XmlAccessorType(XmlAccessType.FIELD) -@XmlType(name = "ProbeAlertsData") -public class ProbeAlertsData { - - @XmlAttribute(name = "IpAddress") - protected String ipAddress; - @XmlAttribute(name = "ProbeType") - protected String probeType; - @XmlAttribute(name = "ProbeStatus") - protected String probeStatus; - @XmlAttribute(name = "AlertDate") - protected String alertDate; - @XmlAttribute(name = "FailOverOccured") - protected String failOverOccured; - @XmlAttribute(name = "PoolDName") - protected String poolDName; - @XmlAttribute(name = "Status") - protected String status; - - /** - * Gets the value of the ipAddress property. - * - * @return - * possible object is - * {@link String } - * - */ - public String getIpAddress() { - return ipAddress; - } - - /** - * Sets the value of the ipAddress property. - * - * @param value - * allowed object is - * {@link String } - * - */ - public void setIpAddress(String value) { - this.ipAddress = value; - } - - /** - * Gets the value of the probeType property. - * - * @return - * possible object is - * {@link String } - * - */ - public String getProbeType() { - return probeType; - } - - /** - * Sets the value of the probeType property. - * - * @param value - * allowed object is - * {@link String } - * - */ - public void setProbeType(String value) { - this.probeType = value; - } - - /** - * Gets the value of the probeStatus property. - * - * @return - * possible object is - * {@link String } - * - */ - public String getProbeStatus() { - return probeStatus; - } - - /** - * Sets the value of the probeStatus property. - * - * @param value - * allowed object is - * {@link String } - * - */ - public void setProbeStatus(String value) { - this.probeStatus = value; - } - - /** - * Gets the value of the alertDate property. - * - * @return - * possible object is - * {@link String } - * - */ - public String getAlertDate() { - return alertDate; - } - - /** - * Sets the value of the alertDate property. - * - * @param value - * allowed object is - * {@link String } - * - */ - public void setAlertDate(String value) { - this.alertDate = value; - } - - /** - * Gets the value of the failOverOccured property. - * - * @return - * possible object is - * {@link String } - * - */ - public String getFailOverOccured() { - return failOverOccured; - } - - /** - * Sets the value of the failOverOccured property. - * - * @param value - * allowed object is - * {@link String } - * - */ - public void setFailOverOccured(String value) { - this.failOverOccured = value; - } - - /** - * Gets the value of the poolDName property. - * - * @return - * possible object is - * {@link String } - * - */ - public String getPoolDName() { - return poolDName; - } - - /** - * Sets the value of the poolDName property. - * - * @param value - * allowed object is - * {@link String } - * - */ - public void setPoolDName(String value) { - this.poolDName = value; - } - - /** - * Gets the value of the status property. - * - * @return - * possible object is - * {@link String } - * - */ - public String getStatus() { - return status; - } - - /** - * Sets the value of the status property. - * - * @param value - * allowed object is - * {@link String } - * - */ - public void setStatus(String value) { - this.status = value; - } - -} diff --git a/Plugins/Mineplex.BungeeRotator/src/com/neustar/ultraservice/schema/v01/ProbeAlertsList.java b/Plugins/Mineplex.BungeeRotator/src/com/neustar/ultraservice/schema/v01/ProbeAlertsList.java deleted file mode 100644 index c0b09246b..000000000 --- a/Plugins/Mineplex.BungeeRotator/src/com/neustar/ultraservice/schema/v01/ProbeAlertsList.java +++ /dev/null @@ -1,69 +0,0 @@ - -package com.neustar.ultraservice.schema.v01; - -import java.util.ArrayList; -import java.util.List; -import javax.xml.bind.annotation.XmlAccessType; -import javax.xml.bind.annotation.XmlAccessorType; -import javax.xml.bind.annotation.XmlElement; -import javax.xml.bind.annotation.XmlType; - - -/** - *

Java class for ProbeAlertsList complex type. - * - *

The following schema fragment specifies the expected content contained within this class. - * - *

- * <complexType name="ProbeAlertsList">
- *   <complexContent>
- *     <restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
- *       <sequence>
- *         <element name="ProbeAlertsData" type="{http://schema.ultraservice.neustar.com/v01/}ProbeAlertsData" maxOccurs="unbounded"/>
- *       </sequence>
- *     </restriction>
- *   </complexContent>
- * </complexType>
- * 
- * - * - */ -@XmlAccessorType(XmlAccessType.FIELD) -@XmlType(name = "ProbeAlertsList", propOrder = { - "probeAlertsData" -}) -public class ProbeAlertsList { - - @XmlElement(name = "ProbeAlertsData", required = true) - protected List probeAlertsData; - - /** - * Gets the value of the probeAlertsData property. - * - *

- * This accessor method returns a reference to the live list, - * not a snapshot. Therefore any modification you make to the - * returned list will be present inside the JAXB object. - * This is why there is not a set method for the probeAlertsData property. - * - *

- * For example, to add a new item, do as follows: - *

-     *    getProbeAlertsData().add(newItem);
-     * 
- * - * - *

- * Objects of the following type(s) are allowed in the list - * {@link ProbeAlertsData } - * - * - */ - public List getProbeAlertsData() { - if (probeAlertsData == null) { - probeAlertsData = new ArrayList(); - } - return this.probeAlertsData; - } - -} diff --git a/Plugins/Mineplex.BungeeRotator/src/com/neustar/ultraservice/schema/v01/ProbeData.java b/Plugins/Mineplex.BungeeRotator/src/com/neustar/ultraservice/schema/v01/ProbeData.java deleted file mode 100644 index 9d7cbb31e..000000000 --- a/Plugins/Mineplex.BungeeRotator/src/com/neustar/ultraservice/schema/v01/ProbeData.java +++ /dev/null @@ -1,411 +0,0 @@ - -package com.neustar.ultraservice.schema.v01; - -import javax.xml.bind.annotation.XmlAccessType; -import javax.xml.bind.annotation.XmlAccessorType; -import javax.xml.bind.annotation.XmlAttribute; -import javax.xml.bind.annotation.XmlType; - - -/** - *

Java class for ProbeData complex type. - * - *

The following schema fragment specifies the expected content contained within this class. - * - *

- * <complexType name="ProbeData">
- *   <complexContent>
- *     <restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
- *       <sequence>
- *       </sequence>
- *       <attribute name="PoolProbeId" use="required" type="{http://www.w3.org/2001/XMLSchema}string" />
- *       <attribute name="PoolId" use="required" type="{http://www.w3.org/2001/XMLSchema}string" />
- *       <attribute name="SbprecordId" use="required" type="{http://www.w3.org/2001/XMLSchema}string" />
- *       <attribute name="Active" use="required" type="{http://www.w3.org/2001/XMLSchema}string" />
- *       <attribute name="ProbeDataType" use="required" type="{http://www.w3.org/2001/XMLSchema}string" />
- *       <attribute name="ProbeID" use="required" type="{http://www.w3.org/2001/XMLSchema}string" />
- *       <attribute name="ProbeName" use="required" type="{http://www.w3.org/2001/XMLSchema}string" />
- *       <attribute name="Bleid" use="required" type="{http://www.w3.org/2001/XMLSchema}string" />
- *       <attribute name="ProbeWeight" use="required" type="{http://www.w3.org/2001/XMLSchema}string" />
- *       <attribute name="probedata" use="required" type="{http://www.w3.org/2001/XMLSchema}string" />
- *       <attribute name="probefailspecs" use="required" type="{http://www.w3.org/2001/XMLSchema}string" />
- *       <attribute name="agentfailspecs" use="required" type="{http://www.w3.org/2001/XMLSchema}string" />
- *       <attribute name="threshold" use="required" type="{http://www.w3.org/2001/XMLSchema}string" />
- *       <attribute name="interval" use="required" type="{http://www.w3.org/2001/XMLSchema}string" />
- *     </restriction>
- *   </complexContent>
- * </complexType>
- * 
- * - * - */ -@XmlAccessorType(XmlAccessType.FIELD) -@XmlType(name = "ProbeData") -public class ProbeData { - - @XmlAttribute(name = "PoolProbeId", required = true) - protected String poolProbeId; - @XmlAttribute(name = "PoolId", required = true) - protected String poolId; - @XmlAttribute(name = "SbprecordId", required = true) - protected String sbprecordId; - @XmlAttribute(name = "Active", required = true) - protected String active; - @XmlAttribute(name = "ProbeDataType", required = true) - protected String probeDataType; - @XmlAttribute(name = "ProbeID", required = true) - protected String probeID; - @XmlAttribute(name = "ProbeName", required = true) - protected String probeName; - @XmlAttribute(name = "Bleid", required = true) - protected String bleid; - @XmlAttribute(name = "ProbeWeight", required = true) - protected String probeWeight; - @XmlAttribute(name = "probedata", required = true) - protected String probedata; - @XmlAttribute(name = "probefailspecs", required = true) - protected String probefailspecs; - @XmlAttribute(name = "agentfailspecs", required = true) - protected String agentfailspecs; - @XmlAttribute(name = "threshold", required = true) - protected String threshold; - @XmlAttribute(name = "interval", required = true) - protected String interval; - - /** - * Gets the value of the poolProbeId property. - * - * @return - * possible object is - * {@link String } - * - */ - public String getPoolProbeId() { - return poolProbeId; - } - - /** - * Sets the value of the poolProbeId property. - * - * @param value - * allowed object is - * {@link String } - * - */ - public void setPoolProbeId(String value) { - this.poolProbeId = value; - } - - /** - * Gets the value of the poolId property. - * - * @return - * possible object is - * {@link String } - * - */ - public String getPoolId() { - return poolId; - } - - /** - * Sets the value of the poolId property. - * - * @param value - * allowed object is - * {@link String } - * - */ - public void setPoolId(String value) { - this.poolId = value; - } - - /** - * Gets the value of the sbprecordId property. - * - * @return - * possible object is - * {@link String } - * - */ - public String getSbprecordId() { - return sbprecordId; - } - - /** - * Sets the value of the sbprecordId property. - * - * @param value - * allowed object is - * {@link String } - * - */ - public void setSbprecordId(String value) { - this.sbprecordId = value; - } - - /** - * Gets the value of the active property. - * - * @return - * possible object is - * {@link String } - * - */ - public String getActive() { - return active; - } - - /** - * Sets the value of the active property. - * - * @param value - * allowed object is - * {@link String } - * - */ - public void setActive(String value) { - this.active = value; - } - - /** - * Gets the value of the probeDataType property. - * - * @return - * possible object is - * {@link String } - * - */ - public String getProbeDataType() { - return probeDataType; - } - - /** - * Sets the value of the probeDataType property. - * - * @param value - * allowed object is - * {@link String } - * - */ - public void setProbeDataType(String value) { - this.probeDataType = value; - } - - /** - * Gets the value of the probeID property. - * - * @return - * possible object is - * {@link String } - * - */ - public String getProbeID() { - return probeID; - } - - /** - * Sets the value of the probeID property. - * - * @param value - * allowed object is - * {@link String } - * - */ - public void setProbeID(String value) { - this.probeID = value; - } - - /** - * Gets the value of the probeName property. - * - * @return - * possible object is - * {@link String } - * - */ - public String getProbeName() { - return probeName; - } - - /** - * Sets the value of the probeName property. - * - * @param value - * allowed object is - * {@link String } - * - */ - public void setProbeName(String value) { - this.probeName = value; - } - - /** - * Gets the value of the bleid property. - * - * @return - * possible object is - * {@link String } - * - */ - public String getBleid() { - return bleid; - } - - /** - * Sets the value of the bleid property. - * - * @param value - * allowed object is - * {@link String } - * - */ - public void setBleid(String value) { - this.bleid = value; - } - - /** - * Gets the value of the probeWeight property. - * - * @return - * possible object is - * {@link String } - * - */ - public String getProbeWeight() { - return probeWeight; - } - - /** - * Sets the value of the probeWeight property. - * - * @param value - * allowed object is - * {@link String } - * - */ - public void setProbeWeight(String value) { - this.probeWeight = value; - } - - /** - * Gets the value of the probedata property. - * - * @return - * possible object is - * {@link String } - * - */ - public String getProbedata() { - return probedata; - } - - /** - * Sets the value of the probedata property. - * - * @param value - * allowed object is - * {@link String } - * - */ - public void setProbedata(String value) { - this.probedata = value; - } - - /** - * Gets the value of the probefailspecs property. - * - * @return - * possible object is - * {@link String } - * - */ - public String getProbefailspecs() { - return probefailspecs; - } - - /** - * Sets the value of the probefailspecs property. - * - * @param value - * allowed object is - * {@link String } - * - */ - public void setProbefailspecs(String value) { - this.probefailspecs = value; - } - - /** - * Gets the value of the agentfailspecs property. - * - * @return - * possible object is - * {@link String } - * - */ - public String getAgentfailspecs() { - return agentfailspecs; - } - - /** - * Sets the value of the agentfailspecs property. - * - * @param value - * allowed object is - * {@link String } - * - */ - public void setAgentfailspecs(String value) { - this.agentfailspecs = value; - } - - /** - * Gets the value of the threshold property. - * - * @return - * possible object is - * {@link String } - * - */ - public String getThreshold() { - return threshold; - } - - /** - * Sets the value of the threshold property. - * - * @param value - * allowed object is - * {@link String } - * - */ - public void setThreshold(String value) { - this.threshold = value; - } - - /** - * Gets the value of the interval property. - * - * @return - * possible object is - * {@link String } - * - */ - public String getInterval() { - return interval; - } - - /** - * Sets the value of the interval property. - * - * @param value - * allowed object is - * {@link String } - * - */ - public void setInterval(String value) { - this.interval = value; - } - -} diff --git a/Plugins/Mineplex.BungeeRotator/src/com/neustar/ultraservice/schema/v01/ProbeDefinition.java b/Plugins/Mineplex.BungeeRotator/src/com/neustar/ultraservice/schema/v01/ProbeDefinition.java deleted file mode 100644 index f022539c7..000000000 --- a/Plugins/Mineplex.BungeeRotator/src/com/neustar/ultraservice/schema/v01/ProbeDefinition.java +++ /dev/null @@ -1,109 +0,0 @@ - -package com.neustar.ultraservice.schema.v01; - -import javax.xml.bind.annotation.XmlAccessType; -import javax.xml.bind.annotation.XmlAccessorType; -import javax.xml.bind.annotation.XmlElement; -import javax.xml.bind.annotation.XmlType; - - -/** - *

Java class for ProbeDefinition complex type. - * - *

The following schema fragment specifies the expected content contained within this class. - * - *

- * <complexType name="ProbeDefinition">
- *   <complexContent>
- *     <restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
- *       <sequence>
- *         <element name="name" type="{http://www.w3.org/2001/XMLSchema}string"/>
- *         <element name="interval" type="{http://www.w3.org/2001/XMLSchema}int"/>
- *         <element name="transactions" type="{http://schema.ultraservice.neustar.com/v01/}ProbeDefinitionTransactions"/>
- *       </sequence>
- *     </restriction>
- *   </complexContent>
- * </complexType>
- * 
- * - * - */ -@XmlAccessorType(XmlAccessType.FIELD) -@XmlType(name = "ProbeDefinition", propOrder = { - "name", - "interval", - "transactions" -}) -public class ProbeDefinition { - - @XmlElement(required = true) - protected String name; - protected int interval; - @XmlElement(required = true) - protected ProbeDefinitionTransactions transactions; - - /** - * Gets the value of the name property. - * - * @return - * possible object is - * {@link String } - * - */ - public String getName() { - return name; - } - - /** - * Sets the value of the name property. - * - * @param value - * allowed object is - * {@link String } - * - */ - public void setName(String value) { - this.name = value; - } - - /** - * Gets the value of the interval property. - * - */ - public int getInterval() { - return interval; - } - - /** - * Sets the value of the interval property. - * - */ - public void setInterval(int value) { - this.interval = value; - } - - /** - * Gets the value of the transactions property. - * - * @return - * possible object is - * {@link ProbeDefinitionTransactions } - * - */ - public ProbeDefinitionTransactions getTransactions() { - return transactions; - } - - /** - * Sets the value of the transactions property. - * - * @param value - * allowed object is - * {@link ProbeDefinitionTransactions } - * - */ - public void setTransactions(ProbeDefinitionTransactions value) { - this.transactions = value; - } - -} diff --git a/Plugins/Mineplex.BungeeRotator/src/com/neustar/ultraservice/schema/v01/ProbeDefinitionHttpTransactions.java b/Plugins/Mineplex.BungeeRotator/src/com/neustar/ultraservice/schema/v01/ProbeDefinitionHttpTransactions.java deleted file mode 100644 index c936f3131..000000000 --- a/Plugins/Mineplex.BungeeRotator/src/com/neustar/ultraservice/schema/v01/ProbeDefinitionHttpTransactions.java +++ /dev/null @@ -1,69 +0,0 @@ - -package com.neustar.ultraservice.schema.v01; - -import java.util.ArrayList; -import java.util.List; -import javax.xml.bind.annotation.XmlAccessType; -import javax.xml.bind.annotation.XmlAccessorType; -import javax.xml.bind.annotation.XmlElement; -import javax.xml.bind.annotation.XmlType; - - -/** - *

Java class for ProbeDefinitionHttpTransactions complex type. - * - *

The following schema fragment specifies the expected content contained within this class. - * - *

- * <complexType name="ProbeDefinitionHttpTransactions">
- *   <complexContent>
- *     <restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
- *       <sequence>
- *         <element name="httpTransaction" type="{http://schema.ultraservice.neustar.com/v01/}HTTPTransaction" maxOccurs="unbounded"/>
- *       </sequence>
- *     </restriction>
- *   </complexContent>
- * </complexType>
- * 
- * - * - */ -@XmlAccessorType(XmlAccessType.FIELD) -@XmlType(name = "ProbeDefinitionHttpTransactions", propOrder = { - "httpTransaction" -}) -public class ProbeDefinitionHttpTransactions { - - @XmlElement(required = true) - protected List httpTransaction; - - /** - * Gets the value of the httpTransaction property. - * - *

- * This accessor method returns a reference to the live list, - * not a snapshot. Therefore any modification you make to the - * returned list will be present inside the JAXB object. - * This is why there is not a set method for the httpTransaction property. - * - *

- * For example, to add a new item, do as follows: - *

-     *    getHttpTransaction().add(newItem);
-     * 
- * - * - *

- * Objects of the following type(s) are allowed in the list - * {@link HTTPTransaction } - * - * - */ - public List getHttpTransaction() { - if (httpTransaction == null) { - httpTransaction = new ArrayList(); - } - return this.httpTransaction; - } - -} diff --git a/Plugins/Mineplex.BungeeRotator/src/com/neustar/ultraservice/schema/v01/ProbeDefinitionId.java b/Plugins/Mineplex.BungeeRotator/src/com/neustar/ultraservice/schema/v01/ProbeDefinitionId.java deleted file mode 100644 index c1ec27673..000000000 --- a/Plugins/Mineplex.BungeeRotator/src/com/neustar/ultraservice/schema/v01/ProbeDefinitionId.java +++ /dev/null @@ -1,90 +0,0 @@ - -package com.neustar.ultraservice.schema.v01; - -import javax.xml.bind.annotation.XmlAccessType; -import javax.xml.bind.annotation.XmlAccessorType; -import javax.xml.bind.annotation.XmlElement; -import javax.xml.bind.annotation.XmlType; - - -/** - *

Java class for ProbeDefinitionId complex type. - * - *

The following schema fragment specifies the expected content contained within this class. - * - *

- * <complexType name="ProbeDefinitionId">
- *   <complexContent>
- *     <restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
- *       <sequence>
- *         <element name="accountName" type="{http://www.w3.org/2001/XMLSchema}string"/>
- *         <element name="name" type="{http://www.w3.org/2001/XMLSchema}string"/>
- *       </sequence>
- *     </restriction>
- *   </complexContent>
- * </complexType>
- * 
- * - * - */ -@XmlAccessorType(XmlAccessType.FIELD) -@XmlType(name = "ProbeDefinitionId", propOrder = { - "accountName", - "name" -}) -public class ProbeDefinitionId { - - @XmlElement(required = true) - protected String accountName; - @XmlElement(required = true) - protected String name; - - /** - * Gets the value of the accountName property. - * - * @return - * possible object is - * {@link String } - * - */ - public String getAccountName() { - return accountName; - } - - /** - * Sets the value of the accountName property. - * - * @param value - * allowed object is - * {@link String } - * - */ - public void setAccountName(String value) { - this.accountName = value; - } - - /** - * Gets the value of the name property. - * - * @return - * possible object is - * {@link String } - * - */ - public String getName() { - return name; - } - - /** - * Sets the value of the name property. - * - * @param value - * allowed object is - * {@link String } - * - */ - public void setName(String value) { - this.name = value; - } - -} diff --git a/Plugins/Mineplex.BungeeRotator/src/com/neustar/ultraservice/schema/v01/ProbeDefinitionList.java b/Plugins/Mineplex.BungeeRotator/src/com/neustar/ultraservice/schema/v01/ProbeDefinitionList.java deleted file mode 100644 index bb9225b6e..000000000 --- a/Plugins/Mineplex.BungeeRotator/src/com/neustar/ultraservice/schema/v01/ProbeDefinitionList.java +++ /dev/null @@ -1,69 +0,0 @@ - -package com.neustar.ultraservice.schema.v01; - -import java.util.ArrayList; -import java.util.List; -import javax.xml.bind.annotation.XmlAccessType; -import javax.xml.bind.annotation.XmlAccessorType; -import javax.xml.bind.annotation.XmlElement; -import javax.xml.bind.annotation.XmlType; - - -/** - *

Java class for ProbeDefinitionList complex type. - * - *

The following schema fragment specifies the expected content contained within this class. - * - *

- * <complexType name="ProbeDefinitionList">
- *   <complexContent>
- *     <restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
- *       <sequence>
- *         <element name="probeDefinition" type="{http://schema.ultraservice.neustar.com/v01/}ProbeDefinition" maxOccurs="unbounded"/>
- *       </sequence>
- *     </restriction>
- *   </complexContent>
- * </complexType>
- * 
- * - * - */ -@XmlAccessorType(XmlAccessType.FIELD) -@XmlType(name = "ProbeDefinitionList", propOrder = { - "probeDefinition" -}) -public class ProbeDefinitionList { - - @XmlElement(required = true) - protected List probeDefinition; - - /** - * Gets the value of the probeDefinition property. - * - *

- * This accessor method returns a reference to the live list, - * not a snapshot. Therefore any modification you make to the - * returned list will be present inside the JAXB object. - * This is why there is not a set method for the probeDefinition property. - * - *

- * For example, to add a new item, do as follows: - *

-     *    getProbeDefinition().add(newItem);
-     * 
- * - * - *

- * Objects of the following type(s) are allowed in the list - * {@link ProbeDefinition } - * - * - */ - public List getProbeDefinition() { - if (probeDefinition == null) { - probeDefinition = new ArrayList(); - } - return this.probeDefinition; - } - -} diff --git a/Plugins/Mineplex.BungeeRotator/src/com/neustar/ultraservice/schema/v01/ProbeDefinitionTransactions.java b/Plugins/Mineplex.BungeeRotator/src/com/neustar/ultraservice/schema/v01/ProbeDefinitionTransactions.java deleted file mode 100644 index 9c2d57da4..000000000 --- a/Plugins/Mineplex.BungeeRotator/src/com/neustar/ultraservice/schema/v01/ProbeDefinitionTransactions.java +++ /dev/null @@ -1,222 +0,0 @@ - -package com.neustar.ultraservice.schema.v01; - -import javax.xml.bind.annotation.XmlAccessType; -import javax.xml.bind.annotation.XmlAccessorType; -import javax.xml.bind.annotation.XmlType; - - -/** - *

Java class for ProbeDefinitionTransactions complex type. - * - *

The following schema fragment specifies the expected content contained within this class. - * - *

- * <complexType name="ProbeDefinitionTransactions">
- *   <complexContent>
- *     <restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
- *       <sequence>
- *         <element name="httpTransactions" type="{http://schema.ultraservice.neustar.com/v01/}ProbeDefinitionHttpTransactions" minOccurs="0"/>
- *         <element name="dnsTransaction" type="{http://schema.ultraservice.neustar.com/v01/}DNSTransaction" minOccurs="0"/>
- *         <element name="pingTransaction" type="{http://schema.ultraservice.neustar.com/v01/}PINGTransaction" minOccurs="0"/>
- *         <element name="tcpTransaction" type="{http://schema.ultraservice.neustar.com/v01/}TCPTransaction" minOccurs="0"/>
- *         <element name="ftpTransaction" type="{http://schema.ultraservice.neustar.com/v01/}FTPTransaction" minOccurs="0"/>
- *         <element name="smtpTransaction" type="{http://schema.ultraservice.neustar.com/v01/}SMTPTransaction" minOccurs="0"/>
- *         <element name="smtp2Transaction" type="{http://schema.ultraservice.neustar.com/v01/}SMTP2Transaction" minOccurs="0"/>
- *       </sequence>
- *     </restriction>
- *   </complexContent>
- * </complexType>
- * 
- * - * - */ -@XmlAccessorType(XmlAccessType.FIELD) -@XmlType(name = "ProbeDefinitionTransactions", propOrder = { - "httpTransactions", - "dnsTransaction", - "pingTransaction", - "tcpTransaction", - "ftpTransaction", - "smtpTransaction", - "smtp2Transaction" -}) -public class ProbeDefinitionTransactions { - - protected ProbeDefinitionHttpTransactions httpTransactions; - protected DNSTransaction dnsTransaction; - protected PINGTransaction pingTransaction; - protected TCPTransaction tcpTransaction; - protected FTPTransaction ftpTransaction; - protected SMTPTransaction smtpTransaction; - protected SMTP2Transaction smtp2Transaction; - - /** - * Gets the value of the httpTransactions property. - * - * @return - * possible object is - * {@link ProbeDefinitionHttpTransactions } - * - */ - public ProbeDefinitionHttpTransactions getHttpTransactions() { - return httpTransactions; - } - - /** - * Sets the value of the httpTransactions property. - * - * @param value - * allowed object is - * {@link ProbeDefinitionHttpTransactions } - * - */ - public void setHttpTransactions(ProbeDefinitionHttpTransactions value) { - this.httpTransactions = value; - } - - /** - * Gets the value of the dnsTransaction property. - * - * @return - * possible object is - * {@link DNSTransaction } - * - */ - public DNSTransaction getDnsTransaction() { - return dnsTransaction; - } - - /** - * Sets the value of the dnsTransaction property. - * - * @param value - * allowed object is - * {@link DNSTransaction } - * - */ - public void setDnsTransaction(DNSTransaction value) { - this.dnsTransaction = value; - } - - /** - * Gets the value of the pingTransaction property. - * - * @return - * possible object is - * {@link PINGTransaction } - * - */ - public PINGTransaction getPingTransaction() { - return pingTransaction; - } - - /** - * Sets the value of the pingTransaction property. - * - * @param value - * allowed object is - * {@link PINGTransaction } - * - */ - public void setPingTransaction(PINGTransaction value) { - this.pingTransaction = value; - } - - /** - * Gets the value of the tcpTransaction property. - * - * @return - * possible object is - * {@link TCPTransaction } - * - */ - public TCPTransaction getTcpTransaction() { - return tcpTransaction; - } - - /** - * Sets the value of the tcpTransaction property. - * - * @param value - * allowed object is - * {@link TCPTransaction } - * - */ - public void setTcpTransaction(TCPTransaction value) { - this.tcpTransaction = value; - } - - /** - * Gets the value of the ftpTransaction property. - * - * @return - * possible object is - * {@link FTPTransaction } - * - */ - public FTPTransaction getFtpTransaction() { - return ftpTransaction; - } - - /** - * Sets the value of the ftpTransaction property. - * - * @param value - * allowed object is - * {@link FTPTransaction } - * - */ - public void setFtpTransaction(FTPTransaction value) { - this.ftpTransaction = value; - } - - /** - * Gets the value of the smtpTransaction property. - * - * @return - * possible object is - * {@link SMTPTransaction } - * - */ - public SMTPTransaction getSmtpTransaction() { - return smtpTransaction; - } - - /** - * Sets the value of the smtpTransaction property. - * - * @param value - * allowed object is - * {@link SMTPTransaction } - * - */ - public void setSmtpTransaction(SMTPTransaction value) { - this.smtpTransaction = value; - } - - /** - * Gets the value of the smtp2Transaction property. - * - * @return - * possible object is - * {@link SMTP2Transaction } - * - */ - public SMTP2Transaction getSmtp2Transaction() { - return smtp2Transaction; - } - - /** - * Sets the value of the smtp2Transaction property. - * - * @param value - * allowed object is - * {@link SMTP2Transaction } - * - */ - public void setSmtp2Transaction(SMTP2Transaction value) { - this.smtp2Transaction = value; - } - -} diff --git a/Plugins/Mineplex.BungeeRotator/src/com/neustar/ultraservice/schema/v01/ProbeIndexes.java b/Plugins/Mineplex.BungeeRotator/src/com/neustar/ultraservice/schema/v01/ProbeIndexes.java deleted file mode 100644 index 06c58fb18..000000000 --- a/Plugins/Mineplex.BungeeRotator/src/com/neustar/ultraservice/schema/v01/ProbeIndexes.java +++ /dev/null @@ -1,42 +0,0 @@ - -package com.neustar.ultraservice.schema.v01; - -import javax.xml.bind.annotation.XmlEnum; -import javax.xml.bind.annotation.XmlType; - - -/** - *

Java class for probeIndexes. - * - *

The following schema fragment specifies the expected content contained within this class. - *

- *

- * <simpleType name="probeIndexes">
- *   <restriction base="{http://www.w3.org/2001/XMLSchema}string">
- *     <enumeration value="PROBE_LEVEL"/>
- *     <enumeration value="NAME"/>
- *     <enumeration value="TYPE"/>
- *     <enumeration value="INTERVAL"/>
- *   </restriction>
- * </simpleType>
- * 
- * - */ -@XmlType(name = "probeIndexes") -@XmlEnum -public enum ProbeIndexes { - - PROBE_LEVEL, - NAME, - TYPE, - INTERVAL; - - public String value() { - return name(); - } - - public static ProbeIndexes fromValue(String v) { - return valueOf(v); - } - -} diff --git a/Plugins/Mineplex.BungeeRotator/src/com/neustar/ultraservice/schema/v01/ProbeInfo.java b/Plugins/Mineplex.BungeeRotator/src/com/neustar/ultraservice/schema/v01/ProbeInfo.java deleted file mode 100644 index afa77ec3e..000000000 --- a/Plugins/Mineplex.BungeeRotator/src/com/neustar/ultraservice/schema/v01/ProbeInfo.java +++ /dev/null @@ -1,118 +0,0 @@ - -package com.neustar.ultraservice.schema.v01; - -import javax.xml.bind.annotation.XmlAccessType; -import javax.xml.bind.annotation.XmlAccessorType; -import javax.xml.bind.annotation.XmlElement; -import javax.xml.bind.annotation.XmlType; - - -/** - *

Java class for ProbeInfo complex type. - * - *

The following schema fragment specifies the expected content contained within this class. - * - *

- * <complexType name="ProbeInfo">
- *   <complexContent>
- *     <restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
- *       <sequence>
- *         <element name="ProbeData" type="{http://schema.ultraservice.neustar.com/v01/}ProbeData"/>
- *         <element name="SBAgentsList" type="{http://schema.ultraservice.neustar.com/v01/}SBAgentsList"/>
- *         <element name="DNSProbeMaster" type="{http://schema.ultraservice.neustar.com/v01/}DNSProbeMaster"/>
- *       </sequence>
- *     </restriction>
- *   </complexContent>
- * </complexType>
- * 
- * - * - */ -@XmlAccessorType(XmlAccessType.FIELD) -@XmlType(name = "ProbeInfo", propOrder = { - "probeData", - "sbAgentsList", - "dnsProbeMaster" -}) -public class ProbeInfo { - - @XmlElement(name = "ProbeData", required = true) - protected ProbeData probeData; - @XmlElement(name = "SBAgentsList", required = true) - protected SBAgentsList sbAgentsList; - @XmlElement(name = "DNSProbeMaster", required = true) - protected DNSProbeMaster dnsProbeMaster; - - /** - * Gets the value of the probeData property. - * - * @return - * possible object is - * {@link ProbeData } - * - */ - public ProbeData getProbeData() { - return probeData; - } - - /** - * Sets the value of the probeData property. - * - * @param value - * allowed object is - * {@link ProbeData } - * - */ - public void setProbeData(ProbeData value) { - this.probeData = value; - } - - /** - * Gets the value of the sbAgentsList property. - * - * @return - * possible object is - * {@link SBAgentsList } - * - */ - public SBAgentsList getSBAgentsList() { - return sbAgentsList; - } - - /** - * Sets the value of the sbAgentsList property. - * - * @param value - * allowed object is - * {@link SBAgentsList } - * - */ - public void setSBAgentsList(SBAgentsList value) { - this.sbAgentsList = value; - } - - /** - * Gets the value of the dnsProbeMaster property. - * - * @return - * possible object is - * {@link DNSProbeMaster } - * - */ - public DNSProbeMaster getDNSProbeMaster() { - return dnsProbeMaster; - } - - /** - * Sets the value of the dnsProbeMaster property. - * - * @param value - * allowed object is - * {@link DNSProbeMaster } - * - */ - public void setDNSProbeMaster(DNSProbeMaster value) { - this.dnsProbeMaster = value; - } - -} diff --git a/Plugins/Mineplex.BungeeRotator/src/com/neustar/ultraservice/schema/v01/ProbeInfo2.java b/Plugins/Mineplex.BungeeRotator/src/com/neustar/ultraservice/schema/v01/ProbeInfo2.java deleted file mode 100644 index 5ac49b729..000000000 --- a/Plugins/Mineplex.BungeeRotator/src/com/neustar/ultraservice/schema/v01/ProbeInfo2.java +++ /dev/null @@ -1,174 +0,0 @@ - -package com.neustar.ultraservice.schema.v01; - -import javax.xml.bind.JAXBElement; -import javax.xml.bind.annotation.XmlAccessType; -import javax.xml.bind.annotation.XmlAccessorType; -import javax.xml.bind.annotation.XmlElement; -import javax.xml.bind.annotation.XmlElementRef; -import javax.xml.bind.annotation.XmlType; - - -/** - *

Java class for probeInfo complex type. - * - *

The following schema fragment specifies the expected content contained within this class. - * - *

- * <complexType name="probeInfo">
- *   <complexContent>
- *     <restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
- *       <sequence>
- *         <element name="description" type="{http://www.w3.org/2001/XMLSchema}string" minOccurs="0"/>
- *         <element name="allFailRecord" type="{http://schema.ultraservice.neustar.com/v01/}MonitoredRDPoolRecordAdd" minOccurs="0"/>
- *         <element name="ttl" type="{http://www.w3.org/2001/XMLSchema}long" minOccurs="0"/>
- *         <element name="monitor" type="{http://schema.ultraservice.neustar.com/v01/}MonitoredRDPoolMonitor"/>
- *         <element name="regionThreshold" type="{http://schema.ultraservice.neustar.com/v01/}simpleFailoverPoolRegionThreshold"/>
- *       </sequence>
- *     </restriction>
- *   </complexContent>
- * </complexType>
- * 
- * - * - */ -@XmlAccessorType(XmlAccessType.FIELD) -@XmlType(name = "probeInfo", propOrder = { - "description", - "allFailRecord", - "ttl", - "monitor", - "regionThreshold" -}) -public class ProbeInfo2 { - - protected String description; - protected MonitoredRDPoolRecordAdd allFailRecord; - @XmlElementRef(name = "ttl", namespace = "http://schema.ultraservice.neustar.com/v01/", type = JAXBElement.class) - protected JAXBElement ttl; - @XmlElement(required = true) - protected MonitoredRDPoolMonitor monitor; - @XmlElement(required = true) - protected SimpleFailoverPoolRegionThreshold regionThreshold; - - /** - * Gets the value of the description property. - * - * @return - * possible object is - * {@link String } - * - */ - public String getDescription() { - return description; - } - - /** - * Sets the value of the description property. - * - * @param value - * allowed object is - * {@link String } - * - */ - public void setDescription(String value) { - this.description = value; - } - - /** - * Gets the value of the allFailRecord property. - * - * @return - * possible object is - * {@link MonitoredRDPoolRecordAdd } - * - */ - public MonitoredRDPoolRecordAdd getAllFailRecord() { - return allFailRecord; - } - - /** - * Sets the value of the allFailRecord property. - * - * @param value - * allowed object is - * {@link MonitoredRDPoolRecordAdd } - * - */ - public void setAllFailRecord(MonitoredRDPoolRecordAdd value) { - this.allFailRecord = value; - } - - /** - * Gets the value of the ttl property. - * - * @return - * possible object is - * {@link JAXBElement }{@code <}{@link Long }{@code >} - * - */ - public JAXBElement getTtl() { - return ttl; - } - - /** - * Sets the value of the ttl property. - * - * @param value - * allowed object is - * {@link JAXBElement }{@code <}{@link Long }{@code >} - * - */ - public void setTtl(JAXBElement value) { - this.ttl = value; - } - - /** - * Gets the value of the monitor property. - * - * @return - * possible object is - * {@link MonitoredRDPoolMonitor } - * - */ - public MonitoredRDPoolMonitor getMonitor() { - return monitor; - } - - /** - * Sets the value of the monitor property. - * - * @param value - * allowed object is - * {@link MonitoredRDPoolMonitor } - * - */ - public void setMonitor(MonitoredRDPoolMonitor value) { - this.monitor = value; - } - - /** - * Gets the value of the regionThreshold property. - * - * @return - * possible object is - * {@link SimpleFailoverPoolRegionThreshold } - * - */ - public SimpleFailoverPoolRegionThreshold getRegionThreshold() { - return regionThreshold; - } - - /** - * Sets the value of the regionThreshold property. - * - * @param value - * allowed object is - * {@link SimpleFailoverPoolRegionThreshold } - * - */ - public void setRegionThreshold(SimpleFailoverPoolRegionThreshold value) { - this.regionThreshold = value; - } - -} diff --git a/Plugins/Mineplex.BungeeRotator/src/com/neustar/ultraservice/schema/v01/ProbeListParams.java b/Plugins/Mineplex.BungeeRotator/src/com/neustar/ultraservice/schema/v01/ProbeListParams.java deleted file mode 100644 index 69ecdb27f..000000000 --- a/Plugins/Mineplex.BungeeRotator/src/com/neustar/ultraservice/schema/v01/ProbeListParams.java +++ /dev/null @@ -1,141 +0,0 @@ - -package com.neustar.ultraservice.schema.v01; - -import javax.xml.bind.annotation.XmlAccessType; -import javax.xml.bind.annotation.XmlAccessorType; -import javax.xml.bind.annotation.XmlType; - - -/** - *

Java class for ProbeListParams complex type. - * - *

The following schema fragment specifies the expected content contained within this class. - * - *

- * <complexType name="ProbeListParams">
- *   <complexContent>
- *     <restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
- *       <sequence>
- *         <element name="sortBy" type="{http://schema.ultraservice.neustar.com/v01/}probeIndexes" minOccurs="0"/>
- *         <element name="sortOrder" type="{http://schema.ultraservice.neustar.com/v01/}sortOrder" minOccurs="0"/>
- *         <element name="offset" type="{http://www.w3.org/2001/XMLSchema}int" minOccurs="0"/>
- *         <element name="limit" type="{http://www.w3.org/2001/XMLSchema}int" minOccurs="0"/>
- *       </sequence>
- *     </restriction>
- *   </complexContent>
- * </complexType>
- * 
- * - * - */ -@XmlAccessorType(XmlAccessType.FIELD) -@XmlType(name = "ProbeListParams", propOrder = { - "sortBy", - "sortOrder", - "offset", - "limit" -}) -public class ProbeListParams { - - protected ProbeIndexes sortBy; - protected SortOrder sortOrder; - protected Integer offset; - protected Integer limit; - - /** - * Gets the value of the sortBy property. - * - * @return - * possible object is - * {@link ProbeIndexes } - * - */ - public ProbeIndexes getSortBy() { - return sortBy; - } - - /** - * Sets the value of the sortBy property. - * - * @param value - * allowed object is - * {@link ProbeIndexes } - * - */ - public void setSortBy(ProbeIndexes value) { - this.sortBy = value; - } - - /** - * Gets the value of the sortOrder property. - * - * @return - * possible object is - * {@link SortOrder } - * - */ - public SortOrder getSortOrder() { - return sortOrder; - } - - /** - * Sets the value of the sortOrder property. - * - * @param value - * allowed object is - * {@link SortOrder } - * - */ - public void setSortOrder(SortOrder value) { - this.sortOrder = value; - } - - /** - * Gets the value of the offset property. - * - * @return - * possible object is - * {@link Integer } - * - */ - public Integer getOffset() { - return offset; - } - - /** - * Sets the value of the offset property. - * - * @param value - * allowed object is - * {@link Integer } - * - */ - public void setOffset(Integer value) { - this.offset = value; - } - - /** - * Gets the value of the limit property. - * - * @return - * possible object is - * {@link Integer } - * - */ - public Integer getLimit() { - return limit; - } - - /** - * Sets the value of the limit property. - * - * @param value - * allowed object is - * {@link Integer } - * - */ - public void setLimit(Integer value) { - this.limit = value; - } - -} diff --git a/Plugins/Mineplex.BungeeRotator/src/com/neustar/ultraservice/schema/v01/ProbeRegion.java b/Plugins/Mineplex.BungeeRotator/src/com/neustar/ultraservice/schema/v01/ProbeRegion.java deleted file mode 100644 index d7e416fe5..000000000 --- a/Plugins/Mineplex.BungeeRotator/src/com/neustar/ultraservice/schema/v01/ProbeRegion.java +++ /dev/null @@ -1,87 +0,0 @@ - -package com.neustar.ultraservice.schema.v01; - -import javax.xml.bind.annotation.XmlAccessType; -import javax.xml.bind.annotation.XmlAccessorType; -import javax.xml.bind.annotation.XmlAttribute; -import javax.xml.bind.annotation.XmlType; - - -/** - *

Java class for ProbeRegion complex type. - * - *

The following schema fragment specifies the expected content contained within this class. - * - *

- * <complexType name="ProbeRegion">
- *   <complexContent>
- *     <restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
- *       <sequence>
- *       </sequence>
- *       <attribute name="Description" use="required" type="{http://www.w3.org/2001/XMLSchema}string" />
- *       <attribute name="Name" use="required" type="{http://www.w3.org/2001/XMLSchema}string" />
- *     </restriction>
- *   </complexContent>
- * </complexType>
- * 
- * - * - */ -@XmlAccessorType(XmlAccessType.FIELD) -@XmlType(name = "ProbeRegion") -public class ProbeRegion { - - @XmlAttribute(name = "Description", required = true) - protected String description; - @XmlAttribute(name = "Name", required = true) - protected String name; - - /** - * Gets the value of the description property. - * - * @return - * possible object is - * {@link String } - * - */ - public String getDescription() { - return description; - } - - /** - * Sets the value of the description property. - * - * @param value - * allowed object is - * {@link String } - * - */ - public void setDescription(String value) { - this.description = value; - } - - /** - * Gets the value of the name property. - * - * @return - * possible object is - * {@link String } - * - */ - public String getName() { - return name; - } - - /** - * Sets the value of the name property. - * - * @param value - * allowed object is - * {@link String } - * - */ - public void setName(String value) { - this.name = value; - } - -} diff --git a/Plugins/Mineplex.BungeeRotator/src/com/neustar/ultraservice/schema/v01/ProbeRegionList.java b/Plugins/Mineplex.BungeeRotator/src/com/neustar/ultraservice/schema/v01/ProbeRegionList.java deleted file mode 100644 index d460bc8e2..000000000 --- a/Plugins/Mineplex.BungeeRotator/src/com/neustar/ultraservice/schema/v01/ProbeRegionList.java +++ /dev/null @@ -1,69 +0,0 @@ - -package com.neustar.ultraservice.schema.v01; - -import java.util.ArrayList; -import java.util.List; -import javax.xml.bind.annotation.XmlAccessType; -import javax.xml.bind.annotation.XmlAccessorType; -import javax.xml.bind.annotation.XmlElement; -import javax.xml.bind.annotation.XmlType; - - -/** - *

Java class for ProbeRegionList complex type. - * - *

The following schema fragment specifies the expected content contained within this class. - * - *

- * <complexType name="ProbeRegionList">
- *   <complexContent>
- *     <restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
- *       <sequence>
- *         <element name="ProbeRegion" type="{http://schema.ultraservice.neustar.com/v01/}ProbeRegion" maxOccurs="unbounded"/>
- *       </sequence>
- *     </restriction>
- *   </complexContent>
- * </complexType>
- * 
- * - * - */ -@XmlAccessorType(XmlAccessType.FIELD) -@XmlType(name = "ProbeRegionList", propOrder = { - "probeRegion" -}) -public class ProbeRegionList { - - @XmlElement(name = "ProbeRegion", required = true) - protected List probeRegion; - - /** - * Gets the value of the probeRegion property. - * - *

- * This accessor method returns a reference to the live list, - * not a snapshot. Therefore any modification you make to the - * returned list will be present inside the JAXB object. - * This is why there is not a set method for the probeRegion property. - * - *

- * For example, to add a new item, do as follows: - *

-     *    getProbeRegion().add(newItem);
-     * 
- * - * - *

- * Objects of the following type(s) are allowed in the list - * {@link ProbeRegion } - * - * - */ - public List getProbeRegion() { - if (probeRegion == null) { - probeRegion = new ArrayList(); - } - return this.probeRegion; - } - -} diff --git a/Plugins/Mineplex.BungeeRotator/src/com/neustar/ultraservice/schema/v01/ProbeRegions.java b/Plugins/Mineplex.BungeeRotator/src/com/neustar/ultraservice/schema/v01/ProbeRegions.java deleted file mode 100644 index d58ae726f..000000000 --- a/Plugins/Mineplex.BungeeRotator/src/com/neustar/ultraservice/schema/v01/ProbeRegions.java +++ /dev/null @@ -1,69 +0,0 @@ - -package com.neustar.ultraservice.schema.v01; - -import java.util.ArrayList; -import java.util.List; -import javax.xml.bind.annotation.XmlAccessType; -import javax.xml.bind.annotation.XmlAccessorType; -import javax.xml.bind.annotation.XmlElement; -import javax.xml.bind.annotation.XmlType; - - -/** - *

Java class for ProbeRegions complex type. - * - *

The following schema fragment specifies the expected content contained within this class. - * - *

- * <complexType name="ProbeRegions">
- *   <complexContent>
- *     <restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
- *       <sequence>
- *         <element name="region" type="{http://www.w3.org/2001/XMLSchema}string" maxOccurs="unbounded"/>
- *       </sequence>
- *     </restriction>
- *   </complexContent>
- * </complexType>
- * 
- * - * - */ -@XmlAccessorType(XmlAccessType.FIELD) -@XmlType(name = "ProbeRegions", propOrder = { - "region" -}) -public class ProbeRegions { - - @XmlElement(required = true) - protected List region; - - /** - * Gets the value of the region property. - * - *

- * This accessor method returns a reference to the live list, - * not a snapshot. Therefore any modification you make to the - * returned list will be present inside the JAXB object. - * This is why there is not a set method for the region property. - * - *

- * For example, to add a new item, do as follows: - *

-     *    getRegion().add(newItem);
-     * 
- * - * - *

- * Objects of the following type(s) are allowed in the list - * {@link String } - * - * - */ - public List getRegion() { - if (region == null) { - region = new ArrayList(); - } - return this.region; - } - -} diff --git a/Plugins/Mineplex.BungeeRotator/src/com/neustar/ultraservice/schema/v01/ProbeType.java b/Plugins/Mineplex.BungeeRotator/src/com/neustar/ultraservice/schema/v01/ProbeType.java deleted file mode 100644 index 12e920540..000000000 --- a/Plugins/Mineplex.BungeeRotator/src/com/neustar/ultraservice/schema/v01/ProbeType.java +++ /dev/null @@ -1,54 +0,0 @@ - -package com.neustar.ultraservice.schema.v01; - -import javax.xml.bind.annotation.XmlEnum; -import javax.xml.bind.annotation.XmlEnumValue; -import javax.xml.bind.annotation.XmlType; - - -/** - *

Java class for probeType. - * - *

The following schema fragment specifies the expected content contained within this class. - *

- *

- * <simpleType name="probeType">
- *   <restriction base="{http://www.w3.org/2001/XMLSchema}string">
- *     <enumeration value="global"/>
- *     <enumeration value="record"/>
- *     <enumeration value="all"/>
- *   </restriction>
- * </simpleType>
- * 
- * - */ -@XmlType(name = "probeType") -@XmlEnum -public enum ProbeType { - - @XmlEnumValue("global") - GLOBAL("global"), - @XmlEnumValue("record") - RECORD("record"), - @XmlEnumValue("all") - ALL("all"); - private final String value; - - ProbeType(String v) { - value = v; - } - - public String value() { - return value; - } - - public static ProbeType fromValue(String v) { - for (ProbeType c: ProbeType.values()) { - if (c.value.equals(v)) { - return c; - } - } - throw new IllegalArgumentException(v); - } - -} diff --git a/Plugins/Mineplex.BungeeRotator/src/com/neustar/ultraservice/schema/v01/ProbeTypeEnum.java b/Plugins/Mineplex.BungeeRotator/src/com/neustar/ultraservice/schema/v01/ProbeTypeEnum.java deleted file mode 100644 index f23aaea6e..000000000 --- a/Plugins/Mineplex.BungeeRotator/src/com/neustar/ultraservice/schema/v01/ProbeTypeEnum.java +++ /dev/null @@ -1,60 +0,0 @@ - -package com.neustar.ultraservice.schema.v01; - -import javax.xml.bind.annotation.XmlEnum; -import javax.xml.bind.annotation.XmlEnumValue; -import javax.xml.bind.annotation.XmlType; - - -/** - *

Java class for ProbeTypeEnum. - * - *

The following schema fragment specifies the expected content contained within this class. - *

- *

- * <simpleType name="ProbeTypeEnum">
- *   <restriction base="{http://www.w3.org/2001/XMLSchema}string">
- *     <enumeration value="HTTP"/>
- *     <enumeration value="PING"/>
- *     <enumeration value="FTP"/>
- *     <enumeration value="TCP"/>
- *     <enumeration value="SMTP"/>
- *     <enumeration value="SMTP2"/>
- *     <enumeration value="DNS"/>
- *   </restriction>
- * </simpleType>
- * 
- * - */ -@XmlType(name = "ProbeTypeEnum") -@XmlEnum -public enum ProbeTypeEnum { - - HTTP("HTTP"), - PING("PING"), - FTP("FTP"), - TCP("TCP"), - SMTP("SMTP"), - @XmlEnumValue("SMTP2") - SMTP_2("SMTP2"), - DNS("DNS"); - private final String value; - - ProbeTypeEnum(String v) { - value = v; - } - - public String value() { - return value; - } - - public static ProbeTypeEnum fromValue(String v) { - for (ProbeTypeEnum c: ProbeTypeEnum.values()) { - if (c.value.equals(v)) { - return c; - } - } - throw new IllegalArgumentException(v); - } - -} diff --git a/Plugins/Mineplex.BungeeRotator/src/com/neustar/ultraservice/schema/v01/ProbesList.java b/Plugins/Mineplex.BungeeRotator/src/com/neustar/ultraservice/schema/v01/ProbesList.java deleted file mode 100644 index b3b649217..000000000 --- a/Plugins/Mineplex.BungeeRotator/src/com/neustar/ultraservice/schema/v01/ProbesList.java +++ /dev/null @@ -1,69 +0,0 @@ - -package com.neustar.ultraservice.schema.v01; - -import java.util.ArrayList; -import java.util.List; -import javax.xml.bind.annotation.XmlAccessType; -import javax.xml.bind.annotation.XmlAccessorType; -import javax.xml.bind.annotation.XmlElement; -import javax.xml.bind.annotation.XmlType; - - -/** - *

Java class for ProbesList complex type. - * - *

The following schema fragment specifies the expected content contained within this class. - * - *

- * <complexType name="ProbesList">
- *   <complexContent>
- *     <restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
- *       <sequence>
- *         <element name="ProbeData" type="{http://schema.ultraservice.neustar.com/v01/}ProbeData" maxOccurs="unbounded"/>
- *       </sequence>
- *     </restriction>
- *   </complexContent>
- * </complexType>
- * 
- * - * - */ -@XmlAccessorType(XmlAccessType.FIELD) -@XmlType(name = "ProbesList", propOrder = { - "probeData" -}) -public class ProbesList { - - @XmlElement(name = "ProbeData", required = true) - protected List probeData; - - /** - * Gets the value of the probeData property. - * - *

- * This accessor method returns a reference to the live list, - * not a snapshot. Therefore any modification you make to the - * returned list will be present inside the JAXB object. - * This is why there is not a set method for the probeData property. - * - *

- * For example, to add a new item, do as follows: - *

-     *    getProbeData().add(newItem);
-     * 
- * - * - *

- * Objects of the following type(s) are allowed in the list - * {@link ProbeData } - * - * - */ - public List getProbeData() { - if (probeData == null) { - probeData = new ArrayList(); - } - return this.probeData; - } - -} diff --git a/Plugins/Mineplex.BungeeRotator/src/com/neustar/ultraservice/schema/v01/Protocol.java b/Plugins/Mineplex.BungeeRotator/src/com/neustar/ultraservice/schema/v01/Protocol.java deleted file mode 100644 index 7f10fe142..000000000 --- a/Plugins/Mineplex.BungeeRotator/src/com/neustar/ultraservice/schema/v01/Protocol.java +++ /dev/null @@ -1,51 +0,0 @@ - -package com.neustar.ultraservice.schema.v01; - -import javax.xml.bind.annotation.XmlEnum; -import javax.xml.bind.annotation.XmlEnumValue; -import javax.xml.bind.annotation.XmlType; - - -/** - *

Java class for protocol. - * - *

The following schema fragment specifies the expected content contained within this class. - *

- *

- * <simpleType name="protocol">
- *   <restriction base="{http://www.w3.org/2001/XMLSchema}string">
- *     <enumeration value="http"/>
- *     <enumeration value="https"/>
- *   </restriction>
- * </simpleType>
- * 
- * - */ -@XmlType(name = "protocol") -@XmlEnum -public enum Protocol { - - @XmlEnumValue("http") - HTTP("http"), - @XmlEnumValue("https") - HTTPS("https"); - private final String value; - - Protocol(String v) { - value = v; - } - - public String value() { - return value; - } - - public static Protocol fromValue(String v) { - for (Protocol c: Protocol.values()) { - if (c.value.equals(v)) { - return c; - } - } - throw new IllegalArgumentException(v); - } - -} diff --git a/Plugins/Mineplex.BungeeRotator/src/com/neustar/ultraservice/schema/v01/RDPoolConversionInfo.java b/Plugins/Mineplex.BungeeRotator/src/com/neustar/ultraservice/schema/v01/RDPoolConversionInfo.java deleted file mode 100644 index 4d83905ee..000000000 --- a/Plugins/Mineplex.BungeeRotator/src/com/neustar/ultraservice/schema/v01/RDPoolConversionInfo.java +++ /dev/null @@ -1,173 +0,0 @@ - -package com.neustar.ultraservice.schema.v01; - -import javax.xml.bind.annotation.XmlAccessType; -import javax.xml.bind.annotation.XmlAccessorType; -import javax.xml.bind.annotation.XmlElement; -import javax.xml.bind.annotation.XmlType; -import com.neustar.ultra.api.webservice.v01.ConvertTypeEnum; - - -/** - *

Java class for rDPoolConversionInfo complex type. - * - *

The following schema fragment specifies the expected content contained within this class. - * - *

- * <complexType name="rDPoolConversionInfo">
- *   <complexContent>
- *     <restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
- *       <sequence>
- *         <element name="zoneName" type="{http://www.w3.org/2001/XMLSchema}string"/>
- *         <element name="hostName" type="{http://www.w3.org/2001/XMLSchema}string"/>
- *         <element name="conversionType" type="{http://webservice.api.ultra.neustar.com/v01/}convertTypeEnum"/>
- *         <element name="recordToKeep" type="{http://www.w3.org/2001/XMLSchema}string" minOccurs="0"/>
- *         <element name="probeInfo" type="{http://schema.ultraservice.neustar.com/v01/}probeInfo" minOccurs="0"/>
- *       </sequence>
- *     </restriction>
- *   </complexContent>
- * </complexType>
- * 
- * - * - */ -@XmlAccessorType(XmlAccessType.FIELD) -@XmlType(name = "rDPoolConversionInfo", propOrder = { - "zoneName", - "hostName", - "conversionType", - "recordToKeep", - "probeInfo" -}) -public class RDPoolConversionInfo { - - @XmlElement(required = true) - protected String zoneName; - @XmlElement(required = true) - protected String hostName; - @XmlElement(required = true) - protected ConvertTypeEnum conversionType; - protected String recordToKeep; - protected ProbeInfo2 probeInfo; - - /** - * Gets the value of the zoneName property. - * - * @return - * possible object is - * {@link String } - * - */ - public String getZoneName() { - return zoneName; - } - - /** - * Sets the value of the zoneName property. - * - * @param value - * allowed object is - * {@link String } - * - */ - public void setZoneName(String value) { - this.zoneName = value; - } - - /** - * Gets the value of the hostName property. - * - * @return - * possible object is - * {@link String } - * - */ - public String getHostName() { - return hostName; - } - - /** - * Sets the value of the hostName property. - * - * @param value - * allowed object is - * {@link String } - * - */ - public void setHostName(String value) { - this.hostName = value; - } - - /** - * Gets the value of the conversionType property. - * - * @return - * possible object is - * {@link ConvertTypeEnum } - * - */ - public ConvertTypeEnum getConversionType() { - return conversionType; - } - - /** - * Sets the value of the conversionType property. - * - * @param value - * allowed object is - * {@link ConvertTypeEnum } - * - */ - public void setConversionType(ConvertTypeEnum value) { - this.conversionType = value; - } - - /** - * Gets the value of the recordToKeep property. - * - * @return - * possible object is - * {@link String } - * - */ - public String getRecordToKeep() { - return recordToKeep; - } - - /** - * Sets the value of the recordToKeep property. - * - * @param value - * allowed object is - * {@link String } - * - */ - public void setRecordToKeep(String value) { - this.recordToKeep = value; - } - - /** - * Gets the value of the probeInfo property. - * - * @return - * possible object is - * {@link ProbeInfo2 } - * - */ - public ProbeInfo2 getProbeInfo() { - return probeInfo; - } - - /** - * Sets the value of the probeInfo property. - * - * @param value - * allowed object is - * {@link ProbeInfo2 } - * - */ - public void setProbeInfo(ProbeInfo2 value) { - this.probeInfo = value; - } - -} diff --git a/Plugins/Mineplex.BungeeRotator/src/com/neustar/ultraservice/schema/v01/RecentActivity.java b/Plugins/Mineplex.BungeeRotator/src/com/neustar/ultraservice/schema/v01/RecentActivity.java deleted file mode 100644 index beff03fef..000000000 --- a/Plugins/Mineplex.BungeeRotator/src/com/neustar/ultraservice/schema/v01/RecentActivity.java +++ /dev/null @@ -1,168 +0,0 @@ - -package com.neustar.ultraservice.schema.v01; - -import javax.xml.bind.annotation.XmlAccessType; -import javax.xml.bind.annotation.XmlAccessorType; -import javax.xml.bind.annotation.XmlAttribute; -import javax.xml.bind.annotation.XmlType; - - -/** - *

Java class for RecentActivity complex type. - * - *

The following schema fragment specifies the expected content contained within this class. - * - *

- * <complexType name="RecentActivity">
- *   <complexContent>
- *     <restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
- *       <sequence>
- *       </sequence>
- *       <attribute name="changeObject" use="required" type="{http://www.w3.org/2001/XMLSchema}string" />
- *       <attribute name="changeTime" use="required" type="{http://www.w3.org/2001/XMLSchema}string" />
- *       <attribute name="changeType" use="required" type="{http://www.w3.org/2001/XMLSchema}string" />
- *       <attribute name="User" use="required" type="{http://www.w3.org/2001/XMLSchema}string" />
- *       <attribute name="auditId" use="required" type="{http://www.w3.org/2001/XMLSchema}string" />
- *     </restriction>
- *   </complexContent>
- * </complexType>
- * 
- * - * - */ -@XmlAccessorType(XmlAccessType.FIELD) -@XmlType(name = "RecentActivity") -public class RecentActivity { - - @XmlAttribute(name = "changeObject", required = true) - protected String changeObject; - @XmlAttribute(name = "changeTime", required = true) - protected String changeTime; - @XmlAttribute(name = "changeType", required = true) - protected String changeType; - @XmlAttribute(name = "User", required = true) - protected String user; - @XmlAttribute(name = "auditId", required = true) - protected String auditId; - - /** - * Gets the value of the changeObject property. - * - * @return - * possible object is - * {@link String } - * - */ - public String getChangeObject() { - return changeObject; - } - - /** - * Sets the value of the changeObject property. - * - * @param value - * allowed object is - * {@link String } - * - */ - public void setChangeObject(String value) { - this.changeObject = value; - } - - /** - * Gets the value of the changeTime property. - * - * @return - * possible object is - * {@link String } - * - */ - public String getChangeTime() { - return changeTime; - } - - /** - * Sets the value of the changeTime property. - * - * @param value - * allowed object is - * {@link String } - * - */ - public void setChangeTime(String value) { - this.changeTime = value; - } - - /** - * Gets the value of the changeType property. - * - * @return - * possible object is - * {@link String } - * - */ - public String getChangeType() { - return changeType; - } - - /** - * Sets the value of the changeType property. - * - * @param value - * allowed object is - * {@link String } - * - */ - public void setChangeType(String value) { - this.changeType = value; - } - - /** - * Gets the value of the user property. - * - * @return - * possible object is - * {@link String } - * - */ - public String getUser() { - return user; - } - - /** - * Sets the value of the user property. - * - * @param value - * allowed object is - * {@link String } - * - */ - public void setUser(String value) { - this.user = value; - } - - /** - * Gets the value of the auditId property. - * - * @return - * possible object is - * {@link String } - * - */ - public String getAuditId() { - return auditId; - } - - /** - * Sets the value of the auditId property. - * - * @param value - * allowed object is - * {@link String } - * - */ - public void setAuditId(String value) { - this.auditId = value; - } - -} diff --git a/Plugins/Mineplex.BungeeRotator/src/com/neustar/ultraservice/schema/v01/RecentActivityList.java b/Plugins/Mineplex.BungeeRotator/src/com/neustar/ultraservice/schema/v01/RecentActivityList.java deleted file mode 100644 index 47737e305..000000000 --- a/Plugins/Mineplex.BungeeRotator/src/com/neustar/ultraservice/schema/v01/RecentActivityList.java +++ /dev/null @@ -1,69 +0,0 @@ - -package com.neustar.ultraservice.schema.v01; - -import java.util.ArrayList; -import java.util.List; -import javax.xml.bind.annotation.XmlAccessType; -import javax.xml.bind.annotation.XmlAccessorType; -import javax.xml.bind.annotation.XmlElement; -import javax.xml.bind.annotation.XmlType; - - -/** - *

Java class for RecentActivityList complex type. - * - *

The following schema fragment specifies the expected content contained within this class. - * - *

- * <complexType name="RecentActivityList">
- *   <complexContent>
- *     <restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
- *       <sequence>
- *         <element name="RecentActivity" type="{http://schema.ultraservice.neustar.com/v01/}RecentActivity" maxOccurs="unbounded"/>
- *       </sequence>
- *     </restriction>
- *   </complexContent>
- * </complexType>
- * 
- * - * - */ -@XmlAccessorType(XmlAccessType.FIELD) -@XmlType(name = "RecentActivityList", propOrder = { - "recentActivity" -}) -public class RecentActivityList { - - @XmlElement(name = "RecentActivity", required = true) - protected List recentActivity; - - /** - * Gets the value of the recentActivity property. - * - *

- * This accessor method returns a reference to the live list, - * not a snapshot. Therefore any modification you make to the - * returned list will be present inside the JAXB object. - * This is why there is not a set method for the recentActivity property. - * - *

- * For example, to add a new item, do as follows: - *

-     *    getRecentActivity().add(newItem);
-     * 
- * - * - *

- * Objects of the following type(s) are allowed in the list - * {@link RecentActivity } - * - * - */ - public List getRecentActivity() { - if (recentActivity == null) { - recentActivity = new ArrayList(); - } - return this.recentActivity; - } - -} diff --git a/Plugins/Mineplex.BungeeRotator/src/com/neustar/ultraservice/schema/v01/Record.java b/Plugins/Mineplex.BungeeRotator/src/com/neustar/ultraservice/schema/v01/Record.java deleted file mode 100644 index 9552bb13e..000000000 --- a/Plugins/Mineplex.BungeeRotator/src/com/neustar/ultraservice/schema/v01/Record.java +++ /dev/null @@ -1,146 +0,0 @@ - -package com.neustar.ultraservice.schema.v01; - -import javax.xml.bind.annotation.XmlAccessType; -import javax.xml.bind.annotation.XmlAccessorType; -import javax.xml.bind.annotation.XmlAttribute; -import javax.xml.bind.annotation.XmlElement; -import javax.xml.bind.annotation.XmlType; - - -/** - *

Java class for Record complex type. - * - *

The following schema fragment specifies the expected content contained within this class. - * - *

- * <complexType name="Record">
- *   <complexContent>
- *     <restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
- *       <sequence>
- *         <element name="ARecord" type="{http://schema.ultraservice.neustar.com/v01/}ARecord"/>
- *         <element name="CNAMERecord" type="{http://schema.ultraservice.neustar.com/v01/}CNAMERecord"/>
- *         <element name="SubPoolRecord" type="{http://schema.ultraservice.neustar.com/v01/}SUBPOOLRecord"/>
- *       </sequence>
- *       <attribute name="recordType" use="required" type="{http://schema.ultraservice.neustar.com/v01/}RecordType" />
- *     </restriction>
- *   </complexContent>
- * </complexType>
- * 
- * - * - */ -@XmlAccessorType(XmlAccessType.FIELD) -@XmlType(name = "Record", propOrder = { - "aRecord", - "cnameRecord", - "subPoolRecord" -}) -public class Record { - - @XmlElement(name = "ARecord", required = true) - protected ARecord aRecord; - @XmlElement(name = "CNAMERecord", required = true) - protected CNAMERecord cnameRecord; - @XmlElement(name = "SubPoolRecord", required = true) - protected SUBPOOLRecord subPoolRecord; - @XmlAttribute(name = "recordType", required = true) - protected RecordType recordType; - - /** - * Gets the value of the aRecord property. - * - * @return - * possible object is - * {@link ARecord } - * - */ - public ARecord getARecord() { - return aRecord; - } - - /** - * Sets the value of the aRecord property. - * - * @param value - * allowed object is - * {@link ARecord } - * - */ - public void setARecord(ARecord value) { - this.aRecord = value; - } - - /** - * Gets the value of the cnameRecord property. - * - * @return - * possible object is - * {@link CNAMERecord } - * - */ - public CNAMERecord getCNAMERecord() { - return cnameRecord; - } - - /** - * Sets the value of the cnameRecord property. - * - * @param value - * allowed object is - * {@link CNAMERecord } - * - */ - public void setCNAMERecord(CNAMERecord value) { - this.cnameRecord = value; - } - - /** - * Gets the value of the subPoolRecord property. - * - * @return - * possible object is - * {@link SUBPOOLRecord } - * - */ - public SUBPOOLRecord getSubPoolRecord() { - return subPoolRecord; - } - - /** - * Sets the value of the subPoolRecord property. - * - * @param value - * allowed object is - * {@link SUBPOOLRecord } - * - */ - public void setSubPoolRecord(SUBPOOLRecord value) { - this.subPoolRecord = value; - } - - /** - * Gets the value of the recordType property. - * - * @return - * possible object is - * {@link RecordType } - * - */ - public RecordType getRecordType() { - return recordType; - } - - /** - * Sets the value of the recordType property. - * - * @param value - * allowed object is - * {@link RecordType } - * - */ - public void setRecordType(RecordType value) { - this.recordType = value; - } - -} diff --git a/Plugins/Mineplex.BungeeRotator/src/com/neustar/ultraservice/schema/v01/RecordState.java b/Plugins/Mineplex.BungeeRotator/src/com/neustar/ultraservice/schema/v01/RecordState.java deleted file mode 100644 index 1be4fb4f1..000000000 --- a/Plugins/Mineplex.BungeeRotator/src/com/neustar/ultraservice/schema/v01/RecordState.java +++ /dev/null @@ -1,40 +0,0 @@ - -package com.neustar.ultraservice.schema.v01; - -import javax.xml.bind.annotation.XmlEnum; -import javax.xml.bind.annotation.XmlType; - - -/** - *

Java class for RecordState. - * - *

The following schema fragment specifies the expected content contained within this class. - *

- *

- * <simpleType name="RecordState">
- *   <restriction base="{http://www.w3.org/2001/XMLSchema}string">
- *     <enumeration value="ACTIVE"/>
- *     <enumeration value="INACTIVE"/>
- *     <enumeration value="INACTIVE_DUE_TO_CNAME"/>
- *   </restriction>
- * </simpleType>
- * 
- * - */ -@XmlType(name = "RecordState") -@XmlEnum -public enum RecordState { - - ACTIVE, - INACTIVE, - INACTIVE_DUE_TO_CNAME; - - public String value() { - return name(); - } - - public static RecordState fromValue(String v) { - return valueOf(v); - } - -} diff --git a/Plugins/Mineplex.BungeeRotator/src/com/neustar/ultraservice/schema/v01/RecordType.java b/Plugins/Mineplex.BungeeRotator/src/com/neustar/ultraservice/schema/v01/RecordType.java deleted file mode 100644 index 60434dee8..000000000 --- a/Plugins/Mineplex.BungeeRotator/src/com/neustar/ultraservice/schema/v01/RecordType.java +++ /dev/null @@ -1,40 +0,0 @@ - -package com.neustar.ultraservice.schema.v01; - -import javax.xml.bind.annotation.XmlEnum; -import javax.xml.bind.annotation.XmlType; - - -/** - *

Java class for RecordType. - * - *

The following schema fragment specifies the expected content contained within this class. - *

- *

- * <simpleType name="RecordType">
- *   <restriction base="{http://www.w3.org/2001/XMLSchema}string">
- *     <enumeration value="A"/>
- *     <enumeration value="CNAME"/>
- *     <enumeration value="SUBPOOL"/>
- *   </restriction>
- * </simpleType>
- * 
- * - */ -@XmlType(name = "RecordType") -@XmlEnum -public enum RecordType { - - A, - CNAME, - SUBPOOL; - - public String value() { - return name(); - } - - public static RecordType fromValue(String v) { - return valueOf(v); - } - -} diff --git a/Plugins/Mineplex.BungeeRotator/src/com/neustar/ultraservice/schema/v01/RedirectType.java b/Plugins/Mineplex.BungeeRotator/src/com/neustar/ultraservice/schema/v01/RedirectType.java deleted file mode 100644 index f7f1b65f6..000000000 --- a/Plugins/Mineplex.BungeeRotator/src/com/neustar/ultraservice/schema/v01/RedirectType.java +++ /dev/null @@ -1,56 +0,0 @@ - -package com.neustar.ultraservice.schema.v01; - -import javax.xml.bind.annotation.XmlEnum; -import javax.xml.bind.annotation.XmlEnumValue; -import javax.xml.bind.annotation.XmlType; - - -/** - *

Java class for RedirectType. - * - *

The following schema fragment specifies the expected content contained within this class. - *

- *

- * <simpleType name="RedirectType">
- *   <restriction base="{http://www.w3.org/2001/XMLSchema}string">
- *     <enumeration value="Framed"/>
- *     <enumeration value="HTTP_301_REDIRECT"/>
- *     <enumeration value="HTTP_302_REDIRECT"/>
- *     <enumeration value="HTTP_303_REDIRECT"/>
- *     <enumeration value="HTTP_307_REDIRECT"/>
- *   </restriction>
- * </simpleType>
- * 
- * - */ -@XmlType(name = "RedirectType") -@XmlEnum -public enum RedirectType { - - @XmlEnumValue("Framed") - FRAMED("Framed"), - HTTP_301_REDIRECT("HTTP_301_REDIRECT"), - HTTP_302_REDIRECT("HTTP_302_REDIRECT"), - HTTP_303_REDIRECT("HTTP_303_REDIRECT"), - HTTP_307_REDIRECT("HTTP_307_REDIRECT"); - private final String value; - - RedirectType(String v) { - value = v; - } - - public String value() { - return value; - } - - public static RedirectType fromValue(String v) { - for (RedirectType c: RedirectType.values()) { - if (c.value.equals(v)) { - return c; - } - } - throw new IllegalArgumentException(v); - } - -} diff --git a/Plugins/Mineplex.BungeeRotator/src/com/neustar/ultraservice/schema/v01/Region.java b/Plugins/Mineplex.BungeeRotator/src/com/neustar/ultraservice/schema/v01/Region.java deleted file mode 100644 index 430d04a8b..000000000 --- a/Plugins/Mineplex.BungeeRotator/src/com/neustar/ultraservice/schema/v01/Region.java +++ /dev/null @@ -1,114 +0,0 @@ - -package com.neustar.ultraservice.schema.v01; - -import javax.xml.bind.annotation.XmlAccessType; -import javax.xml.bind.annotation.XmlAccessorType; -import javax.xml.bind.annotation.XmlAttribute; -import javax.xml.bind.annotation.XmlType; - - -/** - *

Java class for Region complex type. - * - *

The following schema fragment specifies the expected content contained within this class. - * - *

- * <complexType name="Region">
- *   <complexContent>
- *     <restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
- *       <sequence>
- *       </sequence>
- *       <attribute name="TerritoryName" use="required" type="{http://www.w3.org/2001/XMLSchema}string" />
- *       <attribute name="RegionName" use="required" type="{http://www.w3.org/2001/XMLSchema}string" />
- *       <attribute name="RegionID" use="required" type="{http://www.w3.org/2001/XMLSchema}string" />
- *     </restriction>
- *   </complexContent>
- * </complexType>
- * 
- * - * - */ -@XmlAccessorType(XmlAccessType.FIELD) -@XmlType(name = "Region") -public class Region { - - @XmlAttribute(name = "TerritoryName", required = true) - protected String territoryName; - @XmlAttribute(name = "RegionName", required = true) - protected String regionName; - @XmlAttribute(name = "RegionID", required = true) - protected String regionID; - - /** - * Gets the value of the territoryName property. - * - * @return - * possible object is - * {@link String } - * - */ - public String getTerritoryName() { - return territoryName; - } - - /** - * Sets the value of the territoryName property. - * - * @param value - * allowed object is - * {@link String } - * - */ - public void setTerritoryName(String value) { - this.territoryName = value; - } - - /** - * Gets the value of the regionName property. - * - * @return - * possible object is - * {@link String } - * - */ - public String getRegionName() { - return regionName; - } - - /** - * Sets the value of the regionName property. - * - * @param value - * allowed object is - * {@link String } - * - */ - public void setRegionName(String value) { - this.regionName = value; - } - - /** - * Gets the value of the regionID property. - * - * @return - * possible object is - * {@link String } - * - */ - public String getRegionID() { - return regionID; - } - - /** - * Sets the value of the regionID property. - * - * @param value - * allowed object is - * {@link String } - * - */ - public void setRegionID(String value) { - this.regionID = value; - } - -} diff --git a/Plugins/Mineplex.BungeeRotator/src/com/neustar/ultraservice/schema/v01/RegionAndAgent.java b/Plugins/Mineplex.BungeeRotator/src/com/neustar/ultraservice/schema/v01/RegionAndAgent.java deleted file mode 100644 index b46da7e89..000000000 --- a/Plugins/Mineplex.BungeeRotator/src/com/neustar/ultraservice/schema/v01/RegionAndAgent.java +++ /dev/null @@ -1,87 +0,0 @@ - -package com.neustar.ultraservice.schema.v01; - -import javax.xml.bind.annotation.XmlAccessType; -import javax.xml.bind.annotation.XmlAccessorType; -import javax.xml.bind.annotation.XmlAttribute; -import javax.xml.bind.annotation.XmlType; - - -/** - *

Java class for RegionAndAgent complex type. - * - *

The following schema fragment specifies the expected content contained within this class. - * - *

- * <complexType name="RegionAndAgent">
- *   <complexContent>
- *     <restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
- *       <sequence>
- *       </sequence>
- *       <attribute name="RegionName" use="required" type="{http://www.w3.org/2001/XMLSchema}string" />
- *       <attribute name="AgentName" use="required" type="{http://www.w3.org/2001/XMLSchema}string" />
- *     </restriction>
- *   </complexContent>
- * </complexType>
- * 
- * - * - */ -@XmlAccessorType(XmlAccessType.FIELD) -@XmlType(name = "RegionAndAgent") -public class RegionAndAgent { - - @XmlAttribute(name = "RegionName", required = true) - protected String regionName; - @XmlAttribute(name = "AgentName", required = true) - protected String agentName; - - /** - * Gets the value of the regionName property. - * - * @return - * possible object is - * {@link String } - * - */ - public String getRegionName() { - return regionName; - } - - /** - * Sets the value of the regionName property. - * - * @param value - * allowed object is - * {@link String } - * - */ - public void setRegionName(String value) { - this.regionName = value; - } - - /** - * Gets the value of the agentName property. - * - * @return - * possible object is - * {@link String } - * - */ - public String getAgentName() { - return agentName; - } - - /** - * Sets the value of the agentName property. - * - * @param value - * allowed object is - * {@link String } - * - */ - public void setAgentName(String value) { - this.agentName = value; - } - -} diff --git a/Plugins/Mineplex.BungeeRotator/src/com/neustar/ultraservice/schema/v01/RegionForNewGroups.java b/Plugins/Mineplex.BungeeRotator/src/com/neustar/ultraservice/schema/v01/RegionForNewGroups.java deleted file mode 100644 index d3bf0b521..000000000 --- a/Plugins/Mineplex.BungeeRotator/src/com/neustar/ultraservice/schema/v01/RegionForNewGroups.java +++ /dev/null @@ -1,87 +0,0 @@ - -package com.neustar.ultraservice.schema.v01; - -import javax.xml.bind.annotation.XmlAccessType; -import javax.xml.bind.annotation.XmlAccessorType; -import javax.xml.bind.annotation.XmlAttribute; -import javax.xml.bind.annotation.XmlType; - - -/** - *

Java class for RegionForNewGroups complex type. - * - *

The following schema fragment specifies the expected content contained within this class. - * - *

- * <complexType name="RegionForNewGroups">
- *   <complexContent>
- *     <restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
- *       <sequence>
- *       </sequence>
- *       <attribute name="RegionName" use="required" type="{http://www.w3.org/2001/XMLSchema}string" />
- *       <attribute name="TerritoryName" use="required" type="{http://www.w3.org/2001/XMLSchema}string" />
- *     </restriction>
- *   </complexContent>
- * </complexType>
- * 
- * - * - */ -@XmlAccessorType(XmlAccessType.FIELD) -@XmlType(name = "RegionForNewGroups") -public class RegionForNewGroups { - - @XmlAttribute(name = "RegionName", required = true) - protected String regionName; - @XmlAttribute(name = "TerritoryName", required = true) - protected String territoryName; - - /** - * Gets the value of the regionName property. - * - * @return - * possible object is - * {@link String } - * - */ - public String getRegionName() { - return regionName; - } - - /** - * Sets the value of the regionName property. - * - * @param value - * allowed object is - * {@link String } - * - */ - public void setRegionName(String value) { - this.regionName = value; - } - - /** - * Gets the value of the territoryName property. - * - * @return - * possible object is - * {@link String } - * - */ - public String getTerritoryName() { - return territoryName; - } - - /** - * Sets the value of the territoryName property. - * - * @param value - * allowed object is - * {@link String } - * - */ - public void setTerritoryName(String value) { - this.territoryName = value; - } - -} diff --git a/Plugins/Mineplex.BungeeRotator/src/com/neustar/ultraservice/schema/v01/RegionForNewGroupsList.java b/Plugins/Mineplex.BungeeRotator/src/com/neustar/ultraservice/schema/v01/RegionForNewGroupsList.java deleted file mode 100644 index 5cd44ca9c..000000000 --- a/Plugins/Mineplex.BungeeRotator/src/com/neustar/ultraservice/schema/v01/RegionForNewGroupsList.java +++ /dev/null @@ -1,69 +0,0 @@ - -package com.neustar.ultraservice.schema.v01; - -import java.util.ArrayList; -import java.util.List; -import javax.xml.bind.annotation.XmlAccessType; -import javax.xml.bind.annotation.XmlAccessorType; -import javax.xml.bind.annotation.XmlElement; -import javax.xml.bind.annotation.XmlType; - - -/** - *

Java class for RegionForNewGroupsList complex type. - * - *

The following schema fragment specifies the expected content contained within this class. - * - *

- * <complexType name="RegionForNewGroupsList">
- *   <complexContent>
- *     <restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
- *       <sequence>
- *         <element name="RegionForNewGroups" type="{http://schema.ultraservice.neustar.com/v01/}RegionForNewGroups" maxOccurs="unbounded"/>
- *       </sequence>
- *     </restriction>
- *   </complexContent>
- * </complexType>
- * 
- * - * - */ -@XmlAccessorType(XmlAccessType.FIELD) -@XmlType(name = "RegionForNewGroupsList", propOrder = { - "regionForNewGroups" -}) -public class RegionForNewGroupsList { - - @XmlElement(name = "RegionForNewGroups", required = true) - protected List regionForNewGroups; - - /** - * Gets the value of the regionForNewGroups property. - * - *

- * This accessor method returns a reference to the live list, - * not a snapshot. Therefore any modification you make to the - * returned list will be present inside the JAXB object. - * This is why there is not a set method for the regionForNewGroups property. - * - *

- * For example, to add a new item, do as follows: - *

-     *    getRegionForNewGroups().add(newItem);
-     * 
- * - * - *

- * Objects of the following type(s) are allowed in the list - * {@link RegionForNewGroups } - * - * - */ - public List getRegionForNewGroups() { - if (regionForNewGroups == null) { - regionForNewGroups = new ArrayList(); - } - return this.regionForNewGroups; - } - -} diff --git a/Plugins/Mineplex.BungeeRotator/src/com/neustar/ultraservice/schema/v01/RegionList.java b/Plugins/Mineplex.BungeeRotator/src/com/neustar/ultraservice/schema/v01/RegionList.java deleted file mode 100644 index 14ad45268..000000000 --- a/Plugins/Mineplex.BungeeRotator/src/com/neustar/ultraservice/schema/v01/RegionList.java +++ /dev/null @@ -1,69 +0,0 @@ - -package com.neustar.ultraservice.schema.v01; - -import java.util.ArrayList; -import java.util.List; -import javax.xml.bind.annotation.XmlAccessType; -import javax.xml.bind.annotation.XmlAccessorType; -import javax.xml.bind.annotation.XmlElement; -import javax.xml.bind.annotation.XmlType; - - -/** - *

Java class for RegionList complex type. - * - *

The following schema fragment specifies the expected content contained within this class. - * - *

- * <complexType name="RegionList">
- *   <complexContent>
- *     <restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
- *       <sequence>
- *         <element name="Region" type="{http://schema.ultraservice.neustar.com/v01/}Region" maxOccurs="unbounded"/>
- *       </sequence>
- *     </restriction>
- *   </complexContent>
- * </complexType>
- * 
- * - * - */ -@XmlAccessorType(XmlAccessType.FIELD) -@XmlType(name = "RegionList", propOrder = { - "region" -}) -public class RegionList { - - @XmlElement(name = "Region", required = true) - protected List region; - - /** - * Gets the value of the region property. - * - *

- * This accessor method returns a reference to the live list, - * not a snapshot. Therefore any modification you make to the - * returned list will be present inside the JAXB object. - * This is why there is not a set method for the region property. - * - *

- * For example, to add a new item, do as follows: - *

-     *    getRegion().add(newItem);
-     * 
- * - * - *

- * Objects of the following type(s) are allowed in the list - * {@link Region } - * - * - */ - public List getRegion() { - if (region == null) { - region = new ArrayList(); - } - return this.region; - } - -} diff --git a/Plugins/Mineplex.BungeeRotator/src/com/neustar/ultraservice/schema/v01/Regions.java b/Plugins/Mineplex.BungeeRotator/src/com/neustar/ultraservice/schema/v01/Regions.java deleted file mode 100644 index b2d63c223..000000000 --- a/Plugins/Mineplex.BungeeRotator/src/com/neustar/ultraservice/schema/v01/Regions.java +++ /dev/null @@ -1,60 +0,0 @@ - -package com.neustar.ultraservice.schema.v01; - -import javax.xml.bind.annotation.XmlAccessType; -import javax.xml.bind.annotation.XmlAccessorType; -import javax.xml.bind.annotation.XmlAttribute; -import javax.xml.bind.annotation.XmlType; - - -/** - *

Java class for Regions complex type. - * - *

The following schema fragment specifies the expected content contained within this class. - * - *

- * <complexType name="Regions">
- *   <complexContent>
- *     <restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
- *       <sequence>
- *       </sequence>
- *       <attribute name="region" use="required" type="{http://www.w3.org/2001/XMLSchema}string" />
- *     </restriction>
- *   </complexContent>
- * </complexType>
- * 
- * - * - */ -@XmlAccessorType(XmlAccessType.FIELD) -@XmlType(name = "Regions") -public class Regions { - - @XmlAttribute(name = "region", required = true) - protected String region; - - /** - * Gets the value of the region property. - * - * @return - * possible object is - * {@link String } - * - */ - public String getRegion() { - return region; - } - - /** - * Sets the value of the region property. - * - * @param value - * allowed object is - * {@link String } - * - */ - public void setRegion(String value) { - this.region = value; - } - -} diff --git a/Plugins/Mineplex.BungeeRotator/src/com/neustar/ultraservice/schema/v01/ReportType.java b/Plugins/Mineplex.BungeeRotator/src/com/neustar/ultraservice/schema/v01/ReportType.java deleted file mode 100644 index 1ad927578..000000000 --- a/Plugins/Mineplex.BungeeRotator/src/com/neustar/ultraservice/schema/v01/ReportType.java +++ /dev/null @@ -1,87 +0,0 @@ - -package com.neustar.ultraservice.schema.v01; - -import javax.xml.bind.annotation.XmlEnum; -import javax.xml.bind.annotation.XmlEnumValue; -import javax.xml.bind.annotation.XmlType; - - -/** - *

Java class for reportType. - * - *

The following schema fragment specifies the expected content contained within this class. - *

- *

- * <simpleType name="reportType">
- *   <restriction base="{http://www.w3.org/2001/XMLSchema}string">
- *     <enumeration value="Domains"/>
- *     <enumeration value="Records"/>
- *     <enumeration value="Queries"/>
- *     <enumeration value="Region"/>
- *     <enumeration value="PoolRecord"/>
- *     <enumeration value="FailoverProbe"/>
- *     <enumeration value="Failover"/>
- *     <enumeration value="Overall Activity - Domains"/>
- *     <enumeration value="Overall Activity - Records"/>
- *     <enumeration value="Overall Activity - Queries"/>
- *     <enumeration value="Activity by Region"/>
- *     <enumeration value="Failover - Pool Record"/>
- *     <enumeration value="Failover - Probe Statistics"/>
- *     <enumeration value="Failover - Failover"/>
- *   </restriction>
- * </simpleType>
- * 
- * - */ -@XmlType(name = "reportType") -@XmlEnum -public enum ReportType { - - @XmlEnumValue("Domains") - DOMAINS("Domains"), - @XmlEnumValue("Records") - RECORDS("Records"), - @XmlEnumValue("Queries") - QUERIES("Queries"), - @XmlEnumValue("Region") - REGION("Region"), - @XmlEnumValue("PoolRecord") - POOL_RECORD("PoolRecord"), - @XmlEnumValue("FailoverProbe") - FAILOVER_PROBE("FailoverProbe"), - @XmlEnumValue("Failover") - FAILOVER("Failover"), - @XmlEnumValue("Overall Activity - Domains") - OVERALL_ACTIVITY_DOMAINS("Overall Activity - Domains"), - @XmlEnumValue("Overall Activity - Records") - OVERALL_ACTIVITY_RECORDS("Overall Activity - Records"), - @XmlEnumValue("Overall Activity - Queries") - OVERALL_ACTIVITY_QUERIES("Overall Activity - Queries"), - @XmlEnumValue("Activity by Region") - ACTIVITY_BY_REGION("Activity by Region"), - @XmlEnumValue("Failover - Pool Record") - FAILOVER_POOL_RECORD("Failover - Pool Record"), - @XmlEnumValue("Failover - Probe Statistics") - FAILOVER_PROBE_STATISTICS("Failover - Probe Statistics"), - @XmlEnumValue("Failover - Failover") - FAILOVER_FAILOVER("Failover - Failover"); - private final String value; - - ReportType(String v) { - value = v; - } - - public String value() { - return value; - } - - public static ReportType fromValue(String v) { - for (ReportType c: ReportType.values()) { - if (c.value.equals(v)) { - return c; - } - } - throw new IllegalArgumentException(v); - } - -} diff --git a/Plugins/Mineplex.BungeeRotator/src/com/neustar/ultraservice/schema/v01/ResourceRecord.java b/Plugins/Mineplex.BungeeRotator/src/com/neustar/ultraservice/schema/v01/ResourceRecord.java deleted file mode 100644 index 68f393668..000000000 --- a/Plugins/Mineplex.BungeeRotator/src/com/neustar/ultraservice/schema/v01/ResourceRecord.java +++ /dev/null @@ -1,329 +0,0 @@ - -package com.neustar.ultraservice.schema.v01; - -import javax.xml.bind.annotation.XmlAccessType; -import javax.xml.bind.annotation.XmlAccessorType; -import javax.xml.bind.annotation.XmlAttribute; -import javax.xml.bind.annotation.XmlElement; -import javax.xml.bind.annotation.XmlSchemaType; -import javax.xml.bind.annotation.XmlType; -import javax.xml.datatype.XMLGregorianCalendar; - - -/** - *

Java class for ResourceRecord complex type. - * - *

The following schema fragment specifies the expected content contained within this class. - * - *

- * <complexType name="ResourceRecord">
- *   <complexContent>
- *     <restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
- *       <sequence>
- *         <element name="InfoValues" type="{http://schema.ultraservice.neustar.com/v01/}InfoValues"/>
- *       </sequence>
- *       <attribute name="ZoneName" use="required" type="{http://www.w3.org/2001/XMLSchema}string" />
- *       <attribute name="Type" use="required" type="{http://www.w3.org/2001/XMLSchema}int" />
- *       <attribute name="DName" use="required" type="{http://www.w3.org/2001/XMLSchema}string" />
- *       <attribute name="TTL" use="required" type="{http://www.w3.org/2001/XMLSchema}string" />
- *       <attribute name="Guid" use="required" type="{http://www.w3.org/2001/XMLSchema}string" />
- *       <attribute name="ZoneId" use="required" type="{http://www.w3.org/2001/XMLSchema}string" />
- *       <attribute name="LName" use="required" type="{http://www.w3.org/2001/XMLSchema}string" />
- *       <attribute name="Priority" type="{http://www.w3.org/2001/XMLSchema}string" />
- *       <attribute name="Created" use="required" type="{http://www.w3.org/2001/XMLSchema}dateTime" />
- *       <attribute name="Modified" use="required" type="{http://www.w3.org/2001/XMLSchema}dateTime" />
- *     </restriction>
- *   </complexContent>
- * </complexType>
- * 
- * - * - */ -@XmlAccessorType(XmlAccessType.FIELD) -@XmlType(name = "ResourceRecord", propOrder = { - "infoValues" -}) -public class ResourceRecord { - - @XmlElement(name = "InfoValues", required = true) - protected InfoValues infoValues; - @XmlAttribute(name = "ZoneName", required = true) - protected String zoneName; - @XmlAttribute(name = "Type", required = true) - protected int type; - @XmlAttribute(name = "DName", required = true) - protected String dName; - @XmlAttribute(name = "TTL", required = true) - protected String ttl; - @XmlAttribute(name = "Guid", required = true) - protected String guid; - @XmlAttribute(name = "ZoneId", required = true) - protected String zoneId; - @XmlAttribute(name = "LName", required = true) - protected String lName; - @XmlAttribute(name = "Priority") - protected String priority; - @XmlAttribute(name = "Created", required = true) - @XmlSchemaType(name = "dateTime") - protected XMLGregorianCalendar created; - @XmlAttribute(name = "Modified", required = true) - @XmlSchemaType(name = "dateTime") - protected XMLGregorianCalendar modified; - - /** - * Gets the value of the infoValues property. - * - * @return - * possible object is - * {@link InfoValues } - * - */ - public InfoValues getInfoValues() { - return infoValues; - } - - /** - * Sets the value of the infoValues property. - * - * @param value - * allowed object is - * {@link InfoValues } - * - */ - public void setInfoValues(InfoValues value) { - this.infoValues = value; - } - - /** - * Gets the value of the zoneName property. - * - * @return - * possible object is - * {@link String } - * - */ - public String getZoneName() { - return zoneName; - } - - /** - * Sets the value of the zoneName property. - * - * @param value - * allowed object is - * {@link String } - * - */ - public void setZoneName(String value) { - this.zoneName = value; - } - - /** - * Gets the value of the type property. - * - */ - public int getType() { - return type; - } - - /** - * Sets the value of the type property. - * - */ - public void setType(int value) { - this.type = value; - } - - /** - * Gets the value of the dName property. - * - * @return - * possible object is - * {@link String } - * - */ - public String getDName() { - return dName; - } - - /** - * Sets the value of the dName property. - * - * @param value - * allowed object is - * {@link String } - * - */ - public void setDName(String value) { - this.dName = value; - } - - /** - * Gets the value of the ttl property. - * - * @return - * possible object is - * {@link String } - * - */ - public String getTTL() { - return ttl; - } - - /** - * Sets the value of the ttl property. - * - * @param value - * allowed object is - * {@link String } - * - */ - public void setTTL(String value) { - this.ttl = value; - } - - /** - * Gets the value of the guid property. - * - * @return - * possible object is - * {@link String } - * - */ - public String getGuid() { - return guid; - } - - /** - * Sets the value of the guid property. - * - * @param value - * allowed object is - * {@link String } - * - */ - public void setGuid(String value) { - this.guid = value; - } - - /** - * Gets the value of the zoneId property. - * - * @return - * possible object is - * {@link String } - * - */ - public String getZoneId() { - return zoneId; - } - - /** - * Sets the value of the zoneId property. - * - * @param value - * allowed object is - * {@link String } - * - */ - public void setZoneId(String value) { - this.zoneId = value; - } - - /** - * Gets the value of the lName property. - * - * @return - * possible object is - * {@link String } - * - */ - public String getLName() { - return lName; - } - - /** - * Sets the value of the lName property. - * - * @param value - * allowed object is - * {@link String } - * - */ - public void setLName(String value) { - this.lName = value; - } - - /** - * Gets the value of the priority property. - * - * @return - * possible object is - * {@link String } - * - */ - public String getPriority() { - return priority; - } - - /** - * Sets the value of the priority property. - * - * @param value - * allowed object is - * {@link String } - * - */ - public void setPriority(String value) { - this.priority = value; - } - - /** - * Gets the value of the created property. - * - * @return - * possible object is - * {@link XMLGregorianCalendar } - * - */ - public XMLGregorianCalendar getCreated() { - return created; - } - - /** - * Sets the value of the created property. - * - * @param value - * allowed object is - * {@link XMLGregorianCalendar } - * - */ - public void setCreated(XMLGregorianCalendar value) { - this.created = value; - } - - /** - * Gets the value of the modified property. - * - * @return - * possible object is - * {@link XMLGregorianCalendar } - * - */ - public XMLGregorianCalendar getModified() { - return modified; - } - - /** - * Sets the value of the modified property. - * - * @param value - * allowed object is - * {@link XMLGregorianCalendar } - * - */ - public void setModified(XMLGregorianCalendar value) { - this.modified = value; - } - -} diff --git a/Plugins/Mineplex.BungeeRotator/src/com/neustar/ultraservice/schema/v01/ResourceRecordGUIDList.java b/Plugins/Mineplex.BungeeRotator/src/com/neustar/ultraservice/schema/v01/ResourceRecordGUIDList.java deleted file mode 100644 index 46d3b2089..000000000 --- a/Plugins/Mineplex.BungeeRotator/src/com/neustar/ultraservice/schema/v01/ResourceRecordGUIDList.java +++ /dev/null @@ -1,69 +0,0 @@ - -package com.neustar.ultraservice.schema.v01; - -import java.util.ArrayList; -import java.util.List; -import javax.xml.bind.annotation.XmlAccessType; -import javax.xml.bind.annotation.XmlAccessorType; -import javax.xml.bind.annotation.XmlElement; -import javax.xml.bind.annotation.XmlType; - - -/** - *

Java class for ResourceRecordGUIDList complex type. - * - *

The following schema fragment specifies the expected content contained within this class. - * - *

- * <complexType name="ResourceRecordGUIDList">
- *   <complexContent>
- *     <restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
- *       <sequence>
- *         <element name="GUID" type="{http://www.w3.org/2001/XMLSchema}string" maxOccurs="unbounded"/>
- *       </sequence>
- *     </restriction>
- *   </complexContent>
- * </complexType>
- * 
- * - * - */ -@XmlAccessorType(XmlAccessType.FIELD) -@XmlType(name = "ResourceRecordGUIDList", propOrder = { - "guid" -}) -public class ResourceRecordGUIDList { - - @XmlElement(name = "GUID", required = true) - protected List guid; - - /** - * Gets the value of the guid property. - * - *

- * This accessor method returns a reference to the live list, - * not a snapshot. Therefore any modification you make to the - * returned list will be present inside the JAXB object. - * This is why there is not a set method for the guid property. - * - *

- * For example, to add a new item, do as follows: - *

-     *    getGUID().add(newItem);
-     * 
- * - * - *

- * Objects of the following type(s) are allowed in the list - * {@link String } - * - * - */ - public List getGUID() { - if (guid == null) { - guid = new ArrayList(); - } - return this.guid; - } - -} diff --git a/Plugins/Mineplex.BungeeRotator/src/com/neustar/ultraservice/schema/v01/ResourceRecordList.java b/Plugins/Mineplex.BungeeRotator/src/com/neustar/ultraservice/schema/v01/ResourceRecordList.java deleted file mode 100644 index a14016e15..000000000 --- a/Plugins/Mineplex.BungeeRotator/src/com/neustar/ultraservice/schema/v01/ResourceRecordList.java +++ /dev/null @@ -1,69 +0,0 @@ - -package com.neustar.ultraservice.schema.v01; - -import java.util.ArrayList; -import java.util.List; -import javax.xml.bind.annotation.XmlAccessType; -import javax.xml.bind.annotation.XmlAccessorType; -import javax.xml.bind.annotation.XmlElement; -import javax.xml.bind.annotation.XmlType; - - -/** - *

Java class for ResourceRecordList complex type. - * - *

The following schema fragment specifies the expected content contained within this class. - * - *

- * <complexType name="ResourceRecordList">
- *   <complexContent>
- *     <restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
- *       <sequence>
- *         <element name="ResourceRecord" type="{http://schema.ultraservice.neustar.com/v01/}ResourceRecord" maxOccurs="unbounded"/>
- *       </sequence>
- *     </restriction>
- *   </complexContent>
- * </complexType>
- * 
- * - * - */ -@XmlAccessorType(XmlAccessType.FIELD) -@XmlType(name = "ResourceRecordList", propOrder = { - "resourceRecord" -}) -public class ResourceRecordList { - - @XmlElement(name = "ResourceRecord", required = true) - protected List resourceRecord; - - /** - * Gets the value of the resourceRecord property. - * - *

- * This accessor method returns a reference to the live list, - * not a snapshot. Therefore any modification you make to the - * returned list will be present inside the JAXB object. - * This is why there is not a set method for the resourceRecord property. - * - *

- * For example, to add a new item, do as follows: - *

-     *    getResourceRecord().add(newItem);
-     * 
- * - * - *

- * Objects of the following type(s) are allowed in the list - * {@link ResourceRecord } - * - * - */ - public List getResourceRecord() { - if (resourceRecord == null) { - resourceRecord = new ArrayList(); - } - return this.resourceRecord; - } - -} diff --git a/Plugins/Mineplex.BungeeRotator/src/com/neustar/ultraservice/schema/v01/ResourceRecordTemplate.java b/Plugins/Mineplex.BungeeRotator/src/com/neustar/ultraservice/schema/v01/ResourceRecordTemplate.java deleted file mode 100644 index e65569977..000000000 --- a/Plugins/Mineplex.BungeeRotator/src/com/neustar/ultraservice/schema/v01/ResourceRecordTemplate.java +++ /dev/null @@ -1,82 +0,0 @@ - -package com.neustar.ultraservice.schema.v01; - -import javax.xml.bind.annotation.XmlAccessType; -import javax.xml.bind.annotation.XmlAccessorType; -import javax.xml.bind.annotation.XmlAttribute; -import javax.xml.bind.annotation.XmlElement; -import javax.xml.bind.annotation.XmlType; - - -/** - *

Java class for ResourceRecordTemplate complex type. - * - *

The following schema fragment specifies the expected content contained within this class. - * - *

- * <complexType name="ResourceRecordTemplate">
- *   <complexContent>
- *     <restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
- *       <sequence>
- *         <element name="InfoTypes" type="{http://schema.ultraservice.neustar.com/v01/}InfoTypes"/>
- *       </sequence>
- *       <attribute name="Type" use="required" type="{http://www.w3.org/2001/XMLSchema}int" />
- *     </restriction>
- *   </complexContent>
- * </complexType>
- * 
- * - * - */ -@XmlAccessorType(XmlAccessType.FIELD) -@XmlType(name = "ResourceRecordTemplate", propOrder = { - "infoTypes" -}) -public class ResourceRecordTemplate { - - @XmlElement(name = "InfoTypes", required = true) - protected InfoTypes infoTypes; - @XmlAttribute(name = "Type", required = true) - protected int type; - - /** - * Gets the value of the infoTypes property. - * - * @return - * possible object is - * {@link InfoTypes } - * - */ - public InfoTypes getInfoTypes() { - return infoTypes; - } - - /** - * Sets the value of the infoTypes property. - * - * @param value - * allowed object is - * {@link InfoTypes } - * - */ - public void setInfoTypes(InfoTypes value) { - this.infoTypes = value; - } - - /** - * Gets the value of the type property. - * - */ - public int getType() { - return type; - } - - /** - * Sets the value of the type property. - * - */ - public void setType(int value) { - this.type = value; - } - -} diff --git a/Plugins/Mineplex.BungeeRotator/src/com/neustar/ultraservice/schema/v01/ResourceRecordToCreate.java b/Plugins/Mineplex.BungeeRotator/src/com/neustar/ultraservice/schema/v01/ResourceRecordToCreate.java deleted file mode 100644 index 648361faa..000000000 --- a/Plugins/Mineplex.BungeeRotator/src/com/neustar/ultraservice/schema/v01/ResourceRecordToCreate.java +++ /dev/null @@ -1,163 +0,0 @@ - -package com.neustar.ultraservice.schema.v01; - -import javax.xml.bind.annotation.XmlAccessType; -import javax.xml.bind.annotation.XmlAccessorType; -import javax.xml.bind.annotation.XmlAttribute; -import javax.xml.bind.annotation.XmlElement; -import javax.xml.bind.annotation.XmlType; - - -/** - *

Java class for ResourceRecordToCreate complex type. - * - *

The following schema fragment specifies the expected content contained within this class. - * - *

- * <complexType name="ResourceRecordToCreate">
- *   <complexContent>
- *     <restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
- *       <sequence>
- *         <element name="InfoValues" type="{http://schema.ultraservice.neustar.com/v01/}InfoValues"/>
- *       </sequence>
- *       <attribute name="ZoneName" use="required" type="{http://www.w3.org/2001/XMLSchema}string" />
- *       <attribute name="Type" use="required" type="{http://www.w3.org/2001/XMLSchema}int" />
- *       <attribute name="DName" use="required" type="{http://www.w3.org/2001/XMLSchema}string" />
- *       <attribute name="TTL" type="{http://www.w3.org/2001/XMLSchema}string" />
- *     </restriction>
- *   </complexContent>
- * </complexType>
- * 
- * - * - */ -@XmlAccessorType(XmlAccessType.FIELD) -@XmlType(name = "ResourceRecordToCreate", propOrder = { - "infoValues" -}) -public class ResourceRecordToCreate { - - @XmlElement(name = "InfoValues", required = true) - protected InfoValues infoValues; - @XmlAttribute(name = "ZoneName", required = true) - protected String zoneName; - @XmlAttribute(name = "Type", required = true) - protected int type; - @XmlAttribute(name = "DName", required = true) - protected String dName; - @XmlAttribute(name = "TTL") - protected String ttl; - - /** - * Gets the value of the infoValues property. - * - * @return - * possible object is - * {@link InfoValues } - * - */ - public InfoValues getInfoValues() { - return infoValues; - } - - /** - * Sets the value of the infoValues property. - * - * @param value - * allowed object is - * {@link InfoValues } - * - */ - public void setInfoValues(InfoValues value) { - this.infoValues = value; - } - - /** - * Gets the value of the zoneName property. - * - * @return - * possible object is - * {@link String } - * - */ - public String getZoneName() { - return zoneName; - } - - /** - * Sets the value of the zoneName property. - * - * @param value - * allowed object is - * {@link String } - * - */ - public void setZoneName(String value) { - this.zoneName = value; - } - - /** - * Gets the value of the type property. - * - */ - public int getType() { - return type; - } - - /** - * Sets the value of the type property. - * - */ - public void setType(int value) { - this.type = value; - } - - /** - * Gets the value of the dName property. - * - * @return - * possible object is - * {@link String } - * - */ - public String getDName() { - return dName; - } - - /** - * Sets the value of the dName property. - * - * @param value - * allowed object is - * {@link String } - * - */ - public void setDName(String value) { - this.dName = value; - } - - /** - * Gets the value of the ttl property. - * - * @return - * possible object is - * {@link String } - * - */ - public String getTTL() { - return ttl; - } - - /** - * Sets the value of the ttl property. - * - * @param value - * allowed object is - * {@link String } - * - */ - public void setTTL(String value) { - this.ttl = value; - } - -} diff --git a/Plugins/Mineplex.BungeeRotator/src/com/neustar/ultraservice/schema/v01/ResourceRecordToSearch.java b/Plugins/Mineplex.BungeeRotator/src/com/neustar/ultraservice/schema/v01/ResourceRecordToSearch.java deleted file mode 100644 index 31802306f..000000000 --- a/Plugins/Mineplex.BungeeRotator/src/com/neustar/ultraservice/schema/v01/ResourceRecordToSearch.java +++ /dev/null @@ -1,136 +0,0 @@ - -package com.neustar.ultraservice.schema.v01; - -import javax.xml.bind.annotation.XmlAccessType; -import javax.xml.bind.annotation.XmlAccessorType; -import javax.xml.bind.annotation.XmlAttribute; -import javax.xml.bind.annotation.XmlElement; -import javax.xml.bind.annotation.XmlType; - - -/** - *

Java class for ResourceRecordToSearch complex type. - * - *

The following schema fragment specifies the expected content contained within this class. - * - *

- * <complexType name="ResourceRecordToSearch">
- *   <complexContent>
- *     <restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
- *       <sequence>
- *         <element name="InfoValues" type="{http://schema.ultraservice.neustar.com/v01/}InfoValues"/>
- *       </sequence>
- *       <attribute name="ZoneName" use="required" type="{http://www.w3.org/2001/XMLSchema}string" />
- *       <attribute name="Type" use="required" type="{http://www.w3.org/2001/XMLSchema}int" />
- *       <attribute name="DName" use="required" type="{http://www.w3.org/2001/XMLSchema}string" />
- *     </restriction>
- *   </complexContent>
- * </complexType>
- * 
- * - * - */ -@XmlAccessorType(XmlAccessType.FIELD) -@XmlType(name = "ResourceRecordToSearch", propOrder = { - "infoValues" -}) -public class ResourceRecordToSearch { - - @XmlElement(name = "InfoValues", required = true) - protected InfoValues infoValues; - @XmlAttribute(name = "ZoneName", required = true) - protected String zoneName; - @XmlAttribute(name = "Type", required = true) - protected int type; - @XmlAttribute(name = "DName", required = true) - protected String dName; - - /** - * Gets the value of the infoValues property. - * - * @return - * possible object is - * {@link InfoValues } - * - */ - public InfoValues getInfoValues() { - return infoValues; - } - - /** - * Sets the value of the infoValues property. - * - * @param value - * allowed object is - * {@link InfoValues } - * - */ - public void setInfoValues(InfoValues value) { - this.infoValues = value; - } - - /** - * Gets the value of the zoneName property. - * - * @return - * possible object is - * {@link String } - * - */ - public String getZoneName() { - return zoneName; - } - - /** - * Sets the value of the zoneName property. - * - * @param value - * allowed object is - * {@link String } - * - */ - public void setZoneName(String value) { - this.zoneName = value; - } - - /** - * Gets the value of the type property. - * - */ - public int getType() { - return type; - } - - /** - * Sets the value of the type property. - * - */ - public void setType(int value) { - this.type = value; - } - - /** - * Gets the value of the dName property. - * - * @return - * possible object is - * {@link String } - * - */ - public String getDName() { - return dName; - } - - /** - * Sets the value of the dName property. - * - * @param value - * allowed object is - * {@link String } - * - */ - public void setDName(String value) { - this.dName = value; - } - -} diff --git a/Plugins/Mineplex.BungeeRotator/src/com/neustar/ultraservice/schema/v01/ResourceRecordToUpdate.java b/Plugins/Mineplex.BungeeRotator/src/com/neustar/ultraservice/schema/v01/ResourceRecordToUpdate.java deleted file mode 100644 index d67fcc61d..000000000 --- a/Plugins/Mineplex.BungeeRotator/src/com/neustar/ultraservice/schema/v01/ResourceRecordToUpdate.java +++ /dev/null @@ -1,163 +0,0 @@ - -package com.neustar.ultraservice.schema.v01; - -import javax.xml.bind.annotation.XmlAccessType; -import javax.xml.bind.annotation.XmlAccessorType; -import javax.xml.bind.annotation.XmlAttribute; -import javax.xml.bind.annotation.XmlElement; -import javax.xml.bind.annotation.XmlType; - - -/** - *

Java class for ResourceRecordToUpdate complex type. - * - *

The following schema fragment specifies the expected content contained within this class. - * - *

- * <complexType name="ResourceRecordToUpdate">
- *   <complexContent>
- *     <restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
- *       <sequence>
- *         <element name="InfoValues" type="{http://schema.ultraservice.neustar.com/v01/}InfoValues"/>
- *       </sequence>
- *       <attribute name="Guid" use="required" type="{http://www.w3.org/2001/XMLSchema}string" />
- *       <attribute name="Type" use="required" type="{http://www.w3.org/2001/XMLSchema}int" />
- *       <attribute name="DName" type="{http://www.w3.org/2001/XMLSchema}string" />
- *       <attribute name="TTL" type="{http://www.w3.org/2001/XMLSchema}string" />
- *     </restriction>
- *   </complexContent>
- * </complexType>
- * 
- * - * - */ -@XmlAccessorType(XmlAccessType.FIELD) -@XmlType(name = "ResourceRecordToUpdate", propOrder = { - "infoValues" -}) -public class ResourceRecordToUpdate { - - @XmlElement(name = "InfoValues", required = true) - protected InfoValues infoValues; - @XmlAttribute(name = "Guid", required = true) - protected String guid; - @XmlAttribute(name = "Type", required = true) - protected int type; - @XmlAttribute(name = "DName") - protected String dName; - @XmlAttribute(name = "TTL") - protected String ttl; - - /** - * Gets the value of the infoValues property. - * - * @return - * possible object is - * {@link InfoValues } - * - */ - public InfoValues getInfoValues() { - return infoValues; - } - - /** - * Sets the value of the infoValues property. - * - * @param value - * allowed object is - * {@link InfoValues } - * - */ - public void setInfoValues(InfoValues value) { - this.infoValues = value; - } - - /** - * Gets the value of the guid property. - * - * @return - * possible object is - * {@link String } - * - */ - public String getGuid() { - return guid; - } - - /** - * Sets the value of the guid property. - * - * @param value - * allowed object is - * {@link String } - * - */ - public void setGuid(String value) { - this.guid = value; - } - - /** - * Gets the value of the type property. - * - */ - public int getType() { - return type; - } - - /** - * Sets the value of the type property. - * - */ - public void setType(int value) { - this.type = value; - } - - /** - * Gets the value of the dName property. - * - * @return - * possible object is - * {@link String } - * - */ - public String getDName() { - return dName; - } - - /** - * Sets the value of the dName property. - * - * @param value - * allowed object is - * {@link String } - * - */ - public void setDName(String value) { - this.dName = value; - } - - /** - * Gets the value of the ttl property. - * - * @return - * possible object is - * {@link String } - * - */ - public String getTTL() { - return ttl; - } - - /** - * Sets the value of the ttl property. - * - * @param value - * allowed object is - * {@link String } - * - */ - public void setTTL(String value) { - this.ttl = value; - } - -} diff --git a/Plugins/Mineplex.BungeeRotator/src/com/neustar/ultraservice/schema/v01/ResourceRecordType.java b/Plugins/Mineplex.BungeeRotator/src/com/neustar/ultraservice/schema/v01/ResourceRecordType.java deleted file mode 100644 index 47054e233..000000000 --- a/Plugins/Mineplex.BungeeRotator/src/com/neustar/ultraservice/schema/v01/ResourceRecordType.java +++ /dev/null @@ -1,90 +0,0 @@ - -package com.neustar.ultraservice.schema.v01; - -import javax.xml.bind.annotation.XmlEnum; -import javax.xml.bind.annotation.XmlEnumValue; -import javax.xml.bind.annotation.XmlType; - - -/** - *

Java class for ResourceRecordType. - * - *

The following schema fragment specifies the expected content contained within this class. - *

- *

- * <simpleType name="ResourceRecordType">
- *   <restriction base="{http://www.w3.org/2001/XMLSchema}string">
- *     <enumeration value="Directional"/>
- *     <enumeration value="Load Balancing"/>
- *     <enumeration value="A (IPv4 Host)"/>
- *     <enumeration value="AAAA (IPv6 Host)"/>
- *     <enumeration value="CNAME (Alias)"/>
- *     <enumeration value="Web Forwarding"/>
- *     <enumeration value="MX (Mail Exchange)"/>
- *     <enumeration value="TXT (Text)"/>
- *     <enumeration value="SRV (Service Locator)"/>
- *     <enumeration value="NS (Nameserver)"/>
- *     <enumeration value="PTR (Pointer)"/>
- *     <enumeration value="RP (Responsible Person)"/>
- *     <enumeration value="HINFO (Host Info)"/>
- *     <enumeration value="NAPTR (Naming Authority Pointer)"/>
- *     <enumeration value="SPF (Sender Policy Framework)"/>
- *   </restriction>
- * </simpleType>
- * 
- * - */ -@XmlType(name = "ResourceRecordType") -@XmlEnum -public enum ResourceRecordType { - - @XmlEnumValue("Directional") - DIRECTIONAL("Directional"), - @XmlEnumValue("Load Balancing") - LOAD_BALANCING("Load Balancing"), - @XmlEnumValue("A (IPv4 Host)") - A_I_PV_4_HOST("A (IPv4 Host)"), - @XmlEnumValue("AAAA (IPv6 Host)") - AAAA_I_PV_6_HOST("AAAA (IPv6 Host)"), - @XmlEnumValue("CNAME (Alias)") - CNAME_ALIAS("CNAME (Alias)"), - @XmlEnumValue("Web Forwarding") - WEB_FORWARDING("Web Forwarding"), - @XmlEnumValue("MX (Mail Exchange)") - MX_MAIL_EXCHANGE("MX (Mail Exchange)"), - @XmlEnumValue("TXT (Text)") - TXT_TEXT("TXT (Text)"), - @XmlEnumValue("SRV (Service Locator)") - SRV_SERVICE_LOCATOR("SRV (Service Locator)"), - @XmlEnumValue("NS (Nameserver)") - NS_NAMESERVER("NS (Nameserver)"), - @XmlEnumValue("PTR (Pointer)") - PTR_POINTER("PTR (Pointer)"), - @XmlEnumValue("RP (Responsible Person)") - RP_RESPONSIBLE_PERSON("RP (Responsible Person)"), - @XmlEnumValue("HINFO (Host Info)") - HINFO_HOST_INFO("HINFO (Host Info)"), - @XmlEnumValue("NAPTR (Naming Authority Pointer)") - NAPTR_NAMING_AUTHORITY_POINTER("NAPTR (Naming Authority Pointer)"), - @XmlEnumValue("SPF (Sender Policy Framework)") - SPF_SENDER_POLICY_FRAMEWORK("SPF (Sender Policy Framework)"); - private final String value; - - ResourceRecordType(String v) { - value = v; - } - - public String value() { - return value; - } - - public static ResourceRecordType fromValue(String v) { - for (ResourceRecordType c: ResourceRecordType.values()) { - if (c.value.equals(v)) { - return c; - } - } - throw new IllegalArgumentException(v); - } - -} diff --git a/Plugins/Mineplex.BungeeRotator/src/com/neustar/ultraservice/schema/v01/ResourceRecordTypeOrderInfo.java b/Plugins/Mineplex.BungeeRotator/src/com/neustar/ultraservice/schema/v01/ResourceRecordTypeOrderInfo.java deleted file mode 100644 index 885e83912..000000000 --- a/Plugins/Mineplex.BungeeRotator/src/com/neustar/ultraservice/schema/v01/ResourceRecordTypeOrderInfo.java +++ /dev/null @@ -1,98 +0,0 @@ - -package com.neustar.ultraservice.schema.v01; - -import javax.xml.bind.annotation.XmlAccessType; -import javax.xml.bind.annotation.XmlAccessorType; -import javax.xml.bind.annotation.XmlAttribute; -import javax.xml.bind.annotation.XmlType; - - -/** - *

Java class for ResourceRecordTypeOrderInfo complex type. - * - *

The following schema fragment specifies the expected content contained within this class. - * - *

- * <complexType name="ResourceRecordTypeOrderInfo">
- *   <complexContent>
- *     <restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
- *       <sequence>
- *       </sequence>
- *       <attribute name="recordOrder" use="required" type="{http://www.w3.org/2001/XMLSchema}int" />
- *       <attribute name="recordType" use="required" type="{http://schema.ultraservice.neustar.com/v01/}ResourceRecordType" />
- *       <attribute name="recordDisplay" use="required" type="{http://www.w3.org/2001/XMLSchema}boolean" />
- *     </restriction>
- *   </complexContent>
- * </complexType>
- * 
- * - * - */ -@XmlAccessorType(XmlAccessType.FIELD) -@XmlType(name = "ResourceRecordTypeOrderInfo") -public class ResourceRecordTypeOrderInfo { - - @XmlAttribute(name = "recordOrder", required = true) - protected int recordOrder; - @XmlAttribute(name = "recordType", required = true) - protected ResourceRecordType recordType; - @XmlAttribute(name = "recordDisplay", required = true) - protected boolean recordDisplay; - - /** - * Gets the value of the recordOrder property. - * - */ - public int getRecordOrder() { - return recordOrder; - } - - /** - * Sets the value of the recordOrder property. - * - */ - public void setRecordOrder(int value) { - this.recordOrder = value; - } - - /** - * Gets the value of the recordType property. - * - * @return - * possible object is - * {@link ResourceRecordType } - * - */ - public ResourceRecordType getRecordType() { - return recordType; - } - - /** - * Sets the value of the recordType property. - * - * @param value - * allowed object is - * {@link ResourceRecordType } - * - */ - public void setRecordType(ResourceRecordType value) { - this.recordType = value; - } - - /** - * Gets the value of the recordDisplay property. - * - */ - public boolean isRecordDisplay() { - return recordDisplay; - } - - /** - * Sets the value of the recordDisplay property. - * - */ - public void setRecordDisplay(boolean value) { - this.recordDisplay = value; - } - -} diff --git a/Plugins/Mineplex.BungeeRotator/src/com/neustar/ultraservice/schema/v01/ResourceRecordTypeOrderInfoList.java b/Plugins/Mineplex.BungeeRotator/src/com/neustar/ultraservice/schema/v01/ResourceRecordTypeOrderInfoList.java deleted file mode 100644 index 4da41142a..000000000 --- a/Plugins/Mineplex.BungeeRotator/src/com/neustar/ultraservice/schema/v01/ResourceRecordTypeOrderInfoList.java +++ /dev/null @@ -1,69 +0,0 @@ - -package com.neustar.ultraservice.schema.v01; - -import java.util.ArrayList; -import java.util.List; -import javax.xml.bind.annotation.XmlAccessType; -import javax.xml.bind.annotation.XmlAccessorType; -import javax.xml.bind.annotation.XmlElement; -import javax.xml.bind.annotation.XmlType; - - -/** - *

Java class for ResourceRecordTypeOrderInfoList complex type. - * - *

The following schema fragment specifies the expected content contained within this class. - * - *

- * <complexType name="ResourceRecordTypeOrderInfoList">
- *   <complexContent>
- *     <restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
- *       <sequence>
- *         <element name="ResourceRecordTypeOrderInfo" type="{http://schema.ultraservice.neustar.com/v01/}ResourceRecordTypeOrderInfo" maxOccurs="unbounded"/>
- *       </sequence>
- *     </restriction>
- *   </complexContent>
- * </complexType>
- * 
- * - * - */ -@XmlAccessorType(XmlAccessType.FIELD) -@XmlType(name = "ResourceRecordTypeOrderInfoList", propOrder = { - "resourceRecordTypeOrderInfo" -}) -public class ResourceRecordTypeOrderInfoList { - - @XmlElement(name = "ResourceRecordTypeOrderInfo", required = true) - protected List resourceRecordTypeOrderInfo; - - /** - * Gets the value of the resourceRecordTypeOrderInfo property. - * - *

- * This accessor method returns a reference to the live list, - * not a snapshot. Therefore any modification you make to the - * returned list will be present inside the JAXB object. - * This is why there is not a set method for the resourceRecordTypeOrderInfo property. - * - *

- * For example, to add a new item, do as follows: - *

-     *    getResourceRecordTypeOrderInfo().add(newItem);
-     * 
- * - * - *

- * Objects of the following type(s) are allowed in the list - * {@link ResourceRecordTypeOrderInfo } - * - * - */ - public List getResourceRecordTypeOrderInfo() { - if (resourceRecordTypeOrderInfo == null) { - resourceRecordTypeOrderInfo = new ArrayList(); - } - return this.resourceRecordTypeOrderInfo; - } - -} diff --git a/Plugins/Mineplex.BungeeRotator/src/com/neustar/ultraservice/schema/v01/ResponseMethod.java b/Plugins/Mineplex.BungeeRotator/src/com/neustar/ultraservice/schema/v01/ResponseMethod.java deleted file mode 100644 index 0e89cc72f..000000000 --- a/Plugins/Mineplex.BungeeRotator/src/com/neustar/ultraservice/schema/v01/ResponseMethod.java +++ /dev/null @@ -1,42 +0,0 @@ - -package com.neustar.ultraservice.schema.v01; - -import javax.xml.bind.annotation.XmlEnum; -import javax.xml.bind.annotation.XmlType; - - -/** - *

Java class for ResponseMethod. - * - *

The following schema fragment specifies the expected content contained within this class. - *

- *

- * <simpleType name="ResponseMethod">
- *   <restriction base="{http://www.w3.org/2001/XMLSchema}string">
- *     <enumeration value="FIXED"/>
- *     <enumeration value="RANDOM"/>
- *     <enumeration value="ROUND_ROBIN"/>
- *     <enumeration value="WEIGHTED"/>
- *   </restriction>
- * </simpleType>
- * 
- * - */ -@XmlType(name = "ResponseMethod") -@XmlEnum -public enum ResponseMethod { - - FIXED, - RANDOM, - ROUND_ROBIN, - WEIGHTED; - - public String value() { - return name(); - } - - public static ResponseMethod fromValue(String v) { - return valueOf(v); - } - -} diff --git a/Plugins/Mineplex.BungeeRotator/src/com/neustar/ultraservice/schema/v01/RestrictIP.java b/Plugins/Mineplex.BungeeRotator/src/com/neustar/ultraservice/schema/v01/RestrictIP.java deleted file mode 100644 index 5198a1bfc..000000000 --- a/Plugins/Mineplex.BungeeRotator/src/com/neustar/ultraservice/schema/v01/RestrictIP.java +++ /dev/null @@ -1,195 +0,0 @@ - -package com.neustar.ultraservice.schema.v01; - -import javax.xml.bind.annotation.XmlAccessType; -import javax.xml.bind.annotation.XmlAccessorType; -import javax.xml.bind.annotation.XmlAttribute; -import javax.xml.bind.annotation.XmlType; - - -/** - *

Java class for RestrictIP complex type. - * - *

The following schema fragment specifies the expected content contained within this class. - * - *

- * <complexType name="RestrictIP">
- *   <complexContent>
- *     <restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
- *       <sequence>
- *       </sequence>
- *       <attribute name="guid" use="required" type="{http://www.w3.org/2001/XMLSchema}string" />
- *       <attribute name="startIP" use="required" type="{http://www.w3.org/2001/XMLSchema}string" />
- *       <attribute name="endIP" use="required" type="{http://www.w3.org/2001/XMLSchema}string" />
- *       <attribute name="keyID" use="required" type="{http://www.w3.org/2001/XMLSchema}string" />
- *       <attribute name="comments" use="required" type="{http://www.w3.org/2001/XMLSchema}string" />
- *       <attribute name="modified" use="required" type="{http://www.w3.org/2001/XMLSchema}string" />
- *     </restriction>
- *   </complexContent>
- * </complexType>
- * 
- * - * - */ -@XmlAccessorType(XmlAccessType.FIELD) -@XmlType(name = "RestrictIP") -public class RestrictIP { - - @XmlAttribute(name = "guid", required = true) - protected String guid; - @XmlAttribute(name = "startIP", required = true) - protected String startIP; - @XmlAttribute(name = "endIP", required = true) - protected String endIP; - @XmlAttribute(name = "keyID", required = true) - protected String keyID; - @XmlAttribute(name = "comments", required = true) - protected String comments; - @XmlAttribute(name = "modified", required = true) - protected String modified; - - /** - * Gets the value of the guid property. - * - * @return - * possible object is - * {@link String } - * - */ - public String getGuid() { - return guid; - } - - /** - * Sets the value of the guid property. - * - * @param value - * allowed object is - * {@link String } - * - */ - public void setGuid(String value) { - this.guid = value; - } - - /** - * Gets the value of the startIP property. - * - * @return - * possible object is - * {@link String } - * - */ - public String getStartIP() { - return startIP; - } - - /** - * Sets the value of the startIP property. - * - * @param value - * allowed object is - * {@link String } - * - */ - public void setStartIP(String value) { - this.startIP = value; - } - - /** - * Gets the value of the endIP property. - * - * @return - * possible object is - * {@link String } - * - */ - public String getEndIP() { - return endIP; - } - - /** - * Sets the value of the endIP property. - * - * @param value - * allowed object is - * {@link String } - * - */ - public void setEndIP(String value) { - this.endIP = value; - } - - /** - * Gets the value of the keyID property. - * - * @return - * possible object is - * {@link String } - * - */ - public String getKeyID() { - return keyID; - } - - /** - * Sets the value of the keyID property. - * - * @param value - * allowed object is - * {@link String } - * - */ - public void setKeyID(String value) { - this.keyID = value; - } - - /** - * Gets the value of the comments property. - * - * @return - * possible object is - * {@link String } - * - */ - public String getComments() { - return comments; - } - - /** - * Sets the value of the comments property. - * - * @param value - * allowed object is - * {@link String } - * - */ - public void setComments(String value) { - this.comments = value; - } - - /** - * Gets the value of the modified property. - * - * @return - * possible object is - * {@link String } - * - */ - public String getModified() { - return modified; - } - - /** - * Sets the value of the modified property. - * - * @param value - * allowed object is - * {@link String } - * - */ - public void setModified(String value) { - this.modified = value; - } - -} diff --git a/Plugins/Mineplex.BungeeRotator/src/com/neustar/ultraservice/schema/v01/RestrictIPList.java b/Plugins/Mineplex.BungeeRotator/src/com/neustar/ultraservice/schema/v01/RestrictIPList.java deleted file mode 100644 index cbc11ff64..000000000 --- a/Plugins/Mineplex.BungeeRotator/src/com/neustar/ultraservice/schema/v01/RestrictIPList.java +++ /dev/null @@ -1,69 +0,0 @@ - -package com.neustar.ultraservice.schema.v01; - -import java.util.ArrayList; -import java.util.List; -import javax.xml.bind.annotation.XmlAccessType; -import javax.xml.bind.annotation.XmlAccessorType; -import javax.xml.bind.annotation.XmlElement; -import javax.xml.bind.annotation.XmlType; - - -/** - *

Java class for RestrictIPList complex type. - * - *

The following schema fragment specifies the expected content contained within this class. - * - *

- * <complexType name="RestrictIPList">
- *   <complexContent>
- *     <restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
- *       <sequence>
- *         <element name="RestrictIP" type="{http://schema.ultraservice.neustar.com/v01/}RestrictIP" maxOccurs="unbounded"/>
- *       </sequence>
- *     </restriction>
- *   </complexContent>
- * </complexType>
- * 
- * - * - */ -@XmlAccessorType(XmlAccessType.FIELD) -@XmlType(name = "RestrictIPList", propOrder = { - "restrictIP" -}) -public class RestrictIPList { - - @XmlElement(name = "RestrictIP", required = true) - protected List restrictIP; - - /** - * Gets the value of the restrictIP property. - * - *

- * This accessor method returns a reference to the live list, - * not a snapshot. Therefore any modification you make to the - * returned list will be present inside the JAXB object. - * This is why there is not a set method for the restrictIP property. - * - *

- * For example, to add a new item, do as follows: - *

-     *    getRestrictIP().add(newItem);
-     * 
- * - * - *

- * Objects of the following type(s) are allowed in the list - * {@link RestrictIP } - * - * - */ - public List getRestrictIP() { - if (restrictIP == null) { - restrictIP = new ArrayList(); - } - return this.restrictIP; - } - -} diff --git a/Plugins/Mineplex.BungeeRotator/src/com/neustar/ultraservice/schema/v01/RoundRobinRecord.java b/Plugins/Mineplex.BungeeRotator/src/com/neustar/ultraservice/schema/v01/RoundRobinRecord.java deleted file mode 100644 index 0f31c0bc6..000000000 --- a/Plugins/Mineplex.BungeeRotator/src/com/neustar/ultraservice/schema/v01/RoundRobinRecord.java +++ /dev/null @@ -1,168 +0,0 @@ - -package com.neustar.ultraservice.schema.v01; - -import javax.xml.bind.annotation.XmlAccessType; -import javax.xml.bind.annotation.XmlAccessorType; -import javax.xml.bind.annotation.XmlAttribute; -import javax.xml.bind.annotation.XmlType; - - -/** - *

Java class for RoundRobinRecord complex type. - * - *

The following schema fragment specifies the expected content contained within this class. - * - *

- * <complexType name="RoundRobinRecord">
- *   <complexContent>
- *     <restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
- *       <sequence>
- *       </sequence>
- *       <attribute name="lbPoolID" use="required" type="{http://www.w3.org/2001/XMLSchema}string" />
- *       <attribute name="info1Value" use="required" type="{http://www.w3.org/2001/XMLSchema}string" />
- *       <attribute name="ZoneName" use="required" type="{http://www.w3.org/2001/XMLSchema}string" />
- *       <attribute name="Type" use="required" type="{http://www.w3.org/2001/XMLSchema}string" />
- *       <attribute name="TTL" type="{http://www.w3.org/2001/XMLSchema}string" />
- *     </restriction>
- *   </complexContent>
- * </complexType>
- * 
- * - * - */ -@XmlAccessorType(XmlAccessType.FIELD) -@XmlType(name = "RoundRobinRecord") -public class RoundRobinRecord { - - @XmlAttribute(name = "lbPoolID", required = true) - protected String lbPoolID; - @XmlAttribute(name = "info1Value", required = true) - protected String info1Value; - @XmlAttribute(name = "ZoneName", required = true) - protected String zoneName; - @XmlAttribute(name = "Type", required = true) - protected String type; - @XmlAttribute(name = "TTL") - protected String ttl; - - /** - * Gets the value of the lbPoolID property. - * - * @return - * possible object is - * {@link String } - * - */ - public String getLbPoolID() { - return lbPoolID; - } - - /** - * Sets the value of the lbPoolID property. - * - * @param value - * allowed object is - * {@link String } - * - */ - public void setLbPoolID(String value) { - this.lbPoolID = value; - } - - /** - * Gets the value of the info1Value property. - * - * @return - * possible object is - * {@link String } - * - */ - public String getInfo1Value() { - return info1Value; - } - - /** - * Sets the value of the info1Value property. - * - * @param value - * allowed object is - * {@link String } - * - */ - public void setInfo1Value(String value) { - this.info1Value = value; - } - - /** - * Gets the value of the zoneName property. - * - * @return - * possible object is - * {@link String } - * - */ - public String getZoneName() { - return zoneName; - } - - /** - * Sets the value of the zoneName property. - * - * @param value - * allowed object is - * {@link String } - * - */ - public void setZoneName(String value) { - this.zoneName = value; - } - - /** - * Gets the value of the type property. - * - * @return - * possible object is - * {@link String } - * - */ - public String getType() { - return type; - } - - /** - * Sets the value of the type property. - * - * @param value - * allowed object is - * {@link String } - * - */ - public void setType(String value) { - this.type = value; - } - - /** - * Gets the value of the ttl property. - * - * @return - * possible object is - * {@link String } - * - */ - public String getTTL() { - return ttl; - } - - /** - * Sets the value of the ttl property. - * - * @param value - * allowed object is - * {@link String } - * - */ - public void setTTL(String value) { - this.ttl = value; - } - -} diff --git a/Plugins/Mineplex.BungeeRotator/src/com/neustar/ultraservice/schema/v01/Rule.java b/Plugins/Mineplex.BungeeRotator/src/com/neustar/ultraservice/schema/v01/Rule.java deleted file mode 100644 index 0613fa798..000000000 --- a/Plugins/Mineplex.BungeeRotator/src/com/neustar/ultraservice/schema/v01/Rule.java +++ /dev/null @@ -1,341 +0,0 @@ - -package com.neustar.ultraservice.schema.v01; - -import javax.xml.bind.annotation.XmlAccessType; -import javax.xml.bind.annotation.XmlAccessorType; -import javax.xml.bind.annotation.XmlElement; -import javax.xml.bind.annotation.XmlType; - - -/** - *

Java class for Rule complex type. - * - *

The following schema fragment specifies the expected content contained within this class. - * - *

- * <complexType name="Rule">
- *   <complexContent>
- *     <restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
- *       <sequence>
- *         <element name="ruleName" type="{http://www.w3.org/2001/XMLSchema}string"/>
- *         <element name="priority" type="{http://www.w3.org/2001/XMLSchema}int"/>
- *         <element name="type" type="{http://schema.ultraservice.neustar.com/v01/}RuleType" minOccurs="0"/>
- *         <element name="description" type="{http://www.w3.org/2001/XMLSchema}string" minOccurs="0"/>
- *         <element name="status" type="{http://schema.ultraservice.neustar.com/v01/}StatusEnum" minOccurs="0"/>
- *         <element name="attachNewProbes" type="{http://www.w3.org/2001/XMLSchema}boolean"/>
- *         <element name="occurrences" type="{http://www.w3.org/2001/XMLSchema}int"/>
- *         <element name="timespan" type="{http://www.w3.org/2001/XMLSchema}int"/>
- *         <element name="changeState" type="{http://www.w3.org/2001/XMLSchema}boolean"/>
- *         <element name="stateDelay" type="{http://www.w3.org/2001/XMLSchema}int"/>
- *         <element name="weightPercentage" type="{http://www.w3.org/2001/XMLSchema}int"/>
- *         <element name="maxActiveAdjustment" type="{http://www.w3.org/2001/XMLSchema}int"/>
- *         <element name="maxResponseAdjustment" type="{http://www.w3.org/2001/XMLSchema}int"/>
- *         <element name="notifications" type="{http://schema.ultraservice.neustar.com/v01/}Notifications" minOccurs="0"/>
- *       </sequence>
- *     </restriction>
- *   </complexContent>
- * </complexType>
- * 
- * - * - */ -@XmlAccessorType(XmlAccessType.FIELD) -@XmlType(name = "Rule", propOrder = { - "ruleName", - "priority", - "type", - "description", - "status", - "attachNewProbes", - "occurrences", - "timespan", - "changeState", - "stateDelay", - "weightPercentage", - "maxActiveAdjustment", - "maxResponseAdjustment", - "notifications" -}) -public class Rule { - - @XmlElement(required = true) - protected String ruleName; - protected int priority; - protected RuleType type; - protected String description; - protected StatusEnum status; - protected boolean attachNewProbes; - protected int occurrences; - protected int timespan; - protected boolean changeState; - protected int stateDelay; - protected int weightPercentage; - protected int maxActiveAdjustment; - protected int maxResponseAdjustment; - protected Notifications notifications; - - /** - * Gets the value of the ruleName property. - * - * @return - * possible object is - * {@link String } - * - */ - public String getRuleName() { - return ruleName; - } - - /** - * Sets the value of the ruleName property. - * - * @param value - * allowed object is - * {@link String } - * - */ - public void setRuleName(String value) { - this.ruleName = value; - } - - /** - * Gets the value of the priority property. - * - */ - public int getPriority() { - return priority; - } - - /** - * Sets the value of the priority property. - * - */ - public void setPriority(int value) { - this.priority = value; - } - - /** - * Gets the value of the type property. - * - * @return - * possible object is - * {@link RuleType } - * - */ - public RuleType getType() { - return type; - } - - /** - * Sets the value of the type property. - * - * @param value - * allowed object is - * {@link RuleType } - * - */ - public void setType(RuleType value) { - this.type = value; - } - - /** - * Gets the value of the description property. - * - * @return - * possible object is - * {@link String } - * - */ - public String getDescription() { - return description; - } - - /** - * Sets the value of the description property. - * - * @param value - * allowed object is - * {@link String } - * - */ - public void setDescription(String value) { - this.description = value; - } - - /** - * Gets the value of the status property. - * - * @return - * possible object is - * {@link StatusEnum } - * - */ - public StatusEnum getStatus() { - return status; - } - - /** - * Sets the value of the status property. - * - * @param value - * allowed object is - * {@link StatusEnum } - * - */ - public void setStatus(StatusEnum value) { - this.status = value; - } - - /** - * Gets the value of the attachNewProbes property. - * - */ - public boolean isAttachNewProbes() { - return attachNewProbes; - } - - /** - * Sets the value of the attachNewProbes property. - * - */ - public void setAttachNewProbes(boolean value) { - this.attachNewProbes = value; - } - - /** - * Gets the value of the occurrences property. - * - */ - public int getOccurrences() { - return occurrences; - } - - /** - * Sets the value of the occurrences property. - * - */ - public void setOccurrences(int value) { - this.occurrences = value; - } - - /** - * Gets the value of the timespan property. - * - */ - public int getTimespan() { - return timespan; - } - - /** - * Sets the value of the timespan property. - * - */ - public void setTimespan(int value) { - this.timespan = value; - } - - /** - * Gets the value of the changeState property. - * - */ - public boolean isChangeState() { - return changeState; - } - - /** - * Sets the value of the changeState property. - * - */ - public void setChangeState(boolean value) { - this.changeState = value; - } - - /** - * Gets the value of the stateDelay property. - * - */ - public int getStateDelay() { - return stateDelay; - } - - /** - * Sets the value of the stateDelay property. - * - */ - public void setStateDelay(int value) { - this.stateDelay = value; - } - - /** - * Gets the value of the weightPercentage property. - * - */ - public int getWeightPercentage() { - return weightPercentage; - } - - /** - * Sets the value of the weightPercentage property. - * - */ - public void setWeightPercentage(int value) { - this.weightPercentage = value; - } - - /** - * Gets the value of the maxActiveAdjustment property. - * - */ - public int getMaxActiveAdjustment() { - return maxActiveAdjustment; - } - - /** - * Sets the value of the maxActiveAdjustment property. - * - */ - public void setMaxActiveAdjustment(int value) { - this.maxActiveAdjustment = value; - } - - /** - * Gets the value of the maxResponseAdjustment property. - * - */ - public int getMaxResponseAdjustment() { - return maxResponseAdjustment; - } - - /** - * Sets the value of the maxResponseAdjustment property. - * - */ - public void setMaxResponseAdjustment(int value) { - this.maxResponseAdjustment = value; - } - - /** - * Gets the value of the notifications property. - * - * @return - * possible object is - * {@link Notifications } - * - */ - public Notifications getNotifications() { - return notifications; - } - - /** - * Sets the value of the notifications property. - * - * @param value - * allowed object is - * {@link Notifications } - * - */ - public void setNotifications(Notifications value) { - this.notifications = value; - } - -} diff --git a/Plugins/Mineplex.BungeeRotator/src/com/neustar/ultraservice/schema/v01/RuleType.java b/Plugins/Mineplex.BungeeRotator/src/com/neustar/ultraservice/schema/v01/RuleType.java deleted file mode 100644 index 56da071fb..000000000 --- a/Plugins/Mineplex.BungeeRotator/src/com/neustar/ultraservice/schema/v01/RuleType.java +++ /dev/null @@ -1,42 +0,0 @@ - -package com.neustar.ultraservice.schema.v01; - -import javax.xml.bind.annotation.XmlEnum; -import javax.xml.bind.annotation.XmlType; - - -/** - *

Java class for RuleType. - * - *

The following schema fragment specifies the expected content contained within this class. - *

- *

- * <simpleType name="RuleType">
- *   <restriction base="{http://www.w3.org/2001/XMLSchema}string">
- *     <enumeration value="RESTORED"/>
- *     <enumeration value="ACTION"/>
- *     <enumeration value="FAILOVER"/>
- *     <enumeration value="FAILBACK"/>
- *   </restriction>
- * </simpleType>
- * 
- * - */ -@XmlType(name = "RuleType") -@XmlEnum -public enum RuleType { - - RESTORED, - ACTION, - FAILOVER, - FAILBACK; - - public String value() { - return name(); - } - - public static RuleType fromValue(String v) { - return valueOf(v); - } - -} diff --git a/Plugins/Mineplex.BungeeRotator/src/com/neustar/ultraservice/schema/v01/Rules.java b/Plugins/Mineplex.BungeeRotator/src/com/neustar/ultraservice/schema/v01/Rules.java deleted file mode 100644 index 7b2dd9917..000000000 --- a/Plugins/Mineplex.BungeeRotator/src/com/neustar/ultraservice/schema/v01/Rules.java +++ /dev/null @@ -1,67 +0,0 @@ - -package com.neustar.ultraservice.schema.v01; - -import java.util.ArrayList; -import java.util.List; -import javax.xml.bind.annotation.XmlAccessType; -import javax.xml.bind.annotation.XmlAccessorType; -import javax.xml.bind.annotation.XmlType; - - -/** - *

Java class for Rules complex type. - * - *

The following schema fragment specifies the expected content contained within this class. - * - *

- * <complexType name="Rules">
- *   <complexContent>
- *     <restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
- *       <sequence>
- *         <element name="rules" type="{http://schema.ultraservice.neustar.com/v01/}Rule" maxOccurs="unbounded" minOccurs="0"/>
- *       </sequence>
- *     </restriction>
- *   </complexContent>
- * </complexType>
- * 
- * - * - */ -@XmlAccessorType(XmlAccessType.FIELD) -@XmlType(name = "Rules", propOrder = { - "rules" -}) -public class Rules { - - protected List rules; - - /** - * Gets the value of the rules property. - * - *

- * This accessor method returns a reference to the live list, - * not a snapshot. Therefore any modification you make to the - * returned list will be present inside the JAXB object. - * This is why there is not a set method for the rules property. - * - *

- * For example, to add a new item, do as follows: - *

-     *    getRules().add(newItem);
-     * 
- * - * - *

- * Objects of the following type(s) are allowed in the list - * {@link Rule } - * - * - */ - public List getRules() { - if (rules == null) { - rules = new ArrayList(); - } - return this.rules; - } - -} diff --git a/Plugins/Mineplex.BungeeRotator/src/com/neustar/ultraservice/schema/v01/SBAgentsData.java b/Plugins/Mineplex.BungeeRotator/src/com/neustar/ultraservice/schema/v01/SBAgentsData.java deleted file mode 100644 index bfd696663..000000000 --- a/Plugins/Mineplex.BungeeRotator/src/com/neustar/ultraservice/schema/v01/SBAgentsData.java +++ /dev/null @@ -1,114 +0,0 @@ - -package com.neustar.ultraservice.schema.v01; - -import javax.xml.bind.annotation.XmlAccessType; -import javax.xml.bind.annotation.XmlAccessorType; -import javax.xml.bind.annotation.XmlAttribute; -import javax.xml.bind.annotation.XmlType; - - -/** - *

Java class for SBAgentsData complex type. - * - *

The following schema fragment specifies the expected content contained within this class. - * - *

- * <complexType name="SBAgentsData">
- *   <complexContent>
- *     <restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
- *       <sequence>
- *       </sequence>
- *       <attribute name="AgentName" type="{http://www.w3.org/2001/XMLSchema}string" />
- *       <attribute name="RegionName" type="{http://www.w3.org/2001/XMLSchema}string" />
- *       <attribute name="RegionId" type="{http://www.w3.org/2001/XMLSchema}string" />
- *     </restriction>
- *   </complexContent>
- * </complexType>
- * 
- * - * - */ -@XmlAccessorType(XmlAccessType.FIELD) -@XmlType(name = "SBAgentsData") -public class SBAgentsData { - - @XmlAttribute(name = "AgentName") - protected String agentName; - @XmlAttribute(name = "RegionName") - protected String regionName; - @XmlAttribute(name = "RegionId") - protected String regionId; - - /** - * Gets the value of the agentName property. - * - * @return - * possible object is - * {@link String } - * - */ - public String getAgentName() { - return agentName; - } - - /** - * Sets the value of the agentName property. - * - * @param value - * allowed object is - * {@link String } - * - */ - public void setAgentName(String value) { - this.agentName = value; - } - - /** - * Gets the value of the regionName property. - * - * @return - * possible object is - * {@link String } - * - */ - public String getRegionName() { - return regionName; - } - - /** - * Sets the value of the regionName property. - * - * @param value - * allowed object is - * {@link String } - * - */ - public void setRegionName(String value) { - this.regionName = value; - } - - /** - * Gets the value of the regionId property. - * - * @return - * possible object is - * {@link String } - * - */ - public String getRegionId() { - return regionId; - } - - /** - * Sets the value of the regionId property. - * - * @param value - * allowed object is - * {@link String } - * - */ - public void setRegionId(String value) { - this.regionId = value; - } - -} diff --git a/Plugins/Mineplex.BungeeRotator/src/com/neustar/ultraservice/schema/v01/SBAgentsList.java b/Plugins/Mineplex.BungeeRotator/src/com/neustar/ultraservice/schema/v01/SBAgentsList.java deleted file mode 100644 index 0cac52092..000000000 --- a/Plugins/Mineplex.BungeeRotator/src/com/neustar/ultraservice/schema/v01/SBAgentsList.java +++ /dev/null @@ -1,69 +0,0 @@ - -package com.neustar.ultraservice.schema.v01; - -import java.util.ArrayList; -import java.util.List; -import javax.xml.bind.annotation.XmlAccessType; -import javax.xml.bind.annotation.XmlAccessorType; -import javax.xml.bind.annotation.XmlElement; -import javax.xml.bind.annotation.XmlType; - - -/** - *

Java class for SBAgentsList complex type. - * - *

The following schema fragment specifies the expected content contained within this class. - * - *

- * <complexType name="SBAgentsList">
- *   <complexContent>
- *     <restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
- *       <sequence>
- *         <element name="SBAgentsData" type="{http://schema.ultraservice.neustar.com/v01/}SBAgentsData" maxOccurs="unbounded"/>
- *       </sequence>
- *     </restriction>
- *   </complexContent>
- * </complexType>
- * 
- * - * - */ -@XmlAccessorType(XmlAccessType.FIELD) -@XmlType(name = "SBAgentsList", propOrder = { - "sbAgentsData" -}) -public class SBAgentsList { - - @XmlElement(name = "SBAgentsData", required = true) - protected List sbAgentsData; - - /** - * Gets the value of the sbAgentsData property. - * - *

- * This accessor method returns a reference to the live list, - * not a snapshot. Therefore any modification you make to the - * returned list will be present inside the JAXB object. - * This is why there is not a set method for the sbAgentsData property. - * - *

- * For example, to add a new item, do as follows: - *

-     *    getSBAgentsData().add(newItem);
-     * 
- * - * - *

- * Objects of the following type(s) are allowed in the list - * {@link SBAgentsData } - * - * - */ - public List getSBAgentsData() { - if (sbAgentsData == null) { - sbAgentsData = new ArrayList(); - } - return this.sbAgentsData; - } - -} diff --git a/Plugins/Mineplex.BungeeRotator/src/com/neustar/ultraservice/schema/v01/SBRegionData.java b/Plugins/Mineplex.BungeeRotator/src/com/neustar/ultraservice/schema/v01/SBRegionData.java deleted file mode 100644 index 170d24b7a..000000000 --- a/Plugins/Mineplex.BungeeRotator/src/com/neustar/ultraservice/schema/v01/SBRegionData.java +++ /dev/null @@ -1,87 +0,0 @@ - -package com.neustar.ultraservice.schema.v01; - -import javax.xml.bind.annotation.XmlAccessType; -import javax.xml.bind.annotation.XmlAccessorType; -import javax.xml.bind.annotation.XmlAttribute; -import javax.xml.bind.annotation.XmlType; - - -/** - *

Java class for SBRegionData complex type. - * - *

The following schema fragment specifies the expected content contained within this class. - * - *

- * <complexType name="SBRegionData">
- *   <complexContent>
- *     <restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
- *       <sequence>
- *       </sequence>
- *       <attribute name="RegionName" type="{http://www.w3.org/2001/XMLSchema}string" />
- *       <attribute name="RegionId" type="{http://www.w3.org/2001/XMLSchema}string" />
- *     </restriction>
- *   </complexContent>
- * </complexType>
- * 
- * - * - */ -@XmlAccessorType(XmlAccessType.FIELD) -@XmlType(name = "SBRegionData") -public class SBRegionData { - - @XmlAttribute(name = "RegionName") - protected String regionName; - @XmlAttribute(name = "RegionId") - protected String regionId; - - /** - * Gets the value of the regionName property. - * - * @return - * possible object is - * {@link String } - * - */ - public String getRegionName() { - return regionName; - } - - /** - * Sets the value of the regionName property. - * - * @param value - * allowed object is - * {@link String } - * - */ - public void setRegionName(String value) { - this.regionName = value; - } - - /** - * Gets the value of the regionId property. - * - * @return - * possible object is - * {@link String } - * - */ - public String getRegionId() { - return regionId; - } - - /** - * Sets the value of the regionId property. - * - * @param value - * allowed object is - * {@link String } - * - */ - public void setRegionId(String value) { - this.regionId = value; - } - -} diff --git a/Plugins/Mineplex.BungeeRotator/src/com/neustar/ultraservice/schema/v01/SBRegionsList.java b/Plugins/Mineplex.BungeeRotator/src/com/neustar/ultraservice/schema/v01/SBRegionsList.java deleted file mode 100644 index 3f112d90f..000000000 --- a/Plugins/Mineplex.BungeeRotator/src/com/neustar/ultraservice/schema/v01/SBRegionsList.java +++ /dev/null @@ -1,69 +0,0 @@ - -package com.neustar.ultraservice.schema.v01; - -import java.util.ArrayList; -import java.util.List; -import javax.xml.bind.annotation.XmlAccessType; -import javax.xml.bind.annotation.XmlAccessorType; -import javax.xml.bind.annotation.XmlElement; -import javax.xml.bind.annotation.XmlType; - - -/** - *

Java class for SBRegionsList complex type. - * - *

The following schema fragment specifies the expected content contained within this class. - * - *

- * <complexType name="SBRegionsList">
- *   <complexContent>
- *     <restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
- *       <sequence>
- *         <element name="SBRegionData" type="{http://schema.ultraservice.neustar.com/v01/}SBRegionData" maxOccurs="unbounded"/>
- *       </sequence>
- *     </restriction>
- *   </complexContent>
- * </complexType>
- * 
- * - * - */ -@XmlAccessorType(XmlAccessType.FIELD) -@XmlType(name = "SBRegionsList", propOrder = { - "sbRegionData" -}) -public class SBRegionsList { - - @XmlElement(name = "SBRegionData", required = true) - protected List sbRegionData; - - /** - * Gets the value of the sbRegionData property. - * - *

- * This accessor method returns a reference to the live list, - * not a snapshot. Therefore any modification you make to the - * returned list will be present inside the JAXB object. - * This is why there is not a set method for the sbRegionData property. - * - *

- * For example, to add a new item, do as follows: - *

-     *    getSBRegionData().add(newItem);
-     * 
- * - * - *

- * Objects of the following type(s) are allowed in the list - * {@link SBRegionData } - * - * - */ - public List getSBRegionData() { - if (sbRegionData == null) { - sbRegionData = new ArrayList(); - } - return this.sbRegionData; - } - -} diff --git a/Plugins/Mineplex.BungeeRotator/src/com/neustar/ultraservice/schema/v01/SMTP2Transaction.java b/Plugins/Mineplex.BungeeRotator/src/com/neustar/ultraservice/schema/v01/SMTP2Transaction.java deleted file mode 100644 index b80559850..000000000 --- a/Plugins/Mineplex.BungeeRotator/src/com/neustar/ultraservice/schema/v01/SMTP2Transaction.java +++ /dev/null @@ -1,215 +0,0 @@ - -package com.neustar.ultraservice.schema.v01; - -import javax.xml.bind.annotation.XmlAccessType; -import javax.xml.bind.annotation.XmlAccessorType; -import javax.xml.bind.annotation.XmlAttribute; -import javax.xml.bind.annotation.XmlType; - - -/** - *

Java class for SMTP2Transaction complex type. - * - *

The following schema fragment specifies the expected content contained within this class. - * - *

- * <complexType name="SMTP2Transaction">
- *   <complexContent>
- *     <restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
- *       <sequence>
- *         <element name="warningCriteria" type="{http://schema.ultraservice.neustar.com/v01/}SMTPCriteria" minOccurs="0"/>
- *         <element name="criticalCriteria" type="{http://schema.ultraservice.neustar.com/v01/}SMTPCriteria" minOccurs="0"/>
- *         <element name="failCriteria" type="{http://schema.ultraservice.neustar.com/v01/}SMTPCriteria" minOccurs="0"/>
- *       </sequence>
- *       <attribute name="port" use="required" type="{http://www.w3.org/2001/XMLSchema}int" />
- *       <attribute name="addressFrom" use="required" type="{http://www.w3.org/2001/XMLSchema}string" />
- *       <attribute name="addressTo" use="required" type="{http://www.w3.org/2001/XMLSchema}string" />
- *       <attribute name="messageBody" type="{http://www.w3.org/2001/XMLSchema}string" />
- *     </restriction>
- *   </complexContent>
- * </complexType>
- * 
- * - * - */ -@XmlAccessorType(XmlAccessType.FIELD) -@XmlType(name = "SMTP2Transaction", propOrder = { - "warningCriteria", - "criticalCriteria", - "failCriteria" -}) -public class SMTP2Transaction { - - protected SMTPCriteria warningCriteria; - protected SMTPCriteria criticalCriteria; - protected SMTPCriteria failCriteria; - @XmlAttribute(name = "port", required = true) - protected int port; - @XmlAttribute(name = "addressFrom", required = true) - protected String addressFrom; - @XmlAttribute(name = "addressTo", required = true) - protected String addressTo; - @XmlAttribute(name = "messageBody") - protected String messageBody; - - /** - * Gets the value of the warningCriteria property. - * - * @return - * possible object is - * {@link SMTPCriteria } - * - */ - public SMTPCriteria getWarningCriteria() { - return warningCriteria; - } - - /** - * Sets the value of the warningCriteria property. - * - * @param value - * allowed object is - * {@link SMTPCriteria } - * - */ - public void setWarningCriteria(SMTPCriteria value) { - this.warningCriteria = value; - } - - /** - * Gets the value of the criticalCriteria property. - * - * @return - * possible object is - * {@link SMTPCriteria } - * - */ - public SMTPCriteria getCriticalCriteria() { - return criticalCriteria; - } - - /** - * Sets the value of the criticalCriteria property. - * - * @param value - * allowed object is - * {@link SMTPCriteria } - * - */ - public void setCriticalCriteria(SMTPCriteria value) { - this.criticalCriteria = value; - } - - /** - * Gets the value of the failCriteria property. - * - * @return - * possible object is - * {@link SMTPCriteria } - * - */ - public SMTPCriteria getFailCriteria() { - return failCriteria; - } - - /** - * Sets the value of the failCriteria property. - * - * @param value - * allowed object is - * {@link SMTPCriteria } - * - */ - public void setFailCriteria(SMTPCriteria value) { - this.failCriteria = value; - } - - /** - * Gets the value of the port property. - * - */ - public int getPort() { - return port; - } - - /** - * Sets the value of the port property. - * - */ - public void setPort(int value) { - this.port = value; - } - - /** - * Gets the value of the addressFrom property. - * - * @return - * possible object is - * {@link String } - * - */ - public String getAddressFrom() { - return addressFrom; - } - - /** - * Sets the value of the addressFrom property. - * - * @param value - * allowed object is - * {@link String } - * - */ - public void setAddressFrom(String value) { - this.addressFrom = value; - } - - /** - * Gets the value of the addressTo property. - * - * @return - * possible object is - * {@link String } - * - */ - public String getAddressTo() { - return addressTo; - } - - /** - * Sets the value of the addressTo property. - * - * @param value - * allowed object is - * {@link String } - * - */ - public void setAddressTo(String value) { - this.addressTo = value; - } - - /** - * Gets the value of the messageBody property. - * - * @return - * possible object is - * {@link String } - * - */ - public String getMessageBody() { - return messageBody; - } - - /** - * Sets the value of the messageBody property. - * - * @param value - * allowed object is - * {@link String } - * - */ - public void setMessageBody(String value) { - this.messageBody = value; - } - -} diff --git a/Plugins/Mineplex.BungeeRotator/src/com/neustar/ultraservice/schema/v01/SMTPAvailabilityProbeData.java b/Plugins/Mineplex.BungeeRotator/src/com/neustar/ultraservice/schema/v01/SMTPAvailabilityProbeData.java deleted file mode 100644 index f6f9c1cf8..000000000 --- a/Plugins/Mineplex.BungeeRotator/src/com/neustar/ultraservice/schema/v01/SMTPAvailabilityProbeData.java +++ /dev/null @@ -1,438 +0,0 @@ - -package com.neustar.ultraservice.schema.v01; - -import javax.xml.bind.annotation.XmlAccessType; -import javax.xml.bind.annotation.XmlAccessorType; -import javax.xml.bind.annotation.XmlAttribute; -import javax.xml.bind.annotation.XmlType; - - -/** - *

Java class for SMTPAvailabilityProbeData complex type. - * - *

The following schema fragment specifies the expected content contained within this class. - * - *

- * <complexType name="SMTPAvailabilityProbeData">
- *   <complexContent>
- *     <restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
- *       <sequence>
- *       </sequence>
- *       <attribute name="port" type="{http://www.w3.org/2001/XMLSchema}string" />
- *       <attribute name="connectTime" type="{http://www.w3.org/2001/XMLSchema}string" />
- *       <attribute name="runtime" type="{http://www.w3.org/2001/XMLSchema}string" />
- *       <attribute name="failConnectTime" type="{http://www.w3.org/2001/XMLSchema}string" />
- *       <attribute name="criticalConnectTime" type="{http://www.w3.org/2001/XMLSchema}string" />
- *       <attribute name="warningConnectTime" type="{http://www.w3.org/2001/XMLSchema}string" />
- *       <attribute name="failRuntime" type="{http://www.w3.org/2001/XMLSchema}string" />
- *       <attribute name="criticalRuntime" type="{http://www.w3.org/2001/XMLSchema}string" />
- *       <attribute name="warningRuntime" type="{http://www.w3.org/2001/XMLSchema}string" />
- *       <attribute name="failAverageConnectTime" type="{http://www.w3.org/2001/XMLSchema}string" />
- *       <attribute name="criticalAverageConnectTime" type="{http://www.w3.org/2001/XMLSchema}string" />
- *       <attribute name="warningAverageConnectTime" type="{http://www.w3.org/2001/XMLSchema}string" />
- *       <attribute name="failAverageRunTime" type="{http://www.w3.org/2001/XMLSchema}string" />
- *       <attribute name="criticalAverageRunTime" type="{http://www.w3.org/2001/XMLSchema}string" />
- *       <attribute name="warningAverageRunTime" type="{http://www.w3.org/2001/XMLSchema}string" />
- *     </restriction>
- *   </complexContent>
- * </complexType>
- * 
- * - * - */ -@XmlAccessorType(XmlAccessType.FIELD) -@XmlType(name = "SMTPAvailabilityProbeData") -public class SMTPAvailabilityProbeData { - - @XmlAttribute(name = "port") - protected String port; - @XmlAttribute(name = "connectTime") - protected String connectTime; - @XmlAttribute(name = "runtime") - protected String runtime; - @XmlAttribute(name = "failConnectTime") - protected String failConnectTime; - @XmlAttribute(name = "criticalConnectTime") - protected String criticalConnectTime; - @XmlAttribute(name = "warningConnectTime") - protected String warningConnectTime; - @XmlAttribute(name = "failRuntime") - protected String failRuntime; - @XmlAttribute(name = "criticalRuntime") - protected String criticalRuntime; - @XmlAttribute(name = "warningRuntime") - protected String warningRuntime; - @XmlAttribute(name = "failAverageConnectTime") - protected String failAverageConnectTime; - @XmlAttribute(name = "criticalAverageConnectTime") - protected String criticalAverageConnectTime; - @XmlAttribute(name = "warningAverageConnectTime") - protected String warningAverageConnectTime; - @XmlAttribute(name = "failAverageRunTime") - protected String failAverageRunTime; - @XmlAttribute(name = "criticalAverageRunTime") - protected String criticalAverageRunTime; - @XmlAttribute(name = "warningAverageRunTime") - protected String warningAverageRunTime; - - /** - * Gets the value of the port property. - * - * @return - * possible object is - * {@link String } - * - */ - public String getPort() { - return port; - } - - /** - * Sets the value of the port property. - * - * @param value - * allowed object is - * {@link String } - * - */ - public void setPort(String value) { - this.port = value; - } - - /** - * Gets the value of the connectTime property. - * - * @return - * possible object is - * {@link String } - * - */ - public String getConnectTime() { - return connectTime; - } - - /** - * Sets the value of the connectTime property. - * - * @param value - * allowed object is - * {@link String } - * - */ - public void setConnectTime(String value) { - this.connectTime = value; - } - - /** - * Gets the value of the runtime property. - * - * @return - * possible object is - * {@link String } - * - */ - public String getRuntime() { - return runtime; - } - - /** - * Sets the value of the runtime property. - * - * @param value - * allowed object is - * {@link String } - * - */ - public void setRuntime(String value) { - this.runtime = value; - } - - /** - * Gets the value of the failConnectTime property. - * - * @return - * possible object is - * {@link String } - * - */ - public String getFailConnectTime() { - return failConnectTime; - } - - /** - * Sets the value of the failConnectTime property. - * - * @param value - * allowed object is - * {@link String } - * - */ - public void setFailConnectTime(String value) { - this.failConnectTime = value; - } - - /** - * Gets the value of the criticalConnectTime property. - * - * @return - * possible object is - * {@link String } - * - */ - public String getCriticalConnectTime() { - return criticalConnectTime; - } - - /** - * Sets the value of the criticalConnectTime property. - * - * @param value - * allowed object is - * {@link String } - * - */ - public void setCriticalConnectTime(String value) { - this.criticalConnectTime = value; - } - - /** - * Gets the value of the warningConnectTime property. - * - * @return - * possible object is - * {@link String } - * - */ - public String getWarningConnectTime() { - return warningConnectTime; - } - - /** - * Sets the value of the warningConnectTime property. - * - * @param value - * allowed object is - * {@link String } - * - */ - public void setWarningConnectTime(String value) { - this.warningConnectTime = value; - } - - /** - * Gets the value of the failRuntime property. - * - * @return - * possible object is - * {@link String } - * - */ - public String getFailRuntime() { - return failRuntime; - } - - /** - * Sets the value of the failRuntime property. - * - * @param value - * allowed object is - * {@link String } - * - */ - public void setFailRuntime(String value) { - this.failRuntime = value; - } - - /** - * Gets the value of the criticalRuntime property. - * - * @return - * possible object is - * {@link String } - * - */ - public String getCriticalRuntime() { - return criticalRuntime; - } - - /** - * Sets the value of the criticalRuntime property. - * - * @param value - * allowed object is - * {@link String } - * - */ - public void setCriticalRuntime(String value) { - this.criticalRuntime = value; - } - - /** - * Gets the value of the warningRuntime property. - * - * @return - * possible object is - * {@link String } - * - */ - public String getWarningRuntime() { - return warningRuntime; - } - - /** - * Sets the value of the warningRuntime property. - * - * @param value - * allowed object is - * {@link String } - * - */ - public void setWarningRuntime(String value) { - this.warningRuntime = value; - } - - /** - * Gets the value of the failAverageConnectTime property. - * - * @return - * possible object is - * {@link String } - * - */ - public String getFailAverageConnectTime() { - return failAverageConnectTime; - } - - /** - * Sets the value of the failAverageConnectTime property. - * - * @param value - * allowed object is - * {@link String } - * - */ - public void setFailAverageConnectTime(String value) { - this.failAverageConnectTime = value; - } - - /** - * Gets the value of the criticalAverageConnectTime property. - * - * @return - * possible object is - * {@link String } - * - */ - public String getCriticalAverageConnectTime() { - return criticalAverageConnectTime; - } - - /** - * Sets the value of the criticalAverageConnectTime property. - * - * @param value - * allowed object is - * {@link String } - * - */ - public void setCriticalAverageConnectTime(String value) { - this.criticalAverageConnectTime = value; - } - - /** - * Gets the value of the warningAverageConnectTime property. - * - * @return - * possible object is - * {@link String } - * - */ - public String getWarningAverageConnectTime() { - return warningAverageConnectTime; - } - - /** - * Sets the value of the warningAverageConnectTime property. - * - * @param value - * allowed object is - * {@link String } - * - */ - public void setWarningAverageConnectTime(String value) { - this.warningAverageConnectTime = value; - } - - /** - * Gets the value of the failAverageRunTime property. - * - * @return - * possible object is - * {@link String } - * - */ - public String getFailAverageRunTime() { - return failAverageRunTime; - } - - /** - * Sets the value of the failAverageRunTime property. - * - * @param value - * allowed object is - * {@link String } - * - */ - public void setFailAverageRunTime(String value) { - this.failAverageRunTime = value; - } - - /** - * Gets the value of the criticalAverageRunTime property. - * - * @return - * possible object is - * {@link String } - * - */ - public String getCriticalAverageRunTime() { - return criticalAverageRunTime; - } - - /** - * Sets the value of the criticalAverageRunTime property. - * - * @param value - * allowed object is - * {@link String } - * - */ - public void setCriticalAverageRunTime(String value) { - this.criticalAverageRunTime = value; - } - - /** - * Gets the value of the warningAverageRunTime property. - * - * @return - * possible object is - * {@link String } - * - */ - public String getWarningAverageRunTime() { - return warningAverageRunTime; - } - - /** - * Sets the value of the warningAverageRunTime property. - * - * @param value - * allowed object is - * {@link String } - * - */ - public void setWarningAverageRunTime(String value) { - this.warningAverageRunTime = value; - } - -} diff --git a/Plugins/Mineplex.BungeeRotator/src/com/neustar/ultraservice/schema/v01/SMTPCriteria.java b/Plugins/Mineplex.BungeeRotator/src/com/neustar/ultraservice/schema/v01/SMTPCriteria.java deleted file mode 100644 index d7fea1535..000000000 --- a/Plugins/Mineplex.BungeeRotator/src/com/neustar/ultraservice/schema/v01/SMTPCriteria.java +++ /dev/null @@ -1,125 +0,0 @@ - -package com.neustar.ultraservice.schema.v01; - -import javax.xml.bind.annotation.XmlAccessType; -import javax.xml.bind.annotation.XmlAccessorType; -import javax.xml.bind.annotation.XmlType; - - -/** - *

Java class for SMTPCriteria complex type. - * - *

The following schema fragment specifies the expected content contained within this class. - * - *

- * <complexType name="SMTPCriteria">
- *   <complexContent>
- *     <restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
- *       <sequence>
- *         <element name="runTime" type="{http://www.w3.org/2001/XMLSchema}int"/>
- *         <element name="runTimeAverage" type="{http://www.w3.org/2001/XMLSchema}int" minOccurs="0"/>
- *         <element name="connectTime" type="{http://www.w3.org/2001/XMLSchema}int"/>
- *         <element name="connectTimeAverage" type="{http://www.w3.org/2001/XMLSchema}int" minOccurs="0"/>
- *       </sequence>
- *     </restriction>
- *   </complexContent>
- * </complexType>
- * 
- * - * - */ -@XmlAccessorType(XmlAccessType.FIELD) -@XmlType(name = "SMTPCriteria", propOrder = { - "runTime", - "runTimeAverage", - "connectTime", - "connectTimeAverage" -}) -public class SMTPCriteria { - - protected int runTime; - protected Integer runTimeAverage; - protected int connectTime; - protected Integer connectTimeAverage; - - /** - * Gets the value of the runTime property. - * - */ - public int getRunTime() { - return runTime; - } - - /** - * Sets the value of the runTime property. - * - */ - public void setRunTime(int value) { - this.runTime = value; - } - - /** - * Gets the value of the runTimeAverage property. - * - * @return - * possible object is - * {@link Integer } - * - */ - public Integer getRunTimeAverage() { - return runTimeAverage; - } - - /** - * Sets the value of the runTimeAverage property. - * - * @param value - * allowed object is - * {@link Integer } - * - */ - public void setRunTimeAverage(Integer value) { - this.runTimeAverage = value; - } - - /** - * Gets the value of the connectTime property. - * - */ - public int getConnectTime() { - return connectTime; - } - - /** - * Sets the value of the connectTime property. - * - */ - public void setConnectTime(int value) { - this.connectTime = value; - } - - /** - * Gets the value of the connectTimeAverage property. - * - * @return - * possible object is - * {@link Integer } - * - */ - public Integer getConnectTimeAverage() { - return connectTimeAverage; - } - - /** - * Sets the value of the connectTimeAverage property. - * - * @param value - * allowed object is - * {@link Integer } - * - */ - public void setConnectTimeAverage(Integer value) { - this.connectTimeAverage = value; - } - -} diff --git a/Plugins/Mineplex.BungeeRotator/src/com/neustar/ultraservice/schema/v01/SMTPSendMailProbeData.java b/Plugins/Mineplex.BungeeRotator/src/com/neustar/ultraservice/schema/v01/SMTPSendMailProbeData.java deleted file mode 100644 index 72da0ff64..000000000 --- a/Plugins/Mineplex.BungeeRotator/src/com/neustar/ultraservice/schema/v01/SMTPSendMailProbeData.java +++ /dev/null @@ -1,519 +0,0 @@ - -package com.neustar.ultraservice.schema.v01; - -import javax.xml.bind.annotation.XmlAccessType; -import javax.xml.bind.annotation.XmlAccessorType; -import javax.xml.bind.annotation.XmlAttribute; -import javax.xml.bind.annotation.XmlType; - - -/** - *

Java class for SMTPSendMailProbeData complex type. - * - *

The following schema fragment specifies the expected content contained within this class. - * - *

- * <complexType name="SMTPSendMailProbeData">
- *   <complexContent>
- *     <restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
- *       <sequence>
- *       </sequence>
- *       <attribute name="port" type="{http://www.w3.org/2001/XMLSchema}string" />
- *       <attribute name="connectTime" type="{http://www.w3.org/2001/XMLSchema}string" />
- *       <attribute name="runtime" type="{http://www.w3.org/2001/XMLSchema}string" />
- *       <attribute name="failConnectTime" type="{http://www.w3.org/2001/XMLSchema}string" />
- *       <attribute name="criticalConnectTime" type="{http://www.w3.org/2001/XMLSchema}string" />
- *       <attribute name="warningConnectTime" type="{http://www.w3.org/2001/XMLSchema}string" />
- *       <attribute name="failRuntime" type="{http://www.w3.org/2001/XMLSchema}string" />
- *       <attribute name="criticalRuntime" type="{http://www.w3.org/2001/XMLSchema}string" />
- *       <attribute name="warningRuntime" type="{http://www.w3.org/2001/XMLSchema}string" />
- *       <attribute name="failAverageConnectTime" type="{http://www.w3.org/2001/XMLSchema}string" />
- *       <attribute name="criticalAverageConnectTime" type="{http://www.w3.org/2001/XMLSchema}string" />
- *       <attribute name="warningAverageConnectTime" type="{http://www.w3.org/2001/XMLSchema}string" />
- *       <attribute name="failAverageRunTime" type="{http://www.w3.org/2001/XMLSchema}string" />
- *       <attribute name="criticalAverageRunTime" type="{http://www.w3.org/2001/XMLSchema}string" />
- *       <attribute name="warningAverageRunTime" type="{http://www.w3.org/2001/XMLSchema}string" />
- *       <attribute name="mailFromAddress" type="{http://www.w3.org/2001/XMLSchema}string" />
- *       <attribute name="mailToAddress" type="{http://www.w3.org/2001/XMLSchema}string" />
- *       <attribute name="message" type="{http://www.w3.org/2001/XMLSchema}string" />
- *     </restriction>
- *   </complexContent>
- * </complexType>
- * 
- * - * - */ -@XmlAccessorType(XmlAccessType.FIELD) -@XmlType(name = "SMTPSendMailProbeData") -public class SMTPSendMailProbeData { - - @XmlAttribute(name = "port") - protected String port; - @XmlAttribute(name = "connectTime") - protected String connectTime; - @XmlAttribute(name = "runtime") - protected String runtime; - @XmlAttribute(name = "failConnectTime") - protected String failConnectTime; - @XmlAttribute(name = "criticalConnectTime") - protected String criticalConnectTime; - @XmlAttribute(name = "warningConnectTime") - protected String warningConnectTime; - @XmlAttribute(name = "failRuntime") - protected String failRuntime; - @XmlAttribute(name = "criticalRuntime") - protected String criticalRuntime; - @XmlAttribute(name = "warningRuntime") - protected String warningRuntime; - @XmlAttribute(name = "failAverageConnectTime") - protected String failAverageConnectTime; - @XmlAttribute(name = "criticalAverageConnectTime") - protected String criticalAverageConnectTime; - @XmlAttribute(name = "warningAverageConnectTime") - protected String warningAverageConnectTime; - @XmlAttribute(name = "failAverageRunTime") - protected String failAverageRunTime; - @XmlAttribute(name = "criticalAverageRunTime") - protected String criticalAverageRunTime; - @XmlAttribute(name = "warningAverageRunTime") - protected String warningAverageRunTime; - @XmlAttribute(name = "mailFromAddress") - protected String mailFromAddress; - @XmlAttribute(name = "mailToAddress") - protected String mailToAddress; - @XmlAttribute(name = "message") - protected String message; - - /** - * Gets the value of the port property. - * - * @return - * possible object is - * {@link String } - * - */ - public String getPort() { - return port; - } - - /** - * Sets the value of the port property. - * - * @param value - * allowed object is - * {@link String } - * - */ - public void setPort(String value) { - this.port = value; - } - - /** - * Gets the value of the connectTime property. - * - * @return - * possible object is - * {@link String } - * - */ - public String getConnectTime() { - return connectTime; - } - - /** - * Sets the value of the connectTime property. - * - * @param value - * allowed object is - * {@link String } - * - */ - public void setConnectTime(String value) { - this.connectTime = value; - } - - /** - * Gets the value of the runtime property. - * - * @return - * possible object is - * {@link String } - * - */ - public String getRuntime() { - return runtime; - } - - /** - * Sets the value of the runtime property. - * - * @param value - * allowed object is - * {@link String } - * - */ - public void setRuntime(String value) { - this.runtime = value; - } - - /** - * Gets the value of the failConnectTime property. - * - * @return - * possible object is - * {@link String } - * - */ - public String getFailConnectTime() { - return failConnectTime; - } - - /** - * Sets the value of the failConnectTime property. - * - * @param value - * allowed object is - * {@link String } - * - */ - public void setFailConnectTime(String value) { - this.failConnectTime = value; - } - - /** - * Gets the value of the criticalConnectTime property. - * - * @return - * possible object is - * {@link String } - * - */ - public String getCriticalConnectTime() { - return criticalConnectTime; - } - - /** - * Sets the value of the criticalConnectTime property. - * - * @param value - * allowed object is - * {@link String } - * - */ - public void setCriticalConnectTime(String value) { - this.criticalConnectTime = value; - } - - /** - * Gets the value of the warningConnectTime property. - * - * @return - * possible object is - * {@link String } - * - */ - public String getWarningConnectTime() { - return warningConnectTime; - } - - /** - * Sets the value of the warningConnectTime property. - * - * @param value - * allowed object is - * {@link String } - * - */ - public void setWarningConnectTime(String value) { - this.warningConnectTime = value; - } - - /** - * Gets the value of the failRuntime property. - * - * @return - * possible object is - * {@link String } - * - */ - public String getFailRuntime() { - return failRuntime; - } - - /** - * Sets the value of the failRuntime property. - * - * @param value - * allowed object is - * {@link String } - * - */ - public void setFailRuntime(String value) { - this.failRuntime = value; - } - - /** - * Gets the value of the criticalRuntime property. - * - * @return - * possible object is - * {@link String } - * - */ - public String getCriticalRuntime() { - return criticalRuntime; - } - - /** - * Sets the value of the criticalRuntime property. - * - * @param value - * allowed object is - * {@link String } - * - */ - public void setCriticalRuntime(String value) { - this.criticalRuntime = value; - } - - /** - * Gets the value of the warningRuntime property. - * - * @return - * possible object is - * {@link String } - * - */ - public String getWarningRuntime() { - return warningRuntime; - } - - /** - * Sets the value of the warningRuntime property. - * - * @param value - * allowed object is - * {@link String } - * - */ - public void setWarningRuntime(String value) { - this.warningRuntime = value; - } - - /** - * Gets the value of the failAverageConnectTime property. - * - * @return - * possible object is - * {@link String } - * - */ - public String getFailAverageConnectTime() { - return failAverageConnectTime; - } - - /** - * Sets the value of the failAverageConnectTime property. - * - * @param value - * allowed object is - * {@link String } - * - */ - public void setFailAverageConnectTime(String value) { - this.failAverageConnectTime = value; - } - - /** - * Gets the value of the criticalAverageConnectTime property. - * - * @return - * possible object is - * {@link String } - * - */ - public String getCriticalAverageConnectTime() { - return criticalAverageConnectTime; - } - - /** - * Sets the value of the criticalAverageConnectTime property. - * - * @param value - * allowed object is - * {@link String } - * - */ - public void setCriticalAverageConnectTime(String value) { - this.criticalAverageConnectTime = value; - } - - /** - * Gets the value of the warningAverageConnectTime property. - * - * @return - * possible object is - * {@link String } - * - */ - public String getWarningAverageConnectTime() { - return warningAverageConnectTime; - } - - /** - * Sets the value of the warningAverageConnectTime property. - * - * @param value - * allowed object is - * {@link String } - * - */ - public void setWarningAverageConnectTime(String value) { - this.warningAverageConnectTime = value; - } - - /** - * Gets the value of the failAverageRunTime property. - * - * @return - * possible object is - * {@link String } - * - */ - public String getFailAverageRunTime() { - return failAverageRunTime; - } - - /** - * Sets the value of the failAverageRunTime property. - * - * @param value - * allowed object is - * {@link String } - * - */ - public void setFailAverageRunTime(String value) { - this.failAverageRunTime = value; - } - - /** - * Gets the value of the criticalAverageRunTime property. - * - * @return - * possible object is - * {@link String } - * - */ - public String getCriticalAverageRunTime() { - return criticalAverageRunTime; - } - - /** - * Sets the value of the criticalAverageRunTime property. - * - * @param value - * allowed object is - * {@link String } - * - */ - public void setCriticalAverageRunTime(String value) { - this.criticalAverageRunTime = value; - } - - /** - * Gets the value of the warningAverageRunTime property. - * - * @return - * possible object is - * {@link String } - * - */ - public String getWarningAverageRunTime() { - return warningAverageRunTime; - } - - /** - * Sets the value of the warningAverageRunTime property. - * - * @param value - * allowed object is - * {@link String } - * - */ - public void setWarningAverageRunTime(String value) { - this.warningAverageRunTime = value; - } - - /** - * Gets the value of the mailFromAddress property. - * - * @return - * possible object is - * {@link String } - * - */ - public String getMailFromAddress() { - return mailFromAddress; - } - - /** - * Sets the value of the mailFromAddress property. - * - * @param value - * allowed object is - * {@link String } - * - */ - public void setMailFromAddress(String value) { - this.mailFromAddress = value; - } - - /** - * Gets the value of the mailToAddress property. - * - * @return - * possible object is - * {@link String } - * - */ - public String getMailToAddress() { - return mailToAddress; - } - - /** - * Sets the value of the mailToAddress property. - * - * @param value - * allowed object is - * {@link String } - * - */ - public void setMailToAddress(String value) { - this.mailToAddress = value; - } - - /** - * Gets the value of the message property. - * - * @return - * possible object is - * {@link String } - * - */ - public String getMessage() { - return message; - } - - /** - * Sets the value of the message property. - * - * @param value - * allowed object is - * {@link String } - * - */ - public void setMessage(String value) { - this.message = value; - } - -} diff --git a/Plugins/Mineplex.BungeeRotator/src/com/neustar/ultraservice/schema/v01/SMTPTransaction.java b/Plugins/Mineplex.BungeeRotator/src/com/neustar/ultraservice/schema/v01/SMTPTransaction.java deleted file mode 100644 index dc1c2fef2..000000000 --- a/Plugins/Mineplex.BungeeRotator/src/com/neustar/ultraservice/schema/v01/SMTPTransaction.java +++ /dev/null @@ -1,134 +0,0 @@ - -package com.neustar.ultraservice.schema.v01; - -import javax.xml.bind.annotation.XmlAccessType; -import javax.xml.bind.annotation.XmlAccessorType; -import javax.xml.bind.annotation.XmlAttribute; -import javax.xml.bind.annotation.XmlType; - - -/** - *

Java class for SMTPTransaction complex type. - * - *

The following schema fragment specifies the expected content contained within this class. - * - *

- * <complexType name="SMTPTransaction">
- *   <complexContent>
- *     <restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
- *       <sequence>
- *         <element name="warningCriteria" type="{http://schema.ultraservice.neustar.com/v01/}SMTPCriteria" minOccurs="0"/>
- *         <element name="criticalCriteria" type="{http://schema.ultraservice.neustar.com/v01/}SMTPCriteria" minOccurs="0"/>
- *         <element name="failCriteria" type="{http://schema.ultraservice.neustar.com/v01/}SMTPCriteria" minOccurs="0"/>
- *       </sequence>
- *       <attribute name="port" use="required" type="{http://www.w3.org/2001/XMLSchema}int" />
- *     </restriction>
- *   </complexContent>
- * </complexType>
- * 
- * - * - */ -@XmlAccessorType(XmlAccessType.FIELD) -@XmlType(name = "SMTPTransaction", propOrder = { - "warningCriteria", - "criticalCriteria", - "failCriteria" -}) -public class SMTPTransaction { - - protected SMTPCriteria warningCriteria; - protected SMTPCriteria criticalCriteria; - protected SMTPCriteria failCriteria; - @XmlAttribute(name = "port", required = true) - protected int port; - - /** - * Gets the value of the warningCriteria property. - * - * @return - * possible object is - * {@link SMTPCriteria } - * - */ - public SMTPCriteria getWarningCriteria() { - return warningCriteria; - } - - /** - * Sets the value of the warningCriteria property. - * - * @param value - * allowed object is - * {@link SMTPCriteria } - * - */ - public void setWarningCriteria(SMTPCriteria value) { - this.warningCriteria = value; - } - - /** - * Gets the value of the criticalCriteria property. - * - * @return - * possible object is - * {@link SMTPCriteria } - * - */ - public SMTPCriteria getCriticalCriteria() { - return criticalCriteria; - } - - /** - * Sets the value of the criticalCriteria property. - * - * @param value - * allowed object is - * {@link SMTPCriteria } - * - */ - public void setCriticalCriteria(SMTPCriteria value) { - this.criticalCriteria = value; - } - - /** - * Gets the value of the failCriteria property. - * - * @return - * possible object is - * {@link SMTPCriteria } - * - */ - public SMTPCriteria getFailCriteria() { - return failCriteria; - } - - /** - * Sets the value of the failCriteria property. - * - * @param value - * allowed object is - * {@link SMTPCriteria } - * - */ - public void setFailCriteria(SMTPCriteria value) { - this.failCriteria = value; - } - - /** - * Gets the value of the port property. - * - */ - public int getPort() { - return port; - } - - /** - * Sets the value of the port property. - * - */ - public void setPort(int value) { - this.port = value; - } - -} diff --git a/Plugins/Mineplex.BungeeRotator/src/com/neustar/ultraservice/schema/v01/SUBPOOLRecord.java b/Plugins/Mineplex.BungeeRotator/src/com/neustar/ultraservice/schema/v01/SUBPOOLRecord.java deleted file mode 100644 index 089640e01..000000000 --- a/Plugins/Mineplex.BungeeRotator/src/com/neustar/ultraservice/schema/v01/SUBPOOLRecord.java +++ /dev/null @@ -1,60 +0,0 @@ - -package com.neustar.ultraservice.schema.v01; - -import javax.xml.bind.annotation.XmlAccessType; -import javax.xml.bind.annotation.XmlAccessorType; -import javax.xml.bind.annotation.XmlAttribute; -import javax.xml.bind.annotation.XmlType; - - -/** - *

Java class for SUBPOOLRecord complex type. - * - *

The following schema fragment specifies the expected content contained within this class. - * - *

- * <complexType name="SUBPOOLRecord">
- *   <complexContent>
- *     <restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
- *       <sequence>
- *       </sequence>
- *       <attribute name="poolName" use="required" type="{http://www.w3.org/2001/XMLSchema}string" />
- *     </restriction>
- *   </complexContent>
- * </complexType>
- * 
- * - * - */ -@XmlAccessorType(XmlAccessType.FIELD) -@XmlType(name = "SUBPOOLRecord") -public class SUBPOOLRecord { - - @XmlAttribute(name = "poolName", required = true) - protected String poolName; - - /** - * Gets the value of the poolName property. - * - * @return - * possible object is - * {@link String } - * - */ - public String getPoolName() { - return poolName; - } - - /** - * Sets the value of the poolName property. - * - * @param value - * allowed object is - * {@link String } - * - */ - public void setPoolName(String value) { - this.poolName = value; - } - -} diff --git a/Plugins/Mineplex.BungeeRotator/src/com/neustar/ultraservice/schema/v01/ScheduledEvent.java b/Plugins/Mineplex.BungeeRotator/src/com/neustar/ultraservice/schema/v01/ScheduledEvent.java deleted file mode 100644 index f487f2c5a..000000000 --- a/Plugins/Mineplex.BungeeRotator/src/com/neustar/ultraservice/schema/v01/ScheduledEvent.java +++ /dev/null @@ -1,241 +0,0 @@ - -package com.neustar.ultraservice.schema.v01; - -import javax.xml.bind.annotation.XmlAccessType; -import javax.xml.bind.annotation.XmlAccessorType; -import javax.xml.bind.annotation.XmlAttribute; -import javax.xml.bind.annotation.XmlType; - - -/** - *

Java class for ScheduledEvent complex type. - * - *

The following schema fragment specifies the expected content contained within this class. - * - *

- * <complexType name="ScheduledEvent">
- *   <complexContent>
- *     <restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
- *       <sequence>
- *       </sequence>
- *       <attribute name="guid" type="{http://www.w3.org/2001/XMLSchema}string" />
- *       <attribute name="name" type="{http://www.w3.org/2001/XMLSchema}string" />
- *       <attribute name="action" type="{http://www.w3.org/2001/XMLSchema}string" />
- *       <attribute name="recurring" use="required" type="{http://www.w3.org/2001/XMLSchema}boolean" />
- *       <attribute name="eventEndDate" type="{http://www.w3.org/2001/XMLSchema}string" />
- *       <attribute name="eventStartDate" type="{http://www.w3.org/2001/XMLSchema}string" />
- *       <attribute name="recurringEndDate" type="{http://www.w3.org/2001/XMLSchema}string" />
- *       <attribute name="interval" type="{http://www.w3.org/2001/XMLSchema}string" />
- *     </restriction>
- *   </complexContent>
- * </complexType>
- * 
- * - * - */ -@XmlAccessorType(XmlAccessType.FIELD) -@XmlType(name = "ScheduledEvent") -public class ScheduledEvent { - - @XmlAttribute(name = "guid") - protected String guid; - @XmlAttribute(name = "name") - protected String name; - @XmlAttribute(name = "action") - protected String action; - @XmlAttribute(name = "recurring", required = true) - protected boolean recurring; - @XmlAttribute(name = "eventEndDate") - protected String eventEndDate; - @XmlAttribute(name = "eventStartDate") - protected String eventStartDate; - @XmlAttribute(name = "recurringEndDate") - protected String recurringEndDate; - @XmlAttribute(name = "interval") - protected String interval; - - /** - * Gets the value of the guid property. - * - * @return - * possible object is - * {@link String } - * - */ - public String getGuid() { - return guid; - } - - /** - * Sets the value of the guid property. - * - * @param value - * allowed object is - * {@link String } - * - */ - public void setGuid(String value) { - this.guid = value; - } - - /** - * Gets the value of the name property. - * - * @return - * possible object is - * {@link String } - * - */ - public String getName() { - return name; - } - - /** - * Sets the value of the name property. - * - * @param value - * allowed object is - * {@link String } - * - */ - public void setName(String value) { - this.name = value; - } - - /** - * Gets the value of the action property. - * - * @return - * possible object is - * {@link String } - * - */ - public String getAction() { - return action; - } - - /** - * Sets the value of the action property. - * - * @param value - * allowed object is - * {@link String } - * - */ - public void setAction(String value) { - this.action = value; - } - - /** - * Gets the value of the recurring property. - * - */ - public boolean isRecurring() { - return recurring; - } - - /** - * Sets the value of the recurring property. - * - */ - public void setRecurring(boolean value) { - this.recurring = value; - } - - /** - * Gets the value of the eventEndDate property. - * - * @return - * possible object is - * {@link String } - * - */ - public String getEventEndDate() { - return eventEndDate; - } - - /** - * Sets the value of the eventEndDate property. - * - * @param value - * allowed object is - * {@link String } - * - */ - public void setEventEndDate(String value) { - this.eventEndDate = value; - } - - /** - * Gets the value of the eventStartDate property. - * - * @return - * possible object is - * {@link String } - * - */ - public String getEventStartDate() { - return eventStartDate; - } - - /** - * Sets the value of the eventStartDate property. - * - * @param value - * allowed object is - * {@link String } - * - */ - public void setEventStartDate(String value) { - this.eventStartDate = value; - } - - /** - * Gets the value of the recurringEndDate property. - * - * @return - * possible object is - * {@link String } - * - */ - public String getRecurringEndDate() { - return recurringEndDate; - } - - /** - * Sets the value of the recurringEndDate property. - * - * @param value - * allowed object is - * {@link String } - * - */ - public void setRecurringEndDate(String value) { - this.recurringEndDate = value; - } - - /** - * Gets the value of the interval property. - * - * @return - * possible object is - * {@link String } - * - */ - public String getInterval() { - return interval; - } - - /** - * Sets the value of the interval property. - * - * @param value - * allowed object is - * {@link String } - * - */ - public void setInterval(String value) { - this.interval = value; - } - -} diff --git a/Plugins/Mineplex.BungeeRotator/src/com/neustar/ultraservice/schema/v01/ScheduledEventList.java b/Plugins/Mineplex.BungeeRotator/src/com/neustar/ultraservice/schema/v01/ScheduledEventList.java deleted file mode 100644 index f92426190..000000000 --- a/Plugins/Mineplex.BungeeRotator/src/com/neustar/ultraservice/schema/v01/ScheduledEventList.java +++ /dev/null @@ -1,69 +0,0 @@ - -package com.neustar.ultraservice.schema.v01; - -import java.util.ArrayList; -import java.util.List; -import javax.xml.bind.annotation.XmlAccessType; -import javax.xml.bind.annotation.XmlAccessorType; -import javax.xml.bind.annotation.XmlElement; -import javax.xml.bind.annotation.XmlType; - - -/** - *

Java class for ScheduledEventList complex type. - * - *

The following schema fragment specifies the expected content contained within this class. - * - *

- * <complexType name="ScheduledEventList">
- *   <complexContent>
- *     <restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
- *       <sequence>
- *         <element name="ScheduledEvent" type="{http://schema.ultraservice.neustar.com/v01/}ScheduledEvent" maxOccurs="unbounded"/>
- *       </sequence>
- *     </restriction>
- *   </complexContent>
- * </complexType>
- * 
- * - * - */ -@XmlAccessorType(XmlAccessType.FIELD) -@XmlType(name = "ScheduledEventList", propOrder = { - "scheduledEvent" -}) -public class ScheduledEventList { - - @XmlElement(name = "ScheduledEvent", required = true) - protected List scheduledEvent; - - /** - * Gets the value of the scheduledEvent property. - * - *

- * This accessor method returns a reference to the live list, - * not a snapshot. Therefore any modification you make to the - * returned list will be present inside the JAXB object. - * This is why there is not a set method for the scheduledEvent property. - * - *

- * For example, to add a new item, do as follows: - *

-     *    getScheduledEvent().add(newItem);
-     * 
- * - * - *

- * Objects of the following type(s) are allowed in the list - * {@link ScheduledEvent } - * - * - */ - public List getScheduledEvent() { - if (scheduledEvent == null) { - scheduledEvent = new ArrayList(); - } - return this.scheduledEvent; - } - -} diff --git a/Plugins/Mineplex.BungeeRotator/src/com/neustar/ultraservice/schema/v01/SecurityPreferences.java b/Plugins/Mineplex.BungeeRotator/src/com/neustar/ultraservice/schema/v01/SecurityPreferences.java deleted file mode 100644 index 262cd59ab..000000000 --- a/Plugins/Mineplex.BungeeRotator/src/com/neustar/ultraservice/schema/v01/SecurityPreferences.java +++ /dev/null @@ -1,118 +0,0 @@ - -package com.neustar.ultraservice.schema.v01; - -import javax.xml.bind.annotation.XmlAccessType; -import javax.xml.bind.annotation.XmlAccessorType; -import javax.xml.bind.annotation.XmlElement; -import javax.xml.bind.annotation.XmlType; - - -/** - *

Java class for SecurityPreferences complex type. - * - *

The following schema fragment specifies the expected content contained within this class. - * - *

- * <complexType name="SecurityPreferences">
- *   <complexContent>
- *     <restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
- *       <sequence>
- *         <element name="SecurityQuestions" type="{http://schema.ultraservice.neustar.com/v01/}SecurityQuestions"/>
- *         <element name="InactiveTimeOutPreference" type="{http://schema.ultraservice.neustar.com/v01/}InactiveTimeOutPreference"/>
- *         <element name="PasswordExpirationPreference" type="{http://schema.ultraservice.neustar.com/v01/}PasswordExpirationPreference"/>
- *       </sequence>
- *     </restriction>
- *   </complexContent>
- * </complexType>
- * 
- * - * - */ -@XmlAccessorType(XmlAccessType.FIELD) -@XmlType(name = "SecurityPreferences", propOrder = { - "securityQuestions", - "inactiveTimeOutPreference", - "passwordExpirationPreference" -}) -public class SecurityPreferences { - - @XmlElement(name = "SecurityQuestions", required = true) - protected SecurityQuestions securityQuestions; - @XmlElement(name = "InactiveTimeOutPreference", required = true) - protected InactiveTimeOutPreference inactiveTimeOutPreference; - @XmlElement(name = "PasswordExpirationPreference", required = true) - protected PasswordExpirationPreference passwordExpirationPreference; - - /** - * Gets the value of the securityQuestions property. - * - * @return - * possible object is - * {@link SecurityQuestions } - * - */ - public SecurityQuestions getSecurityQuestions() { - return securityQuestions; - } - - /** - * Sets the value of the securityQuestions property. - * - * @param value - * allowed object is - * {@link SecurityQuestions } - * - */ - public void setSecurityQuestions(SecurityQuestions value) { - this.securityQuestions = value; - } - - /** - * Gets the value of the inactiveTimeOutPreference property. - * - * @return - * possible object is - * {@link InactiveTimeOutPreference } - * - */ - public InactiveTimeOutPreference getInactiveTimeOutPreference() { - return inactiveTimeOutPreference; - } - - /** - * Sets the value of the inactiveTimeOutPreference property. - * - * @param value - * allowed object is - * {@link InactiveTimeOutPreference } - * - */ - public void setInactiveTimeOutPreference(InactiveTimeOutPreference value) { - this.inactiveTimeOutPreference = value; - } - - /** - * Gets the value of the passwordExpirationPreference property. - * - * @return - * possible object is - * {@link PasswordExpirationPreference } - * - */ - public PasswordExpirationPreference getPasswordExpirationPreference() { - return passwordExpirationPreference; - } - - /** - * Sets the value of the passwordExpirationPreference property. - * - * @param value - * allowed object is - * {@link PasswordExpirationPreference } - * - */ - public void setPasswordExpirationPreference(PasswordExpirationPreference value) { - this.passwordExpirationPreference = value; - } - -} diff --git a/Plugins/Mineplex.BungeeRotator/src/com/neustar/ultraservice/schema/v01/SecurityQuestions.java b/Plugins/Mineplex.BungeeRotator/src/com/neustar/ultraservice/schema/v01/SecurityQuestions.java deleted file mode 100644 index 18293faae..000000000 --- a/Plugins/Mineplex.BungeeRotator/src/com/neustar/ultraservice/schema/v01/SecurityQuestions.java +++ /dev/null @@ -1,195 +0,0 @@ - -package com.neustar.ultraservice.schema.v01; - -import javax.xml.bind.annotation.XmlAccessType; -import javax.xml.bind.annotation.XmlAccessorType; -import javax.xml.bind.annotation.XmlAttribute; -import javax.xml.bind.annotation.XmlType; - - -/** - *

Java class for SecurityQuestions complex type. - * - *

The following schema fragment specifies the expected content contained within this class. - * - *

- * <complexType name="SecurityQuestions">
- *   <complexContent>
- *     <restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
- *       <sequence>
- *       </sequence>
- *       <attribute name="SecurityQuestion1" type="{http://www.w3.org/2001/XMLSchema}string" />
- *       <attribute name="SecretAnswer1" type="{http://www.w3.org/2001/XMLSchema}string" />
- *       <attribute name="SecurityQuestion2" type="{http://www.w3.org/2001/XMLSchema}string" />
- *       <attribute name="SecretAnswer2" type="{http://www.w3.org/2001/XMLSchema}string" />
- *       <attribute name="SecurityQuestion3" type="{http://www.w3.org/2001/XMLSchema}string" />
- *       <attribute name="SecretAnswer3" type="{http://www.w3.org/2001/XMLSchema}string" />
- *     </restriction>
- *   </complexContent>
- * </complexType>
- * 
- * - * - */ -@XmlAccessorType(XmlAccessType.FIELD) -@XmlType(name = "SecurityQuestions") -public class SecurityQuestions { - - @XmlAttribute(name = "SecurityQuestion1") - protected String securityQuestion1; - @XmlAttribute(name = "SecretAnswer1") - protected String secretAnswer1; - @XmlAttribute(name = "SecurityQuestion2") - protected String securityQuestion2; - @XmlAttribute(name = "SecretAnswer2") - protected String secretAnswer2; - @XmlAttribute(name = "SecurityQuestion3") - protected String securityQuestion3; - @XmlAttribute(name = "SecretAnswer3") - protected String secretAnswer3; - - /** - * Gets the value of the securityQuestion1 property. - * - * @return - * possible object is - * {@link String } - * - */ - public String getSecurityQuestion1() { - return securityQuestion1; - } - - /** - * Sets the value of the securityQuestion1 property. - * - * @param value - * allowed object is - * {@link String } - * - */ - public void setSecurityQuestion1(String value) { - this.securityQuestion1 = value; - } - - /** - * Gets the value of the secretAnswer1 property. - * - * @return - * possible object is - * {@link String } - * - */ - public String getSecretAnswer1() { - return secretAnswer1; - } - - /** - * Sets the value of the secretAnswer1 property. - * - * @param value - * allowed object is - * {@link String } - * - */ - public void setSecretAnswer1(String value) { - this.secretAnswer1 = value; - } - - /** - * Gets the value of the securityQuestion2 property. - * - * @return - * possible object is - * {@link String } - * - */ - public String getSecurityQuestion2() { - return securityQuestion2; - } - - /** - * Sets the value of the securityQuestion2 property. - * - * @param value - * allowed object is - * {@link String } - * - */ - public void setSecurityQuestion2(String value) { - this.securityQuestion2 = value; - } - - /** - * Gets the value of the secretAnswer2 property. - * - * @return - * possible object is - * {@link String } - * - */ - public String getSecretAnswer2() { - return secretAnswer2; - } - - /** - * Sets the value of the secretAnswer2 property. - * - * @param value - * allowed object is - * {@link String } - * - */ - public void setSecretAnswer2(String value) { - this.secretAnswer2 = value; - } - - /** - * Gets the value of the securityQuestion3 property. - * - * @return - * possible object is - * {@link String } - * - */ - public String getSecurityQuestion3() { - return securityQuestion3; - } - - /** - * Sets the value of the securityQuestion3 property. - * - * @param value - * allowed object is - * {@link String } - * - */ - public void setSecurityQuestion3(String value) { - this.securityQuestion3 = value; - } - - /** - * Gets the value of the secretAnswer3 property. - * - * @return - * possible object is - * {@link String } - * - */ - public String getSecretAnswer3() { - return secretAnswer3; - } - - /** - * Sets the value of the secretAnswer3 property. - * - * @param value - * allowed object is - * {@link String } - * - */ - public void setSecretAnswer3(String value) { - this.secretAnswer3 = value; - } - -} diff --git a/Plugins/Mineplex.BungeeRotator/src/com/neustar/ultraservice/schema/v01/ServiceInfo.java b/Plugins/Mineplex.BungeeRotator/src/com/neustar/ultraservice/schema/v01/ServiceInfo.java deleted file mode 100644 index 4e909b05b..000000000 --- a/Plugins/Mineplex.BungeeRotator/src/com/neustar/ultraservice/schema/v01/ServiceInfo.java +++ /dev/null @@ -1,114 +0,0 @@ - -package com.neustar.ultraservice.schema.v01; - -import javax.xml.bind.annotation.XmlAccessType; -import javax.xml.bind.annotation.XmlAccessorType; -import javax.xml.bind.annotation.XmlType; - - -/** - *

Java class for ServiceInfo complex type. - * - *

The following schema fragment specifies the expected content contained within this class. - * - *

- * <complexType name="ServiceInfo">
- *   <complexContent>
- *     <restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
- *       <sequence>
- *         <element name="serviceName" type="{http://www.w3.org/2001/XMLSchema}string" minOccurs="0"/>
- *         <element name="serviceVersion" type="{http://www.w3.org/2001/XMLSchema}string" minOccurs="0"/>
- *         <element name="serviceStatus" type="{http://www.w3.org/2001/XMLSchema}string" minOccurs="0"/>
- *       </sequence>
- *     </restriction>
- *   </complexContent>
- * </complexType>
- * 
- * - * - */ -@XmlAccessorType(XmlAccessType.FIELD) -@XmlType(name = "ServiceInfo", propOrder = { - "serviceName", - "serviceVersion", - "serviceStatus" -}) -public class ServiceInfo { - - protected String serviceName; - protected String serviceVersion; - protected String serviceStatus; - - /** - * Gets the value of the serviceName property. - * - * @return - * possible object is - * {@link String } - * - */ - public String getServiceName() { - return serviceName; - } - - /** - * Sets the value of the serviceName property. - * - * @param value - * allowed object is - * {@link String } - * - */ - public void setServiceName(String value) { - this.serviceName = value; - } - - /** - * Gets the value of the serviceVersion property. - * - * @return - * possible object is - * {@link String } - * - */ - public String getServiceVersion() { - return serviceVersion; - } - - /** - * Sets the value of the serviceVersion property. - * - * @param value - * allowed object is - * {@link String } - * - */ - public void setServiceVersion(String value) { - this.serviceVersion = value; - } - - /** - * Gets the value of the serviceStatus property. - * - * @return - * possible object is - * {@link String } - * - */ - public String getServiceStatus() { - return serviceStatus; - } - - /** - * Sets the value of the serviceStatus property. - * - * @param value - * allowed object is - * {@link String } - * - */ - public void setServiceStatus(String value) { - this.serviceStatus = value; - } - -} diff --git a/Plugins/Mineplex.BungeeRotator/src/com/neustar/ultraservice/schema/v01/ServiceList.java b/Plugins/Mineplex.BungeeRotator/src/com/neustar/ultraservice/schema/v01/ServiceList.java deleted file mode 100644 index ac62fb177..000000000 --- a/Plugins/Mineplex.BungeeRotator/src/com/neustar/ultraservice/schema/v01/ServiceList.java +++ /dev/null @@ -1,67 +0,0 @@ - -package com.neustar.ultraservice.schema.v01; - -import java.util.ArrayList; -import java.util.List; -import javax.xml.bind.annotation.XmlAccessType; -import javax.xml.bind.annotation.XmlAccessorType; -import javax.xml.bind.annotation.XmlType; - - -/** - *

Java class for ServiceList complex type. - * - *

The following schema fragment specifies the expected content contained within this class. - * - *

- * <complexType name="ServiceList">
- *   <complexContent>
- *     <restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
- *       <sequence>
- *         <element name="service" type="{http://schema.ultraservice.neustar.com/v01/}ServiceInfo" maxOccurs="unbounded" minOccurs="0"/>
- *       </sequence>
- *     </restriction>
- *   </complexContent>
- * </complexType>
- * 
- * - * - */ -@XmlAccessorType(XmlAccessType.FIELD) -@XmlType(name = "ServiceList", propOrder = { - "service" -}) -public class ServiceList { - - protected List service; - - /** - * Gets the value of the service property. - * - *

- * This accessor method returns a reference to the live list, - * not a snapshot. Therefore any modification you make to the - * returned list will be present inside the JAXB object. - * This is why there is not a set method for the service property. - * - *

- * For example, to add a new item, do as follows: - *

-     *    getService().add(newItem);
-     * 
- * - * - *

- * Objects of the following type(s) are allowed in the list - * {@link ServiceInfo } - * - * - */ - public List getService() { - if (service == null) { - service = new ArrayList(); - } - return this.service; - } - -} diff --git a/Plugins/Mineplex.BungeeRotator/src/com/neustar/ultraservice/schema/v01/SimpleFailoverConversion.java b/Plugins/Mineplex.BungeeRotator/src/com/neustar/ultraservice/schema/v01/SimpleFailoverConversion.java deleted file mode 100644 index ca6de2f79..000000000 --- a/Plugins/Mineplex.BungeeRotator/src/com/neustar/ultraservice/schema/v01/SimpleFailoverConversion.java +++ /dev/null @@ -1,42 +0,0 @@ - -package com.neustar.ultraservice.schema.v01; - -import javax.xml.bind.annotation.XmlEnum; -import javax.xml.bind.annotation.XmlType; - - -/** - *

Java class for simpleFailoverConversion. - * - *

The following schema fragment specifies the expected content contained within this class. - *

- *

- * <simpleType name="simpleFailoverConversion">
- *   <restriction base="{http://www.w3.org/2001/XMLSchema}string">
- *     <enumeration value="A"/>
- *     <enumeration value="RD"/>
- *     <enumeration value="ADAPTIVE_RESPONSE"/>
- *     <enumeration value="MRD"/>
- *   </restriction>
- * </simpleType>
- * 
- * - */ -@XmlType(name = "simpleFailoverConversion") -@XmlEnum -public enum SimpleFailoverConversion { - - A, - RD, - ADAPTIVE_RESPONSE, - MRD; - - public String value() { - return name(); - } - - public static SimpleFailoverConversion fromValue(String v) { - return valueOf(v); - } - -} diff --git a/Plugins/Mineplex.BungeeRotator/src/com/neustar/ultraservice/schema/v01/SimpleFailoverConversionInfo.java b/Plugins/Mineplex.BungeeRotator/src/com/neustar/ultraservice/schema/v01/SimpleFailoverConversionInfo.java deleted file mode 100644 index d34fdd1a2..000000000 --- a/Plugins/Mineplex.BungeeRotator/src/com/neustar/ultraservice/schema/v01/SimpleFailoverConversionInfo.java +++ /dev/null @@ -1,117 +0,0 @@ - -package com.neustar.ultraservice.schema.v01; - -import javax.xml.bind.annotation.XmlAccessType; -import javax.xml.bind.annotation.XmlAccessorType; -import javax.xml.bind.annotation.XmlElement; -import javax.xml.bind.annotation.XmlType; - - -/** - *

Java class for SimpleFailoverConversionInfo complex type. - * - *

The following schema fragment specifies the expected content contained within this class. - * - *

- * <complexType name="SimpleFailoverConversionInfo">
- *   <complexContent>
- *     <restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
- *       <sequence>
- *         <element name="simpleFailoverPoolKey" type="{http://schema.ultraservice.neustar.com/v01/}SimpleFailoverPoolKey"/>
- *         <element name="conversionType" type="{http://schema.ultraservice.neustar.com/v01/}simpleFailoverConversion"/>
- *         <element name="keptRecord" type="{http://www.w3.org/2001/XMLSchema}string" minOccurs="0"/>
- *       </sequence>
- *     </restriction>
- *   </complexContent>
- * </complexType>
- * 
- * - * - */ -@XmlAccessorType(XmlAccessType.FIELD) -@XmlType(name = "SimpleFailoverConversionInfo", propOrder = { - "simpleFailoverPoolKey", - "conversionType", - "keptRecord" -}) -public class SimpleFailoverConversionInfo { - - @XmlElement(required = true) - protected SimpleFailoverPoolKey simpleFailoverPoolKey; - @XmlElement(required = true) - protected SimpleFailoverConversion conversionType; - protected String keptRecord; - - /** - * Gets the value of the simpleFailoverPoolKey property. - * - * @return - * possible object is - * {@link SimpleFailoverPoolKey } - * - */ - public SimpleFailoverPoolKey getSimpleFailoverPoolKey() { - return simpleFailoverPoolKey; - } - - /** - * Sets the value of the simpleFailoverPoolKey property. - * - * @param value - * allowed object is - * {@link SimpleFailoverPoolKey } - * - */ - public void setSimpleFailoverPoolKey(SimpleFailoverPoolKey value) { - this.simpleFailoverPoolKey = value; - } - - /** - * Gets the value of the conversionType property. - * - * @return - * possible object is - * {@link SimpleFailoverConversion } - * - */ - public SimpleFailoverConversion getConversionType() { - return conversionType; - } - - /** - * Sets the value of the conversionType property. - * - * @param value - * allowed object is - * {@link SimpleFailoverConversion } - * - */ - public void setConversionType(SimpleFailoverConversion value) { - this.conversionType = value; - } - - /** - * Gets the value of the keptRecord property. - * - * @return - * possible object is - * {@link String } - * - */ - public String getKeptRecord() { - return keptRecord; - } - - /** - * Sets the value of the keptRecord property. - * - * @param value - * allowed object is - * {@link String } - * - */ - public void setKeptRecord(String value) { - this.keptRecord = value; - } - -} diff --git a/Plugins/Mineplex.BungeeRotator/src/com/neustar/ultraservice/schema/v01/SimpleFailoverPool.java b/Plugins/Mineplex.BungeeRotator/src/com/neustar/ultraservice/schema/v01/SimpleFailoverPool.java deleted file mode 100644 index a5bab6851..000000000 --- a/Plugins/Mineplex.BungeeRotator/src/com/neustar/ultraservice/schema/v01/SimpleFailoverPool.java +++ /dev/null @@ -1,284 +0,0 @@ - -package com.neustar.ultraservice.schema.v01; - -import javax.xml.bind.annotation.XmlAccessType; -import javax.xml.bind.annotation.XmlAccessorType; -import javax.xml.bind.annotation.XmlElement; -import javax.xml.bind.annotation.XmlType; - - -/** - *

Java class for SimpleFailoverPool complex type. - * - *

The following schema fragment specifies the expected content contained within this class. - * - *

- * <complexType name="SimpleFailoverPool">
- *   <complexContent>
- *     <restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
- *       <sequence>
- *         <element name="zoneName" type="{http://www.w3.org/2001/XMLSchema}string"/>
- *         <element name="hostName" type="{http://www.w3.org/2001/XMLSchema}string"/>
- *         <element name="description" type="{http://www.w3.org/2001/XMLSchema}string" minOccurs="0"/>
- *         <element name="liveRecord" type="{http://schema.ultraservice.neustar.com/v01/}FailoverRecord"/>
- *         <element name="backupRecord" type="{http://schema.ultraservice.neustar.com/v01/}FailoverRecord"/>
- *         <element name="ttl" type="{http://www.w3.org/2001/XMLSchema}long"/>
- *         <element name="monitor" type="{http://schema.ultraservice.neustar.com/v01/}FailoverMonitor"/>
- *         <element name="regionThreshold" type="{http://schema.ultraservice.neustar.com/v01/}simpleFailoverPoolRegionThreshold"/>
- *         <element name="status" type="{http://schema.ultraservice.neustar.com/v01/}ARStatusEnum" minOccurs="0"/>
- *       </sequence>
- *     </restriction>
- *   </complexContent>
- * </complexType>
- * 
- * - * - */ -@XmlAccessorType(XmlAccessType.FIELD) -@XmlType(name = "SimpleFailoverPool", propOrder = { - "zoneName", - "hostName", - "description", - "liveRecord", - "backupRecord", - "ttl", - "monitor", - "regionThreshold", - "status" -}) -public class SimpleFailoverPool { - - @XmlElement(required = true) - protected String zoneName; - @XmlElement(required = true) - protected String hostName; - protected String description; - @XmlElement(required = true) - protected FailoverRecord liveRecord; - @XmlElement(required = true) - protected FailoverRecord backupRecord; - @XmlElement(required = true, type = Long.class, nillable = true) - protected Long ttl; - @XmlElement(required = true) - protected FailoverMonitor monitor; - @XmlElement(required = true) - protected SimpleFailoverPoolRegionThreshold regionThreshold; - protected ARStatusEnum status; - - /** - * Gets the value of the zoneName property. - * - * @return - * possible object is - * {@link String } - * - */ - public String getZoneName() { - return zoneName; - } - - /** - * Sets the value of the zoneName property. - * - * @param value - * allowed object is - * {@link String } - * - */ - public void setZoneName(String value) { - this.zoneName = value; - } - - /** - * Gets the value of the hostName property. - * - * @return - * possible object is - * {@link String } - * - */ - public String getHostName() { - return hostName; - } - - /** - * Sets the value of the hostName property. - * - * @param value - * allowed object is - * {@link String } - * - */ - public void setHostName(String value) { - this.hostName = value; - } - - /** - * Gets the value of the description property. - * - * @return - * possible object is - * {@link String } - * - */ - public String getDescription() { - return description; - } - - /** - * Sets the value of the description property. - * - * @param value - * allowed object is - * {@link String } - * - */ - public void setDescription(String value) { - this.description = value; - } - - /** - * Gets the value of the liveRecord property. - * - * @return - * possible object is - * {@link FailoverRecord } - * - */ - public FailoverRecord getLiveRecord() { - return liveRecord; - } - - /** - * Sets the value of the liveRecord property. - * - * @param value - * allowed object is - * {@link FailoverRecord } - * - */ - public void setLiveRecord(FailoverRecord value) { - this.liveRecord = value; - } - - /** - * Gets the value of the backupRecord property. - * - * @return - * possible object is - * {@link FailoverRecord } - * - */ - public FailoverRecord getBackupRecord() { - return backupRecord; - } - - /** - * Sets the value of the backupRecord property. - * - * @param value - * allowed object is - * {@link FailoverRecord } - * - */ - public void setBackupRecord(FailoverRecord value) { - this.backupRecord = value; - } - - /** - * Gets the value of the ttl property. - * - * @return - * possible object is - * {@link Long } - * - */ - public Long getTtl() { - return ttl; - } - - /** - * Sets the value of the ttl property. - * - * @param value - * allowed object is - * {@link Long } - * - */ - public void setTtl(Long value) { - this.ttl = value; - } - - /** - * Gets the value of the monitor property. - * - * @return - * possible object is - * {@link FailoverMonitor } - * - */ - public FailoverMonitor getMonitor() { - return monitor; - } - - /** - * Sets the value of the monitor property. - * - * @param value - * allowed object is - * {@link FailoverMonitor } - * - */ - public void setMonitor(FailoverMonitor value) { - this.monitor = value; - } - - /** - * Gets the value of the regionThreshold property. - * - * @return - * possible object is - * {@link SimpleFailoverPoolRegionThreshold } - * - */ - public SimpleFailoverPoolRegionThreshold getRegionThreshold() { - return regionThreshold; - } - - /** - * Sets the value of the regionThreshold property. - * - * @param value - * allowed object is - * {@link SimpleFailoverPoolRegionThreshold } - * - */ - public void setRegionThreshold(SimpleFailoverPoolRegionThreshold value) { - this.regionThreshold = value; - } - - /** - * Gets the value of the status property. - * - * @return - * possible object is - * {@link ARStatusEnum } - * - */ - public ARStatusEnum getStatus() { - return status; - } - - /** - * Sets the value of the status property. - * - * @param value - * allowed object is - * {@link ARStatusEnum } - * - */ - public void setStatus(ARStatusEnum value) { - this.status = value; - } - -} diff --git a/Plugins/Mineplex.BungeeRotator/src/com/neustar/ultraservice/schema/v01/SimpleFailoverPoolAdd.java b/Plugins/Mineplex.BungeeRotator/src/com/neustar/ultraservice/schema/v01/SimpleFailoverPoolAdd.java deleted file mode 100644 index 4d562784c..000000000 --- a/Plugins/Mineplex.BungeeRotator/src/com/neustar/ultraservice/schema/v01/SimpleFailoverPoolAdd.java +++ /dev/null @@ -1,257 +0,0 @@ - -package com.neustar.ultraservice.schema.v01; - -import javax.xml.bind.annotation.XmlAccessType; -import javax.xml.bind.annotation.XmlAccessorType; -import javax.xml.bind.annotation.XmlElement; -import javax.xml.bind.annotation.XmlType; - - -/** - *

Java class for SimpleFailoverPoolAdd complex type. - * - *

The following schema fragment specifies the expected content contained within this class. - * - *

- * <complexType name="SimpleFailoverPoolAdd">
- *   <complexContent>
- *     <restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
- *       <sequence>
- *         <element name="zoneName" type="{http://www.w3.org/2001/XMLSchema}string"/>
- *         <element name="hostName" type="{http://www.w3.org/2001/XMLSchema}string"/>
- *         <element name="description" type="{http://www.w3.org/2001/XMLSchema}string" minOccurs="0"/>
- *         <element name="liveRecord" type="{http://schema.ultraservice.neustar.com/v01/}FailoverRecord"/>
- *         <element name="backupRecord" type="{http://schema.ultraservice.neustar.com/v01/}FailoverRecord"/>
- *         <element name="ttl" type="{http://www.w3.org/2001/XMLSchema}long"/>
- *         <element name="monitor" type="{http://schema.ultraservice.neustar.com/v01/}FailoverMonitor"/>
- *         <element name="regionThreshold" type="{http://schema.ultraservice.neustar.com/v01/}simpleFailoverPoolRegionThreshold"/>
- *       </sequence>
- *     </restriction>
- *   </complexContent>
- * </complexType>
- * 
- * - * - */ -@XmlAccessorType(XmlAccessType.FIELD) -@XmlType(name = "SimpleFailoverPoolAdd", propOrder = { - "zoneName", - "hostName", - "description", - "liveRecord", - "backupRecord", - "ttl", - "monitor", - "regionThreshold" -}) -public class SimpleFailoverPoolAdd { - - @XmlElement(required = true) - protected String zoneName; - @XmlElement(required = true) - protected String hostName; - protected String description; - @XmlElement(required = true) - protected FailoverRecord liveRecord; - @XmlElement(required = true) - protected FailoverRecord backupRecord; - @XmlElement(required = true, type = Long.class, nillable = true) - protected Long ttl; - @XmlElement(required = true) - protected FailoverMonitor monitor; - @XmlElement(required = true) - protected SimpleFailoverPoolRegionThreshold regionThreshold; - - /** - * Gets the value of the zoneName property. - * - * @return - * possible object is - * {@link String } - * - */ - public String getZoneName() { - return zoneName; - } - - /** - * Sets the value of the zoneName property. - * - * @param value - * allowed object is - * {@link String } - * - */ - public void setZoneName(String value) { - this.zoneName = value; - } - - /** - * Gets the value of the hostName property. - * - * @return - * possible object is - * {@link String } - * - */ - public String getHostName() { - return hostName; - } - - /** - * Sets the value of the hostName property. - * - * @param value - * allowed object is - * {@link String } - * - */ - public void setHostName(String value) { - this.hostName = value; - } - - /** - * Gets the value of the description property. - * - * @return - * possible object is - * {@link String } - * - */ - public String getDescription() { - return description; - } - - /** - * Sets the value of the description property. - * - * @param value - * allowed object is - * {@link String } - * - */ - public void setDescription(String value) { - this.description = value; - } - - /** - * Gets the value of the liveRecord property. - * - * @return - * possible object is - * {@link FailoverRecord } - * - */ - public FailoverRecord getLiveRecord() { - return liveRecord; - } - - /** - * Sets the value of the liveRecord property. - * - * @param value - * allowed object is - * {@link FailoverRecord } - * - */ - public void setLiveRecord(FailoverRecord value) { - this.liveRecord = value; - } - - /** - * Gets the value of the backupRecord property. - * - * @return - * possible object is - * {@link FailoverRecord } - * - */ - public FailoverRecord getBackupRecord() { - return backupRecord; - } - - /** - * Sets the value of the backupRecord property. - * - * @param value - * allowed object is - * {@link FailoverRecord } - * - */ - public void setBackupRecord(FailoverRecord value) { - this.backupRecord = value; - } - - /** - * Gets the value of the ttl property. - * - * @return - * possible object is - * {@link Long } - * - */ - public Long getTtl() { - return ttl; - } - - /** - * Sets the value of the ttl property. - * - * @param value - * allowed object is - * {@link Long } - * - */ - public void setTtl(Long value) { - this.ttl = value; - } - - /** - * Gets the value of the monitor property. - * - * @return - * possible object is - * {@link FailoverMonitor } - * - */ - public FailoverMonitor getMonitor() { - return monitor; - } - - /** - * Sets the value of the monitor property. - * - * @param value - * allowed object is - * {@link FailoverMonitor } - * - */ - public void setMonitor(FailoverMonitor value) { - this.monitor = value; - } - - /** - * Gets the value of the regionThreshold property. - * - * @return - * possible object is - * {@link SimpleFailoverPoolRegionThreshold } - * - */ - public SimpleFailoverPoolRegionThreshold getRegionThreshold() { - return regionThreshold; - } - - /** - * Sets the value of the regionThreshold property. - * - * @param value - * allowed object is - * {@link SimpleFailoverPoolRegionThreshold } - * - */ - public void setRegionThreshold(SimpleFailoverPoolRegionThreshold value) { - this.regionThreshold = value; - } - -} diff --git a/Plugins/Mineplex.BungeeRotator/src/com/neustar/ultraservice/schema/v01/SimpleFailoverPoolKey.java b/Plugins/Mineplex.BungeeRotator/src/com/neustar/ultraservice/schema/v01/SimpleFailoverPoolKey.java deleted file mode 100644 index 015a444f1..000000000 --- a/Plugins/Mineplex.BungeeRotator/src/com/neustar/ultraservice/schema/v01/SimpleFailoverPoolKey.java +++ /dev/null @@ -1,90 +0,0 @@ - -package com.neustar.ultraservice.schema.v01; - -import javax.xml.bind.annotation.XmlAccessType; -import javax.xml.bind.annotation.XmlAccessorType; -import javax.xml.bind.annotation.XmlElement; -import javax.xml.bind.annotation.XmlType; - - -/** - *

Java class for SimpleFailoverPoolKey complex type. - * - *

The following schema fragment specifies the expected content contained within this class. - * - *

- * <complexType name="SimpleFailoverPoolKey">
- *   <complexContent>
- *     <restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
- *       <sequence>
- *         <element name="zoneName" type="{http://www.w3.org/2001/XMLSchema}string"/>
- *         <element name="hostName" type="{http://www.w3.org/2001/XMLSchema}string"/>
- *       </sequence>
- *     </restriction>
- *   </complexContent>
- * </complexType>
- * 
- * - * - */ -@XmlAccessorType(XmlAccessType.FIELD) -@XmlType(name = "SimpleFailoverPoolKey", propOrder = { - "zoneName", - "hostName" -}) -public class SimpleFailoverPoolKey { - - @XmlElement(required = true) - protected String zoneName; - @XmlElement(required = true) - protected String hostName; - - /** - * Gets the value of the zoneName property. - * - * @return - * possible object is - * {@link String } - * - */ - public String getZoneName() { - return zoneName; - } - - /** - * Sets the value of the zoneName property. - * - * @param value - * allowed object is - * {@link String } - * - */ - public void setZoneName(String value) { - this.zoneName = value; - } - - /** - * Gets the value of the hostName property. - * - * @return - * possible object is - * {@link String } - * - */ - public String getHostName() { - return hostName; - } - - /** - * Sets the value of the hostName property. - * - * @param value - * allowed object is - * {@link String } - * - */ - public void setHostName(String value) { - this.hostName = value; - } - -} diff --git a/Plugins/Mineplex.BungeeRotator/src/com/neustar/ultraservice/schema/v01/SimpleFailoverPoolList.java b/Plugins/Mineplex.BungeeRotator/src/com/neustar/ultraservice/schema/v01/SimpleFailoverPoolList.java deleted file mode 100644 index 95aabc0dd..000000000 --- a/Plugins/Mineplex.BungeeRotator/src/com/neustar/ultraservice/schema/v01/SimpleFailoverPoolList.java +++ /dev/null @@ -1,126 +0,0 @@ - -package com.neustar.ultraservice.schema.v01; - -import java.util.ArrayList; -import java.util.List; -import javax.xml.bind.annotation.XmlAccessType; -import javax.xml.bind.annotation.XmlAccessorType; -import javax.xml.bind.annotation.XmlElement; -import javax.xml.bind.annotation.XmlType; - - -/** - *

Java class for SimpleFailoverPoolList complex type. - * - *

The following schema fragment specifies the expected content contained within this class. - * - *

- * <complexType name="SimpleFailoverPoolList">
- *   <complexContent>
- *     <restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
- *       <sequence>
- *         <element name="poolDefinitions" type="{http://schema.ultraservice.neustar.com/v01/}SimpleFailoverPool" maxOccurs="unbounded"/>
- *         <element name="total" type="{http://www.w3.org/2001/XMLSchema}int"/>
- *         <element name="offset" type="{http://www.w3.org/2001/XMLSchema}int"/>
- *         <element name="count" type="{http://www.w3.org/2001/XMLSchema}int"/>
- *       </sequence>
- *     </restriction>
- *   </complexContent>
- * </complexType>
- * 
- * - * - */ -@XmlAccessorType(XmlAccessType.FIELD) -@XmlType(name = "SimpleFailoverPoolList", propOrder = { - "poolDefinitions", - "total", - "offset", - "count" -}) -public class SimpleFailoverPoolList { - - @XmlElement(required = true) - protected List poolDefinitions; - protected int total; - protected int offset; - protected int count; - - /** - * Gets the value of the poolDefinitions property. - * - *

- * This accessor method returns a reference to the live list, - * not a snapshot. Therefore any modification you make to the - * returned list will be present inside the JAXB object. - * This is why there is not a set method for the poolDefinitions property. - * - *

- * For example, to add a new item, do as follows: - *

-     *    getPoolDefinitions().add(newItem);
-     * 
- * - * - *

- * Objects of the following type(s) are allowed in the list - * {@link SimpleFailoverPool } - * - * - */ - public List getPoolDefinitions() { - if (poolDefinitions == null) { - poolDefinitions = new ArrayList(); - } - return this.poolDefinitions; - } - - /** - * Gets the value of the total property. - * - */ - public int getTotal() { - return total; - } - - /** - * Sets the value of the total property. - * - */ - public void setTotal(int value) { - this.total = value; - } - - /** - * Gets the value of the offset property. - * - */ - public int getOffset() { - return offset; - } - - /** - * Sets the value of the offset property. - * - */ - public void setOffset(int value) { - this.offset = value; - } - - /** - * Gets the value of the count property. - * - */ - public int getCount() { - return count; - } - - /** - * Sets the value of the count property. - * - */ - public void setCount(int value) { - this.count = value; - } - -} diff --git a/Plugins/Mineplex.BungeeRotator/src/com/neustar/ultraservice/schema/v01/SimpleFailoverPoolRegionThreshold.java b/Plugins/Mineplex.BungeeRotator/src/com/neustar/ultraservice/schema/v01/SimpleFailoverPoolRegionThreshold.java deleted file mode 100644 index d2649bee1..000000000 --- a/Plugins/Mineplex.BungeeRotator/src/com/neustar/ultraservice/schema/v01/SimpleFailoverPoolRegionThreshold.java +++ /dev/null @@ -1,38 +0,0 @@ - -package com.neustar.ultraservice.schema.v01; - -import javax.xml.bind.annotation.XmlEnum; -import javax.xml.bind.annotation.XmlType; - - -/** - *

Java class for simpleFailoverPoolRegionThreshold. - * - *

The following schema fragment specifies the expected content contained within this class. - *

- *

- * <simpleType name="simpleFailoverPoolRegionThreshold">
- *   <restriction base="{http://www.w3.org/2001/XMLSchema}string">
- *     <enumeration value="LOW"/>
- *     <enumeration value="HIGH"/>
- *   </restriction>
- * </simpleType>
- * 
- * - */ -@XmlType(name = "simpleFailoverPoolRegionThreshold") -@XmlEnum -public enum SimpleFailoverPoolRegionThreshold { - - LOW, - HIGH; - - public String value() { - return name(); - } - - public static SimpleFailoverPoolRegionThreshold fromValue(String v) { - return valueOf(v); - } - -} diff --git a/Plugins/Mineplex.BungeeRotator/src/com/neustar/ultraservice/schema/v01/SimpleFailoverPoolUpdate.java b/Plugins/Mineplex.BungeeRotator/src/com/neustar/ultraservice/schema/v01/SimpleFailoverPoolUpdate.java deleted file mode 100644 index c8aa15fed..000000000 --- a/Plugins/Mineplex.BungeeRotator/src/com/neustar/ultraservice/schema/v01/SimpleFailoverPoolUpdate.java +++ /dev/null @@ -1,195 +0,0 @@ - -package com.neustar.ultraservice.schema.v01; - -import javax.xml.bind.annotation.XmlAccessType; -import javax.xml.bind.annotation.XmlAccessorType; -import javax.xml.bind.annotation.XmlType; - - -/** - *

Java class for SimpleFailoverPoolUpdate complex type. - * - *

The following schema fragment specifies the expected content contained within this class. - * - *

- * <complexType name="SimpleFailoverPoolUpdate">
- *   <complexContent>
- *     <restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
- *       <sequence>
- *         <element name="description" type="{http://www.w3.org/2001/XMLSchema}string" minOccurs="0"/>
- *         <element name="liveRecord" type="{http://schema.ultraservice.neustar.com/v01/}FailoverRecordUpdate" minOccurs="0"/>
- *         <element name="backupRecord" type="{http://schema.ultraservice.neustar.com/v01/}FailoverRecordUpdate" minOccurs="0"/>
- *         <element name="ttl" type="{http://www.w3.org/2001/XMLSchema}long" minOccurs="0"/>
- *         <element name="monitor" type="{http://schema.ultraservice.neustar.com/v01/}FailoverMonitorUpdate" minOccurs="0"/>
- *         <element name="regionThreshold" type="{http://schema.ultraservice.neustar.com/v01/}simpleFailoverPoolRegionThreshold" minOccurs="0"/>
- *       </sequence>
- *     </restriction>
- *   </complexContent>
- * </complexType>
- * 
- * - * - */ -@XmlAccessorType(XmlAccessType.FIELD) -@XmlType(name = "SimpleFailoverPoolUpdate", propOrder = { - "description", - "liveRecord", - "backupRecord", - "ttl", - "monitor", - "regionThreshold" -}) -public class SimpleFailoverPoolUpdate { - - protected String description; - protected FailoverRecordUpdate liveRecord; - protected FailoverRecordUpdate backupRecord; - protected Long ttl; - protected FailoverMonitorUpdate monitor; - protected SimpleFailoverPoolRegionThreshold regionThreshold; - - /** - * Gets the value of the description property. - * - * @return - * possible object is - * {@link String } - * - */ - public String getDescription() { - return description; - } - - /** - * Sets the value of the description property. - * - * @param value - * allowed object is - * {@link String } - * - */ - public void setDescription(String value) { - this.description = value; - } - - /** - * Gets the value of the liveRecord property. - * - * @return - * possible object is - * {@link FailoverRecordUpdate } - * - */ - public FailoverRecordUpdate getLiveRecord() { - return liveRecord; - } - - /** - * Sets the value of the liveRecord property. - * - * @param value - * allowed object is - * {@link FailoverRecordUpdate } - * - */ - public void setLiveRecord(FailoverRecordUpdate value) { - this.liveRecord = value; - } - - /** - * Gets the value of the backupRecord property. - * - * @return - * possible object is - * {@link FailoverRecordUpdate } - * - */ - public FailoverRecordUpdate getBackupRecord() { - return backupRecord; - } - - /** - * Sets the value of the backupRecord property. - * - * @param value - * allowed object is - * {@link FailoverRecordUpdate } - * - */ - public void setBackupRecord(FailoverRecordUpdate value) { - this.backupRecord = value; - } - - /** - * Gets the value of the ttl property. - * - * @return - * possible object is - * {@link Long } - * - */ - public Long getTtl() { - return ttl; - } - - /** - * Sets the value of the ttl property. - * - * @param value - * allowed object is - * {@link Long } - * - */ - public void setTtl(Long value) { - this.ttl = value; - } - - /** - * Gets the value of the monitor property. - * - * @return - * possible object is - * {@link FailoverMonitorUpdate } - * - */ - public FailoverMonitorUpdate getMonitor() { - return monitor; - } - - /** - * Sets the value of the monitor property. - * - * @param value - * allowed object is - * {@link FailoverMonitorUpdate } - * - */ - public void setMonitor(FailoverMonitorUpdate value) { - this.monitor = value; - } - - /** - * Gets the value of the regionThreshold property. - * - * @return - * possible object is - * {@link SimpleFailoverPoolRegionThreshold } - * - */ - public SimpleFailoverPoolRegionThreshold getRegionThreshold() { - return regionThreshold; - } - - /** - * Sets the value of the regionThreshold property. - * - * @param value - * allowed object is - * {@link SimpleFailoverPoolRegionThreshold } - * - */ - public void setRegionThreshold(SimpleFailoverPoolRegionThreshold value) { - this.regionThreshold = value; - } - -} diff --git a/Plugins/Mineplex.BungeeRotator/src/com/neustar/ultraservice/schema/v01/SortOrder.java b/Plugins/Mineplex.BungeeRotator/src/com/neustar/ultraservice/schema/v01/SortOrder.java deleted file mode 100644 index 0b50a63d8..000000000 --- a/Plugins/Mineplex.BungeeRotator/src/com/neustar/ultraservice/schema/v01/SortOrder.java +++ /dev/null @@ -1,38 +0,0 @@ - -package com.neustar.ultraservice.schema.v01; - -import javax.xml.bind.annotation.XmlEnum; -import javax.xml.bind.annotation.XmlType; - - -/** - *

Java class for sortOrder. - * - *

The following schema fragment specifies the expected content contained within this class. - *

- *

- * <simpleType name="sortOrder">
- *   <restriction base="{http://www.w3.org/2001/XMLSchema}string">
- *     <enumeration value="ASC"/>
- *     <enumeration value="DESC"/>
- *   </restriction>
- * </simpleType>
- * 
- * - */ -@XmlType(name = "sortOrder") -@XmlEnum -public enum SortOrder { - - ASC, - DESC; - - public String value() { - return name(); - } - - public static SortOrder fromValue(String v) { - return valueOf(v); - } - -} diff --git a/Plugins/Mineplex.BungeeRotator/src/com/neustar/ultraservice/schema/v01/SourceIPGroupData.java b/Plugins/Mineplex.BungeeRotator/src/com/neustar/ultraservice/schema/v01/SourceIPGroupData.java deleted file mode 100644 index 652f285e5..000000000 --- a/Plugins/Mineplex.BungeeRotator/src/com/neustar/ultraservice/schema/v01/SourceIPGroupData.java +++ /dev/null @@ -1,90 +0,0 @@ - -package com.neustar.ultraservice.schema.v01; - -import javax.xml.bind.annotation.XmlAccessType; -import javax.xml.bind.annotation.XmlAccessorType; -import javax.xml.bind.annotation.XmlElement; -import javax.xml.bind.annotation.XmlType; - - -/** - *

Java class for SourceIPGroupData complex type. - * - *

The following schema fragment specifies the expected content contained within this class. - * - *

- * <complexType name="SourceIPGroupData">
- *   <complexContent>
- *     <restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
- *       <sequence>
- *         <element name="GroupData" type="{http://schema.ultraservice.neustar.com/v01/}GroupData"/>
- *         <element name="SourceIPGroupDetails" type="{http://schema.ultraservice.neustar.com/v01/}SourceIPGroupDetails"/>
- *       </sequence>
- *     </restriction>
- *   </complexContent>
- * </complexType>
- * 
- * - * - */ -@XmlAccessorType(XmlAccessType.FIELD) -@XmlType(name = "SourceIPGroupData", propOrder = { - "groupData", - "sourceIPGroupDetails" -}) -public class SourceIPGroupData { - - @XmlElement(name = "GroupData", required = true) - protected GroupData groupData; - @XmlElement(name = "SourceIPGroupDetails", required = true, nillable = true) - protected SourceIPGroupDetails sourceIPGroupDetails; - - /** - * Gets the value of the groupData property. - * - * @return - * possible object is - * {@link GroupData } - * - */ - public GroupData getGroupData() { - return groupData; - } - - /** - * Sets the value of the groupData property. - * - * @param value - * allowed object is - * {@link GroupData } - * - */ - public void setGroupData(GroupData value) { - this.groupData = value; - } - - /** - * Gets the value of the sourceIPGroupDetails property. - * - * @return - * possible object is - * {@link SourceIPGroupDetails } - * - */ - public SourceIPGroupDetails getSourceIPGroupDetails() { - return sourceIPGroupDetails; - } - - /** - * Sets the value of the sourceIPGroupDetails property. - * - * @param value - * allowed object is - * {@link SourceIPGroupDetails } - * - */ - public void setSourceIPGroupDetails(SourceIPGroupDetails value) { - this.sourceIPGroupDetails = value; - } - -} diff --git a/Plugins/Mineplex.BungeeRotator/src/com/neustar/ultraservice/schema/v01/SourceIPGroupDetails.java b/Plugins/Mineplex.BungeeRotator/src/com/neustar/ultraservice/schema/v01/SourceIPGroupDetails.java deleted file mode 100644 index a9ca6248f..000000000 --- a/Plugins/Mineplex.BungeeRotator/src/com/neustar/ultraservice/schema/v01/SourceIPGroupDetails.java +++ /dev/null @@ -1,128 +0,0 @@ - -package com.neustar.ultraservice.schema.v01; - -import java.util.ArrayList; -import java.util.List; -import javax.xml.bind.annotation.XmlAccessType; -import javax.xml.bind.annotation.XmlAccessorType; -import javax.xml.bind.annotation.XmlAttribute; -import javax.xml.bind.annotation.XmlElement; -import javax.xml.bind.annotation.XmlSeeAlso; -import javax.xml.bind.annotation.XmlType; - - -/** - *

Java class for SourceIPGroupDetails complex type. - * - *

The following schema fragment specifies the expected content contained within this class. - * - *

- * <complexType name="SourceIPGroupDetails">
- *   <complexContent>
- *     <restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
- *       <sequence>
- *         <element name="SourceIpGroupDefinitionData" type="{http://schema.ultraservice.neustar.com/v01/}SourceIpGroupDefinitionData" maxOccurs="unbounded"/>
- *       </sequence>
- *       <attribute name="groupName" use="required" type="{http://www.w3.org/2001/XMLSchema}string" />
- *       <attribute name="description" type="{http://www.w3.org/2001/XMLSchema}string" />
- *     </restriction>
- *   </complexContent>
- * </complexType>
- * 
- * - * - */ -@XmlAccessorType(XmlAccessType.FIELD) -@XmlType(name = "SourceIPGroupDetails", propOrder = { - "sourceIpGroupDefinitionData" -}) -@XmlSeeAlso({ - UpdateSourceIPGroupDetails.class -}) -public class SourceIPGroupDetails { - - @XmlElement(name = "SourceIpGroupDefinitionData", required = true) - protected List sourceIpGroupDefinitionData; - @XmlAttribute(name = "groupName", required = true) - protected String groupName; - @XmlAttribute(name = "description") - protected String description; - - /** - * Gets the value of the sourceIpGroupDefinitionData property. - * - *

- * This accessor method returns a reference to the live list, - * not a snapshot. Therefore any modification you make to the - * returned list will be present inside the JAXB object. - * This is why there is not a set method for the sourceIpGroupDefinitionData property. - * - *

- * For example, to add a new item, do as follows: - *

-     *    getSourceIpGroupDefinitionData().add(newItem);
-     * 
- * - * - *

- * Objects of the following type(s) are allowed in the list - * {@link SourceIpGroupDefinitionData } - * - * - */ - public List getSourceIpGroupDefinitionData() { - if (sourceIpGroupDefinitionData == null) { - sourceIpGroupDefinitionData = new ArrayList(); - } - return this.sourceIpGroupDefinitionData; - } - - /** - * Gets the value of the groupName property. - * - * @return - * possible object is - * {@link String } - * - */ - public String getGroupName() { - return groupName; - } - - /** - * Sets the value of the groupName property. - * - * @param value - * allowed object is - * {@link String } - * - */ - public void setGroupName(String value) { - this.groupName = value; - } - - /** - * Gets the value of the description property. - * - * @return - * possible object is - * {@link String } - * - */ - public String getDescription() { - return description; - } - - /** - * Sets the value of the description property. - * - * @param value - * allowed object is - * {@link String } - * - */ - public void setDescription(String value) { - this.description = value; - } - -} diff --git a/Plugins/Mineplex.BungeeRotator/src/com/neustar/ultraservice/schema/v01/SourceIpGroupDefinitionData.java b/Plugins/Mineplex.BungeeRotator/src/com/neustar/ultraservice/schema/v01/SourceIpGroupDefinitionData.java deleted file mode 100644 index 76fc57bed..000000000 --- a/Plugins/Mineplex.BungeeRotator/src/com/neustar/ultraservice/schema/v01/SourceIpGroupDefinitionData.java +++ /dev/null @@ -1,87 +0,0 @@ - -package com.neustar.ultraservice.schema.v01; - -import javax.xml.bind.annotation.XmlAccessType; -import javax.xml.bind.annotation.XmlAccessorType; -import javax.xml.bind.annotation.XmlAttribute; -import javax.xml.bind.annotation.XmlType; - - -/** - *

Java class for SourceIpGroupDefinitionData complex type. - * - *

The following schema fragment specifies the expected content contained within this class. - * - *

- * <complexType name="SourceIpGroupDefinitionData">
- *   <complexContent>
- *     <restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
- *       <sequence>
- *       </sequence>
- *       <attribute name="startIpAddress" use="required" type="{http://www.w3.org/2001/XMLSchema}string" />
- *       <attribute name="endIpAddress" type="{http://www.w3.org/2001/XMLSchema}string" />
- *     </restriction>
- *   </complexContent>
- * </complexType>
- * 
- * - * - */ -@XmlAccessorType(XmlAccessType.FIELD) -@XmlType(name = "SourceIpGroupDefinitionData") -public class SourceIpGroupDefinitionData { - - @XmlAttribute(name = "startIpAddress", required = true) - protected String startIpAddress; - @XmlAttribute(name = "endIpAddress") - protected String endIpAddress; - - /** - * Gets the value of the startIpAddress property. - * - * @return - * possible object is - * {@link String } - * - */ - public String getStartIpAddress() { - return startIpAddress; - } - - /** - * Sets the value of the startIpAddress property. - * - * @param value - * allowed object is - * {@link String } - * - */ - public void setStartIpAddress(String value) { - this.startIpAddress = value; - } - - /** - * Gets the value of the endIpAddress property. - * - * @return - * possible object is - * {@link String } - * - */ - public String getEndIpAddress() { - return endIpAddress; - } - - /** - * Sets the value of the endIpAddress property. - * - * @param value - * allowed object is - * {@link String } - * - */ - public void setEndIpAddress(String value) { - this.endIpAddress = value; - } - -} diff --git a/Plugins/Mineplex.BungeeRotator/src/com/neustar/ultraservice/schema/v01/SourceIpGroupDefinitionList.java b/Plugins/Mineplex.BungeeRotator/src/com/neustar/ultraservice/schema/v01/SourceIpGroupDefinitionList.java deleted file mode 100644 index 1a23231c1..000000000 --- a/Plugins/Mineplex.BungeeRotator/src/com/neustar/ultraservice/schema/v01/SourceIpGroupDefinitionList.java +++ /dev/null @@ -1,69 +0,0 @@ - -package com.neustar.ultraservice.schema.v01; - -import java.util.ArrayList; -import java.util.List; -import javax.xml.bind.annotation.XmlAccessType; -import javax.xml.bind.annotation.XmlAccessorType; -import javax.xml.bind.annotation.XmlElement; -import javax.xml.bind.annotation.XmlType; - - -/** - *

Java class for SourceIpGroupDefinitionList complex type. - * - *

The following schema fragment specifies the expected content contained within this class. - * - *

- * <complexType name="SourceIpGroupDefinitionList">
- *   <complexContent>
- *     <restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
- *       <sequence>
- *         <element name="SourceIpGroupDefinitionData" type="{http://schema.ultraservice.neustar.com/v01/}SourceIpGroupDefinitionData" maxOccurs="unbounded"/>
- *       </sequence>
- *     </restriction>
- *   </complexContent>
- * </complexType>
- * 
- * - * - */ -@XmlAccessorType(XmlAccessType.FIELD) -@XmlType(name = "SourceIpGroupDefinitionList", propOrder = { - "sourceIpGroupDefinitionData" -}) -public class SourceIpGroupDefinitionList { - - @XmlElement(name = "SourceIpGroupDefinitionData", required = true) - protected List sourceIpGroupDefinitionData; - - /** - * Gets the value of the sourceIpGroupDefinitionData property. - * - *

- * This accessor method returns a reference to the live list, - * not a snapshot. Therefore any modification you make to the - * returned list will be present inside the JAXB object. - * This is why there is not a set method for the sourceIpGroupDefinitionData property. - * - *

- * For example, to add a new item, do as follows: - *

-     *    getSourceIpGroupDefinitionData().add(newItem);
-     * 
- * - * - *

- * Objects of the following type(s) are allowed in the list - * {@link SourceIpGroupDefinitionData } - * - * - */ - public List getSourceIpGroupDefinitionData() { - if (sourceIpGroupDefinitionData == null) { - sourceIpGroupDefinitionData = new ArrayList(); - } - return this.sourceIpGroupDefinitionData; - } - -} diff --git a/Plugins/Mineplex.BungeeRotator/src/com/neustar/ultraservice/schema/v01/StatesInfo.java b/Plugins/Mineplex.BungeeRotator/src/com/neustar/ultraservice/schema/v01/StatesInfo.java deleted file mode 100644 index 06c052cac..000000000 --- a/Plugins/Mineplex.BungeeRotator/src/com/neustar/ultraservice/schema/v01/StatesInfo.java +++ /dev/null @@ -1,60 +0,0 @@ - -package com.neustar.ultraservice.schema.v01; - -import javax.xml.bind.annotation.XmlAccessType; -import javax.xml.bind.annotation.XmlAccessorType; -import javax.xml.bind.annotation.XmlAttribute; -import javax.xml.bind.annotation.XmlType; - - -/** - *

Java class for StatesInfo complex type. - * - *

The following schema fragment specifies the expected content contained within this class. - * - *

- * <complexType name="StatesInfo">
- *   <complexContent>
- *     <restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
- *       <sequence>
- *       </sequence>
- *       <attribute name="StateName" type="{http://www.w3.org/2001/XMLSchema}string" />
- *     </restriction>
- *   </complexContent>
- * </complexType>
- * 
- * - * - */ -@XmlAccessorType(XmlAccessType.FIELD) -@XmlType(name = "StatesInfo") -public class StatesInfo { - - @XmlAttribute(name = "StateName") - protected String stateName; - - /** - * Gets the value of the stateName property. - * - * @return - * possible object is - * {@link String } - * - */ - public String getStateName() { - return stateName; - } - - /** - * Sets the value of the stateName property. - * - * @param value - * allowed object is - * {@link String } - * - */ - public void setStateName(String value) { - this.stateName = value; - } - -} diff --git a/Plugins/Mineplex.BungeeRotator/src/com/neustar/ultraservice/schema/v01/Status.java b/Plugins/Mineplex.BungeeRotator/src/com/neustar/ultraservice/schema/v01/Status.java deleted file mode 100644 index 5fd075f68..000000000 --- a/Plugins/Mineplex.BungeeRotator/src/com/neustar/ultraservice/schema/v01/Status.java +++ /dev/null @@ -1,40 +0,0 @@ - -package com.neustar.ultraservice.schema.v01; - -import javax.xml.bind.annotation.XmlEnum; -import javax.xml.bind.annotation.XmlType; - - -/** - *

Java class for Status. - * - *

The following schema fragment specifies the expected content contained within this class. - *

- *

- * <simpleType name="Status">
- *   <restriction base="{http://www.w3.org/2001/XMLSchema}string">
- *     <enumeration value="SUCCESSFUL"/>
- *     <enumeration value="FAILED"/>
- *     <enumeration value="REFRESH"/>
- *   </restriction>
- * </simpleType>
- * 
- * - */ -@XmlType(name = "Status") -@XmlEnum -public enum Status { - - SUCCESSFUL, - FAILED, - REFRESH; - - public String value() { - return name(); - } - - public static Status fromValue(String v) { - return valueOf(v); - } - -} diff --git a/Plugins/Mineplex.BungeeRotator/src/com/neustar/ultraservice/schema/v01/StatusEnum.java b/Plugins/Mineplex.BungeeRotator/src/com/neustar/ultraservice/schema/v01/StatusEnum.java deleted file mode 100644 index 54922011a..000000000 --- a/Plugins/Mineplex.BungeeRotator/src/com/neustar/ultraservice/schema/v01/StatusEnum.java +++ /dev/null @@ -1,42 +0,0 @@ - -package com.neustar.ultraservice.schema.v01; - -import javax.xml.bind.annotation.XmlEnum; -import javax.xml.bind.annotation.XmlType; - - -/** - *

Java class for StatusEnum. - * - *

The following schema fragment specifies the expected content contained within this class. - *

- *

- * <simpleType name="StatusEnum">
- *   <restriction base="{http://www.w3.org/2001/XMLSchema}string">
- *     <enumeration value="OK"/>
- *     <enumeration value="WARNING"/>
- *     <enumeration value="CRITICAL"/>
- *     <enumeration value="FAILURE"/>
- *   </restriction>
- * </simpleType>
- * 
- * - */ -@XmlType(name = "StatusEnum") -@XmlEnum -public enum StatusEnum { - - OK, - WARNING, - CRITICAL, - FAILURE; - - public String value() { - return name(); - } - - public static StatusEnum fromValue(String v) { - return valueOf(v); - } - -} diff --git a/Plugins/Mineplex.BungeeRotator/src/com/neustar/ultraservice/schema/v01/SuspendZone.java b/Plugins/Mineplex.BungeeRotator/src/com/neustar/ultraservice/schema/v01/SuspendZone.java deleted file mode 100644 index 223a147fa..000000000 --- a/Plugins/Mineplex.BungeeRotator/src/com/neustar/ultraservice/schema/v01/SuspendZone.java +++ /dev/null @@ -1,62 +0,0 @@ - -package com.neustar.ultraservice.schema.v01; - -import javax.xml.bind.annotation.XmlAccessType; -import javax.xml.bind.annotation.XmlAccessorType; -import javax.xml.bind.annotation.XmlElement; -import javax.xml.bind.annotation.XmlType; - - -/** - *

Java class for SuspendZone complex type. - * - *

The following schema fragment specifies the expected content contained within this class. - * - *

- * <complexType name="SuspendZone">
- *   <complexContent>
- *     <restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
- *       <sequence>
- *         <element name="suspendZoneRequest" type="{http://schema.ultraservice.neustar.com/v01/}SuspendZoneRequest"/>
- *       </sequence>
- *     </restriction>
- *   </complexContent>
- * </complexType>
- * 
- * - * - */ -@XmlAccessorType(XmlAccessType.FIELD) -@XmlType(name = "SuspendZone", propOrder = { - "suspendZoneRequest" -}) -public class SuspendZone { - - @XmlElement(required = true) - protected SuspendZoneRequest suspendZoneRequest; - - /** - * Gets the value of the suspendZoneRequest property. - * - * @return - * possible object is - * {@link SuspendZoneRequest } - * - */ - public SuspendZoneRequest getSuspendZoneRequest() { - return suspendZoneRequest; - } - - /** - * Sets the value of the suspendZoneRequest property. - * - * @param value - * allowed object is - * {@link SuspendZoneRequest } - * - */ - public void setSuspendZoneRequest(SuspendZoneRequest value) { - this.suspendZoneRequest = value; - } - -} diff --git a/Plugins/Mineplex.BungeeRotator/src/com/neustar/ultraservice/schema/v01/SuspendZoneRequest.java b/Plugins/Mineplex.BungeeRotator/src/com/neustar/ultraservice/schema/v01/SuspendZoneRequest.java deleted file mode 100644 index 71e6fba1b..000000000 --- a/Plugins/Mineplex.BungeeRotator/src/com/neustar/ultraservice/schema/v01/SuspendZoneRequest.java +++ /dev/null @@ -1,62 +0,0 @@ - -package com.neustar.ultraservice.schema.v01; - -import javax.xml.bind.annotation.XmlAccessType; -import javax.xml.bind.annotation.XmlAccessorType; -import javax.xml.bind.annotation.XmlElement; -import javax.xml.bind.annotation.XmlType; - - -/** - *

Java class for SuspendZoneRequest complex type. - * - *

The following schema fragment specifies the expected content contained within this class. - * - *

- * <complexType name="SuspendZoneRequest">
- *   <complexContent>
- *     <restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
- *       <sequence>
- *         <element name="zoneName" type="{http://www.w3.org/2001/XMLSchema}string"/>
- *       </sequence>
- *     </restriction>
- *   </complexContent>
- * </complexType>
- * 
- * - * - */ -@XmlAccessorType(XmlAccessType.FIELD) -@XmlType(name = "SuspendZoneRequest", propOrder = { - "zoneName" -}) -public class SuspendZoneRequest { - - @XmlElement(required = true) - protected String zoneName; - - /** - * Gets the value of the zoneName property. - * - * @return - * possible object is - * {@link String } - * - */ - public String getZoneName() { - return zoneName; - } - - /** - * Sets the value of the zoneName property. - * - * @param value - * allowed object is - * {@link String } - * - */ - public void setZoneName(String value) { - this.zoneName = value; - } - -} diff --git a/Plugins/Mineplex.BungeeRotator/src/com/neustar/ultraservice/schema/v01/TCPCriteria.java b/Plugins/Mineplex.BungeeRotator/src/com/neustar/ultraservice/schema/v01/TCPCriteria.java deleted file mode 100644 index 88162aceb..000000000 --- a/Plugins/Mineplex.BungeeRotator/src/com/neustar/ultraservice/schema/v01/TCPCriteria.java +++ /dev/null @@ -1,79 +0,0 @@ - -package com.neustar.ultraservice.schema.v01; - -import javax.xml.bind.annotation.XmlAccessType; -import javax.xml.bind.annotation.XmlAccessorType; -import javax.xml.bind.annotation.XmlType; - - -/** - *

Java class for TCPCriteria complex type. - * - *

The following schema fragment specifies the expected content contained within this class. - * - *

- * <complexType name="TCPCriteria">
- *   <complexContent>
- *     <restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
- *       <sequence>
- *         <element name="connectTime" type="{http://www.w3.org/2001/XMLSchema}int"/>
- *         <element name="connectTimeAverage" type="{http://www.w3.org/2001/XMLSchema}int" minOccurs="0"/>
- *       </sequence>
- *     </restriction>
- *   </complexContent>
- * </complexType>
- * 
- * - * - */ -@XmlAccessorType(XmlAccessType.FIELD) -@XmlType(name = "TCPCriteria", propOrder = { - "connectTime", - "connectTimeAverage" -}) -public class TCPCriteria { - - protected int connectTime; - protected Integer connectTimeAverage; - - /** - * Gets the value of the connectTime property. - * - */ - public int getConnectTime() { - return connectTime; - } - - /** - * Sets the value of the connectTime property. - * - */ - public void setConnectTime(int value) { - this.connectTime = value; - } - - /** - * Gets the value of the connectTimeAverage property. - * - * @return - * possible object is - * {@link Integer } - * - */ - public Integer getConnectTimeAverage() { - return connectTimeAverage; - } - - /** - * Sets the value of the connectTimeAverage property. - * - * @param value - * allowed object is - * {@link Integer } - * - */ - public void setConnectTimeAverage(Integer value) { - this.connectTimeAverage = value; - } - -} diff --git a/Plugins/Mineplex.BungeeRotator/src/com/neustar/ultraservice/schema/v01/TCPProbeData.java b/Plugins/Mineplex.BungeeRotator/src/com/neustar/ultraservice/schema/v01/TCPProbeData.java deleted file mode 100644 index 091b37b28..000000000 --- a/Plugins/Mineplex.BungeeRotator/src/com/neustar/ultraservice/schema/v01/TCPProbeData.java +++ /dev/null @@ -1,276 +0,0 @@ - -package com.neustar.ultraservice.schema.v01; - -import javax.xml.bind.annotation.XmlAccessType; -import javax.xml.bind.annotation.XmlAccessorType; -import javax.xml.bind.annotation.XmlAttribute; -import javax.xml.bind.annotation.XmlType; - - -/** - *

Java class for TCPProbeData complex type. - * - *

The following schema fragment specifies the expected content contained within this class. - * - *

- * <complexType name="TCPProbeData">
- *   <complexContent>
- *     <restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
- *       <sequence>
- *       </sequence>
- *       <attribute name="port" type="{http://www.w3.org/2001/XMLSchema}string" />
- *       <attribute name="controlIPAddress" type="{http://www.w3.org/2001/XMLSchema}string" />
- *       <attribute name="connectTime" type="{http://www.w3.org/2001/XMLSchema}string" />
- *       <attribute name="failConnectTime" type="{http://www.w3.org/2001/XMLSchema}string" />
- *       <attribute name="criticalConnectTime" type="{http://www.w3.org/2001/XMLSchema}string" />
- *       <attribute name="warningConnectTime" type="{http://www.w3.org/2001/XMLSchema}string" />
- *       <attribute name="failAverageConnectTime" type="{http://www.w3.org/2001/XMLSchema}string" />
- *       <attribute name="criticalAverageConnectTime" type="{http://www.w3.org/2001/XMLSchema}string" />
- *       <attribute name="warningAverageConnectTime" type="{http://www.w3.org/2001/XMLSchema}string" />
- *     </restriction>
- *   </complexContent>
- * </complexType>
- * 
- * - * - */ -@XmlAccessorType(XmlAccessType.FIELD) -@XmlType(name = "TCPProbeData") -public class TCPProbeData { - - @XmlAttribute(name = "port") - protected String port; - @XmlAttribute(name = "controlIPAddress") - protected String controlIPAddress; - @XmlAttribute(name = "connectTime") - protected String connectTime; - @XmlAttribute(name = "failConnectTime") - protected String failConnectTime; - @XmlAttribute(name = "criticalConnectTime") - protected String criticalConnectTime; - @XmlAttribute(name = "warningConnectTime") - protected String warningConnectTime; - @XmlAttribute(name = "failAverageConnectTime") - protected String failAverageConnectTime; - @XmlAttribute(name = "criticalAverageConnectTime") - protected String criticalAverageConnectTime; - @XmlAttribute(name = "warningAverageConnectTime") - protected String warningAverageConnectTime; - - /** - * Gets the value of the port property. - * - * @return - * possible object is - * {@link String } - * - */ - public String getPort() { - return port; - } - - /** - * Sets the value of the port property. - * - * @param value - * allowed object is - * {@link String } - * - */ - public void setPort(String value) { - this.port = value; - } - - /** - * Gets the value of the controlIPAddress property. - * - * @return - * possible object is - * {@link String } - * - */ - public String getControlIPAddress() { - return controlIPAddress; - } - - /** - * Sets the value of the controlIPAddress property. - * - * @param value - * allowed object is - * {@link String } - * - */ - public void setControlIPAddress(String value) { - this.controlIPAddress = value; - } - - /** - * Gets the value of the connectTime property. - * - * @return - * possible object is - * {@link String } - * - */ - public String getConnectTime() { - return connectTime; - } - - /** - * Sets the value of the connectTime property. - * - * @param value - * allowed object is - * {@link String } - * - */ - public void setConnectTime(String value) { - this.connectTime = value; - } - - /** - * Gets the value of the failConnectTime property. - * - * @return - * possible object is - * {@link String } - * - */ - public String getFailConnectTime() { - return failConnectTime; - } - - /** - * Sets the value of the failConnectTime property. - * - * @param value - * allowed object is - * {@link String } - * - */ - public void setFailConnectTime(String value) { - this.failConnectTime = value; - } - - /** - * Gets the value of the criticalConnectTime property. - * - * @return - * possible object is - * {@link String } - * - */ - public String getCriticalConnectTime() { - return criticalConnectTime; - } - - /** - * Sets the value of the criticalConnectTime property. - * - * @param value - * allowed object is - * {@link String } - * - */ - public void setCriticalConnectTime(String value) { - this.criticalConnectTime = value; - } - - /** - * Gets the value of the warningConnectTime property. - * - * @return - * possible object is - * {@link String } - * - */ - public String getWarningConnectTime() { - return warningConnectTime; - } - - /** - * Sets the value of the warningConnectTime property. - * - * @param value - * allowed object is - * {@link String } - * - */ - public void setWarningConnectTime(String value) { - this.warningConnectTime = value; - } - - /** - * Gets the value of the failAverageConnectTime property. - * - * @return - * possible object is - * {@link String } - * - */ - public String getFailAverageConnectTime() { - return failAverageConnectTime; - } - - /** - * Sets the value of the failAverageConnectTime property. - * - * @param value - * allowed object is - * {@link String } - * - */ - public void setFailAverageConnectTime(String value) { - this.failAverageConnectTime = value; - } - - /** - * Gets the value of the criticalAverageConnectTime property. - * - * @return - * possible object is - * {@link String } - * - */ - public String getCriticalAverageConnectTime() { - return criticalAverageConnectTime; - } - - /** - * Sets the value of the criticalAverageConnectTime property. - * - * @param value - * allowed object is - * {@link String } - * - */ - public void setCriticalAverageConnectTime(String value) { - this.criticalAverageConnectTime = value; - } - - /** - * Gets the value of the warningAverageConnectTime property. - * - * @return - * possible object is - * {@link String } - * - */ - public String getWarningAverageConnectTime() { - return warningAverageConnectTime; - } - - /** - * Sets the value of the warningAverageConnectTime property. - * - * @param value - * allowed object is - * {@link String } - * - */ - public void setWarningAverageConnectTime(String value) { - this.warningAverageConnectTime = value; - } - -} diff --git a/Plugins/Mineplex.BungeeRotator/src/com/neustar/ultraservice/schema/v01/TCPTransaction.java b/Plugins/Mineplex.BungeeRotator/src/com/neustar/ultraservice/schema/v01/TCPTransaction.java deleted file mode 100644 index 91fa90ed0..000000000 --- a/Plugins/Mineplex.BungeeRotator/src/com/neustar/ultraservice/schema/v01/TCPTransaction.java +++ /dev/null @@ -1,161 +0,0 @@ - -package com.neustar.ultraservice.schema.v01; - -import javax.xml.bind.annotation.XmlAccessType; -import javax.xml.bind.annotation.XmlAccessorType; -import javax.xml.bind.annotation.XmlAttribute; -import javax.xml.bind.annotation.XmlType; - - -/** - *

Java class for TCPTransaction complex type. - * - *

The following schema fragment specifies the expected content contained within this class. - * - *

- * <complexType name="TCPTransaction">
- *   <complexContent>
- *     <restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
- *       <sequence>
- *         <element name="warningCriteria" type="{http://schema.ultraservice.neustar.com/v01/}TCPCriteria" minOccurs="0"/>
- *         <element name="criticalCriteria" type="{http://schema.ultraservice.neustar.com/v01/}TCPCriteria" minOccurs="0"/>
- *         <element name="failCriteria" type="{http://schema.ultraservice.neustar.com/v01/}TCPCriteria" minOccurs="0"/>
- *       </sequence>
- *       <attribute name="port" use="required" type="{http://www.w3.org/2001/XMLSchema}int" />
- *       <attribute name="controlIP" type="{http://www.w3.org/2001/XMLSchema}string" />
- *     </restriction>
- *   </complexContent>
- * </complexType>
- * 
- * - * - */ -@XmlAccessorType(XmlAccessType.FIELD) -@XmlType(name = "TCPTransaction", propOrder = { - "warningCriteria", - "criticalCriteria", - "failCriteria" -}) -public class TCPTransaction { - - protected TCPCriteria warningCriteria; - protected TCPCriteria criticalCriteria; - protected TCPCriteria failCriteria; - @XmlAttribute(name = "port", required = true) - protected int port; - @XmlAttribute(name = "controlIP") - protected String controlIP; - - /** - * Gets the value of the warningCriteria property. - * - * @return - * possible object is - * {@link TCPCriteria } - * - */ - public TCPCriteria getWarningCriteria() { - return warningCriteria; - } - - /** - * Sets the value of the warningCriteria property. - * - * @param value - * allowed object is - * {@link TCPCriteria } - * - */ - public void setWarningCriteria(TCPCriteria value) { - this.warningCriteria = value; - } - - /** - * Gets the value of the criticalCriteria property. - * - * @return - * possible object is - * {@link TCPCriteria } - * - */ - public TCPCriteria getCriticalCriteria() { - return criticalCriteria; - } - - /** - * Sets the value of the criticalCriteria property. - * - * @param value - * allowed object is - * {@link TCPCriteria } - * - */ - public void setCriticalCriteria(TCPCriteria value) { - this.criticalCriteria = value; - } - - /** - * Gets the value of the failCriteria property. - * - * @return - * possible object is - * {@link TCPCriteria } - * - */ - public TCPCriteria getFailCriteria() { - return failCriteria; - } - - /** - * Sets the value of the failCriteria property. - * - * @param value - * allowed object is - * {@link TCPCriteria } - * - */ - public void setFailCriteria(TCPCriteria value) { - this.failCriteria = value; - } - - /** - * Gets the value of the port property. - * - */ - public int getPort() { - return port; - } - - /** - * Sets the value of the port property. - * - */ - public void setPort(int value) { - this.port = value; - } - - /** - * Gets the value of the controlIP property. - * - * @return - * possible object is - * {@link String } - * - */ - public String getControlIP() { - return controlIP; - } - - /** - * Sets the value of the controlIP property. - * - * @param value - * allowed object is - * {@link String } - * - */ - public void setControlIP(String value) { - this.controlIP = value; - } - -} diff --git a/Plugins/Mineplex.BungeeRotator/src/com/neustar/ultraservice/schema/v01/TaskId.java b/Plugins/Mineplex.BungeeRotator/src/com/neustar/ultraservice/schema/v01/TaskId.java deleted file mode 100644 index f665774f1..000000000 --- a/Plugins/Mineplex.BungeeRotator/src/com/neustar/ultraservice/schema/v01/TaskId.java +++ /dev/null @@ -1,62 +0,0 @@ - -package com.neustar.ultraservice.schema.v01; - -import javax.xml.bind.annotation.XmlAccessType; -import javax.xml.bind.annotation.XmlAccessorType; -import javax.xml.bind.annotation.XmlElement; -import javax.xml.bind.annotation.XmlType; - - -/** - *

Java class for TaskId complex type. - * - *

The following schema fragment specifies the expected content contained within this class. - * - *

- * <complexType name="TaskId">
- *   <complexContent>
- *     <restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
- *       <sequence>
- *         <element name="guid" type="{http://www.w3.org/2001/XMLSchema}string"/>
- *       </sequence>
- *     </restriction>
- *   </complexContent>
- * </complexType>
- * 
- * - * - */ -@XmlAccessorType(XmlAccessType.FIELD) -@XmlType(name = "TaskId", propOrder = { - "guid" -}) -public class TaskId { - - @XmlElement(required = true) - protected String guid; - - /** - * Gets the value of the guid property. - * - * @return - * possible object is - * {@link String } - * - */ - public String getGuid() { - return guid; - } - - /** - * Sets the value of the guid property. - * - * @param value - * allowed object is - * {@link String } - * - */ - public void setGuid(String value) { - this.guid = value; - } - -} diff --git a/Plugins/Mineplex.BungeeRotator/src/com/neustar/ultraservice/schema/v01/TaskStatus.java b/Plugins/Mineplex.BungeeRotator/src/com/neustar/ultraservice/schema/v01/TaskStatus.java deleted file mode 100644 index b8484736e..000000000 --- a/Plugins/Mineplex.BungeeRotator/src/com/neustar/ultraservice/schema/v01/TaskStatus.java +++ /dev/null @@ -1,146 +0,0 @@ - -package com.neustar.ultraservice.schema.v01; - -import javax.xml.bind.annotation.XmlAccessType; -import javax.xml.bind.annotation.XmlAccessorType; -import javax.xml.bind.annotation.XmlElement; -import javax.xml.bind.annotation.XmlType; -import com.neustar.ultra.api.webservice.v01.Code; - - -/** - *

Java class for TaskStatus complex type. - * - *

The following schema fragment specifies the expected content contained within this class. - * - *

- * <complexType name="TaskStatus">
- *   <complexContent>
- *     <restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
- *       <sequence>
- *         <element name="id" type="{http://schema.ultraservice.neustar.com/v01/}TaskId"/>
- *         <element name="code" type="{http://webservice.api.ultra.neustar.com/v01/}code"/>
- *         <element name="message" type="{http://www.w3.org/2001/XMLSchema}string"/>
- *         <element name="resultUrl" type="{http://www.w3.org/2001/XMLSchema}string" minOccurs="0"/>
- *       </sequence>
- *     </restriction>
- *   </complexContent>
- * </complexType>
- * 
- * - * - */ -@XmlAccessorType(XmlAccessType.FIELD) -@XmlType(name = "TaskStatus", propOrder = { - "id", - "code", - "message", - "resultUrl" -}) -public class TaskStatus { - - @XmlElement(required = true) - protected TaskId id; - @XmlElement(required = true) - protected Code code; - @XmlElement(required = true) - protected String message; - protected String resultUrl; - - /** - * Gets the value of the id property. - * - * @return - * possible object is - * {@link TaskId } - * - */ - public TaskId getId() { - return id; - } - - /** - * Sets the value of the id property. - * - * @param value - * allowed object is - * {@link TaskId } - * - */ - public void setId(TaskId value) { - this.id = value; - } - - /** - * Gets the value of the code property. - * - * @return - * possible object is - * {@link Code } - * - */ - public Code getCode() { - return code; - } - - /** - * Sets the value of the code property. - * - * @param value - * allowed object is - * {@link Code } - * - */ - public void setCode(Code value) { - this.code = value; - } - - /** - * Gets the value of the message property. - * - * @return - * possible object is - * {@link String } - * - */ - public String getMessage() { - return message; - } - - /** - * Sets the value of the message property. - * - * @param value - * allowed object is - * {@link String } - * - */ - public void setMessage(String value) { - this.message = value; - } - - /** - * Gets the value of the resultUrl property. - * - * @return - * possible object is - * {@link String } - * - */ - public String getResultUrl() { - return resultUrl; - } - - /** - * Sets the value of the resultUrl property. - * - * @param value - * allowed object is - * {@link String } - * - */ - public void setResultUrl(String value) { - this.resultUrl = value; - } - -} diff --git a/Plugins/Mineplex.BungeeRotator/src/com/neustar/ultraservice/schema/v01/TaskStatusList.java b/Plugins/Mineplex.BungeeRotator/src/com/neustar/ultraservice/schema/v01/TaskStatusList.java deleted file mode 100644 index 79e136a6f..000000000 --- a/Plugins/Mineplex.BungeeRotator/src/com/neustar/ultraservice/schema/v01/TaskStatusList.java +++ /dev/null @@ -1,69 +0,0 @@ - -package com.neustar.ultraservice.schema.v01; - -import java.util.ArrayList; -import java.util.List; -import javax.xml.bind.annotation.XmlAccessType; -import javax.xml.bind.annotation.XmlAccessorType; -import javax.xml.bind.annotation.XmlElement; -import javax.xml.bind.annotation.XmlType; - - -/** - *

Java class for TaskStatusList complex type. - * - *

The following schema fragment specifies the expected content contained within this class. - * - *

- * <complexType name="TaskStatusList">
- *   <complexContent>
- *     <restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
- *       <sequence>
- *         <element name="taskStatus" type="{http://schema.ultraservice.neustar.com/v01/}TaskStatus" maxOccurs="unbounded"/>
- *       </sequence>
- *     </restriction>
- *   </complexContent>
- * </complexType>
- * 
- * - * - */ -@XmlAccessorType(XmlAccessType.FIELD) -@XmlType(name = "TaskStatusList", propOrder = { - "taskStatus" -}) -public class TaskStatusList { - - @XmlElement(required = true) - protected List taskStatus; - - /** - * Gets the value of the taskStatus property. - * - *

- * This accessor method returns a reference to the live list, - * not a snapshot. Therefore any modification you make to the - * returned list will be present inside the JAXB object. - * This is why there is not a set method for the taskStatus property. - * - *

- * For example, to add a new item, do as follows: - *

-     *    getTaskStatus().add(newItem);
-     * 
- * - * - *

- * Objects of the following type(s) are allowed in the list - * {@link TaskStatus } - * - * - */ - public List getTaskStatus() { - if (taskStatus == null) { - taskStatus = new ArrayList(); - } - return this.taskStatus; - } - -} diff --git a/Plugins/Mineplex.BungeeRotator/src/com/neustar/ultraservice/schema/v01/TieBreak.java b/Plugins/Mineplex.BungeeRotator/src/com/neustar/ultraservice/schema/v01/TieBreak.java deleted file mode 100644 index 2f1fd5d7c..000000000 --- a/Plugins/Mineplex.BungeeRotator/src/com/neustar/ultraservice/schema/v01/TieBreak.java +++ /dev/null @@ -1,38 +0,0 @@ - -package com.neustar.ultraservice.schema.v01; - -import javax.xml.bind.annotation.XmlEnum; -import javax.xml.bind.annotation.XmlType; - - -/** - *

Java class for TieBreak. - * - *

The following schema fragment specifies the expected content contained within this class. - *

- *

- * <simpleType name="TieBreak">
- *   <restriction base="{http://www.w3.org/2001/XMLSchema}string">
- *     <enumeration value="GEOLOCATION"/>
- *     <enumeration value="SOURCEIP"/>
- *   </restriction>
- * </simpleType>
- * 
- * - */ -@XmlType(name = "TieBreak") -@XmlEnum -public enum TieBreak { - - GEOLOCATION, - SOURCEIP; - - public String value() { - return name(); - } - - public static TieBreak fromValue(String v) { - return valueOf(v); - } - -} diff --git a/Plugins/Mineplex.BungeeRotator/src/com/neustar/ultraservice/schema/v01/TimeZone.java b/Plugins/Mineplex.BungeeRotator/src/com/neustar/ultraservice/schema/v01/TimeZone.java deleted file mode 100644 index bdae88ad5..000000000 --- a/Plugins/Mineplex.BungeeRotator/src/com/neustar/ultraservice/schema/v01/TimeZone.java +++ /dev/null @@ -1,302 +0,0 @@ - -package com.neustar.ultraservice.schema.v01; - -import javax.xml.bind.annotation.XmlEnum; -import javax.xml.bind.annotation.XmlEnumValue; -import javax.xml.bind.annotation.XmlType; - - -/** - *

Java class for TimeZone. - * - *

The following schema fragment specifies the expected content contained within this class. - *

- *

- * <simpleType name="TimeZone">
- *   <restriction base="{http://www.w3.org/2001/XMLSchema}string">
- *     <enumeration value="(GMT-11.00) Midway Island / Samoa"/>
- *     <enumeration value="(GMT-10.00) Hawaii"/>
- *     <enumeration value="(GMT-09.00) Alaska"/>
- *     <enumeration value="(GMT-08.00) Pacific Time (US & Canada)"/>
- *     <enumeration value="(GMT-08.00) Tijuana / Baja California"/>
- *     <enumeration value="(GMT-07.00) Arizona"/>
- *     <enumeration value="(GMT-07.00) Chihuahua / La Paz / Mazatlan - New"/>
- *     <enumeration value="(GMT-07.00) Chihuahua / La Paz / Mazatlan - Old"/>
- *     <enumeration value="(GMT-07.00) Mountain Time (US & Canada)"/>
- *     <enumeration value="(GMT-06.00) Central America"/>
- *     <enumeration value="(GMT-06.00) Central Time (US & Canada)"/>
- *     <enumeration value="(GMT-06.00) Guadalajara / Mexico City / Monterrey - New"/>
- *     <enumeration value="(GMT-06.00) Guadalajara / Mexico City / Monterrey - Old"/>
- *     <enumeration value="(GMT-06.00) Saskatchewan"/>
- *     <enumeration value="(GMT-05.00) Bogota / Lima / Quito / Rio Branco"/>
- *     <enumeration value="(GMT-05.00) Eastern Time (US & Canada)"/>
- *     <enumeration value="(GMT-05.00) Indiana (East)"/>
- *     <enumeration value="(GMT-04.00) Atlantic Time (Canada)"/>
- *     <enumeration value="(GMT-04.00) Caracas / La Paz"/>
- *     <enumeration value="(GMT-04.00) Manaus"/>
- *     <enumeration value="(GMT-04.00) Santiago"/>
- *     <enumeration value="(GMT-03.30) Newfoundland"/>
- *     <enumeration value="(GMT-03.00) Brasilia"/>
- *     <enumeration value="(GMT-03.00) Buenos Aires / Georgetown"/>
- *     <enumeration value="(GMT-03.00) Greenland"/>
- *     <enumeration value="(GMT-03.00) Montevideo"/>
- *     <enumeration value="(GMT-02.00) Mid-Atlantic"/>
- *     <enumeration value="(GMT-01.00) Azores"/>
- *     <enumeration value="(GMT-01.00) Cape Verde Is."/>
- *     <enumeration value="(GMT) Casablanca / Monrovia / Reykjavik"/>
- *     <enumeration value="(GMT) Greenwich Mean Time - Dublin / Edinburgh / Lisbon / London"/>
- *     <enumeration value="(GMT) Greenwich Mean Time"/>
- *     <enumeration value="(GMT+01.00) Amsterdam / Berlin / Bern / Rome / Stockholm / Vienna"/>
- *     <enumeration value="(GMT+01.00) Belgrade / Bratislava / Budapest / Ljubljana / Prague"/>
- *     <enumeration value="(GMT+01.00) Brussels / Copenhagen / Madrid / Paris"/>
- *     <enumeration value="(GMT+01.00) Sarajevo / Skopje / Warsaw / Zagreb"/>
- *     <enumeration value="(GMT+01.00) West Central Africa"/>
- *     <enumeration value="(GMT+02.00) Amman"/>
- *     <enumeration value="(GMT+02.00) Athens / Bucharest / Istanbul"/>
- *     <enumeration value="(GMT+02.00) Beirut"/>
- *     <enumeration value="(GMT+02.00) Cairo"/>
- *     <enumeration value="(GMT+02.00) Harare / Pretoria"/>
- *     <enumeration value="(GMT+02.00) Helsinki / Kyiv / Riga / Sofia / Tallinn / Vilnius"/>
- *     <enumeration value="(GMT+02.00) Jerusalem"/>
- *     <enumeration value="(GMT+02.00) Minsk"/>
- *     <enumeration value="(GMT+02.00) Windhoek"/>
- *     <enumeration value="(GMT+03.00) Baghdad"/>
- *     <enumeration value="(GMT+03.00) Kuwait / Riyadh"/>
- *     <enumeration value="(GMT+03.00) Moscow / St. Petersburg / Volgograd"/>
- *     <enumeration value="(GMT+03.00) Nairobi"/>
- *     <enumeration value="(GMT+03.00) Tbilisi"/>
- *     <enumeration value="(GMT+03.30) Tehran"/>
- *     <enumeration value="(GMT+04.00) Abu Dhabi / Muscat"/>
- *     <enumeration value="(GMT+04.00) Baku"/>
- *     <enumeration value="(GMT+04.00) Yerevan"/>
- *     <enumeration value="(GMT+04.30) Kabul"/>
- *     <enumeration value="(GMT+05.00) Ekaterinburg"/>
- *     <enumeration value="(GMT+05.00) Islamabad / Karachi / Tashkent"/>
- *     <enumeration value="(GMT+05.30) Chennai / Kolkata / Mumbai / New Delhi"/>
- *     <enumeration value="(GMT+05.30) Sri Jayawardenepura"/>
- *     <enumeration value="(GMT+05.45) Kathmandu"/>
- *     <enumeration value="(GMT+06.00) Almaty / Novosibirsk"/>
- *     <enumeration value="(GMT+06.00) Astana / Dhaka"/>
- *     <enumeration value="(GMT+06.30) Yangon (Rangoon)"/>
- *     <enumeration value="(GMT+07.00) Bangkok / Hanoi / Jakarta"/>
- *     <enumeration value="(GMT+07.00) Krasnoyarsk"/>
- *     <enumeration value="(GMT+08.00) Beijing / Chongqing / Hong Kong / Urumqi"/>
- *     <enumeration value="(GMT+08.00) Irkutsk / Ulaan Bataar"/>
- *     <enumeration value="(GMT+08.00) Kuala Lumpur / Singapore"/>
- *     <enumeration value="(GMT+08.00) Perth"/>
- *     <enumeration value="(GMT+08.00) Taipei"/>
- *     <enumeration value="(GMT+09.00) Osaka / Sapporo / Tokyo"/>
- *     <enumeration value="(GMT+09.00) Seoul"/>
- *     <enumeration value="(GMT+09.00) Yakutsk"/>
- *     <enumeration value="(GMT+09.30) Adelaide"/>
- *     <enumeration value="(GMT+09.30) Darwin"/>
- *     <enumeration value="(GMT+10.00) Brisbane"/>
- *     <enumeration value="(GMT+10.00) Canberra / Melbourne / Sydney"/>
- *     <enumeration value="(GMT+10.00) Guam / Port Moresby"/>
- *     <enumeration value="(GMT+10.00) Hobart"/>
- *     <enumeration value="(GMT+10.00) Vladivostok"/>
- *     <enumeration value="(GMT+11.00) Magadan / Solomon Is. / New Caledonia"/>
- *     <enumeration value="(GMT+12.00) Auckland / Wellington"/>
- *     <enumeration value="(GMT+12.00) Fiji / Kamchatka / Marshall Is."/>
- *     <enumeration value="(GMT+13.00) Nuku'alofa"/>
- *     <enumeration value="GMT"/>
- *   </restriction>
- * </simpleType>
- * 
- * - */ -@XmlType(name = "TimeZone") -@XmlEnum -public enum TimeZone { - - @XmlEnumValue("(GMT-11.00) Midway Island / Samoa") - GMT_11_00_MIDWAY_ISLAND_SAMOA("(GMT-11.00) Midway Island / Samoa"), - @XmlEnumValue("(GMT-10.00) Hawaii") - GMT_10_00_HAWAII("(GMT-10.00) Hawaii"), - @XmlEnumValue("(GMT-09.00) Alaska") - GMT_09_00_ALASKA("(GMT-09.00) Alaska"), - @XmlEnumValue("(GMT-08.00) Pacific Time (US & Canada)") - GMT_08_00_PACIFIC_TIME_US_CANADA("(GMT-08.00) Pacific Time (US & Canada)"), - @XmlEnumValue("(GMT-08.00) Tijuana / Baja California") - GMT_08_00_TIJUANA_BAJA_CALIFORNIA("(GMT-08.00) Tijuana / Baja California"), - @XmlEnumValue("(GMT-07.00) Arizona") - GMT_07_00_ARIZONA("(GMT-07.00) Arizona"), - @XmlEnumValue("(GMT-07.00) Chihuahua / La Paz / Mazatlan - New") - GMT_07_00_CHIHUAHUA_LA_PAZ_MAZATLAN_NEW("(GMT-07.00) Chihuahua / La Paz / Mazatlan - New"), - @XmlEnumValue("(GMT-07.00) Chihuahua / La Paz / Mazatlan - Old") - GMT_07_00_CHIHUAHUA_LA_PAZ_MAZATLAN_OLD("(GMT-07.00) Chihuahua / La Paz / Mazatlan - Old"), - @XmlEnumValue("(GMT-07.00) Mountain Time (US & Canada)") - GMT_07_00_MOUNTAIN_TIME_US_CANADA("(GMT-07.00) Mountain Time (US & Canada)"), - @XmlEnumValue("(GMT-06.00) Central America") - GMT_06_00_CENTRAL_AMERICA("(GMT-06.00) Central America"), - @XmlEnumValue("(GMT-06.00) Central Time (US & Canada)") - GMT_06_00_CENTRAL_TIME_US_CANADA("(GMT-06.00) Central Time (US & Canada)"), - @XmlEnumValue("(GMT-06.00) Guadalajara / Mexico City / Monterrey - New") - GMT_06_00_GUADALAJARA_MEXICO_CITY_MONTERREY_NEW("(GMT-06.00) Guadalajara / Mexico City / Monterrey - New"), - @XmlEnumValue("(GMT-06.00) Guadalajara / Mexico City / Monterrey - Old") - GMT_06_00_GUADALAJARA_MEXICO_CITY_MONTERREY_OLD("(GMT-06.00) Guadalajara / Mexico City / Monterrey - Old"), - @XmlEnumValue("(GMT-06.00) Saskatchewan") - GMT_06_00_SASKATCHEWAN("(GMT-06.00) Saskatchewan"), - @XmlEnumValue("(GMT-05.00) Bogota / Lima / Quito / Rio Branco") - GMT_05_00_BOGOTA_LIMA_QUITO_RIO_BRANCO("(GMT-05.00) Bogota / Lima / Quito / Rio Branco"), - @XmlEnumValue("(GMT-05.00) Eastern Time (US & Canada)") - GMT_05_00_EASTERN_TIME_US_CANADA("(GMT-05.00) Eastern Time (US & Canada)"), - @XmlEnumValue("(GMT-05.00) Indiana (East)") - GMT_05_00_INDIANA_EAST("(GMT-05.00) Indiana (East)"), - @XmlEnumValue("(GMT-04.00) Atlantic Time (Canada)") - GMT_04_00_ATLANTIC_TIME_CANADA("(GMT-04.00) Atlantic Time (Canada)"), - @XmlEnumValue("(GMT-04.00) Caracas / La Paz") - GMT_04_00_CARACAS_LA_PAZ("(GMT-04.00) Caracas / La Paz"), - @XmlEnumValue("(GMT-04.00) Manaus") - GMT_04_00_MANAUS("(GMT-04.00) Manaus"), - @XmlEnumValue("(GMT-04.00) Santiago") - GMT_04_00_SANTIAGO("(GMT-04.00) Santiago"), - @XmlEnumValue("(GMT-03.30) Newfoundland") - GMT_03_30_NEWFOUNDLAND("(GMT-03.30) Newfoundland"), - @XmlEnumValue("(GMT-03.00) Brasilia") - GMT_03_00_BRASILIA("(GMT-03.00) Brasilia"), - @XmlEnumValue("(GMT-03.00) Buenos Aires / Georgetown") - GMT_03_00_BUENOS_AIRES_GEORGETOWN("(GMT-03.00) Buenos Aires / Georgetown"), - @XmlEnumValue("(GMT-03.00) Greenland") - GMT_03_00_GREENLAND("(GMT-03.00) Greenland"), - @XmlEnumValue("(GMT-03.00) Montevideo") - GMT_03_00_MONTEVIDEO("(GMT-03.00) Montevideo"), - @XmlEnumValue("(GMT-02.00) Mid-Atlantic") - GMT_02_00_MID_ATLANTIC("(GMT-02.00) Mid-Atlantic"), - @XmlEnumValue("(GMT-01.00) Azores") - GMT_01_00_AZORES("(GMT-01.00) Azores"), - @XmlEnumValue("(GMT-01.00) Cape Verde Is.") - GMT_01_00_CAPE_VERDE_IS("(GMT-01.00) Cape Verde Is."), - @XmlEnumValue("(GMT) Casablanca / Monrovia / Reykjavik") - GMT_CASABLANCA_MONROVIA_REYKJAVIK("(GMT) Casablanca / Monrovia / Reykjavik"), - @XmlEnumValue("(GMT) Greenwich Mean Time - Dublin / Edinburgh / Lisbon / London") - GMT_GREENWICH_MEAN_TIME_DUBLIN_EDINBURGH_LISBON_LONDON("(GMT) Greenwich Mean Time - Dublin / Edinburgh / Lisbon / London"), - @XmlEnumValue("(GMT) Greenwich Mean Time") - GMT_GREENWICH_MEAN_TIME("(GMT) Greenwich Mean Time"), - @XmlEnumValue("(GMT+01.00) Amsterdam / Berlin / Bern / Rome / Stockholm / Vienna") - GMT_01_00_AMSTERDAM_BERLIN_BERN_ROME_STOCKHOLM_VIENNA("(GMT+01.00) Amsterdam / Berlin / Bern / Rome / Stockholm / Vienna"), - @XmlEnumValue("(GMT+01.00) Belgrade / Bratislava / Budapest / Ljubljana / Prague") - GMT_01_00_BELGRADE_BRATISLAVA_BUDAPEST_LJUBLJANA_PRAGUE("(GMT+01.00) Belgrade / Bratislava / Budapest / Ljubljana / Prague"), - @XmlEnumValue("(GMT+01.00) Brussels / Copenhagen / Madrid / Paris") - GMT_01_00_BRUSSELS_COPENHAGEN_MADRID_PARIS("(GMT+01.00) Brussels / Copenhagen / Madrid / Paris"), - @XmlEnumValue("(GMT+01.00) Sarajevo / Skopje / Warsaw / Zagreb") - GMT_01_00_SARAJEVO_SKOPJE_WARSAW_ZAGREB("(GMT+01.00) Sarajevo / Skopje / Warsaw / Zagreb"), - @XmlEnumValue("(GMT+01.00) West Central Africa") - GMT_01_00_WEST_CENTRAL_AFRICA("(GMT+01.00) West Central Africa"), - @XmlEnumValue("(GMT+02.00) Amman") - GMT_02_00_AMMAN("(GMT+02.00) Amman"), - @XmlEnumValue("(GMT+02.00) Athens / Bucharest / Istanbul") - GMT_02_00_ATHENS_BUCHAREST_ISTANBUL("(GMT+02.00) Athens / Bucharest / Istanbul"), - @XmlEnumValue("(GMT+02.00) Beirut") - GMT_02_00_BEIRUT("(GMT+02.00) Beirut"), - @XmlEnumValue("(GMT+02.00) Cairo") - GMT_02_00_CAIRO("(GMT+02.00) Cairo"), - @XmlEnumValue("(GMT+02.00) Harare / Pretoria") - GMT_02_00_HARARE_PRETORIA("(GMT+02.00) Harare / Pretoria"), - @XmlEnumValue("(GMT+02.00) Helsinki / Kyiv / Riga / Sofia / Tallinn / Vilnius") - GMT_02_00_HELSINKI_KYIV_RIGA_SOFIA_TALLINN_VILNIUS("(GMT+02.00) Helsinki / Kyiv / Riga / Sofia / Tallinn / Vilnius"), - @XmlEnumValue("(GMT+02.00) Jerusalem") - GMT_02_00_JERUSALEM("(GMT+02.00) Jerusalem"), - @XmlEnumValue("(GMT+02.00) Minsk") - GMT_02_00_MINSK("(GMT+02.00) Minsk"), - @XmlEnumValue("(GMT+02.00) Windhoek") - GMT_02_00_WINDHOEK("(GMT+02.00) Windhoek"), - @XmlEnumValue("(GMT+03.00) Baghdad") - GMT_03_00_BAGHDAD("(GMT+03.00) Baghdad"), - @XmlEnumValue("(GMT+03.00) Kuwait / Riyadh") - GMT_03_00_KUWAIT_RIYADH("(GMT+03.00) Kuwait / Riyadh"), - @XmlEnumValue("(GMT+03.00) Moscow / St. Petersburg / Volgograd") - GMT_03_00_MOSCOW_ST_PETERSBURG_VOLGOGRAD("(GMT+03.00) Moscow / St. Petersburg / Volgograd"), - @XmlEnumValue("(GMT+03.00) Nairobi") - GMT_03_00_NAIROBI("(GMT+03.00) Nairobi"), - @XmlEnumValue("(GMT+03.00) Tbilisi") - GMT_03_00_TBILISI("(GMT+03.00) Tbilisi"), - @XmlEnumValue("(GMT+03.30) Tehran") - GMT_03_30_TEHRAN("(GMT+03.30) Tehran"), - @XmlEnumValue("(GMT+04.00) Abu Dhabi / Muscat") - GMT_04_00_ABU_DHABI_MUSCAT("(GMT+04.00) Abu Dhabi / Muscat"), - @XmlEnumValue("(GMT+04.00) Baku") - GMT_04_00_BAKU("(GMT+04.00) Baku"), - @XmlEnumValue("(GMT+04.00) Yerevan") - GMT_04_00_YEREVAN("(GMT+04.00) Yerevan"), - @XmlEnumValue("(GMT+04.30) Kabul") - GMT_04_30_KABUL("(GMT+04.30) Kabul"), - @XmlEnumValue("(GMT+05.00) Ekaterinburg") - GMT_05_00_EKATERINBURG("(GMT+05.00) Ekaterinburg"), - @XmlEnumValue("(GMT+05.00) Islamabad / Karachi / Tashkent") - GMT_05_00_ISLAMABAD_KARACHI_TASHKENT("(GMT+05.00) Islamabad / Karachi / Tashkent"), - @XmlEnumValue("(GMT+05.30) Chennai / Kolkata / Mumbai / New Delhi") - GMT_05_30_CHENNAI_KOLKATA_MUMBAI_NEW_DELHI("(GMT+05.30) Chennai / Kolkata / Mumbai / New Delhi"), - @XmlEnumValue("(GMT+05.30) Sri Jayawardenepura") - GMT_05_30_SRI_JAYAWARDENEPURA("(GMT+05.30) Sri Jayawardenepura"), - @XmlEnumValue("(GMT+05.45) Kathmandu") - GMT_05_45_KATHMANDU("(GMT+05.45) Kathmandu"), - @XmlEnumValue("(GMT+06.00) Almaty / Novosibirsk") - GMT_06_00_ALMATY_NOVOSIBIRSK("(GMT+06.00) Almaty / Novosibirsk"), - @XmlEnumValue("(GMT+06.00) Astana / Dhaka") - GMT_06_00_ASTANA_DHAKA("(GMT+06.00) Astana / Dhaka"), - @XmlEnumValue("(GMT+06.30) Yangon (Rangoon)") - GMT_06_30_YANGON_RANGOON("(GMT+06.30) Yangon (Rangoon)"), - @XmlEnumValue("(GMT+07.00) Bangkok / Hanoi / Jakarta") - GMT_07_00_BANGKOK_HANOI_JAKARTA("(GMT+07.00) Bangkok / Hanoi / Jakarta"), - @XmlEnumValue("(GMT+07.00) Krasnoyarsk") - GMT_07_00_KRASNOYARSK("(GMT+07.00) Krasnoyarsk"), - @XmlEnumValue("(GMT+08.00) Beijing / Chongqing / Hong Kong / Urumqi") - GMT_08_00_BEIJING_CHONGQING_HONG_KONG_URUMQI("(GMT+08.00) Beijing / Chongqing / Hong Kong / Urumqi"), - @XmlEnumValue("(GMT+08.00) Irkutsk / Ulaan Bataar") - GMT_08_00_IRKUTSK_ULAAN_BATAAR("(GMT+08.00) Irkutsk / Ulaan Bataar"), - @XmlEnumValue("(GMT+08.00) Kuala Lumpur / Singapore") - GMT_08_00_KUALA_LUMPUR_SINGAPORE("(GMT+08.00) Kuala Lumpur / Singapore"), - @XmlEnumValue("(GMT+08.00) Perth") - GMT_08_00_PERTH("(GMT+08.00) Perth"), - @XmlEnumValue("(GMT+08.00) Taipei") - GMT_08_00_TAIPEI("(GMT+08.00) Taipei"), - @XmlEnumValue("(GMT+09.00) Osaka / Sapporo / Tokyo") - GMT_09_00_OSAKA_SAPPORO_TOKYO("(GMT+09.00) Osaka / Sapporo / Tokyo"), - @XmlEnumValue("(GMT+09.00) Seoul") - GMT_09_00_SEOUL("(GMT+09.00) Seoul"), - @XmlEnumValue("(GMT+09.00) Yakutsk") - GMT_09_00_YAKUTSK("(GMT+09.00) Yakutsk"), - @XmlEnumValue("(GMT+09.30) Adelaide") - GMT_09_30_ADELAIDE("(GMT+09.30) Adelaide"), - @XmlEnumValue("(GMT+09.30) Darwin") - GMT_09_30_DARWIN("(GMT+09.30) Darwin"), - @XmlEnumValue("(GMT+10.00) Brisbane") - GMT_10_00_BRISBANE("(GMT+10.00) Brisbane"), - @XmlEnumValue("(GMT+10.00) Canberra / Melbourne / Sydney") - GMT_10_00_CANBERRA_MELBOURNE_SYDNEY("(GMT+10.00) Canberra / Melbourne / Sydney"), - @XmlEnumValue("(GMT+10.00) Guam / Port Moresby") - GMT_10_00_GUAM_PORT_MORESBY("(GMT+10.00) Guam / Port Moresby"), - @XmlEnumValue("(GMT+10.00) Hobart") - GMT_10_00_HOBART("(GMT+10.00) Hobart"), - @XmlEnumValue("(GMT+10.00) Vladivostok") - GMT_10_00_VLADIVOSTOK("(GMT+10.00) Vladivostok"), - @XmlEnumValue("(GMT+11.00) Magadan / Solomon Is. / New Caledonia") - GMT_11_00_MAGADAN_SOLOMON_IS_NEW_CALEDONIA("(GMT+11.00) Magadan / Solomon Is. / New Caledonia"), - @XmlEnumValue("(GMT+12.00) Auckland / Wellington") - GMT_12_00_AUCKLAND_WELLINGTON("(GMT+12.00) Auckland / Wellington"), - @XmlEnumValue("(GMT+12.00) Fiji / Kamchatka / Marshall Is.") - GMT_12_00_FIJI_KAMCHATKA_MARSHALL_IS("(GMT+12.00) Fiji / Kamchatka / Marshall Is."), - @XmlEnumValue("(GMT+13.00) Nuku'alofa") - GMT_13_00_NUKU_ALOFA("(GMT+13.00) Nuku'alofa"), - GMT("GMT"); - private final String value; - - TimeZone(String v) { - value = v; - } - - public String value() { - return value; - } - - public static TimeZone fromValue(String v) { - for (TimeZone c: TimeZone.values()) { - if (c.value.equals(v)) { - return c; - } - } - throw new IllegalArgumentException(v); - } - -} diff --git a/Plugins/Mineplex.BungeeRotator/src/com/neustar/ultraservice/schema/v01/UltraZone.java b/Plugins/Mineplex.BungeeRotator/src/com/neustar/ultraservice/schema/v01/UltraZone.java deleted file mode 100644 index 6b6e1620d..000000000 --- a/Plugins/Mineplex.BungeeRotator/src/com/neustar/ultraservice/schema/v01/UltraZone.java +++ /dev/null @@ -1,268 +0,0 @@ - -package com.neustar.ultraservice.schema.v01; - -import javax.xml.bind.annotation.XmlAccessType; -import javax.xml.bind.annotation.XmlAccessorType; -import javax.xml.bind.annotation.XmlAttribute; -import javax.xml.bind.annotation.XmlType; - - -/** - *

Java class for UltraZone complex type. - * - *

The following schema fragment specifies the expected content contained within this class. - * - *

- * <complexType name="UltraZone">
- *   <complexContent>
- *     <restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
- *       <sequence>
- *       </sequence>
- *       <attribute name="zoneName" use="required" type="{http://www.w3.org/2001/XMLSchema}string" />
- *       <attribute name="zoneType" use="required" type="{http://www.w3.org/2001/XMLSchema}int" />
- *       <attribute name="accountId" type="{http://www.w3.org/2001/XMLSchema}string" />
- *       <attribute name="primarySrc" type="{http://www.w3.org/2001/XMLSchema}string" />
- *       <attribute name="owner" type="{http://www.w3.org/2001/XMLSchema}string" />
- *       <attribute name="zoneId" type="{http://www.w3.org/2001/XMLSchema}string" />
- *       <attribute name="parentZoneGuid" type="{http://www.w3.org/2001/XMLSchema}string" />
- *       <attribute name="dnssecStatus" type="{http://www.w3.org/2001/XMLSchema}string" />
- *       <attribute name="suspended" type="{http://www.w3.org/2001/XMLSchema}string" />
- *     </restriction>
- *   </complexContent>
- * </complexType>
- * 
- * - * - */ -@XmlAccessorType(XmlAccessType.FIELD) -@XmlType(name = "UltraZone") -public class UltraZone { - - @XmlAttribute(name = "zoneName", required = true) - protected String zoneName; - @XmlAttribute(name = "zoneType", required = true) - protected int zoneType; - @XmlAttribute(name = "accountId") - protected String accountId; - @XmlAttribute(name = "primarySrc") - protected String primarySrc; - @XmlAttribute(name = "owner") - protected String owner; - @XmlAttribute(name = "zoneId") - protected String zoneId; - @XmlAttribute(name = "parentZoneGuid") - protected String parentZoneGuid; - @XmlAttribute(name = "dnssecStatus") - protected String dnssecStatus; - @XmlAttribute(name = "suspended") - protected String suspended; - - /** - * Gets the value of the zoneName property. - * - * @return - * possible object is - * {@link String } - * - */ - public String getZoneName() { - return zoneName; - } - - /** - * Sets the value of the zoneName property. - * - * @param value - * allowed object is - * {@link String } - * - */ - public void setZoneName(String value) { - this.zoneName = value; - } - - /** - * Gets the value of the zoneType property. - * - */ - public int getZoneType() { - return zoneType; - } - - /** - * Sets the value of the zoneType property. - * - */ - public void setZoneType(int value) { - this.zoneType = value; - } - - /** - * Gets the value of the accountId property. - * - * @return - * possible object is - * {@link String } - * - */ - public String getAccountId() { - return accountId; - } - - /** - * Sets the value of the accountId property. - * - * @param value - * allowed object is - * {@link String } - * - */ - public void setAccountId(String value) { - this.accountId = value; - } - - /** - * Gets the value of the primarySrc property. - * - * @return - * possible object is - * {@link String } - * - */ - public String getPrimarySrc() { - return primarySrc; - } - - /** - * Sets the value of the primarySrc property. - * - * @param value - * allowed object is - * {@link String } - * - */ - public void setPrimarySrc(String value) { - this.primarySrc = value; - } - - /** - * Gets the value of the owner property. - * - * @return - * possible object is - * {@link String } - * - */ - public String getOwner() { - return owner; - } - - /** - * Sets the value of the owner property. - * - * @param value - * allowed object is - * {@link String } - * - */ - public void setOwner(String value) { - this.owner = value; - } - - /** - * Gets the value of the zoneId property. - * - * @return - * possible object is - * {@link String } - * - */ - public String getZoneId() { - return zoneId; - } - - /** - * Sets the value of the zoneId property. - * - * @param value - * allowed object is - * {@link String } - * - */ - public void setZoneId(String value) { - this.zoneId = value; - } - - /** - * Gets the value of the parentZoneGuid property. - * - * @return - * possible object is - * {@link String } - * - */ - public String getParentZoneGuid() { - return parentZoneGuid; - } - - /** - * Sets the value of the parentZoneGuid property. - * - * @param value - * allowed object is - * {@link String } - * - */ - public void setParentZoneGuid(String value) { - this.parentZoneGuid = value; - } - - /** - * Gets the value of the dnssecStatus property. - * - * @return - * possible object is - * {@link String } - * - */ - public String getDnssecStatus() { - return dnssecStatus; - } - - /** - * Sets the value of the dnssecStatus property. - * - * @param value - * allowed object is - * {@link String } - * - */ - public void setDnssecStatus(String value) { - this.dnssecStatus = value; - } - - /** - * Gets the value of the suspended property. - * - * @return - * possible object is - * {@link String } - * - */ - public String getSuspended() { - return suspended; - } - - /** - * Sets the value of the suspended property. - * - * @param value - * allowed object is - * {@link String } - * - */ - public void setSuspended(String value) { - this.suspended = value; - } - -} diff --git a/Plugins/Mineplex.BungeeRotator/src/com/neustar/ultraservice/schema/v01/UnsuspendZone.java b/Plugins/Mineplex.BungeeRotator/src/com/neustar/ultraservice/schema/v01/UnsuspendZone.java deleted file mode 100644 index 7507012b5..000000000 --- a/Plugins/Mineplex.BungeeRotator/src/com/neustar/ultraservice/schema/v01/UnsuspendZone.java +++ /dev/null @@ -1,62 +0,0 @@ - -package com.neustar.ultraservice.schema.v01; - -import javax.xml.bind.annotation.XmlAccessType; -import javax.xml.bind.annotation.XmlAccessorType; -import javax.xml.bind.annotation.XmlElement; -import javax.xml.bind.annotation.XmlType; - - -/** - *

Java class for UnsuspendZone complex type. - * - *

The following schema fragment specifies the expected content contained within this class. - * - *

- * <complexType name="UnsuspendZone">
- *   <complexContent>
- *     <restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
- *       <sequence>
- *         <element name="unsuspendZoneRequest" type="{http://schema.ultraservice.neustar.com/v01/}UnsuspendZoneRequest"/>
- *       </sequence>
- *     </restriction>
- *   </complexContent>
- * </complexType>
- * 
- * - * - */ -@XmlAccessorType(XmlAccessType.FIELD) -@XmlType(name = "UnsuspendZone", propOrder = { - "unsuspendZoneRequest" -}) -public class UnsuspendZone { - - @XmlElement(required = true) - protected UnsuspendZoneRequest unsuspendZoneRequest; - - /** - * Gets the value of the unsuspendZoneRequest property. - * - * @return - * possible object is - * {@link UnsuspendZoneRequest } - * - */ - public UnsuspendZoneRequest getUnsuspendZoneRequest() { - return unsuspendZoneRequest; - } - - /** - * Sets the value of the unsuspendZoneRequest property. - * - * @param value - * allowed object is - * {@link UnsuspendZoneRequest } - * - */ - public void setUnsuspendZoneRequest(UnsuspendZoneRequest value) { - this.unsuspendZoneRequest = value; - } - -} diff --git a/Plugins/Mineplex.BungeeRotator/src/com/neustar/ultraservice/schema/v01/UnsuspendZoneRequest.java b/Plugins/Mineplex.BungeeRotator/src/com/neustar/ultraservice/schema/v01/UnsuspendZoneRequest.java deleted file mode 100644 index accf747f9..000000000 --- a/Plugins/Mineplex.BungeeRotator/src/com/neustar/ultraservice/schema/v01/UnsuspendZoneRequest.java +++ /dev/null @@ -1,62 +0,0 @@ - -package com.neustar.ultraservice.schema.v01; - -import javax.xml.bind.annotation.XmlAccessType; -import javax.xml.bind.annotation.XmlAccessorType; -import javax.xml.bind.annotation.XmlElement; -import javax.xml.bind.annotation.XmlType; - - -/** - *

Java class for UnsuspendZoneRequest complex type. - * - *

The following schema fragment specifies the expected content contained within this class. - * - *

- * <complexType name="UnsuspendZoneRequest">
- *   <complexContent>
- *     <restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
- *       <sequence>
- *         <element name="zoneName" type="{http://www.w3.org/2001/XMLSchema}string"/>
- *       </sequence>
- *     </restriction>
- *   </complexContent>
- * </complexType>
- * 
- * - * - */ -@XmlAccessorType(XmlAccessType.FIELD) -@XmlType(name = "UnsuspendZoneRequest", propOrder = { - "zoneName" -}) -public class UnsuspendZoneRequest { - - @XmlElement(required = true) - protected String zoneName; - - /** - * Gets the value of the zoneName property. - * - * @return - * possible object is - * {@link String } - * - */ - public String getZoneName() { - return zoneName; - } - - /** - * Sets the value of the zoneName property. - * - * @param value - * allowed object is - * {@link String } - * - */ - public void setZoneName(String value) { - this.zoneName = value; - } - -} diff --git a/Plugins/Mineplex.BungeeRotator/src/com/neustar/ultraservice/schema/v01/UpdateCustomHTTPHeaderData.java b/Plugins/Mineplex.BungeeRotator/src/com/neustar/ultraservice/schema/v01/UpdateCustomHTTPHeaderData.java deleted file mode 100644 index 86f8975fc..000000000 --- a/Plugins/Mineplex.BungeeRotator/src/com/neustar/ultraservice/schema/v01/UpdateCustomHTTPHeaderData.java +++ /dev/null @@ -1,87 +0,0 @@ - -package com.neustar.ultraservice.schema.v01; - -import javax.xml.bind.annotation.XmlAccessType; -import javax.xml.bind.annotation.XmlAccessorType; -import javax.xml.bind.annotation.XmlAttribute; -import javax.xml.bind.annotation.XmlType; - - -/** - *

Java class for UpdateCustomHTTPHeaderData complex type. - * - *

The following schema fragment specifies the expected content contained within this class. - * - *

- * <complexType name="UpdateCustomHTTPHeaderData">
- *   <complexContent>
- *     <restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
- *       <sequence>
- *       </sequence>
- *       <attribute name="guid" use="required" type="{http://www.w3.org/2001/XMLSchema}string" />
- *       <attribute name="customHeaderValue" use="required" type="{http://www.w3.org/2001/XMLSchema}string" />
- *     </restriction>
- *   </complexContent>
- * </complexType>
- * 
- * - * - */ -@XmlAccessorType(XmlAccessType.FIELD) -@XmlType(name = "UpdateCustomHTTPHeaderData") -public class UpdateCustomHTTPHeaderData { - - @XmlAttribute(name = "guid", required = true) - protected String guid; - @XmlAttribute(name = "customHeaderValue", required = true) - protected String customHeaderValue; - - /** - * Gets the value of the guid property. - * - * @return - * possible object is - * {@link String } - * - */ - public String getGuid() { - return guid; - } - - /** - * Sets the value of the guid property. - * - * @param value - * allowed object is - * {@link String } - * - */ - public void setGuid(String value) { - this.guid = value; - } - - /** - * Gets the value of the customHeaderValue property. - * - * @return - * possible object is - * {@link String } - * - */ - public String getCustomHeaderValue() { - return customHeaderValue; - } - - /** - * Sets the value of the customHeaderValue property. - * - * @param value - * allowed object is - * {@link String } - * - */ - public void setCustomHeaderValue(String value) { - this.customHeaderValue = value; - } - -} diff --git a/Plugins/Mineplex.BungeeRotator/src/com/neustar/ultraservice/schema/v01/UpdateDirectionalPoolData.java b/Plugins/Mineplex.BungeeRotator/src/com/neustar/ultraservice/schema/v01/UpdateDirectionalPoolData.java deleted file mode 100644 index f37519341..000000000 --- a/Plugins/Mineplex.BungeeRotator/src/com/neustar/ultraservice/schema/v01/UpdateDirectionalPoolData.java +++ /dev/null @@ -1,141 +0,0 @@ - -package com.neustar.ultraservice.schema.v01; - -import javax.xml.bind.annotation.XmlAccessType; -import javax.xml.bind.annotation.XmlAccessorType; -import javax.xml.bind.annotation.XmlAttribute; -import javax.xml.bind.annotation.XmlType; - - -/** - *

Java class for updateDirectionalPoolData complex type. - * - *

The following schema fragment specifies the expected content contained within this class. - * - *

- * <complexType name="updateDirectionalPoolData">
- *   <complexContent>
- *     <restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
- *       <sequence>
- *       </sequence>
- *       <attribute name="description" type="{http://www.w3.org/2001/XMLSchema}string" />
- *       <attribute name="dirPoolID" use="required" type="{http://www.w3.org/2001/XMLSchema}string" />
- *       <attribute name="dirPoolType" type="{http://schema.ultraservice.neustar.com/v01/}DirPoolType" />
- *       <attribute name="tieBreak" type="{http://schema.ultraservice.neustar.com/v01/}TieBreak" />
- *     </restriction>
- *   </complexContent>
- * </complexType>
- * 
- * - * - */ -@XmlAccessorType(XmlAccessType.FIELD) -@XmlType(name = "updateDirectionalPoolData") -public class UpdateDirectionalPoolData { - - @XmlAttribute(name = "description") - protected String description; - @XmlAttribute(name = "dirPoolID", required = true) - protected String dirPoolID; - @XmlAttribute(name = "dirPoolType") - protected DirPoolType dirPoolType; - @XmlAttribute(name = "tieBreak") - protected TieBreak tieBreak; - - /** - * Gets the value of the description property. - * - * @return - * possible object is - * {@link String } - * - */ - public String getDescription() { - return description; - } - - /** - * Sets the value of the description property. - * - * @param value - * allowed object is - * {@link String } - * - */ - public void setDescription(String value) { - this.description = value; - } - - /** - * Gets the value of the dirPoolID property. - * - * @return - * possible object is - * {@link String } - * - */ - public String getDirPoolID() { - return dirPoolID; - } - - /** - * Sets the value of the dirPoolID property. - * - * @param value - * allowed object is - * {@link String } - * - */ - public void setDirPoolID(String value) { - this.dirPoolID = value; - } - - /** - * Gets the value of the dirPoolType property. - * - * @return - * possible object is - * {@link DirPoolType } - * - */ - public DirPoolType getDirPoolType() { - return dirPoolType; - } - - /** - * Sets the value of the dirPoolType property. - * - * @param value - * allowed object is - * {@link DirPoolType } - * - */ - public void setDirPoolType(DirPoolType value) { - this.dirPoolType = value; - } - - /** - * Gets the value of the tieBreak property. - * - * @return - * possible object is - * {@link TieBreak } - * - */ - public TieBreak getTieBreak() { - return tieBreak; - } - - /** - * Sets the value of the tieBreak property. - * - * @param value - * allowed object is - * {@link TieBreak } - * - */ - public void setTieBreak(TieBreak value) { - this.tieBreak = value; - } - -} diff --git a/Plugins/Mineplex.BungeeRotator/src/com/neustar/ultraservice/schema/v01/UpdateDirectionalRecordData.java b/Plugins/Mineplex.BungeeRotator/src/com/neustar/ultraservice/schema/v01/UpdateDirectionalRecordData.java deleted file mode 100644 index d0fb11283..000000000 --- a/Plugins/Mineplex.BungeeRotator/src/com/neustar/ultraservice/schema/v01/UpdateDirectionalRecordData.java +++ /dev/null @@ -1,173 +0,0 @@ - -package com.neustar.ultraservice.schema.v01; - -import javax.xml.bind.annotation.XmlAccessType; -import javax.xml.bind.annotation.XmlAccessorType; -import javax.xml.bind.annotation.XmlAttribute; -import javax.xml.bind.annotation.XmlElement; -import javax.xml.bind.annotation.XmlType; - - -/** - *

Java class for UpdateDirectionalRecordData complex type. - * - *

The following schema fragment specifies the expected content contained within this class. - * - *

- * <complexType name="UpdateDirectionalRecordData">
- *   <complexContent>
- *     <restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
- *       <sequence>
- *         <element name="DirectionalRecordConfiguration" type="{http://schema.ultraservice.neustar.com/v01/}DirectionalDNSRecordToUpdate"/>
- *         <element name="GeolocationGroupDetails" type="{http://schema.ultraservice.neustar.com/v01/}UpdateGeolocationGroupDetails"/>
- *         <element name="SourceIPGroupDetails" type="{http://schema.ultraservice.neustar.com/v01/}UpdateSourceIPGroupDetails"/>
- *         <element name="forceOverlapTransfer" type="{http://www.w3.org/2001/XMLSchema}boolean" minOccurs="0"/>
- *       </sequence>
- *       <attribute name="directionalPoolRecordId" use="required" type="{http://www.w3.org/2001/XMLSchema}string" />
- *     </restriction>
- *   </complexContent>
- * </complexType>
- * 
- * - * - */ -@XmlAccessorType(XmlAccessType.FIELD) -@XmlType(name = "UpdateDirectionalRecordData", propOrder = { - "directionalRecordConfiguration", - "geolocationGroupDetails", - "sourceIPGroupDetails", - "forceOverlapTransfer" -}) -public class UpdateDirectionalRecordData { - - @XmlElement(name = "DirectionalRecordConfiguration", required = true, nillable = true) - protected DirectionalDNSRecordToUpdate directionalRecordConfiguration; - @XmlElement(name = "GeolocationGroupDetails", required = true, nillable = true) - protected UpdateGeolocationGroupDetails geolocationGroupDetails; - @XmlElement(name = "SourceIPGroupDetails", required = true, nillable = true) - protected UpdateSourceIPGroupDetails sourceIPGroupDetails; - protected Boolean forceOverlapTransfer; - @XmlAttribute(name = "directionalPoolRecordId", required = true) - protected String directionalPoolRecordId; - - /** - * Gets the value of the directionalRecordConfiguration property. - * - * @return - * possible object is - * {@link DirectionalDNSRecordToUpdate } - * - */ - public DirectionalDNSRecordToUpdate getDirectionalRecordConfiguration() { - return directionalRecordConfiguration; - } - - /** - * Sets the value of the directionalRecordConfiguration property. - * - * @param value - * allowed object is - * {@link DirectionalDNSRecordToUpdate } - * - */ - public void setDirectionalRecordConfiguration(DirectionalDNSRecordToUpdate value) { - this.directionalRecordConfiguration = value; - } - - /** - * Gets the value of the geolocationGroupDetails property. - * - * @return - * possible object is - * {@link UpdateGeolocationGroupDetails } - * - */ - public UpdateGeolocationGroupDetails getGeolocationGroupDetails() { - return geolocationGroupDetails; - } - - /** - * Sets the value of the geolocationGroupDetails property. - * - * @param value - * allowed object is - * {@link UpdateGeolocationGroupDetails } - * - */ - public void setGeolocationGroupDetails(UpdateGeolocationGroupDetails value) { - this.geolocationGroupDetails = value; - } - - /** - * Gets the value of the sourceIPGroupDetails property. - * - * @return - * possible object is - * {@link UpdateSourceIPGroupDetails } - * - */ - public UpdateSourceIPGroupDetails getSourceIPGroupDetails() { - return sourceIPGroupDetails; - } - - /** - * Sets the value of the sourceIPGroupDetails property. - * - * @param value - * allowed object is - * {@link UpdateSourceIPGroupDetails } - * - */ - public void setSourceIPGroupDetails(UpdateSourceIPGroupDetails value) { - this.sourceIPGroupDetails = value; - } - - /** - * Gets the value of the forceOverlapTransfer property. - * - * @return - * possible object is - * {@link Boolean } - * - */ - public Boolean isForceOverlapTransfer() { - return forceOverlapTransfer; - } - - /** - * Sets the value of the forceOverlapTransfer property. - * - * @param value - * allowed object is - * {@link Boolean } - * - */ - public void setForceOverlapTransfer(Boolean value) { - this.forceOverlapTransfer = value; - } - - /** - * Gets the value of the directionalPoolRecordId property. - * - * @return - * possible object is - * {@link String } - * - */ - public String getDirectionalPoolRecordId() { - return directionalPoolRecordId; - } - - /** - * Sets the value of the directionalPoolRecordId property. - * - * @param value - * allowed object is - * {@link String } - * - */ - public void setDirectionalPoolRecordId(String value) { - this.directionalPoolRecordId = value; - } - -} diff --git a/Plugins/Mineplex.BungeeRotator/src/com/neustar/ultraservice/schema/v01/UpdateGeolocationGroupDetails.java b/Plugins/Mineplex.BungeeRotator/src/com/neustar/ultraservice/schema/v01/UpdateGeolocationGroupDetails.java deleted file mode 100644 index 027411206..000000000 --- a/Plugins/Mineplex.BungeeRotator/src/com/neustar/ultraservice/schema/v01/UpdateGeolocationGroupDetails.java +++ /dev/null @@ -1,62 +0,0 @@ - -package com.neustar.ultraservice.schema.v01; - -import javax.xml.bind.annotation.XmlAccessType; -import javax.xml.bind.annotation.XmlAccessorType; -import javax.xml.bind.annotation.XmlAttribute; -import javax.xml.bind.annotation.XmlType; - - -/** - *

Java class for UpdateGeolocationGroupDetails complex type. - * - *

The following schema fragment specifies the expected content contained within this class. - * - *

- * <complexType name="UpdateGeolocationGroupDetails">
- *   <complexContent>
- *     <extension base="{http://schema.ultraservice.neustar.com/v01/}GeolocationGroupDetails">
- *       <sequence>
- *       </sequence>
- *       <attribute name="removeGroup" type="{http://www.w3.org/2001/XMLSchema}boolean" />
- *     </extension>
- *   </complexContent>
- * </complexType>
- * 
- * - * - */ -@XmlAccessorType(XmlAccessType.FIELD) -@XmlType(name = "UpdateGeolocationGroupDetails") -public class UpdateGeolocationGroupDetails - extends GeolocationGroupDetails -{ - - @XmlAttribute(name = "removeGroup") - protected Boolean removeGroup; - - /** - * Gets the value of the removeGroup property. - * - * @return - * possible object is - * {@link Boolean } - * - */ - public Boolean isRemoveGroup() { - return removeGroup; - } - - /** - * Sets the value of the removeGroup property. - * - * @param value - * allowed object is - * {@link Boolean } - * - */ - public void setRemoveGroup(Boolean value) { - this.removeGroup = value; - } - -} diff --git a/Plugins/Mineplex.BungeeRotator/src/com/neustar/ultraservice/schema/v01/UpdateRoundRobinRecord.java b/Plugins/Mineplex.BungeeRotator/src/com/neustar/ultraservice/schema/v01/UpdateRoundRobinRecord.java deleted file mode 100644 index 271399df6..000000000 --- a/Plugins/Mineplex.BungeeRotator/src/com/neustar/ultraservice/schema/v01/UpdateRoundRobinRecord.java +++ /dev/null @@ -1,141 +0,0 @@ - -package com.neustar.ultraservice.schema.v01; - -import javax.xml.bind.annotation.XmlAccessType; -import javax.xml.bind.annotation.XmlAccessorType; -import javax.xml.bind.annotation.XmlAttribute; -import javax.xml.bind.annotation.XmlType; - - -/** - *

Java class for UpdateRoundRobinRecord complex type. - * - *

The following schema fragment specifies the expected content contained within this class. - * - *

- * <complexType name="UpdateRoundRobinRecord">
- *   <complexContent>
- *     <restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
- *       <sequence>
- *       </sequence>
- *       <attribute name="rrGuid" use="required" type="{http://www.w3.org/2001/XMLSchema}string" />
- *       <attribute name="lbPoolID" use="required" type="{http://www.w3.org/2001/XMLSchema}string" />
- *       <attribute name="info1Value" use="required" type="{http://www.w3.org/2001/XMLSchema}string" />
- *       <attribute name="TTL" type="{http://www.w3.org/2001/XMLSchema}string" />
- *     </restriction>
- *   </complexContent>
- * </complexType>
- * 
- * - * - */ -@XmlAccessorType(XmlAccessType.FIELD) -@XmlType(name = "UpdateRoundRobinRecord") -public class UpdateRoundRobinRecord { - - @XmlAttribute(name = "rrGuid", required = true) - protected String rrGuid; - @XmlAttribute(name = "lbPoolID", required = true) - protected String lbPoolID; - @XmlAttribute(name = "info1Value", required = true) - protected String info1Value; - @XmlAttribute(name = "TTL") - protected String ttl; - - /** - * Gets the value of the rrGuid property. - * - * @return - * possible object is - * {@link String } - * - */ - public String getRrGuid() { - return rrGuid; - } - - /** - * Sets the value of the rrGuid property. - * - * @param value - * allowed object is - * {@link String } - * - */ - public void setRrGuid(String value) { - this.rrGuid = value; - } - - /** - * Gets the value of the lbPoolID property. - * - * @return - * possible object is - * {@link String } - * - */ - public String getLbPoolID() { - return lbPoolID; - } - - /** - * Sets the value of the lbPoolID property. - * - * @param value - * allowed object is - * {@link String } - * - */ - public void setLbPoolID(String value) { - this.lbPoolID = value; - } - - /** - * Gets the value of the info1Value property. - * - * @return - * possible object is - * {@link String } - * - */ - public String getInfo1Value() { - return info1Value; - } - - /** - * Sets the value of the info1Value property. - * - * @param value - * allowed object is - * {@link String } - * - */ - public void setInfo1Value(String value) { - this.info1Value = value; - } - - /** - * Gets the value of the ttl property. - * - * @return - * possible object is - * {@link String } - * - */ - public String getTTL() { - return ttl; - } - - /** - * Sets the value of the ttl property. - * - * @param value - * allowed object is - * {@link String } - * - */ - public void setTTL(String value) { - this.ttl = value; - } - -} diff --git a/Plugins/Mineplex.BungeeRotator/src/com/neustar/ultraservice/schema/v01/UpdateSourceIPGroupDetails.java b/Plugins/Mineplex.BungeeRotator/src/com/neustar/ultraservice/schema/v01/UpdateSourceIPGroupDetails.java deleted file mode 100644 index f65ca79cd..000000000 --- a/Plugins/Mineplex.BungeeRotator/src/com/neustar/ultraservice/schema/v01/UpdateSourceIPGroupDetails.java +++ /dev/null @@ -1,62 +0,0 @@ - -package com.neustar.ultraservice.schema.v01; - -import javax.xml.bind.annotation.XmlAccessType; -import javax.xml.bind.annotation.XmlAccessorType; -import javax.xml.bind.annotation.XmlAttribute; -import javax.xml.bind.annotation.XmlType; - - -/** - *

Java class for UpdateSourceIPGroupDetails complex type. - * - *

The following schema fragment specifies the expected content contained within this class. - * - *

- * <complexType name="UpdateSourceIPGroupDetails">
- *   <complexContent>
- *     <extension base="{http://schema.ultraservice.neustar.com/v01/}SourceIPGroupDetails">
- *       <sequence>
- *       </sequence>
- *       <attribute name="removeGroup" type="{http://www.w3.org/2001/XMLSchema}boolean" />
- *     </extension>
- *   </complexContent>
- * </complexType>
- * 
- * - * - */ -@XmlAccessorType(XmlAccessType.FIELD) -@XmlType(name = "UpdateSourceIPGroupDetails") -public class UpdateSourceIPGroupDetails - extends SourceIPGroupDetails -{ - - @XmlAttribute(name = "removeGroup") - protected Boolean removeGroup; - - /** - * Gets the value of the removeGroup property. - * - * @return - * possible object is - * {@link Boolean } - * - */ - public Boolean isRemoveGroup() { - return removeGroup; - } - - /** - * Sets the value of the removeGroup property. - * - * @param value - * allowed object is - * {@link Boolean } - * - */ - public void setRemoveGroup(Boolean value) { - this.removeGroup = value; - } - -} diff --git a/Plugins/Mineplex.BungeeRotator/src/com/neustar/ultraservice/schema/v01/UpdateWebForwardPoolRecordData.java b/Plugins/Mineplex.BungeeRotator/src/com/neustar/ultraservice/schema/v01/UpdateWebForwardPoolRecordData.java deleted file mode 100644 index 25c1315df..000000000 --- a/Plugins/Mineplex.BungeeRotator/src/com/neustar/ultraservice/schema/v01/UpdateWebForwardPoolRecordData.java +++ /dev/null @@ -1,116 +0,0 @@ - -package com.neustar.ultraservice.schema.v01; - -import java.util.ArrayList; -import java.util.List; -import javax.xml.bind.annotation.XmlAccessType; -import javax.xml.bind.annotation.XmlAccessorType; -import javax.xml.bind.annotation.XmlAttribute; -import javax.xml.bind.annotation.XmlElement; -import javax.xml.bind.annotation.XmlType; - - -/** - *

Java class for UpdateWebForwardPoolRecordData complex type. - * - *

The following schema fragment specifies the expected content contained within this class. - * - *

- * <complexType name="UpdateWebForwardPoolRecordData">
- *   <complexContent>
- *     <restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
- *       <sequence>
- *         <element name="HeaderRule" type="{http://schema.ultraservice.neustar.com/v01/}HeaderRule" maxOccurs="unbounded" minOccurs="0"/>
- *       </sequence>
- *       <attribute name="guid" use="required" type="{http://www.w3.org/2001/XMLSchema}string" />
- *       <attribute name="priority" use="required" type="{http://www.w3.org/2001/XMLSchema}long" />
- *     </restriction>
- *   </complexContent>
- * </complexType>
- * 
- * - * - */ -@XmlAccessorType(XmlAccessType.FIELD) -@XmlType(name = "UpdateWebForwardPoolRecordData", propOrder = { - "headerRule" -}) -public class UpdateWebForwardPoolRecordData { - - @XmlElement(name = "HeaderRule") - protected List headerRule; - @XmlAttribute(name = "guid", required = true) - protected String guid; - @XmlAttribute(name = "priority", required = true) - protected long priority; - - /** - * Gets the value of the headerRule property. - * - *

- * This accessor method returns a reference to the live list, - * not a snapshot. Therefore any modification you make to the - * returned list will be present inside the JAXB object. - * This is why there is not a set method for the headerRule property. - * - *

- * For example, to add a new item, do as follows: - *

-     *    getHeaderRule().add(newItem);
-     * 
- * - * - *

- * Objects of the following type(s) are allowed in the list - * {@link HeaderRule } - * - * - */ - public List getHeaderRule() { - if (headerRule == null) { - headerRule = new ArrayList(); - } - return this.headerRule; - } - - /** - * Gets the value of the guid property. - * - * @return - * possible object is - * {@link String } - * - */ - public String getGuid() { - return guid; - } - - /** - * Sets the value of the guid property. - * - * @param value - * allowed object is - * {@link String } - * - */ - public void setGuid(String value) { - this.guid = value; - } - - /** - * Gets the value of the priority property. - * - */ - public long getPriority() { - return priority; - } - - /** - * Sets the value of the priority property. - * - */ - public void setPriority(long value) { - this.priority = value; - } - -} diff --git a/Plugins/Mineplex.BungeeRotator/src/com/neustar/ultraservice/schema/v01/UserContactInfo.java b/Plugins/Mineplex.BungeeRotator/src/com/neustar/ultraservice/schema/v01/UserContactInfo.java deleted file mode 100644 index 4acdac152..000000000 --- a/Plugins/Mineplex.BungeeRotator/src/com/neustar/ultraservice/schema/v01/UserContactInfo.java +++ /dev/null @@ -1,62 +0,0 @@ - -package com.neustar.ultraservice.schema.v01; - -import javax.xml.bind.annotation.XmlAccessType; -import javax.xml.bind.annotation.XmlAccessorType; -import javax.xml.bind.annotation.XmlElement; -import javax.xml.bind.annotation.XmlType; - - -/** - *

Java class for UserContactInfo complex type. - * - *

The following schema fragment specifies the expected content contained within this class. - * - *

- * <complexType name="UserContactInfo">
- *   <complexContent>
- *     <restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
- *       <sequence>
- *         <element name="UserContactInfoValues" type="{http://schema.ultraservice.neustar.com/v01/}UserContactInfoValues"/>
- *       </sequence>
- *     </restriction>
- *   </complexContent>
- * </complexType>
- * 
- * - * - */ -@XmlAccessorType(XmlAccessType.FIELD) -@XmlType(name = "UserContactInfo", propOrder = { - "userContactInfoValues" -}) -public class UserContactInfo { - - @XmlElement(name = "UserContactInfoValues", required = true) - protected UserContactInfoValues userContactInfoValues; - - /** - * Gets the value of the userContactInfoValues property. - * - * @return - * possible object is - * {@link UserContactInfoValues } - * - */ - public UserContactInfoValues getUserContactInfoValues() { - return userContactInfoValues; - } - - /** - * Sets the value of the userContactInfoValues property. - * - * @param value - * allowed object is - * {@link UserContactInfoValues } - * - */ - public void setUserContactInfoValues(UserContactInfoValues value) { - this.userContactInfoValues = value; - } - -} diff --git a/Plugins/Mineplex.BungeeRotator/src/com/neustar/ultraservice/schema/v01/UserContactInfoValues.java b/Plugins/Mineplex.BungeeRotator/src/com/neustar/ultraservice/schema/v01/UserContactInfoValues.java deleted file mode 100644 index 6c2113ece..000000000 --- a/Plugins/Mineplex.BungeeRotator/src/com/neustar/ultraservice/schema/v01/UserContactInfoValues.java +++ /dev/null @@ -1,411 +0,0 @@ - -package com.neustar.ultraservice.schema.v01; - -import javax.xml.bind.annotation.XmlAccessType; -import javax.xml.bind.annotation.XmlAccessorType; -import javax.xml.bind.annotation.XmlAttribute; -import javax.xml.bind.annotation.XmlType; - - -/** - *

Java class for UserContactInfoValues complex type. - * - *

The following schema fragment specifies the expected content contained within this class. - * - *

- * <complexType name="UserContactInfoValues">
- *   <complexContent>
- *     <restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
- *       <sequence>
- *       </sequence>
- *       <attribute name="FirstName" use="required" type="{http://www.w3.org/2001/XMLSchema}string" />
- *       <attribute name="LastName" use="required" type="{http://www.w3.org/2001/XMLSchema}string" />
- *       <attribute name="PrimaryEmail" use="required" type="{http://www.w3.org/2001/XMLSchema}string" />
- *       <attribute name="SecondaryEmail" type="{http://www.w3.org/2001/XMLSchema}string" />
- *       <attribute name="PhoneNumber" use="required" type="{http://www.w3.org/2001/XMLSchema}string" />
- *       <attribute name="FaxNumber" type="{http://www.w3.org/2001/XMLSchema}string" />
- *       <attribute name="MobileNumber" type="{http://www.w3.org/2001/XMLSchema}string" />
- *       <attribute name="CompanyName" use="required" type="{http://www.w3.org/2001/XMLSchema}string" />
- *       <attribute name="Address1" use="required" type="{http://www.w3.org/2001/XMLSchema}string" />
- *       <attribute name="Address2" type="{http://www.w3.org/2001/XMLSchema}string" />
- *       <attribute name="City" use="required" type="{http://www.w3.org/2001/XMLSchema}string" />
- *       <attribute name="State" use="required" type="{http://www.w3.org/2001/XMLSchema}string" />
- *       <attribute name="ZipCode" use="required" type="{http://www.w3.org/2001/XMLSchema}string" />
- *       <attribute name="Country" use="required" type="{http://www.w3.org/2001/XMLSchema}string" />
- *     </restriction>
- *   </complexContent>
- * </complexType>
- * 
- * - * - */ -@XmlAccessorType(XmlAccessType.FIELD) -@XmlType(name = "UserContactInfoValues") -public class UserContactInfoValues { - - @XmlAttribute(name = "FirstName", required = true) - protected String firstName; - @XmlAttribute(name = "LastName", required = true) - protected String lastName; - @XmlAttribute(name = "PrimaryEmail", required = true) - protected String primaryEmail; - @XmlAttribute(name = "SecondaryEmail") - protected String secondaryEmail; - @XmlAttribute(name = "PhoneNumber", required = true) - protected String phoneNumber; - @XmlAttribute(name = "FaxNumber") - protected String faxNumber; - @XmlAttribute(name = "MobileNumber") - protected String mobileNumber; - @XmlAttribute(name = "CompanyName", required = true) - protected String companyName; - @XmlAttribute(name = "Address1", required = true) - protected String address1; - @XmlAttribute(name = "Address2") - protected String address2; - @XmlAttribute(name = "City", required = true) - protected String city; - @XmlAttribute(name = "State", required = true) - protected String state; - @XmlAttribute(name = "ZipCode", required = true) - protected String zipCode; - @XmlAttribute(name = "Country", required = true) - protected String country; - - /** - * Gets the value of the firstName property. - * - * @return - * possible object is - * {@link String } - * - */ - public String getFirstName() { - return firstName; - } - - /** - * Sets the value of the firstName property. - * - * @param value - * allowed object is - * {@link String } - * - */ - public void setFirstName(String value) { - this.firstName = value; - } - - /** - * Gets the value of the lastName property. - * - * @return - * possible object is - * {@link String } - * - */ - public String getLastName() { - return lastName; - } - - /** - * Sets the value of the lastName property. - * - * @param value - * allowed object is - * {@link String } - * - */ - public void setLastName(String value) { - this.lastName = value; - } - - /** - * Gets the value of the primaryEmail property. - * - * @return - * possible object is - * {@link String } - * - */ - public String getPrimaryEmail() { - return primaryEmail; - } - - /** - * Sets the value of the primaryEmail property. - * - * @param value - * allowed object is - * {@link String } - * - */ - public void setPrimaryEmail(String value) { - this.primaryEmail = value; - } - - /** - * Gets the value of the secondaryEmail property. - * - * @return - * possible object is - * {@link String } - * - */ - public String getSecondaryEmail() { - return secondaryEmail; - } - - /** - * Sets the value of the secondaryEmail property. - * - * @param value - * allowed object is - * {@link String } - * - */ - public void setSecondaryEmail(String value) { - this.secondaryEmail = value; - } - - /** - * Gets the value of the phoneNumber property. - * - * @return - * possible object is - * {@link String } - * - */ - public String getPhoneNumber() { - return phoneNumber; - } - - /** - * Sets the value of the phoneNumber property. - * - * @param value - * allowed object is - * {@link String } - * - */ - public void setPhoneNumber(String value) { - this.phoneNumber = value; - } - - /** - * Gets the value of the faxNumber property. - * - * @return - * possible object is - * {@link String } - * - */ - public String getFaxNumber() { - return faxNumber; - } - - /** - * Sets the value of the faxNumber property. - * - * @param value - * allowed object is - * {@link String } - * - */ - public void setFaxNumber(String value) { - this.faxNumber = value; - } - - /** - * Gets the value of the mobileNumber property. - * - * @return - * possible object is - * {@link String } - * - */ - public String getMobileNumber() { - return mobileNumber; - } - - /** - * Sets the value of the mobileNumber property. - * - * @param value - * allowed object is - * {@link String } - * - */ - public void setMobileNumber(String value) { - this.mobileNumber = value; - } - - /** - * Gets the value of the companyName property. - * - * @return - * possible object is - * {@link String } - * - */ - public String getCompanyName() { - return companyName; - } - - /** - * Sets the value of the companyName property. - * - * @param value - * allowed object is - * {@link String } - * - */ - public void setCompanyName(String value) { - this.companyName = value; - } - - /** - * Gets the value of the address1 property. - * - * @return - * possible object is - * {@link String } - * - */ - public String getAddress1() { - return address1; - } - - /** - * Sets the value of the address1 property. - * - * @param value - * allowed object is - * {@link String } - * - */ - public void setAddress1(String value) { - this.address1 = value; - } - - /** - * Gets the value of the address2 property. - * - * @return - * possible object is - * {@link String } - * - */ - public String getAddress2() { - return address2; - } - - /** - * Sets the value of the address2 property. - * - * @param value - * allowed object is - * {@link String } - * - */ - public void setAddress2(String value) { - this.address2 = value; - } - - /** - * Gets the value of the city property. - * - * @return - * possible object is - * {@link String } - * - */ - public String getCity() { - return city; - } - - /** - * Sets the value of the city property. - * - * @param value - * allowed object is - * {@link String } - * - */ - public void setCity(String value) { - this.city = value; - } - - /** - * Gets the value of the state property. - * - * @return - * possible object is - * {@link String } - * - */ - public String getState() { - return state; - } - - /** - * Sets the value of the state property. - * - * @param value - * allowed object is - * {@link String } - * - */ - public void setState(String value) { - this.state = value; - } - - /** - * Gets the value of the zipCode property. - * - * @return - * possible object is - * {@link String } - * - */ - public String getZipCode() { - return zipCode; - } - - /** - * Sets the value of the zipCode property. - * - * @param value - * allowed object is - * {@link String } - * - */ - public void setZipCode(String value) { - this.zipCode = value; - } - - /** - * Gets the value of the country property. - * - * @return - * possible object is - * {@link String } - * - */ - public String getCountry() { - return country; - } - - /** - * Sets the value of the country property. - * - * @param value - * allowed object is - * {@link String } - * - */ - public void setCountry(String value) { - this.country = value; - } - -} diff --git a/Plugins/Mineplex.BungeeRotator/src/com/neustar/ultraservice/schema/v01/UserDefaultPreferences.java b/Plugins/Mineplex.BungeeRotator/src/com/neustar/ultraservice/schema/v01/UserDefaultPreferences.java deleted file mode 100644 index c3c0b968e..000000000 --- a/Plugins/Mineplex.BungeeRotator/src/com/neustar/ultraservice/schema/v01/UserDefaultPreferences.java +++ /dev/null @@ -1,202 +0,0 @@ - -package com.neustar.ultraservice.schema.v01; - -import javax.xml.bind.annotation.XmlAccessType; -import javax.xml.bind.annotation.XmlAccessorType; -import javax.xml.bind.annotation.XmlElement; -import javax.xml.bind.annotation.XmlType; - - -/** - *

Java class for UserDefaultPreferences complex type. - * - *

The following schema fragment specifies the expected content contained within this class. - * - *

- * <complexType name="UserDefaultPreferences">
- *   <complexContent>
- *     <restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
- *       <sequence>
- *         <element name="DefaultAccountPreference" type="{http://schema.ultraservice.neustar.com/v01/}DefaultAccountPreference"/>
- *         <element name="DefaultDateAndTimePreference" type="{http://schema.ultraservice.neustar.com/v01/}DefaultDateAndTimePreference"/>
- *         <element name="DefaultNumberOfrecordsPreference" type="{http://schema.ultraservice.neustar.com/v01/}DefaultNumberOfrecordsPreference"/>
- *         <element name="DeleteConfirmPreference" type="{http://schema.ultraservice.neustar.com/v01/}DeleteConfirmPreference"/>
- *         <element name="AutomaticPointerPreference" type="{http://schema.ultraservice.neustar.com/v01/}AutomaticPointerPreference"/>
- *         <element name="DefaultReportPreference" type="{http://schema.ultraservice.neustar.com/v01/}DefaultReportPrefPreference"/>
- *       </sequence>
- *     </restriction>
- *   </complexContent>
- * </complexType>
- * 
- * - * - */ -@XmlAccessorType(XmlAccessType.FIELD) -@XmlType(name = "UserDefaultPreferences", propOrder = { - "defaultAccountPreference", - "defaultDateAndTimePreference", - "defaultNumberOfrecordsPreference", - "deleteConfirmPreference", - "automaticPointerPreference", - "defaultReportPreference" -}) -public class UserDefaultPreferences { - - @XmlElement(name = "DefaultAccountPreference", required = true) - protected DefaultAccountPreference defaultAccountPreference; - @XmlElement(name = "DefaultDateAndTimePreference", required = true) - protected DefaultDateAndTimePreference defaultDateAndTimePreference; - @XmlElement(name = "DefaultNumberOfrecordsPreference", required = true) - protected DefaultNumberOfrecordsPreference defaultNumberOfrecordsPreference; - @XmlElement(name = "DeleteConfirmPreference", required = true) - protected DeleteConfirmPreference deleteConfirmPreference; - @XmlElement(name = "AutomaticPointerPreference", required = true) - protected AutomaticPointerPreference automaticPointerPreference; - @XmlElement(name = "DefaultReportPreference", required = true) - protected DefaultReportPrefPreference defaultReportPreference; - - /** - * Gets the value of the defaultAccountPreference property. - * - * @return - * possible object is - * {@link DefaultAccountPreference } - * - */ - public DefaultAccountPreference getDefaultAccountPreference() { - return defaultAccountPreference; - } - - /** - * Sets the value of the defaultAccountPreference property. - * - * @param value - * allowed object is - * {@link DefaultAccountPreference } - * - */ - public void setDefaultAccountPreference(DefaultAccountPreference value) { - this.defaultAccountPreference = value; - } - - /** - * Gets the value of the defaultDateAndTimePreference property. - * - * @return - * possible object is - * {@link DefaultDateAndTimePreference } - * - */ - public DefaultDateAndTimePreference getDefaultDateAndTimePreference() { - return defaultDateAndTimePreference; - } - - /** - * Sets the value of the defaultDateAndTimePreference property. - * - * @param value - * allowed object is - * {@link DefaultDateAndTimePreference } - * - */ - public void setDefaultDateAndTimePreference(DefaultDateAndTimePreference value) { - this.defaultDateAndTimePreference = value; - } - - /** - * Gets the value of the defaultNumberOfrecordsPreference property. - * - * @return - * possible object is - * {@link DefaultNumberOfrecordsPreference } - * - */ - public DefaultNumberOfrecordsPreference getDefaultNumberOfrecordsPreference() { - return defaultNumberOfrecordsPreference; - } - - /** - * Sets the value of the defaultNumberOfrecordsPreference property. - * - * @param value - * allowed object is - * {@link DefaultNumberOfrecordsPreference } - * - */ - public void setDefaultNumberOfrecordsPreference(DefaultNumberOfrecordsPreference value) { - this.defaultNumberOfrecordsPreference = value; - } - - /** - * Gets the value of the deleteConfirmPreference property. - * - * @return - * possible object is - * {@link DeleteConfirmPreference } - * - */ - public DeleteConfirmPreference getDeleteConfirmPreference() { - return deleteConfirmPreference; - } - - /** - * Sets the value of the deleteConfirmPreference property. - * - * @param value - * allowed object is - * {@link DeleteConfirmPreference } - * - */ - public void setDeleteConfirmPreference(DeleteConfirmPreference value) { - this.deleteConfirmPreference = value; - } - - /** - * Gets the value of the automaticPointerPreference property. - * - * @return - * possible object is - * {@link AutomaticPointerPreference } - * - */ - public AutomaticPointerPreference getAutomaticPointerPreference() { - return automaticPointerPreference; - } - - /** - * Sets the value of the automaticPointerPreference property. - * - * @param value - * allowed object is - * {@link AutomaticPointerPreference } - * - */ - public void setAutomaticPointerPreference(AutomaticPointerPreference value) { - this.automaticPointerPreference = value; - } - - /** - * Gets the value of the defaultReportPreference property. - * - * @return - * possible object is - * {@link DefaultReportPrefPreference } - * - */ - public DefaultReportPrefPreference getDefaultReportPreference() { - return defaultReportPreference; - } - - /** - * Sets the value of the defaultReportPreference property. - * - * @param value - * allowed object is - * {@link DefaultReportPrefPreference } - * - */ - public void setDefaultReportPreference(DefaultReportPrefPreference value) { - this.defaultReportPreference = value; - } - -} diff --git a/Plugins/Mineplex.BungeeRotator/src/com/neustar/ultraservice/schema/v01/UserDetailsData.java b/Plugins/Mineplex.BungeeRotator/src/com/neustar/ultraservice/schema/v01/UserDetailsData.java deleted file mode 100644 index 2299826fd..000000000 --- a/Plugins/Mineplex.BungeeRotator/src/com/neustar/ultraservice/schema/v01/UserDetailsData.java +++ /dev/null @@ -1,141 +0,0 @@ - -package com.neustar.ultraservice.schema.v01; - -import javax.xml.bind.annotation.XmlAccessType; -import javax.xml.bind.annotation.XmlAccessorType; -import javax.xml.bind.annotation.XmlAttribute; -import javax.xml.bind.annotation.XmlType; - - -/** - *

Java class for UserDetailsData complex type. - * - *

The following schema fragment specifies the expected content contained within this class. - * - *

- * <complexType name="UserDetailsData">
- *   <complexContent>
- *     <restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
- *       <sequence>
- *       </sequence>
- *       <attribute name="userid" use="required" type="{http://www.w3.org/2001/XMLSchema}string" />
- *       <attribute name="userName" use="required" type="{http://www.w3.org/2001/XMLSchema}string" />
- *       <attribute name="firstName" use="required" type="{http://www.w3.org/2001/XMLSchema}string" />
- *       <attribute name="lastName" use="required" type="{http://www.w3.org/2001/XMLSchema}string" />
- *     </restriction>
- *   </complexContent>
- * </complexType>
- * 
- * - * - */ -@XmlAccessorType(XmlAccessType.FIELD) -@XmlType(name = "UserDetailsData") -public class UserDetailsData { - - @XmlAttribute(name = "userid", required = true) - protected String userid; - @XmlAttribute(name = "userName", required = true) - protected String userName; - @XmlAttribute(name = "firstName", required = true) - protected String firstName; - @XmlAttribute(name = "lastName", required = true) - protected String lastName; - - /** - * Gets the value of the userid property. - * - * @return - * possible object is - * {@link String } - * - */ - public String getUserid() { - return userid; - } - - /** - * Sets the value of the userid property. - * - * @param value - * allowed object is - * {@link String } - * - */ - public void setUserid(String value) { - this.userid = value; - } - - /** - * Gets the value of the userName property. - * - * @return - * possible object is - * {@link String } - * - */ - public String getUserName() { - return userName; - } - - /** - * Sets the value of the userName property. - * - * @param value - * allowed object is - * {@link String } - * - */ - public void setUserName(String value) { - this.userName = value; - } - - /** - * Gets the value of the firstName property. - * - * @return - * possible object is - * {@link String } - * - */ - public String getFirstName() { - return firstName; - } - - /** - * Sets the value of the firstName property. - * - * @param value - * allowed object is - * {@link String } - * - */ - public void setFirstName(String value) { - this.firstName = value; - } - - /** - * Gets the value of the lastName property. - * - * @return - * possible object is - * {@link String } - * - */ - public String getLastName() { - return lastName; - } - - /** - * Sets the value of the lastName property. - * - * @param value - * allowed object is - * {@link String } - * - */ - public void setLastName(String value) { - this.lastName = value; - } - -} diff --git a/Plugins/Mineplex.BungeeRotator/src/com/neustar/ultraservice/schema/v01/UserDetailsPermissionData.java b/Plugins/Mineplex.BungeeRotator/src/com/neustar/ultraservice/schema/v01/UserDetailsPermissionData.java deleted file mode 100644 index ebd16472c..000000000 --- a/Plugins/Mineplex.BungeeRotator/src/com/neustar/ultraservice/schema/v01/UserDetailsPermissionData.java +++ /dev/null @@ -1,276 +0,0 @@ - -package com.neustar.ultraservice.schema.v01; - -import javax.xml.bind.annotation.XmlAccessType; -import javax.xml.bind.annotation.XmlAccessorType; -import javax.xml.bind.annotation.XmlAttribute; -import javax.xml.bind.annotation.XmlType; - - -/** - *

Java class for UserDetailsPermissionData complex type. - * - *

The following schema fragment specifies the expected content contained within this class. - * - *

- * <complexType name="UserDetailsPermissionData">
- *   <complexContent>
- *     <restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
- *       <sequence>
- *       </sequence>
- *       <attribute name="Login" type="{http://www.w3.org/2001/XMLSchema}string" />
- *       <attribute name="Read" type="{http://www.w3.org/2001/XMLSchema}string" />
- *       <attribute name="Write" type="{http://www.w3.org/2001/XMLSchema}string" />
- *       <attribute name="Create" type="{http://www.w3.org/2001/XMLSchema}string" />
- *       <attribute name="Delete" type="{http://www.w3.org/2001/XMLSchema}string" />
- *       <attribute name="Grant" type="{http://www.w3.org/2001/XMLSchema}string" />
- *       <attribute name="Name" type="{http://www.w3.org/2001/XMLSchema}string" />
- *       <attribute name="MemberType" type="{http://www.w3.org/2001/XMLSchema}string" />
- *       <attribute name="AssetType" type="{http://www.w3.org/2001/XMLSchema}string" />
- *     </restriction>
- *   </complexContent>
- * </complexType>
- * 
- * - * - */ -@XmlAccessorType(XmlAccessType.FIELD) -@XmlType(name = "UserDetailsPermissionData") -public class UserDetailsPermissionData { - - @XmlAttribute(name = "Login") - protected String login; - @XmlAttribute(name = "Read") - protected String read; - @XmlAttribute(name = "Write") - protected String write; - @XmlAttribute(name = "Create") - protected String create; - @XmlAttribute(name = "Delete") - protected String delete; - @XmlAttribute(name = "Grant") - protected String grant; - @XmlAttribute(name = "Name") - protected String name; - @XmlAttribute(name = "MemberType") - protected String memberType; - @XmlAttribute(name = "AssetType") - protected String assetType; - - /** - * Gets the value of the login property. - * - * @return - * possible object is - * {@link String } - * - */ - public String getLogin() { - return login; - } - - /** - * Sets the value of the login property. - * - * @param value - * allowed object is - * {@link String } - * - */ - public void setLogin(String value) { - this.login = value; - } - - /** - * Gets the value of the read property. - * - * @return - * possible object is - * {@link String } - * - */ - public String getRead() { - return read; - } - - /** - * Sets the value of the read property. - * - * @param value - * allowed object is - * {@link String } - * - */ - public void setRead(String value) { - this.read = value; - } - - /** - * Gets the value of the write property. - * - * @return - * possible object is - * {@link String } - * - */ - public String getWrite() { - return write; - } - - /** - * Sets the value of the write property. - * - * @param value - * allowed object is - * {@link String } - * - */ - public void setWrite(String value) { - this.write = value; - } - - /** - * Gets the value of the create property. - * - * @return - * possible object is - * {@link String } - * - */ - public String getCreate() { - return create; - } - - /** - * Sets the value of the create property. - * - * @param value - * allowed object is - * {@link String } - * - */ - public void setCreate(String value) { - this.create = value; - } - - /** - * Gets the value of the delete property. - * - * @return - * possible object is - * {@link String } - * - */ - public String getDelete() { - return delete; - } - - /** - * Sets the value of the delete property. - * - * @param value - * allowed object is - * {@link String } - * - */ - public void setDelete(String value) { - this.delete = value; - } - - /** - * Gets the value of the grant property. - * - * @return - * possible object is - * {@link String } - * - */ - public String getGrant() { - return grant; - } - - /** - * Sets the value of the grant property. - * - * @param value - * allowed object is - * {@link String } - * - */ - public void setGrant(String value) { - this.grant = value; - } - - /** - * Gets the value of the name property. - * - * @return - * possible object is - * {@link String } - * - */ - public String getName() { - return name; - } - - /** - * Sets the value of the name property. - * - * @param value - * allowed object is - * {@link String } - * - */ - public void setName(String value) { - this.name = value; - } - - /** - * Gets the value of the memberType property. - * - * @return - * possible object is - * {@link String } - * - */ - public String getMemberType() { - return memberType; - } - - /** - * Sets the value of the memberType property. - * - * @param value - * allowed object is - * {@link String } - * - */ - public void setMemberType(String value) { - this.memberType = value; - } - - /** - * Gets the value of the assetType property. - * - * @return - * possible object is - * {@link String } - * - */ - public String getAssetType() { - return assetType; - } - - /** - * Sets the value of the assetType property. - * - * @param value - * allowed object is - * {@link String } - * - */ - public void setAssetType(String value) { - this.assetType = value; - } - -} diff --git a/Plugins/Mineplex.BungeeRotator/src/com/neustar/ultraservice/schema/v01/UserSummary.java b/Plugins/Mineplex.BungeeRotator/src/com/neustar/ultraservice/schema/v01/UserSummary.java deleted file mode 100644 index a4150fdf0..000000000 --- a/Plugins/Mineplex.BungeeRotator/src/com/neustar/ultraservice/schema/v01/UserSummary.java +++ /dev/null @@ -1,87 +0,0 @@ - -package com.neustar.ultraservice.schema.v01; - -import javax.xml.bind.annotation.XmlAccessType; -import javax.xml.bind.annotation.XmlAccessorType; -import javax.xml.bind.annotation.XmlAttribute; -import javax.xml.bind.annotation.XmlType; - - -/** - *

Java class for UserSummary complex type. - * - *

The following schema fragment specifies the expected content contained within this class. - * - *

- * <complexType name="UserSummary">
- *   <complexContent>
- *     <restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
- *       <sequence>
- *       </sequence>
- *       <attribute name="servicePackageName" type="{http://www.w3.org/2001/XMLSchema}string" />
- *       <attribute name="numberOfRecords" type="{http://www.w3.org/2001/XMLSchema}string" />
- *     </restriction>
- *   </complexContent>
- * </complexType>
- * 
- * - * - */ -@XmlAccessorType(XmlAccessType.FIELD) -@XmlType(name = "UserSummary") -public class UserSummary { - - @XmlAttribute(name = "servicePackageName") - protected String servicePackageName; - @XmlAttribute(name = "numberOfRecords") - protected String numberOfRecords; - - /** - * Gets the value of the servicePackageName property. - * - * @return - * possible object is - * {@link String } - * - */ - public String getServicePackageName() { - return servicePackageName; - } - - /** - * Sets the value of the servicePackageName property. - * - * @param value - * allowed object is - * {@link String } - * - */ - public void setServicePackageName(String value) { - this.servicePackageName = value; - } - - /** - * Gets the value of the numberOfRecords property. - * - * @return - * possible object is - * {@link String } - * - */ - public String getNumberOfRecords() { - return numberOfRecords; - } - - /** - * Sets the value of the numberOfRecords property. - * - * @param value - * allowed object is - * {@link String } - * - */ - public void setNumberOfRecords(String value) { - this.numberOfRecords = value; - } - -} diff --git a/Plugins/Mineplex.BungeeRotator/src/com/neustar/ultraservice/schema/v01/UserSummaryList.java b/Plugins/Mineplex.BungeeRotator/src/com/neustar/ultraservice/schema/v01/UserSummaryList.java deleted file mode 100644 index 97d4539ab..000000000 --- a/Plugins/Mineplex.BungeeRotator/src/com/neustar/ultraservice/schema/v01/UserSummaryList.java +++ /dev/null @@ -1,69 +0,0 @@ - -package com.neustar.ultraservice.schema.v01; - -import java.util.ArrayList; -import java.util.List; -import javax.xml.bind.annotation.XmlAccessType; -import javax.xml.bind.annotation.XmlAccessorType; -import javax.xml.bind.annotation.XmlElement; -import javax.xml.bind.annotation.XmlType; - - -/** - *

Java class for UserSummaryList complex type. - * - *

The following schema fragment specifies the expected content contained within this class. - * - *

- * <complexType name="UserSummaryList">
- *   <complexContent>
- *     <restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
- *       <sequence>
- *         <element name="UserSummary" type="{http://schema.ultraservice.neustar.com/v01/}UserSummary" maxOccurs="unbounded"/>
- *       </sequence>
- *     </restriction>
- *   </complexContent>
- * </complexType>
- * 
- * - * - */ -@XmlAccessorType(XmlAccessType.FIELD) -@XmlType(name = "UserSummaryList", propOrder = { - "userSummary" -}) -public class UserSummaryList { - - @XmlElement(name = "UserSummary", required = true) - protected List userSummary; - - /** - * Gets the value of the userSummary property. - * - *

- * This accessor method returns a reference to the live list, - * not a snapshot. Therefore any modification you make to the - * returned list will be present inside the JAXB object. - * This is why there is not a set method for the userSummary property. - * - *

- * For example, to add a new item, do as follows: - *

-     *    getUserSummary().add(newItem);
-     * 
- * - * - *

- * Objects of the following type(s) are allowed in the list - * {@link UserSummary } - * - * - */ - public List getUserSummary() { - if (userSummary == null) { - userSummary = new ArrayList(); - } - return this.userSummary; - } - -} diff --git a/Plugins/Mineplex.BungeeRotator/src/com/neustar/ultraservice/schema/v01/UsersList.java b/Plugins/Mineplex.BungeeRotator/src/com/neustar/ultraservice/schema/v01/UsersList.java deleted file mode 100644 index eed082c3c..000000000 --- a/Plugins/Mineplex.BungeeRotator/src/com/neustar/ultraservice/schema/v01/UsersList.java +++ /dev/null @@ -1,69 +0,0 @@ - -package com.neustar.ultraservice.schema.v01; - -import java.util.ArrayList; -import java.util.List; -import javax.xml.bind.annotation.XmlAccessType; -import javax.xml.bind.annotation.XmlAccessorType; -import javax.xml.bind.annotation.XmlElement; -import javax.xml.bind.annotation.XmlType; - - -/** - *

Java class for UsersList complex type. - * - *

The following schema fragment specifies the expected content contained within this class. - * - *

- * <complexType name="UsersList">
- *   <complexContent>
- *     <restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
- *       <sequence>
- *         <element name="UserDetailsData" type="{http://schema.ultraservice.neustar.com/v01/}UserDetailsData" maxOccurs="unbounded"/>
- *       </sequence>
- *     </restriction>
- *   </complexContent>
- * </complexType>
- * 
- * - * - */ -@XmlAccessorType(XmlAccessType.FIELD) -@XmlType(name = "UsersList", propOrder = { - "userDetailsData" -}) -public class UsersList { - - @XmlElement(name = "UserDetailsData", required = true) - protected List userDetailsData; - - /** - * Gets the value of the userDetailsData property. - * - *

- * This accessor method returns a reference to the live list, - * not a snapshot. Therefore any modification you make to the - * returned list will be present inside the JAXB object. - * This is why there is not a set method for the userDetailsData property. - * - *

- * For example, to add a new item, do as follows: - *

-     *    getUserDetailsData().add(newItem);
-     * 
- * - * - *

- * Objects of the following type(s) are allowed in the list - * {@link UserDetailsData } - * - * - */ - public List getUserDetailsData() { - if (userDetailsData == null) { - userDetailsData = new ArrayList(); - } - return this.userDetailsData; - } - -} diff --git a/Plugins/Mineplex.BungeeRotator/src/com/neustar/ultraservice/schema/v01/WebForwardPoolRecordData.java b/Plugins/Mineplex.BungeeRotator/src/com/neustar/ultraservice/schema/v01/WebForwardPoolRecordData.java deleted file mode 100644 index 5610047fc..000000000 --- a/Plugins/Mineplex.BungeeRotator/src/com/neustar/ultraservice/schema/v01/WebForwardPoolRecordData.java +++ /dev/null @@ -1,174 +0,0 @@ - -package com.neustar.ultraservice.schema.v01; - -import java.util.ArrayList; -import java.util.List; -import javax.xml.bind.annotation.XmlAccessType; -import javax.xml.bind.annotation.XmlAccessorType; -import javax.xml.bind.annotation.XmlAttribute; -import javax.xml.bind.annotation.XmlElement; -import javax.xml.bind.annotation.XmlSeeAlso; -import javax.xml.bind.annotation.XmlType; - - -/** - *

Java class for WebForwardPoolRecordData complex type. - * - *

The following schema fragment specifies the expected content contained within this class. - * - *

- * <complexType name="WebForwardPoolRecordData">
- *   <complexContent>
- *     <restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
- *       <sequence>
- *         <element name="HeaderRule" type="{http://schema.ultraservice.neustar.com/v01/}HeaderRule" maxOccurs="unbounded" minOccurs="0"/>
- *       </sequence>
- *       <attribute name="redirectsTo" use="required" type="{http://www.w3.org/2001/XMLSchema}string" />
- *       <attribute name="parentGuid" use="required" type="{http://www.w3.org/2001/XMLSchema}string" />
- *       <attribute name="redirectType" use="required" type="{http://schema.ultraservice.neustar.com/v01/}RedirectType" />
- *       <attribute name="priority" use="required" type="{http://www.w3.org/2001/XMLSchema}long" />
- *     </restriction>
- *   </complexContent>
- * </complexType>
- * 
- * - * - */ -@XmlAccessorType(XmlAccessType.FIELD) -@XmlType(name = "WebForwardPoolRecordData", propOrder = { - "headerRule" -}) -@XmlSeeAlso({ - WebForwardPoolRecordDataGuid.class -}) -public class WebForwardPoolRecordData { - - @XmlElement(name = "HeaderRule") - protected List headerRule; - @XmlAttribute(name = "redirectsTo", required = true) - protected String redirectsTo; - @XmlAttribute(name = "parentGuid", required = true) - protected String parentGuid; - @XmlAttribute(name = "redirectType", required = true) - protected RedirectType redirectType; - @XmlAttribute(name = "priority", required = true) - protected long priority; - - /** - * Gets the value of the headerRule property. - * - *

- * This accessor method returns a reference to the live list, - * not a snapshot. Therefore any modification you make to the - * returned list will be present inside the JAXB object. - * This is why there is not a set method for the headerRule property. - * - *

- * For example, to add a new item, do as follows: - *

-     *    getHeaderRule().add(newItem);
-     * 
- * - * - *

- * Objects of the following type(s) are allowed in the list - * {@link HeaderRule } - * - * - */ - public List getHeaderRule() { - if (headerRule == null) { - headerRule = new ArrayList(); - } - return this.headerRule; - } - - /** - * Gets the value of the redirectsTo property. - * - * @return - * possible object is - * {@link String } - * - */ - public String getRedirectsTo() { - return redirectsTo; - } - - /** - * Sets the value of the redirectsTo property. - * - * @param value - * allowed object is - * {@link String } - * - */ - public void setRedirectsTo(String value) { - this.redirectsTo = value; - } - - /** - * Gets the value of the parentGuid property. - * - * @return - * possible object is - * {@link String } - * - */ - public String getParentGuid() { - return parentGuid; - } - - /** - * Sets the value of the parentGuid property. - * - * @param value - * allowed object is - * {@link String } - * - */ - public void setParentGuid(String value) { - this.parentGuid = value; - } - - /** - * Gets the value of the redirectType property. - * - * @return - * possible object is - * {@link RedirectType } - * - */ - public RedirectType getRedirectType() { - return redirectType; - } - - /** - * Sets the value of the redirectType property. - * - * @param value - * allowed object is - * {@link RedirectType } - * - */ - public void setRedirectType(RedirectType value) { - this.redirectType = value; - } - - /** - * Gets the value of the priority property. - * - */ - public long getPriority() { - return priority; - } - - /** - * Sets the value of the priority property. - * - */ - public void setPriority(long value) { - this.priority = value; - } - -} diff --git a/Plugins/Mineplex.BungeeRotator/src/com/neustar/ultraservice/schema/v01/WebForwardPoolRecordDataGuid.java b/Plugins/Mineplex.BungeeRotator/src/com/neustar/ultraservice/schema/v01/WebForwardPoolRecordDataGuid.java deleted file mode 100644 index 47dcede73..000000000 --- a/Plugins/Mineplex.BungeeRotator/src/com/neustar/ultraservice/schema/v01/WebForwardPoolRecordDataGuid.java +++ /dev/null @@ -1,62 +0,0 @@ - -package com.neustar.ultraservice.schema.v01; - -import javax.xml.bind.annotation.XmlAccessType; -import javax.xml.bind.annotation.XmlAccessorType; -import javax.xml.bind.annotation.XmlAttribute; -import javax.xml.bind.annotation.XmlType; - - -/** - *

Java class for WebForwardPoolRecordDataGuid complex type. - * - *

The following schema fragment specifies the expected content contained within this class. - * - *

- * <complexType name="WebForwardPoolRecordDataGuid">
- *   <complexContent>
- *     <extension base="{http://schema.ultraservice.neustar.com/v01/}WebForwardPoolRecordData">
- *       <sequence>
- *       </sequence>
- *       <attribute name="guid" type="{http://www.w3.org/2001/XMLSchema}string" />
- *     </extension>
- *   </complexContent>
- * </complexType>
- * 
- * - * - */ -@XmlAccessorType(XmlAccessType.FIELD) -@XmlType(name = "WebForwardPoolRecordDataGuid") -public class WebForwardPoolRecordDataGuid - extends WebForwardPoolRecordData -{ - - @XmlAttribute(name = "guid") - protected String guid; - - /** - * Gets the value of the guid property. - * - * @return - * possible object is - * {@link String } - * - */ - public String getGuid() { - return guid; - } - - /** - * Sets the value of the guid property. - * - * @param value - * allowed object is - * {@link String } - * - */ - public void setGuid(String value) { - this.guid = value; - } - -} diff --git a/Plugins/Mineplex.BungeeRotator/src/com/neustar/ultraservice/schema/v01/WebForwardPoolRecordDataList.java b/Plugins/Mineplex.BungeeRotator/src/com/neustar/ultraservice/schema/v01/WebForwardPoolRecordDataList.java deleted file mode 100644 index 7fcf70eef..000000000 --- a/Plugins/Mineplex.BungeeRotator/src/com/neustar/ultraservice/schema/v01/WebForwardPoolRecordDataList.java +++ /dev/null @@ -1,69 +0,0 @@ - -package com.neustar.ultraservice.schema.v01; - -import java.util.ArrayList; -import java.util.List; -import javax.xml.bind.annotation.XmlAccessType; -import javax.xml.bind.annotation.XmlAccessorType; -import javax.xml.bind.annotation.XmlElement; -import javax.xml.bind.annotation.XmlType; - - -/** - *

Java class for WebForwardPoolRecordDataList complex type. - * - *

The following schema fragment specifies the expected content contained within this class. - * - *

- * <complexType name="WebForwardPoolRecordDataList">
- *   <complexContent>
- *     <restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
- *       <sequence>
- *         <element name="WebForwardPoolRecordData" type="{http://schema.ultraservice.neustar.com/v01/}WebForwardPoolRecordDataGuid" maxOccurs="unbounded" minOccurs="0"/>
- *       </sequence>
- *     </restriction>
- *   </complexContent>
- * </complexType>
- * 
- * - * - */ -@XmlAccessorType(XmlAccessType.FIELD) -@XmlType(name = "WebForwardPoolRecordDataList", propOrder = { - "webForwardPoolRecordData" -}) -public class WebForwardPoolRecordDataList { - - @XmlElement(name = "WebForwardPoolRecordData") - protected List webForwardPoolRecordData; - - /** - * Gets the value of the webForwardPoolRecordData property. - * - *

- * This accessor method returns a reference to the live list, - * not a snapshot. Therefore any modification you make to the - * returned list will be present inside the JAXB object. - * This is why there is not a set method for the webForwardPoolRecordData property. - * - *

- * For example, to add a new item, do as follows: - *

-     *    getWebForwardPoolRecordData().add(newItem);
-     * 
- * - * - *

- * Objects of the following type(s) are allowed in the list - * {@link WebForwardPoolRecordDataGuid } - * - * - */ - public List getWebForwardPoolRecordData() { - if (webForwardPoolRecordData == null) { - webForwardPoolRecordData = new ArrayList(); - } - return this.webForwardPoolRecordData; - } - -} diff --git a/Plugins/Mineplex.BungeeRotator/src/com/neustar/ultraservice/schema/v01/WebForwardRecord.java b/Plugins/Mineplex.BungeeRotator/src/com/neustar/ultraservice/schema/v01/WebForwardRecord.java deleted file mode 100644 index c7f177b85..000000000 --- a/Plugins/Mineplex.BungeeRotator/src/com/neustar/ultraservice/schema/v01/WebForwardRecord.java +++ /dev/null @@ -1,187 +0,0 @@ - -package com.neustar.ultraservice.schema.v01; - -import javax.xml.bind.annotation.XmlAccessType; -import javax.xml.bind.annotation.XmlAccessorType; -import javax.xml.bind.annotation.XmlAttribute; -import javax.xml.bind.annotation.XmlType; - - -/** - *

Java class for Web_Forward_Record complex type. - * - *

The following schema fragment specifies the expected content contained within this class. - * - *

- * <complexType name="Web_Forward_Record">
- *   <complexContent>
- *     <restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
- *       <sequence>
- *       </sequence>
- *       <attribute name="ZoneName" use="required" type="{http://www.w3.org/2001/XMLSchema}string" />
- *       <attribute name="ForwardType" use="required" type="{http://www.w3.org/2001/XMLSchema}string" />
- *       <attribute name="RedirectTo" use="required" type="{http://www.w3.org/2001/XMLSchema}string" />
- *       <attribute name="RequestTo" use="required" type="{http://www.w3.org/2001/XMLSchema}string" />
- *       <attribute name="Advanced" use="required" type="{http://www.w3.org/2001/XMLSchema}boolean" />
- *       <attribute name="Guid" use="required" type="{http://www.w3.org/2001/XMLSchema}string" />
- *     </restriction>
- *   </complexContent>
- * </complexType>
- * 
- * - * - */ -@XmlAccessorType(XmlAccessType.FIELD) -@XmlType(name = "Web_Forward_Record") -public class WebForwardRecord { - - @XmlAttribute(name = "ZoneName", required = true) - protected String zoneName; - @XmlAttribute(name = "ForwardType", required = true) - protected String forwardType; - @XmlAttribute(name = "RedirectTo", required = true) - protected String redirectTo; - @XmlAttribute(name = "RequestTo", required = true) - protected String requestTo; - @XmlAttribute(name = "Advanced", required = true) - protected boolean advanced; - @XmlAttribute(name = "Guid", required = true) - protected String guid; - - /** - * Gets the value of the zoneName property. - * - * @return - * possible object is - * {@link String } - * - */ - public String getZoneName() { - return zoneName; - } - - /** - * Sets the value of the zoneName property. - * - * @param value - * allowed object is - * {@link String } - * - */ - public void setZoneName(String value) { - this.zoneName = value; - } - - /** - * Gets the value of the forwardType property. - * - * @return - * possible object is - * {@link String } - * - */ - public String getForwardType() { - return forwardType; - } - - /** - * Sets the value of the forwardType property. - * - * @param value - * allowed object is - * {@link String } - * - */ - public void setForwardType(String value) { - this.forwardType = value; - } - - /** - * Gets the value of the redirectTo property. - * - * @return - * possible object is - * {@link String } - * - */ - public String getRedirectTo() { - return redirectTo; - } - - /** - * Sets the value of the redirectTo property. - * - * @param value - * allowed object is - * {@link String } - * - */ - public void setRedirectTo(String value) { - this.redirectTo = value; - } - - /** - * Gets the value of the requestTo property. - * - * @return - * possible object is - * {@link String } - * - */ - public String getRequestTo() { - return requestTo; - } - - /** - * Sets the value of the requestTo property. - * - * @param value - * allowed object is - * {@link String } - * - */ - public void setRequestTo(String value) { - this.requestTo = value; - } - - /** - * Gets the value of the advanced property. - * - */ - public boolean isAdvanced() { - return advanced; - } - - /** - * Sets the value of the advanced property. - * - */ - public void setAdvanced(boolean value) { - this.advanced = value; - } - - /** - * Gets the value of the guid property. - * - * @return - * possible object is - * {@link String } - * - */ - public String getGuid() { - return guid; - } - - /** - * Sets the value of the guid property. - * - * @param value - * allowed object is - * {@link String } - * - */ - public void setGuid(String value) { - this.guid = value; - } - -} diff --git a/Plugins/Mineplex.BungeeRotator/src/com/neustar/ultraservice/schema/v01/WebFwdRecordsList.java b/Plugins/Mineplex.BungeeRotator/src/com/neustar/ultraservice/schema/v01/WebFwdRecordsList.java deleted file mode 100644 index afae32f7a..000000000 --- a/Plugins/Mineplex.BungeeRotator/src/com/neustar/ultraservice/schema/v01/WebFwdRecordsList.java +++ /dev/null @@ -1,69 +0,0 @@ - -package com.neustar.ultraservice.schema.v01; - -import java.util.ArrayList; -import java.util.List; -import javax.xml.bind.annotation.XmlAccessType; -import javax.xml.bind.annotation.XmlAccessorType; -import javax.xml.bind.annotation.XmlElement; -import javax.xml.bind.annotation.XmlType; - - -/** - *

Java class for WebFwdRecordsList complex type. - * - *

The following schema fragment specifies the expected content contained within this class. - * - *

- * <complexType name="WebFwdRecordsList">
- *   <complexContent>
- *     <restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
- *       <sequence>
- *         <element name="Web_Forward_Record" type="{http://schema.ultraservice.neustar.com/v01/}Web_Forward_Record" maxOccurs="unbounded"/>
- *       </sequence>
- *     </restriction>
- *   </complexContent>
- * </complexType>
- * 
- * - * - */ -@XmlAccessorType(XmlAccessType.FIELD) -@XmlType(name = "WebFwdRecordsList", propOrder = { - "webForwardRecord" -}) -public class WebFwdRecordsList { - - @XmlElement(name = "Web_Forward_Record", required = true) - protected List webForwardRecord; - - /** - * Gets the value of the webForwardRecord property. - * - *

- * This accessor method returns a reference to the live list, - * not a snapshot. Therefore any modification you make to the - * returned list will be present inside the JAXB object. - * This is why there is not a set method for the webForwardRecord property. - * - *

- * For example, to add a new item, do as follows: - *

-     *    getWebForwardRecord().add(newItem);
-     * 
- * - * - *

- * Objects of the following type(s) are allowed in the list - * {@link WebForwardRecord } - * - * - */ - public List getWebForwardRecord() { - if (webForwardRecord == null) { - webForwardRecord = new ArrayList(); - } - return this.webForwardRecord; - } - -} diff --git a/Plugins/Mineplex.BungeeRotator/src/com/neustar/ultraservice/schema/v01/ZoneInfoData.java b/Plugins/Mineplex.BungeeRotator/src/com/neustar/ultraservice/schema/v01/ZoneInfoData.java deleted file mode 100644 index df8441b76..000000000 --- a/Plugins/Mineplex.BungeeRotator/src/com/neustar/ultraservice/schema/v01/ZoneInfoData.java +++ /dev/null @@ -1,168 +0,0 @@ - -package com.neustar.ultraservice.schema.v01; - -import javax.xml.bind.annotation.XmlAccessType; -import javax.xml.bind.annotation.XmlAccessorType; -import javax.xml.bind.annotation.XmlAttribute; -import javax.xml.bind.annotation.XmlType; - - -/** - *

Java class for ZoneInfoData complex type. - * - *

The following schema fragment specifies the expected content contained within this class. - * - *

- * <complexType name="ZoneInfoData">
- *   <complexContent>
- *     <restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
- *       <sequence>
- *       </sequence>
- *       <attribute name="guid" use="required" type="{http://www.w3.org/2001/XMLSchema}string" />
- *       <attribute name="zoneid" use="required" type="{http://www.w3.org/2001/XMLSchema}string" />
- *       <attribute name="infoname" type="{http://www.w3.org/2001/XMLSchema}string" />
- *       <attribute name="infovalue" type="{http://www.w3.org/2001/XMLSchema}string" />
- *       <attribute name="modified" type="{http://www.w3.org/2001/XMLSchema}string" />
- *     </restriction>
- *   </complexContent>
- * </complexType>
- * 
- * - * - */ -@XmlAccessorType(XmlAccessType.FIELD) -@XmlType(name = "ZoneInfoData") -public class ZoneInfoData { - - @XmlAttribute(name = "guid", required = true) - protected String guid; - @XmlAttribute(name = "zoneid", required = true) - protected String zoneid; - @XmlAttribute(name = "infoname") - protected String infoname; - @XmlAttribute(name = "infovalue") - protected String infovalue; - @XmlAttribute(name = "modified") - protected String modified; - - /** - * Gets the value of the guid property. - * - * @return - * possible object is - * {@link String } - * - */ - public String getGuid() { - return guid; - } - - /** - * Sets the value of the guid property. - * - * @param value - * allowed object is - * {@link String } - * - */ - public void setGuid(String value) { - this.guid = value; - } - - /** - * Gets the value of the zoneid property. - * - * @return - * possible object is - * {@link String } - * - */ - public String getZoneid() { - return zoneid; - } - - /** - * Sets the value of the zoneid property. - * - * @param value - * allowed object is - * {@link String } - * - */ - public void setZoneid(String value) { - this.zoneid = value; - } - - /** - * Gets the value of the infoname property. - * - * @return - * possible object is - * {@link String } - * - */ - public String getInfoname() { - return infoname; - } - - /** - * Sets the value of the infoname property. - * - * @param value - * allowed object is - * {@link String } - * - */ - public void setInfoname(String value) { - this.infoname = value; - } - - /** - * Gets the value of the infovalue property. - * - * @return - * possible object is - * {@link String } - * - */ - public String getInfovalue() { - return infovalue; - } - - /** - * Sets the value of the infovalue property. - * - * @param value - * allowed object is - * {@link String } - * - */ - public void setInfovalue(String value) { - this.infovalue = value; - } - - /** - * Gets the value of the modified property. - * - * @return - * possible object is - * {@link String } - * - */ - public String getModified() { - return modified; - } - - /** - * Sets the value of the modified property. - * - * @param value - * allowed object is - * {@link String } - * - */ - public void setModified(String value) { - this.modified = value; - } - -} diff --git a/Plugins/Mineplex.BungeeRotator/src/com/neustar/ultraservice/schema/v01/ZoneInfoList.java b/Plugins/Mineplex.BungeeRotator/src/com/neustar/ultraservice/schema/v01/ZoneInfoList.java deleted file mode 100644 index 70a11325d..000000000 --- a/Plugins/Mineplex.BungeeRotator/src/com/neustar/ultraservice/schema/v01/ZoneInfoList.java +++ /dev/null @@ -1,69 +0,0 @@ - -package com.neustar.ultraservice.schema.v01; - -import java.util.ArrayList; -import java.util.List; -import javax.xml.bind.annotation.XmlAccessType; -import javax.xml.bind.annotation.XmlAccessorType; -import javax.xml.bind.annotation.XmlElement; -import javax.xml.bind.annotation.XmlType; - - -/** - *

Java class for ZoneInfoList complex type. - * - *

The following schema fragment specifies the expected content contained within this class. - * - *

- * <complexType name="ZoneInfoList">
- *   <complexContent>
- *     <restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
- *       <sequence>
- *         <element name="ZoneInfoData" type="{http://schema.ultraservice.neustar.com/v01/}ZoneInfoData" maxOccurs="unbounded"/>
- *       </sequence>
- *     </restriction>
- *   </complexContent>
- * </complexType>
- * 
- * - * - */ -@XmlAccessorType(XmlAccessType.FIELD) -@XmlType(name = "ZoneInfoList", propOrder = { - "zoneInfoData" -}) -public class ZoneInfoList { - - @XmlElement(name = "ZoneInfoData", required = true) - protected List zoneInfoData; - - /** - * Gets the value of the zoneInfoData property. - * - *

- * This accessor method returns a reference to the live list, - * not a snapshot. Therefore any modification you make to the - * returned list will be present inside the JAXB object. - * This is why there is not a set method for the zoneInfoData property. - * - *

- * For example, to add a new item, do as follows: - *

-     *    getZoneInfoData().add(newItem);
-     * 
- * - * - *

- * Objects of the following type(s) are allowed in the list - * {@link ZoneInfoData } - * - * - */ - public List getZoneInfoData() { - if (zoneInfoData == null) { - zoneInfoData = new ArrayList(); - } - return this.zoneInfoData; - } - -} diff --git a/Plugins/Mineplex.BungeeRotator/src/com/neustar/ultraservice/schema/v01/ZoneList.java b/Plugins/Mineplex.BungeeRotator/src/com/neustar/ultraservice/schema/v01/ZoneList.java deleted file mode 100644 index 17deaec75..000000000 --- a/Plugins/Mineplex.BungeeRotator/src/com/neustar/ultraservice/schema/v01/ZoneList.java +++ /dev/null @@ -1,126 +0,0 @@ - -package com.neustar.ultraservice.schema.v01; - -import java.util.ArrayList; -import java.util.List; -import javax.xml.bind.annotation.XmlAccessType; -import javax.xml.bind.annotation.XmlAccessorType; -import javax.xml.bind.annotation.XmlElement; -import javax.xml.bind.annotation.XmlType; - - -/** - *

Java class for ZoneList complex type. - * - *

The following schema fragment specifies the expected content contained within this class. - * - *

- * <complexType name="ZoneList">
- *   <complexContent>
- *     <restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
- *       <sequence>
- *         <element name="UltraZone" type="{http://schema.ultraservice.neustar.com/v01/}UltraZone" maxOccurs="unbounded"/>
- *         <element name="total" type="{http://www.w3.org/2001/XMLSchema}int"/>
- *         <element name="offset" type="{http://www.w3.org/2001/XMLSchema}int"/>
- *         <element name="count" type="{http://www.w3.org/2001/XMLSchema}int"/>
- *       </sequence>
- *     </restriction>
- *   </complexContent>
- * </complexType>
- * 
- * - * - */ -@XmlAccessorType(XmlAccessType.FIELD) -@XmlType(name = "ZoneList", propOrder = { - "ultraZone", - "total", - "offset", - "count" -}) -public class ZoneList { - - @XmlElement(name = "UltraZone", required = true) - protected List ultraZone; - protected int total; - protected int offset; - protected int count; - - /** - * Gets the value of the ultraZone property. - * - *

- * This accessor method returns a reference to the live list, - * not a snapshot. Therefore any modification you make to the - * returned list will be present inside the JAXB object. - * This is why there is not a set method for the ultraZone property. - * - *

- * For example, to add a new item, do as follows: - *

-     *    getUltraZone().add(newItem);
-     * 
- * - * - *

- * Objects of the following type(s) are allowed in the list - * {@link UltraZone } - * - * - */ - public List getUltraZone() { - if (ultraZone == null) { - ultraZone = new ArrayList(); - } - return this.ultraZone; - } - - /** - * Gets the value of the total property. - * - */ - public int getTotal() { - return total; - } - - /** - * Sets the value of the total property. - * - */ - public void setTotal(int value) { - this.total = value; - } - - /** - * Gets the value of the offset property. - * - */ - public int getOffset() { - return offset; - } - - /** - * Sets the value of the offset property. - * - */ - public void setOffset(int value) { - this.offset = value; - } - - /** - * Gets the value of the count property. - * - */ - public int getCount() { - return count; - } - - /** - * Sets the value of the count property. - * - */ - public void setCount(int value) { - this.count = value; - } - -} diff --git a/Plugins/Mineplex.BungeeRotator/src/com/neustar/ultraservice/schema/v01/ZoneTransferStatus.java b/Plugins/Mineplex.BungeeRotator/src/com/neustar/ultraservice/schema/v01/ZoneTransferStatus.java deleted file mode 100644 index d2cbde192..000000000 --- a/Plugins/Mineplex.BungeeRotator/src/com/neustar/ultraservice/schema/v01/ZoneTransferStatus.java +++ /dev/null @@ -1,87 +0,0 @@ - -package com.neustar.ultraservice.schema.v01; - -import javax.xml.bind.annotation.XmlAccessType; -import javax.xml.bind.annotation.XmlAccessorType; -import javax.xml.bind.annotation.XmlAttribute; -import javax.xml.bind.annotation.XmlType; - - -/** - *

Java class for ZoneTransferStatus complex type. - * - *

The following schema fragment specifies the expected content contained within this class. - * - *

- * <complexType name="ZoneTransferStatus">
- *   <complexContent>
- *     <restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
- *       <sequence>
- *       </sequence>
- *       <attribute name="status" type="{http://www.w3.org/2001/XMLSchema}string" />
- *       <attribute name="taskId" type="{http://www.w3.org/2001/XMLSchema}string" />
- *     </restriction>
- *   </complexContent>
- * </complexType>
- * 
- * - * - */ -@XmlAccessorType(XmlAccessType.FIELD) -@XmlType(name = "ZoneTransferStatus") -public class ZoneTransferStatus { - - @XmlAttribute(name = "status") - protected String status; - @XmlAttribute(name = "taskId") - protected String taskId; - - /** - * Gets the value of the status property. - * - * @return - * possible object is - * {@link String } - * - */ - public String getStatus() { - return status; - } - - /** - * Sets the value of the status property. - * - * @param value - * allowed object is - * {@link String } - * - */ - public void setStatus(String value) { - this.status = value; - } - - /** - * Gets the value of the taskId property. - * - * @return - * possible object is - * {@link String } - * - */ - public String getTaskId() { - return taskId; - } - - /** - * Sets the value of the taskId property. - * - * @param value - * allowed object is - * {@link String } - * - */ - public void setTaskId(String value) { - this.taskId = value; - } - -} diff --git a/Plugins/Mineplex.BungeeRotator/src/com/neustar/ultraservice/schema/v01/ZoneType.java b/Plugins/Mineplex.BungeeRotator/src/com/neustar/ultraservice/schema/v01/ZoneType.java deleted file mode 100644 index d10b63b96..000000000 --- a/Plugins/Mineplex.BungeeRotator/src/com/neustar/ultraservice/schema/v01/ZoneType.java +++ /dev/null @@ -1,57 +0,0 @@ - -package com.neustar.ultraservice.schema.v01; - -import javax.xml.bind.annotation.XmlEnum; -import javax.xml.bind.annotation.XmlEnumValue; -import javax.xml.bind.annotation.XmlType; - - -/** - *

Java class for zoneType. - * - *

The following schema fragment specifies the expected content contained within this class. - *

- *

- * <simpleType name="zoneType">
- *   <restriction base="{http://www.w3.org/2001/XMLSchema}string">
- *     <enumeration value="primary"/>
- *     <enumeration value="secondary"/>
- *     <enumeration value="alias"/>
- *     <enumeration value="all"/>
- *   </restriction>
- * </simpleType>
- * 
- * - */ -@XmlType(name = "zoneType") -@XmlEnum -public enum ZoneType { - - @XmlEnumValue("primary") - PRIMARY("primary"), - @XmlEnumValue("secondary") - SECONDARY("secondary"), - @XmlEnumValue("alias") - ALIAS("alias"), - @XmlEnumValue("all") - ALL("all"); - private final String value; - - ZoneType(String v) { - value = v; - } - - public String value() { - return value; - } - - public static ZoneType fromValue(String v) { - for (ZoneType c: ZoneType.values()) { - if (c.value.equals(v)) { - return c; - } - } - throw new IllegalArgumentException(v); - } - -} diff --git a/Plugins/Mineplex.BungeeRotator/src/com/neustar/ultraservice/schema/v01/package-info.java b/Plugins/Mineplex.BungeeRotator/src/com/neustar/ultraservice/schema/v01/package-info.java deleted file mode 100644 index 7ad6102ca..000000000 --- a/Plugins/Mineplex.BungeeRotator/src/com/neustar/ultraservice/schema/v01/package-info.java +++ /dev/null @@ -1,2 +0,0 @@ -@javax.xml.bind.annotation.XmlSchema(namespace = "http://schema.ultraservice.neustar.com/v01/", elementFormDefault = javax.xml.bind.annotation.XmlNsForm.QUALIFIED) -package com.neustar.ultraservice.schema.v01; diff --git a/Plugins/Mineplex.BungeeRotator/src/mineplex/bungee/BungeeRotator.java b/Plugins/Mineplex.BungeeRotator/src/mineplex/bungee/BungeeRotator.java index 2dd88a8e3..a7d2e0462 100644 --- a/Plugins/Mineplex.BungeeRotator/src/mineplex/bungee/BungeeRotator.java +++ b/Plugins/Mineplex.BungeeRotator/src/mineplex/bungee/BungeeRotator.java @@ -16,7 +16,6 @@ import java.util.logging.Logger; import mineplex.bungee.api.ApiDeleteCall; import mineplex.bungee.api.ApiGetCall; import mineplex.bungee.api.ApiPostCall; -import mineplex.bungee.api.HttpCallBase; import mineplex.bungee.api.token.ARecord; import mineplex.bungee.api.token.DnsRecord; import mineplex.bungee.api.token.DomainRecords; @@ -25,8 +24,8 @@ import mineplex.serverdata.data.BungeeServer; import mineplex.serverdata.data.DataRepository; import mineplex.serverdata.redis.RedisDataRepository; import mineplex.serverdata.servers.ConnectionData; -import mineplex.serverdata.servers.ServerManager; import mineplex.serverdata.servers.ConnectionData.ConnectionType; +import mineplex.serverdata.servers.ServerManager; public class BungeeRotator { @@ -40,16 +39,7 @@ public class BungeeRotator private static boolean _debug = false; public static void main(String args[]) - { - try - { - Class.forName("com.mysql.jdbc.Driver"); - } - catch (ClassNotFoundException e1) - { - e1.printStackTrace(); - } - + { try { FileHandler fileHandler = new FileHandler("rotator.log", true); @@ -106,7 +96,8 @@ public class BungeeRotator _repository = new RedisDataRepository(ServerManager.getConnection(true, ServerManager.SERVER_STATUS_LABEL), ServerManager.getConnection(false, ServerManager.SERVER_STATUS_LABEL), Region.ALL, BungeeServer.class, "bungeeServers"); - _secondRepository = new RedisDataRepository(new ConnectionData("10.81.1.156", 6379, ConnectionType.MASTER, "ServerStatus"), new ConnectionData("10.81.1.156", 6377, ConnectionType.SLAVE, "ServerStatus"), + // Temporarily reassigning to US Redis IP for EU player redirection testing. 10.81.1.156 -> 10.33.53.16 + _secondRepository = new RedisDataRepository(new ConnectionData("10.33.53.16", 6379, ConnectionType.MASTER, "ServerStatus"), new ConnectionData("10.33.53.16", 6377, ConnectionType.SLAVE, "ServerStatus"), Region.ALL, BungeeServer.class, "bungeeServers"); //_ipRepository = new PlayerStatsRepository(); @@ -119,7 +110,7 @@ public class BungeeRotator try { List bungeeServers = new ArrayList(_repository.getElements()); - bungeeServers.addAll(_secondRepository.getElements()); + //bungeeServers.addAll(_secondRepository.getElements()); Collections.sort(bungeeServers, bungeeSorter); diff --git a/Plugins/Mineplex.BungeeRotator/src/mineplex/bungee/PlayerStatsRepository.java b/Plugins/Mineplex.BungeeRotator/src/mineplex/bungee/PlayerStatsRepository.java index 009695499..9cd065320 100644 --- a/Plugins/Mineplex.BungeeRotator/src/mineplex/bungee/PlayerStatsRepository.java +++ b/Plugins/Mineplex.BungeeRotator/src/mineplex/bungee/PlayerStatsRepository.java @@ -17,18 +17,6 @@ public class PlayerStatsRepository extends RepositoryBase super(DBPool.getPlayerStats()); } - @Override - protected void initialize() - { - - } - - @Override - protected void update() - { - - } - public List getIpAddresses() { List ipinfos = new ArrayList(1000); diff --git a/Plugins/Mineplex.BungeeRotator/src/mineplex/bungee/api/DnsMadeEasyApiCallBase.java b/Plugins/Mineplex.BungeeRotator/src/mineplex/bungee/api/DnsMadeEasyApiCallBase.java index 57dc55496..e8aa90d35 100644 --- a/Plugins/Mineplex.BungeeRotator/src/mineplex/bungee/api/DnsMadeEasyApiCallBase.java +++ b/Plugins/Mineplex.BungeeRotator/src/mineplex/bungee/api/DnsMadeEasyApiCallBase.java @@ -1,5 +1,7 @@ package mineplex.bungee.api; +import javax.crypto.Mac; +import javax.crypto.spec.SecretKeySpec; import java.io.BufferedReader; import java.io.IOException; import java.io.InputStream; @@ -8,23 +10,23 @@ import java.text.SimpleDateFormat; import java.util.Calendar; import java.util.Locale; import java.util.TimeZone; - -import javax.crypto.Mac; -import javax.crypto.spec.SecretKeySpec; +import java.util.concurrent.TimeUnit; import org.apache.commons.codec.binary.Hex; import org.apache.http.HttpResponse; import org.apache.http.client.HttpClient; import org.apache.http.client.methods.HttpRequestBase; -import org.apache.http.conn.scheme.PlainSocketFactory; -import org.apache.http.conn.scheme.Scheme; -import org.apache.http.conn.scheme.SchemeRegistry; import org.apache.http.impl.client.DefaultHttpClient; import org.apache.http.impl.conn.PoolingClientConnectionManager; +import org.apache.http.params.BasicHttpParams; +import org.apache.http.params.HttpConnectionParams; +import org.apache.http.params.HttpParams; public abstract class DnsMadeEasyApiCallBase { - protected String ApiUrl = "http://api.dnsmadeeasy.com/V2.0/dns/managed/"; + public static final int TIMEOUT = (int) TimeUnit.SECONDS.toMillis(60); + + protected String ApiUrl = "https://api.dnsmadeeasy.com/V2.0/dns/managed/"; protected int DomainId = 962728; protected String Category = "/records/"; @@ -37,14 +39,13 @@ public abstract class DnsMadeEasyApiCallBase protected String execute(HttpRequestBase request) { - SchemeRegistry schemeRegistry = new SchemeRegistry(); - schemeRegistry.register(new Scheme("https", 80, PlainSocketFactory.getSocketFactory())); - - PoolingClientConnectionManager connectionManager = new PoolingClientConnectionManager(schemeRegistry); + PoolingClientConnectionManager connectionManager = new PoolingClientConnectionManager(); connectionManager.setMaxTotal(200); connectionManager.setDefaultMaxPerRoute(20); - HttpClient httpClient = new DefaultHttpClient(connectionManager); + HttpParams params = new BasicHttpParams(); + HttpConnectionParams.setConnectionTimeout(params, TIMEOUT); + HttpClient httpClient = new DefaultHttpClient(connectionManager, params); InputStream in = null; String response = ""; @@ -72,13 +73,9 @@ public abstract class DnsMadeEasyApiCallBase } catch (Exception ex) { - System.out.println("DnsMadeEasyApiCall Error:\n" + ex.getMessage()); - - for (StackTraceElement trace : ex.getStackTrace()) - { - System.out.println(trace); - } - } + System.out.println("DnsMadeEasyApiCall Error:"); + ex.printStackTrace(); + } finally { httpClient.getConnectionManager().shutdown(); diff --git a/Plugins/Mineplex.BungeeRotator/src/net/java/dev/jaxb/array/ObjectFactory.java b/Plugins/Mineplex.BungeeRotator/src/net/java/dev/jaxb/array/ObjectFactory.java deleted file mode 100644 index 908a97ff7..000000000 --- a/Plugins/Mineplex.BungeeRotator/src/net/java/dev/jaxb/array/ObjectFactory.java +++ /dev/null @@ -1,40 +0,0 @@ - -package net.java.dev.jaxb.array; - -import javax.xml.bind.annotation.XmlRegistry; - - -/** - * This object contains factory methods for each - * Java content interface and Java element interface - * generated in the net.java.dev.jaxb.array package. - *

An ObjectFactory allows you to programatically - * construct new instances of the Java representation - * for XML content. The Java representation of XML - * content can consist of schema derived interfaces - * and classes representing the binding of schema - * type definitions, element declarations and model - * groups. Factory methods for each of these are - * provided in this class. - * - */ -@XmlRegistry -public class ObjectFactory { - - - /** - * Create a new ObjectFactory that can be used to create new instances of schema derived classes for package: net.java.dev.jaxb.array - * - */ - public ObjectFactory() { - } - - /** - * Create an instance of {@link StringArray } - * - */ - public StringArray createStringArray() { - return new StringArray(); - } - -} diff --git a/Plugins/Mineplex.BungeeRotator/src/net/java/dev/jaxb/array/StringArray.java b/Plugins/Mineplex.BungeeRotator/src/net/java/dev/jaxb/array/StringArray.java deleted file mode 100644 index c0d74b372..000000000 --- a/Plugins/Mineplex.BungeeRotator/src/net/java/dev/jaxb/array/StringArray.java +++ /dev/null @@ -1,69 +0,0 @@ - -package net.java.dev.jaxb.array; - -import java.util.ArrayList; -import java.util.List; -import javax.xml.bind.annotation.XmlAccessType; -import javax.xml.bind.annotation.XmlAccessorType; -import javax.xml.bind.annotation.XmlElement; -import javax.xml.bind.annotation.XmlType; - - -/** - *

Java class for stringArray complex type. - * - *

The following schema fragment specifies the expected content contained within this class. - * - *

- * <complexType name="stringArray">
- *   <complexContent>
- *     <restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
- *       <sequence>
- *         <element name="item" type="{http://www.w3.org/2001/XMLSchema}string" maxOccurs="unbounded" minOccurs="0"/>
- *       </sequence>
- *     </restriction>
- *   </complexContent>
- * </complexType>
- * 
- * - * - */ -@XmlAccessorType(XmlAccessType.FIELD) -@XmlType(name = "stringArray", propOrder = { - "item" -}) -public class StringArray { - - @XmlElement(nillable = true) - protected List item; - - /** - * Gets the value of the item property. - * - *

- * This accessor method returns a reference to the live list, - * not a snapshot. Therefore any modification you make to the - * returned list will be present inside the JAXB object. - * This is why there is not a set method for the item property. - * - *

- * For example, to add a new item, do as follows: - *

-     *    getItem().add(newItem);
-     * 
- * - * - *

- * Objects of the following type(s) are allowed in the list - * {@link String } - * - * - */ - public List getItem() { - if (item == null) { - item = new ArrayList(); - } - return this.item; - } - -} diff --git a/Plugins/Mineplex.BungeeRotator/src/net/java/dev/jaxb/array/package-info.java b/Plugins/Mineplex.BungeeRotator/src/net/java/dev/jaxb/array/package-info.java deleted file mode 100644 index c521ad51a..000000000 --- a/Plugins/Mineplex.BungeeRotator/src/net/java/dev/jaxb/array/package-info.java +++ /dev/null @@ -1,2 +0,0 @@ -@javax.xml.bind.annotation.XmlSchema(namespace = "http://jaxb.dev.java.net/array") -package net.java.dev.jaxb.array; diff --git a/Plugins/Mineplex.Cache/src/mineplex/cache/player/PlayerCache.java b/Plugins/Mineplex.Cache/src/mineplex/cache/player/PlayerCache.java index 804515ad2..2409e3be7 100644 --- a/Plugins/Mineplex.Cache/src/mineplex/cache/player/PlayerCache.java +++ b/Plugins/Mineplex.Cache/src/mineplex/cache/player/PlayerCache.java @@ -4,37 +4,43 @@ import java.util.UUID; import mineplex.serverdata.Region; import mineplex.serverdata.redis.RedisDataRepository; +import mineplex.serverdata.redis.atomic.RedisStringRepository; import mineplex.serverdata.servers.ServerManager; -public class PlayerCache +public enum PlayerCache { - private static PlayerCache _instance = null; - - private RedisDataRepository _repository; + INSTANCE; public static PlayerCache getInstance() { - if (_instance == null) - _instance = new PlayerCache(); - - return _instance; + return INSTANCE; } - - private PlayerCache() + + private final RedisDataRepository _playerInfoRepository; + private final RedisStringRepository _accountIdRepository; + + PlayerCache() { - _repository = new RedisDataRepository( - ServerManager.getMasterConnection(), + _playerInfoRepository = new RedisDataRepository( + ServerManager.getMasterConnection(), ServerManager.getSlaveConnection(), - Region.ALL, - PlayerInfo.class, + Region.ALL, + PlayerInfo.class, "playercache"); + + _accountIdRepository = new RedisStringRepository( + ServerManager.getMasterConnection(), + ServerManager.getSlaveConnection(), + Region.ALL, + "accountid" + ); } - + public void addPlayer(PlayerInfo player) { try { - _repository.addElement(player, 60 * 60 * 6); // 6 Hours + _playerInfoRepository.addElement(player, 60 * 60 * 6); // 6 Hours } catch (Exception exception) { @@ -42,12 +48,12 @@ public class PlayerCache exception.printStackTrace(); } } - + public PlayerInfo getPlayer(UUID uuid) { try { - PlayerInfo playerInfo = _repository.getElement(uuid.toString()); + PlayerInfo playerInfo = _playerInfoRepository.getElement(uuid.toString()); return playerInfo; } catch (Exception exception) @@ -55,23 +61,49 @@ public class PlayerCache System.out.println("Error retrieving player info in PlayerCache : " + exception.getMessage()); exception.printStackTrace(); } - + return null; } /** * Attempts to grab a player's account ID from the cache + * * @param uuid Minecraft Account UUID * @return The account id of the player, or -1 if the player is not in the cache */ public int getAccountId(UUID uuid) { - PlayerInfo info = getPlayer(uuid); - return info == null ? -1 : info.getAccountId(); + String accountIdStr = _accountIdRepository.get(uuid.toString()); + + if (accountIdStr == null) + return -1; + + try + { + int accountId = Integer.parseInt(accountIdStr); + if (accountId <= 0) + { + // remove invalid account id + _accountIdRepository.del(uuid.toString()); + return -1; + } + return accountId; + } + catch (NumberFormatException ex) + { + // remove invalid account id + _accountIdRepository.del(uuid.toString()); + return -1; + } + } + + public void updateAccountId(UUID uuid, int newId) + { + _accountIdRepository.set(uuid.toString(), String.valueOf(newId)); } public void clean() { - _repository.clean(); + _playerInfoRepository.clean(); } } diff --git a/Plugins/Mineplex.Cache/src/mineplex/cache/player/PlayerInfo.java b/Plugins/Mineplex.Cache/src/mineplex/cache/player/PlayerInfo.java index c7cf6faec..5719f661b 100644 --- a/Plugins/Mineplex.Cache/src/mineplex/cache/player/PlayerInfo.java +++ b/Plugins/Mineplex.Cache/src/mineplex/cache/player/PlayerInfo.java @@ -36,11 +36,6 @@ public class PlayerInfo implements Data return _id; } - public int getAccountId() - { - return _accountId; - } - public UUID getUUID() { return _uuid; @@ -90,11 +85,6 @@ public class PlayerInfo implements Data { _version = version; } - - public void setAccountId(int accountId) - { - _accountId = accountId; - } public void updateLoginTime() { diff --git a/Plugins/Mineplex.Core.Common/pom.xml b/Plugins/Mineplex.Core.Common/pom.xml index 3e9fed6c9..65ec63dd8 100644 --- a/Plugins/Mineplex.Core.Common/pom.xml +++ b/Plugins/Mineplex.Core.Common/pom.xml @@ -1,35 +1,40 @@ - 4.0.0 + xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> + 4.0.0 - - com.mineplex - mineplex-parent - dev-SNAPSHOT - + + com.mineplex + mineplex-parent + dev-SNAPSHOT + - mineplex-core-common + mineplex-core-common - - - com.mineplex - spigot - - - org.apache.httpcomponents - httpclient - - + + + com.mineplex + spigot + + + org.apache.httpcomponents + httpclient + + + com.mineplex + mineplex-serverdata + dev-SNAPSHOT + + - - - - - - ascii.png - - - - + + + + + + ascii.png + + + + diff --git a/Plugins/Mineplex.Core.Common/src/mineplex/core/common/Constants.java b/Plugins/Mineplex.Core.Common/src/mineplex/core/common/Constants.java new file mode 100644 index 000000000..32a6014cb --- /dev/null +++ b/Plugins/Mineplex.Core.Common/src/mineplex/core/common/Constants.java @@ -0,0 +1,73 @@ +package mineplex.core.common; + +import java.lang.reflect.Type; +import java.util.Map; +import java.util.UUID; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.JsonSerializationContext; +import com.google.gson.JsonSerializer; +import com.mojang.authlib.GameProfile; +import com.mojang.authlib.properties.Property; +import com.mojang.authlib.properties.PropertyMap; +import com.mojang.util.UUIDTypeAdapter; + +public class Constants +{ + public static final String WEB_ADDRESS = "http://accounts.mineplex.com/"; + public static final String WEB_CONFIG_KEY = "webServer"; + + public static Gson GSON; + + static + { + GsonBuilder builder = new GsonBuilder() + .registerTypeAdapter(PropertyMap.class, new PropertyMap.Serializer()) + .registerTypeAdapter(UUID.class, new UUIDTypeAdapter()); + + builder.registerTypeAdapter(GameProfile.class, new GameProfileSerializer()); + + GSON = builder.create(); + } + + private static class GameProfileSerializer implements JsonSerializer, JsonDeserializer + { + public GameProfile deserialize(JsonElement json, Type type, JsonDeserializationContext context) throws JsonParseException + { + if (!(json instanceof JsonObject)) + return new GameProfile(null, null); + + JsonObject object = (JsonObject) json; + UUID id = object.has("id") ? (UUID) context.deserialize(object.get("id"), UUID.class) : null; + String name = object.has("name") ? object.getAsJsonPrimitive("name").getAsString() : null; + GameProfile profile = new GameProfile(id, name); + + if (object.has("properties")) + profile.getProperties().putAll(context.deserialize(object.get("properties"), PropertyMap.class)); + + return profile; + } + + public JsonElement serialize(GameProfile profile, Type type, JsonSerializationContext context) + { + JsonObject result = new JsonObject(); + + if (profile.getId() != null) + result.add("id", context.serialize(profile.getId())); + + if (profile.getName() != null) + result.addProperty("name", profile.getName()); + + if (!profile.getProperties().isEmpty()) + result.add("properties", context.serialize(profile.getProperties())); + + return result; + } + } +} diff --git a/Plugins/Mineplex.Core.Common/src/mineplex/core/common/RangeShuffleIterator.java b/Plugins/Mineplex.Core.Common/src/mineplex/core/common/RangeShuffleIterator.java new file mode 100644 index 000000000..49af0d468 --- /dev/null +++ b/Plugins/Mineplex.Core.Common/src/mineplex/core/common/RangeShuffleIterator.java @@ -0,0 +1,162 @@ +package mineplex.core.common; + +import java.util.Iterator; +import java.util.Map; +import java.util.NavigableMap; +import java.util.PrimitiveIterator; +import java.util.Random; +import java.util.Set; +import java.util.TreeMap; + +import com.google.common.base.Preconditions; + +/** + * An Iterator that shuffles and provides integers from a specified range. + * The shuffle strategy is based on the Fisher-Yates shuffle. + * + * @see #nextInts(int) + * @see #nextInt() + */ +public class RangeShuffleIterator implements PrimitiveIterator.OfInt +{ + private static final Random random = new Random(); + private final IntSet _remaining; + private int _remainingCount; + + /** + * Create a RangeShuffleIterator encompassing the specified range (inclusive) + * + * @param start The range lower bound, inclusive + * @param end The range upper bound, inclusive + */ + public RangeShuffleIterator(int start, int end) + { + Preconditions.checkArgument(start <= end); + _remaining = new IntSet(start, end); + _remainingCount = end - start + 1; + } + + /** + * Provide a specified number of integers in an int array. If the number + * of elements remaining is fewer than {@code maxAmount}, return all + * remaining elements. + * + * @param maxAmount The number of elements to retrieve + * @return An array containing the retrieved elements + */ + public int[] nextInts(int maxAmount) + { + int[] ret = new int[Math.min(_remainingCount, maxAmount)]; + for (int i = 0; i < ret.length; i++) + { + ret[i] = nextInt(); + } + return ret; + } + + @Override + public int nextInt() + { + if (!hasNext()) + { + throw new IllegalStateException("No remaining ranges to iterate"); + } + + int selectedPosition = random.nextInt(_remainingCount); + + Iterator> it = _remaining.ranges().iterator(); + + final int selected; + while (true) + { + Map.Entry range = it.next(); + int span = range.getValue() - range.getKey(); + if (span < selectedPosition) + { + selectedPosition -= span + 1; + + } + else + { + selected = range.getKey() + selectedPosition; + break; + } + } + + _remaining.remove(selected); + --_remainingCount; + + return selected; + } + + @Override + public boolean hasNext() + { + return _remainingCount > 0; + } + + /** + * A set of integers. The set is seeded by a single range, and the only + * supported operation is int removal. + *

+ * This implementation only exists for performance reasons. + */ + private static class IntSet + { + /** + * A set of ranges representing the remaining integers in this set + */ + private final NavigableMap ranges = new TreeMap<>(); + + /** + * Create an IntSet containing all numbers from {@code start} to + * {@code end}, inclusive + * + * @param start The range lower bound, inclusive + * @param end The range upper bound, inclusive + */ + private IntSet(int start, int end) + { + ranges.put(start, end); + } + + public Set> ranges() + { + return ranges.entrySet(); + } + + /** + * Remove an integer from this IntSet + * @param value The integer to remove + */ + public void remove(int value) + { + Map.Entry range = ranges.floorEntry(value); + if (range == null || range.getValue() < value) + { + return; + } + + int lower = range.getKey(); + int upper = range.getValue(); + + if (upper > value) + { + reinsert(value + 1, upper); + } + reinsert(lower, Math.min(upper, value - 1)); + } + + private void reinsert(int start, int end) + { + if (end < start) + { + ranges.remove(start); + } + else + { + ranges.put(start, end); + } + } + } +} \ No newline at end of file diff --git a/Plugins/Mineplex.Core.Common/src/mineplex/core/common/Rank.java b/Plugins/Mineplex.Core.Common/src/mineplex/core/common/Rank.java index bc48356ff..2f3556b26 100644 --- a/Plugins/Mineplex.Core.Common/src/mineplex/core/common/Rank.java +++ b/Plugins/Mineplex.Core.Common/src/mineplex/core/common/Rank.java @@ -10,54 +10,58 @@ import mineplex.core.common.util.UtilPlayer; public enum Rank { //Staff - LT("Leader", ChatColor.DARK_RED, "Leaders manage the operation of their respective team \nor projects. They usually operate on affairs within \nthe staff, development, or management team."), - OWNER("Owner", ChatColor.DARK_RED, "Owners are the founders of Mineplex. \nEach owner manages a different aspect of the \nserver and ensures its efficient operation."), - DEVELOPER("Dev", ChatColor.DARK_RED, "Developers work behind the scenes to \ncreate new games and features, and fix bugs to \ngive the best experience."), - ADMIN("Admin", ChatColor.DARK_RED, "An Administrator’s role is to manage \ntheir respective Senior Moderator team \nand all moderators within it."), - JNR_DEV("Jr.Dev", ChatColor.GOLD, "Junior Developers work behind the scenes to \ncreate new games and features, and fix bugs to \ngive the best experience."), - SUPPORT("Support", ChatColor.BLUE, "Support agents handle tickets and \nprovide customer service."), - CMOD("C.Mod", ChatColor.GOLD, "Clans Moderators are members of the Clans Management Senior Mod team. \nTheir duties include moderation and support within the Clans servers. \n\nFor assistance, contact them using " + F.elem("/a ") + "."), - SNR_MODERATOR("Sr.Mod", ChatColor.GOLD, "Senior Moderators are members of a special \nSenior Moderator team where they have to fulfill specific tasks. \nJust like Moderators, you can always ask them for help. \n\nFor assistance, contact them using " + F.elem("/a ") + "."), - MODERATOR("Mod", ChatColor.GOLD, "Moderators enforce rules and provide help to \nanyone with questions or concerns. \n\nFor assistance, contact them using " + F.elem("/a ") + "."), - HELPER("Trainee", ChatColor.DARK_AQUA, "Trainees are moderators-in-training. \nTheir duties include enforcing the rules and \nproviding help to anyone with questions or concerns. \n\nFor assistance, contact them using " + F.elem("/a ") + "."), - MAPLEAD("MapLead", ChatColor.BLUE, "Map Leaders are leaders of the Mineplex Build Team. \nThey oversee the creation of new maps and manage Builders."), - MAPDEV("Builder", ChatColor.BLUE, "Builders are members of the Mineplex Build Team. \nThey create many of the maps used across Mineplex."), - MEDIA("Media", ChatColor.BLUE, "The Media rank is given to talented artists who are\n endorsed to create content for Mineplex."), + LT("Leader", "lt", ChatColor.DARK_RED, "Leaders manage the operation of their respective team \nor projects. They usually operate on affairs within \nthe staff, development, or management team."), + OWNER("Owner", "owner", ChatColor.DARK_RED, "Owners are the founders of Mineplex. \nEach owner manages a different aspect of the \nserver and ensures its efficient operation."), + DEVELOPER("Dev", "dev", ChatColor.DARK_RED, "Developers work behind the scenes to \ncreate new games and features, and fix bugs to \ngive the best experience."), + ADMIN("Admin", "adm", ChatColor.DARK_RED, "An Administrator’s role is to manage \ntheir respective Senior Moderator team \nand all moderators within it."), + JNR_DEV("Jr.Dev", "jrdev", ChatColor.GOLD, "Junior Developers work behind the scenes to \ncreate new games and features, and fix bugs to \ngive the best experience."), + SUPPORT("Support", "spp", ChatColor.BLUE, "Support agents handle tickets and \nprovide customer service."), + CMOD("C.Mod", "cmod", ChatColor.GOLD, "Clans Moderators are members of the Clans Management Senior Mod team. \nTheir duties include moderation and support within the Clans servers. \n\nFor assistance, contact them using " + F.elem("/a ") + "."), + SNR_MODERATOR("Sr.Mod", "srmod", ChatColor.GOLD, "Senior Moderators are members of a special \nSenior Moderator team where they have to fulfill specific tasks. \nJust like Moderators, you can always ask them for help. \n\nFor assistance, contact them using " + F.elem("/a ") + "."), + MODERATOR("Mod", "mod", ChatColor.GOLD, "Moderators enforce rules and provide help to \nanyone with questions or concerns. \n\nFor assistance, contact them using " + F.elem("/a ") + "."), + HELPER("Trainee", "train", ChatColor.GOLD, "Trainees are moderators-in-training. \nTheir duties include enforcing the rules and \nproviding help to anyone with questions or concerns. \n\nFor assistance, contact them using " + F.elem("/a ") + "."), + MAPLEAD("MapLead", "mapl", ChatColor.BLUE, "Map Leaders are leaders of the Mineplex Build Team. \nThey oversee the creation of new maps and manage Builders."), + MAPDEV("Builder", "mapd", ChatColor.BLUE, "Builders are members of the Mineplex Build Team. \nThey create many of the maps used across Mineplex."), + MEDIA("Media", "media", ChatColor.BLUE, "The Media rank is given to talented artists who are\n endorsed to create content for Mineplex."), - EVENT("Event", ChatColor.WHITE, "A member of the official Mineplex Events team!"), + EVENT("Event", "evnt", ChatColor.WHITE, "A member of the official Mineplex Events team!"), //Media - YOUTUBE("YouTube", ChatColor.RED, "A YouTuber who creates content for \nor related to Mineplex."), - YOUTUBE_SMALL("YT", ChatColor.DARK_PURPLE, "A YouTuber who creates content for \nor related to Mineplex. \n\nThey have fewer subscribers than full YouTubers."), - TWITCH("Twitch", ChatColor.DARK_PURPLE, "A Twitch streamer who often features \nMineplex in their streams."), + YOUTUBE("YouTube", "yt", ChatColor.RED, "A YouTuber who creates content for \nor related to Mineplex."), + YOUTUBE_SMALL("YT", "ytsm", ChatColor.DARK_PURPLE, "A YouTuber who creates content for \nor related to Mineplex. \n\nThey have fewer subscribers than full YouTubers."), + TWITCH("Twitch", "tw", ChatColor.DARK_PURPLE, "A Twitch streamer who often features \nMineplex in their streams."), //Player - TITAN("Titan", ChatColor.RED, true, "Ancient myths spoke of a gigantic being \nwith immense power... \n\nPurchase Titan at www.mineplex.com/shop"), - LEGEND("Legend", ChatColor.GREEN, true, "Mineplex's third premium rank. \n\nPurchase Legend at www.mineplex.com/shop"), - HERO("Hero", ChatColor.LIGHT_PURPLE, true, "There are many stories of a \nvaliant Hero who was brave enough to \ntame the most fearsome dragon in the land. \n\nPurchase Hero at www.mineplex.com/shop"), - ULTRA("Ultra", ChatColor.AQUA, true, "Mineplex's first premium rank. \n\nPurchase Ultra at www.mineplex.com/shop"), - ALL("", ChatColor.WHITE, null); + ETERNAL("Eternal", "et", ChatColor.DARK_AQUA, true, "Fantastic and magical, no one \nexcept the time lords truly understand \nthe power of this rank.\n\nThe fifth purchasable rank at Mineplex.com/shop"), + TITAN("Titan", "t", ChatColor.RED, true, "Ancient myths spoke of a gigantic being \nwith immense power... \n\nThe fourth purchasable rank at Mineplex.com/shop"), + LEGEND("Legend", "l", ChatColor.GREEN, true, "Years they have told stories of this rank, \nonly for the legends to be true. \n\nThe third purchasable rank at Mineplex.com/shop"), + HERO("Hero", "h", ChatColor.LIGHT_PURPLE, true, "There are many stories of a \nvaliant Hero who was brave enough to \ntame the most fearsome dragon in the land. \n\nThe second purchasable rank at Mineplex.com/shop"), + ULTRA("Ultra", "u", ChatColor.AQUA, true, "A first step into the stories of the mist. \nOnly those brave enough may enter. \n\nThe first purchasable rank at Mineplex.com/shop"), + ALL("", "", ChatColor.WHITE, null); private ChatColor _color; private boolean _donor; private String _description; public String Name; + public String ScoreboardTag; - Rank(String name, ChatColor color, String description) + Rank(String name, String scoreboardTag, ChatColor color, String description) { _color = color; Name = name; _donor = false; _description = description; + ScoreboardTag = scoreboardTag; } - Rank(String name, ChatColor color, boolean donor, String description) + Rank(String name, String scoreboardTag, ChatColor color, boolean donor, String description) { _color = color; Name = name; _donor = donor; _description = description; + ScoreboardTag = scoreboardTag; } public String getDescription() @@ -121,8 +125,8 @@ public enum Rank if (uppercase) name = Name.toUpperCase(); - if (bold) return _color + C.Bold + name; - else return _color + name; + if (bold) return _color + C.Bold + name; + else return _color + name; } public ChatColor getColor() diff --git a/Plugins/Mineplex.Core.Common/src/mineplex/core/common/animation/Animator.java b/Plugins/Mineplex.Core.Common/src/mineplex/core/common/animation/Animator.java index 335f327a4..a18be0a5e 100644 --- a/Plugins/Mineplex.Core.Common/src/mineplex/core/common/animation/Animator.java +++ b/Plugins/Mineplex.Core.Common/src/mineplex/core/common/animation/Animator.java @@ -6,6 +6,7 @@ import java.util.PriorityQueue; import java.util.Set; import org.bukkit.Location; +import org.bukkit.entity.Entity; import org.bukkit.plugin.Plugin; import org.bukkit.scheduler.BukkitRunnable; import org.bukkit.scheduler.BukkitTask; @@ -130,6 +131,65 @@ public abstract class Animator }.runTaskTimer(_plugin, 0, 1); } + public void start(Entity entity) + { + if(isRunning()) return; + + _queue.clear(); + _queue.addAll(_points); + + if(_queue.isEmpty()) return; + + _baseLoc = entity.getLocation().clone(); + _next = _queue.peek(); + _prev = new AnimationPoint(0, _next.getMove().clone(), _next.getDirection().clone()); + + _task = new BukkitRunnable() + { + public void run() + { + _tick++; + + if(_next.getTick() < _tick) + { + _queue.remove(); + _prev = _next; + _next = _queue.peek(); + } + + if(_queue.isEmpty()) + { + if(_repeat) + { + Location clone = _baseLoc.clone(); + stop(); + start(clone); + } + else + { + finish(_baseLoc); + stop(); + } + return; + } + + Location prev = _baseLoc.clone().add(_prev.getMove()); + Location next = _baseLoc.clone().add(_next.getMove()); + prev.setDirection(_prev.getDirection()); + + double diff = ((double)_tick-_prev.getTick())/(_next.getTick()-_prev.getTick()); + if(!Double.isFinite(diff)) diff = 0; + prev.add(next.clone().subtract(prev).toVector().multiply(diff)); + + Vector dirDiff = _next.getDirection().subtract(prev.getDirection()); + dirDiff.multiply(diff); + prev.setDirection(prev.getDirection().add(dirDiff)); + + tick(prev); + } + }.runTaskTimer(_plugin, 0, 1); + } + public boolean isRunning() { return _task != null; diff --git a/Plugins/Mineplex.Core.Common/src/mineplex/core/common/api/ApiException.java b/Plugins/Mineplex.Core.Common/src/mineplex/core/common/api/ApiException.java new file mode 100644 index 000000000..2239245f7 --- /dev/null +++ b/Plugins/Mineplex.Core.Common/src/mineplex/core/common/api/ApiException.java @@ -0,0 +1,5 @@ +package mineplex.core.common.api; + +public class ApiException extends Exception +{ +} diff --git a/Plugins/Mineplex.Core.Common/src/mineplex/core/common/api/ApiHost.java b/Plugins/Mineplex.Core.Common/src/mineplex/core/common/api/ApiHost.java index 93dbf761b..a6dd1cbae 100644 --- a/Plugins/Mineplex.Core.Common/src/mineplex/core/common/api/ApiHost.java +++ b/Plugins/Mineplex.Core.Common/src/mineplex/core/common/api/ApiHost.java @@ -1,19 +1,80 @@ package mineplex.core.common.api; -/** - * TODO: Store this in a file instead of being hardcoded - * - * @author Shaun Bennett - */ -public enum ApiHost +import java.io.File; +import java.util.HashMap; +import java.util.Map; + +import org.bukkit.configuration.file.YamlConfiguration; + +public class ApiHost { - AMPLIFIERS("10.33.53.12", 7979), - ANTISPAM("10.33.53.12", 8181); + private static final String API_HOST_FILE = "api-config.dat"; + private static final Object LOCK = new Object(); + + private static volatile boolean LOADED = false; + + private static final Map API_HOST_MAP = new HashMap<>(); + + public static ApiHost getAPIHost(String identifier) + { + if (!LOADED) + { + synchronized (LOCK) + { + if (!LOADED) + { + try + { + File configFile = new File(API_HOST_FILE); + YamlConfiguration configuration = YamlConfiguration.loadConfiguration(configFile); + + for (String key : configuration.getKeys(false)) + { + String ip = configuration.getConfigurationSection(key).getString("ip"); + // Use parseInt to catch non-ints instead of a 0 + int port = Integer.parseInt(configuration.getConfigurationSection(key).getString("port")); + if (ip == null) + { + throw new NullPointerException(); + } + + API_HOST_MAP.put(key, new ApiHost(ip, port)); + } + } + catch (Throwable t) + { + t.printStackTrace(); + } + finally + { + LOADED = true; + } + } + } + } + + return API_HOST_MAP.get(identifier); + } + + public static ApiHost getAmplifierService() + { + return getAPIHost("AMPLIFIERS"); + } + + public static ApiHost getAntispamService() + { + return getAPIHost("ANTISPAM"); + } + + public static ApiHost getEnderchestService() + { + return getAPIHost("ENDERCHEST"); + } private String _host; private int _port; - ApiHost(String host, int port) + private ApiHost(String host, int port) { _host = host; _port = port; diff --git a/Plugins/Mineplex.Core.Common/src/mineplex/core/common/api/ApiWebCall.java b/Plugins/Mineplex.Core.Common/src/mineplex/core/common/api/ApiWebCall.java index e59cb7f76..faf5b7d43 100644 --- a/Plugins/Mineplex.Core.Common/src/mineplex/core/common/api/ApiWebCall.java +++ b/Plugins/Mineplex.Core.Common/src/mineplex/core/common/api/ApiWebCall.java @@ -1,6 +1,11 @@ package mineplex.core.common.api; import com.google.gson.Gson; + +import org.apache.commons.codec.binary.Hex; +import org.apache.commons.codec.digest.DigestUtils; +import org.apache.commons.io.IOUtils; +import org.apache.http.Header; import org.apache.http.HttpEntity; import org.apache.http.client.ClientProtocolException; import org.apache.http.client.methods.CloseableHttpResponse; @@ -13,10 +18,18 @@ import org.apache.http.impl.conn.PoolingHttpClientConnectionManager; import org.apache.http.message.BasicHeader; import org.apache.http.protocol.HTTP; +import java.io.File; +import java.io.FileOutputStream; import java.io.IOException; import java.io.InputStreamReader; +import java.io.OutputStream; import java.io.UnsupportedEncodingException; import java.lang.reflect.Type; +import java.security.DigestInputStream; +import java.security.MessageDigest; +import java.security.NoSuchAlgorithmException; + +import mineplex.core.common.api.enderchest.HashesNotEqualException; /** * @author Shaun Bennett @@ -28,6 +41,11 @@ public class ApiWebCall private PoolingHttpClientConnectionManager _cm; private CloseableHttpClient _httpClient; + public ApiWebCall(String url) + { + this(url, new Gson()); + } + public ApiWebCall(String url, Gson gson) { _url = url; @@ -89,6 +107,50 @@ public class ApiWebCall return returnData; } + public File getFile(String resource, String savePath) throws HashesNotEqualException, IOException + { + HttpGet httpGet = new HttpGet(_url + resource); + File file = new File(savePath); + + FileOutputStream fos = null; + DigestInputStream dis = null; + try (CloseableHttpResponse response = _httpClient.execute(httpGet)) + { + MessageDigest md = DigestUtils.getMd5Digest(); + HttpEntity entity = response.getEntity(); + dis = new DigestInputStream(entity.getContent(), md); + fos = new FileOutputStream(file); + IOUtils.copy(dis, fos); + + String calculatedHash = Hex.encodeHexString(md.digest()); + Header hashHeader = response.getFirstHeader("Content-MD5"); + + if (hashHeader != null && !calculatedHash.equals(hashHeader.getValue())) + { + file.delete(); + throw new HashesNotEqualException(hashHeader.getValue(), calculatedHash); + } + } finally { + try + { + if (fos != null) fos.close(); + } catch (IOException e) + { + e.printStackTrace(); + } + + try + { + if (dis != null) dis.close(); + } catch (IOException e) + { + e.printStackTrace(); + } + } + + return file; + } + private T parseResponse(CloseableHttpResponse response, Type type) throws IOException { HttpEntity entity = response.getEntity(); diff --git a/Plugins/Mineplex.Core.Common/src/mineplex/core/common/api/enderchest/EnderchestWorldLoader.java b/Plugins/Mineplex.Core.Common/src/mineplex/core/common/api/enderchest/EnderchestWorldLoader.java new file mode 100644 index 000000000..c11615902 --- /dev/null +++ b/Plugins/Mineplex.Core.Common/src/mineplex/core/common/api/enderchest/EnderchestWorldLoader.java @@ -0,0 +1,46 @@ +package mineplex.core.common.api.enderchest; + +import java.io.File; +import java.io.IOException; + +import mineplex.core.common.api.ApiHost; +import mineplex.core.common.api.ApiWebCall; +import mineplex.core.common.util.ZipUtil; +import mineplex.core.common.timing.TimingManager; + +/** + * Load worlds from the `enderchest` microservice + */ +public class EnderchestWorldLoader +{ + private static final String TIMINGS_PREFIX = "Enderchest LoadMap::"; + private ApiWebCall _webCall; + + public EnderchestWorldLoader() + { + String url = "http://" + ApiHost.getEnderchestService().getHost() + ":" + ApiHost.getEnderchestService().getPort() + "/"; + _webCall = new ApiWebCall(url); + } + + public void loadMap(String mapType, String folder) throws HashesNotEqualException, IOException + { + TimingManager.start(TIMINGS_PREFIX + "DownloadMap"); + String fileName = mapType + "_map.zip"; + File f = _webCall.getFile("map/" + mapType + "/next", fileName); + TimingManager.stop(TIMINGS_PREFIX + "DownloadMap"); + + TimingManager.start(TIMINGS_PREFIX + "CreateFolders"); + new File(folder).mkdir(); + new File(folder + java.io.File.separator + "region").mkdir(); + new File(folder + java.io.File.separator + "data").mkdir(); + TimingManager.stop(TIMINGS_PREFIX + "CreateFolders"); + + TimingManager.start(TIMINGS_PREFIX + "UnzipToDirectory"); + ZipUtil.UnzipToDirectory(f.getAbsolutePath(), folder); + TimingManager.stop(TIMINGS_PREFIX + "UnzipToDirectory"); + + TimingManager.start(TIMINGS_PREFIX + "DeleteZip"); + f.delete(); + TimingManager.stop(TIMINGS_PREFIX + "DeleteZip"); + } +} diff --git a/Plugins/Mineplex.Core.Common/src/mineplex/core/common/api/enderchest/HashesNotEqualException.java b/Plugins/Mineplex.Core.Common/src/mineplex/core/common/api/enderchest/HashesNotEqualException.java new file mode 100644 index 000000000..f5920b26f --- /dev/null +++ b/Plugins/Mineplex.Core.Common/src/mineplex/core/common/api/enderchest/HashesNotEqualException.java @@ -0,0 +1,25 @@ +package mineplex.core.common.api.enderchest; + +import mineplex.core.common.api.ApiException; + +public class HashesNotEqualException extends ApiException +{ + private String _hashFromServer; + private String _calculatedHash; + + public HashesNotEqualException(String hashFromServer, String calculatedHash) + { + _hashFromServer = hashFromServer; + _calculatedHash = calculatedHash; + } + + public String getHashFromServer() + { + return _hashFromServer; + } + + public String getGeneratedHash() + { + return _calculatedHash; + } +} diff --git a/Plugins/Mineplex.Core.Common/src/mineplex/core/common/function/Result.java b/Plugins/Mineplex.Core.Common/src/mineplex/core/common/function/Result.java deleted file mode 100644 index cb45540e3..000000000 --- a/Plugins/Mineplex.Core.Common/src/mineplex/core/common/function/Result.java +++ /dev/null @@ -1,7 +0,0 @@ -package mineplex.core.common.function; - -@FunctionalInterface -public interface Result -{ - public void Get(T result); -} diff --git a/Plugins/Mineplex.Core.Common/src/mineplex/core/common/shape/ShapeWings.java b/Plugins/Mineplex.Core.Common/src/mineplex/core/common/shape/ShapeWings.java index 6d5ca87be..439bf4958 100644 --- a/Plugins/Mineplex.Core.Common/src/mineplex/core/common/shape/ShapeWings.java +++ b/Plugins/Mineplex.Core.Common/src/mineplex/core/common/shape/ShapeWings.java @@ -1,14 +1,18 @@ package mineplex.core.common.shape; +import java.awt.Color; + import org.bukkit.Location; import org.bukkit.util.Vector; import mineplex.core.common.util.UtilParticle; import mineplex.core.common.util.UtilParticle.ParticleType; import mineplex.core.common.util.UtilParticle.ViewDist; +import mineplex.core.common.util.particles.ColoredParticle; +import mineplex.core.common.util.particles.DustSpellColor; /** - * Some simple wing shapes implementing {@link ICosmeticShape} storing additional particle information + * Some simple wing shapes implementing {@link CosmeticShape} storing additional particle information */ public class ShapeWings extends ShapeGrid implements CosmeticShape @@ -51,20 +55,60 @@ public class ShapeWings extends ShapeGrid implements CosmeticShape public static final String[] BUTTERFLY_WING_PATTERN = new String[] { - "0$$0000000000000000$$0", - "$##$00000000000000$##$", - "0$##$000000000000$##$0", - "00$##$0000000000$##$00", - "00$###$00000000$###$00", - "000$####$0000$####$000", - "000$######$$#####$0000", - "0000$############$0000", - "00000$##########$00000", - "00000$##########$00000", - "00000$####$$$###$00000", - "00000$###$000$###$0000", - "00000$##$00000$##$0000", - "000000$000000000$00000" + "0$$000000000000000$$0", + "$##$0000000000000$##$", + "0$##$00000000000$##$0", + "00$##$000000000$##$00", + "00$###$0000000$###$00", + "000$###$$000$$###$000", + "0000$####$$$####$0000", + "0000$###########$0000", + "00000$#########$00000", + "00000$#########$00000", + "00000$###$$$###$00000", + "0000$###$000$###$0000", + "0000$##$00000$##$0000", + "00000$$0000000$$00000" + }; + + public static final String[] SMALL_BUTTERFLY_WING_PATTERN = new String[] + { + "0$$00000000$$0", + "$##$000000$##$", + "0$##$0000$##$0", + "00$##$$$$##$00", + "000$######$000", + "000$######$000", + "00$###$$###$00", + "000$#$00$#$000", + "0000$0000$0000" + }; + + public static final String[] HEART_WING_PATTERN = new String[] + { + "00$00000000000000000$00", + "0$%$000000000000000$%$0", + "$%%%$$00$$000$$00$$%%%$", + "$%%%%%$$##$0$##$$%%%%%$", + "$%%%%%$####$####$%%%%%$", + "0$%%%%$#########$%%%%$0", + "00$%%%$#########$%%%$00", + "000$%%$$#######$$%%$000", + "0000$$00$#####$00$$0000", + "000000000$###$000000000", + "0000000000$#$0000000000", + "00000000000$00000000000" + }; + + public static final String[] SMALL_HEART_WING_PATTERN = new String[] + { + "0$000000000$0", + "$%$0$$0$$0$%$", + "$%%$##$##$%%$", + "0$%$00000$%$0", + "00$0$###$0$00", + "00000$#$00000", + "000000$000000" }; @@ -163,17 +207,38 @@ public class ShapeWings extends ShapeGrid implements CosmeticShape rotateOnXAxis(xRotation); } + public ShapeWings(String particle, Vector offsetData, float speed, int count, char c, double xRotation, String... pattern) + { + super(0.15, c, pattern); + _particle = particle; + _offsetData = offsetData; + _speed = speed; + _count = count; + rotateOnXAxis(xRotation); + } + @Override public void display(Location loc) { Shape clone = clone(); clone.rotateOnYAxis(Math.toRadians(loc.getYaw())); - for(Vector v : clone._points) + for (Vector v : clone.getPoints()) { Location ploc = loc.clone().add(v); displayParticle(ploc); } } + + public void displayColored(Location loc, Color color) + { + Shape clone = clone(); + clone.rotateOnYAxis(Math.toRadians(loc.getYaw())); + for (Vector v : clone.getPoints()) + { + Location ploc = loc.clone().add(v); + displayColoredParticle(ploc, color); + } + } /** * Display a single particle of the type provided to this shape at the given location. @@ -183,4 +248,10 @@ public class ShapeWings extends ShapeGrid implements CosmeticShape UtilParticle.PlayParticleToAll(_particle, loc, _offsetData, _speed, _count, ViewDist.NORMAL); } + public void displayColoredParticle(Location loc, Color color) + { + ColoredParticle coloredParticle = new ColoredParticle(ParticleType.RED_DUST, new DustSpellColor(color), loc); + coloredParticle.display(ViewDist.NORMAL); + } + } diff --git a/Plugins/Mineplex.Core.Common/src/mineplex/core/common/skin/SkinData.java b/Plugins/Mineplex.Core.Common/src/mineplex/core/common/skin/SkinData.java index 910849f06..ff803a28b 100644 --- a/Plugins/Mineplex.Core.Common/src/mineplex/core/common/skin/SkinData.java +++ b/Plugins/Mineplex.Core.Common/src/mineplex/core/common/skin/SkinData.java @@ -62,6 +62,8 @@ public class SkinData public final static SkinData HAUNTED_CHEST = new SkinData("eyJ0aW1lc3RhbXAiOjE0NzUyNTUzOTE3OTcsInByb2ZpbGVJZCI6IjlmY2FlZDhiMTRiNTRmN2ZhNjRjYjYwNDBlNzA1MjcyIiwicHJvZmlsZU5hbWUiOiJMQ2FzdHIxIiwic2lnbmF0dXJlUmVxdWlyZWQiOnRydWUsInRleHR1cmVzIjp7IlNLSU4iOnsidXJsIjoiaHR0cDovL3RleHR1cmVzLm1pbmVjcmFmdC5uZXQvdGV4dHVyZS9lZWM5MmU4ODNiOGFjODI0MDU5YTk5NGM5NTNjNTQ0NDQ0Yjk3ZWFkZDdhNWFjNGY3ZTZhOTUxOGQ5YTkxMSJ9fX0=", "GqycEQvWoZeXDLAJ6ricUx3coA4Y6AswL0GV1KebetoTkd9XNtkJJ9eUf6ViwpSgmL0H89sdMjghThHKczUEmjaFeNl2Z9cwGnR1WOK3KpD+v8C7f10l2DNd7z8s1clJfkVay/5KkgNMneu+ZStF8mCt+uyOSfZX4toLRBba6ZDaz4RlmcNt3e6h+dCaB/npbrWxddX7YZWsAMEKxmMKrG/Rm1Gx7ZOchmd4l6+pypA3Vrjoc0LVjqDV/TsePiNxV9LWFB7Rc6YGkIyz2+z5m168iLnn4+qMMXOYndwH7RGcTLEJDPRfNjawuPNcRlYZ6bf30S540MQdC0dJbRLu0uT9CAyi1vjxezdKjGJZSiY5WmtWrhkiRRtCMr9fGxBRNxPDdf5bs7IgWClFgafkGFZKZjLlOV8qtlMrPQSduPtGBCM64veJchSMFS6MfxgE2O/+4EZ246ZN1bdV6KiLRDIzFmy9PBn2o6MNtcdFc/G5XdD7aCTwuGD6sbG2T97Aiai56CN1vYsc6yXUfeZafSm6qviXAx3zTEd1aw1oAZLj3PAt0uZRHggsBEKvwPVKsgHsOVFj5vu0BfHFbdaSdhL3GFotk06Ilr5cLxOrTwqoVNp/hiIJ8pu7T0AEWy1pMYD1+RszsTjJ76l305cQ3UHvinjnbXllsFQIIVE899s="); public final static SkinData WITCH = new SkinData("eyJ0aW1lc3RhbXAiOjE0NzM5OTEyMTE1NDQsInByb2ZpbGVJZCI6IjlmY2FlZDhiMTRiNTRmN2ZhNjRjYjYwNDBlNzA1MjcyIiwicHJvZmlsZU5hbWUiOiJMQ2FzdHIxIiwic2lnbmF0dXJlUmVxdWlyZWQiOnRydWUsInRleHR1cmVzIjp7IlNLSU4iOnsidXJsIjoiaHR0cDovL3RleHR1cmVzLm1pbmVjcmFmdC5uZXQvdGV4dHVyZS81NDg1ZDZlMTBhNmNmMmY3Mzg2NmZhMGRiNjEzOWQ5NWViZDM0ZGZiMGY0YzAxMmRkM2YzYWYxMWQ5ZjQxYyJ9fX0=", "cojkGLflVWxwnhDXmHMke7crkeA78iUYOWY7H3YvMJFD+VZi9E7vUahLTTx5ELH+PvcaHJerSDmuV+Nasc3K2n6zlXXb0B7RB/ose/kdPxHAIJee7IbZX0iFNDn6irUSOS4wOYF/BwaqG3HmpoSxV52SGMs6kqTer2Rjg3X+XwYFFiDHAR/gwhfXLzrM1iBc171vgu6T+kx65iBHa/YB/V/mj8FSxwM0f5IsLpgAEdxDL9PvEKQWgWeZ1CAqEXlGnjPkd9oGzW0TgDz2MksBbYZ2kmn/S53kK9vCrVB7egZPS4VBtKpq1P7Jeu8rtgjnAKVFQJZ2lMHnVRuvGTd8JKoPHarUPpU2LURUMaCtHzSv9v/4gjkafnDhqxG4TTcr5hxFV+ho72HQchoeaUXzIO+Yo71zrVqkrS0hw6OtgMIBlvaGaEUsFvGiCZePBEiHojO43AKqJcJAVeT2RAzHcAaBAO79ACGjNKw/oj02rOurLha9i+99bKui96Eg7SS/nPchbmu5YQ9nSpkW+JeYXnBzGGzNG4y02VWgz15L718+8161zXobhuK07qlY9i1nipFbEJedqG0cfS+AUzauETFvS9nMtxhtftYPCIxm40GQj6e77asNCAEElGssaUGKO3bjm348+oF9tR/eBOYWJQ8kL46IQLDRoop7UhG4ewY="); public final static SkinData TURKEY = new SkinData("eyJ0aW1lc3RhbXAiOjE0NzU3NzM2MTc5MDQsInByb2ZpbGVJZCI6IjlmY2FlZDhiMTRiNTRmN2ZhNjRjYjYwNDBlNzA1MjcyIiwicHJvZmlsZU5hbWUiOiJMQ2FzdHIxIiwic2lnbmF0dXJlUmVxdWlyZWQiOnRydWUsInRleHR1cmVzIjp7IlNLSU4iOnsidXJsIjoiaHR0cDovL3RleHR1cmVzLm1pbmVjcmFmdC5uZXQvdGV4dHVyZS8xYzdmYjczMTRkNmY1ZTMzNmVjN2ViNTI1ZGM0ODMzOWNhMjI4ZDk3ODU1MDM3ZDZhNDIwOGZjNzYwNDc1NiJ9fX0=", "eZWi1LOD8ke7MCUAfhspBCnyfCoGM8suFLKtbW6b27CURoRBG3eKIfwLYYeMp3ObjoZ8gCB90s28Qyw5XMzwvvowy9W/b5cYC0OzQ8+GR7tDZoWc28tGqGBM8cmDJIFQgZdceBIIr2lXeAvEJfLbyrus46hPjk8YTiQW2DsBq88BhKIy6Igb1rGqJ1goVERF07b6+/yMdLKCaT8OZFzKLXfo5rY5gr6HLnvsQiNL9aTrl74agXn1GUcP+QVNe7/c9lYmv5vLCBst1YiIPq27NZASZ++Fwyv6+PRlaFZZYtMHVd4UZeYPl7ak1Cdi/1sUcRpkBbJM8AHIrqq0iuXxrLbc6ldQ2cYQKHg9ljIpW/EZanuf6Wgm/LK1JnxXne9GUb/xPzB1EnZ95i8/u9WJa+NixEcfc3pAzDPYncIR8lishFwyBRta6BCG76U3UY2lQr3YD/48AJ49r7+WVU0gOP/h2SDSdAZHEdvkpVJ0w/xA+SevJ7Y7xA5EJ655YMQ0F8f3WUFTf1pFklE5E+fwkMVCWOPw7UMy558IcRSpdWAPPyf8sc7CpDqRk37/vXWRDa+7YBfgskK6B2eXowrzThUOBx+AmDTF3Rv8ZSr1Un0FWGi+GQ5ny7W9dJBMomzyMUbzz9stsCml5XB+6xLP2MD+9lO1bHipKS6qkhtZChE="); + public final static SkinData GINGERBREAD = new SkinData("eyJ0aW1lc3RhbXAiOjE0ODAxOTk5MjM0NTUsInByb2ZpbGVJZCI6IjRjOGQ1NjllZWZlMTRkOGE4YzJmMmM4ODA3ODA3ODRmIiwicHJvZmlsZU5hbWUiOiJHaW5nZXJicmVhZE1hbiIsInNpZ25hdHVyZVJlcXVpcmVkIjp0cnVlLCJ0ZXh0dXJlcyI6eyJTS0lOIjp7InVybCI6Imh0dHA6Ly90ZXh0dXJlcy5taW5lY3JhZnQubmV0L3RleHR1cmUvMzAyM2IxZGQ5MWQyYjM2Y2FkZTU2NjVjM2Y3ODk3ZmNiOGRlMWFlNjE5YTRlOTYxODU2MzdiMTliZGNmZjQ3In19fQ==", "lND5lQCzd5DKdn+ps82zn55hrSDr12bBLFoSbxetOj7MaYAuHCkJPQQOXdcMh3TLLSgxmQzEWkIHSUo760/2Qfd2uDDOTVfZZqiFjiOwDQ7YQjkokqNaC3U9gEq+LBJ+IgEkwaCsluXYMIK0Wvqx1DFa82pg8bSYGczJfTw/1kQsUUTpmao6ChZw3yrHTPow38onD95f9i6yVcnhSpPfM/JTQuL4N6Jdcql6VRJNSvCHJvEgh6R2p0w7DJhEGIzkFaF3lPdBqw+Mm97fBPvznscd4s6gpH07gUl/T+vlyHyRBLm85Pgm70r4MQ+c/nGOQOXzFMNpO8RIot/uhd7t3bvSi6yFzZQm7P9QLCLm/0C84x0sCugjeN/hVA347FWnuRPcya5xPzlpTWAW7pCjheAz0mvnPUMYT6Wp4CJx6bPdePnaiLFSeK8EyQIU9IUQJgXqMA3cOwqMBdh/0r71fTInPdgXsVxabmGbCgIuK3A2hSgxpcZv9412T0NIJYSTi0s2B3dyAaZJrdF5wa1hIr8au63SWFJww3GEEOF5YObEyVvKj2yS40iaHaRrfn1DeALT0eD0oN1zzK66FKbFuDmZmm4Thel9gKt+QcnR2uHlFLEBUogpIXyeC8zca7SOppANloOpO4mBbf22dXBJogenVd425JWaXOHJ6NVqIBw="); + public final static SkinData LOVE_DOCTOR = new SkinData("eyJ0aW1lc3RhbXAiOjE0ODQ0MzM1MjQxMjAsInByb2ZpbGVJZCI6IjlmY2FlZDhiMTRiNTRmN2ZhNjRjYjYwNDBlNzA1MjcyIiwicHJvZmlsZU5hbWUiOiJMQ2FzdHIxIiwic2lnbmF0dXJlUmVxdWlyZWQiOnRydWUsInRleHR1cmVzIjp7IlNLSU4iOnsidXJsIjoiaHR0cDovL3RleHR1cmVzLm1pbmVjcmFmdC5uZXQvdGV4dHVyZS9iY2RiZTM2OTM1NGZjMzUxY2RhNGRmY2Y2OWM0MzY3ODcwYjI4ZWE3NDUzYWVjM2IzMjgyM2YyMWMzNTJlNTUifX19", "KD0NsKFlS+9/JpPQdT0Lq2jo942WeHpFevJPR3T9JO/5NVmNprupsWuTgepw14iHoax8/xyP8S4XksYq8hJ30e+gRKXVReqtq4l8JetXJILI7JTL6EHj/Flg4t0O6ASIm3Hr+w86IKrPb0NwHTjHJHvbf0r7k3E/TMLbq0/c7Xgi+JgC0uQd+wIPZhQe92P3O7eGH858X0vsxG0FVzgnEAlHVLmqBCwqxMU5CsBp0JCTVIbtp+JNmveCsfLagP6mi39rUudbueXJQgqLv7H7Zw+ZNINLLaKPNVO6Od8sX3c+CSUQ+Bm9bakYr628k/z0krTdNpLG7OGXWoT3XShW6HXB/z7o7hpuDXJW7HdyvmWv9GVyWLm2USNe7/3Ugs2zWZI1f+t6t+V3EVr3T+nR4zpY/ISdlTsLtV/Daebr0v/V0YlaM0UaASzz16ob3p1cfao7C7BZwKqOBKoSyHpnuLhd70wOtNrhhPDU9dWQBC/l6uojcMJ9lQMsxFmHj4JFqJYl7p/UXnq1vnYBo1P3A//IGl4gL1Hv8U0I14LT77/AMYH57mItgD0/VnE4bvPIFML/4cX7L9qpdLoOAAyfa5P9cAfzhUnVnRRLM016MpGtvY8SfbZ68Of1Xjz/dZ9/fBEcObXPHGX2QNuJRFiWJjRVKjO7ok0qfiVUEmuZr6I="); // Comments this out for now, so it doesn't load the player profile // A better way to do this would check for the properties when getting the skull or the skin diff --git a/Plugins/Mineplex.Core/src/mineplex/core/timing/TimeData.java b/Plugins/Mineplex.Core.Common/src/mineplex/core/common/timing/TimeData.java similarity index 94% rename from Plugins/Mineplex.Core/src/mineplex/core/timing/TimeData.java rename to Plugins/Mineplex.Core.Common/src/mineplex/core/common/timing/TimeData.java index 2a00de525..28f56221e 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/timing/TimeData.java +++ b/Plugins/Mineplex.Core.Common/src/mineplex/core/common/timing/TimeData.java @@ -1,4 +1,4 @@ -package mineplex.core.timing; +package mineplex.core.common.timing; public class TimeData { diff --git a/Plugins/Mineplex.Core/src/mineplex/core/timing/TimingManager.java b/Plugins/Mineplex.Core.Common/src/mineplex/core/common/timing/TimingManager.java similarity index 76% rename from Plugins/Mineplex.Core/src/mineplex/core/timing/TimingManager.java rename to Plugins/Mineplex.Core.Common/src/mineplex/core/common/timing/TimingManager.java index 8935e5eb4..14bd0ecbb 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/timing/TimingManager.java +++ b/Plugins/Mineplex.Core.Common/src/mineplex/core/common/timing/TimingManager.java @@ -1,17 +1,11 @@ -package mineplex.core.timing; +package mineplex.core.common.timing; import java.util.Map.Entry; -import org.bukkit.event.Listener; -import org.bukkit.plugin.java.JavaPlugin; - import mineplex.core.common.util.NautHashMap; -public class TimingManager implements Listener +public class TimingManager { - private static TimingManager _instance; - - private JavaPlugin _plugin; private static NautHashMap _timingList = new NautHashMap(); private static NautHashMap _totalList = new NautHashMap(); @@ -20,30 +14,6 @@ public class TimingManager implements Listener public static boolean Debug = true; - protected TimingManager(JavaPlugin plugin) - { - _instance = this; - - _plugin = plugin; - - _plugin.getServer().getPluginManager().registerEvents(this, _plugin); - } - - public static TimingManager Initialize(JavaPlugin plugin) - { - if (_instance == null) - { - _instance = new TimingManager(plugin); - } - - return _instance; - } - - public static TimingManager instance() - { - return _instance; - } - public static void startTotal(String title) { if (!Debug) diff --git a/Plugins/Mineplex.Core.Common/src/mineplex/core/common/util/F.java b/Plugins/Mineplex.Core.Common/src/mineplex/core/common/util/F.java index 08d6147ad..49da7d9cf 100644 --- a/Plugins/Mineplex.Core.Common/src/mineplex/core/common/util/F.java +++ b/Plugins/Mineplex.Core.Common/src/mineplex/core/common/util/F.java @@ -104,6 +104,11 @@ public class F return rank.getColor() + cmd + " " + C.mBody + body + " " + rank(rank); } + public static String help(String cmd, String body, Rank rank, ChatColor displayColor) + { + return displayColor + cmd + " " + C.mBody + body + " " + rank(rank); + } + public static String rank(Rank rank) { if (rank == Rank.ALL) diff --git a/Plugins/Mineplex.Core.Common/src/mineplex/core/common/util/PlayerMap.java b/Plugins/Mineplex.Core.Common/src/mineplex/core/common/util/PlayerMap.java index 426d2fd20..5cb6e7758 100644 --- a/Plugins/Mineplex.Core.Common/src/mineplex/core/common/util/PlayerMap.java +++ b/Plugins/Mineplex.Core.Common/src/mineplex/core/common/util/PlayerMap.java @@ -4,6 +4,7 @@ import com.google.common.collect.Sets; import org.apache.commons.lang3.Validate; import org.bukkit.entity.Player; import org.bukkit.event.EventHandler; +import org.bukkit.event.EventPriority; import org.bukkit.event.Listener; import org.bukkit.event.player.PlayerQuitEvent; @@ -218,7 +219,7 @@ public class PlayerMap implements Map private static class RemovalListener implements Listener { - @EventHandler + @EventHandler (priority = EventPriority.MONITOR) public void onQuit(PlayerQuitEvent event) { synchronized (LOCK) diff --git a/Plugins/Mineplex.Core.Common/src/mineplex/core/common/util/UtilBlock.java b/Plugins/Mineplex.Core.Common/src/mineplex/core/common/util/UtilBlock.java index 201f36c2f..6a43363de 100644 --- a/Plugins/Mineplex.Core.Common/src/mineplex/core/common/util/UtilBlock.java +++ b/Plugins/Mineplex.Core.Common/src/mineplex/core/common/util/UtilBlock.java @@ -1,8 +1,11 @@ package mineplex.core.common.util; +import java.lang.reflect.Field; import java.util.ArrayList; import java.util.HashMap; import java.util.HashSet; +import java.util.Set; +import java.util.UUID; import org.bukkit.Location; import org.bukkit.Material; @@ -27,7 +30,11 @@ import org.bukkit.inventory.meta.BannerMeta; import org.bukkit.inventory.meta.SkullMeta; import org.bukkit.material.Bed; +import com.mojang.authlib.GameProfile; + +import mineplex.core.common.Pair; import mineplex.core.common.block.MultiBlockUpdaterAgent; +import mineplex.core.common.skin.SkinData; import net.minecraft.server.v1_8_R3.BlockPosition; import net.minecraft.server.v1_8_R3.Blocks; import net.minecraft.server.v1_8_R3.IBlockData; @@ -496,8 +503,6 @@ public class UtilBlock * @param location of explosion * @param strength of explosion * @param damageBlocksEqually - Treat all blocks as durability of dirt - * @param ensureDestruction - Ensure that the closest blocks are destroyed - * at least * @return */ public static ArrayList getExplosionBlocks(Location location, float strength, boolean damageBlocksEqually) @@ -1646,5 +1651,58 @@ public class UtilBlock { return liquid(block.getType()); } + + public static Skull blockToSkull(Block block, SkinData skinData) throws Exception + { + block.setType(Material.SKULL); + block.setData((byte) 1); + if (block.getState() instanceof Skull) + { + Skull skull = (Skull) block.getState(); + skull.setSkullType(SkullType.PLAYER); + Field field = Class.forName("org.bukkit.craftbukkit.v1_8_R3.block.CraftSkull").getDeclaredField("profile"); + field.setAccessible(true); + GameProfile data = new GameProfile(UUID.randomUUID(), SkinData.getUnusedSkullName()); + data.getProperties().put("textures", skinData.getProperty()); + field.set(skull, data); + skull.update(); + return skull; + } + return null; + } + + /** + * Returns a {@link Set} containing all the relevant data regarding beacon construction. + * Useful for adding them to block restore. + * + * @param surface + * The Location of the glass coloured block (at surface level). The beacon is placed one block below this. + * @param glassData + * The colour data value of glass that colours the beacon + */ + public static Set>> getBeaconBlocks(Location surface, byte glassData) + { + Set>> blocks = new HashSet<>(); + + for (int x = -1; x <= 1; x++) + { + for (int z = -1; z <= 1; z++) + { + blocks.add(Pair.create(surface.clone().add(x, -3, z), Pair.create(Material.IRON_BLOCK, (byte) 0))); + + if (x == 0 && z == 0) + { + continue; + } + + blocks.add(Pair.create(surface.clone().add(x, -1, z), Pair.create(Material.QUARTZ_BLOCK, (byte) 0))); + } + } + + blocks.add(Pair.create(surface.clone().add(0, -2, 0), Pair.create(Material.BEACON, (byte) 0))); + blocks.add(Pair.create(surface.clone().add(0, -1, 0), Pair.create(Material.STAINED_GLASS, glassData))); + + return blocks; + } } diff --git a/Plugins/Mineplex.Core.Common/src/mineplex/core/common/util/UtilEnt.java b/Plugins/Mineplex.Core.Common/src/mineplex/core/common/util/UtilEnt.java index ee6eed0df..062823754 100644 --- a/Plugins/Mineplex.Core.Common/src/mineplex/core/common/util/UtilEnt.java +++ b/Plugins/Mineplex.Core.Common/src/mineplex/core/common/util/UtilEnt.java @@ -6,6 +6,25 @@ import java.util.HashMap; import java.util.LinkedList; 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.NBTTagCompound; +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.Location; import org.bukkit.Material; @@ -29,26 +48,9 @@ import org.bukkit.inventory.ItemStack; import org.bukkit.metadata.FixedMetadataValue; 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 static final String FLAG_NO_REMOVE = "noremove"; //Custom Entity Names private static HashMap _nameMap = new HashMap(); @@ -67,7 +69,34 @@ public class UtilEnt public static void silence(Entity entity, boolean silence) { - ((CraftEntity)entity).getHandle().setSilent(silence); + net.minecraft.server.v1_8_R3.Entity nmsEntity = ((CraftEntity) entity).getHandle(); + NBTTagCompound tag = new NBTTagCompound(); + nmsEntity.c(tag); + tag.setByte("Silent", (byte) ((silence) ? 1 : 0)); + nmsEntity.f(tag); + // Not working right now + //((CraftEntity)entity).getHandle().setSilent(silence); + } + + public static void addFlag(Entity entity, String flag) + { + if (entity == null) + return; + + entity.setMetadata("flag:" + flag, new FixedMetadataValue(UtilServer.getPlugin(), true)); + } + + public static void removeFlag(Entity entity, String flag) + { + if (entity == null) + return; + + entity.removeMetadata("flag:" + flag, UtilServer.getPlugin()); + } + + public static boolean hasFlag(Entity entity, String flag) + { + return entity.hasMetadata("flag:" + flag); } public static void ghost(Entity entity, boolean ghost, boolean invisible) @@ -81,7 +110,7 @@ public class UtilEnt ((CraftEntity)entity).getHandle().setInvisible(invisible); } - public static void Leash(LivingEntity leashed, Entity holder, boolean pull, boolean breakable) + public static void leash(LivingEntity leashed, Entity holder, boolean pull, boolean breakable) { leashed.setLeashHolder(holder); @@ -191,12 +220,12 @@ public class UtilEnt return box.b(box2); } - public static void Vegetate(Entity entity) + public static void vegetate(Entity entity) { - Vegetate(entity, false); + vegetate(entity, false); } - public static void Vegetate(Entity entity, boolean mute) + public static void vegetate(Entity entity, boolean mute) { try { diff --git a/Plugins/Mineplex.Core.Common/src/mineplex/core/common/util/UtilInv.java b/Plugins/Mineplex.Core.Common/src/mineplex/core/common/util/UtilInv.java index f7b6cbec7..accd913e7 100644 --- a/Plugins/Mineplex.Core.Common/src/mineplex/core/common/util/UtilInv.java +++ b/Plugins/Mineplex.Core.Common/src/mineplex/core/common/util/UtilInv.java @@ -3,6 +3,8 @@ package mineplex.core.common.util; import java.lang.reflect.Field; import java.util.ArrayList; import java.util.HashSet; +import java.util.List; +import java.util.function.Predicate; import org.bukkit.Material; import org.bukkit.enchantments.Enchantment; @@ -447,6 +449,21 @@ public class UtilInv return false; } + + public static boolean hasSpace(Player player, int slots) + { + int slotsFree = 0; + + for (int slot = 0; slot < player.getInventory().getSize(); slot++) + { + if (player.getInventory().getItem(slot) == null) + { + slotsFree++; + } + } + + return slotsFree >= slots; + } public static void give(Player player, Material material) { @@ -462,5 +479,35 @@ public class UtilInv { shooter.getInventory().addItem(new ItemStack(material, amount, data)); } - + + /** + * Checks if an InventoryClickEvent should be cancelled based on the given predicate. The predicate should return true + * if the given ItemStack is one that should not be moved + */ + public static boolean shouldCancelEvent(InventoryClickEvent event, Predicate predicate) + { + List check = new ArrayList<>(); + + if (event.getHotbarButton() != -1) + { + check.add(event.getWhoClicked().getInventory().getItem(event.getHotbarButton())); // Check item in hotbar slot + ItemStack other = event.getCurrentItem(); + if (other != null && other.getType() != Material.AIR) + check.add(other); // Check the other slot (where the cursor is) + } + else + { + ItemStack other = event.getCurrentItem(); + if (other != null && other.getType() != Material.AIR) + check.add(other); // Check the clicked item + } + + for (ItemStack item : check) + { + if (predicate.test(item)) + return true; + } + + return false; + } } diff --git a/Plugins/Mineplex.Core.Common/src/mineplex/core/common/util/UtilItem.java b/Plugins/Mineplex.Core.Common/src/mineplex/core/common/util/UtilItem.java index 6869beb84..3f933517b 100644 --- a/Plugins/Mineplex.Core.Common/src/mineplex/core/common/util/UtilItem.java +++ b/Plugins/Mineplex.Core.Common/src/mineplex/core/common/util/UtilItem.java @@ -8,6 +8,7 @@ import java.util.LinkedList; import java.util.List; import java.util.Map; import java.util.Map.Entry; +import java.util.Objects; import net.minecraft.server.v1_8_R3.NBTTagCompound; import net.minecraft.server.v1_8_R3.NBTTagLong; @@ -1289,4 +1290,112 @@ public class UtilItem } } + + public static boolean doesDisplayNameContain(ItemStack item, String name) + { + if (item == null) + return false; + if (item.getItemMeta() == null) + return false; + if (item.getItemMeta().getDisplayName() == null) + return false; + return item.getItemMeta().getDisplayName().contains(name); + } + + public static String getDisplayName(ItemStack itemStack) + { + if (itemStack == null) + return null; + + if (itemStack.getItemMeta() == null) + return null; + + if (itemStack.getItemMeta().getDisplayName() == null) + return null; + + return itemStack.getItemMeta().getDisplayName(); + } + + public static boolean isSimilar(ItemStack a, ItemStack b, ItemAttribute... attributes) + { + for (ItemAttribute attr : attributes) + { + if (!attr.isEqual(a, b)) + { + return false; + } + } + return true; + } + + public enum ItemAttribute + { + MATERIAL + { + @Override + public boolean isEqual(ItemStack a, ItemStack b) + { + return a == null ? b == null : b != null && a.getType() == b.getType(); + } + }, + DATA + { + @Override + public boolean isEqual(ItemStack a, ItemStack b) + { + return a == null ? b == null : b != null && a.getData().getData() == b.getData().getData(); + } + }, + AMOUNT + { + @Override + public boolean isEqual(ItemStack a, ItemStack b) + { + return a == null ? b == null : b != null && a.getAmount() == b.getAmount(); + } + }, + NAME + { + @Override + public boolean isEqual(ItemStack a, ItemStack b) + { + if (a == null) + { + return b == null; + } + else + { + if (b == null) + { + return false; + } + } + ItemMeta ma = a.getItemMeta(); + ItemMeta mb = b.getItemMeta(); + if (ma == null) + { + return mb == null; + } + else + { + if (mb == null) + { + return false; + } + } + + return Objects.equals(ma.getDisplayName(), mb.getDisplayName()); + } + }, + LORE + { + @Override + public boolean isEqual(ItemStack a, ItemStack b) + { + return a == null ? b == null : b != null && Objects.equals(a.getItemMeta().getLore(), b.getItemMeta().getLore()); + } + }; + + public abstract boolean isEqual(ItemStack a, ItemStack b); + } } diff --git a/Plugins/Mineplex.Core.Common/src/mineplex/core/common/util/UtilParser.java b/Plugins/Mineplex.Core.Common/src/mineplex/core/common/util/UtilParser.java index 453904e1e..47c3ba612 100644 --- a/Plugins/Mineplex.Core.Common/src/mineplex/core/common/util/UtilParser.java +++ b/Plugins/Mineplex.Core.Common/src/mineplex/core/common/util/UtilParser.java @@ -6,6 +6,8 @@ public class UtilParser { public static String parseDamageCause(EntityDamageEvent.DamageCause cause) { + if (cause == null) + return "Unknown"; switch (cause) { case CONTACT: diff --git a/Plugins/Mineplex.Core.Common/src/mineplex/core/common/util/UtilParticle.java b/Plugins/Mineplex.Core.Common/src/mineplex/core/common/util/UtilParticle.java index abe2a726f..0945ad7fd 100644 --- a/Plugins/Mineplex.Core.Common/src/mineplex/core/common/util/UtilParticle.java +++ b/Plugins/Mineplex.Core.Common/src/mineplex/core/common/util/UtilParticle.java @@ -1,14 +1,18 @@ package mineplex.core.common.util; +import java.util.ArrayList; +import java.util.List; + +import net.minecraft.server.v1_8_R3.EnumParticle; +import net.minecraft.server.v1_8_R3.PacketPlayOutWorldParticles; + import org.bukkit.Color; +import org.bukkit.GameMode; import org.bukkit.Location; import org.bukkit.Material; import org.bukkit.entity.Player; import org.bukkit.util.Vector; -import net.minecraft.server.v1_8_R3.EnumParticle; -import net.minecraft.server.v1_8_R3.PacketPlayOutWorldParticles; - public class UtilParticle { public enum ViewDist @@ -52,22 +56,22 @@ public class UtilParticle ANGRY_VILLAGER(EnumParticle.VILLAGER_ANGRY, "angryVillager", "Lightning Cloud", Material.INK_SACK, (byte) 11), BLOCK_CRACK(EnumParticle.BLOCK_CRACK, "blockcrack") - { - @Override - public String getParticle(Material type, int data) - { - return "blockcrack_" + type.getId() + "_" + data; - } - }, + { + @Override + public String getParticle(Material type, int data) + { + return "blockcrack_" + type.getId() + "_" + data; + } + }, BLOCK_DUST(EnumParticle.BLOCK_DUST, "blockdust") - { - @Override - public String getParticle(Material type, int data) - { - return "blockdust_" + type.getId() + "_" + data; - } - }, + { + @Override + public String getParticle(Material type, int data) + { + return "blockdust_" + type.getId() + "_" + data; + } + }, BUBBLE(EnumParticle.WATER_BUBBLE, "bubble"), @@ -100,20 +104,20 @@ public class UtilParticle HUGE_EXPLOSION(EnumParticle.EXPLOSION_HUGE, "hugeexplosion", "Huge Explosion", Material.TNT, (byte) 0), ICON_CRACK(EnumParticle.ITEM_CRACK, "iconcrack") - { - @Override - public String getParticle(Material type, int data) - { - return "iconcrack_" + type.getId() + "_" + data; - } - }, + { + @Override + public String getParticle(Material type, int data) + { + return "iconcrack_" + type.getId() + "_" + data; + } + }, INSTANT_SPELL(EnumParticle.SPELL_INSTANT, "instantSpell"), LARGE_EXPLODE(EnumParticle.EXPLOSION_LARGE, "largeexplode", "Explosion", Material.FIREBALL, (byte) 0), LARGE_SMOKE(EnumParticle.SMOKE_LARGE, "largesmoke", "Black Smoke", Material.INK_SACK, (byte) 0), - + SMOKE(EnumParticle.SMOKE_NORMAL, "smoke", "Smoke", Material.INK_SACK, (byte) 0), LAVA(EnumParticle.LAVA, "lava", "Lava Debris", Material.LAVA, (byte) 0), @@ -132,8 +136,8 @@ public class UtilParticle .getMaterial(2266), (byte) 0), /** - * To do certain colors, use "no / 24F" for the random X value, 1 for speed. 0 for count. - */ + * To do certain colors, use "no / 24F" for the random X value, 1 for speed. 0 for count. + */ NOTE(EnumParticle.NOTE, "note", "Musical Note", Material.JUKEBOX, (byte) 0), PORTAL(EnumParticle.PORTAL, "portal", "Portal Effect", Material.INK_SACK, (byte) 5), @@ -234,7 +238,7 @@ public class UtilParticle } private static PacketPlayOutWorldParticles getPacket(String particleName, Location location, float offsetX, float offsetY, - float offsetZ, float speed, int count, boolean displayFar) + float offsetZ, float speed, int count, boolean displayFar) { String[] parts = particleName.split("_"); int[] details = new int[parts.length - 1]; @@ -260,19 +264,75 @@ public class UtilParticle return packet; } - - public static void PlayParticle(ParticleType type,Location location, float offsetX, float offsetY, + + public static void PlayParticle(ParticleType type, Location location, float offsetX, float offsetY, float offsetZ, float speed, int count, ViewDist dist) { PlayParticle(type, location, offsetX, offsetY, offsetZ, speed, count, dist, UtilServer.getPlayers()); } + public static void playParticleFor(Player player, ParticleType type, Location location, Vector offset, float speed, int count, ViewDist dist) + { + if (player.getGameMode() == GameMode.SPECTATOR) + return; + float x = 0; + float y = 0; + float z = 0; + if (offset != null) + { + x = (float) offset.getX(); + y = (float) offset.getY(); + z = (float) offset.getZ(); + } + List players = new ArrayList<>(UtilServer.getPlayersCollection()); + players.removeIf(other -> !other.canSee(player)); + PlayParticle(type, location, x, y, z, speed, count, dist, players.toArray(new Player[0])); + } + + public static void playParticleFor(Player player, ParticleType type, Location location, float offsetX, float offsetY, float offsetZ, + float speed, int count, ViewDist dist) + { + if (player.getGameMode() == GameMode.SPECTATOR) + return; + List players = new ArrayList<>(UtilServer.getPlayersCollection()); + players.removeIf(other -> !other.canSee(player)); + PlayParticle(type.particleName, location, offsetX, offsetY, offsetZ, speed, count, dist, players.toArray(new Player[0])); + } + + public static void playParticleFor(Player player, String particle, Location location, Vector offset, float speed, int count, ViewDist dist) + { + if (player.getGameMode() == GameMode.SPECTATOR) + return; + float x = 0; + float y = 0; + float z = 0; + if (offset != null) + { + x = (float) offset.getX(); + y = (float) offset.getY(); + z = (float) offset.getZ(); + } + List players = new ArrayList<>(UtilServer.getPlayersCollection()); + players.removeIf(other -> !other.canSee(player)); + PlayParticle(particle, location, x, y, z, speed, count, dist, players.toArray(new Player[0])); + } + + public static void playParticleFor(Player player, String particle, Location location, float offsetX, float offsetY, float offsetZ, + float speed, int count, ViewDist dist) + { + if (player.getGameMode() == GameMode.SPECTATOR) + return; + List players = new ArrayList<>(UtilServer.getPlayersCollection()); + players.removeIf(other -> !other.canSee(player)); + PlayParticle(particle, location, offsetX, offsetY, offsetZ, speed, count, dist, players.toArray(new Player[0])); + } + public static void PlayParticleToAll(ParticleType type, Location location, Vector offset, float speed, int count, ViewDist dist) { float x = 0; float y = 0; float z = 0; - if(offset != null) + if (offset != null) { x = (float) offset.getX(); y = (float) offset.getY(); @@ -280,13 +340,14 @@ public class UtilParticle } PlayParticle(type, location, x, y, z, speed, count, dist, UtilServer.getPlayers()); } - + + public static void PlayParticle(ParticleType type, Location location, Vector offset, float speed, int count, ViewDist dist, Player... players) { float x = 0; float y = 0; float z = 0; - if(offset != null) + if (offset != null) { x = (float) offset.getX(); y = (float) offset.getY(); @@ -294,21 +355,21 @@ public class UtilParticle } PlayParticle(type, location, x, y, z, speed, count, dist, players); } - + public static void PlayParticleToAll(ParticleType type, Location location, float offsetX, float offsetY, float offsetZ, - float speed, int count, ViewDist dist) + float speed, int count, ViewDist dist) { PlayParticle(type.particleName, location, offsetX, offsetY, offsetZ, speed, count, dist, UtilServer.getPlayers()); } - + public static void PlayParticle(ParticleType type, Location location, float offsetX, float offsetY, float offsetZ, - float speed, int count, ViewDist dist, Player... players) + float speed, int count, ViewDist dist, Player... players) { PlayParticle(type.particleName, location, offsetX, offsetY, offsetZ, speed, count, dist, players); } public static void PlayParticle(String particle, Location location, float offsetX, float offsetY, float offsetZ, float speed, - int count, ViewDist dist, Player... players) + int count, ViewDist dist, Player... players) { PacketPlayOutWorldParticles packet = getPacket(particle, location, offsetX, offsetY, offsetZ, speed, count, true); @@ -321,13 +382,13 @@ public class UtilParticle UtilPlayer.sendPacket(player, packet); } } - + public static void PlayParticleToAll(String particle, Location location, Vector offset, float speed, int count, ViewDist dist) { float x = 0; float y = 0; float z = 0; - if(offset != null) + if (offset != null) { x = (float) offset.getX(); y = (float) offset.getY(); @@ -335,9 +396,9 @@ public class UtilParticle } PlayParticle(particle, location, x, y, z, speed, count, dist, UtilServer.getPlayers()); } - + public static void PlayParticleToAll(String particle, Location location, float offsetX, float offsetY, float offsetZ, - float speed, int count, ViewDist dist) + float speed, int count, ViewDist dist) { PlayParticle(particle, location, offsetX, offsetY, offsetZ, speed, count, dist, UtilServer.getPlayers()); } @@ -357,5 +418,5 @@ public class UtilParticle return; PlayParticleToAll(particleType, location, color.getRed() / 255F, color.getGreen() / 255F, color.getBlue() / 255F, 1f, count, dist); } - + } \ No newline at end of file diff --git a/Plugins/Mineplex.Core.Common/src/mineplex/core/common/util/UtilPlayer.java b/Plugins/Mineplex.Core.Common/src/mineplex/core/common/util/UtilPlayer.java index 930bf299a..3e7d31f3f 100644 --- a/Plugins/Mineplex.Core.Common/src/mineplex/core/common/util/UtilPlayer.java +++ b/Plugins/Mineplex.Core.Common/src/mineplex/core/common/util/UtilPlayer.java @@ -13,6 +13,8 @@ import java.util.Map; import java.util.Random; import java.util.Set; import java.util.UUID; +import java.util.function.Function; +import java.util.stream.Collectors; import net.md_5.bungee.api.chat.ClickEvent; import net.md_5.bungee.api.chat.ClickEvent.Action; @@ -397,6 +399,18 @@ public class UtilPlayer return UtilServer.getServer().getPlayer(uuid); } + + public static void sendMatches(Player target, String module, Collection matches) + { + sendMatches(target, module, matches, Function.identity()); + } + + public static void sendMatches(Player target, String module, Collection matches, Function mapToString) + { + String matchString = matches.stream().map(mapToString).collect(Collectors.joining(C.mBody + ", " + C.mElem)); + UtilPlayer.message(target, F.main(module, "Matches [" + C.mElem + matchString + C.mBody + "].")); + } + public static String searchCollection(Player caller, String player, Collection coll, String collName, boolean inform) { LinkedList matchList = new LinkedList(); diff --git a/Plugins/Mineplex.Core.Common/src/mineplex/core/common/util/UtilServer.java b/Plugins/Mineplex.Core.Common/src/mineplex/core/common/util/UtilServer.java index 5eef556cf..722b7f174 100644 --- a/Plugins/Mineplex.Core.Common/src/mineplex/core/common/util/UtilServer.java +++ b/Plugins/Mineplex.Core.Common/src/mineplex/core/common/util/UtilServer.java @@ -1,7 +1,11 @@ package mineplex.core.common.util; import com.google.common.collect.Lists; + +import mineplex.core.common.Constants; import mineplex.core.common.events.PlayerRecieveBroadcastEvent; +import mineplex.serverdata.Region; + import org.bukkit.Bukkit; import org.bukkit.Server; import org.bukkit.Sound; @@ -13,12 +17,20 @@ import org.bukkit.plugin.Plugin; import org.bukkit.plugin.PluginManager; import org.bukkit.plugin.java.JavaPlugin; import org.bukkit.scheduler.BukkitRunnable; +import org.bukkit.scheduler.BukkitTask; +import java.io.File; import java.lang.reflect.Field; import java.util.*; public class UtilServer { + private static boolean TEST_OVERRIDE = false; + + static { + TEST_OVERRIDE = new File("TEST_OVERRIDE.dat").exists(); + } + public static Player[] getPlayers() { return getServer().getOnlinePlayers().toArray(new Player[0]); @@ -52,7 +64,7 @@ public class UtilServer { return Bukkit.getServer(); } - + public static void broadcast(String message) { for (Player cur : getPlayers()) @@ -61,13 +73,13 @@ public class UtilServer UtilPlayer.message(cur, message); } } - + public static void broadcast(LinkedList messages) { for (Player cur : getPlayers()) UtilPlayer.message(cur, messages); } - + public static void broadcastSpecial(String event, String message) { for (Player cur : getPlayers()) @@ -78,32 +90,32 @@ public class UtilServer cur.playSound(cur.getLocation(), Sound.ORB_PICKUP, 2f, 0f); } } - + public static void broadcast(String sender, String message) { broadcast("§f§l" + sender + " " + "§b" + message); } - + public static void broadcastMagic(String sender, String message) { broadcast("§2§k" + message); } - - public static double getFilledPercent() + + public static double getFilledPercent() { - return (double)getPlayers().length / (double)UtilServer.getServer().getMaxPlayers(); + return (double) getPlayers().length / (double) UtilServer.getServer().getMaxPlayers(); } - + public static void RegisterEvents(Listener listener) { getPluginManager().registerEvents(listener, getPlugin()); } - + public static void Unregister(Listener listener) { HandlerList.unregisterAll(listener); } - + public static JavaPlugin getPlugin() { return JavaPlugin.getProvidingPlugin(UtilServer.class); @@ -135,13 +147,104 @@ public class UtilServer return getPlugin().getConfig().getString("serverstatus.name"); } + public static Region getRegion() + { + return getPlugin().getConfig().getBoolean("serverstatus.us") ? Region.US : Region.EU; + } + + public static String getGroup() + { + return getPlugin().getConfig().getString("serverstatus.group"); + } + public static boolean isTestServer() { - return getPlugin().getConfig().getString("serverstatus.group").equalsIgnoreCase("Testing"); + return isTestServer(true); + } + + public static boolean isTestServer(boolean bypass) + { + return getPlugin().getConfig().getString("serverstatus.group").equalsIgnoreCase("Testing") || (bypass && TEST_OVERRIDE); + } + + public static boolean isDevServer() + { + return !isTestServer() && isDevServer(getServerName()); + } + + public static boolean isDevServer(String name) + { + try + { + int index = name.lastIndexOf('-'); + if (index != -1) + { + int id = Integer.parseInt(name.substring(index + 1)); + return id >= 777; + } + } + catch (NumberFormatException ex) + { + return false; + } + return false; } public static boolean isHubServer() { return getPlugin().getConfig().getString("serverstatus.group").equalsIgnoreCase("Lobby"); } + + public static void raiseError(RuntimeException throwable) + { + if (isTestServer()) + { + throw throwable; + } + else + { + System.out.println("ERROR WAS RAISED"); + throwable.printStackTrace(System.out); + } + } + + public static String getWebServerURL() + { + return getPlugin().getConfig().getString(Constants.WEB_CONFIG_KEY); + } + + public static BukkitTask runAsync(Runnable runnable) + { + return getPlugin().getServer().getScheduler().runTaskAsynchronously(getPlugin(), runnable); + } + + public static BukkitTask runAsync(Runnable runnable, long time) + { + return getPlugin().getServer().getScheduler().runTaskLaterAsynchronously(getPlugin(), runnable, time); + } + + public static BukkitTask runAsyncTimer(Runnable runnable, long time, long period) + { + return getPlugin().getServer().getScheduler().runTaskTimerAsynchronously(getPlugin(), runnable, time, period); + } + + public static BukkitTask runSync(Runnable runnable) + { + return getPlugin().getServer().getScheduler().runTask(getPlugin(), runnable); + } + + public static BukkitTask runSyncLater(Runnable runnable, long delay) + { + return getPlugin().getServer().getScheduler().runTaskLater(getPlugin(), runnable, delay); + } + + public static BukkitTask runSyncTimer(Runnable runnable, long delay, long period) + { + return getPlugin().getServer().getScheduler().runTaskTimer(getPlugin(), runnable, delay, period); + } + + public static BukkitTask runSyncTimer(BukkitRunnable runnable, long delay, long period) + { + return runnable.runTaskTimer(getPlugin(), delay, period); + } } diff --git a/Plugins/Mineplex.Core.Common/src/mineplex/core/common/util/UtilShapes.java b/Plugins/Mineplex.Core.Common/src/mineplex/core/common/util/UtilShapes.java index a0bda3026..500cbc5e2 100644 --- a/Plugins/Mineplex.Core.Common/src/mineplex/core/common/util/UtilShapes.java +++ b/Plugins/Mineplex.Core.Common/src/mineplex/core/common/util/UtilShapes.java @@ -97,6 +97,10 @@ public class UtilShapes public static BlockFace getFacing(float yaw) { + while (yaw < 0) + { + yaw += 360; + } return radial[Math.round(yaw / 45f) % 8]; } diff --git a/Plugins/Mineplex.Core.Common/src/mineplex/core/common/util/UtilTasks.java b/Plugins/Mineplex.Core.Common/src/mineplex/core/common/util/UtilTasks.java index 6e71d4002..b873010cf 100644 --- a/Plugins/Mineplex.Core.Common/src/mineplex/core/common/util/UtilTasks.java +++ b/Plugins/Mineplex.Core.Common/src/mineplex/core/common/util/UtilTasks.java @@ -31,10 +31,13 @@ public class UtilTasks { return t -> { - onMainThread(() -> + if (original != null) { - original.accept(t); - }); + onMainThread(() -> + { + original.accept(t); + }).run(); + } }; } } diff --git a/Plugins/Mineplex.Core.Common/src/mineplex/core/common/util/UtilText.java b/Plugins/Mineplex.Core.Common/src/mineplex/core/common/util/UtilText.java index c151fcf84..66b9c562a 100644 --- a/Plugins/Mineplex.Core.Common/src/mineplex/core/common/util/UtilText.java +++ b/Plugins/Mineplex.Core.Common/src/mineplex/core/common/util/UtilText.java @@ -778,7 +778,8 @@ public class UtilText * @param s The string * @return A buffered image containing the text */ - public static BufferedImage stringToBufferedImage(Font font, String s) { + public static BufferedImage stringToBufferedImage(Font font, String s) + { BufferedImage img = new BufferedImage(1, 1, BufferedImage.TYPE_4BYTE_ABGR); Graphics g = img.getGraphics(); g.setFont(font); @@ -801,4 +802,30 @@ public class UtilText return img; } + + static final int MIN_VALUE = 1; + static final int MAX_VALUE = 3999; + static final String[] RN_M = {"", "M", "MM", "MMM"}; + static final String[] RN_C = {"", "C", "CC", "CCC", "CD", "D", "DC", "DCC", "DCCC", "CM"}; + static final String[] RN_X = {"", "X", "XX", "XXX", "XL", "L", "LX", "LXX", "LXXX", "XC"}; + static final String[] RN_I = {"", "I", "II", "III", "IV", "V", "VI", "VII", "VIII", "IX"}; + + public static String toRomanNumeral(int number) + { + if (number < MIN_VALUE || number > MAX_VALUE) + { + throw new IllegalArgumentException( + String.format( + "The number must be in the range [%d, %d]", + MIN_VALUE, + MAX_VALUE + ) + ); + } + + return RN_M[number / 1000] + + RN_C[number % 1000 / 100] + + RN_X[number % 100 / 10] + + RN_I[number % 10]; + } } \ No newline at end of file diff --git a/Plugins/Mineplex.Core.Common/src/mineplex/core/common/util/particles/DustSpellColor.java b/Plugins/Mineplex.Core.Common/src/mineplex/core/common/util/particles/DustSpellColor.java index f3cb0466b..31ff46ed1 100644 --- a/Plugins/Mineplex.Core.Common/src/mineplex/core/common/util/particles/DustSpellColor.java +++ b/Plugins/Mineplex.Core.Common/src/mineplex/core/common/util/particles/DustSpellColor.java @@ -1,6 +1,6 @@ package mineplex.core.common.util.particles; -import org.bukkit.Color; +import java.awt.Color; public class DustSpellColor extends ParticleColor { diff --git a/Plugins/Mineplex.Core/pom.xml b/Plugins/Mineplex.Core/pom.xml index c4dbb202a..afbd561ec 100644 --- a/Plugins/Mineplex.Core/pom.xml +++ b/Plugins/Mineplex.Core/pom.xml @@ -43,7 +43,27 @@ com.mineplex anticheat - 1.2 + 1.3 + + + org.tukaani + xz + 1.5 + + + com.warrenstrange + googleauth + 1.1.1 + + + com.google.zxing + core + 3.3.0 + + + junit + junit + test diff --git a/Plugins/Mineplex.Core/src/mineplex/core/CustomTagFix.java b/Plugins/Mineplex.Core/src/mineplex/core/CustomTagFix.java index 8372203e6..c4ea24040 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/CustomTagFix.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/CustomTagFix.java @@ -9,6 +9,17 @@ import java.util.Map.Entry; import java.util.Set; import java.util.UUID; +import mineplex.core.common.DummyEntity; +import mineplex.core.common.MinecraftVersion; +import mineplex.core.common.util.UtilPlayer; +import mineplex.core.event.CustomTagEvent; +import mineplex.core.packethandler.IPacketHandler; +import mineplex.core.common.util.UtilEnt; +import mineplex.core.packethandler.PacketHandler; +import mineplex.core.packethandler.PacketVerifier; +import mineplex.core.packethandler.PacketInfo; +import mineplex.core.updater.UpdateType; +import mineplex.core.updater.event.UpdateEvent; import net.minecraft.server.v1_8_R3.DataWatcher; import net.minecraft.server.v1_8_R3.DataWatcher.WatchableObject; import net.minecraft.server.v1_8_R3.Entity; @@ -120,6 +131,9 @@ public class CustomTagFix extends MiniPlugin implements IPacketHandler // wat return; + if (UtilPlayer.getVersion(owner) != MinecraftVersion.Version1_8) + return; + if (!_entityMap.containsKey(owner.getUniqueId())) { _entityMap.put(owner.getUniqueId(), new HashMap<>()); diff --git a/Plugins/Mineplex.Core/src/mineplex/core/MiniClientPlugin.java b/Plugins/Mineplex.Core/src/mineplex/core/MiniClientPlugin.java index c5f2119e1..5f406b27d 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/MiniClientPlugin.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/MiniClientPlugin.java @@ -16,12 +16,17 @@ public abstract class MiniClientPlugin extends MiniPlug private static final Object _clientDataLock = new Object(); private Map _clientData = new HashMap<>(); - - public MiniClientPlugin(String moduleName, JavaPlugin plugin) + + public MiniClientPlugin(String moduleName, JavaPlugin plugin) { super(moduleName, plugin); } - + + public MiniClientPlugin(String moduleName) + { + super(moduleName); + } + @EventHandler public void UnloadPlayer(ClientUnloadEvent event) { diff --git a/Plugins/Mineplex.Core/src/mineplex/core/MiniPlugin.java b/Plugins/Mineplex.Core/src/mineplex/core/MiniPlugin.java index 80c128715..223b31351 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/MiniPlugin.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/MiniPlugin.java @@ -7,30 +7,39 @@ import mineplex.core.common.util.NautHashMap; import mineplex.core.common.util.UtilServer; import mineplex.core.common.util.UtilTime; import mineplex.core.common.util.UtilTime.TimeUnit; +import mineplex.core.lifetimes.Lifetime; +import mineplex.core.lifetimes.Lifetimed; +import mineplex.core.lifetimes.SimpleLifetime; import mineplex.core.thread.ThreadPool; + import org.bukkit.Bukkit; import org.bukkit.event.HandlerList; import org.bukkit.event.Listener; import org.bukkit.plugin.PluginManager; import org.bukkit.plugin.java.JavaPlugin; +import org.bukkit.scheduler.BukkitRunnable; import org.bukkit.scheduler.BukkitScheduler; import org.bukkit.scheduler.BukkitTask; /** * In the future, all implementations of MiniPlugin should only have one constructor: - * + *

* private MiniPlugin() - * + *

* MiniPlugins should also not depend on load order. - * + *

* This way, we can reflectively create them during {@link #require} when they do not exist, leading to much cleaner code */ -public abstract class MiniPlugin implements Listener +public abstract class MiniPlugin implements Listener, Lifetimed { + // As MiniPlugins can technically be disabled at any time, each + // has its own unique Lifetime. If MiniPlugins are declared + // to never be able to be disabled, then a "Singleton" Lifetime + // could be shared between all of them. + private final SimpleLifetime _lifetime = new SimpleLifetime(); protected String _moduleName = "Default"; protected JavaPlugin _plugin; - protected NautHashMap _commands; - + protected long _initializedTime; public MiniPlugin(String moduleName) @@ -40,50 +49,49 @@ public abstract class MiniPlugin implements Listener public MiniPlugin(String moduleName, JavaPlugin plugin) { - _moduleName = moduleName; - _plugin = plugin; - - _initializedTime = System.currentTimeMillis(); + _moduleName = moduleName; + _plugin = plugin; - _commands = new NautHashMap<>(); - + _initializedTime = System.currentTimeMillis(); + + _lifetime.start(); onEnable(); registerEvents(this); Managers.put(this); } - + public PluginManager getPluginManager() { return _plugin.getServer().getPluginManager(); } - + public BukkitScheduler getScheduler() { return _plugin.getServer().getScheduler(); } - + public JavaPlugin getPlugin() { return _plugin; } - + public void registerEvents(Listener listener) { _plugin.getServer().getPluginManager().registerEvents(listener, _plugin); } - + public void registerSelf() { registerEvents(this); } - + public void deregisterSelf() { HandlerList.unregisterAll(this); } - + public final void onEnable() { long epoch = System.currentTimeMillis(); @@ -96,26 +104,32 @@ public abstract class MiniPlugin implements Listener public final void onDisable() { disable(); - + log("Disabled."); } - public void enable() { } - - public void disable() { } - - public void addCommands() { } - + public void enable() + { + } + + public void disable() + { + } + + public void addCommands() + { + } + public final String getName() { return _moduleName; } - + public final void addCommand(ICommand command) { CommandCenter.Instance.addCommand(command); } - + public final void removeCommand(ICommand command) { CommandCenter.Instance.removeCommand(command); @@ -125,39 +139,133 @@ public abstract class MiniPlugin implements Listener { Bukkit.getConsoleSender().sendMessage(F.main(_moduleName, message)); } - + public void runAsync(Runnable runnable) { - ThreadPool.ASYNC.execute(runnable); + Exception exception = new Exception(); + exception.fillInStackTrace(); + ThreadPool.ASYNC.execute(() -> + { + try + { + runnable.run(); + } + catch (Throwable t) + { + exception.initCause(t); + throw new RuntimeException("Exception while executing MiniPlugin task", exception); + } + }); } - + public BukkitTask runAsync(Runnable runnable, long time) { - return _plugin.getServer().getScheduler().runTaskLaterAsynchronously(_plugin, runnable, time); + Exception exception = new Exception(); + exception.fillInStackTrace(); + return _plugin.getServer().getScheduler().runTaskLaterAsynchronously(_plugin, () -> + { + try + { + runnable.run(); + } + catch (Throwable t) + { + exception.initCause(t); + throw new RuntimeException("Exception while executing MiniPlugin task", exception); + } + }, time); } public BukkitTask runAsyncTimer(Runnable runnable, long time, long period) { - return _plugin.getServer().getScheduler().runTaskTimerAsynchronously(_plugin, runnable, time, period); + Exception exception = new Exception(); + exception.fillInStackTrace(); + return _plugin.getServer().getScheduler().runTaskTimerAsynchronously(_plugin, () -> + { + try + { + runnable.run(); + } + catch (Throwable t) + { + exception.initCause(t); + throw new RuntimeException("Exception while executing MiniPlugin task", exception); + } + }, time, period); } public BukkitTask runSync(Runnable runnable) { - return _plugin.getServer().getScheduler().runTask(_plugin, runnable); + Exception exception = new Exception(); + exception.fillInStackTrace(); + return _plugin.getServer().getScheduler().runTask(_plugin, () -> + { + try + { + runnable.run(); + } + catch (Throwable t) + { + exception.initCause(t); + throw new RuntimeException("Exception while executing MiniPlugin task", exception); + } + }); } public BukkitTask runSyncLater(Runnable runnable, long delay) { - return _plugin.getServer().getScheduler().runTaskLater(_plugin, runnable, delay); + Exception exception = new Exception(); + exception.fillInStackTrace(); + return _plugin.getServer().getScheduler().runTaskLater(_plugin, () -> + { + try + { + runnable.run(); + } + catch (Throwable t) + { + exception.initCause(t); + throw new RuntimeException("Exception while executing MiniPlugin task", exception); + } + }, delay); + } + + public BukkitTask runSyncLater(BukkitRunnable runnable, long delay) + { + return runnable.runTaskLater(_plugin, delay); } public BukkitTask runSyncTimer(Runnable runnable, long delay, long period) { - return _plugin.getServer().getScheduler().runTaskTimer(_plugin, runnable, delay, period); + Exception exception = new Exception(); + exception.fillInStackTrace(); + return _plugin.getServer().getScheduler().runTaskTimer(_plugin, () -> + { + try + { + runnable.run(); + } + catch (Throwable t) + { + exception.initCause(t); + throw new RuntimeException("Exception while executing MiniPlugin task", exception); + } + }, delay, period); + } + + public BukkitTask runSyncTimer(BukkitRunnable runnable, long delay, long period) + { + return runnable.runTaskTimer(_plugin, delay, period); } protected T require(Class clazz) { return Managers.require(clazz); } + + @Override + public Lifetime getLifetime() + { + return _lifetime; + } } diff --git a/Plugins/Mineplex.Core/src/mineplex/core/account/CoreClient.java b/Plugins/Mineplex.Core/src/mineplex/core/account/CoreClient.java index 603281907..379dc217d 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/account/CoreClient.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/account/CoreClient.java @@ -68,12 +68,6 @@ public class CoreClient return _accountId; } - public void Delete() - { - _name = null; - _player = null; - } - public void setAccountId(int accountId) { _accountId = accountId; @@ -207,4 +201,23 @@ public class CoreClient UtilPlayer.message(_player, C.cGold + "Your test rank has been reset!"); } } + + public String getRealOrDisguisedName() + { + if (getDisguisedAs() != null) + return getDisguisedAs(); + return getName(); + } + + @Override + public String toString() + { + return "CoreClient{" + + "_accountId=" + _accountId + + ", _name='" + _name + '\'' + + ", _uuid=" + _uuid + + ", _player=" + _player + + ", _rank=" + _rank + + '}'; + } } diff --git a/Plugins/Mineplex.Core/src/mineplex/core/account/CoreClientManager.java b/Plugins/Mineplex.Core/src/mineplex/core/account/CoreClientManager.java index dc68fca79..37ca50942 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/account/CoreClientManager.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/account/CoreClientManager.java @@ -8,33 +8,13 @@ import java.util.Iterator; import java.util.List; import java.util.Map; import java.util.Map.Entry; +import java.util.Set; import java.util.UUID; import java.util.concurrent.ConcurrentHashMap; import java.util.concurrent.atomic.AtomicInteger; import java.util.concurrent.atomic.AtomicReference; import java.util.function.Consumer; -import com.google.gson.Gson; - -import mineplex.cache.player.PlayerCache; -import mineplex.cache.player.PlayerInfo; -import mineplex.core.MiniPlugin; -import mineplex.core.account.command.TestRank; -import mineplex.core.account.command.UpdateRank; -import mineplex.core.account.event.ClientUnloadEvent; -import mineplex.core.account.event.ClientWebResponseEvent; -import mineplex.core.account.repository.AccountRepository; -import mineplex.core.account.repository.token.ClientToken; -import mineplex.core.common.Rank; -import mineplex.core.common.util.Callback; -import mineplex.core.common.util.UUIDFetcher; -import mineplex.core.common.util.UtilPlayer; -import mineplex.core.common.util.UtilTasks; -import mineplex.core.timing.TimingManager; -import mineplex.core.updater.UpdateType; -import mineplex.core.updater.event.UpdateEvent; - -import mineplex.core.utils.UtilGameProfile; import org.bukkit.Bukkit; import org.bukkit.OfflinePlayer; import org.bukkit.entity.Player; @@ -47,6 +27,28 @@ import org.bukkit.event.player.PlayerLoginEvent; import org.bukkit.event.player.PlayerQuitEvent; import org.bukkit.plugin.java.JavaPlugin; +import com.google.common.collect.Sets; +import com.google.gson.Gson; + +import mineplex.cache.player.PlayerCache; +import mineplex.core.MiniPlugin; +import mineplex.core.account.command.TestRank; +import mineplex.core.account.command.UpdateRank; +import mineplex.core.account.event.ClientUnloadEvent; +import mineplex.core.account.event.ClientWebResponseEvent; +import mineplex.core.account.repository.AccountRepository; +import mineplex.core.account.repository.token.ClientToken; +import mineplex.core.common.Rank; +import mineplex.core.common.timing.TimingManager; +import mineplex.core.common.util.Callback; +import mineplex.core.common.util.UUIDFetcher; +import mineplex.core.common.util.UtilPlayer; +import mineplex.core.common.util.UtilTasks; +import mineplex.core.updater.UpdateType; +import mineplex.core.updater.event.UpdateEvent; +import mineplex.core.utils.UtilGameProfile; +import mineplex.core.utils.UtilScheduler; + public class CoreClientManager extends MiniPlugin { private static final Map CLIENT_LOGIN_LOCKS = new ConcurrentHashMap<>(); @@ -65,18 +67,32 @@ public class CoreClientManager extends MiniPlugin private final Rank WHITELIST_BYPASS; - public CoreClientManager(JavaPlugin plugin, String webServer) + private final Set _reservedSlots = Sets.newConcurrentHashSet(); + + public CoreClientManager(JavaPlugin plugin) { - this(plugin, webServer, Rank.MODERATOR); + this(plugin, Rank.MODERATOR); } - public CoreClientManager(JavaPlugin plugin, String webServer, Rank whitelistBypass) + public CoreClientManager(JavaPlugin plugin, Rank whitelistBypass) { super("Client Manager", plugin); _plugin = plugin; - _repository = new AccountRepository(plugin, webServer); + _repository = new AccountRepository(); WHITELIST_BYPASS = whitelistBypass; + + UtilScheduler.runEvery(UpdateType.TICK, this::checkForIllegalAccounts); + } + + private void checkForIllegalAccounts() { + // Use getOnlinePlayers because in the future, I might change UtilServer.getPlayers to account for vanish + for (Player player : Bukkit.getOnlinePlayers()) { + if (Get(player).getAccountId() == -1) { + // ew ew getim outta here + player.kickPlayer("There was a problem logging you in"); + } + } } public AccountRepository getRepository() @@ -102,11 +118,6 @@ public class CoreClientManager extends MiniPlugin oldClient = _clientList.put(uuid, newClient); } - if (oldClient != null) - { - oldClient.Delete(); - } - return newClient; } @@ -125,7 +136,7 @@ public class CoreClientManager extends MiniPlugin public CoreClient Get(String name) { Player p = Bukkit.getPlayerExact(name); - return Get(p.getUniqueId()); + return p != null ? Get(p.getUniqueId()) : null; } public CoreClient Get(UUID uuid) @@ -231,6 +242,17 @@ public class CoreClientManager extends MiniPlugin _repository.getAccountId(uuid, callback); } + public void getOrLoadClient(String playerName, Consumer loadedClient) + { + CoreClient client = Get(playerName); + if (client != null) + { + loadedClient.accept(client); + return; + } + loadClientByName(playerName, loadedClient); + } + public void loadClientByName(final String playerName, final Runnable runnable) { loadClientByName(playerName, client -> runnable.run()); @@ -251,7 +273,9 @@ public class CoreClientManager extends MiniPlugin if (uuid == null) { - uuid = UtilGameProfile.getProfileByName(playerName, false, profile -> {}).get().getId(); + uuid = UtilGameProfile.getProfileByName(playerName, false, profile -> + { + }).get().getId(); } String response = ""; @@ -276,13 +300,7 @@ public class CoreClientManager extends MiniPlugin if (client.getAccountId() > 0) { - PlayerInfo playerInfo = PlayerCache.getInstance().getPlayer(uuid); - - if (playerInfo != null) - { - playerInfo.setAccountId(client.getAccountId()); - PlayerCache.getInstance().addPlayer(playerInfo); - } + PlayerCache.getInstance().updateAccountId(uuid, client.getAccountId()); } loaded.set(client); @@ -342,13 +360,7 @@ public class CoreClientManager extends MiniPlugin if (client.getAccountId() > 0) { - PlayerInfo playerInfo = PlayerCache.getInstance().getPlayer(uuid); - - if (playerInfo != null) - { - playerInfo.setAccountId(client.getAccountId()); - PlayerCache.getInstance().addPlayer(playerInfo); - } + PlayerCache.getInstance().updateAccountId(uuid, client.getAccountId()); } } catch (Exception exception) @@ -433,18 +445,17 @@ public class CoreClientManager extends MiniPlugin if (client.getAccountId() > 0) { - PlayerInfo playerInfo = PlayerCache.getInstance().getPlayer(uuid); - - if (playerInfo != null) - { - client.setNetworkSessionLoginTime(playerInfo.getLoginTime()); - playerInfo.setAccountId(client.getAccountId()); - PlayerCache.getInstance().addPlayer(playerInfo); - } + PlayerCache.getInstance().updateAccountId(uuid, client.getAccountId()); } return !CLIENT_LOGIN_LOCKS.containsKey(client.getName()); } + + public ClientToken loadOfflineClient(UUID uuid) + { + String client = _repository.getClientByUUID(uuid); + return new Gson().fromJson(client, ClientToken.class); + } @EventHandler(priority = EventPriority.LOWEST) public void Login(PlayerLoginEvent event) @@ -467,8 +478,10 @@ public class CoreClientManager extends MiniPlugin client.SetPlayer(event.getPlayer()); + _reservedSlots.remove(event.getPlayer().getUniqueId()); + // Reserved Slot Check - if (Bukkit.getOnlinePlayers().size() >= Bukkit.getServer().getMaxPlayers()) + if (Bukkit.getOnlinePlayers().size() + _reservedSlots.size() >= Bukkit.getServer().getMaxPlayers()) { if (client.GetRank().has(event.getPlayer(), Rank.ULTRA, false)) { @@ -481,6 +494,16 @@ public class CoreClientManager extends MiniPlugin } } + public void reserveFor(UUID player) + { + this._reservedSlots.add(player); + } + + public void unreserve(UUID uuid) + { + _reservedSlots.remove(uuid); + } + @EventHandler public void Kick(PlayerKickEvent event) { @@ -675,4 +698,4 @@ public class CoreClientManager extends MiniPlugin return client.GetRank().has(rank); } -} \ No newline at end of file +} diff --git a/Plugins/Mineplex.Core/src/mineplex/core/account/command/TestRank.java b/Plugins/Mineplex.Core/src/mineplex/core/account/command/TestRank.java index 9387b2cf2..e4ab7147e 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/account/command/TestRank.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/account/command/TestRank.java @@ -7,6 +7,7 @@ import mineplex.core.common.Rank; import mineplex.core.common.util.C; import mineplex.core.common.util.F; import mineplex.core.common.util.UtilPlayer; +import mineplex.core.common.util.UtilServer; import org.bukkit.Bukkit; import org.bukkit.ChatColor; @@ -27,10 +28,8 @@ public class TestRank extends CommandBase UtilPlayer.message(caller, F.main("Permissions", "This requires Permission Rank [" + Rank.SNR_MODERATOR.getTag(false, true) + C.cGray + "].")); return; } - - boolean testServer = Plugin.getPlugin().getConfig().getString("serverstatus.group").equalsIgnoreCase("Testing"); - if (!testServer) + if (!UtilServer.isTestServer()) { UtilPlayer.message(caller, F.main(Plugin.getName(), F.elem("This command can only be used on test servers!"))); return; diff --git a/Plugins/Mineplex.Core/src/mineplex/core/account/command/UpdateRank.java b/Plugins/Mineplex.Core/src/mineplex/core/account/command/UpdateRank.java index 432beb29d..ba8c69ffa 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/account/command/UpdateRank.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/account/command/UpdateRank.java @@ -13,6 +13,7 @@ import mineplex.core.common.util.F; import mineplex.core.common.util.UUIDFetcher; import mineplex.core.common.util.UtilPlayer; import mineplex.core.common.util.UtilServer; +import mineplex.serverdata.commands.UpdateRankCommand; import org.bukkit.Bukkit; import org.bukkit.ChatColor; @@ -52,8 +53,13 @@ public class UpdateRank extends CommandBase UtilPlayer.message(caller, F.main(Plugin.getName(), ChatColor.RED + "" + ChatColor.BOLD + "Invalid rank!")); return; } - + final Rank rank = tempRank; + + Plugin.runAsync(() -> + { + new UpdateRankCommand(caller.getName(), caller.getUniqueId().toString(), playerName, rank.name()).publish(); + }); Plugin.getRepository().matchPlayerName(new Callback>() { diff --git a/Plugins/Mineplex.Core/src/mineplex/core/account/repository/AccountRepository.java b/Plugins/Mineplex.Core/src/mineplex/core/account/repository/AccountRepository.java index e30cabf81..789914489 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/account/repository/AccountRepository.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/account/repository/AccountRepository.java @@ -4,15 +4,15 @@ import java.sql.Connection; import java.sql.ResultSet; import java.sql.SQLException; import java.sql.Statement; -import java.sql.Timestamp; import java.util.ArrayList; import java.util.List; import java.util.UUID; +import java.util.function.Consumer; import java.util.stream.Collectors; -import org.bukkit.Bukkit; +import org.apache.commons.dbcp2.BasicDataSource; + import com.google.gson.reflect.TypeToken; -import org.bukkit.plugin.java.JavaPlugin; import mineplex.cache.player.PlayerCache; import mineplex.core.account.ILoginProcessor; @@ -20,48 +20,35 @@ import mineplex.core.account.repository.token.LoginToken; import mineplex.core.account.repository.token.RankUpdateToken; import mineplex.core.common.Rank; import mineplex.core.common.util.Callback; +import mineplex.core.common.util.UtilServer; import mineplex.core.database.MinecraftRepository; -import mineplex.core.server.remotecall.JsonWebCall; import mineplex.serverdata.database.DBPool; -import mineplex.serverdata.database.DatabaseRunnable; import mineplex.serverdata.database.ResultSetCallable; -import mineplex.serverdata.database.column.ColumnBoolean; -import mineplex.serverdata.database.column.ColumnTimestamp; import mineplex.serverdata.database.column.ColumnVarChar; public class AccountRepository extends MinecraftRepository -{ +{ private static String CREATE_ACCOUNT_TABLE = "CREATE TABLE IF NOT EXISTS accounts (id INT NOT NULL AUTO_INCREMENT, uuid VARCHAR(100), name VARCHAR(40), gems INT, rank VARCHAR(40), rankPerm BOOL, rankExpire LONG, lastLogin LONG, totalPlayTime LONG, PRIMARY KEY (id), UNIQUE INDEX uuidIndex (uuid), UNIQUE INDEX nameIndex (name), INDEX rankIndex (rank));"; - private static String ACCOUNT_LOGIN_NEW = "INSERT INTO accounts (uuid, name, lastLogin) values(?, ?, now());"; + private static String ACCOUNT_LOGIN_NEW = "INSERT INTO accounts (uuid, name, lastLogin) values(?, ?, now());"; private static String UPDATE_ACCOUNT_RANK = "UPDATE accounts SET rank=?, rankPerm=false, rankExpire=now() + INTERVAL 1 MONTH WHERE uuid = ?;"; private static String UPDATE_ACCOUNT_RANK_DONOR = "UPDATE accounts SET rank=?, donorRank=?, rankPerm=false, rankExpire=now() + INTERVAL 1 MONTH WHERE uuid = ?;"; private static String UPDATE_ACCOUNT_RANK_PERM = "UPDATE accounts SET rank=?, rankPerm=true WHERE uuid = ?;"; private static String UPDATE_ACCOUNT_RANK_DONOR_PERM = "UPDATE accounts SET rank=?, donorRank=?, rankPerm=true WHERE uuid = ?;"; - private static String UPDATE_ACCOUNT_NULL_RANK = "UPDATE accounts SET rank=?, donorRank=?, rankPerm=?, rankExpire=? WHERE uuid = ? AND rank IS NULL;"; - + private static String SELECT_ACCOUNT_UUID_BY_NAME = "SELECT uuid FROM accounts WHERE name = ? ORDER BY lastLogin DESC;"; private static String SELECT_ACCOUNT_ID_BY_UUID = "SELECT id FROM accounts WHERE accounts.uuid = ? LIMIT 1"; - - private String _webAddress; - - public AccountRepository(JavaPlugin plugin, String webAddress) + + public AccountRepository() { - super(plugin, DBPool.getAccount()); - - _webAddress = webAddress; + super(DBPool.getAccount()); } - @Override - protected void initialize() - { - //executeUpdate(CREATE_ACCOUNT_TABLE); - } - public int login(final List loginProcessors, final UUID uuid, final String name) throws SQLException { // First we try to grab the account id from cache - this saves an extra trip to database int accountId = PlayerCache.getInstance().getAccountId(uuid); + System.out.println("LOGIN... IDLE: " + ((BasicDataSource) DBPool.getAccount()).getNumIdle() + " ACTIVE: " + ((BasicDataSource) DBPool.getAccount()).getNumActive()); try (Connection connection = getConnection(); Statement statement = connection.createStatement()) { if (accountId <= 0) @@ -107,7 +94,9 @@ public class AccountRepository extends MinecraftRepository loginString += loginProcessors.parallelStream().map(processor -> processor.getQuery(finalId, uuidString, name)).collect(Collectors.joining()); statement.execute(loginString); - + + System.out.println("EXECUTE COMPLETE - " + accountId); + statement.getUpdateCount(); statement.getMoreResults(); @@ -128,20 +117,21 @@ public class AccountRepository extends MinecraftRepository } } } - - + + return accountId; } public void getAccountId(UUID uuid, Callback callback) { - executeQuery(SELECT_ACCOUNT_ID_BY_UUID, resultSet -> { + executeQuery(SELECT_ACCOUNT_ID_BY_UUID, resultSet -> + { int accountId = -1; while (resultSet.next()) accountId = resultSet.getInt(1); callback.run(accountId); }, new ColumnVarChar("uuid", 100, uuid.toString())); } - + public String GetClient(String name, UUID uuid, String ipAddress) { LoginToken token = new LoginToken(); @@ -149,18 +139,18 @@ public class AccountRepository extends MinecraftRepository token.Uuid = uuid.toString(); token.IpAddress = ipAddress; - return new JsonWebCall(_webAddress + "PlayerAccount/Login").ExecuteReturnStream(token); + return handleSyncMSSQLCallStream("PlayerAccount/Login", token); } - + public String getClientByUUID(UUID uuid) { - return new JsonWebCall(_webAddress + "PlayerAccount/GetAccountByUUID").ExecuteReturnStream(uuid.toString()); + return handleSyncMSSQLCallStream("PlayerAccount/GetAccountByUUID", uuid.toString()); } public UUID getClientUUID(String name) { final List uuids = new ArrayList(); - + executeQuery(SELECT_ACCOUNT_UUID_BY_NAME, new ResultSetCallable() { @Override @@ -172,93 +162,61 @@ public class AccountRepository extends MinecraftRepository } } }, new ColumnVarChar("name", 100, name)); - + if (uuids.size() > 0) return uuids.get(0); else return null; } - + public void saveRank(final Callback callback, final String name, final UUID uuid, final Rank rank, final boolean perm) { final RankUpdateToken token = new RankUpdateToken(); token.Name = name; token.Rank = rank.toString(); token.Perm = perm; - - final Callback extraCallback = new Callback() + + final Consumer extraCallback = response -> { - public void run(final Rank response) + if (rank == Rank.ULTRA || rank == Rank.HERO || rank == Rank.LEGEND || rank == Rank.TITAN) { - if (rank == Rank.ULTRA || rank == Rank.HERO || rank == Rank.LEGEND || rank == Rank.TITAN) + if (rank.isDonor()) { if (perm) executeUpdate(UPDATE_ACCOUNT_RANK_DONOR_PERM, new ColumnVarChar("rank", 100, rank.toString()), new ColumnVarChar("donorRank", 100, rank.toString()), new ColumnVarChar("uuid", 100, uuid.toString())); else executeUpdate(UPDATE_ACCOUNT_RANK_DONOR, new ColumnVarChar("rank", 100, rank.toString()), new ColumnVarChar("donorRank", 100, rank.toString()), new ColumnVarChar("uuid", 100, uuid.toString())); } + if (perm) + executeUpdate(UPDATE_ACCOUNT_RANK_DONOR_PERM, new ColumnVarChar("rank", 100, rank.toString()), new ColumnVarChar("donorRank", 100, rank.toString()), new ColumnVarChar("uuid", 100, uuid.toString())); else - { - if (perm) - executeUpdate(UPDATE_ACCOUNT_RANK_PERM, new ColumnVarChar("rank", 100, rank.toString()), new ColumnVarChar("uuid", 100, uuid.toString())); - else - executeUpdate(UPDATE_ACCOUNT_RANK, new ColumnVarChar("rank", 100, rank.toString()), new ColumnVarChar("uuid", 100, uuid.toString())); - } - - Bukkit.getServer().getScheduler().runTask(getPlugin(), new Runnable() - { - @Override - public void run() - { - if (callback != null) - callback.run(response); - } - }); + executeUpdate(UPDATE_ACCOUNT_RANK_DONOR, new ColumnVarChar("rank", 100, rank.toString()), new ColumnVarChar("donorRank", 100, rank.toString()), new ColumnVarChar("uuid", 100, uuid.toString())); } + else + { + if (perm) + executeUpdate(UPDATE_ACCOUNT_RANK_PERM, new ColumnVarChar("rank", 100, rank.toString()), new ColumnVarChar("uuid", 100, uuid.toString())); + else + executeUpdate(UPDATE_ACCOUNT_RANK, new ColumnVarChar("rank", 100, rank.toString()), new ColumnVarChar("uuid", 100, uuid.toString())); + } + + UtilServer.runSync(() -> + { + if (callback != null) + callback.run(response); + }); }; - - handleDatabaseCall(new DatabaseRunnable(new Runnable() - { - public void run() - { - new JsonWebCall(_webAddress + "PlayerAccount/RankUpdate").Execute(Rank.class, extraCallback, token); - } - }), "Error saving player " + token.Name + "'s rank in AccountRepository : "); - - } - - public void matchPlayerName(final Callback> callback, final String userName) - { - Thread asyncThread = new Thread(new Runnable() - { - public void run() - { - List tokenList = new JsonWebCall(_webAddress + "PlayerAccount/GetMatches").Execute(new TypeToken>(){}.getType(), userName); - callback.run(tokenList); - } - }); - - asyncThread.start(); + + handleMSSQLCall("PlayerAccount/RankUpdate", String.format("Error saving %s's rank: ", token.Name), token, Rank.class, extraCallback); } - @Override - protected void update() + public void matchPlayerName(final Callback> callback, final String userName) { - } - - public void updateMysqlRank(final String uuid, final String rank, final boolean perm, final String rankExpire) - { - handleDatabaseCall(new DatabaseRunnable(new Runnable() - { - public void run() - { - executeUpdate(UPDATE_ACCOUNT_NULL_RANK, new ColumnVarChar("rank", 100, rank), new ColumnVarChar("donorRank", 100, rank), new ColumnBoolean("rankPerm", perm), new ColumnTimestamp("rankExpire", Timestamp.valueOf(rankExpire)), new ColumnVarChar("uuid", 100, uuid)); - } - }), "Error updating player's mysql rank AccountRepository : "); + handleMSSQLCall("PlayerAccount/GetMatches", userName, new TypeToken>(){}.getType(), callback::run); } public String getClientByName(String playerName) { - return new JsonWebCall(_webAddress + "PlayerAccount/GetAccount").ExecuteReturnStream(playerName); + return handleSyncMSSQLCallStream("PlayerAccount/GetAccount", playerName); } } diff --git a/Plugins/Mineplex.Core/src/mineplex/core/achievement/Achievement.java b/Plugins/Mineplex.Core/src/mineplex/core/achievement/Achievement.java index 7dbe9d5fe..db2e4d154 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/achievement/Achievement.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/achievement/Achievement.java @@ -1,5 +1,11 @@ package mineplex.core.achievement; +import java.util.ArrayList; +import java.util.Collections; +import java.util.HashMap; +import java.util.List; +import java.util.Map; + import mineplex.core.common.util.C; public enum Achievement @@ -161,8 +167,6 @@ public enum Achievement new String[]{"Win a Game With No Armor"}, new int[]{1}, AchievementCategory.SKYWARS), - - //UHC UHC_WINS("Ultimate Winner", 600, @@ -170,9 +174,57 @@ public enum Achievement new String[]{"Win 10 games of Ultra Hardcore"}, new int[]{10}, AchievementCategory.UHC), - + + UHC_FOOD("Fine Dining", 1200, + new String[]{"Ultra Hardcore.Food"}, + new String[]{"Collect and eat every type of food in a game", "Foods needed:", "Apple, Mushroom Stew, Bread, Cooked Porkchop", "Golden Apple, Cooked Fish, Cookie, Melon", "Steak, Cooked Chicken, Carrot, Cooked Potato", "Pumpkin Pie, Cooked Rabbit and Cooked Mutton"}, + new int[]{1}, + AchievementCategory.UHC), + + UHC_MINER("Lucky Miner", 1200, + new String[]{"Ultra Hardcore.Miner"}, + new String[]{"Equip a full set of iron armor within 10 minutes of the game starting"}, + new int[]{1}, + AchievementCategory.UHC), + + UHC_HOE("I Don\'t Need This", 1200, + new String[]{"Ultra Hardcore.Hoe"}, + new String[]{"Craft a diamond hoe"}, + new int[]{1}, + AchievementCategory.UHC), + + UHC_DIE("I Will Not Die!", 1200, + new String[]{"Ultra Hardcore.Die"}, + new String[]{"Drop down to half a heart before healing back up"}, + new int[]{1}, + AchievementCategory.UHC), + + UHC_SPEED_FOOD("Fine Dining", 1200, + new String[]{"Ultra Hardcore Speed.Food"}, + new String[]{"Collect and eat every type of food in a game", "Foods needed:", "Apple, Mushroom Stew, Bread, Cooked Porkchop", "Golden Apple, Cooked Fish, Cookie, Melon", "Steak, Cooked Chicken, Carrot, Cooked Potato", "Pumpkin Pie, Cooked Rabbit and Cooked Mutton"}, + new int[]{1}, + AchievementCategory.UHC_SPEED), + + UHC_SPEED_MINER("Lucky Miner", 1200, + new String[]{"Ultra Hardcore Speed.Miner"}, + new String[]{"Equip a full set of iron armor within 10 minutes of the game starting"}, + new int[]{1}, + AchievementCategory.UHC_SPEED), + + UHC_SPEED_HOE("I Don\'t Need This", 1200, + new String[]{"Ultra Hardcore Speed.Hoe"}, + new String[]{"Craft a diamond hoe"}, + new int[]{1}, + AchievementCategory.UHC_SPEED), + + UHC_SPEED_DIE("I Will Not Die!", 1200, + new String[]{"Ultra Hardcore Speed.Die"}, + new String[]{"Drop down to half a heart before healing back up"}, + new int[]{1}, + AchievementCategory.UHC_SPEED), + //MC League - MC_LEAGUE_STRIKE("First Strike", 600, + /*MC_LEAGUE_STRIKE("First Strike", 600, new String[] {"MC League.FirstStrike"}, new String[] {"Earn 30 First Bloods"}, new int[] {30}, @@ -206,7 +258,7 @@ public enum Achievement new String[] {"MC League.SavingUp"}, new String[] {"Craft a Diamond Chestplate"}, new int[] {1}, - AchievementCategory.MC_LEAGUE), + AchievementCategory.MC_LEAGUE),*/ //UHC WIZARDS_WINS("Supreme Wizard", 600, @@ -1006,7 +1058,7 @@ public enum Achievement AchievementCategory.SPEED_BUILDERS), // OITQP - QUIVER_PAYLOAD_BLOSSOM("Flowering Blossom", 2000, + /*QUIVER_PAYLOAD_BLOSSOM("Flowering Blossom", 2000, new String[]{"One in the Quiver Payload.Blossom"}, new String[]{"Get 4 kills with a single Pyromancer ultimate."}, new int[]{1}, @@ -1034,7 +1086,7 @@ public enum Achievement new String[]{"One in the Quiver Payload.Bow"}, new String[]{"Get 10 kills in a single game without firing an arrow."}, new int[]{1}, - AchievementCategory.ONE_IN_THE_QUIVER_PAYLOAD), + AchievementCategory.ONE_IN_THE_QUIVER_PAYLOAD),*/ // Skyfall SKYFALL_GAMES_WINS("Skyfaller", 600, @@ -1218,4 +1270,24 @@ public enum Achievement { return _gems; } + + private static final Map> BY_CATEGORY; + + static + { + Map> byCategory = new HashMap<>(); + for (Achievement achievement : values()) + { + byCategory.computeIfAbsent(achievement.getCategory(), key -> new ArrayList<>()).add(achievement); + } + Map> immutableByCategory = new HashMap<>(); + byCategory.forEach((key, value) -> immutableByCategory.put(key, Collections.unmodifiableList(value))); + + BY_CATEGORY = Collections.unmodifiableMap(immutableByCategory); + } + + public static List getByCategory(AchievementCategory category) + { + return BY_CATEGORY.get(category); + } } diff --git a/Plugins/Mineplex.Core/src/mineplex/core/achievement/AchievementCategory.java b/Plugins/Mineplex.Core/src/mineplex/core/achievement/AchievementCategory.java index 56115f236..511e97086 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/achievement/AchievementCategory.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/achievement/AchievementCategory.java @@ -46,12 +46,40 @@ public enum AchievementCategory Material.FEATHER, 0, GameCategory.SURVIVAL, "Destructor Kit", false, GameDisplay.Skywars.getGameId(), GameDisplay.SkywarsTeams.getGameId()), UHC("Ultra Hardcore", null, + new StatDisplay[] { + new StatDisplay(C.Bold + "Solo Stats", true), + null, + StatDisplay.fromGame("Wins", GameDisplay.UHCSolo, "Wins"), StatDisplay.fromGame("Games Played", GameDisplay.UHCSolo, "Wins", "Losses"), + StatDisplay.fromGame("Kills", GameDisplay.UHCSolo, "Kills"), StatDisplay.fromGame("Deaths", GameDisplay.UHCSolo, "Deaths"), + StatDisplay.fromGame("Gems Earned", GameDisplay.UHCSolo, "GemsEarned"), + null, + null, + new StatDisplay(C.Bold + "Teams Stats", true), + null, + StatDisplay.fromGame("Wins", GameDisplay.UHC, "Wins"), StatDisplay.fromGame("Games Played", GameDisplay.UHC, "Wins", "Losses"), + StatDisplay.fromGame("Kills", GameDisplay.UHC, "Kills"), StatDisplay.fromGame("Deaths", GameDisplay.UHC, "Deaths"), + StatDisplay.fromGame("Gems Earned", GameDisplay.UHC, "GemsEarned") }, + Material.GOLDEN_APPLE, 0, GameCategory.UHC, "None", false, GameDisplay.UHCSolo.getGameId(), GameDisplay.UHC.getGameId()), + + UHC_SPEED("Ultra Hardcore Speed", null, + new StatDisplay[] { + new StatDisplay(C.Bold + "Solo Stats", true), + null, + StatDisplay.fromGame("Wins", GameDisplay.UHCSoloSpeed, "Wins"), StatDisplay.fromGame("Games Played", GameDisplay.UHCSoloSpeed, "Wins", "Losses"), + StatDisplay.fromGame("Kills", GameDisplay.UHCSoloSpeed, "Kills"), StatDisplay.fromGame("Deaths", GameDisplay.UHCSoloSpeed, "Deaths"), + StatDisplay.fromGame("Gems Earned", GameDisplay.UHCSoloSpeed, "GemsEarned"), + null, + null, + new StatDisplay(C.Bold + "Teams Stats", true), + null, + StatDisplay.fromGame("Wins", GameDisplay.UHCTeamsSpeed, "Wins"), StatDisplay.fromGame("Games Played", GameDisplay.UHCTeamsSpeed, "Wins", "Losses"), + StatDisplay.fromGame("Kills", GameDisplay.UHCTeamsSpeed, "Kills"), StatDisplay.fromGame("Deaths", GameDisplay.UHCTeamsSpeed, "Deaths"), + StatDisplay.fromGame("Gems Earned", GameDisplay.UHCTeamsSpeed, "GemsEarned") }, + Material.GOLDEN_APPLE, 0, GameCategory.UHC, "None", false, GameDisplay.UHCSoloSpeed.getGameId(), GameDisplay.UHCTeamsSpeed.getGameId()), + + /*MC_LEAGUE("MC League", null, new StatDisplay[] { StatDisplay.WINS, StatDisplay.GAMES_PLAYED, StatDisplay.KILLS, StatDisplay.DEATHS, StatDisplay.GEMS_EARNED }, - Material.GOLDEN_APPLE, 0, GameCategory.SURVIVAL, "None", false, GameDisplay.UHC.getGameId()), - - MC_LEAGUE("MC League", null, - new StatDisplay[] { StatDisplay.WINS, StatDisplay.GAMES_PLAYED, StatDisplay.KILLS, StatDisplay.DEATHS, StatDisplay.GEMS_EARNED }, - Material.IRON_CHESTPLATE, 0, GameCategory.SURVIVAL, "None", true, GameDisplay.Minecraft_League.getGameId()), + Material.IRON_CHESTPLATE, 0, GameCategory.SURVIVAL, "None", true, GameDisplay.Minecraft_League.getGameId()),*/ WIZARDS("Wizards", null, new StatDisplay[] { StatDisplay.WINS, StatDisplay.GAMES_PLAYED, StatDisplay.KILLS, StatDisplay.DEATHS, StatDisplay.GEMS_EARNED }, @@ -153,7 +181,7 @@ public enum AchievementCategory EVOLUTION("Evolution", null, new StatDisplay[] {StatDisplay.WINS, StatDisplay.GAMES_PLAYED, StatDisplay.KILLS, StatDisplay.DEATHS, StatDisplay.GEMS_EARNED}, - Material.MONSTER_EGG, 0, GameCategory.ARCADE, "Harvester Kit", false, GameDisplay.Evolution.getGameId()), + Material.MONSTER_EGG, 55 /* slime */, GameCategory.ARCADE, "Harvester Kit", false, GameDisplay.Evolution.getGameId()), MONSTER_MAZE("Monster Maze", null, new StatDisplay[] {StatDisplay.WINS, StatDisplay.GAMES_PLAYED, StatDisplay.DEATHS, StatDisplay.GEMS_EARNED}, @@ -171,9 +199,9 @@ public enum AchievementCategory new StatDisplay[] {StatDisplay.WINS, StatDisplay.GAMES_PLAYED, StatDisplay.GEMS_EARNED, null, new StatDisplay("Perfect Builds", "PerfectBuild")}, Material.QUARTZ_BLOCK, 0, GameCategory.CLASSICS, null, false, GameDisplay.SpeedBuilders.getGameId()), - ONE_IN_THE_QUIVER_PAYLOAD("One in the Quiver Payload", null, + /*ONE_IN_THE_QUIVER_PAYLOAD("One in the Quiver Payload", null, new StatDisplay[] {StatDisplay.WINS, StatDisplay.GAMES_PLAYED, StatDisplay.GEMS_EARNED}, - Material.EXPLOSIVE_MINECART, 0, GameCategory.CLASSICS, "Sky Warrior Kit", false, GameDisplay.QuiverPayload.getGameId()), + Material.EXPLOSIVE_MINECART, 0, GameCategory.CLASSICS, "Sky Warrior Kit", false, GameDisplay.QuiverPayload.getGameId()),*/ SKYFALL("Skyfall", null, new StatDisplay[] {StatDisplay.WINS, StatDisplay.GAMES_PLAYED, StatDisplay.KILLS, StatDisplay.DEATHS, StatDisplay.GEMS_EARNED, null, new StatDisplay("Booster Rings", "Rings"), @@ -335,6 +363,6 @@ public enum AchievementCategory public enum GameCategory { - GLOBAL, HOLIDAY, SURVIVAL, CLASSICS, CHAMPIONS, ARCADE + GLOBAL, HOLIDAY, SURVIVAL, CLASSICS, CHAMPIONS, ARCADE, UHC } } diff --git a/Plugins/Mineplex.Core/src/mineplex/core/achievement/AchievementManager.java b/Plugins/Mineplex.Core/src/mineplex/core/achievement/AchievementManager.java index dca56aef9..1c2ac0f69 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/achievement/AchievementManager.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/achievement/AchievementManager.java @@ -81,9 +81,7 @@ public class AchievementManager extends MiniPlugin @EventHandler public void informLevelUp(StatChangeEvent event) { - Player player = UtilPlayer.searchExact(event.getPlayerName()); - if (player == null) - return; + Player player = event.getPlayer(); for (Achievement type : Achievement.values()) { diff --git a/Plugins/Mineplex.Core/src/mineplex/core/achievement/command/StatsCommand.java b/Plugins/Mineplex.Core/src/mineplex/core/achievement/command/StatsCommand.java index 384bdf996..f25cb32ce 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/achievement/command/StatsCommand.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/achievement/command/StatsCommand.java @@ -1,6 +1,7 @@ package mineplex.core.achievement.command; import mineplex.core.stats.PlayerStats; + import org.bukkit.entity.Player; import mineplex.core.achievement.AchievementManager; @@ -35,7 +36,7 @@ public class StatsCommand extends CommandBase if (Plugin.getClientManager().hasRank(caller, Rank.MODERATOR)) attemptOffline(caller, args); return; } - + if (/* StaffServer special case */Plugin.getIncognito() != null && Plugin.getIncognito().Get(target).Hidden) { UtilPlayer.message(caller, @@ -59,35 +60,17 @@ public class StatsCommand extends CommandBase UtilPlayer.message(caller, F.main("Stats", "Attempting to look up offline stats...")); final String playerName = args[0]; - Plugin.runAsync(() -> { - try + Plugin.getStatsManager().getOfflinePlayerStats(args[0], stats -> + { + if (stats == null) { - PlayerStats stats = Plugin.getStatsManager().getOfflinePlayerStats(playerName); - - if (stats == null) - { - Plugin.runSync(() -> offlinePlayerNotFound(caller, playerName)); - } - else - { - Plugin.runSync(() -> openShop(caller, playerName, stats)); - } - } catch (SQLException e) + UtilPlayer.message(caller, F.main("Stats", "Offline Player " + F.elem(playerName) + " not found.")); + } + else { - Plugin.runSync(() -> UtilPlayer.message(caller, F.main("Stats", "There was an error trying to look up offline player " + F.elem(playerName)))); - e.printStackTrace(); + Plugin.openShop(caller, playerName, stats); } }); } } - - private void offlinePlayerNotFound(Player caller, String searchName) - { - UtilPlayer.message(caller, F.main("Stats", "Offline Player " + F.elem(searchName) + " not found.")); - } - - private void openShop(Player caller, String searchName, PlayerStats playerStats) - { - Plugin.openShop(caller, searchName, playerStats); - } } diff --git a/Plugins/Mineplex.Core/src/mineplex/core/achievement/ui/AchievementShop.java b/Plugins/Mineplex.Core/src/mineplex/core/achievement/ui/AchievementShop.java index 809c8d82e..9223b446c 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/achievement/ui/AchievementShop.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/achievement/ui/AchievementShop.java @@ -37,17 +37,17 @@ public class AchievementShop extends ShopBase public boolean attemptShopOpen(Player player, String targetName, PlayerStats targetStats) { - if (!getOpenedShop().contains(player.getName())) + if (!getOpenedShop().contains(player.getUniqueId())) { if (!canOpenShop(player)) return false; - getOpenedShop().add(player.getName()); + getOpenedShop().add(player.getUniqueId()); openShopForPlayer(player); - if (!getPlayerPageMap().containsKey(player.getName())) + if (!getPlayerPageMap().containsKey(player.getUniqueId())) { - getPlayerPageMap().put(player.getName(), BuildPagesFor(player, targetName, targetStats)); + getPlayerPageMap().put(player.getUniqueId(), BuildPagesFor(player, targetName, targetStats)); } openPageForPlayer(player, getOpeningPageForPlayer(player)); diff --git a/Plugins/Mineplex.Core/src/mineplex/core/achievement/ui/button/UHCButton.java b/Plugins/Mineplex.Core/src/mineplex/core/achievement/ui/button/UHCButton.java new file mode 100644 index 000000000..7fa0e1234 --- /dev/null +++ b/Plugins/Mineplex.Core/src/mineplex/core/achievement/ui/button/UHCButton.java @@ -0,0 +1,46 @@ +package mineplex.core.achievement.ui.button; + +import org.bukkit.Sound; +import org.bukkit.entity.Player; +import org.bukkit.event.inventory.ClickType; + +import mineplex.core.account.CoreClientManager; +import mineplex.core.achievement.AchievementManager; +import mineplex.core.achievement.ui.AchievementShop; +import mineplex.core.achievement.ui.page.UHCMainPage; +import mineplex.core.donation.DonationManager; +import mineplex.core.shop.item.IButton; +import mineplex.core.stats.PlayerStats; +import mineplex.core.stats.StatsManager; + +public class UHCButton implements IButton +{ + private AchievementShop _shop; + private AchievementManager _achievementManager; + private StatsManager _statsManager; + private DonationManager _donationManager; + private CoreClientManager _clientManager; + + private String _targetName; + private PlayerStats _targetStats; + + public UHCButton(AchievementShop shop, AchievementManager achievementManager, StatsManager statsManager, DonationManager donationManager, CoreClientManager clientManager, String targetName, PlayerStats targetStats) + { + _shop = shop; + _achievementManager = achievementManager; + _statsManager = statsManager; + _donationManager = donationManager; + _clientManager = clientManager; + + _targetName = targetName; + _targetStats = targetStats; + } + + @Override + public void onClick(Player player, ClickType clickType) + { + _shop.openPageForPlayer(player, new UHCMainPage(_achievementManager, _statsManager, _shop, _clientManager, _donationManager, "UHC", player, _targetName, _targetStats)); + player.playSound(player.getLocation(), Sound.CLICK, 1, 1); + } + +} diff --git a/Plugins/Mineplex.Core/src/mineplex/core/achievement/ui/page/AchievementMainPage.java b/Plugins/Mineplex.Core/src/mineplex/core/achievement/ui/page/AchievementMainPage.java index 95c89a727..e2825bfde 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/achievement/ui/page/AchievementMainPage.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/achievement/ui/page/AchievementMainPage.java @@ -3,7 +3,6 @@ package mineplex.core.achievement.ui.page; import java.util.ArrayList; import java.util.List; -import mineplex.core.stats.PlayerStats; import org.bukkit.ChatColor; import org.bukkit.Material; import org.bukkit.entity.Player; @@ -16,11 +15,13 @@ import mineplex.core.achievement.AchievementManager; import mineplex.core.achievement.ui.AchievementShop; import mineplex.core.achievement.ui.button.ArcadeButton; import mineplex.core.achievement.ui.button.CategoryButton; +import mineplex.core.achievement.ui.button.UHCButton; import mineplex.core.common.util.C; import mineplex.core.donation.DonationManager; import mineplex.core.itemstack.ItemLayout; import mineplex.core.shop.item.ShopItem; import mineplex.core.shop.page.ShopPageBase; +import mineplex.core.stats.PlayerStats; import mineplex.core.stats.StatsManager; public class AchievementMainPage extends ShopPageBase @@ -59,7 +60,7 @@ public class AchievementMainPage extends ShopPageBase lore, int max) { int achievementCount = 0; - for (int i = 0; i < Achievement.values().length && achievementCount < max; i++) + for (int i = 0; i < Achievement.values().length; i++) { Achievement achievement = Achievement.values()[i]; if (achievement.getCategory() == category) diff --git a/Plugins/Mineplex.Core/src/mineplex/core/achievement/ui/page/UHCMainPage.java b/Plugins/Mineplex.Core/src/mineplex/core/achievement/ui/page/UHCMainPage.java new file mode 100644 index 000000000..a020aa599 --- /dev/null +++ b/Plugins/Mineplex.Core/src/mineplex/core/achievement/ui/page/UHCMainPage.java @@ -0,0 +1,71 @@ +package mineplex.core.achievement.ui.page; + +import java.util.ArrayList; + +import mineplex.core.stats.PlayerStats; +import org.bukkit.ChatColor; +import org.bukkit.Material; +import org.bukkit.Sound; +import org.bukkit.entity.Player; +import org.bukkit.event.inventory.ClickType; + +import mineplex.core.account.CoreClientManager; +import mineplex.core.achievement.AchievementCategory; +import mineplex.core.achievement.AchievementManager; +import mineplex.core.achievement.ui.AchievementShop; +import mineplex.core.achievement.ui.button.CategoryButton; +import mineplex.core.common.util.C; +import mineplex.core.donation.DonationManager; +import mineplex.core.shop.item.IButton; +import mineplex.core.shop.item.ShopItem; +import mineplex.core.stats.StatsManager; + +public class UHCMainPage extends AchievementMainPage +{ + public UHCMainPage(AchievementManager plugin, StatsManager statsManager, AchievementShop shop, CoreClientManager clientManager, DonationManager donationManager, String name, Player player, String targetName, PlayerStats targetStats) + { + super(plugin, statsManager, shop, clientManager, donationManager, name, player, 3 * 9, targetName, targetStats); + } + + @Override + protected void buildPage() + { + int slot = 11; + + for (AchievementCategory category : AchievementCategory.values()) + { + if (category.getGameCategory() != AchievementCategory.GameCategory.UHC) + continue; + + CategoryButton button = new CategoryButton(getShop(), getPlugin(), _statsManager, category, getDonationManager(), getClientManager(), _targetName, _targetStats); + + ArrayList lore = new ArrayList(); + lore.add(" "); + category.addStats(getClientManager(), _statsManager, lore, getPlayer(), _targetName, _targetStats); + lore.add(" "); + addAchievements(category, lore, 9); + lore.add(" "); + lore.add(ChatColor.RESET + "Click for more details!"); + + ShopItem shopItem = new ShopItem(category.getIcon(), category.getIconData(), C.Bold + category.getFriendlyName(), lore.toArray(new String[0]), 1, false, false); + addButton(slot, shopItem, button); + + slot += 4; + } + + addBackButton(); + } + + private void addBackButton() + { + addButton(4, new ShopItem(Material.BED, C.cGray + " \u21FD Go Back", new String[]{}, 1, false), new IButton() + { + public void onClick(Player player, ClickType clickType) + { + getShop().openPageForPlayer(getPlayer(), new AchievementMainPage(getPlugin(), _statsManager, getShop(), getClientManager(), getDonationManager(), _targetName + "'s Stats", player, _targetName, _targetStats)); + player.playSound(player.getLocation(), Sound.CLICK, 1, 1); + } + }); + } + +} diff --git a/Plugins/Mineplex.Core/src/mineplex/core/antihack/AntiHack.java b/Plugins/Mineplex.Core/src/mineplex/core/antihack/AntiHack.java index b8bd978f1..96af06514 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/antihack/AntiHack.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/antihack/AntiHack.java @@ -1,620 +1,286 @@ package mineplex.core.antihack; +import java.util.Collections; +import java.util.HashSet; +import java.util.Map; +import java.util.Set; +import java.util.UUID; +import java.util.concurrent.ThreadLocalRandom; +import java.util.concurrent.TimeUnit; +import java.util.function.Consumer; + +import javax.xml.bind.DatatypeConverter; + +import org.bukkit.Bukkit; +import org.bukkit.entity.Player; +import org.bukkit.event.EventHandler; +import org.bukkit.event.EventPriority; +import org.bukkit.event.entity.EntityDamageByEntityEvent; +import org.bukkit.event.entity.EntityDamageEvent; +import org.bukkit.event.player.PlayerCommandPreprocessEvent; +import org.bukkit.event.player.PlayerInteractEvent; +import org.bukkit.event.player.PlayerMoveEvent; +import org.bukkit.event.player.PlayerQuitEvent; +import org.bukkit.event.player.PlayerToggleFlightEvent; +import org.bukkit.plugin.ServicePriority; + import com.google.common.cache.Cache; import com.google.common.cache.CacheBuilder; import com.google.common.collect.ImmutableMap; -import com.google.common.util.concurrent.AtomicDouble; +import com.google.gson.JsonObject; import com.mineplex.anticheat.api.GameEndEvent; import com.mineplex.anticheat.api.GameStartEvent; import com.mineplex.anticheat.api.MineplexLink; import com.mineplex.anticheat.api.PlayerViolationEvent; import com.mineplex.anticheat.checks.Check; -import mineplex.core.Managers; +import com.mineplex.anticheat.checks.CheckManager; +import com.mineplex.anticheat.checks.combat.KillauraTypeA; +import com.mineplex.anticheat.checks.combat.KillauraTypeB; +import com.mineplex.anticheat.checks.combat.KillauraTypeC; +import com.mineplex.anticheat.checks.combat.KillauraTypeD; +import com.mineplex.anticheat.checks.combat.KillauraTypeE; +import com.mineplex.anticheat.checks.combat.KillauraTypeF; +import com.mineplex.anticheat.checks.move.Glide; +import com.mineplex.anticheat.checks.move.HeadRoll; +import com.mineplex.anticheat.checks.move.Speed; +import com.mineplex.anticheat.checks.player.BadPackets; + import mineplex.core.MiniPlugin; -import mineplex.core.PlayerSelector; import mineplex.core.ReflectivelyCreateMiniPlugin; import mineplex.core.account.CoreClient; import mineplex.core.account.CoreClientManager; import mineplex.core.antihack.actions.AntiHackAction; +import mineplex.core.antihack.actions.BanwaveAction; +import mineplex.core.antihack.actions.GEPBanAction; +import mineplex.core.antihack.actions.ImmediateBanAction; +import mineplex.core.antihack.actions.NoopAction; +import mineplex.core.antihack.animations.BanwaveAnimationSpin; +import mineplex.core.antihack.banwave.BanWaveInfo; import mineplex.core.antihack.banwave.BanWaveManager; -import mineplex.core.antihack.types.Fly; -import mineplex.core.antihack.types.Idle; -import mineplex.core.antihack.types.Reach; -import mineplex.core.antihack.types.Speed; -import mineplex.core.command.CommandBase; +import mineplex.core.antihack.commands.AnticheatOffCommand; +import mineplex.core.antihack.commands.AnticheatOnCommand; +import mineplex.core.antihack.commands.DetailedMessagesCommand; +import mineplex.core.antihack.commands.GetVlsCommand; +import mineplex.core.antihack.commands.TestBanCommand; +import mineplex.core.antihack.gep.GwenExtremePrejudice; +import mineplex.core.antihack.guardians.GuardianManager; +import mineplex.core.antihack.logging.AntihackLogger; +import mineplex.core.antihack.redisnotifications.GwenBanNotification; import mineplex.core.common.Rank; -import mineplex.core.common.util.*; -import mineplex.core.disguise.DisguiseManager; -import mineplex.core.disguise.disguises.DisguiseBase; -import mineplex.core.portal.Portal; +import mineplex.core.common.util.F; +import mineplex.core.common.util.UtilMath; +import mineplex.core.common.util.UtilServer; import mineplex.core.preferences.Preference; import mineplex.core.preferences.PreferencesManager; import mineplex.core.punish.Category; import mineplex.core.punish.Punish; -import mineplex.core.punish.PunishClient; -import mineplex.core.punish.Punishment; -import mineplex.core.updater.UpdateType; -import mineplex.core.updater.event.UpdateEvent; +import mineplex.core.punish.PunishmentResponse; import mineplex.serverdata.commands.ServerCommandManager; -import net.minecraft.server.v1_8_R3.*; -import org.bukkit.*; -import org.bukkit.Material; -import org.bukkit.craftbukkit.v1_8_R3.entity.CraftPlayer; -import org.bukkit.entity.EntityType; -import org.bukkit.entity.Player; -import org.bukkit.event.EventHandler; -import org.bukkit.event.EventPriority; -import org.bukkit.event.player.*; -import org.bukkit.event.server.ServerListPingEvent; -import org.bukkit.plugin.ServicePriority; -import org.bukkit.potion.PotionEffect; -import org.bukkit.potion.PotionEffectType; -import org.bukkit.scheduler.BukkitTask; - -import java.util.*; -import java.util.Map.Entry; -import java.util.concurrent.ThreadLocalRandom; -import java.util.concurrent.TimeUnit; -import java.util.concurrent.atomic.AtomicInteger; -import java.util.concurrent.atomic.AtomicReference; -import java.util.function.Function; -import java.util.function.Predicate; +import net.md_5.bungee.api.ChatColor; +import net.md_5.bungee.api.chat.BaseComponent; +import net.md_5.bungee.api.chat.ClickEvent; +import net.md_5.bungee.api.chat.ComponentBuilder; +import net.md_5.bungee.api.chat.HoverEvent; @ReflectivelyCreateMiniPlugin public class AntiHack extends MiniPlugin { - public static final Map CHECKS = ImmutableMap.builder() - .put("Killaura (Type A)", new CheckThresholds("Kill Aura", 0, 25, 50)) - .put("Killaura (Type B)", new CheckThresholds("High CPS", 0, 0, Integer.MAX_VALUE)) - .put("Killaura (Type C)", new CheckThresholds("Reach", 0, Integer.MAX_VALUE, Integer.MAX_VALUE)) - .put("Killaura (Type D)", new CheckThresholds("Kill Aura", 500, 1000, 1500)) - .put("Killaura (Type E)", new CheckThresholds("Kill Aura", 300, 700, 2000)) - .put("Killaura (Type F)", new CheckThresholds("Kill Aura", 150, 250, 350)) - .put("BadPackets", new CheckThresholds("Regen", 500, 1000, 2000)) - .put("Glide", new CheckThresholds("Flying", 50, 100, 200)) // TODO: specific VL levels - .put("Speed", new CheckThresholds("Speed", 50, 100, 200)) // TODO: specific VL levels - .put("HeadRoll", new CheckThresholds("Illegal Movement", 0, 0, 0)) + private static final Map, CheckThresholds> CHECKS = ImmutableMap., CheckThresholds>builder() + .put(KillauraTypeA.class, new CheckThresholds("Kill Aura", 0, 25, 50)) + .put(KillauraTypeB.class, new CheckThresholds("High CPS", 0, 0, Integer.MAX_VALUE)) + .put(KillauraTypeC.class, new CheckThresholds("Reach", 0, Integer.MAX_VALUE, Integer.MAX_VALUE)) + .put(KillauraTypeD.class, new CheckThresholds("Kill Aura", 500, 1000, 1500)) + .put(KillauraTypeE.class, new CheckThresholds("Kill Aura", 300, 700, 2000)) + .put(KillauraTypeF.class, new CheckThresholds("Kill Aura", 150, 250, 350)) + .put(BadPackets.class, new CheckThresholds("Regen", 500, 1000, 2000)) + .put(Glide.class, new CheckThresholds("Flying", 150, 250, 500)) + .put(Speed.class, new CheckThresholds("Speed", 150, 250, 500)) + .put(HeadRoll.class, new CheckThresholds("Illegal Movement", 0, 0, 0)) .build(); - public static final String NAME = "Chiss"; - public static final String USER_HAS_BEEN_BANNED = F.main("GWEN", "%s has been banned. I am always watching."); - public static final String USER_HAS_BEEN_BANNED_BANWAVE = USER_HAS_BEEN_BANNED; + private static final CheckThresholds NOOP_THRESHOLD = new CheckThresholds("Unknown", 0, Integer.MAX_VALUE, Integer.MAX_VALUE); - private static final int VL_DIFF_BEFORE_RENOTIFY = 999999; - private static final int MAX_STALKED_PLAYERS = 3; - private static final int STALK_COOLDOWN_TIME_SECONDS = 5; - private static final int MIN_STALK_TIME = 10 * 20; - private static final int MAX_STALK_TIME = 20 * 20; - private static final int MAX_MIN_DIFF = MAX_STALK_TIME - MIN_STALK_TIME; - private static final Function STALK_END_PROBABILITY_EQUATION = x -> - { - return 1.0/ MAX_MIN_DIFF * x; // linear equation with points (0, 0) and (diff, 1) - }; + private static final Map, AntiHackAction> ACTIONS = ImmutableMap., AntiHackAction>builder() + .put(KillauraTypeA.class, new ImmediateBanAction(200)) + .put(KillauraTypeD.class, new BanwaveAction(1500)) + .put(Glide.class, new ImmediateBanAction(10000)) + .put(Speed.class, new ImmediateBanAction(10000)) +// .put(HeadRoll.class, new ImmediateBanAction(200)) + .put(HeadRoll.class, new GEPBanAction(1)) + .put(BadPackets.class, new GEPBanAction(300)) + .put(KillauraTypeB.class, new GEPBanAction(100)) + .build(); + + private static final AntiHackAction NOOP_ACTION = new NoopAction(); + + private static final String NAME = "Chiss"; + private static final String USER_HAS_BEEN_BANNED = F.main("GWEN", "%s has been banned. I am always watching."); + private static final String USER_HAS_BEEN_BANNED_BANWAVE = USER_HAS_BEEN_BANNED; + + public static final int ID_LENGTH = 5; private final Cache _cooldown = CacheBuilder.newBuilder() .concurrencyLevel(1) .expireAfterWrite(30, TimeUnit.SECONDS) .build(); - private final Cache _stalkingCooldown = CacheBuilder.newBuilder() - .concurrencyLevel(1) - .expireAfterWrite(STALK_COOLDOWN_TIME_SECONDS, TimeUnit.SECONDS) - .build(); - private final List _stalking = new ArrayList<>(); - private final String _thisServer; + private final String _thisServer = UtilServer.getServerName(); - private boolean _enabled = true; - private boolean _strict = false; - private boolean _kick = true; + private final CoreClientManager _clientManager = require(CoreClientManager.class); + private final AntihackLogger _logger = require(AntihackLogger.class); + private final PreferencesManager _preferences = require(PreferencesManager.class); + private final Punish _punish = require(Punish.class); - public Portal Portal = require(Portal.class); - private PreferencesManager _preferences = require(PreferencesManager.class); - private CoreClientManager _clientManager = require(CoreClientManager.class); + private final Set _detailedMessages = new HashSet<>(); - //Record Offenses - private HashMap>> _offense = new HashMap>>(); + private Set _pendingBan = Collections.synchronizedSet(new HashSet<>()); - //Ignore Player - private HashMap _ignore = new HashMap(); - - //Player Info - private HashSet _velocityEvent = new HashSet(); - private HashMap _lastMoveEvent = new HashMap(); - - private HashSet _hubAttempted = new HashSet(); - - //Hack Requirements - public int FloatHackTicks = 10; - public int HoverHackTicks = 4; - public int RiseHackTicks = 6; - public int SpeedHackTicks = 6; - public int IdleTime = 20000; - - public int KeepOffensesFor = 30000; - - //Other Times - public int FlightTriggerCancel = 2000; - - public ArrayList _movementDetectors; - public ArrayList _combatDetectors; - - private AntiHackRepository _repository; - - private List _guardians = new ArrayList<>(); - - private Predicate _filter = player -> true; - - private Set _pendingBan = new HashSet<>(); + private Set _banned = Collections.synchronizedSet(new HashSet<>()); // These are the GWEN checks to ignore when handling PlayerViolationEvent private HashSet> _ignoredChecks = new HashSet<>(); + private boolean _strict; + + private BanWaveManager _banWaveManager; - @SuppressWarnings("Convert2streamapi") private AntiHack() { super("AntiHack"); - DisguiseManager disguiseManager = require(DisguiseManager.class); + _detailedMessages.add("Spoobncoobr"); - this._thisServer = UtilServer.getServerName(); + require(GuardianManager.class); + _banWaveManager = require(BanWaveManager.class); - _repository = new AntiHackRepository(this._thisServer); - _repository.initialize(); - - _movementDetectors = new ArrayList(); - _combatDetectors = new ArrayList(); - - _movementDetectors.add(new Fly(this)); - _movementDetectors.add(new Idle(this)); - _movementDetectors.add(new Speed(this)); - - _combatDetectors.add(new Reach(this)); - - Bukkit.getServicesManager().register(MineplexLink.class, new MineplexLink() - { - @Override - public EntityType getActiveDisguise(Player player) - { - DisguiseBase disguise = disguiseManager.getActiveDisguise(player); - return disguise != null ? disguise.getDisguiseType() : null; - } - - @Override - public boolean isSpectator(Player player) - { - return UtilPlayer.isSpectator(player); - } - - @Override - public double getTPS() - { - return MinecraftServer.getServer().recentTps[0]; // Return the average TPS from the last minute - } - - @Override - public int getPing(Player player) - { - return Math.min(((CraftPlayer)player).getHandle().ping, 1000); - } - - @Override - public boolean isUsingItem(Player player) - { - return ((CraftPlayer)player).getHandle().bS(); // See Anticheat javadoc - } - }, this._plugin, ServicePriority.Normal); + Bukkit.getServicesManager().register(MineplexLink.class, new MineplexLinkImpl(), this._plugin, ServicePriority.Normal); ServerCommandManager.getInstance().registerCommandType(MajorViolationCommand.class, violation -> { - IChatBaseComponent component = getMinimalMessage(violation); - + BaseComponent[] minimal = getMinimalMessage(violation); + BaseComponent[] detailed = getDetailedMessage(violation); for (Player player : Bukkit.getOnlinePlayers()) { - if (player.getName().equals("Spoobncoobr")) - { - ((CraftPlayer) player).getHandle().sendMessage(getDetailedMessage(violation)); - - } else if (_clientManager.Get(player).GetRank().has(Rank.HELPER) && (violation.getOriginatingServer().equals(_thisServer) || Managers.get(PreferencesManager.class).get(player).isActive(Preference.GLOBAL_GWEN_REPORTS))) - { - ((CraftPlayer) player).getHandle().sendMessage(component); - } + if (_detailedMessages.contains(player.getName())) + player.spigot().sendMessage(detailed); + else if (_clientManager.Get(player).GetRank().has(Rank.HELPER) && (violation.getOriginatingServer().equals(_thisServer) || _preferences.get(player).isActive(Preference.GLOBAL_GWEN_REPORTS))) + player.spigot().sendMessage(minimal); } }); - - this._plugin.getServer().getScheduler().runTaskTimer(this._plugin, () -> - { - for (AntiHackGuardian guardian : this._guardians) - { - if (guardian.getTarget() != null && !guardian.getTarget().isOnline()) - { - this._stalking.remove(guardian.getTarget().getUniqueId()); - guardian.stopTargeting(); - } - else if (guardian.getTargetingTime() > MIN_STALK_TIME) - { - double threshold = STALK_END_PROBABILITY_EQUATION.apply(guardian.getTargetingTime() - MIN_STALK_TIME); - if (Math.random() <= threshold) - { - this._stalking.remove(guardian.getTarget().getUniqueId()); - _stalkingCooldown.put(guardian.getTarget().getUniqueId(), true); - guardian.stopTargeting(); - } - } - guardian.tick(); - } - }, 0L, 1L); - - this._plugin.getServer().getScheduler().runTaskTimer(this._plugin, () -> - { - if (_stalking.size() >= MAX_STALKED_PLAYERS) - { - return; - } - - if (_guardians.size() == 0) - { - return; - } - - List targets = PlayerSelector.selectPlayers( - UtilLambda.and( - PlayerSelector.NOT_VANISHED, - PlayerSelector.hasAnyRank(false, - Rank.ALL, - Rank.ULTRA, - Rank.HERO, - Rank.LEGEND, - Rank.TITAN, - Rank.TWITCH, - Rank.YOUTUBE_SMALL, - Rank.YOUTUBE, - Rank.MEDIA, - Rank.ADMIN, - Rank.DEVELOPER, - Rank.OWNER, - Rank.LT - ), - player -> !_stalking.contains(player.getUniqueId()), - player -> _stalkingCooldown.getIfPresent(player.getUniqueId()) == null, - _filter - )); - - while (_stalking.size() < MAX_STALKED_PLAYERS && targets.size() > 0) - { - Player target = targets.remove(ThreadLocalRandom.current().nextInt(targets.size())); - - int start = ThreadLocalRandom.current().nextInt(_guardians.size()); - - for (int i = start, j = 0; j < _guardians.size(); i++, j++) - { - if (i >= _guardians.size()) - { - i -= _guardians.size(); - } - AntiHackGuardian guardian = _guardians.get(i); - if (!guardian.isTargeting()) - { - guardian.target(target); - _stalking.add(target.getUniqueId()); - break; - } - } - } - }, 0L, 20L); - - require(BanWaveManager.class); + + new GwenExtremePrejudice(UtilServer.getPlugin()); } - private IChatBaseComponent getDetailedMessage(MajorViolationCommand violation) + @Override + public void addCommands() { - return new ChatComponentText("") - .addSibling( - new ChatComponentText("A") - .setChatModifier( - new ChatModifier() - .setColor(EnumChatFormat.AQUA) - .setRandom(true) - ) - ) - .addSibling( - new ChatComponentText(" GWEN > ") - .setChatModifier( - new ChatModifier() - .setColor(EnumChatFormat.RED) - .setBold(true) - ) - ) - .addSibling( - new ChatComponentText(violation.getPlayerName()) - .setChatModifier( - new ChatModifier() - .setColor(EnumChatFormat.GOLD) - ) - ) - .addSibling( - new ChatComponentText(" failed " + violation.getHackType() + " VL" + violation.getViolations() + " in server ") - .setChatModifier( - new ChatModifier() - .setColor(EnumChatFormat.YELLOW) - ) - ) - .addSibling( - new ChatComponentText( - violation.getOriginatingServer() - ) - .setChatModifier( - new ChatModifier() - .setColor(EnumChatFormat.YELLOW) - .setChatClickable( - new ChatClickable( - ChatClickable.EnumClickAction.RUN_COMMAND, - "/server " + violation.getOriginatingServer() - ) - ) - .setChatHoverable( - new ChatHoverable( - ChatHoverable.EnumHoverAction.SHOW_TEXT, - new ChatComponentText("Teleport to " + violation.getOriginatingServer()) - ) - ) - ) - ) - .addSibling( - new ChatComponentText(": " + violation.getMessage() + ".") - .setChatModifier( - new ChatModifier() - .setColor(EnumChatFormat.YELLOW) - ) - ); - } - - private IChatBaseComponent getMinimalMessage(MajorViolationCommand violation) - { - IChatBaseComponent component = new ChatComponentText("") - .addSibling( - new ChatComponentText("A") - .setChatModifier( - new ChatModifier() - .setColor(EnumChatFormat.AQUA) - .setRandom(true) - ) - ) - .addSibling( - new ChatComponentText(" GWEN > ") - .setChatModifier( - new ChatModifier() - .setColor(EnumChatFormat.RED) - .setBold(true) - ) - ) - .addSibling( - new ChatComponentText(violation.getPlayerName()) - .setChatModifier( - new ChatModifier() - .setColor(EnumChatFormat.GOLD) - ) - ) - .addSibling( - new ChatComponentText(" suspected of ") - .setChatModifier( - new ChatModifier() - .setColor(EnumChatFormat.YELLOW) - ) - ) - .addSibling(CHECKS.get(violation.getHackType()).format(violation.getViolations())); - - if (!violation.getOriginatingServer().equals(this._thisServer)) + if (UtilServer.isTestServer()) { - component - .addSibling( - new ChatComponentText(" in ") - .setChatModifier( - new ChatModifier() - .setColor(EnumChatFormat.YELLOW) - ) - ) - .addSibling( - new ChatComponentText(violation.getOriginatingServer()) - .setChatModifier( - new ChatModifier() - .setColor(EnumChatFormat.AQUA) - .setChatClickable( - new ChatClickable( - ChatClickable.EnumClickAction.RUN_COMMAND, - "/server " + violation.getOriginatingServer() - ) - ) - .setChatHoverable( - new ChatHoverable( - ChatHoverable.EnumHoverAction.SHOW_TEXT, - new ChatComponentText("Teleport to " + violation.getOriginatingServer()) - ) - ) - ) - ); + addCommand(new AnticheatOnCommand(this)); + addCommand(new AnticheatOffCommand(this)); + addCommand(new TestBanCommand(this)); } - - return component.addSibling( - new ChatComponentText(".") - .setChatModifier( - new ChatModifier() - .setColor(EnumChatFormat.YELLOW) - ) - ); + addCommand(new GetVlsCommand(this)); + addCommand(new DetailedMessagesCommand(this)); } - public void registerFilter(Predicate filter) + private void runBanAnimation(Player player, Runnable after) { - if (filter == null) + new BanwaveAnimationSpin().run(player, after); + } + + @EventHandler + public void onQuit(PlayerQuitEvent event) + { + UUID uuid = event.getPlayer().getUniqueId(); + runSync(() -> _banned.remove(uuid)); + } + + public void doBan(Player player, Class cause, boolean gep) + { + runSync(() -> { - this._filter = player -> true; - } - else - { - this._filter = filter; - } - } - - public void registerGuardian(AntiHackGuardian guardian) - { - this._guardians.add(guardian); - } - - public void clearGuardians() - { - this._guardians.forEach(AntiHackGuardian::remove); - this._guardians.clear(); - this._stalking.clear(); - this._stalkingCooldown.cleanUp(); - } - - public void runBanAnimation(Player player, Runnable after) - { - if (_pendingBan.add(player)) - { - float oldWalkSpeed = player.getWalkSpeed(); - player.setWalkSpeed(0); - player.addPotionEffect(new PotionEffect(PotionEffectType.JUMP, 999999, -10)); - - double radius = 4; - double heightAdj = 8; - - double baseDeg = 18; - - Location center = player.getLocation().add(0, heightAdj, 0); - AntiHackGuardian north = new AntiHackGuardian(center.clone().add(0, 0, -radius), 0, 0, 0, 0, 0, 0, false); - AntiHackGuardian east = new AntiHackGuardian(center.clone().add(radius, 0, 0), 0, 0, 0, 0, 0, 0, false); - AntiHackGuardian south = new AntiHackGuardian(center.clone().add(0, 0, radius), 0, 0, 0, 0, 0, 0, false); - AntiHackGuardian west = new AntiHackGuardian(center.clone().add(-radius, 0, 0), 0, 0, 0, 0, 0, 0, false); - - UtilEnt.CreatureLook(east.getEntity(), player); - UtilEnt.CreatureLook(west.getEntity(), player); - UtilEnt.CreatureLook(south.getEntity(), player); - UtilEnt.CreatureLook(north.getEntity(), player); - - Function magic = seconds -> + if (_pendingBan.add(player) && !_banned.contains(player.getUniqueId())) { - return Math.pow(2, seconds - 5); + CoreClient coreClient = _clientManager.Get(player); + + String id = generateId(); + String finalMessage = "[GWEN] " + id; + JsonObject custom = new JsonObject(); + custom.addProperty("ban-reason", CheckManager.getCheckSimpleName(cause)); + if (gep) + { + custom.addProperty("extreme-prejudice", true); + } + + _logger.saveMetadata(player, id, () -> + { + Consumer> doPunish = after -> + { + runAsync(() -> + { + new GwenBanNotification(_thisServer, player.getName(), player.getUniqueId().toString(), coreClient.GetRank().name(), CheckManager.getCheckSimpleName(cause), id, gep).publish(); + }); + + _punish.AddPunishment(coreClient.getName(), Category.Hacking, finalMessage, AntiHack.NAME, 3, true, -1, true, after); + }; + + if (coreClient.GetRank().has(Rank.TWITCH)) + { + doPunish.accept(result -> + { + _pendingBan.remove(player); + _banned.add(player.getUniqueId()); + }); + } + else + { + runBanAnimation(player, () -> + doPunish.accept(result -> + { + if (result == PunishmentResponse.Punished) + { + announceBan(player); + _banned.add(player.getUniqueId()); + _banWaveManager.flagDone(coreClient); + } + _pendingBan.remove(player); + }) + ); + } + }, custom); + } + }); + } + + public void doBanWave(Player player, BanWaveInfo info) + { + runSync(() -> + { + CoreClient coreClient = _clientManager.Get(player); + + Consumer> doPunish = after -> + { + _punish.AddPunishment(coreClient.getName(), Category.Hacking, info.getMessage(), AntiHack.NAME, 3, true, -1, true, after); }; - runSyncLater(() -> - { - north.shoot(player); - east.shoot(player); - south.shoot(player); - west.shoot(player); - - // We get 5 seconds, or 100 ticks - AtomicInteger timer = new AtomicInteger(5); - AtomicReference task = new AtomicReference<>(); - - AtomicDouble cNorth = new AtomicDouble(270); - AtomicDouble cEast = new AtomicDouble(0); - AtomicDouble cSouth = new AtomicDouble(90); - AtomicDouble cWest = new AtomicDouble(180); - - task.set(runSyncTimer(() -> - { - timer.getAndIncrement(); - if (timer.get() > 100) - { - task.get().cancel(); - - player.removePotionEffect(PotionEffectType.JUMP); - player.setWalkSpeed(oldWalkSpeed); - Location location = player.getLocation(); - - UtilParticle.PlayParticle(UtilParticle.ParticleType.HUGE_EXPLOSION, player.getLocation(), 3f, 3f, 3f, 0, 32, UtilParticle.ViewDist.MAX, UtilServer.getPlayers()); - - after.run(); - - _pendingBan.remove(player); - - north.shoot(null); - south.shoot(null); - east.shoot(null); - west.shoot(null); - UtilEnt.CreatureLook(north.getEntity(), location); - UtilEnt.CreatureLook(south.getEntity(), location); - UtilEnt.CreatureLook(east.getEntity(), location); - UtilEnt.CreatureLook(west.getEntity(), location); - runSyncLater(() -> - { - north.remove(); - south.remove(); - east.remove(); - west.remove(); - }, 40L); - return; - } - - double seconds = timer.get() / 20.0; - - double rate = magic.apply(seconds) * 3 * baseDeg; - - player.getLocation(center); - center.add(0, heightAdj, 0); - - { - cNorth.addAndGet(rate); - north.move(center.getX() + radius * MathHelper.cos((float) Math.toRadians(cNorth.get())), center.getY(), center.getZ() + radius * MathHelper.sin((float) Math.toRadians(cNorth.get()))); - } - { - cSouth.addAndGet(rate); - south.move(center.getX() + radius * MathHelper.cos((float) Math.toRadians(cSouth.get())), center.getY(), center.getZ() + radius * MathHelper.sin((float) Math.toRadians(cSouth.get()))); - } - { - cEast.addAndGet(rate); - east.move(center.getX() + radius * MathHelper.cos((float) Math.toRadians(cEast.get())), center.getY(), center.getZ() + radius * MathHelper.sin((float) Math.toRadians(cEast.get()))); - } - { - cWest.addAndGet(rate); - west.move(center.getX() + radius * MathHelper.cos((float) Math.toRadians(cWest.get())), center.getY(), center.getZ() + radius * MathHelper.sin((float) Math.toRadians(cWest.get()))); - } - }, 5, 1)); - }, 20); - } - } - - public void doBan(Player player, String message) - { - runSync(() -> - { - CoreClient coreClient = _clientManager.Get(player); - if (coreClient.GetRank().has(Rank.TWITCH)) { - require(Punish.class).AddPunishment(coreClient.getName(), Category.Hacking, message, AntiHack.NAME, 3, true, -1, true); - } - else - { - runBanAnimation(player, () -> + doPunish.accept(response -> { - require(Punish.class).AddPunishment(coreClient.getName(), Category.Hacking, message, AntiHack.NAME, 3, true, -1, true); - announceBan(player); }); } - }); - } - - public void doBanWave(Player player, String message) - { - runSync(() -> - { - int totalPunishments = getPunishments(player); - int daysBanned = getDaysBanned(player); - CoreClient coreClient = _clientManager.Get(player); - if (coreClient.GetRank().has(Rank.TWITCH)) - { - require(Punish.class).AddPunishment(coreClient.getName(), Category.Hacking, message, AntiHack.NAME, totalPunishments + 1, true, daysBanned == -1 ? -1 : TimeUnit.DAYS.toHours(daysBanned), true); - } else { runBanAnimation(player, () -> { - require(Punish.class).AddPunishment(coreClient.getName(), Category.Hacking, message, AntiHack.NAME, totalPunishments + 1, true, daysBanned == -1 ? -1 : TimeUnit.DAYS.toHours(daysBanned), true); - announceBanwave(player); + doPunish.accept(result -> + { + if (result == PunishmentResponse.Punished) + { + announceBanwave(player); + } + }); }); } }); @@ -657,13 +323,18 @@ public class AntiHack extends MiniPlugin } } - @EventHandler - public void on(PlayerViolationEvent event) + @EventHandler(priority = EventPriority.LOWEST) + public void on(EntityDamageEvent event) { - if (_ignoredChecks.contains(event.getCheckClass())) - return; + if (_pendingBan.contains(event.getEntity())) + event.setCancelled(true); + } - AntiHackAction.getAction(event.getCheckClass()).handle(event); + @EventHandler(priority = EventPriority.LOWEST) + public void on(EntityDamageByEntityEvent event) + { + if (_pendingBan.contains(event.getDamager())) + event.setCancelled(true); } public void announceBan(Player player) @@ -676,326 +347,16 @@ public class AntiHack extends MiniPlugin Bukkit.getServer().broadcastMessage(String.format(USER_HAS_BEEN_BANNED_BANWAVE, player.getName())); } - public int getPunishments(Player player) + public boolean toggleDetailedMessage(Player player) { - PunishClient punishClient = require(Punish.class).GetClient(player.getName()); - - int totalPunishments = 0; - - if (punishClient.GetPunishments().containsKey(Category.Hacking)) - { - for (Punishment punishment : punishClient.GetPunishments().get(Category.Hacking)) - { - if (punishment.GetAdmin().equalsIgnoreCase(NAME)) - { - totalPunishments++; - } - } - } - - return totalPunishments; - } - - public int getDaysBanned(Player player) - { - int totalPunishments = getPunishments(player); - - int daysBanned = 0; - - switch (totalPunishments) - { - case 0: - daysBanned = 7; - break; - case 1: - daysBanned = 30; - break; - case 2: - default: - daysBanned = -1; - } - - return daysBanned; - } - - @Override - public void addCommands() - { - if (UtilServer.isTestServer()) - { - addCommand(new CommandBase(this, Rank.DEVELOPER, "acon") - { - @Override - public void Execute(Player caller, String[] args) - { - if (caller.getUniqueId().toString().equals("b86b54da-93dd-46f9-be33-27bd92aa36d7")) - { - enableNewAnticheat(); - UtilPlayer.message(caller, F.main(getName(), "Enabled new anticheat")); - } - } - }); - addCommand(new CommandBase(this, Rank.DEVELOPER, "acoff") - { - @Override - public void Execute(Player caller, String[] args) - { - if (caller.getUniqueId().toString().equals("b86b54da-93dd-46f9-be33-27bd92aa36d7")) - { - disableNewAnticheat(); - UtilPlayer.message(caller, F.main(getName(), "Disabled new anticheat")); - } - } - }); - addCommand(new CommandBase(this, Rank.DEVELOPER, "testban") - { - @Override - public void Execute(Player caller, String[] args) - { - if (caller.getUniqueId().toString().equals("b86b54da-93dd-46f9-be33-27bd92aa36d7")) - { - if (args.length > 0) - { - Player p = Bukkit.getPlayerExact(args[0]); - if (p != null) - { - runBanAnimation(p, () -> - { - String reason = C.cRed + C.Bold + "You are banned for permanent by " + NAME + - "\n" + C.cWhite + "Seems to be speeding up time. (" + ThreadLocalRandom.current().nextInt(200, 400) + " packets/150 ms)" + - "\n" + C.cDGreen + "Unfairly banned? Appeal at " + C.cGreen + "www.mineplex.com/appeals"; - p.kickPlayer(reason); - - announceBan(p); - }); - } - else - { - UtilPlayer.message(caller, F.main(getName(), "Could not find player")); - } - } - else - { - UtilPlayer.message(caller, F.main(getName(), "No player specified")); - } - } - } - }); - } - } - - @EventHandler - public void playerMove(PlayerMoveEvent event) - { - if (!_enabled) - return; - - _lastMoveEvent.put(event.getPlayer(), System.currentTimeMillis()); - } - - @EventHandler - public void playerTeleport(PlayerTeleportEvent event) - { - if (!_enabled) - return; - - setIgnore(event.getPlayer(), 2000); - } - - @EventHandler - public void playerVelocity(PlayerVelocityEvent event) - { - if (!_enabled) - return; - - _velocityEvent.add(event.getPlayer()); - } - - @EventHandler - public void playerQuit(PlayerQuitEvent event) - { - if (!_enabled) - return; - - resetAll(event.getPlayer()); - } - - @EventHandler - public void startIgnore(PlayerMoveEvent event) - { - if (!_enabled) - return; - - Player player = event.getPlayer(); - - if (_velocityEvent.remove(player)) - { - setIgnore(player, 2000); - } - - //Initial Move (or Lag) Ignore - if (_lastMoveEvent.containsKey(player)) - { - long timeBetweenPackets = System.currentTimeMillis() - _lastMoveEvent.get(player); - - if (timeBetweenPackets > 500) - { - setIgnore(player, Math.min(4000, timeBetweenPackets)); - } - } - } - - public void setIgnore(Player player, long time) - { - //Wipe Detection - for (Detector detector : _movementDetectors) - detector.Reset(player); - - //Already ignoring for a longer period - if (_ignore.containsKey(player) && _ignore.get(player) > System.currentTimeMillis() + time) - return; - - //Add Ignore - _ignore.put(player, System.currentTimeMillis() + time); - } - - public boolean isValid(Player player, boolean groundValid) - { - //Near Other Player - for (Player other : UtilServer.getPlayers()) - { - if (player.equals(other)) - continue; - - if (other.getGameMode() != GameMode.SURVIVAL || UtilPlayer.isSpectator(player)) - continue; - - if (other.getVehicle() != null) - continue; - - if (UtilMath.offset(player, other) < 2) - return true; - } - - if (player.isFlying() || ((CraftPlayer) player).getHandle().isGliding() || player.isInsideVehicle() || player.getGameMode() != GameMode.SURVIVAL || UtilPlayer.isSpectator(player)) + if (_detailedMessages.add(player.getName())) { return true; } - - if (UtilInv.IsItem(player.getInventory().getArmorContents()[2], Material.ELYTRA, (byte) 0)) + else { - return true; - } - - //On Ground - if (groundValid) - { - if (UtilEnt.onBlock(player) || player.getLocation().getBlock().getType() != Material.AIR) - { - return true; - } - } - - if ((_ignore.containsKey(player) && System.currentTimeMillis() < _ignore.get(player))) - { - return true; - } - - return false; - } - - public void addSuspicion(Player player, String type) - { - if (!_enabled) - return; - - System.out.println(C.cRed + C.Bold + player.getName() + " suspected for " + type + "."); - - //Add Offense - if (!_offense.containsKey(player)) - _offense.put(player, new HashMap>()); - - if (!_offense.get(player).containsKey(type)) - _offense.get(player).put(type, new ArrayList()); - - _offense.get(player).get(type).add(System.currentTimeMillis()); - - //Cull & Count - int total = 0; - for (String curType : _offense.get(player).keySet()) - { - //Remove Old Offenses - Iterator offenseIterator = _offense.get(player).get(curType).iterator(); - while (offenseIterator.hasNext()) - { - if (UtilTime.elapsed(offenseIterator.next(), KeepOffensesFor)) - offenseIterator.remove(); - } - - //Count - total += _offense.get(player).get(curType).size(); - } - - // Print (Debug) - System.out.println("[Offense] #" + total + ": " + player.getName() + " received suspicion for " + type + "."); - } - - @EventHandler - public void generateReports(UpdateEvent event) - { - if (!_enabled) - return; - - if (event.getType() != UpdateType.SEC) - return; - - for (Iterator>>> playerIterator = _offense.entrySet().iterator(); playerIterator.hasNext(); ) - { - Entry>> entry = playerIterator.next(); - Player player = entry.getKey(); - - String out = ""; - int total = 0; - - for (String type : entry.getValue().keySet()) - { - //Remove Old Offenses - Iterator offenseIterator = entry.getValue().get(type).iterator(); - while (offenseIterator.hasNext()) - { - long time = offenseIterator.next(); - - if (UtilTime.elapsed(time, KeepOffensesFor)) - offenseIterator.remove(); - } - - //Count - int count = entry.getValue().get(type).size(); - total += count; - - out += count + " " + type + ", "; - } - - if (out.length() > 0) - out = out.substring(0, out.length() - 2); - - String severity = "Low"; - - if (total > (_strict ? 6 : 18)) - severity = "Extreme"; - else if (total > (_strict ? 4 : 12)) - severity = "High"; - else if (total > (_strict ? 2 : 6)) - severity = "Medium"; - - //Send Report - sendReport(player, out, severity); - - if (severity.equalsIgnoreCase("Extreme")) - { - playerIterator.remove(); - resetAll(player, false); - } + _detailedMessages.remove(player.getName()); + return false; } } @@ -1005,13 +366,11 @@ public class AntiHack extends MiniPlugin if (_ignoredChecks.contains(event.getCheckClass())) return; + ACTIONS.getOrDefault(event.getCheckClass(), NOOP_ACTION).handle(event); + if (event.shouldTellStaff()) { - CheckThresholds thresholds = CHECKS.get(event.getHackType()); - if (thresholds == null) - { - thresholds = new CheckThresholds(event.getHackType(), 0, Integer.MAX_VALUE, Integer.MAX_VALUE); - } + CheckThresholds thresholds = CHECKS.getOrDefault(event.getCheckClass(), NOOP_THRESHOLD); CheckThresholds.Severity severity = thresholds.getSeverity(event.getViolations()); if (severity == CheckThresholds.Severity.NONE) @@ -1022,18 +381,9 @@ public class AntiHack extends MiniPlugin String key = event.getPlayer().getName() + "." + event.getHackType() + "." + severity.toString(); Integer pastVl = this._cooldown.getIfPresent(key); - if (pastVl != null) + if (pastVl == null) { - if (event.getViolations() - pastVl > VL_DIFF_BEFORE_RENOTIFY) - { - this._cooldown.put(key, event.getViolations()); - MajorViolationCommand command = new MajorViolationCommand(_thisServer, event.getPlayer().getName(), event.getHackType(), event.getViolations(), event.getMessage()); - ServerCommandManager.getInstance().publishCommand(command); - } - } - else - { - MajorViolationCommand command = new MajorViolationCommand(_thisServer, event.getPlayer().getName(), event.getHackType(), event.getViolations(), event.getMessage()); + MajorViolationCommand command = new MajorViolationCommand(_thisServer, event.getPlayer().getName(), CheckManager.getCheckSimpleName(event.getCheckClass()), event.getViolations(), event.getMessage()); ServerCommandManager.getInstance().publishCommand(command); this._cooldown.put(key, event.getViolations()); @@ -1041,138 +391,10 @@ public class AntiHack extends MiniPlugin } } - public void sendReport(Player player, String report, String severity) - { - if (severity.equals("Extreme")) - { - //Staff - boolean handled = false; - for (Player staff : UtilServer.getPlayers()) - { - if (_clientManager.Get(staff).GetRank().has(Rank.MODERATOR)) - { - UtilPlayer.message(staff, C.cAqua + C.Scramble + "A" + ChatColor.RESET + C.cRed + C.Bold + " MAC > " + ChatColor.RESET + C.cYellow + report); - UtilPlayer.message(staff, C.cAqua + C.Scramble + "A" + ChatColor.RESET + C.cRed + C.Bold + " MAC > " + ChatColor.RESET + C.cGold + player.getName() + C.cYellow + " has extreme violation."); - - handled = true; - } - } - - //Record - ServerListPingEvent event = new ServerListPingEvent(null, Bukkit.getServer().getMotd(), Bukkit.getServer().getOnlinePlayers().size(), Bukkit.getServer().getMaxPlayers()); - getPluginManager().callEvent(event); - - String motd = event.getMotd(); - String game = "N/A"; - String map = "N/A"; - - String[] args = motd.split("\\|"); - - if (args.length > 0) - motd = args[0]; - - if (args.length > 2) - game = args[2]; - - if (args.length > 3) - map = args[3]; - - _repository.saveOffense(player, motd, game, map, report); - } - } - - private void reset() - { - for (Player player : UtilServer.getPlayers()) - resetAll(player); - } - - private void resetAll(Player player) - { - resetAll(player, true); - } - - private void resetAll(Player player, boolean removeOffenses) - { - _ignore.remove(player); - _velocityEvent.remove(player); - _lastMoveEvent.remove(player); - - if (removeOffenses) - _offense.remove(player); - - for (Detector detector : _movementDetectors) - detector.Reset(player); - - for (Detector detector : _combatDetectors) - detector.Reset(player); - } - - @EventHandler - public void cleanupPlayers(UpdateEvent event) - { - if (!_enabled) - return; - - if (event.getType() != UpdateType.SLOW) - return; - - for (Iterator> playerIterator = _ignore.entrySet().iterator(); playerIterator.hasNext(); ) - { - Player player = playerIterator.next().getKey(); - - if (!player.isOnline() || player.isDead() || !player.isValid()) - { - playerIterator.remove(); - - _velocityEvent.remove(player); - _lastMoveEvent.remove(player); - - _offense.remove(player); - - for (Detector detector : _movementDetectors) - detector.Reset(player); - - for (Detector detector : _combatDetectors) - detector.Reset(player); - } - } - - - for (Iterator playerIterator = _hubAttempted.iterator(); playerIterator.hasNext(); ) - { - Player player = playerIterator.next(); - - if (!player.isOnline() || !player.isValid()) - { - playerIterator.remove(); - } - } - } - - public void setEnabled(boolean b) - { - _enabled = b; - System.out.println("MAC Enabled: " + b); - } - - public boolean isEnabled() - { - return _enabled; - } - - public void setStrict(boolean strict) - { - _strict = strict; - - reset(); - - System.out.println("MAC Strict: " + strict); - } - /** * Add a GWEN Anticheat class to the ignored checks. * All violation events for these checks will be ignored + * * @param check The class of the check to ignore */ public void addIgnoredCheck(Class check) @@ -1189,27 +411,73 @@ public class AntiHack extends MiniPlugin _ignoredChecks.clear(); } + public void enableAnticheat() + { + UtilServer.CallEvent(new GameStartEvent()); + } + + public void disableAnticheat() + { + UtilServer.CallEvent(new GameEndEvent()); + } + + private BaseComponent[] getDetailedMessage(MajorViolationCommand violation) + { + return new ComponentBuilder("") + .append("A").color(ChatColor.AQUA).obfuscated(true) + .append(" GWEN > ", ComponentBuilder.FormatRetention.NONE).color(ChatColor.RED).bold(true) + .append(violation.getPlayerName(), ComponentBuilder.FormatRetention.NONE).color(ChatColor.GOLD) + .append(" failed " + violation.getHackType() + " VL" + violation.getViolations() + " in server", ComponentBuilder.FormatRetention.NONE).color(ChatColor.YELLOW) + .append(violation.getOriginatingServer(), ComponentBuilder.FormatRetention.NONE).color(ChatColor.YELLOW) + .event(new ClickEvent(ClickEvent.Action.RUN_COMMAND, "/server " + violation.getOriginatingServer())) + .event(new HoverEvent(HoverEvent.Action.SHOW_TEXT, + new ComponentBuilder("Teleport to " + violation.getOriginatingServer()).create())) + .append(": " + violation.getMessage() + ".", ComponentBuilder.FormatRetention.NONE).color(ChatColor.YELLOW) + .create(); + } + + private BaseComponent[] getMinimalMessage(MajorViolationCommand violation) + { + Class checkType = CheckManager.getCheckBySimpleName(violation.getHackType()); + if (!CHECKS.containsKey(checkType)) + { + System.out.println("Warning: Unknown check type '" + violation.getHackType() + "' " + checkType); + } + ComponentBuilder componentBuilder = new ComponentBuilder("") + .append("A").color(ChatColor.AQUA).obfuscated(true) + .append(" GWEN > ", ComponentBuilder.FormatRetention.NONE).color(ChatColor.RED).bold(true) + .append(violation.getPlayerName(), ComponentBuilder.FormatRetention.NONE).color(ChatColor.GOLD) + .append(" suspected of ", ComponentBuilder.FormatRetention.NONE).color(ChatColor.YELLOW); + CHECKS.getOrDefault(checkType, NOOP_THRESHOLD).format(componentBuilder, violation.getViolations()); + + if (!violation.getOriginatingServer().equals(this._thisServer)) + { + componentBuilder.append(" in ", ComponentBuilder.FormatRetention.NONE).color(ChatColor.YELLOW) + .append(violation.getOriginatingServer()).color(ChatColor.AQUA) + .event(new ClickEvent(ClickEvent.Action.RUN_COMMAND, "/server " + violation.getOriginatingServer())) + .event(new HoverEvent(HoverEvent.Action.SHOW_TEXT, + new ComponentBuilder("Teleport to " + violation.getOriginatingServer()).create())); + } + + componentBuilder.append(".").color(ChatColor.YELLOW); + + return componentBuilder.create(); + } + + public static String generateId() + { + byte[] holder = new byte[ID_LENGTH]; + ThreadLocalRandom.current().nextBytes(holder); + return DatatypeConverter.printHexBinary(holder); + } + public boolean isStrict() { return _strict; } - public void setKick(boolean kick) + public void setStrict(boolean strict) { - _kick = kick; - - System.out.println("MAC Kick: " + kick); - } - - public void enableNewAnticheat() - { - UtilServer.CallEvent(new GameStartEvent()); - System.out.println("Enabled new anticheat"); - } - - public void disableNewAnticheat() - { - UtilServer.CallEvent(new GameEndEvent()); - System.out.println("Disabled new anticheat"); + this._strict = strict; } } diff --git a/Plugins/Mineplex.Core/src/mineplex/core/antihack/AntiHackRepository.java b/Plugins/Mineplex.Core/src/mineplex/core/antihack/AntiHackRepository.java deleted file mode 100644 index eb3b3cd0c..000000000 --- a/Plugins/Mineplex.Core/src/mineplex/core/antihack/AntiHackRepository.java +++ /dev/null @@ -1,71 +0,0 @@ -package mineplex.core.antihack; - -import java.sql.Connection; -import java.sql.PreparedStatement; -import java.sql.SQLException; - -import mineplex.serverdata.database.DBPool; - -import org.bukkit.craftbukkit.v1_8_R3.entity.CraftPlayer; -import org.bukkit.entity.Player; - -public class AntiHackRepository -{ - private String _serverName; - - //private static String CREATE_TABLE = "CREATE TABLE IF NOT EXISTS AntiHack_Kick_Log (id INT NOT NULL AUTO_INCREMENT, updated LONG, playerName VARCHAR(256), motd VARCHAR(56), gameType VARCHAR(56), map VARCHAR(256), serverName VARCHAR(256), report VARCHAR(256), ping VARCHAR(25), PRIMARY KEY (id));"; - private static String UPDATE_PLAYER_OFFENSES = "INSERT INTO AntiHack_Kick_Log (updated, playerName, motd, gameType, map, serverName, report, ping) VALUES (now(), ?, ?, ?, ?, ?, ?, ?);"; - - public AntiHackRepository(String serverName) - { - _serverName = serverName; - } - - public void initialize() - { - } - - public void saveOffense(final Player player, final String motd, final String game, final String map, final String report) - { - new Thread(new Runnable() - { - public void run() - { - PreparedStatement preparedStatement = null; - - try (Connection connection = DBPool.getMineplexStats().getConnection()) - { - preparedStatement = connection.prepareStatement(UPDATE_PLAYER_OFFENSES); - - preparedStatement.setString(1, player.getName()); - preparedStatement.setString(2, motd); - preparedStatement.setString(3, game); - preparedStatement.setString(4, map); - preparedStatement.setString(5, _serverName); - preparedStatement.setString(6, report); - preparedStatement.setString(7, ((CraftPlayer)player).getHandle().ping + "ms"); - - preparedStatement.execute(); - } - catch (Exception exception) - { - exception.printStackTrace(); - } - finally - { - if (preparedStatement != null) - { - try - { - preparedStatement.close(); - } - catch (SQLException e) - { - e.printStackTrace(); - } - } - } - } - }).start(); - } -} diff --git a/Plugins/Mineplex.Core/src/mineplex/core/antihack/CheckThresholds.java b/Plugins/Mineplex.Core/src/mineplex/core/antihack/CheckThresholds.java index f64783e55..590739775 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/antihack/CheckThresholds.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/antihack/CheckThresholds.java @@ -1,5 +1,7 @@ package mineplex.core.antihack; +import net.md_5.bungee.api.ChatColor; +import net.md_5.bungee.api.chat.ComponentBuilder; import net.minecraft.server.v1_8_R3.ChatComponentText; import net.minecraft.server.v1_8_R3.ChatModifier; import net.minecraft.server.v1_8_R3.EnumChatFormat; @@ -25,10 +27,9 @@ public class CheckThresholds return _friendlyName; } - public IChatBaseComponent format(int violationLevel) + public void format(ComponentBuilder builder, int violationLevel) { - EnumChatFormat color = getSeverity(violationLevel)._color; - return new ChatComponentText(_friendlyName).setChatModifier(new ChatModifier().setColor(color)); + builder.append(_friendlyName, ComponentBuilder.FormatRetention.NONE).color(getSeverity(violationLevel)._color); } public Severity getSeverity(int violationLevel) @@ -51,14 +52,14 @@ public class CheckThresholds public enum Severity { - NONE(EnumChatFormat.GREEN), - LOW(EnumChatFormat.GREEN), - MEDIUM(EnumChatFormat.GOLD), - HIGH(EnumChatFormat.RED), + NONE(ChatColor.GREEN), + LOW(ChatColor.GREEN), + MEDIUM(ChatColor.GOLD), + HIGH(ChatColor.RED), ; - private final EnumChatFormat _color; + private final ChatColor _color; - Severity(EnumChatFormat color) + Severity(ChatColor color) { _color = color; } diff --git a/Plugins/Mineplex.Core/src/mineplex/core/antihack/Detector.java b/Plugins/Mineplex.Core/src/mineplex/core/antihack/Detector.java deleted file mode 100644 index 5cfec165e..000000000 --- a/Plugins/Mineplex.Core/src/mineplex/core/antihack/Detector.java +++ /dev/null @@ -1,8 +0,0 @@ -package mineplex.core.antihack; - -import org.bukkit.entity.Player; - -public interface Detector -{ - public void Reset(Player player); -} diff --git a/Plugins/Mineplex.Core/src/mineplex/core/antihack/MineplexLinkImpl.java b/Plugins/Mineplex.Core/src/mineplex/core/antihack/MineplexLinkImpl.java new file mode 100644 index 000000000..6195a3fd2 --- /dev/null +++ b/Plugins/Mineplex.Core/src/mineplex/core/antihack/MineplexLinkImpl.java @@ -0,0 +1,50 @@ +package mineplex.core.antihack; + +import net.minecraft.server.v1_8_R3.MinecraftServer; + +import org.bukkit.craftbukkit.v1_8_R3.entity.CraftPlayer; +import org.bukkit.entity.EntityType; +import org.bukkit.entity.Player; + +import com.mineplex.anticheat.api.MineplexLink; + +import mineplex.core.Managers; +import mineplex.core.common.util.UtilPlayer; +import mineplex.core.disguise.DisguiseManager; +import mineplex.core.disguise.disguises.DisguiseBase; + +public class MineplexLinkImpl implements MineplexLink +{ + private final DisguiseManager _disguiseManager = Managers.require(DisguiseManager.class); + + @Override + public EntityType getActiveDisguise(Player player) + { + DisguiseBase disguise = _disguiseManager.getActiveDisguise(player); + return disguise != null ? disguise.getDisguiseType() : null; + } + + @Override + public boolean isSpectator(Player player) + { + return UtilPlayer.isSpectator(player); + } + + @Override + public double getTPS() + { + return MinecraftServer.getServer().recentTps[0]; // Return the average TPS from the last minute + } + + @Override + public int getPing(Player player) + { + return Math.min(((CraftPlayer) player).getHandle().ping, 1000); + } + + @Override + public boolean isUsingItem(Player player) + { + return ((CraftPlayer) player).getHandle().bS(); // See Anticheat javadoc + } +} diff --git a/Plugins/Mineplex.Core/src/mineplex/core/antihack/ViolationLevels.java b/Plugins/Mineplex.Core/src/mineplex/core/antihack/ViolationLevels.java new file mode 100644 index 000000000..00a800bce --- /dev/null +++ b/Plugins/Mineplex.Core/src/mineplex/core/antihack/ViolationLevels.java @@ -0,0 +1,87 @@ +package mineplex.core.antihack; + +import com.mineplex.anticheat.checks.Check; +import com.mineplex.anticheat.checks.CheckManager; + +import gnu.trove.map.TObjectIntMap; +import gnu.trove.map.hash.TObjectIntHashMap; + +/** + * Locally cached information about a user's max violations and total number of alerts for each + * check type. + *

+ * Instances of this have no concept of identity i.e. account id is not tracked by this. + */ +public class ViolationLevels +{ + private final TObjectIntMap> _maxViolations; + + private final TObjectIntMap> _totalAlerts; + + private final TObjectIntMap> _lastBan; + + public ViolationLevels() + { + _maxViolations = new TObjectIntHashMap<>(CheckManager.AVAILABLE_CHECKS.size()); + _totalAlerts = new TObjectIntHashMap<>(CheckManager.AVAILABLE_CHECKS.size()); + _lastBan = new TObjectIntHashMap<>(CheckManager.AVAILABLE_CHECKS.size()); + } + + public void updateMaxViolations(Class check, int violationLevel) + { + if (violationLevel > _maxViolations.get(check)) + { + _maxViolations.put(check, violationLevel); + } + } + + public void updateMaxViolationsSinceLastBan(Class check, int violationLevel) + { + if (violationLevel > _lastBan.get(check)) + { + _lastBan.put(check, violationLevel); + } + } + + public void incrementAlerts(Class check) + { + int cur = _totalAlerts.get(check); + + setTotalAlerts(check, cur + 1); + } + + public void setTotalAlerts(Class check, int totalAlerts) + { + _totalAlerts.put(check, totalAlerts); + } + + public int getTotalAlertsForCheck(Class check) + { + if (_totalAlerts.containsKey(check)) + { + return _totalAlerts.get(check); + } + + return -1; + } + + public int getMaxViolationsForCheck(Class check) + { + if (_maxViolations.containsKey(check)) + { + return _maxViolations.get(check); + } + + return -1; + } + + public int getLastBanViolationsForCheck(Class check) + { + if (_lastBan.containsKey(check)) + { + return _lastBan.get(check); + } + + return -1; + } +} diff --git a/Plugins/Mineplex.Core/src/mineplex/core/antihack/actions/AntiHackAction.java b/Plugins/Mineplex.Core/src/mineplex/core/antihack/actions/AntiHackAction.java index ddcc5e909..f3b748352 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/antihack/actions/AntiHackAction.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/antihack/actions/AntiHackAction.java @@ -1,52 +1,20 @@ package mineplex.core.antihack.actions; import com.mineplex.anticheat.api.PlayerViolationEvent; -import com.mineplex.anticheat.checks.combat.KillauraTypeA; -import com.mineplex.anticheat.checks.combat.KillauraTypeD; -import com.mineplex.anticheat.checks.move.Glide; -import com.mineplex.anticheat.checks.move.Speed; -import mineplex.core.common.util.UtilServer; -import org.bukkit.event.Listener; -import java.util.Date; -import java.util.HashMap; -import java.util.Map; -import java.util.concurrent.TimeUnit; - -public abstract class AntiHackAction implements Listener +public abstract class AntiHackAction { - private static final Map, AntiHackAction> ACTIONS = new HashMap<>(); - private static final AntiHackAction NOOP_ACTION = new NoopAction(); - - private static final Date NEXT_BAN_WAVE = new Date(System.currentTimeMillis() + TimeUnit.MINUTES.toMillis(5)); - - static - { - ACTIONS.put(KillauraTypeA.class, new ImmediateBanAction(200)); - ACTIONS.put(KillauraTypeD.class, new BanwaveAction(2000)); - ACTIONS.put(Glide.class, new ImmediateBanAction(10000)); - ACTIONS.put(Speed.class, new ImmediateBanAction(10000)); - } - - private int _vl; + private final int _vl; AntiHackAction(int vl) { this._vl = vl; - - UtilServer.RegisterEvents(this); } - public abstract void handle(PlayerViolationEvent event); - - public int getMinVl() + public final int getMinVl() { return this._vl; } - public static AntiHackAction getAction(Class checkClass) - { - AntiHackAction action = ACTIONS.getOrDefault(checkClass, NOOP_ACTION); - return action; - } + public abstract void handle(PlayerViolationEvent event); } diff --git a/Plugins/Mineplex.Core/src/mineplex/core/antihack/actions/BanwaveAction.java b/Plugins/Mineplex.Core/src/mineplex/core/antihack/actions/BanwaveAction.java index 876671029..694c75488 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/antihack/actions/BanwaveAction.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/antihack/actions/BanwaveAction.java @@ -1,17 +1,19 @@ package mineplex.core.antihack.actions; import com.mineplex.anticheat.api.PlayerViolationEvent; + import mineplex.core.Managers; +import mineplex.core.antihack.AntiHack; import mineplex.core.antihack.banwave.BanWaveManager; import mineplex.core.common.util.UtilMath; import mineplex.core.common.util.UtilServer; -class BanwaveAction extends AntiHackAction +public class BanwaveAction extends AntiHackAction { private static final int BAN_DELAY_AVERAGE = 6 * 60 * 60 * 1000; // 6 hours private static final int BAN_DELAY_VARIANCE_SPAN = 4 * 60 * 60 * 1000; // 4 hours total; 2 on either side - BanwaveAction(int vl) + public BanwaveAction(int vl) { super(vl); } @@ -19,6 +21,11 @@ class BanwaveAction extends AntiHackAction @Override public void handle(PlayerViolationEvent event) { + if (event.getViolations() >= (Math.floor(getMinVl() * .9)) && event.getPlayer().getMetadata("GWENEXTREMEPREJUDICE").get(0).asBoolean()) + { + Managers.get(AntiHack.class).doBan(event.getPlayer(), event.getCheckClass(), true); + return; + } if (event.getViolations() >= this.getMinVl()) { // Delay bans by 6 hours +/- 2 hours for fuzzing @@ -27,7 +34,6 @@ class BanwaveAction extends AntiHackAction event.getPlayer(), banTime, event.getCheckClass(), - "[GWEN] Hacking [BanWave]", event.getViolations(), UtilServer.getServerName() ); diff --git a/Plugins/Mineplex.Core/src/mineplex/core/antihack/actions/GEPBanAction.java b/Plugins/Mineplex.Core/src/mineplex/core/antihack/actions/GEPBanAction.java new file mode 100644 index 000000000..0fbaa3377 --- /dev/null +++ b/Plugins/Mineplex.Core/src/mineplex/core/antihack/actions/GEPBanAction.java @@ -0,0 +1,23 @@ +package mineplex.core.antihack.actions; + +import com.mineplex.anticheat.api.PlayerViolationEvent; + +import mineplex.core.Managers; +import mineplex.core.antihack.AntiHack; + +public class GEPBanAction extends AntiHackAction +{ + public GEPBanAction(int vl) + { + super(vl); + } + + @Override + public void handle(PlayerViolationEvent event) + { + if (event.getViolations() >= this.getMinVl() && event.getPlayer().getMetadata("GWENEXTREMEPREJUDICE").get(0).asBoolean()) + { + Managers.get(AntiHack.class).doBan(event.getPlayer(), event.getCheckClass(), true); + } + } +} \ No newline at end of file diff --git a/Plugins/Mineplex.Core/src/mineplex/core/antihack/actions/ImmediateBanAction.java b/Plugins/Mineplex.Core/src/mineplex/core/antihack/actions/ImmediateBanAction.java index ce6eeaf08..1016ba9c5 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/antihack/actions/ImmediateBanAction.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/antihack/actions/ImmediateBanAction.java @@ -1,13 +1,13 @@ package mineplex.core.antihack.actions; import com.mineplex.anticheat.api.PlayerViolationEvent; + import mineplex.core.Managers; import mineplex.core.antihack.AntiHack; -import mineplex.core.common.util.UtilServer; -class ImmediateBanAction extends AntiHackAction +public class ImmediateBanAction extends AntiHackAction { - ImmediateBanAction(int vl) + public ImmediateBanAction(int vl) { super(vl); } @@ -15,14 +15,14 @@ class ImmediateBanAction extends AntiHackAction @Override public void handle(PlayerViolationEvent event) { + if (event.getViolations() >= (Math.floor(getMinVl() * .9)) && event.getPlayer().getMetadata("GWENEXTREMEPREJUDICE").get(0).asBoolean()) + { + Managers.get(AntiHack.class).doBan(event.getPlayer(), event.getCheckClass(), true); + return; + } if (event.getViolations() >= this.getMinVl()) { - String server = UtilServer.getServerName(); - if (server.contains("-")) - { - server = server.substring(0, server.indexOf('-')); - } - Managers.get(AntiHack.class).doBan(event.getPlayer(), "[GWEN] Hacking [" + server + "]"); + Managers.get(AntiHack.class).doBan(event.getPlayer(), event.getCheckClass(), false); } } } diff --git a/Plugins/Mineplex.Core/src/mineplex/core/antihack/actions/MixedAction.java b/Plugins/Mineplex.Core/src/mineplex/core/antihack/actions/MixedAction.java deleted file mode 100644 index 14066a4d7..000000000 --- a/Plugins/Mineplex.Core/src/mineplex/core/antihack/actions/MixedAction.java +++ /dev/null @@ -1,49 +0,0 @@ -package mineplex.core.antihack.actions; - -import com.mineplex.anticheat.api.PlayerViolationEvent; - -import java.util.ArrayList; -import java.util.Arrays; -import java.util.Collections; -import java.util.HashMap; -import java.util.HashSet; -import java.util.List; -import java.util.Map; -import java.util.Set; -import java.util.UUID; - -public class MixedAction extends AntiHackAction -{ - private List _actions = new ArrayList<>(); - private Map> _punished = new HashMap<>(); - - public MixedAction(AntiHackAction firstAction, AntiHackAction... actions) - { - super(firstAction.getMinVl()); - this._actions.add(firstAction); - this._actions.addAll(Arrays.asList(actions)); - } - - - @Override - public void handle(PlayerViolationEvent event) - { - for (int i = this._actions.size() - 1; i >= 0; i--) - { - AntiHackAction action = this._actions.get(i); - if (action.getMinVl() <= event.getViolations()) - { - if (_punished.computeIfAbsent(event.getPlayer().getUniqueId(), key -> new HashSet<>()).add(action)) - { - action.handle(event); - } - break; - } - } - } - - public int getMinVl() - { - return this._actions.get(0).getMinVl(); - } -} diff --git a/Plugins/Mineplex.Core/src/mineplex/core/antihack/actions/NoopAction.java b/Plugins/Mineplex.Core/src/mineplex/core/antihack/actions/NoopAction.java index 38794c630..848322ac3 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/antihack/actions/NoopAction.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/antihack/actions/NoopAction.java @@ -4,7 +4,7 @@ import com.mineplex.anticheat.api.PlayerViolationEvent; public class NoopAction extends AntiHackAction { - NoopAction() + public NoopAction() { super(Integer.MAX_VALUE); } diff --git a/Plugins/Mineplex.Core/src/mineplex/core/antihack/animations/BanwaveAnimation.java b/Plugins/Mineplex.Core/src/mineplex/core/antihack/animations/BanwaveAnimation.java new file mode 100644 index 000000000..e3af1b117 --- /dev/null +++ b/Plugins/Mineplex.Core/src/mineplex/core/antihack/animations/BanwaveAnimation.java @@ -0,0 +1,9 @@ +package mineplex.core.antihack.animations; + +import mineplex.core.antihack.AntiHack; +import org.bukkit.entity.Player; + +public interface BanwaveAnimation +{ + void run(Player player, Runnable after); +} diff --git a/Plugins/Mineplex.Core/src/mineplex/core/antihack/animations/BanwaveAnimationSpin.java b/Plugins/Mineplex.Core/src/mineplex/core/antihack/animations/BanwaveAnimationSpin.java new file mode 100644 index 000000000..3370f28f2 --- /dev/null +++ b/Plugins/Mineplex.Core/src/mineplex/core/antihack/animations/BanwaveAnimationSpin.java @@ -0,0 +1,123 @@ +package mineplex.core.antihack.animations; + +import com.google.common.util.concurrent.AtomicDouble; +import mineplex.core.antihack.AntiHack; +import mineplex.core.antihack.guardians.AntiHackGuardian; +import mineplex.core.common.util.UtilEnt; +import mineplex.core.common.util.UtilParticle; +import mineplex.core.common.util.UtilServer; +import net.minecraft.server.v1_8_R3.MathHelper; +import org.bukkit.Location; +import org.bukkit.entity.Player; +import org.bukkit.potion.PotionEffect; +import org.bukkit.potion.PotionEffectType; +import org.bukkit.scheduler.BukkitRunnable; + +import java.util.concurrent.atomic.AtomicInteger; +import java.util.function.Function; + +public class BanwaveAnimationSpin implements BanwaveAnimation +{ + @Override + public void run(Player player, Runnable after) + { + float oldWalkSpeed = player.getWalkSpeed(); + player.setWalkSpeed(0); + player.addPotionEffect(new PotionEffect(PotionEffectType.JUMP, 999999, -10)); + + double radius = 4; + double heightAdj = 8; + + double baseDeg = 18; + + Location center = player.getLocation().add(0, heightAdj, 0); + AntiHackGuardian north = new AntiHackGuardian(center.clone().add(0, 0, -radius), 0, 0, 0, 0, 0, 0, false); + AntiHackGuardian east = new AntiHackGuardian(center.clone().add(radius, 0, 0), 0, 0, 0, 0, 0, 0, false); + AntiHackGuardian south = new AntiHackGuardian(center.clone().add(0, 0, radius), 0, 0, 0, 0, 0, 0, false); + AntiHackGuardian west = new AntiHackGuardian(center.clone().add(-radius, 0, 0), 0, 0, 0, 0, 0, 0, false); + + UtilEnt.CreatureLook(east.getEntity(), player); + UtilEnt.CreatureLook(west.getEntity(), player); + UtilEnt.CreatureLook(south.getEntity(), player); + UtilEnt.CreatureLook(north.getEntity(), player); + + Function magic = seconds -> Math.pow(2, seconds - 5); + + UtilServer.runSyncLater(() -> + { + north.shoot(player); + east.shoot(player); + south.shoot(player); + west.shoot(player); + + // We get 5 seconds, or 100 ticks + AtomicInteger timer = new AtomicInteger(5); + + AtomicDouble cNorth = new AtomicDouble(270); + AtomicDouble cEast = new AtomicDouble(0); + AtomicDouble cSouth = new AtomicDouble(90); + AtomicDouble cWest = new AtomicDouble(180); + + UtilServer.runSyncTimer(new BukkitRunnable() + { + public void run() + { + timer.getAndIncrement(); + if (timer.get() > 100) + { + cancel(); + + player.removePotionEffect(PotionEffectType.JUMP); + player.setWalkSpeed(oldWalkSpeed); + Location location = player.getLocation(); + + UtilParticle.PlayParticle(UtilParticle.ParticleType.HUGE_EXPLOSION, player.getLocation(), 3f, 3f, 3f, 0, 32, UtilParticle.ViewDist.MAX, UtilServer.getPlayers()); + + after.run(); + + north.shoot(null); + south.shoot(null); + east.shoot(null); + west.shoot(null); + UtilEnt.CreatureLook(north.getEntity(), location); + UtilEnt.CreatureLook(south.getEntity(), location); + UtilEnt.CreatureLook(east.getEntity(), location); + UtilEnt.CreatureLook(west.getEntity(), location); + UtilServer.runSyncLater(() -> + { + north.remove(); + south.remove(); + east.remove(); + west.remove(); + }, 40L); + return; + } + + double seconds = timer.get() / 20.0; + + double rate = magic.apply(seconds) * 3 * baseDeg; + + player.getLocation(center); + center.add(0, heightAdj, 0); + + { + cNorth.addAndGet(rate); + north.move(center.getX() + radius * MathHelper.cos((float) Math.toRadians(cNorth.get())), center.getY(), center.getZ() + radius * MathHelper.sin((float) Math.toRadians(cNorth.get()))); + } + { + cSouth.addAndGet(rate); + south.move(center.getX() + radius * MathHelper.cos((float) Math.toRadians(cSouth.get())), center.getY(), center.getZ() + radius * MathHelper.sin((float) Math.toRadians(cSouth.get()))); + } + { + cEast.addAndGet(rate); + east.move(center.getX() + radius * MathHelper.cos((float) Math.toRadians(cEast.get())), center.getY(), center.getZ() + radius * MathHelper.sin((float) Math.toRadians(cEast.get()))); + } + { + cWest.addAndGet(rate); + west.move(center.getX() + radius * MathHelper.cos((float) Math.toRadians(cWest.get())), center.getY(), center.getZ() + radius * MathHelper.sin((float) Math.toRadians(cWest.get()))); + } + } + }, 5L, 1L); + }, 20); + } +} diff --git a/Plugins/Mineplex.Core/src/mineplex/core/antihack/banwave/BanWaveManager.java b/Plugins/Mineplex.Core/src/mineplex/core/antihack/banwave/BanWaveManager.java index dd2bebe96..668c60db2 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/antihack/banwave/BanWaveManager.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/antihack/banwave/BanWaveManager.java @@ -5,14 +5,25 @@ import mineplex.core.ReflectivelyCreateMiniPlugin; import mineplex.core.account.CoreClient; import mineplex.core.account.CoreClientManager; import mineplex.core.antihack.AntiHack; +import mineplex.core.antihack.logging.AntihackLogger; +import mineplex.core.antihack.redisnotifications.GwenBanwaveNotification; +import mineplex.core.common.util.UtilServer; +import mineplex.serverdata.commands.ServerCommandManager; + +import org.bukkit.Bukkit; import org.bukkit.entity.Player; import org.bukkit.event.EventHandler; import org.bukkit.event.player.PlayerJoinEvent; +import com.google.gson.JsonObject; +import com.mineplex.anticheat.checks.Check; +import com.mineplex.anticheat.checks.CheckManager; + @ReflectivelyCreateMiniPlugin public class BanWaveManager extends MiniPlugin { private final BanWaveRepository _repository = new BanWaveRepository(); + private final CoreClientManager _clientManager = require(CoreClientManager.class); private BanWaveManager() { @@ -32,30 +43,44 @@ public class BanWaveManager extends MiniPlugin if (info.getTimeToBan() < now) { - require(AntiHack.class).doBanWave(event.getPlayer(), info.getMessage()); + require(AntiHack.class).doBanWave(event.getPlayer(), info); _repository.flagDone(info); } }); }); } - public void insertBanWaveInfo(Player player, long timeToBan, Class checkClass, String message, int vl, String server) + public void insertBanWaveInfo(Player player, long timeToBan, Class checkClass, int vl, String server) { - insertBanWaveInfo(player, timeToBan, checkClass, message, vl, server, null); + insertBanWaveInfo(player, timeToBan, checkClass, vl, server, null); } - public void insertBanWaveInfo(Player player, long timeToBan, Class checkClass, String message, int vl, String server, Runnable after) + public void insertBanWaveInfo(Player player, long timeToBan, Class checkClass, int vl, String server, Runnable after) { runAsync(() -> { - CoreClient client = require(CoreClientManager.class).Get(player); + String id = AntiHack.generateId(); + String newMessage = "[GWEN] [BanWave] " + id; - this._repository.insertBanWaveInfo(client.getAccountId(), timeToBan, checkClass.getName(), message, vl, server); + CoreClient client = _clientManager.Get(player); - if (after != null) + if (this._repository.insertBanWaveInfo(client.getAccountId(), timeToBan, CheckManager.getCheckSimpleName(checkClass), newMessage, vl, server)) { - after.run(); + runAsync(() -> + { + new GwenBanwaveNotification(UtilServer.getServerName(), player.getName(), player.getUniqueId().toString(), client.GetRank().name(), CheckManager.getCheckSimpleName(checkClass), id, timeToBan).publish(); + }); + + JsonObject custom = new JsonObject(); + custom.addProperty("is-banwave", true); + + require(AntihackLogger.class).saveMetadata(player, id, after, custom); } }); } + + public void flagDone(CoreClient client) + { + _repository.flagDone(client.getAccountId()); + } } diff --git a/Plugins/Mineplex.Core/src/mineplex/core/antihack/banwave/BanWaveRepository.java b/Plugins/Mineplex.Core/src/mineplex/core/antihack/banwave/BanWaveRepository.java index ff41ab647..d2aa19eb1 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/antihack/banwave/BanWaveRepository.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/antihack/banwave/BanWaveRepository.java @@ -1,14 +1,14 @@ package mineplex.core.antihack.banwave; import mineplex.core.common.util.Callback; -import mineplex.core.common.util.UtilServer; import mineplex.core.database.MinecraftRepository; import mineplex.serverdata.database.DBPool; +import mineplex.serverdata.database.RepositoryBase; import mineplex.serverdata.database.column.ColumnInt; import mineplex.serverdata.database.column.ColumnLong; import mineplex.serverdata.database.column.ColumnVarChar; -public class BanWaveRepository extends MinecraftRepository +public class BanWaveRepository extends RepositoryBase { private static final String INITIALIZE_PENDING_TABLE = "CREATE TABLE IF NOT EXISTS banwavePending (" + "accountId INT(11) NOT NULL, " + @@ -38,19 +38,7 @@ public class BanWaveRepository extends MinecraftRepository BanWaveRepository() { - super(UtilServer.getPlugin(), DBPool.getAccount()); - } - - @Override - protected void initialize() - { - //executeUpdate(INITIALIZE_TABLE); - } - - @Override - protected void update() - { - + super(DBPool.getAccount()); } void getPendingBanWaveInfo(int accountId, Callback callback) @@ -72,9 +60,9 @@ public class BanWaveRepository extends MinecraftRepository }, new ColumnInt("accountId", accountId)); } - void insertBanWaveInfo(int accountId, long timeToBan, String hackType, String message, int vl, String server) + boolean insertBanWaveInfo(int accountId, long timeToBan, String hackType, String message, int vl, String server) { - executeInsert(INSERT_PENDING, null, + int affectedRows = executeInsert(INSERT_PENDING, null, new ColumnInt("accountId", accountId), new ColumnLong("timeToBan", timeToBan), new ColumnVarChar("hacktype", 64, hackType), @@ -82,11 +70,17 @@ public class BanWaveRepository extends MinecraftRepository new ColumnInt("vl", vl), new ColumnVarChar("server", 32, server) ); + return affectedRows > 0; } void flagDone(BanWaveInfo info) { - executeUpdate(PROCESS_WAVE_FOR_ACCOUNT, new ColumnInt("id", info.getAccountId())); - executeUpdate(DELETE_PENDING, new ColumnInt("id", info.getAccountId())); + flagDone(info.getAccountId()); + } + + public void flagDone(int accountId) + { + executeUpdate(PROCESS_WAVE_FOR_ACCOUNT, new ColumnInt("id", accountId)); + executeUpdate(DELETE_PENDING, new ColumnInt("id", accountId)); } } diff --git a/Plugins/Mineplex.Core/src/mineplex/core/antihack/commands/AnticheatOffCommand.java b/Plugins/Mineplex.Core/src/mineplex/core/antihack/commands/AnticheatOffCommand.java new file mode 100644 index 000000000..a3d1f4267 --- /dev/null +++ b/Plugins/Mineplex.Core/src/mineplex/core/antihack/commands/AnticheatOffCommand.java @@ -0,0 +1,24 @@ +package mineplex.core.antihack.commands; + +import org.bukkit.entity.Player; + +import mineplex.core.antihack.AntiHack; +import mineplex.core.command.CommandBase; +import mineplex.core.common.Rank; +import mineplex.core.common.util.F; +import mineplex.core.common.util.UtilPlayer; + +public class AnticheatOffCommand extends CommandBase +{ + public AnticheatOffCommand(AntiHack plugin) + { + super(plugin, Rank.DEVELOPER, "acoff"); + } + + @Override + public void Execute(Player caller, String[] args) + { + Plugin.disableAnticheat(); + UtilPlayer.message(caller, F.main(Plugin.getName(), "Disabled anticheat")); + } +} diff --git a/Plugins/Mineplex.Core/src/mineplex/core/antihack/commands/AnticheatOnCommand.java b/Plugins/Mineplex.Core/src/mineplex/core/antihack/commands/AnticheatOnCommand.java new file mode 100644 index 000000000..7c1f3a767 --- /dev/null +++ b/Plugins/Mineplex.Core/src/mineplex/core/antihack/commands/AnticheatOnCommand.java @@ -0,0 +1,24 @@ +package mineplex.core.antihack.commands; + +import org.bukkit.entity.Player; + +import mineplex.core.antihack.AntiHack; +import mineplex.core.command.CommandBase; +import mineplex.core.common.Rank; +import mineplex.core.common.util.F; +import mineplex.core.common.util.UtilPlayer; + +public class AnticheatOnCommand extends CommandBase +{ + public AnticheatOnCommand(AntiHack plugin) + { + super(plugin, Rank.DEVELOPER, "acon"); + } + + @Override + public void Execute(Player caller, String[] args) + { + Plugin.enableAnticheat(); + UtilPlayer.message(caller, F.main(Plugin.getName(), "Enabled anticheat")); + } +} diff --git a/Plugins/Mineplex.Core/src/mineplex/core/antihack/commands/DetailedMessagesCommand.java b/Plugins/Mineplex.Core/src/mineplex/core/antihack/commands/DetailedMessagesCommand.java new file mode 100644 index 000000000..e873d22e8 --- /dev/null +++ b/Plugins/Mineplex.Core/src/mineplex/core/antihack/commands/DetailedMessagesCommand.java @@ -0,0 +1,30 @@ +package mineplex.core.antihack.commands; + +import org.bukkit.entity.Player; + +import mineplex.core.antihack.AntiHack; +import mineplex.core.command.CommandBase; +import mineplex.core.common.Rank; +import mineplex.core.common.util.F; +import mineplex.core.common.util.UtilPlayer; + +public class DetailedMessagesCommand extends CommandBase +{ + public DetailedMessagesCommand(AntiHack plugin) + { + super(plugin, Rank.DEVELOPER, "detailedmessages"); + } + + @Override + public void Execute(Player caller, String[] args) + { + if (Plugin.toggleDetailedMessage(caller)) + { + UtilPlayer.message(caller, F.main(Plugin.getName(), "Detailed messages enabled")); + } + else + { + UtilPlayer.message(caller, F.main(Plugin.getName(), "Detailed messages disabled")); + } + } +} diff --git a/Plugins/Mineplex.Core/src/mineplex/core/antihack/commands/GetVlsCommand.java b/Plugins/Mineplex.Core/src/mineplex/core/antihack/commands/GetVlsCommand.java new file mode 100644 index 000000000..84f32311b --- /dev/null +++ b/Plugins/Mineplex.Core/src/mineplex/core/antihack/commands/GetVlsCommand.java @@ -0,0 +1,47 @@ +package mineplex.core.antihack.commands; + +import org.bukkit.Bukkit; +import org.bukkit.entity.Player; + +import com.mineplex.anticheat.MineplexAnticheat; +import com.mineplex.anticheat.checks.Check; +import com.mineplex.anticheat.checks.CheckManager; + +import mineplex.core.antihack.AntiHack; +import mineplex.core.command.CommandBase; +import mineplex.core.common.Rank; +import mineplex.core.common.util.F; +import mineplex.core.common.util.UtilPlayer; + +public class GetVlsCommand extends CommandBase +{ + public GetVlsCommand(AntiHack plugin) + { + super(plugin, Rank.DEVELOPER, "getvls"); + } + + @Override + public void Execute(Player caller, String[] args) + { + if (args.length > 0) + { + Player p = Bukkit.getPlayerExact(args[0]); + if (p != null) + { + CheckManager manager = MineplexAnticheat.getPlugin(MineplexAnticheat.class).getCheckManager(); + for (Check check : manager.getActiveChecks()) + { + UtilPlayer.message(caller, F.desc(check.getName(), String.valueOf(check.getViolationLevel(p)))); + } + } + else + { + UtilPlayer.message(caller, F.main(Plugin.getName(), "Could not find player")); + } + } + else + { + UtilPlayer.message(caller, F.main(Plugin.getName(), "No player specified")); + } + } +} diff --git a/Plugins/Mineplex.Core/src/mineplex/core/antihack/commands/TestBanCommand.java b/Plugins/Mineplex.Core/src/mineplex/core/antihack/commands/TestBanCommand.java new file mode 100644 index 000000000..40ac6c1aa --- /dev/null +++ b/Plugins/Mineplex.Core/src/mineplex/core/antihack/commands/TestBanCommand.java @@ -0,0 +1,51 @@ +package mineplex.core.antihack.commands; + +import java.util.concurrent.ThreadLocalRandom; + +import org.bukkit.Bukkit; +import org.bukkit.entity.Player; + +import mineplex.core.antihack.AntiHack; +import mineplex.core.antihack.animations.BanwaveAnimationSpin; +import mineplex.core.command.CommandBase; +import mineplex.core.common.Rank; +import mineplex.core.common.util.C; +import mineplex.core.common.util.F; +import mineplex.core.common.util.UtilPlayer; + +public class TestBanCommand extends CommandBase +{ + public TestBanCommand(AntiHack plugin) + { + super(plugin, Rank.DEVELOPER, "testban"); + } + + @Override + public void Execute(Player caller, String[] args) + { + if (args.length > 0) + { + Player p = Bukkit.getPlayerExact(args[0]); + if (p != null) + { + new BanwaveAnimationSpin().run(p, () -> + { + String reason = C.cRed + C.Bold + "You are banned for permanent by Test" + + "\n" + C.cWhite + "Seems to be speeding up time. (" + ThreadLocalRandom.current().nextInt(200, 400) + " packets/150 ms)" + + "\n" + C.cDGreen + "Unfairly banned? Appeal at " + C.cGreen + "www.mineplex.com/appeals"; + p.kickPlayer(reason); + + Plugin.announceBan(p); + }); + } + else + { + UtilPlayer.message(caller, F.main(Plugin.getName(), "Could not find player")); + } + } + else + { + UtilPlayer.message(caller, F.main(Plugin.getName(), "No player specified")); + } + } +} diff --git a/Plugins/Mineplex.Core/src/mineplex/core/antihack/gep/GwenExtremePrejudice.java b/Plugins/Mineplex.Core/src/mineplex/core/antihack/gep/GwenExtremePrejudice.java new file mode 100644 index 000000000..16bf107cf --- /dev/null +++ b/Plugins/Mineplex.Core/src/mineplex/core/antihack/gep/GwenExtremePrejudice.java @@ -0,0 +1,87 @@ +package mineplex.core.antihack.gep; + +import java.sql.Connection; +import java.sql.ResultSet; +import java.sql.SQLException; +import java.util.ArrayList; +import java.util.List; + +import org.bukkit.Bukkit; +import org.bukkit.entity.Player; +import org.bukkit.event.EventHandler; +import org.bukkit.event.player.PlayerJoinEvent; +import org.bukkit.metadata.FixedMetadataValue; +import org.bukkit.plugin.java.JavaPlugin; + +import mineplex.core.MiniPlugin; +import mineplex.serverdata.database.DBPool; + +public class GwenExtremePrejudice extends MiniPlugin +{ + private final List _addresses = new ArrayList<>(); + + @SuppressWarnings("deprecation") + public GwenExtremePrejudice(JavaPlugin plugin) + { + super("GEP", plugin); + + int ticks = 20 * 5 * 60; + int offset = 20 * (int)Math.floor(Math.random() * 10) * 60; + ticks += offset; + + Bukkit.getScheduler().scheduleAsyncRepeatingTask(plugin, () -> + { + refreshIPList(); + }, 0, ticks); + } + + private void refreshIPList() + { + try (Connection c = DBPool.getAccount().getConnection()) + { + List addresses = new ArrayList<>(); + ResultSet rs = c.prepareStatement("SELECT ipAddress FROM gepAddresses;").executeQuery(); + while (rs.next()) + { + addresses.add(rs.getString(1)); + } + runSync(() -> + { + for (Player player : Bukkit.getOnlinePlayers()) + { + if (addresses.contains(player.getAddress().getAddress().getHostAddress())) + { + player.removeMetadata("GWENEXTREMEPREJUDICE", getPlugin()); + player.setMetadata("GWENEXTREMEPREJUDICE", new FixedMetadataValue(getPlugin(), true)); + } + else + { + player.removeMetadata("GWENEXTREMEPREJUDICE", getPlugin()); + player.setMetadata("GWENEXTREMEPREJUDICE", new FixedMetadataValue(getPlugin(), false)); + } + } + _addresses.clear(); + _addresses.addAll(addresses); + }); + } + catch (SQLException e) + { + e.printStackTrace(); + } + } + + @EventHandler + public void onJoin(PlayerJoinEvent event) + { + Player player = event.getPlayer(); + if (!_addresses.isEmpty() && _addresses.contains(player.getAddress().getAddress().getHostAddress())) + { + player.removeMetadata("GWENEXTREMEPREJUDICE", getPlugin()); + player.setMetadata("GWENEXTREMEPREJUDICE", new FixedMetadataValue(getPlugin(), true)); + } + else + { + player.setMetadata("GWENEXTREMEPREJUDICE", new FixedMetadataValue(getPlugin(), false)); + } + } +} \ No newline at end of file diff --git a/Plugins/Mineplex.Core/src/mineplex/core/antihack/AntiHackGuardian.java b/Plugins/Mineplex.Core/src/mineplex/core/antihack/guardians/AntiHackGuardian.java similarity index 99% rename from Plugins/Mineplex.Core/src/mineplex/core/antihack/AntiHackGuardian.java rename to Plugins/Mineplex.Core/src/mineplex/core/antihack/guardians/AntiHackGuardian.java index 9cff0ce43..cb9ef2898 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/antihack/AntiHackGuardian.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/antihack/guardians/AntiHackGuardian.java @@ -1,4 +1,4 @@ -package mineplex.core.antihack; +package mineplex.core.antihack.guardians; import com.mineplex.spigot.ChunkAddEntityEvent; import mineplex.core.Managers; diff --git a/Plugins/Mineplex.Core/src/mineplex/core/antihack/guardians/GuardianManager.java b/Plugins/Mineplex.Core/src/mineplex/core/antihack/guardians/GuardianManager.java new file mode 100644 index 000000000..a5806e753 --- /dev/null +++ b/Plugins/Mineplex.Core/src/mineplex/core/antihack/guardians/GuardianManager.java @@ -0,0 +1,129 @@ +package mineplex.core.antihack.guardians; + +import com.google.common.cache.Cache; +import com.google.common.cache.CacheBuilder; +import mineplex.core.MiniPlugin; +import mineplex.core.PlayerSelector; +import mineplex.core.ReflectivelyCreateMiniPlugin; +import mineplex.core.common.Rank; +import mineplex.core.common.util.UtilLambda; +import org.bukkit.entity.Player; + +import java.util.ArrayList; +import java.util.List; +import java.util.UUID; +import java.util.concurrent.ThreadLocalRandom; +import java.util.concurrent.TimeUnit; +import java.util.function.Function; + +@ReflectivelyCreateMiniPlugin +public class GuardianManager extends MiniPlugin +{ + private static final int MAX_STALKED_PLAYERS = 3; + private static final int STALK_COOLDOWN_TIME_SECONDS = 5; + + private static final int MIN_STALK_TIME = 10 * 20; + private static final int MAX_STALK_TIME = 20 * 20; + private static final int MAX_MIN_DIFF = MAX_STALK_TIME - MIN_STALK_TIME; + private static final Function STALK_END_PROBABILITY_EQUATION = x -> + { + return 1.0/ MAX_MIN_DIFF * x; // linear equation with points (0, 0) and (diff, 1) + }; + + private final Cache _stalkingCooldown = CacheBuilder.newBuilder() + .concurrencyLevel(1) + .expireAfterWrite(STALK_COOLDOWN_TIME_SECONDS, TimeUnit.SECONDS) + .build(); + private final List _stalking = new ArrayList<>(); + private List _guardians = new ArrayList<>(); + + private GuardianManager() + { + super("GuardianManager"); + + this._plugin.getServer().getScheduler().runTaskTimer(this._plugin, () -> + { + for (AntiHackGuardian guardian : this._guardians) + { + if (guardian.getTarget() != null && !guardian.getTarget().isOnline()) + { + this._stalking.remove(guardian.getTarget().getUniqueId()); + guardian.stopTargeting(); + } + else if (guardian.getTargetingTime() > MIN_STALK_TIME) + { + double threshold = STALK_END_PROBABILITY_EQUATION.apply(guardian.getTargetingTime() - MIN_STALK_TIME); + if (Math.random() <= threshold) + { + this._stalking.remove(guardian.getTarget().getUniqueId()); + _stalkingCooldown.put(guardian.getTarget().getUniqueId(), true); + guardian.stopTargeting(); + } + } + guardian.tick(); + } + }, 0L, 1L); + + this._plugin.getServer().getScheduler().runTaskTimer(this._plugin, () -> + { + if (_stalking.size() >= MAX_STALKED_PLAYERS) + { + return; + } + + if (_guardians.size() == 0) + { + return; + } + + List targets = PlayerSelector.selectPlayers( + UtilLambda.and( + PlayerSelector.NOT_VANISHED, + PlayerSelector.hasAnyRank(false, + Rank.ALL, + Rank.ULTRA, + Rank.HERO, + Rank.LEGEND, + Rank.TITAN, + Rank.TWITCH, + Rank.YOUTUBE_SMALL, + Rank.YOUTUBE, + Rank.MEDIA, + Rank.ADMIN, + Rank.DEVELOPER, + Rank.OWNER, + Rank.LT + ), + player -> !_stalking.contains(player.getUniqueId()), + player -> _stalkingCooldown.getIfPresent(player.getUniqueId()) == null + )); + + while (_stalking.size() < MAX_STALKED_PLAYERS && targets.size() > 0) + { + Player target = targets.remove(ThreadLocalRandom.current().nextInt(targets.size())); + + int start = ThreadLocalRandom.current().nextInt(_guardians.size()); + + for (int i = start, j = 0; j < _guardians.size(); i++, j++) + { + if (i >= _guardians.size()) + { + i -= _guardians.size(); + } + AntiHackGuardian guardian = _guardians.get(i); + if (!guardian.isTargeting()) + { + guardian.target(target); + _stalking.add(target.getUniqueId()); + break; + } + } + } + }, 0L, 20L); + } + + public void registerGuardian(AntiHackGuardian guardian) + { + this._guardians.add(guardian); + } +} diff --git a/Plugins/Mineplex.Core/src/mineplex/core/antihack/logging/AnticheatDatabase.java b/Plugins/Mineplex.Core/src/mineplex/core/antihack/logging/AnticheatDatabase.java new file mode 100644 index 000000000..087b68d3c --- /dev/null +++ b/Plugins/Mineplex.Core/src/mineplex/core/antihack/logging/AnticheatDatabase.java @@ -0,0 +1,48 @@ +package mineplex.core.antihack.logging; + +import java.sql.Connection; +import java.sql.PreparedStatement; +import java.sql.SQLException; + +import mineplex.core.common.util.UtilTasks; +import mineplex.core.database.MinecraftRepository; +import mineplex.serverdata.database.DBPool; +import mineplex.serverdata.database.RepositoryBase; + +public class AnticheatDatabase extends RepositoryBase +{ + /* + CREATE TABLE IF NOT EXISTS anticheat_ban_metadata (id INT NOT NULL AUTO_INCREMENT, accountId INT, banId CHAR(10) NOT NULL, data MEDIUMTEXT NOT NULL, PRIMARY KEY(id)); + */ + + private static final String INSERT_INTO_METADATA = "INSERT INTO anticheat_ban_metadata (accountId, banId, data) VALUES (?, ?, ?);"; + + public AnticheatDatabase() + { + super(DBPool.getAccount()); + } + + public void saveMetadata(int accountId, String id, String base64, Runnable after) + { + try (Connection connection = getConnection()) + { + PreparedStatement statement = connection.prepareStatement(INSERT_INTO_METADATA); + statement.setInt(1, accountId); + statement.setString(2, id); + statement.setString(3, base64); + + statement.executeUpdate(); + } + catch (SQLException ex) + { + ex.printStackTrace(); + } + finally + { + if (after != null) + { + UtilTasks.onMainThread(after).run(); + } + } + } +} diff --git a/Plugins/Mineplex.Core/src/mineplex/core/antihack/logging/AnticheatMetadata.java b/Plugins/Mineplex.Core/src/mineplex/core/antihack/logging/AnticheatMetadata.java new file mode 100644 index 000000000..dc015a66a --- /dev/null +++ b/Plugins/Mineplex.Core/src/mineplex/core/antihack/logging/AnticheatMetadata.java @@ -0,0 +1,23 @@ +package mineplex.core.antihack.logging; + +import java.util.UUID; + +import org.bukkit.event.Listener; + +import com.google.gson.JsonElement; + +import mineplex.core.common.util.UtilServer; + +public abstract class AnticheatMetadata implements Listener +{ + public AnticheatMetadata() + { + UtilServer.RegisterEvents(this); + } + + public abstract String getId(); + + public abstract JsonElement build(UUID player); + + public abstract void remove(UUID player); +} diff --git a/Plugins/Mineplex.Core/src/mineplex/core/antihack/logging/AntihackLogger.java b/Plugins/Mineplex.Core/src/mineplex/core/antihack/logging/AntihackLogger.java new file mode 100644 index 000000000..3c3cc03ef --- /dev/null +++ b/Plugins/Mineplex.Core/src/mineplex/core/antihack/logging/AntihackLogger.java @@ -0,0 +1,151 @@ +package mineplex.core.antihack.logging; + +import java.io.ByteArrayOutputStream; +import java.io.IOException; +import java.nio.charset.StandardCharsets; +import java.util.Base64; +import java.util.HashMap; +import java.util.Map; +import java.util.concurrent.ConcurrentHashMap; + +import org.bukkit.Bukkit; +import org.bukkit.entity.Player; +import org.bukkit.event.EventHandler; +import org.bukkit.event.player.PlayerQuitEvent; +import org.tukaani.xz.LZMA2Options; +import org.tukaani.xz.XZ; +import org.tukaani.xz.XZOutputStream; + +import com.google.gson.Gson; +import com.google.gson.JsonNull; +import com.google.gson.JsonObject; +import com.mineplex.anticheat.api.PlayerViolationEvent; +import com.mineplex.anticheat.checks.Check; + +import mineplex.core.MiniPlugin; +import mineplex.core.ReflectivelyCreateMiniPlugin; +import mineplex.core.account.CoreClientManager; +import mineplex.core.antihack.AntiHack; +import mineplex.core.antihack.ViolationLevels; +import mineplex.core.antihack.logging.builtin.PartyInfoMetadata; +import mineplex.core.antihack.logging.builtin.PlayerInfoMetadata; +import mineplex.core.antihack.logging.builtin.ServerInfoMetadata; +import mineplex.core.antihack.logging.builtin.ViolationInfoMetadata; +import mineplex.core.command.CommandBase; +import mineplex.core.common.Rank; +import mineplex.core.common.util.F; +import mineplex.core.common.util.UtilPlayer; +import mineplex.core.common.util.UtilServer; + +@ReflectivelyCreateMiniPlugin +public class AntihackLogger extends MiniPlugin +{ + public static final Gson GSON = new Gson(); + + private final CoreClientManager _clientManager = require(CoreClientManager.class); + + private final Map _metadata = new HashMap<>(); + + private final AnticheatDatabase _db; + + private AntihackLogger() + { + super("AnticheatPlugin"); + + _db = new AnticheatDatabase(); + + registerMetadata(new ServerInfoMetadata()); + registerMetadata(new ViolationInfoMetadata()); + registerMetadata(new PartyInfoMetadata()); + registerMetadata(new PlayerInfoMetadata()); + } + + public void addCommands() + { + if (UtilServer.isTestServer()) + { + addCommand(new CommandBase(this, Rank.SNR_MODERATOR, "savemetadata") + { + @Override + public void Execute(Player caller, String[] args) + { + if (args.length == 1) + { + Player player = Bukkit.getPlayer(args[0]); + if (player != null) + { + JsonObject custom = new JsonObject(); + custom.addProperty("is-test-metadata", true); + String id = AntiHack.generateId(); + saveMetadata(player, id, () -> + { + UtilPlayer.message(caller, F.main(getName(), "Saved metadata for " + player.getName() + " with id " + id)); + }, custom); + } + } + } + }); + } + } + + @EventHandler + public void onQuit(PlayerQuitEvent event) + { + _metadata.values().forEach(metadata -> metadata.remove(event.getPlayer().getUniqueId())); + } + + public void saveMetadata(Player player, String id, Runnable after, JsonObject custom) + { + runAsync(() -> + { + JsonObject info = new JsonObject(); + + for (AnticheatMetadata anticheatMetadata : _metadata.values()) + { + try + { + info.add(anticheatMetadata.getId(), anticheatMetadata.build(player.getUniqueId())); + } + catch (Throwable t) + { + t.printStackTrace(); + } + } + + info.add("custom", custom == null ? JsonNull.INSTANCE: custom); + + String str = GSON.toJson(info); + byte[] b = str.getBytes(StandardCharsets.UTF_8); + + ByteArrayOutputStream bout = new ByteArrayOutputStream(); + + try + { + XZOutputStream o2 = new XZOutputStream(bout, new LZMA2Options(LZMA2Options.PRESET_MIN), XZ.CHECK_NONE); + o2.write(b); + o2.close(); + } + catch (IOException ex) + { + // Should never happen + ex.printStackTrace(); + } + + String base64 = Base64.getEncoder().encodeToString(bout.toByteArray()); + + _db.saveMetadata(_clientManager.getAccountId(player), id, base64, after); + }); + } + + public void registerMetadata(AnticheatMetadata metadata) + { + if (!this._metadata.containsKey(metadata.getId())) + { + this._metadata.put(metadata.getId(), metadata); + } + else + { + throw new IllegalArgumentException("Attempting to register: " + metadata.getId()); + } + } +} diff --git a/Plugins/Mineplex.Core/src/mineplex/core/antihack/logging/builtin/PartyInfoMetadata.java b/Plugins/Mineplex.Core/src/mineplex/core/antihack/logging/builtin/PartyInfoMetadata.java new file mode 100644 index 000000000..5b56687d8 --- /dev/null +++ b/Plugins/Mineplex.Core/src/mineplex/core/antihack/logging/builtin/PartyInfoMetadata.java @@ -0,0 +1,55 @@ +package mineplex.core.antihack.logging.builtin; + +import java.util.UUID; + +import com.google.gson.JsonArray; +import com.google.gson.JsonElement; +import com.google.gson.JsonNull; +import com.google.gson.JsonObject; +import com.google.gson.JsonPrimitive; + +import mineplex.core.antihack.logging.AnticheatMetadata; +import mineplex.core.party.Party; +import mineplex.core.party.PartyManager; + +import static mineplex.core.Managers.require; + +public class PartyInfoMetadata extends AnticheatMetadata +{ + private static final String KEY_OWNER = "owner"; + private static final String KEY_MEMBERS = "members"; + + @Override + public String getId() + { + return "party-info"; + } + + @Override + public JsonElement build(UUID player) + { + Party party = require(PartyManager.class).getPartyByPlayer(player); + if (party != null) + { + JsonObject partyData = new JsonObject(); + partyData.addProperty(KEY_OWNER, party.getOwnerName()); + + JsonArray members = new JsonArray(); + party.getMembers().forEach(m -> members.add(new JsonPrimitive(m.getName()))); + + partyData.add(KEY_MEMBERS, members); + + return partyData; + } + else + { + return JsonNull.INSTANCE; + } + } + + @Override + public void remove(UUID player) + { + + } +} diff --git a/Plugins/Mineplex.Core/src/mineplex/core/antihack/logging/builtin/PlayerInfoMetadata.java b/Plugins/Mineplex.Core/src/mineplex/core/antihack/logging/builtin/PlayerInfoMetadata.java new file mode 100644 index 000000000..479db70d2 --- /dev/null +++ b/Plugins/Mineplex.Core/src/mineplex/core/antihack/logging/builtin/PlayerInfoMetadata.java @@ -0,0 +1,51 @@ +package mineplex.core.antihack.logging.builtin; + +import java.util.UUID; + +import org.bukkit.Bukkit; +import org.bukkit.entity.Player; + +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; + +import mineplex.core.account.CoreClientManager; +import mineplex.core.antihack.logging.AnticheatMetadata; + +import static mineplex.core.Managers.require; + +public class PlayerInfoMetadata extends AnticheatMetadata +{ + private static final String KEY_UUID = "uuid"; + private static final String KEY_ACCOUNT_ID = "accountid"; + private static final String KEY_NAME = "name"; + + private final CoreClientManager _clientManager = require(CoreClientManager.class); + + @Override + public String getId() + { + return "player-info"; + } + + @Override + public JsonElement build(UUID player) + { + JsonObject object = new JsonObject(); + object.addProperty(KEY_UUID, player.toString()); + + Player bPlayer = Bukkit.getPlayer(player); + if (bPlayer != null) + { + object.addProperty(KEY_NAME, bPlayer.getName()); + object.addProperty(KEY_ACCOUNT_ID, _clientManager.getAccountId(bPlayer)); + } + + return object; + } + + @Override + public void remove(UUID player) + { + + } +} diff --git a/Plugins/Mineplex.Core/src/mineplex/core/antihack/logging/builtin/ServerInfoMetadata.java b/Plugins/Mineplex.Core/src/mineplex/core/antihack/logging/builtin/ServerInfoMetadata.java new file mode 100644 index 000000000..7376a6d3e --- /dev/null +++ b/Plugins/Mineplex.Core/src/mineplex/core/antihack/logging/builtin/ServerInfoMetadata.java @@ -0,0 +1,38 @@ +package mineplex.core.antihack.logging.builtin; + +import java.util.UUID; + +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; + +import mineplex.core.antihack.logging.AnticheatMetadata; +import mineplex.core.common.util.UtilServer; + +public class ServerInfoMetadata extends AnticheatMetadata +{ + private static final String KEY_SERVER_NAME = "server-name"; + private static final String KEY_SERVER_REGION = "server-region"; + private static final String KEY_SERVER_GROUP = "server-group"; + + @Override + public String getId() + { + return "server-info"; + } + + @Override + public JsonElement build(UUID player) + { + JsonObject info = new JsonObject(); + info.addProperty(KEY_SERVER_NAME, UtilServer.getServerName()); + info.addProperty(KEY_SERVER_REGION, UtilServer.getRegion().name()); + info.addProperty(KEY_SERVER_GROUP, UtilServer.getGroup()); + return info; + } + + @Override + public void remove(UUID player) + { + + } +} diff --git a/Plugins/Mineplex.Core/src/mineplex/core/antihack/logging/builtin/ViolationInfoMetadata.java b/Plugins/Mineplex.Core/src/mineplex/core/antihack/logging/builtin/ViolationInfoMetadata.java new file mode 100644 index 000000000..da2ee4278 --- /dev/null +++ b/Plugins/Mineplex.Core/src/mineplex/core/antihack/logging/builtin/ViolationInfoMetadata.java @@ -0,0 +1,154 @@ +package mineplex.core.antihack.logging.builtin; + +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; +import java.util.UUID; + +import net.minecraft.server.v1_8_R3.MinecraftServer; + +import org.bukkit.Location; +import org.bukkit.event.EventHandler; +import org.bukkit.event.player.PlayerJoinEvent; + +import com.google.gson.JsonArray; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.mineplex.anticheat.api.CheckDisabledEvent; +import com.mineplex.anticheat.api.PlayerViolationEvent; +import com.mineplex.anticheat.checks.Check; + +import mineplex.core.antihack.logging.AnticheatMetadata; + +import gnu.trove.map.TObjectIntMap; +import gnu.trove.map.TObjectLongMap; +import gnu.trove.map.hash.TObjectIntHashMap; +import gnu.trove.map.hash.TObjectLongHashMap; + +public class ViolationInfoMetadata extends AnticheatMetadata +{ + private static final Location MUTABLE_LOCATION = new Location(null, 0, 0, 0); + + private static final String KEY_JOIN_TIME_MS = "join-time-ms"; + private static final String KEY_JOIN_TIME_TICK = "join-time-tick"; + + private static final String KEY_CURRENT_TIME = "current-time"; + private static final String KEY_MS = "ms"; + private static final String KEY_TICK = "tick"; + + private static final String KEY_VIOLATION_INFO = "violation-info"; + private static final String KEY_VL = "current-vl"; + private static final String KEY_MESSAGE = "msg"; + + private static final String KEY_PLAYER_INFO = "player-info"; + private static final String KEY_LOCATION = "loc"; + private static final String KEY_WORLD = "world"; + private static final String KEY_X = "x"; + private static final String KEY_Y = "y"; + private static final String KEY_Z = "z"; + private static final String KEY_YAW = "yaw"; + private static final String KEY_PITCH = "pitch"; + + private static final JsonObject VAL_CHECK_DISABLED; + + static + { + VAL_CHECK_DISABLED = new JsonObject(); + VAL_CHECK_DISABLED.addProperty(KEY_MESSAGE, "disabled"); + } + + private TObjectLongMap _joinTime = new TObjectLongHashMap<>(); + private TObjectIntMap _joinTimeTick = new TObjectIntHashMap<>(); + private Map, List>> _violations = new HashMap<>(); + + @Override + public String getId() + { + return "violation-info"; + } + + @Override + public JsonElement build(UUID player) + { + JsonObject object = new JsonObject(); + object.addProperty(KEY_JOIN_TIME_MS, _joinTime.get(player)); + object.addProperty(KEY_JOIN_TIME_TICK, _joinTimeTick.get(player)); + _violations.get(player).forEach((check, list) -> + { + JsonArray checkElem = new JsonArray(); + list.forEach(checkElem::add); + object.add(check.getName(), checkElem); + }); + + return object; + } + + @Override + public void remove(UUID player) + { + _joinTime.remove(player); + _joinTimeTick.remove(player); + _violations.remove(player); + } + + @EventHandler + public void onJoin(PlayerJoinEvent event) + { + long thisMs = System.currentTimeMillis(); + int thisTick = MinecraftServer.getServer().at(); + _joinTime.put(event.getPlayer().getUniqueId(), thisMs); + _joinTimeTick.put(event.getPlayer().getUniqueId(), thisTick); + _violations.put(event.getPlayer().getUniqueId(), new HashMap<>()); + } + + @EventHandler + public void onDisabledCheck(CheckDisabledEvent event) + { + _violations.values().forEach(map -> + { + List data = map.get(event.getCheck()); + if (data != null) + { + data.add(VAL_CHECK_DISABLED); + } + }); + } + + @EventHandler + public void onViolation(PlayerViolationEvent event) + { + long thisMs = System.currentTimeMillis(); + int thisTick = MinecraftServer.getServer().at(); + + List violations = _violations.get(event.getPlayer().getUniqueId()).computeIfAbsent(event.getCheckClass(), key -> new ArrayList<>()); + + JsonObject currentTime = new JsonObject(); + currentTime.addProperty(KEY_MS, thisMs); + currentTime.addProperty(KEY_TICK, thisTick); + + JsonObject violationInfo = new JsonObject(); + violationInfo.addProperty(KEY_VL, event.getViolations()); + violationInfo.addProperty(KEY_MESSAGE, event.getMessage()); + + event.getPlayer().getLocation(MUTABLE_LOCATION); + + JsonObject playerInfo = new JsonObject(); + JsonObject location = new JsonObject(); + location.addProperty(KEY_WORLD, MUTABLE_LOCATION.getWorld().getName()); + location.addProperty(KEY_X, MUTABLE_LOCATION.getX()); + location.addProperty(KEY_Y, MUTABLE_LOCATION.getY()); + location.addProperty(KEY_Z, MUTABLE_LOCATION.getZ()); + location.addProperty(KEY_YAW, MUTABLE_LOCATION.getYaw()); + location.addProperty(KEY_PITCH, MUTABLE_LOCATION.getPitch()); + + playerInfo.add(KEY_LOCATION, location); + + JsonObject data = new JsonObject(); + data.add(KEY_CURRENT_TIME, currentTime); + data.add(KEY_VIOLATION_INFO, violationInfo); + data.add(KEY_PLAYER_INFO, playerInfo); + + violations.add(data); + } +} diff --git a/Plugins/Mineplex.Core/src/mineplex/core/antihack/redisnotifications/GwenBanNotification.java b/Plugins/Mineplex.Core/src/mineplex/core/antihack/redisnotifications/GwenBanNotification.java new file mode 100644 index 000000000..d5ab1806f --- /dev/null +++ b/Plugins/Mineplex.Core/src/mineplex/core/antihack/redisnotifications/GwenBanNotification.java @@ -0,0 +1,60 @@ +package mineplex.core.antihack.redisnotifications; + +import mineplex.serverdata.commands.ServerCommand; + +public class GwenBanNotification extends ServerCommand +{ + private final String _serverName; + private final String _playerName; + private final String _playerUUID; + private final String _playerRank; + private final String _hackType; + private final String _metadataId; + private final boolean _extremePrejudice; + + public GwenBanNotification(String serverName, String playerName, String playerUUID, String playerRank, String hackType, String metadataId, boolean extremePrejudice) + { + _serverName = serverName; + _playerName = playerName; + _playerUUID = playerUUID; + _playerRank = playerRank; + _hackType = hackType; + _metadataId = metadataId; + _extremePrejudice = extremePrejudice; + } + + public String getServerName() + { + return _serverName; + } + + public String getPlayerName() + { + return _playerName; + } + + public String getPlayerUUID() + { + return _playerUUID; + } + + public String getPlayerRank() + { + return _playerRank; + } + + public String getHackType() + { + return _hackType; + } + + public String getMetadataId() + { + return _metadataId; + } + + public boolean isExtremePrejudice() + { + return _extremePrejudice; + } +} \ No newline at end of file diff --git a/Plugins/Mineplex.Core/src/mineplex/core/antihack/redisnotifications/GwenBanwaveNotification.java b/Plugins/Mineplex.Core/src/mineplex/core/antihack/redisnotifications/GwenBanwaveNotification.java new file mode 100644 index 000000000..11cb1ab8d --- /dev/null +++ b/Plugins/Mineplex.Core/src/mineplex/core/antihack/redisnotifications/GwenBanwaveNotification.java @@ -0,0 +1,55 @@ +package mineplex.core.antihack.redisnotifications; + +import mineplex.serverdata.commands.ServerCommand; + +public class GwenBanwaveNotification extends ServerCommand +{ + private final String _serverName; + private final String _playerName; + private final String _playerUUID; + private final String _playerRank; + private final String _hackType; + private final String _metadataId; + private final long _timeToBan; + + public GwenBanwaveNotification(String serverName, String playerName, String playerUUID, String playerRank, String hackType, String metadataId, long timeToBan) + { + _serverName = serverName; + _playerName = playerName; + _playerUUID = playerUUID; + _playerRank = playerRank; + _hackType = hackType; + _metadataId = metadataId; + _timeToBan = timeToBan; + } + + public String getServerName() + { + return _serverName; + } + + public String getPlayerName() + { + return _playerName; + } + + public String getPlayerUUID() + { + return _playerUUID; + } + + public String getHackType() + { + return _hackType; + } + + public String getMetadataId() + { + return _metadataId; + } + + public long getTimeToBan() + { + return _timeToBan; + } +} diff --git a/Plugins/Mineplex.Core/src/mineplex/core/antihack/types/Fly.java b/Plugins/Mineplex.Core/src/mineplex/core/antihack/types/Fly.java deleted file mode 100644 index 0941d4a2a..000000000 --- a/Plugins/Mineplex.Core/src/mineplex/core/antihack/types/Fly.java +++ /dev/null @@ -1,172 +0,0 @@ -package mineplex.core.antihack.types; - -import java.util.AbstractMap; -import java.util.HashMap; -import java.util.Map.Entry; - -import mineplex.core.MiniPlugin; -import mineplex.core.antihack.AntiHack; -import mineplex.core.antihack.Detector; -import mineplex.core.common.util.UtilBlock; -import mineplex.core.common.util.UtilMath; - -import org.bukkit.Material; -import org.bukkit.block.Block; -import org.bukkit.entity.Player; -import org.bukkit.event.EventHandler; -import org.bukkit.event.EventPriority; -import org.bukkit.event.player.PlayerMoveEvent; -import org.bukkit.potion.PotionEffect; -import org.bukkit.potion.PotionEffectType; - -public class Fly extends MiniPlugin implements Detector -{ - private AntiHack Host; - - private HashMap> _floatTicks = new HashMap>(); //Ticks, PrevY - private HashMap> _hoverTicks = new HashMap>(); //Ticks, PrevY - private HashMap> _riseTicks = new HashMap>(); //Ticks, PrevY - - public Fly (AntiHack host) - { - super("Fly Detector", host.getPlugin()); - Host = host; - } - - @EventHandler(priority = EventPriority.MONITOR) - public void updateFlyhack(PlayerMoveEvent event) - { - if (!Host.isEnabled()) - return; - - Player player = event.getPlayer(); - - //100% Valid - if (Host.isValid(player, true)) - Reset(player); - - //Hasn't moved, just looking around - if (UtilMath.offset(event.getFrom(), event.getTo()) <= 0) - { - updateFloat(player); - return; - } - else - { - _floatTicks.remove(player); - } - - updateHover(player); - updateRise(player); - } - - private void updateFloat(Player player) - { - int count = 0; - - if (_floatTicks.containsKey(player)) - { - if (player.getLocation().getY() == _floatTicks.get(player).getValue()) - { - count = _floatTicks.get(player).getKey() + 1; - } - else - { - count = 0; - } - } - - if (count > Host.FloatHackTicks) - { - Host.addSuspicion(player, "Fly (Float)"); - count -= 2; - } - - _floatTicks.put(player, new AbstractMap.SimpleEntry(count, player.getLocation().getY())); - } - - private void updateHover(Player player) - { - int count = 0; - - if (_hoverTicks.containsKey(player)) - { - if (player.getLocation().getY() == _hoverTicks.get(player).getValue()) - { - count = _hoverTicks.get(player).getKey() + 1; - } - else - { - count = 0; - } - - //player.sendMessage(count + " - " + player.getLocation().getY() + " vs " + _hoverTicks.get(player).getValue()); - } - - if (count > Host.HoverHackTicks) - { - Host.addSuspicion(player, "Fly (Hover)"); - count -= 2; - } - - _hoverTicks.put(player, new AbstractMap.SimpleEntry(count, player.getLocation().getY())); - } - - private void updateRise(Player player) - { - int count = 0; - - if (_riseTicks.containsKey(player)) - { - if (player.getLocation().getY() >= _riseTicks.get(player).getValue()) - { - boolean nearBlocks = false; - for (Block block : UtilBlock.getSurrounding(player.getLocation().getBlock(), true)) - { - if (block.getType() != Material.AIR) - { - nearBlocks = true; - break; - } - } - - for (PotionEffect effect : player.getActivePotionEffects()) - if (effect.getType() == PotionEffectType.JUMP || effect.getType().equals(PotionEffectType.JUMP)) - nearBlocks = true; - - if (nearBlocks) - { - count = 0; - } - else - { - count = _riseTicks.get(player).getKey() + 1; - } - - } - else - { - count = 0; - } - } - - if (count > Host.RiseHackTicks) - { - //Only give Offense if actually rising - initial ticks can be trigged via Hover. - if (player.getLocation().getY() > _riseTicks.get(player).getValue()) - Host.addSuspicion(player, "Fly (Rise)"); - - count -= 2; - } - - _riseTicks.put(player, new AbstractMap.SimpleEntry(count, player.getLocation().getY())); - } - - @Override - public void Reset(Player player) - { - _floatTicks.remove(player); - _hoverTicks.remove(player); - _riseTicks.remove(player); - } -} diff --git a/Plugins/Mineplex.Core/src/mineplex/core/antihack/types/Idle.java b/Plugins/Mineplex.Core/src/mineplex/core/antihack/types/Idle.java deleted file mode 100644 index 18889a4c6..000000000 --- a/Plugins/Mineplex.Core/src/mineplex/core/antihack/types/Idle.java +++ /dev/null @@ -1,78 +0,0 @@ -package mineplex.core.antihack.types; - -import java.util.HashMap; - -import mineplex.core.MiniPlugin; -import mineplex.core.antihack.AntiHack; -import mineplex.core.antihack.Detector; -import mineplex.core.common.util.C; -import mineplex.core.common.util.UtilPlayer; -import mineplex.core.common.util.UtilServer; -import mineplex.core.common.util.UtilTime; -import mineplex.core.updater.UpdateType; -import mineplex.core.updater.event.UpdateEvent; - -import org.bukkit.entity.Player; -import org.bukkit.event.EventHandler; -import org.bukkit.event.EventPriority; -import org.bukkit.event.player.PlayerMoveEvent; - -public class Idle extends MiniPlugin implements Detector -{ - private AntiHack Host; - - private HashMap _idleTime = new HashMap(); - - public Idle (AntiHack host) - { - super("Idle Detector", host.getPlugin()); - Host = host; - } - - @EventHandler(priority = EventPriority.MONITOR) - public void updateFlyhack(PlayerMoveEvent event) - { - if (!Host.isEnabled()) - return; - - Player player = event.getPlayer(); - - _idleTime.put(player, System.currentTimeMillis()); - } - - @EventHandler(priority = EventPriority.MONITOR) - public void updateFreeCam(UpdateEvent event) - { - if (!Host.isEnabled()) - return; - - if (event.getType() != UpdateType.FAST) - return; - - for (Player player : UtilServer.getPlayers()) - { - //100% Valid - if (Host.isValid(player, true)) - continue; - - if (!_idleTime.containsKey(player)) - continue; - - if (!UtilTime.elapsed(_idleTime.get(player), Host.IdleTime)) - continue; - - //Host.addSuspicion(player, "Lag / Fly (Idle)"); - //player.kickPlayer(C.cGold + "Mineplex " + C.cRed + "Anti-Cheat " + C.cWhite + "Kicked for Lag / Fly (Idle)"); - - UtilPlayer.message(player, C.cRed + C.Bold + "Mineplex Anti-Cheat detected Lagging / Fly (Idle)"); - UtilPlayer.message(player, C.cRed + C.Bold + "You have been returned to Lobby."); - Host.Portal.sendPlayerToServer(player, "Lobby"); - } - } - - @Override - public void Reset(Player player) - { - _idleTime.remove(player); - } -} diff --git a/Plugins/Mineplex.Core/src/mineplex/core/antihack/types/Reach.java b/Plugins/Mineplex.Core/src/mineplex/core/antihack/types/Reach.java deleted file mode 100644 index 9bf8b4a00..000000000 --- a/Plugins/Mineplex.Core/src/mineplex/core/antihack/types/Reach.java +++ /dev/null @@ -1,123 +0,0 @@ -package mineplex.core.antihack.types; - -import java.util.ArrayList; -import java.util.HashMap; - -import mineplex.core.MiniPlugin; -import mineplex.core.antihack.AntiHack; -import mineplex.core.antihack.Detector; -import mineplex.core.common.util.UtilEvent; -import mineplex.core.common.util.UtilMath; -import mineplex.core.common.util.UtilPlayer; -import mineplex.core.common.util.UtilServer; -import mineplex.core.updater.UpdateType; -import mineplex.core.updater.event.UpdateEvent; - -import org.bukkit.GameMode; -import org.bukkit.Location; -import org.bukkit.entity.LivingEntity; -import org.bukkit.entity.Player; -import org.bukkit.event.EventHandler; -import org.bukkit.event.EventPriority; -import org.bukkit.event.entity.EntityDamageEvent; -import org.bukkit.event.entity.EntityDamageEvent.DamageCause; - -public class Reach extends MiniPlugin implements Detector -{ - private AntiHack Host; - - private HashMap> _history = new HashMap>(); - - public Reach (AntiHack host) - { - super("Reach Detector", host.getPlugin()); - Host = host; - } - - @EventHandler(priority = EventPriority.LOWEST) - public void recordMove(UpdateEvent event) - { - if (!Host.isEnabled()) - return; - - if (event.getType() != UpdateType.TICK) - return; - - for (Player player : UtilServer.getPlayers()) - { - if (player.getGameMode() != GameMode.SURVIVAL || UtilPlayer.isSpectator(player)) - continue; - - if (!_history.containsKey(player)) - _history.put(player, new ArrayList()); - - _history.get(player).add(0, player.getLocation()); - - while (_history.get(player).size() > 40) - { - _history.get(player).remove(_history.get(player).size()-1); - } - } - } - - @EventHandler(priority = EventPriority.LOWEST) - public void reachDetect(EntityDamageEvent event) - { - if (event.getCause() != DamageCause.ENTITY_ATTACK) - return; - - if (!(event.getEntity() instanceof Player)) - return; - - LivingEntity damagerEntity = UtilEvent.GetDamagerEntity(event, false); - - if (!(damagerEntity instanceof Player)) - return; - - Player damager = (Player)damagerEntity; - Player damagee = (Player)event.getEntity(); - - if (!isInRange(damager.getLocation(), damagee.getLocation())) - { - ArrayList damageeHistory = _history.get(damagee); - - if (damageeHistory != null) - { - for (Location historyLoc : damageeHistory) - { - if (isInRange(damager.getLocation(), historyLoc)) - { - return; - } - } - } - - //Host.addSuspicion(damager, "Reach"); - } - } - - private boolean isInRange(Location a, Location b) - { - //2d Range - double distFlat = UtilMath.offset2d(a, b); //Limit is 3.40 - if (distFlat > 3.4) - { - return true; - } - - //3d Range - double dist = UtilMath.offset(a, b); //Limit is 6 (highest i saw was 5.67) - if (dist > 6.0) - { - return true; - } - - return false; - } - - @Override - public void Reset(Player player) - { - _history.remove(player); - } -} diff --git a/Plugins/Mineplex.Core/src/mineplex/core/antihack/types/Speed.java b/Plugins/Mineplex.Core/src/mineplex/core/antihack/types/Speed.java deleted file mode 100644 index 9e57c33df..000000000 --- a/Plugins/Mineplex.Core/src/mineplex/core/antihack/types/Speed.java +++ /dev/null @@ -1,105 +0,0 @@ -package mineplex.core.antihack.types; - -import java.util.AbstractMap; -import java.util.HashMap; -import java.util.Map.Entry; - -import mineplex.core.MiniPlugin; -import mineplex.core.antihack.AntiHack; -import mineplex.core.antihack.Detector; -import mineplex.core.common.util.UtilEnt; -import mineplex.core.common.util.UtilMath; -import mineplex.core.common.util.UtilTime; - -import org.bukkit.entity.Player; -import org.bukkit.event.EventHandler; -import org.bukkit.event.EventPriority; -import org.bukkit.event.player.PlayerMoveEvent; -import org.bukkit.potion.PotionEffect; -import org.bukkit.potion.PotionEffectType; - -public class Speed extends MiniPlugin implements Detector -{ - private AntiHack Host; - - private HashMap> _speedTicks = new HashMap>(); //Ticks, PrevY - - public Speed (AntiHack host) - { - super("Speed Detector", host.getPlugin()); - Host = host; - } - - @EventHandler(priority = EventPriority.MONITOR) - public void updateSpeedhack(PlayerMoveEvent event) - { - if (!Host.isEnabled()) - return; - - Player player = event.getPlayer(); - - //100% Valid - if (Host.isValid(player, false)) - return; - - UpdateSpeed(player, event); - } - - private void UpdateSpeed(Player player, PlayerMoveEvent event) - { - int count = 0; - - if (_speedTicks.containsKey(player)) - { - double offset; - if (event.getFrom().getY() > event.getTo().getY()) - { - offset = UtilMath.offset2d(event.getFrom(), event.getTo()); - } - else - { - offset = UtilMath.offset(event.getFrom(), event.getTo()); - } - - //Limit - double limit = 0.74; - if (UtilEnt.isGrounded(player)) - limit = 0.32; - - for (PotionEffect effect : player.getActivePotionEffects()) - { - if (effect.getType().equals(PotionEffectType.SPEED)) - { - if (UtilEnt.isGrounded(player)) - limit += 0.08 * (effect.getAmplifier() + 1); - else - limit += 0.04 * (effect.getAmplifier() + 1); - } - } - - //Check - if (offset > limit && !UtilTime.elapsed(_speedTicks.get(player).getValue(), 100))//Counters Lag - { - count = _speedTicks.get(player).getKey() + 1; - } - else - { - count = 0; - } - } - - if (count > Host.SpeedHackTicks) - { - Host.addSuspicion(player, "Speed (Fly/Move)"); - count -= 2; - } - - _speedTicks.put(player, new AbstractMap.SimpleEntry(count, System.currentTimeMillis())); - } - - @Override - public void Reset(Player player) - { - _speedTicks.remove(player); - } -} diff --git a/Plugins/Mineplex.Core/src/mineplex/core/antispam/repository/AntiSpamRepository.java b/Plugins/Mineplex.Core/src/mineplex/core/antispam/repository/AntiSpamRepository.java index 4211d3116..be920e079 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/antispam/repository/AntiSpamRepository.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/antispam/repository/AntiSpamRepository.java @@ -17,7 +17,7 @@ public class AntiSpamRepository extends ApiEndpoint { public AntiSpamRepository() { - super(ApiHost.ANTISPAM, "/chat"); + super(ApiHost.getAntispamService(), "/chat"); } public AntiSpamApiResponse sendMessage(String source, ChatPayload payload) diff --git a/Plugins/Mineplex.Core/src/mineplex/core/anvilMenu/PlayerInputActionMenu.java b/Plugins/Mineplex.Core/src/mineplex/core/anvilMenu/PlayerInputActionMenu.java index 2976e2b00..005131244 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/anvilMenu/PlayerInputActionMenu.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/anvilMenu/PlayerInputActionMenu.java @@ -1,12 +1,8 @@ package mineplex.core.anvilMenu; import mineplex.core.MiniPlugin; -import mineplex.core.account.CoreClientManager; -import mineplex.core.common.util.C; import mineplex.core.common.util.UtilPlayer; import mineplex.core.itemstack.ItemBuilder; -import mineplex.core.party.Party; -import mineplex.core.party.PartyManager; import net.minecraft.server.v1_8_R3.*; import org.apache.commons.lang.StringUtils; import org.bukkit.Material; @@ -21,8 +17,6 @@ import org.bukkit.event.inventory.InventoryCloseEvent; import org.bukkit.event.player.PlayerQuitEvent; import org.bukkit.inventory.Inventory; -import static sun.audio.AudioPlayer.player; - /** * A utility class for creating simple and easy Anvil GUI's that require actions based on a users input. */ @@ -34,13 +28,11 @@ public abstract class PlayerInputActionMenu implements Listener protected Inventory _currentInventory; protected String _itemName = ""; protected boolean _searching; - protected Party _party; - public PlayerInputActionMenu(MiniPlugin plugin, Player player, Party party) + public PlayerInputActionMenu(MiniPlugin plugin, Player player) { _player = player; _plugin = plugin; - _party = party; player.closeInventory(); _plugin.registerEvents(this); } diff --git a/Plugins/Mineplex.Core/src/mineplex/core/anvilMenu/player/PlayerNameMenu.java b/Plugins/Mineplex.Core/src/mineplex/core/anvilMenu/player/PlayerNameMenu.java index ab4999c54..dd6762645 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/anvilMenu/player/PlayerNameMenu.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/anvilMenu/player/PlayerNameMenu.java @@ -11,8 +11,6 @@ import org.bukkit.Material; import org.bukkit.Sound; import org.bukkit.entity.Player; -import static net.minecraft.server.v1_8_R3.PotionBrewer.n; - /** * A wrapped menu that handles looking for players specifically. */ @@ -21,9 +19,9 @@ public abstract class PlayerNameMenu extends PlayerInputActionMenu protected CoreClientManager _clientManager; - public PlayerNameMenu(MiniPlugin plugin, CoreClientManager clientManager, Player player, Party party) + public PlayerNameMenu(MiniPlugin plugin, CoreClientManager clientManager, Player player) { - super(plugin, player, party); + super(plugin, player); _clientManager = clientManager; } diff --git a/Plugins/Mineplex.Core/src/mineplex/core/benefit/BenefitManagerRepository.java b/Plugins/Mineplex.Core/src/mineplex/core/benefit/BenefitManagerRepository.java index 60af1605a..bcb93096c 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/benefit/BenefitManagerRepository.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/benefit/BenefitManagerRepository.java @@ -11,7 +11,7 @@ import mineplex.serverdata.database.column.ColumnVarChar; import org.bukkit.plugin.java.JavaPlugin; -public class BenefitManagerRepository extends MinecraftRepository +public class BenefitManagerRepository extends RepositoryBase { private static String CREATE_BENEFIT_TABLE = "CREATE TABLE IF NOT EXISTS rankBenefits (id INT NOT NULL AUTO_INCREMENT, accountId INT, benefit VARCHAR(100), PRIMARY KEY (id), FOREIGN KEY (accountId) REFERENCES accounts(id));"; @@ -20,20 +20,9 @@ public class BenefitManagerRepository extends MinecraftRepository public BenefitManagerRepository(JavaPlugin plugin) { - super(plugin, DBPool.getAccount()); + super(DBPool.getAccount()); } - @Override - protected void initialize() - { - //executeUpdate(CREATE_BENEFIT_TABLE); - } - - @Override - protected void update() - { - } - public boolean addBenefit(int accountId, String benefit) { return executeUpdate(INSERT_BENEFIT, new ColumnInt("accountId", accountId), new ColumnVarChar("benefit", 100, benefit)) > 0; diff --git a/Plugins/Mineplex.Core/src/mineplex/core/beta/BetaWhitelist.java b/Plugins/Mineplex.Core/src/mineplex/core/beta/BetaWhitelist.java new file mode 100644 index 000000000..ca0f67e27 --- /dev/null +++ b/Plugins/Mineplex.Core/src/mineplex/core/beta/BetaWhitelist.java @@ -0,0 +1,68 @@ +package mineplex.core.beta; + +import java.util.Set; +import java.util.UUID; + +import org.bukkit.ChatColor; +import org.bukkit.entity.Player; +import org.bukkit.event.EventHandler; +import org.bukkit.event.player.PlayerJoinEvent; + +import com.google.common.collect.ImmutableSet; + +import mineplex.core.MiniPlugin; +import mineplex.core.account.CoreClientManager; +import mineplex.core.common.Rank; +import mineplex.core.powerplayclub.PowerPlayClubRepository; + +public class BetaWhitelist extends MiniPlugin +{ + private static final Set EXTRA_PLAYERS = ImmutableSet.builder() + // GI Members + .add(UUID.fromString("8506533f-1da7-4d5c-a835-a483b5a18b54")) // Awquard + .add(UUID.fromString("a8526c97-95be-4cb7-ae58-7df5d3b108a6")) // ASlime + .add(UUID.fromString("ae6d71b7-3d49-429f-b31f-5cf5af136540")) // Cabob + .add(UUID.fromString("ea1f709c-031f-4028-8f7d-2073c5a37d1a")) // CharlieHacks + .add(UUID.fromString("d3c1457a-1084-43e1-846c-addc47393b90")) // Chocobutter + .add(UUID.fromString("6b60782e-f95b-4449-a39e-0ad7fa5fdab0")) // CosmoLink + .add(UUID.fromString("18697323-50d3-47ea-a5c2-e7ac1a0d9fa0")) // Danah + .add(UUID.fromString("1cc18d8d-ab28-4354-8cce-f93fb06423bf")) // Fetch + .add(UUID.fromString("c56e5b96-8dc3-46ca-b682-24cf8467e3a1")) // KingOfWizards + .add(UUID.fromString("ea30fe99-2044-438f-bfd8-97bcc639239e")) // Mauo + .add(UUID.fromString("933b2f93-806a-4f39-88a2-935442418ae5")) // Tier4Global + .add(UUID.fromString("ac239b94-3079-4a8a-a52f-7b81c8a87b4d")) // Paddi + .add(UUID.fromString("3ced328d-f079-45e4-ad71-8c721c4a699b")) // Smaland47 + .add(UUID.fromString("d51fc65b-fce9-4464-9391-b259525dc6ca")) // SnitSays + .add(UUID.fromString("12bbeda2-567a-400a-9d66-f76fab832de0")) // StoneColdKiller + .add(UUID.fromString("2e0c1d88-7f44-44f5-85b4-9ad0b2cfddce")) // Tours + .add(UUID.fromString("32aff2d0-f68c-4eb9-b5d4-139fc48b7ca6")) // Trimzon + .add(UUID.fromString("3dcfe366-fcaa-48f7-abcc-b73fb62616e1")) // gamefish32 + .add(UUID.fromString("6795643a-2b61-41bf-9429-c7549fd128a8")) // umGim + .add(UUID.fromString("47ba454a-4999-42f4-a269-2f4114ceb3c7")) // falconviii + .build(); + private final CoreClientManager _clientManager; + private final PowerPlayClubRepository _powerPlayClubRepository; + + public BetaWhitelist(CoreClientManager clientManager, PowerPlayClubRepository powerPlayRepository) + { + super("Beta Whitelist"); + _clientManager = clientManager; + _powerPlayClubRepository = powerPlayRepository; + } + + @EventHandler + public void onJoin(PlayerJoinEvent event) + { + Player player = event.getPlayer(); + Rank rank = _clientManager.Get(player).GetRank(true); + if ((rank != Rank.MAPDEV && rank != Rank.MAPLEAD && rank.has(Rank.ETERNAL) // If this player is Eternal+ (and not a builder), + || _powerPlayClubRepository.getCachedData(player).isSubscribed()) // a PPC subscriber, + || EXTRA_PLAYERS.contains(player.getUniqueId())) // or explicitly whitelisted, + { + return; // allow them in + } + + // Otherwise, kick them out + event.getPlayer().kickPlayer("Sorry, you aren't whitelisted on this beta server.\n\nSubscribe to " + ChatColor.GOLD + "Power Play Club " + ChatColor.WHITE + "at " + ChatColor.GREEN + "mineplex.com/shop" + ChatColor.WHITE + "!"); + } +} diff --git a/Plugins/Mineplex.Core/src/mineplex/core/blockrestore/BlockRestore.java b/Plugins/Mineplex.Core/src/mineplex/core/blockrestore/BlockRestore.java index 664a742de..c2859d691 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/blockrestore/BlockRestore.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/blockrestore/BlockRestore.java @@ -18,22 +18,23 @@ import org.bukkit.event.block.BlockBreakEvent; import org.bukkit.event.block.BlockPistonExtendEvent; import org.bukkit.event.block.BlockPlaceEvent; import org.bukkit.event.world.ChunkUnloadEvent; -import org.bukkit.plugin.java.JavaPlugin; import mineplex.core.MiniPlugin; +import mineplex.core.ReflectivelyCreateMiniPlugin; import mineplex.core.common.util.UtilBlock; import mineplex.core.common.util.UtilMath; import mineplex.core.updater.UpdateType; import mineplex.core.updater.event.UpdateEvent; +@ReflectivelyCreateMiniPlugin public class BlockRestore extends MiniPlugin { private HashMap _blocks = new HashMap(); private LinkedList _restoreMaps; - public BlockRestore(JavaPlugin plugin) + private BlockRestore() { - super("Block Restore", plugin); + super("Block Restore"); _restoreMaps = new LinkedList(); } diff --git a/Plugins/Mineplex.Core/src/mineplex/core/bonuses/BonusAmount.java b/Plugins/Mineplex.Core/src/mineplex/core/bonuses/BonusAmount.java index bdd50e4d7..6efb176cd 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/bonuses/BonusAmount.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/bonuses/BonusAmount.java @@ -2,24 +2,24 @@ package mineplex.core.bonuses; import java.util.List; -import org.bukkit.ChatColor; - import mineplex.core.common.util.C; public class BonusAmount { private int _gems; - private int _coins; - private int _gold; + private int _shards; + private GoldAmount _gold = new GoldAmount(); private int _bonusGems; - private int _bonusCoins; - private int _bonusGold; + private int _bonusShards; + private GoldAmount _bonusGold = new GoldAmount(); private int _experience; private int _bonusExperience; private int _tickets; private int _oldChests; private int _ancientChests; private int _mythicalChests; + private int _illuminatedChests; + private int _omegaChests; public BonusAmount() { @@ -36,24 +36,24 @@ public class BonusAmount _gems = gems; } - public int getCoins() + public int getShards() { - return _coins; + return _shards; } - public void setCoins(int coins) + public void setShards(int shards) { - _coins = coins; + _shards = shards; } - public int getGold() + public GoldAmount getGold() { return _gold; } - public void setGold(int gold) + public void setGold(Integer serverId, Integer gold) { - _gold = gold; + _gold.setGoldFor(serverId, gold); } public int getBonusGems() @@ -66,24 +66,24 @@ public class BonusAmount _bonusGems = bonusGems; } - public int getBonusCoins() + public int getBonusShards() { - return _bonusCoins; + return _bonusShards; } - public void setBonusCoins(int bonusCoins) + public void setBonusShards(int bonusShards) { - _bonusCoins = bonusCoins; + _bonusShards = bonusShards; } - public int getBonusGold() + public GoldAmount getBonusGold() { return _bonusGold; } - public void setBonusGold(int bonusGold) + public void setBonusGold(Integer serverId, Integer bonusGold) { - _bonusGold = bonusGold; + _bonusGold.setGoldFor(serverId, bonusGold); } public int getTotalGems() @@ -91,14 +91,14 @@ public class BonusAmount return getGems() + getBonusGems(); } - public int getTotalCoins() + public int getTotalShards() { - return getCoins() + getBonusCoins(); + return getShards() + getBonusShards(); } public int getTotalGold() { - return getGold() + getBonusGold(); + return getGold().getTotalGold() + getBonusGold().getTotalGold(); } public int getExperience() @@ -166,28 +166,52 @@ public class BonusAmount _mythicalChests = mythicalChests; } + public int getIlluminatedChests() + { + return _illuminatedChests; + } + + public void setIlluminatedChests(int illuminatedChests) + { + _illuminatedChests = illuminatedChests; + } + + public int getOmegaChests() + { + return _omegaChests; + } + + public void setOmegaChests(int omegaChests) + { + _omegaChests = omegaChests; + } + public boolean isGreaterThanZero() { - return _bonusCoins > 0 || _coins > 0 || _bonusGems > 0 || _gems > 0 || _gold > 0 || _bonusGold > 0 || _oldChests > 0 || _ancientChests > 0 || _mythicalChests > 0; + return _bonusShards > 0 || _shards > 0 || _bonusGems > 0 || _gems > 0 || _gold.getTotalGold() > 0 || _bonusGold.getTotalGold() > 0 || _oldChests > 0 || _ancientChests > 0 || _mythicalChests > 0; } public void addLore(List lore) { lore.add(C.cYellow + "Rewards"); addLore(lore, getTickets(), 0, "Carl Spin Ticket" + (getTickets() > 1 ? "s" : "")); - addLore(lore, getCoins(), getBonusCoins(), "Treasure Shards"); + addLore(lore, getShards(), getBonusShards(), "Treasure Shards"); addLore(lore, getGems(), getBonusGems(), "Gems"); - addLore(lore, getGold(), getBonusGold(), "Gold"); + addLore(lore, getGold().getTotalGold(), getBonusGold().getTotalGold(), "Gold"); addLore(lore, getExperience(), getBonusExperience(), "Experience"); addLore(lore, getOldChests(), 0, "Old Chest", "Old Chests"); addLore(lore, getAncientChests(), 0, "Ancient Chest", "Ancient Chests"); addLore(lore, getMythicalChests(), 0, "Mythical Chest", "Mythical Chests"); + addLore(lore, getIlluminatedChests(), 0, "Illuminated Chest", "Illuminated Chests"); + addLore(lore, getOmegaChests(), 0, "Omega Chest", "Omega Chests"); } private void addLore(List lore, int amount, int bonus, String suffix) { if (amount > 0) + { lore.add(" " + C.cWhite + amount + " " + suffix); + } // if (bonus > 0) // lore.add(C.cYellow + "Streak Bonus: " + C.cWhite + bonus + " " + suffix); @@ -196,8 +220,12 @@ public class BonusAmount private void addLore(List lore, int amount, int bonus, String suffix, String plural) { if (amount == 1) + { lore.add(" " + C.cWhite + amount + " " + plural); + } else if (amount > 0) + { lore.add(" " + C.cWhite + amount + " " + suffix); + } } } diff --git a/Plugins/Mineplex.Core/src/mineplex/core/bonuses/BonusClientData.java b/Plugins/Mineplex.Core/src/mineplex/core/bonuses/BonusClientData.java index 346f58b1c..aaf60ab71 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/bonuses/BonusClientData.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/bonuses/BonusClientData.java @@ -4,7 +4,6 @@ import java.sql.Date; import java.sql.Timestamp; import mineplex.core.hologram.Hologram; -import mineplex.database.tables.records.BonusRecord; public class BonusClientData { @@ -12,8 +11,10 @@ public class BonusClientData private int _accountId; private Timestamp _dailyTime; + private Timestamp _clansDailyTime; private Date _rankTime; private Date _voteTime; + private Date _clansVoteTime; private int _dailyStreak; private int _maxDailyStreak; private int _voteStreak; @@ -44,6 +45,16 @@ public class BonusClientData { return _dailyTime; } + + public void setClansDailyTime(Timestamp value) + { + _clansDailyTime = value; + } + + public Timestamp getClansDailyTime() + { + return _clansDailyTime; + } public void setRankTime(Date value) { @@ -64,6 +75,16 @@ public class BonusClientData { return _voteTime; } + + public void setClansVoteTime(Date value) + { + _clansVoteTime = value; + } + + public Date getClansVoteTime() + { + return _clansVoteTime; + } public void setDailyStreak(Integer value) { diff --git a/Plugins/Mineplex.Core/src/mineplex/core/bonuses/BonusManager.java b/Plugins/Mineplex.Core/src/mineplex/core/bonuses/BonusManager.java index 3ab6b1292..b22f39e3c 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/bonuses/BonusManager.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/bonuses/BonusManager.java @@ -7,14 +7,13 @@ import java.sql.Timestamp; import java.util.ArrayList; import java.util.Calendar; import java.util.HashMap; -import java.util.LinkedList; -import java.util.Queue; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; import java.util.TimeZone; import java.util.UUID; - -import net.minecraft.server.v1_8_R3.DataWatcher; -import net.minecraft.server.v1_8_R3.EntityCreeper; -import net.minecraft.server.v1_8_R3.PacketPlayOutEntityMetadata; +import java.util.concurrent.ConcurrentHashMap; import org.bukkit.Bukkit; import org.bukkit.Location; @@ -46,7 +45,11 @@ import mineplex.core.bonuses.event.CarlSpinnerEvent; import mineplex.core.bonuses.gui.BonusGui; import mineplex.core.bonuses.gui.SpinGui; import mineplex.core.bonuses.gui.buttons.PowerPlayClubButton; +import mineplex.core.bonuses.redis.VoteHandler; +import mineplex.core.bonuses.redis.VotifierCommand; +import mineplex.core.common.Pair; import mineplex.core.common.Rank; +import mineplex.core.common.currency.GlobalCurrency; import mineplex.core.common.util.C; import mineplex.core.common.util.Callback; import mineplex.core.common.util.F; @@ -56,7 +59,6 @@ import mineplex.core.common.util.UtilParticle.ViewDist; import mineplex.core.common.util.UtilPlayer; import mineplex.core.common.util.UtilServer; import mineplex.core.donation.DonationManager; -import mineplex.core.donation.GiveDonorData; import mineplex.core.facebook.FacebookManager; import mineplex.core.gadget.GadgetManager; import mineplex.core.hologram.Hologram; @@ -78,20 +80,28 @@ import mineplex.core.updater.UpdateType; import mineplex.core.updater.event.UpdateEvent; import mineplex.core.youtube.YoutubeManager; import mineplex.database.Tables; +import mineplex.database.tables.records.BonusRecord; +import mineplex.serverdata.commands.ServerCommandManager; import mineplex.serverdata.database.DBPool; +import net.minecraft.server.v1_8_R3.DataWatcher; +import net.minecraft.server.v1_8_R3.EntityCreeper; +import net.minecraft.server.v1_8_R3.PacketPlayOutEntityMetadata; public class BonusManager extends MiniClientPlugin implements ILoginProcessor { - public static final TimeZone TIMEZONE = TimeZone.getTimeZone("UTC"); - + private static long timeOffSet = 0; private ArrayList _pendingExplosions = new ArrayList<>(); private ArrayList _pendingExplosionsPlayers = new ArrayList<>(); - private HashMap _showCarl = new HashMap<>(); + private final Map> _homeServerMap = new ConcurrentHashMap<>(); + private Map _showCarl = new HashMap<>(); private long _explode; + private boolean _canVote; private boolean _animationRunning; + + public final boolean ClansBonus; public static long getSqlTime() { @@ -137,12 +147,58 @@ public class BonusManager extends MiniClientPlugin implements I private Location _carlLocation; private AnimationCarl _animation; private int _visualTick; + + private ArrayList _voteList; + private List> _youtubers; + + private String _creeperName; + + /** + * THIS SHOULD ONLY BE USED FOR VOTIFIER! + */ + public BonusManager(JavaPlugin plugin, CoreClientManager clientManager, DonationManager donationManager) + { + super("Bonus", plugin); + _enabled = false; - // Donor Queues - private Queue _coinQueue; - private Queue _gemQueue; + _repository = new BonusRepository(plugin, this, donationManager); + _clientManager = clientManager; + _donationManager = donationManager; + _powerPlayClubRepository = new PowerPlayClubRepository(plugin, clientManager, donationManager); - public BonusManager(JavaPlugin plugin, Location carlLocation, PlayWireManager playWireManager, CoreClientManager clientManager, DonationManager donationManager, PollManager pollManager, NpcManager npcManager, HologramManager hologramManager, StatsManager statsManager, InventoryManager inventoryManager, PetManager petManager, FacebookManager facebookManager, YoutubeManager youtubeManager, GadgetManager gadgetManager, ThankManager thankManager) + System.out.print("VOTIFIER: "); + System.out.print("DONATION MANAGER - > " + _donationManager.toString()); + + ClansBonus = _plugin.getClass().getSimpleName().equalsIgnoreCase("ClansHub"); + + _voteList = new ArrayList<>(); + if (ClansBonus) + { + _voteList.add("http://cvote1.mineplex.com"); + _voteList.add("http://cvote2.mineplex.com"); + _voteList.add("http://cvote3.mineplex.com"); + } + else + { + _voteList.add("http://vote1.mineplex.com"); + _voteList.add("http://vote2.mineplex.com"); + _voteList.add("http://vote3.mineplex.com"); + } + + _youtubers = new ArrayList<>(); + if (!ClansBonus) + { + _youtubers.add(Pair.create("Sigils", "https://www.youtube.com/user/SigilsPlaysGames?sub_confirmation=1")); + _youtubers.add(Pair.create("SallyGreenGamer", "https://www.youtube.com/channel/UCt8eypdLUND5CBvgXzEZrxw?sub_confirmation=1")); + } + _youtubers.add(Pair.create("SamitoD", "https://www.youtube.com/user/SamitoD?sub_confirmation=1")); + + _creeperName = "Carl"; + + updateOffSet(); + } + + public BonusManager(JavaPlugin plugin, Location carlLocation, PlayWireManager playWireManager, CoreClientManager clientManager, DonationManager donationManager, PollManager pollManager, NpcManager npcManager, HologramManager hologramManager, StatsManager statsManager, InventoryManager inventoryManager, PetManager petManager, FacebookManager facebookManager, YoutubeManager youtubeManager, GadgetManager gadgetManager, ThankManager thankManager, String creeperName) { super("Bonus", plugin); _repository = new BonusRepository(plugin, this, donationManager); @@ -152,13 +208,14 @@ public class BonusManager extends MiniClientPlugin implements I _hologramManager = hologramManager; _inventoryManager = inventoryManager; _thankManager = thankManager; + _creeperName = creeperName; if (gadgetManager == null) { System.out.print("GM NULL"); } - _rewardManager = new RewardManager(_clientManager, _donationManager, _inventoryManager, petManager, statsManager, gadgetManager); + _rewardManager = new RewardManager(_clientManager, _donationManager, _inventoryManager, petManager, gadgetManager, statsManager); _pollManager = pollManager; _statsManager = statsManager; @@ -168,14 +225,35 @@ public class BonusManager extends MiniClientPlugin implements I _playWireManager = playWireManager; _powerPlayClubRepository = new PowerPlayClubRepository(plugin, _clientManager, _donationManager); - - _coinQueue = new LinkedList<>(); - _gemQueue = new LinkedList<>(); - + + ClansBonus = _plugin.getClass().getSimpleName().equalsIgnoreCase("ClansHub"); + + _voteList = new ArrayList<>(); + if (ClansBonus) + { + _voteList.add("http://cvote1.mineplex.com"); + _voteList.add("http://cvote2.mineplex.com"); + _voteList.add("http://cvote3.mineplex.com"); + } + else + { + _voteList.add("http://vote1.mineplex.com"); + _voteList.add("http://vote2.mineplex.com"); + _voteList.add("http://vote3.mineplex.com"); + } + _canVote = true; + + _youtubers = new ArrayList<>(); + if (!ClansBonus) + { + _youtubers.add(Pair.create("Sigils", "https://www.youtube.com/user/SigilsPlaysGames?sub_confirmation=1")); + _youtubers.add(Pair.create("SallyGreenGamer", "https://www.youtube.com/channel/UCt8eypdLUND5CBvgXzEZrxw?sub_confirmation=1")); + } + _youtubers.add(Pair.create("SamitoD", "https://www.youtube.com/user/SamitoD?sub_confirmation=1")); if (npcManager != null) { - _carlNpc = _npcManager.getNpcByName("Carl the Creeper"); + _carlNpc = _npcManager.getNpcByName(_creeperName + " the Creeper"); if (_carlNpc == null) { _enabled = false; @@ -197,8 +275,38 @@ public class BonusManager extends MiniClientPlugin implements I } clientManager.addStoredProcedureLoginProcessor(this); - + + ServerCommandManager.getInstance().registerCommandType("VotifierCommand", VotifierCommand.class, new VoteHandler(this)); + updateOffSet(); + + if (ClansBonus) + { + clientManager.addStoredProcedureLoginProcessor(new ILoginProcessor() + { + @Override + public String getName() + { + return "clans-server-id-loader"; + } + + @Override + public void processLoginResultSet(String playerName, UUID uuid, int accountId, ResultSet resultSet) throws SQLException + { + boolean hasRow = resultSet.next(); + if (hasRow) + { + _homeServerMap.put(uuid, Pair.create(resultSet.getString(1), resultSet.getInt(2))); + } + } + + @Override + public String getQuery(int accountId, String uuid, String name) + { + return "SELECT cs.serverName, cs.id FROM accountClan INNER JOIN clans ON clans.id = accountClan.clanId INNER JOIN clanServer AS cs ON clans.serverId = cs.id WHERE accountClan.accountId = " + accountId + ";"; + } + }); + } } @@ -220,6 +328,53 @@ public class BonusManager extends MiniClientPlugin implements I updateOffSet(); } + public String getCreeperName() + { + return _creeperName; + } + + public Pair getClansHomeServer(Player player) + { + if (ClansBonus) + { + return _homeServerMap.getOrDefault(player.getUniqueId(), Pair.create("No Server", -1)); + } + else + { + return Pair.create("No Server", -1); + } + } + + public void handleVote(final Player player, final int rewardReceived, final boolean clans) + { + final int accountId = _clientManager.getAccountId(player); + + runAsync(() -> _repository.getClientData(accountId, data -> runSync(() -> + { + BonusClientData oldData = Get(player); + if (oldData != null) + { + data.setHologram(oldData.getHologram()); + } + Set(player, data); + + if (clans) + { + _statsManager.incrementStat(player, "Global.ClansDailyVote", 1); + addPendingExplosion(player, player.getName()); + UtilPlayer.message(player, F.main(_creeperName, "Thanks for voting for Mineplex Clans!")); + UtilPlayer.message(player, F.main(_creeperName, "You received " + F.elem(rewardReceived + " Gold") + " on your home server and " + F.elem("1 Spinner Ticket") + "!")); + } + else + { + _statsManager.incrementStat(player, "Global.DailyVote", 1); + addPendingExplosion(player, player.getName()); + UtilPlayer.message(player, F.main(_creeperName, "Thanks for voting for Mineplex!")); + UtilPlayer.message(player, F.main(_creeperName, "You received " + F.elem(rewardReceived + " Gems") + " and " + F.elem("1 Spinner Ticket") + "!")); + } + }))); + } + @EventHandler public void fireCreeper(UpdateEvent event) { @@ -232,12 +387,16 @@ public class BonusManager extends MiniClientPlugin implements I if (_animationRunning) return; + if (!_canVote) + return; + if (!_enabled) return; _animationRunning = true; _explode = System.currentTimeMillis(); _animation.setTicks(0); + _canVote = false; } @EventHandler @@ -246,11 +405,14 @@ public class BonusManager extends MiniClientPlugin implements I if (event.getType() != UpdateType.TICK) return; - _animation.itemClean(); + if (_canVote) + return; if (!_enabled) return; + _animation.itemClean(); + if (!_animationRunning) return; @@ -285,6 +447,7 @@ public class BonusManager extends MiniClientPlugin implements I DecreaseSize(creeper); _pendingExplosions.remove(0); _pendingExplosionsPlayers.remove(0); + _canVote = true; } @EventHandler @@ -322,23 +485,29 @@ public class BonusManager extends MiniClientPlugin implements I public static final long TIME_BETWEEN_BONUSES = 1000 * 60 * 60 * 20; public static final long DAILY_STREAK_RESET_TIME = 1000 * 60 * 60 * 12; + public static final long VOTE_STREAK_RESET_TIME = 1000 * 60 * 60 * 24; - - public void attemptDailyBonus(final Player player, final BonusAmount amount, final Callback result) + public void attemptDailyBonus(final Player player, final BonusAmount amount, final boolean clans, final Callback result) { if (timeTillDailyBonus(player) > 0) result.run(false); - getRepository().attemptDailyBonus(player, r -> + getRepository().attemptDailyBonus(player, ClansBonus, r -> { if (r) { - incrementDailyStreak(player); + if (ClansBonus) + { + _statsManager.incrementStat(player, "Global.ClansDailyReward", 1); + } + else + { + incrementDailyStreak(player); + _statsManager.incrementStat(player, "Global.DailyReward", 1); + } awardBonus(player, amount); updateCreeperVisual(player, true, C.cAqua); - UtilPlayer.message(player, F.main("Carl", "Come back tomorrow for more!")); - - _statsManager.incrementStat(player, "Global.DailyReward", 1); + UtilPlayer.message(player, F.main(_creeperName, "Come back tomorrow for more!")); } result.run(r); @@ -353,7 +522,7 @@ public class BonusManager extends MiniClientPlugin implements I // This calculates the the next daily bonus, IT HAS TO MATCH THE MYSQL STORED FUNCTION. public long nextDailyBonus(Player player) { - Timestamp timestamp = Get(player).getDailyTime(); + Timestamp timestamp = ClansBonus ? Get(player).getClansDailyTime() : Get(player).getDailyTime(); if (timestamp == null) return 0; @@ -375,7 +544,7 @@ public class BonusManager extends MiniClientPlugin implements I { awardBonus(player, getRankBonusAmount(player)); updateCreeperVisual(player, true, C.cAqua); - UtilPlayer.message(player, F.main("Carl", "Come back next month for more!")); + UtilPlayer.message(player, F.main(_creeperName, "Come back next month for more!")); } result.run(aBoolean); @@ -403,7 +572,7 @@ public class BonusManager extends MiniClientPlugin implements I } else { - UtilPlayer.message(player, F.main("Carl", "There was an error processing your request. Try again later")); + UtilPlayer.message(player, F.main(_creeperName, "There was an error processing your request. Try again later")); } }); } @@ -415,7 +584,6 @@ public class BonusManager extends MiniClientPlugin implements I return nextRankBonus(player) - getLocalTime(); } - // This calculates the the next rank bonus, IT HAS TO MATCH THE MYSQL STORED FUNCTION. public long nextRankBonus(Player player) { @@ -426,7 +594,6 @@ public class BonusManager extends MiniClientPlugin implements I long lastBonus = date.getTime(); - return getNextRankBonusTime(getLocalTime(lastBonus)); } @@ -444,6 +611,20 @@ public class BonusManager extends MiniClientPlugin implements I } } } + + public void updateVoteStreak(BonusRecord client) + { + if (client.getVoteStreak() > 0 && client.getVotetime() != null) + { + long lastBonus = getLocalTime(client.getVotetime().getTime()); + long timeLeft = getStreakTimeRemaining(lastBonus, BonusManager.VOTE_STREAK_RESET_TIME); + + if (timeLeft < 0) + { + client.setVoteStreak(0); + } + } + } public void incrementDailyStreak(Player player) { @@ -454,6 +635,16 @@ public class BonusManager extends MiniClientPlugin implements I if (data.getDailyStreak() > data.getMaxDailyStreak()) data.setMaxDailyStreak(data.getDailyStreak()); } + + public void incrementVoteStreak(BonusRecord client) + { + client.setVoteStreak(client.getVoteStreak() + 1); + + if (client.getVoteStreak() > client.getMaxVoteStreak()) + { + client.setMaxVoteStreak(client.getVoteStreak()); + } + } public boolean continueStreak(long localLastBonus, long extendTime) { @@ -469,7 +660,6 @@ public class BonusManager extends MiniClientPlugin implements I public static long getNextRankBonusTime(long time) { - Calendar calendar = Calendar.getInstance(); calendar.setTimeZone(TIMEZONE); calendar.setTimeInMillis(time); @@ -494,25 +684,84 @@ public class BonusManager extends MiniClientPlugin implements I if (streak >= 40) multiplier += (1 * (streak - 40)); return multiplier; } + + public int getVoteMultiplier(int streak) + { + int multiplier = Math.min(100, 5 * streak); + if (streak >= 20) + { + multiplier += (1 * (streak - 40)); + } + return multiplier; + } public BonusAmount getDailyBonusAmount(Player player) { double mult = getDailyMultiplier(player) / 100.0; BonusAmount amount = new BonusAmount(); - int coins = 100; + int shards = 100; int gems = 100; int experience = 250; - amount.setCoins(coins); + amount.setShards(shards); amount.setGems(gems); amount.setExperience(experience); - amount.setBonusCoins((int) (mult * coins)); + amount.setBonusShards((int) (mult * shards)); amount.setBonusGems((int) (mult * gems)); amount.setBonusExperience((int) (mult * experience)); return amount; } + + public BonusAmount getClansDailyBonusAmount(Player player) + { + BonusAmount amount = new BonusAmount(); + + int serverId = getClansHomeServer(player).getRight(); + + if (serverId != -1) + { + amount.setGold(serverId, 500); + } + + return amount; + } + + public BonusAmount getVoteBonusAmount(Player player) + { + return getVoteBonusAmount(Get(player).getVoteStreak()); + } + + public BonusAmount getVoteBonusAmount(int voteStreak) + { + double mult = getVoteMultiplier(voteStreak) / 100.0; + + BonusAmount amount = new BonusAmount(); + amount.setTickets(1); + amount.setGems(400); + amount.setBonusGems((int) (mult * 400)); + + return amount; + } + + public BonusAmount getClansVoteBonusAmount(Player player) + { + return getClansVoteBonusAmount(getClansHomeServer(player).getRight()); + } + + public BonusAmount getClansVoteBonusAmount(int serverId) + { + BonusAmount amount = new BonusAmount(); + + if (serverId != -1) + { + amount.setTickets(1); + amount.setGold(serverId, 1000); + } + + return amount; + } public BonusAmount getRankBonusAmount(Player player) { @@ -520,7 +769,13 @@ public class BonusManager extends MiniClientPlugin implements I BonusAmount data = new BonusAmount(); - if (rank.has(Rank.TITAN)) + if (rank.has(Rank.ETERNAL)) + { + data.setIlluminatedChests(2); + data.setMythicalChests(2); + data.setOmegaChests(1); + } + else if (rank.has(Rank.TITAN)) { data.setMythicalChests(5); } @@ -539,6 +794,26 @@ public class BonusManager extends MiniClientPlugin implements I return data; } + + + //VOTE + public long timeTillVoteBonus(Player player) + { + return nextVoteTime(player) - getLocalTime(); + } + + // This calculates the the next vote bonus, IT HAS TO MATCH THE MYSQL STORED FUNCTION. + public long nextVoteTime(Player player) + { + Date date = ClansBonus ? Get(player).getClansVoteTime() : Get(player).getVoteTime(); + if (date == null) + { + return 0; + } + long lastBonus = date.getTime(); + + return getNextVoteTime(getLocalTime(lastBonus)); + } public void awardBonus(final Player player, BonusAmount amount) { @@ -547,52 +822,73 @@ public class BonusManager extends MiniClientPlugin implements I final int gems = amount.getTotalGems(); final int gold = amount.getTotalGold(); - final int coins = amount.getTotalCoins(); + final int shards = amount.getTotalShards(); final int tickets = amount.getTickets(); int experience = amount.getTotalExperience(); int oldChests = amount.getOldChests(); int ancientChests = amount.getAncientChests(); int mythicalChests = amount.getMythicalChests(); + int illuminatedChests = amount.getIlluminatedChests(); + int omegaChests = amount.getOmegaChests(); if (oldChests > 0) { - UtilPlayer.message(player, F.main("Carl", "Rewarded " + F.elem(oldChests + " Old Chests"))); + UtilPlayer.message(player, F.main(_creeperName, "Rewarded " + F.elem(oldChests + " Old Chests"))); _inventoryManager.Get(player).addItem(new ClientItem(_inventoryManager.getItem(TreasureType.OLD.getItemName()), oldChests)); } if (ancientChests > 0) { - UtilPlayer.message(player, F.main("Carl", "Rewarded " + F.elem(ancientChests + " Ancient Chests"))); + UtilPlayer.message(player, F.main(_creeperName, "Rewarded " + F.elem(ancientChests + " Ancient Chests"))); _inventoryManager.Get(player).addItem(new ClientItem(_inventoryManager.getItem(TreasureType.ANCIENT.getItemName()), ancientChests)); } if (mythicalChests > 0) { - UtilPlayer.message(player, F.main("Carl", "Rewarded " + F.elem(mythicalChests + " Mythical Chests"))); + UtilPlayer.message(player, F.main(_creeperName, "Rewarded " + F.elem(mythicalChests + " Mythical Chests"))); _inventoryManager.Get(player).addItem(new ClientItem(_inventoryManager.getItem(TreasureType.MYTHICAL.getItemName()), mythicalChests)); } + if (illuminatedChests > 0) + { + UtilPlayer.message(player, F.main(_creeperName, "Rewarded " + F.elem(illuminatedChests + " Illuminated Chests"))); + _inventoryManager.Get(player).addItem(new ClientItem(_inventoryManager.getItem(TreasureType.ILLUMINATED.getItemName()), illuminatedChests)); + } + + if (omegaChests > 0) + { + UtilPlayer.message(player, F.main(_creeperName, "Rewarded " + F.elem(omegaChests + " Omega Chests"))); + _inventoryManager.Get(player).addItem(new ClientItem(_inventoryManager.getItem(TreasureType.OMEGA.getItemName()), omegaChests)); + } + if (gems > 0) { - UtilPlayer.message(player, F.main("Carl", "Rewarded " + F.elem(gems + " Gems"))); - _gemQueue.add(new GiveDonorData(null, player.getName(), "Treasure", player.getUniqueId(), coreClient.getAccountId(), gems)); + UtilPlayer.message(player, F.main(_creeperName, "Rewarded " + F.elem(gems + " Gems"))); + _donationManager.rewardCurrencyUntilSuccess(GlobalCurrency.GEM, player, "Earned", gems); } if (gold > 0) { - UtilPlayer.message(player, F.main("Carl", "Rewarded " + F.elem(gold + " Gold"))); + UtilPlayer.message(player, F.main(_creeperName, "Rewarded " + F.elem(gold + " Gold"))); + Set serverIds = new HashSet<>(); + serverIds.addAll(amount.getGold().getServerIds()); + serverIds.addAll(amount.getBonusGold().getServerIds()); + for (Integer serverId : serverIds) + { + _donationManager.getGoldRepository().rewardGold(null, serverId, coreClient.getAccountId(), amount.getGold().getGoldFor(serverId) + amount.getBonusGold().getGoldFor(serverId)); + } } - if (coins > 0) + if (shards > 0) { - 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)); + UtilPlayer.message(player, F.main(_creeperName, "Rewarded " + F.elem(shards + " Treasure Shards"))); + _donationManager.rewardCurrencyUntilSuccess(GlobalCurrency.TREASURE_SHARD, player, "Earned", shards); } if (tickets > 0) { - UtilPlayer.message(player, F.main("Carl", "Rewarded " + F.elem(tickets + " Carl Spin Ticket"))); - final int accountId = _clientManager.Get(player).getAccountId(); + UtilPlayer.message(player, F.main(_creeperName, "Rewarded " + F.elem(tickets + " Carl Spin Ticket"))); + final int accountId = coreClient.getAccountId(); runAsync(() -> { try @@ -612,9 +908,30 @@ public class BonusManager extends MiniClientPlugin implements I if (experience > 0) { _statsManager.incrementStat(player, "Global.ExpEarned", experience); - UtilPlayer.message(player, F.main("Carl", "Rewarded " + F.elem(experience + " Experience"))); + UtilPlayer.message(player, F.main(_creeperName, "Rewarded " + F.elem(experience + " Experience"))); } } + + public static long getNextVoteTime(long time) + { + Calendar calendar = Calendar.getInstance(); + calendar.setTimeZone(TIMEZONE); + calendar.setTimeInMillis(time); + + calendar.add(Calendar.DAY_OF_YEAR, 1); + calendar.set(Calendar.HOUR_OF_DAY, 0); + calendar.set(Calendar.MINUTE, 0); + calendar.set(Calendar.SECOND, 0); + calendar.set(Calendar.MILLISECOND, 0); + + return calendar.getTimeInMillis(); + } + + public boolean canVote(Player player) + { + long nextVoteTime = nextVoteTime(player); + return System.currentTimeMillis() >= nextVoteTime; + } @EventHandler(priority = EventPriority.LOW, ignoreCancelled = true) public void openGui(PlayerInteractAtEntityEvent event) @@ -678,8 +995,10 @@ public class BonusManager extends MiniClientPlugin implements I int availableRewards = 0; - if (_playWireManager.Get(player) != null && _playWireManager.Get(player).getAccountId() == -1 && _playWireManager.canRedeemTickets(_playWireManager.Get(player))) availableRewards++; + if (canVote(player)) availableRewards++; + if (_playWireManager.Get(player) != null && _playWireManager.Get(player).getAccountId() != -1 && _playWireManager.canRedeemTickets(_playWireManager.Get(player))) availableRewards++; if (_youtubeManager.canYoutube(player)) availableRewards++; + if (_youtubeManager.canSpecificYoutube(player)) availableRewards++; if (canRank(player) && _clientManager.hasRank(player, Rank.ULTRA) && isPastAugust()) availableRewards++; if (canDaily(player)) availableRewards++; if (getPollManager().getNextPoll(_pollManager.Get(player), _clientManager.Get(player).GetRank()) != null) availableRewards++; @@ -839,60 +1158,42 @@ public class BonusManager extends MiniClientPlugin implements I { if (Recharge.Instance.use(player, "Carl Inform", 240000, false, false)) { - if(_pollManager.hasPoll(player) || (_playWireManager.Get(player) != null && _playWireManager.Get(player).getAccountId() == -1 && _playWireManager.canRedeemTickets(_playWireManager.Get(player))) || (canRank(player) && _clientManager.hasRank(player, Rank.ULTRA) && isPastAugust()) || canDaily(player) || PowerPlayClubButton.isAvailable(player, _powerPlayClubRepository)) + if (_pollManager.hasPoll(player) || canVote(player) || _youtubeManager.canSpecificYoutube(player) || _youtubeManager.canYoutube(player) || (_playWireManager.Get(player) != null && _playWireManager.Get(player).getAccountId() != -1 && _playWireManager.canRedeemTickets(_playWireManager.Get(player))) || (canRank(player) && _clientManager.hasRank(player, Rank.ULTRA) && isPastAugust()) || canDaily(player) || PowerPlayClubButton.isAvailable(player, _powerPlayClubRepository)) { - if(_showCarl.containsKey(player.getName())) + if (_showCarl.containsKey(player.getName())) { - if(_plugin.getConfig().getString("serverstatus.group").equalsIgnoreCase("Lobby")) - UtilPlayer.message(player, C.cDGreen + C.Bold + "Carl the Creeper>" + C.cGreen + " Hey " + player.getName().replace("s", "sss") + "! I have sssome amazing rewardsss for you! Come sssee me!"); + if (_plugin.getClass().getSimpleName().equalsIgnoreCase("Hub") || _plugin.getClass().getSimpleName().equalsIgnoreCase("ClansHub")) + UtilPlayer.message(player, C.cDGreen + C.Bold + _creeperName + " the Creeper>" + C.cGreen + " Hey " + player.getName().replace("s", "sss") + "! I have sssome amazing rewardsss for you! Come sssee me!"); } } } } } - - @EventHandler - public void processQueue(UpdateEvent event) + + public String getVoteLink() { - if (event.getType() != UpdateType.FASTER) - return; - - // Gems - final GiveDonorData gemData = _gemQueue.poll(); - if (gemData != null && gemData.getAttempts() < 10) + long sqlTime = getSqlTime(); + Calendar calendar = Calendar.getInstance(); + calendar.setTimeInMillis(sqlTime); + int date = calendar.get(Calendar.DAY_OF_YEAR); + int index = date % _voteList.size(); + return _voteList.get(index); + } + + public Pair getSpecificCreator() + { + long sqlTime = getSqlTime(); + Calendar calendar = Calendar.getInstance(); + calendar.setTimeInMillis(sqlTime); + int date = calendar.get(Calendar.DAY_OF_YEAR); + if (_youtubers.size() >= 1) { - _donationManager.RewardGems(data -> - { - if (data) - { - System.out.println("Successfully processed " + gemData.getGiveAmount() + " gems for " + gemData.getPlayerName()); - } - else - { - gemData.incrementAttempts(); - System.out.println("Failed to process gems for " + gemData.getPlayerName() + " adding to back of queue. Attempts: " + gemData.getAttempts()); - _gemQueue.add(gemData); - } - }, "Earned", gemData.getPlayerName(), gemData.getUuid(), gemData.getGiveAmount()); + int index = date % _youtubers.size(); + return _youtubers.get(index); } - - // Coins - final GiveDonorData coinData = _coinQueue.poll(); - if (coinData != null && coinData.getAttempts() < 10) + else { - _donationManager.RewardCoins(data -> - { - if (data) - { - System.out.println("Successfully processed " + coinData.getGiveAmount() + " coins for " + coinData.getPlayerName()); - } - else - { - coinData.incrementAttempts(); - System.out.println("Failed to process coins for " + coinData.getPlayerName() + " adding to back of queue. Attempts: " + coinData.getAttempts()); - _coinQueue.add(coinData); - } - }, "Earned", coinData.getPlayerName(), coinData.getAccountId(), coinData.getGiveAmount()); + return Pair.create("MineplexGames", "http://youtube.com/mineplexgamesofficial?sub_confirmation=1"); } } @@ -958,4 +1259,4 @@ public class BonusManager extends MiniClientPlugin implements I { _carlLocation = carlLocation; } -} \ No newline at end of file +} diff --git a/Plugins/Mineplex.Core/src/mineplex/core/bonuses/BonusRepository.java b/Plugins/Mineplex.Core/src/mineplex/core/bonuses/BonusRepository.java index 594dff4e8..2d882fd72 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/bonuses/BonusRepository.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/bonuses/BonusRepository.java @@ -3,41 +3,41 @@ package mineplex.core.bonuses; import java.sql.CallableStatement; import java.sql.Connection; import java.sql.Date; +import java.sql.PreparedStatement; import java.sql.ResultSet; import java.sql.SQLException; import java.sql.Timestamp; import java.sql.Types; -import mineplex.core.common.Pair; -import mineplex.core.common.util.Callback; -import mineplex.core.database.MinecraftRepository; -import mineplex.serverdata.database.DBPool; -import mineplex.serverdata.database.RepositoryBase; -import mineplex.serverdata.database.ResultSetCallable; -import mineplex.core.donation.DonationManager; -import mineplex.core.recharge.Recharge; -import mineplex.database.Tables; -import mineplex.database.tables.records.BonusRecord; +import org.bukkit.Bukkit; +import org.bukkit.entity.Player; +import org.bukkit.plugin.Plugin; +import org.bukkit.plugin.java.JavaPlugin; import org.jooq.DSLContext; import org.jooq.Record2; import org.jooq.SQLDialect; import org.jooq.TableField; import org.jooq.impl.DSL; -import org.bukkit.Bukkit; -import org.bukkit.entity.Player; -import org.bukkit.plugin.Plugin; -import org.bukkit.plugin.java.JavaPlugin; +import mineplex.core.common.Pair; +import mineplex.core.common.util.Callback; +import mineplex.core.donation.DonationManager; +import mineplex.core.recharge.Recharge; +import mineplex.database.Tables; +import mineplex.database.tables.records.BonusRecord; +import mineplex.serverdata.database.DBPool; +import mineplex.serverdata.database.RepositoryBase; +import mineplex.serverdata.database.ResultSetCallable; -public class BonusRepository extends MinecraftRepository +public class BonusRepository extends RepositoryBase { - private static String CREATE_BONUS_TABLE = "CREATE TABLE IF NOT EXISTS bonus (accountId INT NOT NULL AUTO_INCREMENT, dailytime TIMESTAMP NULL DEFAULT NULL, ranktime DATE NULL DEFAULT NULL, PRIMARY KEY (accountId), FOREIGN KEY (accountId) REFERENCES accounts(id));"; + private static String CREATE_BONUS_TABLE = "CREATE TABLE IF NOT EXISTS bonus (accountId INT NOT NULL AUTO_INCREMENT, dailytime TIMESTAMP NULL DEFAULT NULL, clansdailytime TIMESTAMP NULL DEFAULT NULL, ranktime DATE NULL DEFAULT NULL, votetime DATE NULL DEFAULT NULL, clansvotetime DATE NULL DEFAULT NULL, PRIMARY KEY (accountId), FOREIGN KEY (accountId) REFERENCES accounts(id));"; private BonusManager _manager; private DonationManager _donationManager; public BonusRepository(JavaPlugin plugin, BonusManager bonusManager, DonationManager donationManager) { - super(plugin, DBPool.getAccount()); + super(DBPool.getAccount()); _manager = bonusManager; _donationManager = donationManager; } @@ -63,6 +63,29 @@ public class BonusRepository extends MinecraftRepository System.out.println("Loaded record. Daily time: " + record.getDailytime()); return record; } + + public int loadClansServerId(int accountId) + { + try (Connection connection = getConnection()) + { + PreparedStatement s = connection.prepareStatement("SELECT clans.serverId FROM accountClan INNER JOIN clans ON clans.id = accountClan.clanId WHERE accountClan.accountId = " + accountId + ";"); + ResultSet rs = s.executeQuery(); + boolean hasRow = rs.next(); + if (hasRow) + { + return rs.getInt(1); + } + else + { + return -1; + } + } + catch (SQLException e) + { + e.printStackTrace(); + return -1; + } + } public BonusClientData loadData(final int accountId, ResultSet resultSet) throws SQLException { @@ -74,13 +97,15 @@ public class BonusRepository extends MinecraftRepository { foundClient = true; clientData.setDailyTime(resultSet.getTimestamp(2)); - clientData.setRankTime(resultSet.getDate(3)); - clientData.setVoteTime(resultSet.getDate(4)); - clientData.setDailyStreak(resultSet.getInt(5)); - clientData.setMaxDailyStreak(resultSet.getInt(6)); - clientData.setVoteStreak(resultSet.getInt(7)); - clientData.setMaxVoteStreak(resultSet.getInt(8)); - clientData.setTickets(resultSet.getInt(9)); + clientData.setClansDailyTime(resultSet.getTimestamp(3)); + clientData.setRankTime(resultSet.getDate(4)); + clientData.setVoteTime(resultSet.getDate(5)); + clientData.setClansVoteTime(resultSet.getDate(6)); + clientData.setDailyStreak(resultSet.getInt(7)); + clientData.setMaxDailyStreak(resultSet.getInt(8)); + clientData.setVoteStreak(resultSet.getInt(9)); + clientData.setMaxVoteStreak(resultSet.getInt(10)); + clientData.setTickets(resultSet.getInt(11)); } if (!foundClient) @@ -170,13 +195,15 @@ public class BonusRepository extends MinecraftRepository }); } - public void attemptDailyBonus(final Player player, final Callback result) + public void attemptDailyBonus(final Player player, final boolean clans, final Callback result) { final int accountId = _manager.getClientManager().Get(player).getAccountId(); - final int coins = 0; + final int serverId = _manager.getClansHomeServer(player).getRight(); + final int shards = 0; final int gems = 0; + final int gold = 500; /* - * if (coins == 0 && gems == 0) { result.accept(false); return; } + * if (shards == 0 && gems == 0) { result.accept(false); return; } */ final JavaPlugin plug = _manager.getPlugin(); @@ -185,46 +212,93 @@ public class BonusRepository extends MinecraftRepository @Override public void run() { - try (Connection connection = getConnection(); - CallableStatement callableStatement = connection.prepareCall("{call check_daily(?, ?, ?, ?, ?)}")) + if (clans) { - callableStatement.setInt(1, accountId); - callableStatement.setInt(2, coins); - callableStatement.setInt(3, gems); - callableStatement.registerOutParameter(4, java.sql.Types.BOOLEAN); - callableStatement.registerOutParameter(5, java.sql.Types.TIMESTAMP); - - callableStatement.executeUpdate(); - - final boolean pass = callableStatement.getBoolean(4); - - final Timestamp timeStamp = callableStatement.getTimestamp(5); - - Bukkit.getScheduler().runTask(plug, new Runnable() - { - @Override - public void run() + try (Connection connection = getConnection(); + CallableStatement callableStatement = connection.prepareCall("{call check_clans_daily(?, ?, ?, ?, ?)}")) { + callableStatement.setInt(1, accountId); + callableStatement.setInt(2, serverId); + callableStatement.setInt(3, gold); + callableStatement.registerOutParameter(4, java.sql.Types.BOOLEAN); + callableStatement.registerOutParameter(5, java.sql.Types.TIMESTAMP); - if (pass) + callableStatement.executeUpdate(); + + final boolean pass = callableStatement.getBoolean(4); + + final Timestamp timeStamp = callableStatement.getTimestamp(5); + + Bukkit.getScheduler().runTask(plug, new Runnable() { - _manager.Get(player).setDailyTime(new Timestamp(BonusManager.getSqlTime())); - result.run(true); - } - else - { - Recharge.Instance.use(player, "AttemptDailyBonus", 1000 * 10, false, false); - _manager.Get(player).setDailyTime(timeStamp); - result.run(false); - } + @Override + public void run() + { + + if (pass) + { + _manager.Get(player).setClansDailyTime(new Timestamp(BonusManager.getSqlTime())); + result.run(true); + } + else + { + Recharge.Instance.use(player, "AttemptDailyBonus", 1000 * 10, false, false); + _manager.Get(player).setClansDailyTime(timeStamp); + result.run(false); + } + } + }); + } + catch (Exception e) + { + Recharge.Instance.use(player, "AttemptDailyBonus", 1000 * 30, false, false); + e.printStackTrace(); + result.run(false); } - }); } - catch (Exception e) + else { - Recharge.Instance.use(player, "AttemptDailyBonus", 1000 * 30, false, false); - e.printStackTrace(); - result.run(false); + try (Connection connection = getConnection(); + CallableStatement callableStatement = connection.prepareCall("{call check_daily(?, ?, ?, ?, ?)}")) + { + callableStatement.setInt(1, accountId); + callableStatement.setInt(2, shards); + callableStatement.setInt(3, gems); + callableStatement.registerOutParameter(4, java.sql.Types.BOOLEAN); + callableStatement.registerOutParameter(5, java.sql.Types.TIMESTAMP); + + callableStatement.executeUpdate(); + + final boolean pass = callableStatement.getBoolean(4); + + final Timestamp timeStamp = callableStatement.getTimestamp(5); + + Bukkit.getScheduler().runTask(plug, new Runnable() + { + @Override + public void run() + { + + if (pass) + { + _manager.Get(player).setDailyTime(new Timestamp(BonusManager.getSqlTime())); + result.run(true); + } + else + { + Recharge.Instance.use(player, "AttemptDailyBonus", 1000 * 10, false, false); + _manager.Get(player).setDailyTime(timeStamp); + result.run(false); + } + } + }); + } + catch (Exception e) + { + Recharge.Instance.use(player, "AttemptDailyBonus", 1000 * 30, false, false); + e.printStackTrace(); + result.run(false); + } } } }); @@ -264,11 +338,9 @@ public class BonusRepository extends MinecraftRepository result.run(false); return; } - + + final BonusAmount bonusAmount = _manager.getRankBonusAmount(player); final int accountId = _manager.getClientManager().Get(player).getAccountId(); - 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()) { @@ -284,20 +356,22 @@ public class BonusRepository extends MinecraftRepository public void run() { try (Connection connection = getConnection(); - CallableStatement callableStatement = connection.prepareCall("{call rankBonus(?, ?, ?, ?, ?, ?)}")) + CallableStatement callableStatement = connection.prepareCall("{call rankBonus(?, ?, ?, ?, ?, ?, ?, ?)}")) { callableStatement.setInt(1, accountId); - callableStatement.setInt(2, coins); - callableStatement.setInt(3, gems); - callableStatement.setInt(4, mythicalChestChange); - callableStatement.registerOutParameter(5, java.sql.Types.BOOLEAN); - callableStatement.registerOutParameter(6, java.sql.Types.DATE); + callableStatement.setInt(2, bonusAmount.getShards()); + callableStatement.setInt(3, bonusAmount.getGems()); + callableStatement.setInt(4, bonusAmount.getMythicalChests()); + callableStatement.setInt(5, bonusAmount.getOmegaChests()); + callableStatement.setInt(6, bonusAmount.getIlluminatedChests()); + callableStatement.registerOutParameter(7, java.sql.Types.BOOLEAN); + callableStatement.registerOutParameter(8, java.sql.Types.DATE); callableStatement.executeUpdate(); - final boolean pass = callableStatement.getBoolean(5); + final boolean pass = callableStatement.getBoolean(7); - final Date date = callableStatement.getDate(6); + final Date date = callableStatement.getDate(8); Bukkit.getScheduler().runTask(plug, new Runnable() { @@ -329,10 +403,12 @@ public class BonusRepository extends MinecraftRepository }); } - public void attemptVoteBonus(final int accountId, final Callback> result) + public void attemptVoteBonus(final int accountId, final boolean clans, final Callback> result) { - final int coins = 0; + final int serverId = 0; + final int shards = 0; final int gems = 0; + final int gold = 1000; final JavaPlugin plug = _manager.getPlugin(); @@ -341,32 +417,62 @@ public class BonusRepository extends MinecraftRepository @Override public void run() { + if (clans) + { + try (Connection connection = getConnection(); + CallableStatement callableStatement = connection.prepareCall("{call check_clans_vote(?, ?, ?, ?, ?)}")) { + callableStatement.setInt(1, accountId); + callableStatement.setInt(2, serverId); + callableStatement.setInt(3, gold); + callableStatement.registerOutParameter(4, Types.BOOLEAN); + callableStatement.registerOutParameter(5, Types.DATE); - try (Connection connection = getConnection(); - CallableStatement callableStatement = connection.prepareCall("{call check_vote(?, ?, ?, ?, ?)}")) { - callableStatement.setInt(1, accountId); - callableStatement.setInt(2, coins); - callableStatement.setInt(3, gems); - callableStatement.registerOutParameter(4, Types.BOOLEAN); - callableStatement.registerOutParameter(5, Types.DATE); + callableStatement.executeUpdate(); - callableStatement.executeUpdate(); + final boolean pass = callableStatement.getBoolean(4); + final Date date = callableStatement.getDate(5); - final boolean pass = callableStatement.getBoolean(4); - final Date date = callableStatement.getDate(5); - - Bukkit.getScheduler().runTask(plug, new Runnable() { - - @Override - public void run() + Bukkit.getScheduler().runTask(plug, new Runnable() { -// _manager.Get(player).setVoteTime(date); - result.run(Pair.create(pass, date)); - } - }); - } catch (Exception e) { - e.printStackTrace(); - result.run(null); + @Override + public void run() + { + // _manager.Get(player).setVoteTime(date); + result.run(Pair.create(pass, date)); + } + }); + } catch (Exception e) { + e.printStackTrace(); + result.run(null); + } + } + else + { + try (Connection connection = getConnection(); + CallableStatement callableStatement = connection.prepareCall("{call check_vote(?, ?, ?, ?, ?)}")) { + callableStatement.setInt(1, accountId); + callableStatement.setInt(2, shards); + callableStatement.setInt(3, gems); + callableStatement.registerOutParameter(4, Types.BOOLEAN); + callableStatement.registerOutParameter(5, Types.DATE); + + callableStatement.executeUpdate(); + + final boolean pass = callableStatement.getBoolean(4); + final Date date = callableStatement.getDate(5); + + Bukkit.getScheduler().runTask(plug, new Runnable() { + @Override + public void run() + { + // _manager.Get(player).setVoteTime(date); + result.run(Pair.create(pass, date)); + } + }); + } catch (Exception e) { + e.printStackTrace(); + result.run(null); + } } } }); @@ -433,16 +539,4 @@ public class BonusRepository extends MinecraftRepository .set(Tables.bonus.maxVoteStreak, clientData.getMaxVoteStreak()) .where(Tables.bonus.accountId.eq(accountId)).execute(); } - - @Override - protected void initialize() - { - //executeUpdate(CREATE_BONUS_TABLE); - } - - @Override - protected void update() - { - } - } diff --git a/Plugins/Mineplex.Core/src/mineplex/core/bonuses/GoldAmount.java b/Plugins/Mineplex.Core/src/mineplex/core/bonuses/GoldAmount.java new file mode 100644 index 000000000..36ed82194 --- /dev/null +++ b/Plugins/Mineplex.Core/src/mineplex/core/bonuses/GoldAmount.java @@ -0,0 +1,51 @@ +package mineplex.core.bonuses; + +import java.util.Collection; +import java.util.HashMap; +import java.util.Map; + +public class GoldAmount +{ + private Map _goldAmounts; + + public GoldAmount() + { + _goldAmounts = new HashMap<>(); + } + + public Collection getServerIds() + { + return _goldAmounts.keySet(); + } + + public Integer getGoldFor(Integer serverId) + { + return _goldAmounts.getOrDefault(serverId, 0); + } + + public Integer getTotalGold() + { + Integer gold = 0; + for (Integer g : _goldAmounts.values()) + { + gold += g; + } + + return gold; + } + + public void setGoldFor(Integer serverId, Integer gold) + { + _goldAmounts.put(serverId, gold); + } + + public void addGold(Integer serverId, Integer gold) + { + _goldAmounts.put(serverId, getGoldFor(serverId) + gold); + } + + public void clearGoldFor(Integer serverId) + { + _goldAmounts.remove(serverId); + } +} \ No newline at end of file diff --git a/Plugins/Mineplex.Core/src/mineplex/core/bonuses/animations/AnimationCarl.java b/Plugins/Mineplex.Core/src/mineplex/core/bonuses/animations/AnimationCarl.java index 5e2fb892a..4ea6aa93b 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/bonuses/animations/AnimationCarl.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/bonuses/animations/AnimationCarl.java @@ -311,4 +311,4 @@ public class AnimationCarl extends Animation } } } -} +} \ No newline at end of file diff --git a/Plugins/Mineplex.Core/src/mineplex/core/bonuses/gui/BonusGui.java b/Plugins/Mineplex.Core/src/mineplex/core/bonuses/gui/BonusGui.java index 99faaa17a..ea4c1a099 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/bonuses/gui/BonusGui.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/bonuses/gui/BonusGui.java @@ -1,38 +1,50 @@ package mineplex.core.bonuses.gui; +import org.bukkit.entity.Player; +import org.bukkit.plugin.Plugin; + import mineplex.core.bonuses.BonusManager; -import mineplex.core.bonuses.gui.buttons.*; +import mineplex.core.bonuses.gui.buttons.CarlSpinButton; +import mineplex.core.bonuses.gui.buttons.ClaimTipsButton; +import mineplex.core.bonuses.gui.buttons.DailyBonusButton; +import mineplex.core.bonuses.gui.buttons.FacebookButton; +import mineplex.core.bonuses.gui.buttons.PlayWireButton; +import mineplex.core.bonuses.gui.buttons.PollButton; +import mineplex.core.bonuses.gui.buttons.PowerPlayClubButton; +import mineplex.core.bonuses.gui.buttons.RankBonusButton; +import mineplex.core.bonuses.gui.buttons.SpecificChannelButton; +import mineplex.core.bonuses.gui.buttons.TwitterButton; +import mineplex.core.bonuses.gui.buttons.VoteButton; +import mineplex.core.bonuses.gui.buttons.YoutubeButton; import mineplex.core.facebook.FacebookManager; import mineplex.core.gui.SimpleGui; import mineplex.core.playwire.PlayWireManager; import mineplex.core.reward.RewardManager; import mineplex.core.thank.ThankManager; import mineplex.core.youtube.YoutubeManager; -import org.bukkit.entity.Player; -import org.bukkit.plugin.Plugin; public class BonusGui extends SimpleGui { + private final int VOTE_SLOT = 40; + private final int RANK_BONUS_SLOT = 10; + private final int DAILY_BONUS_SLOT = 12; + private final int POLL_SLOT = 28; + private final int FACEBOOK_SLOT = 20; + private final int CLAIM_TIPS_SLOT = 30; + private final int POWER_PLAY_SLOT = 16; + private final int CARL_SPINNER_SLOT = 14; + private final int YOUTUBE_SLOT = 22; + private final int TWITTER_SLOT = 34; + private final int PLAY_WIRE_SLOT = 32; + private final int SPECIFIC_YOUTUBE_SLOT = 24; - //private final int VOTE_SLOT = 10; - private final int RANK_BONUS_SLOT = 11; - private final int DAILY_BONUS_SLOT = 13; - private final int POLL_SLOT = 15; - private final int FACEBOOK_SLOT = 19; - private final int CLAIM_TIPS_SLOT = 25; - private final int POWER_PLAY_SLOT = 21; - private final int CARL_SPINNER_SLOT = 23; - private final int YOUTUBE_SLOT = 29; - private final int TWITTER_SLOT = 33; - private final int PLAY_WIRE_SLOT = 31; - - private static final int INV_SIZE = 45; + private static final int INV_SIZE = 54; public BonusGui(Plugin plugin, Player player, BonusManager manager, RewardManager rewardManager, FacebookManager facebookManager, YoutubeManager youtubeManager, ThankManager thankManager, PlayWireManager playWireManager) { super(plugin, player, player.getName() + "'s Bonuses", INV_SIZE); - //setItem(VOTE_SLOT, new VoteButton(plugin, player, this, manager)); + setItem(VOTE_SLOT, new VoteButton(plugin, player, this, manager)); setItem(RANK_BONUS_SLOT, new RankBonusButton(getPlugin(), player, this, manager)); @@ -53,6 +65,8 @@ public class BonusGui extends SimpleGui setItem(CARL_SPINNER_SLOT, new CarlSpinButton(getPlugin(), player, manager, rewardManager)); setItem(PLAY_WIRE_SLOT, new PlayWireButton(playWireManager, player)); + + setItem(SPECIFIC_YOUTUBE_SLOT, new SpecificChannelButton(player, youtubeManager)); } @Override diff --git a/Plugins/Mineplex.Core/src/mineplex/core/bonuses/gui/buttons/CarlSpinButton.java b/Plugins/Mineplex.Core/src/mineplex/core/bonuses/gui/buttons/CarlSpinButton.java index 006135c5d..210f773cd 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/bonuses/gui/buttons/CarlSpinButton.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/bonuses/gui/buttons/CarlSpinButton.java @@ -82,4 +82,4 @@ public class CarlSpinButton implements GuiItem return new ShopItem(material, data, name, lore.toArray(new String[0]), 1, false, false); } -} +} \ No newline at end of file diff --git a/Plugins/Mineplex.Core/src/mineplex/core/bonuses/gui/buttons/DailyBonusButton.java b/Plugins/Mineplex.Core/src/mineplex/core/bonuses/gui/buttons/DailyBonusButton.java index f46ceca73..18780e9e2 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/bonuses/gui/buttons/DailyBonusButton.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/bonuses/gui/buttons/DailyBonusButton.java @@ -2,6 +2,22 @@ package mineplex.core.bonuses.gui.buttons; import java.util.ArrayList; +import org.bukkit.Bukkit; +import org.bukkit.ChatColor; +import org.bukkit.DyeColor; +import org.bukkit.Material; +import org.bukkit.Sound; +import org.bukkit.entity.Player; +import org.bukkit.event.EventHandler; +import org.bukkit.event.HandlerList; +import org.bukkit.event.Listener; +import org.bukkit.event.inventory.ClickType; +import org.bukkit.inventory.ItemStack; +import org.bukkit.plugin.Plugin; + +import mineplex.core.bonuses.BonusAmount; +import mineplex.core.bonuses.BonusClientData; +import mineplex.core.bonuses.BonusManager; import mineplex.core.common.util.C; import mineplex.core.common.util.Callback; import mineplex.core.common.util.F; @@ -17,27 +33,9 @@ import mineplex.core.recharge.Recharge; import mineplex.core.shop.item.ShopItem; import mineplex.core.updater.UpdateType; import mineplex.core.updater.event.UpdateEvent; -import mineplex.core.bonuses.BonusAmount; -import mineplex.core.bonuses.BonusClientData; -import mineplex.core.bonuses.BonusManager; -import mineplex.core.bonuses.StreakRecord; - -import org.bukkit.Bukkit; -import org.bukkit.ChatColor; -import org.bukkit.DyeColor; -import org.bukkit.Material; -import org.bukkit.Sound; -import org.bukkit.entity.Player; -import org.bukkit.event.EventHandler; -import org.bukkit.event.HandlerList; -import org.bukkit.event.Listener; -import org.bukkit.event.inventory.ClickType; -import org.bukkit.inventory.ItemStack; -import org.bukkit.plugin.Plugin; public class DailyBonusButton implements GuiItem, Listener { - private ItemStack _item; private Player _player; @@ -75,29 +73,39 @@ public class DailyBonusButton implements GuiItem, Listener return; } - if (isAvailable()) { + if (isAvailable() && canUse()) + { _item = ItemStackFactory.Instance.CreateStack(Material.LAPIS_BLOCK, (byte)0, 1, ChatColor.BLUE + "Processing..."); refreshItem(); new LoadingWindow(getPlugin(), getPlayer(), 6*9); - _bonusManager.attemptDailyBonus(getPlayer(), _bonusManager.getDailyBonusAmount(_player), new Callback() { + _bonusManager.attemptDailyBonus(getPlayer(), _bonusManager.ClansBonus ? _bonusManager.getClansDailyBonusAmount(_player) : _bonusManager.getDailyBonusAmount(_player), _bonusManager.ClansBonus, new Callback() + { @Override public void run(Boolean t) { - if (t) { - + if (t) + { setItem(); - if (getPlayer().getOpenInventory() != null) { + if (getPlayer().getOpenInventory() != null) + { new TimedMessageWindow(getPlugin(), getPlayer(), ItemStackFactory.Instance.CreateStack(Material.STAINED_GLASS_PANE, DyeColor.LIME.getData(), 1, ChatColor.GREEN + "Bonus collected!"), "Bonus collected!", 6*9, 20*3, getGui()).openInventory(); - } else { + } + else + { UtilPlayer.message(getPlayer(), F.main("Bonus", "Bonus collected!")); } _bonusManager.addPendingExplosion(getPlayer(), "DAILY"); getPlayer().playSound(getPlayer().getLocation(), Sound.NOTE_PLING, 1, 1.6f); - } else { - if (getPlayer().getOpenInventory() != null) { + } + else + { + if (getPlayer().getOpenInventory() != null) + { new TimedMessageWindow(getPlugin(), getPlayer(), ItemStackFactory.Instance.CreateStack(Material.STAINED_GLASS_PANE, DyeColor.RED.getData(), 1, ChatColor.RED + "Failed to collect bonus!"), "Failed to collect bonus!", 6*9, 20*3, getGui()).openInventory(); - } else { + } + else + { UtilPlayer.message(getPlayer(), F.main("Bonus", "Failed to collect bonus!")); } getPlayer().playSound(getPlayer().getLocation(), Sound.ENDERDRAGON_GROWL, 1, 10); @@ -105,8 +113,11 @@ public class DailyBonusButton implements GuiItem, Listener getPlayer().closeInventory(); } }); - } else + } + else + { getPlayer().playSound(getPlayer().getLocation(), Sound.ITEM_BREAK, 1, 10); + } return; } @@ -125,7 +136,7 @@ public class DailyBonusButton implements GuiItem, Listener String itemName; byte data = 0; - if (isAvailable()) + if (isAvailable() && canUse()) { material = Material.CHEST; itemName = C.cGreen + C.Bold + "Daily Reward"; @@ -133,6 +144,14 @@ public class DailyBonusButton implements GuiItem, Listener lore.add(" "); lore.add(ChatColor.RESET + "Click to Claim!"); } + else if (!canUse()) + { + material = Material.REDSTONE_BLOCK; + itemName = C.cRed + C.Bold + "Daily Reward"; + + lore.add(" "); + lore.add(ChatColor.RESET + "You must set your home server by joining a clan to claim this!"); + } else { material = Material.REDSTONE_BLOCK; @@ -143,37 +162,46 @@ public class DailyBonusButton implements GuiItem, Listener } lore.add(" "); - - BonusClientData client = _bonusManager.Get(_player); - - BonusAmount bonusAmount = _bonusManager.getDailyBonusAmount(_player); - bonusAmount.addLore(lore); - lore.add(" "); - - lore.add(C.cYellow + "Current Streak: " + C.cWhite + client.getDailyStreak()); - lore.add(C.cYellow + "Streak Bonus: " + C.cWhite + _bonusManager.getDailyMultiplier(_player) + "%"); - lore.add(" "); - lore.add(C.cYellow + "Highest Streak: " + C.cWhite + client.getMaxDailyStreak()); - - if (client.getDailyTime() != null) + + if (!_bonusManager.ClansBonus) { - long lastBonus = _bonusManager.getLocalTime(client.getDailyTime().getTime()); - long timeLeft = _bonusManager.getStreakTimeRemaining(lastBonus, BonusManager.DAILY_STREAK_RESET_TIME); + BonusClientData client = _bonusManager.Get(_player); + + BonusAmount bonusAmount = _bonusManager.getDailyBonusAmount(_player); + bonusAmount.addLore(lore); + lore.add(" "); - if (timeLeft > 0) + lore.add(C.cYellow + "Current Streak: " + C.cWhite + client.getDailyStreak()); + lore.add(C.cYellow + "Streak Bonus: " + C.cWhite + _bonusManager.getDailyMultiplier(_player) + "%"); + lore.add(" "); + lore.add(C.cYellow + "Highest Streak: " + C.cWhite + client.getMaxDailyStreak()); + + if (client.getDailyTime() != null) { - lore.add(C.cYellow + "Streak Reset: " + C.cWhite + UtilTime.convertString(timeLeft, 1, TimeUnit.FIT)); + long lastBonus = BonusManager.getLocalTime(client.getDailyTime().getTime()); + long timeLeft = _bonusManager.getStreakTimeRemaining(lastBonus, BonusManager.DAILY_STREAK_RESET_TIME); + + if (timeLeft > 0) + { + lore.add(C.cYellow + "Streak Reset: " + C.cWhite + UtilTime.convertString(timeLeft, 1, TimeUnit.FIT)); + } } + +// StreakRecord streakRecord = _bonusManager.getDailyStreak(); +// if (streakRecord != null) +// { +// lore.add(" "); +// lore.add(C.cYellow + "Record: " + C.cWhite + streakRecord.getPlayerName()); +// lore.add(C.cYellow + "Streak: " + C.cWhite + streakRecord.getStreak()); +// } + } + else + { + lore.add(C.cYellow + "Home Server: " + C.cWhite + _bonusManager.getClansHomeServer(getPlayer()).getLeft()); + lore.add(" "); + BonusAmount amount = _bonusManager.getClansDailyBonusAmount(_player); + amount.addLore(lore); } - -// StreakRecord streakRecord = _bonusManager.getDailyStreak(); -// if (streakRecord != null) -// { -// lore.add(" "); -// lore.add(C.cYellow + "Record: " + C.cWhite + streakRecord.getPlayerName()); -// lore.add(C.cYellow + "Streak: " + C.cWhite + streakRecord.getStreak()); -// } - _item = new ShopItem(material, itemName, lore.toArray(new String[0]), 1, false, false); } @@ -200,6 +228,16 @@ public class DailyBonusButton implements GuiItem, Listener return (timeLeft() <= 0); } + public boolean canUse() + { + if (!_bonusManager.ClansBonus) + { + return true; + } + + return _bonusManager.getClansHomeServer(getPlayer()).getRight() != -1; + } + public Plugin getPlugin() { return _plugin; diff --git a/Plugins/Mineplex.Core/src/mineplex/core/bonuses/gui/buttons/PollButton.java b/Plugins/Mineplex.Core/src/mineplex/core/bonuses/gui/buttons/PollButton.java index 29054f2a6..6e8c16e17 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/bonuses/gui/buttons/PollButton.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/bonuses/gui/buttons/PollButton.java @@ -97,7 +97,7 @@ public class PollButton extends SimpleGui implements GuiItem { } lore.add(""); BonusAmount amount = new BonusAmount(); - amount.setCoins(_poll.getCoinReward()); + amount.setShards(_poll.getCoinReward()); amount.setGems(_poll.getCoinReward()); amount.addLore(lore); // lore.add(C.cYellow + "Reward:" + C.cWhite + " 500 Gems"); @@ -142,7 +142,7 @@ public class PollButton extends SimpleGui implements GuiItem { } lore.add(""); BonusAmount amount = new BonusAmount(); - amount.setCoins(_poll.getCoinReward()); + amount.setShards(_poll.getCoinReward()); amount.setGems(_poll.getCoinReward()); amount.addLore(lore); diff --git a/Plugins/Mineplex.Core/src/mineplex/core/bonuses/gui/buttons/PowerPlayClubButton.java b/Plugins/Mineplex.Core/src/mineplex/core/bonuses/gui/buttons/PowerPlayClubButton.java index 2d231cdd3..d1282cc18 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/bonuses/gui/buttons/PowerPlayClubButton.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/bonuses/gui/buttons/PowerPlayClubButton.java @@ -21,7 +21,6 @@ import mineplex.core.bonuses.BonusManager; import mineplex.core.common.util.C; import mineplex.core.common.util.F; import mineplex.core.common.util.UtilPlayer; -import mineplex.core.donation.DonationManager; import mineplex.core.gui.GuiItem; import mineplex.core.inventory.InventoryManager; import mineplex.core.powerplayclub.PowerPlayClubRepository; @@ -36,16 +35,12 @@ public class PowerPlayClubButton implements GuiItem private Player _player; private PowerPlayClubRepository _powerPlayClubRepository; private InventoryManager _inventoryManager; - private DonationManager _donationManager; - private BonusManager _bonusManager; public PowerPlayClubButton(Player player, BonusManager manager) { _player = player; - _bonusManager = manager; _powerPlayClubRepository = manager.getPowerPlayClubRepository(); _inventoryManager = manager.getInventoryManager(); - _donationManager = manager.getDonationManager(); } @Override @@ -132,7 +127,7 @@ public class PowerPlayClubButton implements GuiItem itemName = C.cRedB + "Power Play Club"; lore.add(C.cYellow + YearMonth.now().getMonth().getDisplayName(TextStyle.FULL, Locale.US) + "'s Cosmetic"); - lore.add(C.cWhite + " " + PowerPlayClubRewards.rewards().get(YearMonth.now()).getPrize()); + lore.add(C.cWhite + " " + PowerPlayClubRewards.rewards().get(YearMonth.now()).getPrizeName()); lore.add(" "); lore.addAll(buildOtherRewardsLore(1)); lore.add(C.cRed + "Get Power Play Club months at"); @@ -152,7 +147,7 @@ public class PowerPlayClubButton implements GuiItem .forEach(entry -> { YearMonth yearMonth = entry.getKey(); - lore.add(C.cWhite + " " + entry.getValue().getPrize() + " " + C.cGold + yearMonth.getMonth().getDisplayName(TextStyle.SHORT, Locale.US) + " " + yearMonth.getYear()); + lore.add(C.cWhite + " " + entry.getValue().getPrizeName() + " " + C.cGold + yearMonth.getMonth().getDisplayName(TextStyle.SHORT, Locale.US) + " " + yearMonth.getYear()); }); lore.add(" "); return lore; @@ -175,7 +170,8 @@ public class PowerPlayClubButton implements GuiItem public static boolean isAvailable(Player player, PowerPlayClubRepository repo) { - return !repo.getCachedData(player).getUnclaimedMonths().isEmpty(); + PowerPlayData data = repo.getCachedData(player); + return data != null && !data.getUnclaimedMonths().isEmpty(); } } diff --git a/Plugins/Mineplex.Core/src/mineplex/core/bonuses/gui/buttons/SpecificChannelButton.java b/Plugins/Mineplex.Core/src/mineplex/core/bonuses/gui/buttons/SpecificChannelButton.java new file mode 100644 index 000000000..1edafc35d --- /dev/null +++ b/Plugins/Mineplex.Core/src/mineplex/core/bonuses/gui/buttons/SpecificChannelButton.java @@ -0,0 +1,114 @@ +package mineplex.core.bonuses.gui.buttons; + +import org.bukkit.Material; +import org.bukkit.Sound; +import org.bukkit.entity.Player; +import org.bukkit.event.inventory.ClickType; +import org.bukkit.inventory.ItemStack; + +import mineplex.core.Managers; +import mineplex.core.bonuses.BonusManager; +import mineplex.core.common.Pair; +import mineplex.core.common.jsonchat.ClickEvent; +import mineplex.core.common.jsonchat.JsonMessage; +import mineplex.core.common.util.C; +import mineplex.core.common.util.UtilPlayer; +import mineplex.core.gui.GuiItem; +import mineplex.core.itemstack.ItemBuilder; +import mineplex.core.recharge.Recharge; +import mineplex.core.youtube.YoutubeManager; + +public class SpecificChannelButton implements GuiItem +{ + private final Player _player; + private final YoutubeManager _youtubeManager; + private Pair _channel; + private ItemStack _item; + + public SpecificChannelButton(Player player, YoutubeManager youtubeManager) + { + _player = player; + _youtubeManager = youtubeManager; + } + + @Override + public void setup() + { + _channel = Managers.get(BonusManager.class).getSpecificCreator(); + if (_youtubeManager.canSpecificYoutube(_player)) + { + _item = new ItemBuilder(Material.APPLE) + .setTitle(C.cGreen + C.Bold + "Visit our featured creator " + C.cGoldB + _channel.getLeft()) + .addLore( + C.cYellow + "Claim a Daily Reward", + C.cWhite + "by checking out the latest Video", + C.cWhite + "by " + C.cGold + _channel.getLeft() + C.cWhite + "!", + C.cWhite + " ", + C.cWhite + "Be sure and Subscribe if you", + C.cWhite + "enjoy their videos!", + " ", + C.cGreen + "Click to visit " + C.cGold + _channel.getLeft() + C.cGreen + " on YouTube!" + ) + .build(); + } + else + { + _item = new ItemBuilder(Material.APPLE) + .setTitle(C.cGreen + C.Bold + "Visit our featured creator " + C.cGoldB + _channel.getLeft()) + .addLore( + C.cWhite + "Come back tomorrow for your", + C.cWhite + "Daily Reward!", + " ", + C.cWhite + "Check out the latest Video", + C.cWhite + "by " + C.cGold + _channel.getLeft() + C.cWhite + "!", + " ", + C.cWhite + "Be sure and Subscribe if you", + C.cWhite + "enjoy their videos!", + " ", + C.cGreen + "Click to visit " + C.cGold + _channel.getLeft() + C.cGreen + " on YouTube!" + ) + .build(); + } + } + + @Override + public void close() {} + + @Override + public void click(ClickType clickType) + { + if (!Recharge.Instance.use(_player, "Use Youtube Button", 1000, false, false)) + { + return; + } + + _player.closeInventory(); + + _player.playSound(_player.getLocation(), Sound.NOTE_PLING, 1, 1.6f); + + final String message; + if (_youtubeManager.canSpecificYoutube(_player)) + { + message = "claim your Reward!"; + _youtubeManager.attemptSpecificYoutube(_player, Managers.get(BonusManager.class).ClansBonus, Managers.get(BonusManager.class).getClansHomeServer(_player).getRight()); + } + else + { + message = "visit " + _channel.getLeft() + " on YouTube!"; + } + + UtilPlayer.message(_player, C.cGold + C.Bold + C.Strike + "============================================="); + UtilPlayer.message(_player, ""); + + new JsonMessage(" " + C.Bold + "Click to Open in Web Browser and " + message).click(ClickEvent.OPEN_URL, _channel.getRight()).sendToPlayer(_player); + new JsonMessage( " " + C.cGreen + C.Line + _channel.getRight().replace("?sub_confirmation=1", "")).click(ClickEvent.OPEN_URL, _channel.getRight()).sendToPlayer(_player); + UtilPlayer.message(_player, ""); + UtilPlayer.message(_player, C.cGold + C.Bold + C.Strike + "============================================="); + } + + @Override + public ItemStack getObject() + { + return _item; + } +} \ No newline at end of file diff --git a/Plugins/Mineplex.Core/src/mineplex/core/bonuses/gui/buttons/VoteButton.java b/Plugins/Mineplex.Core/src/mineplex/core/bonuses/gui/buttons/VoteButton.java new file mode 100644 index 000000000..f2efea600 --- /dev/null +++ b/Plugins/Mineplex.Core/src/mineplex/core/bonuses/gui/buttons/VoteButton.java @@ -0,0 +1,213 @@ +package mineplex.core.bonuses.gui.buttons; + +import java.util.ArrayList; + +import mineplex.core.bonuses.BonusAmount; +import mineplex.core.bonuses.BonusClientData; +import mineplex.core.bonuses.BonusManager; +import mineplex.core.common.jsonchat.ClickEvent; +import mineplex.core.common.jsonchat.JsonMessage; +import mineplex.core.common.util.C; +import mineplex.core.common.util.UtilPlayer; +import mineplex.core.common.util.UtilTime; +import mineplex.core.common.util.UtilTime.TimeUnit; +import mineplex.core.gui.GuiItem; +import mineplex.core.gui.ItemRefresher; +import mineplex.core.shop.item.ShopItem; + +import org.bukkit.Bukkit; +import org.bukkit.ChatColor; +import org.bukkit.Material; +import org.bukkit.Sound; +import org.bukkit.entity.Player; +import org.bukkit.event.HandlerList; +import org.bukkit.event.Listener; +import org.bukkit.event.inventory.ClickType; +import org.bukkit.inventory.ItemStack; +import org.bukkit.plugin.Plugin; + +public class VoteButton implements GuiItem, Listener +{ + private ItemStack _item; + + private String _url; + + private Player _player; + private Plugin _plugin; + private ItemRefresher _gui; + + private BonusManager _bonusManager; + + public VoteButton(Plugin plugin, Player player, ItemRefresher gui, BonusManager bonusManager) + { + _bonusManager = bonusManager; + _player = player; + _plugin = plugin; + _gui = gui; + } + + @Override + public void setup() + { + //TODO get url from db + _url = _bonusManager.getVoteLink(); + + setItem(); + Bukkit.getPluginManager().registerEvents(this, getPlugin()); + } + + @Override + public void close() + { + HandlerList.unregisterAll(this); + } + + @Override + public void click(ClickType clickType) + { + if (isAvailable()) + { + getPlayer().closeInventory(); + + getPlayer().playSound(getPlayer().getLocation(), Sound.NOTE_PLING, 1, 1.6f); + + UtilPlayer.message(getPlayer(), C.cGold + C.Bold + C.Strike + "============================================="); + UtilPlayer.message(getPlayer(), ""); + + new JsonMessage(" " + C.Bold + "Click to Open in Web Browser").click(ClickEvent.OPEN_URL, _url).sendToPlayer(getPlayer()); + new JsonMessage( " " + C.cGreen + C.Line + _url).click(ClickEvent.OPEN_URL, _url).sendToPlayer(getPlayer()); + UtilPlayer.message(getPlayer(), ""); + UtilPlayer.message(getPlayer(), " Please be patient. Votes may take a few minutes to register."); + UtilPlayer.message(getPlayer(), ""); + UtilPlayer.message(getPlayer(), C.cGold + C.Bold + C.Strike + "============================================="); + + getPlayer().closeInventory(); + + } + else + { + getPlayer().playSound(getPlayer().getLocation(), Sound.ITEM_BREAK, 1, 10); + } + } + + @Override + public ItemStack getObject() + { + return _item; + } + + private void setItem() + { + ArrayList lore = new ArrayList(); + Material material; + String itemName; + byte data = 0; + + if (isAvailable() && canUse()) + { + material = Material.JUKEBOX; + itemName = C.cGreen + C.Bold + "Vote for Mineplex"; + + lore.add(" "); + lore.add(ChatColor.RESET + "Click to Vote!"); + } + else if (!canUse()) + { + material = Material.REDSTONE_BLOCK; + itemName = C.cRed + C.Bold + "Vote for Mineplex"; + + lore.add(" "); + lore.add(ChatColor.RESET + "You must set your home server by joining a clan to receive voting rewards!"); + } + else + { + material = Material.REDSTONE_BLOCK; + itemName = C.cRed + C.Bold + "Vote for Mineplex"; + + lore.add(" "); + lore.add(ChatColor.RESET + "Next vote in " + UtilTime.convertString(timeLeft(), 0, TimeUnit.FIT) + "!"); + } + + lore.add(" "); + + if (!_bonusManager.ClansBonus) + { + BonusClientData client = _bonusManager.Get(_player); + + BonusAmount bonusAmount = _bonusManager.getVoteBonusAmount(_player); + bonusAmount.addLore(lore); + lore.add(" "); + + lore.add(C.cYellow + "Current Streak: " + C.cWhite + client.getVoteStreak()); + lore.add(C.cYellow + "Streak Bonus: " + C.cWhite + "+" + _bonusManager.getVoteMultiplier(client.getVoteStreak()) + "%"); + if (client.getVoteTime() != null) + { + long lastBonus = _bonusManager.getLocalTime(client.getVoteTime().getTime()); + long timeLeft = _bonusManager.getStreakTimeRemaining(lastBonus, BonusManager.VOTE_STREAK_RESET_TIME); + + if (timeLeft > 0) + { + lore.add(C.cYellow + "Streak Reset: " + C.cWhite + UtilTime.convertString(timeLeft, 1, TimeUnit.FIT)); + } + } + + lore.add(" "); + lore.add(C.cYellow + "Highest Streak: " + C.cWhite + client.getMaxVoteStreak()); + +// StreakRecord streakRecord = _bonusManager.getVoteStreak(); +// if (streakRecord != null) +// { +// lore.add(" "); +// lore.add(C.cYellow + "Record: " + C.cWhite + streakRecord.getPlayerName()); +// lore.add(C.cYellow + "Streak: " + C.cWhite + streakRecord.getStreak()); +// } + } + else + { + lore.add(C.cYellow + "Home Server: " + C.cWhite + _bonusManager.getClansHomeServer(getPlayer()).getLeft()); + lore.add(" "); + BonusAmount amount = _bonusManager.getClansVoteBonusAmount(_player); + amount.addLore(lore); + } + + _item = new ShopItem(material, itemName, lore.toArray(new String[0]), 1, false, false); + } + + public long timeLeft() + { + return _bonusManager.nextVoteTime(getPlayer()) - System.currentTimeMillis(); + } + + public boolean isAvailable() + { + if (_url == null) + return false; + + return (timeLeft() <= 0); + } + + public boolean canUse() + { + if (!_bonusManager.ClansBonus) + { + return true; + } + + return _bonusManager.getClansHomeServer(getPlayer()).getRight() != -1; + } + + public Plugin getPlugin() + { + return _plugin; + } + + public Player getPlayer() + { + return _player; + } + + public ItemRefresher getGui() + { + return _gui; + } +} \ No newline at end of file diff --git a/Plugins/Mineplex.Core/src/mineplex/core/bonuses/gui/buttons/YoutubeButton.java b/Plugins/Mineplex.Core/src/mineplex/core/bonuses/gui/buttons/YoutubeButton.java index cab491f83..df76962fc 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/bonuses/gui/buttons/YoutubeButton.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/bonuses/gui/buttons/YoutubeButton.java @@ -1,5 +1,7 @@ package mineplex.core.bonuses.gui.buttons; +import mineplex.core.Managers; +import mineplex.core.bonuses.BonusManager; import mineplex.core.common.jsonchat.ClickEvent; import mineplex.core.common.jsonchat.JsonMessage; import mineplex.core.common.util.C; @@ -20,7 +22,7 @@ public class YoutubeButton implements GuiItem .setTitle(C.cGreen + C.Bold + "Visit us on YouTube") .addLore( C.cWhite + "Come back tomorrow for your", - C.cWhite + "Daily 250 Shard Reward!", + C.cWhite + "Daily Reward!", " ", C.cWhite + "Check out the latest Video", C.cWhite + "on the MineplexGames Channel!", @@ -34,7 +36,7 @@ public class YoutubeButton implements GuiItem private static final ItemStack ENABLED_ICON = new ItemBuilder(Material.APPLE) .setTitle(C.cGreen + C.Bold + "Visit us on YouTube") .addLore( - C.cYellow + "Claim your Daily 250 Shard Reward", + C.cYellow + "Claim your Daily Reward", C.cWhite + "by checking out the latest Video", C.cWhite + "on the MineplexGames Channel!", C.cWhite + " ", @@ -75,7 +77,7 @@ public class YoutubeButton implements GuiItem if (_youtubeManager.canYoutube(_player)) { message = "claim YouTube Prize!"; - _youtubeManager.attemptYoutube(_player); + _youtubeManager.attemptYoutube(_player, Managers.get(BonusManager.class).ClansBonus, Managers.get(BonusManager.class).getClansHomeServer(_player).getRight()); } else { @@ -96,4 +98,4 @@ public class YoutubeButton implements GuiItem { return _youtubeManager.canYoutube(_player) ? ENABLED_ICON : DISABLED_ICON; } -} +} \ No newline at end of file diff --git a/Plugins/Mineplex.Core/src/mineplex/core/bonuses/redis/VoteHandler.java b/Plugins/Mineplex.Core/src/mineplex/core/bonuses/redis/VoteHandler.java new file mode 100644 index 000000000..efe90072e --- /dev/null +++ b/Plugins/Mineplex.Core/src/mineplex/core/bonuses/redis/VoteHandler.java @@ -0,0 +1,31 @@ +package mineplex.core.bonuses.redis; + +import org.bukkit.entity.Player; + +import mineplex.core.bonuses.BonusManager; +import mineplex.core.common.util.UtilPlayer; +import mineplex.serverdata.commands.CommandCallback; +import mineplex.serverdata.commands.ServerCommand; + +public class VoteHandler implements CommandCallback +{ + private BonusManager _bonusManager; + + public VoteHandler(BonusManager bonusManager) + { + _bonusManager = bonusManager; + } + + @Override + public void run(ServerCommand command) + { + VotifierCommand v = ((VotifierCommand) command); + + Player player = UtilPlayer.searchExact(v.getPlayerName()); + + if (player != null) + { + _bonusManager.handleVote(player, v.getRewardReceived(), v.isClans()); + } + } +} \ No newline at end of file diff --git a/Plugins/Mineplex.Core/src/mineplex/core/bonuses/redis/VotifierCommand.java b/Plugins/Mineplex.Core/src/mineplex/core/bonuses/redis/VotifierCommand.java new file mode 100644 index 000000000..e3bfa4231 --- /dev/null +++ b/Plugins/Mineplex.Core/src/mineplex/core/bonuses/redis/VotifierCommand.java @@ -0,0 +1,34 @@ +package mineplex.core.bonuses.redis; + +import mineplex.serverdata.commands.ServerCommand; + +public class VotifierCommand extends ServerCommand +{ + private String _playerName; + private int _rewardReceived; + private boolean _clans; + + public VotifierCommand(String playerName, int rewardReceived, boolean clans, String... targetServer) + { + super(targetServer); + + _playerName = playerName; + _rewardReceived = rewardReceived; + _clans = clans; + } + + public String getPlayerName() + { + return _playerName; + } + + public int getRewardReceived() + { + return _rewardReceived; + } + + public boolean isClans() + { + return _clans; + } +} \ No newline at end of file diff --git a/Plugins/Mineplex.Core/src/mineplex/core/book/BookBuilder.java b/Plugins/Mineplex.Core/src/mineplex/core/book/BookBuilder.java new file mode 100644 index 000000000..e345f0a02 --- /dev/null +++ b/Plugins/Mineplex.Core/src/mineplex/core/book/BookBuilder.java @@ -0,0 +1,119 @@ +package mineplex.core.book; + +import java.util.ArrayList; +import java.util.List; + +import net.minecraft.server.v1_8_R3.Items; +import net.minecraft.server.v1_8_R3.NBTTagCompound; +import net.minecraft.server.v1_8_R3.NBTTagList; +import net.minecraft.server.v1_8_R3.NBTTagString; + +import org.apache.commons.lang3.Validate; +import org.bukkit.ChatColor; +import org.bukkit.craftbukkit.v1_8_R3.inventory.CraftItemStack; +import org.bukkit.inventory.ItemStack; + +public class BookBuilder +{ + public static BookBuilder newBuilder() + { + return new BookBuilder(); + } + + private final List _pageBuilders = new ArrayList<>(); + + private String _title; + private String _author = ""; + private int _generation = 0; + private boolean _resolved = true; + + private BookBuilder() + { + + } + + public PageBuilder newPage(int index) + { + PageBuilder pageBuilder = new PageBuilder(this); + _pageBuilders.add(index, pageBuilder); + return pageBuilder; + } + + public PageBuilder newPage() + { + PageBuilder pageBuilder = new PageBuilder(this); + _pageBuilders.add(pageBuilder); + return pageBuilder; + } + + public int getPageNumber(PageBuilder builder) + { + return _pageBuilders.indexOf(builder); + } + + public BookBuilder title(String title) + { + Validate.notNull(title, "Title cannot be null"); + this._title = title; + return this; + } + + public BookBuilder author(String author) + { + Validate.notNull(author, "Author cannot be null"); + this._author = author; + return this; + } + + public BookBuilder resolved(boolean resolved) + { + this._resolved = resolved; + return this; + } + + public BookBuilder generation(int generation) + { + this._generation = generation; + return this; + } + + public ItemStack toItem() + { + net.minecraft.server.v1_8_R3.ItemStack itemStack = new net.minecraft.server.v1_8_R3.ItemStack(Items.WRITTEN_BOOK); + itemStack.setTag(toCompound()); + return CraftItemStack.asCraftMirror(itemStack); + } + + public NBTTagCompound toCompound() + { + NBTTagCompound compound = new NBTTagCompound(); + if (_author != null) + compound.setString("author", _author); + if (_title != null) + { + if (_title.length() < 32) + { + compound.setString("title", _title); + } + else + { + NBTTagCompound display = new NBTTagCompound(); + + display.set("Name", new NBTTagString(ChatColor.RESET + _title)); + compound.set("display", display); + } + } + compound.setInt("generation", _generation); + compound.setBoolean("resolved", _resolved); + + NBTTagList pages = new NBTTagList(); + for (PageBuilder pageBuilder : _pageBuilders) + { + pages.add(new NBTTagString(pageBuilder.build())); + } + + compound.set("pages", pages); + + return compound; + } +} diff --git a/Plugins/Mineplex.Core/src/mineplex/core/book/PageBuilder.java b/Plugins/Mineplex.Core/src/mineplex/core/book/PageBuilder.java new file mode 100644 index 000000000..876b8c1b4 --- /dev/null +++ b/Plugins/Mineplex.Core/src/mineplex/core/book/PageBuilder.java @@ -0,0 +1,37 @@ +package mineplex.core.book; + +import net.md_5.bungee.api.chat.BaseComponent; +import net.md_5.bungee.chat.ComponentSerializer; + +public class PageBuilder +{ + private final BookBuilder _parent; + + private BaseComponent[] _components = new BaseComponent[0]; + + protected PageBuilder(BookBuilder builder) + { + this._parent = builder; + } + + public int getPage() + { + return this._parent.getPageNumber(this); + } + + public PageBuilder component(BaseComponent... components) + { + _components = components; + return this; + } + + public BookBuilder bookBuilder() + { + return this._parent; + } + + protected String build() + { + return ComponentSerializer.toString(_components); + } +} diff --git a/Plugins/Mineplex.Core/src/mineplex/core/boosters/BoosterRepository.java b/Plugins/Mineplex.Core/src/mineplex/core/boosters/BoosterRepository.java index 25e8c2c64..2f42602e9 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/boosters/BoosterRepository.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/boosters/BoosterRepository.java @@ -24,7 +24,7 @@ public class BoosterRepository extends ApiEndpoint { public BoosterRepository() { - super(ApiHost.AMPLIFIERS, "/booster", new GsonBuilder().setFieldNamingStrategy(new ApiFieldNamingStrategy()) + super(ApiHost.getAmplifierService(), "/booster", new GsonBuilder().setFieldNamingStrategy(new ApiFieldNamingStrategy()) // .registerTypeAdapter(PropertyMap.class, new PropertyMap.Serializer()) .setDateFormat("yyyy-MM-dd'T'HH:mm:ss.SSSX").create()); } diff --git a/Plugins/Mineplex.Core/src/mineplex/core/boosters/command/BoosterCommand.java b/Plugins/Mineplex.Core/src/mineplex/core/boosters/command/BoosterCommand.java index 44a429ac6..42866745b 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/boosters/command/BoosterCommand.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/boosters/command/BoosterCommand.java @@ -15,7 +15,7 @@ public class BoosterCommand extends MultiCommandBase { public BoosterCommand(BoosterManager plugin) { - super(plugin, Rank.ALL, "amplifier", "booster"); + super(plugin, Rank.ALL, "amplifier"); AddCommand(new AddCommand(plugin)); AddCommand(new GuiCommand(plugin)); diff --git a/Plugins/Mineplex.Core/src/mineplex/core/boosters/tips/BoosterThankManager.java b/Plugins/Mineplex.Core/src/mineplex/core/boosters/tips/BoosterThankManager.java index c3ae99372..303833c4d 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/boosters/tips/BoosterThankManager.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/boosters/tips/BoosterThankManager.java @@ -74,7 +74,7 @@ public class BoosterThankManager extends MiniPlugin if (_repository.checkAmplifierThank(accountId, booster.getId())) { // We can thank that amplifier! - _thankManager.thankPlayer(booster.getPlayerName(), booster.getAccountId(), player.getName(), accountId, + _thankManager.thankPlayer(booster.getPlayerName(), booster.getAccountId(), player, TIP_FOR_SPONSOR, TIP_FOR_TIPPER, "Amplifier", true, thankResult -> runSync(() -> callback.run(fromThankResult(thankResult)))); } diff --git a/Plugins/Mineplex.Core/src/mineplex/core/boosters/tips/BoosterThankRepository.java b/Plugins/Mineplex.Core/src/mineplex/core/boosters/tips/BoosterThankRepository.java index 8fd26265e..c2f02d7d3 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/boosters/tips/BoosterThankRepository.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/boosters/tips/BoosterThankRepository.java @@ -1,23 +1,20 @@ package mineplex.core.boosters.tips; import mineplex.core.database.MinecraftRepository; -import mineplex.database.routines.AddTip; import mineplex.database.routines.CheckAmplifierThank; -import mineplex.database.routines.ClaimTips; import mineplex.serverdata.database.DBPool; import mineplex.serverdata.database.RepositoryBase; -import mineplex.serverdata.database.column.ColumnInt; -import org.bukkit.entity.Player; + import org.bukkit.plugin.java.JavaPlugin; /** * @author Shaun Bennett */ -public class BoosterThankRepository extends MinecraftRepository +public class BoosterThankRepository extends RepositoryBase { public BoosterThankRepository(JavaPlugin plugin) { - super(plugin, DBPool.getAccount()); + super(DBPool.getAccount()); } /** @@ -37,16 +34,4 @@ public class BoosterThankRepository extends MinecraftRepository checkAmplifierThank.execute(jooq().configuration()); return checkAmplifierThank.getCanThank() == 1; } - - @Override - protected void initialize() - { - - } - - @Override - protected void update() - { - - } } diff --git a/Plugins/Mineplex.Core/src/mineplex/core/botspam/BotSpamManager.java b/Plugins/Mineplex.Core/src/mineplex/core/botspam/BotSpamManager.java index 29a38932c..d42e2b881 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/botspam/BotSpamManager.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/botspam/BotSpamManager.java @@ -19,12 +19,14 @@ import mineplex.core.botspam.command.BotSpamCommand; import mineplex.core.botspam.repository.BotSpamRepository; import mineplex.core.updater.UpdateType; import mineplex.core.updater.event.UpdateEvent; +import mineplex.serverdata.commands.ServerCommandManager; public class BotSpamManager extends MiniPlugin { private Punish _punish; private CoreClientManager _clientManager; private BotSpamRepository _repository; + private volatile ArrayList _spam = new ArrayList(); public BotSpamManager(JavaPlugin plugin, CoreClientManager clientManager, Punish punish) @@ -35,6 +37,8 @@ public class BotSpamManager extends MiniPlugin _clientManager = clientManager; _repository = new BotSpamRepository(plugin); _spam = _repository.getSpamText(); + + ServerCommandManager.getInstance().registerCommandType(ForceUpdateCommand.class, command -> runAsync(() -> _spam = _repository.getSpamText())); } @EventHandler @@ -71,14 +75,7 @@ public class BotSpamManager extends MiniPlugin { if (spamText.isEnabled() && spamText.isSpam(event.getMessage())) { - runSync(new Runnable() - { - @Override - public void run() - { - punishBot(event.getPlayer(), spamText); - } - }); + runSync(() -> punishBot(event.getPlayer(), spamText)); event.setCancelled(true); return; } @@ -90,79 +87,52 @@ public class BotSpamManager extends MiniPlugin _punish.AddPunishment(player.getName(), Category.Other, "Bot Spam #" + botText.getId(), "Chiss", 1, true, -1, true); // Update bot text count - runAsync(new Runnable() - { - @Override - public void run() - { - _repository.addPunishment(botText); - } - }); + runAsync(() -> _repository.addPunishment(botText)); } public void addSpamText(final String caller, final String text, final Runnable callback) { - runAsync(new Runnable() + runAsync(() -> { - @Override - public void run() - { - _repository.addSpamText(caller, text); - _spam = _repository.getSpamText(); + _repository.addSpamText(caller, text); + _spam = _repository.getSpamText(); - if (callback != null) - runSync(callback); - } + if (callback != null) + runSync(callback); }); } public void enableSpamText(final String caller, final SpamText spamText, final Runnable callback) { - runAsync(new Runnable() + runAsync(() -> { - @Override - public void run() + _repository.enableSpamText(caller, spamText); + + runSync(() -> { - _repository.enableSpamText(caller, spamText); + spamText.setEnabled(true); + spamText.setEnabledBy(caller); - runSync(new Runnable() - { - @Override - public void run() - { - spamText.setEnabled(true); - spamText.setEnabledBy(caller); - - if (callback != null) - callback.run(); - } - }); - } + if (callback != null) + callback.run(); + }); }); } public void disableSpamText(final String caller, final SpamText spamText, final Runnable callback) { - runAsync(new Runnable() + runAsync(() -> { - @Override - public void run() + _repository.disableSpamText(caller, spamText); + + runSync(() -> { - _repository.disableSpamText(caller, spamText); + spamText.setEnabled(false); + spamText.setDisabledBy(caller); - runSync(new Runnable() - { - @Override - public void run() - { - spamText.setEnabled(false); - spamText.setDisabledBy(caller); - - if (callback != null) - callback.run(); - } - }); - } + if (callback != null) + callback.run(); + }); }); } @@ -176,14 +146,7 @@ public class BotSpamManager extends MiniPlugin { if (event.getType() == UpdateType.MIN_01) { - runAsync(new Runnable() - { - @Override - public void run() - { - _spam = _repository.getSpamText(); - } - }); + runAsync(() -> _spam = _repository.getSpamText()); } } diff --git a/Plugins/Mineplex.Core/src/mineplex/core/botspam/ForceUpdateCommand.java b/Plugins/Mineplex.Core/src/mineplex/core/botspam/ForceUpdateCommand.java new file mode 100644 index 000000000..ac6884017 --- /dev/null +++ b/Plugins/Mineplex.Core/src/mineplex/core/botspam/ForceUpdateCommand.java @@ -0,0 +1,7 @@ +package mineplex.core.botspam; + +import mineplex.serverdata.commands.ServerCommand; + +public class ForceUpdateCommand extends ServerCommand +{ +} diff --git a/Plugins/Mineplex.Core/src/mineplex/core/botspam/command/BotSpamAddCommand.java b/Plugins/Mineplex.Core/src/mineplex/core/botspam/command/BotSpamAddCommand.java index 224f3506c..adfa6d20a 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/botspam/command/BotSpamAddCommand.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/botspam/command/BotSpamAddCommand.java @@ -1,5 +1,6 @@ package mineplex.core.botspam.command; +import org.apache.commons.lang3.StringUtils; import org.bukkit.entity.Player; import mineplex.core.botspam.SpamText; @@ -21,15 +22,7 @@ public class BotSpamAddCommand extends CommandBase { if (args != null && args.length >= 1) { - StringBuilder sb = new StringBuilder(); - for (int i = 0; i < args.length; i++) - { - if (i > 0) sb.append(" "); - - sb.append(args[i]); - } - - final String text = sb.toString(); + String text = StringUtils.join(args, " ", 0, args.length); if (text.length() < 8) { @@ -41,19 +34,15 @@ public class BotSpamAddCommand extends CommandBase { if (text.equalsIgnoreCase(spamText.getText())) { - UtilPlayer.message(caller, F.main("BotSpam", "That Spam Text already exists. Type " + F.elem("/botspam list") + " to view")); + UtilPlayer.message(caller, F.main("BotSpam", "That Spam Text (id " + spamText.getId() + ") already exists. Type " + F.elem("/botspam list") + " to view")); return; } } - Plugin.addSpamText(caller.getName(), text, new Runnable() + Plugin.addSpamText(caller.getName(), text, () -> { - @Override - public void run() - { - if (caller.isOnline()) - UtilPlayer.message(caller, F.main("BotSpam", "Added Spam Text: " + F.elem(text))); - } + if (caller.isOnline()) + UtilPlayer.message(caller, F.main("BotSpam", "Added Spam Text: " + F.elem(text))); }); } else diff --git a/Plugins/Mineplex.Core/src/mineplex/core/botspam/command/BotSpamCommand.java b/Plugins/Mineplex.Core/src/mineplex/core/botspam/command/BotSpamCommand.java index 99a3e1bab..39013e95c 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/botspam/command/BotSpamCommand.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/botspam/command/BotSpamCommand.java @@ -2,9 +2,9 @@ package mineplex.core.botspam.command; import org.bukkit.entity.Player; +import mineplex.core.botspam.BotSpamManager; import mineplex.core.command.MultiCommandBase; import mineplex.core.common.Rank; -import mineplex.core.botspam.BotSpamManager; import mineplex.core.common.util.F; import mineplex.core.common.util.UtilPlayer; @@ -18,6 +18,7 @@ public class BotSpamCommand extends MultiCommandBase AddCommand(new BotSpamEnableCommand(Plugin)); AddCommand(new BotSpamDisableCommand(Plugin)); AddCommand(new BotSpamListCommand(Plugin)); + AddCommand(new BotSpamGlobalUpdateCommand(Plugin)); } @Override @@ -27,5 +28,6 @@ public class BotSpamCommand extends MultiCommandBase UtilPlayer.message(caller, F.main("BotSpam", "/botspam add ")); UtilPlayer.message(caller, F.main("BotSpam", "/botspam enable ")); UtilPlayer.message(caller, F.main("BotSpam", "/botspam disable ")); + UtilPlayer.message(caller, F.main("BotSpam", "/botspam globalupdate")); } } diff --git a/Plugins/Mineplex.Core/src/mineplex/core/botspam/command/BotSpamDisableCommand.java b/Plugins/Mineplex.Core/src/mineplex/core/botspam/command/BotSpamDisableCommand.java index 4afcb9894..2736c30eb 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/botspam/command/BotSpamDisableCommand.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/botspam/command/BotSpamDisableCommand.java @@ -53,14 +53,7 @@ public class BotSpamDisableCommand extends CommandBase } final SpamText finalText = text; - Plugin.disableSpamText(caller.getName(), text, new Runnable() - { - @Override - public void run() - { - UtilPlayer.message(caller, F.main("BotSpam", "Disabled Spam Text " + F.elem(finalText.getText()))); - } - }); + Plugin.disableSpamText(caller.getName(), text, () -> UtilPlayer.message(caller, F.main("BotSpam", "Disabled Spam Text " + F.elem(finalText.getText())))); } else { diff --git a/Plugins/Mineplex.Core/src/mineplex/core/botspam/command/BotSpamEnableCommand.java b/Plugins/Mineplex.Core/src/mineplex/core/botspam/command/BotSpamEnableCommand.java index d694e06cc..18746c60c 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/botspam/command/BotSpamEnableCommand.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/botspam/command/BotSpamEnableCommand.java @@ -53,14 +53,7 @@ public class BotSpamEnableCommand extends CommandBase } final SpamText finalText = text; - Plugin.enableSpamText(caller.getName(), text, new Runnable() - { - @Override - public void run() - { - UtilPlayer.message(caller, F.main("BotSpam", "Enabled Spam Text " + F.elem(finalText.getText()))); - } - }); + Plugin.enableSpamText(caller.getName(), text, () -> UtilPlayer.message(caller, F.main("BotSpam", "Enabled Spam Text " + F.elem(finalText.getText())))); } else { diff --git a/Plugins/Mineplex.Core/src/mineplex/core/botspam/command/BotSpamGlobalUpdateCommand.java b/Plugins/Mineplex.Core/src/mineplex/core/botspam/command/BotSpamGlobalUpdateCommand.java new file mode 100644 index 000000000..769410e53 --- /dev/null +++ b/Plugins/Mineplex.Core/src/mineplex/core/botspam/command/BotSpamGlobalUpdateCommand.java @@ -0,0 +1,27 @@ +package mineplex.core.botspam.command; + +import org.bukkit.entity.Player; + +import mineplex.core.botspam.BotSpamManager; +import mineplex.core.botspam.ForceUpdateCommand; +import mineplex.core.botspam.SpamText; +import mineplex.core.command.CommandBase; +import mineplex.core.common.Rank; +import mineplex.core.common.util.F; +import mineplex.core.common.util.UtilPlayer; +import mineplex.serverdata.commands.ServerCommandManager; + +public class BotSpamGlobalUpdateCommand extends CommandBase +{ + public BotSpamGlobalUpdateCommand(BotSpamManager plugin) + { + super(plugin, Rank.ADMIN, "globalupdate"); + } + + @Override + public void Execute(final Player caller, String[] args) + { + ServerCommandManager.getInstance().publishCommand(new ForceUpdateCommand()); + UtilPlayer.message(caller, F.main("Botspam", "Forced an update across all servers!")); + } +} diff --git a/Plugins/Mineplex.Core/src/mineplex/core/botspam/command/BotSpamListCommand.java b/Plugins/Mineplex.Core/src/mineplex/core/botspam/command/BotSpamListCommand.java index 47e31606c..a0be34906 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/botspam/command/BotSpamListCommand.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/botspam/command/BotSpamListCommand.java @@ -1,14 +1,21 @@ package mineplex.core.botspam.command; +import java.util.Collections; +import java.util.List; + +import net.md_5.bungee.api.ChatColor; +import net.md_5.bungee.api.chat.BaseComponent; +import net.md_5.bungee.api.chat.ClickEvent; +import net.md_5.bungee.api.chat.ComponentBuilder; +import net.md_5.bungee.api.chat.HoverEvent; + +import org.apache.commons.lang.StringUtils; import org.bukkit.entity.Player; +import mineplex.core.botspam.BotSpamManager; import mineplex.core.botspam.SpamText; import mineplex.core.command.CommandBase; import mineplex.core.common.Rank; -import mineplex.core.botspam.BotSpamManager; -import mineplex.core.common.jsonchat.ClickEvent; -import mineplex.core.common.jsonchat.HoverEvent; -import mineplex.core.common.jsonchat.JsonMessage; import mineplex.core.common.util.C; import mineplex.core.common.util.F; import mineplex.core.common.util.UtilPlayer; @@ -23,24 +30,181 @@ public class BotSpamListCommand extends CommandBase @Override public void Execute(Player caller, String[] args) { - UtilPlayer.message(caller, F.main("BotSpam", "Listing Spam Texts. Hover for more details")); - UtilPlayer.message(caller, ""); // Blank Line! + List spamMessages = Plugin.getSpamTexts(); - for (SpamText spamText : Plugin.getSpamTexts()) + if (spamMessages == null || spamMessages.isEmpty()) { - String modifyMessage = spamText.isEnabled() ? C.cRed + "Click To Disable" : C.cGreen + "Click To Enable"; - String hoverMessage = C.cYellow + "Spam Id: " + C.cWhite + spamText.getId() + "\\n" + C.cYellow + "Ban Count: " + C.cWhite + spamText.getPunishments() + "\\n" + C.cYellow + "Enabled: " + C.cWhite + spamText.isEnabled(); - hoverMessage += "\\n\\n" + C.cYellow + "Created By: " + C.cWhite + spamText.getCreatedBy(); - if (spamText.getEnabledBy() != null) - hoverMessage += "\\n" + C.cYellow + "Enabled By: " + C.cWhite + spamText.getEnabledBy(); - if (spamText.getDisabledBy() != null) - hoverMessage += "\\n" + C.cYellow + "Disabled By: " + C.cWhite + spamText.getDisabledBy(); - hoverMessage += "\\n\\n" + modifyMessage; - - JsonMessage message = new JsonMessage((spamText.isEnabled() ? "" : C.cRed) + spamText.getText()); - message.hover(HoverEvent.SHOW_TEXT, hoverMessage); - message.click(ClickEvent.RUN_COMMAND, "/botspam " + (spamText.isEnabled() ? "disable" : "enable") + " " + spamText.getId()); - message.send(JsonMessage.MessageType.SYSTEM_MESSAGE, caller); + UtilPlayer.message(caller, F.main("BotSpam", "No botspam messages!")); + return; } + + int totalPages = (int) Math.ceil(spamMessages.size() / 8.0); + int page = 0; + + if (args.length != 0) + { + try + { + page = Integer.parseInt(args[0]); + } + catch (NumberFormatException ex) + { + UtilPlayer.message(caller, F.main("BotSpam", F.elem(args[0]) + " is not a number!")); + return; + } + page = page - 1; + + if (page < 0) + { + UtilPlayer.message(caller, F.main("BotSpam", "Page numbers must be greater than zero!")); + return; + } + else if (page >= totalPages) + { + UtilPlayer.message(caller, F.main("BotSpam", "There are only " + F.elem(totalPages) + " pages of botspam messages, that number is too big!")); + return; + } + } + + String header = "[" + + ChatColor.RESET + C.cWhite + C.Bold + "BotSpam (" + (page + 1) + "/" + totalPages + ")" + + ChatColor.RESET + C.cAqua + C.Strike + "]"; + + int headerChars = ChatColor.stripColor(header).length(); + + int numEqualsInHeader = (50 - headerChars) / 2; + header = C.cAqua + C.Strike + StringUtils.repeat("=", numEqualsInHeader) + header + StringUtils.repeat("=", numEqualsInHeader); + + caller.sendMessage(header); + + int start = page * 8; + + List subList = start < spamMessages.size() ? spamMessages.subList(start, Math.min(spamMessages.size(), start + 8)) : Collections.emptyList(); + + for (SpamText spamText : subList) + { + ComponentBuilder hover = new ComponentBuilder("") + .append("Spam ID: ") + .color(ChatColor.YELLOW) + .append(spamText.getId() + "\n", ComponentBuilder.FormatRetention.NONE) + .color(ChatColor.WHITE) + .append("Ban Count: ", ComponentBuilder.FormatRetention.NONE) + .color(ChatColor.YELLOW) + .append(spamText.getPunishments() + "\n", ComponentBuilder.FormatRetention.NONE) + .append("Enabled: ", ComponentBuilder.FormatRetention.NONE) + .color(ChatColor.YELLOW) + .append((spamText.isEnabled() ? "True" : "False") + "\n", ComponentBuilder.FormatRetention.NONE) + .color(ChatColor.WHITE) + .append("\n", ComponentBuilder.FormatRetention.NONE) + .append("Created By: ", ComponentBuilder.FormatRetention.NONE) + .color(ChatColor.YELLOW) + .append(spamText.getCreatedBy() + "\n", ComponentBuilder.FormatRetention.NONE) + .color(ChatColor.WHITE); + + if (spamText.getEnabledBy() != null) + { + hover + .append("Enabled By: ", ComponentBuilder.FormatRetention.NONE) + .color(ChatColor.YELLOW) + .append(spamText.getEnabledBy() + "\n", ComponentBuilder.FormatRetention.NONE) + .color(ChatColor.WHITE); + } + if (spamText.getDisabledBy() != null) + { + hover + .append("Disabled By: ", ComponentBuilder.FormatRetention.NONE) + .color(ChatColor.YELLOW) + .append(spamText.getDisabledBy() + "\n", ComponentBuilder.FormatRetention.NONE) + .color(ChatColor.WHITE); + + } + hover.append("\n", ComponentBuilder.FormatRetention.NONE); + + if (spamText.isEnabled()) + { + hover.append("Click to disable") + .color(ChatColor.RED); + } + else + { + hover.append("Click to enable") + .color(ChatColor.GREEN); + } + + ComponentBuilder mainMsg = new ComponentBuilder("") + .append(spamText.getText()); + + if (!spamText.isEnabled()) + { + mainMsg.color(ChatColor.RED); + } + + mainMsg.event(new HoverEvent(HoverEvent.Action.SHOW_TEXT, hover.create())) + .event(new ClickEvent(ClickEvent.Action.RUN_COMMAND, "/botspam " + (spamText.isEnabled() ? "disable" : "enable") + " " + spamText.getId())); + + caller.spigot().sendMessage(mainMsg.create()); + } + + int chars = ChatColor.stripColor(header).length(); + + int numEquals = (chars - 5) / 2; // 5 chars: " < > " + + ComponentBuilder pageSwitch = new ComponentBuilder("") + .append(StringUtils.repeat("=", numEquals) + "[") + .strikethrough(true) + .color(ChatColor.AQUA) + .append(" ", ComponentBuilder.FormatRetention.NONE) + .append("<", ComponentBuilder.FormatRetention.NONE) + .bold(true); + + if (page > 0) + { + BaseComponent[] prev = new ComponentBuilder("") + .append("Go to page " + page) + .color(ChatColor.GREEN) + .create(); + + pageSwitch + .color(ChatColor.GREEN) + .event(new net.md_5.bungee.api.chat.ClickEvent(net.md_5.bungee.api.chat.ClickEvent.Action.RUN_COMMAND, "/botspam list " + (page))) + .event(new net.md_5.bungee.api.chat.HoverEvent(net.md_5.bungee.api.chat.HoverEvent.Action.SHOW_TEXT, prev)); + + } + else + { + pageSwitch + .color(ChatColor.GRAY); + } + + pageSwitch.append(" ", ComponentBuilder.FormatRetention.NONE) + .append(">", ComponentBuilder.FormatRetention.NONE) + .bold(true); + + if (page + 1 < totalPages) + { + BaseComponent[] next = new ComponentBuilder("") + .append("Go to page " + (page + 2)) + .color(ChatColor.GREEN) + .create(); + + pageSwitch + .color(ChatColor.GREEN) + .event(new net.md_5.bungee.api.chat.ClickEvent(net.md_5.bungee.api.chat.ClickEvent.Action.RUN_COMMAND, "/botspam list " + (page + 2))) + .event(new net.md_5.bungee.api.chat.HoverEvent(net.md_5.bungee.api.chat.HoverEvent.Action.SHOW_TEXT, next)); + + } + else + { + pageSwitch + .color(ChatColor.GRAY); + } + + pageSwitch + .append(" ", ComponentBuilder.FormatRetention.NONE) + .append("]" + StringUtils.repeat("=", numEquals), ComponentBuilder.FormatRetention.NONE) + .strikethrough(true) + .color(ChatColor.AQUA); + + caller.spigot().sendMessage(pageSwitch.create()); } } diff --git a/Plugins/Mineplex.Core/src/mineplex/core/botspam/repository/BotSpamRepository.java b/Plugins/Mineplex.Core/src/mineplex/core/botspam/repository/BotSpamRepository.java index 30d8f0c62..cdaede58c 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/botspam/repository/BotSpamRepository.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/botspam/repository/BotSpamRepository.java @@ -8,13 +8,13 @@ import mineplex.core.database.MinecraftRepository; import org.bukkit.plugin.java.JavaPlugin; import mineplex.serverdata.database.DBPool; -import mineplex.serverdata.database.RepositoryBase; import mineplex.core.botspam.SpamText; +import mineplex.serverdata.database.RepositoryBase; import mineplex.serverdata.database.ResultSetCallable; import mineplex.serverdata.database.column.ColumnInt; import mineplex.serverdata.database.column.ColumnVarChar; -public class BotSpamRepository extends MinecraftRepository +public class BotSpamRepository extends RepositoryBase { private static final String GET_SPAM_TEXT = "SELECT * FROM botSpam"; private static final String ADD_SPAM_TEXT = "INSERT INTO botSpam (text, createdBy, enabledBy) VALUES (?, ?, ?)"; @@ -25,30 +25,26 @@ public class BotSpamRepository extends MinecraftRepository public BotSpamRepository(JavaPlugin plugin) { - super(plugin, DBPool.getAccount()); + super(DBPool.getAccount()); } public ArrayList getSpamText() { final ArrayList list = new ArrayList(); - executeQuery(GET_SPAM_TEXT, new ResultSetCallable() + executeQuery(GET_SPAM_TEXT, resultSet -> { - @Override - public void processResultSet(ResultSet resultSet) throws SQLException + while (resultSet.next()) { - while (resultSet.next()) - { - int id = resultSet.getInt(1); - String text = resultSet.getString(2); - int punishments = resultSet.getInt(3); - boolean enabled = resultSet.getBoolean(4); - String createdBy = resultSet.getString(5); - String enabledBy = resultSet.getString(6); - String disabledBy = resultSet.getString(7); + int id = resultSet.getInt(1); + String text = resultSet.getString(2); + int punishments = resultSet.getInt(3); + boolean enabled = resultSet.getBoolean(4); + String createdBy = resultSet.getString(5); + String enabledBy = resultSet.getString(6); + String disabledBy = resultSet.getString(7); - list.add(new SpamText(id, text, punishments, enabled, createdBy, enabledBy, disabledBy)); - } + list.add(new SpamText(id, text, punishments, enabled, createdBy, enabledBy, disabledBy)); } }); @@ -74,16 +70,4 @@ public class BotSpamRepository extends MinecraftRepository { executeInsert(ADD_SPAM_TEXT, null, new ColumnVarChar("text", 200, spamText), new ColumnVarChar("createdBy", 100, caller), new ColumnVarChar("enabledBy", 100, caller)); } - - @Override - protected void initialize() - { - - } - - @Override - protected void update() - { - - } } diff --git a/Plugins/Mineplex.Core/src/mineplex/core/brawl/fountain/FountainManager.java b/Plugins/Mineplex.Core/src/mineplex/core/brawl/fountain/FountainManager.java index 4479a447c..e7c009f3f 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/brawl/fountain/FountainManager.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/brawl/fountain/FountainManager.java @@ -45,7 +45,7 @@ public class FountainManager extends MiniPlugin World world = Bukkit.getWorlds().get(0);//-43.5, 66, -38.5 - int goal = 70000000;//!new File("eu.dat").exists() ? 200000000 : 20000000; + int goal = 35000000;//!new File("eu.dat").exists() ? 200000000 : 20000000; _gemFountain = new Fountain(new ConnectionData("10.3.203.80", 6379, ConnectionData.ConnectionType.MASTER, "USRedis"), new ConnectionData("10.3.203.80", 6377, ConnectionData.ConnectionType.SLAVE, "USRedis"), Region.ALL, LocationConstants.FOUNTAIN_LOCATION, LocationConstants.FOUNTAIN_SCHEMATIC, diff --git a/Plugins/Mineplex.Core/src/mineplex/core/brawl/fountain/command/AddCommand.java b/Plugins/Mineplex.Core/src/mineplex/core/brawl/fountain/command/AddCommand.java index 8e108093c..bebc34341 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/brawl/fountain/command/AddCommand.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/brawl/fountain/command/AddCommand.java @@ -1,5 +1,7 @@ package mineplex.core.brawl.fountain.command; +import java.util.function.Consumer; + import mineplex.core.brawl.fountain.FountainManager; import mineplex.core.command.CommandBase; import mineplex.core.common.Rank; @@ -8,10 +10,12 @@ import mineplex.core.common.util.Callback; import mineplex.core.common.util.F; import mineplex.core.common.util.UtilPlayer; import mineplex.core.server.util.TransactionResponse; + import org.bukkit.entity.Player; /** * Command to add gems to the fountain + * * @author Shaun Bennett */ public class AddCommand extends CommandBase @@ -34,26 +38,23 @@ public class AddCommand extends CommandBase { int amount = Integer.parseInt(args[0]); - Plugin.getDonationManager().purchaseUnknownSalesPackage(new Callback() - { - @Override - public void run(TransactionResponse result) - { - if (result == TransactionResponse.Success) + Plugin.getDonationManager().purchaseUnknownSalesPackage(caller, "GemFountain.Add", GlobalCurrency.GEM, amount, false, + result -> { - Plugin.getGemFountain().increment(caller, amount, null); - UtilPlayer.message(caller, F.main("Fountain", "Added " + F.elem(amount) + " to the fountain!")); - } - else if (result == TransactionResponse.InsufficientFunds) - { - UtilPlayer.message(caller, F.main("Fountain", "You do not have enough gems!")); - } - else - { - UtilPlayer.message(caller, F.main("Fountain", "There was an error processing your request!")); - } - } - }, caller, "GemFountain.Add", GlobalCurrency.GEM, amount, false); + if (result == TransactionResponse.Success) + { + Plugin.getGemFountain().increment(caller, amount, null); + UtilPlayer.message(caller, F.main("Fountain", "Added " + F.elem(amount) + " to the fountain!")); + } + else if (result == TransactionResponse.InsufficientFunds) + { + UtilPlayer.message(caller, F.main("Fountain", "You do not have enough gems!")); + } + else + { + UtilPlayer.message(caller, F.main("Fountain", "There was an error processing your request!")); + } + }); } catch (NumberFormatException ex) { diff --git a/Plugins/Mineplex.Core/src/mineplex/core/chat/Chat.java b/Plugins/Mineplex.Core/src/mineplex/core/chat/Chat.java index b1c170e19..71f36d24d 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/chat/Chat.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/chat/Chat.java @@ -147,8 +147,11 @@ public class Chat extends MiniPlugin || event.getMessage().toLowerCase().startsWith("/bukkit") || event.getMessage().toLowerCase().startsWith("/minecraft")) { - event.getPlayer().sendMessage(F.main(getName(), "Nope, not allowed!")); - event.setCancelled(true); + if (!event.getPlayer().isOp()) + { + event.getPlayer().sendMessage(F.main(getName(), "Nope, not allowed!")); + event.setCancelled(true); + } } } @@ -267,7 +270,15 @@ public class Chat extends MiniPlugin if (event.isAsynchronous()) { - event.setMessage(getFilteredMessage(event.getPlayer(), event.getMessage())); + String filtered = getFilteredMessage(event.getPlayer(), event.getMessage()); + if (filtered.isEmpty()) + { + event.setCancelled(true); + } + else + { + event.setMessage(getFilteredMessage(event.getPlayer(), event.getMessage())); + } } } diff --git a/Plugins/Mineplex.Core/src/mineplex/core/chatsnap/SnapshotRepository.java b/Plugins/Mineplex.Core/src/mineplex/core/chatsnap/SnapshotRepository.java index 261f081f8..2b638186e 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/chatsnap/SnapshotRepository.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/chatsnap/SnapshotRepository.java @@ -163,11 +163,11 @@ public class SnapshotRepository } } - public CompletableFuture getSnapshotMetadata(int snapshotId) + public CompletableFuture getSnapshotMetadata(Connection connection, int snapshotId) { CompletableFuture future = CompletableFuture.supplyAsync(() -> { - try (Connection connection = DBPool.getAccount().getConnection()) + try { try (PreparedStatement statement = connection.prepareStatement(GET_METADATA)) { diff --git a/Plugins/Mineplex.Core/src/mineplex/core/command/CommandBase.java b/Plugins/Mineplex.Core/src/mineplex/core/command/CommandBase.java index 2aafb6cb9..f2cccf0a2 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/command/CommandBase.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/command/CommandBase.java @@ -4,42 +4,48 @@ import java.util.ArrayList; import java.util.Arrays; import java.util.Collection; import java.util.List; +import java.util.Locale; +import java.util.function.Function; +import java.util.function.Predicate; +import java.util.stream.Collectors; +import java.util.stream.Stream; import org.bukkit.command.CommandSender; import org.bukkit.entity.Player; import mineplex.core.MiniPlugin; +import mineplex.core.PlayerSelector; import mineplex.core.common.Rank; -import mineplex.core.common.util.UtilServer; +import mineplex.core.common.util.UtilLambda; import mineplex.core.recharge.Recharge; public abstract class CommandBase implements ICommand -{ +{ private Rank _requiredRank; private Rank[] _specificRank; - + private List _aliases; - + protected PluginType Plugin; protected String _aliasUsed; protected CommandCenter _commandCenter; - - public CommandBase(PluginType plugin, Rank requiredRank, String...aliases) + + public CommandBase(PluginType plugin, Rank requiredRank, String... aliases) { Plugin = plugin; _requiredRank = requiredRank; _aliases = Arrays.asList(aliases); } - - public CommandBase(PluginType plugin, Rank requiredRank, Rank[] specificRank, String...aliases) + + public CommandBase(PluginType plugin, Rank requiredRank, Rank[] specificRank, String... aliases) { Plugin = plugin; _requiredRank = requiredRank; _specificRank = specificRank; - + _aliases = Arrays.asList(aliases); } - + public Collection Aliases() { return _aliases; @@ -49,22 +55,27 @@ public abstract class CommandBase implements ICom { _aliasUsed = alias; } - + public Rank GetRequiredRank() { return _requiredRank; } - + + public void setRequiredRank(Rank rank) + { + this._requiredRank = rank; + } + public Rank[] GetSpecificRanks() - { + { return _specificRank; } - + public void SetCommandCenter(CommandCenter commandCenter) { _commandCenter = commandCenter; } - + protected void resetCommandCharge(Player caller) { Recharge.Instance.recharge(caller, "Command"); @@ -76,6 +87,26 @@ public abstract class CommandBase implements ICom return null; } + protected List getMatches(String start, Collection possibleMatches, Function toString) + { + List matches = new ArrayList(); + + for (T possibleMatch : possibleMatches) + { + String str = toString.apply(possibleMatch); + if (str.toLowerCase().startsWith(start.toLowerCase())) + matches.add(str); + } + + return matches; + } + + protected List getMatches(String start, Stream possibleMatches) + { + String lcase = start.toLowerCase(Locale.ENGLISH); + return possibleMatches.filter(str -> str.toLowerCase(Locale.ENGLISH).startsWith(lcase)).collect(Collectors.toList()); + } + protected List getMatches(String start, Collection possibleMatches) { List matches = new ArrayList(); @@ -104,19 +135,27 @@ public abstract class CommandBase implements ICom return matches; } - protected List getPlayerMatches(Player sender, String start) + protected List tabCompletePlayerNames(CommandSender sender, String commandLabel, String[] args) { - List matches = new ArrayList(); - - for (Player player : UtilServer.getPlayers()) - { - if (sender.canSee(player) && player.getName().toLowerCase().startsWith(start.toLowerCase())) - { - matches.add(player.getName()); - } - } - - return matches; + return tabCompletePlayerNames(sender, commandLabel, args, t -> true); } + protected List tabCompletePlayerNames(CommandSender sender, String commandLabel, String[] args, Predicate filter) + { + if (sender instanceof Player) + { + if (args.length == 1) + { + String lcase = args[0].toLowerCase(Locale.ENGLISH); + return PlayerSelector.selectPlayers( + UtilLambda.and( + ((Player) sender)::canSee, + player -> player.getName().toLowerCase(Locale.ENGLISH).startsWith(lcase), + filter + ) + ).stream().map(Player::getName).collect(Collectors.toList()); + } + } + return null; + } } diff --git a/Plugins/Mineplex.Core/src/mineplex/core/command/CommandCenter.java b/Plugins/Mineplex.Core/src/mineplex/core/command/CommandCenter.java index 92301a0e3..5ab90fc5a 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/command/CommandCenter.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/command/CommandCenter.java @@ -1,21 +1,38 @@ package mineplex.core.command; +import java.lang.reflect.Field; +import java.util.ArrayList; +import java.util.Arrays; +import java.util.HashSet; +import java.util.List; +import java.util.Set; +import java.util.concurrent.atomic.AtomicIntegerFieldUpdater; + +import net.minecraft.server.v1_8_R3.PacketPlayInTabComplete; +import net.minecraft.server.v1_8_R3.PacketPlayOutTabComplete; +import net.minecraft.server.v1_8_R3.PlayerConnection; + +import org.bukkit.craftbukkit.v1_8_R3.entity.CraftPlayer; +import org.bukkit.event.EventHandler; +import org.bukkit.event.Listener; +import org.bukkit.event.player.PlayerCommandPreprocessEvent; +import org.bukkit.plugin.java.JavaPlugin; + import com.google.common.collect.Lists; + +import mineplex.core.Managers; import mineplex.core.account.CoreClientManager; import mineplex.core.common.Rank; import mineplex.core.common.util.C; import mineplex.core.common.util.F; import mineplex.core.common.util.NautHashMap; import mineplex.core.common.util.UtilPlayer; +import mineplex.core.packethandler.IPacketHandler; +import mineplex.core.packethandler.PacketHandler; +import mineplex.core.packethandler.PacketInfo; import mineplex.core.recharge.Recharge; -import org.bukkit.event.EventHandler; -import org.bukkit.event.Listener; -import org.bukkit.event.player.PlayerCommandPreprocessEvent; -import org.bukkit.plugin.java.JavaPlugin; -import java.util.List; - -public class CommandCenter implements Listener +public class CommandCenter implements Listener, IPacketHandler { public static CommandCenter Instance; @@ -25,35 +42,55 @@ public class CommandCenter implements Listener private final List BLOCKED_COMMANDS = Lists.newArrayList("pl", "plugins", "ver", "version", "icanhasbukkit", "about", "?", "help"); private final String MESSAGE = C.cRed + "I'm sorry, but you do not have permission to perform this command. Please contact the server administrators if you believe that this is in error."; + private final PacketHandler _packetHandler = Managers.require(PacketHandler.class); + + private static AtomicIntegerFieldUpdater chatSpamField = null; + + static + { + try + { + Field field = PlayerConnection.class.getDeclaredField("chatSpamField"); + field.setAccessible(true); + chatSpamField = (AtomicIntegerFieldUpdater) field.get(null); + } + catch (ReflectiveOperationException ex) + { + throw new RuntimeException("An unexpected error occured while reflectively accessing a field", ex); + } + } + public static void Initialize(JavaPlugin plugin) { if (Instance == null) Instance = new CommandCenter(plugin); } - + public CoreClientManager GetClientManager() { return ClientManager; } - + private CommandCenter(JavaPlugin instance) { Plugin = instance; Commands = new NautHashMap<>(); Plugin.getServer().getPluginManager().registerEvents(this, Plugin); + + _packetHandler.addPacketHandler(this, true, PacketPlayInTabComplete.class); } - + public void setClientManager(CoreClientManager clientManager) { ClientManager = clientManager; } - + @EventHandler public void onPlayerCommandPreprocess(PlayerCommandPreprocessEvent event) { String commandName = event.getMessage().substring(1); - String[] args = new String[] {}; - + String[] args = new String[]{}; + if (commandName.contains(" ")) { commandName = commandName.split(" ")[0]; @@ -61,7 +98,7 @@ public class CommandCenter implements Listener } ICommand command = Commands.get(commandName.toLowerCase()); - + if (command != null) { event.setCancelled(true); @@ -69,18 +106,18 @@ public class CommandCenter implements Listener if (ClientManager.Get(event.getPlayer()).GetRank().has(event.getPlayer(), command.GetRequiredRank(), command.GetSpecificRanks(), true) || UtilPlayer.isCommandAllowed(event.getPlayer(), commandName.toLowerCase())) { - if (!Recharge.Instance.use(event.getPlayer(), "Command", 500, false, false)) - { - event.getPlayer().sendMessage(F.main("Command Center", "You can't spam commands that fast.")); - return; - } - - command.SetAliasUsed(commandName.toLowerCase()); - command.Execute(event.getPlayer(), args); - } + if (!Recharge.Instance.use(event.getPlayer(), "Command", 500, false, false)) + { + event.getPlayer().sendMessage(F.main("Command Center", "You can't spam commands that fast.")); + return; + } + + command.SetAliasUsed(commandName.toLowerCase()); + command.Execute(event.getPlayer(), args); + } return; } - + if (BLOCKED_COMMANDS.contains(commandName.toLowerCase()) && !(event.getPlayer().isOp() || ClientManager.Get(event.getPlayer()).GetRank().has(Rank.DEVELOPER))) { event.setCancelled(true); @@ -89,7 +126,6 @@ public class CommandCenter implements Listener } } - public void addCommand(ICommand command) { for (String commandRoot : command.Aliases()) @@ -112,4 +148,85 @@ public class CommandCenter implements Listener { return Commands; } + + @Override + public void handle(PacketInfo packetInfo) + { + if (packetInfo.getPacket() instanceof PacketPlayInTabComplete) + { + PacketPlayInTabComplete packet = (PacketPlayInTabComplete) packetInfo.getPacket(); + + String message = packet.a(); + + if (message.startsWith("/")) + { + packetInfo.setCancelled(true); + + PlayerConnection playerConnection = ((CraftPlayer) packetInfo.getPlayer()).getHandle().playerConnection; + + if (chatSpamField.addAndGet(playerConnection, 10) > 500 && !packetInfo.getPlayer().isOp()) + { + playerConnection.disconnect("disconnect.spam"); + return; + } + + Set results = new HashSet<>(); + + String commandName = message.substring(1); + String[] args = new String[0]; + + if (commandName.contains(" ")) + { + String[] splits = commandName.split(" ", -1); + commandName = splits[0]; + args = new String[splits.length - 1]; + System.arraycopy(splits, 1, args, 0, args.length); + } + +// System.out.println("Handling tab complete for " + packetInfo.getPlayer().getName() + " " + commandName + " " + Arrays.toString(args) + " " + endsWithSpace); + + if (args.length > 0) + { +// System.out.println("Path 1"); + ICommand command = Commands.get(commandName.toLowerCase()); + + if (command != null) + { + if (ClientManager.Get(packetInfo.getPlayer()).GetRank().has(packetInfo.getPlayer(), command.GetRequiredRank(), command.GetSpecificRanks(), false) + || UtilPlayer.isCommandAllowed(packetInfo.getPlayer(), commandName.toLowerCase())) + { + List tmpres = command.onTabComplete(packetInfo.getPlayer(), commandName.toLowerCase(), args); + if (tmpres != null) + { + results.addAll(tmpres); + } + } + } + } + // tab complete commands? + else + { +// System.out.println("Path 2"); + for (ICommand command : Commands.values()) + { + if (ClientManager.Get(packetInfo.getPlayer()).GetRank().has(packetInfo.getPlayer(), command.GetRequiredRank(), command.GetSpecificRanks(), false) + || UtilPlayer.isCommandAllowed(packetInfo.getPlayer(), commandName.toLowerCase())) + { + for (String alias : command.Aliases()) + { + if (alias.startsWith(commandName)) + { + results.add("/" + alias.toLowerCase()); + } + } + } + } + } + +// System.out.println("Final results: " + results); + + playerConnection.sendPacket(new PacketPlayOutTabComplete(results.toArray(new String[results.size()]))); + } + } + } } diff --git a/Plugins/Mineplex.Core/src/mineplex/core/command/ICommand.java b/Plugins/Mineplex.Core/src/mineplex/core/command/ICommand.java index 463a7631f..f1ba3deaf 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/command/ICommand.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/command/ICommand.java @@ -5,10 +5,11 @@ import java.util.List; import mineplex.core.common.Rank; +import mineplex.core.lifetimes.Component; import org.bukkit.command.CommandSender; import org.bukkit.entity.Player; -public interface ICommand +public interface ICommand extends Component { void SetCommandCenter(CommandCenter commandCenter); void Execute(Player caller, String[] args); @@ -20,5 +21,17 @@ public interface ICommand Rank GetRequiredRank(); Rank[] GetSpecificRanks(); + @Override + default void activate() + { + CommandCenter.Instance.addCommand(this); + } + + @Override + default void deactivate() + { + CommandCenter.Instance.removeCommand(this); + } + List onTabComplete(CommandSender sender, String commandLabel, String[] args); } diff --git a/Plugins/Mineplex.Core/src/mineplex/core/command/MultiCommandBase.java b/Plugins/Mineplex.Core/src/mineplex/core/command/MultiCommandBase.java index 2d4dd27a4..a8d751c9c 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/command/MultiCommandBase.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/command/MultiCommandBase.java @@ -1,38 +1,40 @@ package mineplex.core.command; -import java.util.ArrayList; +import java.util.Collection; import java.util.List; +import java.util.Locale; +import java.util.stream.Stream; + +import org.bukkit.command.CommandSender; +import org.bukkit.entity.Player; import mineplex.core.MiniPlugin; import mineplex.core.common.Rank; import mineplex.core.common.util.NautHashMap; -import org.bukkit.command.CommandSender; -import org.bukkit.entity.Player; - public abstract class MultiCommandBase extends CommandBase { - protected NautHashMap Commands; - - public MultiCommandBase(PluginType plugin, Rank rank, String...aliases) + private NautHashMap Commands; + + public MultiCommandBase(PluginType plugin, Rank rank, String... aliases) { super(plugin, rank, aliases); - - Commands = new NautHashMap(); + + Commands = new NautHashMap<>(); } - - public MultiCommandBase(PluginType plugin, Rank rank, Rank[] specificRanks, String...aliases) + + public MultiCommandBase(PluginType plugin, Rank rank, Rank[] specificRanks, String... aliases) { super(plugin, rank, specificRanks, aliases); - - Commands = new NautHashMap(); + + Commands = new NautHashMap<>(); } - + public void AddCommand(ICommand command) { for (String commandRoot : command.Aliases()) { - Commands.put(commandRoot, command); + Commands.put(commandRoot.toLowerCase(Locale.ENGLISH), command); command.SetCommandCenter(_commandCenter); } } @@ -51,25 +53,25 @@ public abstract class MultiCommandBase extends Co public void Execute(Player caller, String[] args) { String commandName = null; - String[] newArgs = new String[] {}; - + String[] newArgs = new String[]{}; + if (args != null && args.length > 0) { commandName = args[0]; - + if (args.length > 1) { newArgs = new String[args.length - 1]; - - for (int i = 0 ; i < newArgs.length; i++) + + for (int i = 0; i < newArgs.length; i++) { - newArgs[i] = args[i+1]; + newArgs[i] = args[i + 1]; } } } - + ICommand command = Commands.get(commandName); - + if (command != null && _commandCenter.ClientManager.Get(caller).GetRank().has(caller, command.GetRequiredRank(), command.GetSpecificRanks(), true)) { command.SetAliasUsed(commandName); @@ -85,28 +87,28 @@ public abstract class MultiCommandBase extends Co @Override public List onTabComplete(CommandSender sender, String commandLabel, String[] args) { - if (args.length == 1) + if (args.length > 1) { - List possibleMatches = new ArrayList(); - - for (ICommand command : Commands.values()) - { - possibleMatches.addAll(command.Aliases()); - } - - return getMatches(args[0], possibleMatches); - } - else if (args.length > 1) - { - String commandName = args[0]; + String commandName = args[0].toLowerCase(Locale.ENGLISH); ICommand command = Commands.get(commandName); if (command != null) { - return command.onTabComplete(sender, commandLabel, args); + String[] newArgs = new String[args.length - 1]; + System.arraycopy(args, 1, newArgs, 0, newArgs.length); + return command.onTabComplete(sender, args[0], newArgs); } } + else if (args.length == 1) + { + Stream stream = Commands.values().stream(); + if (sender instanceof Player) + { + stream = stream.filter(command -> _commandCenter.GetClientManager().Get((Player) sender).GetRank().has((Player) sender, command.GetRequiredRank(), command.GetSpecificRanks(), false)); + } + return getMatches(args[0], stream.map(ICommand::Aliases).flatMap(Collection::stream)); + } return null; } diff --git a/Plugins/Mineplex.Core/src/mineplex/core/communities/Community.java b/Plugins/Mineplex.Core/src/mineplex/core/communities/Community.java new file mode 100644 index 000000000..86406e7ba --- /dev/null +++ b/Plugins/Mineplex.Core/src/mineplex/core/communities/Community.java @@ -0,0 +1,158 @@ +package mineplex.core.communities; + +import java.util.Map; +import java.util.UUID; +import java.util.concurrent.ConcurrentHashMap; + +import org.bukkit.Bukkit; +import org.bukkit.ChatColor; + +import mineplex.core.common.util.UtilPlayer; +import mineplex.core.game.GameDisplay; + +public class Community +{ + private final int _id; + private String _name; + private String _description; + private Map _members = new ConcurrentHashMap<>(); + private Map _joinRequests = new ConcurrentHashMap<>(); + private ChatColor[] _chatFormat; + private long _chatDelay; + private GameDisplay _favoriteGame; + private PrivacySetting _privacy; + + public Community(int id, String name) + { + _id = id; + _name = name; + _description = "No Description Set"; + _chatFormat = new ChatColor[] {ChatColor.BLUE, ChatColor.RED, ChatColor.GREEN}; + _chatDelay = 1000; + _favoriteGame = GameDisplay.ChampionsCTF; + _privacy = PrivacySetting.RECRUITING; + } + + public Integer getId() + { + return _id; + } + + public String getName() + { + return _name; + } + + public void setName(String name) + { + _name = name; + } + + public String getDescription() + { + return _description; + } + + public void setDescription(String description) + { + _description = description; + } + + public Map getMembers() + { + return _members; + } + + public Map getJoinRequests() + { + return _joinRequests; + } + + public ChatColor[] getChatFormatting() + { + return _chatFormat; + } + + public void setChatFormatting(ChatColor[] colors) + { + _chatFormat = colors; + } + + public Long getChatDelay() + { + return _chatDelay; + } + + public void setChatDelay(Long delay) + { + _chatDelay = delay; + } + + public GameDisplay getFavoriteGame() + { + return _favoriteGame; + } + + public void setFavoriteGame(GameDisplay game) + { + _favoriteGame = game; + } + + public PrivacySetting getPrivacySetting() + { + return _privacy; + } + + public void setPrivacySetting(PrivacySetting privacy) + { + _privacy = privacy; + } + + public void sendChat(String chat) + { + getMembers().values().stream().filter(info -> info.ReadingChat).forEach(member -> UtilPlayer.message(Bukkit.getPlayer(member.UUID), chat)); + } + + public void message(String message) + { + getMembers().values().forEach(member -> UtilPlayer.message(Bukkit.getPlayer(member.UUID), message)); + } + + public void message(String message, CommunityRole minimumRole) + { + getMembers().values().stream().filter(member -> member.Role.ordinal() <= minimumRole.ordinal()).forEach(member -> UtilPlayer.message(Bukkit.getPlayer(member.UUID), message)); + } + + public static enum PrivacySetting + { + OPEN("Open to Join"), + RECRUITING("Accepting Join Requests"), + PRIVATE("Closed") + ; + + private String _display; + + private PrivacySetting(String display) + { + _display = display; + } + + public String getDisplayText() + { + return _display; + } + + public static PrivacySetting parsePrivacy(String privacy) + { + for (PrivacySetting setting : PrivacySetting.values()) + { + if (setting.toString().equalsIgnoreCase(privacy)) + { + return setting; + } + } + + return PrivacySetting.RECRUITING; + } + } +} \ No newline at end of file diff --git a/Plugins/Mineplex.Core/src/mineplex/core/communities/CommunityBrowserUpdateEvent.java b/Plugins/Mineplex.Core/src/mineplex/core/communities/CommunityBrowserUpdateEvent.java new file mode 100644 index 000000000..d9dff9fe7 --- /dev/null +++ b/Plugins/Mineplex.Core/src/mineplex/core/communities/CommunityBrowserUpdateEvent.java @@ -0,0 +1,21 @@ +package mineplex.core.communities; + +import org.bukkit.event.Event; +import org.bukkit.event.HandlerList; + +public class CommunityBrowserUpdateEvent extends Event +{ + private static final HandlerList handlers = new HandlerList(); + + public CommunityBrowserUpdateEvent() {} + + public HandlerList getHandlers() + { + return handlers; + } + + public static HandlerList getHandlerList() + { + return handlers; + } +} \ No newline at end of file diff --git a/Plugins/Mineplex.Core/src/mineplex/core/communities/CommunityDisbandEvent.java b/Plugins/Mineplex.Core/src/mineplex/core/communities/CommunityDisbandEvent.java new file mode 100644 index 000000000..ce97ed20e --- /dev/null +++ b/Plugins/Mineplex.Core/src/mineplex/core/communities/CommunityDisbandEvent.java @@ -0,0 +1,31 @@ +package mineplex.core.communities; + +import org.bukkit.event.Event; +import org.bukkit.event.HandlerList; + +public class CommunityDisbandEvent extends Event +{ + private static final HandlerList handlers = new HandlerList(); + + private Community _community; + + public CommunityDisbandEvent(Community community) + { + _community = community; + } + + public Community getCommunity() + { + return _community; + } + + public HandlerList getHandlers() + { + return handlers; + } + + public static HandlerList getHandlerList() + { + return handlers; + } +} \ No newline at end of file diff --git a/Plugins/Mineplex.Core/src/mineplex/core/communities/CommunityJoinRequestInfo.java b/Plugins/Mineplex.Core/src/mineplex/core/communities/CommunityJoinRequestInfo.java new file mode 100644 index 000000000..3e42d6bcd --- /dev/null +++ b/Plugins/Mineplex.Core/src/mineplex/core/communities/CommunityJoinRequestInfo.java @@ -0,0 +1,51 @@ +package mineplex.core.communities; + +import java.util.UUID; + +import org.bukkit.Material; +import org.bukkit.inventory.ItemStack; + +import mineplex.core.common.util.C; +import mineplex.core.itemstack.ItemBuilder; + +public class CommunityJoinRequestInfo +{ + public String Name; + public final UUID UUID; + public final int AccountId; + private ItemStack _icon; + + public CommunityJoinRequestInfo(String name, UUID uuid, int accountId) + { + Name = name; + UUID = uuid; + AccountId = accountId; + + buildIcon(); + } + + private void buildIcon() + { + ItemBuilder builder = new ItemBuilder(Material.SKULL_ITEM); + builder.setTitle(C.cGreenB + Name); + builder.setLore(C.cRed, C.cYellow + "Left Click " + C.cWhite + "Accept", C.cYellow + "Shift-Right Click " + C.cWhite + "Deny"); + builder.setData((short)3); + builder.setPlayerHead(Name); + _icon = builder.build(); + } + + public void update(String name) + { + if (name == null) + { + return; + } + Name = name; + buildIcon(); + } + + public ItemStack getRepresentation() + { + return _icon; + } +} \ No newline at end of file diff --git a/Plugins/Mineplex.Core/src/mineplex/core/communities/CommunityJoinRequestsUpdateEvent.java b/Plugins/Mineplex.Core/src/mineplex/core/communities/CommunityJoinRequestsUpdateEvent.java new file mode 100644 index 000000000..899ee7f5e --- /dev/null +++ b/Plugins/Mineplex.Core/src/mineplex/core/communities/CommunityJoinRequestsUpdateEvent.java @@ -0,0 +1,31 @@ +package mineplex.core.communities; + +import org.bukkit.event.Event; +import org.bukkit.event.HandlerList; + +public class CommunityJoinRequestsUpdateEvent extends Event +{ + private static final HandlerList handlers = new HandlerList(); + + private Community _community; + + public CommunityJoinRequestsUpdateEvent(Community community) + { + _community = community; + } + + public Community getCommunity() + { + return _community; + } + + public HandlerList getHandlers() + { + return handlers; + } + + public static HandlerList getHandlerList() + { + return handlers; + } +} \ No newline at end of file diff --git a/Plugins/Mineplex.Core/src/mineplex/core/communities/CommunityManager.java b/Plugins/Mineplex.Core/src/mineplex/core/communities/CommunityManager.java new file mode 100644 index 000000000..19a6a5609 --- /dev/null +++ b/Plugins/Mineplex.Core/src/mineplex/core/communities/CommunityManager.java @@ -0,0 +1,788 @@ +package mineplex.core.communities; + +import java.sql.ResultSet; +import java.sql.SQLException; +import java.util.ArrayList; +import java.util.Collections; +import java.util.LinkedList; +import java.util.List; +import java.util.Map; +import java.util.Map.Entry; +import java.util.Set; +import java.util.UUID; +import java.util.concurrent.ConcurrentHashMap; +import java.util.regex.Pattern; + +import org.bukkit.Bukkit; +import org.bukkit.entity.Player; +import org.bukkit.event.EventHandler; +import org.bukkit.event.EventPriority; +import org.bukkit.event.player.AsyncPlayerChatEvent; +import org.bukkit.event.player.PlayerJoinEvent; +import org.bukkit.plugin.java.JavaPlugin; + +import mineplex.core.Managers; +import mineplex.core.MiniDbClientPlugin; +import mineplex.core.account.CoreClientManager; +import mineplex.core.account.ILoginProcessor; +import mineplex.core.common.jsonchat.ClickEvent; +import mineplex.core.common.jsonchat.JsonMessage; +import mineplex.core.common.util.C; +import mineplex.core.common.util.F; +import mineplex.core.common.util.UtilPlayer; +import mineplex.core.common.util.UtilServer; +import mineplex.core.communities.Community.PrivacySetting; +import mineplex.core.communities.commands.CommunityCommand; +import mineplex.core.communities.redis.CommunityChat; +import mineplex.core.communities.redis.CommunityChatHandler; +import mineplex.core.communities.redis.CommunityCloseJoinRequest; +import mineplex.core.communities.redis.CommunityCloseJoinRequestHandler; +import mineplex.core.communities.redis.CommunityCreate; +import mineplex.core.communities.redis.CommunityCreateHandler; +import mineplex.core.communities.redis.CommunityDisband; +import mineplex.core.communities.redis.CommunityDisbandHandler; +import mineplex.core.communities.redis.CommunityInvite; +import mineplex.core.communities.redis.CommunityInviteHandler; +import mineplex.core.communities.redis.CommunityJoinRequest; +import mineplex.core.communities.redis.CommunityJoinRequestHandler; +import mineplex.core.communities.redis.CommunityUnInvite; +import mineplex.core.communities.redis.CommunityUnInviteHandler; +import mineplex.core.communities.redis.CommunityUpdateMemberChatReading; +import mineplex.core.communities.redis.CommunityUpdateMemberChatReadingHandler; +import mineplex.core.communities.redis.CommunityUpdateMemberRole; +import mineplex.core.communities.redis.CommunityUpdateMemberRoleHandler; +import mineplex.core.communities.redis.CommunityUpdateMembership; +import mineplex.core.communities.redis.CommunityUpdateMembershipHandler; +import mineplex.core.communities.redis.CommunityUpdateName; +import mineplex.core.communities.redis.CommunityUpdateNameHandler; +import mineplex.core.communities.redis.CommunityUpdateSetting; +import mineplex.core.communities.redis.CommunityUpdateSettingHandler; +import mineplex.core.communities.storage.CommunityRepository; +import mineplex.core.preferences.Preference; +import mineplex.core.preferences.PreferencesManager; +import mineplex.core.recharge.Recharge; +import mineplex.serverdata.Region; +import mineplex.serverdata.commands.ServerCommandManager; +import mineplex.serverdata.data.DataRepository; +import mineplex.serverdata.data.PlayerStatus; +import mineplex.serverdata.redis.RedisDataRepository; +import mineplex.serverdata.servers.ServerManager; +import mineplex.serverdata.servers.ServerRepository; + +public class CommunityManager extends MiniDbClientPlugin +{ + private final int UPDATE_CYCLE_SECONDS = 10; // The number of seconds between dirty communities refreshes + private final int CACHE_INVALIDATION_SECONDS = 300; // The number of seconds between full communities refreshes + public final Pattern ALPHA_NUMERIC_PATTERN = Pattern.compile("[^A-Za-z0-9]"); + public final String[] BLOCKED_NAMES = new String[] {"help", "chat", "create", "description", "disband", "invite", "join", "mcs", "rename", "uninvite", "trainee", "mod", "moderator", "srmod", "seniormod", "seniormoderator", "builder", "maplead", "twitch", "youtube", "support", "admin", "administrator", "leader", "dev", "developer", "owner", "party", "mineplex", "mineplexOfficial", "staff", "mineplexstaff", "qualityassurance", "traineemanagement", "modcoordination", "forumninja", "communitymanagement", "event", "socialmedia"}; + private final CommunityRepository _repo; + private final Map _loadedCommunities; + + public final List BrowserIds = new LinkedList<>(); + private final List _creating = new ArrayList<>(); + + public final DataRepository StatusRepository; + + private ServerRepository _serverRepo; + private boolean _us; + + private final Set dirty = Collections.newSetFromMap(new ConcurrentHashMap<>()); // Communities with redis updates + private int _updateCycleCount; // The number of update cycles since we've updated all communities + private volatile boolean _cycling = false; + + @SuppressWarnings("deprecation") + public CommunityManager(JavaPlugin plugin, CoreClientManager clientManager) + { + super("Communities", plugin, clientManager); + + StatusRepository = new RedisDataRepository(ServerManager.getMasterConnection(), ServerManager.getSlaveConnection(), + Region.currentRegion(), PlayerStatus.class, "playerStatus"); + + _us = plugin.getConfig().getBoolean("serverstatus.us"); + + Region region = _us ? Region.US : Region.EU; + _serverRepo = ServerManager.getServerRepository(region); + + _repo = new CommunityRepository(plugin, StatusRepository, _us); + + _loadedCommunities = new ConcurrentHashMap<>(); + + clientManager.addStoredProcedureLoginProcessor(new ILoginProcessor() + { + @Override + public String getName() + { + return "community-invite-loader"; + } + + @Override + public void processLoginResultSet(String playerName, UUID uuid, int accountId, ResultSet resultSet) throws SQLException + { + while (resultSet.next()) + { + String region = resultSet.getString("region"); + if ((_us && region.equalsIgnoreCase("US")) || (!_us && region.equalsIgnoreCase("EU"))) + { + CommunityManager.this.Get(uuid).Invites.add(resultSet.getInt("communityId")); + } + } + } + + @Override + public String getQuery(int accountId, String uuid, String name) + { + return "SELECT ci.communityId, c.region FROM communityInvites AS ci INNER JOIN communities AS c ON c.id=ci.communityId WHERE accountId=" + accountId + ";"; + } + }); + + Bukkit.getScheduler().scheduleAsyncRepeatingTask(plugin, () -> + { + _updateCycleCount++; + + if (_cycling) + { + return; + } + + LinkedList communities = new LinkedList<>(); + if (UPDATE_CYCLE_SECONDS * _updateCycleCount > CACHE_INVALIDATION_SECONDS) + { + // It's been five minutes since a full update; update all communities + _updateCycleCount = 0; + dirty.clear(); + + _loadedCommunities.values().forEach(communities::add); + } + else + { + dirty.forEach(communities::add); + dirty.clear(); + } + + _repo.updateMembersAndJoinRequests(communities); + }, 0L, 20 * UPDATE_CYCLE_SECONDS); + + Bukkit.getScheduler().scheduleSyncRepeatingTask(plugin, () -> + { + cycleBrowser(); + }, 0L, 20 * 30); + + _repo.loadCommunities(_loadedCommunities); + + addCommand(new CommunityCommand(this)); + + ServerCommandManager.getInstance().registerCommandType(CommunityChat.class, new CommunityChatHandler(this)); + ServerCommandManager.getInstance().registerCommandType(CommunityCloseJoinRequest.class, new CommunityCloseJoinRequestHandler(this)); + ServerCommandManager.getInstance().registerCommandType(CommunityCreate.class, new CommunityCreateHandler(this)); + ServerCommandManager.getInstance().registerCommandType(CommunityDisband.class, new CommunityDisbandHandler(this)); + ServerCommandManager.getInstance().registerCommandType(CommunityInvite.class, new CommunityInviteHandler(this)); + ServerCommandManager.getInstance().registerCommandType(CommunityJoinRequest.class, new CommunityJoinRequestHandler(this)); + ServerCommandManager.getInstance().registerCommandType(CommunityUnInvite.class, new CommunityUnInviteHandler(this)); + ServerCommandManager.getInstance().registerCommandType(CommunityUpdateMemberChatReading.class, new CommunityUpdateMemberChatReadingHandler(this)); + ServerCommandManager.getInstance().registerCommandType(CommunityUpdateMemberRole.class, new CommunityUpdateMemberRoleHandler(this)); + ServerCommandManager.getInstance().registerCommandType(CommunityUpdateMembership.class, new CommunityUpdateMembershipHandler(this)); + ServerCommandManager.getInstance().registerCommandType(CommunityUpdateName.class, new CommunityUpdateNameHandler(this)); + ServerCommandManager.getInstance().registerCommandType(CommunityUpdateSetting.class, new CommunityUpdateSettingHandler(this)); + } + + public boolean ownsCommunity(UUID uuid) + { + return _loadedCommunities.values().stream() + .flatMap(community -> community.getMembers().entrySet().stream()) + .anyMatch(entry -> entry.getKey().equals(uuid) && entry.getValue().Role == CommunityRole.LEADER); + } + + private void cycleBrowser() + { + if (_cycling) + { + return; + } + _cycling = true; + runAsync(() -> + { + final List ids = new LinkedList<>(); + _loadedCommunities.values().stream().filter(c -> c.getMembers().size() >= 5 && c.getPrivacySetting() != PrivacySetting.PRIVATE).forEach(c -> ids.add(c.getId())); + + Collections.shuffle(ids); + + runSync(() -> + { + BrowserIds.clear(); + BrowserIds.addAll(ids); + _cycling = false; + UtilServer.CallEvent(new CommunityBrowserUpdateEvent()); + }); + }); + } + + public Community getLoadedCommunity(Integer id) + { + return _loadedCommunities.get(id); + } + + public Community getLoadedCommunity(String name) + { + for (Entry entry : _loadedCommunities.entrySet()) + { + if (entry.getValue().getName().equalsIgnoreCase(name)) + { + return entry.getValue(); + } + } + + return null; + } + + public void handleCommunitySettingUpdate(Integer id, String sender, CommunitySetting setting, String newValue) + { + Community community = _loadedCommunities.get(id); + if (community == null) + { + return; + } + dirty.add(community); + setting.parseValueInto(newValue, community); + //community.message(F.main(getName(), F.name(sender) + " has changed settings in " + F.name(community.getName()) + "!")); + runSync(() -> UtilServer.CallEvent(new CommunitySettingUpdateEvent(community))); + } + + public void handleCommunityNameUpdate(Integer id, String sender, String name) + { + Community community = _loadedCommunities.get(id); + if (community == null) + { + return; + } + dirty.add(community); + String oldName = community.getName(); + community.setName(name); + community.message(F.main(getName(), F.name(sender) + " has changed the name of " + F.name(oldName) + " to " + F.name(community.getName()) + "!")); + runSync(() -> UtilServer.CallEvent(new CommunityNameUpdateEvent(community))); + } + + public void handleCommunityMembershipRoleUpdate(Integer id, String sender, UUID uuid, CommunityRole role) + { + Community community = _loadedCommunities.get(id); + if (community == null) + { + return; + } + dirty.add(community); + CommunityMemberInfo member = community.getMembers().get(uuid); + member.updateRole(role); + if (Bukkit.getPlayer(uuid) != null) + { + if (role.ordinal() > CommunityRole.COLEADER.ordinal()) + { + UtilPlayer.message(Bukkit.getPlayer(uuid), F.main(getName(), F.name(sender) + " has changed your role to " + F.elem(role.getDisplay()) + " in " + F.name(community.getName()) + "!")); + } + Get(Bukkit.getPlayer(uuid)).setRoleIn(community, role); + } + String name = member.Name; + community.message(F.main(getName(), F.name(sender) + " has changed " + F.name(name + "'s") + " role to " + F.elem(role.getDisplay()) + " in " + F.name(community.getName()) + "!"), CommunityRole.COLEADER); + runSync(() -> UtilServer.CallEvent(new CommunityMembershipUpdateEvent(community))); + } + + public void handleCommunityMembershipUpdate(Integer id, String sender, String playerName, UUID playerUUID, Integer accountId, boolean kick, boolean leave) + { + Community community = _loadedCommunities.get(id); + if (community == null) + { + return; + } + dirty.add(community); + + if (kick) + { + community.message(F.main(getName(), F.name(sender) + " has kicked " + F.name(playerName) + " from " + F.name(community.getName()) + "!")); + community.getMembers().remove(playerUUID); + if (Bukkit.getPlayer(playerUUID) != null) + { + Get(Bukkit.getPlayer(playerUUID)).leaveCommunity(community); + } + } + else if (leave) + { + community.message(F.main(getName(), F.name(playerName) + " has left " + F.name(community.getName()) + "!")); + community.getMembers().remove(playerUUID); + if (Bukkit.getPlayer(playerUUID) != null) + { + Get(Bukkit.getPlayer(playerUUID)).leaveCommunity(community); + } + } + else + { + community.getMembers().put(playerUUID, new CommunityMemberInfo(playerName, playerUUID, accountId, CommunityRole.MEMBER, System.currentTimeMillis())); + if (Bukkit.getPlayer(playerUUID) != null) + { + Get(Bukkit.getPlayer(playerUUID)).joinCommunity(community); + runSync(() -> Get(Bukkit.getPlayer(playerUUID)).Invites.remove(community.getId())); + } + + community.message(F.main(getName(), F.name(playerName) + " has joined " + F.name(community.getName()) + "!")); + } + + runSync(() -> + { + UtilServer.CallEvent(new CommunityMembershipUpdateEvent(community)); + if (Bukkit.getPlayer(playerUUID) != null) + { + UtilServer.CallEvent(new CommunityMemberDataUpdateEvent(Bukkit.getPlayer(playerUUID))); + } + }); + } + + public void handleCommunityInvite(Integer id, String sender, String targetName, UUID targetUUID) + { + Community community = _loadedCommunities.get(id); + if (community == null) + { + return; + } + dirty.add(community); + runSync(() -> + { + if (Bukkit.getPlayer(targetUUID) != null) + { + if (!Get(Bukkit.getPlayer(targetUUID)).Invites.contains(community.getId())) + { + Get(Bukkit.getPlayer(targetUUID)).Invites.add(community.getId()); + if (Managers.get(PreferencesManager.class).get(Bukkit.getPlayer(targetUUID)).isActive(Preference.COMMUNITY_INVITES)) + { + new JsonMessage(F.main(getName(), "You have been invited to join " + F.elem(community.getName()) + " by " + F.name(sender) + "! Click to join!")).click(ClickEvent.RUN_COMMAND, "/community join " + community.getName()).sendToPlayer(Bukkit.getPlayer(targetUUID)); + } + + UtilServer.CallEvent(new CommunityMemberDataUpdateEvent(Bukkit.getPlayer(targetUUID))); + } + } + }); + community.message(F.main(getName(), F.name(sender) + " has invited " + F.name(targetName) + " to " + F.name(community.getName()) + "!"), CommunityRole.COLEADER); + } + + public void handleCommunityUninvite(Integer id, String sender, String targetName, UUID targetUUID, boolean announce) + { + Community community = _loadedCommunities.get(id); + if (community == null) + { + return; + } + dirty.add(community); + runSync(() -> + { + if (Bukkit.getPlayer(targetUUID) != null) + { + Get(Bukkit.getPlayer(targetUUID)).Invites.remove(community.getId()); + if (Managers.get(PreferencesManager.class).get(Bukkit.getPlayer(targetUUID)).isActive(Preference.COMMUNITY_INVITES) && announce) + { + UtilPlayer.message(Bukkit.getPlayer(targetUUID), F.main(getName(), "Your invitation to join " + F.elem(community.getName()) + " has been revoked by " + F.name(sender) + "!")); + } + UtilServer.CallEvent(new CommunityMemberDataUpdateEvent(Bukkit.getPlayer(targetUUID))); + } + }); + if (announce) + { + community.message(F.main(getName(), F.name(targetName) + "'s invitation to join " + F.name(community.getName()) + " has been revoked by " + F.name(sender) + "!"), CommunityRole.COLEADER); + } + } + + public void handleCommunityJoinRequest(Integer id, String playerName, UUID playerUUID, Integer accountId) + { + Community community = _loadedCommunities.get(id); + if (community == null) + { + return; + } + dirty.add(community); + if (Bukkit.getPlayer(playerUUID) != null) + { + UtilPlayer.message(Bukkit.getPlayer(playerUUID), F.main(getName(), "You have requested to join " + F.elem(community.getName()) + "!")); + } + community.getJoinRequests().put(playerUUID, new CommunityJoinRequestInfo(playerName, playerUUID, accountId)); + community.message(F.main(getName(), F.name(playerName) + " has requested to join " + F.name(community.getName()) + "!"), CommunityRole.COLEADER); + + runSync(() -> UtilServer.CallEvent(new CommunityJoinRequestsUpdateEvent(community))); + } + + public void handleCommunityCloseJoinRequest(Integer id, String sender, String playerName, UUID playerUUID, Integer accountId, boolean announce) + { + Community community = _loadedCommunities.get(id); + if (community == null) + { + return; + } + dirty.add(community); + community.getJoinRequests().remove(playerUUID); + if (announce) + { + if (Bukkit.getPlayer(playerUUID) != null) + { + UtilPlayer.message(Bukkit.getPlayer(playerUUID), F.main(getName(), "Your request to join " + F.name(community.getName()) + " has been denied by " + F.name(sender) + "!")); + } + community.message(F.main(getName(), F.name(playerName) + "'s request to join " + F.name(community.getName()) + " has been denied by " + F.name(sender) + "!"), CommunityRole.COLEADER); + } + + runSync(() -> UtilServer.CallEvent(new CommunityJoinRequestsUpdateEvent(community))); + } + + public void handleCommunityCreation(Integer id, String name, Integer leaderId, UUID leaderUUID, String leaderName) + { + runAsync(() -> + { + _loadedCommunities.put(id, new Community(id, name)); + _loadedCommunities.get(id).getMembers().put(leaderUUID, new CommunityMemberInfo(leaderName, leaderUUID, leaderId, CommunityRole.LEADER, System.currentTimeMillis())); + runSync(() -> + { + Community community = _loadedCommunities.get(id); + dirty.add(community); + if (Bukkit.getPlayer(leaderUUID) != null) + { + Player leader = Bukkit.getPlayer(leaderUUID); + UtilPlayer.message(leader, F.main(getName(), "You have created a community named " + F.name(community.getName()) + "!")); + Get(leader).joinCommunity(id, CommunityRole.LEADER); + } + }); + }); + } + + public void handleCommunityDisband(Integer id, String senderName) + { + Community community = _loadedCommunities.get(id); + if (community == null) + { + return; + } + community.message(F.main(getName(), F.name(senderName) + " has disbanded community " + F.name(community.getName()) + "!")); + UtilServer.CallEvent(new CommunityDisbandEvent(community)); + runSync(() -> + { + UtilServer.GetPlayers().stream().filter(player -> Get(player).Invites.contains(community.getId())).forEach(player -> Get(player).Invites.remove(community.getId())); + }); + community.getMembers().keySet().stream().filter(uuid -> Bukkit.getPlayer(uuid) != null).forEach(uuid -> Get(Bukkit.getPlayer(uuid)).leaveCommunity(community)); + _loadedCommunities.remove(community.getId()); + runSync(() -> + { + if (BrowserIds.remove(community.getId())) + { + UtilServer.CallEvent(new CommunityBrowserUpdateEvent()); + } + }); + } + + public void handleToggleReadingCommunityChat(Integer id, UUID uuid, boolean reading) + { + Community community = _loadedCommunities.get(id); + if (community == null) + { + return; + } + + if (community.getMembers().containsKey(uuid)) + { + community.getMembers().get(uuid).ReadingChat = reading; + if (reading) + { + UtilPlayer.message(Bukkit.getPlayer(uuid), F.main(getName(), "You are now reading chat from " + F.name(community.getName()) + "!")); + } + else + { + UtilPlayer.message(Bukkit.getPlayer(uuid), F.main(getName(), "You are no longer reading chat from " + F.name(community.getName()) + "!")); + } + } + } + + public void handleCommunityChat(Integer id, String senderName, String message) + { + Community community = _loadedCommunities.get(id); + if (community == null) + { + return; + } + community.sendChat(community.getChatFormatting()[0] + C.Bold + community.getName() + " " + community.getChatFormatting()[1] + C.Bold + senderName + " " + community.getChatFormatting()[2] + message); + } + + public void handleInvite(Player sender, Community community, String target) + { + CommunityJoinRequestInfo[] jr = community.getJoinRequests().values().stream().filter(data -> data.Name.equalsIgnoreCase(target)).toArray(size -> new CommunityJoinRequestInfo[size]); + if (jr.length == 1) + { + UtilPlayer.message(sender, F.main(getName(), "You have accepted " + F.name(target) + "'s join request to " + F.name(community.getName()) + "!")); + runAsync(() -> + { + _repo.addToCommunity(jr[0].AccountId, community.getId()); + _repo.removeJoinRequest(community.getId(), jr[0].AccountId); + }); + new CommunityCloseJoinRequest(community.getId(), sender.getName(), jr[0].Name, jr[0].UUID.toString(), jr[0].AccountId, false).publish(); + new CommunityUpdateMembership(community.getId(), sender.getName(), jr[0].Name, jr[0].UUID.toString(), jr[0].AccountId, false, false).publish(); + return; + } + runAsync(() -> + { + if (_repo.inviteToCommunity(community.getId(), target)) + { + if (!community.getMembers().containsKey(sender.getUniqueId())) + { + UtilPlayer.message(sender, F.main(getName(), "You have invited " + F.name(target) + " to join " + F.name(community.getName()) + "!")); + } + new CommunityInvite(community.getId(), sender.getName(), target, Managers.get(CoreClientManager.class).loadUUIDFromDB(target).toString()).publish(); + } + else + { + UtilPlayer.message(sender, F.main(getName(), F.name(target) + " does not exist!")); + } + }); + } + + public void handleUninvite(Player sender, Community community, String target) + { + runAsync(() -> + { + if (_repo.deleteInviteToCommunity(community.getId(), target)) + { + if (!community.getMembers().containsKey(sender.getUniqueId())) + { + UtilPlayer.message(sender, F.main(getName(), "You have revoked " + F.name(target) + "'s invitation to join " + F.name(community.getName()) + "!")); + } + new CommunityUnInvite(community.getId(), sender.getName(), target, Managers.get(CoreClientManager.class).loadUUIDFromDB(target).toString(), true).publish(); + } + else + { + UtilPlayer.message(sender, F.main(getName(), "Either " + F.name(target) + " does not exist or you have not invited them to " + F.name(community.getName()) + "!")); + } + }); + } + + public void handleRejectInvite(Player sender, Community community) + { + final String playerName = Managers.get(CoreClientManager.class).Get(sender).getName(); + runAsync(() -> + { + _repo.deleteInviteToCommunity(community.getId(), playerName); + }); + + new CommunityUnInvite(community.getId(), sender.getName(), sender.getName(), sender.getUniqueId().toString(), false).publish(); + } + + public void handleJoinRequest(Player sender, Community community) + { + final int accountId = Managers.get(CoreClientManager.class).getAccountId(sender); + + if (Get(sender).Invites.contains(community.getId())) + { + String playerName = Managers.get(CoreClientManager.class).Get(sender).getName(); //Guarantee real name (important in this instance) + runAsync(() -> + { + _repo.addToCommunity(accountId, community.getId()); + _repo.deleteInviteToCommunity(community.getId(), playerName); + }); + new CommunityUnInvite(community.getId(), sender.getName(), sender.getName(), sender.getUniqueId().toString(), false).publish(); + new CommunityUpdateMembership(community.getId(), sender.getName(), sender.getName(), sender.getUniqueId().toString(), accountId, false, false).publish(); + return; + } + runAsync(() -> + { + _repo.addJoinRequest(community.getId(), accountId); + }); + new CommunityJoinRequest(community.getId(), sender.getName(), sender.getUniqueId().toString(), accountId).publish(); + } + + public void handleCloseJoinRequest(Player sender, Community community, CommunityJoinRequestInfo info, boolean announce) + { + runAsync(() -> + { + _repo.removeJoinRequest(community.getId(), info.AccountId); + }); + new CommunityCloseJoinRequest(community.getId(), sender.getName(), info.Name, info.UUID.toString(), info.AccountId, announce).publish(); + } + + public void handleJoin(Player sender, Community community, boolean fromInvite) + { + final int accountId = Managers.get(CoreClientManager.class).getAccountId(sender); + final String playerName = Managers.get(CoreClientManager.class).Get(sender).getName(); + runAsync(() -> + { + _repo.addToCommunity(accountId, community.getId()); + if (fromInvite) + { + _repo.deleteInviteToCommunity(community.getId(), playerName); + } + }); + new CommunityUpdateMembership(community.getId(), sender.getName(), sender.getName(), sender.getUniqueId().toString(), accountId, false, false).publish(); + if (fromInvite) + { + new CommunityUnInvite(community.getId(), sender.getName(), sender.getName(), sender.getUniqueId().toString(), false).publish(); + } + } + + public void handleKick(Player sender, Community community, CommunityMemberInfo info) + { + runAsync(() -> + { + _repo.removeFromCommunity(info.AccountId, community.getId()); + }); + new CommunityUpdateMembership(community.getId(), sender.getName(), info.Name, info.UUID.toString(), info.AccountId, true, false).publish(); + } + + public void handleLeave(Player sender, Community community, CommunityMemberInfo info) + { + runAsync(() -> + { + _repo.removeFromCommunity(info.AccountId, community.getId()); + }); + new CommunityUpdateMembership(community.getId(), sender.getName(), info.Name, info.UUID.toString(), info.AccountId, false, true).publish(); + } + + public void handleSettingUpdate(Player sender, Community community, CommunitySetting setting, String newValue) + { + runAsync(() -> + { + _repo.updateCommunitySetting(setting, community.getId(), newValue); + }); + new CommunityUpdateSetting(community.getId(), sender.getName(), setting.toString(), newValue).publish(); + } + + public void handleNameUpdate(Player sender, Community community, String newName) + { + runAsync(() -> + { + _repo.updateCommunityName(community.getId(), newName); + }); + new CommunityUpdateName(community.getId(), sender.getName(), newName).publish(); + } + + public void handleRoleUpdate(Player sender, Community community, CommunityMemberInfo info, CommunityRole role) + { + runAsync(() -> + { + _repo.updateCommunityRole(info.AccountId, community.getId(), role); + }); + new CommunityUpdateMemberRole(community.getId(), sender.getName(), info.UUID.toString(), role.toString()).publish(); + } + + public void handleCreate(Player sender, String senderName, int accountId, String name) + { + if (_creating.contains(sender.getUniqueId())) + { + UtilPlayer.message(sender, F.main(getName(), "You are already creating a Community!")); + return; + } + _creating.add(sender.getUniqueId()); + runAsync(() -> + { + _repo.createCommunity(name, accountId, id -> + { + if (id == -1) + { + UtilPlayer.message(sender, F.main(getName(), "Failed to create community " + F.elem(name))); + runSync(() -> _creating.remove(sender.getUniqueId())); + } + else + { + if (ownsCommunity(sender.getUniqueId())) + { + UtilPlayer.message(sender, F.main(getName(), "You already own a community!")); + _repo.deleteCommunity(id); + runSync(() -> _creating.remove(sender.getUniqueId())); + return; + } + new CommunityCreate(sender.getUniqueId().toString(), senderName, accountId, id, name).publish(); + runSync(() -> _creating.remove(sender.getUniqueId())); + } + }); + }); + } + + public void handleDisband(Player sender, Community community) + { + runAsync(() -> + { + _repo.deleteCommunity(community.getId()); + }); + new CommunityDisband(sender.getName(), community.getId()).publish(); + } + + public void handleToggleReadingChat(Player sender, Community community) + { + final int accountId = Managers.get(CoreClientManager.class).getAccountId(sender); + final boolean reading = !community.getMembers().get(sender.getUniqueId()).ReadingChat; + + runAsync(() -> + { + _repo.setReadingChat(accountId, community.getId(), reading); + }); + new CommunityUpdateMemberChatReading(community.getId(), sender.getUniqueId().toString(), reading).publish(); + } + + @Override + public String getQuery(int accountId, String uuid, String name) + { + return "SELECT cm.communityId, cm.communityRole, c.region FROM communityMembers AS cm INNER JOIN communities AS c ON c.id=cm.communityId WHERE accountId=" + accountId + ";"; + } + + @Override + public void processLoginResultSet(String playerName, UUID uuid, int accountId, ResultSet resultSet) throws SQLException + { + CommunityMemberData data = new CommunityMemberData(); + while (resultSet.next()) + { + Integer communityId = resultSet.getInt("communityId"); + CommunityRole role = CommunityRole.parseRole(resultSet.getString("communityRole")); + String region = resultSet.getString("region"); + if ((_us && region.equalsIgnoreCase("US")) || (!_us && region.equalsIgnoreCase("EU"))) + { + data.joinCommunity(communityId, role); + } + } + Set(uuid, data); + } + + @EventHandler + public void loadInvites(PlayerJoinEvent event) + { + final CommunityMemberData data = Get(event.getPlayer()); + if (data.Invites.size() > 0 && Managers.get(PreferencesManager.class).get(event.getPlayer()).isActive(Preference.COMMUNITY_INVITES)) + { + UtilPlayer.message(event.getPlayer(), F.main(getName(), "You have been invited to join " + F.elem(data.Invites.size()) + " communities!")); + } + } + + @EventHandler(priority = EventPriority.LOW, ignoreCancelled = true) + public void onChat(AsyncPlayerChatEvent event) + { + if (!event.getMessage().startsWith("!")) + { + return; + } + event.setCancelled(true); + Player sender = event.getPlayer(); + if (Get(sender).getCommunityChattingTo() != -1) + { + Community target = _loadedCommunities.get(Get(sender).getCommunityChattingTo()); + if (target == null || !target.getMembers().containsKey(event.getPlayer().getUniqueId())) + { + UtilPlayer.message(sender, F.main(getName(), "You are not in that community! Use " + F.elem("/com chat ") + " to select a new community to chat to!")); + } + else + { + if (Recharge.Instance.use(sender, "Community Chat to " + target.getId(), target.getChatDelay(), false, false)) + { + new CommunityChat(sender.getName(), target.getId(), event.getMessage().substring(1)).publish(); + } + else + { + UtilPlayer.message(sender, F.main(getName(), "You cannot chat to " + F.name(target.getName()) + " that quickly!")); + } + } + } + else + { + UtilPlayer.message(sender, F.main(getName(), "You are not chatting to a specific community! Use " + F.elem("/com chat ") + " to select a community to chat to.")); + } + } + + @Override + protected CommunityMemberData addPlayer(UUID uuid) + { + return new CommunityMemberData(); + } +} \ No newline at end of file diff --git a/Plugins/Mineplex.Core/src/mineplex/core/communities/CommunityMemberData.java b/Plugins/Mineplex.Core/src/mineplex/core/communities/CommunityMemberData.java new file mode 100644 index 000000000..72c44fe00 --- /dev/null +++ b/Plugins/Mineplex.Core/src/mineplex/core/communities/CommunityMemberData.java @@ -0,0 +1,84 @@ +package mineplex.core.communities; + +import java.util.ArrayList; +import java.util.List; +import java.util.Map; +import java.util.concurrent.ConcurrentHashMap; + +import mineplex.core.Managers; + +public class CommunityMemberData +{ + private final Map _communities = new ConcurrentHashMap<>(); + + public final List Invites = new ArrayList<>(); + + private int _chattingTo = -1; + + public CommunityMemberData() + { + + } + + public int getTotalCommunities() + { + return _communities.size(); + } + + public boolean ownsCommunity() + { + return _communities.containsValue(CommunityRole.LEADER); + } + + public int getCommunityChattingTo() + { + return _chattingTo; + } + + public void setCommunityChattingTo(Community community) + { + _chattingTo = community.getId(); + } + + public Community[] getCommunities() + { + Community[] communities = new Community[_communities.size()]; + int index = 0; + for (Integer comId : _communities.keySet()) + { + communities[index] = Managers.get(CommunityManager.class).getLoadedCommunity(comId); + index++; + } + return communities; + } + + public boolean isMemberOf(Community community) + { + return _communities.containsKey(community.getId()); + } + + public CommunityRole getRoleIn(Community community) + { + return _communities.get(community.getId()); + } + + public void joinCommunity(Integer communityId, CommunityRole role) + { + _communities.put(communityId, role); + } + + public void joinCommunity(Community community) + { + joinCommunity(community.getId(), CommunityRole.MEMBER); + } + + public void setRoleIn(Community community, CommunityRole role) + { + _communities.replace(community.getId(), role); + } + + public void leaveCommunity(Community community) + { + _communities.remove(community.getId()); + } +} \ No newline at end of file diff --git a/Plugins/Mineplex.Core/src/mineplex/core/communities/CommunityMemberDataUpdateEvent.java b/Plugins/Mineplex.Core/src/mineplex/core/communities/CommunityMemberDataUpdateEvent.java new file mode 100644 index 000000000..1fd22e0e1 --- /dev/null +++ b/Plugins/Mineplex.Core/src/mineplex/core/communities/CommunityMemberDataUpdateEvent.java @@ -0,0 +1,32 @@ +package mineplex.core.communities; + +import org.bukkit.entity.Player; +import org.bukkit.event.Event; +import org.bukkit.event.HandlerList; + +public class CommunityMemberDataUpdateEvent extends Event +{ + private static final HandlerList handlers = new HandlerList(); + + private Player _player; + + public CommunityMemberDataUpdateEvent(Player player) + { + _player = player; + } + + public Player getPlayer() + { + return _player; + } + + public HandlerList getHandlers() + { + return handlers; + } + + public static HandlerList getHandlerList() + { + return handlers; + } +} \ No newline at end of file diff --git a/Plugins/Mineplex.Core/src/mineplex/core/communities/CommunityMemberInfo.java b/Plugins/Mineplex.Core/src/mineplex/core/communities/CommunityMemberInfo.java new file mode 100644 index 000000000..03e98963f --- /dev/null +++ b/Plugins/Mineplex.Core/src/mineplex/core/communities/CommunityMemberInfo.java @@ -0,0 +1,119 @@ +package mineplex.core.communities; + +import java.util.UUID; + +import org.bukkit.Material; +import org.bukkit.inventory.ItemStack; + +import mineplex.core.common.util.C; +import mineplex.core.common.util.UtilTime; +import mineplex.core.itemstack.ItemBuilder; + +public class CommunityMemberInfo +{ + public String Name; + public final UUID UUID; + public final int AccountId; + public CommunityRole Role; + public boolean ReadingChat = true; + private ItemStack _memberIcon, _outsiderIcon; + private long _lastLogin; + private boolean _online = false; + private String _currentServer = ""; + + public CommunityMemberInfo(String name, UUID uuid, int accountId, CommunityRole role, long lastLogin) + { + Name = name; + UUID = uuid; + AccountId = accountId; + Role = role; + _lastLogin = lastLogin; + + buildIcons(); + } + + private void buildIcons() + { + ItemBuilder builder = new ItemBuilder(Material.SKULL_ITEM).setTitle(C.cGreenB + Name).setLore(C.cRed, C.cYellow + "Role " + C.cWhite + Role.getDisplay()); + _outsiderIcon = builder.build(); + builder.setTitle(!_online ? C.cRedB + Name : C.cGreenB + Name); + if (_online) + { + builder.addLore(C.cYellow + "Server " + C.cWhite + _currentServer); + } + else + { + builder.addLore(C.cYellow + "Last Seen " + C.cWhite + UtilTime.MakeStr(System.currentTimeMillis() - _lastLogin) + " Ago"); + } + if (_online) + { + builder.setData((short)3); + builder.setPlayerHead(Name); + } + _memberIcon = builder.build(); + } + + public void setOffline() + { + _online = false; + _currentServer = ""; + buildIcons(); + } + + public void updateName(String name) + { + if (name == null) + { + return; + } + Name = name; + buildIcons(); + } + + public void updateRole(CommunityRole role) + { + Role = role; + buildIcons(); + } + + public void update(long lastLogin, boolean online, String currentServer) + { + _lastLogin = lastLogin; + _online = online; + _currentServer = currentServer; + + buildIcons(); + } + + public boolean isOnline() + { + return _online; + } + + public ItemStack getRepresentation(CommunityRole viewerRole) + { + if (viewerRole == null) + { + return _outsiderIcon; + } + + ItemBuilder builder = new ItemBuilder(_memberIcon); + if ((viewerRole == CommunityRole.LEADER && Role != CommunityRole.LEADER) || (viewerRole.ordinal() < Role.ordinal())) + { + builder.addLore(C.cGold); + } + if (viewerRole == CommunityRole.LEADER && Role != CommunityRole.LEADER) + { + builder.addLore(C.cYellow + (Role == CommunityRole.COLEADER ? "Shift-" : "" ) + "Left Click " + C.cWhite + "Promote"); + if (Role != CommunityRole.MEMBER) + { + builder.addLore(C.cYellow + "Right Click " + C.cWhite + "Demote"); + } + } + if (viewerRole.ordinal() < Role.ordinal()) + { + builder.addLore(C.cYellow + "Shift-Right Click " + C.cWhite + "Kick"); + } + return builder.build(); + } +} \ No newline at end of file diff --git a/Plugins/Mineplex.Core/src/mineplex/core/communities/CommunityMembershipUpdateEvent.java b/Plugins/Mineplex.Core/src/mineplex/core/communities/CommunityMembershipUpdateEvent.java new file mode 100644 index 000000000..959044ea3 --- /dev/null +++ b/Plugins/Mineplex.Core/src/mineplex/core/communities/CommunityMembershipUpdateEvent.java @@ -0,0 +1,31 @@ +package mineplex.core.communities; + +import org.bukkit.event.Event; +import org.bukkit.event.HandlerList; + +public class CommunityMembershipUpdateEvent extends Event +{ + private static final HandlerList handlers = new HandlerList(); + + private Community _community; + + public CommunityMembershipUpdateEvent(Community community) + { + _community = community; + } + + public Community getCommunity() + { + return _community; + } + + public HandlerList getHandlers() + { + return handlers; + } + + public static HandlerList getHandlerList() + { + return handlers; + } +} \ No newline at end of file diff --git a/Plugins/Mineplex.Core/src/mineplex/core/communities/CommunityNameUpdateEvent.java b/Plugins/Mineplex.Core/src/mineplex/core/communities/CommunityNameUpdateEvent.java new file mode 100644 index 000000000..a583c6ee9 --- /dev/null +++ b/Plugins/Mineplex.Core/src/mineplex/core/communities/CommunityNameUpdateEvent.java @@ -0,0 +1,31 @@ +package mineplex.core.communities; + +import org.bukkit.event.Event; +import org.bukkit.event.HandlerList; + +public class CommunityNameUpdateEvent extends Event +{ + private static final HandlerList handlers = new HandlerList(); + + private Community _community; + + public CommunityNameUpdateEvent(Community community) + { + _community = community; + } + + public Community getCommunity() + { + return _community; + } + + public HandlerList getHandlers() + { + return handlers; + } + + public static HandlerList getHandlerList() + { + return handlers; + } +} \ No newline at end of file diff --git a/Plugins/Mineplex.Core/src/mineplex/core/communities/CommunityRole.java b/Plugins/Mineplex.Core/src/mineplex/core/communities/CommunityRole.java new file mode 100644 index 000000000..c98d7f0b9 --- /dev/null +++ b/Plugins/Mineplex.Core/src/mineplex/core/communities/CommunityRole.java @@ -0,0 +1,34 @@ +package mineplex.core.communities; + +public enum CommunityRole +{ + LEADER("Leader"), + COLEADER("Co-Leader"), + MEMBER("Member") + ; + + private String _displayName; + + private CommunityRole(String displayName) + { + _displayName = displayName; + } + + public String getDisplay() + { + return _displayName; + } + + public static CommunityRole parseRole(String role) + { + for (CommunityRole test : CommunityRole.values()) + { + if (test.toString().equalsIgnoreCase(role)) + { + return test; + } + } + + return CommunityRole.MEMBER; + } +} \ No newline at end of file diff --git a/Plugins/Mineplex.Core/src/mineplex/core/communities/CommunitySetting.java b/Plugins/Mineplex.Core/src/mineplex/core/communities/CommunitySetting.java new file mode 100644 index 000000000..fc049ac5e --- /dev/null +++ b/Plugins/Mineplex.Core/src/mineplex/core/communities/CommunitySetting.java @@ -0,0 +1,124 @@ +package mineplex.core.communities; + +import org.bukkit.ChatColor; + +import mineplex.core.common.Pair; +import mineplex.core.common.util.Callback; +import mineplex.core.communities.Community.PrivacySetting; +import mineplex.core.game.GameDisplay; + +public enum CommunitySetting +{ + CHAT_NAME_COLOR(1, pair -> + { + String value = pair.getLeft(); + Community community = pair.getRight(); + + ChatColor color = ChatColor.valueOf(value); + if (color == null || !color.isColor()) + { + return; + } + community.setChatFormatting(new ChatColor[] {color, community.getChatFormatting()[1], community.getChatFormatting()[2]}); + } + ), + CHAT_PLAYER_COLOR(2, pair -> + { + String value = pair.getLeft(); + Community community = pair.getRight(); + + ChatColor color = ChatColor.valueOf(value); + if (color == null || !color.isColor()) + { + return; + } + community.setChatFormatting(new ChatColor[] {community.getChatFormatting()[0], color, community.getChatFormatting()[2]}); + } + ), + CHAT_MESSAGE_COLOR(3, pair -> + { + String value = pair.getLeft(); + Community community = pair.getRight(); + + ChatColor color = ChatColor.valueOf(value); + if (color == null || !color.isColor()) + { + return; + } + community.setChatFormatting(new ChatColor[] {community.getChatFormatting()[0], community.getChatFormatting()[1], color}); + } + ), + CHAT_DELAY(4, pair -> + { + String value = pair.getLeft(); + Community community = pair.getRight(); + + try + { + Long delay = Long.parseLong(value); + community.setChatDelay(delay); + } + catch (Exception e) + { + return; + } + } + ), + FAVORITE_GAME(5, pair -> + { + String value = pair.getLeft(); + Community community = pair.getRight(); + + GameDisplay display = GameDisplay.matchName(value); + community.setFavoriteGame(display); + } + ), + PRIVACY(6, pair -> + { + String value = pair.getLeft(); + Community community = pair.getRight(); + + PrivacySetting setting = PrivacySetting.parsePrivacy(value); + community.setPrivacySetting(setting); + } + ), + DESCRIPTION(7, pair -> + { + String value = pair.getLeft(); + Community community = pair.getRight(); + + community.setDescription(value); + }); + + private int _id; + private Callback> _parser; + + private CommunitySetting(int id, Callback> parseValue) + { + _id = id; + _parser = parseValue; + } + + public int getId() + { + return _id; + } + + public void parseValueInto(String value, Community community) + { + _parser.run(Pair.create(value, community)); + } + + public static CommunitySetting getSetting(Integer id) + { + for (CommunitySetting setting : CommunitySetting.values()) + { + if (setting.getId() == id) + { + return setting; + } + } + + return null; + } +} \ No newline at end of file diff --git a/Plugins/Mineplex.Core/src/mineplex/core/communities/CommunitySettingUpdateEvent.java b/Plugins/Mineplex.Core/src/mineplex/core/communities/CommunitySettingUpdateEvent.java new file mode 100644 index 000000000..5f7185fdc --- /dev/null +++ b/Plugins/Mineplex.Core/src/mineplex/core/communities/CommunitySettingUpdateEvent.java @@ -0,0 +1,31 @@ +package mineplex.core.communities; + +import org.bukkit.event.Event; +import org.bukkit.event.HandlerList; + +public class CommunitySettingUpdateEvent extends Event +{ + private static final HandlerList handlers = new HandlerList(); + + private Community _community; + + public CommunitySettingUpdateEvent(Community community) + { + _community = community; + } + + public Community getCommunity() + { + return _community; + } + + public HandlerList getHandlers() + { + return handlers; + } + + public static HandlerList getHandlerList() + { + return handlers; + } +} \ No newline at end of file diff --git a/Plugins/Mineplex.Core/src/mineplex/core/communities/commands/CommunityChatCommand.java b/Plugins/Mineplex.Core/src/mineplex/core/communities/commands/CommunityChatCommand.java new file mode 100644 index 000000000..a1edba960 --- /dev/null +++ b/Plugins/Mineplex.Core/src/mineplex/core/communities/commands/CommunityChatCommand.java @@ -0,0 +1,42 @@ +package mineplex.core.communities.commands; + +import org.bukkit.ChatColor; +import org.bukkit.entity.Player; + +import mineplex.core.command.CommandBase; +import mineplex.core.common.Rank; +import mineplex.core.common.util.F; +import mineplex.core.common.util.UtilPlayer; +import mineplex.core.communities.Community; +import mineplex.core.communities.CommunityManager; + +public class CommunityChatCommand extends CommandBase +{ + public CommunityChatCommand(CommunityManager plugin) + { + super(plugin, Rank.ALL, "chat"); + } + + @Override + public void Execute(Player caller, String[] args) + { + if (args.length < 1) + { + UtilPlayer.message(caller, F.help("/com chat ", "Selects which community you chat to", Rank.ALL, ChatColor.AQUA)); + return; + } + Community c = Plugin.getLoadedCommunity(args[0]); + if (c == null) + { + UtilPlayer.message(caller, F.main(Plugin.getName(), "That community was not found!")); + return; + } + if (!c.getMembers().containsKey(caller.getUniqueId())) + { + UtilPlayer.message(caller, F.main(Plugin.getName(), "You are not in " + F.name(c.getName()) + "!")); + return; + } + UtilPlayer.message(caller, F.main(Plugin.getName(), "You are now chatting to " + F.name(c.getName()) + "! Use " + F.elem("!") + " before your message to use community chat!")); + Plugin.Get(caller).setCommunityChattingTo(c); + } +} \ No newline at end of file diff --git a/Plugins/Mineplex.Core/src/mineplex/core/communities/commands/CommunityCommand.java b/Plugins/Mineplex.Core/src/mineplex/core/communities/commands/CommunityCommand.java new file mode 100644 index 000000000..90af36ac7 --- /dev/null +++ b/Plugins/Mineplex.Core/src/mineplex/core/communities/commands/CommunityCommand.java @@ -0,0 +1,68 @@ +package mineplex.core.communities.commands; + +import org.bukkit.ChatColor; +import org.bukkit.entity.Player; + +import mineplex.core.command.MultiCommandBase; +import mineplex.core.common.Rank; +import mineplex.core.common.util.F; +import mineplex.core.common.util.UtilPlayer; +import mineplex.core.communities.Community; +import mineplex.core.communities.CommunityManager; +import mineplex.core.communities.gui.community.CommunityMembersPage; +import mineplex.core.communities.gui.overview.CommunityOverviewPage; + +public class CommunityCommand extends MultiCommandBase +{ + public CommunityCommand(CommunityManager plugin) + { + super(plugin, Rank.ALL, "community", "communities", "com"); + + AddCommand(new CommunityChatCommand(plugin)); + AddCommand(new CommunityCreateCommand(plugin)); + AddCommand(new CommunityDescriptionCommand(plugin)); + AddCommand(new CommunityDisbandCommand(plugin)); + AddCommand(new CommunityInviteCommand(plugin)); + AddCommand(new CommunityJoinCommand(plugin)); + AddCommand(new CommunityMCSCommand(plugin)); + //AddCommand(new CommunityMenuCommand(plugin)); + AddCommand(new CommunityRenameCommand(plugin)); + AddCommand(new CommunityUnInviteCommand(plugin)); + } + + @Override + protected void Help(Player caller, String[] args) + { + if (args.length > 0) + { + if (args[0].equalsIgnoreCase("help")) + { + UtilPlayer.message(caller, F.main(Plugin.getName(), "Community Commands:")); + UtilPlayer.message(caller, F.help("/com ", "Opens a community's menu", Rank.ALL, ChatColor.DARK_AQUA)); + //UtilPlayer.message(caller, F.help("/com menu", "Opens your community menu", Rank.ALL)); + UtilPlayer.message(caller, F.help("/com invite ", "Invites a player to a community you manage", Rank.ALL, ChatColor.DARK_AQUA)); + UtilPlayer.message(caller, F.help("/com uninvite ", "Revokes a player's invitation to a community you manage", Rank.ALL, ChatColor.DARK_AQUA)); + UtilPlayer.message(caller, F.help("/com join ", "Joins a community that is open or you have been invited to", Rank.ALL, ChatColor.DARK_AQUA)); + UtilPlayer.message(caller, F.help("/com chat ", "Selects which community you chat to", Rank.ALL, ChatColor.DARK_AQUA)); + UtilPlayer.message(caller, F.help("/com create ", "Creates a new community", Rank.ETERNAL, ChatColor.DARK_AQUA)); + UtilPlayer.message(caller, F.help("/com rename ", "Changes the name of a community you own", Rank.ETERNAL, ChatColor.DARK_AQUA)); + UtilPlayer.message(caller, F.help("/com mcs ", "Opens the Mineplex Community Server of a community you manage", Rank.ALL, ChatColor.DARK_AQUA)); + UtilPlayer.message(caller, F.help("/com description ", "Sets the description of a community you manage", Rank.ALL, ChatColor.DARK_AQUA)); + UtilPlayer.message(caller, F.help("/com disband ", "Disbands a community you own", Rank.ETERNAL, ChatColor.DARK_AQUA)); + return; + } + Community community = Plugin.getLoadedCommunity(args[0]); + if (community == null) + { + UtilPlayer.message(caller, F.main(Plugin.getName(), "Could not find community " + F.name(args[0]) + "!")); + } + else + { + new CommunityMembersPage(caller, community); + } + return; + } + + new CommunityOverviewPage(caller); + } +} \ No newline at end of file diff --git a/Plugins/Mineplex.Core/src/mineplex/core/communities/commands/CommunityCreateCommand.java b/Plugins/Mineplex.Core/src/mineplex/core/communities/commands/CommunityCreateCommand.java new file mode 100644 index 000000000..af4d189d4 --- /dev/null +++ b/Plugins/Mineplex.Core/src/mineplex/core/communities/commands/CommunityCreateCommand.java @@ -0,0 +1,68 @@ +package mineplex.core.communities.commands; + +import java.util.Arrays; + +import org.bukkit.ChatColor; +import org.bukkit.entity.Player; + +import mineplex.core.Managers; +import mineplex.core.account.CoreClientManager; +import mineplex.core.chat.Chat; +import mineplex.core.command.CommandBase; +import mineplex.core.common.Rank; +import mineplex.core.common.util.F; +import mineplex.core.common.util.UtilPlayer; +import mineplex.core.communities.Community; +import mineplex.core.communities.CommunityManager; + +public class CommunityCreateCommand extends CommandBase +{ + public CommunityCreateCommand(CommunityManager plugin) + { + super(plugin, Rank.ETERNAL, "create"); + } + + @Override + public void Execute(Player caller, String[] args) + { + if (args.length < 1) + { + UtilPlayer.message(caller, F.help("/com create ", "Creates a new community", Rank.ETERNAL, ChatColor.AQUA)); + return; + } + Community c = Plugin.getLoadedCommunity(args[0]); + if (c != null) + { + UtilPlayer.message(caller, F.main(Plugin.getName(), "A community already exists with that name!")); + return; + } + if (Plugin.Get(caller).ownsCommunity()) + { + UtilPlayer.message(caller, F.main(Plugin.getName(), "You already own a community!")); + return; + } + if (args[0].length() > 15 || Plugin.ALPHA_NUMERIC_PATTERN.matcher(args[0]).find()) + { + UtilPlayer.message(caller, F.main(Plugin.getName(), "A community name cannot be longer than 15 characters and must be alphanumeric!")); + return; + } + if (Arrays.asList(Plugin.BLOCKED_NAMES).contains(args[0].toLowerCase())) + { + UtilPlayer.message(caller, F.main(Plugin.getName(), "That name is not allowed!")); + return; + } + final int accountId = Managers.get(CoreClientManager.class).getAccountId(caller); + final String senderName = Managers.get(CoreClientManager.class).Get(caller).getName(); + Plugin.runAsync(() -> + { + if (Managers.get(Chat.class).getFilteredMessage(caller, args[0]).contains("*")) + { + UtilPlayer.message(caller, F.main(Plugin.getName(), "That name is not allowed!")); + } + else + { + Plugin.runSync(() -> Plugin.handleCreate(caller, senderName, accountId, args[0])); + } + }); + } +} \ No newline at end of file diff --git a/Plugins/Mineplex.Core/src/mineplex/core/communities/commands/CommunityDescriptionCommand.java b/Plugins/Mineplex.Core/src/mineplex/core/communities/commands/CommunityDescriptionCommand.java new file mode 100644 index 000000000..efaae74b2 --- /dev/null +++ b/Plugins/Mineplex.Core/src/mineplex/core/communities/commands/CommunityDescriptionCommand.java @@ -0,0 +1,77 @@ +package mineplex.core.communities.commands; + +import org.bukkit.ChatColor; +import org.bukkit.entity.Player; + +import mineplex.core.Managers; +import mineplex.core.account.CoreClientManager; +import mineplex.core.chat.Chat; +import mineplex.core.command.CommandBase; +import mineplex.core.common.Rank; +import mineplex.core.common.util.F; +import mineplex.core.common.util.UtilPlayer; +import mineplex.core.communities.Community; +import mineplex.core.communities.CommunityManager; +import mineplex.core.communities.CommunityMemberInfo; +import mineplex.core.communities.CommunityRole; +import mineplex.core.communities.CommunitySetting; + +public class CommunityDescriptionCommand extends CommandBase +{ + public CommunityDescriptionCommand(CommunityManager plugin) + { + super(plugin, Rank.ALL, "description"); + } + + @Override + public void Execute(Player caller, String[] args) + { + if (args.length < 2) + { + UtilPlayer.message(caller, F.help("/com description ", "Sets the description of a community you manage", Rank.ALL, ChatColor.AQUA)); + return; + } + Community c = Plugin.getLoadedCommunity(args[0]); + String desc = args[1]; + for (int i = 2; i < args.length; i++) + { + desc += (" " + args[i]); + } + if (c == null) + { + UtilPlayer.message(caller, F.main(Plugin.getName(), "That community was not found!")); + return; + } + if (c.getMembers().getOrDefault(caller.getUniqueId(), new CommunityMemberInfo(caller.getName(), caller.getUniqueId(), -1, CommunityRole.MEMBER, -1L)).Role.ordinal() > CommunityRole.COLEADER.ordinal()) + { + if (!Managers.get(CoreClientManager.class).Get(caller).GetRank().has(Rank.ADMIN)) + { + UtilPlayer.message(caller, F.main(Plugin.getName(), "You are not a co-leader of " + F.name(c.getName()) + "!")); + return; + } + } + if (desc.length() > 30) + { + UtilPlayer.message(caller, F.main(Plugin.getName(), "A community description cannot be longer than 30 characters!")); + return; + } + if (Plugin.ALPHA_NUMERIC_PATTERN.matcher(desc.replace(" ", "").replace("!", "").replace("?", "").replace(".", "").replace("'", "").replace("\"", "")).find()) + { + UtilPlayer.message(caller, F.main(Plugin.getName(), "A community description must be alphanumeric!")); + return; + } + final String description = desc; + Plugin.runAsync(() -> + { + if (Managers.get(Chat.class).getFilteredMessage(caller, description).contains("*")) + { + UtilPlayer.message(caller, F.main(Plugin.getName(), "That description is not allowed!")); + } + else + { + UtilPlayer.message(caller, F.main(Plugin.getName(), "You have changed the description of " + F.name(c.getName()) + " to " + F.elem(description) + "!")); + Plugin.handleSettingUpdate(caller, c, CommunitySetting.DESCRIPTION, description); + } + }); + } +} \ No newline at end of file diff --git a/Plugins/Mineplex.Core/src/mineplex/core/communities/commands/CommunityDisbandCommand.java b/Plugins/Mineplex.Core/src/mineplex/core/communities/commands/CommunityDisbandCommand.java new file mode 100644 index 000000000..a70b77542 --- /dev/null +++ b/Plugins/Mineplex.Core/src/mineplex/core/communities/commands/CommunityDisbandCommand.java @@ -0,0 +1,52 @@ +package mineplex.core.communities.commands; + +import org.bukkit.ChatColor; +import org.bukkit.entity.Player; + +import mineplex.core.Managers; +import mineplex.core.account.CoreClientManager; +import mineplex.core.command.CommandBase; +import mineplex.core.common.Rank; +import mineplex.core.common.util.F; +import mineplex.core.common.util.UtilPlayer; +import mineplex.core.communities.Community; +import mineplex.core.communities.CommunityManager; +import mineplex.core.communities.CommunityMemberInfo; +import mineplex.core.communities.CommunityRole; + +public class CommunityDisbandCommand extends CommandBase +{ + public CommunityDisbandCommand(CommunityManager plugin) + { + super(plugin, Rank.ETERNAL, "disband"); + } + + @Override + public void Execute(Player caller, String[] args) + { + if (args.length < 1) + { + UtilPlayer.message(caller, F.help("/com disband ", "Disbands a community you own", Rank.ETERNAL, ChatColor.AQUA)); + return; + } + Community c = Plugin.getLoadedCommunity(args[0]); + if (c == null) + { + UtilPlayer.message(caller, F.main(Plugin.getName(), "That community was not found!")); + return; + } + if (c.getMembers().getOrDefault(caller.getUniqueId(), new CommunityMemberInfo(caller.getName(), caller.getUniqueId(), -1, CommunityRole.MEMBER, -1L)).Role != CommunityRole.LEADER) + { + if (!Managers.get(CoreClientManager.class).Get(caller).GetRank().has(Rank.ADMIN)) + { + UtilPlayer.message(caller, F.main(Plugin.getName(), "You are not the leader of " + F.name(c.getName()) + "!")); + return; + } + } + if (!c.getMembers().containsKey(caller.getUniqueId())) + { + UtilPlayer.message(caller, F.main(Plugin.getName(), "You have disbanded community " + F.name(c.getName()) + "!")); + } + Plugin.handleDisband(caller, c); + } +} \ No newline at end of file diff --git a/Plugins/Mineplex.Core/src/mineplex/core/communities/commands/CommunityInviteCommand.java b/Plugins/Mineplex.Core/src/mineplex/core/communities/commands/CommunityInviteCommand.java new file mode 100644 index 000000000..f3b6e6b65 --- /dev/null +++ b/Plugins/Mineplex.Core/src/mineplex/core/communities/commands/CommunityInviteCommand.java @@ -0,0 +1,57 @@ +package mineplex.core.communities.commands; + +import org.bukkit.ChatColor; +import org.bukkit.entity.Player; + +import mineplex.core.Managers; +import mineplex.core.account.CoreClientManager; +import mineplex.core.command.CommandBase; +import mineplex.core.common.Rank; +import mineplex.core.common.util.F; +import mineplex.core.common.util.UtilPlayer; +import mineplex.core.communities.Community; +import mineplex.core.communities.CommunityManager; +import mineplex.core.communities.CommunityMemberInfo; +import mineplex.core.communities.CommunityRole; + +public class CommunityInviteCommand extends CommandBase +{ + public CommunityInviteCommand(CommunityManager plugin) + { + super(plugin, Rank.ALL, "invite"); + } + + @Override + public void Execute(Player caller, String[] args) + { + if (args.length < 2) + { + UtilPlayer.message(caller, F.help("/com invite ", "Invites a player to a community you manage", Rank.ALL, ChatColor.AQUA)); + return; + } + String player = args[0]; + Community c = Plugin.getLoadedCommunity(args[1]); + if (c == null) + { + UtilPlayer.message(caller, F.main(Plugin.getName(), "That community was not found!")); + return; + } + if (c.getMembers().getOrDefault(caller.getUniqueId(), new CommunityMemberInfo(caller.getName(), caller.getUniqueId(), -1, CommunityRole.MEMBER, -1L)).Role.ordinal() > CommunityRole.COLEADER.ordinal()) + { + if (!Managers.get(CoreClientManager.class).Get(caller).GetRank().has(Rank.ADMIN)) + { + UtilPlayer.message(caller, F.main(Plugin.getName(), "You are not a co-leader of " + F.name(c.getName()) + "!")); + return; + } + } + for (CommunityMemberInfo info : c.getMembers().values()) + { + if (info.Name.equalsIgnoreCase(player)) + { + UtilPlayer.message(caller, F.main(Plugin.getName(), F.name(player) + " is already a member of " + F.name(c.getName()) + "!")); + return; + } + } + Plugin.handleInvite(caller, c, player); + } +} \ No newline at end of file diff --git a/Plugins/Mineplex.Core/src/mineplex/core/communities/commands/CommunityJoinCommand.java b/Plugins/Mineplex.Core/src/mineplex/core/communities/commands/CommunityJoinCommand.java new file mode 100644 index 000000000..b1b167e7b --- /dev/null +++ b/Plugins/Mineplex.Core/src/mineplex/core/communities/commands/CommunityJoinCommand.java @@ -0,0 +1,47 @@ +package mineplex.core.communities.commands; + +import org.bukkit.ChatColor; +import org.bukkit.entity.Player; + +import mineplex.core.command.CommandBase; +import mineplex.core.common.Rank; +import mineplex.core.common.util.F; +import mineplex.core.common.util.UtilPlayer; +import mineplex.core.communities.Community; +import mineplex.core.communities.Community.PrivacySetting; +import mineplex.core.communities.CommunityManager; + +public class CommunityJoinCommand extends CommandBase +{ + public CommunityJoinCommand(CommunityManager plugin) + { + super(plugin, Rank.ALL, "join"); + } + + @Override + public void Execute(Player caller, String[] args) + { + if (args.length < 1) + { + UtilPlayer.message(caller, F.help("/com join ", "Joins a community that is open or you have been invited to", Rank.ALL, ChatColor.AQUA)); + return; + } + Community c = Plugin.getLoadedCommunity(args[0]); + if (c == null) + { + UtilPlayer.message(caller, F.main(Plugin.getName(), "That community was not found!")); + return; + } + if (c.getMembers().containsKey(caller.getUniqueId())) + { + UtilPlayer.message(caller, F.main(Plugin.getName(), "You are already in " + F.name(c.getName()) + "!")); + return; + } + if (c.getPrivacySetting() != PrivacySetting.OPEN && !Plugin.Get(caller).Invites.contains(c.getId())) + { + UtilPlayer.message(caller, F.main(Plugin.getName(), "You are have not been invited to " + F.name(c.getName()) + "!")); + return; + } + Plugin.handleJoin(caller, c, Plugin.Get(caller).Invites.contains(c.getId())); + } +} \ No newline at end of file diff --git a/Plugins/Mineplex.Core/src/mineplex/core/communities/commands/CommunityMCSCommand.java b/Plugins/Mineplex.Core/src/mineplex/core/communities/commands/CommunityMCSCommand.java new file mode 100644 index 000000000..683283e3c --- /dev/null +++ b/Plugins/Mineplex.Core/src/mineplex/core/communities/commands/CommunityMCSCommand.java @@ -0,0 +1,50 @@ +package mineplex.core.communities.commands; + +import org.bukkit.ChatColor; +import org.bukkit.entity.Player; + +import mineplex.core.Managers; +import mineplex.core.account.CoreClientManager; +import mineplex.core.command.CommandBase; +import mineplex.core.common.Rank; +import mineplex.core.common.util.F; +import mineplex.core.common.util.UtilPlayer; +import mineplex.core.communities.Community; +import mineplex.core.communities.CommunityManager; +import mineplex.core.communities.CommunityMemberInfo; +import mineplex.core.communities.CommunityRole; +import mineplex.core.personalServer.PersonalServerManager; + +public class CommunityMCSCommand extends CommandBase +{ + public CommunityMCSCommand(CommunityManager plugin) + { + super(plugin, Rank.ALL, "mcs"); + } + + @Override + public void Execute(Player caller, String[] args) + { + if (args.length < 1) + { + UtilPlayer.message(caller, F.help("/com mcs ", "Opens the Mineplex Community Server of a community you manage", Rank.ALL, ChatColor.AQUA)); + return; + } + Community c = Plugin.getLoadedCommunity(args[0]); + if (c == null) + { + UtilPlayer.message(caller, F.main(Plugin.getName(), "That community was not found!")); + return; + } + if (c.getMembers().getOrDefault(caller.getUniqueId(), new CommunityMemberInfo(caller.getName(), caller.getUniqueId(), -1, CommunityRole.MEMBER, -1L)).Role.ordinal() > CommunityRole.COLEADER.ordinal()) + { + if (!Managers.get(CoreClientManager.class).Get(caller).GetRank().has(Rank.ADMIN)) + { + UtilPlayer.message(caller, F.main(Plugin.getName(), "You are not a co-leader of " + F.name(c.getName()) + "!")); + return; + } + } + + Managers.get(PersonalServerManager.class).hostCommunityServer(caller, c); + } +} \ No newline at end of file diff --git a/Plugins/Mineplex.Core/src/mineplex/core/communities/commands/CommunityMenuCommand.java b/Plugins/Mineplex.Core/src/mineplex/core/communities/commands/CommunityMenuCommand.java new file mode 100644 index 000000000..1e93f267e --- /dev/null +++ b/Plugins/Mineplex.Core/src/mineplex/core/communities/commands/CommunityMenuCommand.java @@ -0,0 +1,22 @@ +package mineplex.core.communities.commands; + +import org.bukkit.entity.Player; + +import mineplex.core.command.CommandBase; +import mineplex.core.common.Rank; +import mineplex.core.communities.CommunityManager; +import mineplex.core.communities.gui.overview.CommunityOverviewPage; + +public class CommunityMenuCommand extends CommandBase +{ + public CommunityMenuCommand(CommunityManager plugin) + { + super(plugin, Rank.ALL, "menu"); + } + + @Override + public void Execute(Player caller, String[] args) + { + new CommunityOverviewPage(caller); + } +} \ No newline at end of file diff --git a/Plugins/Mineplex.Core/src/mineplex/core/communities/commands/CommunityRenameCommand.java b/Plugins/Mineplex.Core/src/mineplex/core/communities/commands/CommunityRenameCommand.java new file mode 100644 index 000000000..bfa1863bf --- /dev/null +++ b/Plugins/Mineplex.Core/src/mineplex/core/communities/commands/CommunityRenameCommand.java @@ -0,0 +1,81 @@ +package mineplex.core.communities.commands; + +import java.util.Arrays; + +import org.bukkit.ChatColor; +import org.bukkit.entity.Player; + +import mineplex.core.Managers; +import mineplex.core.account.CoreClientManager; +import mineplex.core.chat.Chat; +import mineplex.core.command.CommandBase; +import mineplex.core.common.Rank; +import mineplex.core.common.util.F; +import mineplex.core.common.util.UtilPlayer; +import mineplex.core.communities.Community; +import mineplex.core.communities.CommunityManager; +import mineplex.core.communities.CommunityMemberInfo; +import mineplex.core.communities.CommunityRole; + +public class CommunityRenameCommand extends CommandBase +{ + public CommunityRenameCommand(CommunityManager plugin) + { + super(plugin, Rank.ETERNAL, "rename"); + } + + @Override + public void Execute(Player caller, String[] args) + { + if (args.length < 2) + { + UtilPlayer.message(caller, F.help("/com rename ", "Changes the name of a community you own", Rank.ETERNAL, ChatColor.AQUA)); + return; + } + Community c = Plugin.getLoadedCommunity(args[0]); + String newName = args[1]; + if (c == null) + { + UtilPlayer.message(caller, F.main(Plugin.getName(), "That community was not found!")); + return; + } + if (c.getMembers().getOrDefault(caller.getUniqueId(), new CommunityMemberInfo(caller.getName(), caller.getUniqueId(), -1, CommunityRole.MEMBER, -1L)).Role != CommunityRole.LEADER) + { + if (!Managers.get(CoreClientManager.class).Get(caller).GetRank().has(Rank.ADMIN)) + { + UtilPlayer.message(caller, F.main(Plugin.getName(), "You are not the leader of " + F.name(c.getName()) + "!")); + return; + } + } + if (Plugin.getLoadedCommunity(newName) != null) + { + UtilPlayer.message(caller, F.main(Plugin.getName(), "A community already exists with that name!")); + return; + } + if (newName.length() > 15 || Plugin.ALPHA_NUMERIC_PATTERN.matcher(newName).find()) + { + UtilPlayer.message(caller, F.main(Plugin.getName(), "A community name cannot be longer than 15 characters and must be alphanumeric!")); + return; + } + if (Arrays.asList(Plugin.BLOCKED_NAMES).contains(newName.toLowerCase())) + { + UtilPlayer.message(caller, F.main(Plugin.getName(), "That name is not allowed!")); + return; + } + Plugin.runAsync(() -> + { + if (Managers.get(Chat.class).getFilteredMessage(caller, newName).contains("*")) + { + UtilPlayer.message(caller, F.main(Plugin.getName(), "That name is not allowed!")); + } + else + { + if (!c.getMembers().containsKey(caller.getUniqueId())) + { + UtilPlayer.message(caller, F.main(Plugin.getName(), "You have changed the name of " + F.name(c.getName()) + " to " + F.name(newName) + "!")); + } + Plugin.handleNameUpdate(caller, c, newName); + } + }); + } +} \ No newline at end of file diff --git a/Plugins/Mineplex.Core/src/mineplex/core/communities/commands/CommunityUnInviteCommand.java b/Plugins/Mineplex.Core/src/mineplex/core/communities/commands/CommunityUnInviteCommand.java new file mode 100644 index 000000000..99b5e9636 --- /dev/null +++ b/Plugins/Mineplex.Core/src/mineplex/core/communities/commands/CommunityUnInviteCommand.java @@ -0,0 +1,49 @@ +package mineplex.core.communities.commands; + +import org.bukkit.ChatColor; +import org.bukkit.entity.Player; + +import mineplex.core.Managers; +import mineplex.core.account.CoreClientManager; +import mineplex.core.command.CommandBase; +import mineplex.core.common.Rank; +import mineplex.core.common.util.F; +import mineplex.core.common.util.UtilPlayer; +import mineplex.core.communities.Community; +import mineplex.core.communities.CommunityManager; +import mineplex.core.communities.CommunityMemberInfo; +import mineplex.core.communities.CommunityRole; + +public class CommunityUnInviteCommand extends CommandBase +{ + public CommunityUnInviteCommand(CommunityManager plugin) + { + super(plugin, Rank.ALL, "uninvite"); + } + + @Override + public void Execute(Player caller, String[] args) + { + if (args.length < 2) + { + UtilPlayer.message(caller, F.help("/com uninvite ", "Revokes a player's invitation to a community you manage", Rank.ALL, ChatColor.AQUA)); + return; + } + String player = args[0]; + Community c = Plugin.getLoadedCommunity(args[1]); + if (c == null) + { + UtilPlayer.message(caller, F.main(Plugin.getName(), "That community was not found!")); + return; + } + if (c.getMembers().getOrDefault(caller.getUniqueId(), new CommunityMemberInfo(caller.getName(), caller.getUniqueId(), -1, CommunityRole.MEMBER, -1L)).Role.ordinal() > CommunityRole.COLEADER.ordinal()) + { + if (!Managers.get(CoreClientManager.class).Get(caller).GetRank().has(Rank.ADMIN)) + { + UtilPlayer.message(caller, F.main(Plugin.getName(), "You are not a co-leader of " + F.name(c.getName()) + "!")); + return; + } + } + Plugin.handleUninvite(caller, c, player); + } +} \ No newline at end of file diff --git a/Plugins/Mineplex.Core/src/mineplex/core/communities/gui/ActionButton.java b/Plugins/Mineplex.Core/src/mineplex/core/communities/gui/ActionButton.java new file mode 100644 index 000000000..b7e1a94bc --- /dev/null +++ b/Plugins/Mineplex.Core/src/mineplex/core/communities/gui/ActionButton.java @@ -0,0 +1,27 @@ +package mineplex.core.communities.gui; + +import org.bukkit.event.inventory.ClickType; +import org.bukkit.inventory.ItemStack; + +import mineplex.core.common.util.Callback; + +public class ActionButton extends CommunitiesGUIButton +{ + private Callback _onClick; + + public ActionButton(ItemStack icon, Callback onClick) + { + super(icon); + + _onClick = onClick; + } + + @Override + public void update() {} + + @Override + public void handleClick(ClickType type) + { + _onClick.run(type); + } +} \ No newline at end of file diff --git a/Plugins/Mineplex.Core/src/mineplex/core/communities/gui/CommunitiesGUIButton.java b/Plugins/Mineplex.Core/src/mineplex/core/communities/gui/CommunitiesGUIButton.java new file mode 100644 index 000000000..a18b7e1f2 --- /dev/null +++ b/Plugins/Mineplex.Core/src/mineplex/core/communities/gui/CommunitiesGUIButton.java @@ -0,0 +1,26 @@ +package mineplex.core.communities.gui; + +import org.bukkit.event.inventory.ClickType; +import org.bukkit.inventory.ItemStack; + +import mineplex.core.Managers; +import mineplex.core.communities.CommunityManager; + +public abstract class CommunitiesGUIButton +{ + public ItemStack Button = null; + + public CommunitiesGUIButton(ItemStack button) + { + Button = button; + } + + public static CommunityManager getCommunityManager() + { + return Managers.get(CommunityManager.class); + } + + public abstract void update(); + + public abstract void handleClick(ClickType type); +} \ No newline at end of file diff --git a/Plugins/Mineplex.Core/src/mineplex/core/communities/gui/CommunitiesGUIPage.java b/Plugins/Mineplex.Core/src/mineplex/core/communities/gui/CommunitiesGUIPage.java new file mode 100644 index 000000000..15bdbaf82 --- /dev/null +++ b/Plugins/Mineplex.Core/src/mineplex/core/communities/gui/CommunitiesGUIPage.java @@ -0,0 +1,107 @@ +package mineplex.core.communities.gui; + +import java.util.HashMap; +import java.util.Map; + +import org.bukkit.Bukkit; +import org.bukkit.entity.Player; +import org.bukkit.event.EventHandler; +import org.bukkit.event.HandlerList; +import org.bukkit.event.Listener; +import org.bukkit.event.inventory.InventoryClickEvent; +import org.bukkit.inventory.Inventory; + +import mineplex.core.Managers; +import mineplex.core.common.util.UtilServer; +import mineplex.core.communities.CommunityManager; +import mineplex.core.recharge.Recharge; +import mineplex.core.updater.UpdateType; +import mineplex.core.updater.event.UpdateEvent; + +public abstract class CommunitiesGUIPage implements Listener +{ + protected Player Viewer; + protected Inventory Inv; + protected Map Buttons = new HashMap<>(); + + public CommunitiesGUIPage(String name, int rows, Player viewer) + { + Viewer = viewer; + Inv = Bukkit.createInventory(viewer, 9 * rows, name); + } + + private void disable() + { + HandlerList.unregisterAll(this); + } + + public static CommunityManager getCommunityManager() + { + return Managers.get(CommunityManager.class); + } + + public void open() + { + Viewer.openInventory(Inv); + UtilServer.RegisterEvents(this); + } + + public void updateButtons(boolean callUpdate) + { + Inv.clear(); + Buttons.entrySet().stream().forEach(entry -> + { + if (callUpdate) + { + entry.getValue().update(); + } + Inv.setItem(entry.getKey(), entry.getValue().Button); + }); + Viewer.updateInventory(); + } + + @EventHandler + public void onUpdate(UpdateEvent event) + { + if (event.getType() == UpdateType.TICK) + { + if (Viewer.getOpenInventory() == null || Viewer.getOpenInventory().getTopInventory() == null || !Viewer.getOpenInventory().getTopInventory().getTitle().equals(Inv.getTitle())) + { + disable(); + return; + } + } + if (event.getType() == UpdateType.SEC_05) + { + Buttons.entrySet().forEach(entry -> + { + entry.getValue().update(); + Inv.setItem(entry.getKey(), entry.getValue().Button); + }); + } + } + + @EventHandler + public void handleClick(InventoryClickEvent event) + { + if (event.getClickedInventory() == null || !event.getClickedInventory().getTitle().equals(Inv.getTitle())) + { + return; + } + if (!Viewer.getName().equals(event.getWhoClicked().getName())) + { + return; + } + event.setCancelled(true); + if (!Recharge.Instance.use(Viewer, "Communities Button Click", 500, false, false)) + { + return; + } + Integer slot = event.getSlot(); + if (!Buttons.containsKey(slot)) + { + return; + } + Buttons.get(slot).handleClick(event.getClick()); + } +} \ No newline at end of file diff --git a/Plugins/Mineplex.Core/src/mineplex/core/communities/gui/browser/CommunityBrowserButton.java b/Plugins/Mineplex.Core/src/mineplex/core/communities/gui/browser/CommunityBrowserButton.java new file mode 100644 index 000000000..e999b2a8f --- /dev/null +++ b/Plugins/Mineplex.Core/src/mineplex/core/communities/gui/browser/CommunityBrowserButton.java @@ -0,0 +1,41 @@ +package mineplex.core.communities.gui.browser; + +import org.bukkit.entity.Player; +import org.bukkit.event.inventory.ClickType; +import org.bukkit.inventory.ItemStack; + +import mineplex.core.common.util.C; +import mineplex.core.common.util.LineFormat; +import mineplex.core.common.util.UtilText; +import mineplex.core.communities.Community; +import mineplex.core.communities.gui.CommunitiesGUIButton; +import mineplex.core.communities.gui.community.CommunityMembersPage; +import mineplex.core.itemstack.ItemBuilder; + +public class CommunityBrowserButton extends CommunitiesGUIButton +{ + private Player _viewer; + private Community _community; + + @SuppressWarnings("deprecation") + public CommunityBrowserButton(Player viewer, Community community) + { + super(new ItemBuilder(new ItemStack(community.getFavoriteGame().getMaterial(), 1, community.getFavoriteGame().getMaterialData(), null)).setTitle(C.cGreenB + community.getName()).addLore(UtilText.splitLinesToArray(new String[] {C.cRed, C.cYellow + "Members " + C.cWhite + community.getMembers().size(), C.cYellow + "Favorite Game " + C.cWhite + community.getFavoriteGame().getName(), C.cYellow + "Privacy " + C.cWhite + community.getPrivacySetting().getDisplayText(), C.cYellow + "Description " + C.cWhite + community.getDescription(), C.cBlue, C.cGreen + "Click to view community"}, LineFormat.LORE)).build()); + + _viewer = viewer; + _community = community; + } + + @SuppressWarnings("deprecation") + @Override + public void update() + { + Button = new ItemBuilder(new ItemStack(_community.getFavoriteGame().getMaterial(), 1, _community.getFavoriteGame().getMaterialData(), null)).setTitle(C.cGreenB + _community.getName()).addLore(UtilText.splitLinesToArray(new String[] {C.cRed, C.cYellow + "Members " + C.cWhite + _community.getMembers().size(), C.cYellow + "Favorite Game " + C.cWhite + _community.getFavoriteGame().getName(), C.cYellow + "Privacy " + C.cWhite + _community.getPrivacySetting().getDisplayText(), C.cYellow + "Description " + C.cWhite + _community.getDescription(), C.cBlue, C.cGreen + "Click to view community"}, LineFormat.LORE)).build(); + } + + @Override + public void handleClick(ClickType type) + { + new CommunityMembersPage(_viewer, _community).open(); + } +} \ No newline at end of file diff --git a/Plugins/Mineplex.Core/src/mineplex/core/communities/gui/browser/CommunityBrowserPage.java b/Plugins/Mineplex.Core/src/mineplex/core/communities/gui/browser/CommunityBrowserPage.java new file mode 100644 index 000000000..482a40142 --- /dev/null +++ b/Plugins/Mineplex.Core/src/mineplex/core/communities/gui/browser/CommunityBrowserPage.java @@ -0,0 +1,124 @@ +package mineplex.core.communities.gui.browser; + +import java.util.ArrayList; +import java.util.List; + +import org.bukkit.Material; +import org.bukkit.entity.Player; +import org.bukkit.event.EventHandler; + +import mineplex.core.common.util.C; +import mineplex.core.communities.CommunityBrowserUpdateEvent; +import mineplex.core.communities.CommunityDisbandEvent; +import mineplex.core.communities.gui.ActionButton; +import mineplex.core.communities.gui.CommunitiesGUIPage; +import mineplex.core.communities.gui.overview.CommunityInvitesPage; +import mineplex.core.communities.gui.overview.CommunityOverviewPage; +import mineplex.core.itemstack.ItemBuilder; + +public class CommunityBrowserPage extends CommunitiesGUIPage +{ + private static final int COMMUNITIES_PER_PAGE = 27; + + private int _page = 1; + + private List _displaying = new ArrayList<>(); + + //protected PrivacySetting PrivacyFilter = null; + //protected GameDisplay GameFilter = null; + + public CommunityBrowserPage(Player viewer) + { + super("Community Browser", 6, viewer); + + setup(1, true); + open(); + } + + private void setup(int page, boolean initial) + { + if (initial) + { + Buttons.clear(); + Inv.clear(); + } + { + //1 + ActionButton communitiesButton = new ActionButton(new ItemBuilder(Material.EMERALD).setTitle(C.cGreenB + "Your Communities").build(), clickType -> + { + new CommunityOverviewPage(Viewer).open(); + }); + Buttons.put(1, communitiesButton); + Inv.setItem(1, communitiesButton.Button); + //4 + ActionButton browserButton = new ActionButton(new ItemBuilder(Material.COMPASS).setTitle(C.cGreenB + "Browse Communities").build(), clickType -> {}); + Buttons.put(4, browserButton); + Inv.setItem(4, browserButton.Button); + //7 + ActionButton invitesButton = new ActionButton(new ItemBuilder(Material.PAPER).setTitle(C.cGreenB + "Community Invites").build(), clickType -> + { + new CommunityInvitesPage(Viewer); + }); + Buttons.put(7, invitesButton); + Inv.setItem(7, invitesButton.Button); + } + { + ActionButton back = new ActionButton(new ItemBuilder(Material.ARROW).setTitle(C.cGreen + "Previous Page").build(), clickType -> + { + if (_page == 1) + { + return; + } + setup(_page - 1, false); + }); + ActionButton next = new ActionButton(new ItemBuilder(Material.ARROW).setTitle(C.cGreen + "Next Page").build(), clickType -> + { + setup(_page + 1, false); + }); + Buttons.put(45, back); + Inv.setItem(45, back.Button); + Buttons.put(53, next); + Inv.setItem(53, next.Button); + } + + int slot = 18; + boolean cleared = false; + _displaying.clear(); + for (int i = (page - 1) * COMMUNITIES_PER_PAGE; i < (page - 1) * COMMUNITIES_PER_PAGE + COMMUNITIES_PER_PAGE && i < getCommunityManager().BrowserIds.size(); i++) + { + if (!cleared && !initial) + { + cleared = true; + _page = page; + for (int clear = 18; clear < 45; clear++) + { + Buttons.remove(clear); + Inv.setItem(clear, null); + } + } + CommunityBrowserButton button = new CommunityBrowserButton(Viewer, getCommunityManager().getLoadedCommunity(getCommunityManager().BrowserIds.get(i))); + _displaying.add(getCommunityManager().BrowserIds.get(i)); + Buttons.put(slot, button); + Inv.setItem(slot, button.Button); + + slot++; + } + + Viewer.updateInventory(); + } + + @EventHandler + public void onBrowserUpdate(CommunityBrowserUpdateEvent event) + { + setup(1, true); + } + + @EventHandler + public void onCommunityDisband(CommunityDisbandEvent event) + { + if (_displaying.contains(event.getCommunity().getId())) + { + setup(1, true); + } + } +} \ No newline at end of file diff --git a/Plugins/Mineplex.Core/src/mineplex/core/communities/gui/community/CommunityButton.java b/Plugins/Mineplex.Core/src/mineplex/core/communities/gui/community/CommunityButton.java new file mode 100644 index 000000000..ee5696f5a --- /dev/null +++ b/Plugins/Mineplex.Core/src/mineplex/core/communities/gui/community/CommunityButton.java @@ -0,0 +1,99 @@ +package mineplex.core.communities.gui.community; + +import org.bukkit.Material; +import org.bukkit.entity.Player; +import org.bukkit.event.inventory.ClickType; +import org.bukkit.inventory.ItemStack; + +import mineplex.core.common.util.C; +import mineplex.core.common.util.F; +import mineplex.core.common.util.LineFormat; +import mineplex.core.common.util.UtilPlayer; +import mineplex.core.common.util.UtilText; +import mineplex.core.communities.Community; +import mineplex.core.communities.Community.PrivacySetting; +import mineplex.core.communities.CommunityRole; +import mineplex.core.communities.gui.CommunitiesGUIButton; +import mineplex.core.itemstack.ItemBuilder; + +public class CommunityButton extends CommunitiesGUIButton +{ + private Player _viewer; + private Community _community; + + public CommunityButton(Player viewer, Community community) + { + super(getDisplay(community, viewer)); + + _viewer = viewer; + _community = community; + } + + private static ItemStack getDisplay(Community community, Player viewer) + { + ItemStack item = new ItemBuilder(Material.REDSTONE_BLOCK).setTitle(C.cGreenB + community.getName()).addLore(UtilText.splitLinesToArray(new String[] {C.cGreen, C.cYellow + "Members " + C.cWhite + community.getMembers().size(), C.cYellow + "Description " + C.cWhite + community.getDescription(), C.cRed, C.cYellow + "Shift-Left Click " + C.cWhite + "Request To Join"}, LineFormat.LORE)).build(); + + if (community.getMembers().containsKey(viewer.getUniqueId())) + { + ItemBuilder builder = new ItemBuilder(Material.EMERALD_BLOCK).setTitle(C.cGreenB + community.getName()).addLore(UtilText.splitLinesToArray(new String[] {C.cGreen, C.cYellow + "Members " + C.cWhite + community.getMembers().size(), C.cYellow + "Description " + C.cWhite + community.getDescription(), C.cRed, C.cYellow + "Shift-Left Click " + C.cWhite + "Leave Community"}, LineFormat.LORE)); + if (community.getMembers().get(viewer.getUniqueId()).Role == CommunityRole.LEADER) + { + builder.addLore(C.cBlue); + builder.addLore(UtilText.splitLineToArray(C.cGray + "Use " + C.cYellow + "/com disband " + community.getName() + C.cGray + " to disband!", LineFormat.LORE)); + } + item = builder.build(); + } + else if (community.getJoinRequests().containsKey(viewer.getUniqueId())) + { + item = new ItemBuilder(Material.REDSTONE_BLOCK).setTitle(C.cGold + community.getName()).addLore(UtilText.splitLinesToArray(new String[] {C.cGreen, C.cYellow + "Members " + C.cWhite + community.getMembers().size(), C.cYellow + "Description " + C.cWhite + community.getDescription(), C.cRed, C.cYellow + "Shift-Left Click " + C.cWhite + "Cancel Join Request"}, LineFormat.LORE)).build(); + } + else if (getCommunityManager().Get(viewer).Invites.contains(community.getId()) || community.getPrivacySetting() == PrivacySetting.OPEN) + { + item = new ItemBuilder(Material.REDSTONE_BLOCK).setTitle(C.cGold + community.getName()).addLore(UtilText.splitLinesToArray(new String[] {C.cGreen, C.cYellow + "Members " + C.cWhite + community.getMembers().size(), C.cYellow + "Description " + C.cWhite + community.getDescription(), C.cRed, C.cYellow + "Shift-Left Click " + C.cWhite + "Join Community"}, LineFormat.LORE)).build(); + } + else if (community.getPrivacySetting() == PrivacySetting.PRIVATE) + { + item = new ItemBuilder(Material.REDSTONE_BLOCK).setTitle(C.cGreenB + community.getName()).addLore(UtilText.splitLinesToArray(new String[] {C.cGreen, C.cYellow + "Members " + C.cWhite + community.getMembers().size(), C.cYellow + "Description " + C.cWhite + community.getDescription(), C.cRed, C.cRed + "Closed"}, LineFormat.LORE)).build(); + } + + return item; + } + + @Override + public void update() + { + Button = getDisplay(_community, _viewer); + } + + @Override + public void handleClick(ClickType type) + { + if (type == ClickType.SHIFT_LEFT) + { + if (_community.getMembers().containsKey(_viewer.getUniqueId())) + { + if (_community.getMembers().get(_viewer.getUniqueId()).Role == CommunityRole.LEADER) + { + UtilPlayer.message(_viewer, F.main(getCommunityManager().getName(), "You cannot leave " + F.name(_community.getName()) + " without passing on leadership first! If you want to disband your community, type " + F.elem("/com disband " + _community.getName()) + "!")); + return; + } + getCommunityManager().handleLeave(_viewer, _community, _community.getMembers().get(_viewer.getUniqueId())); + } + else if (_community.getJoinRequests().containsKey(_viewer.getUniqueId())) + { + getCommunityManager().handleCloseJoinRequest(_viewer, _community, _community.getJoinRequests().get(_viewer.getUniqueId()), false); + } + else if (getCommunityManager().Get(_viewer).Invites.contains(_community.getId()) || _community.getPrivacySetting() == PrivacySetting.OPEN) + { + getCommunityManager().handleJoin(_viewer, _community, getCommunityManager().Get(_viewer).Invites.contains(_community.getId())); + } + else + { + if (_community.getPrivacySetting() != PrivacySetting.PRIVATE) + { + getCommunityManager().handleJoinRequest(_viewer, _community); + } + } + } + } +} \ No newline at end of file diff --git a/Plugins/Mineplex.Core/src/mineplex/core/communities/gui/community/CommunityChatReadingButton.java b/Plugins/Mineplex.Core/src/mineplex/core/communities/gui/community/CommunityChatReadingButton.java new file mode 100644 index 000000000..38382123a --- /dev/null +++ b/Plugins/Mineplex.Core/src/mineplex/core/communities/gui/community/CommunityChatReadingButton.java @@ -0,0 +1,47 @@ +package mineplex.core.communities.gui.community; + +import org.bukkit.Material; +import org.bukkit.entity.Player; +import org.bukkit.event.inventory.ClickType; +import org.bukkit.inventory.ItemStack; + +import mineplex.core.common.util.C; +import mineplex.core.communities.Community; +import mineplex.core.communities.gui.CommunitiesGUIButton; +import mineplex.core.itemstack.ItemBuilder; + +public class CommunityChatReadingButton extends CommunitiesGUIButton +{ + private Player _viewer; + private Community _community; + + public CommunityChatReadingButton(Player viewer, Community community) + { + super(getDisplay(community, viewer)); + + _viewer = viewer; + _community = community; + } + + private static ItemStack getDisplay(Community community, Player viewer) + { + ItemStack item = new ItemBuilder(Material.BOOK_AND_QUILL).setTitle(C.cGreenB + "Toggle Chat Visibility").build(); + + return item; + } + + @Override + public void update() + { + Button = getDisplay(_community, _viewer); + } + + @Override + public void handleClick(ClickType type) + { + if (_community.getMembers().containsKey(_viewer.getUniqueId())) + { + getCommunityManager().handleToggleReadingChat(_viewer, _community); + } + } +} \ No newline at end of file diff --git a/Plugins/Mineplex.Core/src/mineplex/core/communities/gui/community/CommunityJoinRequestButton.java b/Plugins/Mineplex.Core/src/mineplex/core/communities/gui/community/CommunityJoinRequestButton.java new file mode 100644 index 000000000..ad9af1d6e --- /dev/null +++ b/Plugins/Mineplex.Core/src/mineplex/core/communities/gui/community/CommunityJoinRequestButton.java @@ -0,0 +1,50 @@ +package mineplex.core.communities.gui.community; + +import org.bukkit.entity.Player; +import org.bukkit.event.inventory.ClickType; + +import mineplex.core.communities.Community; +import mineplex.core.communities.CommunityJoinRequestInfo; +import mineplex.core.communities.CommunityRole; +import mineplex.core.communities.gui.CommunitiesGUIButton; + +public class CommunityJoinRequestButton extends CommunitiesGUIButton +{ + private Player _viewer; + private Community _community; + private CommunityJoinRequestInfo _info; + + public CommunityJoinRequestButton(Player viewer, Community community, CommunityJoinRequestInfo info) + { + super(info.getRepresentation()); + + _viewer = viewer; + _community = community; + _info = info; + } + + @Override + public void update() + { + Button = _info.getRepresentation(); + } + + @Override + public void handleClick(ClickType type) + { + if (type == ClickType.LEFT) + { + if (getCommunityManager().Get(_viewer).getRoleIn(_community) != null && getCommunityManager().Get(_viewer).getRoleIn(_community).ordinal() <= CommunityRole.COLEADER.ordinal()) + { + getCommunityManager().handleInvite(_viewer, _community, _info.Name); + } + } + if (type == ClickType.SHIFT_RIGHT) + { + if (getCommunityManager().Get(_viewer).getRoleIn(_community) != null && getCommunityManager().Get(_viewer).getRoleIn(_community).ordinal() <= CommunityRole.COLEADER.ordinal()) + { + getCommunityManager().handleCloseJoinRequest(_viewer, _community, _info, true); + } + } + } +} \ No newline at end of file diff --git a/Plugins/Mineplex.Core/src/mineplex/core/communities/gui/community/CommunityJoinRequestsPage.java b/Plugins/Mineplex.Core/src/mineplex/core/communities/gui/community/CommunityJoinRequestsPage.java new file mode 100644 index 000000000..1c5c69c92 --- /dev/null +++ b/Plugins/Mineplex.Core/src/mineplex/core/communities/gui/community/CommunityJoinRequestsPage.java @@ -0,0 +1,184 @@ +package mineplex.core.communities.gui.community; + +import java.util.LinkedList; +import java.util.List; + +import org.bukkit.Material; +import org.bukkit.entity.Player; +import org.bukkit.event.EventHandler; + +import mineplex.core.common.util.C; +import mineplex.core.communities.Community; +import mineplex.core.communities.CommunityDisbandEvent; +import mineplex.core.communities.CommunityJoinRequestInfo; +import mineplex.core.communities.CommunityJoinRequestsUpdateEvent; +import mineplex.core.communities.CommunityMemberDataUpdateEvent; +import mineplex.core.communities.CommunityMembershipUpdateEvent; +import mineplex.core.communities.CommunityRole; +import mineplex.core.communities.gui.ActionButton; +import mineplex.core.communities.gui.CommunitiesGUIPage; +import mineplex.core.communities.gui.overview.CommunityOverviewPage; +import mineplex.core.itemstack.ItemBuilder; + +public class CommunityJoinRequestsPage extends CommunitiesGUIPage +{ + private static final int REQUESTS_PER_PAGE = 27; + + private Community _community; + private int _page = 1; + + public CommunityJoinRequestsPage(Player viewer, Community community) + { + super(community.getName() + C.cBlack, 6, viewer); + _community = community; + + setup(1, true); + open(); + } + + private void setup(int page, boolean initial) + { + if (initial) + { + Buttons.clear(); + Inv.clear(); + } + { + //0 + ActionButton membersButton = new ActionButton(new ItemBuilder(Material.SKULL_ITEM).setData((short)3).setTitle(C.cGreenB + "Members").build(), clickType -> + { + new CommunityMembersPage(Viewer, _community).open(); + }); + Buttons.put(0, membersButton); + Inv.setItem(0, membersButton.Button); + //4 + CommunityButton communityButton = new CommunityButton(Viewer, _community); + Buttons.put(4, communityButton); + Inv.setItem(4, communityButton.Button); + //8 + ActionButton returnButton = new ActionButton(new ItemBuilder(Material.BED).setTitle(C.cGray + "\u21FD Go Back").build(), clickType -> + { + new CommunityOverviewPage(Viewer).open(); + }); + Buttons.put(8, returnButton); + Inv.setItem(8, returnButton.Button); + //CoLeader+ + if (_community.getMembers().containsKey(Viewer.getUniqueId()) && _community.getMembers().get(Viewer.getUniqueId()).Role.ordinal() <= CommunityRole.COLEADER.ordinal()) + { + ActionButton requestsButton = new ActionButton(new ItemBuilder(Material.PAPER).setTitle(C.cGreenB + "Join Requests").build(), clickType -> {}); + Buttons.put(2, requestsButton); + Inv.setItem(2, requestsButton.Button); + ActionButton settingsButton = new ActionButton(new ItemBuilder(Material.REDSTONE_COMPARATOR).setTitle(C.cGreenB + "Community Settings").build(), clickType -> + { + new CommunitySettingsPage(Viewer, _community); + }); + Buttons.put(6, settingsButton); + Inv.setItem(6, settingsButton.Button); + } + else if (_community.getMembers().containsKey(Viewer.getUniqueId())) + { + CommunityChatReadingButton chatButton = new CommunityChatReadingButton(Viewer, _community); + Buttons.put(6, chatButton); + Inv.setItem(6, chatButton.Button); + } + } + { + ActionButton back = new ActionButton(new ItemBuilder(Material.ARROW).setTitle(C.cGreen + "Previous Page").build(), clickType -> + { + if (_page == 1) + { + return; + } + setup(_page - 1, false); + }); + ActionButton next = new ActionButton(new ItemBuilder(Material.ARROW).setTitle(C.cGreen + "Next Page").build(), clickType -> + { + setup(_page + 1, false); + }); + Buttons.put(45, back); + Inv.setItem(45, back.Button); + Buttons.put(53, next); + Inv.setItem(53, next.Button); + } + List requests = new LinkedList<>(); + for (CommunityJoinRequestInfo info : _community.getJoinRequests().values()) + { + requests.add(info); + } + requests.sort((info1, info2) -> + { + return info1.Name.compareToIgnoreCase(info2.Name); + }); + + int slot = 18; + boolean cleared = false; + for (int i = (page - 1) * REQUESTS_PER_PAGE; i < (page - 1) * REQUESTS_PER_PAGE + REQUESTS_PER_PAGE && i < requests.size(); i++) + { + if (!cleared && !initial) + { + cleared = true; + _page = page; + for (int clear = 18; clear < 45; clear++) + { + Buttons.remove(clear); + Inv.setItem(clear, null); + } + } + CommunityJoinRequestButton button = new CommunityJoinRequestButton(Viewer, _community, requests.get(i)); + Buttons.put(slot, button); + Inv.setItem(slot, button.Button); + + slot++; + } + + Viewer.updateInventory(); + } + + @EventHandler + public void onMembershipUpdate(CommunityMembershipUpdateEvent event) + { + if (event.getCommunity().getId().intValue() != _community.getId().intValue()) + { + return; + } + + if (_community.getMembers().containsKey(Viewer.getUniqueId()) && _community.getMembers().get(Viewer.getUniqueId()).Role.ordinal() <= CommunityRole.COLEADER.ordinal()) + { + setup(1, true); + } + else + { + new CommunityMembersPage(Viewer, _community).open(); + } + } + + @EventHandler + public void onRequestsUpdate(CommunityJoinRequestsUpdateEvent event) + { + if (event.getCommunity().getId().intValue() != _community.getId().intValue()) + { + return; + } + setup(1, true); + } + + @EventHandler + public void onCommunityDisband(CommunityDisbandEvent event) + { + if (_community.getId().intValue() == event.getCommunity().getId().intValue()) + { + Viewer.closeInventory(); + } + } + + @EventHandler + public void onMembershipUpdate(CommunityMemberDataUpdateEvent event) + { + if (!event.getPlayer().getUniqueId().toString().equalsIgnoreCase(Viewer.getUniqueId().toString())) + { + return; + } + + setup(1, true); + } +} \ No newline at end of file diff --git a/Plugins/Mineplex.Core/src/mineplex/core/communities/gui/community/CommunityMemberButton.java b/Plugins/Mineplex.Core/src/mineplex/core/communities/gui/community/CommunityMemberButton.java new file mode 100644 index 000000000..4fd034064 --- /dev/null +++ b/Plugins/Mineplex.Core/src/mineplex/core/communities/gui/community/CommunityMemberButton.java @@ -0,0 +1,80 @@ +package mineplex.core.communities.gui.community; + +import org.bukkit.entity.Player; +import org.bukkit.event.inventory.ClickType; + +import mineplex.core.Managers; +import mineplex.core.account.CoreClientManager; +import mineplex.core.common.Rank; +import mineplex.core.common.util.F; +import mineplex.core.common.util.UtilPlayer; +import mineplex.core.communities.Community; +import mineplex.core.communities.CommunityMemberInfo; +import mineplex.core.communities.CommunityRole; +import mineplex.core.communities.gui.CommunitiesGUIButton; + +public class CommunityMemberButton extends CommunitiesGUIButton +{ + private Player _viewer; + private Community _community; + private CommunityMemberInfo _info; + + public CommunityMemberButton(Player viewer, Community community, CommunityMemberInfo info) + { + super(info.getRepresentation(getCommunityManager().Get(viewer).getRoleIn(community))); + + _viewer = viewer; + _community = community; + _info = info; + } + + @Override + public void update() + { + Button = _info.getRepresentation(getCommunityManager().Get(_viewer).getRoleIn(_community)); + } + + @Override + public void handleClick(ClickType type) + { + if (type == ClickType.SHIFT_RIGHT) + { + if (getCommunityManager().Get(_viewer).getRoleIn(_community) != null && getCommunityManager().Get(_viewer).getRoleIn(_community).ordinal() < _info.Role.ordinal()) + { + getCommunityManager().handleKick(_viewer, _community, _info); + } + } + if (type == ClickType.LEFT || type == ClickType.SHIFT_LEFT) + { + if (getCommunityManager().Get(_viewer).getRoleIn(_community) != null && getCommunityManager().Get(_viewer).getRoleIn(_community) == CommunityRole.LEADER && _info.Role != CommunityRole.LEADER) + { + if (_info.Role == CommunityRole.MEMBER) + { + getCommunityManager().handleRoleUpdate(_viewer, _community, _info, CommunityRole.COLEADER); + } + if (_info.Role == CommunityRole.COLEADER && type == ClickType.SHIFT_LEFT) + { + if (getCommunityManager().ownsCommunity(_info.UUID)) + { + UtilPlayer.message(_viewer, F.main(getCommunityManager().getName(), F.name(_info.Name) + " can only own one community at a time!")); + return; + } + if (!Rank.valueOf(Managers.get(CoreClientManager.class).loadOfflineClient(_info.UUID).Rank).has(Rank.ETERNAL)) + { + UtilPlayer.message(_viewer, F.main(getCommunityManager().getName(), "Only Eternal rank and above can own a community!")); + return; + } + getCommunityManager().handleRoleUpdate(_viewer, _community, _info, CommunityRole.LEADER); + getCommunityManager().handleRoleUpdate(_viewer, _community, _community.getMembers().get(_viewer.getUniqueId()), CommunityRole.COLEADER); + } + } + } + if (type == ClickType.RIGHT) + { + if (getCommunityManager().Get(_viewer).getRoleIn(_community) != null && getCommunityManager().Get(_viewer).getRoleIn(_community) == CommunityRole.LEADER && _info.Role == CommunityRole.COLEADER) + { + getCommunityManager().handleRoleUpdate(_viewer, _community, _info, CommunityRole.MEMBER); + } + } + } +} \ No newline at end of file diff --git a/Plugins/Mineplex.Core/src/mineplex/core/communities/gui/community/CommunityMembersPage.java b/Plugins/Mineplex.Core/src/mineplex/core/communities/gui/community/CommunityMembersPage.java new file mode 100644 index 000000000..720d5a41c --- /dev/null +++ b/Plugins/Mineplex.Core/src/mineplex/core/communities/gui/community/CommunityMembersPage.java @@ -0,0 +1,201 @@ +package mineplex.core.communities.gui.community; + +import java.util.LinkedList; +import java.util.List; + +import org.bukkit.Material; +import org.bukkit.entity.Player; +import org.bukkit.event.EventHandler; + +import mineplex.core.common.util.C; +import mineplex.core.communities.Community; +import mineplex.core.communities.CommunityDisbandEvent; +import mineplex.core.communities.CommunityJoinRequestsUpdateEvent; +import mineplex.core.communities.CommunityMemberDataUpdateEvent; +import mineplex.core.communities.CommunityMemberInfo; +import mineplex.core.communities.CommunityMembershipUpdateEvent; +import mineplex.core.communities.CommunityRole; +import mineplex.core.communities.gui.ActionButton; +import mineplex.core.communities.gui.CommunitiesGUIButton; +import mineplex.core.communities.gui.CommunitiesGUIPage; +import mineplex.core.communities.gui.overview.CommunityOverviewPage; +import mineplex.core.itemstack.ItemBuilder; + +public class CommunityMembersPage extends CommunitiesGUIPage +{ + private static final int MEMBERS_PER_PAGE = 27; + + private Community _community; + private int _page = 1; + + public CommunityMembersPage(Player viewer, Community community) + { + super(community.getName() + C.cAqua, 6, viewer); + _community = community; + + setup(1, true); + open(); + } + + private void setup(int page, boolean initial) + { + if (initial) + { + Buttons.clear(); + Inv.clear(); + } + { + //0 + ActionButton membersButton = new ActionButton(new ItemBuilder(Material.SKULL_ITEM).setData((short)3).setTitle(C.cGreenB + "Members").build(), clickType -> {}); + Buttons.put(0, membersButton); + Inv.setItem(0, membersButton.Button); + //4 + CommunityButton communityButton = new CommunityButton(Viewer, _community); + Buttons.put(4, communityButton); + Inv.setItem(4, communityButton.Button); + //8 + ActionButton returnButton = new ActionButton(new ItemBuilder(Material.BED).setTitle(C.cGray + "\u21FD Go Back").build(), clickType -> + { + new CommunityOverviewPage(Viewer).open(); + }); + Buttons.put(8, returnButton); + Inv.setItem(8, returnButton.Button); + //CoLeader+ + if (_community.getMembers().containsKey(Viewer.getUniqueId()) && _community.getMembers().get(Viewer.getUniqueId()).Role.ordinal() <= CommunityRole.COLEADER.ordinal()) + { + ActionButton requestsButton = new ActionButton(new ItemBuilder(Material.PAPER).setTitle(C.cGreenB + "Join Requests").build(), clickType -> + { + new CommunityJoinRequestsPage(Viewer, _community).open(); + }); + Buttons.put(2, requestsButton); + Inv.setItem(2, requestsButton.Button); + ActionButton settingsButton = new ActionButton(new ItemBuilder(Material.REDSTONE_COMPARATOR).setTitle(C.cGreenB + "Community Settings").build(), clickType -> + { + new CommunitySettingsPage(Viewer, _community); + }); + Buttons.put(6, settingsButton); + Inv.setItem(6, settingsButton.Button); + } + else if (_community.getMembers().containsKey(Viewer.getUniqueId())) + { + CommunityChatReadingButton chatButton = new CommunityChatReadingButton(Viewer, _community); + Buttons.put(6, chatButton); + Inv.setItem(6, chatButton.Button); + } + } + { + ActionButton back = new ActionButton(new ItemBuilder(Material.ARROW).setTitle(C.cGreen + "Previous Page").build(), clickType -> + { + if (_page == 1) + { + return; + } + setup(_page - 1, false); + }); + ActionButton next = new ActionButton(new ItemBuilder(Material.ARROW).setTitle(C.cGreen + "Next Page").build(), clickType -> + { + setup(_page + 1, false); + }); + Buttons.put(45, back); + Inv.setItem(45, back.Button); + Buttons.put(53, next); + Inv.setItem(53, next.Button); + } + List members = new LinkedList<>(); + for (CommunityMemberInfo info : _community.getMembers().values()) + { + members.add(info); + } + members.sort((info1, info2) -> + { + if (info1.isOnline() == info2.isOnline()) + { + if (info1.Role == info2.Role) + { + return info1.Name.compareToIgnoreCase(info2.Name); + } + else if (info1.Role.ordinal() < info2.Role.ordinal()) + { + return -1; + } + else + { + return 1; + } + } + + if (info1.isOnline()) + { + return -1; + } + return 1; + }); + + int slot = 18; + boolean cleared = false; + for (int i = (page - 1) * MEMBERS_PER_PAGE; i < (page - 1) * MEMBERS_PER_PAGE + MEMBERS_PER_PAGE && i < members.size(); i++) + { + if (!cleared && !initial) + { + cleared = true; + _page = page; + for (int clear = 18; clear < 45; clear++) + { + Buttons.remove(clear); + Inv.setItem(clear, null); + } + } + CommunityMemberButton button = new CommunityMemberButton(Viewer, _community, members.get(i)); + Buttons.put(slot, button); + Inv.setItem(slot, button.Button); + + slot++; + } + + Viewer.updateInventory(); + } + + @EventHandler + public void onRequestsUpdate(CommunityJoinRequestsUpdateEvent event) + { + if (event.getCommunity().getId().intValue() != _community.getId().intValue()) + { + return; + } + CommunitiesGUIButton button = Buttons.get(4); + button.update(); + Inv.setItem(4, button.Button); + Viewer.updateInventory(); + } + + @EventHandler + public void onMembershipUpdate(CommunityMembershipUpdateEvent event) + { + if (event.getCommunity().getId().intValue() != _community.getId().intValue()) + { + return; + } + + setup(1, true); + } + + @EventHandler + public void onCommunityDisband(CommunityDisbandEvent event) + { + if (_community.getId().intValue() == event.getCommunity().getId().intValue()) + { + Viewer.closeInventory(); + } + } + + @EventHandler + public void onMembershipUpdate(CommunityMemberDataUpdateEvent event) + { + if (!event.getPlayer().getUniqueId().toString().equalsIgnoreCase(Viewer.getUniqueId().toString())) + { + return; + } + + setup(1, true); + } +} \ No newline at end of file diff --git a/Plugins/Mineplex.Core/src/mineplex/core/communities/gui/community/CommunitySettingButton.java b/Plugins/Mineplex.Core/src/mineplex/core/communities/gui/community/CommunitySettingButton.java new file mode 100644 index 000000000..27a9bee13 --- /dev/null +++ b/Plugins/Mineplex.Core/src/mineplex/core/communities/gui/community/CommunitySettingButton.java @@ -0,0 +1,258 @@ +package mineplex.core.communities.gui.community; + +import java.util.Arrays; +import java.util.HashMap; +import java.util.Map; + +import org.bukkit.ChatColor; +import org.bukkit.DyeColor; +import org.bukkit.Material; +import org.bukkit.entity.Player; +import org.bukkit.event.inventory.ClickType; +import org.bukkit.inventory.ItemStack; +import org.bukkit.material.MaterialData; + +import mineplex.core.common.util.C; +import mineplex.core.communities.Community; +import mineplex.core.communities.Community.PrivacySetting; +import mineplex.core.communities.CommunityRole; +import mineplex.core.communities.CommunitySetting; +import mineplex.core.communities.gui.CommunitiesGUIButton; +import mineplex.core.game.GameDisplay; +import mineplex.core.itemstack.ItemBuilder; + +public class CommunitySettingButton extends CommunitiesGUIButton +{ + @SuppressWarnings("serial") + private static final Map COLOR_MAP = new HashMap() + { + { + put(ChatColor.AQUA, DyeColor.CYAN); + put(ChatColor.BLACK, DyeColor.BLACK); + put(ChatColor.BLUE, DyeColor.LIGHT_BLUE); + put(ChatColor.DARK_AQUA, DyeColor.CYAN); + put(ChatColor.DARK_BLUE, DyeColor.BLUE); + put(ChatColor.DARK_GRAY, DyeColor.GRAY); + put(ChatColor.DARK_GREEN, DyeColor.GREEN); + put(ChatColor.DARK_PURPLE, DyeColor.PURPLE); + put(ChatColor.DARK_RED, DyeColor.RED); + put(ChatColor.GOLD, DyeColor.YELLOW); + put(ChatColor.GRAY, DyeColor.SILVER); + put(ChatColor.GREEN, DyeColor.LIME); + put(ChatColor.LIGHT_PURPLE, DyeColor.PINK); + put(ChatColor.RED, DyeColor.RED); + put(ChatColor.WHITE, DyeColor.WHITE); + put(ChatColor.YELLOW, DyeColor.YELLOW); + } + }; + @SuppressWarnings("serial") + private static final Map COLOR_NAME_MAP = new HashMap() + { + { + put(ChatColor.AQUA, "Aqua"); + put(ChatColor.BLACK, "Black"); + put(ChatColor.BLUE, "Blue"); + put(ChatColor.DARK_AQUA, "Cyan"); + put(ChatColor.DARK_BLUE, "Dark Blue"); + put(ChatColor.DARK_GRAY, "Dark Gray"); + put(ChatColor.DARK_GREEN, "Dark Green"); + put(ChatColor.DARK_PURPLE, "Purple"); + put(ChatColor.DARK_RED, "Dark Red"); + put(ChatColor.GOLD, "Gold"); + put(ChatColor.GRAY, "Gray"); + put(ChatColor.GREEN, "Green"); + put(ChatColor.LIGHT_PURPLE, "Pink"); + put(ChatColor.RED, "Red"); + put(ChatColor.WHITE, "White"); + put(ChatColor.YELLOW, "Yellow"); + } + }; + + private Player _viewer; + private Community _community; + private CommunitySetting _setting; + + public CommunitySettingButton(Player viewer, Community community, CommunitySetting setting) + { + super(new ItemBuilder(Material.BARRIER).build()); + + _viewer = viewer; + _community = community; + _setting = setting; + update(); + } + + @SuppressWarnings("deprecation") + @Override + public void update() + { + if (_setting == CommunitySetting.FAVORITE_GAME) + { + Button = new ItemBuilder(new ItemStack(_community.getFavoriteGame().getMaterial(), 1, _community.getFavoriteGame().getMaterialData(), null)).setTitle(C.cGreenB + "Favorite Game").addLore(C.cWhite + _community.getFavoriteGame().getName(), C.cRed, C.cYellow + "Left Click " + C.cWhite + "Next Game", C.cYellow + "Right Click " + C.cWhite + "Previous Game").build(); + } + else if (_setting == CommunitySetting.PRIVACY) + { + Button = new ItemBuilder(Material.DARK_OAK_DOOR_ITEM).setTitle(C.cGreenB + "Privacy").addLore(C.cWhite + _community.getPrivacySetting().getDisplayText(), C.cRed, C.cYellow + "Left Click " + C.cWhite + "Next Privacy Setting", C.cYellow + "Right Click " + C.cWhite + "Previous Privacy Setting").build(); + } + else if (_setting == CommunitySetting.CHAT_DELAY) + { + Button = new ItemBuilder(Material.PAPER).setTitle(C.cGreenB + "Chat Delay").addLore(C.cWhite + (_community.getChatDelay() == 0 ? "No Delay" : _community.getChatDelay() / 1000 + " Second(s)"), C.cRed, C.cYellow + "Left Click " + C.cWhite + "Next Delay Setting", C.cYellow + "Right Click " + C.cWhite + "Previous Delay Setting").build(); + } + else if (_setting == CommunitySetting.CHAT_NAME_COLOR) + { + ItemStack base = new MaterialData(Material.WOOL, COLOR_MAP.get(_community.getChatFormatting()[0]).getWoolData()).toItemStack(1); + Button = new ItemBuilder(base).setTitle(C.cGreenB + "Chat Community Color").addLore(C.cWhite + COLOR_NAME_MAP.get(_community.getChatFormatting()[0]), C.cRed, C.cYellow + "Left Click " + C.cWhite + "Next Color", C.cYellow + "Right Click " + C.cWhite + "Previous Color").build(); + } + else if (_setting == CommunitySetting.CHAT_PLAYER_COLOR) + { + ItemStack base = new MaterialData(Material.WOOL, COLOR_MAP.get(_community.getChatFormatting()[1]).getWoolData()).toItemStack(1); + Button = new ItemBuilder(base).setTitle(C.cGreenB + "Chat Player Color").addLore(C.cWhite + COLOR_NAME_MAP.get(_community.getChatFormatting()[1]), C.cRed, C.cYellow + "Left Click " + C.cWhite + "Next Color", C.cYellow + "Right Click " + C.cWhite + "Previous Color").build(); + } + else if (_setting == CommunitySetting.CHAT_MESSAGE_COLOR) + { + ItemStack base = new MaterialData(Material.WOOL, COLOR_MAP.get(_community.getChatFormatting()[2]).getWoolData()).toItemStack(1); + Button = new ItemBuilder(base).setTitle(C.cGreenB + "Chat Message Color").addLore(C.cWhite + COLOR_NAME_MAP.get(_community.getChatFormatting()[2]), C.cRed, C.cYellow + "Left Click " + C.cWhite + "Next Color", C.cYellow + "Right Click " + C.cWhite + "Previous Color").build(); + } + } + + @Override + public void handleClick(ClickType type) + { + if (type == ClickType.LEFT) + { + if (getCommunityManager().Get(_viewer).getRoleIn(_community) != null && getCommunityManager().Get(_viewer).getRoleIn(_community).ordinal() <= CommunityRole.COLEADER.ordinal()) + { + String[] valueArray = new String[] {}; + int index = 0; + + if (_setting == CommunitySetting.FAVORITE_GAME) + { + GameDisplay[] games = Arrays.asList(GameDisplay.values()).stream().filter(display -> display.isCommunityFavoriteOption()).toArray(size -> new GameDisplay[size]); + valueArray = new String[games.length]; + for (int i = 0; i < games.length; i++) + { + valueArray[i] = games[i].getName(); + } + + index = Arrays.asList(valueArray).indexOf(_community.getFavoriteGame().getName()); + } + else if (_setting == CommunitySetting.PRIVACY) + { + valueArray = new String[] {PrivacySetting.OPEN.toString(), PrivacySetting.RECRUITING.toString(), PrivacySetting.PRIVATE.toString()}; + + index = Arrays.asList(valueArray).indexOf(_community.getPrivacySetting().toString()); + } + else if (_setting == CommunitySetting.CHAT_DELAY) + { + valueArray = new String[] {1000L + "", 3000L + "", 5000L + ""}; + + index = Arrays.asList(valueArray).indexOf(_community.getChatDelay().toString()); + } + else if (_setting == CommunitySetting.CHAT_NAME_COLOR) + { + ChatColor[] colors = COLOR_MAP.keySet().toArray(new ChatColor[COLOR_MAP.size()]); + valueArray = new String[colors.length]; + for (int i = 0; i < colors.length; i++) + { + valueArray[i] = colors[i].name(); + } + + index = Arrays.asList(valueArray).indexOf(_community.getChatFormatting()[0].name()); + } + else if (_setting == CommunitySetting.CHAT_PLAYER_COLOR) + { + ChatColor[] colors = COLOR_MAP.keySet().toArray(new ChatColor[COLOR_MAP.size()]); + valueArray = new String[colors.length]; + for (int i = 0; i < colors.length; i++) + { + valueArray[i] = colors[i].name(); + } + + index = Arrays.asList(valueArray).indexOf(_community.getChatFormatting()[1].name()); + } + else if (_setting == CommunitySetting.CHAT_MESSAGE_COLOR) + { + ChatColor[] colors = COLOR_MAP.keySet().toArray(new ChatColor[COLOR_MAP.size()]); + valueArray = new String[colors.length]; + for (int i = 0; i < colors.length; i++) + { + valueArray[i] = colors[i].name(); + } + + index = Arrays.asList(valueArray).indexOf(_community.getChatFormatting()[2].name()); + } + + int newIndex = (index + 1 >= valueArray.length) ? 0 : (index + 1); + getCommunityManager().handleSettingUpdate(_viewer, _community, _setting, valueArray[newIndex]); + } + } + if (type == ClickType.RIGHT) + { + if (getCommunityManager().Get(_viewer).getRoleIn(_community) != null && getCommunityManager().Get(_viewer).getRoleIn(_community).ordinal() <= CommunityRole.COLEADER.ordinal()) + { + String[] valueArray = new String[] {}; + int index = 0; + + if (_setting == CommunitySetting.FAVORITE_GAME) + { + GameDisplay[] games = Arrays.asList(GameDisplay.values()).stream().filter(display -> display.isCommunityFavoriteOption()).toArray(size -> new GameDisplay[size]); + valueArray = new String[games.length]; + for (int i = 0; i < games.length; i++) + { + valueArray[i] = games[i].getName(); + } + + index = Arrays.asList(valueArray).indexOf(_community.getFavoriteGame().getName()); + } + else if (_setting == CommunitySetting.PRIVACY) + { + valueArray = new String[] {PrivacySetting.OPEN.toString(), PrivacySetting.RECRUITING.toString(), PrivacySetting.PRIVATE.toString()}; + + index = Arrays.asList(valueArray).indexOf(_community.getPrivacySetting().toString()); + } + else if (_setting == CommunitySetting.CHAT_DELAY) + { + valueArray = new String[] {1000L + "", 3000L + "", 5000L + ""}; + + index = Arrays.asList(valueArray).indexOf(_community.getChatDelay().toString()); + } + else if (_setting == CommunitySetting.CHAT_NAME_COLOR) + { + ChatColor[] colors = COLOR_MAP.keySet().toArray(new ChatColor[COLOR_MAP.size()]); + valueArray = new String[colors.length]; + for (int i = 0; i < colors.length; i++) + { + valueArray[i] = colors[i].name(); + } + + index = Arrays.asList(valueArray).indexOf(_community.getChatFormatting()[0].name()); + } + else if (_setting == CommunitySetting.CHAT_PLAYER_COLOR) + { + ChatColor[] colors = COLOR_MAP.keySet().toArray(new ChatColor[COLOR_MAP.size()]); + valueArray = new String[colors.length]; + for (int i = 0; i < colors.length; i++) + { + valueArray[i] = colors[i].name(); + } + + index = Arrays.asList(valueArray).indexOf(_community.getChatFormatting()[1].name()); + } + else if (_setting == CommunitySetting.CHAT_MESSAGE_COLOR) + { + ChatColor[] colors = COLOR_MAP.keySet().toArray(new ChatColor[COLOR_MAP.size()]); + valueArray = new String[colors.length]; + for (int i = 0; i < colors.length; i++) + { + valueArray[i] = colors[i].name(); + } + + index = Arrays.asList(valueArray).indexOf(_community.getChatFormatting()[2].name()); + } + + int newIndex = (index - 1 < 0) ? (valueArray.length - 1) : (index - 1); + getCommunityManager().handleSettingUpdate(_viewer, _community, _setting, valueArray[newIndex]); + } + } + } +} \ No newline at end of file diff --git a/Plugins/Mineplex.Core/src/mineplex/core/communities/gui/community/CommunitySettingsPage.java b/Plugins/Mineplex.Core/src/mineplex/core/communities/gui/community/CommunitySettingsPage.java new file mode 100644 index 000000000..56e1d0ba4 --- /dev/null +++ b/Plugins/Mineplex.Core/src/mineplex/core/communities/gui/community/CommunitySettingsPage.java @@ -0,0 +1,164 @@ +package mineplex.core.communities.gui.community; + +import org.bukkit.Material; +import org.bukkit.entity.Player; +import org.bukkit.event.EventHandler; + +import mineplex.core.common.util.C; +import mineplex.core.communities.Community; +import mineplex.core.communities.CommunityDisbandEvent; +import mineplex.core.communities.CommunityJoinRequestsUpdateEvent; +import mineplex.core.communities.CommunityMemberDataUpdateEvent; +import mineplex.core.communities.CommunityMembershipUpdateEvent; +import mineplex.core.communities.CommunityRole; +import mineplex.core.communities.CommunitySetting; +import mineplex.core.communities.CommunitySettingUpdateEvent; +import mineplex.core.communities.gui.ActionButton; +import mineplex.core.communities.gui.CommunitiesGUIButton; +import mineplex.core.communities.gui.CommunitiesGUIPage; +import mineplex.core.communities.gui.overview.CommunityOverviewPage; +import mineplex.core.itemstack.ItemBuilder; + +public class CommunitySettingsPage extends CommunitiesGUIPage +{ + private Community _community; + + public CommunitySettingsPage(Player viewer, Community community) + { + super(community.getName() + C.cBlue, 6, viewer); + _community = community; + + setup(); + open(); + } + + private void setup() + { + { + //0 + ActionButton membersButton = new ActionButton(new ItemBuilder(Material.SKULL_ITEM).setData((short)3).setTitle(C.cGreenB + "Members").build(), clickType -> + { + new CommunityMembersPage(Viewer, _community).open(); + }); + Buttons.put(0, membersButton); + Inv.setItem(0, membersButton.Button); + //4 + CommunityButton communityButton = new CommunityButton(Viewer, _community); + Buttons.put(4, communityButton); + Inv.setItem(4, communityButton.Button); + //8 + ActionButton returnButton = new ActionButton(new ItemBuilder(Material.BED).setTitle(C.cGray + "\u21FD Go Back").build(), clickType -> + { + new CommunityOverviewPage(Viewer).open(); + }); + Buttons.put(8, returnButton); + Inv.setItem(8, returnButton.Button); + //CoLeader+ + if (_community.getMembers().containsKey(Viewer.getUniqueId()) && _community.getMembers().get(Viewer.getUniqueId()).Role.ordinal() <= CommunityRole.COLEADER.ordinal()) + { + ActionButton requestsButton = new ActionButton(new ItemBuilder(Material.PAPER).setTitle(C.cGreenB + "Join Requests").build(), clickType -> + { + new CommunityJoinRequestsPage(Viewer, _community).open(); + }); + Buttons.put(2, requestsButton); + Inv.setItem(2, requestsButton.Button); + ActionButton settingsButton = new ActionButton(new ItemBuilder(Material.REDSTONE_COMPARATOR).setTitle(C.cGreenB + "Community Settings").build(), clickType -> {}); + Buttons.put(6, settingsButton); + Inv.setItem(6, settingsButton.Button); + } + else if (_community.getMembers().containsKey(Viewer.getUniqueId())) + { + CommunityChatReadingButton chatButton = new CommunityChatReadingButton(Viewer, _community); + Buttons.put(6, chatButton); + Inv.setItem(6, chatButton.Button); + } + } + { + CommunitySettingButton gameButton = new CommunitySettingButton(Viewer, _community, CommunitySetting.FAVORITE_GAME); + Buttons.put(20, gameButton); + Inv.setItem(20, gameButton.Button); + + CommunitySettingButton privacyButton = new CommunitySettingButton(Viewer, _community, CommunitySetting.PRIVACY); + Buttons.put(22, privacyButton); + Inv.setItem(22, privacyButton.Button); + + CommunityChatReadingButton chatButton = new CommunityChatReadingButton(Viewer, _community); + Buttons.put(24, chatButton); + Inv.setItem(24, chatButton.Button); + + CommunitySettingButton delayButton = new CommunitySettingButton(Viewer, _community, CommunitySetting.CHAT_DELAY); + Buttons.put(38, delayButton); + Inv.setItem(38, delayButton.Button); + + CommunitySettingButton communityColorButton = new CommunitySettingButton(Viewer, _community, CommunitySetting.CHAT_NAME_COLOR); + Buttons.put(40, communityColorButton); + Inv.setItem(40, communityColorButton.Button); + + CommunitySettingButton playerColorButton = new CommunitySettingButton(Viewer, _community, CommunitySetting.CHAT_PLAYER_COLOR); + Buttons.put(41, playerColorButton); + Inv.setItem(41, playerColorButton.Button); + + CommunitySettingButton messageColorButton = new CommunitySettingButton(Viewer, _community, CommunitySetting.CHAT_MESSAGE_COLOR); + Buttons.put(42, messageColorButton); + Inv.setItem(42, messageColorButton.Button); + } + + Viewer.updateInventory(); + } + + @EventHandler + public void onRequestsUpdate(CommunityJoinRequestsUpdateEvent event) + { + if (event.getCommunity().getId().intValue() != _community.getId().intValue()) + { + return; + } + CommunitiesGUIButton button = Buttons.get(4); + button.update(); + Inv.setItem(4, button.Button); + Viewer.updateInventory(); + } + + @EventHandler + public void onMembershipUpdate(CommunityMembershipUpdateEvent event) + { + if (event.getCommunity().getId().intValue() != _community.getId().intValue()) + { + return; + } + + if (!_community.getMembers().containsKey(Viewer.getUniqueId()) || _community.getMembers().get(Viewer.getUniqueId()).Role.ordinal() > CommunityRole.COLEADER.ordinal()) + { + new CommunityMembersPage(Viewer, _community).open(); + } + } + + @EventHandler + public void onSettingsUpdate(CommunitySettingUpdateEvent event) + { + if (event.getCommunity().getId().intValue() != _community.getId().intValue()) + { + return; + } + setup(); + } + + @EventHandler + public void onCommunityDisband(CommunityDisbandEvent event) + { + if (_community.getId().intValue() == event.getCommunity().getId().intValue()) + { + Viewer.closeInventory(); + } + } + + @EventHandler + public void onMembershipUpdate(CommunityMemberDataUpdateEvent event) + { + if (!event.getPlayer().getUniqueId().toString().equalsIgnoreCase(Viewer.getUniqueId().toString())) + { + return; + } + setup(); + } +} \ No newline at end of file diff --git a/Plugins/Mineplex.Core/src/mineplex/core/communities/gui/overview/CommunityInvitesPage.java b/Plugins/Mineplex.Core/src/mineplex/core/communities/gui/overview/CommunityInvitesPage.java new file mode 100644 index 000000000..93796bede --- /dev/null +++ b/Plugins/Mineplex.Core/src/mineplex/core/communities/gui/overview/CommunityInvitesPage.java @@ -0,0 +1,118 @@ +package mineplex.core.communities.gui.overview; + +import org.bukkit.Material; +import org.bukkit.entity.Player; +import org.bukkit.event.EventHandler; + +import mineplex.core.common.util.C; +import mineplex.core.communities.CommunityDisbandEvent; +import mineplex.core.communities.CommunityMemberDataUpdateEvent; +import mineplex.core.communities.gui.ActionButton; +import mineplex.core.communities.gui.CommunitiesGUIPage; +import mineplex.core.communities.gui.browser.CommunityBrowserPage; +import mineplex.core.itemstack.ItemBuilder; + +public class CommunityInvitesPage extends CommunitiesGUIPage +{ + private static final int COMMUNITIES_PER_PAGE = 27; + + private int _page = 1; + + public CommunityInvitesPage(Player viewer) + { + super("Community Invites", 6, viewer); + + setup(1, true); + open(); + } + + private void setup(int page, boolean initial) + { + if (initial) + { + Buttons.clear(); + Inv.clear(); + } + { + //1 + ActionButton communitiesButton = new ActionButton(new ItemBuilder(Material.EMERALD).setTitle(C.cGreenB + "Your Communities").build(), clickType -> + { + new CommunityOverviewPage(Viewer).open(); + }); + Buttons.put(1, communitiesButton); + Inv.setItem(1, communitiesButton.Button); + //4 + ActionButton browserButton = new ActionButton(new ItemBuilder(Material.COMPASS).setTitle(C.cGreenB + "Browse Communities").build(), clickType -> + { + new CommunityBrowserPage(Viewer).open(); + }); + Buttons.put(4, browserButton); + Inv.setItem(4, browserButton.Button); + //7 + ActionButton invitesButton = new ActionButton(new ItemBuilder(Material.PAPER).setTitle(C.cGreenB + "Community Invites").build(), clickType -> {}); + Buttons.put(7, invitesButton); + Inv.setItem(7, invitesButton.Button); + } + { + ActionButton back = new ActionButton(new ItemBuilder(Material.ARROW).setTitle(C.cGreen + "Previous Page").build(), clickType -> + { + if (_page == 1) + { + return; + } + setup(_page - 1, false); + }); + ActionButton next = new ActionButton(new ItemBuilder(Material.ARROW).setTitle(C.cGreen + "Next Page").build(), clickType -> + { + setup(_page + 1, false); + }); + Buttons.put(45, back); + Inv.setItem(45, back.Button); + Buttons.put(53, next); + Inv.setItem(53, next.Button); + } + + int slot = 18; + boolean cleared = false; + for (int i = (page - 1) * COMMUNITIES_PER_PAGE; i < (page - 1) * COMMUNITIES_PER_PAGE + COMMUNITIES_PER_PAGE && i < getCommunityManager().Get(Viewer).Invites.size(); i++) + { + if (!cleared && !initial) + { + cleared = true; + _page = page; + for (int clear = 18; clear < 45; clear++) + { + Buttons.remove(clear); + Inv.setItem(clear, null); + } + } + CommunityVisualizationButton button = new CommunityVisualizationButton(Viewer, getCommunityManager().getLoadedCommunity(getCommunityManager().Get(Viewer).Invites.get(i)), true); + Buttons.put(slot, button); + Inv.setItem(slot, button.Button); + + slot++; + } + + Viewer.updateInventory(); + } + + @EventHandler + public void onMembershipUpdate(CommunityMemberDataUpdateEvent event) + { + if (!event.getPlayer().getUniqueId().toString().equalsIgnoreCase(Viewer.getUniqueId().toString())) + { + return; + } + + setup(1, true); + } + + @EventHandler + public void onCommunityDisband(CommunityDisbandEvent event) + { + if (getCommunityManager().Get(Viewer).Invites.contains(event.getCommunity().getId())) + { + setup(1, true); + } + } +} \ No newline at end of file diff --git a/Plugins/Mineplex.Core/src/mineplex/core/communities/gui/overview/CommunityOverviewPage.java b/Plugins/Mineplex.Core/src/mineplex/core/communities/gui/overview/CommunityOverviewPage.java new file mode 100644 index 000000000..342afa5bd --- /dev/null +++ b/Plugins/Mineplex.Core/src/mineplex/core/communities/gui/overview/CommunityOverviewPage.java @@ -0,0 +1,136 @@ +package mineplex.core.communities.gui.overview; + +import java.util.Arrays; +import java.util.List; + +import org.bukkit.Material; +import org.bukkit.entity.Player; +import org.bukkit.event.EventHandler; + +import mineplex.core.common.util.C; +import mineplex.core.communities.Community; +import mineplex.core.communities.CommunityDisbandEvent; +import mineplex.core.communities.CommunityMemberDataUpdateEvent; +import mineplex.core.communities.gui.ActionButton; +import mineplex.core.communities.gui.CommunitiesGUIPage; +import mineplex.core.communities.gui.browser.CommunityBrowserPage; +import mineplex.core.itemstack.ItemBuilder; + +public class CommunityOverviewPage extends CommunitiesGUIPage +{ + private static final int COMMUNITIES_PER_PAGE = 27; + + private int _page = 1; + + public CommunityOverviewPage(Player viewer) + { + super("Your Communities", 6, viewer); + + setup(1, true); + open(); + } + + private void setup(int page, boolean initial) + { + if (initial) + { + Buttons.clear(); + Inv.clear(); + } + { + //1 + ActionButton communitiesButton = new ActionButton(new ItemBuilder(Material.EMERALD).setTitle(C.cGreenB + "Your Communities").build(), clickType -> {}); + Buttons.put(1, communitiesButton); + Inv.setItem(1, communitiesButton.Button); + //4 + ActionButton browserButton = new ActionButton(new ItemBuilder(Material.COMPASS).setTitle(C.cGreenB + "Browse Communities").build(), clickType -> + { + new CommunityBrowserPage(Viewer).open(); + }); + Buttons.put(4, browserButton); + Inv.setItem(4, browserButton.Button); + //7 + ActionButton invitesButton = new ActionButton(new ItemBuilder(Material.PAPER).setTitle(C.cGreenB + "Community Invites").build(), clickType -> + { + new CommunityInvitesPage(Viewer); + }); + Buttons.put(7, invitesButton); + Inv.setItem(7, invitesButton.Button); + } + { + ActionButton back = new ActionButton(new ItemBuilder(Material.ARROW).setTitle(C.cGreen + "Previous Page").build(), clickType -> + { + if (_page == 1) + { + return; + } + setup(_page - 1, false); + }); + ActionButton next = new ActionButton(new ItemBuilder(Material.ARROW).setTitle(C.cGreen + "Next Page").build(), clickType -> + { + setup(_page + 1, false); + }); + Buttons.put(45, back); + Inv.setItem(45, back.Button); + Buttons.put(53, next); + Inv.setItem(53, next.Button); + } + + int slot = 18; + boolean cleared = false; + for (int i = (page - 1) * COMMUNITIES_PER_PAGE; i < (page - 1) * COMMUNITIES_PER_PAGE + COMMUNITIES_PER_PAGE && i < getCommunityManager().Get(Viewer).getTotalCommunities(); i++) + { + if (!cleared && !initial) + { + cleared = true; + _page = page; + for (int clear = 18; clear < 45; clear++) + { + Buttons.remove(clear); + Inv.setItem(clear, null); + } + } + List coms = Arrays.asList(getCommunityManager().Get(Viewer).getCommunities()); + coms.sort((c1, c2) -> + { + if (c1.getMembers().get(Viewer.getUniqueId()).Role == c2.getMembers().get(Viewer.getUniqueId()).Role) + { + return c1.getName().compareTo(c2.getName()); + } + + if (c1.getMembers().get(Viewer.getUniqueId()).Role.ordinal() < c2.getMembers().get(Viewer.getUniqueId()).Role.ordinal()) + { + return -1; + } + return 1; + }); + CommunityVisualizationButton button = new CommunityVisualizationButton(Viewer, coms.get(i), false); + Buttons.put(slot, button); + Inv.setItem(slot, button.Button); + + slot++; + } + + Viewer.updateInventory(); + } + + @EventHandler + public void onMembershipUpdate(CommunityMemberDataUpdateEvent event) + { + if (!event.getPlayer().getUniqueId().toString().equalsIgnoreCase(Viewer.getUniqueId().toString())) + { + return; + } + + setup(1, true); + } + + @EventHandler + public void onCommunityDisband(CommunityDisbandEvent event) + { + if (getCommunityManager().Get(Viewer).Invites.contains(event.getCommunity().getId())) + { + setup(1, true); + } + } +} \ No newline at end of file diff --git a/Plugins/Mineplex.Core/src/mineplex/core/communities/gui/overview/CommunityVisualizationButton.java b/Plugins/Mineplex.Core/src/mineplex/core/communities/gui/overview/CommunityVisualizationButton.java new file mode 100644 index 000000000..64ca6a19d --- /dev/null +++ b/Plugins/Mineplex.Core/src/mineplex/core/communities/gui/overview/CommunityVisualizationButton.java @@ -0,0 +1,61 @@ +package mineplex.core.communities.gui.overview; + +import org.bukkit.Material; +import org.bukkit.entity.Player; +import org.bukkit.event.inventory.ClickType; +import org.bukkit.inventory.ItemStack; + +import mineplex.core.common.util.C; +import mineplex.core.common.util.LineFormat; +import mineplex.core.common.util.UtilText; +import mineplex.core.communities.Community; +import mineplex.core.communities.gui.CommunitiesGUIButton; +import mineplex.core.communities.gui.community.CommunityMembersPage; +import mineplex.core.itemstack.ItemBuilder; + +public class CommunityVisualizationButton extends CommunitiesGUIButton +{ + private Player _viewer; + private Community _community; + private boolean _invite; + + public CommunityVisualizationButton(Player viewer, Community community, boolean invite) + { + super(new ItemBuilder(Material.BARRIER).build()); + + _viewer = viewer; + _community = community; + _invite = invite; + update(); + } + + @SuppressWarnings("deprecation") + @Override + public void update() + { + ItemBuilder builder = new ItemBuilder(new ItemStack(_community.getFavoriteGame().getMaterial(), 1, _community.getFavoriteGame().getMaterialData(), null)).setTitle(C.cGreenB + _community.getName()).addLore(UtilText.splitLinesToArray(new String[] {C.cRed, C.cYellow + "Members " + C.cWhite + _community.getMembers().size(), C.cYellow + "Favorite Game " + C.cWhite + _community.getFavoriteGame().getName(), C.cYellow + "Description " + C.cWhite + _community.getDescription()}, LineFormat.LORE)); + if (_invite) + { + builder.addLore(UtilText.splitLinesToArray(new String[] {C.cGold, C.cYellow + "Shift-Left Click " + C.cWhite + "Join", C.cYellow + "Shift-Right Click " + C.cWhite + "Decline"}, LineFormat.LORE)); + } + builder.addLore(C.cBlue, C.cGreen + "Click to view community"); + Button = builder.build(); + } + + @Override + public void handleClick(ClickType type) + { + if (_invite && type == ClickType.SHIFT_RIGHT) + { + getCommunityManager().handleRejectInvite(_viewer, _community); + } + else if (_invite && type == ClickType.SHIFT_LEFT) + { + getCommunityManager().handleJoin(_viewer, _community, true); + } + else + { + new CommunityMembersPage(_viewer, _community).open(); + } + } +} \ No newline at end of file diff --git a/Plugins/Mineplex.Core/src/mineplex/core/communities/mcs/MCSTheme.java b/Plugins/Mineplex.Core/src/mineplex/core/communities/mcs/MCSTheme.java new file mode 100644 index 000000000..215cf9106 --- /dev/null +++ b/Plugins/Mineplex.Core/src/mineplex/core/communities/mcs/MCSTheme.java @@ -0,0 +1,50 @@ +package mineplex.core.communities.mcs; + +import org.bukkit.Material; + +import mineplex.core.common.util.C; + +public enum MCSTheme +{ + CANDYLAND(1, C.cPurple + "Candyland", Material.COOKIE, 1000, "Lobby_MPS_Candyland.zip") + ; + + private final int _id; + private final String _displayName, _file; + private final Material _displayType; + private final int _cost; + + private MCSTheme(int id, String displayName, Material displayType, int cost, String file) + { + _id = id; + _displayName = displayName; + _displayType = displayType; + _cost = cost; + _file = file; + } + + public int getId() + { + return _id; + } + + public String getDisplayName() + { + return _displayName; + } + + public Material getDisplayType() + { + return _displayType; + } + + public int getCost() + { + return _cost; + } + + public String getFile() + { + return _file; + } +} \ No newline at end of file diff --git a/Plugins/Mineplex.Core/src/mineplex/core/communities/redis/CommunityChat.java b/Plugins/Mineplex.Core/src/mineplex/core/communities/redis/CommunityChat.java new file mode 100644 index 000000000..15028f160 --- /dev/null +++ b/Plugins/Mineplex.Core/src/mineplex/core/communities/redis/CommunityChat.java @@ -0,0 +1,32 @@ +package mineplex.core.communities.redis; + +import mineplex.serverdata.commands.ServerCommand; + +public class CommunityChat extends ServerCommand +{ + private String _senderName; + private Integer _communityId; + private String _message; + + public CommunityChat(String senderName, Integer communityId, String message) + { + _senderName = senderName; + _communityId = communityId; + _message = message; + } + + public String getSenderName() + { + return _senderName; + } + + public Integer getCommunityId() + { + return _communityId; + } + + public String getMessage() + { + return _message; + } +} \ No newline at end of file diff --git a/Plugins/Mineplex.Core/src/mineplex/core/communities/redis/CommunityChatHandler.java b/Plugins/Mineplex.Core/src/mineplex/core/communities/redis/CommunityChatHandler.java new file mode 100644 index 000000000..de82598e9 --- /dev/null +++ b/Plugins/Mineplex.Core/src/mineplex/core/communities/redis/CommunityChatHandler.java @@ -0,0 +1,25 @@ +package mineplex.core.communities.redis; + +import mineplex.core.communities.CommunityManager; +import mineplex.serverdata.commands.CommandCallback; +import mineplex.serverdata.commands.ServerCommand; + +public class CommunityChatHandler implements CommandCallback +{ + private CommunityManager _manager; + + public CommunityChatHandler(CommunityManager manager) + { + _manager = manager; + } + + @Override + public void run(ServerCommand command) + { + if (command instanceof CommunityChat) + { + CommunityChat chat = ((CommunityChat) command); + _manager.handleCommunityChat(chat.getCommunityId(), chat.getSenderName(), chat.getMessage()); + } + } +} \ No newline at end of file diff --git a/Plugins/Mineplex.Core/src/mineplex/core/communities/redis/CommunityCloseJoinRequest.java b/Plugins/Mineplex.Core/src/mineplex/core/communities/redis/CommunityCloseJoinRequest.java new file mode 100644 index 000000000..569a02958 --- /dev/null +++ b/Plugins/Mineplex.Core/src/mineplex/core/communities/redis/CommunityCloseJoinRequest.java @@ -0,0 +1,53 @@ +package mineplex.core.communities.redis; + +import mineplex.serverdata.commands.ServerCommand; + +public class CommunityCloseJoinRequest extends ServerCommand +{ + private Integer _communityId; + private String _sender; + private String _playerName; + private String _playerUUID; + private Integer _accountId; + private boolean _announce; + + public CommunityCloseJoinRequest(Integer communityId, String sender, String playerName, String playerUUID, Integer accountId, boolean announce) + { + _communityId = communityId; + _sender = sender; + _playerName = playerName; + _playerUUID = playerUUID; + _accountId = accountId; + _announce = announce; + } + + public Integer getCommunityId() + { + return _communityId; + } + + public String getSender() + { + return _sender; + } + + public String getPlayerName() + { + return _playerName; + } + + public String getPlayerUUID() + { + return _playerUUID; + } + + public Integer getAccountId() + { + return _accountId; + } + + public boolean shouldAnnounce() + { + return _announce; + } +} \ No newline at end of file diff --git a/Plugins/Mineplex.Core/src/mineplex/core/communities/redis/CommunityCloseJoinRequestHandler.java b/Plugins/Mineplex.Core/src/mineplex/core/communities/redis/CommunityCloseJoinRequestHandler.java new file mode 100644 index 000000000..15f2e2164 --- /dev/null +++ b/Plugins/Mineplex.Core/src/mineplex/core/communities/redis/CommunityCloseJoinRequestHandler.java @@ -0,0 +1,34 @@ +package mineplex.core.communities.redis; + +import java.util.UUID; + +import mineplex.core.communities.CommunityManager; +import mineplex.serverdata.commands.CommandCallback; +import mineplex.serverdata.commands.ServerCommand; + +public class CommunityCloseJoinRequestHandler implements CommandCallback +{ + private CommunityManager _manager; + + public CommunityCloseJoinRequestHandler(CommunityManager manager) + { + _manager = manager; + } + + @Override + public void run(ServerCommand command) + { + if (command instanceof CommunityCloseJoinRequest) + { + CommunityCloseJoinRequest update = ((CommunityCloseJoinRequest) command); + Integer id = update.getCommunityId(); + String sender = update.getSender(); + UUID uuid = UUID.fromString(update.getPlayerUUID()); + String name = update.getPlayerName(); + Integer accountId = update.getAccountId(); + boolean announce = update.shouldAnnounce(); + + _manager.handleCommunityCloseJoinRequest(id, sender, name, uuid, accountId, announce); + } + } +} \ No newline at end of file diff --git a/Plugins/Mineplex.Core/src/mineplex/core/communities/redis/CommunityCreate.java b/Plugins/Mineplex.Core/src/mineplex/core/communities/redis/CommunityCreate.java new file mode 100644 index 000000000..4e3a364e1 --- /dev/null +++ b/Plugins/Mineplex.Core/src/mineplex/core/communities/redis/CommunityCreate.java @@ -0,0 +1,46 @@ +package mineplex.core.communities.redis; + +import mineplex.serverdata.commands.ServerCommand; + +public class CommunityCreate extends ServerCommand +{ + private String _leaderUUID; + private String _leaderName; + private Integer _leaderId; + private Integer _communityId; + private String _communityName; + + public CommunityCreate(String leaderUUID, String leaderName, Integer leaderId, Integer communityId, String communityName) + { + _leaderUUID = leaderUUID; + _leaderName = leaderName; + _leaderId = leaderId; + _communityId = communityId; + _communityName = communityName; + } + + public String getLeaderUUID() + { + return _leaderUUID; + } + + public String getLeaderName() + { + return _leaderName; + } + + public Integer getLeaderId() + { + return _leaderId; + } + + public Integer getCommunityId() + { + return _communityId; + } + + public String getCommunityName() + { + return _communityName; + } +} \ No newline at end of file diff --git a/Plugins/Mineplex.Core/src/mineplex/core/communities/redis/CommunityCreateHandler.java b/Plugins/Mineplex.Core/src/mineplex/core/communities/redis/CommunityCreateHandler.java new file mode 100644 index 000000000..741ace018 --- /dev/null +++ b/Plugins/Mineplex.Core/src/mineplex/core/communities/redis/CommunityCreateHandler.java @@ -0,0 +1,33 @@ +package mineplex.core.communities.redis; + +import java.util.UUID; + +import mineplex.core.communities.CommunityManager; +import mineplex.serverdata.commands.CommandCallback; +import mineplex.serverdata.commands.ServerCommand; + +public class CommunityCreateHandler implements CommandCallback +{ + private CommunityManager _manager; + + public CommunityCreateHandler(CommunityManager manager) + { + _manager = manager; + } + + @Override + public void run(ServerCommand command) + { + if (command instanceof CommunityCreate) + { + CommunityCreate update = ((CommunityCreate) command); + UUID leaderUUID = UUID.fromString(update.getLeaderUUID()); + Integer communityId = update.getCommunityId(); + String communityName = update.getCommunityName(); + Integer leaderId = update.getLeaderId(); + String leaderName = update.getLeaderName(); + + _manager.handleCommunityCreation(communityId, communityName, leaderId, leaderUUID, leaderName); + } + } +} \ No newline at end of file diff --git a/Plugins/Mineplex.Core/src/mineplex/core/communities/redis/CommunityDisband.java b/Plugins/Mineplex.Core/src/mineplex/core/communities/redis/CommunityDisband.java new file mode 100644 index 000000000..fe69e4404 --- /dev/null +++ b/Plugins/Mineplex.Core/src/mineplex/core/communities/redis/CommunityDisband.java @@ -0,0 +1,25 @@ +package mineplex.core.communities.redis; + +import mineplex.serverdata.commands.ServerCommand; + +public class CommunityDisband extends ServerCommand +{ + private String _senderName; + private Integer _communityId; + + public CommunityDisband(String senderName, Integer communityId) + { + _senderName = senderName; + _communityId = communityId; + } + + public String getSenderName() + { + return _senderName; + } + + public Integer getCommunityId() + { + return _communityId; + } +} \ No newline at end of file diff --git a/Plugins/Mineplex.Core/src/mineplex/core/communities/redis/CommunityDisbandHandler.java b/Plugins/Mineplex.Core/src/mineplex/core/communities/redis/CommunityDisbandHandler.java new file mode 100644 index 000000000..8b4c31e20 --- /dev/null +++ b/Plugins/Mineplex.Core/src/mineplex/core/communities/redis/CommunityDisbandHandler.java @@ -0,0 +1,30 @@ +package mineplex.core.communities.redis; + +import java.util.UUID; + +import mineplex.core.communities.CommunityManager; +import mineplex.serverdata.commands.CommandCallback; +import mineplex.serverdata.commands.ServerCommand; + +public class CommunityDisbandHandler implements CommandCallback +{ + private CommunityManager _manager; + + public CommunityDisbandHandler(CommunityManager manager) + { + _manager = manager; + } + + @Override + public void run(ServerCommand command) + { + if (command instanceof CommunityDisband) + { + CommunityDisband update = ((CommunityDisband) command); + String senderName = update.getSenderName(); + Integer communityId = update.getCommunityId(); + + _manager.handleCommunityDisband(communityId, senderName); + } + } +} \ No newline at end of file diff --git a/Plugins/Mineplex.Core/src/mineplex/core/communities/redis/CommunityInvite.java b/Plugins/Mineplex.Core/src/mineplex/core/communities/redis/CommunityInvite.java new file mode 100644 index 000000000..374d3b5e1 --- /dev/null +++ b/Plugins/Mineplex.Core/src/mineplex/core/communities/redis/CommunityInvite.java @@ -0,0 +1,39 @@ +package mineplex.core.communities.redis; + +import mineplex.serverdata.commands.ServerCommand; + +public class CommunityInvite extends ServerCommand +{ + private Integer _communityId; + private String _sender; + private String _playerName; + private String _playerUUID; + + public CommunityInvite(Integer communityId, String sender, String playerName, String playerUUID) + { + _communityId = communityId; + _sender = sender; + _playerName = playerName; + _playerUUID = playerUUID; + } + + public Integer getCommunityId() + { + return _communityId; + } + + public String getSender() + { + return _sender; + } + + public String getPlayerName() + { + return _playerName; + } + + public String getPlayerUUID() + { + return _playerUUID; + } +} \ No newline at end of file diff --git a/Plugins/Mineplex.Core/src/mineplex/core/communities/redis/CommunityInviteHandler.java b/Plugins/Mineplex.Core/src/mineplex/core/communities/redis/CommunityInviteHandler.java new file mode 100644 index 000000000..065ac86a7 --- /dev/null +++ b/Plugins/Mineplex.Core/src/mineplex/core/communities/redis/CommunityInviteHandler.java @@ -0,0 +1,32 @@ +package mineplex.core.communities.redis; + +import java.util.UUID; + +import mineplex.core.communities.CommunityManager; +import mineplex.serverdata.commands.CommandCallback; +import mineplex.serverdata.commands.ServerCommand; + +public class CommunityInviteHandler implements CommandCallback +{ + private CommunityManager _manager; + + public CommunityInviteHandler(CommunityManager manager) + { + _manager = manager; + } + + @Override + public void run(ServerCommand command) + { + if (command instanceof CommunityInvite) + { + CommunityInvite update = ((CommunityInvite) command); + Integer id = update.getCommunityId(); + String sender = update.getSender(); + String name = update.getPlayerName(); + UUID uuid = UUID.fromString(update.getPlayerUUID()); + + _manager.handleCommunityInvite(id, sender, name, uuid); + } + } +} \ No newline at end of file diff --git a/Plugins/Mineplex.Core/src/mineplex/core/communities/redis/CommunityJoinRequest.java b/Plugins/Mineplex.Core/src/mineplex/core/communities/redis/CommunityJoinRequest.java new file mode 100644 index 000000000..ccfdaf6bd --- /dev/null +++ b/Plugins/Mineplex.Core/src/mineplex/core/communities/redis/CommunityJoinRequest.java @@ -0,0 +1,39 @@ +package mineplex.core.communities.redis; + +import mineplex.serverdata.commands.ServerCommand; + +public class CommunityJoinRequest extends ServerCommand +{ + private Integer _communityId; + private String _playerName; + private String _playerUUID; + private Integer _accountId; + + public CommunityJoinRequest(Integer communityId, String playerName, String playerUUID, Integer accountId) + { + _communityId = communityId; + _playerName = playerName; + _playerUUID = playerUUID; + _accountId = accountId; + } + + public Integer getCommunityId() + { + return _communityId; + } + + public String getPlayerName() + { + return _playerName; + } + + public String getPlayerUUID() + { + return _playerUUID; + } + + public Integer getAccountId() + { + return _accountId; + } +} \ No newline at end of file diff --git a/Plugins/Mineplex.Core/src/mineplex/core/communities/redis/CommunityJoinRequestHandler.java b/Plugins/Mineplex.Core/src/mineplex/core/communities/redis/CommunityJoinRequestHandler.java new file mode 100644 index 000000000..f68ba99d0 --- /dev/null +++ b/Plugins/Mineplex.Core/src/mineplex/core/communities/redis/CommunityJoinRequestHandler.java @@ -0,0 +1,32 @@ +package mineplex.core.communities.redis; + +import java.util.UUID; + +import mineplex.core.communities.CommunityManager; +import mineplex.serverdata.commands.CommandCallback; +import mineplex.serverdata.commands.ServerCommand; + +public class CommunityJoinRequestHandler implements CommandCallback +{ + private CommunityManager _manager; + + public CommunityJoinRequestHandler(CommunityManager manager) + { + _manager = manager; + } + + @Override + public void run(ServerCommand command) + { + if (command instanceof CommunityJoinRequest) + { + CommunityJoinRequest update = ((CommunityJoinRequest) command); + Integer id = update.getCommunityId(); + UUID uuid = UUID.fromString(update.getPlayerUUID()); + String name = update.getPlayerName(); + Integer accountId = update.getAccountId(); + + _manager.handleCommunityJoinRequest(id, name, uuid, accountId); + } + } +} \ No newline at end of file diff --git a/Plugins/Mineplex.Core/src/mineplex/core/communities/redis/CommunityUnInvite.java b/Plugins/Mineplex.Core/src/mineplex/core/communities/redis/CommunityUnInvite.java new file mode 100644 index 000000000..13537e115 --- /dev/null +++ b/Plugins/Mineplex.Core/src/mineplex/core/communities/redis/CommunityUnInvite.java @@ -0,0 +1,46 @@ +package mineplex.core.communities.redis; + +import mineplex.serverdata.commands.ServerCommand; + +public class CommunityUnInvite extends ServerCommand +{ + private Integer _communityId; + private String _sender; + private String _playerName; + private String _playerUUID; + private boolean _announce; + + public CommunityUnInvite(Integer communityId, String sender, String playerName, String playerUUID, boolean announce) + { + _communityId = communityId; + _sender = sender; + _playerName = playerName; + _playerUUID = playerUUID; + _announce = announce; + } + + public Integer getCommunityId() + { + return _communityId; + } + + public String getSender() + { + return _sender; + } + + public String getPlayerName() + { + return _playerName; + } + + public String getPlayerUUID() + { + return _playerUUID; + } + + public boolean shouldAnnounce() + { + return _announce; + } +} \ No newline at end of file diff --git a/Plugins/Mineplex.Core/src/mineplex/core/communities/redis/CommunityUnInviteHandler.java b/Plugins/Mineplex.Core/src/mineplex/core/communities/redis/CommunityUnInviteHandler.java new file mode 100644 index 000000000..d38f9779f --- /dev/null +++ b/Plugins/Mineplex.Core/src/mineplex/core/communities/redis/CommunityUnInviteHandler.java @@ -0,0 +1,33 @@ +package mineplex.core.communities.redis; + +import java.util.UUID; + +import mineplex.core.communities.CommunityManager; +import mineplex.serverdata.commands.CommandCallback; +import mineplex.serverdata.commands.ServerCommand; + +public class CommunityUnInviteHandler implements CommandCallback +{ + private CommunityManager _manager; + + public CommunityUnInviteHandler(CommunityManager manager) + { + _manager = manager; + } + + @Override + public void run(ServerCommand command) + { + if (command instanceof CommunityUnInvite) + { + CommunityUnInvite update = ((CommunityUnInvite) command); + Integer id = update.getCommunityId(); + String sender = update.getSender(); + String name = update.getPlayerName(); + UUID uuid = UUID.fromString(update.getPlayerUUID()); + boolean announce = update.shouldAnnounce(); + + _manager.handleCommunityUninvite(id, sender, name, uuid, announce); + } + } +} \ No newline at end of file diff --git a/Plugins/Mineplex.Core/src/mineplex/core/communities/redis/CommunityUpdateMemberChatReading.java b/Plugins/Mineplex.Core/src/mineplex/core/communities/redis/CommunityUpdateMemberChatReading.java new file mode 100644 index 000000000..de74302de --- /dev/null +++ b/Plugins/Mineplex.Core/src/mineplex/core/communities/redis/CommunityUpdateMemberChatReading.java @@ -0,0 +1,32 @@ +package mineplex.core.communities.redis; + +import mineplex.serverdata.commands.ServerCommand; + +public class CommunityUpdateMemberChatReading extends ServerCommand +{ + private Integer _communityId; + private String _playerUUID; + private boolean _reading; + + public CommunityUpdateMemberChatReading(Integer communityId, String playerUUID, boolean reading) + { + _communityId = communityId; + _playerUUID = playerUUID; + _reading = reading; + } + + public Integer getCommunityId() + { + return _communityId; + } + + public String getPlayerUUID() + { + return _playerUUID; + } + + public boolean reading() + { + return _reading; + } +} \ No newline at end of file diff --git a/Plugins/Mineplex.Core/src/mineplex/core/communities/redis/CommunityUpdateMemberChatReadingHandler.java b/Plugins/Mineplex.Core/src/mineplex/core/communities/redis/CommunityUpdateMemberChatReadingHandler.java new file mode 100644 index 000000000..a536ee7f8 --- /dev/null +++ b/Plugins/Mineplex.Core/src/mineplex/core/communities/redis/CommunityUpdateMemberChatReadingHandler.java @@ -0,0 +1,31 @@ +package mineplex.core.communities.redis; + +import java.util.UUID; + +import mineplex.core.communities.CommunityManager; +import mineplex.serverdata.commands.CommandCallback; +import mineplex.serverdata.commands.ServerCommand; + +public class CommunityUpdateMemberChatReadingHandler implements CommandCallback +{ + private CommunityManager _manager; + + public CommunityUpdateMemberChatReadingHandler(CommunityManager manager) + { + _manager = manager; + } + + @Override + public void run(ServerCommand command) + { + if (command instanceof CommunityUpdateMemberChatReading) + { + CommunityUpdateMemberChatReading update = ((CommunityUpdateMemberChatReading) command); + Integer id = update.getCommunityId(); + UUID uuid = UUID.fromString(update.getPlayerUUID()); + boolean reading = update.reading(); + + _manager.handleToggleReadingCommunityChat(id, uuid, reading); + } + } +} \ No newline at end of file diff --git a/Plugins/Mineplex.Core/src/mineplex/core/communities/redis/CommunityUpdateMemberRole.java b/Plugins/Mineplex.Core/src/mineplex/core/communities/redis/CommunityUpdateMemberRole.java new file mode 100644 index 000000000..9f42ad0c4 --- /dev/null +++ b/Plugins/Mineplex.Core/src/mineplex/core/communities/redis/CommunityUpdateMemberRole.java @@ -0,0 +1,39 @@ +package mineplex.core.communities.redis; + +import mineplex.serverdata.commands.ServerCommand; + +public class CommunityUpdateMemberRole extends ServerCommand +{ + private Integer _communityId; + private String _sender; + private String _playerUUID; + private String _memberRole; + + public CommunityUpdateMemberRole(Integer communityId, String sender, String playerUUID, String memberRole) + { + _communityId = communityId; + _sender = sender; + _playerUUID = playerUUID; + _memberRole = memberRole; + } + + public Integer getCommunityId() + { + return _communityId; + } + + public String getSender() + { + return _sender; + } + + public String getPlayerUUID() + { + return _playerUUID; + } + + public String getMemberRole() + { + return _memberRole; + } +} \ No newline at end of file diff --git a/Plugins/Mineplex.Core/src/mineplex/core/communities/redis/CommunityUpdateMemberRoleHandler.java b/Plugins/Mineplex.Core/src/mineplex/core/communities/redis/CommunityUpdateMemberRoleHandler.java new file mode 100644 index 000000000..bced0dc12 --- /dev/null +++ b/Plugins/Mineplex.Core/src/mineplex/core/communities/redis/CommunityUpdateMemberRoleHandler.java @@ -0,0 +1,32 @@ +package mineplex.core.communities.redis; + +import java.util.UUID; + +import mineplex.core.communities.CommunityManager; +import mineplex.core.communities.CommunityRole; +import mineplex.serverdata.commands.CommandCallback; +import mineplex.serverdata.commands.ServerCommand; + +public class CommunityUpdateMemberRoleHandler implements CommandCallback +{ + private CommunityManager _manager; + + public CommunityUpdateMemberRoleHandler(CommunityManager manager) + { + _manager = manager; + } + + @Override + public void run(ServerCommand command) + { + if (command instanceof CommunityUpdateMemberRole) + { + CommunityUpdateMemberRole update = ((CommunityUpdateMemberRole) command); + Integer id = update.getCommunityId(); + UUID uuid = UUID.fromString(update.getPlayerUUID()); + CommunityRole role = CommunityRole.parseRole(update.getMemberRole()); + + _manager.handleCommunityMembershipRoleUpdate(id, update.getSender(), uuid, role); + } + } +} \ No newline at end of file diff --git a/Plugins/Mineplex.Core/src/mineplex/core/communities/redis/CommunityUpdateMembership.java b/Plugins/Mineplex.Core/src/mineplex/core/communities/redis/CommunityUpdateMembership.java new file mode 100644 index 000000000..cb870d786 --- /dev/null +++ b/Plugins/Mineplex.Core/src/mineplex/core/communities/redis/CommunityUpdateMembership.java @@ -0,0 +1,60 @@ +package mineplex.core.communities.redis; + +import mineplex.serverdata.commands.ServerCommand; + +public class CommunityUpdateMembership extends ServerCommand +{ + private Integer _communityId; + private String _sender; + private String _playerName; + private String _playerUUID; + private Integer _accountId; + private boolean _kick; + private boolean _leave; + + public CommunityUpdateMembership(Integer communityId, String sender, String playerName, String playerUUID, Integer accountId, boolean kick, boolean leave) + { + _communityId = communityId; + _sender = sender; + _playerName = playerName; + _playerUUID = playerUUID; + _accountId = accountId; + _kick = kick; + _leave = leave; + } + + public Integer getCommunityId() + { + return _communityId; + } + + public String getSender() + { + return _sender; + } + + public String getPlayerName() + { + return _playerName; + } + + public String getPlayerUUID() + { + return _playerUUID; + } + + public Integer getAccountId() + { + return _accountId; + } + + public boolean isKick() + { + return _kick; + } + + public boolean isLeave() + { + return _leave; + } +} \ No newline at end of file diff --git a/Plugins/Mineplex.Core/src/mineplex/core/communities/redis/CommunityUpdateMembershipHandler.java b/Plugins/Mineplex.Core/src/mineplex/core/communities/redis/CommunityUpdateMembershipHandler.java new file mode 100644 index 000000000..2ca354304 --- /dev/null +++ b/Plugins/Mineplex.Core/src/mineplex/core/communities/redis/CommunityUpdateMembershipHandler.java @@ -0,0 +1,35 @@ +package mineplex.core.communities.redis; + +import java.util.UUID; + +import mineplex.core.communities.CommunityManager; +import mineplex.serverdata.commands.CommandCallback; +import mineplex.serverdata.commands.ServerCommand; + +public class CommunityUpdateMembershipHandler implements CommandCallback +{ + private CommunityManager _manager; + + public CommunityUpdateMembershipHandler(CommunityManager manager) + { + _manager = manager; + } + + @Override + public void run(ServerCommand command) + { + if (command instanceof CommunityUpdateMembership) + { + CommunityUpdateMembership update = ((CommunityUpdateMembership) command); + Integer id = update.getCommunityId(); + UUID uuid = UUID.fromString(update.getPlayerUUID()); + String sender = update.getSender(); + String name = update.getPlayerName(); + Integer accountId = update.getAccountId(); + boolean kick = update.isKick(); + boolean leave = update.isLeave(); + + _manager.handleCommunityMembershipUpdate(id, sender, name, uuid, accountId, kick, leave); + } + } +} \ No newline at end of file diff --git a/Plugins/Mineplex.Core/src/mineplex/core/communities/redis/CommunityUpdateName.java b/Plugins/Mineplex.Core/src/mineplex/core/communities/redis/CommunityUpdateName.java new file mode 100644 index 000000000..a58347a2c --- /dev/null +++ b/Plugins/Mineplex.Core/src/mineplex/core/communities/redis/CommunityUpdateName.java @@ -0,0 +1,32 @@ +package mineplex.core.communities.redis; + +import mineplex.serverdata.commands.ServerCommand; + +public class CommunityUpdateName extends ServerCommand +{ + private Integer _communityId; + private String _sender; + private String _name; + + public CommunityUpdateName(Integer communityId, String sender, String name) + { + _communityId = communityId; + _sender = sender; + _name = name; + } + + public Integer getCommunityId() + { + return _communityId; + } + + public String getSender() + { + return _sender; + } + + public String getName() + { + return _name; + } +} \ No newline at end of file diff --git a/Plugins/Mineplex.Core/src/mineplex/core/communities/redis/CommunityUpdateNameHandler.java b/Plugins/Mineplex.Core/src/mineplex/core/communities/redis/CommunityUpdateNameHandler.java new file mode 100644 index 000000000..b854b121f --- /dev/null +++ b/Plugins/Mineplex.Core/src/mineplex/core/communities/redis/CommunityUpdateNameHandler.java @@ -0,0 +1,29 @@ +package mineplex.core.communities.redis; + +import mineplex.core.communities.CommunityManager; +import mineplex.serverdata.commands.CommandCallback; +import mineplex.serverdata.commands.ServerCommand; + +public class CommunityUpdateNameHandler implements CommandCallback +{ + private CommunityManager _manager; + + public CommunityUpdateNameHandler(CommunityManager manager) + { + _manager = manager; + } + + @Override + public void run(ServerCommand command) + { + if (command instanceof CommunityUpdateName) + { + CommunityUpdateName update = ((CommunityUpdateName) command); + Integer id = update.getCommunityId(); + String sender = update.getSender(); + String name = update.getName(); + + _manager.handleCommunityNameUpdate(id, sender, name); + } + } +} \ No newline at end of file diff --git a/Plugins/Mineplex.Core/src/mineplex/core/communities/redis/CommunityUpdateSetting.java b/Plugins/Mineplex.Core/src/mineplex/core/communities/redis/CommunityUpdateSetting.java new file mode 100644 index 000000000..bae592d9c --- /dev/null +++ b/Plugins/Mineplex.Core/src/mineplex/core/communities/redis/CommunityUpdateSetting.java @@ -0,0 +1,39 @@ +package mineplex.core.communities.redis; + +import mineplex.serverdata.commands.ServerCommand; + +public class CommunityUpdateSetting extends ServerCommand +{ + private Integer _communityId; + private String _sender; + private String _setting; + private String _newValue; + + public CommunityUpdateSetting(Integer communityId, String sender, String setting, String newValue) + { + _communityId = communityId; + _sender = sender; + _setting = setting; + _newValue = newValue; + } + + public Integer getCommunityId() + { + return _communityId; + } + + public String getSender() + { + return _sender; + } + + public String getSetting() + { + return _setting; + } + + public String getNewValue() + { + return _newValue; + } +} \ No newline at end of file diff --git a/Plugins/Mineplex.Core/src/mineplex/core/communities/redis/CommunityUpdateSettingHandler.java b/Plugins/Mineplex.Core/src/mineplex/core/communities/redis/CommunityUpdateSettingHandler.java new file mode 100644 index 000000000..198a50694 --- /dev/null +++ b/Plugins/Mineplex.Core/src/mineplex/core/communities/redis/CommunityUpdateSettingHandler.java @@ -0,0 +1,30 @@ +package mineplex.core.communities.redis; + +import mineplex.core.communities.CommunityManager; +import mineplex.core.communities.CommunitySetting; +import mineplex.serverdata.commands.CommandCallback; +import mineplex.serverdata.commands.ServerCommand; + +public class CommunityUpdateSettingHandler implements CommandCallback +{ + private CommunityManager _manager; + + public CommunityUpdateSettingHandler(CommunityManager manager) + { + _manager = manager; + } + + @Override + public void run(ServerCommand command) + { + if (command instanceof CommunityUpdateSetting) + { + CommunityUpdateSetting update = ((CommunityUpdateSetting) command); + Integer id = update.getCommunityId(); + CommunitySetting setting = CommunitySetting.valueOf(update.getSetting()); + String newValue = update.getNewValue(); + + _manager.handleCommunitySettingUpdate(id, update.getSender(), setting, newValue); + } + } +} \ No newline at end of file diff --git a/Plugins/Mineplex.Core/src/mineplex/core/communities/redis/PlayerJoinHandler.java b/Plugins/Mineplex.Core/src/mineplex/core/communities/redis/PlayerJoinHandler.java new file mode 100644 index 000000000..5ed774fcb --- /dev/null +++ b/Plugins/Mineplex.Core/src/mineplex/core/communities/redis/PlayerJoinHandler.java @@ -0,0 +1,26 @@ +package mineplex.core.communities.redis; + +import mineplex.core.communities.CommunityManager; +import mineplex.serverdata.commands.CommandCallback; +import mineplex.serverdata.commands.PlayerJoinCommand; +import mineplex.serverdata.commands.ServerCommand; + +public class PlayerJoinHandler implements CommandCallback +{ + private CommunityManager _communityManager; + + public PlayerJoinHandler(CommunityManager communityManager) + { + _communityManager = communityManager; + } + + @Override + public void run(ServerCommand command) + { + if (command instanceof PlayerJoinCommand) + { + PlayerJoinCommand joinCommand = (PlayerJoinCommand)command; + //_communityManager.updateAllMemberData(UUID.fromString(joinCommand.getUuid()), joinCommand.getName()); + } + } +} \ No newline at end of file diff --git a/Plugins/Mineplex.Core/src/mineplex/core/communities/storage/CommunityRepository.java b/Plugins/Mineplex.Core/src/mineplex/core/communities/storage/CommunityRepository.java new file mode 100644 index 000000000..4d9d45992 --- /dev/null +++ b/Plugins/Mineplex.Core/src/mineplex/core/communities/storage/CommunityRepository.java @@ -0,0 +1,330 @@ +package mineplex.core.communities.storage; + +import java.sql.Connection; +import java.sql.SQLException; +import java.util.HashMap; +import java.util.LinkedList; +import java.util.List; +import java.util.Map; +import java.util.UUID; +import java.util.stream.Collectors; +import java.util.stream.Stream; + +import org.bukkit.plugin.java.JavaPlugin; + +import mineplex.core.common.timing.TimingManager; +import mineplex.core.common.util.Callback; +import mineplex.core.communities.Community; +import mineplex.core.communities.CommunityJoinRequestInfo; +import mineplex.core.communities.CommunityMemberInfo; +import mineplex.core.communities.CommunityRole; +import mineplex.core.communities.CommunitySetting; +import mineplex.serverdata.data.DataRepository; +import mineplex.serverdata.data.PlayerStatus; +import mineplex.serverdata.database.DBPool; +import mineplex.serverdata.database.RepositoryBase; +import mineplex.serverdata.database.column.ColumnBoolean; +import mineplex.serverdata.database.column.ColumnInt; +import mineplex.serverdata.database.column.ColumnVarChar; + +public class CommunityRepository extends RepositoryBase +{ + private static final String GET_ALL_COMMUNITIES = "SELECT * FROM communities WHERE region=?;"; + private static final String GET_COMMUNITY_BY_ID = "SELECT * FROM communities WHERE id=?;"; + private static final String GET_COMMUNITY_BY_NAME = "SELECT * FROM communities WHERE name=? AND region=?;"; + private static final String GET_COMMUNITY_MEMBERS = "SELECT cm.communityId, cm.accountId, cm.communityRole, ac.name, ac.uuid, ac.lastLogin, cm.readingChat FROM communityMembers cm INNER JOIN accounts ac ON ac.id=cm.accountId;"; + private static final String GET_COMMUNITY_JOIN_REQUESTS = "SELECT cjr.communityId, cjr.accountId, ac.name, ac.uuid FROM communityJoinRequests cjr INNER JOIN accounts ac ON ac.id=cjr.accountId;"; + private static final String GET_COMMUNITY_SETTINGS = "SELECT communityId, settingId, settingValue FROM communitySettings;"; + + private static final String REMOVE_FROM_COMMUNITY = "DELETE FROM communityMembers WHERE accountId=? AND communityId=?;"; + private static final String UPDATE_COMMUNITY_ROLE = "UPDATE communityMembers SET communityRole=? WHERE accountId=? AND communityId=?;"; + private static final String ADD_TO_COMMUNITY = "INSERT INTO communityMembers (accountId, communityId, communityRole, readingChat) VALUES (?, ?, ?, true);"; + private static final String UPDATE_COMMUNITY_SETTING = "INSERT INTO communitySettings (settingId, communityId, settingValue) VALUES (?, ?, ?) ON DUPLICATE KEY UPDATE settingValue=VALUES(settingValue);"; + private static final String UPDATE_COMMUNITY_NAME = "UPDATE communities SET name=? WHERE id=?;"; + private static final String INVITE_TO_COMMUNITY = "INSERT INTO communityInvites (accountId, communityId) SELECT a.id AS accountId, ? FROM accounts as a WHERE a.name = ? ORDER BY a.lastLogin DESC LIMIT 1 ON DUPLICATE KEY UPDATE communityInvites.id=communityInvites.id;"; + private static final String DELETE_INVITE_TO_COMMUNITY = "DELETE i FROM communityInvites AS i INNER JOIN accounts as a ON i.accountId = a.id WHERE a.name = ? AND i.communityId=?;"; + private static final String ADD_JOIN_REQUEST = "INSERT INTO communityJoinRequests (accountId, communityId) VALUES (?, ?);"; + private static final String REMOVE_JOIN_REQUEST = "DELETE FROM communityJoinRequests WHERE accountId=? AND communityId=?;"; + + private static final String CREATE_COMMUNITY = "INSERT INTO communities (name, region) VALUES (?, ?);"; + + private static final String SET_READING_CHAT_IN = "UPDATE communityMembers SET readingChat=? WHERE accountId=? AND communityId=?;"; + + private DataRepository _repo; + private boolean _us; + + public CommunityRepository(JavaPlugin plugin, DataRepository statusRepo, boolean us) + { + super(DBPool.getAccount()); + + _repo = statusRepo; + _us = us; + } + + public void loadCommunities(final Map communityMap) + { + try (Connection connection = getConnection()) + { + executeQuery(connection, GET_ALL_COMMUNITIES, resultSet -> + { + Map resultant = new HashMap<>(); + while (resultSet.next()) + { + final int id = resultSet.getInt("id"); + final String cName = resultSet.getString("name"); + final Community community = new Community(id, cName); + + resultant.put(community.getId(), community); + } + + communityMap.clear(); + communityMap.putAll(resultant); + }, new ColumnVarChar("region", 5, _us ? "US" : "EU")); + + executeQuery(connection, GET_COMMUNITY_MEMBERS, memberSet -> + { + while (memberSet.next()) + { + final int communityId = memberSet.getInt("communityId"); + final int accountId = memberSet.getInt("accountId"); + final String name = memberSet.getString("name"); + final UUID uuid = UUID.fromString(memberSet.getString("uuid")); + final CommunityRole role = CommunityRole.parseRole(memberSet.getString("communityRole")); + final long lastLogin = memberSet.getTimestamp("lastLogin").getTime(); + boolean readingChat = memberSet.getBoolean("readingChat"); + + CommunityMemberInfo info = new CommunityMemberInfo(name, uuid, accountId, role, lastLogin); + info.ReadingChat = readingChat; + + Community community = communityMap.get(communityId); + if (community != null) + { + community.getMembers().put(info.UUID, info); + } + } + }); + + executeQuery(connection, GET_COMMUNITY_JOIN_REQUESTS, requestSet -> + { + while (requestSet.next()) + { + final int communityId = requestSet.getInt("communityId"); + final int accountId = requestSet.getInt("accountId"); + final UUID uuid = UUID.fromString(requestSet.getString("uuid")); + final String name = requestSet.getString("name"); + + Community community = communityMap.get(communityId); + if (community != null) + { + community.getJoinRequests().put(uuid, new CommunityJoinRequestInfo(name, uuid, accountId)); + } + } + }); + + executeQuery(connection, GET_COMMUNITY_SETTINGS, settingSet -> + { + while (settingSet.next()) + { + final int communityId = settingSet.getInt("communityId"); + final int settingId = settingSet.getInt("settingId"); + final String value = settingSet.getString("settingValue"); + + Community community = communityMap.get(communityId); + CommunitySetting setting = CommunitySetting.getSetting(settingId); + if (community != null && setting != null) + { + setting.parseValueInto(value, community); + } + } + }); + } + catch (SQLException e) + { + e.printStackTrace(); + } + } + + public void updateMembersAndJoinRequests(List communities) + { + if (communities.isEmpty()) + { + return; + } + + TimingManager.start("members + join requests for " + communities.size() + " communities"); + Map statuses = _repo.getElementsMap( + Stream.concat( + communities.stream().flatMap(community -> community.getMembers().keySet().stream()), + communities.stream().flatMap(community -> community.getJoinRequests().keySet().stream()) + ) + .distinct() + .map(UUID::toString) + .collect(Collectors.toList()) + ); + + for (Community c : communities) + { + // Update member player status + for (Map.Entry entry : c.getMembers().entrySet()) + { + CommunityMemberInfo info = entry.getValue(); + PlayerStatus status = statuses.get(entry.getKey().toString()); + + boolean online = false; + String server = ""; + if (status != null) + { + online = true; + server = status.getServer(); + info.update(System.currentTimeMillis(), online, server); + if (!info.Name.equals(status.getName())) + { + info.updateName(status.getName()); + } + } + else + { + if (info.isOnline()) + { + info.setOffline(); + } + } + } + + // Update join request names + for (Map.Entry entry : c.getJoinRequests().entrySet()) + { + + CommunityJoinRequestInfo info = entry.getValue(); + PlayerStatus status = statuses.get(entry.getKey().toString()); + + if (status != null) + { + if (!info.Name.equals(status.getName())) + { + info.update(status.getName()); + } + } + } + } + TimingManager.stop("members + join requests for " + communities.size() + " communities"); + } + + public void updateJoinRequests(LinkedList communities) + { + if (communities.isEmpty()) + { + return; + } + TimingManager.stop("request elements"); + } + + public void loadInvites(int accountId, List invites) + { + executeQuery("SELECT ci.communityId, c.region FROM communityInvites AS ci INNER JOIN communities AS c ON c.id=ci.communityId WHERE accountId=?;", resultSet -> + { + while (resultSet.next()) + { + String region = resultSet.getString("region"); + if ((_us && region.equalsIgnoreCase("US")) || (!_us && region.equalsIgnoreCase("EU"))) + { + invites.add(resultSet.getInt("communityId")); + } + } + }, new ColumnInt("accountId", accountId)); + } + + public void removeFromCommunity(int accountId, int communityId) + { + executeUpdate(REMOVE_FROM_COMMUNITY, new ColumnInt("accountId", accountId), new ColumnInt("communityId", communityId)); + } + + public void updateCommunityRole(int accountId, int communityId, CommunityRole role) + { + executeUpdate(UPDATE_COMMUNITY_ROLE, new ColumnVarChar("communityRole", 20, role.toString()), new ColumnInt("accountId", accountId), new ColumnInt("communityId", communityId)); + } + + public void addToCommunity(int accountId, int communityId) + { + executeUpdate(ADD_TO_COMMUNITY, new ColumnInt("accountId", accountId), new ColumnInt("communityId", communityId), new ColumnVarChar("communityRole", 20, CommunityRole.MEMBER.toString())); + } + + public void updateCommunitySetting(CommunitySetting setting, int communityId, String value) + { + executeUpdate(UPDATE_COMMUNITY_SETTING, new ColumnInt("settingId", setting.getId()), new ColumnInt("communityId", communityId), new ColumnVarChar("settingValue", 100, value)); + } + + public void updateCommunityName(int communityId, String name) + { + executeUpdate(UPDATE_COMMUNITY_NAME, new ColumnVarChar("name", 15, name), new ColumnInt("id", communityId)); + } + + public boolean inviteToCommunity(int communityId, String name) + { + return executeUpdate(INVITE_TO_COMMUNITY, new ColumnInt("communityId", communityId), new ColumnVarChar("name", 32, name)) > 0; + } + + public boolean deleteInviteToCommunity(int communityId, String name) + { + return executeUpdate(DELETE_INVITE_TO_COMMUNITY, new ColumnVarChar("name", 32, name), new ColumnInt("communityId", communityId)) > 0; + } + + public void addJoinRequest(int communityId, int accountId) + { + executeUpdate(ADD_JOIN_REQUEST, new ColumnInt("accountId", accountId), new ColumnInt("communityId", communityId)); + } + + public void removeJoinRequest(int communityId, int accountId) + { + executeUpdate(REMOVE_JOIN_REQUEST, new ColumnInt("accountId", accountId), new ColumnInt("communityId", communityId)); + } + + public void createCommunity(String name, int leaderAccount, Callback idCallback) + { + try (Connection connection = getConnection()) + { + executeInsert(connection, CREATE_COMMUNITY, resultSet -> + { + if (resultSet.next()) + { + int id = resultSet.getInt(1); + executeUpdate(connection, ADD_TO_COMMUNITY, null, new ColumnInt("accountId", leaderAccount), new ColumnInt("communityId", id), new ColumnVarChar("communityRole", 20, CommunityRole.LEADER.toString())); + idCallback.run(id); + } + else + { + idCallback.run(-1); + } + }, () -> idCallback.run(-1), new ColumnVarChar("name", 15, name), new ColumnVarChar("region", 5, _us ? "US" : "EU")); + } + catch (SQLException e) + { + e.printStackTrace(); + idCallback.run(-1); + } + } + + public void deleteCommunity(int communityId) + { + try (Connection connection = getConnection()) + { + executeUpdate(connection, "DELETE FROM communities WHERE id=?;", null, new ColumnInt("id", communityId)); + executeUpdate(connection, "DELETE FROM communitySettings WHERE communityId=?;", null, new ColumnInt("communityId", communityId)); + executeUpdate(connection, "DELETE FROM communityMembers WHERE communityId=?;", null, new ColumnInt("communityId", communityId)); + executeUpdate(connection, "DELETE FROM communityInvites WHERE communityId=?;", null, new ColumnInt("communityId", communityId)); + executeUpdate(connection, "DELETE FROM communityJoinRequests WHERE communityId=?", null, new ColumnInt("communityId", communityId)); + } + catch (SQLException e) + { + e.printStackTrace(); + } + } + + public void setReadingChat(int accountId, int communityId, boolean reading) + { + executeUpdate(SET_READING_CHAT_IN, new ColumnBoolean("readingChat", reading), new ColumnInt("accountId", accountId), new ColumnInt("communityId", communityId)); + } + + protected void initialize() {} + protected void update() {} +} \ No newline at end of file diff --git a/Plugins/Mineplex.Core/src/mineplex/core/cosmetic/CosmeticManager.java b/Plugins/Mineplex.Core/src/mineplex/core/cosmetic/CosmeticManager.java index be0c8a6bb..d1ae7b491 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/cosmetic/CosmeticManager.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/cosmetic/CosmeticManager.java @@ -1,5 +1,22 @@ package mineplex.core.cosmetic; +import org.bukkit.Bukkit; +import org.bukkit.ChatColor; +import org.bukkit.Material; +import org.bukkit.block.Block; +import org.bukkit.block.BlockFace; +import org.bukkit.entity.EntityType; +import org.bukkit.entity.Player; +import org.bukkit.event.EventHandler; +import org.bukkit.event.block.Action; +import org.bukkit.event.player.PlayerDropItemEvent; +import org.bukkit.event.player.PlayerInteractAtEntityEvent; +import org.bukkit.event.player.PlayerInteractEvent; +import org.bukkit.event.player.PlayerJoinEvent; +import org.bukkit.inventory.ItemStack; +import org.bukkit.plugin.java.JavaPlugin; + +import mineplex.core.Managers; import mineplex.core.MiniPlugin; import mineplex.core.account.CoreClientManager; import mineplex.core.boosters.BoosterManager; @@ -10,6 +27,7 @@ import mineplex.core.common.util.UtilServer; import mineplex.core.cosmetic.ui.CosmeticShop; import mineplex.core.donation.DonationManager; import mineplex.core.gadget.GadgetManager; +import mineplex.core.gadget.gadgets.morph.MorphDinnerbone; import mineplex.core.gadget.gadgets.outfit.OutfitTeam; import mineplex.core.gadget.types.Gadget; import mineplex.core.gadget.types.GadgetType; @@ -18,18 +36,11 @@ import mineplex.core.itemstack.ItemStackFactory; import mineplex.core.mount.MountManager; import mineplex.core.pet.PetManager; import mineplex.core.treasure.TreasureManager; -import org.bukkit.Bukkit; -import org.bukkit.ChatColor; -import org.bukkit.Material; -import org.bukkit.entity.Player; -import org.bukkit.event.EventHandler; -import org.bukkit.event.player.PlayerDropItemEvent; -import org.bukkit.event.player.PlayerInteractEvent; -import org.bukkit.event.player.PlayerJoinEvent; -import org.bukkit.plugin.java.JavaPlugin; +import mineplex.core.twofactor.TwoFactorAuth; public class CosmeticManager extends MiniPlugin { + private final TwoFactorAuth _twofactor = Managers.require(TwoFactorAuth.class); private InventoryManager _inventoryManager; private GadgetManager _gadgetManager; private MountManager _mountManager; @@ -127,7 +138,7 @@ public class CosmeticManager extends MiniPlugin @EventHandler public void openShop(PlayerInteractEvent event) { - if (!_showInterface) + if (_twofactor.isAuthenticating(event.getPlayer()) || !_showInterface) return; if (event.hasItem() && event.getItem().getType() == Material.CHEST) @@ -138,6 +149,30 @@ public class CosmeticManager extends MiniPlugin } } + // Allows player to open cosmetic shop while carrying armor stand + // Also calls PlayerInteractEvent to open other menus + @EventHandler + public void openShop(PlayerInteractAtEntityEvent event) + { + if (!_showInterface) + return; + + Player player = event.getPlayer(); + + if (!(_gadgetManager.getActive(player, GadgetType.MORPH) instanceof MorphDinnerbone)) + return; + + if (!event.getRightClicked().getType().equals(EntityType.ARMOR_STAND)) + return; + + Block block = event.getRightClicked().getLocation().getBlock(); + Action action = Action.RIGHT_CLICK_AIR; + BlockFace blockFace = BlockFace.SOUTH; + ItemStack item = player.getItemInHand(); + PlayerInteractEvent playerInteractEvent = new PlayerInteractEvent(player, action, item, block, blockFace); + Bukkit.getPluginManager().callEvent(playerInteractEvent); + } + public GadgetManager getGadgetManager() { return _gadgetManager; @@ -207,6 +242,11 @@ public class CosmeticManager extends MiniPlugin { return _boosterManager; } + + public void displayUI(Player player) + { + _shop.attemptShopOpen(player); + } public void disableTeamArmor() { diff --git a/Plugins/Mineplex.Core/src/mineplex/core/cosmetic/ui/CosmeticShop.java b/Plugins/Mineplex.Core/src/mineplex/core/cosmetic/ui/CosmeticShop.java index 94ec614e7..9c0138469 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/cosmetic/ui/CosmeticShop.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/cosmetic/ui/CosmeticShop.java @@ -34,13 +34,13 @@ public class CosmeticShop extends ShopBase implements PluginMes if (!channel.equalsIgnoreCase("MC|ItemName")) return; - if (getPlayerPageMap().containsKey(player.getName()) && getPlayerPageMap().get(player.getName()) instanceof PetTagPage) + if (getPlayerPageMap().containsKey(player.getUniqueId()) && getPlayerPageMap().get(player.getUniqueId()) instanceof PetTagPage) { if (message != null && message.length >= 1) { String tagName = new String(message); - ((PetTagPage) getPlayerPageMap().get(player.getName())).SetTagName(tagName); + ((PetTagPage) getPlayerPageMap().get(player.getUniqueId())).SetTagName(tagName); } } } diff --git a/Plugins/Mineplex.Core/src/mineplex/core/cosmetic/ui/button/open/OpenBalloons.java b/Plugins/Mineplex.Core/src/mineplex/core/cosmetic/ui/button/open/OpenBalloons.java index ed816cf42..0e893fb8e 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/cosmetic/ui/button/open/OpenBalloons.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/cosmetic/ui/button/open/OpenBalloons.java @@ -1,9 +1,10 @@ package mineplex.core.cosmetic.ui.button.open; +import org.bukkit.entity.Player; + import mineplex.core.cosmetic.ui.page.BalloonsPage; import mineplex.core.cosmetic.ui.page.Menu; import mineplex.core.gadget.types.Gadget; -import org.bukkit.entity.Player; public class OpenBalloons extends OpenPageButton { @@ -16,7 +17,7 @@ public class OpenBalloons extends OpenPageButton @Override protected void leftClick(Player player) { - getMenu().getShop().openPageForPlayer(player, new BalloonsPage(getMenu().getPlugin(), getMenu().getShop(), getMenu().getClientManager(), getMenu().getDonationManager(), "Win Effects", player)); + getMenu().getShop().openPageForPlayer(player, new BalloonsPage(getMenu().getPlugin(), getMenu().getShop(), getMenu().getClientManager(), getMenu().getDonationManager(), "Balloons", player)); } } diff --git a/Plugins/Mineplex.Core/src/mineplex/core/cosmetic/ui/button/open/OpenTaunts.java b/Plugins/Mineplex.Core/src/mineplex/core/cosmetic/ui/button/open/OpenTaunts.java new file mode 100644 index 000000000..a7c9e9923 --- /dev/null +++ b/Plugins/Mineplex.Core/src/mineplex/core/cosmetic/ui/button/open/OpenTaunts.java @@ -0,0 +1,21 @@ +package mineplex.core.cosmetic.ui.button.open; + +import org.bukkit.entity.Player; + +import mineplex.core.cosmetic.ui.page.Menu; +import mineplex.core.cosmetic.ui.page.TauntPage; +import mineplex.core.gadget.types.Gadget; + +public class OpenTaunts extends OpenPageButton +{ + public OpenTaunts(Menu menu, Gadget active) + { + super(menu, active); + } + + @Override + protected void leftClick(Player player) + { + getMenu().getShop().openPageForPlayer(player, new TauntPage(getMenu().getPlugin(), getMenu().getShop(), getMenu().getClientManager(), getMenu().getDonationManager(), "Taunts", player)); + } +} \ No newline at end of file diff --git a/Plugins/Mineplex.Core/src/mineplex/core/cosmetic/ui/page/BalloonsPage.java b/Plugins/Mineplex.Core/src/mineplex/core/cosmetic/ui/page/BalloonsPage.java index 4d7b0276c..fd0b3cf08 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/cosmetic/ui/page/BalloonsPage.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/cosmetic/ui/page/BalloonsPage.java @@ -31,7 +31,7 @@ public class BalloonsPage extends GadgetPage { addGadget(gadget, slot); - if (getPlugin().getGadgetManager().getActive(getPlayer(), GadgetType.BALLOON) == gadget) + if (gadget.isActive(getPlayer())) addGlow(slot); slot++; diff --git a/Plugins/Mineplex.Core/src/mineplex/core/cosmetic/ui/page/CostumePage.java b/Plugins/Mineplex.Core/src/mineplex/core/cosmetic/ui/page/CostumePage.java index 218390e2c..66cb24998 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/cosmetic/ui/page/CostumePage.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/cosmetic/ui/page/CostumePage.java @@ -50,11 +50,11 @@ public class CostumePage extends GadgetPage slot = offset + 1 + 18; //1 buffer to left, 18 = 2 lines down - if (outfitGadget.getSlot() == OutfitGadget.ArmorSlot.Chest) + if (outfitGadget.getSlot() == OutfitGadget.ArmorSlot.CHEST) slot += 9; - else if (outfitGadget.getSlot() == OutfitGadget.ArmorSlot.Legs) + else if (outfitGadget.getSlot() == OutfitGadget.ArmorSlot.LEGS) slot += 18; - else if (outfitGadget.getSlot() == OutfitGadget.ArmorSlot.Boots) + else if (outfitGadget.getSlot() == OutfitGadget.ArmorSlot.BOOTS) slot += 27; addGadget(gadget, slot); diff --git a/Plugins/Mineplex.Core/src/mineplex/core/cosmetic/ui/page/GadgetPage.java b/Plugins/Mineplex.Core/src/mineplex/core/cosmetic/ui/page/GadgetPage.java index b699559ff..d6dd97153 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/cosmetic/ui/page/GadgetPage.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/cosmetic/ui/page/GadgetPage.java @@ -18,9 +18,7 @@ import org.bukkit.inventory.meta.ItemMeta; import mineplex.core.account.CoreClientManager; import mineplex.core.common.currency.GlobalCurrency; import mineplex.core.common.util.C; -import mineplex.core.common.util.F; import mineplex.core.common.util.LineFormat; -import mineplex.core.common.util.UtilPlayer; import mineplex.core.common.util.UtilServer; import mineplex.core.common.util.UtilText; import mineplex.core.common.util.banner.CountryFlag; @@ -31,7 +29,6 @@ import mineplex.core.cosmetic.ui.button.activate.ActivateGadgetButton; import mineplex.core.cosmetic.ui.button.deactivate.DeactivateGadgetButton; import mineplex.core.donation.DonationManager; import mineplex.core.gadget.event.GadgetChangeEvent; -import mineplex.core.gadget.gadgets.morph.MorphWitch; import mineplex.core.gadget.types.Gadget; import mineplex.core.gadget.types.GadgetType; import mineplex.core.gadget.types.HatGadget; @@ -168,6 +165,16 @@ public class GadgetPage extends ShopPageBase itemLore.add(C.cBlue + "Bonus Item Unlocked with Power Play Club"); } } + else if (gadget.getCost(GlobalCurrency.TREASURE_SHARD) == -16) + { + itemLore.add(C.cBlack); + itemLore.add(C.cBlue + "Found in Gingerbread Chests"); + } + else if (gadget.getCost(GlobalCurrency.TREASURE_SHARD) == -17) + { + itemLore.add(C.cBlack); + itemLore.add(C.cBlue + "Found in Love Chests"); + } //Rank Unlocks else if (gadget.getCost(GlobalCurrency.TREASURE_SHARD) == -10) @@ -190,6 +197,11 @@ public class GadgetPage extends ShopPageBase itemLore.add(C.cBlack); itemLore.add(C.cRed + "Unlocked with Titan Rank"); } + else if (gadget.getCost(GlobalCurrency.TREASURE_SHARD) == -15) + { + itemLore.add(C.cBlack); + itemLore.add(C.cDAqua + "Unlocked with Eternal Rank"); + } } //Special case for item gadgets! @@ -301,14 +313,34 @@ public class GadgetPage extends ShopPageBase if (gadget.ownsGadget(getPlayer())) { ItemStack gadgetItemStack; - if (gadget instanceof MorphWitch) + /*if (gadget instanceof MorphWitch) { gadgetItemStack = ((MorphWitch) gadget).getWitchItem(); } + else if (gadget instanceof DeathPresentDanger) + { + gadgetItemStack = SkinData.PRESENT.getSkull(); + } else { gadgetItemStack = new ItemStack(gadget.getDisplayMaterial(), 1, gadget.getDisplayData()); } + + if (gadget instanceof OutfitFreezeSuit && !(gadget instanceof OutfitFreezeSuitHelmet)) + { + LeatherArmorMeta leatherArmorMeta = (LeatherArmorMeta) gadgetItemStack.getItemMeta(); + leatherArmorMeta.setColor(Color.fromRGB(129, 212, 250)); + gadgetItemStack.setItemMeta(leatherArmorMeta); + }*/ + if (gadget.hasDisplayItem()) + { + gadgetItemStack = gadget.getDisplayItem(); + } + else + { + gadgetItemStack = new ItemStack(gadget.getDisplayMaterial(), 1, gadget.getDisplayData()); + } + ItemMeta meta = gadgetItemStack.getItemMeta(); meta.setDisplayName(C.cGreen + C.Bold + gadget.getName()); if (gadget.getActive().contains(getPlayer())) @@ -416,16 +448,25 @@ public class GadgetPage extends ShopPageBase return; } - if(getClientManager().Get(player).isDisguised()) - { - UtilPlayer.message(player, F.main("Disguise", "You cant buy things while you are disguised!")); - return; - } - getShop().openPageForPlayer(getPlayer(), new ConfirmationPage<>(player, this, new SalesPackageProcessor(player, GlobalCurrency.TREASURE_SHARD, (gadget instanceof ItemGadget ? ((ItemGadget) gadget).getAmmo() : gadget), getDonationManager(), () -> - { - getPlugin().getInventoryManager().addItemToInventory(getPlayer(), gadget.getName(), (gadget instanceof ItemGadget ? ((ItemGadget) gadget).getAmmo().getQuantity() : gadget.getQuantity())); - refresh(); - }), gadget.buildIcon())); + getShop().openPageForPlayer( + getPlayer(), + new ConfirmationPage<>( + player, + this, + new SalesPackageProcessor( + player, + GlobalCurrency.TREASURE_SHARD, + (gadget instanceof ItemGadget ? ((ItemGadget) gadget).getAmmo() : gadget), + getDonationManager(), + () -> + { + getPlugin().getInventoryManager().addItemToInventory(getPlayer(), gadget.getName(), (gadget instanceof ItemGadget ? ((ItemGadget) gadget).getAmmo().getQuantity() : gadget.getQuantity())); + refresh(); + } + ), + gadget.buildIcon() + ) + ); } public void activateGadget(Player player, Gadget gadget) diff --git a/Plugins/Mineplex.Core/src/mineplex/core/cosmetic/ui/page/Menu.java b/Plugins/Mineplex.Core/src/mineplex/core/cosmetic/ui/page/Menu.java index 90e02e269..3152a8fd0 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/cosmetic/ui/page/Menu.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/cosmetic/ui/page/Menu.java @@ -1,14 +1,24 @@ package mineplex.core.cosmetic.ui.page; +import java.util.ArrayList; +import java.util.EnumMap; +import java.util.List; +import java.util.Map; + +import org.bukkit.Material; +import org.bukkit.entity.Creature; +import org.bukkit.entity.Player; + import mineplex.core.account.CoreClientManager; import mineplex.core.common.currency.GlobalCurrency; import mineplex.core.common.util.C; -import mineplex.core.common.util.F; import mineplex.core.common.util.LineFormat; import mineplex.core.common.util.UtilText; +import mineplex.core.common.util.UtilUI; import mineplex.core.cosmetic.CosmeticManager; import mineplex.core.cosmetic.ui.CosmeticShop; import mineplex.core.cosmetic.ui.button.open.OpenArrowTrails; +import mineplex.core.cosmetic.ui.button.open.OpenBalloons; import mineplex.core.cosmetic.ui.button.open.OpenCostumes; import mineplex.core.cosmetic.ui.button.open.OpenDeathAnimations; import mineplex.core.cosmetic.ui.button.open.OpenDoubleJump; @@ -20,27 +30,23 @@ import mineplex.core.cosmetic.ui.button.open.OpenMounts; import mineplex.core.cosmetic.ui.button.open.OpenMusic; import mineplex.core.cosmetic.ui.button.open.OpenParticles; import mineplex.core.cosmetic.ui.button.open.OpenPets; +import mineplex.core.cosmetic.ui.button.open.OpenTaunts; import mineplex.core.cosmetic.ui.button.open.OpenWinEffect; import mineplex.core.donation.DonationManager; import mineplex.core.gadget.types.Gadget; import mineplex.core.gadget.types.GadgetType; import mineplex.core.mount.Mount; import mineplex.core.pet.PetType; -import mineplex.core.shop.item.IButton; import mineplex.core.shop.item.ShopItem; import mineplex.core.shop.page.ShopPageBase; -import org.bukkit.Material; -import org.bukkit.entity.Creature; -import org.bukkit.entity.Player; -import org.bukkit.event.inventory.ClickType; - -import java.util.ArrayList; -import java.util.EnumMap; -import java.util.List; -import java.util.Map; public class Menu extends ShopPageBase { + + private static final String VISIBILITY_HUB = "Usable in Lobbies"; + private static final String VISIBILITY_EVERYWHERE = "Visible Everywhere"; + private static final String VISIBILITY_GAMES = "Visible in Games"; + public Menu(CosmeticManager plugin, CosmeticShop shop, CoreClientManager clientManager, DonationManager donationManager, Player player) { super(plugin, shop, clientManager, donationManager, "Inventory", player); @@ -63,11 +69,11 @@ public class Menu extends ShopPageBase addItem(4, shards); // Cosmetic Items -// int[] slots = UtilUI.getIndicesFor(12, 2); - int particleSlot = 10;//slots[0]; - int arrowSlot = 12;//slots[1]; - int jumpSlot = 14;//slots[2]; - int deathSlot = 16;//slots[3]; + int[] slots = UtilUI.getIndicesFor(15, 1, 5, 1); + /*int particleSlot = 9;//slots[0]; + int arrowSlot = 11;//slots[1]; + int jumpSlot = 13;//slots[2]; + int deathSlot = 15;//slots[3]; int gadgetSlot = 27;//slots[4]; int morphSlot = 29;//slots[5]; int mountSlot = 31;//slots[6]; @@ -77,7 +83,12 @@ public class Menu extends ShopPageBase int musicSlot = 47;//slots[10]; int tauntSlot = 49;//slots[11]; int winEffectSlot = 51; - int gameModifierSlot = 53; + int gameModifierSlot = 53;*/ + int particleSlot = slots[0], arrowSlot = slots[1], jumpSlot = slots[2], + deathSlot = slots[3], gadgetSlot = slots[4], morphSlot = slots[5], + mountSlot = slots[6], petSlot = slots[7], hatSlot = slots[8], + costumeSlot = slots[9], musicSlot = slots[10], tauntSlot = slots[11], + winEffectSlot = slots[12], gameModifierSlot = slots[13], balloonsSlot = slots[14]; EnumMap ownedCount = new EnumMap(GadgetType.class); EnumMap maxCount = new EnumMap(GadgetType.class); @@ -111,7 +122,7 @@ public class Menu extends ShopPageBase Mount mountActive = getPlugin().getMountManager().getActive(getPlayer()); for (Mount mount : getPlugin().getMountManager().getMounts()) { - if (getDonationManager().Get(getPlayer()).OwnsUnknownPackage(mount.getName())) + if (getDonationManager().Get(getPlayer()).ownsUnknownSalesPackage(mount.getName())) { mountOwned++; } @@ -134,105 +145,126 @@ public class Menu extends ShopPageBase Creature petActive = getPlugin().getPetManager().getPet(getPlayer()); GadgetType type = GadgetType.PARTICLE; - String[] lore = getLore(ownedCount.get(type), maxCount.get(type), "Show everyone how cool you are with swirly particles that follow you when you walk!", "Visible Everywhere", enabled.get(type)); + String[] lore = getLore(ownedCount.get(type), maxCount.get(type), "Show everyone how cool you are with swirly particles that follow you when you walk!", VISIBILITY_EVERYWHERE, enabled.get(type)); addButton(particleSlot, new ShopItem(Material.NETHER_STAR, "Particle Effects", lore, 1, false), new OpenParticles(this, enabled.get(type))); if (enabled.containsKey(type)) addGlow(particleSlot); type = GadgetType.ARROW_TRAIL; - lore = getLore(ownedCount.get(type), maxCount.get(type), "Your arrows will now leave particle trails as they soar through the air.", "Visible in Games", enabled.get(type)); + lore = getLore(ownedCount.get(type), maxCount.get(type), "Your arrows will now leave particle trails as they soar through the air.", VISIBILITY_GAMES, enabled.get(type)); addButton(arrowSlot, new ShopItem(Material.ARROW, "Arrow Effects", lore, 1, false), new OpenArrowTrails(this, enabled.get(type))); if (enabled.containsKey(type)) addGlow(arrowSlot); type = GadgetType.DOUBLE_JUMP; - lore = getLore(ownedCount.get(type), maxCount.get(type), "Demonstrate your parkour prowess with sweet particles when you double jump.", "Visible Everywhere", enabled.get(type)); + lore = getLore(ownedCount.get(type), maxCount.get(type), "Demonstrate your parkour prowess with sweet particles when you double jump.", VISIBILITY_EVERYWHERE, enabled.get(type)); addButton(jumpSlot, new ShopItem(Material.GOLD_BOOTS, "Double Jump Effects", lore, 1, false), new OpenDoubleJump(this, enabled.get(type))); if (enabled.containsKey(type)) addGlow(jumpSlot); type = GadgetType.DEATH; - lore = getLore(ownedCount.get(type), maxCount.get(type), "Your death will now be mourned with a wonderful particle tribute.", "Visible in Games", enabled.get(type)); + lore = getLore(ownedCount.get(type), maxCount.get(type), "Your death will now be mourned with a wonderful particle tribute.", VISIBILITY_GAMES, enabled.get(type)); addButton(deathSlot, new ShopItem(Material.SKULL_ITEM, "Death Animations", lore, 1, false), new OpenDeathAnimations(this, enabled.get(type))); if (enabled.containsKey(type)) addGlow(deathSlot); type = GadgetType.ITEM; - lore = getLore(ownedCount.get(type), maxCount.get(type), "All sorts of zany contraptions to use on your friends and foes.", "Usable in Lobbies", enabled.get(type)); + lore = getLore(ownedCount.get(type), maxCount.get(type), "All sorts of zany contraptions to use on your friends and foes.", VISIBILITY_HUB, enabled.get(type)); addButton(gadgetSlot, new ShopItem(Material.MELON_BLOCK, "Gadgets", lore, 1, false), new OpenGadgets(this, enabled.get(type))); if (enabled.containsKey(type)) addGlow(gadgetSlot); type = GadgetType.MORPH; - lore = getLore(ownedCount.get(type), maxCount.get(type), "Have you ever wanted to be a tiger? Well, you can't be a tiger! That's silly! But you can be many other things!", "Usable in Lobbies", enabled.get(type)); + lore = getLore(ownedCount.get(type), maxCount.get(type), "Have you ever wanted to be a tiger? Well, you can't be a tiger! That's silly! But you can be many other things!", VISIBILITY_HUB, enabled.get(type)); addButton(morphSlot, new ShopItem(Material.LEATHER, "Morphs", lore, 1, false), new OpenMorphs(this, enabled.get(type))); if (enabled.containsKey(type)) addGlow(morphSlot); - lore = getLore(mountOwned, mountMax, "Why walk when you can ride? Summon fancy mounts to help you move in style.", "Usable in Lobbies", mountActive == null ? null : mountActive.getName()); + lore = getLore(mountOwned, mountMax, "Why walk when you can ride? Summon fancy mounts to help you move in style.", VISIBILITY_HUB, mountActive == null ? null : mountActive.getName(), false); addButton(mountSlot, new ShopItem(Material.IRON_BARDING, "Mounts", lore, 1, false), new OpenMounts(this, mountActive)); if (mountActive != null) addGlow(mountSlot); - lore = getLore(petOwned, petMax, "Life on a server can get lonely sometimes. Summon an adorable pet to follow you around and cheer you up!", "Usable in Lobbies", petActive == null ? null : petActive.getCustomName()); + lore = getLore(petOwned, petMax, "Life on a server can get lonely sometimes. Summon an adorable pet to follow you around and cheer you up!", VISIBILITY_HUB, petActive == null ? null : petActive.getCustomName(), false); addButton(petSlot, new ShopItem(Material.BONE, "Pets", lore, 1, false), new OpenPets(this)); if (petActive != null) addGlow(petSlot); type = GadgetType.HAT; - lore = getLore(ownedCount.get(type), maxCount.get(type), "Hats are in this year. Wear them on your head to impress the ladies.", "Usable in Lobbies", enabled.get(type)); + lore = getLore(ownedCount.get(type), maxCount.get(type), "Hats are in this year. Wear them on your head to impress the ladies.", VISIBILITY_HUB, enabled.get(type)); addButton(hatSlot, new ShopItem(Material.GOLD_HELMET, "Hats", lore, 1, false), new OpenHats(this, enabled.get(type))); if (enabled.containsKey(type)) addGlow(hatSlot); type = GadgetType.COSTUME; - // Fixes more than 8 costumes being counted, even without the WindUp - lore = getLore((ownedCount.get(type) > 8) ? 8 : ownedCount.get(type), /*maxCount.get(type)*/ 8, "Sometimes going out calls for special clothes! Gain bonus effects for matching outfit.", "Usable in Lobbies", enabled.get(type)); + // -4 Fixes more than the real costumes being counted (Happens because of the hub games costumes + lore = getLore(ownedCount.get(type) - 4, maxCount.get(type) - 4, "Sometimes going out calls for special clothes! Gain bonus effects for matching outfit.", VISIBILITY_HUB, enabled.get(type)); addButton(costumeSlot, new ShopItem(Material.DIAMOND_CHESTPLATE, "Costumes", lore, 1, false), new OpenCostumes(this, enabled.get(type))); if (enabled.containsKey(type)) addGlow(costumeSlot); type = GadgetType.MUSIC_DISC; - lore = getLore(ownedCount.get(type), maxCount.get(type), "I JUST WANT TO DANCE WITH YOU!", "Usable in Lobbies", enabled.get(type)); + lore = getLore(ownedCount.get(type), maxCount.get(type), "I JUST WANT TO DANCE WITH YOU!", VISIBILITY_HUB, enabled.get(type)); addButton(musicSlot, new ShopItem(Material.GREEN_RECORD, "Music", lore, 1, false), new OpenMusic(this, enabled.get(type))); if (enabled.containsKey(type)) addGlow(musicSlot); - addButton(tauntSlot, new ShopItem(Material.NAME_TAG, "Taunts", new String[]{C.Bold + "", C.cDGreen + C.Italics + "Coming soon!"}, 1, false), new IButton() - { - @Override - public void onClick(Player player, ClickType clickType) - { - player.sendMessage(F.main("Shop", "Coming soon!")); - } - }); + type = GadgetType.TAUNT; + lore = getLore(ownedCount.get(type), maxCount.get(type), "Taunt your enemies or just show off. Use /taunt to have a good time!", VISIBILITY_GAMES, enabled.get(type)); + addButton(tauntSlot, new ShopItem(Material.NAME_TAG, "Taunts", lore, 1, false), new OpenTaunts(this, enabled.get(type))); + if (enabled.containsKey(type)) addGlow(tauntSlot); type = GadgetType.WIN_EFFECT; - lore = getLore(ownedCount.get(type), maxCount.get(type), "Winning a game with your friends all good and dandy, but then being able to also show off awesome effects is even more fun!", "Usable in Lobbies", enabled.get(type)); + lore = getLore(ownedCount.get(type), maxCount.get(type), "Winning a game with your friends all good and dandy, but then being able to also show off awesome effects is even more fun!", VISIBILITY_GAMES, enabled.get(type)); addButton(winEffectSlot, new ShopItem(Material.CAKE, "Win Effects", lore, 1, false), new OpenWinEffect(this, enabled.get(type))); if (enabled.containsKey(type)) addGlow(winEffectSlot); type = GadgetType.GAME_MODIFIER; - lore = getLore(ownedCount.get(type), maxCount.get(type), "Cosmetic effects which changes appearances of objects in game", "Visible in Games", enabled.get(type)); + lore = getLore(ownedCount.get(type), maxCount.get(type), "Cosmetic effects which changes appearances of objects in game", VISIBILITY_GAMES, enabled.get(type)); addButton(gameModifierSlot, new ShopItem(Material.TORCH, "Game Modifiers", lore, 1, false), new OpenGameModifiers(this, enabled.get(type))); if (enabled.containsKey(type)) addGlow(gameModifierSlot); + + type = GadgetType.BALLOON; + lore = getLore(ownedCount.get(type), maxCount.get(type), "Balloons are collectibles that you can float above your head as you wander the lobby. You can have up to 10 balloons in your hand at one time.", VISIBILITY_HUB, enabled.get(type)); + addButton(balloonsSlot, new ShopItem(Material.LEASH, "Balloons", lore, 1, false), new OpenBalloons(this, enabled.get(type))); + if (enabled.containsKey(type)) addGlow(balloonsSlot); } private String[] getLore(int ownedCount, int maxCount, String info, String visibility, Gadget enabled) { - return getLore(ownedCount, maxCount, info, visibility, enabled == null ? null : enabled.getName()); - } - - private String[] getLore(int ownedCount, int maxCount,String info, String visibility, String enabled) - { + boolean balloon = false; if (enabled != null) { - return UtilText.splitLinesToArray(new String[] { - C.blankLine, - C.cGray + info, - C.cDGray + visibility, - C.blankLine, - C.cWhite + "You own " + ownedCount + "/" + maxCount, - C.blankLine, - C.cWhite + "Active: " + C.cYellow + enabled, - C.cGreen + "Right-Click to Disable", - C.blankLine, - C.cGreen + "Left-Click to View Category" - }, LineFormat.LORE); + if (enabled.getGadgetType() == GadgetType.BALLOON) + balloon = true; + } + return getLore(ownedCount, maxCount, info, visibility, enabled == null ? null : enabled.getName(), balloon); + } + + private String[] getLore(int ownedCount, int maxCount,String info, String visibility, String enabled, boolean balloons) + { + if (!balloons) + { + if (enabled != null) + { + return UtilText.splitLinesToArray(new String[]{ + C.blankLine, + C.cGray + info, + C.cDGray + visibility, + C.blankLine, + C.cWhite + "You own " + ownedCount + "/" + maxCount, + C.blankLine, + C.cWhite + "Active: " + C.cYellow + enabled, + C.cGreen + "Right-Click to Disable", + C.blankLine, + C.cGreen + "Left-Click to View Category" + }, LineFormat.LORE); + } else + { + return UtilText.splitLinesToArray(new String[]{ + C.blankLine, + C.cGray + info, + C.cDGray + visibility, + C.blankLine, + C.cWhite + "You own " + ownedCount + "/" + maxCount, + C.blankLine, + C.cGreen + "Left-Click to View Category" + }, LineFormat.LORE); + } } else { - return UtilText.splitLinesToArray(new String[] { + return UtilText.splitLinesToArray(new String[]{ C.blankLine, C.cGray + info, C.cDGray + visibility, diff --git a/Plugins/Mineplex.Core/src/mineplex/core/cosmetic/ui/page/MountPage.java b/Plugins/Mineplex.Core/src/mineplex/core/cosmetic/ui/page/MountPage.java index 24d260e4a..990d2905b 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/cosmetic/ui/page/MountPage.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/cosmetic/ui/page/MountPage.java @@ -46,7 +46,7 @@ public class MountPage extends ShopPageBase addMount(mount, slot); slot++; - if (slot == 17) + if (slot == 17 || slot == 26) slot += 2; } @@ -66,7 +66,7 @@ public class MountPage extends ShopPageBase itemLore.add(C.cBlack); itemLore.addAll(Arrays.asList(mount.getDescription())); - if (!getDonationManager().Get(getPlayer()).OwnsUnknownPackage(mount.getName())) + if (!getDonationManager().Get(getPlayer()).ownsUnknownSalesPackage(mount.getName())) { if (mount.getCost(GlobalCurrency.TREASURE_SHARD) == -1) { @@ -108,6 +108,11 @@ public class MountPage extends ShopPageBase itemLore.add(C.cBlack); itemLore.add(C.cBlue + "Found in Haunted Chests"); } + else if (mount.getCost(GlobalCurrency.TREASURE_SHARD) == -15) + { + itemLore.add(C.cBlack); + itemLore.add(C.cBlue + "Found in Thankful Treasure"); + } else if (mount.getCost(GlobalCurrency.TREASURE_SHARD) == -14) { itemLore.add(C.cBlack); @@ -148,7 +153,7 @@ public class MountPage extends ShopPageBase } } - if (getDonationManager().Get(getPlayer()).OwnsUnknownPackage(mount.getName())) + if (getDonationManager().Get(getPlayer()).ownsUnknownSalesPackage(mount.getName())) { if (mount.getActive().containsKey(getPlayer())) { diff --git a/Plugins/Mineplex.Core/src/mineplex/core/cosmetic/ui/page/ParticlePage.java b/Plugins/Mineplex.Core/src/mineplex/core/cosmetic/ui/page/ParticlePage.java index 0bd0885c2..a488c922c 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/cosmetic/ui/page/ParticlePage.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/cosmetic/ui/page/ParticlePage.java @@ -35,7 +35,7 @@ public class ParticlePage extends GadgetPage slot++; - if (slot == 17 || slot == 26) + if (slot == 17 || slot == 26 || slot == 35) slot += 2; } diff --git a/Plugins/Mineplex.Core/src/mineplex/core/cosmetic/ui/page/PetPage.java b/Plugins/Mineplex.Core/src/mineplex/core/cosmetic/ui/page/PetPage.java index cf903bc21..503f2897d 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/cosmetic/ui/page/PetPage.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/cosmetic/ui/page/PetPage.java @@ -1,10 +1,14 @@ package mineplex.core.cosmetic.ui.page; +import java.time.Month; +import java.time.YearMonth; +import java.time.format.TextStyle; import java.util.ArrayList; import java.util.Arrays; import java.util.Collections; import java.util.Comparator; import java.util.List; +import java.util.Locale; import net.minecraft.server.v1_8_R3.Blocks; import net.minecraft.server.v1_8_R3.ChatMessage; @@ -110,14 +114,20 @@ public class PetPage extends ShopPageBase else if (pet.getPrice() == -14) { itemLore.add(C.cBlack); - itemLore.add(C.cBlue + "Found in Power Play Club"); + YearMonth yearMonth = pet.getYearMonth(); + if (yearMonth != null) + { + int year = yearMonth.getYear(); + Month month = yearMonth.getMonth(); + String monthName = month.getDisplayName(TextStyle.FULL, Locale.US); + itemLore.addAll(UtilText.splitLine(C.cBlue + "Monthly Power Play Club Reward for " + monthName + " " + year, LineFormat.LORE)); + } + else + { + itemLore.add(C.cBlue + "Bonus Item Unlocked with Power Play Club"); + } } - else if (pet.getPrice() == -14) - { - itemLore.add(C.cBlack); - itemLore.add(C.cBlue + "Found in Power Play Club"); - } - + //Rank Unlocks else if (pet.getPrice() == -10) { @@ -154,8 +164,8 @@ public class PetPage extends ShopPageBase { itemLore.add(C.cBlack); itemLore.add(C.cGreen + "Click to Disable"); - - addButton(slot, new ShopItem(Material.MONSTER_EGG, (byte) pet.getEntityType().getTypeId(), + + addButton(slot, new ShopItem(pet.getMaterial(), pet.getData(), pet.getName() + " (" + C.cWhite + petName + C.cGreen + ")", itemLore.toArray(new String[itemLore.size()]), 1, false, false), new DeactivatePetButton(this, getPlugin().getPetManager())); @@ -185,7 +195,7 @@ public class PetPage extends ShopPageBase } }*/ - addButton(slot, new ShopItem(Material.MONSTER_EGG, (byte) pet.getEntityType().getTypeId(), + addButton(slot, new ShopItem(pet.getMaterial(), pet.getData(), pet.getName() + " (" + C.cWhite + petName + C.cGreen + ")", itemLore.toArray(new String[itemLore.size()]), 1, false, false), new ActivatePetButton(pet, this)); //addButton(slot, new ShopItem(petItem, false, false), iButton); diff --git a/Plugins/Mineplex.Core/src/mineplex/core/cosmetic/ui/page/PetTagPage.java b/Plugins/Mineplex.Core/src/mineplex/core/cosmetic/ui/page/PetTagPage.java index 49756c42f..e81295364 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/cosmetic/ui/page/PetTagPage.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/cosmetic/ui/page/PetTagPage.java @@ -110,7 +110,7 @@ public class PetTagPage extends ShopPageBase if (getClientManager().Get(getPlayer()) != null) token.AccountId = getClientManager().Get(getPlayer()).getAccountId(); else - token.AccountId = PlayerCache.getInstance().getPlayer(getPlayer().getUniqueId()).getAccountId(); + token.AccountId = PlayerCache.getInstance().getAccountId(getPlayer().getUniqueId()); token.Name = getPlayer().getName(); token.PetType = _petType.toString(); diff --git a/Plugins/Mineplex.Core/src/mineplex/core/cosmetic/ui/page/TauntPage.java b/Plugins/Mineplex.Core/src/mineplex/core/cosmetic/ui/page/TauntPage.java index 3db625e5d..687516e0f 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/cosmetic/ui/page/TauntPage.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/cosmetic/ui/page/TauntPage.java @@ -37,7 +37,7 @@ public class TauntPage extends GadgetPage { addGadget(gadget, slot); - if (getPlugin().getGadgetManager().getActive(getPlayer(), GadgetType.MORPH) == gadget) + if (getPlugin().getGadgetManager().getActive(getPlayer(), GadgetType.TAUNT) == gadget) addGlow(slot); slot++; diff --git a/Plugins/Mineplex.Core/src/mineplex/core/creature/Creature.java b/Plugins/Mineplex.Core/src/mineplex/core/creature/Creature.java index a759cdcbc..3678cda49 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/creature/Creature.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/creature/Creature.java @@ -87,7 +87,7 @@ public class Creature extends MiniPlugin return; //Useless Laggy Squids - if (event.getEntityType() == EntityType.SQUID) + if (event.getEntityType() == EntityType.SQUID && event.getSpawnReason() != CreatureSpawnEvent.SpawnReason.CUSTOM) { event.setCancelled(true); return; diff --git a/Plugins/Mineplex.Core/src/mineplex/core/customdata/repository/CustomDataRepository.java b/Plugins/Mineplex.Core/src/mineplex/core/customdata/repository/CustomDataRepository.java index 7ef6ad563..2a0a1d4be 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/customdata/repository/CustomDataRepository.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/customdata/repository/CustomDataRepository.java @@ -23,7 +23,7 @@ import mineplex.serverdata.database.column.ColumnVarChar; * Created by William (WilliamTiger). * 16/12/15 */ -public class CustomDataRepository extends MinecraftRepository +public class CustomDataRepository extends RepositoryBase { private static final String SELECT_KEYS = "SELECT id, name FROM customData;"; private static final String INSERT_KEY = "INSERT INTO customData (name) VALUES (?);"; @@ -37,7 +37,7 @@ public class CustomDataRepository extends MinecraftRepository public CustomDataRepository(JavaPlugin plugin, CoreClientManager clientManager, CustomDataManager customDataManager) { - super(plugin, DBPool.getAccount()); + super(DBPool.getAccount()); _clientManager = clientManager; _customDataManager = customDataManager; @@ -49,9 +49,6 @@ public class CustomDataRepository extends MinecraftRepository downloadDataKeys(); } - @Override - protected void update() {} - private void downloadDataKeys() { _dataKeys = new ArrayList<>(); diff --git a/Plugins/Mineplex.Core/src/mineplex/core/database/BasicMSSQLProvider.java b/Plugins/Mineplex.Core/src/mineplex/core/database/BasicMSSQLProvider.java new file mode 100644 index 000000000..45f4b7b03 --- /dev/null +++ b/Plugins/Mineplex.Core/src/mineplex/core/database/BasicMSSQLProvider.java @@ -0,0 +1,131 @@ +package mineplex.core.database; + +import java.lang.reflect.Type; +import java.util.HashSet; +import java.util.Set; +import java.util.function.Consumer; + +import org.bukkit.scheduler.BukkitTask; + +import mineplex.core.common.util.UtilServer; +import mineplex.core.server.remotecall.JsonWebCall; +import mineplex.core.thread.ThreadPool; +import mineplex.core.updater.UpdateType; +import mineplex.core.utils.UtilScheduler; +import mineplex.serverdata.database.DatabaseRunnable; + +@Deprecated +public class BasicMSSQLProvider implements MSSQLProvider +{ + private final String _webAddress = UtilServer.getWebServerURL(); + + // Queue for failed processes + private final Object QUEUE_LOCK = new Object(); + private Set _failedQueue = new HashSet<>(); + + private final BukkitTask _task; + private volatile boolean _shutdown = false; + + public BasicMSSQLProvider() + { + _task = UtilScheduler.runEvery(UpdateType.MIN_01, this::processDatabaseQueue); + } + + public T handleSyncMSSQLCall(String uri, Object param, Type responseType) + { + return new JsonWebCall(_webAddress + uri).Execute(responseType, param); + } + + public String handleSyncMSSQLCallStream(String uri, Object param) + { + return new JsonWebCall(_webAddress + uri).ExecuteReturnStream(param); + } + + public void handleMSSQLCall(String uri, String error, Object param, Class responseType, Consumer consumer) + { + handleDatabaseCall(new DatabaseRunnable(() -> + { + new JsonWebCall(_webAddress + uri).Execute(responseType, consumer::accept, param); + }, error)); + } + + public void handleMSSQLCall(String uri, Object param, Class responseType, Consumer consumer) + { + handleDatabaseCall(new DatabaseRunnable(() -> + { + new JsonWebCall(_webAddress + uri).Execute(responseType, consumer::accept, param); + }, "Handling MSSQL Call " + uri)); + } + + public void handleMSSQLCall(String uri, Object param, Type responseType, Consumer consumer) + { + handleDatabaseCall(new DatabaseRunnable(() -> + { + T t = new JsonWebCall(_webAddress + uri).Execute(responseType, param); + consumer.accept(t); + }, "Handling MSSQL Call " + uri)); + } + + public void handleMSSQLCall(String uri, Object param) + { + handleDatabaseCall(new DatabaseRunnable(() -> + { + new JsonWebCall(_webAddress + uri).Execute(param); + }, "Handling MSSQL Call " + uri)); + } + + @Override + public void deregister() + { + _shutdown = true; + } + + private void handleDatabaseCall(DatabaseRunnable databaseRunnable) + { + ThreadPool.ASYNC.submit(() -> + { + try + { + databaseRunnable.run(); + } + catch (Exception exception) + { + processFailedDatabaseCall(databaseRunnable, exception); + } + }); + } + + private void processFailedDatabaseCall(DatabaseRunnable databaseRunnable, Exception exception) + { + System.err.println(databaseRunnable.getErrorMessage()); + exception.printStackTrace(); + + if (databaseRunnable.getFailedCounts() < 4) + { + databaseRunnable.incrementFailCount(); + + synchronized (QUEUE_LOCK) + { + _failedQueue.add(databaseRunnable); + } + } + } + + private void processDatabaseQueue() + { + Set clone; + + synchronized (QUEUE_LOCK) + { + clone = new HashSet<>(_failedQueue); + _failedQueue.clear(); + } + + clone.forEach(this::handleDatabaseCall); + + if (_shutdown && _failedQueue.isEmpty()) + { + _task.cancel(); + } + } +} diff --git a/Plugins/Mineplex.Core/src/mineplex/core/database/MSSQLProvider.java b/Plugins/Mineplex.Core/src/mineplex/core/database/MSSQLProvider.java new file mode 100644 index 000000000..e3f5c35a9 --- /dev/null +++ b/Plugins/Mineplex.Core/src/mineplex/core/database/MSSQLProvider.java @@ -0,0 +1,22 @@ +package mineplex.core.database; + +import java.lang.reflect.Type; +import java.util.function.Consumer; + +@Deprecated +public interface MSSQLProvider +{ + T handleSyncMSSQLCall(String uri, Object param, Type responseType); + + String handleSyncMSSQLCallStream(String uri, Object param); + + void handleMSSQLCall(String uri, String error, Object param, Class responseType, Consumer consumer); + + void handleMSSQLCall(String uri, Object param, Class responseType, Consumer consumer); + + void handleMSSQLCall(String uri, Object param, Type responseType, Consumer consumer); + + void handleMSSQLCall(String uri, Object param); + + void deregister(); +} diff --git a/Plugins/Mineplex.Core/src/mineplex/core/database/MinecraftRepository.java b/Plugins/Mineplex.Core/src/mineplex/core/database/MinecraftRepository.java index 690fc9cc6..60a8d39c3 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/database/MinecraftRepository.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/database/MinecraftRepository.java @@ -1,112 +1,69 @@ package mineplex.core.database; -import java.sql.Connection; -import java.sql.PreparedStatement; -import java.sql.ResultSet; -import java.sql.SQLException; -import java.sql.Statement; -import java.util.Iterator; - import javax.sql.DataSource; +import java.lang.reflect.Type; +import java.util.concurrent.atomic.AtomicReference; +import java.util.function.Consumer; -import mineplex.core.common.util.NautHashMap; -import mineplex.serverdata.database.DBPool; -import mineplex.serverdata.database.DatabaseRunnable; -import mineplex.serverdata.database.RepositoryBase; -import mineplex.serverdata.database.column.Column; -import mineplex.core.updater.UpdateType; -import mineplex.core.updater.event.UpdateEvent; +import org.bukkit.event.Listener; import org.jooq.DSLContext; import org.jooq.SQLDialect; import org.jooq.impl.DSL; -import org.bukkit.Bukkit; -import org.bukkit.event.EventHandler; -import org.bukkit.event.Listener; -import org.bukkit.plugin.java.JavaPlugin; +import mineplex.core.common.util.UtilServer; +import mineplex.serverdata.database.DBPool; +import mineplex.serverdata.database.RepositoryBase; +/** + * Do not extend this class unless you are doing MSSQL calls (which you shouldn't be) + * + * @deprecated don't use mssql thx + */ +@Deprecated public abstract class MinecraftRepository extends RepositoryBase implements Listener { - // Queue for failed processes - private static Object _queueLock = new Object(); - private NautHashMap _failedQueue = new NautHashMap(); + private static AtomicReference PROVIDER = new AtomicReference<>(new BasicMSSQLProvider()); - protected JavaPlugin _plugin; // Plugin responsible for this repository + public static void setMSSQLProvider(MSSQLProvider provider) + { + MSSQLProvider oldProvider = PROVIDER.getAndSet(provider); + oldProvider.deregister(); + } - /** - * Constructor - * @param plugin - the {@link JavaPlugin} module responsible for this repository. - * @param dataSource - the {@link DataSource} responsible for providing the connection pool to this repository. - */ - public MinecraftRepository(JavaPlugin plugin, DataSource dataSource) + public MinecraftRepository(DataSource dataSource) { super(dataSource); - _plugin = plugin; - plugin.getServer().getPluginManager().registerEvents(this, plugin); + UtilServer.RegisterEvents(this); } - protected DSLContext jooq() + protected T handleSyncMSSQLCall(String uri, Object param, Type responseType) { - return DSL.using(DBPool.getAccount(), SQLDialect.MYSQL); + return PROVIDER.get().handleSyncMSSQLCall(uri, param, responseType); } - protected void handleDatabaseCall(final DatabaseRunnable databaseRunnable, final String errorMessage) + protected String handleSyncMSSQLCallStream(String uri, Object param) { - Thread asyncThread = new Thread(new Runnable() - { - public void run() - { - try - { - databaseRunnable.run(); - } - catch (Exception exception) - { - processFailedDatabaseCall(databaseRunnable, exception.getMessage(), errorMessage); - } - } - }); - - asyncThread.start(); + return PROVIDER.get().handleSyncMSSQLCallStream(uri, param); } - protected void processFailedDatabaseCall(DatabaseRunnable databaseRunnable, String errorPreMessage, String runnableMessage) + protected void handleMSSQLCall(String uri, String error, Object param, Class responseType, Consumer consumer) { - if (databaseRunnable.getFailedCounts() < 4) - { - databaseRunnable.incrementFailCount(); - - synchronized (_queueLock) - { - _failedQueue.put(databaseRunnable, runnableMessage); - } - } + PROVIDER.get().handleMSSQLCall(uri, error, param, responseType, consumer); } - @EventHandler - public void processDatabaseQueue(UpdateEvent event) + protected void handleMSSQLCall(String uri, Object param, Class responseType, Consumer consumer) { - if (event.getType() != UpdateType.MIN_01) - return; - - processFailedQueue(); + PROVIDER.get().handleMSSQLCall(uri, param, responseType, consumer); } - private void processFailedQueue() + protected void handleMSSQLCall(String uri, Object param, Type responseType, Consumer consumer) { - synchronized (_queueLock) - { - for (Iterator runnablesIterator = _failedQueue.keySet().iterator(); runnablesIterator.hasNext();) - { - DatabaseRunnable databaseRunnable = runnablesIterator.next(); - handleDatabaseCall(databaseRunnable, _failedQueue.get(databaseRunnable)); - } - } + PROVIDER.get().handleMSSQLCall(uri, param, responseType, consumer); } - public JavaPlugin getPlugin() + protected void handleAsyncMSSQLCall(String uri, Object param) { - return _plugin; + PROVIDER.get().handleMSSQLCall(uri, param); } } diff --git a/Plugins/Mineplex.Core/src/mineplex/core/disguise/DisguiseManager.java b/Plugins/Mineplex.Core/src/mineplex/core/disguise/DisguiseManager.java index 6e1e32169..89c28093f 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/disguise/DisguiseManager.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/disguise/DisguiseManager.java @@ -528,6 +528,31 @@ public class DisguiseManager extends MiniPlugin implements IPacketHandler Bukkit.getScheduler().runTaskLater(UtilServer.getPlugin(), r, pDisguise.getShowInTabListDelay()); } } + else + { + if (!pDisguise.replaceOriginalName()) + { + Runnable r = () -> + { + PacketPlayOutPlayerInfo playerInfoPacketRemove = new PacketPlayOutPlayerInfo(PacketPlayOutPlayerInfo.EnumPlayerInfoAction.REMOVE_PLAYER); + PacketPlayOutPlayerInfo.PlayerInfoData dataRemove = playerInfoPacketRemove.new PlayerInfoData(pDisguise.getProfile(), 0, WorldSettings.EnumGamemode.SURVIVAL, null); + playerInfoPacketRemove.b.add(dataRemove); + handlePacket(playerInfoPacketRemove, packetVerifier); + PacketPlayOutPlayerInfo playerInfoPacketAdd = new PacketPlayOutPlayerInfo(PacketPlayOutPlayerInfo.EnumPlayerInfoAction.ADD_PLAYER); + PacketPlayOutPlayerInfo.PlayerInfoData dataAdd = playerInfoPacketRemove.new PlayerInfoData(pDisguise.getOriginalProfile(), 0, WorldSettings.EnumGamemode.SURVIVAL, null); + playerInfoPacketAdd.b.add(dataAdd); + handlePacket(playerInfoPacketAdd, packetVerifier); + }; + if (pDisguise.replaceOriginalNameDelay() == 0) + { + r.run(); + } + else + { + Bukkit.getScheduler().runTaskLater(UtilServer.getPlugin(), r, pDisguise.replaceOriginalNameDelay()); + } + } + } } else { @@ -586,7 +611,7 @@ public class DisguiseManager extends MiniPlugin implements IPacketHandler * * Basically, we need to delay by an arbitrary amount of ticks (in this case, 5) because of the client. * - * In the client, the renderer renders batches of 16x16x16, and entites are stored in ChunkSections. + * In the client, the renderer renders batches of 16x16x16, and entities are stored in ChunkSections. * However, the data structure used is a HashMultimap, and the hashCode() method for Entity simply returns its entity id * * Now, due to an unfortunate coincidence, sending a PacketPlayOutEntityDestroy does not immediately remove an entity from the client. diff --git a/Plugins/Mineplex.Core/src/mineplex/core/disguise/disguises/DisguiseBlock.java b/Plugins/Mineplex.Core/src/mineplex/core/disguise/disguises/DisguiseBlock.java index 387208c51..d0c32a21d 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/disguise/disguises/DisguiseBlock.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/disguise/disguises/DisguiseBlock.java @@ -5,6 +5,9 @@ import java.util.Random; import net.minecraft.server.v1_8_R3.MathHelper; import net.minecraft.server.v1_8_R3.Packet; import net.minecraft.server.v1_8_R3.PacketPlayOutSpawnEntity; + +import org.bukkit.Material; +import org.bukkit.entity.Entity; import org.bukkit.entity.EntityType; public class DisguiseBlock extends DisguiseBase @@ -14,7 +17,7 @@ public class DisguiseBlock extends DisguiseBase private int _blockId; private int _blockData; - public DisguiseBlock(org.bukkit.entity.Entity entity, int blockId, int blockData) + public DisguiseBlock(Entity entity, int blockId, int blockData) { super(EntityType.FALLING_BLOCK, entity); @@ -22,6 +25,14 @@ public class DisguiseBlock extends DisguiseBase _blockData = blockData; } + public DisguiseBlock(Entity entity, Material material, byte data) + { + super(EntityType.FALLING_BLOCK, entity); + + _blockId = material.getId(); + _blockData = (int) data; + } + public int GetBlockId() { return _blockId; diff --git a/Plugins/Mineplex.Core/src/mineplex/core/disguise/disguises/DisguiseInsentient.java b/Plugins/Mineplex.Core/src/mineplex/core/disguise/disguises/DisguiseInsentient.java index 843af0c09..94d880968 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/disguise/disguises/DisguiseInsentient.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/disguise/disguises/DisguiseInsentient.java @@ -43,7 +43,7 @@ public abstract class DisguiseInsentient extends DisguiseLiving public void setCustomNameVisible(boolean visible) { - DataWatcher.watch(3, Byte.valueOf((byte) (visible ? 1 : 0)), EntityInsentient.META_CUSTOMNAME_VISIBLE, visible); + DataWatcher.watch(3, (byte) (visible ? 1 : 0), EntityInsentient.META_CUSTOMNAME_VISIBLE, visible); } public boolean getCustomNameVisible() diff --git a/Plugins/Mineplex.Core/src/mineplex/core/disguise/disguises/DisguisePlayer.java b/Plugins/Mineplex.Core/src/mineplex/core/disguise/disguises/DisguisePlayer.java index abfced0a4..9eef563d7 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/disguise/disguises/DisguisePlayer.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/disguise/disguises/DisguisePlayer.java @@ -6,14 +6,30 @@ import java.util.UUID; import java.util.concurrent.CompletableFuture; import java.util.concurrent.Future; -import com.mojang.authlib.GameProfile; -import mineplex.core.common.skin.SkinData; -import mineplex.core.common.util.UtilMath; -import mineplex.core.disguise.playerdisguise.PlayerDisguiseManager; -import mineplex.core.thread.ThreadPool; -import mineplex.core.utils.UtilGameProfile; -import net.minecraft.server.v1_8_R3.*; +import net.minecraft.server.v1_8_R3.AttributeInstance; +import net.minecraft.server.v1_8_R3.AttributeMapServer; +import net.minecraft.server.v1_8_R3.EntityHuman; +import net.minecraft.server.v1_8_R3.EntityPlayer; +import net.minecraft.server.v1_8_R3.IInventory; +import net.minecraft.server.v1_8_R3.ITileEntityContainer; +import net.minecraft.server.v1_8_R3.MathHelper; +import net.minecraft.server.v1_8_R3.MobEffect; +import net.minecraft.server.v1_8_R3.Packet; +import net.minecraft.server.v1_8_R3.PacketPlayOutAbilities; +import net.minecraft.server.v1_8_R3.PacketPlayOutAnimation; +import net.minecraft.server.v1_8_R3.PacketPlayOutEntityEffect; +import net.minecraft.server.v1_8_R3.PacketPlayOutExperience; +import net.minecraft.server.v1_8_R3.PacketPlayOutHeldItemSlot; +import net.minecraft.server.v1_8_R3.PacketPlayOutNamedEntitySpawn; +import net.minecraft.server.v1_8_R3.PacketPlayOutOpenWindow; +import net.minecraft.server.v1_8_R3.PacketPlayOutPlayerInfo; import net.minecraft.server.v1_8_R3.PacketPlayOutPlayerInfo.EnumPlayerInfoAction; +import net.minecraft.server.v1_8_R3.PacketPlayOutPosition; +import net.minecraft.server.v1_8_R3.PacketPlayOutRespawn; +import net.minecraft.server.v1_8_R3.PacketPlayOutUpdateAttributes; +import net.minecraft.server.v1_8_R3.PacketPlayOutUpdateHealth; +import net.minecraft.server.v1_8_R3.WorldSettings; + import org.bukkit.block.BlockFace; import org.bukkit.craftbukkit.v1_8_R3.inventory.CraftInventory; import org.bukkit.entity.Entity; @@ -21,6 +37,14 @@ import org.bukkit.entity.EntityType; import org.bukkit.entity.Player; import org.bukkit.event.EventHandler; +import com.mojang.authlib.GameProfile; + +import mineplex.core.common.skin.SkinData; +import mineplex.core.common.util.UtilMath; +import mineplex.core.disguise.playerdisguise.PlayerDisguiseManager; +import mineplex.core.thread.ThreadPool; +import mineplex.core.utils.UtilGameProfile; + public class DisguisePlayer extends DisguiseHuman { private String _requestedUsername; @@ -36,7 +60,9 @@ public class DisguisePlayer extends DisguiseHuman private boolean _sendSkinToSelf = true; private boolean _showInTabList = false; + private boolean _replaceOriginalName = true; private int _showInTabListDelay = 30; + private int _replaceOriginalNameDelay; private DisguisePlayer(Entity entity) { @@ -64,7 +90,7 @@ public class DisguisePlayer extends DisguiseHuman /** * @param username The username to disguise this entity as - * @param skin The username of the player whose skin will be used + * @param skin The username of the player whose skin will be used */ public DisguisePlayer(Entity entity, String username, String skin) { @@ -86,7 +112,6 @@ public class DisguisePlayer extends DisguiseHuman * If this DisguisePlayer has been initialized with a requested username and requested skin, it must be initialized * * @param onComplete The Runnable which will be run once initialized. Can be null. It will be run on a separate thread if initialization took place, and the current thread if not - * * @returns A Future which, upon completion, implies the task is done */ public Future initialize(Runnable onComplete) @@ -435,6 +460,22 @@ public class DisguisePlayer extends DisguiseHuman return selfProfile; } + public boolean replaceOriginalName() + { + return this._replaceOriginalName; + } + + public int replaceOriginalNameDelay() + { + return this._replaceOriginalNameDelay; + } + + public void setReplaceOriginalName(boolean b, int delay) + { + this._replaceOriginalName = b; + this._replaceOriginalNameDelay = delay; + } + private UUID getOriginalUUID() { if (this._originalProfile.getProperties().containsKey(PlayerDisguiseManager.ORIGINAL_UUID_KEY)) diff --git a/Plugins/Mineplex.Core/src/mineplex/core/disguise/playerdisguise/DisguiseCommand.java b/Plugins/Mineplex.Core/src/mineplex/core/disguise/playerdisguise/DisguiseCommand.java index 1974687a7..dfe3d6fb2 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/disguise/playerdisguise/DisguiseCommand.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/disguise/playerdisguise/DisguiseCommand.java @@ -11,7 +11,7 @@ public class DisguiseCommand extends CommandBase implemen { DisguiseCommand(PlayerDisguiseManager plugin) { - super(plugin, Rank.ADMIN, new Rank[]{Rank.YOUTUBE, Rank.TWITCH}, "disguise"); + super(plugin, Rank.ADMIN, new Rank[]{Rank.YOUTUBE_SMALL, Rank.YOUTUBE, Rank.TWITCH}, "disguise"); } @Override diff --git a/Plugins/Mineplex.Core/src/mineplex/core/disguise/playerdisguise/DisguisePlayerBean.java b/Plugins/Mineplex.Core/src/mineplex/core/disguise/playerdisguise/DisguisePlayerBean.java index ab7878e08..535cec853 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/disguise/playerdisguise/DisguisePlayerBean.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/disguise/playerdisguise/DisguisePlayerBean.java @@ -12,6 +12,9 @@ import com.google.gson.JsonSerializer; import com.mojang.authlib.GameProfile; import com.mojang.authlib.properties.PropertyMap; import com.mojang.util.UUIDTypeAdapter; + +import mineplex.core.common.Constants; +import mineplex.core.status.ServerStatusManager; import mineplex.serverdata.data.Data; import java.lang.reflect.Type; @@ -19,17 +22,6 @@ import java.util.UUID; public class DisguisePlayerBean implements Data { - private static final Gson GSON; - - static - { - GSON = new GsonBuilder() - .registerTypeAdapter(GameProfile.class, new GameProfileSerializer()) - .registerTypeAdapter(PropertyMap.class, new PropertyMap.Serializer()) - .registerTypeAdapter(UUID.class, new UUIDTypeAdapter()) - .create(); - } - private int _accountID; private String _playerName; @@ -82,56 +74,11 @@ public class DisguisePlayerBean implements Data private String serialize(GameProfile gameProfile) { - return GSON.toJson(gameProfile); + return Constants.GSON.toJson(gameProfile); } private GameProfile deserialize(String in) { - return GSON.fromJson(in, GameProfile.class); - } - - private static class GameProfileSerializer implements JsonSerializer, JsonDeserializer - { - private GameProfileSerializer() - { - } - - public GameProfile deserialize(JsonElement var1, Type var2, JsonDeserializationContext var3) throws JsonParseException - { - JsonObject var4 = (JsonObject) var1; - UUID var5 = var4.has("id") ? (UUID) var3.deserialize(var4.get("id"), UUID.class) : null; - String var6 = var4.has("name") ? var4.getAsJsonPrimitive("name").getAsString() : null; - GameProfile gameProfile = new GameProfile(var5, var6); - - if (var4.has("properties")) - { - PropertyMap propertyMap = var3.deserialize(var4.get("properties"), PropertyMap.class); - gameProfile.getProperties().putAll(propertyMap); - } - - return gameProfile; - } - - public JsonElement serialize(GameProfile var1, Type var2, JsonSerializationContext var3) - { - JsonObject var4 = new JsonObject(); - - if (var1.getId() != null) - { - var4.add("id", var3.serialize(var1.getId())); - } - - if (var1.getName() != null) - { - var4.addProperty("name", var1.getName()); - } - - if (var1.getProperties() != null) - { - var4.add("properties", var3.serialize(var1.getProperties())); - } - - return var4; - } + return Constants.GSON.fromJson(in, GameProfile.class); } } diff --git a/Plugins/Mineplex.Core/src/mineplex/core/disguise/playerdisguise/PlayerDisguiseManager.java b/Plugins/Mineplex.Core/src/mineplex/core/disguise/playerdisguise/PlayerDisguiseManager.java index 4c7e16502..fd1b44c80 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/disguise/playerdisguise/PlayerDisguiseManager.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/disguise/playerdisguise/PlayerDisguiseManager.java @@ -392,8 +392,8 @@ public class PlayerDisguiseManager extends MiniPlugin implements IPacketHandler CoreClient client = getClientManager().Get(caller); client.undisguise(); - require(FriendManager.class).updatePlayerStatus(disguisedProfile.getName(), null); - require(FriendManager.class).updatePlayerStatus(originalProfile.getName(), new PlayerStatus(originalProfile.getName(), _serverName)); + require(FriendManager.class).updatePlayerStatus(disguisedProfile.getId(), null); + require(FriendManager.class).updatePlayerStatus(originalProfile.getId(), new PlayerStatus(originalProfile.getId(), originalProfile.getName(), _serverName)); getPreferencesManager().handlePlayerJoin(caller, true); require(ScoreboardManager.class).handlePlayerJoin(disguise.getOriginalProfile().getName()); @@ -539,8 +539,8 @@ public class PlayerDisguiseManager extends MiniPlugin implements IPacketHandler callerProfile.getProperties().removeAll(ORIGINAL_UUID_KEY); callerProfile.getProperties().put(ORIGINAL_UUID_KEY, new Property(ORIGINAL_UUID_KEY, caller.getUniqueId().toString())); - require(FriendManager.class).updatePlayerStatus(disguisePlayer.getOriginalProfile().getName(), null); - require(FriendManager.class).updatePlayerStatus(requestedUsername, new PlayerStatus(requestedUsername, _serverName)); + require(FriendManager.class).updatePlayerStatus(disguisePlayer.getOriginalProfile().getId(), null); + require(FriendManager.class).updatePlayerStatus(disguisePlayer.getProfile().getId(), new PlayerStatus(disguisePlayer.getProfile().getId(), requestedUsername, _serverName)); getPreferencesManager().handlePlayerJoin(caller, true); diff --git a/Plugins/Mineplex.Core/src/mineplex/core/donation/CurrencyRewardData.java b/Plugins/Mineplex.Core/src/mineplex/core/donation/CurrencyRewardData.java new file mode 100644 index 000000000..72740c3c5 --- /dev/null +++ b/Plugins/Mineplex.Core/src/mineplex/core/donation/CurrencyRewardData.java @@ -0,0 +1,58 @@ +package mineplex.core.donation; + +import java.util.UUID; +import java.util.function.Consumer; + +class CurrencyRewardData +{ + private final String _playerName; + private final UUID _playerUUID; + private final String _reason; + private final int _amount; + private final Consumer _callback; + private int _attempts; + + CurrencyRewardData(String playerName, UUID playerUUID, String reason, int amount, Consumer callback) + { + _playerName = playerName; + _playerUUID = playerUUID; + _reason = reason; + _amount = amount; + _callback = callback; + } + + int getAttempts() + { + return _attempts; + } + + void incrementAttempts() + { + _attempts++; + } + + String getPlayerName() + { + return _playerName; + } + + UUID getPlayerUUID() + { + return _playerUUID; + } + + String getReason() + { + return _reason; + } + + int getAmount() + { + return _amount; + } + + Consumer getCallback() + { + return _callback; + } +} diff --git a/Plugins/Mineplex.Core/src/mineplex/core/donation/DonationManager.java b/Plugins/Mineplex.Core/src/mineplex/core/donation/DonationManager.java index 596bf68c1..9b1934c9c 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/donation/DonationManager.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/donation/DonationManager.java @@ -1,371 +1,346 @@ package mineplex.core.donation; +import java.util.HashMap; +import java.util.LinkedList; +import java.util.Map; +import java.util.UUID; +import java.util.function.Consumer; + +import org.bukkit.entity.Player; +import org.bukkit.event.EventHandler; + import com.google.gson.Gson; -import mineplex.cache.player.PlayerCache; + import mineplex.core.MiniClientPlugin; +import mineplex.core.ReflectivelyCreateMiniPlugin; +import mineplex.core.account.CoreClient; import mineplex.core.account.CoreClientManager; import mineplex.core.account.event.ClientWebResponseEvent; import mineplex.core.common.currency.GlobalCurrency; -import mineplex.core.common.util.Callback; -import mineplex.core.common.util.NautHashMap; import mineplex.core.donation.command.GemCommand; import mineplex.core.donation.command.ShardCommand; +import mineplex.core.donation.gold.GoldRepository; import mineplex.core.donation.repository.DonationRepository; import mineplex.core.donation.repository.token.DonorTokenWrapper; import mineplex.core.server.util.TransactionResponse; import mineplex.core.updater.UpdateType; -import mineplex.core.updater.event.UpdateEvent; -import org.bukkit.Bukkit; -import org.bukkit.entity.Player; -import org.bukkit.event.EventHandler; -import org.bukkit.plugin.java.JavaPlugin; - -import java.util.LinkedList; -import java.util.Queue; -import java.util.UUID; +import mineplex.core.utils.UtilScheduler; +/** + * This manager handles the rewarding of transactions in the form of sales packages and currency + */ +@ReflectivelyCreateMiniPlugin public class DonationManager extends MiniClientPlugin { - private final int MAX_GIVE_ATTEMPTS = 10; + /** + * The maximum number of attempts that will be made to perform a transaction created by {@link DonationManager#rewardCurrencyUntilSuccess} + */ + public static final int MAX_GIVE_ATTEMPTS = 10; - private DonationRepository _repository; - - private NautHashMap> _gemQueue = new NautHashMap>(); - private NautHashMap> _coinQueue = new NautHashMap>(); + private static final Gson GSON = new Gson(); - private Queue _coinAttemptQueue; + private final Map> _attemptUntilSuccess = new HashMap<>(); - private final CoreClientManager _clientManager; - - public DonationManager(JavaPlugin plugin, CoreClientManager clientManager, String webAddress) + private final CoreClientManager _clientManager = require(CoreClientManager.class); + + private final DonationRepository _repository; + private final GoldRepository _goldRepository; + + private DonationManager() { - super("Donation", plugin); - - _repository = new DonationRepository(plugin, webAddress); + super("Donation"); - _coinAttemptQueue = new LinkedList<>(); + _repository = new DonationRepository(); + _goldRepository = new GoldRepository(); - _clientManager = clientManager; + UtilScheduler.runEvery(UpdateType.FAST, this::processCoinAttemptQueue); } - public CoreClientManager getClientManager() - { - return _clientManager; - } - @Override public void addCommands() { - // TODO: Re-add commands? Where are command implementations, seen as missing at the moment. addCommand(new GemCommand(this)); addCommand(new ShardCommand(this)); } - + @EventHandler public void OnClientWebResponse(ClientWebResponseEvent event) { - DonorTokenWrapper token = new Gson().fromJson(event.GetResponse(), DonorTokenWrapper.class); - LoadDonor(token, event.getUniqueId()); - } + DonorTokenWrapper token = GSON.fromJson(event.GetResponse(), DonorTokenWrapper.class); - private void LoadDonor(DonorTokenWrapper token, UUID uuid) - { - Get(uuid).loadToken(token.DonorToken); - //_repository.updateGemsAndCoins(uuid, Get(token.Name).GetGems(), Get(token.Name).getCoins()); - } - - public void purchaseUnknownSalesPackage(Callback callback, Player player, String packageName, GlobalCurrency currencyType, int cost, boolean oneTimePurchase) - { - PurchaseUnknownSalesPackage(callback, player.getName(), _clientManager.getAccountId(player), packageName, currencyType, cost, oneTimePurchase); + Get(event.getUniqueId()).loadToken(token.DonorToken); } - public void PurchaseUnknownSalesPackage(final Callback callback, final String name, final int accountId, final String packageName, final GlobalCurrency currencyType, final int cost, boolean oneTimePurchase) + public GoldRepository getGoldRepository() { - final Donor donor = Bukkit.getPlayerExact(name) != null ? Get(Bukkit.getPlayerExact(name)) : null; - + return _goldRepository; + } + + /** + * Adds an unknown sales package to the specified {@link Player} + * + * @param callback The callback which will be called on the main thread. Possible responses are: + * {@link TransactionResponse#InsufficientFunds}, when the player does not have enough of the currency + * {@link TransactionResponse#Success}, when everything worked fine + * {@link TransactionResponse#Failed}, when an known exception occured + * {@link TransactionResponse#AlreadyOwns}, when the player already owns the package + */ + public void purchaseUnknownSalesPackage(Player player, String packageName, GlobalCurrency currencyType, int cost, boolean oneTimePurchase, Consumer callback) + { + purchaseUnknownSalesPackage(_clientManager.Get(player), packageName, currencyType, cost, oneTimePurchase, callback); + } + + /** + * Adds an unknown sales package to the specified {@link CoreClient} + * + * @param callback The callback which will be called on the main thread. Possible responses are: + * {@link TransactionResponse#InsufficientFunds}, when the player does not have enough of the currency + * {@link TransactionResponse#Success}, when everything worked fine + * {@link TransactionResponse#Failed}, when an known exception occured + * {@link TransactionResponse#AlreadyOwns}, when the player already owns the package + */ + public void purchaseUnknownSalesPackage(CoreClient client, String packageName, GlobalCurrency currencyType, int cost, boolean oneTimePurchase, Consumer callback) + { + Donor donor = Get(client.getUniqueId()); + if (donor != null) { - if (oneTimePurchase && donor.OwnsUnknownPackage(packageName)) + if (oneTimePurchase && donor.ownsUnknownSalesPackage(packageName)) { if (callback != null) - callback.run(TransactionResponse.AlreadyOwns); - + callback.accept(TransactionResponse.AlreadyOwns); + return; } } - - _repository.PurchaseUnknownSalesPackage(new Callback() + + _repository.purchaseUnknownSalesPackage(client.getName(), packageName, currencyType, cost, response -> { - public void run(TransactionResponse response) + if (response == TransactionResponse.Success) { - if (response == TransactionResponse.Success) + if (donor != null) { + donor.addOwnedUnknownSalesPackage(packageName); + donor.addBalance(currencyType, -cost); + } + } + + if (callback != null) + callback.accept(response); + }); + } + + /** + * Adds a known sales package to the {@link Player} + */ + public void purchaseKnownSalesPackage(Player player, int salesPackageId) + { + purchaseKnownSalesPackage(player, salesPackageId, null); + } + + /** + * Adds a known sales package to the {@link CoreClient} + */ + public void purchaseKnownSalesPackage(CoreClient client, int salesPackageId) + { + purchaseKnownSalesPackage(client, salesPackageId, null); + } + + /** + * Adds a known sales package to the {@link Player} + * + * @param callback The callback which will be called on the main thread. Possible responses are: + * {@link TransactionResponse#InsufficientFunds}, when the player does not have enough of the currency + * {@link TransactionResponse#Success}, when everything worked fine + * {@link TransactionResponse#Failed}, when an known exception occured + * {@link TransactionResponse#AlreadyOwns}, when the player already owns the package + */ + public void purchaseKnownSalesPackage(Player player, int salesPackageId, Consumer callback) + { + purchaseKnownSalesPackage(_clientManager.Get(player), salesPackageId, callback); + } + + /** + * Adds a known sales package to the {@link CoreClient} + * + * @param callback The callback which will be called on the main thread. Possible responses are: + * {@link TransactionResponse#InsufficientFunds}, when the player does not have enough of the currency + * {@link TransactionResponse#Success}, when everything worked fine + * {@link TransactionResponse#Failed}, when an known exception occured + * {@link TransactionResponse#AlreadyOwns}, when the player already owns the package + */ + public void purchaseKnownSalesPackage(CoreClient client, int salesPackageId, Consumer callback) + { + _repository.purchaseKnownSalesPackage(client.getName(), salesPackageId, response -> + { + if (response == TransactionResponse.Success) + { + Donor donor = Get(client.getUniqueId()); + + if (donor != null) + { + donor.addOwnedKnownSalesPackage(salesPackageId); + } + } + + if (callback != null) + callback.accept(response); + }); + } + + /** + * Rewards the specified {@link Player} with {@code amount} of {@code currency} because of {@code reason} + * This method will not retry the query if it fails + */ + public void rewardCurrency(GlobalCurrency currency, Player player, String reason, int amount) + { + rewardCurrency(currency, player, reason, amount, true, null); + } + + /** + * Rewards the specified {@link Player} with {@code amount} of {@code currency} because of {@code reason} + * This method will not retry the query if it fails + * + * @param callback The callback which will be called on the main thread. Possible responses are: + * {@link Boolean#TRUE} if the transaction succeeded + * {@link Boolean#FALSE} if the transaction failed, either during incrementation or sanity-checking + */ + public void rewardCurrency(GlobalCurrency currency, Player player, String reason, int amount, Consumer callback) + { + rewardCurrency(currency, player, reason, amount, true, callback); + } + + /** + * Rewards the specified {@link Player} with {@code amount} of {@code currency} because of {@code reason} + * This method will not retry the query if it fails + * + * @param updateTotal Whether to update the local value for {@code currency} + * @param callback The callback which will be called on the main thread. Possible responses are: + * {@link Boolean#TRUE} if the transaction succeeded + * {@link Boolean#FALSE} if the transaction failed, either during incrementation or sanity-checking + */ + public void rewardCurrency(GlobalCurrency currency, Player player, String reason, int amount, boolean updateTotal, Consumer callback) + { + rewardCurrency(currency, _clientManager.Get(player), reason, amount, updateTotal, callback); + } + + /** + * Rewards the specified {@link CoreClient} with {@code amount} of {@code currency} because of {@code reason} + * This method will not retry the query if it fails + */ + public void rewardCurrency(GlobalCurrency currency, CoreClient client, String reason, int amount) + { + rewardCurrency(currency, client.getName(), client.getUniqueId(), reason, amount, true, null); + } + + /** + * Rewards the specified {@link CoreClient} with {@code amount} of {@code currency} because of {@code reason} + * This method will not retry the query if it fails + * + * @param callback The callback which will be called on the main thread. Possible responses are: + * {@link Boolean#TRUE} if the transaction succeeded + * {@link Boolean#FALSE} if the transaction failed, either during incrementation or sanity-checking + */ + public void rewardCurrency(GlobalCurrency currency, CoreClient client, String reason, int amount, Consumer callback) + { + rewardCurrency(currency, client.getName(), client.getUniqueId(), reason, amount, true, callback); + } + + /** + * Rewards the specified {@link CoreClient} with {@code amount} of {@code currency} because of {@code reason} + * This method will not retry the query if it fails + * + * @param updateTotal Whether to update the local value for {@code currency} + * @param callback The callback which will be called on the main thread. Possible responses are: + * {@link Boolean#TRUE} if the transaction succeeded + * {@link Boolean#FALSE} if the transaction failed, either during incrementation or sanity-checking + */ + public void rewardCurrency(GlobalCurrency currency, CoreClient client, String reason, int amount, boolean updateTotal, Consumer callback) + { + rewardCurrency(currency, client.getName(), client.getUniqueId(), reason, amount, updateTotal, callback); + } + + /** + * Rewards a player a specific amount of a currency type - used by Votifier ONLY due to volatile playerName and playerUUID + * @param currency The type of currency to reward + * @param playerName The name of the player being rewarded + * @param playerUUID The UUID of the player being rewarded + * @param reason The reason for the currency being awarded + * @param amount The amount of currency being rewarded + * @param callback A callback to retrieve the success of the award + */ + public void rewardCurrency(GlobalCurrency currency, String playerName, UUID playerUUID, String reason, int amount, Consumer callback) + { + rewardCurrency(currency, playerName, playerUUID, reason, amount, true, callback); + } + + // Private because volatile with playerName and playerUUID + private void rewardCurrency(GlobalCurrency currency, String playerName, UUID playerUUID, String reason, int amount, boolean updateTotal, Consumer callback) + { + _repository.reward(currency, playerName, reason, amount, success -> + { + if (success) + { + if (updateTotal) + { + Donor donor = Get(playerUUID); if (donor != null) { - donor.AddUnknownSalesPackagesOwned(packageName); - donor.DeductCost(cost, currencyType); + donor.addBalance(currency, amount); } } - - if (callback != null) - callback.run(response); } - }, name, accountId, packageName, currencyType, cost); - } - public void PurchaseKnownSalesPackage(final Callback callback, final String name, final UUID uuid, final int cost, final int salesPackageId) - { - _repository.PurchaseKnownSalesPackage(new Callback() - { - public void run(TransactionResponse response) + if (callback != null) { - if (response == TransactionResponse.Success) - { - Donor donor = Get(uuid); - - if (donor != null) - { - donor.AddSalesPackagesOwned(salesPackageId); - } - } - - if (callback != null) - callback.run(response); + callback.accept(success); } - }, name, uuid.toString(), cost, salesPackageId); + }); } - public void RewardGems(Callback callback, String caller, String name, UUID uuid, int amount) + /** + * Rewards the {@link Player} with {@code amount} of {@code currency} because of {@code reason} + * This method will retry the transaction for up to {@link DonationManager#MAX_GIVE_ATTEMPTS} attempts. + * + * This method is not thread safe, and should be called on the main thread + */ + public void rewardCurrencyUntilSuccess(GlobalCurrency currency, Player player, String reason, int amount) { - RewardGems(callback, caller, name, uuid, amount, true); + rewardCurrencyUntilSuccess(currency, _clientManager.Get(player), reason, amount); } - public void RewardGems(final Callback callback, final String caller, final String name, final UUID uuid, final int amount, final boolean updateTotal) + /** + * Rewards the {@link CoreClient} with {@code amount} of {@code currency} because of {@code reason} + * This method will retry the transaction for up to {@link DonationManager#MAX_GIVE_ATTEMPTS} attempts. + * + * This method is not thread safe, and should be called on the main thread + */ + public void rewardCurrencyUntilSuccess(GlobalCurrency currency, CoreClient client, String reason, int amount) { - _repository.gemReward(new Callback() - { - public void run(Boolean success) - { - if (success) - { - if (updateTotal) - { - Donor donor = Get(uuid); - - if (donor != null) - { - donor.addBalance(GlobalCurrency.GEM, amount); - } - } - } - - if (callback != null) - callback.run(success); - } - }, caller, name, uuid.toString(), amount); + rewardCurrencyUntilSuccess(currency, client.getName(), client.getUniqueId(), reason, amount, null); } - - public void RewardGemsLater(final String caller, final Player player, final int amount) + + /** + * Rewards the {@link Player} with {@code amount} of {@code currency} because of {@code reason} + * This method will retry the transaction for up to {@link DonationManager#MAX_GIVE_ATTEMPTS} attempts + * + * This method is not thread safe, and should be called on the main thread + * + * @param callback The callback which will be called on the main thread. Possible responses are: + * {@link Boolean#TRUE} if the transaction succeeded + * {@link Boolean#FALSE} if the transaction failed, either during incrementation or sanity-checking + */ + public void rewardCurrencyUntilSuccess(GlobalCurrency currency, Player player, String reason, int amount, Consumer callback) { - if (!_gemQueue.containsKey(player)) - _gemQueue.put(player, new NautHashMap()); - - int totalAmount = amount; - - if (_gemQueue.get(player).containsKey(caller)) - totalAmount += _gemQueue.get(player).get(caller); - - _gemQueue.get(player).put(caller, totalAmount); - - //Do Temp Change - Donor donor = Get(player.getUniqueId()); - - if (donor != null) - donor.addBalance(GlobalCurrency.GEM, amount); + CoreClient client = _clientManager.Get(player); + rewardCurrencyUntilSuccess(currency, client.getName(), client.getUniqueId(), reason, amount, callback); } - - @EventHandler - public void UpdateGemQueue(UpdateEvent event) + + // private because volatile with name and accountId + private void rewardCurrencyUntilSuccess(GlobalCurrency currency, String name, UUID playerUUID, String reason, int amount, Consumer callback) { - if (event.getType() != UpdateType.SLOWER) - return; - - for (Player player : _gemQueue.keySet()) - { - String caller = null; - int total = 0; - - for (String curCaller : _gemQueue.get(player).keySet()) - { - caller = curCaller; - total += _gemQueue.get(player).get(curCaller); - } - - if (caller == null) - continue; - - //Actually Add Gems - RewardGems(null, caller, player.getName(), player.getUniqueId(), total, false); - - System.out.println("Queue Added [" + player + "] with Gems [" + total + "] for [" + caller + "]"); - - //Clean - _gemQueue.get(player).clear(); - } - - //Clean - _gemQueue.clear(); - } - - public void rewardCoinsUntilSuccess(Callback callback, String caller, String name, int accountId, int amount) - { - _coinAttemptQueue.add(new GiveDonorData(callback, name, caller, accountId, amount)); - } - - public void RewardCoins(Callback callback, String caller, String name, int accountId, int amount) - { - RewardCoins(callback, caller, name, accountId, amount, true); - } - - public void RewardCoins(final Callback callback, final String caller, final String name, final int accountId, final int amount, final boolean updateTotal) - { - _repository.rewardCoins(new Callback() - { - public void run(Boolean success) - { - if (success) - { - if (updateTotal) - { - Donor donor = Get(name); - - if (donor != null) - { - donor.addBalance(GlobalCurrency.TREASURE_SHARD, amount); - } - } - } - - if (callback != null) - callback.run(success); - } - }, caller, name, accountId, amount); - } - - public void RewardCoinsLater(final String caller, final Player player, final int amount) - { - if (!_coinQueue.containsKey(player)) - _coinQueue.put(player, new NautHashMap()); - - int totalAmount = amount; - - if (_coinQueue.get(player).containsKey(caller)) - totalAmount += _coinQueue.get(player).get(caller); - - _coinQueue.get(player).put(caller, totalAmount); - - //Do Temp Change - Donor donor = Get(player.getUniqueId()); - - if (donor != null) - donor.addBalance(GlobalCurrency.TREASURE_SHARD, amount); - } - - @EventHandler - public void UpdateCoinQueue(UpdateEvent event) - { - if (event.getType() != UpdateType.SLOWER) - return; - - for (final Player player : _coinQueue.keySet()) - { - String tempCaller = null; - int tempTotal = 0; - - for (String curCaller : _coinQueue.get(player).keySet()) - { - tempCaller = curCaller; - tempTotal += _coinQueue.get(player).get(curCaller); - } - - final int total = tempTotal; - final String caller = tempCaller; - - if (caller == null) - continue; - - if (player.isOnline() && player.isValid()) - RewardCoins(null, caller, player.getName(), _clientManager.Get(player).getAccountId(), total, false); - else - { - Bukkit.getServer().getScheduler().runTaskAsynchronously(getPlugin(), new Runnable() - { - public void run() - { - RewardCoins(null, caller, player.getName(), PlayerCache.getInstance().getPlayer(player.getUniqueId()).getAccountId(), total, false); - } - }); - } - - System.out.println("Queue Added [" + player + "] with Coins [" + total + "] for [" + caller + "]"); - - //Clean - _coinQueue.get(player).clear(); - } - - //Clean - _coinQueue.clear(); - } - - @EventHandler - public void processCoinAttemptQueue(UpdateEvent event) - { - if (event.getType() != UpdateType.FAST) - return; - - GiveDonorData data = _coinAttemptQueue.poll(); - - if (data != null) - { - _repository.rewardCoins(new Callback() - { - @Override - public void run(Boolean success) - { - if (success) - { - Donor donor = Get(data.getUuid()); - - if (donor != null) - { - donor.addBalance(GlobalCurrency.TREASURE_SHARD, data.getGiveAmount()); - } - - if (data.getCallback() != null) data.getCallback().run(true); - - System.out.println("Successfully rewarded shards to player " + data.getPlayerName()); - } - else - { - data.incrementAttempts(); - - if (data.getAttempts() >= MAX_GIVE_ATTEMPTS) - { - // Admit Defeat! - if (data.getCallback() != null) data.getCallback().run(false); - System.out.println("Gave up giving shards to player " + data.getPlayerName()); - } - else - { - // Add again to the back of queue - _coinAttemptQueue.add(data); - System.out.println("Failed to reward shards to player " + data.getPlayerName() + ". Attempts: " + data.getAttempts()); - } - } - } - }, data.getCaller(), data.getPlayerName(), data.getAccountId(), data.getGiveAmount()); - } - + _attemptUntilSuccess.computeIfAbsent(currency, key -> new LinkedList<>()) + .add(new CurrencyRewardData(name, playerUUID, reason, amount, callback)); } public void applyKits(String playerName) @@ -378,4 +353,56 @@ public class DonationManager extends MiniClientPlugin { return new Donor(); } + + private void processCoinAttemptQueue() + { + _attemptUntilSuccess.forEach((currency, playerMap) -> + { + CurrencyRewardData data = playerMap.poll(); + + if (data != null) + { + _repository.reward(currency, data.getPlayerName(), data.getReason(), data.getAmount(), success -> + { + if (success) + { + Donor donor = Get(data.getPlayerUUID()); + + if (donor != null) + { + donor.addBalance(currency, data.getAmount()); + } + + if (data.getCallback() != null) + { + data.getCallback().accept(true); + } + + System.out.println("Successfully rewarded " + currency.getPrefix() + " to player " + data.getPlayerName()); + } + else + { + data.incrementAttempts(); + + if (data.getAttempts() >= MAX_GIVE_ATTEMPTS) + { + // Admit Defeat! + if (data.getCallback() != null) data.getCallback().accept(false); + System.out.println("Gave up giving " + currency.getPrefix() + " to player " + data.getPlayerName()); + } + else + { + playerMap.add(data); + System.out.println("Failed to reward " + currency.getPrefix() + " to player " + data.getPlayerName() + ". Attempts: " + data.getAttempts()); + } + } + }); + } + }); + } + + public CoreClientManager getClientManager() + { + return _clientManager; + } } diff --git a/Plugins/Mineplex.Core/src/mineplex/core/donation/Donor.java b/Plugins/Mineplex.Core/src/mineplex/core/donation/Donor.java index c2282a3b4..e8ca43725 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/donation/Donor.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/donation/Donor.java @@ -1,119 +1,151 @@ package mineplex.core.donation; +import java.util.ArrayList; +import java.util.HashMap; +import java.util.Iterator; +import java.util.List; +import java.util.Map; + import mineplex.core.common.currency.GlobalCurrency; import mineplex.core.donation.repository.token.CoinTransactionToken; import mineplex.core.donation.repository.token.DonorToken; import mineplex.core.donation.repository.token.TransactionToken; -import java.util.ArrayList; -import java.util.HashMap; -import java.util.List; -import java.util.Map; - +/** + * Represents a player's donation information + */ public class Donor { private final Map _balances = new HashMap<>(); - private boolean _donated; - private List _salesPackagesOwned = new ArrayList(); - private List _unknownSalesPackagesOwned = new ArrayList(); - private List _transactions = new ArrayList(); - private List _coinTransactions = new ArrayList(); - - private boolean _update = true; - - public Donor() { } - - public void loadToken(DonorToken token) + private List _salesPackagesOwned = new ArrayList<>(); + private List _unknownSalesPackagesOwned = new ArrayList<>(); + private List _transactions = new ArrayList<>(); + private List _coinTransactions = new ArrayList<>(); + + void loadToken(DonorToken token) { _balances.put(GlobalCurrency.GEM, token.Gems); _balances.put(GlobalCurrency.TREASURE_SHARD, token.Coins); - _donated = token.Donated; - - _salesPackagesOwned = token.SalesPackages; - _unknownSalesPackagesOwned = token.UnknownSalesPackages; - _transactions = token.Transactions; - _coinTransactions = token.CoinRewards; + + _salesPackagesOwned = token.SalesPackages; + _unknownSalesPackagesOwned = token.UnknownSalesPackages; + _transactions = token.Transactions; + _coinTransactions = token.CoinRewards; } - public List GetSalesPackagesOwned() - { - return _salesPackagesOwned; - } - - public List GetUnknownSalesPackagesOwned() - { - return _unknownSalesPackagesOwned; - } + /** + * Get the known sales packages that this donor owns, local to this server + */ + public List getOwnedKnownSalesPackages() + { + return _salesPackagesOwned; + } - public boolean Owns(Integer salesPackageId) - { - return salesPackageId == -1 || _salesPackagesOwned.contains(salesPackageId); - } + /** + * Get the unknown sales packages that this donor owns, local to this server + */ + public List getOwnedUnknownSalesPackages() + { + return _unknownSalesPackagesOwned; + } - public void AddSalesPackagesOwned(int salesPackageId) + /** + * Checks whether this donor owns the specified known sales package, local to this server + * + * @return True if this donor owns the specified package, or if the id specified is -1 + */ + public boolean ownsKnownSalesPackage(int id) + { + return id == -1 || _salesPackagesOwned.contains(id); + } + + /** + * Checks whether this donor owns the specified unknown sales package, local to this server + * + * @param packageName The package name, case sensitive + */ + public boolean ownsUnknownSalesPackage(String packageName) + { + return _unknownSalesPackagesOwned.contains(packageName); + } + + /** + * Adds a sales package to this donor, local to this server + */ + public void addOwnedKnownSalesPackage(int salesPackageId) { _salesPackagesOwned.add(salesPackageId); } - public boolean HasDonated() + /** + * Adds an unknown sales package to this donor, local to this server + * + * @param packageName The package name, case sensitive + */ + public void addOwnedUnknownSalesPackage(String packageName) { - return _donated; + _unknownSalesPackagesOwned.add(packageName); } - - public void DeductCost(int cost, GlobalCurrency currencyType) - { - addBalance(currencyType, -cost); - } - + + /** + * Removes a known sales package from this donor, local to this server + */ + public void removeOwnedKnownSalesPackage(int id) + { + _salesPackagesOwned.remove(id); + } + + /** + * Removes an unknown sales package from this donor, local to this server + * + * @param packageName The package name, case sensitive + */ + public void removeOwnedUnknownSalesPackage(String packageName) + { + _unknownSalesPackagesOwned.remove(packageName); + } + + /** + * Gets the balance of the specified currency for this donor, local to this server + */ public int getBalance(GlobalCurrency currencyType) { return _balances.getOrDefault(currencyType, 0); } + /** + * Modifies the balance of the specified currency by the given amount, local to this server + * + * @param amount The amount to modify the balance by. Can be positive or negative + */ public void addBalance(GlobalCurrency currencyType, int amount) { _balances.merge(currencyType, amount, Integer::sum); } - public boolean OwnsUnknownPackage(String packageName) - { - return _unknownSalesPackagesOwned.contains(packageName); - } - - public boolean Updated() - { - return _update; - } - - public void AddUnknownSalesPackagesOwned(String packageName) - { - _unknownSalesPackagesOwned.add(packageName); - } - - public void RemoveUnknownSalesPackagesOwned(String packageName) - { - _unknownSalesPackagesOwned.remove(packageName); - } - + /** + * Get the transactions associated to this player, local to this server + */ public List getTransactions() { return _transactions; } - public boolean OwnsUltraPackage() - { - for (String packageName : _unknownSalesPackagesOwned) - { - if (packageName.contains("ULTRA")) - return true; - } - - return false; - } - + /** + * Get the coin transactions associated to this player, local to this server + */ public List getCoinTransactions() { return _coinTransactions; } + /** + * Clears all owned unknown packages with the given name, because it's a List + * + * @param packageName The name + */ + public void removeAllOwnedUnknownSalesPackages(String packageName) + { + _unknownSalesPackagesOwned.removeIf(pack -> pack.equals(packageName)); + } } diff --git a/Plugins/Mineplex.Core/src/mineplex/core/donation/GiveDonorData.java b/Plugins/Mineplex.Core/src/mineplex/core/donation/GiveDonorData.java deleted file mode 100644 index eb8f382b8..000000000 --- a/Plugins/Mineplex.Core/src/mineplex/core/donation/GiveDonorData.java +++ /dev/null @@ -1,71 +0,0 @@ -package mineplex.core.donation; - -import mineplex.core.common.util.Callback; - -import java.util.UUID; - -public class GiveDonorData -{ - private final String _playerName; - private final String _caller; - private final UUID _uuid; - private final int _accountId; - private final int _giveAmount; - private final Callback _callback; - private int _attempts; - - public GiveDonorData(Callback callback, String playerName, String caller, UUID uuid, int accountId, int giveAmount) - { - _callback = callback; - _playerName = playerName; - _caller = caller; - _uuid = uuid; - _accountId = accountId; - _giveAmount = giveAmount; - } - - public GiveDonorData(Callback callback, String playerName, String caller, int accountId, int giveAmount) - { - this(callback, playerName, caller, null, accountId, giveAmount); - } - - public UUID getUuid() - { - return _uuid; - } - - public Callback getCallback() - { - return _callback; - } - - public String getPlayerName() - { - return _playerName; - } - - public String getCaller() - { - return _caller; - } - - public int getAccountId() - { - return _accountId; - } - - public int getGiveAmount() - { - return _giveAmount; - } - - public int getAttempts() - { - return _attempts; - } - - public void incrementAttempts() - { - _attempts++; - } -} diff --git a/Plugins/Mineplex.Core/src/mineplex/core/donation/command/GemCommand.java b/Plugins/Mineplex.Core/src/mineplex/core/donation/command/GemCommand.java index a19144834..c4124317b 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/donation/command/GemCommand.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/donation/command/GemCommand.java @@ -1,14 +1,13 @@ package mineplex.core.donation.command; -import java.util.UUID; - +import org.bukkit.Bukkit; import org.bukkit.entity.Player; +import mineplex.core.account.CoreClient; import mineplex.core.command.CommandBase; import mineplex.core.common.Rank; -import mineplex.core.common.util.Callback; +import mineplex.core.common.currency.GlobalCurrency; import mineplex.core.common.util.F; -import mineplex.core.common.util.UUIDFetcher; import mineplex.core.common.util.UtilPlayer; import mineplex.core.common.util.UtilServer; import mineplex.core.donation.DonationManager; @@ -30,100 +29,72 @@ public class GemCommand extends CommandBase } String targetName = args[0]; - String gemsString = args[1]; - Player target = UtilPlayer.searchExact(targetName); + + int amount; + + try + { + amount = Integer.parseInt(args[1]); + } + catch (NumberFormatException ex) + { + UtilPlayer.message(caller, F.main("Gem", "Invalid gems Amount")); + return; + } if (targetName.equalsIgnoreCase("@a")) { - rewardAllGems(caller, gemsString); - } - else if (target == null) - { - UUID uuid = UUIDFetcher.getUUIDOf(targetName); - if (uuid != null) - { - rewardGems(caller, null, targetName, uuid, gemsString); - } - else - { - UtilPlayer.message(caller, F.main("Gem", "Could not find player " + F.name(targetName))); - } + rewardAllGems(caller, amount); } else { - rewardGems(caller, target, target.getName(), target.getUniqueId(), gemsString); - } - } - - private void rewardAllGems(Player caller, String gemsString) - { - try - { - int gems = Integer.parseInt(gemsString); - - if (gems > 1000) + Plugin.getClientManager().getOrLoadClient(targetName, client -> { - UtilPlayer.message(caller, F.main("Gem", "You can only give everybody 1000 gems at a time.")); - return; - } - - rewardAllGems(caller, gems); - } - catch (Exception e) - { - UtilPlayer.message(caller, F.main("Gem", "Invalid gems Amount")); + if (client != null) + { + rewardGems(caller, client, amount); + } + else + { + UtilPlayer.message(caller, F.main("Gem", "Could not find player " + F.name(targetName))); + } + }); } } private void rewardAllGems(Player caller, int gems) { + if (gems > 1000) + { + UtilPlayer.message(caller, F.main("Gem", "You can only give everybody 1000 gems at a time.")); + return; + } + for (Player player : UtilServer.getPlayers()) { - Plugin.RewardGems(new Callback() - { - public void run(Boolean completed) - { - - } - }, caller.getName(), player.getName(), player.getUniqueId(), gems); + Plugin.rewardCurrency(GlobalCurrency.GEM, player, caller.getName(), gems); } - + UtilPlayer.message(caller, F.main("Gem", "Gave everyone " + F.elem(gems + " gems"))); } - private void rewardGems(final Player caller, final Player target, final String targetName, final UUID uuid, String gemsString) + private void rewardGems(Player caller, CoreClient target, int gems) { - try + Plugin.rewardCurrency(GlobalCurrency.GEM, target, caller.getName(), gems, completed -> { - int gems = Integer.parseInt(gemsString); - rewardGems(caller, target, targetName, uuid, gems); - } - catch (Exception e) - { - UtilPlayer.message(caller, F.main("Gem", "Invalid gems Amount")); - } - } - - private void rewardGems(final Player caller, final Player target, final String targetName, final UUID uuid, final int gems) - { - Plugin.RewardGems(new Callback() - { - public void run(Boolean completed) + if (completed) { - if (completed) + UtilPlayer.message(caller, F.main("Gem", "You gave " + F.elem(gems + " gems") + " to " + F.name(target.getRealOrDisguisedName()) + ".")); + + if (Bukkit.getPlayer(target.getUniqueId()) != null) { - UtilPlayer.message(caller, F.main("Gem", "You gave " + F.elem(gems + " gems") + " to " + F.name(targetName) + ".")); - - if (target != null) - { - UtilPlayer.message(target, F.main("Gem", F.name(caller.getName()) + " gave you " + F.elem(gems + " gems") + ".")); - } - } - else - { - UtilPlayer.message(caller, F.main("Gem", "There was an error giving " + F.elem(gems + " gems") + " to " + F.name(targetName) + ".")); + UtilPlayer.message(Bukkit.getPlayer(target.getUniqueId()), F.main("Gem", F.name(caller.getName()) + " gave you " + F.elem(gems + " gems") + ".")); } } - }, caller.getName(), targetName, uuid, gems); + else + { + UtilPlayer.message(caller, F.main("Gem", "There was an error giving " + F.elem(gems + " gems") + " to " + F.name(target.getRealOrDisguisedName()) + ".")); + } + }); } } diff --git a/Plugins/Mineplex.Core/src/mineplex/core/donation/command/ShardCommand.java b/Plugins/Mineplex.Core/src/mineplex/core/donation/command/ShardCommand.java index f606a607c..2df566a42 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/donation/command/ShardCommand.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/donation/command/ShardCommand.java @@ -1,14 +1,16 @@ package mineplex.core.donation.command; +import org.bukkit.Bukkit; +import org.bukkit.entity.Player; + import mineplex.core.account.CoreClient; import mineplex.core.command.CommandBase; import mineplex.core.common.Rank; -import mineplex.core.common.util.Callback; +import mineplex.core.common.currency.GlobalCurrency; import mineplex.core.common.util.F; import mineplex.core.common.util.UtilPlayer; import mineplex.core.common.util.UtilServer; import mineplex.core.donation.DonationManager; -import org.bukkit.entity.Player; public class ShardCommand extends CommandBase { @@ -27,102 +29,72 @@ public class ShardCommand extends CommandBase } final String targetName = args[0]; - final String coinsString = args[1]; - Player target = UtilPlayer.searchExact(targetName); + + int amount; + + try + { + amount = Integer.parseInt(args[1]); + } + catch (NumberFormatException ex) + { + UtilPlayer.message(caller, F.main("Shards", "Invalid Shards Amount")); + return; + } if (targetName.equalsIgnoreCase("@a")) { - rewardAllShards(caller, coinsString); + rewardAllShards(caller, amount); } - else if (target == null) + else { - Plugin.getClientManager().loadClientByName(targetName, client -> + Plugin.getClientManager().getOrLoadClient(targetName, client -> { if (client != null) - rewardCoins(caller, null, targetName, client.getAccountId(), coinsString); + { + rewardCoins(caller, client, amount); + } else { UtilPlayer.message(caller, F.main("Shards", "Could not find player " + F.name(targetName))); } }); } - else - { - rewardCoins(caller, target, target.getName(), Plugin.getClientManager().Get(target).getAccountId(), coinsString); - } - } - - private void rewardAllShards(Player caller, String shardsString) - { - try - { - int shards = Integer.parseInt(shardsString); - - if (shards > 1000) - { - UtilPlayer.message(caller, F.main("Shards", "You can only give everybody 1000 shards at a time.")); - return; - } - - rewardAllShards(caller, shards); - } - catch (Exception e) - { - UtilPlayer.message(caller, F.main("Shards", "Invalid Shards Amount")); - } } private void rewardAllShards(Player caller, int shards) { + if (shards > 1000) + { + UtilPlayer.message(caller, F.main("Shards", "You can only give everybody 1000 shards at a time.")); + return; + } + for (Player player : UtilServer.getPlayers()) { - CoreClient client = Plugin.getClientManager().Get(player); - - Plugin.RewardCoins(new Callback() - { - public void run(Boolean completed) - { - - } - }, caller.getName(), player.getName(), client.getAccountId(), shards); + Plugin.rewardCurrency(GlobalCurrency.TREASURE_SHARD, player, caller.getName(), shards); } UtilPlayer.message(caller, F.main("Shards", "Gave everyone " + F.elem(shards + " Treasure Shards"))); } - private void rewardCoins(final Player caller, final Player target, final String targetName, final int accountId, String coinsString) + private void rewardCoins(Player caller, CoreClient target, int coins) { - try + Plugin.rewardCurrency(GlobalCurrency.TREASURE_SHARD, target, caller.getName(), coins, completed -> { - int coins = Integer.parseInt(coinsString); - rewardCoins(caller, target, targetName, accountId, coins); - } - catch (Exception e) - { - UtilPlayer.message(caller, F.main("Shards", "Invalid Shards Amount")); - } - } - - private void rewardCoins(final Player caller, final Player target, final String targetName, final int accountId, final int coins) - { - Plugin.RewardCoins(new Callback() - { - public void run(Boolean completed) + if (completed) { - if (completed) + UtilPlayer.message(caller, F.main("Shards", "You gave " + F.elem(coins + " Treasure Shards") + " to " + F.name(target.getRealOrDisguisedName()) + ".")); + + if (Bukkit.getPlayer(target.getUniqueId()) != null) { - UtilPlayer.message(caller, F.main("Shards", "You gave " + F.elem(coins + " Treasure Shards") + " to " + F.name(targetName) + ".")); - - if (target != null) - { - UtilPlayer.message(target, F.main("Shards", F.name(caller.getName()) + " gave you " + F.elem(coins + " Treasure Shards") + ".")); - } - } - else - { - UtilPlayer.message(caller, F.main("Shards", "There was an error giving " + F.elem(coins + "Treasure Shards") + " to " + F.name(targetName) + ".")); + UtilPlayer.message(Bukkit.getPlayer(target.getUniqueId()), F.main("Shards", F.name(caller.getName()) + " gave you " + F.elem(coins + " Treasure Shards") + ".")); } } - }, caller.getName(), targetName, accountId, coins); + else + { + UtilPlayer.message(caller, F.main("Shards", "There was an error giving " + F.elem(coins + "Treasure Shards") + " to " + F.name(target.getRealOrDisguisedName()) + ".")); + } + }); } } diff --git a/Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/economy/GoldRepository.java b/Plugins/Mineplex.Core/src/mineplex/core/donation/gold/GoldRepository.java similarity index 85% rename from Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/economy/GoldRepository.java rename to Plugins/Mineplex.Core/src/mineplex/core/donation/gold/GoldRepository.java index d6f8958f8..649257494 100644 --- a/Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/economy/GoldRepository.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/donation/gold/GoldRepository.java @@ -1,87 +1,84 @@ -package mineplex.game.clans.economy; - -import mineplex.core.common.util.Callback; -import mineplex.core.common.util.UtilServer; -import mineplex.serverdata.database.DBPool; -import org.bukkit.Bukkit; - -import java.sql.Connection; -import java.sql.PreparedStatement; -import java.sql.SQLException; - -public class GoldRepository { - private static final String CREATE_TABLE = "CREATE TABLE clansGold (serverId int(11) not null, id int(11) not null, gold int not null, primary key (serverId, id), foreign key (serverId) references clanServer(id), foreign key (id) references accounts(id))"; - private static final String UPDATE_ACCOUNT_GOLD = "INSERT INTO clansGold (serverId, id, gold) VALUES (?, ?, ?) ON DUPLICATE KEY UPDATE gold=gold+?"; - private static final String SET_ACCOUNT_GOLD = "INSERT INTO clansGold (serverId, id, gold) VALUES (?, ?, ?) ON DUPLICATE KEY UPDATE gold=?"; - - private final int _serverId; - - public GoldRepository(int serverId) { - _serverId = serverId; - } - - public void rewardGold(final Callback callback, final int accountId, final int gold) - { - Bukkit.getScheduler().runTaskAsynchronously(UtilServer.getPlugin(), () -> - { - try (Connection connection = DBPool.getAccount().getConnection()) - { - PreparedStatement statement = connection.prepareStatement(UPDATE_ACCOUNT_GOLD); - statement.setInt(1, _serverId); - statement.setInt(2, accountId); - statement.setInt(3, gold); - statement.setInt(4, gold); - statement.executeUpdate(); - - if (callback != null) - { - Bukkit.getScheduler().runTask(UtilServer.getPlugin(), () -> callback.run(true)); - } - - } catch (SQLException e) - { - e.printStackTrace(); - - if (callback != null) - { - Bukkit.getScheduler().runTask(UtilServer.getPlugin(), () -> callback.run(false)); - } - } - }); - } - - public void setGold(final Callback callback, final int accountId, final int gold) - { - if (gold < 0) - { - throw new IllegalArgumentException("gold cannot be negative"); - } - - Bukkit.getScheduler().runTaskAsynchronously(UtilServer.getPlugin(), () -> - { - try (Connection connection = DBPool.getAccount().getConnection()) - { - PreparedStatement statement = connection.prepareStatement(SET_ACCOUNT_GOLD); - statement.setInt(1, _serverId); - statement.setInt(2, accountId); - statement.setInt(3, gold); - statement.setInt(4, gold); - statement.executeUpdate(); - - if (callback != null) - { - Bukkit.getScheduler().runTask(UtilServer.getPlugin(), () -> callback.run(true)); - } - - } catch (SQLException e) - { - e.printStackTrace(); - - if (callback != null) - { - Bukkit.getScheduler().runTask(UtilServer.getPlugin(), () -> callback.run(false)); - } - } - }); - } -} +package mineplex.core.donation.gold; + +import mineplex.core.common.util.Callback; +import mineplex.core.common.util.UtilServer; +import mineplex.serverdata.database.DBPool; +import org.bukkit.Bukkit; + +import java.sql.Connection; +import java.sql.PreparedStatement; +import java.sql.SQLException; + +public class GoldRepository +{ + private static final String CREATE_TABLE = "CREATE TABLE clansGold (serverId int(11) not null, id int(11) not null, gold int not null, primary key (serverId, id), foreign key (serverId) references clanServer(id), foreign key (id) references accounts(id))"; + private static final String UPDATE_ACCOUNT_GOLD = "INSERT INTO clansGold (serverId, id, gold) VALUES (?, ?, ?) ON DUPLICATE KEY UPDATE gold=gold+?"; + private static final String SET_ACCOUNT_GOLD = "INSERT INTO clansGold (serverId, id, gold) VALUES (?, ?, ?) ON DUPLICATE KEY UPDATE gold=?"; + + public GoldRepository() {} + + public void rewardGold(final Callback callback, final int serverId, final int accountId, final int gold) + { + Bukkit.getScheduler().runTaskAsynchronously(UtilServer.getPlugin(), () -> + { + try (Connection connection = DBPool.getAccount().getConnection()) + { + PreparedStatement statement = connection.prepareStatement(UPDATE_ACCOUNT_GOLD); + statement.setInt(1, serverId); + statement.setInt(2, accountId); + statement.setInt(3, gold); + statement.setInt(4, gold); + statement.executeUpdate(); + + if (callback != null) + { + Bukkit.getScheduler().runTask(UtilServer.getPlugin(), () -> callback.run(true)); + } + } + catch (SQLException e) + { + e.printStackTrace(); + + if (callback != null) + { + Bukkit.getScheduler().runTask(UtilServer.getPlugin(), () -> callback.run(false)); + } + } + }); + } + + public void setGold(final Callback callback, final int serverId, final int accountId, final int gold) + { + if (gold < 0) + { + throw new IllegalArgumentException("gold cannot be negative"); + } + + Bukkit.getScheduler().runTaskAsynchronously(UtilServer.getPlugin(), () -> + { + try (Connection connection = DBPool.getAccount().getConnection()) + { + PreparedStatement statement = connection.prepareStatement(SET_ACCOUNT_GOLD); + statement.setInt(1, serverId); + statement.setInt(2, accountId); + statement.setInt(3, gold); + statement.setInt(4, gold); + statement.executeUpdate(); + + if (callback != null) + { + Bukkit.getScheduler().runTask(UtilServer.getPlugin(), () -> callback.run(true)); + } + } + catch (SQLException e) + { + e.printStackTrace(); + + if (callback != null) + { + Bukkit.getScheduler().runTask(UtilServer.getPlugin(), () -> callback.run(false)); + } + } + }); + } +} \ No newline at end of file diff --git a/Plugins/Mineplex.Core/src/mineplex/core/donation/repository/DonationRepository.java b/Plugins/Mineplex.Core/src/mineplex/core/donation/repository/DonationRepository.java index a73791657..834d6cb10 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/donation/repository/DonationRepository.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/donation/repository/DonationRepository.java @@ -1,204 +1,111 @@ package mineplex.core.donation.repository; +import java.util.HashMap; +import java.util.Map; +import java.util.function.Consumer; + import mineplex.core.common.currency.Currency; import mineplex.core.common.currency.GlobalCurrency; -import mineplex.core.common.util.Callback; +import mineplex.core.common.util.UtilTasks; import mineplex.core.database.MinecraftRepository; import mineplex.core.donation.repository.token.GemRewardToken; import mineplex.core.donation.repository.token.PurchaseToken; import mineplex.core.donation.repository.token.UnknownPurchaseToken; -import mineplex.core.server.remotecall.AsyncJsonWebCall; -import mineplex.core.server.remotecall.JsonWebCall; import mineplex.core.server.util.TransactionResponse; import mineplex.serverdata.database.DBPool; -import mineplex.serverdata.database.DatabaseRunnable; -import mineplex.serverdata.database.column.ColumnInt; -import org.bukkit.Bukkit; -import org.bukkit.plugin.java.JavaPlugin; public class DonationRepository extends MinecraftRepository { - private static String CREATE_COIN_TRANSACTION_TABLE = "CREATE TABLE IF NOT EXISTS accountCoinTransactions (id INT NOT NULL AUTO_INCREMENT, accountId INT, reason VARCHAR(100), coins INT, PRIMARY KEY (id), FOREIGN KEY (accountId) REFERENCES accounts(id));"; - private static String CREATE_GEM_TRANSACTION_TABLE = "CREATE TABLE IF NOT EXISTS accountGemTransactions (id INT NOT NULL AUTO_INCREMENT, accountId INT, reason VARCHAR(100), gems INT, PRIMARY KEY (id), FOREIGN KEY (accountId) REFERENCES accounts(id));"; - private static String INSERT_COIN_TRANSACTION = "INSERT INTO accountCoinTransactions(accountId, reason, coins) VALUES(?, ?, ?);"; - private static String UPDATE_ACCOUNT_COINS = "UPDATE accounts SET coins = coins + ? WHERE id = ?;"; - private static String UPDATE_NULL_ACCOUNT_GEMS_AND_COINS_ = "UPDATE accounts SET gems = ?, coins = ? WHERE id = ? AND gems IS NULL AND coins IS NULL;"; + private static Map WEB_ADDRESSES = new HashMap<>(); - private String _webAddress; - - public DonationRepository(JavaPlugin plugin, String webAddress) + static { - super(plugin, DBPool.getAccount()); - - _webAddress = webAddress; + WEB_ADDRESSES.put(GlobalCurrency.GEM, "PlayerAccount/GemReward"); + WEB_ADDRESSES.put(GlobalCurrency.TREASURE_SHARD, "PlayerAccount/CoinReward"); } - public void PurchaseKnownSalesPackage(final Callback callback, String name, final String uuid, final int cost, final int salesPackageId) + public DonationRepository() { - final PurchaseToken token = new PurchaseToken(); - token.AccountName = name; + super(DBPool.getAccount()); + } + + /** + * Purchases a known sales package + * + * @param playerName The player name + * @param salesPackageId The package id + * @param callback The callback, may be null, will be run on the main thread + */ + public void purchaseKnownSalesPackage(String playerName, int salesPackageId, Consumer callback) + { + PurchaseToken token = new PurchaseToken(); + token.AccountName = playerName; token.UsingCredits = false; token.SalesPackageId = salesPackageId; - final Callback extraCallback = new Callback() - { - public void run(final TransactionResponse response) - { - Bukkit.getServer().getScheduler().runTask(getPlugin(), new Runnable() - { - @Override - public void run() - { - callback.run(response); - } - }); - } - }; - - handleDatabaseCall(new DatabaseRunnable(new Runnable() - { - public void run() - { - new JsonWebCall(_webAddress + "PlayerAccount/PurchaseKnownSalesPackage").Execute(TransactionResponse.class, extraCallback, token); - } - }), "Error purchasing known sales package in DonationRepository : "); + handleMSSQLCall( + "PlayerAccount/PurchaseKnownSalesPackage", + String.format("Error purchasing known sales package %s for %s: ", salesPackageId, playerName), + token, + TransactionResponse.class, + UtilTasks.onMainThread(callback) + ); } - public void PurchaseUnknownSalesPackage(final Callback callback, final String name, final int accountId, final String packageName, final Currency currencyType, final int cost) + /** + * Purchases an unknown sales package + * + * @param playerName The name of the player + * @param packageName The name of the unknown package + * @param currencyType The type of currency + * @param cost The cost + * @param callback The callback, may be null. Will be run on the main thread + */ + public void purchaseUnknownSalesPackage(String playerName, String packageName, Currency currencyType, int cost, Consumer callback) { - final UnknownPurchaseToken token = new UnknownPurchaseToken(); - token.AccountName = name; + UnknownPurchaseToken token = new UnknownPurchaseToken(); + token.AccountName = playerName; token.SalesPackageName = packageName; token.CoinPurchase = currencyType == GlobalCurrency.TREASURE_SHARD; token.Cost = cost; token.Premium = false; - final Callback extraCallback = new Callback() - { - public void run(final TransactionResponse response) - { - if (response == TransactionResponse.Success) - { - if (currencyType == GlobalCurrency.TREASURE_SHARD) - { - executeUpdate(UPDATE_ACCOUNT_COINS, new ColumnInt("coins", -cost), new ColumnInt("id", accountId)); - //executeUpdate(INSERT_COIN_TRANSACTION, new ColumnInt("id", accountId), new ColumnVarChar("reason", 100, "Purchased " + packageName), new ColumnInt("coins", -cost)); - } - } - - Bukkit.getServer().getScheduler().runTask(getPlugin(), new Runnable() - { - @Override - public void run() - { - callback.run(response); - } - }); - } - }; - - handleDatabaseCall(new DatabaseRunnable(new Runnable() - { - public void run() - { - new JsonWebCall(_webAddress + "PlayerAccount/PurchaseUnknownSalesPackage").Execute(TransactionResponse.class, extraCallback, token); - } - }), "Error purchasing unknown sales package in DonationRepository : "); + handleMSSQLCall( + "PlayerAccount/PurchaseUnknownSalesPackage", + String.format("Error purchasing unknown sales package %s for %s: ", packageName, playerName), + token, + TransactionResponse.class, + UtilTasks.onMainThread(callback) + ); } - public void gemReward(final Callback callback, final String giver, String name, final String uuid, final int greenGems) + /** + * Update a player's currency on the MSSQL server. + * + * @param currency The type of currency + * @param playerName The name of the player + * @param reason The reason of rewarding currency + * @param amount The amount (positive or negative) + * @param callback The callback, can be null. This will be run on the main thread + */ + public void reward(GlobalCurrency currency, String playerName, String reason, int amount, Consumer callback) { - final GemRewardToken token = new GemRewardToken(); - token.Source = giver; - token.Name = name; - token.Amount = greenGems; + GemRewardToken token = new GemRewardToken(); + token.Source = reason; + token.Name = playerName; + token.Amount = amount; - final Callback extraCallback = new Callback() - { - public void run(final Boolean response) - { - Bukkit.getServer().getScheduler().runTask(getPlugin(), new Runnable() - { - @Override - public void run() - { - callback.run(response); - } - }); - } - }; - - handleDatabaseCall(new DatabaseRunnable(new Runnable() - { - public void run() - { - new JsonWebCall(_webAddress + "PlayerAccount/GemReward").Execute(Boolean.class, extraCallback, token); - } - }), "Error updating player gem amount in DonationRepository : "); - } - - public void rewardCoins(final Callback callback, final String giver, String name, final int accountId, final int coins) - { - final GemRewardToken token = new GemRewardToken(); - token.Source = giver; - token.Name = name; - token.Amount = coins; - - final Callback extraCallback = new Callback() - { - public void run(final Boolean response) - { - if (response) - { - //executeUpdate(UPDATE_ACCOUNT_COINS, new ColumnInt("coins", coins), new ColumnInt("id", accountId)); - //executeUpdate(INSERT_COIN_TRANSACTION, new ColumnInt("id", accountId), new ColumnVarChar("reason", 100, "Rewarded by " + giver), new ColumnInt("coins", coins)); - } - - Bukkit.getServer().getScheduler().runTask(getPlugin(), new Runnable() - { - @Override - public void run() - { - callback.run(response); - } - }); - } - }; - - handleDatabaseCall(new DatabaseRunnable(new Runnable() - { - public void run() - { - new JsonWebCall(_webAddress + "PlayerAccount/CoinReward").Execute(Boolean.class, extraCallback, token); - } - }), "Error updating player coin amount in DonationRepository : "); - } - - @Override - protected void initialize() - { - //executeUpdate(CREATE_COIN_TRANSACTION_TABLE); - //executeUpdate(CREATE_GEM_TRANSACTION_TABLE); - } - - @Override - protected void update() - { - } - - public void updateGemsAndCoins(final int accountId, final int gems, final int coins) - { - handleDatabaseCall(new DatabaseRunnable(new Runnable() - { - public void run() - { - executeUpdate(UPDATE_NULL_ACCOUNT_GEMS_AND_COINS_, new ColumnInt("gems", gems), new ColumnInt("coins", coins), new ColumnInt("id", accountId)); - } - }), "Error updating player's null gems and coins DonationRepository : "); + handleMSSQLCall( + WEB_ADDRESSES.get(currency), + String.format("Error updating %s for %s: ", currency.getString(2), playerName), + token, + Boolean.class, + UtilTasks.onMainThread(callback) + ); } public void applyKits(String playerName) { - new AsyncJsonWebCall(_webAddress + "PlayerAccount/ApplyKits").Execute(playerName); + handleAsyncMSSQLCall("PlayerAccount/ApplyKits", playerName); } } \ No newline at end of file diff --git a/Plugins/Mineplex.Core/src/mineplex/core/elo/EloRepository.java b/Plugins/Mineplex.Core/src/mineplex/core/elo/EloRepository.java index 24b0cfebc..5d8617a4a 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/elo/EloRepository.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/elo/EloRepository.java @@ -9,10 +9,12 @@ import java.util.LinkedList; import java.util.List; import mineplex.core.common.util.Callback; +import mineplex.core.common.util.UtilServer; import mineplex.core.common.util.UtilTime; import mineplex.core.common.util.UtilTime.TimeUnit; import mineplex.core.database.MinecraftRepository; import mineplex.serverdata.database.DBPool; +import mineplex.serverdata.database.RepositoryBase; import mineplex.serverdata.database.column.ColumnInt; import mineplex.serverdata.database.column.ColumnLong; @@ -22,7 +24,7 @@ import org.bukkit.scheduler.BukkitRunnable; import com.google.common.collect.Lists; -public class EloRepository extends MinecraftRepository +public class EloRepository extends RepositoryBase { private static String INSERT_ELO = "INSERT INTO eloRating (accountId, gameType, elo) VALUES (?, ?, ?);"; @@ -37,19 +39,13 @@ public class EloRepository extends MinecraftRepository public EloRepository(JavaPlugin plugin) { - super(plugin, DBPool.getAccount()); - - initialize(); - } - - public void initialize() - { + super(DBPool.getAccount()); } public boolean saveElo(int accountId, int gameType, int oldElo, int elo) throws SQLException { List ret = Lists.newArrayList(); - Bukkit.getScheduler().runTaskAsynchronously(getPlugin(), () -> { + UtilServer.runAsync(() -> { boolean updateSucceeded = false; // If we're increasing in elo we verify the server version matches the database version (prevent d/c and double wins with concurrent matches) @@ -66,7 +62,7 @@ public class EloRepository extends MinecraftRepository updateSucceeded = true; } } - + ret.add(updateSucceeded); }); @@ -92,14 +88,14 @@ public class EloRepository extends MinecraftRepository public void getStrikeExpiry(int accountId, Callback call) { - Bukkit.getScheduler().runTaskAsynchronously(getPlugin(), () -> executeQuery(GRAB_STRIKE_EXPIRY, resultSet -> { + UtilServer.runAsync(() -> executeQuery(GRAB_STRIKE_EXPIRY, resultSet -> { boolean called = false; while (resultSet.next()) { called = true; call.run(resultSet.getLong(1)); } - + if (!called) { call.run(0L); @@ -109,21 +105,21 @@ public class EloRepository extends MinecraftRepository public void getBanExpiryAsync(int accountId, Callback call) { - Bukkit.getScheduler().runTaskAsynchronously(getPlugin(), () -> executeQuery(GRAB_BAN_EXPIRY, resultSet -> { + UtilServer.runAsync(() -> executeQuery(GRAB_BAN_EXPIRY, resultSet -> { boolean called = false; while (resultSet.next()) { called = true; call.run(resultSet.getLong(1)); } - + if (!called) { call.run(0L); } }, new ColumnInt("accountId", accountId))); } - + public long getBanExpiry(int accountId) { List expiry = new ArrayList(); @@ -133,23 +129,23 @@ public class EloRepository extends MinecraftRepository expiry.add(resultSet.getLong(1)); } }, new ColumnInt("accountId", accountId)); - + if (expiry.isEmpty()) expiry.add(System.currentTimeMillis() - 5000); - + return expiry.get(0); } public void getStrikes(int accountId, Callback call) { - Bukkit.getScheduler().runTaskAsynchronously(getPlugin(), () -> executeQuery(GRAB_STRIKES, resultSet -> { + UtilServer.runAsync(() -> executeQuery(GRAB_STRIKES, resultSet -> { boolean called = false; while (resultSet.next()) { called = true; call.run(resultSet.getInt(1)); } - + if (!called) { call.run(0); @@ -194,19 +190,14 @@ public class EloRepository extends MinecraftRepository long banEnd = System.currentTimeMillis() + UtilTime.convert(minutes, TimeUnit.MINUTES, TimeUnit.MILLISECONDS); long strikesExpire = System.currentTimeMillis() + UtilTime.convert(1, TimeUnit.DAYS, TimeUnit.MILLISECONDS); int newStrikes = Math.min(strikes + 1, 8); - - Bukkit.getScheduler().runTaskAsynchronously(getPlugin(), () -> executeUpdate(UPDATE_BAN, new ColumnInt("accountId", accountId), new ColumnInt("strikes", newStrikes), new ColumnLong("strikesExpire", strikesExpire), new ColumnLong("banEnd", banEnd))); + + UtilServer.runAsync(() -> executeUpdate(UPDATE_BAN, new ColumnInt("accountId", accountId), new ColumnInt("strikes", newStrikes), new ColumnLong("strikesExpire", strikesExpire), new ColumnLong("banEnd", banEnd))); }); } public void resetStrikes(int accountId) { - Bukkit.getScheduler().runTaskAsynchronously(getPlugin(), () -> executeUpdate(DELETE_STRIKES, new ColumnInt("accountId", accountId))); - } - - @Override - protected void update() - { + UtilServer.runAsync(() -> executeUpdate(DELETE_STRIKES, new ColumnInt("accountId", accountId))); } public void getTopElo(int limit, Callback> callback) @@ -266,6 +257,6 @@ public class EloRepository extends MinecraftRepository } } } - }.runTaskAsynchronously(_plugin); + }.runTaskAsynchronously(UtilServer.getPlugin()); } } \ No newline at end of file diff --git a/Plugins/Mineplex.Core/src/mineplex/core/facebook/FacebookRepository.java b/Plugins/Mineplex.Core/src/mineplex/core/facebook/FacebookRepository.java index b9f19f1d9..19674d595 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/facebook/FacebookRepository.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/facebook/FacebookRepository.java @@ -13,26 +13,14 @@ import mineplex.serverdata.database.ResultSetCallable; import mineplex.serverdata.database.column.ColumnInt; import mineplex.serverdata.database.column.ColumnVarChar; -public class FacebookRepository extends MinecraftRepository +public class FacebookRepository extends RepositoryBase { private static final String GET_CODE = "SELECT code, activated FROM facebook WHERE code = ?"; private static final String ACTIVATE_CODE = "UPDATE facebook SET activated = 1, accountId = ?, activationTime = NOW() WHERE code = ?"; public FacebookRepository(JavaPlugin plugin) { - super(plugin, DBPool.getAccount()); - } - - @Override - protected void initialize() - { - - } - - @Override - protected void update() - { - + super(DBPool.getAccount()); } public void getCode(String codeName, Callback callback) diff --git a/Plugins/Mineplex.Core/src/mineplex/core/friend/FriendManager.java b/Plugins/Mineplex.Core/src/mineplex/core/friend/FriendManager.java index 99a168f9f..32effd24c 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/friend/FriendManager.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/friend/FriendManager.java @@ -1,5 +1,19 @@ package mineplex.core.friend; +import java.sql.ResultSet; +import java.sql.SQLException; +import java.util.ArrayList; +import java.util.Collections; +import java.util.Iterator; +import java.util.List; +import java.util.UUID; + +import org.bukkit.Bukkit; +import org.bukkit.ChatColor; +import org.bukkit.entity.Player; +import org.bukkit.event.EventHandler; +import org.bukkit.plugin.java.JavaPlugin; + import mineplex.core.MiniDbClientPlugin; import mineplex.core.account.CoreClientManager; import mineplex.core.common.Rank; @@ -22,19 +36,6 @@ import mineplex.core.preferences.PreferencesManager; import mineplex.core.updater.UpdateType; import mineplex.core.updater.event.UpdateEvent; import mineplex.serverdata.data.PlayerStatus; -import org.bukkit.Bukkit; -import org.bukkit.ChatColor; -import org.bukkit.entity.Player; -import org.bukkit.event.EventHandler; -import org.bukkit.plugin.java.JavaPlugin; - -import java.sql.ResultSet; -import java.sql.SQLException; -import java.util.ArrayList; -import java.util.Collections; -import java.util.Iterator; -import java.util.List; -import java.util.UUID; public class FriendManager extends MiniDbClientPlugin { @@ -402,14 +403,14 @@ public class FriendManager extends MiniDbClientPlugin } - public void updatePlayerStatus(String playerName, PlayerStatus status) + public void updatePlayerStatus(UUID playerUUID, PlayerStatus status) { - _repository.updatePlayerStatus(playerName, status); + _repository.updatePlayerStatus(playerUUID, status); } - public PlayerStatus getStatus(String playerName) + public PlayerStatus getStatus(UUID playerUUID) { - return _repository.getStatus(playerName); + return _repository.getStatus(playerUUID); } @Override @@ -421,7 +422,7 @@ public class FriendManager extends MiniDbClientPlugin @Override public String getQuery(int accountId, String uuid, String name) { - return "SELECT tA.Name, status, tA.lastLogin, now() FROM accountFriend INNER Join accounts AS fA ON fA.uuid = uuidSource INNER JOIN accounts AS tA ON tA.uuid = uuidTarget WHERE uuidSource = '" + return "SELECT tA.Name, status, tA.lastLogin, now(), uuidTarget FROM accountFriend INNER Join accounts AS fA ON fA.uuid = uuidSource INNER JOIN accounts AS tA ON tA.uuid = uuidTarget WHERE uuidSource = '" + uuid + "';"; } } diff --git a/Plugins/Mineplex.Core/src/mineplex/core/friend/command/AddFriend.java b/Plugins/Mineplex.Core/src/mineplex/core/friend/command/AddFriend.java index e75cff044..691c350f0 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/friend/command/AddFriend.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/friend/command/AddFriend.java @@ -1,10 +1,14 @@ package mineplex.core.friend.command; +import java.util.List; + import mineplex.core.command.CommandBase; import mineplex.core.common.Rank; import mineplex.core.friend.FriendManager; import mineplex.core.friend.ui.FriendsGUI; import mineplex.core.preferences.Preference; + +import org.bukkit.command.CommandSender; import org.bukkit.entity.Player; public class AddFriend extends CommandBase @@ -39,4 +43,10 @@ public class AddFriend extends CommandBase }); } } + + @Override + public List onTabComplete(CommandSender sender, String commandLabel, String[] args) + { + return tabCompletePlayerNames(sender, commandLabel, args); + } } diff --git a/Plugins/Mineplex.Core/src/mineplex/core/friend/data/FriendRepository.java b/Plugins/Mineplex.Core/src/mineplex/core/friend/data/FriendRepository.java index 81cf0b4eb..c2bc5b608 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/friend/data/FriendRepository.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/friend/data/FriendRepository.java @@ -7,6 +7,7 @@ import java.util.HashMap; import java.util.HashSet; import java.util.Map; import java.util.Set; +import java.util.UUID; import mineplex.core.database.MinecraftRepository; import org.bukkit.entity.Player; @@ -14,6 +15,7 @@ import org.bukkit.plugin.java.JavaPlugin; import mineplex.core.common.util.NautHashMap; import mineplex.serverdata.database.DBPool; +import mineplex.serverdata.database.RepositoryBase; import mineplex.serverdata.database.ResultSetCallable; import mineplex.serverdata.database.column.ColumnVarChar; import mineplex.core.friend.FriendStatusType; @@ -23,10 +25,10 @@ import mineplex.serverdata.data.PlayerStatus; import mineplex.serverdata.redis.RedisDataRepository; import mineplex.serverdata.servers.ServerManager; -public class FriendRepository extends MinecraftRepository +public class FriendRepository extends RepositoryBase { private static String CREATE_FRIEND_TABLE = "CREATE TABLE IF NOT EXISTS accountFriend (id INT NOT NULL AUTO_INCREMENT, uuidSource VARCHAR(100), uuidTarget VARCHAR(100), status VARCHAR(100), PRIMARY KEY (id), UNIQUE INDEX uuidIndex (uuidSource, uuidTarget));"; - private static String RETRIEVE_MULTIPLE_FRIEND_RECORDS = "SELECT uuidSource, tA.Name, status, tA.lastLogin, now() FROM accountFriend INNER Join accounts AS fA ON fA.uuid = uuidSource INNER JOIN accounts AS tA ON tA.uuid = uuidTarget WHERE uuidSource IN "; + private static String RETRIEVE_MULTIPLE_FRIEND_RECORDS = "SELECT uuidSource, tA.Name, status, tA.lastLogin, now(), uuidTarget FROM accountFriend INNER Join accounts AS fA ON fA.uuid = uuidSource INNER JOIN accounts AS tA ON tA.uuid = uuidTarget WHERE uuidSource IN "; private static String ADD_FRIEND_RECORD = "INSERT INTO accountFriend (uuidSource, uuidTarget, status, created) SELECT fA.uuid AS uuidSource, tA.uuid AS uuidTarget, ?, now() FROM accounts as fA LEFT JOIN accounts AS tA ON tA.name = ? WHERE fA.name = ?;"; private static String UPDATE_MUTUAL_RECORD = "UPDATE accountFriend AS aF INNER JOIN accounts as fA ON aF.uuidSource = fA.uuid INNER JOIN accounts AS tA ON aF.uuidTarget = tA.uuid SET aF.status = ? WHERE tA.name = ? AND fA.name = ?;"; private static String DELETE_FRIEND_RECORD = "DELETE aF FROM accountFriend AS aF INNER JOIN accounts as fA ON aF.uuidSource = fA.uuid INNER JOIN accounts AS tA ON aF.uuidTarget = tA.uuid WHERE fA.name = ? AND tA.name = ?;"; @@ -36,23 +38,12 @@ public class FriendRepository extends MinecraftRepository public FriendRepository(JavaPlugin plugin) { - super(plugin, DBPool.getAccount()); + super(DBPool.getAccount()); _repository = new RedisDataRepository(ServerManager.getMasterConnection(), ServerManager.getSlaveConnection(), Region.currentRegion(), PlayerStatus.class, "playerStatus"); } - - @Override - protected void initialize() - { - //executeUpdate(CREATE_FRIEND_TABLE); - } - @Override - protected void update() - { - } - public boolean addFriend(final Player caller, String name) { int rowsAffected = executeUpdate(ADD_FRIEND_RECORD, new ColumnVarChar("status", 100, "Sent"), new ColumnVarChar("name", 100, name), new ColumnVarChar("name", 100, caller.getName())); @@ -106,6 +97,7 @@ public class FriendRepository extends MinecraftRepository friend.Name = resultSet.getString(2); friend.Status = Enum.valueOf(FriendStatusType.class, resultSet.getString(3)); friend.LastSeenOnline = resultSet.getTimestamp(5).getTime() - resultSet.getTimestamp(4).getTime(); + friend.UUID = UUID.fromString(resultSet.getString(6)); if (!friends.containsKey(uuidSource)) friends.put(uuidSource, new FriendData()); @@ -137,6 +129,7 @@ public class FriendRepository extends MinecraftRepository friend.Name = resultSet.getString(1); friend.Status = Enum.valueOf(FriendStatusType.class, resultSet.getString(2)); friend.LastSeenOnline = resultSet.getTimestamp(4).getTime() - resultSet.getTimestamp(3).getTime(); + friend.UUID = UUID.fromString(resultSet.getString(5)); friend.ServerName = null; friend.Online = (friend.ServerName != null); friendData.getFriends().add(friend); @@ -155,26 +148,26 @@ public class FriendRepository extends MinecraftRepository public void loadFriendStatuses(FriendData friendData) { // Generate a set of all friend names - Set friendNames = new HashSet(); + Set friendUUIDS = new HashSet<>(); for(FriendStatus status : friendData.getFriends()) { - friendNames.add(status.Name.toLowerCase()); + friendUUIDS.add(status.UUID.toString()); } // Load PlayerStatus' for friends - Collection statuses = _repository.getElements(friendNames); + Collection statuses = _repository.getElements(friendUUIDS); // Load player statuses into a mapping - Map playerStatuses = new HashMap(); + Map playerStatuses = new HashMap<>(); for(PlayerStatus status : statuses) { - playerStatuses.put(status.getName(), status); + playerStatuses.put(status.getUUID(), status); } // Load status information into friend data. for (FriendStatus friend : friendData.getFriends()) { - PlayerStatus status = playerStatuses.get(friend.Name); + PlayerStatus status = playerStatuses.get(friend.UUID); friend.Online = (status != null); friend.ServerName = (friend.Online) ? status.getServer() : null; } @@ -185,14 +178,14 @@ public class FriendRepository extends MinecraftRepository * @return the name that the player matching {@code playerName} * is currently online on, if they are online, null otherwise. */ - public String fetchPlayerServer(String playerName) + public String fetchPlayerServer(UUID playerUUID) { - PlayerStatus status = _repository.getElement(playerName.toLowerCase()); + PlayerStatus status = _repository.getElement(playerUUID.toString()); return (status == null) ? null : status.getServer(); } - public void updatePlayerStatus(String playerName, PlayerStatus status) + public void updatePlayerStatus(UUID playerUUID, PlayerStatus status) { if (status != null) { @@ -200,12 +193,12 @@ public class FriendRepository extends MinecraftRepository } else { - _repository.removeElement(playerName.toLowerCase()); + _repository.removeElement(playerUUID.toString()); } } - public PlayerStatus getStatus(String playerName) + public PlayerStatus getStatus(UUID playerUUID) { - return _repository.getElement(playerName.toLowerCase()); + return _repository.getElement(playerUUID.toString()); } } diff --git a/Plugins/Mineplex.Core/src/mineplex/core/friend/data/FriendStatus.java b/Plugins/Mineplex.Core/src/mineplex/core/friend/data/FriendStatus.java index 9c60df03f..fa5f10870 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/friend/data/FriendStatus.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/friend/data/FriendStatus.java @@ -1,10 +1,13 @@ package mineplex.core.friend.data; +import java.util.UUID; + import mineplex.core.friend.FriendStatusType; public class FriendStatus { public String Name; + public UUID UUID; public String ServerName; public boolean Online; /** diff --git a/Plugins/Mineplex.Core/src/mineplex/core/friend/ui/FriendsGUI.java b/Plugins/Mineplex.Core/src/mineplex/core/friend/ui/FriendsGUI.java index 0fa3e4051..e20fe63b4 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/friend/ui/FriendsGUI.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/friend/ui/FriendsGUI.java @@ -21,7 +21,6 @@ import org.bukkit.event.player.PlayerCommandPreprocessEvent; import org.bukkit.event.player.PlayerQuitEvent; import org.bukkit.inventory.Inventory; import org.bukkit.inventory.ItemStack; -import net.minecraft.server.v1_8_R3.EntityPlayer; import mineplex.core.command.CommandCenter; import mineplex.core.common.util.C; @@ -35,6 +34,7 @@ import mineplex.core.friend.data.FriendStatus; import mineplex.core.itemstack.ItemBuilder; import mineplex.core.itemstack.ItemLayout; import mineplex.core.shop.item.IButton; +import net.minecraft.server.v1_8_R3.EntityPlayer; public class FriendsGUI implements Listener { @@ -152,7 +152,6 @@ public class FriendsGUI implements Listener AddButton(slot, builder.build(), new IButton() { - @Override public void onClick(Player player, ClickType clickType) { @@ -298,11 +297,10 @@ public class FriendsGUI implements Listener AddButton(slot, builder.build(), new IButton() { - @Override public void onClick(Player player, ClickType clickType) { - _plugin.getPortal().sendPlayerToServer(player, serverName); + CommandCenter.Instance.onPlayerCommandPreprocess(new PlayerCommandPreprocessEvent(player, "/server " + serverName)); } }); } diff --git a/Plugins/Mineplex.Core/src/mineplex/core/gadget/GadgetManager.java b/Plugins/Mineplex.Core/src/mineplex/core/gadget/GadgetManager.java index 78086823e..0537100f2 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/gadget/GadgetManager.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/gadget/GadgetManager.java @@ -31,6 +31,7 @@ import mineplex.core.common.util.F; import mineplex.core.common.util.NautHashMap; import mineplex.core.common.util.UtilEnt; import mineplex.core.common.util.UtilMath; +import mineplex.core.common.util.UtilPlayer; import mineplex.core.common.util.UtilServer; import mineplex.core.common.util.UtilTime; import mineplex.core.disguise.DisguiseManager; @@ -42,6 +43,7 @@ import mineplex.core.gadget.event.GadgetChangeEvent; import mineplex.core.gadget.event.GadgetCollideEntityEvent; import mineplex.core.gadget.event.GadgetEnableEvent; import mineplex.core.gadget.event.PlayerToggleSwimEvent; +import mineplex.core.gadget.event.TauntCommandEvent; import mineplex.core.gadget.gadgets.arrowtrail.ArrowTrailHalloween; import mineplex.core.gadget.gadgets.arrowtrail.candycane.ArrowTrailCandyCane; import mineplex.core.gadget.gadgets.arrowtrail.cupidslove.ArrowTrailCupid; @@ -55,7 +57,10 @@ import mineplex.core.gadget.gadgets.arrowtrail.shadow.ArrowTrailShadow; import mineplex.core.gadget.gadgets.arrowtrail.titan.ArrowTrailTitan; import mineplex.core.gadget.gadgets.arrowtrail.vampire.ArrowTrailBlood; import mineplex.core.gadget.gadgets.arrowtrail.wisdom.ArrowTrailEnchant; +import mineplex.core.gadget.gadgets.balloons.BalloonItem; +import mineplex.core.gadget.gadgets.balloons.BalloonType; import mineplex.core.gadget.gadgets.death.candycane.DeathCandyCane; +import mineplex.core.gadget.gadgets.death.christmas.DeathPresentDanger; import mineplex.core.gadget.gadgets.death.cupidslove.DeathCupidsBrokenHeart; import mineplex.core.gadget.gadgets.death.emerald.DeathEmerald; import mineplex.core.gadget.gadgets.death.freedom.DeathFreedom; @@ -81,6 +86,8 @@ import mineplex.core.gadget.gadgets.doublejump.titan.DoubleJumpTitan; import mineplex.core.gadget.gadgets.doublejump.vampire.DoubleJumpBlood; import mineplex.core.gadget.gadgets.doublejump.wisdom.DoubleJumpEnchant; import mineplex.core.gadget.gadgets.gamemodifiers.GameModifierType; +import mineplex.core.gadget.gadgets.gamemodifiers.gemhunters.GameModifierMount; +import mineplex.core.gadget.gadgets.gamemodifiers.gemhunters.MountType; import mineplex.core.gadget.gadgets.gamemodifiers.kits.KitGameModifier; import mineplex.core.gadget.gadgets.gamemodifiers.kits.KitModifier; import mineplex.core.gadget.gadgets.gamemodifiers.kits.KitModifierType; @@ -110,13 +117,18 @@ import mineplex.core.gadget.gadgets.morph.MorphBlaze; import mineplex.core.gadget.gadgets.morph.MorphBlock; import mineplex.core.gadget.gadgets.morph.MorphBunny; import mineplex.core.gadget.gadgets.morph.MorphChicken; +import mineplex.core.gadget.gadgets.morph.MorphChristmasKing; import mineplex.core.gadget.gadgets.morph.MorphCow; import mineplex.core.gadget.gadgets.morph.MorphCreeper; +import mineplex.core.gadget.gadgets.morph.MorphDinnerbone; import mineplex.core.gadget.gadgets.morph.MorphEnderman; +import mineplex.core.gadget.gadgets.morph.MorphGoldPot; import mineplex.core.gadget.gadgets.morph.MorphGrimReaper; +import mineplex.core.gadget.gadgets.morph.MorphLoveDoctor; import mineplex.core.gadget.gadgets.morph.MorphMetalMan; import mineplex.core.gadget.gadgets.morph.MorphPig; import mineplex.core.gadget.gadgets.morph.MorphPumpkinKing; +import mineplex.core.gadget.gadgets.morph.MorphSanta; import mineplex.core.gadget.gadgets.morph.MorphSlime; import mineplex.core.gadget.gadgets.morph.MorphSnowman; import mineplex.core.gadget.gadgets.morph.MorphSquid; @@ -129,6 +141,10 @@ import mineplex.core.gadget.gadgets.morph.MorphWither; import mineplex.core.gadget.gadgets.morph.managers.SoulManager; import mineplex.core.gadget.gadgets.morph.managers.SwimManager; import mineplex.core.gadget.gadgets.outfit.OutfitTeam; +import mineplex.core.gadget.gadgets.outfit.freezesuit.OutfitFreezeSuitBoots; +import mineplex.core.gadget.gadgets.outfit.freezesuit.OutfitFreezeSuitChestplate; +import mineplex.core.gadget.gadgets.outfit.freezesuit.OutfitFreezeSuitHelmet; +import mineplex.core.gadget.gadgets.outfit.freezesuit.OutfitFreezeSuitLeggings; import mineplex.core.gadget.gadgets.outfit.ravesuit.OutfitRaveSuitBoots; import mineplex.core.gadget.gadgets.outfit.ravesuit.OutfitRaveSuitChestplate; import mineplex.core.gadget.gadgets.outfit.ravesuit.OutfitRaveSuitHelmet; @@ -138,6 +154,7 @@ import mineplex.core.gadget.gadgets.outfit.spacesuit.OutfitSpaceSuitChestplate; import mineplex.core.gadget.gadgets.outfit.spacesuit.OutfitSpaceSuitHelmet; import mineplex.core.gadget.gadgets.outfit.spacesuit.OutfitSpaceSuitLeggings; import mineplex.core.gadget.gadgets.outfit.windupsuit.OutfitWindUpSuitBoosterManager; +import mineplex.core.gadget.gadgets.particle.ParticleChristmasTree; import mineplex.core.gadget.gadgets.particle.ParticleCoalFumes; import mineplex.core.gadget.gadgets.particle.ParticleFairy; import mineplex.core.gadget.gadgets.particle.ParticleFireRings; @@ -145,6 +162,7 @@ import mineplex.core.gadget.gadgets.particle.ParticleLegend; import mineplex.core.gadget.gadgets.particle.ParticleWingsAngel; import mineplex.core.gadget.gadgets.particle.ParticleWingsDemons; import mineplex.core.gadget.gadgets.particle.ParticleWingsInfernal; +import mineplex.core.gadget.gadgets.particle.ParticleWingsLove; import mineplex.core.gadget.gadgets.particle.ParticleWingsPixie; import mineplex.core.gadget.gadgets.particle.ParticleYinYang; import mineplex.core.gadget.gadgets.particle.candycane.ParticleCandyCane; @@ -159,15 +177,19 @@ import mineplex.core.gadget.gadgets.particle.shadow.ParticleFoot; import mineplex.core.gadget.gadgets.particle.titan.ParticleTitan; import mineplex.core.gadget.gadgets.particle.vampire.ParticleBlood; import mineplex.core.gadget.gadgets.particle.wisdom.ParticleEnchant; +import mineplex.core.gadget.gadgets.taunts.BlowAKissTaunt; +import mineplex.core.gadget.gadgets.taunts.EternalTaunt; import mineplex.core.gadget.gadgets.wineffect.WinEffectBabyChicken; import mineplex.core.gadget.gadgets.wineffect.WinEffectFlames; import mineplex.core.gadget.gadgets.wineffect.WinEffectHalloween; import mineplex.core.gadget.gadgets.wineffect.WinEffectLavaTrap; import mineplex.core.gadget.gadgets.wineffect.WinEffectLightningStrike; +import mineplex.core.gadget.gadgets.wineffect.WinEffectLoveIsABattlefield; import mineplex.core.gadget.gadgets.wineffect.WinEffectMrPunchMan; import mineplex.core.gadget.gadgets.wineffect.WinEffectPodium; import mineplex.core.gadget.gadgets.wineffect.WinEffectRiseOfTheElderGuardian; import mineplex.core.gadget.gadgets.wineffect.WinEffectSnowTrails; +import mineplex.core.gadget.gadgets.wineffect.WinEffectWinterWarfare; import mineplex.core.gadget.persistence.UserGadgetPersistence; import mineplex.core.gadget.set.SetCandyCane; import mineplex.core.gadget.set.SetCupidsLove; @@ -181,9 +203,11 @@ import mineplex.core.gadget.set.SetShadow; import mineplex.core.gadget.set.SetTitan; import mineplex.core.gadget.set.SetVampire; import mineplex.core.gadget.set.SetWisdom; +import mineplex.core.gadget.set.suits.SetFreezeSuit; import mineplex.core.gadget.set.suits.SetRaveSuit; import mineplex.core.gadget.set.suits.SetSpaceSuit; import mineplex.core.gadget.types.ArrowEffectGadget; +import mineplex.core.gadget.types.BalloonGadget; import mineplex.core.gadget.types.DeathEffectGadget; import mineplex.core.gadget.types.DoubleJumpEffectGadget; import mineplex.core.gadget.types.Gadget; @@ -196,6 +220,7 @@ import mineplex.core.gadget.types.MusicGadget; import mineplex.core.gadget.types.OutfitGadget; import mineplex.core.gadget.types.OutfitGadget.ArmorSlot; import mineplex.core.gadget.types.ParticleGadget; +import mineplex.core.gadget.types.TauntGadget; import mineplex.core.gadget.types.WinEffectGadget; import mineplex.core.hologram.HologramManager; import mineplex.core.incognito.IncognitoManager; @@ -289,6 +314,7 @@ public class GadgetManager extends MiniPlugin //Costumes addSet(new SetRaveSuit(this)); addSet(new SetSpaceSuit(this)); + addSet(new SetFreezeSuit(this)); // Hidden in this update //addSet(new SetWindUpSuit(this)); addSet(new SetParty(this)); @@ -341,11 +367,16 @@ public class GadgetManager extends MiniPlugin addGadget(new OutfitWindUpSuitChestplate(this)); addGadget(new OutfitWindUpSuitLeggings(this)); addGadget(new OutfitWindUpSuitBoots(this));*/ + + addGadget(new OutfitFreezeSuitHelmet(this)); + addGadget(new OutfitFreezeSuitChestplate(this)); + addGadget(new OutfitFreezeSuitLeggings(this)); + addGadget(new OutfitFreezeSuitBoots(this)); - addGadget(new OutfitTeam(this, "Team Helmet", -1, ArmorSlot.Helmet, Material.LEATHER_HELMET, (byte)0)); - addGadget(new OutfitTeam(this, "Team Shirt", -1, ArmorSlot.Chest, Material.LEATHER_CHESTPLATE, (byte)0)); - addGadget(new OutfitTeam(this, "Team Pants", -1, ArmorSlot.Legs, Material.LEATHER_LEGGINGS, (byte)0)); - addGadget(new OutfitTeam(this, "Team Boots", -1, ArmorSlot.Boots, Material.LEATHER_BOOTS, (byte)0)); + addGadget(new OutfitTeam(this, "Team Helmet", -1, ArmorSlot.HELMET, Material.LEATHER_HELMET, (byte)0)); + addGadget(new OutfitTeam(this, "Team Shirt", -1, ArmorSlot.CHEST, Material.LEATHER_CHESTPLATE, (byte)0)); + addGadget(new OutfitTeam(this, "Team Pants", -1, ArmorSlot.LEGS, Material.LEATHER_LEGGINGS, (byte)0)); + addGadget(new OutfitTeam(this, "Team Boots", -1, ArmorSlot.BOOTS, Material.LEATHER_BOOTS, (byte)0)); // Morphs addGadget(new MorphVillager(this)); @@ -369,9 +400,13 @@ public class GadgetManager extends MiniPlugin addGadget(new MorphGrimReaper(this)); addGadget(new MorphMetalMan(this)); addGadget(new MorphTurkey(this)); + addGadget(new MorphChristmasKing(this)); // Not in this update //addGadget(new MorphStray(this)); - //addGadget(new MorphSanta(this)); + addGadget(new MorphSanta(this)); + addGadget(new MorphDinnerbone(this)); + addGadget(new MorphLoveDoctor(this)); + addGadget(new MorphGoldPot(this)); // Particles addGadget(new ParticleFoot(this)); @@ -395,8 +430,9 @@ public class GadgetManager extends MiniPlugin addGadget(new ParticleWingsPixie(this)); addGadget(new ParticleYinYang(this)); addGadget(new ParticleFreedom(this)); - - + addGadget(new ParticleChristmasTree(this)); + addGadget(new ParticleWingsLove(this)); + // Arrow Trails addGadget(new ArrowTrailFrostLord(this)); addGadget(new ArrowTrailTitan(this)); @@ -425,6 +461,7 @@ public class GadgetManager extends MiniPlugin addGadget(new DeathBlood(this)); addGadget(new DeathMusic(this)); addGadget(new DeathFreedom(this)); + addGadget(new DeathPresentDanger(this)); // Double Jump addGadget(new DoubleJumpFrostLord(this)); @@ -459,6 +496,8 @@ public class GadgetManager extends MiniPlugin addGadget(new WinEffectRiseOfTheElderGuardian(this)); addGadget(new WinEffectLavaTrap(this)); addGadget(new WinEffectHalloween(this)); + addGadget(new WinEffectWinterWarfare(this)); + addGadget(new WinEffectLoveIsABattlefield(this)); // Music addGadget(new MusicGadget(this, "13 Disc", new String[] {""}, -2, 2256, 178000)); @@ -477,7 +516,7 @@ public class GadgetManager extends MiniPlugin // Game Modifiers // MineStrike - addGadget(new GameModifierMineStrikeSkin(this, MineStrikeSkin.P250_Muertos, -2)); + /*addGadget(new GameModifierMineStrikeSkin(this, MineStrikeSkin.P250_Muertos, -2)); addGadget(new GameModifierMineStrikeSkin(this, MineStrikeSkin.CZ75_Auto_Tigris, -2)); addGadget(new GameModifierMineStrikeSkin(this, MineStrikeSkin.Desert_Eagle_Blaze, -2)); addGadget(new GameModifierMineStrikeSkin(this, MineStrikeSkin.Nova_Koi, -2)); @@ -488,6 +527,7 @@ public class GadgetManager extends MiniPlugin addGadget(new GameModifierMineStrikeSkin(this, MineStrikeSkin.AWP_Asiimov, -2)); addGadget(new GameModifierMineStrikeSkin(this, MineStrikeSkin.Knife_M9_Bayonette_Fade, -2)); + addGadget(new GameModifierMineStrikeSkin(this, )); //Blue only addGadget(new GameModifierMineStrikeSkin(this, MineStrikeSkin.P2000_Fire_Elemental, -2)); @@ -498,7 +538,11 @@ public class GadgetManager extends MiniPlugin addGadget(new GameModifierMineStrikeSkin(this, MineStrikeSkin.Glock_18_Fade, -2)); addGadget(new GameModifierMineStrikeSkin(this, MineStrikeSkin.Galil_AR_Eco, -2)); addGadget(new GameModifierMineStrikeSkin(this, MineStrikeSkin.AK_47_Vulcan, -2)); - addGadget(new GameModifierMineStrikeSkin(this, MineStrikeSkin.SG553_Pulse, -2)); + addGadget(new GameModifierMineStrikeSkin(this, MineStrikeSkin.SG553_Pulse, -2));*/ + for (MineStrikeSkin mineStrikeSkin : MineStrikeSkin.values()) + { + addGadget(new GameModifierMineStrikeSkin(this, mineStrikeSkin, -2)); + } // Survival Games @@ -507,9 +551,23 @@ public class GadgetManager extends MiniPlugin addGadget(new KitGameModifier(this, kitModifier)); }*/ - // Balloons - //addGadget(new BabyCowBalloon(this)); + // Balloons + for (BalloonType balloonType : BalloonType.values()) + { + addGadget(new BalloonItem(this, balloonType)); + } + + // TAUNTS!!! + addGadget(new EternalTaunt(this)); + addGadget(new BlowAKissTaunt(this)); + + // Gem Hunters Mounts + for (MountType mount : MountType.values()) + { + addGadget(new GameModifierMount(this, mount)); + } + for (GadgetType gadgetType : GadgetType.values()) { if (!_gadgets.containsKey(gadgetType)) @@ -597,6 +655,22 @@ public class GadgetManager extends MiniPlugin } return null; } + + public List getActiveBalloons(Player player) + { + List balloonGadgets = new ArrayList<>(); + for (Gadget gadget : getGadgets(GadgetType.BALLOON)) + { + if (gadget instanceof BalloonGadget) + { + if (gadget.isActive(player)) + { + balloonGadgets.add((BalloonGadget) gadget); + } + } + } + return balloonGadgets; + } public List getGameModifiers(GameModifierType gameType) { @@ -675,6 +749,20 @@ public class GadgetManager extends MiniPlugin } return null; } + + public BalloonGadget getBalloonGadget(BalloonType balloonType) + { + for (Gadget gadget : getGadgets(GadgetType.BALLOON)) + { + if (gadget instanceof BalloonGadget) + { + BalloonGadget balloonGadget = (BalloonGadget) gadget; + if (balloonGadget.getBalloonType().equals(balloonType)) + return balloonGadget; + } + } + return null; + } // Disallows two armor gadgets in same slot. public void removeOutfit(Player player, ArmorSlot slot) @@ -738,7 +826,10 @@ public class GadgetManager extends MiniPlugin if (gadget instanceof WinEffectGadget) continue; - if(gadget instanceof GameModifierGadget) + if (gadget instanceof GameModifierGadget) + continue; + + if (gadget instanceof TauntGadget) continue; for (Player player : UtilServer.getPlayers()) @@ -760,17 +851,23 @@ public class GadgetManager extends MiniPlugin public void disableAll(Player player, boolean winRooms) { - for (GadgetType gadgetType : _gadgets.keySet()) + if (winRooms) { - if (gadgetType == GadgetType.WIN_EFFECT && winRooms) - { - continue; - } - for (Gadget gadget : _gadgets.get(gadgetType)) + for (Gadget gadget : _gadgets.get(GadgetType.PARTICLE)) { gadget.disable(player, false); } } + else + { + for (GadgetType gadgetType : _gadgets.keySet()) + { + for (Gadget gadget : _gadgets.get(gadgetType)) + { + gadget.disable(player, false); + } + } + } } public void disableAll(Player player, List dontDisable) @@ -1063,6 +1160,17 @@ public class GadgetManager extends MiniPlugin event.setCancelled(true); player.sendMessage(F.main("Cosmetics", "You cannot enable particles while vanished!")); } + if (event.getGadget().getGadgetType() == GadgetType.MORPH) + { + if (event.getGadget() instanceof MorphDinnerbone) + { + if (_mountManager.getActive(player) != null) + { + event.setCancelled(true); + UtilPlayer.message(player, F.main("Cosmetics", "You cannot morph into " + event.getGadget().getName() + " with an active mount!")); + } + } + } } @EventHandler @@ -1173,15 +1281,25 @@ public class GadgetManager extends MiniPlugin if (!SwimManager.isSwimming(uuid)) { SwimManager.addPlayer(uuid); - Bukkit.getPluginManager().callEvent(new PlayerToggleSwimEvent(event.getPlayer(), true)); + SwimManager.removePlayerLava(uuid); + Bukkit.getPluginManager().callEvent(new PlayerToggleSwimEvent(event.getPlayer(), true, false)); + } + } + else if (material == Material.LAVA || material == Material.STATIONARY_LAVA) + { + if (!SwimManager.isInLava(uuid)) + { + SwimManager.addPlayerLava(uuid); + SwimManager.removePlayer(uuid); + Bukkit.getPluginManager().callEvent(new PlayerToggleSwimEvent(event.getPlayer(), true, false)); } } else { - if (SwimManager.isSwimming(uuid)) + if (SwimManager.isSwimming(uuid) || SwimManager.isInLava(uuid)) { - SwimManager.removePlayer(uuid); - Bukkit.getPluginManager().callEvent(new PlayerToggleSwimEvent(event.getPlayer(), false)); + SwimManager.removeLavaAndWater(uuid); + Bukkit.getPluginManager().callEvent(new PlayerToggleSwimEvent(event.getPlayer(), false, false)); } } } @@ -1200,4 +1318,57 @@ public class GadgetManager extends MiniPlugin { return _soulManager; } + + /** + * Handles taunt commands + * @param event + */ + @EventHandler + public void onTauntCommand(TauntCommandEvent event) + { + Player player = event.getPlayer(); + + Gadget gadget = getActive(player, GadgetType.TAUNT); + + if (gadget == null) + { + event.setState(TauntCommandEvent.TauntState.NO_TAUNT); + UtilPlayer.message(player, F.main("Taunt", event.getState().getMessage())); + return; + } + + if (!(gadget instanceof TauntGadget)) + { + event.setState(TauntCommandEvent.TauntState.NO_TAUNT); + UtilPlayer.message(player, F.main("Taunt", event.getState().getMessage())); + return; + } + + TauntGadget taunt = (TauntGadget) gadget; + + if (!event.isGameInProgress() && event.getState().equals(TauntCommandEvent.TauntState.NONE)) + event.setState(TauntCommandEvent.TauntState.NOT_IN_GAME); + + if (taunt.isGameDisabled(event.getGameType()) && event.getState().equals(TauntCommandEvent.TauntState.NONE)) + event.setState(TauntCommandEvent.TauntState.GAME_DISABLED); + + if (!event.isAlive() && event.getState().equals(TauntCommandEvent.TauntState.NONE)) + event.setState(TauntCommandEvent.TauntState.NOT_ALIVE); + + if (event.isSpectator() && event.getState().equals(TauntCommandEvent.TauntState.NONE)) + event.setState(TauntCommandEvent.TauntState.SPECTATOR); + + if (event.isInPvp(taunt.getPvpCooldown()) && !taunt.canPlayWithPvp() + && event.getState().equals(TauntCommandEvent.TauntState.NONE)) + event.setState(TauntCommandEvent.TauntState.PVP); + + if (event.getState() != TauntCommandEvent.TauntState.NONE) + { + UtilPlayer.message(player, F.main("Taunt", event.getState().getMessage())); + return; + } + + taunt.start(player); + } + } diff --git a/Plugins/Mineplex.Core/src/mineplex/core/gadget/commands/LockCosmeticsCommand.java b/Plugins/Mineplex.Core/src/mineplex/core/gadget/commands/LockCosmeticsCommand.java index e81367341..a4968bead 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/gadget/commands/LockCosmeticsCommand.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/gadget/commands/LockCosmeticsCommand.java @@ -7,6 +7,7 @@ import mineplex.core.command.CommandBase; import mineplex.core.common.Rank; import mineplex.core.common.util.F; import mineplex.core.common.util.UtilPlayer; +import mineplex.core.common.util.UtilServer; import mineplex.core.common.util.UtilText; import mineplex.core.donation.Donor; import mineplex.core.gadget.GadgetManager; @@ -22,13 +23,19 @@ public class LockCosmeticsCommand extends CommandBase public LockCosmeticsCommand(GadgetManager plugin) { - super(plugin, Rank.JNR_DEV, "lockCosmetics"); + super(plugin, Rank.SNR_MODERATOR, "lockCosmetics"); _plugin = plugin; } @Override public void Execute(Player caller, String[] args) { + if (!UtilServer.isTestServer()) + { + UtilPlayer.message(caller, F.main("Lock Cosmetics", "This command requires a test server!")); + return; + } + // Adds all cosmetic types if (args.length == 0) { @@ -72,9 +79,9 @@ public class LockCosmeticsCommand extends CommandBase names[i++] = gadget.getName(); for (String name : names) { - if (donor.OwnsUnknownPackage(name)) + if (donor.ownsUnknownSalesPackage(name)) { - donor.RemoveUnknownSalesPackagesOwned(name); + donor.removeAllOwnedUnknownSalesPackages(name); removed++; } } @@ -89,14 +96,14 @@ public class LockCosmeticsCommand extends CommandBase int removed = 0; for (Mount mount : _plugin.getMountManager().getMounts()) { - if (donor.OwnsUnknownPackage(mount.getName())) + if (donor.ownsUnknownSalesPackage(mount.getName())) { - donor.RemoveUnknownSalesPackagesOwned(mount.getName()); + donor.removeAllOwnedUnknownSalesPackages(mount.getName()); removed++; } else if (mount.hasMount(caller)) { - donor.RemoveUnknownSalesPackagesOwned(mount.getName()); + donor.removeAllOwnedUnknownSalesPackages(mount.getName()); removed++; } } diff --git a/Plugins/Mineplex.Core/src/mineplex/core/gadget/commands/LockInfusedCommand.java b/Plugins/Mineplex.Core/src/mineplex/core/gadget/commands/LockInfusedCommand.java new file mode 100644 index 000000000..fef74b9fd --- /dev/null +++ b/Plugins/Mineplex.Core/src/mineplex/core/gadget/commands/LockInfusedCommand.java @@ -0,0 +1,81 @@ +package mineplex.core.gadget.commands; + +import java.util.ArrayList; +import java.util.Arrays; +import java.util.List; + +import org.bukkit.entity.Player; + +import mineplex.core.command.CommandBase; +import mineplex.core.common.Rank; +import mineplex.core.gadget.GadgetManager; +import mineplex.core.gadget.gadgets.arrowtrail.candycane.ArrowTrailCandyCane; +import mineplex.core.gadget.gadgets.arrowtrail.frostlord.ArrowTrailFrostLord; +import mineplex.core.gadget.gadgets.death.candycane.DeathCandyCane; +import mineplex.core.gadget.gadgets.death.frostlord.DeathFrostLord; +import mineplex.core.gadget.gadgets.doublejump.candycane.DoubleJumpCandyCane; +import mineplex.core.gadget.gadgets.doublejump.frostlord.DoubleJumpFrostLord; +import mineplex.core.gadget.gadgets.hat.HatType; +import mineplex.core.gadget.gadgets.item.ItemCoal; +import mineplex.core.gadget.gadgets.item.ItemFreezeCannon; +import mineplex.core.gadget.gadgets.item.ItemPartyPopper; +import mineplex.core.gadget.gadgets.item.ItemSnowball; +import mineplex.core.gadget.gadgets.morph.MorphSnowman; +import mineplex.core.gadget.gadgets.particle.frostlord.ParticleFrostLord; +import mineplex.core.gadget.types.Gadget; +import mineplex.core.mount.Mount; + +public class LockInfusedCommand extends CommandBase +{ + + private GadgetManager _manager; + + public LockInfusedCommand(GadgetManager manager) + { + super(manager, Rank.JNR_DEV, "lockinfused"); + _manager = manager; + } + + @Override + public void Execute(Player player, String args[]) + { + // Hats + List types = Arrays.asList(HatType.PRESENT, HatType.SNOWMAN, HatType.SANTA, HatType.GRINCH); + + // Mounts + Mount mount = _manager.getMountManager().getMount("Baby Reindeer"); + + // Others + List infusedItems = new ArrayList<>(); + infusedItems.add(_manager.getGadget(ItemCoal.class)); + infusedItems.add(_manager.getGadget(ItemFreezeCannon.class)); + infusedItems.add(_manager.getGadget(ItemPartyPopper.class)); + infusedItems.add(_manager.getGadget(ItemSnowball.class)); + infusedItems.add(_manager.getGadget(ArrowTrailCandyCane.class)); + infusedItems.add(_manager.getGadget(DoubleJumpCandyCane.class)); + infusedItems.add(_manager.getGadget(DeathCandyCane.class)); + infusedItems.add(_manager.getGadget(ArrowTrailFrostLord.class)); + infusedItems.add(_manager.getGadget(DeathFrostLord.class)); + infusedItems.add(_manager.getGadget(DoubleJumpFrostLord.class)); + infusedItems.add(_manager.getGadget(MorphSnowman.class)); + infusedItems.add(_manager.getGadget(ParticleFrostLord.class)); + + for (HatType hatType : types) + { + infusedItems.add(_manager.getHatGadget(hatType)); + } + + for (Gadget gadget : infusedItems) + { + _manager.getDonationManager().Get(player).removeAllOwnedUnknownSalesPackages(gadget.getName()); + for (String possibleName : gadget.getAlternativePackageNames()) + { + _manager.getDonationManager().Get(player).removeAllOwnedUnknownSalesPackages(possibleName); + } + } + + _manager.getDonationManager().Get(player).removeAllOwnedUnknownSalesPackages(mount.getName()); + + } + +} diff --git a/Plugins/Mineplex.Core/src/mineplex/core/gadget/commands/UnlockCosmeticsCommand.java b/Plugins/Mineplex.Core/src/mineplex/core/gadget/commands/UnlockCosmeticsCommand.java index 3f4c0ea3d..43e1a4756 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/gadget/commands/UnlockCosmeticsCommand.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/gadget/commands/UnlockCosmeticsCommand.java @@ -7,6 +7,7 @@ import mineplex.core.command.CommandBase; import mineplex.core.common.Rank; import mineplex.core.common.util.F; import mineplex.core.common.util.UtilPlayer; +import mineplex.core.common.util.UtilServer; import mineplex.core.common.util.UtilText; import mineplex.core.donation.Donor; import mineplex.core.gadget.GadgetManager; @@ -22,13 +23,19 @@ public class UnlockCosmeticsCommand extends CommandBase public UnlockCosmeticsCommand(GadgetManager plugin) { - super(plugin, Rank.JNR_DEV, "unlockCosmetics"); + super(plugin, Rank.SNR_MODERATOR, "unlockCosmetics"); _plugin = plugin; } @Override public void Execute(Player caller, String[] args) { + if (!UtilServer.isTestServer()) + { + UtilPlayer.message(caller, F.main("Unlock Cosmetics", "This command requires a test server!")); + return; + } + // Adds all cosmetic types if (args.length == 0) { @@ -73,19 +80,19 @@ public class UnlockCosmeticsCommand extends CommandBase names[i++] = gadget.getName(); for (String name : names) { - if (donor.OwnsUnknownPackage(name)) + if (donor.ownsUnknownSalesPackage(name)) { hasGadget = true; } } if (!hasGadget) { - donor.AddUnknownSalesPackagesOwned(gadget.getName()); + donor.addOwnedUnknownSalesPackage(gadget.getName()); added++; } } } - UtilPlayer.message(caller, F.main("Unlock Cosmetics", "Added" + added + F.elem(" " + gadgetType.getCategoryType()) + UtilText.plural(" item", added) + "!")); + UtilPlayer.message(caller, F.main("Unlock Cosmetics", "Added " + added + F.elem(" " + gadgetType.getCategoryType()) + UtilText.plural(" item", added) + "!")); } private void addMounts(Player caller) @@ -94,14 +101,14 @@ public class UnlockCosmeticsCommand extends CommandBase int added = 0; for (Mount mount : _plugin.getMountManager().getMounts()) { - if (!donor.OwnsUnknownPackage(mount.getName())) + if (!donor.ownsUnknownSalesPackage(mount.getName())) { - donor.AddUnknownSalesPackagesOwned(mount.getName()); + donor.addOwnedUnknownSalesPackage(mount.getName()); added++; } else if (!mount.hasMount(caller)) { - donor.AddUnknownSalesPackagesOwned(mount.getName()); + donor.addOwnedUnknownSalesPackage(mount.getName()); added++; } } diff --git a/Plugins/Mineplex.Core/src/mineplex/core/gadget/event/ItemGadgetUseEvent.java b/Plugins/Mineplex.Core/src/mineplex/core/gadget/event/ItemGadgetUseEvent.java index 1a5122f51..3d4dc5c9f 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/gadget/event/ItemGadgetUseEvent.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/gadget/event/ItemGadgetUseEvent.java @@ -1,20 +1,21 @@ package mineplex.core.gadget.event; -import mineplex.core.gadget.types.ItemGadget; - import org.bukkit.entity.Player; +import org.bukkit.event.Cancellable; import org.bukkit.event.Event; import org.bukkit.event.HandlerList; -public class ItemGadgetUseEvent extends Event +import mineplex.core.gadget.types.ItemGadget; + +public class ItemGadgetUseEvent extends Event implements Cancellable { private static final HandlerList handlers = new HandlerList(); private Player _player; private ItemGadget _gadget; private int _count; - - private boolean _cancelled = false; + private boolean _cancelled; + private String _cancelledMessage = ""; public ItemGadgetUseEvent(Player player, ItemGadget gadget, int count) { @@ -48,13 +49,25 @@ public class ItemGadgetUseEvent extends Event return _player; } - public void setCancelled(boolean cancel) - { - _cancelled = cancel; - } - + @Override public boolean isCancelled() { return _cancelled; } + + @Override + public void setCancelled(boolean cancelled) + { + _cancelled = cancelled; + } + + public String getCancelledMessage() + { + return _cancelledMessage; + } + + public void setCancelledMessage(String cancelledMessage) + { + _cancelledMessage = cancelledMessage; + } } \ No newline at end of file diff --git a/Plugins/Mineplex.Core/src/mineplex/core/gadget/event/PlayerConsumeMelonEvent.java b/Plugins/Mineplex.Core/src/mineplex/core/gadget/event/PlayerConsumeMelonEvent.java new file mode 100644 index 000000000..74b433ec5 --- /dev/null +++ b/Plugins/Mineplex.Core/src/mineplex/core/gadget/event/PlayerConsumeMelonEvent.java @@ -0,0 +1,25 @@ +package mineplex.core.gadget.event; + +import org.bukkit.entity.Player; +import org.bukkit.event.HandlerList; +import org.bukkit.event.player.PlayerEvent; + +public class PlayerConsumeMelonEvent extends PlayerEvent +{ + private static final HandlerList handlers = new HandlerList(); + + public PlayerConsumeMelonEvent(Player player) + { + super(player); + } + + public HandlerList getHandlers() + { + return handlers; + } + + public static HandlerList getHandlerList() + { + return handlers; + } +} diff --git a/Plugins/Mineplex.Core/src/mineplex/core/gadget/event/PlayerToggleSwimEvent.java b/Plugins/Mineplex.Core/src/mineplex/core/gadget/event/PlayerToggleSwimEvent.java index 2d5c5f00b..49803ac80 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/gadget/event/PlayerToggleSwimEvent.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/gadget/event/PlayerToggleSwimEvent.java @@ -10,9 +10,9 @@ public class PlayerToggleSwimEvent extends Event private static final HandlerList handlers = new HandlerList(); private Player _player; - private boolean _swimming; + private boolean _swimming, _lava; - public PlayerToggleSwimEvent(Player player, boolean swimming) + public PlayerToggleSwimEvent(Player player, boolean swimming, boolean lava) { _player = player; _swimming = swimming; @@ -28,6 +28,11 @@ public class PlayerToggleSwimEvent extends Event return _swimming; } + public boolean isInLava() + { + return _lava; + } + public HandlerList getHandlers() { return handlers; diff --git a/Plugins/Mineplex.Core/src/mineplex/core/gadget/event/PlayerUseCoalEvent.java b/Plugins/Mineplex.Core/src/mineplex/core/gadget/event/PlayerUseCoalEvent.java new file mode 100644 index 000000000..33998960f --- /dev/null +++ b/Plugins/Mineplex.Core/src/mineplex/core/gadget/event/PlayerUseCoalEvent.java @@ -0,0 +1,49 @@ +package mineplex.core.gadget.event; + +import org.bukkit.entity.Player; +import org.bukkit.event.HandlerList; +import org.bukkit.event.player.PlayerEvent; + +import mineplex.core.gadget.types.Gadget; + +public class PlayerUseCoalEvent extends PlayerEvent +{ + private static final HandlerList handlers = new HandlerList(); + + private final CoalReward _prize; + private final int _cost; + + public PlayerUseCoalEvent(Player player, CoalReward reward, int cost) + { + super(player); + this._prize = reward; + this._cost = cost; + } + + public CoalReward getPrize() + { + return this._prize; + } + + public int getCost() + { + return this._cost; + } + + public HandlerList getHandlers() + { + return handlers; + } + + public static HandlerList getHandlerList() + { + return handlers; + } + + public enum CoalReward + { + HAT, + PET, + PARTICLE + } +} diff --git a/Plugins/Mineplex.Core/src/mineplex/core/gadget/event/TauntCommandEvent.java b/Plugins/Mineplex.Core/src/mineplex/core/gadget/event/TauntCommandEvent.java new file mode 100644 index 000000000..e803d54e2 --- /dev/null +++ b/Plugins/Mineplex.Core/src/mineplex/core/gadget/event/TauntCommandEvent.java @@ -0,0 +1,106 @@ +package mineplex.core.gadget.event; + +import org.bukkit.entity.Player; +import org.bukkit.event.Event; +import org.bukkit.event.HandlerList; + +import mineplex.core.common.util.UtilTime; +import mineplex.core.gadget.gadgets.taunts.GameType; + +public class TauntCommandEvent extends Event +{ + + private static final HandlerList handlers = new HandlerList(); + + private Player _player; + private boolean _gameInProgress; + private boolean _alive; + private boolean _spectator; + private long _lastPvp; + private TauntState _state = TauntState.NONE; + private GameType _gameType; + + public TauntCommandEvent(Player player, boolean gameInProgress, boolean alive, boolean spectator, long lastPvp, GameType gameType) + { + _player = player; + _gameInProgress = gameInProgress; + _alive = alive; + _spectator = spectator; + _lastPvp = lastPvp; + _gameType = gameType; + } + + public Player getPlayer() + { + return _player; + } + + public boolean isGameInProgress() + { + return _gameInProgress; + } + + public boolean isAlive() + { + return _alive; + } + + public boolean isSpectator() + { + return _spectator; + } + + public boolean isInPvp(long cooldown) + { + return !UtilTime.elapsed(_lastPvp, cooldown); + } + + public TauntState getState() + { + return _state; + } + + public GameType getGameType() + { + return _gameType; + } + + public void setState(TauntState state) + { + _state = state; + } + + public HandlerList getHandlers() + { + return handlers; + } + + public static HandlerList getHandlerList() + { + return handlers; + } + + public enum TauntState + { + NONE(""), + NO_TAUNT("You have no active taunts!"), + NOT_IN_GAME("You are not in a game!"), + NOT_ALIVE("You are not playing the game!"), + SPECTATOR("You can't run this as a spectator!"), + PVP("You can't run this while in pvp!"), + GAME_DISABLED("Taunts are disabled in this game!"); + + private String _message; + + TauntState(String message) + { + _message = message; + } + + public String getMessage() + { + return _message; + } + } + +} diff --git a/Plugins/Mineplex.Core/src/mineplex/core/gadget/event/ToggleMobsEvent.java b/Plugins/Mineplex.Core/src/mineplex/core/gadget/event/ToggleMobsEvent.java new file mode 100644 index 000000000..a0f73d33c --- /dev/null +++ b/Plugins/Mineplex.Core/src/mineplex/core/gadget/event/ToggleMobsEvent.java @@ -0,0 +1,33 @@ +package mineplex.core.gadget.event; + +import org.bukkit.event.Event; +import org.bukkit.event.HandlerList; + +public class ToggleMobsEvent extends Event +{ + + private static final HandlerList handlers = new HandlerList(); + + private boolean _enable; + + public ToggleMobsEvent(boolean enable) + { + _enable = enable; + } + + public boolean enable() + { + return _enable; + } + + public HandlerList getHandlers() + { + return handlers; + } + + public static HandlerList getHandlerList() + { + return handlers; + } + +} diff --git a/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/arrowtrail/ArrowTrailHalloween.java b/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/arrowtrail/ArrowTrailHalloween.java index 26723da8e..bd5b62563 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/arrowtrail/ArrowTrailHalloween.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/arrowtrail/ArrowTrailHalloween.java @@ -1,9 +1,9 @@ package mineplex.core.gadget.gadgets.arrowtrail; +import java.awt.Color; import java.util.HashMap; import java.util.Map; -import org.bukkit.Color; import org.bukkit.Material; import org.bukkit.entity.Arrow; diff --git a/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/arrowtrail/freedom/ArrowTrailFreedom.java b/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/arrowtrail/freedom/ArrowTrailFreedom.java index cdc26c768..8921b26cc 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/arrowtrail/freedom/ArrowTrailFreedom.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/arrowtrail/freedom/ArrowTrailFreedom.java @@ -1,17 +1,20 @@ package mineplex.core.gadget.gadgets.arrowtrail.freedom; +import java.awt.Color; + +import org.bukkit.ChatColor; +import org.bukkit.Material; +import org.bukkit.entity.Arrow; + import mineplex.core.common.util.LineFormat; import mineplex.core.common.util.UtilParticle; import mineplex.core.common.util.UtilText; +import mineplex.core.common.util.banner.CountryFlag; import mineplex.core.common.util.particles.ColoredParticle; import mineplex.core.common.util.particles.DustSpellColor; import mineplex.core.gadget.GadgetManager; -import mineplex.core.particleeffects.BabyFireworkEffect; import mineplex.core.gadget.types.ArrowEffectGadget; -import org.bukkit.ChatColor; -import org.bukkit.Color; -import org.bukkit.Material; -import org.bukkit.entity.Arrow; +import mineplex.core.particleeffects.BabyFireworkEffect; public class ArrowTrailFreedom extends ArrowEffectGadget { @@ -25,6 +28,7 @@ public class ArrowTrailFreedom extends ArrowEffectGadget ChatColor.RED, ChatColor.WHITE, ChatColor.BLUE), LineFormat.LORE), -8, Material.WOOL, (byte) 0); + setDisplayItem(CountryFlag.USA.getBanner()); } @Override diff --git a/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/arrowtrail/titan/ArrowTrailTitan.java b/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/arrowtrail/titan/ArrowTrailTitan.java index 6bada9d2d..956055929 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/arrowtrail/titan/ArrowTrailTitan.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/arrowtrail/titan/ArrowTrailTitan.java @@ -45,7 +45,7 @@ public class ArrowTrailTitan extends ArrowEffectGadget { if (Manager.getClientManager().Get(event.getPlayer()).GetRank().has(Rank.TITAN)) { - Manager.getDonationManager().Get(event.getPlayer()).AddUnknownSalesPackagesOwned(getName()); + Manager.getDonationManager().Get(event.getPlayer()).addOwnedUnknownSalesPackage(getName()); } } } diff --git a/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/balloons/BabyCowBalloon.java b/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/balloons/BabyCowBalloon.java deleted file mode 100644 index 4b1e7e23f..000000000 --- a/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/balloons/BabyCowBalloon.java +++ /dev/null @@ -1,52 +0,0 @@ -package mineplex.core.gadget.gadgets.balloons; - -import mineplex.core.common.util.UtilEnt; -import mineplex.core.gadget.GadgetManager; -import mineplex.core.gadget.types.BalloonGadget; -import org.bukkit.Location; -import org.bukkit.Material; -import org.bukkit.entity.*; - -public class BabyCowBalloon extends BalloonGadget -{ - - private ArmorStand _entityStand, _playerStand; - private Entity _balloonEntity; - - public BabyCowBalloon(GadgetManager manager) - { - super(manager, "Baby Cow Balloon", new String[]{"placeholder"}, 0, Material.MONSTER_EGG, UtilEnt.getEntityEggData(EntityType.COW)); - } - - @Override - public void enableCustom(Player player, boolean message) - { - if (!canSpawnBalloon(player)) - { - // TODO MESSAGE - return; - } - addPlayerBalloon(player); - _entityStand = player.getWorld().spawn(player.getLocation(), ArmorStand.class); - _entityStand.setGravity(false); - _entityStand.setVisible(false); - Cow babyCow = player.getWorld().spawn(player.getLocation(), Cow.class); - babyCow.setBaby(); - _balloonEntity = babyCow; - _entityStand.setPassenger(babyCow); - Location balloonLocation = player.getLocation().add(_random.nextDouble(), getNewHeight(player), _random.nextDouble()); - _entityStand.teleport(balloonLocation); - babyCow.setLeashHolder(player); - // TODO UPDATE BALLOONS - } - - @Override - public void disableCustom(Player player, boolean message) - { - _entityStand.remove(); - _balloonEntity.remove(); - removePlayerBalloon(player); - // TODO UPDATE PLAYER HEIGHT - } - -} diff --git a/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/balloons/BalloonItem.java b/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/balloons/BalloonItem.java new file mode 100644 index 000000000..be3382dc6 --- /dev/null +++ b/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/balloons/BalloonItem.java @@ -0,0 +1,100 @@ +package mineplex.core.gadget.gadgets.balloons; + +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; +import java.util.UUID; + +import org.bukkit.entity.Ageable; +import org.bukkit.entity.Entity; +import org.bukkit.entity.EntityType; +import org.bukkit.entity.Player; +import org.bukkit.entity.Zombie; +import org.bukkit.metadata.FixedMetadataValue; +import org.bukkit.potion.PotionEffect; +import org.bukkit.potion.PotionEffectType; + +import mineplex.core.common.util.UtilEnt; +import mineplex.core.common.util.UtilServer; +import mineplex.core.gadget.GadgetManager; +import mineplex.core.gadget.types.BalloonGadget; + +public class BalloonItem extends BalloonGadget +{ + + private BalloonType _balloonType; + private Map> _entities = new HashMap<>(); + private Map _reverseEntityMap = new HashMap<>(); + + public BalloonItem(GadgetManager manager, BalloonType balloonType) + { + super(manager, balloonType.getName(), balloonType.getLore(), balloonType.getCost(), + balloonType.getDisplayItem().getType(), + balloonType.getDisplayItem().getData().getData(), balloonType, + balloonType.getEntityType()); + setDisplayItem(balloonType.getDisplayItem()); + _balloonType = balloonType; + } + + @Override + public Entity[] spawnEntity(Player player) + { + Entity[] ents = new Entity[2]; + if (_balloonType.getEntityType().equals(EntityType.ARMOR_STAND)) + { + Zombie zombie = player.getWorld().spawn(player.getLocation(), Zombie.class); + zombie.addPotionEffect(new PotionEffect(PotionEffectType.INVISIBILITY, Integer.MAX_VALUE, 1, false, false)); + zombie.getEquipment().setHelmet(_balloonType.getDisplayItem()); + UtilEnt.silence(zombie, true); + UtilEnt.vegetate(zombie); + addEntity(player, zombie); + + ents[0] = zombie; + + return ents; + } + else if (_balloonType.equals(BalloonType.BABY_ZOMBIE)) + { + Zombie zombie = player.getWorld().spawn(player.getLocation(), Zombie.class); + zombie.setBaby(true); + UtilEnt.vegetate(zombie); + UtilEnt.silence(zombie, true); + addEntity(player, zombie); + ents[0] = zombie; + return ents; + } + + + Entity entity = player.getWorld().spawnEntity(player.getLocation(), _balloonType.getEntityType()); + if (_balloonType.isBaby() && entity instanceof Ageable) + ((Ageable) entity).setBaby(); + UtilEnt.vegetate(entity); + UtilEnt.silence(entity, true); + addEntity(player, entity); + ents[0] = entity; + return ents; + } + + private void addEntity(Player player, Entity entity) + { + _entities.computeIfAbsent(player.getUniqueId(), list -> new ArrayList<>()); + List entities = _entities.get(player.getUniqueId()); + entities.add(entity); + _entities.put(player.getUniqueId(), entities); + _reverseEntityMap.put(entity, player); + entity.setMetadata("balloon", new FixedMetadataValue(UtilServer.getPlugin(), "true")); + } + + @Override + public void removeEntities(Player player) + { + for (Entity entity : _entities.get(player.getUniqueId())) + { + _reverseEntityMap.remove(entity); + entity.remove(); + } + _entities.remove(player.getUniqueId()); + } + +} diff --git a/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/balloons/BalloonType.java b/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/balloons/BalloonType.java new file mode 100644 index 000000000..1fbf94fc2 --- /dev/null +++ b/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/balloons/BalloonType.java @@ -0,0 +1,95 @@ +package mineplex.core.gadget.gadgets.balloons; + +import org.bukkit.Material; +import org.bukkit.entity.EntityType; +import org.bukkit.inventory.ItemStack; + +import mineplex.core.common.util.C; +import mineplex.core.common.util.LineFormat; +import mineplex.core.common.util.UtilText; + +public enum BalloonType +{ + + // BABY + BABY_COW (EntityType.COW, true, "Baby Cow Balloon", 0, new ItemStack(Material.COOKED_BEEF)), + BABY_PIG (EntityType.PIG, true, "Baby Pig Balloon", 0, new ItemStack(Material.GRILLED_PORK)), + BABY_ZOMBIE (EntityType.ZOMBIE, true, "Baby Zombie Balloon", 0, new ItemStack(Material.ROTTEN_FLESH)), + BABY_MUSHROOM(EntityType.MUSHROOM_COW, true, "Baby Mushroom Cow Balloon", 0, new ItemStack(Material.MUSHROOM_SOUP)), + BABY_OCELOT (EntityType.OCELOT, true, "Baby Ocelot Balloon", 0, new ItemStack(Material.COOKED_FISH)), + BABY_WOLF (EntityType.WOLF, true, "Baby Wolf Balloon", 0, new ItemStack(Material.BONE)), + BABY_SHEEP (EntityType.SHEEP, true, "Baby Sheep Balloon", 0, new ItemStack(Material.WOOL)), + BABY_VILLAGER(EntityType.VILLAGER, true, "Baby Villager Balloon", 0, new ItemStack(Material.EMERALD)), + BABY_SLIME (EntityType.SLIME, true, "Baby Slime Balloon", 0, new ItemStack(Material.SLIME_BALL)), + + // NOT BABY + SQUID (EntityType.SQUID, "Squid Balloon", 0, new ItemStack(Material.INK_SACK)), + BAT (EntityType.BAT, "Bat Balloon", 0, new ItemStack(Material.JACK_O_LANTERN)), + SILVERFISH(EntityType.SILVERFISH, "Silverfish Balloon", 0, new ItemStack(Material.getMaterial(97))), + GUARDIAN (EntityType.GUARDIAN, "Guardian Balloon", 0, new ItemStack(Material.PRISMARINE_SHARD)), + + // BLOCK + /*DRAGON_EGG (new ItemStack(Material.DRAGON_EGG), false, "Dragon Egg Balloon", UtilText.splitLinesToArray(new String[]{"Placeholder"}, LineFormat.LORE), 0), + DIAMOND_BLOCK(new ItemStack(Material.DIAMOND_BLOCK), false, "Diamond Block Balloon", UtilText.splitLinesToArray(new String[]{"Placeholder"}, LineFormat.LORE), 0), + IRON_BLOCK (new ItemStack(Material.IRON_BLOCK), false, "Iron Block Balloon", UtilText.splitLinesToArray(new String[]{"Placeholder"}, LineFormat.LORE), 0), + GOLD_BLOCK (new ItemStack(Material.GOLD_BLOCK), false, "Gold Block Balloon", UtilText.splitLinesToArray(new String[]{"Placeholder"}, LineFormat.LORE), 0),*/ + EMERALD_BLOCK(new ItemStack(Material.EMERALD_BLOCK), false, "Emerald Block Balloon", 0); + + private EntityType _entityType; + private boolean _isBaby; + private String _name; + private String[] _lore; + private int _cost; + private ItemStack _displayItem; + + BalloonType(EntityType entityType, String name, int cost, ItemStack displayItem) + { + this(entityType, false, name, cost, displayItem); + } + + BalloonType(EntityType entityType, boolean isBaby, String name, int cost, ItemStack displayItem) + { + _entityType = entityType; + _isBaby = isBaby; + _name = name; + _cost = cost; + _displayItem = displayItem; + } + + BalloonType(ItemStack block, boolean isBaby, String name, int cost) + { + this(EntityType.ARMOR_STAND, isBaby, name, cost, block); + } + + public EntityType getEntityType() + { + return _entityType; + } + + public boolean isBaby() + { + return _isBaby; + } + + public String getName() + { + return _name; + } + + public String[] getLore() + { + return UtilText.splitLinesToArray(new String[]{C.cGray + "A floating " + getName() + " that appears above your head!", + "", + C.cWhite + "Click to activate, click again to remove. You can have up to 10 balloons active at a time."}, LineFormat.LORE); + } + + public int getCost() + { + return _cost; + } + + public ItemStack getDisplayItem() + { + return _displayItem; + } +} diff --git a/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/death/christmas/DeathPresentDanger.java b/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/death/christmas/DeathPresentDanger.java new file mode 100644 index 000000000..e8db5ed6a --- /dev/null +++ b/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/death/christmas/DeathPresentDanger.java @@ -0,0 +1,93 @@ +package mineplex.core.gadget.gadgets.death.christmas; + +import java.util.ArrayList; +import java.util.Iterator; +import java.util.List; + +import org.bukkit.Bukkit; +import org.bukkit.Location; +import org.bukkit.Material; +import org.bukkit.entity.ArmorStand; +import org.bukkit.entity.Player; +import org.bukkit.event.EventHandler; +import org.bukkit.event.entity.EntityDamageByEntityEvent; + +import mineplex.core.blood.BloodEvent; +import mineplex.core.common.skin.SkinData; +import mineplex.core.common.util.C; +import mineplex.core.common.util.LineFormat; +import mineplex.core.common.util.UtilParticle; +import mineplex.core.common.util.UtilText; +import mineplex.core.gadget.GadgetManager; +import mineplex.core.gadget.event.ToggleMobsEvent; +import mineplex.core.gadget.types.DeathEffectGadget; +import mineplex.core.updater.UpdateType; +import mineplex.core.updater.event.UpdateEvent; + +public class DeathPresentDanger extends DeathEffectGadget +{ + + private List _armorStands = new ArrayList<>(); + + public DeathPresentDanger(GadgetManager manager) + { + super(manager, "Present Danger", + UtilText.splitLineToArray(C.cGray + "Leave behind a little gift for your enemies.", LineFormat.LORE), + -16, + Material.INK_SACK, (byte)1); + setDisplayItem(SkinData.PRESENT.getSkull()); + } + + @Override + public void onBlood(Player player, BloodEvent event) + { + event.setCancelled(true); + + Location loc = event.getLocation(); + UtilParticle.PlayParticleToAll(UtilParticle.ParticleType.ICON_CRACK.getParticle(Material.WOOL, (byte) 14), loc, 0, 0, 0, 0.1f, 15, UtilParticle.ViewDist.NORMAL); + UtilParticle.PlayParticleToAll(UtilParticle.ParticleType.ICON_CRACK.getParticle(Material.WOOL, (byte) 4), loc, 0, 0, 0, 0.1f, 15, UtilParticle.ViewDist.NORMAL); + + Bukkit.getPluginManager().callEvent(new ToggleMobsEvent(true)); + ArmorStand armorStand = loc.getWorld().spawn(loc.clone().subtract(0, 2.3, 0), ArmorStand.class); + armorStand.setVisible(false); + armorStand.setGravity(false); + armorStand.setSmall(true); + armorStand.setHelmet(SkinData.PRESENT.getSkull()); + _armorStands.add(armorStand); + Bukkit.getPluginManager().callEvent(new ToggleMobsEvent(false)); + } + + @EventHandler + public void onUpdate(UpdateEvent event) + { + if (event.getType() != UpdateType.TICK) + return; + + Iterator iterator = _armorStands.iterator(); + while (iterator.hasNext()) + { + ArmorStand armorStand = iterator.next(); + if (armorStand.getTicksLived() >= 100 || !armorStand.isValid()) + { + Location loc = armorStand.getEyeLocation(); + UtilParticle.PlayParticleToAll(UtilParticle.ParticleType.ICON_CRACK.getParticle(Material.WOOL, (byte) 14), loc, 0, 0, 0, 0.1f, 15, UtilParticle.ViewDist.NORMAL); + UtilParticle.PlayParticleToAll(UtilParticle.ParticleType.ICON_CRACK.getParticle(Material.WOOL, (byte) 4), loc, 0, 0, 0, 0.1f, 15, UtilParticle.ViewDist.NORMAL); + armorStand.remove(); + iterator.remove(); + } + } + } + + @EventHandler + public void removeArrows(EntityDamageByEntityEvent event) + { + if (event.getEntity() instanceof ArmorStand) + { + if (_armorStands.contains(event.getEntity())) + { + event.setCancelled(true); + } + } + } + +} diff --git a/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/death/freedom/DeathFreedom.java b/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/death/freedom/DeathFreedom.java index bb2f1e1fb..24d43eb0b 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/death/freedom/DeathFreedom.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/death/freedom/DeathFreedom.java @@ -1,17 +1,18 @@ package mineplex.core.gadget.gadgets.death.freedom; -import mineplex.core.blood.BloodEvent; -import mineplex.core.common.util.C; -import mineplex.core.common.util.LineFormat; -import mineplex.core.common.util.UtilFirework; -import mineplex.core.common.util.UtilText; -import mineplex.core.gadget.GadgetManager; -import mineplex.core.gadget.types.DeathEffectGadget; import org.bukkit.ChatColor; import org.bukkit.Location; import org.bukkit.Material; import org.bukkit.entity.Player; +import mineplex.core.blood.BloodEvent; +import mineplex.core.common.util.LineFormat; +import mineplex.core.common.util.UtilFirework; +import mineplex.core.common.util.UtilText; +import mineplex.core.common.util.banner.CountryFlag; +import mineplex.core.gadget.GadgetManager; +import mineplex.core.gadget.types.DeathEffectGadget; + public class DeathFreedom extends DeathEffectGadget { @@ -20,6 +21,7 @@ public class DeathFreedom extends DeathEffectGadget super(manager, "Price of Freedom", UtilText.splitLineToArray(UtilText.colorWords("Freedom isn't always free, Soldier.", ChatColor.RED, ChatColor.WHITE, ChatColor.BLUE), LineFormat.LORE), -8, Material.WOOL, (byte) 0); + setDisplayItem(CountryFlag.USA.getBanner()); } @Override diff --git a/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/death/titan/DeathTitan.java b/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/death/titan/DeathTitan.java index 375384371..00b64eace 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/death/titan/DeathTitan.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/death/titan/DeathTitan.java @@ -34,7 +34,7 @@ public class DeathTitan extends DeathEffectGadget { if (Manager.getClientManager().Get(event.getPlayer()).GetRank().has(Rank.TITAN)) { - Manager.getDonationManager().Get(event.getPlayer()).AddUnknownSalesPackagesOwned(getName()); + Manager.getDonationManager().Get(event.getPlayer()).addOwnedUnknownSalesPackage(getName()); } } diff --git a/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/doublejump/DoubleJumpHalloween.java b/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/doublejump/DoubleJumpHalloween.java index 8381c5a93..0f2cc13e8 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/doublejump/DoubleJumpHalloween.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/doublejump/DoubleJumpHalloween.java @@ -1,10 +1,10 @@ package mineplex.core.gadget.gadgets.doublejump; +import java.awt.Color; import java.util.HashMap; import java.util.Iterator; import java.util.Map; -import org.bukkit.Color; import org.bukkit.Location; import org.bukkit.Material; import org.bukkit.entity.Player; diff --git a/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/doublejump/freedom/DoubleJumpFreedom.java b/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/doublejump/freedom/DoubleJumpFreedom.java index 8caeb35e3..7f887e345 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/doublejump/freedom/DoubleJumpFreedom.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/doublejump/freedom/DoubleJumpFreedom.java @@ -1,13 +1,15 @@ package mineplex.core.gadget.gadgets.doublejump.freedom; +import org.bukkit.ChatColor; +import org.bukkit.Material; +import org.bukkit.entity.Player; + import mineplex.core.common.util.LineFormat; import mineplex.core.common.util.UtilFirework; import mineplex.core.common.util.UtilText; +import mineplex.core.common.util.banner.CountryFlag; import mineplex.core.gadget.GadgetManager; import mineplex.core.gadget.types.DoubleJumpEffectGadget; -import org.bukkit.ChatColor; -import org.bukkit.Material; -import org.bukkit.entity.Player; public class DoubleJumpFreedom extends DoubleJumpEffectGadget { @@ -17,13 +19,12 @@ public class DoubleJumpFreedom extends DoubleJumpEffectGadget super(manager, "Leap of Freedom", UtilText.splitLineToArray(UtilText.colorWords("FREEEEEEEEEEEDOM!", ChatColor.RED, ChatColor.WHITE, ChatColor.BLUE), LineFormat.LORE), -8, Material.WOOL, (byte) 14); + setDisplayItem(CountryFlag.USA.getBanner()); } @Override public void doEffect(Player player) { - /*FreedomFireworkEffect freedomFireworkEffect = new FreedomFireworkEffect(player, Manager.getPlugin(), 3); - freedomFireworkEffect.start();*/ UtilFirework.playFreedomFirework(player.getLocation()); } diff --git a/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/doublejump/titan/DoubleJumpTitan.java b/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/doublejump/titan/DoubleJumpTitan.java index 9de6ce64f..336aaa5bc 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/doublejump/titan/DoubleJumpTitan.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/doublejump/titan/DoubleJumpTitan.java @@ -39,7 +39,7 @@ public class DoubleJumpTitan extends DoubleJumpEffectGadget { if (Manager.getClientManager().Get(event.getPlayer()).GetRank().has(Rank.TITAN)) { - Manager.getDonationManager().Get(event.getPlayer()).AddUnknownSalesPackagesOwned(getName()); + Manager.getDonationManager().Get(event.getPlayer()).addOwnedUnknownSalesPackage(getName()); } } } diff --git a/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/gamemodifiers/GameModifierType.java b/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/gamemodifiers/GameModifierType.java index 569a71dcf..018092c15 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/gamemodifiers/GameModifierType.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/gamemodifiers/GameModifierType.java @@ -19,7 +19,11 @@ public enum GameModifierType MineStrike("MineStrike", new String[]{"Apply custom gun models and skin to use ingame"}, Material.TNT, 0), SurvivalGames("Survival Games", new String[]{"Placeholder"}, Material.DIAMOND_SWORD, 0, true), - Bridges("Bridges", new String[]{"Placeholder"}, Material.IRON_PICKAXE, 0, true); + Bridges("Bridges", new String[]{"Placeholder"}, Material.IRON_PICKAXE, 0, true), + + GemHunters("Gem Hunters", new String[] { "" }, Material.EMERALD, 0) + + ; private String _name; private List _desc; diff --git a/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/gamemodifiers/gemhunters/GameModifierMount.java b/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/gamemodifiers/gemhunters/GameModifierMount.java new file mode 100644 index 000000000..eb23fea91 --- /dev/null +++ b/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/gamemodifiers/gemhunters/GameModifierMount.java @@ -0,0 +1,23 @@ +package mineplex.core.gadget.gadgets.gamemodifiers.gemhunters; + +import mineplex.core.gadget.GadgetManager; +import mineplex.core.gadget.gadgets.gamemodifiers.GameModifierType; +import mineplex.core.gadget.types.GameModifierGadget; + +public class GameModifierMount extends GameModifierGadget +{ + + private final MountType _mountType; + + public GameModifierMount(GadgetManager manager, MountType mountType) + { + super(manager, GameModifierType.GemHunters, mountType.getName() + " Mount", mountType.getDescription(), -2, mountType.getMaterial(), mountType.getData(), false); + + _mountType = mountType; + } + + public final MountType getMountType() + { + return _mountType; + } +} diff --git a/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/gamemodifiers/gemhunters/MountType.java b/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/gamemodifiers/gemhunters/MountType.java new file mode 100644 index 000000000..c1af6c427 --- /dev/null +++ b/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/gamemodifiers/gemhunters/MountType.java @@ -0,0 +1,53 @@ +package mineplex.core.gadget.gadgets.gamemodifiers.gemhunters; + +import org.bukkit.Material; +import org.bukkit.entity.EntityType; + +public enum MountType +{ + + SKELETON(EntityType.HORSE, Material.BONE, (byte) 0, "Skeleton Horse", "Spooky") + + ; + + private final EntityType _entityType; + private final Material _material; + private final byte _data; + private final String _name; + private final String[] _description; + + private MountType(EntityType entityType, Material material, byte data, String name, String... description) + { + _entityType = entityType; + _material = material; + _data = data; + _name = name; + _description = description; + } + + public final EntityType getEntityType() + { + return _entityType; + } + + public final Material getMaterial() + { + return _material; + } + + public byte getData() + { + return _data; + } + + public final String getName() + { + return _name; + } + + public final String[] getDescription() + { + return _description; + } + +} diff --git a/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/gamemodifiers/minestrike/GameModifierMineStrikeSkin.java b/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/gamemodifiers/minestrike/GameModifierMineStrikeSkin.java index a9f2ebcaf..df1cf150f 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/gamemodifiers/minestrike/GameModifierMineStrikeSkin.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/gamemodifiers/minestrike/GameModifierMineStrikeSkin.java @@ -5,6 +5,7 @@ import java.util.function.Predicate; import org.bukkit.Material; import org.bukkit.entity.Player; +import mineplex.core.common.util.C; import mineplex.core.common.util.LineFormat; import mineplex.core.common.util.UtilText; import mineplex.core.gadget.GadgetManager; @@ -36,7 +37,7 @@ public class GameModifierMineStrikeSkin extends GameModifierGadget public GameModifierMineStrikeSkin(GadgetManager manager, String name, String[] lore, String weaponName, Material newSkin, byte newSkinData, int cost, Material displayMat, int displayData) { - super(manager, GameModifierType.MineStrike, name, + super(manager, GameModifierType.MineStrike, name, UtilText.splitLinesToArray(lore, LineFormat.LORE), cost, displayMat, (byte) displayData, true); _weapon = weaponName; _skinMat = newSkin; @@ -51,7 +52,7 @@ public class GameModifierMineStrikeSkin extends GameModifierGadget */ public GameModifierMineStrikeSkin(GadgetManager manager, MineStrikeSkin skin, int cost) { - this(manager, skin, new String[]{""}, cost); + this(manager, skin, new String[]{C.cGray + "Weapon: " + C.cYellow + skin.getWeaponName()}, cost); } /** diff --git a/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/gamemodifiers/minestrike/MineStrikeSkin.java b/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/gamemodifiers/minestrike/MineStrikeSkin.java index 1b118c120..af30e790e 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/gamemodifiers/minestrike/MineStrikeSkin.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/gamemodifiers/minestrike/MineStrikeSkin.java @@ -5,25 +5,33 @@ import org.bukkit.Material; public enum MineStrikeSkin { - P250_Muertos( "P250", "P250 Muertos", Material.INK_SACK, (byte) 3), - CZ75_Auto_Tigris( "CZ75-Auto", "CZ75-Auto Tigris", Material.CLAY_BRICK, (byte) 0), - Desert_Eagle_Blaze( "Desert Eagle", "Desert Eagle Blaze", Material.NETHER_STALK, (byte) 0), - Nova_Koi( "Nova", "Nova Koi", Material.INK_SACK, (byte) 14), - XM1014_Tranquility( "XM1014", "XM1014 Tranquility", Material.DIAMOND, (byte) 0), - PP_Bizon_Streak( "PP Bizon", "PP-Bizon Streak", Material.INK_SACK, (byte) 4), - P90_Asiimov( "P90", "P90 Asiimov", Material.INK_SACK, (byte) 0), - SSG_08_Blood_in_the_Water( "SSG 08", "SSG 08 Blood in the Water", Material.INK_SACK, (byte) 12), - AWP_Asiimov( "AWP", "AWP Asiimov", Material.SULPHUR, (byte) 0), - P2000_Fire_Elemental( "P2000", "P2000 Fire Elemental", Material.INK_SACK, (byte) 6), - FAMAS_Pulse( "FAMAS", "FAMAS Pulse", Material.CLAY_BALL, (byte) 0), - M4A4_Howl( "M4A4", "M4A4 Howl", Material.INK_SACK, (byte) 11), - Steyr_AUG_Torque( "Steyr AUG", "Steyr AUG Torque", Material.BLAZE_ROD, (byte) 0), - Glock_18_Fade( "Glock 18", "Glock 18 Fade", Material.INK_SACK, (byte) 9), - Galil_AR_Eco( "Galil AR", "Galil AR Eco", Material.INK_SACK, (byte) 10), - AK_47_Vulcan( "AK-47", "AK-47 Vulcan", Material.INK_SACK, (byte) 7), - SG553_Pulse( "SG553", "SG553 Pulse", Material.INK_SACK, (byte) 5), + P250_Muertos( "P250", "P250 Muertos", Material.INK_SACK, (byte) 3), + CZ75_Auto_Tigris( "CZ75-Auto", "CZ75-Auto Tigris", Material.CLAY_BRICK, (byte) 0), + Desert_Eagle_Blaze( "Desert Eagle", "Desert Eagle Blaze", Material.NETHER_STALK, (byte) 0), + Desert_Eagle_Golden_Gun( "Desert Eagle", "Golden Gun", Material.GLOWSTONE_DUST, (byte) 0), + Nova_Koi( "Nova", "Nova Koi", Material.INK_SACK, (byte) 14), + XM1014_Tranquility( "XM1014", "XM1014 Tranquility", Material.DIAMOND, (byte) 0), + XM1014_Pig_Gun( "XM1014", "XM1014 Pig Gun", Material.LEATHER, (byte) 0), + PP_Bizon_Streak( "PP-Bizon", "PP-Bizon Streak", Material.INK_SACK, (byte) 4), + P90_Asiimov( "P90", "P90 Asiimov", Material.INK_SACK, (byte) 0), + SSG_08_Blood_in_the_Water( "SSG 08", "SSG 08 Blood in the Water", Material.INK_SACK, (byte) 12), + AWP_Asiimov( "AWP", "AWP Asiimov", Material.SULPHUR, (byte) 0), + P2000_Fire_Elemental( "P2000", "P2000 Fire Elemental", Material.INK_SACK, (byte) 6), + FAMAS_Pulse( "FAMAS", "FAMAS Pulse", Material.CLAY_BALL, (byte) 0), + M4A4_Howl( "M4A4", "M4A4 Howl", Material.INK_SACK, (byte) 11), + M4A4_Enderman( "M4A4", "Enderman M4", Material.COAL, (byte) 0), + Steyr_AUG_Torque( "Steyr AUG", "Steyr AUG Torque", Material.BLAZE_ROD, (byte) 0), + Glock_18_Fade( "Glock 18", "Glock 18 Fade", Material.INK_SACK, (byte) 9), + Galil_AR_Eco( "Galil AR", "Galil AR Eco", Material.INK_SACK, (byte) 10), + AK_47_Vulcan( "AK-47", "AK-47 Vulcan", Material.INK_SACK, (byte) 7), + AK_47_Guardian( "AK-47", "Guardian AK", Material.PRISMARINE_SHARD, (byte) 0), + SG553_Pulse( "SG553", "SG553 Pulse", Material.INK_SACK, (byte) 5), + - Knife_M9_Bayonette_Fade( "Knife", "M9 Bayonette Fade", Material.DIAMOND_SWORD, (byte) 0); + Knife_M9_Bayonette_Fade( "Knife", "M9 Bayonette Fade", Material.DIAMOND_SWORD, (byte) 0), + Knife_Counter_Terrorist_Sword("Knife", "Counter Terrorist Sword", Material.STICK, (byte) 0), + Knife_Terrorist_Sword( "Knife", "Terrorist Sword", Material.FEATHER, (byte) 0), + Knife_M9_Bayonette_Glass( "Knife", "Glass M9 Bayonette", Material.QUARTZ, (byte) 0); diff --git a/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/hat/HatItem.java b/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/hat/HatItem.java index daea695eb..186e19d8a 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/hat/HatItem.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/hat/HatItem.java @@ -2,8 +2,6 @@ package mineplex.core.gadget.gadgets.hat; import mineplex.core.gadget.GadgetManager; import mineplex.core.gadget.types.HatGadget; -import org.bukkit.Material; -import org.bukkit.inventory.ItemStack; public class HatItem extends HatGadget { @@ -13,14 +11,4 @@ public class HatItem extends HatGadget super(manager, hatType); } - public HatItem(GadgetManager manager, String name, String[] desc, int cost, Material material, byte data) - { - super(manager, name, desc, cost, new ItemStack(material, 1, data)); - } - - public HatItem(GadgetManager manager, String name, String[] desc, int cost, String playerName) - { - super(manager, name, desc, cost, playerName); - } - } diff --git a/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/item/ItemCoal.java b/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/item/ItemCoal.java index 8534e02e6..118f1b8b9 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/item/ItemCoal.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/item/ItemCoal.java @@ -21,9 +21,11 @@ import mineplex.core.common.util.UtilParticle; import mineplex.core.common.util.UtilParticle.ParticleType; import mineplex.core.common.util.UtilParticle.ViewDist; import mineplex.core.common.util.UtilPlayer; +import mineplex.core.common.util.UtilServer; import mineplex.core.common.util.UtilText; import mineplex.core.gadget.GadgetManager; import mineplex.core.gadget.event.ItemGadgetOutOfAmmoEvent; +import mineplex.core.gadget.event.PlayerUseCoalEvent; import mineplex.core.gadget.gadgets.Ammo; import mineplex.core.gadget.gadgets.hat.HatType; import mineplex.core.gadget.gadgets.particle.ParticleCoalFumes; @@ -105,7 +107,9 @@ public class ItemCoal extends ItemGadget Manager.getInventoryManager().addItemToInventory(player, getName(), -_hat); player.getInventory().setItem(Manager.getActiveItemSlot(), ItemStackFactory.Instance.CreateStack(getDisplayMaterial(), getDisplayData(), 1, F.item(Manager.getInventoryManager().Get(player).getItemCount(getName()) + " " + getName()))); - Manager.getDonationManager().Get(player).AddUnknownSalesPackagesOwned("Lump of Coal Hat"); + Manager.getDonationManager().Get(player).addOwnedUnknownSalesPackage("Lump of Coal Hat"); + + UtilServer.CallEvent(new PlayerUseCoalEvent(player, PlayerUseCoalEvent.CoalReward.HAT, _particle)); } else { @@ -118,7 +122,7 @@ public class ItemCoal extends ItemGadget } //Coal Apparition - if (!Manager.getPetManager().Get(player).getPets().containsKey(EntityType.PIG_ZOMBIE)) + if (!Manager.getPetManager().Get(player).getPets().containsKey(PetType.PIG_ZOMBIE)) { goal = _pet; @@ -147,7 +151,9 @@ public class ItemCoal extends ItemGadget Manager.getInventoryManager().addItemToInventory(player, getName(), -_pet); player.getInventory().setItem(Manager.getActiveItemSlot(), ItemStackFactory.Instance.CreateStack(getDisplayMaterial(), getDisplayData(), 1, F.item(Manager.getInventoryManager().Get(player).getItemCount(getName()) + " " + getName()))); - Manager.getDonationManager().Get(player).AddUnknownSalesPackagesOwned("Coal Apparition"); + Manager.getDonationManager().Get(player).addOwnedUnknownSalesPackage("Coal Apparition"); + + UtilServer.CallEvent(new PlayerUseCoalEvent(player, PlayerUseCoalEvent.CoalReward.PET, _particle)); } }); @@ -180,7 +186,9 @@ public class ItemCoal extends ItemGadget Manager.getInventoryManager().addItemToInventory(player, getName(), -_particle); player.getInventory().setItem(Manager.getActiveItemSlot(), ItemStackFactory.Instance.CreateStack(getDisplayMaterial(), getDisplayData(), 1, F.item(Manager.getInventoryManager().Get(player).getItemCount(getName()) + " " + getName()))); - Manager.getDonationManager().Get(player).AddUnknownSalesPackagesOwned("Coal Fumes"); + Manager.getDonationManager().Get(player).addOwnedUnknownSalesPackage("Coal Fumes"); + + UtilServer.CallEvent(new PlayerUseCoalEvent(player, PlayerUseCoalEvent.CoalReward.PARTICLE, _particle)); } else { diff --git a/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/item/ItemCoinBomb.java b/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/item/ItemCoinBomb.java index 7bebd373d..7334375b3 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/item/ItemCoinBomb.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/item/ItemCoinBomb.java @@ -16,6 +16,7 @@ import org.bukkit.event.player.PlayerPickupItemEvent; import org.bukkit.inventory.ItemStack; import org.bukkit.util.Vector; +import mineplex.core.common.currency.GlobalCurrency; import mineplex.core.common.util.C; import mineplex.core.common.util.LineFormat; import mineplex.core.common.util.UtilAction; @@ -34,14 +35,14 @@ public class ItemCoinBomb extends ItemGadget { private HashMap _active = new HashMap(); private HashSet _coins = new HashSet(); - + public ItemCoinBomb(GadgetManager manager) { - super(manager, "Treasure Party Bomb", - UtilText.splitLineToArray(C.cWhite + "It's party time! You'll be everyone's favourite player when you use one of these!", LineFormat.LORE), - -1, - Material.PRISMARINE, (byte)0, - 30000, new Ammo("Treasure Party Bomb", "1 Coin Party Bomb", Material.PRISMARINE, (byte)0, new String[] { C.cWhite + "1 Treasure Party Bomb" }, 2000, 1)); + super(manager, "Treasure Party Bomb", + UtilText.splitLineToArray(C.cWhite + "It's party time! You'll be everyone's favourite player when you use one of these!", LineFormat.LORE), + -1, + Material.PRISMARINE, (byte) 0, + 30000, new Ammo("Treasure Party Bomb", "1 Coin Party Bomb", Material.PRISMARINE, (byte) 0, new String[]{C.cWhite + "1 Treasure Party Bomb"}, 2000, 1)); } @Override @@ -50,20 +51,20 @@ public class ItemCoinBomb extends ItemGadget Item item = player.getWorld().dropItem(player.getEyeLocation().add(player.getLocation().getDirection()), new ItemStack(Material.PRISMARINE)); UtilAction.velocity(item, player.getLocation().getDirection(), 1, false, 0, 0.2, 1, false); _active.put(item, System.currentTimeMillis()); - + //Inform for (Player other : UtilServer.getPlayers()) UtilPlayer.message(other, C.cAqua + C.Bold + player.getName() + C.cWhite + C.Bold + " has thrown a " + C.cAqua + C.Bold + "Treasure Party Bomb" + C.cWhite + C.Bold + "!"); } - + @EventHandler public void Update(UpdateEvent event) { if (event.getType() != UpdateType.TICK) return; - + Iterator itemIterator = _active.keySet().iterator(); - + while (itemIterator.hasNext()) { Item item = itemIterator.next(); @@ -75,20 +76,20 @@ public class ItemCoinBomb extends ItemGadget UtilFirework.playFirework(item.getLocation(), FireworkEffect.builder().flicker(false).withColor(Color.AQUA).with(Type.BURST).trail(false).build()); else item.getWorld().playSound(item.getLocation(), Sound.FIREWORK_LAUNCH, 1f, 1f); - + Item coin = item.getWorld().dropItem(item.getLocation().add(0, 1, 0), new ItemStack(Material.PRISMARINE_SHARD)); - + //Velocity long passed = System.currentTimeMillis() - time; - Vector vel = new Vector(Math.sin(passed/300d), 0, Math.cos(passed/300d)); - - UtilAction.velocity(coin, vel, Math.abs(Math.sin(passed/3000d)), false, 0, 0.2 + Math.abs(Math.cos(passed/3000d))*0.8, 1, false); - + Vector vel = new Vector(Math.sin(passed / 300d), 0, Math.cos(passed / 300d)); + + UtilAction.velocity(coin, vel, Math.abs(Math.sin(passed / 3000d)), false, 0, 0.2 + Math.abs(Math.cos(passed / 3000d)) * 0.8, 1, false); + coin.setPickupDelay(40); - + _coins.add(coin); } - + if (UtilTime.elapsed(time, 23000)) { item.remove(); @@ -96,7 +97,7 @@ public class ItemCoinBomb extends ItemGadget } } } - + @EventHandler public void Pickup(PlayerPickupItemEvent event) { @@ -108,27 +109,27 @@ public class ItemCoinBomb extends ItemGadget { event.setCancelled(true); event.getItem().remove(); - - Manager.getDonationManager().RewardCoinsLater(getName() + " Pickup", event.getPlayer(), 4); - + + Manager.getDonationManager().rewardCurrency(GlobalCurrency.TREASURE_SHARD, event.getPlayer(), getName() + " Pickup", 4); + event.getPlayer().getWorld().playSound(event.getPlayer().getLocation(), Sound.ORB_PICKUP, 1f, 2f); - + //UtilPlayer.message(event.getPlayer(), C.cGreen + C.Bold + "+4 Gems"); } } - + @EventHandler public void Clean(UpdateEvent event) { if (event.getType() != UpdateType.FAST) return; - + Iterator coinIterator = _coins.iterator(); - + while (coinIterator.hasNext()) { Item coin = coinIterator.next(); - + if (!coin.isValid() || coin.getTicksLived() > 1200) { coin.remove(); diff --git a/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/item/ItemFleshHook.java b/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/item/ItemFleshHook.java index 01904e133..6c454ebff 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/item/ItemFleshHook.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/item/ItemFleshHook.java @@ -4,6 +4,7 @@ import org.bukkit.EntityEffect; import org.bukkit.Material; import org.bukkit.Sound; import org.bukkit.block.Block; +import org.bukkit.entity.ArmorStand; import org.bukkit.entity.Item; import org.bukkit.entity.LivingEntity; import org.bukkit.entity.Player; @@ -69,6 +70,9 @@ public class ItemFleshHook extends ItemGadget implements IThrown if (Manager.collideEvent(player, this, target)) return; + if (target instanceof ArmorStand) + return; + //Pull UtilAction.velocity(target, UtilAlg.getTrajectory(target.getLocation(), player.getLocation()), diff --git a/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/item/ItemFootball.java b/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/item/ItemFootball.java index a405ea02c..06a4178ff 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/item/ItemFootball.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/item/ItemFootball.java @@ -51,7 +51,7 @@ public class ItemFootball extends ItemGadget FallingBlock ball = player.getWorld().spawnFallingBlock(player.getLocation().add(0, 1, 0), Material.SKULL, (byte) 3); Bat bat = player.getWorld().spawn(player.getLocation(), Bat.class); - UtilEnt.Vegetate(bat); + UtilEnt.vegetate(bat); UtilEnt.ghost(bat, true, true); UtilEnt.silence(bat, true); diff --git a/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/item/ItemLovePotion.java b/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/item/ItemLovePotion.java index cea21e874..f2246773c 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/item/ItemLovePotion.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/item/ItemLovePotion.java @@ -22,10 +22,12 @@ import mineplex.core.common.util.UtilGear; import mineplex.core.common.util.UtilInv; import mineplex.core.common.util.UtilMath; import mineplex.core.common.util.UtilPlayer; +import mineplex.core.common.util.UtilServer; import mineplex.core.common.util.UtilText; import mineplex.core.gadget.GadgetManager; import mineplex.core.gadget.event.GadgetCollideEntityEvent; import mineplex.core.gadget.event.ItemGadgetOutOfAmmoEvent; +import mineplex.core.gadget.event.ItemGadgetUseEvent; import mineplex.core.gadget.gadgets.Ammo; import mineplex.core.gadget.types.GadgetType; import mineplex.core.gadget.types.ItemGadget; @@ -129,6 +131,9 @@ public class ItemLovePotion extends ItemGadget Recharge.Instance.use(player, getName(), getName(), _recharge, _recharge > 1000, true, false, true, "Cosmetics"); // Cooldown Manager.getInventoryManager().addItemToInventory(player, getName(), -1); + + ItemGadgetUseEvent itemGadgetUseEvent = new ItemGadgetUseEvent(player, this, 1); + UtilServer.CallEvent(itemGadgetUseEvent); player.getInventory().setItem(Manager.getActiveItemSlot(), new ItemBuilder(getDisplayMaterial(), getDisplayData()).setTitle(F.item(Manager.getInventoryManager().Get(player).getItemCount(getName()) + " " + getName())).setHideInfo(true).build()); } @@ -180,6 +185,9 @@ public class ItemLovePotion extends ItemGadget player.getInventory().setItem(Manager.getActiveItemSlot(), new ItemBuilder(getDisplayMaterial(), getDisplayData()).setTitle(F.item(Manager.getInventoryManager().Get(player).getItemCount(getName()) + " " + getName())).setHideInfo(true).build()); + ItemGadgetUseEvent itemGadgetUseEvent = new ItemGadgetUseEvent(player, this, 1); + UtilServer.CallEvent(itemGadgetUseEvent); + ActivateCustom(event.getPlayer()); } diff --git a/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/item/ItemMelonLauncher.java b/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/item/ItemMelonLauncher.java index ee0eea7f3..264118b41 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/item/ItemMelonLauncher.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/item/ItemMelonLauncher.java @@ -8,6 +8,7 @@ import org.bukkit.EntityEffect; import org.bukkit.Material; import org.bukkit.Sound; import org.bukkit.block.Block; +import org.bukkit.entity.ArmorStand; import org.bukkit.entity.Entity; import org.bukkit.entity.Item; import org.bukkit.entity.LivingEntity; @@ -25,8 +26,10 @@ import mineplex.core.common.util.UtilAction; import mineplex.core.common.util.UtilAlg; import mineplex.core.common.util.UtilMath; import mineplex.core.common.util.UtilPlayer; +import mineplex.core.common.util.UtilServer; import mineplex.core.common.util.UtilText; import mineplex.core.gadget.GadgetManager; +import mineplex.core.gadget.event.PlayerConsumeMelonEvent; import mineplex.core.gadget.gadgets.Ammo; import mineplex.core.gadget.types.ItemGadget; import mineplex.core.itemstack.ItemStackFactory; @@ -71,13 +74,16 @@ public class ItemMelonLauncher extends ItemGadget implements IThrown { if (target != null) { - //Push - UtilAction.velocity(target, - UtilAlg.getTrajectory2d(data.getThrown().getLocation(), target.getLocation()), - 1.4, false, 0, 0.8, 1.5, true); + if (!(target instanceof ArmorStand)) + { + //Push + UtilAction.velocity(target, + UtilAlg.getTrajectory2d(data.getThrown().getLocation(), target.getLocation()), + 1.4, false, 0, 0.8, 1.5, true); - //Effect - target.playEffect(EntityEffect.HURT); + //Effect + target.playEffect(EntityEffect.HURT); + } } smash(data.getThrown()); @@ -119,6 +125,8 @@ public class ItemMelonLauncher extends ItemGadget implements IThrown if (!_melon.remove(event.getItem())) return; + UtilServer.CallEvent(new PlayerConsumeMelonEvent(event.getPlayer())); + event.getItem().remove(); event.setCancelled(true); diff --git a/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/item/ItemSnowball.java b/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/item/ItemSnowball.java index fd6e988e8..ebca74d1f 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/item/ItemSnowball.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/item/ItemSnowball.java @@ -2,6 +2,7 @@ package mineplex.core.gadget.gadgets.item; import org.bukkit.Material; import org.bukkit.Sound; +import org.bukkit.entity.ArmorStand; import org.bukkit.entity.Player; import org.bukkit.entity.Snowball; import org.bukkit.event.EventHandler; @@ -56,6 +57,8 @@ public class ItemSnowball extends ItemGadget if(Manager.collideEvent(_snowballs.remove(ball), this, event.getEntity())) return; + if (event.getEntity() instanceof ArmorStand) + return; UtilAction.velocity(event.getEntity(), event.getDamager().getVelocity().normalize().add(new Vector(0,0.5,0)).multiply(0.5)); event.getDamager().getWorld().playSound(event.getDamager().getLocation(), Sound.STEP_SNOW, 1, 0.5f); diff --git a/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/morph/BlockForm.java b/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/morph/BlockForm.java index 94a9d55de..2b1c13ea3 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/morph/BlockForm.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/morph/BlockForm.java @@ -3,18 +3,10 @@ package mineplex.core.gadget.gadgets.morph; import java.util.ArrayList; import java.util.List; -import mineplex.core.common.util.F; -import mineplex.core.common.util.MapUtil; -import mineplex.core.common.util.UtilBlock; -import mineplex.core.common.util.UtilPlayer; -import mineplex.core.common.util.UtilServer; -import mineplex.core.disguise.disguises.DisguiseCat; -import mineplex.core.disguise.disguises.DisguiseChicken; -import mineplex.core.gadget.event.GadgetBlockEvent; -import mineplex.core.gadget.gadgets.morph.managers.UtilMorph; -import mineplex.core.itemstack.ItemStackFactory; -import mineplex.core.recharge.Recharge; import net.minecraft.server.v1_8_R3.Entity; +import net.minecraft.server.v1_8_R3.EntityArmorStand; +import net.minecraft.server.v1_8_R3.EntityPlayer; +import net.minecraft.server.v1_8_R3.IBlockData; import org.bukkit.Bukkit; import org.bukkit.Effect; @@ -23,100 +15,163 @@ import org.bukkit.Material; import org.bukkit.Sound; import org.bukkit.block.Block; import org.bukkit.block.BlockFace; +import org.bukkit.craftbukkit.v1_8_R3.CraftWorld; import org.bukkit.craftbukkit.v1_8_R3.entity.CraftEntity; -import org.bukkit.craftbukkit.v1_8_R3.entity.CraftFallingSand; -import org.bukkit.entity.FallingBlock; +import org.bukkit.craftbukkit.v1_8_R3.entity.CraftPlayer; +import org.bukkit.craftbukkit.v1_8_R3.util.CraftMagicNumbers; +import org.bukkit.entity.ArmorStand; import org.bukkit.entity.Player; +import org.bukkit.entity.Slime; + +import mineplex.core.common.util.F; +import mineplex.core.common.util.UtilBlock; +import mineplex.core.common.util.UtilEnt; +import mineplex.core.common.util.UtilPlayer; +import mineplex.core.common.util.UtilServer; +import mineplex.core.disguise.disguises.DisguiseBlock; +import mineplex.core.disguise.disguises.DisguiseSlime; +import mineplex.core.gadget.event.GadgetBlockEvent; +import mineplex.core.itemstack.ItemStackFactory; public class BlockForm { private MorphBlock _host; private Player _player; - private Material _mat; + private Material _blockMat; + private int _blockData; + private Block _block; private Location _loc; - public BlockForm(MorphBlock host, Player player, Material mat) + private Slime _fallingBlock; + private ArmorStand _fallingBlockBase; + + private DisguiseBlock _disguiseBlock; + private DisguiseSlime _disguiseBlockBase; + private DisguiseSlime _hiddenDisguise; + + private EntityPlayer _entityPlayer; + private Entity _nmsFallingBlockBase; + + public BlockForm(MorphBlock host, Player player, Material blockMat, int blockData) { _host = host; _player = player; - _mat = mat; + _blockMat = blockMat; + _blockData = blockData; + _loc = player.getLocation(); - Apply(); + _entityPlayer = ((CraftPlayer) player).getHandle(); + + _hiddenDisguise = new DisguiseSlime(player); + _hiddenDisguise.setInvisible(true); + + _host.Manager.getDisguiseManager().disguise(_hiddenDisguise); + + this._fallingBlock = _loc.getWorld().spawn(_loc, Slime.class); + this._fallingBlock.setSize(0); + this._fallingBlock.setRemoveWhenFarAway(false); + UtilEnt.vegetate(this._fallingBlock, true); + UtilEnt.ghost(this._fallingBlock, true, true); + + this._fallingBlockBase = (ArmorStand) new EntityArmorStand(((CraftWorld) this._loc.getWorld()).getHandle(), this._loc.getX(), this._loc.getY(), this._loc.getZ()).getBukkitEntity(); + this._fallingBlockBase.setGravity(false); + this._fallingBlockBase.setVisible(false); + this._fallingBlockBase.setRemoveWhenFarAway(false); + this._fallingBlockBase.setPassenger(this._fallingBlock); + + UtilEnt.addFlag(this._fallingBlock, UtilEnt.FLAG_NO_REMOVE); + UtilEnt.addFlag(this._fallingBlock, MorphBlock.FLAG_BLOCK_MORPH_COMPONENT); + UtilEnt.addFlag(this._fallingBlockBase, UtilEnt.FLAG_NO_REMOVE); + UtilEnt.addFlag(this._fallingBlockBase, MorphBlock.FLAG_BLOCK_MORPH_COMPONENT); + + _nmsFallingBlockBase = ((CraftEntity) _fallingBlockBase).getHandle(); + _disguiseBlockBase = new DisguiseSlime(_fallingBlockBase); + _disguiseBlockBase.SetSize(0); + _disguiseBlockBase.setInvisible(true); + _host.Manager.getDisguiseManager().disguise(_disguiseBlockBase); + + reset(); } - public void Apply() + private void createFallingBlock() { - // Remove Old - if (_player.getPassenger() != null) - { - Recharge.Instance.useForce(_player, "PassengerChange", 100); + removeFallingBlock(); - _player.getPassenger().remove(); - _player.eject(); + _disguiseBlock = new DisguiseBlock(_fallingBlock, _blockMat.getId(), _blockData); + _disguiseBlock.setHideIfNotDisguised(true); + _host.Manager.getDisguiseManager().disguise(_disguiseBlock); + + _fallingBlockBase.setPassenger(_fallingBlock); + } + + private void removeFallingBlock() + { + if (_disguiseBlock != null) + { + _host.Manager.getDisguiseManager().undisguise(_disguiseBlock); + _disguiseBlock = null; + _fallingBlockBase.setPassenger(null); + } + } + + private void reset() + { + removeSolidBlock(); + createFallingBlock(); + // Inform + + String name = ItemStackFactory.Instance.GetName(_blockMat, (byte) _blockData, false); + + if (!name.contains("Block")) + { + name = name + " Block"; } - ((CraftEntity) _player).getHandle().getDataWatcher().watch(0, Byte.valueOf((byte) 32), Entity.META_ENTITYDATA, (byte) 32); - - // Player > Chicken - DisguiseChicken disguise = new DisguiseChicken(_player); - disguise.setBaby(); - disguise.setSoundDisguise(new DisguiseCat(_player)); - disguise.setInvisible(true); - //_host.Manager.getDisguiseManager().disguise(disguise); - UtilMorph.disguise(_player, disguise, _host.Manager.getDisguiseManager()); - - // Apply Falling Block - FallingBlockCheck(); - - // Inform - String blockName = F.elem(ItemStackFactory.Instance.GetName(_mat, (byte) 0, false)); - if (!blockName.contains("Block")) - UtilPlayer - .message( - _player, - F.main("Morph", - "You are now a " - + F.elem(ItemStackFactory.Instance.GetName(_mat, (byte) 0, false) + " Block") + "!")); - else - UtilPlayer.message(_player, - F.main("Morph", "You are now a " + F.elem(ItemStackFactory.Instance.GetName(_mat, (byte) 0, false)) + "!")); + UtilPlayer.message(_player, F.main("Morph", "You are now " + F.vowelAN(name) + " " + F.elem(name) + "!")); // Sound _player.playSound(_player.getLocation(), Sound.ZOMBIE_UNFECT, 2f, 2f); } - public void Remove() + public void remove() { - SolidifyRemove(); + removeSolidBlock(); + removeFallingBlock(); - //_host.Manager.getDisguiseManager().undisguise(_player); - UtilMorph.undisguise(_player, _host.Manager.getDisguiseManager()); - - // Remove FB - if (_player.getPassenger() != null) - { - Recharge.Instance.useForce(_player, "PassengerChange", 100); - - _player.getPassenger().remove(); - _player.eject(); - } - - ((CraftEntity) _player).getHandle().getDataWatcher().watch(0, Byte.valueOf((byte) 0), Entity.META_ENTITYDATA, (byte) 0); + _host.Manager.getDisguiseManager().undisguise(_hiddenDisguise); + _host.Manager.getDisguiseManager().undisguise(_disguiseBlockBase); + _fallingBlockBase.remove(); + _fallingBlockBase = null; + _fallingBlock.remove(); + _fallingBlock = null; + _nmsFallingBlockBase = null; } - public void SolidifyUpdate() + public void update() { - if (!_player.isSprinting()) - ((CraftEntity) _player).getHandle().getDataWatcher() - .watch(0, Byte.valueOf((byte) 32), Entity.META_ENTITYDATA, (byte) 32); - // Not a Block if (_block == null) { + if (_fallingBlockBase.getPassenger() != _fallingBlock) + _fallingBlockBase.setPassenger(_fallingBlock); + + if (!_nmsFallingBlockBase.getBukkitEntity().getWorld().equals(_player.getWorld())) + _nmsFallingBlockBase.getBukkitEntity().teleport(_player); + else + { + _nmsFallingBlockBase.locX = _entityPlayer.locX; + _nmsFallingBlockBase.locY = _entityPlayer.locY; + _nmsFallingBlockBase.locZ = _entityPlayer.locZ; + _nmsFallingBlockBase.motX = _entityPlayer.motX; + _nmsFallingBlockBase.motY = _entityPlayer.motY; + _nmsFallingBlockBase.motZ = _entityPlayer.motZ; + _nmsFallingBlockBase.velocityChanged = true; + } + // Moved if (!_loc.getBlock().equals(_player.getLocation().getBlock())) { @@ -135,7 +190,7 @@ public class BlockForm { Block block = _player.getLocation().getBlock(); - List blockList = new ArrayList(); + List blockList = new ArrayList<>(); blockList.add(block); GadgetBlockEvent event = new GadgetBlockEvent(_host, blockList); @@ -155,17 +210,18 @@ public class BlockForm _block = block; // Effect - _player.playEffect(_player.getLocation(), Effect.STEP_SOUND, _mat); - // block.getWorld().playEffect(block.getLocation(), Effect.STEP_SOUND, _mat); + _player.playEffect(_block.getLocation(), Effect.STEP_SOUND, _blockMat); + + removeFallingBlock(); // Display - SolidifyVisual(); - - // Invisible - // Host.Manager.GetCondition().Factory().Cloak("Disguised as Block", Player, Player, 60000, false, false); + for (Player other : UtilServer.getPlayers()) + { + other.sendBlockChange(_block.getLocation(), _blockMat, (byte) _blockData); + } // Sound - _player.playSound(_player.getLocation(), Sound.NOTE_PLING, 1f, 2f); + _player.playSound(_block.getLocation(), Sound.NOTE_PLING, 1f, 2f); } } } @@ -175,93 +231,60 @@ public class BlockForm // Moved if (!_loc.getBlock().equals(_player.getLocation().getBlock())) { - SolidifyRemove(); - } - // Send Packets - else - { - SolidifyVisual(); + removeSolidBlock(); + createFallingBlock(); } } } - public void SolidifyRemove() + private void removeSolidBlock() { if (_block != null) { - MapUtil.QuickChangeBlockAt(_block.getLocation(), 0, (byte) 0); + Location location = _block.getLocation(); _block = null; + + for (Player other : UtilServer.getPlayers()) + { + other.sendBlockChange(location, 0, (byte) 0); + } + + _player.setExp(0f); + + // Inform + _player.playSound(_player.getLocation(), Sound.NOTE_PLING, 1f, 0.5f); } - - _player.setExp(0f); - - // Host.Manager.GetCondition().EndCondition(Player, null, "Disguised as Block"); - - // Inform - _player.playSound(_player.getLocation(), Sound.NOTE_PLING, 1f, 0.5f); - - FallingBlockCheck(); } - @SuppressWarnings("deprecation") - public void SolidifyVisual() + public void setType(Block block) { - if (_block == null) + if (block == null) return; - // Remove Old - if (_player.getPassenger() != null) - { - Recharge.Instance.useForce(_player, "PassengerChange", 100); - - _player.getPassenger().remove(); - _player.eject(); - } - - // Others - for (Player other : UtilServer.getPlayers()) - other.sendBlockChange(_player.getLocation(), _mat, (byte) 0); - - // Self - _player.sendBlockChange(_player.getLocation(), 36, (byte) 0); - - FallingBlockCheck(); - } - - public void FallingBlockCheck() - { - // Block Form (Hide Falling) - if (_block != null) + if (block.getType() == Material.AIR) return; - // Recreate Falling - if (_player.getPassenger() == null || !_player.getPassenger().isValid()) - { - if (!Recharge.Instance.use(_player, "PassengerChange", 100, false, false)) - return; + if (_blockMat == block.getType() && _blockData == block.getData()) + return; - // Falling Block - FallingBlock block = _player.getWorld().spawnFallingBlock(_player.getEyeLocation(), _mat, (byte) 0); - - // No Arrow Collision - ((CraftFallingSand) block).getHandle().spectating = true; - - _player.setPassenger(block); - - _host.fallingBlockRegister(block); - } - - // Ensure Falling doesnt Despawn - else - { - ((CraftFallingSand) _player.getPassenger()).getHandle().ticksLived = 1; - _player.getPassenger().setTicksLived(1); - } + _blockMat = block.getType(); + _blockData = block.getData(); + reset(); } - public Block GetBlock() + public Block getBlock() { return _block; } + + public IBlockData getBlockData() + { + return CraftMagicNumbers.getBlock(_blockMat).fromLegacyData(_blockData); + } + + public Player getPlayer() + { + return this._player; + } } diff --git a/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/morph/MorphBlaze.java b/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/morph/MorphBlaze.java index c7f1f5b01..abd40e459 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/morph/MorphBlaze.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/morph/MorphBlaze.java @@ -83,7 +83,7 @@ public class MorphBlaze extends MorphGadget { if (Manager.getClientManager().Get(event.getPlayer()).GetRank().has(Rank.HERO)) { - Manager.getDonationManager().Get(event.getPlayer()).AddUnknownSalesPackagesOwned(getName()); + Manager.getDonationManager().Get(event.getPlayer()).addOwnedUnknownSalesPackage(getName()); } } } diff --git a/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/morph/MorphBlock.java b/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/morph/MorphBlock.java index 5847c76e3..eab479203 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/morph/MorphBlock.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/morph/MorphBlock.java @@ -1,48 +1,54 @@ package mineplex.core.gadget.gadgets.morph; - import java.util.HashMap; -import java.util.HashSet; -import java.util.Iterator; +import java.util.Map; +import net.minecraft.server.v1_8_R3.Blocks; +import net.minecraft.server.v1_8_R3.PacketPlayInBlockDig; +import net.minecraft.server.v1_8_R3.PacketPlayOutBlockChange; + +import org.bukkit.Location; import org.bukkit.Material; -import org.bukkit.entity.FallingBlock; import org.bukkit.entity.Player; import org.bukkit.event.EventHandler; -import org.bukkit.event.entity.EntityChangeBlockEvent; -import org.bukkit.event.entity.ItemSpawnEvent; +import org.bukkit.event.entity.EntityDamageEvent; import org.bukkit.event.player.PlayerInteractEvent; import mineplex.core.common.util.C; import mineplex.core.common.util.LineFormat; -import mineplex.core.common.util.UtilBlock; +import mineplex.core.common.util.UtilEnt; import mineplex.core.common.util.UtilEvent; -import mineplex.core.common.util.UtilMath; -import mineplex.core.common.util.UtilText; import mineplex.core.common.util.UtilEvent.ActionType; -import mineplex.core.event.StackerEvent; +import mineplex.core.common.util.UtilText; import mineplex.core.gadget.GadgetManager; import mineplex.core.gadget.types.MorphGadget; +import mineplex.core.packethandler.IPacketHandler; +import mineplex.core.packethandler.PacketInfo; import mineplex.core.recharge.Recharge; import mineplex.core.updater.UpdateType; -import mineplex.core.updater.event.UpdateEvent; +import mineplex.core.utils.UtilScheduler; + +public class MorphBlock extends MorphGadget implements IPacketHandler +{ + public static final String FLAG_BLOCK_MORPH_COMPONENT = "block-morph-component"; + + private Map _active = new HashMap<>(); -public class MorphBlock extends MorphGadget -{ - private HashMap _active = new HashMap(); - private HashSet _blocks = new HashSet(); - public MorphBlock(GadgetManager manager) { - super(manager, "Block Morph", UtilText.splitLinesToArray(new String[] - { - C.cGray + "The blockiest block that ever blocked.", - C.blankLine, - "#" + C.cWhite + "Left Click to use Change Block", - "#" + C.cWhite + "Stay Still to use Solidify", - }, LineFormat.LORE), + super(manager, "Block Morph", UtilText.splitLinesToArray(new String[] + { + C.cGray + "The blockiest block that ever blocked.", + C.blankLine, + "#" + C.cWhite + "Left Click to use Change Block", + "#" + C.cWhite + "Stay Still to use Solidify", + }, LineFormat.LORE), 30000, - Material.EMERALD_BLOCK, (byte)0); + Material.EMERALD_BLOCK, (byte) 0); + + UtilScheduler.runEvery(UpdateType.TICK, () -> _active.values().forEach(BlockForm::update)); + + manager.getPacketManager().addPacketHandler(this, PacketPlayOutBlockChange.class, PacketPlayInBlockDig.class); } @Override @@ -50,7 +56,7 @@ public class MorphBlock extends MorphGadget { this.applyArmor(player, message); - _active.put(player, new BlockForm(this, player, Material.EMERALD_BLOCK)); + _active.put(player, new BlockForm(this, player, Material.EMERALD_BLOCK, 0)); } @Override @@ -58,108 +64,86 @@ public class MorphBlock extends MorphGadget { this.removeArmor(player); - BlockForm form = _active.remove(player); if (form != null) { - form.Remove(); + form.remove(); } } - - @EventHandler - public void formUpdate(UpdateEvent event) - { - if (event.getType() != UpdateType.TICK) - return; - - for (BlockForm form : _active.values()) - { - form.SolidifyUpdate(); - form.FallingBlockCheck(); - } - } - + @EventHandler public void formChange(PlayerInteractEvent event) { if (event.getClickedBlock() == null) return; - + if (!UtilEvent.isAction(event, ActionType.L_BLOCK) && !UtilEvent.isAction(event, ActionType.R_BLOCK)) return; - - if (!UtilBlock.solid(event.getClickedBlock())) - return; - + if (!Recharge.Instance.use(event.getPlayer(), getName(), 500, false, false)) return; - + BlockForm form = _active.get(event.getPlayer()); - + if (form == null) return; - - form.Remove(); - - _active.put(event.getPlayer(), new BlockForm(this, event.getPlayer(), event.getClickedBlock().getType())); + + form.setType(event.getClickedBlock()); } - + @EventHandler - public void stacker(StackerEvent event) + public void onDamage(EntityDamageEvent event) { - if (_active.containsKey(event.getEntity())) - event.setCancelled(true); - } - - public void fallingBlockRegister(FallingBlock block) - { - _blocks.add(block); - } - - @EventHandler - public void fallingBlockForm(EntityChangeBlockEvent event) - { - if (_blocks.remove(event.getEntity())) + if (UtilEnt.hasFlag(event.getEntity(), FLAG_BLOCK_MORPH_COMPONENT)) { - event.getEntity().remove(); event.setCancelled(true); } } - - @EventHandler - public void fallingBlockClean(UpdateEvent event) + + @Override + public void handle(PacketInfo packetInfo) { - if (event.getType() != UpdateType.SEC) - return; - - Iterator blockIterator = _blocks.iterator(); - - while (blockIterator.hasNext()) + if (packetInfo.getPacket() instanceof PacketPlayOutBlockChange) { - FallingBlock block = blockIterator.next(); - - if (!block.isValid() || block.getVehicle() == null) + PacketPlayOutBlockChange packet = (PacketPlayOutBlockChange) packetInfo.getPacket(); + + for (BlockForm form : _active.values()) { - block.remove(); - blockIterator.remove(); + if (form.getBlock() == null) + continue; + + Location location = form.getBlock().getLocation(); + if (packetInfo.getPlayer().getWorld() == location.getWorld() && packet.a.getX() == location.getX() && packet.a.getY() == location.getY() && packet.a.getZ() == location.getZ()) + { + if (packetInfo.getPlayer() == form.getPlayer()) + { + packet.block = Blocks.AIR.getBlockData(); + } + else + { + packet.block = form.getBlockData(); + } + } } } - } - - @EventHandler - public void itemSpawnCancel(ItemSpawnEvent event) - { - Iterator blockIterator = _blocks.iterator(); - - while (blockIterator.hasNext()) + else if (packetInfo.getPacket() instanceof PacketPlayInBlockDig) { - FallingBlock block = blockIterator.next(); - - if (UtilMath.offset(block, event.getEntity()) < 0.1) + PacketPlayInBlockDig packet = (PacketPlayInBlockDig) packetInfo.getPacket(); + + if (packet.c != PacketPlayInBlockDig.EnumPlayerDigType.STOP_DESTROY_BLOCK) + return; + + for (BlockForm form : _active.values()) { - block.remove(); - blockIterator.remove(); - event.setCancelled(true); + if (form.getBlock() == null) + continue; + + Location location = form.getBlock().getLocation(); + if (packetInfo.getPlayer().getWorld() == location.getWorld() && packet.a.getX() == location.getX() && packet.a.getY() == location.getY() && packet.a.getZ() == location.getZ()) + { + packetInfo.setCancelled(true); + packetInfo.getPlayer().sendBlockChange(location, 0, (byte) 0); + } } } } diff --git a/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/morph/MorphBunny.java b/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/morph/MorphBunny.java index 7516326f1..ef51b27f4 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/morph/MorphBunny.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/morph/MorphBunny.java @@ -46,23 +46,23 @@ import mineplex.core.updater.UpdateType; import mineplex.core.updater.event.UpdateEvent; public class MorphBunny extends MorphGadget -{ +{ private HashSet _jumpCharge = new HashSet(); private HashMap _eggs = new HashMap(); - + public MorphBunny(GadgetManager manager) { - super(manager, "Easter Bunny Morph", UtilText.splitLinesToArray(new String[] - { - C.cGray + "Happy Easter!", - C.blankLine, - "#" + C.cWhite + "Charge Crouch to use Super Jump", - "#" + C.cWhite + "Left Click to use Hide Easter Egg", - C.blankLine, - "#" + C.cRed +C.Bold + "WARNING: " + ChatColor.RESET + "Hide Easter Egg uses 500 Shards" , - }, LineFormat.LORE), + super(manager, "Easter Bunny Morph", UtilText.splitLinesToArray(new String[] + { + C.cGray + "Happy Easter!", + C.blankLine, + "#" + C.cWhite + "Charge Crouch to use Super Jump", + "#" + C.cWhite + "Left Click to use Hide Easter Egg", + C.blankLine, + "#" + C.cRed + C.Bold + "WARNING: " + ChatColor.RESET + "Hide Easter Egg uses 500 Shards", + }, LineFormat.LORE), -5, - Material.MONSTER_EGG, (byte)98); + Material.MONSTER_EGG, (byte) 98); } @Override @@ -86,17 +86,17 @@ public class MorphBunny extends MorphGadget player.removePotionEffect(PotionEffectType.SPEED); player.removePotionEffect(PotionEffectType.JUMP); - + } - + @EventHandler public void jumpTrigger(PlayerToggleSneakEvent event) { Player player = event.getPlayer(); - + if (!isActive(player)) return; - + //Start if (!event.getPlayer().isSneaking()) { @@ -108,13 +108,13 @@ public class MorphBunny extends MorphGadget { float power = player.getExp(); player.setExp(0f); - + UtilAction.velocity(player, power * 4, 0.4, 4, true); - + player.getWorld().playSound(player.getLocation(), Sound.CAT_HIT, 0.75f, 2f); } } - + @EventHandler public void jumpBoost(UpdateEvent event) { @@ -122,23 +122,23 @@ public class MorphBunny extends MorphGadget return; Iterator jumpIter = _jumpCharge.iterator(); - + while (jumpIter.hasNext()) { Player player = jumpIter.next(); - + if (!player.isValid() || !player.isOnline() || !player.isSneaking()) { jumpIter.remove(); continue; } - + player.setExp(Math.min(0.9999f, player.getExp() + 0.03f)); - + player.playSound(player.getLocation(), Sound.FIZZ, 0.25f + player.getExp() * 0.5f, 0.5f + player.getExp()); } } - + @EventHandler public void eggHide(PlayerInteractEvent event) { @@ -155,85 +155,85 @@ public class MorphBunny extends MorphGadget UtilPlayer.message(player, F.main("Gadget", "You do not have enough Shards.")); return; } - + if (!Recharge.Instance.use(player, "Hide Egg", 30000, true, false)) return; - + //Color - - + + //Item - ItemStack eggStack = ItemStackFactory.Instance.CreateStack(Material.MONSTER_EGG, (byte)0, 1, "Hidden Egg" + System.currentTimeMillis()); + ItemStack eggStack = ItemStackFactory.Instance.CreateStack(Material.MONSTER_EGG, (byte) 0, 1, "Hidden Egg" + System.currentTimeMillis()); eggStack.setDurability((short) 98); - + Item egg = player.getWorld().dropItem(player.getEyeLocation().add(player.getLocation().getDirection()), eggStack); UtilAction.velocity(egg, player.getLocation().getDirection(), 0.2, false, 0, 0.2, 1, false); - - Manager.getDonationManager().RewardCoinsLater(this.getName() + " Egg Hide", player, -500); - + + Manager.getDonationManager().rewardCurrency(GlobalCurrency.TREASURE_SHARD, player, this.getName() + " Egg Hide", -500); + egg.setPickupDelay(40); - + _eggs.put(egg, player.getName()); - + //Announce - Bukkit.broadcastMessage(C.cYellow + C.Bold + player.getName() + + Bukkit.broadcastMessage(C.cYellow + C.Bold + player.getName() + ChatColor.RESET + C.Bold + " hid an " + C.cYellow + C.Bold + "Easter Egg" + ChatColor.RESET + C.Bold + " worth " + C.cYellow + C.Bold + "450 Shards"); - + for (Player other : UtilServer.getPlayers()) other.playSound(other.getLocation(), Sound.CAT_HIT, 1.5f, 1.5f); } - + @EventHandler public void eggPickup(PlayerPickupItemEvent event) { if (_eggs.containsKey(event.getItem()) && !_eggs.get(event.getItem()).equals(event.getPlayer().getName())) { _eggs.remove(event.getItem()); - + event.setCancelled(true); event.getItem().remove(); - - Manager.getDonationManager().RewardCoinsLater(getName() + " Egg Pickup", event.getPlayer(), 450); - + + Manager.getDonationManager().rewardCurrency(GlobalCurrency.TREASURE_SHARD, event.getPlayer(), getName() + " Egg Pickup", 450); + event.getPlayer().getWorld().playSound(event.getPlayer().getLocation(), Sound.ORB_PICKUP, 1.5f, 0.75f); event.getPlayer().getWorld().playSound(event.getPlayer().getLocation(), Sound.ORB_PICKUP, 1.5f, 1.25f); - + UtilFirework.playFirework(event.getItem().getLocation(), Type.BURST, Color.YELLOW, true, true); - + //Announce - Bukkit.broadcastMessage(C.cGold + C.Bold + event.getPlayer().getName() + + Bukkit.broadcastMessage(C.cGold + C.Bold + event.getPlayer().getName() + ChatColor.RESET + C.Bold + " found an " + C.cGold + C.Bold + "Easter Egg" + ChatColor.RESET + C.Bold + "! " + _eggs.size() + " Eggs left!"); - } + } } - + @EventHandler public void eggClean(UpdateEvent event) { if (event.getType() != UpdateType.FAST) return; - + Iterator eggIter = _eggs.keySet().iterator(); - + while (eggIter.hasNext()) { Item egg = eggIter.next(); - + if (!egg.isValid() || egg.getTicksLived() > 24000) { egg.remove(); eggIter.remove(); - + //Announce Bukkit.broadcastMessage( ChatColor.RESET + C.Bold + "No one found an " + - C.cGold + C.Bold + "Easter Egg" + - ChatColor.RESET + C.Bold + "! " + _eggs.size() + " Eggs left!"); + C.cGold + C.Bold + "Easter Egg" + + ChatColor.RESET + C.Bold + "! " + _eggs.size() + " Eggs left!"); } else { @@ -242,7 +242,7 @@ public class MorphBunny extends MorphGadget } } } - + @EventHandler public void eggDespawnCancel(ItemDespawnEvent event) { diff --git a/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/morph/MorphChristmasKing.java b/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/morph/MorphChristmasKing.java new file mode 100644 index 000000000..24803972f --- /dev/null +++ b/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/morph/MorphChristmasKing.java @@ -0,0 +1,171 @@ +package mineplex.core.gadget.gadgets.morph; + +import java.util.Map; +import java.util.WeakHashMap; + +import org.bukkit.Location; +import org.bukkit.Material; +import org.bukkit.Sound; +import org.bukkit.entity.Player; +import org.bukkit.entity.Projectile; +import org.bukkit.entity.Skeleton.SkeletonType; +import org.bukkit.entity.Snowball; +import org.bukkit.event.EventHandler; +import org.bukkit.event.entity.EntityDamageByEntityEvent; +import org.bukkit.event.player.PlayerToggleSneakEvent; +import org.bukkit.inventory.ItemStack; +import org.bukkit.util.Vector; + +import mineplex.core.common.util.C; +import mineplex.core.common.util.F; +import mineplex.core.common.util.LineFormat; +import mineplex.core.common.util.NautHashMap; +import mineplex.core.common.util.UtilAction; +import mineplex.core.common.util.UtilMath; +import mineplex.core.common.util.UtilParticle; +import mineplex.core.common.util.UtilParticle.ParticleType; +import mineplex.core.common.util.UtilParticle.ViewDist; +import mineplex.core.common.util.UtilServer; +import mineplex.core.common.util.UtilText; +import mineplex.core.disguise.disguises.DisguiseSkeleton; +import mineplex.core.gadget.GadgetManager; +import mineplex.core.gadget.gadgets.morph.managers.UtilMorph; +import mineplex.core.gadget.types.MorphGadget; +import mineplex.core.recharge.Recharge; +import mineplex.core.recharge.RechargeData; +import mineplex.core.updater.UpdateType; +import mineplex.core.updater.event.UpdateEvent; +import mineplex.core.visibility.VisibilityManager; + +public class MorphChristmasKing extends MorphGadget +{ + private Map _snowball = new WeakHashMap(); + + public MorphChristmasKing(GadgetManager manager) + { + super(manager, "Christmas Kings Head", UtilText.splitLinesToArray(new String[] + { + C.cGray + "Transforms the wearer into the", + C.cGray + "Pumpkin King's not so jolly Winter Form!", + "", + C.cBlue + "Earned by defeating the Pumpkin King", + C.cBlue + "in the 2016 Christmas Chaos Event", + C.blankLine, + "#" + C.cWhite + "Sneak to use Snowstorm" + }, LineFormat.LORE), + -1, + Material.PUMPKIN, (byte)0); + + } + + @Override + public void enableCustom(final Player player, boolean message) + { + this.applyArmor(player, message); + + DisguiseSkeleton disguise = new DisguiseSkeleton(player); + disguise.showArmor(); + disguise.SetSkeletonType(SkeletonType.WITHER); + UtilMorph.disguise(player, disguise, Manager); + + player.getInventory().setHelmet(new ItemStack(Material.JACK_O_LANTERN)); + + VisibilityManager.Instance.setVisibility(player, false, UtilServer.getPlayers()); + VisibilityManager.Instance.setVisibility(player, true, UtilServer.getPlayers()); + } + + @Override + public void disableCustom(Player player, boolean message) + { + this.removeArmor(player); + UtilMorph.undisguise(player, Manager.getDisguiseManager()); + player.getInventory().setHelmet(null); + } + + @EventHandler + public void onUpdate(UpdateEvent event) + { + if (event.getType() == UpdateType.FASTEST) + { + for (Player player : getActive()) + { + NautHashMap map = Recharge.Instance.Get(player); + if (map == null) + continue; + + RechargeData data = map.get("Snowstorm"); + if (data == null) + continue; + if (data.GetRemaining() < 25000) + continue; + + for (int i = 0; i < 6; i++) + { + Snowball snow = player.getWorld().spawn(player.getEyeLocation().add(player.getLocation().getDirection()), Snowball.class); + double x = 0.1 - (UtilMath.r(20)/100d); + double y = UtilMath.r(20)/100d; + double z = 0.1 - (UtilMath.r(20)/100d); + snow.setShooter(player); + snow.setVelocity(player.getLocation().getDirection().add(new Vector(x,y,z)).multiply(2)); + _snowball.put(snow, player); + } + + //Effect + player.getWorld().playSound(player.getLocation(), Sound.STEP_SNOW, 0.2f, 0.5f); + } + } + + if (event.getType() == UpdateType.TICK) + { + for (Player player : getActive()) + { + if (Manager.isMoving(player)) + { + continue; + } + for (double y = 0; y < 5; y++) + { + double sin = Math.sin(y); + double cos = Math.cos(y); + + Location loc1 = player.getLocation().add(sin, y, cos); + Location loc2 = player.getLocation().add(cos, y, sin); + UtilParticle.PlayParticleToAll(ParticleType.SNOWBALL_POOF, loc1, null, 0, 1, ViewDist.NORMAL); + UtilParticle.PlayParticleToAll(ParticleType.SNOWBALL_POOF, loc2, null, 0, 1, ViewDist.NORMAL); + } + } + } + } + + @EventHandler + public void onSneak(PlayerToggleSneakEvent event) + { + if (!isActive(event.getPlayer())) + return; + + if (!event.isSneaking()) + return; + + if (Recharge.Instance.use(event.getPlayer(), "Snowstorm", 30000, true, true)) + { + event.getPlayer().sendMessage(F.main("Recharge", "You used " + F.skill("Snowstorm") + ".")); + } + } + + @EventHandler + public void onSnowballHit(EntityDamageByEntityEvent event) + { + if (!(event.getDamager() instanceof Snowball)) + return; + + Snowball proj = (Snowball) event.getDamager(); + + if (!_snowball.containsKey(proj)) + return; + + if (Manager.collideEvent(_snowball.remove(proj), this, event.getEntity())) + return; + + UtilAction.velocity(event.getEntity(), proj.getVelocity().multiply(0.15).add(new Vector(0, 0.15, 0))); + } +} \ No newline at end of file diff --git a/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/morph/MorphCreeper.java b/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/morph/MorphCreeper.java index 13f6a91b4..bcce06361 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/morph/MorphCreeper.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/morph/MorphCreeper.java @@ -170,7 +170,7 @@ public class MorphCreeper extends MorphGadget { if (Manager.getClientManager().Get(event.getPlayer()).GetRank().has(Rank.HERO)) { - Manager.getDonationManager().Get(event.getPlayer()).AddUnknownSalesPackagesOwned(getName()); + Manager.getDonationManager().Get(event.getPlayer()).addOwnedUnknownSalesPackage(getName()); } } diff --git a/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/morph/MorphDinnerbone.java b/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/morph/MorphDinnerbone.java new file mode 100644 index 000000000..ba67af21c --- /dev/null +++ b/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/morph/MorphDinnerbone.java @@ -0,0 +1,328 @@ +package mineplex.core.gadget.gadgets.morph; + +import java.time.Month; +import java.time.YearMonth; +import java.util.Arrays; +import java.util.HashMap; +import java.util.List; +import java.util.Map; +import java.util.UUID; + +import net.minecraft.server.v1_8_R3.DataWatcher; +import net.minecraft.server.v1_8_R3.EntityArmorStand; +import net.minecraft.server.v1_8_R3.EntitySlime; +import net.minecraft.server.v1_8_R3.MathHelper; +import net.minecraft.server.v1_8_R3.PacketPlayOutAttachEntity; +import net.minecraft.server.v1_8_R3.PacketPlayOutEntityDestroy; +import net.minecraft.server.v1_8_R3.PacketPlayOutNamedEntitySpawn; +import net.minecraft.server.v1_8_R3.PacketPlayOutNewAttachEntity; +import net.minecraft.server.v1_8_R3.PacketPlayOutSpawnEntityLiving; +import net.minecraft.server.v1_8_R3.World; + +import org.bukkit.ChatColor; +import org.bukkit.Material; +import org.bukkit.craftbukkit.v1_8_R3.CraftWorld; +import org.bukkit.craftbukkit.v1_8_R3.entity.CraftPlayer; +import org.bukkit.entity.Entity; +import org.bukkit.entity.EntityType; +import org.bukkit.entity.Player; + +import com.mojang.authlib.GameProfile; + +import mineplex.core.Managers; +import mineplex.core.account.CoreClientManager; +import mineplex.core.common.DummyEntity; +import mineplex.core.common.Rank; +import mineplex.core.common.skin.SkinData; +import mineplex.core.common.util.C; +import mineplex.core.common.util.LineFormat; +import mineplex.core.common.util.UtilEnt; +import mineplex.core.common.util.UtilPlayer; +import mineplex.core.common.util.UtilText; +import mineplex.core.disguise.disguises.DisguisePlayer; +import mineplex.core.gadget.GadgetManager; +import mineplex.core.gadget.gadgets.morph.managers.UtilMorph; +import mineplex.core.gadget.types.GadgetType; +import mineplex.core.gadget.types.MorphGadget; +import mineplex.core.packethandler.IPacketHandler; +import mineplex.core.packethandler.PacketHandler; +import mineplex.core.packethandler.PacketInfo; +import mineplex.core.utils.UtilGameProfile; + +import static mineplex.core.common.util.UtilServer.runSync; + +public class MorphDinnerbone extends MorphGadget implements IPacketHandler +{ + private static final String NAME = "Dinnerbone"; + + private final CoreClientManager _coreClientManager = Managers.require(CoreClientManager.class); + + // Maps player to map of player and the id for the armorstand nametag + private final Map> _armorStandIds = new HashMap<>(); + // Maps player to map of player and all ids that it owns + private final Map>> _allIds = new HashMap<>(); + + public MorphDinnerbone(GadgetManager manager) + { + super(manager, "Over Easy Morph", UtilText.splitLinesToArray(new String[]{ + C.cGray + "This morph lets you walk around on your head. But be careful, all the blood might go to your head!", + }, LineFormat.LORE), + -14, Material.EGG, (byte) 0, YearMonth.of(2017, Month.JANUARY)); + + Managers.require(PacketHandler.class).addPacketHandler(this, PacketHandler.ListenerPriority.LOW, PacketPlayOutNamedEntitySpawn.class, PacketPlayOutEntityDestroy.class); + } + + @Override + public void enableCustom(Player player, boolean message) + { + applyArmor(player, message); + + GameProfile profile = UtilGameProfile.getGameProfile(player); + try + { + UtilGameProfile.changeName(profile, "Dinnerbone"); + } + catch (ReflectiveOperationException e) + { + // Literally should never happen + e.printStackTrace(); + } + + DisguisePlayer disguisePlayer = new DisguisePlayer(player, profile); + disguisePlayer.setSendSkinDataToSelf(false); + disguisePlayer.setReplaceOriginalName(false, 10); + disguisePlayer.showInTabList(true, 0); + UtilMorph.disguise(player, disguisePlayer, Manager); + } + + @Override + public void disableCustom(Player player, boolean message) + { + removeArmor(player); + + UtilMorph.undisguise(player, Manager.getDisguiseManager()); + } + + @Override + public void handle(PacketInfo packetInfo) + { + if (packetInfo.isCancelled()) + return; + + if (packetInfo.getPacket() instanceof PacketPlayOutNamedEntitySpawn) + { + PacketPlayOutNamedEntitySpawn packet = (PacketPlayOutNamedEntitySpawn) packetInfo.getPacket(); + Entity entity = UtilEnt.getEntityById(packet.a); + + if (!(entity instanceof Player)) + { + return; + } + + Player owner = (Player) entity; + if (Manager.getActive(owner, GadgetType.MORPH) == this) + { + summonForEntity(packetInfo.getPlayer(), owner); + } + } + else if (packetInfo.getPacket() instanceof PacketPlayOutEntityDestroy) + { + PacketPlayOutEntityDestroy packet = (PacketPlayOutEntityDestroy) packetInfo.getPacket(); + for (int id : packet.a) + { + destroyForEntity(packetInfo.getPlayer(), id); + } + } + } + + private void summonForEntity(Player receiver, Player player) + { + switch (UtilPlayer.getVersion(receiver)) + { + case Version1_9: + summonForEntity19(receiver, player); + break; + case Version1_8: + summonForEntity18(receiver, player); + break; + case ALL: + // do nothing + break; + } + } + + private void summonForEntity19(Player receiver, Player player) + { + World world = ((CraftWorld) receiver.getWorld()).getHandle(); + + DataWatcher armorStandWatcher = getArmorStandWatcher(player); + armorStandWatcher.a(10, (byte) 0x10, EntityArmorStand.META_ARMOR_OPTION, (byte) 0x10); // Small + + DataWatcher squidWatcher = new DataWatcher(new DummyEntity(world)); + squidWatcher.a(0, (byte) 0x20, net.minecraft.server.v1_8_R3.Entity.META_ENTITYDATA, (byte) 0x20); + + PacketPlayOutSpawnEntityLiving spawnSquid = new PacketPlayOutSpawnEntityLiving(); + spawnSquid.a = UtilEnt.getNewEntityId(); + spawnSquid.b = EntityType.SQUID.getTypeId(); + spawnSquid.c = MathHelper.floor(player.getLocation().getX() * 32.0D); + spawnSquid.d = -150; + spawnSquid.e = MathHelper.floor(player.getLocation().getZ() * 32.0D); + spawnSquid.i = 0; + spawnSquid.j = 0; + spawnSquid.k = 0; + spawnSquid.f = 0; + spawnSquid.g = 0; + spawnSquid.h = 0; + spawnSquid.uuid = UUID.randomUUID(); + spawnSquid.l = squidWatcher; + + PacketPlayOutSpawnEntityLiving spawnArmorStand = new PacketPlayOutSpawnEntityLiving(); + spawnArmorStand.a = UtilEnt.getNewEntityId(); + spawnArmorStand.b = EntityType.ARMOR_STAND.getTypeId(); + spawnArmorStand.c = MathHelper.floor(player.getLocation().getX() * 32.0D); + spawnArmorStand.d = -150; + spawnArmorStand.e = MathHelper.floor(player.getLocation().getZ() * 32.0D); + spawnArmorStand.i = 0; + spawnArmorStand.j = 0; + spawnArmorStand.k = 0; + spawnArmorStand.f = 0; + spawnArmorStand.g = 0; + spawnArmorStand.h = 0; + spawnArmorStand.uuid = UUID.randomUUID(); + spawnArmorStand.l = armorStandWatcher; + + PacketPlayOutNewAttachEntity attachSquidtoPlayer = new PacketPlayOutNewAttachEntity(player.getEntityId(), new int[]{spawnSquid.a}); + PacketPlayOutNewAttachEntity attachArmorStandToSquid = new PacketPlayOutNewAttachEntity(spawnSquid.a, new int[]{spawnArmorStand.a}); + + _armorStandIds.computeIfAbsent(player.getEntityId(), key -> new HashMap<>()).put(receiver.getUniqueId(), spawnArmorStand.a); + _allIds.computeIfAbsent(player.getEntityId(), key -> new HashMap<>()).put(receiver.getUniqueId(), Arrays.asList(spawnSquid.a, spawnArmorStand.a)); + + runSync(() -> + { + ((CraftPlayer) receiver).getHandle().playerConnection.networkManager.handle(spawnSquid); + ((CraftPlayer) receiver).getHandle().playerConnection.networkManager.handle(spawnArmorStand); + ((CraftPlayer) receiver).getHandle().playerConnection.networkManager.handle(attachSquidtoPlayer); + ((CraftPlayer) receiver).getHandle().playerConnection.networkManager.handle(attachArmorStandToSquid); + }); + } + + private void summonForEntity18(Player receiver, Player player) + { + World world = ((CraftWorld) receiver.getWorld()).getHandle(); + + DataWatcher armorStandWatcher = getArmorStandWatcher(player); + armorStandWatcher.a(10, (byte) 0x10, EntityArmorStand.META_ARMOR_OPTION, (byte) 0x10); // Small + + DataWatcher squidWatcher = new DataWatcher(new DummyEntity(world)); + squidWatcher.a(0, (byte) 0x20, net.minecraft.server.v1_8_R3.Entity.META_ENTITYDATA, (byte) 0x20); + + PacketPlayOutSpawnEntityLiving spawnSquid = new PacketPlayOutSpawnEntityLiving(); + spawnSquid.a = UtilEnt.getNewEntityId(); + spawnSquid.b = EntityType.WOLF.getTypeId(); + spawnSquid.c = MathHelper.floor(player.getLocation().getX() * 32.0D); + spawnSquid.d = -150; + spawnSquid.e = MathHelper.floor(player.getLocation().getZ() * 32.0D); + spawnSquid.i = 0; + spawnSquid.j = 0; + spawnSquid.k = 0; + spawnSquid.f = 0; + spawnSquid.g = 0; + spawnSquid.h = 0; + spawnSquid.uuid = UUID.randomUUID(); + spawnSquid.l = squidWatcher; + + PacketPlayOutSpawnEntityLiving spawnArmorStand = new PacketPlayOutSpawnEntityLiving(); + spawnArmorStand.a = UtilEnt.getNewEntityId(); + spawnArmorStand.b = EntityType.ARMOR_STAND.getTypeId(); + spawnArmorStand.c = MathHelper.floor(player.getLocation().getX() * 32.0D); + spawnArmorStand.d = -150; + spawnArmorStand.e = MathHelper.floor(player.getLocation().getZ() * 32.0D); + spawnArmorStand.i = 0; + spawnArmorStand.j = 0; + spawnArmorStand.k = 0; + spawnArmorStand.f = 0; + spawnArmorStand.g = 0; + spawnArmorStand.h = 0; + spawnArmorStand.uuid = UUID.randomUUID(); + spawnArmorStand.l = armorStandWatcher; + + PacketPlayOutAttachEntity attachSquidtoPlayer = new PacketPlayOutAttachEntity(); + attachSquidtoPlayer.a = 0; + attachSquidtoPlayer.b = spawnSquid.a; + attachSquidtoPlayer.c = player.getEntityId(); + + PacketPlayOutAttachEntity attachArmorStandToSquid = new PacketPlayOutAttachEntity(); + attachArmorStandToSquid.a = 0; + attachArmorStandToSquid.b = spawnArmorStand.a; + attachArmorStandToSquid.c = spawnSquid.a; + + _armorStandIds.computeIfAbsent(player.getEntityId(), key -> new HashMap<>()).put(receiver.getUniqueId(), spawnArmorStand.a); + _allIds.computeIfAbsent(player.getEntityId(), key -> new HashMap<>()).put(receiver.getUniqueId(), Arrays.asList(spawnSquid.a, spawnArmorStand.a)); + + runSync(() -> + { + ((CraftPlayer) receiver).getHandle().playerConnection.networkManager.handle(spawnSquid); + ((CraftPlayer) receiver).getHandle().playerConnection.networkManager.handle(spawnArmorStand); + ((CraftPlayer) receiver).getHandle().playerConnection.networkManager.handle(attachSquidtoPlayer); + ((CraftPlayer) receiver).getHandle().playerConnection.networkManager.handle(attachArmorStandToSquid); + }); + } + + private void destroyForEntity(Player receiver, int id) + { + Map innerMap = _armorStandIds.get(id); + if (innerMap != null) + { + innerMap.remove(receiver.getUniqueId()); + + if (innerMap.isEmpty()) + { + _armorStandIds.remove(id); + } + } + + Map> allIdsMap = _allIds.get(id); + + if (allIdsMap != null) + { + List ids = allIdsMap.remove(receiver.getUniqueId()); + if (ids != null) + { + int[] idsArr = ids.stream().mapToInt(Integer::intValue).toArray(); + + PacketPlayOutEntityDestroy destroy = new PacketPlayOutEntityDestroy(idsArr); + ((CraftPlayer) receiver).getHandle().playerConnection.networkManager.handle(destroy); + } + + if (allIdsMap.isEmpty()) + { + _allIds.remove(id); + } + } + } + + private DataWatcher getArmorStandWatcher(Player ownerOfTrack) + { + Rank rank = _coreClientManager.Get(ownerOfTrack).getRealOrDisguisedRank(); + String name = ownerOfTrack.getName(); + + if (rank != null) + { + if (rank.has(Rank.ULTRA)) + { + name = rank.getTag(true, true) + " " + ChatColor.RESET + name; + } + } + + World world = ((CraftWorld) ownerOfTrack.getWorld()).getHandle(); + + DataWatcher armorStandWatcher = new DataWatcher(new DummyEntity(world)); + armorStandWatcher.a(0, (byte) 0x20, net.minecraft.server.v1_8_R3.Entity.META_ENTITYDATA, (byte) 0x20); + armorStandWatcher.a(1, (short) 300, net.minecraft.server.v1_8_R3.Entity.META_AIR, 0); + + armorStandWatcher.a(2, name, net.minecraft.server.v1_8_R3.Entity.META_CUSTOMNAME, name); + armorStandWatcher.a(3, (byte) 1, net.minecraft.server.v1_8_R3.Entity.META_CUSTOMNAME_VISIBLE, true); + + return armorStandWatcher; + } +} \ No newline at end of file diff --git a/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/morph/MorphGoldPot.java b/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/morph/MorphGoldPot.java new file mode 100644 index 000000000..017c3642f --- /dev/null +++ b/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/morph/MorphGoldPot.java @@ -0,0 +1,132 @@ +package mineplex.core.gadget.gadgets.morph; + +import java.time.Month; +import java.time.YearMonth; +import java.util.HashMap; +import java.util.Map; + +import org.bukkit.Location; +import org.bukkit.Material; +import org.bukkit.entity.Player; +import org.bukkit.event.EventHandler; +import org.bukkit.event.block.Action; +import org.bukkit.event.player.PlayerInteractEvent; +import org.bukkit.event.player.PlayerMoveEvent; +import org.bukkit.event.player.PlayerPickupItemEvent; + +import mineplex.core.common.util.C; +import mineplex.core.common.util.LineFormat; +import mineplex.core.common.util.UtilText; +import mineplex.core.disguise.disguises.DisguiseBlock; +import mineplex.core.gadget.GadgetManager; +import mineplex.core.gadget.gadgets.morph.managers.GoldPotHelper; +import mineplex.core.gadget.gadgets.morph.managers.UtilMorph; +import mineplex.core.gadget.types.MorphGadget; +import mineplex.core.updater.UpdateType; +import mineplex.core.updater.event.UpdateEvent; + +public class MorphGoldPot extends MorphGadget +{ + + private Map _helpers = new HashMap<>(); + + public MorphGoldPot(GadgetManager manager) + { + super(manager, "Gold Pot Morph", UtilText.splitLinesToArray(new String[] + { + C.cGray + "They say at the end of every rainbow a leprechaun has a pot filled with gold.", + C.blankLine, + C.cWhite + "Stand still to hide in place and fill up with treasure. Players who find you will earn a reward!", + }, LineFormat.LORE), + -14, + Material.CAULDRON_ITEM, (byte) 0, YearMonth.of(2017, Month.MARCH)); + } + + @Override + public void enableCustom(Player player, boolean message) + { + applyArmor(player, message); + + _helpers.put(player, new GoldPotHelper(player, Manager, this)); + + DisguiseBlock disguiseBlock = new DisguiseBlock(player, Material.CAULDRON, (byte) 0); + UtilMorph.disguise(player, disguiseBlock, Manager); + } + + @Override + public void disableCustom(Player player, boolean message) + { + removeArmor(player); + + if (_helpers.containsKey(player)) + { + _helpers.get(player).unsolidifyPlayer(); + _helpers.get(player).cleanItems(true); + _helpers.remove(player); + } + + UtilMorph.undisguise(player, Manager.getDisguiseManager()); + } + + @EventHandler + public void onUpdate(UpdateEvent event) + { for (GoldPotHelper goldPotHelper : _helpers.values()) + { + boolean solid = goldPotHelper.updatePlayer(event.getType() == UpdateType.SEC, event.getType() == UpdateType.TICK); + if (solid) + { + goldPotHelper.solififyPlayer(); + } + } + } + + @EventHandler + public void onRightClick(PlayerInteractEvent event) + { + if (event.getAction() == Action.RIGHT_CLICK_BLOCK) + { + for (GoldPotHelper goldPotHelper : _helpers.values()) + { + goldPotHelper.performRightClick(event.getPlayer(), event.getClickedBlock()); + } + } + } + + @EventHandler + public void onItemPickup(PlayerPickupItemEvent event) + { + for (GoldPotHelper goldPotHelper : _helpers.values()) + { + if (goldPotHelper.getItems().contains(event.getItem())) + { + event.setCancelled(true); + } + } + } + + @EventHandler + public void onPlayerMove(PlayerMoveEvent event) + { + if (!isActive(event.getPlayer())) + return; + + if (_helpers.containsKey(event.getPlayer())) + { + if (!_helpers.get(event.getPlayer()).isSolid()) + return; + } + + Location from = event.getFrom(), to = event.getTo(); + double xFrom = from.getX(), yFrom = from.getY(), zFrom = from.getZ(), + xTo = to.getX(), yTo = to.getY(), zTo = to.getZ(); + if (xFrom != xTo || yFrom != yTo || zFrom != zTo) + { + if (_helpers.containsKey(event.getPlayer())) + { + _helpers.get(event.getPlayer()).unsolidifyPlayer(); + } + event.getPlayer().setExp(0f); + } + } + +} \ No newline at end of file diff --git a/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/morph/MorphLoveDoctor.java b/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/morph/MorphLoveDoctor.java new file mode 100644 index 000000000..1a96f75d1 --- /dev/null +++ b/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/morph/MorphLoveDoctor.java @@ -0,0 +1,93 @@ +package mineplex.core.gadget.gadgets.morph; + +import java.util.HashSet; + +import org.bukkit.Bukkit; +import org.bukkit.Location; +import org.bukkit.Material; +import org.bukkit.entity.Player; +import org.bukkit.event.EventHandler; +import org.bukkit.event.player.PlayerToggleSneakEvent; + +import com.mojang.authlib.GameProfile; + +import mineplex.core.common.skin.SkinData; +import mineplex.core.common.util.C; +import mineplex.core.common.util.F; +import mineplex.core.common.util.LineFormat; +import mineplex.core.common.util.UtilPlayer; +import mineplex.core.common.util.UtilText; +import mineplex.core.disguise.disguises.DisguisePlayer; +import mineplex.core.gadget.GadgetManager; +import mineplex.core.gadget.event.GadgetSelectLocationEvent; +import mineplex.core.gadget.gadgets.morph.managers.UtilMorph; +import mineplex.core.gadget.types.MorphGadget; +import mineplex.core.particleeffects.LoveDoctorEffect; +import mineplex.core.recharge.Recharge; +import mineplex.core.utils.UtilGameProfile; + +public class MorphLoveDoctor extends MorphGadget +{ + + public MorphLoveDoctor(GadgetManager manager) + { + super(manager, "Love Doctor", UtilText.splitLinesToArray(new String[]{C.cGray + "The Doctor is in! Sneak to diagnose players with cooties!"}, LineFormat.LORE), + -17, Material.GLASS, (byte) 0); + setDisplayItem(SkinData.LOVE_DOCTOR.getSkull()); + } + + @Override + public void enableCustom(Player player, boolean message) + { + applyArmor(player, message); + + GameProfile gameProfile = UtilGameProfile.getGameProfile(player); + gameProfile.getProperties().clear(); + gameProfile.getProperties().put("textures", SkinData.LOVE_DOCTOR.getProperty()); + + DisguisePlayer disguisePlayer = new DisguisePlayer(player, gameProfile); + disguisePlayer.showInTabList(true, 0); + UtilMorph.disguise(player, disguisePlayer, Manager); + } + + @Override + public void disableCustom(Player player, boolean message) + { + removeArmor(player); + + UtilMorph.undisguise(player, Manager.getDisguiseManager()); + } + + @EventHandler + public void onSneak(PlayerToggleSneakEvent event) + { + if (!isActive(event.getPlayer())) + return; + + Player player = event.getPlayer(); + + if (!Recharge.Instance.use(player, "Love Doctor Laser", 5000, true, false, "Cosmetics")) + return; + + HashSet ignore = new HashSet(); + ignore.add(Material.AIR); + Location loc = player.getTargetBlock(ignore, 64).getLocation().add(0.5, 0.5, 0.5); + + GadgetSelectLocationEvent gadgetSelectLocationEvent = new GadgetSelectLocationEvent(player, this, loc); + Bukkit.getServer().getPluginManager().callEvent(gadgetSelectLocationEvent); + + // Checks to see if it's a valid location + if (gadgetSelectLocationEvent.isCancelled()) + { + if (gadgetSelectLocationEvent.canShowMessage()) + { + UtilPlayer.message(player, F.main("Gadget", "You cannot use the laser on this area!")); + } + + return; + } + LoveDoctorEffect loveDoctorEffect = new LoveDoctorEffect(player, loc, this); + loveDoctorEffect.start(); + } + +} diff --git a/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/morph/MorphPig.java b/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/morph/MorphPig.java index 5ca077a14..d45504531 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/morph/MorphPig.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/morph/MorphPig.java @@ -86,7 +86,7 @@ public class MorphPig extends MorphGadget { if (Manager.getClientManager().Get(event.getPlayer()).GetRank().has(Rank.ULTRA)) { - Manager.getDonationManager().Get(event.getPlayer()).AddUnknownSalesPackagesOwned(getName()); + Manager.getDonationManager().Get(event.getPlayer()).addOwnedUnknownSalesPackage(getName()); } } diff --git a/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/morph/MorphPumpkinKing.java b/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/morph/MorphPumpkinKing.java index 2da37bc5d..cb13b4ff5 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/morph/MorphPumpkinKing.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/morph/MorphPumpkinKing.java @@ -1,22 +1,48 @@ package mineplex.core.gadget.gadgets.morph; +import java.util.List; +import java.util.Map; +import java.util.Random; + +import org.bukkit.Location; import org.bukkit.Material; +import org.bukkit.entity.Item; import org.bukkit.entity.Player; import org.bukkit.entity.Skeleton.SkeletonType; +import org.bukkit.event.EventHandler; +import org.bukkit.event.player.PlayerToggleSneakEvent; import org.bukkit.inventory.ItemStack; +import com.google.common.collect.Lists; + import mineplex.core.common.util.C; +import mineplex.core.common.util.F; import mineplex.core.common.util.LineFormat; +import mineplex.core.common.util.UtilAction; +import mineplex.core.common.util.UtilAlg; +import mineplex.core.common.util.UtilParticle; +import mineplex.core.common.util.UtilParticle.ParticleType; +import mineplex.core.common.util.UtilParticle.ViewDist; +import mineplex.core.common.util.UtilPlayer; import mineplex.core.common.util.UtilServer; import mineplex.core.common.util.UtilText; +import mineplex.core.disguise.disguises.DisguiseBlock; import mineplex.core.disguise.disguises.DisguiseSkeleton; import mineplex.core.gadget.GadgetManager; import mineplex.core.gadget.gadgets.morph.managers.UtilMorph; import mineplex.core.gadget.types.MorphGadget; +import mineplex.core.itemstack.ItemBuilder; +import mineplex.core.recharge.Recharge; +import mineplex.core.updater.UpdateType; +import mineplex.core.updater.event.UpdateEvent; import mineplex.core.visibility.VisibilityManager; public class MorphPumpkinKing extends MorphGadget { + private static final int CROWN_POINTS = 12; + + private List _bombs = Lists.newArrayList(); + public MorphPumpkinKing(GadgetManager manager) { super(manager, "Pumpkin Kings Head", UtilText.splitLinesToArray(new String[] @@ -24,7 +50,9 @@ public class MorphPumpkinKing extends MorphGadget C.cGray + "Transforms the wearer into the dreaded Pumpkin King!", "", C.cBlue + "Earned by defeating the Pumpkin King", - C.cBlue + "in the 2013 Halloween Horror Event" + C.cBlue + "in the 2013 Halloween Horror Event", + C.blankLine, + "#" + C.cWhite + "Sneak to use Jack O Bomb" }, LineFormat.LORE), -1, Material.PUMPKIN, (byte)0); @@ -54,6 +82,95 @@ public class MorphPumpkinKing extends MorphGadget UtilMorph.undisguise(player, Manager.getDisguiseManager()); player.getInventory().setHelmet(null); } - -} + @EventHandler + public void onSneak(PlayerToggleSneakEvent event) + { + if (!isActive(event.getPlayer())) + return; + + if (!event.isSneaking()) + return; + + if (Recharge.Instance.use(event.getPlayer(), "Jack O Bomb", 30000, true, true)) + { + event.getPlayer().sendMessage(F.main("Recharge", "You used " + F.skill("Jack O Bomb") + ".")); + _bombs.add(new JackOBomb(event.getPlayer(), event.getPlayer().getLocation().add(event.getPlayer().getEyeLocation().getDirection().normalize()))); + } + } + + @EventHandler + public void onUpdate(UpdateEvent event) + { + if (event.getType() == UpdateType.TICK) + { + for (Player player : getActive()) + { + if (Manager.isMoving(player)) + { + continue; + } + for (int i = 0; i < 360; i += 360/CROWN_POINTS) + { + double angle = (i * Math.PI / 180); + double x = 0.5 * Math.cos(angle); + double z = 0.5 * Math.sin(angle); + Location loc = player.getEyeLocation().add(x, 1.4, z); + UtilParticle.PlayParticleToAll(ParticleType.FLAME, loc, null, 0, 1, ViewDist.NORMAL); + } + } + + _bombs.removeIf(bomb -> bomb.update()); + } + } + + private class JackOBomb + { + private Player _user; + private Item _ent; + private DisguiseBlock _disguise; + + private long _detonation; + + private boolean _done; + + public JackOBomb(Player user, Location spawnLocation) + { + _user = user; + _ent = spawnLocation.getWorld().dropItem(spawnLocation, new ItemBuilder(Material.APPLE).setTitle(new Random().nextDouble() + "").build()); + _ent.setPickupDelay(Integer.MAX_VALUE); + _disguise = new DisguiseBlock(_ent, Material.JACK_O_LANTERN.getId(), 0); + Manager.getDisguiseManager().disguise(_disguise); + _detonation = System.currentTimeMillis() + 7000; + _done = false; + } + + public boolean update() + { + if (_done) + { + return true; + } + if (System.currentTimeMillis() >= _detonation) + { + UtilParticle.PlayParticleToAll(ParticleType.HUGE_EXPLOSION, _ent.getLocation(), null, 0, 1, ViewDist.NORMAL); + Map players = UtilPlayer.getInRadius(_ent.getLocation(), 8); + for (Player player : players.keySet()) + { + if (Manager.collideEvent(_user, MorphPumpkinKing.this, player)) + continue; + + double mult = players.get(player); + + //Knockback + UtilAction.velocity(player, UtilAlg.getTrajectory(_ent.getLocation(), player.getLocation()), 1 * mult, false, 0, 0.5 + 0.5 * mult, 10, true); + } + Manager.getDisguiseManager().undisguise(_disguise); + _ent.remove(); + _done = true; + } + + return false; + } + } +} \ No newline at end of file diff --git a/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/morph/MorphSanta.java b/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/morph/MorphSanta.java index 42d46a0a1..7c857694b 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/morph/MorphSanta.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/morph/MorphSanta.java @@ -1,281 +1,284 @@ -package mineplex.core.gadget.gadgets.morph; - -import java.time.Month; -import java.time.YearMonth; -import java.util.ArrayList; -import java.util.HashMap; -import java.util.Iterator; - -import org.bukkit.Bukkit; -import org.bukkit.ChatColor; -import org.bukkit.Color; -import org.bukkit.FireworkEffect; -import org.bukkit.Material; -import org.bukkit.Sound; -import org.bukkit.entity.Item; -import org.bukkit.entity.Player; -import org.bukkit.event.EventHandler; -import org.bukkit.event.entity.ItemDespawnEvent; -import org.bukkit.event.player.PlayerInteractEvent; -import org.bukkit.event.player.PlayerPickupItemEvent; -import org.bukkit.inventory.ItemStack; - -import com.mojang.authlib.GameProfile; - -import mineplex.core.common.currency.GlobalCurrency; -import mineplex.core.common.skin.SkinData; -import mineplex.core.common.util.C; -import mineplex.core.common.util.F; -import mineplex.core.common.util.LineFormat; -import mineplex.core.common.util.UtilAction; -import mineplex.core.common.util.UtilEvent; -import mineplex.core.common.util.UtilFirework; -import mineplex.core.common.util.UtilMath; -import mineplex.core.common.util.UtilParticle; -import mineplex.core.common.util.UtilPlayer; -import mineplex.core.common.util.UtilServer; -import mineplex.core.common.util.UtilText; -import mineplex.core.disguise.disguises.DisguisePlayer; -import mineplex.core.gadget.GadgetManager; -import mineplex.core.gadget.gadgets.morph.managers.SantaPresent; -import mineplex.core.gadget.gadgets.morph.managers.UtilMorph; -import mineplex.core.gadget.types.MorphGadget; -import mineplex.core.itemstack.ItemStackFactory; -import mineplex.core.updater.UpdateType; -import mineplex.core.updater.event.UpdateEvent; -import mineplex.core.utils.UtilGameProfile; - -public class MorphSanta extends MorphGadget -{ - - private HashMap _items = new HashMap<>(); - - private static final int SHARD_CHARGE = 50; - - public MorphSanta(GadgetManager manager) - { - super(manager, "Santa Morph", UtilText.splitLinesToArray(new String[]{"Placeholder"}, LineFormat.LORE), -14, Material.STAINED_CLAY, (byte) 14, YearMonth.of(2016, Month.DECEMBER)); - } - - @Override - public void enableCustom(Player player, boolean message) - { - applyArmor(player, message); - - GameProfile profile = UtilGameProfile.getGameProfile(player); - profile.getProperties().clear(); - profile.getProperties().put("textures", SkinData.SANTA.getProperty()); - - DisguisePlayer disguisePlayer = new DisguisePlayer(player, profile); - disguisePlayer.showInTabList(true, 0); - UtilMorph.disguise(player, disguisePlayer, Manager); - } - - @Override - public void disableCustom(Player player, boolean message) - { - removeArmor(player); - - UtilMorph.undisguise(player, Manager.getDisguiseManager()); - } - - // PRESENT - - @EventHandler - public void throwPresent(PlayerInteractEvent event) - { - if (!isActive(event.getPlayer())) - return; - - if (!UtilEvent.isAction(event, UtilEvent.ActionType.L)) - return; - - Player player = event.getPlayer(); - - int type = 0; - - if (UtilMath.random(0.1, 1.1) > 0.76) - { - type = 1; - } - - if (player.getItemInHand().getType() != Material.AIR) - return; - - //if (!Recharge.Instance.use(player, getName(), 150000, true, false, "Cosmetics")) - //return; - - if (type == 0) - { - int shards = UtilMath.rRange(250, 500); - - if (Manager.getDonationManager().Get(player).getBalance(GlobalCurrency.TREASURE_SHARD) < shards + SHARD_CHARGE) - { - UtilPlayer.message(player, F.main("Gadget", "You do not have enough Shards.")); - return; - } - - Item present = player.getWorld().dropItem(player.getEyeLocation().add(player.getLocation().getDirection()), - SkinData.PRESENT.getSkull("Present " + System.currentTimeMillis(), new ArrayList<>())); - UtilAction.velocity(present, player.getLocation().getDirection(), 0.2, false, 0, 0.2, 1, false); - - Manager.getDonationManager().RewardCoinsLater(this.getName() + " Present Hide", player, -(shards + SHARD_CHARGE)); - - present.setPickupDelay(40); - - _items.put(present, new SantaPresent(player.getName(), SantaPresent.PresentType.PRESENT, shards)); - - //Announce - Bukkit.broadcastMessage(C.cYellow + C.Bold + player.getName() + - ChatColor.RESET + C.Bold + " hid a " + - C.cRed + C.Bold + "Christmas Present" + - ChatColor.RESET + C.Bold + " worth " + - C.cRed + C.Bold + shards + " Shards"); - - for (Player other : UtilServer.getPlayers()) - other.playSound(other.getLocation(), Sound.BLAZE_HIT, 1.5f, 1.5f); - } - else - { - ItemStack coalStack = ItemStackFactory.Instance.CreateStack(Material.COAL, (byte)0, 1, "Hidden Coal" + System.currentTimeMillis()); - Item coal = player.getWorld().dropItem(player.getEyeLocation().add(player.getLocation().getDirection()), coalStack); - UtilAction.velocity(coal, player.getLocation().getDirection(), 0.2, false, 0, 0.2, 1, false); - - int coals = UtilMath.rRange(1, 3); - - coal.setPickupDelay(40); - - _items.put(coal, new SantaPresent(player.getName(), SantaPresent.PresentType.COAL, coals)); - - //Announce - Bukkit.broadcastMessage(C.cYellow + C.Bold + player.getName() + - ChatColor.RESET + C.Bold + " hid a " + - C.cRed + C.Bold + "Christmas Coal" + - ChatColor.RESET + C.Bold + " worth " + - C.cRed + C.Bold + coals + " Coal Ammo"); - - for (Player other : UtilServer.getPlayers()) - other.playSound(other.getLocation(), Sound.DIG_SNOW, 1.5f, 1.5f); - } - } - - @EventHandler - public void presentPickup(PlayerPickupItemEvent event) - { - if (_items.containsKey(event.getItem()) && !_items.get(event.getItem()).getThrower().equals(event.getPlayer().getName())) - { - SantaPresent santaPresent = _items.get(event.getItem()); - - _items.remove(event.getItem()); - - event.setCancelled(true); - event.getItem().remove(); - - int presentsLeft = 0, coalsLeft = 0; - for (SantaPresent present : _items.values()) - { - if (present.getPresentType().equals(SantaPresent.PresentType.PRESENT)) - { - presentsLeft++; - } - else if (present.getPresentType().equals(SantaPresent.PresentType.COAL)) - { - coalsLeft++; - } - } - - if (santaPresent.getPresentType().equals(SantaPresent.PresentType.PRESENT)) - { - Manager.getDonationManager().RewardCoinsLater(getName() + " Present Pickup", event.getPlayer(), santaPresent.getAmmo()); - - //Announce - Bukkit.broadcastMessage(C.cGold + C.Bold + event.getPlayer().getName() + - ChatColor.RESET + C.Bold + " found a " + - C.cGold + C.Bold + "Christmas Present" + - ChatColor.RESET + C.Bold + "! " + presentsLeft + " Presents left!"); - } - else if (santaPresent.getPresentType().equals(SantaPresent.PresentType.COAL)) - { - // Gives coals - Manager.getInventoryManager().addItemToInventory(event.getPlayer(), "Coal", santaPresent.getAmmo()); - - //Announce - Bukkit.broadcastMessage(C.cGold + C.Bold + event.getPlayer().getName() + - ChatColor.RESET + C.Bold + " found a " + - C.cGold + C.Bold + "Christmas Coal" + - ChatColor.RESET + C.Bold + "! " + coalsLeft + " Coals left!"); - } - - event.getPlayer().getWorld().playSound(event.getPlayer().getLocation(), Sound.ORB_PICKUP, 1.5f, 0.75f); - event.getPlayer().getWorld().playSound(event.getPlayer().getLocation(), Sound.ORB_PICKUP, 1.5f, 1.25f); - - UtilFirework.playFirework(event.getItem().getLocation(), FireworkEffect.Type.BURST, Color.RED, true, true); - } - } - - @EventHandler - public void presentClean(UpdateEvent event) - { - if (event.getType() != UpdateType.FAST) - return; - - Iterator presentIter = _items.keySet().iterator(); - - while (presentIter.hasNext()) - { - Item presentItem = presentIter.next(); - - if (!presentItem.isValid() || presentItem.getTicksLived() > 24000) - { - SantaPresent santaPresent = _items.get(presentItem); - - presentItem.remove(); - presentIter.remove(); - - //Announce - if (santaPresent.getPresentType().equals(SantaPresent.PresentType.PRESENT)) - { - int presentsLeft = 0; - for (SantaPresent present : _items.values()) - { - if (present.getPresentType().equals(SantaPresent.PresentType.PRESENT)) - { - presentsLeft++; - } - } - Bukkit.broadcastMessage( - ChatColor.RESET + C.Bold + "No one found a " + - C.cGold + C.Bold + "Christmas Present" + - ChatColor.RESET + C.Bold + "! " + presentsLeft + " Presents left!"); - } - else if (santaPresent.getPresentType().equals(SantaPresent.PresentType.COAL)) - { - int coalsLeft = 0; - for (SantaPresent present : _items.values()) - { - if (present.getPresentType().equals(SantaPresent.PresentType.COAL)) - { - coalsLeft++; - } - } - Bukkit.broadcastMessage( - ChatColor.RESET + C.Bold + "No one found a " + - C.cGold + C.Bold + "Christmas Coal" + - ChatColor.RESET + C.Bold + "! " + coalsLeft + " Coals left!"); - } - } - else - { - UtilParticle.PlayParticle(UtilParticle.ParticleType.SNOW_SHOVEL, presentItem.getLocation().add(0, 0.1, 0), 0.1f, 0.1f, 0.1f, 0, 1, - UtilParticle.ViewDist.NORMAL, UtilServer.getPlayers()); - } - } - } - - @EventHandler - public void presentDespawnCancel(ItemDespawnEvent event) - { - if (_items.containsKey(event.getEntity())) - event.setCancelled(true); - } -} +package mineplex.core.gadget.gadgets.morph; + +import java.time.Month; +import java.time.YearMonth; +import java.util.ArrayList; +import java.util.HashMap; +import java.util.Iterator; + +import mineplex.core.common.util.*; +import mineplex.core.recharge.Recharge; +import org.bukkit.Bukkit; +import org.bukkit.ChatColor; +import org.bukkit.Color; +import org.bukkit.FireworkEffect; +import org.bukkit.Material; +import org.bukkit.Sound; +import org.bukkit.entity.Item; +import org.bukkit.entity.Player; +import org.bukkit.event.EventHandler; +import org.bukkit.event.entity.ItemDespawnEvent; +import org.bukkit.event.player.PlayerInteractEvent; +import org.bukkit.event.player.PlayerPickupItemEvent; +import org.bukkit.inventory.ItemStack; + +import com.mojang.authlib.GameProfile; + +import mineplex.core.common.currency.GlobalCurrency; +import mineplex.core.common.skin.SkinData; +import mineplex.core.disguise.disguises.DisguisePlayer; +import mineplex.core.gadget.GadgetManager; +import mineplex.core.gadget.gadgets.morph.managers.SantaPresent; +import mineplex.core.gadget.gadgets.morph.managers.UtilMorph; +import mineplex.core.gadget.types.MorphGadget; +import mineplex.core.itemstack.ItemStackFactory; +import mineplex.core.updater.UpdateType; +import mineplex.core.updater.event.UpdateEvent; +import mineplex.core.utils.UtilGameProfile; + +public class MorphSanta extends MorphGadget +{ + + private HashMap _items = new HashMap<>(); + // For some reason, present.getTicksLived() is not doing the right job here + private HashMap _spawnTime = new HashMap<>(); + + private static final int SHARD_CHARGE = 50; + + public MorphSanta(GadgetManager manager) + { + super(manager, "Santa Morph", UtilText.splitLinesToArray(new String[]{ + C.cGray + "We're all Santa now this Holiday Season!", + "", + C.cWhite + "Left click to deliver a random gift for players who have been Naughty or Nice!", + "", + C.cRedB + "WARNING: " + ChatColor.RESET + "Delivering a gift uses shards!" + }, LineFormat.LORE), -14, Material.STAINED_CLAY, (byte) 14, YearMonth.of(2016, Month.DECEMBER)); + } + + @Override + public void enableCustom(Player player, boolean message) + { + applyArmor(player, message); + + GameProfile profile = UtilGameProfile.getGameProfile(player); + profile.getProperties().clear(); + profile.getProperties().put("textures", SkinData.SANTA.getProperty()); + + DisguisePlayer disguisePlayer = new DisguisePlayer(player, profile); + disguisePlayer.showInTabList(true, 0); + UtilMorph.disguise(player, disguisePlayer, Manager); + } + + @Override + public void disableCustom(Player player, boolean message) + { + removeArmor(player); + + UtilMorph.undisguise(player, Manager.getDisguiseManager()); + } + + @EventHandler + public void throwPresent(PlayerInteractEvent event) + { + if (!isActive(event.getPlayer())) + return; + + if (!UtilEvent.isAction(event, UtilEvent.ActionType.L)) + return; + + Player player = event.getPlayer(); + + int type = 0; + + if (UtilMath.random(0.1, 1.1) > 0.76) + { + type = 1; + } + + if (player.getItemInHand().getType() != Material.AIR) + return; + + if (type == 0) + { + int shards = UtilMath.rRange(250, 500); + + if (Manager.getDonationManager().Get(player).getBalance(GlobalCurrency.TREASURE_SHARD) < shards + SHARD_CHARGE) + { + UtilPlayer.message(player, F.main("Gadget", "You do not have enough Shards.")); + return; + } + + if (!Recharge.Instance.use(player, "Hide Gift", 30000, true, false, "Cosmetics")) + return; + + Item present = player.getWorld().dropItem(player.getEyeLocation().add(player.getLocation().getDirection()), + SkinData.PRESENT.getSkull("Hidden Present " + System.currentTimeMillis(), new ArrayList<>())); + UtilAction.velocity(present, player.getLocation().getDirection(), 0.2, false, 0, 0.2, 1, false); + + Manager.getDonationManager().rewardCurrency(GlobalCurrency.TREASURE_SHARD, player, this.getName() + " Present Hide", -(shards + SHARD_CHARGE)); + + present.setPickupDelay(40); + + _items.put(present, new SantaPresent(player.getName(), SantaPresent.PresentType.PRESENT, shards)); + _spawnTime.put(present, System.currentTimeMillis()); + + //Announce + Bukkit.broadcastMessage(C.cYellow + C.Bold + player.getName() + + ChatColor.RESET + C.Bold + " hid a " + + C.cRed + C.Bold + "Christmas Present" + + ChatColor.RESET + C.Bold + " worth " + + C.cRed + C.Bold + shards + " Shards"); + + for (Player other : UtilServer.getPlayers()) + other.playSound(other.getLocation(), Sound.BLAZE_HIT, 1.5f, 1.5f); + } + else + { + if (!Recharge.Instance.use(player, "Hide Gift", 30000, true, false, "Cosmetics")) + return; + + ItemStack coalStack = ItemStackFactory.Instance.CreateStack(Material.COAL, (byte)0, 1, "Hidden Coal" + System.currentTimeMillis()); + Item coal = player.getWorld().dropItem(player.getEyeLocation().add(player.getLocation().getDirection()), coalStack); + UtilAction.velocity(coal, player.getLocation().getDirection(), 0.2, false, 0, 0.2, 1, false); + + int coals = UtilMath.rRange(1, 3); + + coal.setPickupDelay(40); + + _items.put(coal, new SantaPresent(player.getName(), SantaPresent.PresentType.COAL, coals)); + _spawnTime.put(coal, System.currentTimeMillis()); + + //Announce + Bukkit.broadcastMessage(C.cYellow + C.Bold + player.getName() + + ChatColor.RESET + C.Bold + " hid a " + + C.cRed + C.Bold + "Christmas Coal" + + ChatColor.RESET + C.Bold + " worth " + + C.cRed + C.Bold + coals + " Coal Ammo"); + + for (Player other : UtilServer.getPlayers()) + other.playSound(other.getLocation(), Sound.DIG_SNOW, 1.5f, 1.5f); + } + } + + @EventHandler + public void presentPickup(PlayerPickupItemEvent event) + { + if (_items.containsKey(event.getItem()) && !_items.get(event.getItem()).getThrower().equals(event.getPlayer().getName())) + { + SantaPresent santaPresent = _items.get(event.getItem()); + + _items.remove(event.getItem()); + _spawnTime.remove(event.getItem()); + + event.setCancelled(true); + event.getItem().remove(); + + int presentsLeft = 0, coalsLeft = 0; + for (SantaPresent present : _items.values()) + { + if (present.getPresentType().equals(SantaPresent.PresentType.PRESENT)) + { + presentsLeft++; + } + else if (present.getPresentType().equals(SantaPresent.PresentType.COAL)) + { + coalsLeft++; + } + } + + if (santaPresent.getPresentType().equals(SantaPresent.PresentType.PRESENT)) + { + Manager.getDonationManager().rewardCurrency(GlobalCurrency.TREASURE_SHARD, event.getPlayer(), getName() + " Present Pickup", santaPresent.getAmmo()); + + //Announce + Bukkit.broadcastMessage(C.cGold + C.Bold + event.getPlayer().getName() + + ChatColor.RESET + C.Bold + " found a " + + C.cGold + C.Bold + "Christmas Present" + + ChatColor.RESET + C.Bold + "! " + presentsLeft + " Presents left!"); + } + else if (santaPresent.getPresentType().equals(SantaPresent.PresentType.COAL)) + { + // Gives coals + Manager.getInventoryManager().addItemToInventory(event.getPlayer(), "Coal", santaPresent.getAmmo()); + + //Announce + Bukkit.broadcastMessage(C.cGold + C.Bold + event.getPlayer().getName() + + ChatColor.RESET + C.Bold + " found a " + + C.cGold + C.Bold + "Christmas Coal" + + ChatColor.RESET + C.Bold + "! " + coalsLeft + " Coals left!"); + } + + event.getPlayer().getWorld().playSound(event.getPlayer().getLocation(), Sound.ORB_PICKUP, 1.5f, 0.75f); + event.getPlayer().getWorld().playSound(event.getPlayer().getLocation(), Sound.ORB_PICKUP, 1.5f, 1.25f); + + UtilFirework.playFirework(event.getItem().getLocation(), FireworkEffect.Type.BURST, Color.RED, true, true); + } + } + + @EventHandler + public void presentClean(UpdateEvent event) + { + if (event.getType() != UpdateType.FAST) + return; + + Iterator presentIter = _items.keySet().iterator(); + + while (presentIter.hasNext()) + { + Item presentItem = presentIter.next(); + + if (!presentItem.isValid() || UtilTime.elapsed(_spawnTime.get(presentItem), 60 * 10000)) + { + SantaPresent santaPresent = _items.get(presentItem); + + presentItem.remove(); + presentIter.remove(); + + //Announce + if (santaPresent.getPresentType().equals(SantaPresent.PresentType.PRESENT)) + { + int presentsLeft = 0; + for (SantaPresent present : _items.values()) + { + if (present.getPresentType().equals(SantaPresent.PresentType.PRESENT)) + { + presentsLeft++; + } + } + Bukkit.broadcastMessage( + ChatColor.RESET + C.Bold + "No one found a " + + C.cGold + C.Bold + "Christmas Present" + + ChatColor.RESET + C.Bold + "! " + presentsLeft + " Presents left!"); + } + else if (santaPresent.getPresentType().equals(SantaPresent.PresentType.COAL)) + { + int coalsLeft = 0; + for (SantaPresent present : _items.values()) + { + if (present.getPresentType().equals(SantaPresent.PresentType.COAL)) + { + coalsLeft++; + } + } + Bukkit.broadcastMessage( + ChatColor.RESET + C.Bold + "No one found a " + + C.cGold + C.Bold + "Christmas Coal" + + ChatColor.RESET + C.Bold + "! " + coalsLeft + " Coals left!"); + } + } + else + { + UtilParticle.PlayParticle(UtilParticle.ParticleType.SNOW_SHOVEL, presentItem.getLocation().add(0, 0.1, 0), 0.1f, 0.1f, 0.1f, 0, 1, + UtilParticle.ViewDist.NORMAL, UtilServer.getPlayers()); + } + } + } + + @EventHandler + public void cancelDespawn(ItemDespawnEvent event) + { + if (_items.containsKey(event.getEntity())) + event.setCancelled(true); + } +} diff --git a/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/morph/MorphSquid.java b/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/morph/MorphSquid.java index b7a4fba03..096f453fd 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/morph/MorphSquid.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/morph/MorphSquid.java @@ -55,7 +55,7 @@ public class MorphSquid extends MorphGadget implements IThrown applyArmor(player, message); DisguiseSquid disguiseSquid = new DisguiseSquid(player); UtilMorph.disguise(player, disguiseSquid, Manager); - onToggleSwim(new PlayerToggleSwimEvent(player, SwimManager.isSwimming(player.getUniqueId()))); + onToggleSwim(new PlayerToggleSwimEvent(player, SwimManager.isSwimming(player.getUniqueId()), SwimManager.isInLava(player.getUniqueId()))); } @Override @@ -89,7 +89,7 @@ public class MorphSquid extends MorphGadget implements IThrown if (event.isSwimming()) { // Removes any costume player could be wearing - Manager.removeOutfit(event.getPlayer(), OutfitGadget.ArmorSlot.Boots); + Manager.removeOutfit(event.getPlayer(), OutfitGadget.ArmorSlot.BOOTS); // Adds enchanted boot ItemStack enchantedBoot = new ItemStack(Material.DIAMOND_BOOTS, 1); diff --git a/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/morph/MorphStray.java b/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/morph/MorphStray.java index a2fecafb5..8a6571d36 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/morph/MorphStray.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/morph/MorphStray.java @@ -1,128 +1,128 @@ -package mineplex.core.gadget.gadgets.morph; - -import java.util.ArrayList; -import java.util.List; - -import org.bukkit.Bukkit; -import org.bukkit.Material; -import org.bukkit.entity.Arrow; -import org.bukkit.entity.Player; -import org.bukkit.event.EventHandler; -import org.bukkit.event.entity.EntityDamageByEntityEvent; -import org.bukkit.event.entity.EntityShootBowEvent; -import org.bukkit.inventory.ItemStack; - -import mineplex.core.common.util.C; -import mineplex.core.common.util.F; -import mineplex.core.common.util.LineFormat; -import mineplex.core.common.util.UtilPlayer; -import mineplex.core.common.util.UtilText; -import mineplex.core.disguise.disguises.DisguiseSquid; -import mineplex.core.gadget.GadgetManager; -import mineplex.core.gadget.gadgets.morph.managers.UtilMorph; -import mineplex.core.gadget.types.MorphGadget; -import mineplex.core.itemstack.ItemStackFactory; - -/** - * THIS MORPH IS 1.9+ ONLY - */ -public class MorphStray extends MorphGadget -{ - - private List _strayArrows = new ArrayList<>(); - private ItemStack _arrow; - - public MorphStray(GadgetManager manager) - { - super(manager, "Stray Morph", UtilText.splitLinesToArray(new String[]{ - C.cGray + "Even though it's a stray your mom probably won't let you keep this puppy.", - "", - C.cWhite + "Gains an arrow every 5 seconds with EXTREME knockback." - }, LineFormat.LORE), - 0, Material.BARRIER, (byte) 0); - _arrow = ItemStackFactory.Instance.CreateStack(Material.ARROW, (byte) 0, 1, C.cGreen + "Stray Arrow", UtilText.splitLinesToArray(new String[]{"Placeholder"}, LineFormat.LORE)); - } - - @Override - public void enableCustom(Player player, boolean message) - { - // TODO CHECK IF LOBBY IS 1.9+ - applyArmor(player, message); - DisguiseSquid disguiseSquid = new DisguiseSquid(player); - UtilMorph.disguise(player, disguiseSquid, Manager); - - // Gives bow and arrow - ItemStack bow = ItemStackFactory.Instance.CreateStack(Material.BOW, (byte) 0, 1, C.cGreen + "Stray Bow", UtilText.splitLinesToArray(new String[]{"Placeholder"}, LineFormat.LORE)); - player.getInventory().setItem(2, bow); - player.getInventory().setItem(17, _arrow); - } - - @Override - public void disableCustom(Player player, boolean message) - { - removeArmor(player); - UtilMorph.undisguise(player, Manager.getDisguiseManager()); - - // Removes bow and arrow - player.getInventory().setItem(2, new ItemStack(Material.AIR)); - player.getInventory().setItem(17, new ItemStack(Material.AIR)); - } - - @EventHandler - public void onShoot(EntityShootBowEvent event) - { - if (!(event.getEntity() instanceof Player)) - return; - - if (!(event.getProjectile() instanceof Arrow)) - return; - - Player player = (Player) event.getEntity(); - - if (!isActive(player)) - return; - - _strayArrows.add((Arrow) event.getProjectile()); - - Bukkit.getScheduler().scheduleSyncDelayedTask(Manager.getPlugin(), new Runnable() - { - @Override - public void run() - { - player.getInventory().setItem(17, _arrow); - } - }, 3 * 20L); - } - - @EventHandler - public void onArrowHitPlayer(EntityDamageByEntityEvent event) - { - if (!(event.getDamager() instanceof Arrow)) - return; - - if (!(event.getEntity() instanceof Player)) - return; - - if (!(((Arrow) event.getDamager()).getShooter() instanceof Player)) - return; - - Arrow arrow = (Arrow) event.getDamager(); - Player player = (Player) event.getEntity(); - - if (!_strayArrows.contains(arrow)) - return; - - _strayArrows.remove(arrow); - - Player shooter = (Player) arrow.getShooter(); - arrow.remove(); - - if (shooter.getUniqueId().equals(player.getUniqueId())) - return; - - player.setVelocity(player.getVelocity().multiply(-15).setY(15)); - UtilPlayer.message(player, F.main("Stray Arrow", "You were hit with a " + F.greenElem("Stray Arrow") + " from " + F.name(shooter.getName()) + " and got knocked back!")); - UtilPlayer.message(shooter, F.main("Stray Arrow", "You hit " + F.name(player.getName()) + " with the " + F.greenElem("Stray Arrow") + " and they got knocked back!")); - } - -} +package mineplex.core.gadget.gadgets.morph; + +import java.util.ArrayList; +import java.util.List; + +import org.bukkit.Bukkit; +import org.bukkit.Material; +import org.bukkit.entity.Arrow; +import org.bukkit.entity.Player; +import org.bukkit.event.EventHandler; +import org.bukkit.event.entity.EntityDamageByEntityEvent; +import org.bukkit.event.entity.EntityShootBowEvent; +import org.bukkit.inventory.ItemStack; + +import mineplex.core.common.util.C; +import mineplex.core.common.util.F; +import mineplex.core.common.util.LineFormat; +import mineplex.core.common.util.UtilPlayer; +import mineplex.core.common.util.UtilText; +import mineplex.core.disguise.disguises.DisguiseSquid; +import mineplex.core.gadget.GadgetManager; +import mineplex.core.gadget.gadgets.morph.managers.UtilMorph; +import mineplex.core.gadget.types.MorphGadget; +import mineplex.core.itemstack.ItemStackFactory; + +/** + * THIS MORPH IS 1.9+ ONLY + */ +public class MorphStray extends MorphGadget +{ + + private List _strayArrows = new ArrayList<>(); + private ItemStack _arrow; + + public MorphStray(GadgetManager manager) + { + super(manager, "Stray Morph", UtilText.splitLinesToArray(new String[]{ + C.cGray + "Even though it's a stray your mom probably won't let you keep this puppy.", + "", + C.cWhite + "Gains an arrow every 5 seconds with EXTREME knockback." + }, LineFormat.LORE), + 0, Material.BARRIER, (byte) 0); + _arrow = ItemStackFactory.Instance.CreateStack(Material.ARROW, (byte) 0, 1, C.cGreen + "Stray Arrow", UtilText.splitLinesToArray(new String[]{"Placeholder"}, LineFormat.LORE)); + } + + @Override + public void enableCustom(Player player, boolean message) + { + // TODO CHECK IF LOBBY IS 1.9+ + applyArmor(player, message); + DisguiseSquid disguiseSquid = new DisguiseSquid(player); + UtilMorph.disguise(player, disguiseSquid, Manager); + + // Gives bow and arrow + ItemStack bow = ItemStackFactory.Instance.CreateStack(Material.BOW, (byte) 0, 1, C.cGreen + "Stray Bow", UtilText.splitLinesToArray(new String[]{"Placeholder"}, LineFormat.LORE)); + player.getInventory().setItem(2, bow); + player.getInventory().setItem(17, _arrow); + } + + @Override + public void disableCustom(Player player, boolean message) + { + removeArmor(player); + UtilMorph.undisguise(player, Manager.getDisguiseManager()); + + // Removes bow and arrow + player.getInventory().setItem(2, new ItemStack(Material.AIR)); + player.getInventory().setItem(17, new ItemStack(Material.AIR)); + } + + @EventHandler + public void onShoot(EntityShootBowEvent event) + { + if (!(event.getEntity() instanceof Player)) + return; + + if (!(event.getProjectile() instanceof Arrow)) + return; + + Player player = (Player) event.getEntity(); + + if (!isActive(player)) + return; + + _strayArrows.add((Arrow) event.getProjectile()); + + Bukkit.getScheduler().scheduleSyncDelayedTask(Manager.getPlugin(), new Runnable() + { + @Override + public void run() + { + player.getInventory().setItem(17, _arrow); + } + }, 3 * 20L); + } + + @EventHandler + public void onArrowHitPlayer(EntityDamageByEntityEvent event) + { + if (!(event.getDamager() instanceof Arrow)) + return; + + if (!(event.getEntity() instanceof Player)) + return; + + if (!(((Arrow) event.getDamager()).getShooter() instanceof Player)) + return; + + Arrow arrow = (Arrow) event.getDamager(); + Player player = (Player) event.getEntity(); + + if (!_strayArrows.contains(arrow)) + return; + + _strayArrows.remove(arrow); + + Player shooter = (Player) arrow.getShooter(); + arrow.remove(); + + if (shooter.getUniqueId().equals(player.getUniqueId())) + return; + + player.setVelocity(player.getVelocity().multiply(-15).setY(15)); + UtilPlayer.message(player, F.main("Stray Arrow", "You were hit with a " + F.greenElem("Stray Arrow") + " from " + F.name(shooter.getName()) + " and got knocked back!")); + UtilPlayer.message(shooter, F.main("Stray Arrow", "You hit " + F.name(player.getName()) + " with the " + F.greenElem("Stray Arrow") + " and they got knocked back!")); + } + +} diff --git a/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/morph/MorphTitan.java b/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/morph/MorphTitan.java index 03076725c..24cd35247 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/morph/MorphTitan.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/morph/MorphTitan.java @@ -227,7 +227,7 @@ public class MorphTitan extends MorphGadget { if (Manager.getClientManager().Get(event.getPlayer()).GetRank().has(Rank.TITAN)) { - Manager.getDonationManager().Get(event.getPlayer()).AddUnknownSalesPackagesOwned(getName()); + Manager.getDonationManager().Get(event.getPlayer()).addOwnedUnknownSalesPackage(getName()); } } diff --git a/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/morph/MorphVillager.java b/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/morph/MorphVillager.java index 9c0777d38..729c115b0 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/morph/MorphVillager.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/morph/MorphVillager.java @@ -37,21 +37,21 @@ import mineplex.core.updater.UpdateType; import mineplex.core.updater.event.UpdateEvent; public class MorphVillager extends MorphGadget implements IThrown -{ +{ private HashSet _gems = new HashSet(); - + public MorphVillager(GadgetManager manager) { - super(manager, "Villager Morph", UtilText.splitLinesToArray(new String[] - { - C.cGray + "HURRRR! MURR HURRR!", - C.blankLine, - "#" + C.cWhite + "Left Click to use Gem Throw", - C.blankLine, - "#" + C.cRed +C.Bold + "WARNING: " + ChatColor.RESET + "Gem Throw uses 20 Gems" - }, LineFormat.LORE), + super(manager, "Villager Morph", UtilText.splitLinesToArray(new String[] + { + C.cGray + "HURRRR! MURR HURRR!", + C.blankLine, + "#" + C.cWhite + "Left Click to use Gem Throw", + C.blankLine, + "#" + C.cRed + C.Bold + "WARNING: " + ChatColor.RESET + "Gem Throw uses 20 Gems" + }, LineFormat.LORE), 12000, - Material.EMERALD, (byte)0); + Material.EMERALD, (byte) 0); } @Override @@ -86,42 +86,42 @@ public class MorphVillager extends MorphGadget implements IThrown UtilPlayer.message(player, F.main("Gadget", "You do not have enough Gems.")); return; } - + if (!Recharge.Instance.use(player, getName(), 800, false, false, "Cosmetics")) return; - + player.getWorld().playSound(player.getLocation(), Sound.VILLAGER_IDLE, 1f, 1f); - + //Item Item gem = player.getWorld().dropItem(player.getEyeLocation().add(player.getLocation().getDirection()), new ItemStack(Material.EMERALD)); UtilAction.velocity(gem, player.getLocation().getDirection(), 1, false, 0, 0.2, 1, false); - + //Throw - Manager.getProjectileManager().AddThrow(gem, player, this, -1, true, true, true, true, + Manager.getProjectileManager().AddThrow(gem, player, this, -1, true, true, true, true, null, 1.4f, 0.8f, null, null, 0, UpdateType.TICK, 0.5f); - - Manager.getDonationManager().RewardGems(null, this.getName() + " Throw", player.getName(), player.getUniqueId(), -20); - + + Manager.getDonationManager().rewardCurrency(GlobalCurrency.GEM, player, this.getName() + " Throw", -20); + gem.setPickupDelay(40); - + _gems.add(gem); } - + @Override public void Collide(LivingEntity target, Block block, ProjectileUser data) { if (target == null) return; - + if (target instanceof Player) if (Manager.collideEvent((Player) data.getThrower(), this, (Player) target)) return; //Pull - UtilAction.velocity(target, + UtilAction.velocity(target, UtilAlg.getTrajectory(data.getThrown().getLocation(), target.getEyeLocation()), 1, false, 0, 0.2, 0.8, true); - + UtilAction.velocity(data.getThrown(), UtilAlg.getTrajectory(target, data.getThrown()), 0.5, false, 0, 0, 0.8, true); @@ -133,15 +133,15 @@ public class MorphVillager extends MorphGadget implements IThrown @Override public void Idle(ProjectileUser data) { - + } @Override public void Expire(ProjectileUser data) { - + } - + @EventHandler public void Pickup(PlayerPickupItemEvent event) { @@ -149,25 +149,25 @@ public class MorphVillager extends MorphGadget implements IThrown { event.setCancelled(true); event.getItem().remove(); - - Manager.getDonationManager().RewardGemsLater(getName() + " Pickup", event.getPlayer(), 16); - + + Manager.getDonationManager().rewardCurrency(GlobalCurrency.GEM, event.getPlayer(), getName() + " Pickup", 16); + event.getPlayer().getWorld().playSound(event.getPlayer().getLocation(), Sound.ORB_PICKUP, 1f, 2f); } } - + @EventHandler public void Clean(UpdateEvent event) { if (event.getType() != UpdateType.FAST) return; - + Iterator gemIterator = _gems.iterator(); - + while (gemIterator.hasNext()) { Item gem = gemIterator.next(); - + if (!gem.isValid() || gem.getTicksLived() > 1200) { gem.remove(); diff --git a/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/morph/managers/GoldPotHelper.java b/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/morph/managers/GoldPotHelper.java new file mode 100644 index 000000000..bd4f43c48 --- /dev/null +++ b/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/morph/managers/GoldPotHelper.java @@ -0,0 +1,213 @@ +package mineplex.core.gadget.gadgets.morph.managers; + +import java.util.Collections; +import java.util.HashSet; +import java.util.Iterator; + +import org.bukkit.Bukkit; +import org.bukkit.Material; +import org.bukkit.block.Block; +import org.bukkit.entity.Item; +import org.bukkit.entity.Player; +import org.bukkit.inventory.ItemStack; +import org.bukkit.inventory.meta.ItemMeta; +import org.bukkit.util.Vector; + +import mineplex.core.common.currency.GlobalCurrency; +import mineplex.core.common.util.F; +import mineplex.core.common.util.UtilMath; +import mineplex.core.common.util.UtilParticle; +import mineplex.core.common.util.UtilPlayer; +import mineplex.core.disguise.disguises.DisguiseBlock; +import mineplex.core.disguise.disguises.DisguiseCat; +import mineplex.core.disguise.disguises.DisguiseChicken; +import mineplex.core.gadget.GadgetManager; +import mineplex.core.gadget.event.GadgetBlockEvent; +import mineplex.core.gadget.types.Gadget; +import mineplex.core.recharge.Recharge; + +public class GoldPotHelper +{ + + private static final float EXP_INCREMENT = 0.2f; + private static final long COOLDOWN = 300000; + private static final int SHARDS = 250; + private static final int GEMS = 60; + + private Player _player; + private GadgetManager _manager; + private Gadget _gadget; + private GoldPotStands _goldPotStands; + private Block _block; + private boolean _solid = false; + private boolean _nuggets = false; + + private HashSet _items = new HashSet<>(); + + public GoldPotHelper(Player player, GadgetManager manager, Gadget gadget) + { + _player = player; + _manager = manager; + _gadget = gadget; + _goldPotStands = new GoldPotStands(); + } + + public void solififyPlayer() + { + if (_solid) + return; + + Block block = _player.getLocation().getBlock(); + + GadgetBlockEvent event = new GadgetBlockEvent(_gadget, Collections.singletonList(block)); + + Bukkit.getServer().getPluginManager().callEvent(event); + + if (event.isCancelled() || block.getType() != Material.AIR) + { + UtilPlayer.message(_player, F.main("Morph", "You cannot become a gold pot here!")); + return; + } + + if (!Recharge.Instance.usable(_player, _gadget.getName(), true, "Your pot will be refilled with gold in %t")) + { + return; + } + + UtilMorph.undisguise(_player, _manager.getDisguiseManager()); + DisguiseChicken disguiseChicken = new DisguiseChicken(_player); + disguiseChicken.setSoundDisguise(new DisguiseCat(_player)); + disguiseChicken.setInvisible(true); + UtilMorph.disguise(_player, disguiseChicken, _manager); + + block.setType(Material.CAULDRON); + _block = block; + _goldPotStands.setBlock(_block); + _goldPotStands.createStands(); + + _solid = true; + + UtilPlayer.message(_player, F.main("Gold Pot", "You're now filled with gold!")); + } + + public void unsolidifyPlayer() + { + if (!_solid) + return; + + _goldPotStands.removeStands(); + UtilMorph.undisguise(_player, _manager.getDisguiseManager()); + DisguiseBlock disguiseBlock = new DisguiseBlock(_player, Material.CAULDRON, (byte) 0); + UtilMorph.disguise(_player, disguiseBlock, _manager); + + if (_block != null) + { + _block.setType(Material.AIR); + _block = null; + } + + _solid = false; + + UtilPlayer.message(_player, F.main("Gold Pot", "You're no longer filled with gold!")); + } + + public boolean updatePlayer(boolean second, boolean tick) + { + boolean solidify = false; + if (second) + { + if (!_solid) + { + // Updates EXP Bar + _player.setExp(_player.getExp() + EXP_INCREMENT); + + if (_player.getExp() == 1) + { + // Solidifies (or tries to) + solidify = true; + _player.setExp(0f); + } + if (_manager.isMoving(_player)) + { + _player.setExp(0f); + solidify = false; + } + } + else + { + // Throws items in the air + for (int i = 1; i < 5; i++) + { + ItemStack itemStack = new ItemStack((_nuggets) ? Material.GOLD_NUGGET : Material.GOLD_INGOT); + ItemMeta itemMeta = itemStack.getItemMeta(); + itemMeta.setDisplayName("DROPPED" + System.currentTimeMillis() + i); + itemStack.setItemMeta(itemMeta); + Item gold = _block.getWorld().dropItem(_block.getLocation().add(0.5, 1.5, 0.5), itemStack); + _items.add(gold); + + gold.setVelocity(new Vector((Math.random()-0.5)*0.3, Math.random()-0.4, (Math.random()-0.5)*0.3)); + } + _nuggets = !_nuggets; + } + } + if (tick) + { + UtilParticle.PlayParticleToAll(UtilParticle.ParticleType.ICON_CRACK.getParticle(Material.GOLD_BLOCK, + (byte) 0), _player.getLocation().add(0, 0.5, 0), 0.1f, 0.1f, 0.1f, 0.3f, 1, UtilParticle.ViewDist.LONG); + cleanItems(false); + } + return solidify; + } + + public void performRightClick(Player clicked, Block block) + { + if (_block == null) + return; + + if (!block.equals(_block)) + return; + + if (clicked.equals(_player)) + return; + + unsolidifyPlayer(); + + Recharge.Instance.use(_player, _gadget.getName(), COOLDOWN, false, false, "Cosmetics"); + + boolean shards = UtilMath.random.nextBoolean(); + if (shards) + { + _manager.getDonationManager().rewardCurrency(GlobalCurrency.TREASURE_SHARD, clicked, _gadget.getName() + " Gold Pot Pickup Shards", SHARDS); + Bukkit.broadcastMessage(F.main("Gold Pot", F.name(clicked.getName()) + " found a gold pot worth " + F.currency(GlobalCurrency.TREASURE_SHARD, SHARDS) + "!")); + } else + { + _manager.getDonationManager().rewardCurrency(GlobalCurrency.GEM, clicked, _gadget.getName() + " Gold Pot Pickup Gems", GEMS); + Bukkit.broadcastMessage(F.main("Gold Pot", F.name(clicked.getName()) + " found a gold pot worth " + F.currency(GlobalCurrency.GEM, GEMS) + "!")); + } + } + + public HashSet getItems() + { + return _items; + } + + public void cleanItems(boolean force) + { + Iterator it = _items.iterator(); + while (it.hasNext()) + { + Item item = it.next(); + if (item.getTicksLived() >= 20 || force) + { + item.remove(); + it.remove(); + } + } + } + + public boolean isSolid() + { + return _solid; + } + +} \ No newline at end of file diff --git a/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/morph/managers/GoldPotStands.java b/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/morph/managers/GoldPotStands.java new file mode 100644 index 000000000..a448db9b6 --- /dev/null +++ b/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/morph/managers/GoldPotStands.java @@ -0,0 +1,98 @@ +package mineplex.core.gadget.gadgets.morph.managers; + +import org.bukkit.Location; +import org.bukkit.Material; +import org.bukkit.block.Block; +import org.bukkit.entity.ArmorStand; +import org.bukkit.inventory.ItemStack; +import org.bukkit.util.EulerAngle; + +public class GoldPotStands +{ + + private ArmorStand _helmet, _armsA, _armsB, _armsC; + private Block _block; + + public void setBlock(Block block) + { + _block = block; + } + + public void createStands() + { + if (_block == null) + { + return; + } + Location loc = _block.getLocation().clone().add(0.5, 0, 0.5); + + // Spawns main armorstand + Location asHelmetGoldLoc = loc.clone().subtract(0, 1, 0); + ArmorStand asHelmetGold = loc.getWorld().spawn(asHelmetGoldLoc, ArmorStand.class); + asHelmetGold.setVisible(false); + asHelmetGold.setGravity(false); + asHelmetGold.setHelmet(new ItemStack(Material.GOLD_BLOCK)); + + // Spawns second armorstand + Location asArmsGoldALoc = asHelmetGoldLoc.clone(); + ArmorStand asArmsGoldA = loc.getWorld().spawn(asArmsGoldALoc, ArmorStand.class); + asArmsGoldA.setVisible(false); + asArmsGoldA.setGravity(false); + asArmsGoldA.setItemInHand(new ItemStack(Material.GOLD_BLOCK)); + double asArmsGoldAX = Math.toRadians(158), asArmsGoldAY = Math.toRadians(75); + EulerAngle asArmsGoldAEuler = new EulerAngle(asArmsGoldAX, asArmsGoldAY, 0); + asArmsGoldA.setRightArmPose(asArmsGoldAEuler); + + // Spawns third armorstand + Location asArmsGoldBLoc = asHelmetGoldLoc.clone(); + ArmorStand asArmsGoldB = loc.getWorld().spawn(asArmsGoldBLoc, ArmorStand.class); + asArmsGoldB.setVisible(false); + asArmsGoldB.setGravity(false); + asArmsGoldB.setItemInHand(new ItemStack(Material.GOLD_BLOCK)); + double asArmsGoldBX = Math.toRadians(202), asArmsGoldBY = Math.toRadians(245); + EulerAngle asArmsGoldBEuler = new EulerAngle(asArmsGoldBX, asArmsGoldBY, 0); + asArmsGoldB.setRightArmPose(asArmsGoldBEuler); + + // Spawns fourth armorstand + Location asArmsGoldCLoc = loc.clone().add(0.4, 0.1, 0.1); + ArmorStand asArmsGoldC = loc.getWorld().spawn(asArmsGoldCLoc, ArmorStand.class); + asArmsGoldC.setVisible(false); + asArmsGoldC.setGravity(false); + asArmsGoldC.setSmall(true); + asArmsGoldC.setItemInHand(new ItemStack(Material.GOLD_BLOCK)); + double asArmsGoldCX = Math.toRadians(191), asArmsGoldCY = Math.toRadians(245); + EulerAngle asArmsGoldCEuler = new EulerAngle(asArmsGoldCX, asArmsGoldCY, 0); + asArmsGoldC.setRightArmPose(asArmsGoldCEuler); + + _helmet = asHelmetGold; + _armsA = asArmsGoldA; + _armsB = asArmsGoldB; + _armsC = asArmsGoldC; + } + + public void removeStands() + { + if (_helmet != null) + { + _helmet.remove(); + _helmet = null; + } + if (_armsA != null) + { + _armsA.remove(); + _armsA = null; + } + if (_armsB != null) + { + _armsB.remove(); + _armsB = null; + } + if (_armsC != null) + { + _armsC.remove(); + _armsC = null; + } + _block = null; + } + +} \ No newline at end of file diff --git a/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/morph/managers/SantaPresent.java b/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/morph/managers/SantaPresent.java index 5a05ad30c..44e88f23d 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/morph/managers/SantaPresent.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/morph/managers/SantaPresent.java @@ -1,38 +1,38 @@ -package mineplex.core.gadget.gadgets.morph.managers; - -public class SantaPresent -{ - - public enum PresentType - { - PRESENT, - COAL - } - - private final String _thrower; - private final PresentType _presentType; - private final int _ammo; - - public SantaPresent(String thrower, PresentType presentType, int ammo) - { - _thrower = thrower; - _presentType = presentType; - _ammo = ammo; - } - - public String getThrower() - { - return _thrower; - } - - public PresentType getPresentType() - { - return _presentType; - } - - public int getAmmo() - { - return _ammo; - } - -} +package mineplex.core.gadget.gadgets.morph.managers; + +public class SantaPresent +{ + + public enum PresentType + { + PRESENT, + COAL + } + + private final String _thrower; + private final PresentType _presentType; + private final int _ammo; + + public SantaPresent(String thrower, PresentType presentType, int ammo) + { + _thrower = thrower; + _presentType = presentType; + _ammo = ammo; + } + + public String getThrower() + { + return _thrower; + } + + public PresentType getPresentType() + { + return _presentType; + } + + public int getAmmo() + { + return _ammo; + } + +} diff --git a/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/morph/managers/SwimManager.java b/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/morph/managers/SwimManager.java index 6a76f4a96..ab526bad0 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/morph/managers/SwimManager.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/morph/managers/SwimManager.java @@ -8,6 +8,7 @@ public class SwimManager { private static List _swimming = new ArrayList<>(); + private static List _lava = new ArrayList<>(); public static void addPlayer(UUID uuid) { @@ -22,9 +23,33 @@ public class SwimManager } } + public static void addPlayerLava(UUID uuid) + { + _lava.add(uuid); + } + + public static void removePlayerLava(UUID uuid) + { + if (_lava.contains(uuid)) + { + _lava.remove(uuid); + } + } + + public static void removeLavaAndWater(UUID uuid) + { + removePlayerLava(uuid); + removePlayer(uuid); + } + public static boolean isSwimming(UUID uuid) { return _swimming.contains(uuid); } + public static boolean isInLava(UUID uuid) + { + return _lava.contains(uuid); + } + } diff --git a/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/outfit/OutfitTeam.java b/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/outfit/OutfitTeam.java index 087893c88..0004420cd 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/outfit/OutfitTeam.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/outfit/OutfitTeam.java @@ -63,16 +63,16 @@ public class OutfitTeam extends OutfitGadget _active.add(player); - if (_slot == ArmorSlot.Helmet) player.getInventory().setHelmet( + if (_slot == ArmorSlot.HELMET) player.getInventory().setHelmet( ItemStackFactory.Instance.CreateStack(getDisplayMaterial().getId(), getDisplayData(), 1, getName())); - else if (_slot == ArmorSlot.Chest) player.getInventory().setChestplate( + else if (_slot == ArmorSlot.CHEST) player.getInventory().setChestplate( ItemStackFactory.Instance.CreateStack(getDisplayMaterial().getId(), getDisplayData(), 1, getName())); - else if (_slot == ArmorSlot.Legs) player.getInventory().setLeggings( + else if (_slot == ArmorSlot.LEGS) player.getInventory().setLeggings( ItemStackFactory.Instance.CreateStack(getDisplayMaterial().getId(), getDisplayData(), 1, getName())); - else if (_slot == ArmorSlot.Boots) player.getInventory().setBoots( + else if (_slot == ArmorSlot.BOOTS) player.getInventory().setBoots( ItemStackFactory.Instance.CreateStack(getDisplayMaterial().getId(), getDisplayData(), 1, getName())); } @@ -82,10 +82,10 @@ public class OutfitTeam extends OutfitGadget if (!_active.remove(player)) return; - if (_slot == ArmorSlot.Helmet) player.getInventory().setHelmet(null); - else if (_slot == ArmorSlot.Chest) player.getInventory().setChestplate(null); - else if (_slot == ArmorSlot.Legs) player.getInventory().setLeggings(null); - else if (_slot == ArmorSlot.Boots) player.getInventory().setBoots(null); + if (_slot == ArmorSlot.HELMET) player.getInventory().setHelmet(null); + else if (_slot == ArmorSlot.CHEST) player.getInventory().setChestplate(null); + else if (_slot == ArmorSlot.LEGS) player.getInventory().setLeggings(null); + else if (_slot == ArmorSlot.BOOTS) player.getInventory().setBoots(null); } @Override @@ -124,7 +124,7 @@ public class OutfitTeam extends OutfitGadget //Will only display the message once - if (getSlot() == ArmorSlot.Legs) + if (getSlot() == ArmorSlot.LEGS) { if (!Recharge.Instance.use(player, "Set Team Color", 20000, true, false)) return; @@ -140,28 +140,28 @@ public class OutfitTeam extends OutfitGadget { _colorSetting.put(player.getName(), Color.RED); - if (getSlot() == ArmorSlot.Legs) //Only Display Once + if (getSlot() == ArmorSlot.LEGS) //Only Display Once UtilPlayer.message(player, F.main("Gadget", "You equipped " + F.elem(C.cRed + "Red Team Outfit") + "!")); } else if (args[1].equals("yellow")) { _colorSetting.put(player.getName(), Color.YELLOW); - if (getSlot() == ArmorSlot.Legs) //Only Display Once + if (getSlot() == ArmorSlot.LEGS) //Only Display Once UtilPlayer.message(player, F.main("Gadget", "You equipped " + F.elem(C.cYellow + "Yellow Team Outfit") + "!")); } else if (args[1].equals("green")) { _colorSetting.put(player.getName(), Color.LIME); - if (getSlot() == ArmorSlot.Legs) //Only Display Once + if (getSlot() == ArmorSlot.LEGS) //Only Display Once UtilPlayer.message(player, F.main("Gadget", "You equipped " + F.elem(C.cGreen + "Green Team Outfit") + "!")); } else if (args[1].equals("blue")) { _colorSetting.put(player.getName(), Color.AQUA); - if (getSlot() == ArmorSlot.Legs) //Only Display Once + if (getSlot() == ArmorSlot.LEGS) //Only Display Once UtilPlayer.message(player, F.main("Gadget", "You equipped " + F.elem(C.cAqua + "Blue Team Outfit") + "!")); } else @@ -180,7 +180,7 @@ public class OutfitTeam extends OutfitGadget //Get Item ItemStack stack; - if (getSlot() == ArmorSlot.Helmet) + if (getSlot() == ArmorSlot.HELMET) { stack = player.getInventory().getHelmet(); @@ -190,7 +190,7 @@ public class OutfitTeam extends OutfitGadget return; } } - else if (getSlot() == ArmorSlot.Chest) + else if (getSlot() == ArmorSlot.CHEST) { stack = player.getInventory().getChestplate(); @@ -200,7 +200,7 @@ public class OutfitTeam extends OutfitGadget return; } } - else if (getSlot() == ArmorSlot.Legs) + else if (getSlot() == ArmorSlot.LEGS) { stack = player.getInventory().getLeggings(); @@ -210,7 +210,7 @@ public class OutfitTeam extends OutfitGadget return; } } - else if (getSlot() == ArmorSlot.Boots) + else if (getSlot() == ArmorSlot.BOOTS) { stack = player.getInventory().getBoots(); diff --git a/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/outfit/freezesuit/FreezeSuitPathData.java b/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/outfit/freezesuit/FreezeSuitPathData.java new file mode 100644 index 000000000..d4b8bd61b --- /dev/null +++ b/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/outfit/freezesuit/FreezeSuitPathData.java @@ -0,0 +1,102 @@ +package mineplex.core.gadget.gadgets.outfit.freezesuit; + +import java.util.ArrayList; + +import org.bukkit.Location; +import org.bukkit.Material; +import org.bukkit.block.Block; +import org.bukkit.entity.Player; +import org.bukkit.util.Vector; + +import mineplex.core.common.util.UtilMath; + +public class FreezeSuitPathData +{ + + private ArrayList _blocks; + + public FreezeSuitPathData(Player player) + { + _blocks = new ArrayList<>(); + + //Add Blocks + if (Math.abs(player.getLocation().getDirection().getX()) > Math.abs(player.getLocation().getDirection().getZ())) + { + getBlocks(player.getLocation().add(0, 0, 1), 16); + getBlocks(player.getLocation().add(0, 0, -1), 16); + } + else + { + getBlocks(player.getLocation().add(1, 0, 0), 16); + getBlocks(player.getLocation().add(-1, 0, 0), 16); + } + + getBlocks(player.getLocation(), 16); + + //Sort Blocks + for (int i=0 ; i<_blocks.size() ; i++) + { + for (int j=0 ; j+1<_blocks.size() ; j++) + { + if (UtilMath.offset(player.getLocation(), _blocks.get(j).getLocation().add(0.5, 0.5, 0.5)) > + UtilMath.offset(player.getLocation(), _blocks.get(j+1).getLocation().add(0.5, 0.5, 0.5))) + { + Block temp = _blocks.get(j); + _blocks.set(j, _blocks.get(j+1)); + _blocks.set(j+1, temp); + } + } + } + } + + public void getBlocks(Location loc, int length) + { + //Below Player + loc.subtract(0, 1, 0); + + Vector dir = loc.getDirection(); + + double hLength = Math.sqrt(dir.getX()*dir.getX() + dir.getZ()*dir.getZ()); + + if (Math.abs(dir.getY()) > hLength) + { + if (dir.getY() > 0) + dir.setY(hLength); + else + dir.setY(-hLength); + + dir.normalize(); + } + + //Backtrack + loc.subtract(dir.clone().multiply(2)); + + double dist = 0; + while (dist < length) + { + dist += 0.2; + + loc.add(dir.clone().multiply(0.2)); + + if (loc.getBlock().getType() == Material.ICE) + continue; + + if (loc.getBlock().getType() == Material.AIR || loc.getBlock().getType() == Material.SNOW) + { + if (!_blocks.contains(loc.getBlock())) + { + _blocks.add(loc.getBlock()); + } + } + } + } + + public Block getNextBlock() + { + if (_blocks.isEmpty()) + return null; + + return _blocks.remove(0); + } + +} diff --git a/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/outfit/freezesuit/OutfitFreezeSuit.java b/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/outfit/freezesuit/OutfitFreezeSuit.java new file mode 100644 index 000000000..0cba46733 --- /dev/null +++ b/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/outfit/freezesuit/OutfitFreezeSuit.java @@ -0,0 +1,193 @@ +package mineplex.core.gadget.gadgets.outfit.freezesuit; + +import java.util.HashMap; +import java.util.HashSet; +import java.util.Iterator; +import java.util.Map; +import java.util.Set; +import java.util.UUID; + +import org.bukkit.Color; +import org.bukkit.Effect; +import org.bukkit.Location; +import org.bukkit.Material; +import org.bukkit.block.Block; +import org.bukkit.entity.Player; +import org.bukkit.event.EventHandler; +import org.bukkit.event.player.PlayerToggleSneakEvent; +import org.bukkit.inventory.ItemStack; +import org.bukkit.inventory.meta.LeatherArmorMeta; +import org.bukkit.util.Vector; + +import mineplex.core.common.util.C; +import mineplex.core.common.util.LineFormat; +import mineplex.core.common.util.UtilAction; +import mineplex.core.common.util.UtilBlock; +import mineplex.core.common.util.UtilParticle; +import mineplex.core.common.util.UtilServer; +import mineplex.core.common.util.UtilText; +import mineplex.core.gadget.GadgetManager; +import mineplex.core.gadget.types.OutfitGadget; +import mineplex.core.recharge.Recharge; +import mineplex.core.updater.UpdateType; +import mineplex.core.updater.event.UpdateEvent; + +public class OutfitFreezeSuit extends OutfitGadget +{ + + private Set _data = new HashSet<>(); + private Map _failedAttempts = new HashMap<>(); + + private static final int DURATION = 2000; + private static final int RANGE = 3; + private static final int MELT_TIME = 6000; + private static final int COOLDOWN = 15000; + + public OutfitFreezeSuit(GadgetManager manager, String name, int cost, ArmorSlot slot, Material mat, byte data) + { + super(manager, name, + UtilText.splitLineToArray(C.cGray + "Stolen directly from the Winter Lord's closet, this coat is designed to " + + "survive the coldest of weather! Press sneak to generate your ice bridge.", LineFormat.LORE), + cost, slot, mat, data); + setColor(Color.fromRGB(129, 212, 250)); + // Sets the display item + if (slot.equals(ArmorSlot.HELMET)) + { + setDisplayItem(new ItemStack(mat, 1, data)); + } + else + { + ItemStack displayItem = new ItemStack(mat, 1, data); + if (displayItem.getItemMeta() instanceof LeatherArmorMeta) + { + LeatherArmorMeta leatherArmorMeta = (LeatherArmorMeta) displayItem.getItemMeta(); + leatherArmorMeta.setColor(Color.fromRGB(129, 212, 250)); + displayItem.setItemMeta(leatherArmorMeta); + } + setDisplayItem(displayItem); + } + } + + @Override + public void enableCustom(Player player, boolean message) + { + applyArmor(player, message); + } + + @Override + public void disableCustom(Player player, boolean message) + { + removeArmor(player, message); + } + + @EventHandler + public void activateBridge(PlayerToggleSneakEvent event) + { + // Prevents running event 4 times + if (getSlot() != ArmorSlot.HELMET) + return; + + if (!setActive(event.getPlayer())) + return; + + if (!event.isSneaking()) + return; + + if (!Recharge.Instance.use(event.getPlayer(), "Ice Path", COOLDOWN, true, false, "Cosmetics")) + return; + + Player player = event.getPlayer(); + + player.teleport(player.getLocation().add(0, 1, 0)); + UtilAction.velocity(player, new Vector(0, 0.5, 0)); + + _data.add(new FreezeSuitPathData(player)); + } + + @EventHandler + public void snowAura(UpdateEvent event) + { + // Prevents running event 4 times + if (getSlot() != ArmorSlot.HELMET) + return; + + if (event.getType() != UpdateType.FAST) + return; + + for(Player player : UtilServer.getPlayers()) + { + if (!setActive(player)) + { + continue; + } + + UtilParticle.PlayParticleToAll(UtilParticle.ParticleType.SNOW_SHOVEL, player.getLocation().add(0, 1, 0), + 0.25f, 0.25f, 0.25f, 0.1f, 1, UtilParticle.ViewDist.NORMAL); + + Map blocks = UtilBlock.getInRadius(player.getLocation(), RANGE); + + boolean setBlocks = true, forceBreak = false; + + for (Block block : blocks.keySet()) + { + if (Manager.getTreasureManager() != null) + { + if (Manager.getTreasureManager().isOpening(player)) + { + forceBreak= true; + } + for (Location blockLocation : Manager.getTreasureManager().getBlockLocations()) + { + if (blockLocation.distanceSquared(block.getLocation()) <= 25) + { + setBlocks = false; + } + } + } + if (forceBreak) + break; + + if (!setBlocks) + continue; + + Manager.getBlockRestore().snow(block, (byte) 1, (byte) 1, (int) (DURATION * (1 + blocks.get(block))), 250, 0); + } + } + } + + @EventHandler + public void icePath(UpdateEvent event) + { + // Prevents running event 4 times + if (getSlot() != ArmorSlot.HELMET) + return; + + if (event.getType() != UpdateType.TICK) + return; + + Iterator dataIterator = _data.iterator(); + + while (dataIterator.hasNext()) + { + FreezeSuitPathData data = dataIterator.next(); + + Block block = data.getNextBlock(); + + if (block == null) + { + dataIterator.remove(); + } + else + { + block.getWorld().playEffect(block.getLocation(), Effect.STEP_SOUND, 79); + Manager.getBlockRestore().add(block, 79, (byte) 0, MELT_TIME); + } + } + } + + private boolean setActive(Player player) + { + return getSet() != null && getSet().isActive(player); + } + +} diff --git a/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/outfit/freezesuit/OutfitFreezeSuitBoots.java b/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/outfit/freezesuit/OutfitFreezeSuitBoots.java new file mode 100644 index 000000000..dc4eb645f --- /dev/null +++ b/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/outfit/freezesuit/OutfitFreezeSuitBoots.java @@ -0,0 +1,15 @@ +package mineplex.core.gadget.gadgets.outfit.freezesuit; + +import org.bukkit.Material; + +import mineplex.core.gadget.GadgetManager; + +public class OutfitFreezeSuitBoots extends OutfitFreezeSuit +{ + + public OutfitFreezeSuitBoots(GadgetManager manager) + { + super(manager, "Freeze Boots", -16, ArmorSlot.BOOTS, Material.LEATHER_BOOTS, (byte) 0); + } + +} diff --git a/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/outfit/freezesuit/OutfitFreezeSuitChestplate.java b/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/outfit/freezesuit/OutfitFreezeSuitChestplate.java new file mode 100644 index 000000000..cb8edd7a6 --- /dev/null +++ b/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/outfit/freezesuit/OutfitFreezeSuitChestplate.java @@ -0,0 +1,15 @@ +package mineplex.core.gadget.gadgets.outfit.freezesuit; + +import org.bukkit.Material; + +import mineplex.core.gadget.GadgetManager; + +public class OutfitFreezeSuitChestplate extends OutfitFreezeSuit +{ + + public OutfitFreezeSuitChestplate(GadgetManager manager) + { + super(manager, "Freeze Chest", -16, ArmorSlot.CHEST, Material.LEATHER_CHESTPLATE, (byte) 0); + } + +} diff --git a/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/outfit/freezesuit/OutfitFreezeSuitHelmet.java b/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/outfit/freezesuit/OutfitFreezeSuitHelmet.java new file mode 100644 index 000000000..b8f3640a6 --- /dev/null +++ b/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/outfit/freezesuit/OutfitFreezeSuitHelmet.java @@ -0,0 +1,15 @@ +package mineplex.core.gadget.gadgets.outfit.freezesuit; + +import org.bukkit.Material; + +import mineplex.core.gadget.GadgetManager; + +public class OutfitFreezeSuitHelmet extends OutfitFreezeSuit +{ + + public OutfitFreezeSuitHelmet(GadgetManager manager) + { + super(manager, "Freeze Helmet", -16, ArmorSlot.HELMET, Material.ICE, (byte) 0); + } + +} diff --git a/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/outfit/freezesuit/OutfitFreezeSuitLeggings.java b/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/outfit/freezesuit/OutfitFreezeSuitLeggings.java new file mode 100644 index 000000000..c10a3b792 --- /dev/null +++ b/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/outfit/freezesuit/OutfitFreezeSuitLeggings.java @@ -0,0 +1,15 @@ +package mineplex.core.gadget.gadgets.outfit.freezesuit; + +import org.bukkit.Material; + +import mineplex.core.gadget.GadgetManager; + +public class OutfitFreezeSuitLeggings extends OutfitFreezeSuit +{ + + public OutfitFreezeSuitLeggings(GadgetManager manager) + { + super(manager, "Freeze Leggings", -16, ArmorSlot.LEGS, Material.LEATHER_LEGGINGS, (byte) 0); + } + +} diff --git a/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/outfit/ravesuit/OutfitRaveSuit.java b/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/outfit/ravesuit/OutfitRaveSuit.java index 2c851cced..48305d620 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/outfit/ravesuit/OutfitRaveSuit.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/outfit/ravesuit/OutfitRaveSuit.java @@ -64,7 +64,7 @@ public class OutfitRaveSuit extends OutfitGadget //Get Item ItemStack stack; - if (getSlot() == ArmorSlot.Helmet) + if (getSlot() == ArmorSlot.HELMET) { stack = player.getInventory().getHelmet(); @@ -74,7 +74,7 @@ public class OutfitRaveSuit extends OutfitGadget continue; } } - else if (getSlot() == ArmorSlot.Chest) + else if (getSlot() == ArmorSlot.CHEST) { stack = player.getInventory().getChestplate(); @@ -84,7 +84,7 @@ public class OutfitRaveSuit extends OutfitGadget continue; } } - else if (getSlot() == ArmorSlot.Legs) + else if (getSlot() == ArmorSlot.LEGS) { stack = player.getInventory().getLeggings(); @@ -94,7 +94,7 @@ public class OutfitRaveSuit extends OutfitGadget continue; } } - else if (getSlot() == ArmorSlot.Boots) + else if (getSlot() == ArmorSlot.BOOTS) { stack = player.getInventory().getBoots(); @@ -168,7 +168,7 @@ public class OutfitRaveSuit extends OutfitGadget if (event.getType() != UpdateType.FAST) return; - if (getSlot() != ArmorSlot.Helmet) + if (getSlot() != ArmorSlot.HELMET) return; for (Player player : UtilServer.getPlayers()) diff --git a/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/outfit/ravesuit/OutfitRaveSuitBoots.java b/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/outfit/ravesuit/OutfitRaveSuitBoots.java index e8635180e..5c7f34fb2 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/outfit/ravesuit/OutfitRaveSuitBoots.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/outfit/ravesuit/OutfitRaveSuitBoots.java @@ -9,7 +9,7 @@ public class OutfitRaveSuitBoots extends OutfitRaveSuit public OutfitRaveSuitBoots(GadgetManager manager) { - super(manager, "Rave Boots", -2, ArmorSlot.Boots, Material.LEATHER_BOOTS, (byte)0); + super(manager, "Rave Boots", -2, ArmorSlot.BOOTS, Material.LEATHER_BOOTS, (byte)0); } } diff --git a/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/outfit/ravesuit/OutfitRaveSuitChestplate.java b/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/outfit/ravesuit/OutfitRaveSuitChestplate.java index 94ef200b4..3494794cd 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/outfit/ravesuit/OutfitRaveSuitChestplate.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/outfit/ravesuit/OutfitRaveSuitChestplate.java @@ -9,7 +9,7 @@ public class OutfitRaveSuitChestplate extends OutfitRaveSuit public OutfitRaveSuitChestplate(GadgetManager manager) { - super(manager, "Rave Shirt", -2, ArmorSlot.Chest, Material.LEATHER_CHESTPLATE, (byte)0); + super(manager, "Rave Shirt", -2, ArmorSlot.CHEST, Material.LEATHER_CHESTPLATE, (byte)0); } } diff --git a/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/outfit/ravesuit/OutfitRaveSuitHelmet.java b/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/outfit/ravesuit/OutfitRaveSuitHelmet.java index 3de7d1c86..0f4433656 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/outfit/ravesuit/OutfitRaveSuitHelmet.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/outfit/ravesuit/OutfitRaveSuitHelmet.java @@ -9,7 +9,7 @@ public class OutfitRaveSuitHelmet extends OutfitRaveSuit public OutfitRaveSuitHelmet(GadgetManager manager) { - super(manager, "Rave Hat", -2, ArmorSlot.Helmet, Material.LEATHER_HELMET, (byte)0); + super(manager, "Rave Hat", -2, ArmorSlot.HELMET, Material.LEATHER_HELMET, (byte)0); } } diff --git a/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/outfit/ravesuit/OutfitRaveSuitLeggings.java b/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/outfit/ravesuit/OutfitRaveSuitLeggings.java index b17a31b30..d7569c34a 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/outfit/ravesuit/OutfitRaveSuitLeggings.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/outfit/ravesuit/OutfitRaveSuitLeggings.java @@ -9,7 +9,7 @@ public class OutfitRaveSuitLeggings extends OutfitRaveSuit public OutfitRaveSuitLeggings(GadgetManager manager) { - super(manager, "Rave Pants", -2, ArmorSlot.Legs, Material.LEATHER_LEGGINGS, (byte)0); + super(manager, "Rave Pants", -2, ArmorSlot.LEGS, Material.LEATHER_LEGGINGS, (byte)0); } } diff --git a/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/outfit/spacesuit/OutfitSpaceSuit.java b/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/outfit/spacesuit/OutfitSpaceSuit.java index bac66d1ae..c203d1b52 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/outfit/spacesuit/OutfitSpaceSuit.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/outfit/spacesuit/OutfitSpaceSuit.java @@ -43,7 +43,7 @@ public class OutfitSpaceSuit extends OutfitGadget if (event.getType() != UpdateType.FAST) return; - if (getSlot() != ArmorSlot.Helmet) + if (getSlot() != ArmorSlot.HELMET) return; for (Player player : UtilServer.getPlayers()) diff --git a/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/outfit/spacesuit/OutfitSpaceSuitBoots.java b/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/outfit/spacesuit/OutfitSpaceSuitBoots.java index 4e5ad32a3..c1f8c3e28 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/outfit/spacesuit/OutfitSpaceSuitBoots.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/outfit/spacesuit/OutfitSpaceSuitBoots.java @@ -9,7 +9,7 @@ public class OutfitSpaceSuitBoots extends OutfitSpaceSuit public OutfitSpaceSuitBoots(GadgetManager manager) { - super(manager, "Space Boots", -2, ArmorSlot.Boots, Material.GOLD_BOOTS, (byte)0); + super(manager, "Space Boots", -2, ArmorSlot.BOOTS, Material.GOLD_BOOTS, (byte)0); } } diff --git a/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/outfit/spacesuit/OutfitSpaceSuitChestplate.java b/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/outfit/spacesuit/OutfitSpaceSuitChestplate.java index 7df3e6e27..db8ea650e 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/outfit/spacesuit/OutfitSpaceSuitChestplate.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/outfit/spacesuit/OutfitSpaceSuitChestplate.java @@ -9,7 +9,7 @@ public class OutfitSpaceSuitChestplate extends OutfitSpaceSuit public OutfitSpaceSuitChestplate(GadgetManager manager) { - super(manager, "Space Jacket", -2, ArmorSlot.Chest, Material.GOLD_CHESTPLATE, (byte)0); + super(manager, "Space Jacket", -2, ArmorSlot.CHEST, Material.GOLD_CHESTPLATE, (byte)0); } } diff --git a/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/outfit/spacesuit/OutfitSpaceSuitHelmet.java b/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/outfit/spacesuit/OutfitSpaceSuitHelmet.java index 2a46a4f9e..caabcdc2f 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/outfit/spacesuit/OutfitSpaceSuitHelmet.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/outfit/spacesuit/OutfitSpaceSuitHelmet.java @@ -9,7 +9,7 @@ public class OutfitSpaceSuitHelmet extends OutfitSpaceSuit public OutfitSpaceSuitHelmet(GadgetManager manager) { - super(manager, "Space Helmet", -2, ArmorSlot.Helmet, Material.GLASS, (byte)0); + super(manager, "Space Helmet", -2, ArmorSlot.HELMET, Material.GLASS, (byte)0); } } diff --git a/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/outfit/spacesuit/OutfitSpaceSuitLeggings.java b/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/outfit/spacesuit/OutfitSpaceSuitLeggings.java index d690f06cb..0a9c71647 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/outfit/spacesuit/OutfitSpaceSuitLeggings.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/outfit/spacesuit/OutfitSpaceSuitLeggings.java @@ -9,7 +9,7 @@ public class OutfitSpaceSuitLeggings extends OutfitSpaceSuit public OutfitSpaceSuitLeggings(GadgetManager manager) { - super(manager, "Space Pants", -2, ArmorSlot.Legs, Material.GOLD_LEGGINGS, (byte)0); + super(manager, "Space Pants", -2, ArmorSlot.LEGS, Material.GOLD_LEGGINGS, (byte)0); } } diff --git a/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/outfit/windupsuit/OutfitWindUpSuit.java b/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/outfit/windupsuit/OutfitWindUpSuit.java index 201eab634..1d084921c 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/outfit/windupsuit/OutfitWindUpSuit.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/outfit/windupsuit/OutfitWindUpSuit.java @@ -230,19 +230,19 @@ public class OutfitWindUpSuit extends OutfitGadget { ItemStack stack; - if(getSlot() == ArmorSlot.Helmet) + if(getSlot() == ArmorSlot.HELMET) { stack = player.getInventory().getHelmet(); } - else if (getSlot() == ArmorSlot.Chest) + else if (getSlot() == ArmorSlot.CHEST) { stack = player.getInventory().getChestplate(); } - else if (getSlot() == ArmorSlot.Legs) + else if (getSlot() == ArmorSlot.LEGS) { stack = player.getInventory().getLeggings(); } - else if (getSlot() == ArmorSlot.Boots) + else if (getSlot() == ArmorSlot.BOOTS) { stack = player.getInventory().getBoots(); } diff --git a/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/outfit/windupsuit/OutfitWindUpSuitBoots.java b/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/outfit/windupsuit/OutfitWindUpSuitBoots.java index 54541e2c8..55448de2d 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/outfit/windupsuit/OutfitWindUpSuitBoots.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/outfit/windupsuit/OutfitWindUpSuitBoots.java @@ -8,7 +8,7 @@ public class OutfitWindUpSuitBoots extends OutfitWindUpSuit public OutfitWindUpSuitBoots(GadgetManager manager) { - super(manager, "Wind Up Boots", -2, ArmorSlot.Boots, Material.LEATHER_BOOTS, (byte)0, manager.getBoosterManager()); + super(manager, "Wind Up Boots", -2, ArmorSlot.BOOTS, Material.LEATHER_BOOTS, (byte)0, manager.getBoosterManager()); } } diff --git a/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/outfit/windupsuit/OutfitWindUpSuitChestplate.java b/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/outfit/windupsuit/OutfitWindUpSuitChestplate.java index bf1f8c5e2..bc64a4bd5 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/outfit/windupsuit/OutfitWindUpSuitChestplate.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/outfit/windupsuit/OutfitWindUpSuitChestplate.java @@ -8,7 +8,7 @@ public class OutfitWindUpSuitChestplate extends OutfitWindUpSuit public OutfitWindUpSuitChestplate(GadgetManager manager) { - super(manager, "Wind Up Shirt", -2, ArmorSlot.Chest, Material.LEATHER_CHESTPLATE, (byte)0, manager.getBoosterManager()); + super(manager, "Wind Up Shirt", -2, ArmorSlot.CHEST, Material.LEATHER_CHESTPLATE, (byte)0, manager.getBoosterManager()); } } diff --git a/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/outfit/windupsuit/OutfitWindUpSuitHelmet.java b/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/outfit/windupsuit/OutfitWindUpSuitHelmet.java index c801db220..23d19d334 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/outfit/windupsuit/OutfitWindUpSuitHelmet.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/outfit/windupsuit/OutfitWindUpSuitHelmet.java @@ -8,7 +8,7 @@ public class OutfitWindUpSuitHelmet extends OutfitWindUpSuit public OutfitWindUpSuitHelmet(GadgetManager manager) { - super(manager, "Wind Up Hat", -2, ArmorSlot.Helmet, Material.LEATHER_HELMET, (byte)0, manager.getBoosterManager()); + super(manager, "Wind Up Hat", -2, ArmorSlot.HELMET, Material.LEATHER_HELMET, (byte)0, manager.getBoosterManager()); } } diff --git a/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/outfit/windupsuit/OutfitWindUpSuitLeggings.java b/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/outfit/windupsuit/OutfitWindUpSuitLeggings.java index 0f57f3875..c7b094e32 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/outfit/windupsuit/OutfitWindUpSuitLeggings.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/outfit/windupsuit/OutfitWindUpSuitLeggings.java @@ -8,7 +8,7 @@ public class OutfitWindUpSuitLeggings extends OutfitWindUpSuit public OutfitWindUpSuitLeggings(GadgetManager manager) { - super(manager, "Wind Up Pants", -2, ArmorSlot.Legs, Material.LEATHER_LEGGINGS, (byte)0, manager.getBoosterManager()); + super(manager, "Wind Up Pants", -2, ArmorSlot.LEGS, Material.LEATHER_LEGGINGS, (byte)0, manager.getBoosterManager()); } } diff --git a/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/particle/ParticleChristmasTree.java b/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/particle/ParticleChristmasTree.java new file mode 100644 index 000000000..8261df65c --- /dev/null +++ b/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/particle/ParticleChristmasTree.java @@ -0,0 +1,58 @@ +package mineplex.core.gadget.gadgets.particle; + +import java.util.HashMap; +import java.util.Map; +import java.util.UUID; + +import org.bukkit.Material; +import org.bukkit.entity.Player; + +import mineplex.core.common.util.C; +import mineplex.core.common.util.LineFormat; +import mineplex.core.common.util.UtilText; +import mineplex.core.gadget.GadgetManager; +import mineplex.core.gadget.types.ParticleGadget; +import mineplex.core.particleeffects.ChristmasTreeEffect; +import mineplex.core.updater.event.UpdateEvent; + +public class ParticleChristmasTree extends ParticleGadget +{ + + private Map _effects = new HashMap<>(); + + public ParticleChristmasTree(GadgetManager manager) + { + super(manager, "Holiday Tree", UtilText.splitLinesToArray(new String[]{C.cGray + + "There's nothing like a well decorated tree to bring in the Holiday Spirit."}, LineFormat.LORE), + -16, Material.SAPLING, (byte) 1); + } + + @Override + public void playParticle(Player player, UpdateEvent event) + { + + } + + @Override + public void startEffect(Player player) + { + if (!_effects.containsKey(player.getUniqueId())) + { + ChristmasTreeEffect christmasTreeEffect = new ChristmasTreeEffect(Manager.getPlugin(), player, Manager); + christmasTreeEffect.start(); + _effects.put(player.getUniqueId(), christmasTreeEffect); + } + } + + @Override + public void stopEffect(Player player) + { + if (_effects.containsKey(player.getUniqueId())) + { + ChristmasTreeEffect christmasTreeEffect = _effects.get(player.getUniqueId()); + christmasTreeEffect.stop(); + _effects.remove(player.getUniqueId()); + } + } + +} diff --git a/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/particle/ParticleCoalFumes.java b/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/particle/ParticleCoalFumes.java index 63bdd7b12..467db55d2 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/particle/ParticleCoalFumes.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/particle/ParticleCoalFumes.java @@ -39,6 +39,6 @@ public class ParticleCoalFumes extends ParticleGadget amount = 2; } - UtilParticle.PlayParticleToAll(type, player.getLocation(), xz, 0, xz, 0, amount, ViewDist.NORMAL); + UtilParticle.playParticleFor(player, type, player.getLocation(), xz, 0, xz, 0, amount, ViewDist.NORMAL); } } diff --git a/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/particle/ParticleFireRings.java b/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/particle/ParticleFireRings.java index de25c0f7a..0a2298be6 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/particle/ParticleFireRings.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/particle/ParticleFireRings.java @@ -1,22 +1,20 @@ package mineplex.core.gadget.gadgets.particle; -import org.bukkit.GameMode; import org.bukkit.Material; import org.bukkit.Sound; import org.bukkit.entity.Player; -import org.bukkit.event.EventHandler; import mineplex.core.common.util.C; import mineplex.core.common.util.LineFormat; import mineplex.core.common.util.UtilParticle; -import mineplex.core.common.util.UtilServer; -import mineplex.core.common.util.UtilText; import mineplex.core.common.util.UtilParticle.ParticleType; import mineplex.core.common.util.UtilParticle.ViewDist; +import mineplex.core.common.util.UtilServer; +import mineplex.core.common.util.UtilText; +import mineplex.core.gadget.GadgetManager; import mineplex.core.gadget.types.ParticleGadget; import mineplex.core.updater.UpdateType; import mineplex.core.updater.event.UpdateEvent; -import mineplex.core.gadget.GadgetManager; public class ParticleFireRings extends ParticleGadget { @@ -25,7 +23,7 @@ public class ParticleFireRings extends ParticleGadget { super(manager, "Flame Rings", UtilText.splitLineToArray(C.cGray + "Forged from the blazing rods of 1000 Blazes by the infamous Nether King.", LineFormat.LORE), - -2, Material.BLAZE_POWDER, (byte) 0); + -2, Material.BLAZE_ROD, (byte) 0); } @Override diff --git a/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/particle/ParticleKronos.java b/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/particle/ParticleKronos.java index 9da1505f5..92239bdfd 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/particle/ParticleKronos.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/particle/ParticleKronos.java @@ -56,7 +56,7 @@ public class ParticleKronos extends ParticleGadget /*Until it becomes purchasable*/if (Manager.getClientManager().Get(event.getPlayer()).GetRank().equals(Rank.TITAN)) //if (Manager.getClientManager().Get(event.getPlayer()).GetRank().has(Rank.TITAN)) { - Manager.getDonationManager().Get(event.getPlayer()).AddUnknownSalesPackagesOwned(getName()); + Manager.getDonationManager().Get(event.getPlayer()).addOwnedUnknownSalesPackage(getName()); } } diff --git a/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/particle/ParticleWingsDemons.java b/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/particle/ParticleWingsDemons.java index 5abe6764f..ca1f4f584 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/particle/ParticleWingsDemons.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/particle/ParticleWingsDemons.java @@ -37,7 +37,7 @@ public class ParticleWingsDemons extends ParticleGadget if (Manager.isMoving(player)) { if (event.getType() == UpdateType.FASTEST) - UtilParticle.PlayParticleToAll(ParticleType.SMOKE, loc, 0.3f, 0.2f, 0.3f, 0, 10, ViewDist.NORMAL); + UtilParticle.playParticleFor(player, ParticleType.SMOKE, loc, 0.3f, 0.2f, 0.3f, 0, 10, ViewDist.NORMAL); return; } diff --git a/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/particle/ParticleWingsLove.java b/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/particle/ParticleWingsLove.java new file mode 100644 index 000000000..3ad307040 --- /dev/null +++ b/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/particle/ParticleWingsLove.java @@ -0,0 +1,59 @@ +package mineplex.core.gadget.gadgets.particle; + +import java.awt.Color; + +import org.bukkit.Location; +import org.bukkit.Material; +import org.bukkit.entity.Player; +import org.bukkit.potion.PotionType; +import org.bukkit.util.Vector; + +import mineplex.core.common.shape.ShapeWings; +import mineplex.core.common.util.C; +import mineplex.core.common.util.LineFormat; +import mineplex.core.common.util.UtilParticle; +import mineplex.core.common.util.UtilText; +import mineplex.core.gadget.GadgetManager; +import mineplex.core.gadget.types.ParticleGadget; +import mineplex.core.itemstack.ItemStackFactory; +import mineplex.core.updater.UpdateType; +import mineplex.core.updater.event.UpdateEvent; + +public class ParticleWingsLove extends ParticleGadget +{ + + private ShapeWings _wings = new ShapeWings(UtilParticle.ParticleType.RED_DUST.particleName, new Vector(1, 1, 1), 1, 0, false, ShapeWings.DEFAULT_ROTATION, ShapeWings.HEART_WING_PATTERN); + private ShapeWings _wingsWhite = new ShapeWings(UtilParticle.ParticleType.RED_DUST.particleName, new Vector(1, 1, 1), 1, 0, '%', ShapeWings.DEFAULT_ROTATION, ShapeWings.HEART_WING_PATTERN); + private ShapeWings _wingsEdge = new ShapeWings(UtilParticle.ParticleType.RED_DUST.particleName, new Vector(1, 1, 1), 1, 0, true, ShapeWings.DEFAULT_ROTATION, ShapeWings.HEART_WING_PATTERN); + + public ParticleWingsLove(GadgetManager manager) + { + super(manager, "Love Wings", + UtilText.splitLineToArray(C.cGray + "Sometimes Love just makes you want to fly.", LineFormat.LORE), + -17, Material.NETHER_STAR, (byte) 0); + setDisplayItem(ItemStackFactory.Instance.createCustomPotion(PotionType.INSTANT_HEAL)); + } + + @Override + public void playParticle(Player player, UpdateEvent event) + { + Location loc = player.getLocation().add(0, 1.2, 0).add(player.getLocation().getDirection().multiply(-0.2)); + if (Manager.isMoving(player)) + { + if (event.getType() == UpdateType.TICK) + { + _wings.displayColoredParticle(loc, Color.PINK); + _wingsWhite.displayColoredParticle(loc, Color.WHITE); + _wingsEdge.displayColoredParticle(loc, Color.BLACK); + } + return; + } + + if (event.getType() == UpdateType.FAST) + { + _wings.displayColored(loc, Color.PINK); + _wingsWhite.displayColored(loc, Color.WHITE); + _wingsEdge.displayColored(loc, Color.BLACK); + } + } +} diff --git a/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/particle/ParticleYinYang.java b/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/particle/ParticleYinYang.java index da68db221..19cd7705c 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/particle/ParticleYinYang.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/particle/ParticleYinYang.java @@ -64,8 +64,8 @@ public class ParticleYinYang extends ParticleGadget z *= 0.1 + ((1-d) * 0.9); } - UtilParticle.PlayParticleToAll(ParticleType.FIREWORKS_SPARK, loc, new Vector(x, y, z), 1, 0, ViewDist.NORMAL); - UtilParticle.PlayParticleToAll(ParticleType.FIREWORKS_SPARK, loc, new Vector(-x, y, -z), 1, 0, ViewDist.NORMAL); + UtilParticle.playParticleFor(player, ParticleType.FIREWORKS_SPARK, loc, new Vector(x, y, z), 1, 0, ViewDist.NORMAL); + UtilParticle.playParticleFor(player, ParticleType.FIREWORKS_SPARK, loc, new Vector(-x, y, -z), 1, 0, ViewDist.NORMAL); if(y == 0) { @@ -78,9 +78,9 @@ public class ParticleYinYang extends ParticleGadget for(int i = 0; i < a; i++) { - UtilParticle.PlayParticleToAll(ParticleType.RED_DUST, loc.clone().add(v), + UtilParticle.playParticleFor(player, ParticleType.RED_DUST, loc.clone().add(v), UtilColor.colorToVector(Color.BLACK), 1, 0, ViewDist.NORMAL); - UtilParticle.PlayParticleToAll(ParticleType.RED_DUST, loc.clone().subtract(v), + UtilParticle.playParticleFor(player, ParticleType.RED_DUST, loc.clone().subtract(v), UtilColor.colorToVector(Color.BLACK), 1, 0, ViewDist.NORMAL); } } diff --git a/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/particle/candycane/ParticleCandyCane.java b/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/particle/candycane/ParticleCandyCane.java index aead78417..4d8b223fc 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/particle/candycane/ParticleCandyCane.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/particle/candycane/ParticleCandyCane.java @@ -61,9 +61,9 @@ public class ParticleCandyCane extends ParticleGadget loc.add(v); } - UtilParticle.PlayParticleToAll(UtilParticle.ParticleType.ICON_CRACK.getParticle(Material.INK_SACK, 15), loc, w, y, w, 0, a, UtilParticle.ViewDist.NORMAL); - UtilParticle.PlayParticleToAll(UtilParticle.ParticleType.ICON_CRACK.getParticle(Material.INK_SACK, 1), loc, w, y, w, 0, a, UtilParticle.ViewDist.NORMAL); - UtilParticle.PlayParticleToAll(UtilParticle.ParticleType.ICON_CRACK.getParticle(Material.INK_SACK, 2), loc, w, y, w, 0, a, UtilParticle.ViewDist.NORMAL); + UtilParticle.playParticleFor(player, UtilParticle.ParticleType.ICON_CRACK.getParticle(Material.INK_SACK, 15), loc, w, y, w, 0, a, UtilParticle.ViewDist.NORMAL); + UtilParticle.playParticleFor(player, UtilParticle.ParticleType.ICON_CRACK.getParticle(Material.INK_SACK, 1), loc, w, y, w, 0, a, UtilParticle.ViewDist.NORMAL); + UtilParticle.playParticleFor(player, UtilParticle.ParticleType.ICON_CRACK.getParticle(Material.INK_SACK, 2), loc, w, y, w, 0, a, UtilParticle.ViewDist.NORMAL); } @EventHandler diff --git a/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/particle/cupidslove/ParticleHeart.java b/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/particle/cupidslove/ParticleHeart.java index db4464335..dea6a85aa 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/particle/cupidslove/ParticleHeart.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/particle/cupidslove/ParticleHeart.java @@ -37,11 +37,11 @@ public class ParticleHeart extends ParticleGadget { if(getSet() == null || !getSet().isActive(player)) return; - UtilParticle.PlayParticleToAll(ParticleType.HEART, player.getLocation().add(0, 1, 0), null, 0, 1, ViewDist.NORMAL); + UtilParticle.playParticleFor(player, ParticleType.HEART, player.getLocation().add(0, 1, 0), null, 0, 1, ViewDist.NORMAL); } else { - UtilParticle.PlayParticleToAll(ParticleType.HEART, player.getLocation().add(0, 1, 0), 0.5f, 0.5f, 0.5f, 0, 1, ViewDist.NORMAL); + UtilParticle.playParticleFor(player, ParticleType.HEART, player.getLocation().add(0, 1, 0), 0.5f, 0.5f, 0.5f, 0, 1, ViewDist.NORMAL); } } diff --git a/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/particle/freedom/ParticleFreedom.java b/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/particle/freedom/ParticleFreedom.java index 4b639156c..bafa31183 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/particle/freedom/ParticleFreedom.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/particle/freedom/ParticleFreedom.java @@ -4,16 +4,18 @@ import java.util.HashMap; import java.util.Map; import java.util.UUID; -import mineplex.core.common.util.LineFormat; -import mineplex.core.common.util.UtilText; -import mineplex.core.gadget.GadgetManager; -import mineplex.core.particleeffects.FreedomFireworkEffect; -import mineplex.core.gadget.types.ParticleGadget; -import mineplex.core.updater.event.UpdateEvent; import org.bukkit.ChatColor; import org.bukkit.Material; import org.bukkit.entity.Player; +import mineplex.core.common.util.LineFormat; +import mineplex.core.common.util.UtilText; +import mineplex.core.common.util.banner.CountryFlag; +import mineplex.core.gadget.GadgetManager; +import mineplex.core.gadget.types.ParticleGadget; +import mineplex.core.particleeffects.FreedomFireworkEffect; +import mineplex.core.updater.event.UpdateEvent; + public class ParticleFreedom extends ParticleGadget { @@ -24,6 +26,7 @@ public class ParticleFreedom extends ParticleGadget super(manager, "Freedom Aura", UtilText.splitLineToArray(UtilText.colorWords("Do you hear that? It's the sound of Freedom swirling around you.", ChatColor.RED, ChatColor.WHITE, ChatColor.BLUE), LineFormat.LORE), -8, Material.WOOL, (byte) 11); + setDisplayItem(CountryFlag.USA.getBanner()); } @Override diff --git a/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/particle/howlingwinds/ParticleRain.java b/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/particle/howlingwinds/ParticleRain.java index f463f648d..f2c45007c 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/particle/howlingwinds/ParticleRain.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/particle/howlingwinds/ParticleRain.java @@ -37,7 +37,7 @@ public class ParticleRain extends ParticleGadget if (Manager.isMoving(player)) { - UtilParticle.PlayParticleToAll(ParticleType.SPLASH, player.getLocation(), 0.2f, 0, 0.2f, 0, 6, ViewDist.NORMAL); + UtilParticle.playParticleFor(player, ParticleType.SPLASH, player.getLocation(), 0.2f, 0, 0.2f, 0, 6, ViewDist.NORMAL); } else { @@ -49,7 +49,7 @@ public class ParticleRain extends ParticleGadget others.remove(player); UtilParticle.PlayParticle(ParticleType.CLOUD, loc, 0.6f, 0.1f, 0.6f, 0, 8, ViewDist.NORMAL); - UtilParticle.PlayParticleToAll(ParticleType.DRIP_WATER, loc, 0.4f, 0.1f, 0.4f, 0, 2, ViewDist.NORMAL); + UtilParticle.playParticleFor(player, ParticleType.DRIP_WATER, loc, 0.4f, 0.1f, 0.4f, 0, 2, ViewDist.NORMAL); // Sound player.getWorld().playSound(player.getLocation(), Sound.AMBIENCE_RAIN, 0.1f, 1f); diff --git a/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/particle/music/ParticleMusic.java b/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/particle/music/ParticleMusic.java index 3422ae096..04874fffc 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/particle/music/ParticleMusic.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/particle/music/ParticleMusic.java @@ -49,7 +49,7 @@ public class ParticleMusic extends ParticleGadget if (moving) { - UtilParticle.PlayParticleToAll(ParticleType.NOTE, player.getLocation(), d, 0, 0, 1, 0, ViewDist.NORMAL); + UtilParticle.playParticleFor(player, ParticleType.NOTE, player.getLocation(), d, 0, 0, 1, 0, ViewDist.NORMAL); return; } @@ -64,7 +64,7 @@ public class ParticleMusic extends ParticleGadget Location loc = player.getLocation().add(x, y, z); - UtilParticle.PlayParticleToAll(ParticleType.NOTE, loc, d, 0, 0, 1, 0, ViewDist.NORMAL); + UtilParticle.playParticleFor(player, ParticleType.NOTE, loc, d, 0, 0, 1, 0, ViewDist.NORMAL); } if (getSet() != null && getSet().isActive(player)) @@ -84,7 +84,7 @@ public class ParticleMusic extends ParticleGadget double z = Math.cos(rad2 + step) * r; Location loc = player.getLocation().add(x, 1.25, z); - UtilParticle.PlayParticleToAll(ParticleType.RED_DUST, loc, new Vector(red, green, blue), 1, 0, ViewDist.NORMAL); + UtilParticle.playParticleFor(player, ParticleType.RED_DUST, loc, new Vector(red, green, blue), 1, 0, ViewDist.NORMAL); } } diff --git a/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/particle/party/ParticlePartyTime.java b/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/particle/party/ParticlePartyTime.java index eada07e8d..3aab6f928 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/particle/party/ParticlePartyTime.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/particle/party/ParticlePartyTime.java @@ -2,18 +2,18 @@ package mineplex.core.gadget.gadgets.particle.party; import java.util.Arrays; import java.util.Collections; +import java.util.HashMap; import java.util.HashSet; import java.util.Iterator; import java.util.List; +import java.util.Map; import java.util.Set; -import org.bukkit.Bukkit; import org.bukkit.Location; import org.bukkit.Material; import org.bukkit.entity.Item; import org.bukkit.entity.Player; import org.bukkit.event.EventHandler; -import org.bukkit.event.entity.ItemDespawnEvent; import org.bukkit.inventory.ItemStack; import org.bukkit.util.Vector; @@ -33,78 +33,91 @@ import mineplex.core.updater.event.UpdateEvent; public class ParticlePartyTime extends ParticleGadget { - - private Set _hiddenDrops = new HashSet<>(); - - private Byte[] _data = new Byte[]{1,2,4,5,6,9,10,11,12,13,14,15}; + + private Map> _hiddenDrops = new HashMap<>(); + + private Byte[] _data = new Byte[]{1, 2, 4, 5, 6, 9, 10, 11, 12, 13, 14, 15}; public ParticlePartyTime(GadgetManager manager) { - super(manager, "Party Time", + super(manager, "Party Time", UtilText.splitLineToArray(C.cGray + "It is " + C.cPurple + "PARTY TIME!", LineFormat.LORE), - -3, Material.FIREWORK, (byte)-1); + -3, Material.FIREWORK, (byte) -1); } - + @Override public void playParticle(Player player, UpdateEvent event) { - if(event.getType() != UpdateType.TICK) return; - - Location loc = player.getLocation().add(Math.random()*2-1, 2.3 + Math.random()*0.7, Math.random()*2-1); - + if (event.getType() != UpdateType.TICK) return; + + Location loc = player.getLocation().add(Math.random() * 2 - 1, 2.3 + Math.random() * 0.7, Math.random() * 2 - 1); + List list = Arrays.asList(_data); Collections.shuffle(list); - for(int i = 0; i < 1; i++) + for (int i = 0; i < 1; i++) { String particle = ParticleType.ICON_CRACK.getParticle(Material.INK_SACK, list.get(i)); - if(Manager.isMoving(player)) { - UtilParticle.PlayParticleToAll(particle, player.getLocation().add(0, 1, 0), null, 0.08f, 1, ViewDist.NORMAL); - } else { - UtilParticle.PlayParticleToAll(particle, loc, null, 0.08f, 10, ViewDist.NORMAL); + if (Manager.isMoving(player)) + { + UtilParticle.playParticleFor(player, particle, player.getLocation().add(0, 1, 0), null, 0.08f, 1, ViewDist.NORMAL); + } + else + { + UtilParticle.playParticleFor(player, particle, loc, null, 0.08f, 10, ViewDist.NORMAL); } } - - if(getSet() != null && getSet().isActive(player)) + + if (getSet() != null && getSet().isActive(player)) { - if(player.getTicksLived()%10 == 0) + if (player.getTicksLived() % 10 == 0) { Location spawnLoc = player.getLocation().add(0, 2.5, 0); - Vector v = Vector.getRandom().subtract(Vector.getRandom()).setY(0).normalize().multiply(0.3).setY(0.3+0.3*Math.random()); + Vector v = Vector.getRandom().subtract(Vector.getRandom()).setY(0).normalize().multiply(0.3).setY(0.3 + 0.3 * Math.random()); byte data = _data[UtilMath.r(_data.length)]; - ItemStack stack = new ItemStack(Material.INK_SACK, 1, (short)0, data); + ItemStack stack = new ItemStack(Material.INK_SACK, 1, (short) 0, data); Item item = UtilItem.dropItem(stack, spawnLoc, false, false, 10, true); item.setVelocity(v); - - _hiddenDrops.add(item); + + _hiddenDrops.computeIfAbsent(player, key -> new HashSet<>()).add(item); DisguiseArmorStand stand = new DisguiseArmorStand(item); stand.setInvisible(true); Manager.getDisguiseManager().disguise(stand); - + String particle = ParticleType.ICON_CRACK.getParticle(Material.INK_SACK, data); - UtilParticle.PlayParticleToAll(particle, spawnLoc, null, 0.08f, 30, ViewDist.NORMAL); + UtilParticle.playParticleFor(player, particle, spawnLoc, null, 0.08f, 30, ViewDist.NORMAL); } } } - - @EventHandler - public void onUpdate(UpdateEvent event) - { - if(event.getType() != UpdateType.TICK) return; - - for(Iterator it = _hiddenDrops.iterator(); it.hasNext();) - { - Item item = it.next(); - if(!item.isValid()) { - it.remove(); - return; - } - -// Bukkit.broadcastMessage("Item still alive: " + item.getTicksLived()); - - String particle = ParticleType.ICON_CRACK.getParticle(item.getItemStack().getType(), item.getItemStack().getData().getData()); - UtilParticle.PlayParticleToAll(particle, item.getLocation(), null, 0, 3, ViewDist.NORMAL); - } - } + + @Override + public void stopEffect(Player player) + { + _hiddenDrops.remove(player); + } + + @EventHandler + public void onUpdate(UpdateEvent event) + { + if (event.getType() != UpdateType.TICK) return; + + _hiddenDrops.forEach((key, value) -> + { + for (Iterator it = value.iterator(); it.hasNext(); ) + { + Item item = it.next(); + if (!item.isValid()) + { + it.remove(); + return; + } + +// Bukkit.broadcastMessage("Item still alive: " + item.getTicksLived()); + + String particle = ParticleType.ICON_CRACK.getParticle(item.getItemStack().getType(), item.getItemStack().getData().getData()); + UtilParticle.playParticleFor(key, particle, item.getLocation(), null, 0, 3, ViewDist.NORMAL); + } + }); + } } diff --git a/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/particle/titan/ParticleTitan.java b/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/particle/titan/ParticleTitan.java index 973c54471..b5f02de23 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/particle/titan/ParticleTitan.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/particle/titan/ParticleTitan.java @@ -51,7 +51,7 @@ public class ParticleTitan extends ParticleGadget if (Manager.isMoving(player)) { - UtilParticle.PlayParticleToAll(ParticleType.FLAME, player.getLocation().add(0, 0.1, 0), 0.2f, 0.1f, 0.2f, 0.015f, 3, ViewDist.NORMAL); + UtilParticle.playParticleFor(player, ParticleType.FLAME, player.getLocation().add(0, 0.1, 0), 0.2f, 0.1f, 0.2f, 0.015f, 3, ViewDist.NORMAL); return; } @@ -70,9 +70,9 @@ public class ParticleTitan extends ParticleGadget loc.add(v); - if (redstone) UtilParticle.PlayParticleToAll(ParticleType.RED_DUST, loc, 1, 0, 0, 1, 0, ViewDist.NORMAL); + if (redstone) UtilParticle.playParticleFor(player, ParticleType.RED_DUST, loc, 1, 0, 0, 1, 0, ViewDist.NORMAL); v.multiply(-1); - UtilParticle.PlayParticleToAll(ParticleType.FLAME, loc, v, 0.05f, 0, ViewDist.NORMAL); + UtilParticle.playParticleFor(player, ParticleType.FLAME, loc, v, 0.05f, 0, ViewDist.NORMAL); rad = -(step * i + offset2); x = Math.sin(rad); @@ -85,9 +85,9 @@ public class ParticleTitan extends ParticleGadget loc.add(v); - if (redstone) UtilParticle.PlayParticleToAll(ParticleType.RED_DUST, loc, 1, 0, 0, 1, 0, ViewDist.NORMAL); + if (redstone) UtilParticle.playParticleFor(player, ParticleType.RED_DUST, loc, 1, 0, 0, 1, 0, ViewDist.NORMAL); v.multiply(-1); - UtilParticle.PlayParticleToAll(ParticleType.FLAME, loc, v, 0.05f, 0, ViewDist.NORMAL); + UtilParticle.playParticleFor(player, ParticleType.FLAME, loc, v, 0.05f, 0, ViewDist.NORMAL); } } @@ -96,7 +96,7 @@ public class ParticleTitan extends ParticleGadget { if (Manager.getClientManager().Get(event.getPlayer()).GetRank().has(Rank.TITAN)) { - Manager.getDonationManager().Get(event.getPlayer()).AddUnknownSalesPackagesOwned(getName()); + Manager.getDonationManager().Get(event.getPlayer()).addOwnedUnknownSalesPackage(getName()); } } } diff --git a/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/particle/vampire/ParticleBlood.java b/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/particle/vampire/ParticleBlood.java index e7c8d66ae..a33078067 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/particle/vampire/ParticleBlood.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/particle/vampire/ParticleBlood.java @@ -32,7 +32,7 @@ public class ParticleBlood extends ParticleGadget if (Manager.isMoving(player)) { - UtilParticle.PlayParticleToAll(ParticleType.RED_DUST, player.getLocation().add(0, 1, 0), 0.2f, 0.2f, 0.2f, 0, 2, ViewDist.NORMAL); + UtilParticle.playParticleFor(player, ParticleType.RED_DUST, player.getLocation().add(0, 1, 0), 0.2f, 0.2f, 0.2f, 0, 2, ViewDist.NORMAL); } else { @@ -55,7 +55,7 @@ public class ParticleBlood extends ParticleGadget Location lloc = loc.clone().add(v); - UtilParticle.PlayParticleToAll(ParticleType.RED_DUST, lloc, null, 0f, 2, ViewDist.NORMAL); + UtilParticle.playParticleFor(player, ParticleType.RED_DUST, lloc, null, 0f, 2, ViewDist.NORMAL); } } } diff --git a/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/taunts/BlowAKissTaunt.java b/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/taunts/BlowAKissTaunt.java new file mode 100644 index 000000000..aa16f3bcc --- /dev/null +++ b/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/taunts/BlowAKissTaunt.java @@ -0,0 +1,62 @@ +package mineplex.core.gadget.gadgets.taunts; + +import java.util.HashSet; + +import org.bukkit.Location; +import org.bukkit.Material; +import org.bukkit.entity.Player; +import org.bukkit.potion.PotionType; + +import mineplex.core.common.util.C; +import mineplex.core.common.util.LineFormat; +import mineplex.core.common.util.UtilText; +import mineplex.core.gadget.GadgetManager; +import mineplex.core.gadget.types.TauntGadget; +import mineplex.core.itemstack.ItemStackFactory; +import mineplex.core.particleeffects.BlowAKissEffect; +import mineplex.core.recharge.Recharge; + +public class BlowAKissTaunt extends TauntGadget +{ + + private static final int COOLDOWN = 30000; + private static final int PVP_COOLDOWN = 10000; + + public BlowAKissTaunt(GadgetManager manager) + { + super(manager, "Blow A Kiss", UtilText.splitLinesToArray(new String[]{ + C.cWhite + "Type /taunt in game to blow a kiss at your enemies.", + C.cRed + "Cannot be used while in PvP!"}, LineFormat.LORE), + -17, Material.GLASS, (byte) 0); + setDisplayItem(ItemStackFactory.Instance.createCustomPotion(PotionType.INSTANT_HEAL)); + setCanPlayWithPvp(false); + setPvpCooldown(PVP_COOLDOWN); + setShouldPlay(false); + } + + @Override + public void onStart(Player player) + { + if (!Recharge.Instance.use(player, getName(), COOLDOWN, true, false, "Cosmetics")) + return; + + HashSet ignore = new HashSet<>(); + ignore.add(Material.AIR); + Location loc = player.getTargetBlock(ignore, 64).getLocation().add(0.5, 0.5, 0.5); + + BlowAKissEffect blowAKissEffect = new BlowAKissEffect(player, loc, this); + blowAKissEffect.start(); + } + + @Override + public void onPlay(Player player) + { + + } + + @Override + public void onFinish(Player player) + { + + } +} diff --git a/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/taunts/EternalTaunt.java b/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/taunts/EternalTaunt.java new file mode 100644 index 000000000..53e6a7793 --- /dev/null +++ b/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/taunts/EternalTaunt.java @@ -0,0 +1,147 @@ +package mineplex.core.gadget.gadgets.taunts; + +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; +import java.util.UUID; + +import org.bukkit.Bukkit; +import org.bukkit.Color; +import org.bukkit.FireworkEffect; +import org.bukkit.Material; +import org.bukkit.Sound; +import org.bukkit.entity.Item; +import org.bukkit.entity.Player; +import org.bukkit.event.EventHandler; +import org.bukkit.event.player.PlayerJoinEvent; +import org.bukkit.event.player.PlayerPickupItemEvent; +import org.bukkit.util.Vector; + +import mineplex.core.common.Rank; +import mineplex.core.common.util.C; +import mineplex.core.common.util.F; +import mineplex.core.common.util.LineFormat; +import mineplex.core.common.util.UtilAction; +import mineplex.core.common.util.UtilFirework; +import mineplex.core.common.util.UtilText; +import mineplex.core.disguise.disguises.DisguiseSkeleton; +import mineplex.core.events.EnableArcadeSpawnEvent; +import mineplex.core.gadget.GadgetManager; +import mineplex.core.gadget.gadgets.morph.managers.UtilMorph; +import mineplex.core.gadget.types.TauntGadget; +import mineplex.core.itemstack.ItemStackFactory; +import mineplex.core.recharge.Recharge; +import mineplex.core.updater.UpdateType; + +public class EternalTaunt extends TauntGadget +{ + + private static final int COOLDOWN = 30000; + private static final int PVP_COOLDOWN = 10000; + + private Map> _clocks = new HashMap<>(); + + public EternalTaunt(GadgetManager manager) + { + super(manager, "Eternal Taunt", UtilText.splitLinesToArray(new String[]{C.cGray + "Although the Eternal has been around forever, he waited too long for a worthy opponent and he turned to bones.", + "", + C.cWhite + "Use /taunt in game to show how long you've been waiting.", + C.cRed + "Cannot be used while in PvP!"}, LineFormat.LORE), + -15, Material.WATCH, (byte) 0); + setCanPlayWithPvp(false); + setPvpCooldown(PVP_COOLDOWN); + setShouldPlay(true); + setEventType(UpdateType.FAST); + addDisabledGames(GameType.SMASH, GameType.SMASHTEAMS, GameType.SMASHDOMINATION); + } + + @Override + public void onStart(Player player) + { + if (!Recharge.Instance.use(player, getName(), COOLDOWN, true, false, "Cosmetics")) + return; + UtilFirework.playFirework(player.getLocation(), FireworkEffect.builder().with(FireworkEffect.Type.BALL_LARGE).withColor(Color.fromRGB(255, 175, 175)).withFade(Color.RED).build()); + + _clocks.put(player.getUniqueId(), new ArrayList<>()); + + Bukkit.broadcastMessage(F.main("Taunt", F.name(player.getName()) + " waited so long they turned to bones.")); + + DisguiseSkeleton disguiseSkeleton = new DisguiseSkeleton(player); + UtilMorph.disguise(player, disguiseSkeleton, Manager); + } + + @Override + public void onPlay(Player player) + { + if (!_clocks.containsKey(player.getUniqueId())) + return; + + int i = getPlayerTicks(player); + + EnableArcadeSpawnEvent enableArcadeSpawnEvent = new EnableArcadeSpawnEvent(true); + Bukkit.getPluginManager().callEvent(enableArcadeSpawnEvent); + + Item clock = player.getWorld().dropItem(player.getLocation().add(0.5, 1.5, 0.5), + ItemStackFactory.Instance.CreateStack(Material.WATCH, (byte) 0, 1, " " + i)); + + enableArcadeSpawnEvent = new EnableArcadeSpawnEvent(false); + Bukkit.getPluginManager().callEvent(enableArcadeSpawnEvent); + + Vector vel = new Vector(Math.sin(i * 9/5d), 0, Math.cos(i * 9/5d)); + UtilAction.velocity(clock, vel, Math.abs(Math.sin(i * 12/3000d)), false, 0, 0.2 + Math.abs(Math.cos(i * 12/3000d))*0.6, 1, false); + + _clocks.get(player.getUniqueId()).add(clock); + + if (_clocks.get(player.getUniqueId()).size() >= 5) + { + _clocks.get(player.getUniqueId()).get(0).remove(); + _clocks.get(player.getUniqueId()).remove(0); + } + + if (i % 2 == 0) + player.playSound(player.getLocation(), Sound.CLICK, 1f, 1f); + else + player.playSound(player.getLocation(), Sound.CLICK, 0.5f, 0.5f); + + if (i >= 15) + { + finish(player); + } + } + + @Override + public void onFinish(Player player) + { + UtilMorph.undisguise(player, Manager.getDisguiseManager()); + if (_clocks.containsKey(player.getUniqueId())) + { + _clocks.get(player.getUniqueId()).forEach(c -> c.remove()); + _clocks.get(player.getUniqueId()).clear(); + _clocks.remove(player.getUniqueId()); + } + } + + @EventHandler + public void titanOwner(PlayerJoinEvent event) + { + if (Manager.getClientManager().Get(event.getPlayer()).GetRank().has(Rank.ETERNAL)) + { + Manager.getDonationManager().Get(event.getPlayer()).addOwnedUnknownSalesPackage(getName()); + } + } + + @EventHandler + public void onClockPickup(PlayerPickupItemEvent event) + { + for (List clocks : _clocks.values()) + { + for (Item item : clocks) + { + if (event.getItem().equals(item)) + event.setCancelled(true); + } + } + } + +} diff --git a/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/taunts/GameType.java b/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/taunts/GameType.java new file mode 100644 index 000000000..a0fe9230b --- /dev/null +++ b/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/taunts/GameType.java @@ -0,0 +1,84 @@ +package mineplex.core.gadget.gadgets.taunts; + +public enum GameType +{ + + BACONBRAWL, + BARBARIANS, + BASKETBALL, + BOSSBATTLES, + BRIDGE, + CASTLESIEGE, + CHAMPIONSCTF, + CHAMPIONSDOMINATE, + CHAMPIONSTDM, + CHRISTMAS, + DEATHTAG, + DRAGONESCAPE, + DRAGONESCAPETEAMS, + DRAGONRIDERS, + DRAGONS, + DRAGONSTEAMS, + DRAW, + ELYTRARINGS, + EVOLUTION, + GRAVITY, + HALLOWEEN, + HALLOWEEN2016, + HIDESEEK, + HOLEINTHEWALL, + HORSE, + LOBBERS, + MICRO, + MILKCOW, + MINESTRIKE, + BAWKBAWKBATTLES, + MINECRAFTLEAGUE, + OLDMINEWARE, + PAINTBALL, + QUIVER, + QUIVERPAYLOAD, + QUIVERTEAMS, + RUNNER, + SEARCHANDDESTROY, + SHEEP, + TYPEWARS, + SMASH, + SMASHDOMINATION, + SMASHTEAMS, + SNAKE, + SNEAKYASSASSINS, + SNOWFIGHT, + SPEEDBUILDERS, + SPLEEF, + SPLEEFTEAMS, + SQUIDSHOOTER, + STACKER, + SURVIVALGAMES, + SURVIVALGAMESTEAMS, + TUG, + TURFWARS, + UHC, + UHCSOLO, + UHCSOLOSPEED, + UHCTEAMSSPEED, + WITHERASSAULT, + WIZARDS, + ZOMBIESURVIVAL, + BUILD, + BUILDMAVERICKS, + CARDS, + SKYWARS, + SKYWARSTEAMS, + MONSTERMAZE, + MONSTERLEAGUE, + GLADIATORS, + SKYFALL, + SKYFALLTEAMS, + BOUNCYBALLS, + VALENTINES, + EVENT, + BRAWL, + NONE + +} diff --git a/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/wineffect/WinEffectHalloween.java b/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/wineffect/WinEffectHalloween.java index 49aaa7bbe..d40136327 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/wineffect/WinEffectHalloween.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/wineffect/WinEffectHalloween.java @@ -1,9 +1,9 @@ package mineplex.core.gadget.gadgets.wineffect; +import java.awt.Color; import java.util.ArrayList; import java.util.List; -import org.bukkit.Color; import org.bukkit.Location; import org.bukkit.Material; import org.bukkit.Sound; @@ -26,8 +26,8 @@ import mineplex.core.common.util.particles.ColoredParticle; import mineplex.core.common.util.particles.DustSpellColor; import mineplex.core.disguise.disguises.DisguisePlayer; import mineplex.core.gadget.GadgetManager; -import mineplex.core.particleeffects.BabyFireworkEffect; import mineplex.core.gadget.types.WinEffectGadget; +import mineplex.core.particleeffects.BabyFireworkEffect; import mineplex.core.updater.UpdateType; import mineplex.core.updater.event.UpdateEvent; import mineplex.core.utils.UtilVariant; @@ -134,7 +134,7 @@ public class WinEffectHalloween extends WinEffectGadget skeleton.setCustomNameVisible(true); skeleton.getEquipment().setHelmet(new ItemStack(Material.JACK_O_LANTERN)); UtilEnt.ghost(skeleton, true, false); - UtilEnt.Vegetate(skeleton); + UtilEnt.vegetate(skeleton); for (int i = 0; i < 15; i++) { playFirework(skeleton.getLocation().clone().add(0, 2, 0), i, true); diff --git a/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/wineffect/WinEffectLoveIsABattlefield.java b/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/wineffect/WinEffectLoveIsABattlefield.java new file mode 100644 index 000000000..9b31c73fa --- /dev/null +++ b/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/wineffect/WinEffectLoveIsABattlefield.java @@ -0,0 +1,136 @@ +package mineplex.core.gadget.gadgets.wineffect; + +import java.util.ArrayList; +import java.util.List; + +import org.bukkit.Location; +import org.bukkit.Material; +import org.bukkit.entity.ArmorStand; +import org.bukkit.entity.Player; +import org.bukkit.event.EventHandler; +import org.bukkit.util.Vector; + +import mineplex.core.common.animation.AnimationPoint; +import mineplex.core.common.animation.AnimatorEntity; +import mineplex.core.common.util.C; +import mineplex.core.common.util.LineFormat; +import mineplex.core.common.util.UtilParticle; +import mineplex.core.common.util.UtilShapes; +import mineplex.core.common.util.UtilText; +import mineplex.core.disguise.disguises.DisguisePlayer; +import mineplex.core.gadget.GadgetManager; +import mineplex.core.gadget.types.WinEffectGadget; +import mineplex.core.updater.UpdateType; +import mineplex.core.updater.event.UpdateEvent; + +public class WinEffectLoveIsABattlefield extends WinEffectGadget +{ + + private DisguisePlayer _npc; + private int _ticks = 0; + private List _nonTeamArmorStands = new ArrayList<>(); + + public WinEffectLoveIsABattlefield(GadgetManager manager) + { + super(manager, "Love is a Battlefield", UtilText.splitLineToArray(C.cGray + "Don't hate the players. Hate the game.", LineFormat.LORE), + -17, Material.WOOL, (byte) 6); + _schematicName = "WinRoomLove"; + } + + @Override + public void teleport() + { + Location loc = getBaseLocation().add(getBaseLocation().getDirection().normalize().multiply(17)).add(0, 3, 0); + loc.setDirection(getBaseLocation().clone().subtract(loc).toVector()); + super.teleport(loc); + } + + @Override + public void play() + { + _npc = getNPC(this._player, getBaseLocation()); + + AnimatorEntity animator = new AnimatorEntity(Manager.getPlugin(), _npc.getEntity().getBukkitEntity()); + + animator.addPoint(new AnimationPoint(20, new Vector(0,0,0), new Vector(-1, 0.5, 0))); + animator.addPoint(new AnimationPoint(40, new Vector(0,0,0), new Vector( 0, 0.5,-1))); + animator.addPoint(new AnimationPoint(60, new Vector(0,0,0), new Vector( 1, 0.5, 0))); + animator.addPoint(new AnimationPoint(80, new Vector(0,0,0), new Vector( 0, 0.5, 1))); + + animator.setRepeat(true); + + Location loc = _npc.getEntity().getBukkitEntity().getLocation(); + loc.setDirection(new Vector(0, 0.5, 1)); + animator.start(loc); + + spawnNonTeam(); + } + + @EventHandler + public void onUpdate(UpdateEvent event) + { + + if(!isRunning()) return; + + if (event.getType() == UpdateType.TICK) + { + _ticks++; + if (_ticks == 70) + knockPlayers(); + } + + if(event.getType() == UpdateType.FASTER) + { + _npc.sendHit(); + } + + if(event.getType() != UpdateType.FAST) return; + + Location loc = getBaseLocation(); + + for(int i = 0; i < 3; i++) + { + double r = 3; + double rad = (((Math.PI*2)/3.0)*i) + ((event.getTick()%240) * Math.PI/120.0); + double x = Math.sin(rad) * r; + double z = Math.cos(rad) * r; + + Location l = loc.clone().add(x, 0, z); + UtilParticle.PlayParticle(UtilParticle.ParticleType.HEART, l, 0.75f, 0.75f, 0.75f, 0.5f, 5, UtilParticle.ViewDist.NORMAL); + } + } + + @Override + public void finish() + { + Manager.getDisguiseManager().undisguise(_npc); + _npc = null; + } + + private void knockPlayers() + { + for (ArmorStand armorStand : _nonTeamArmorStands) + { + armorStand.setVelocity(armorStand.getLocation().getDirection().multiply(-1).multiply(5)); + } + } + + private void spawnNonTeam() + { + int i = 0; + List circle = UtilShapes.getPointsInCircle(getBaseLocation(), _nonTeam.size(), 2.5); + for (Player player : _nonTeam) + { + Location loc = circle.get(i); + DisguisePlayer disguisePlayer = getNPC(player, loc); + ArmorStand armorStand = (ArmorStand) disguisePlayer.getEntity().getBukkitEntity(); + Vector direction = _player.getEyeLocation().toVector().subtract(armorStand.getEyeLocation().toVector()); + Location teleport = armorStand.getLocation().setDirection(direction); + armorStand.teleport(teleport); + armorStand.setGravity(true); + _nonTeamArmorStands.add(armorStand); + i++; + } + } + +} \ No newline at end of file diff --git a/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/wineffect/WinEffectWinterWarfare.java b/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/wineffect/WinEffectWinterWarfare.java new file mode 100644 index 000000000..67a9abe9c --- /dev/null +++ b/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/wineffect/WinEffectWinterWarfare.java @@ -0,0 +1,174 @@ +package mineplex.core.gadget.gadgets.wineffect; + +import java.io.File; +import java.io.IOException; +import java.util.ArrayList; +import java.util.List; + +import org.bukkit.Location; +import org.bukkit.Material; +import org.bukkit.Sound; +import org.bukkit.entity.ArmorStand; +import org.bukkit.entity.Entity; +import org.bukkit.entity.TNTPrimed; +import org.bukkit.event.EventHandler; +import org.bukkit.event.entity.EntityExplodeEvent; +import org.bukkit.util.Vector; + +import mineplex.core.common.block.schematic.Schematic; +import mineplex.core.common.block.schematic.SchematicData; +import mineplex.core.common.block.schematic.UtilSchematic; +import mineplex.core.common.util.C; +import mineplex.core.common.util.LineFormat; +import mineplex.core.common.util.UtilAction; +import mineplex.core.common.util.UtilMath; +import mineplex.core.common.util.UtilShapes; +import mineplex.core.common.util.UtilText; +import mineplex.core.disguise.disguises.DisguisePlayer; +import mineplex.core.gadget.GadgetManager; +import mineplex.core.gadget.types.WinEffectGadget; +import mineplex.core.updater.UpdateType; + +public class WinEffectWinterWarfare extends WinEffectGadget +{ + + private Schematic _sleigh; + private Location _sleighLocation; + private DisguisePlayer _npc; + private Entity _entity; + private SchematicData _data; + private List _playersLeft; + + public WinEffectWinterWarfare(GadgetManager manager) + { + super(manager, "Winter Warfare", UtilText.splitLinesToArray(new String[]{C.cGray + + "Santa isn't only packing coal for the bad girls and boys this year!"}, LineFormat.LORE), -16, Material.TNT, (byte) 0); + _schematicName = "WinterWarfare"; + try + { + _sleigh = UtilSchematic.loadSchematic(new File("../../update/schematic/WinterWarfareSleigh.schematic")); + } catch (IOException e) + { + _sleigh = null; + e.printStackTrace(); + } + } + + @Override + public void play() + { + _sleighLocation = getBaseLocation().clone().subtract(0, -2, 0); + pasteSleigh(); + Location npcLocation = _sleighLocation.clone().add(44, 11, 4); + npcLocation.setYaw(90); + npcLocation.setPitch(0); + _npc = getNPC(_player, npcLocation); + List circle = UtilShapes.getPointsInCircle(getBaseLocation().clone().subtract(0, 2, 0), _other.size(), 3); + + _playersLeft = new ArrayList<>(); + + for(int i = 0; i < _other.size(); i++) + { + _playersLeft.add((ArmorStand) getNPC(_other.get(i), circle.get(i)).getEntity().getBukkitEntity()); + } + } + + @Override + public void finish() + { + Manager.getDisguiseManager().undisguise(_npc); + _npc = null; + } + + @Override + public void teleport() + { + Location loc = getBaseLocation().clone().subtract(0, -5, 15); + loc.setDirection(getBaseLocation().subtract(loc).toVector()); + super.teleport(loc); + } + + @Override + public void update(UpdateType type) + { + if (!isRunning()) + return; + + if (_sleighLocation == null) + return; + + if (type == UpdateType.FAST) + { + if (_npc == null) + return; + + TNTPrimed tnt = _sleighLocation.getWorld().spawn(_npc.getEntity().getBukkitEntity().getLocation().add(0, 3, 0), TNTPrimed.class); + int r = UtilMath.random.nextInt(50); + Vector vel = new Vector(Math.sin(r * 9/5d), 0, Math.cos(r * 9/5d)); + UtilAction.velocity(tnt, vel, Math.abs(Math.sin(r * 12/3000d)), false, 0, 0.2 + Math.abs(Math.cos(r * 12/3000d))*0.6, 1, false); + } + + if (type != UpdateType.TICK) + return; + + // Teleports sleigh + _sleighLocation = _sleighLocation.subtract(1, 0, 0); + pasteSleigh(); + + if (_npc == null) + return; + + Location npcLocation = _sleighLocation.clone().add(44, 11, 4); + npcLocation.setYaw(90); + npcLocation.setPitch(0); + _npc.getEntity().getBukkitEntity().teleport(npcLocation); + } + + private void pasteSleigh() + { + if (_sleigh != null) + { + _data = _sleigh.paste(_sleighLocation); + } + } + + @EventHandler + public void onTNTExplode(EntityExplodeEvent event) + { + if (!isRunning()) + return; + + if (_playersLeft == null) + return; + + if (_playersLeft.size() < 1) + return; + + if (!(event.getEntity() instanceof TNTPrimed)) + return; + + boolean removePlayers = false; + + for(ArmorStand armorStand : _playersLeft) + { + if (armorStand.getLocation().distanceSquared(event.getEntity().getLocation()) <= 25) + { + removePlayers = true; + break; + } + } + + if (!removePlayers) + return; + + for(ArmorStand player : _playersLeft) + { + player.getWorld().playSound(player.getLocation(), Sound.VILLAGER_HIT, 2, 1); + player.getWorld().playSound(player.getLocation(), Sound.VILLAGER_DEATH, 1, 1); + player.remove(); + } + + _playersLeft.clear(); + } + +} diff --git a/Plugins/Mineplex.Core/src/mineplex/core/gadget/set/SetCandyCane.java b/Plugins/Mineplex.Core/src/mineplex/core/gadget/set/SetCandyCane.java index a9a2bbe0c..e6f6f5707 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/gadget/set/SetCandyCane.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/gadget/set/SetCandyCane.java @@ -12,7 +12,7 @@ public class SetCandyCane extends GadgetSet public SetCandyCane(GadgetManager manager) { - super(manager, "Candy Cane", "Coming Soon...", + super(manager, "Candy Cane", "2x Sweet Points while active (Titles)", manager.getGadget(ArrowTrailCandyCane.class), manager.getGadget(DeathCandyCane.class), manager.getGadget(DoubleJumpCandyCane.class), diff --git a/Plugins/Mineplex.Core/src/mineplex/core/gadget/set/SetCupidsLove.java b/Plugins/Mineplex.Core/src/mineplex/core/gadget/set/SetCupidsLove.java index 7696abc25..ccbaf0863 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/gadget/set/SetCupidsLove.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/gadget/set/SetCupidsLove.java @@ -12,7 +12,7 @@ public class SetCupidsLove extends GadgetSet public SetCupidsLove(GadgetManager manager) { - super(manager, "Cupid's Love", /*"Running into other players gives them hearts for 5 seconds."*/ "Coming soon...", + super(manager, "Cupid's Love", /*"Running into other players gives them hearts for 5 seconds."*/ "2x Holiday Points while active (Titles)", manager.getGadget(ArrowTrailCupid.class), manager.getGadget(DeathCupidsBrokenHeart.class), manager.getGadget(DoubleJumpCupidsWings.class), diff --git a/Plugins/Mineplex.Core/src/mineplex/core/gadget/set/SetEmerald.java b/Plugins/Mineplex.Core/src/mineplex/core/gadget/set/SetEmerald.java index 60897253f..b34a8f88e 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/gadget/set/SetEmerald.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/gadget/set/SetEmerald.java @@ -12,7 +12,7 @@ public class SetEmerald extends GadgetSet public SetEmerald(GadgetManager manager) { - super(manager, "Emerald", /*"Press Shift to summon a Gem Party Bomb. 24 hour cooldown."*/ "Coming soon...", + super(manager, "Emerald", /*"Press Shift to summon a Gem Party Bomb. 24 hour cooldown."*/ "2x Gem Points while active (Titles)", manager.getGadget(ArrowTrailEmerald.class), manager.getGadget(DeathEmerald.class), manager.getGadget(DoubleJumpEmerald.class), diff --git a/Plugins/Mineplex.Core/src/mineplex/core/gadget/set/SetFreedom.java b/Plugins/Mineplex.Core/src/mineplex/core/gadget/set/SetFreedom.java index ce9675b16..6196a145b 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/gadget/set/SetFreedom.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/gadget/set/SetFreedom.java @@ -12,7 +12,7 @@ public class SetFreedom extends GadgetSet public SetFreedom(GadgetManager manager) { - super(manager, "Freedom Set", "Coming soon...", + super(manager, "Freedom", "2x Holiday Points while active (Titles)", manager.getGadget(ArrowTrailFreedom.class), manager.getGadget(DeathFreedom.class), manager.getGadget(DoubleJumpFreedom.class), diff --git a/Plugins/Mineplex.Core/src/mineplex/core/gadget/set/SetFrostLord.java b/Plugins/Mineplex.Core/src/mineplex/core/gadget/set/SetFrostLord.java index 0ced72181..6112655a0 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/gadget/set/SetFrostLord.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/gadget/set/SetFrostLord.java @@ -12,7 +12,7 @@ public class SetFrostLord extends GadgetSet public SetFrostLord(GadgetManager manager) { - super(manager, "Frost Lord", /*"Improved Wind of the Frost Lord"*/ "Coming soon...", + super(manager, "Frost Lord", /*"Improved Wind of the Frost Lord"*/ "2x Holiday Points while active (Titles)", manager.getGadget(ArrowTrailFrostLord.class), manager.getGadget(DeathFrostLord.class), manager.getGadget(DoubleJumpFrostLord.class), diff --git a/Plugins/Mineplex.Core/src/mineplex/core/gadget/set/SetMusic.java b/Plugins/Mineplex.Core/src/mineplex/core/gadget/set/SetMusic.java index 89022edb4..9e606f0e2 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/gadget/set/SetMusic.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/gadget/set/SetMusic.java @@ -12,7 +12,7 @@ public class SetMusic extends GadgetSet public SetMusic(GadgetManager manager) { - super(manager, "Ultimate Music Collection", /*"Press Shift to shoot a blast of music particles. People hit by the blast hear music for 15 seconds. 5 minute cooldown."*/ "Coming soon...", + super(manager, "Ultimate Music Collection", /*"Press Shift to shoot a blast of music particles. People hit by the blast hear music for 15 seconds. 5 minute cooldown."*/ "2x Peaceful Points while active (Titles)", manager.getGadget(ArrowTrailMusic.class), manager.getGadget(DeathMusic.class), manager.getGadget(DoubleJumpMusic.class), diff --git a/Plugins/Mineplex.Core/src/mineplex/core/gadget/set/SetParty.java b/Plugins/Mineplex.Core/src/mineplex/core/gadget/set/SetParty.java index 93370a41f..f9debaef0 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/gadget/set/SetParty.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/gadget/set/SetParty.java @@ -12,7 +12,7 @@ public class SetParty extends GadgetSet public SetParty(GadgetManager manager) { - super(manager, "Party", /*"Improved Party Time"*/ "Coming soon...", + super(manager, "Party", /*"Improved Party Time"*/ "2x Party Points while active (Titles)", manager.getGadget(ArrowTrailConfetti.class), manager.getGadget(DeathPinataBurst.class), manager.getGadget(DoubleJumpFirecracker.class), diff --git a/Plugins/Mineplex.Core/src/mineplex/core/gadget/set/SetVampire.java b/Plugins/Mineplex.Core/src/mineplex/core/gadget/set/SetVampire.java index 25842bb71..b070122de 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/gadget/set/SetVampire.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/gadget/set/SetVampire.java @@ -12,7 +12,7 @@ public class SetVampire extends GadgetSet public SetVampire(GadgetManager manager) { - super(manager, "The Vampire 2000", /*"Press Shift to turn into a bat and be able to fly for 10 seconds. 5 Minute cooldown."*/ "Coming soon...", + super(manager, "Blood", /*"Press Shift to turn into a bat and be able to fly for 10 seconds. 5 Minute cooldown."*/ "2x Warrior Points while active (Titles)", manager.getGadget(ArrowTrailBlood.class), manager.getGadget(DeathBlood.class), manager.getGadget(DoubleJumpBlood.class), diff --git a/Plugins/Mineplex.Core/src/mineplex/core/gadget/set/SetWisdom.java b/Plugins/Mineplex.Core/src/mineplex/core/gadget/set/SetWisdom.java index 06858d63f..2d2ff0693 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/gadget/set/SetWisdom.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/gadget/set/SetWisdom.java @@ -12,7 +12,7 @@ public class SetWisdom extends GadgetSet public SetWisdom(GadgetManager manager) { - super(manager, "Wisdom", /*"Wearing the full Wisdom set when opening a chest slightly increases your chest roll %."*/ "Coming soon...", + super(manager, "Wisdom", /*"Wearing the full Wisdom set when opening a chest slightly increases your chest roll %."*/ "2x Treasure Points while active (Titles)", manager.getGadget(ArrowTrailEnchant.class), manager.getGadget(DeathEnchant.class), manager.getGadget(DoubleJumpEnchant.class), diff --git a/Plugins/Mineplex.Core/src/mineplex/core/gadget/set/suits/SetFreezeSuit.java b/Plugins/Mineplex.Core/src/mineplex/core/gadget/set/suits/SetFreezeSuit.java new file mode 100644 index 000000000..46c057aea --- /dev/null +++ b/Plugins/Mineplex.Core/src/mineplex/core/gadget/set/suits/SetFreezeSuit.java @@ -0,0 +1,22 @@ +package mineplex.core.gadget.set.suits; + +import mineplex.core.gadget.GadgetManager; +import mineplex.core.gadget.gadgets.outfit.freezesuit.OutfitFreezeSuitBoots; +import mineplex.core.gadget.gadgets.outfit.freezesuit.OutfitFreezeSuitChestplate; +import mineplex.core.gadget.gadgets.outfit.freezesuit.OutfitFreezeSuitHelmet; +import mineplex.core.gadget.gadgets.outfit.freezesuit.OutfitFreezeSuitLeggings; +import mineplex.core.gadget.types.GadgetSet; + +public class SetFreezeSuit extends GadgetSet +{ + + public SetFreezeSuit(GadgetManager manager) + { + super(manager, "Freeze Suit", "Grants the wearer a \"snow aura\" and the ability to summon a bridge of ice.", + manager.getGadget(OutfitFreezeSuitHelmet.class), + manager.getGadget(OutfitFreezeSuitChestplate.class), + manager.getGadget(OutfitFreezeSuitLeggings.class), + manager.getGadget(OutfitFreezeSuitBoots.class)); + } + +} diff --git a/Plugins/Mineplex.Core/src/mineplex/core/gadget/types/BalloonGadget.java b/Plugins/Mineplex.Core/src/mineplex/core/gadget/types/BalloonGadget.java index 721282b33..4a5ad6f60 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/gadget/types/BalloonGadget.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/gadget/types/BalloonGadget.java @@ -1,64 +1,162 @@ package mineplex.core.gadget.types; -import java.util.*; +import java.util.HashMap; +import java.util.Iterator; +import java.util.Map; +import java.util.UUID; -import mineplex.core.gadget.GadgetManager; import org.bukkit.Material; +import org.bukkit.entity.Entity; +import org.bukkit.entity.EntityType; import org.bukkit.entity.Player; +import org.bukkit.event.EventHandler; +import org.bukkit.event.player.PlayerTeleportEvent; + +import mineplex.core.common.util.F; +import mineplex.core.common.util.UtilPlayer; +import mineplex.core.gadget.GadgetManager; +import mineplex.core.gadget.gadgets.balloons.BalloonType; +import mineplex.core.gadget.util.BalloonData; +import mineplex.core.updater.UpdateType; +import mineplex.core.updater.event.UpdateEvent; public abstract class BalloonGadget extends Gadget { - protected static final Map> PLAYER_BALLOONS = new HashMap<>(); + private static final Map> PLAYER_BALLOONS = new HashMap<>(); - protected final Random _random; + private EntityType _balloon; + private BalloonType _balloonType; - public BalloonGadget(GadgetManager manager, String name, String[] desc, int cost, Material material, byte data, String... altNames) + public BalloonGadget(GadgetManager manager, String name, String[] desc, int cost, Material material, byte data, BalloonType balloonType, EntityType balloon, String... altNames) { super(manager, GadgetType.BALLOON, name, desc, cost, material, data, 1, altNames); - _random = new Random(); + _balloon = balloon; + _balloonType = balloonType; } - protected boolean canSpawnBalloon(Player player) + @Override + public void enableCustom(Player player, boolean message) + { + boolean add = addPlayerBalloon(player); + if (add) + { + _active.add(player); + if (message) + { + UtilPlayer.message(player, F.main("Gadget", "You spawned a " + F.elem(getName()) + "!")); + } + } + else + { + Manager.removeActive(player, this); + UtilPlayer.message(player, F.main("Gadget", "You cannot have more than " + F.count("10") + " balloons!")); + } + } + + @Override + public void disableCustom(Player player, boolean message) + { + if (!_active.remove(player)) + return; + + removePlayerBalloon(player); + if (message) + UtilPlayer.message(player, F.main("Gadget", "You despawned a " + F.elem(getName())) + "!"); + } + + private boolean addPlayerBalloon(Player player) + { + if (!canSpawnBalloon(player)) + return false; + + PLAYER_BALLOONS.computeIfAbsent(player.getUniqueId(), map -> new HashMap<>()); + BalloonData balloonData; + Entity[] ents = spawnEntity(player); + if (ents[1] == null) + balloonData = new BalloonData(player, ents[0]); + else if (!_balloon.equals(EntityType.ARMOR_STAND)) + balloonData = new BalloonData(player, ents[0], ents[1]); + else + { + balloonData = new BalloonData(player, ents[0]); + balloonData.setLeash(ents[1]); + } + PLAYER_BALLOONS.get(player.getUniqueId()).put(_balloon, balloonData); + + return true; + } + + private void removePlayerBalloon(Player player) { if (PLAYER_BALLOONS.containsKey(player.getUniqueId())) { - List balloonGadgets = PLAYER_BALLOONS.get(player.getUniqueId()); + if (PLAYER_BALLOONS.get(player.getUniqueId()).containsKey(_balloon)) + { + removeEntities(player); + PLAYER_BALLOONS.get(player.getUniqueId()).remove(_balloon); + } + } + } + + protected abstract Entity[] spawnEntity(Player player); + + protected abstract void removeEntities(Player player); + + @EventHandler + public void onUpdate(UpdateEvent event) + { + if (event.getType() != UpdateType.TICK) + return; + + Iterator>> iterator = PLAYER_BALLOONS.entrySet().iterator(); + while (iterator.hasNext()) + { + Map.Entry> entry = iterator.next(); + for (BalloonData balloonData : entry.getValue().values()) + { + balloonData.update(); + } + } + } + + private boolean canSpawnBalloon(Player player) + { + if (PLAYER_BALLOONS.containsKey(player.getUniqueId())) + { + Map balloonGadgets = PLAYER_BALLOONS.get(player.getUniqueId()); return balloonGadgets.size() < 10; } return true; } - protected void addPlayerBalloon(Player player) + public BalloonType getBalloonType() { - if (canSpawnBalloon(player)) + return _balloonType; + } + + public static int getBalloons(Player player) + { + return ((PLAYER_BALLOONS.containsKey(player.getUniqueId())) ? PLAYER_BALLOONS.get(player.getUniqueId()).size() : 0); + } + + /** + * Prevents errors caused by players teleporting + * @param event + */ + @EventHandler + public void onTeleport(PlayerTeleportEvent event) + { + if (getBalloons(event.getPlayer()) > 0) { - PLAYER_BALLOONS.computeIfAbsent(player.getUniqueId(), list -> new ArrayList<>()); - List balloonGadgets = PLAYER_BALLOONS.get(player.getUniqueId()); - balloonGadgets.add(this); - PLAYER_BALLOONS.put(player.getUniqueId(), balloonGadgets); + if (event.getFrom().getY() > 0) + return; + + for (BalloonGadget balloonGadget : Manager.getActiveBalloons(event.getPlayer())) + { + balloonGadget.disable(event.getPlayer(), false); + } + UtilPlayer.message(event.getPlayer(), F.main("Balloons", "Your balloons popped when you fell into the void! Equip them again!")); } } - - protected void removePlayerBalloon(Player player) - { - List balloonGadgets = PLAYER_BALLOONS.computeIfPresent(player.getUniqueId(), (uuid, list) -> list); - if (balloonGadgets.contains(this)) - { - balloonGadgets.remove(this); - } - if (balloonGadgets.size() >= 1) - PLAYER_BALLOONS.put(player.getUniqueId(), balloonGadgets); - else - PLAYER_BALLOONS.remove(player.getUniqueId()); - } - - protected double getNewHeight(Player player) - { - List balloonGadgets = PLAYER_BALLOONS.computeIfPresent(player.getUniqueId(), (uuid, list) -> list); - if (balloonGadgets != null) - return balloonGadgets.size() * _random.nextDouble() * (_random.nextInt(1) + 2); - return 3; - } - } diff --git a/Plugins/Mineplex.Core/src/mineplex/core/gadget/types/Gadget.java b/Plugins/Mineplex.Core/src/mineplex/core/gadget/types/Gadget.java index a39d7b46b..141885d0c 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/gadget/types/Gadget.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/gadget/types/Gadget.java @@ -9,6 +9,7 @@ import org.bukkit.entity.Player; import org.bukkit.event.EventHandler; import org.bukkit.event.Listener; import org.bukkit.event.player.PlayerQuitEvent; +import org.bukkit.inventory.ItemStack; import mineplex.core.common.util.F; import mineplex.core.common.util.UtilPlayer; @@ -34,6 +35,8 @@ public abstract class Gadget extends SalesPackageBase implements Listener private boolean _free; private YearMonth _yearMonth = null; + + private ItemStack _displayItem = null; public Gadget(GadgetManager manager, GadgetType gadgetType, String name, String[] desc, int cost, Material mat, byte data) { @@ -181,13 +184,13 @@ public abstract class Gadget extends SalesPackageBase implements Listener public boolean ownsGadget(Player player) { - if(isFree() || _free) return true; - if(Manager.getDonationManager().Get(player).OwnsUnknownPackage(getName())) { return true; } + if(isFree() || _free) { return true; } + if(Manager.getDonationManager().Get(player).ownsUnknownSalesPackage(getName())) { return true; } if(Manager.getInventoryManager().Get(player).getItemCount(getName()) > 0) { return true; } for(String alt : _alternativePackageNames) { - if(Manager.getDonationManager().Get(player).OwnsUnknownPackage(alt)) { return true; } + if(Manager.getDonationManager().Get(player).ownsUnknownSalesPackage(alt)) { return true; } if(Manager.getInventoryManager().Get(player).getItemCount(alt) > 0) { return true; } } @@ -208,4 +211,19 @@ public abstract class Gadget extends SalesPackageBase implements Listener { return _alternativePackageNames; } + + public void setDisplayItem(ItemStack displayItem) + { + _displayItem = displayItem; + } + + public boolean hasDisplayItem() + { + return _displayItem != null; + } + + public ItemStack getDisplayItem() + { + return _displayItem; + } } diff --git a/Plugins/Mineplex.Core/src/mineplex/core/gadget/types/HatGadget.java b/Plugins/Mineplex.Core/src/mineplex/core/gadget/types/HatGadget.java index fb63ac704..b6becadc1 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/gadget/types/HatGadget.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/gadget/types/HatGadget.java @@ -20,7 +20,7 @@ public abstract class HatGadget extends OutfitGadget public HatGadget(GadgetManager manager, HatType type) { - super(manager, type.getName(), type.getLore(), type.getCost(), ArmorSlot.Helmet, type.getHat().getType(), type.getHat().getData().getData(), type.getAltNames()); + super(manager, type.getName(), type.getLore(), type.getCost(), ArmorSlot.HELMET, type.getHat().getType(), type.getHat().getData().getData(), type.getAltNames()); _hat = type.getHat(); _hatType = type; @@ -31,7 +31,7 @@ public abstract class HatGadget extends OutfitGadget public HatGadget(GadgetManager manager, String name, String[] desc, int cost, ItemStack item) { - super(manager, name, desc, cost, ArmorSlot.Helmet, item.getType(), item.getData().getData()); + super(manager, name, desc, cost, ArmorSlot.HELMET, item.getType(), item.getData().getData()); } public HatGadget(GadgetManager manager, String name, String[] desc, int cost, String playerName) diff --git a/Plugins/Mineplex.Core/src/mineplex/core/gadget/types/ItemGadget.java b/Plugins/Mineplex.Core/src/mineplex/core/gadget/types/ItemGadget.java index 657ad67ac..82a685892 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/gadget/types/ItemGadget.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/gadget/types/ItemGadget.java @@ -19,8 +19,10 @@ import mineplex.core.common.util.UtilBlock; import mineplex.core.common.util.UtilGear; import mineplex.core.common.util.UtilInv; import mineplex.core.common.util.UtilPlayer; +import mineplex.core.common.util.UtilServer; import mineplex.core.gadget.GadgetManager; import mineplex.core.gadget.event.ItemGadgetOutOfAmmoEvent; +import mineplex.core.gadget.event.ItemGadgetUseEvent; import mineplex.core.gadget.gadgets.Ammo; import mineplex.core.itemstack.ItemStackFactory; import mineplex.core.recharge.Recharge; @@ -171,11 +173,20 @@ public abstract class ItemGadget extends Gadget UtilInv.Update(player); return; } - + + ItemGadgetUseEvent itemGadgetUseEvent = new ItemGadgetUseEvent(player, this, 1); + UtilServer.CallEvent(itemGadgetUseEvent); + + if (itemGadgetUseEvent.isCancelled()) + { + UtilPlayer.message(player, F.main("Item", itemGadgetUseEvent.getCancelledMessage())); + return; + } + Manager.getInventoryManager().addItemToInventory(player, getName(), -1); player.getInventory().setItem(Manager.getActiveItemSlot(), ItemStackFactory.Instance.CreateStack(getDisplayMaterial(), getDisplayData(), 1, F.item(Manager.getInventoryManager().Get(player).getItemCount(getName()) + " " + getName()))); - + ActivateCustom(event.getPlayer()); } diff --git a/Plugins/Mineplex.Core/src/mineplex/core/gadget/types/OutfitGadget.java b/Plugins/Mineplex.Core/src/mineplex/core/gadget/types/OutfitGadget.java index 72edc0486..6ce4d70b7 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/gadget/types/OutfitGadget.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/gadget/types/OutfitGadget.java @@ -1,21 +1,23 @@ package mineplex.core.gadget.types; +import org.bukkit.Color; import org.bukkit.Material; import org.bukkit.entity.Player; +import org.bukkit.inventory.ItemStack; +import org.bukkit.inventory.meta.LeatherArmorMeta; import mineplex.core.common.util.F; import mineplex.core.common.util.UtilPlayer; import mineplex.core.gadget.GadgetManager; -import mineplex.core.itemstack.ItemStackFactory; public abstract class OutfitGadget extends Gadget { public enum ArmorSlot { - Helmet ("Helmet"), - Chest ("Chestplate"), - Legs ("Leggings"), - Boots ("Boots"); + HELMET("Helmet"), + CHEST("Chestplate"), + LEGS("Leggings"), + BOOTS("Boots"); private String _databaseKey; @@ -31,18 +33,29 @@ public abstract class OutfitGadget extends Gadget } protected ArmorSlot _slot; + protected Color _color = null; public OutfitGadget(GadgetManager manager, String name, String[] desc, int cost, ArmorSlot slot, Material mat, byte data, String... altNames) { super(manager, GadgetType.COSTUME, name, desc, cost, mat, data, 1, altNames); _slot = slot; - } + } public ArmorSlot getSlot() { return _slot; } + + public void setColor(Color color) + { + _color = color; + } + + public Color getColor() + { + return _color; + } public void applyArmor(Player player, boolean message) { @@ -54,18 +67,26 @@ public abstract class OutfitGadget extends Gadget if (message) UtilPlayer.message(player, F.main("Gadget", "You put on " + F.elem(getName()) + ".")); + + ItemStack itemStack = new ItemStack(getDisplayMaterial(), 1, getDisplayData()); + if (getColor() != null) + { + if (itemStack.getItemMeta() instanceof LeatherArmorMeta) + { + LeatherArmorMeta leatherArmorMeta = (LeatherArmorMeta) itemStack.getItemMeta(); + leatherArmorMeta.setColor(getColor()); + leatherArmorMeta.setDisplayName(getName()); + itemStack.setItemMeta(leatherArmorMeta); + } + } + + if (_slot == ArmorSlot.HELMET) player.getInventory().setHelmet(itemStack); - if (_slot == ArmorSlot.Helmet) player.getInventory().setHelmet( - ItemStackFactory.Instance.CreateStack(getDisplayMaterial().getId(), getDisplayData(), 1, getName())); + else if (_slot == ArmorSlot.CHEST) player.getInventory().setChestplate(itemStack); - else if (_slot == ArmorSlot.Chest) player.getInventory().setChestplate( - ItemStackFactory.Instance.CreateStack(getDisplayMaterial().getId(), getDisplayData(), 1, getName())); + else if (_slot == ArmorSlot.LEGS) player.getInventory().setLeggings(itemStack); - else if (_slot == ArmorSlot.Legs) player.getInventory().setLeggings( - ItemStackFactory.Instance.CreateStack(getDisplayMaterial().getId(), getDisplayData(), 1, getName())); - - else if (_slot == ArmorSlot.Boots) player.getInventory().setBoots( - ItemStackFactory.Instance.CreateStack(getDisplayMaterial().getId(), getDisplayData(), 1, getName())); + else if (_slot == ArmorSlot.BOOTS) player.getInventory().setBoots(itemStack); } public void removeArmor(Player player, boolean message) @@ -76,9 +97,9 @@ public abstract class OutfitGadget extends Gadget if (message) UtilPlayer.message(player, F.main("Gadget", "You took off " + F.elem(getName()) + ".")); - if (_slot == ArmorSlot.Helmet) player.getInventory().setHelmet(null); - else if (_slot == ArmorSlot.Chest) player.getInventory().setChestplate(null); - else if (_slot == ArmorSlot.Legs) player.getInventory().setLeggings(null); - else if (_slot == ArmorSlot.Boots) player.getInventory().setBoots(null); + if (_slot == ArmorSlot.HELMET) player.getInventory().setHelmet(null); + else if (_slot == ArmorSlot.CHEST) player.getInventory().setChestplate(null); + else if (_slot == ArmorSlot.LEGS) player.getInventory().setLeggings(null); + else if (_slot == ArmorSlot.BOOTS) player.getInventory().setBoots(null); } } diff --git a/Plugins/Mineplex.Core/src/mineplex/core/gadget/types/TauntGadget.java b/Plugins/Mineplex.Core/src/mineplex/core/gadget/types/TauntGadget.java new file mode 100644 index 000000000..9326a4cdb --- /dev/null +++ b/Plugins/Mineplex.Core/src/mineplex/core/gadget/types/TauntGadget.java @@ -0,0 +1,162 @@ +package mineplex.core.gadget.types; + +import java.time.YearMonth; +import java.util.ArrayList; +import java.util.Arrays; +import java.util.HashMap; +import java.util.List; +import java.util.Map; +import java.util.UUID; + +import org.bukkit.Material; +import org.bukkit.entity.Player; +import org.bukkit.event.EventHandler; + +import mineplex.core.gadget.GadgetManager; +import mineplex.core.gadget.gadgets.taunts.GameType; +import mineplex.core.updater.UpdateType; +import mineplex.core.updater.event.UpdateEvent; + +/** + * Handles Taunts + */ +public abstract class TauntGadget extends Gadget +{ + + /** Sets if this specific taunt can be used while in PvP */ + private boolean _canPlayWithPvp = false; + /** Sets the cooldown for pvp */ + private long _pvpCooldown = 0; + /** Sets if this taunt needs to run on updates */ + private boolean _shouldPlay = false; + /** Sets when the taunt will run, if set above */ + private UpdateType _updateType = UpdateType.TICK; + /** List of games where this item is disabled */ + private List _disabledGames = new ArrayList<>(); + /** The ticks that passed since the player started the effect */ + private Map _ticksPerPlayer = new HashMap<>(); + + /** + * @param manager The normal GadgetManager + * @param name The name of the item + * @param desc The lore/description of the item + * @param cost The cost of the item + * @param mat The display material of the item + * @param data The display data of the item + * @param alternativeSalesPackageNames Possible alternative names for this package + */ + public TauntGadget(GadgetManager manager, String name, String[] desc, int cost, Material mat, byte data, + String... alternativeSalesPackageNames) + { + super(manager, GadgetType.TAUNT, name, desc, cost, mat, data, 1, alternativeSalesPackageNames); + } + + /** + * @param manager The normal GadgetManager + * @param name The name of the item + * @param desc The lore/description of the item + * @param cost The cost of the item + * @param mat The display material of the item + * @param data The display data of the item + * @param yearMonth The year and month of this item, if it is a PPC item + * @param alternativeSalesPackageNames Possible alternative names for this package + */ + public TauntGadget(GadgetManager manager, String name, String[] desc, int cost, Material mat, byte data, + YearMonth yearMonth, String... alternativeSalesPackageNames) + { + super(manager, GadgetType.TAUNT, name, desc, cost, mat, data, yearMonth, 1, alternativeSalesPackageNames); + } + + @Override + public void disableCustom(Player player, boolean message) + { + finish(player); + } + + public void start(Player player) + { + onStart(player); + _ticksPerPlayer.put(player.getUniqueId(), 0); + } + + public abstract void onStart(Player player); + + public void play(Player player) + { + onPlay(player); + int ticks = getPlayerTicks(player) + 1; + _ticksPerPlayer.put(player.getUniqueId(), ticks); + } + + public abstract void onPlay(Player player); + + public void finish(Player player) + { + onFinish(player); + _ticksPerPlayer.remove(player.getUniqueId()); + } + + public abstract void onFinish(Player player); + + public void setCanPlayWithPvp(boolean canPlayWithPvp) + { + _canPlayWithPvp = canPlayWithPvp; + } + + public void setPvpCooldown(long pvpCooldown) + { + _pvpCooldown = pvpCooldown; + } + + public void setShouldPlay(boolean shouldPlay) + { + _shouldPlay = shouldPlay; + } + + public void setEventType(UpdateType updateType) + { + _updateType = updateType; + } + + public void addDisabledGames(GameType... disabledGames) + { + _disabledGames.addAll(Arrays.asList(disabledGames)); + } + + public boolean canPlayWithPvp() + { + return _canPlayWithPvp; + } + + public boolean isGameDisabled(GameType gameType) + { + return _disabledGames.contains(gameType); + } + + public long getPvpCooldown() + { + return _pvpCooldown; + } + + public int getPlayerTicks(Player player) + { + return (_ticksPerPlayer.containsKey(player.getUniqueId())) ? _ticksPerPlayer.get(player.getUniqueId()) : -1; + } + + @EventHandler + public void onUpdate(UpdateEvent event) + { + if (!_shouldPlay) + return; + + if (event.getType() != _updateType) + return; + + for (Player player : getActive()) + { + if (_ticksPerPlayer.containsKey(player.getUniqueId())) + play(player); + } + } + +} diff --git a/Plugins/Mineplex.Core/src/mineplex/core/gadget/types/WinEffectGadget.java b/Plugins/Mineplex.Core/src/mineplex/core/gadget/types/WinEffectGadget.java index 0ab922d9d..403161cc9 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/gadget/types/WinEffectGadget.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/gadget/types/WinEffectGadget.java @@ -6,16 +6,11 @@ import java.util.ArrayList; import java.util.List; import java.util.UUID; -import com.mojang.authlib.GameProfile; -import mineplex.core.common.block.schematic.Schematic; -import mineplex.core.common.block.schematic.UtilSchematic; -import mineplex.core.common.skin.SkinData; -import mineplex.core.common.util.*; -import mineplex.core.disguise.disguises.DisguisePlayer; -import mineplex.core.gadget.GadgetManager; -import mineplex.core.updater.UpdateType; -import mineplex.core.updater.event.UpdateEvent; -import org.bukkit.*; +import org.bukkit.Color; +import org.bukkit.FireworkEffect; +import org.bukkit.GameMode; +import org.bukkit.Location; +import org.bukkit.Material; import org.bukkit.craftbukkit.v1_8_R3.entity.CraftPlayer; import org.bukkit.entity.ArmorStand; import org.bukkit.entity.Player; @@ -27,6 +22,21 @@ import org.bukkit.potion.PotionEffectType; import org.bukkit.scheduler.BukkitRunnable; import org.bukkit.util.Vector; +import com.mojang.authlib.GameProfile; + +import mineplex.core.common.block.schematic.Schematic; +import mineplex.core.common.block.schematic.UtilSchematic; +import mineplex.core.common.skin.SkinData; +import mineplex.core.common.util.C; +import mineplex.core.common.util.UtilFirework; +import mineplex.core.common.util.UtilMath; +import mineplex.core.common.util.UtilPlayer; +import mineplex.core.common.util.UtilServer; +import mineplex.core.disguise.disguises.DisguisePlayer; +import mineplex.core.gadget.GadgetManager; +import mineplex.core.updater.UpdateType; +import mineplex.core.updater.event.UpdateEvent; + /** * A wrapper for different win effects */ @@ -128,6 +138,12 @@ public abstract class WinEffectGadget extends Gadget * cleared. */ public abstract void finish(); + + /** + * This method is called when an update happens + * @param type The type of the update + */ + public void update(UpdateType type){}; public boolean isRunning() { @@ -222,7 +238,6 @@ public abstract class WinEffectGadget extends Gadget p.setAllowFlight(false); p.setHealth(p.getMaxHealth()); p.setFoodLevel(20); - Manager.disableAll(p, true); } } }; @@ -236,6 +251,8 @@ public abstract class WinEffectGadget extends Gadget @EventHandler public void onUpdate(UpdateEvent event) { + update(event.getType()); + if (event.getType() != UpdateType.TICK) return; diff --git a/Plugins/Mineplex.Core/src/mineplex/core/gadget/util/BalloonData.java b/Plugins/Mineplex.Core/src/mineplex/core/gadget/util/BalloonData.java new file mode 100644 index 000000000..fe81e2d15 --- /dev/null +++ b/Plugins/Mineplex.Core/src/mineplex/core/gadget/util/BalloonData.java @@ -0,0 +1,134 @@ +package mineplex.core.gadget.util; + +import org.bukkit.Location; +import org.bukkit.entity.Entity; +import org.bukkit.entity.LivingEntity; +import org.bukkit.entity.Player; +import org.bukkit.util.Vector; + +import mineplex.core.common.util.UtilAlg; +import mineplex.core.common.util.UtilMath; + +public class BalloonData +{ + + /** + * Makes the balloons fly around the player + * Copied from {@link mineplex.core.gadget.gadgets.particle.ParticleFairyData} + */ + + private Player _player; + private Entity _balloon, _passenger, _leash; + private Location _balloonLoc, _target; + private Vector _direction; + private double _speed; + private long _idleTime; + + public BalloonData(Player player, Entity balloon) + { + _player = player; + _balloon = balloon; + _balloonLoc = player.getEyeLocation(); + _target = getNewTarget(); + _speed = 0.2; + _idleTime = 0; + _direction = new Vector(1, 0, 0); + ((LivingEntity) _balloon).setLeashHolder(_player); + } + + // This exists for a possible widder balloon that could be added later + public BalloonData(Player player, Entity balloon, Entity passenger) + { + _player = player; + _balloon = balloon; + _passenger = passenger; + _balloonLoc = player.getEyeLocation(); + _target = getNewTarget(); + _speed = 0.2; + _idleTime = 0; + _direction = new Vector(1, 0, 0); + ((LivingEntity) _balloon).setLeashHolder(_player); + } + + public void update() + { + if (_leash == null) + { + if (!((LivingEntity) _balloon).isLeashed()) + ((LivingEntity) _balloon).setLeashHolder(_player); + } + else + { + if (!((LivingEntity) _leash).isLeashed()) + ((LivingEntity) _leash).setLeashHolder(_player); + } + + //Update Target + if (UtilMath.offset(_player.getEyeLocation(), _target) > 3 || UtilMath.offset(_balloonLoc, _target) < 1) + _target = getNewTarget(); + + //Pause? + if (Math.random() > 0.98) + _idleTime = System.currentTimeMillis() + (long)(Math.random() * 3000); + + //Speed + if (UtilMath.offset(_player.getEyeLocation(), _balloonLoc) < 3) + { + if (_idleTime > System.currentTimeMillis()) + { + _speed = Math.max(0, _speed - 0.005); + } + else + { + _speed = Math.min(0.15, _speed + 0.005); + } + } + else + { + _idleTime = 0; + + _speed = Math.min(0.15 + UtilMath.offset(_player.getEyeLocation(), _balloonLoc) * 0.05, _speed + 0.02); + } + + + //Modify Direction + _direction.add(UtilAlg.getTrajectory(_balloonLoc, _target).multiply(0.15)); + if (_direction.length() < 1) + _speed = _speed * _direction.length(); + UtilAlg.Normalize(_direction); + + //Move + if (UtilMath.offset(_balloonLoc, _target) > 0.1) + _balloonLoc.add(_direction.clone().multiply(_speed)); + + _balloon.teleport(_balloonLoc); + _balloon.setVelocity(new Vector(0, .25, 0)); + if (_passenger != null) + { + _passenger.teleport(_balloonLoc); + _balloon.setPassenger(_passenger); + } + if (_leash != null) + { + _leash.teleport(_balloon.getLocation().add(0, 1.5, 0)); + } + //return false; + } + + private Location getNewTarget() + { + return _player.getEyeLocation().add(Math.random() * 6 - 3, Math.random() * 7.5, Math.random() * 6 - 3); + } + + public Entity getBalloon() + { + return _balloon; + } + + public void setLeash(Entity leashedEntity) + { + _leash = leashedEntity; + ((LivingEntity) _leash).setLeashHolder(_player); + } + +} diff --git a/Plugins/Mineplex.Core/src/mineplex/core/game/GameDisplay.java b/Plugins/Mineplex.Core/src/mineplex/core/game/GameDisplay.java index 8038a84e1..cc5ba27d4 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/game/GameDisplay.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/game/GameDisplay.java @@ -1,98 +1,107 @@ package mineplex.core.game; +import java.util.Collections; +import java.util.HashMap; +import java.util.Map; + import org.bukkit.DyeColor; import org.bukkit.Material; public enum GameDisplay { //Mini - BaconBrawl("Bacon Brawl", Material.PORK, (byte)0, GameCategory.ARCADE, 1), - Barbarians("A Barbarians Life", Material.WOOD_AXE, (byte)0, GameCategory.EXTRA, 2), - BossBattles("Boss Battles", Material.SKULL_ITEM, (byte) 0, GameCategory.EVENT, 55), - Bridge("The Bridges", Material.IRON_PICKAXE, (byte)0, GameCategory.SURVIVAL, 3), - CastleSiege("Castle Siege", Material.DIAMOND_CHESTPLATE, (byte)0, GameCategory.CLASSICS, 4), - ChampionsDominate("Champions Domination", "Champions", Material.BEACON, (byte)0, GameCategory.CHAMPIONS, 6), - ChampionsTDM("Champions TDM", "Champions", Material.GOLD_SWORD, (byte)0, GameCategory.CHAMPIONS, 5), - Christmas("Christmas Chaos", Material.SNOW_BALL, (byte)0, GameCategory.CLASSICS, 8), - DeathTag("Death Tag", Material.SKULL_ITEM, (byte)0, GameCategory.ARCADE, 9), - DragonEscape("Dragon Escape", Material.DRAGON_EGG, (byte)0, GameCategory.ARCADE, 10), - DragonEscapeTeams("Dragon Escape Teams", Material.DRAGON_EGG, (byte)0, GameCategory.TEAM_VARIANT, 11), - DragonRiders("Dragon Riders", Material.DRAGON_EGG, (byte)0, GameCategory.ARCADE, 12), - Dragons("Dragons", Material.ENDER_STONE, (byte)0, GameCategory.ARCADE, 13), - DragonsTeams("Dragons Teams", Material.DRAGON_EGG, (byte)0, GameCategory.TEAM_VARIANT, 14), - Draw("Draw My Thing", Material.BOOK_AND_QUILL, (byte)0, GameCategory.CLASSICS, 15), - ElytraRings("Elytra Rings", Material.ELYTRA, (byte) 0, GameCategory.CLASSICS, 61), - Evolution("Evolution", Material.EMERALD, (byte)0, GameCategory.ARCADE, 16), - Gravity("Gravity", Material.ENDER_PORTAL_FRAME, (byte)0, GameCategory.EXTRA, 18), - Halloween("Halloween Horror", Material.PUMPKIN, (byte)0, GameCategory.CLASSICS, 19), - Halloween2016("Pumpkin's Revenge", Material.PUMPKIN, (byte)0, GameCategory.CLASSICS, 63), - HideSeek("Block Hunt", Material.GRASS, (byte)0, GameCategory.CLASSICS, 20), - HoleInTheWall("Hole in the Wall", Material.STAINED_GLASS, (byte) 2, GameCategory.ARCADE, 52), - Horse("Horseback", Material.IRON_BARDING, (byte)0, GameCategory.ARCADE, 21), + BaconBrawl("Bacon Brawl", Material.PORK, (byte)0, GameCategory.ARCADE, 1, true), + Barbarians("A Barbarians Life", Material.WOOD_AXE, (byte)0, GameCategory.EXTRA, 2, false), + BossBattles("Boss Battles", Material.SKULL_ITEM, (byte) 0, GameCategory.EVENT, 55, false), + Bridge("The Bridges", Material.IRON_PICKAXE, (byte)0, GameCategory.SURVIVAL, 3, true), + CastleSiege("Castle Siege", Material.DIAMOND_CHESTPLATE, (byte)0, GameCategory.CLASSICS, 4, true), + ChampionsDominate("Champions Domination", "Champions", Material.BEACON, (byte)0, GameCategory.CHAMPIONS, 6, true), + ChampionsTDM("Champions TDM", "Champions", Material.GOLD_SWORD, (byte)0, GameCategory.CHAMPIONS, 5, true), + Christmas("Christmas Chaos", Material.SNOW_BALL, (byte)0, GameCategory.CLASSICS, 8, false), + DeathTag("Death Tag", Material.SKULL_ITEM, (byte)0, GameCategory.ARCADE, 9, true), + DragonEscape("Dragon Escape", Material.DRAGON_EGG, (byte)0, GameCategory.ARCADE, 10, true), + DragonEscapeTeams("Dragon Escape Teams", Material.DRAGON_EGG, (byte)0, GameCategory.TEAM_VARIANT, 11, false), + DragonRiders("Dragon Riders", Material.DRAGON_EGG, (byte)0, GameCategory.ARCADE, 12, false), + Dragons("Dragons", Material.ENDER_STONE, (byte)0, GameCategory.ARCADE, 13, true), + DragonsTeams("Dragons Teams", Material.DRAGON_EGG, (byte)0, GameCategory.TEAM_VARIANT, 14, false), + Draw("Draw My Thing", Material.BOOK_AND_QUILL, (byte)0, GameCategory.CLASSICS, 15, true), + ElytraRings("Elytra Rings", Material.ELYTRA, (byte) 0, GameCategory.CLASSICS, 61, false), + Evolution("Evolution", Material.EMERALD, (byte)0, GameCategory.ARCADE, 16, true), + Gravity("Gravity", Material.ENDER_PORTAL_FRAME, (byte)0, GameCategory.EXTRA, 18, false), + Halloween("Halloween Horror", Material.PUMPKIN, (byte)0, GameCategory.CLASSICS, 19, false), + Halloween2016("Pumpkin's Revenge", Material.PUMPKIN, (byte)0, GameCategory.CLASSICS, 63, false), + HideSeek("Block Hunt", Material.GRASS, (byte)0, GameCategory.CLASSICS, 20, true), + HoleInTheWall("Hole in the Wall", Material.STAINED_GLASS, (byte) 2, GameCategory.ARCADE, 52, false), + Horse("Horseback", Material.IRON_BARDING, (byte)0, GameCategory.ARCADE, 21, false), - Micro("Micro Battle", Material.LAVA_BUCKET, (byte)0, GameCategory.ARCADE, 24), - MilkCow("Milk the Cow", Material.MILK_BUCKET, (byte)0, GameCategory.ARCADE, 27), - MineStrike("MineStrike", Material.TNT, (byte)0, GameCategory.CHAMPIONS, 25),// Temp set to CHAMPIONS to fix UI bug - BawkBawkBattles("Bawk Bawk Battles", Material.EGG, (byte)0, GameCategory.CLASSICS, 26), - OldMineWare("Old MineWare", Material.PAPER, (byte)0, GameCategory.EXTRA, 26), - Paintball("Super Paintball", Material.ENDER_PEARL, (byte)0, GameCategory.ARCADE, 28), - Quiver("One in the Quiver", Material.ARROW, (byte)0, GameCategory.ARCADE, 29), - QuiverTeams("One in the Quiver Teams", Material.ARROW, (byte)0, GameCategory.TEAM_VARIANT, 30), - Runner("Runner", Material.LEATHER_BOOTS, (byte)0, GameCategory.ARCADE, 31), - SearchAndDestroy("Search and Destroy", Material.TNT, (byte)0, GameCategory.SURVIVAL, 32), - Sheep("Sheep Quest", Material.WOOL, (byte)4, GameCategory.ARCADE, 33), + Micro("Micro Battle", Material.LAVA_BUCKET, (byte)0, GameCategory.ARCADE, 24, true), + MilkCow("Milk the Cow", Material.MILK_BUCKET, (byte)0, GameCategory.ARCADE, 27, false), + MineStrike("MineStrike", Material.TNT, (byte)0, GameCategory.CHAMPIONS, 25, true),// Temp set to CHAMPIONS to fix UI bug + BawkBawkBattles("Bawk Bawk Battles", Material.EGG, (byte)0, GameCategory.CLASSICS, 26, true), + OldMineWare("Old MineWare", Material.PAPER, (byte)0, GameCategory.EXTRA, 26, false), + Paintball("Super Paintball", Material.ENDER_PEARL, (byte)0, GameCategory.ARCADE, 28, true), + Quiver("One in the Quiver", Material.ARROW, (byte)0, GameCategory.ARCADE, 29, true), + QuiverTeams("One in the Quiver Teams", Material.ARROW, (byte)0, GameCategory.TEAM_VARIANT, 30, false), + Runner("Runner", Material.LEATHER_BOOTS, (byte)0, GameCategory.ARCADE, 31, true), + SearchAndDestroy("Search and Destroy", Material.TNT, (byte)0, GameCategory.SURVIVAL, 32, false), + Sheep("Sheep Quest", Material.WOOL, (byte)4, GameCategory.ARCADE, 33, true), - Smash("Super Smash Mobs", Material.SKULL_ITEM, (byte)4, GameCategory.CLASSICS, 34), - SmashDomination("Super Smash Mobs Domination", "Super Smash Mobs", Material.SKULL_ITEM, (byte)4, GameCategory.EXTRA, 36), - SmashTeams("Super Smash Mobs Teams", "Super Smash Mobs", Material.SKULL_ITEM, (byte)4, GameCategory.TEAM_VARIANT, 35), - Snake("Snake", Material.WOOL, (byte)0, GameCategory.ARCADE, 37), - SneakyAssassins("Sneaky Assassins", Material.INK_SACK, (byte)0, GameCategory.ARCADE, 38), - SnowFight("Snow Fight", Material.SNOW_BALL, (byte)0, GameCategory.EXTRA, 39), - Spleef("Super Spleef", Material.IRON_SPADE, (byte)0, GameCategory.ARCADE, 40), - SpleefTeams("Super Spleef Teams", Material.IRON_SPADE, (byte)0, GameCategory.TEAM_VARIANT, 41), - SquidShooter("Squid Shooter", Material.FIREWORK_CHARGE, (byte)0, GameCategory.ARCADE, 43), - Stacker("Super Stacker", Material.BOWL, (byte)0, GameCategory.ARCADE, 42), - SurvivalGames("Survival Games", Material.IRON_SWORD, (byte)0, GameCategory.SURVIVAL, 22), - SurvivalGamesTeams("Survival Games Teams", "Survival Games", Material.IRON_SWORD, (byte)0, GameCategory.TEAM_VARIANT, 23), - Tug("Tug of Wool", Material.WHEAT, (byte)0, GameCategory.ARCADE, 44), - TurfWars("Turf Wars", Material.STAINED_CLAY, (byte)14, GameCategory.ARCADE, 45), - UHC("Ultra Hardcore", Material.GOLDEN_APPLE, (byte)0, GameCategory.SURVIVAL, 46), - WitherAssault("Wither Assault", Material.SKULL_ITEM, (byte)1, GameCategory.ARCADE, 47), - Wizards("Wizards", Material.BLAZE_ROD, (byte)0, GameCategory.SURVIVAL, 48), - ZombieSurvival("Zombie Survival", Material.SKULL_ITEM, (byte)2, GameCategory.SURVIVAL, 49), + Smash("Super Smash Mobs", Material.SKULL_ITEM, (byte)4, GameCategory.CLASSICS, 34, true), + SmashDomination("Super Smash Mobs Domination", "Super Smash Mobs", Material.SKULL_ITEM, (byte)4, GameCategory.EXTRA, 36, false), + SmashTeams("Super Smash Mobs Teams", "Super Smash Mobs", Material.SKULL_ITEM, (byte)4, GameCategory.TEAM_VARIANT, 35, false), + Snake("Snake", Material.WOOL, (byte)0, GameCategory.ARCADE, 37, true), + SneakyAssassins("Sneaky Assassins", Material.INK_SACK, (byte)0, GameCategory.ARCADE, 38, true), + SnowFight("Snow Fight", Material.SNOW_BALL, (byte)0, GameCategory.EXTRA, 39, false), + Spleef("Super Spleef", Material.IRON_SPADE, (byte)0, GameCategory.ARCADE, 40, true), + SpleefTeams("Super Spleef Teams", Material.IRON_SPADE, (byte)0, GameCategory.TEAM_VARIANT, 41, false), + SquidShooter("Squid Shooter", Material.FIREWORK_CHARGE, (byte)0, GameCategory.ARCADE, 43, false), + Stacker("Super Stacker", Material.BOWL, (byte)0, GameCategory.ARCADE, 42, false), + SurvivalGames("Survival Games", Material.IRON_SWORD, (byte)0, GameCategory.SURVIVAL, 22, true), + SurvivalGamesTeams("Survival Games Teams", "Survival Games", Material.IRON_SWORD, (byte)0, GameCategory.TEAM_VARIANT, 23, false), + Tug("Tug of Wool", Material.WHEAT, (byte)0, GameCategory.ARCADE, 44, false), + TurfWars("Turf Wars", Material.STAINED_CLAY, (byte)14, GameCategory.ARCADE, 45, true), + UHC("Ultra Hardcore", Material.GOLDEN_APPLE, (byte)0, GameCategory.TEAM_VARIANT, 46, true), + UHCSolo("Ultra Hardcore Solo", "Ultra Hardcore", Material.GOLDEN_APPLE, (byte)0, GameCategory.SURVIVAL, 46, false), + UHCSoloSpeed("Ultra Hardcore Solo Speed", "Ultra Hardcore", Material.GOLDEN_APPLE, (byte)0, GameCategory.SURVIVAL, 67, false), + UHCTeamsSpeed("Ultra Hardcore Teams Speed", "Ultra Hardcore", Material.GOLDEN_APPLE, (byte)0, GameCategory.TEAM_VARIANT, 67, false), + WitherAssault("Wither Assault", Material.SKULL_ITEM, (byte)1, GameCategory.ARCADE, 47, true), + Wizards("Wizards", Material.BLAZE_ROD, (byte)0, GameCategory.SURVIVAL, 48, true), + ZombieSurvival("Zombie Survival", Material.SKULL_ITEM, (byte)2, GameCategory.SURVIVAL, 49, false), - Build("Master Builders", Material.WOOD, (byte)0, GameCategory.CLASSICS, 50), - BuildMavericks("Mavericks Master Builders", Material.WOOD, (byte)3, GameCategory.CLASSICS, 63), - Cards("Craft Against Humanity", Material.MAP, (byte)0, GameCategory.CLASSICS, 51), - Skywars("Skywars", Material.FEATHER, (byte) 0, GameCategory.SURVIVAL, 52), - SkywarsTeams("Skywars Teams", "Skywars", Material.FEATHER, (byte)0, GameCategory.TEAM_VARIANT, 53), - MonsterMaze("Monster Maze", Material.ROTTEN_FLESH, (byte)0, GameCategory.ARCADE, 55), - MonsterLeague("Monster League", Material.MINECART, (byte)0, GameCategory.ARCADE, 56), + Build("Master Builders", Material.WOOD, (byte)0, GameCategory.CLASSICS, 50, true), + BuildMavericks("Mavericks Master Builders", Material.WOOD, (byte)3, GameCategory.CLASSICS, 63, false), + Cards("Craft Against Humanity", Material.MAP, (byte)0, GameCategory.CLASSICS, 51, false), + Skywars("Skywars", Material.FEATHER, (byte) 0, GameCategory.SURVIVAL, 52, true), + SkywarsTeams("Skywars Teams", "Skywars", Material.FEATHER, (byte)0, GameCategory.TEAM_VARIANT, 53, false), + MonsterMaze("Monster Maze", Material.ROTTEN_FLESH, (byte)0, GameCategory.ARCADE, 55, true), + MonsterLeague("Monster League", Material.MINECART, (byte)0, GameCategory.ARCADE, 56, false), - Lobbers("Bomb Lobbers", Material.FIREBALL, (byte) 0, GameCategory.ARCADE, 54), + Lobbers("Bomb Lobbers", Material.FIREBALL, (byte) 0, GameCategory.ARCADE, 54, true), - Minecraft_League("MC League", Material.DIAMOND_SWORD, (byte)0, GameCategory.SURVIVAL, 62), + Minecraft_League("MC League", Material.DIAMOND_SWORD, (byte)0, GameCategory.SURVIVAL, 62, false), - ChampionsCTF("Champions CTF", "Champions", Material.BANNER, DyeColor.RED.getDyeData(), GameCategory.CHAMPIONS, 56), + ChampionsCTF("Champions CTF", "Champions", Material.BANNER, DyeColor.RED.getDyeData(), GameCategory.CHAMPIONS, 56, true), - BouncyBalls("Bouncy Balls", Material.SLIME_BALL, (byte)0, GameCategory.ARCADE, 57), - Gladiators("Gladiators", Material.IRON_SWORD, (byte)0, GameCategory.ARCADE, 58), - TypeWars("Type Wars", Material.NAME_TAG, (byte) 0, GameCategory.CLASSICS, 59), + BouncyBalls("Bouncy Balls", Material.SLIME_BALL, (byte)0, GameCategory.ARCADE, 57, false), + Gladiators("Gladiators", Material.IRON_SWORD, (byte)0, GameCategory.ARCADE, 58, true), + TypeWars("Type Wars", Material.NAME_TAG, (byte) 0, GameCategory.CLASSICS, 59, false), - SpeedBuilders("Speed Builders", Material.QUARTZ_BLOCK, (byte) 0, GameCategory.CLASSICS, 60), + SpeedBuilders("Speed Builders", Material.QUARTZ_BLOCK, (byte) 0, GameCategory.CLASSICS, 60, true), - Valentines("Valentines Vendetta", Material.LEATHER, (byte)0, GameCategory.EXTRA, 61), + Valentines("Valentines Vendetta", Material.LEATHER, (byte)0, GameCategory.EXTRA, 61, false), - Skyfall("Skyfall", Material.DIAMOND_BOOTS, (byte)0, GameCategory.SURVIVAL, 62), - SkyfallTeams("Skyfall Teams", Material.DIAMOND_BOOTS, (byte)0, GameCategory.SURVIVAL, 65), + Skyfall("Skyfall", Material.DIAMOND_BOOTS, (byte)0, GameCategory.SURVIVAL, 62, true), + SkyfallTeams("Skyfall Teams", Material.DIAMOND_BOOTS, (byte)0, GameCategory.SURVIVAL, 65, false), - Basketball("Hoops", Material.SLIME_BALL, (byte)0, GameCategory.EXTRA, 63), + Basketball("Hoops", Material.SLIME_BALL, (byte)0, GameCategory.EXTRA, 63, false), - QuiverPayload("One in the Quiver Payload", Material.ARROW, (byte)0, GameCategory.ARCADE, 64), + QuiverPayload("One in the Quiver Payload", Material.ARROW, (byte)0, GameCategory.ARCADE, 64, false), + + StrikeGames("Strike Games", Material.DIAMOND_LEGGINGS, (byte) 0, GameCategory.SURVIVAL, 66, false), - Event("Mineplex Event", Material.CAKE, (byte)0, GameCategory.EVENT, 999), + Event("Mineplex Event", Material.CAKE, (byte)0, GameCategory.EVENT, 999, false), - Brawl("Brawl", Material.DIAMOND, (byte) 0, GameCategory.EVENT, 998); + Brawl("Brawl", Material.DIAMOND, (byte) 0, GameCategory.EVENT, 998, false); String _name; String _lobbyName; @@ -102,13 +111,16 @@ public enum GameDisplay private int _gameId; // Unique identifying id for this gamemode (used for statistics) public int getGameId() { return _gameId; } + + private boolean _communityFavorite; + public boolean isCommunityFavoriteOption() { return _communityFavorite; } - GameDisplay(String name, Material mat, byte data, GameCategory gameCategory, int gameId) + GameDisplay(String name, Material mat, byte data, GameCategory gameCategory, int gameId, boolean communityFavorite) { - this(name, name, mat, data, gameCategory, gameId); + this(name, name, mat, data, gameCategory, gameId, communityFavorite); } - GameDisplay(String name, String lobbyName, Material mat, byte data, GameCategory gameCategory, int gameId) + GameDisplay(String name, String lobbyName, Material mat, byte data, GameCategory gameCategory, int gameId, boolean communityFavorite) { _name = name; _lobbyName = lobbyName; @@ -116,6 +128,7 @@ public enum GameDisplay _data = data; _gameCategory = gameCategory; _gameId = gameId; + _communityFavorite = communityFavorite; } public String getName() @@ -160,4 +173,21 @@ public enum GameDisplay return _lobbyName; } + private static final Map BY_ID; + + static + { + Map byId = new HashMap<>(); + for (GameDisplay gameDisplay : values()) + { + byId.put(gameDisplay.getGameId(), gameDisplay); + } + BY_ID = Collections.unmodifiableMap(byId); + } + + public static GameDisplay getById(int id) + { + return BY_ID.get(id); + } + } \ No newline at end of file diff --git a/Plugins/Mineplex.Core/src/mineplex/core/giveaway/GiveawayRepository.java b/Plugins/Mineplex.Core/src/mineplex/core/giveaway/GiveawayRepository.java index 52c0cc50f..a88efc3fd 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/giveaway/GiveawayRepository.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/giveaway/GiveawayRepository.java @@ -18,7 +18,7 @@ import mineplex.serverdata.database.column.ColumnInt; import mineplex.serverdata.database.column.ColumnVarChar; import mineplex.serverdata.Region; -public class GiveawayRepository extends MinecraftRepository +public class GiveawayRepository extends RepositoryBase { private static final String INSERT_GIVEAWAY = "INSERT INTO Account.accountGiveaway (giveawayId, accountId, cooldownId, region, serverName, time, uuid) VALUES (?, ?, ?, ?, ?, now(), ?)"; private static final String LOAD_GIVEAWAY = "SELECT id, name, prettyName, header, message, max, notifyNetwork, notifyCooldown, canWinTwice FROM Account.giveaway WHERE enabled = TRUE"; @@ -26,7 +26,7 @@ public class GiveawayRepository extends MinecraftRepository public GiveawayRepository(JavaPlugin plugin) { - super(plugin, DBPool.getAccount()); + super(DBPool.getAccount()); } public boolean canGiveaway(int accountId, String giveawayName, String cooldownName) @@ -119,16 +119,4 @@ public class GiveawayRepository extends MinecraftRepository return giveawayData; } - - @Override - protected void initialize() - { - - } - - @Override - protected void update() - { - - } } diff --git a/Plugins/Mineplex.Core/src/mineplex/core/globalpacket/listeners/GlobalGiveCoins.java b/Plugins/Mineplex.Core/src/mineplex/core/globalpacket/listeners/GlobalGiveCoins.java index f264b2457..13f42d45d 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/globalpacket/listeners/GlobalGiveCoins.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/globalpacket/listeners/GlobalGiveCoins.java @@ -6,6 +6,7 @@ import org.bukkit.event.Listener; import mineplex.core.account.CoreClientManager; import mineplex.core.common.Rank; +import mineplex.core.common.currency.GlobalCurrency; import mineplex.core.common.util.C; import mineplex.core.common.util.Callback; import mineplex.core.common.util.F; @@ -68,15 +69,14 @@ public class GlobalGiveCoins implements Listener final int fAmount = amount; for (final Player p : UtilServer.getPlayers()) { - _donationManager.RewardCoins(new Callback() + _donationManager.rewardCurrency(GlobalCurrency.TREASURE_SHARD, p, "Global Coins", amount, response -> { - @Override - public void run(Boolean data) + if (response) { UtilPlayer.message(p, F.main("Global", "You received " + F.elem(fAmount + " Coins") + ".")); UtilTextMiddle.display(C.cYellow + fAmount + " Coins", C.cGold + "received from " + e.getCallerName() + "!", p); } - }, "Global Coins", p.getName(), _clientManager.getAccountId(p), amount); + }); } } } diff --git a/Plugins/Mineplex.Core/src/mineplex/core/globalpacket/listeners/GlobalGiveGems.java b/Plugins/Mineplex.Core/src/mineplex/core/globalpacket/listeners/GlobalGiveGems.java index f7763b839..187d55ca1 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/globalpacket/listeners/GlobalGiveGems.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/globalpacket/listeners/GlobalGiveGems.java @@ -5,6 +5,7 @@ import org.bukkit.event.EventHandler; import org.bukkit.event.Listener; import mineplex.core.common.Rank; +import mineplex.core.common.currency.GlobalCurrency; import mineplex.core.common.util.C; import mineplex.core.common.util.Callback; import mineplex.core.common.util.F; @@ -65,15 +66,11 @@ public class GlobalGiveGems implements Listener final int fAmount = amount; for (final Player p : UtilServer.getPlayers()) { - _donationManager.RewardGems(new Callback() + _donationManager.rewardCurrency(GlobalCurrency.GEM, p, "Global Gems", amount, success -> { - @Override - public void run(Boolean data) - { - UtilPlayer.message(p, F.main("Global", "You received " + F.elem(fAmount + " Gems") + ".")); - UtilTextMiddle.display(C.cYellow + fAmount + " Gems", C.cGold + "received from " + e.getCallerName() + "!", p); - } - }, "Global Gems", p.getName(), p.getUniqueId(), amount); + UtilPlayer.message(p, F.main("Global", "You received " + F.elem(fAmount + " Gems") + ".")); + UtilTextMiddle.display(C.cYellow + fAmount + " Gems", C.cGold + "received from " + e.getCallerName() + "!", p); + }); } } } diff --git a/Plugins/Mineplex.Core/src/mineplex/core/google/GoogleSheetsManager.java b/Plugins/Mineplex.Core/src/mineplex/core/google/GoogleSheetsManager.java new file mode 100644 index 000000000..12be686f9 --- /dev/null +++ b/Plugins/Mineplex.Core/src/mineplex/core/google/GoogleSheetsManager.java @@ -0,0 +1,81 @@ +package mineplex.core.google; + +import java.io.File; +import java.io.FileNotFoundException; +import java.io.FileReader; +import java.util.ArrayList; +import java.util.HashMap; +import java.util.Iterator; +import java.util.List; +import java.util.Map; + +import com.google.gson.JsonArray; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParser; + +import mineplex.core.MiniPlugin; +import mineplex.core.ReflectivelyCreateMiniPlugin; + +@ReflectivelyCreateMiniPlugin +public class GoogleSheetsManager extends MiniPlugin +{ + + private static final File DATA_STORE_DIR = new File(".." + File.separatorChar + ".." + File.separatorChar + "update" + File.separatorChar + "files"); + + private GoogleSheetsManager() + { + super("Google Sheets"); + } + + public Map>> getSheetData(String name) + { + return getSheetData(new File(DATA_STORE_DIR + File.separator + name + ".json")); + } + + public Map>> getSheetData(File file) + { + if (!file.exists()) + { + return null; + } + + Map>> valuesMap = new HashMap<>(); + + try + { + JsonParser parser = new JsonParser(); + JsonElement data = parser.parse(new FileReader(file)); + JsonArray parent = data.getAsJsonObject().getAsJsonArray("data"); + + for (int i = 0; i < parent.size(); i++) + { + JsonObject sheet = parent.get(i).getAsJsonObject(); + String name = sheet.get("name").getAsString(); + JsonArray values = sheet.getAsJsonArray("values"); + List> valuesList = new ArrayList<>(values.size()); + + for (int j = 0; j < values.size(); j++) + { + List list = new ArrayList<>(); + Iterator iterator = values.get(j).getAsJsonArray().iterator(); + + while (iterator.hasNext()) + { + String value = iterator.next().getAsString(); + list.add(value); + } + + valuesList.add(list); + } + + valuesMap.put(name, valuesList); + } + } + catch (FileNotFoundException e) + { + } + + return valuesMap; + } +} diff --git a/Plugins/Mineplex.Core/src/mineplex/core/google/SheetObjectDeserialiser.java b/Plugins/Mineplex.Core/src/mineplex/core/google/SheetObjectDeserialiser.java new file mode 100644 index 000000000..d254f7cf0 --- /dev/null +++ b/Plugins/Mineplex.Core/src/mineplex/core/google/SheetObjectDeserialiser.java @@ -0,0 +1,8 @@ +package mineplex.core.google; + +public interface SheetObjectDeserialiser +{ + + public T deserialise(String[] values) throws ArrayIndexOutOfBoundsException; + +} diff --git a/Plugins/Mineplex.Core/src/mineplex/core/ignore/IgnoreManager.java b/Plugins/Mineplex.Core/src/mineplex/core/ignore/IgnoreManager.java index 774544f7e..86b378193 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/ignore/IgnoreManager.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/ignore/IgnoreManager.java @@ -25,6 +25,7 @@ import org.bukkit.Bukkit; import org.bukkit.ChatColor; import org.bukkit.entity.Player; import org.bukkit.event.EventHandler; +import org.bukkit.event.EventPriority; import org.bukkit.event.player.AsyncPlayerChatEvent; import org.bukkit.plugin.java.JavaPlugin; @@ -86,7 +87,7 @@ public class IgnoreManager extends MiniDbClientPlugin return new IgnoreData(); } - @EventHandler + @EventHandler(priority = EventPriority.LOWEST) public void onChat(AsyncPlayerChatEvent event) { if (ClientManager.Get(event.getPlayer()).GetRank().has(Rank.HELPER)) diff --git a/Plugins/Mineplex.Core/src/mineplex/core/ignore/data/IgnoreRepository.java b/Plugins/Mineplex.Core/src/mineplex/core/ignore/data/IgnoreRepository.java index f4ee78ab2..d69fa55b1 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/ignore/data/IgnoreRepository.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/ignore/data/IgnoreRepository.java @@ -11,24 +11,14 @@ import mineplex.serverdata.database.column.ColumnVarChar; import org.bukkit.entity.Player; import org.bukkit.plugin.java.JavaPlugin; -public class IgnoreRepository extends MinecraftRepository +public class IgnoreRepository extends RepositoryBase { private static String ADD_IGNORE_RECORD = "INSERT INTO accountIgnore (uuidIgnorer, uuidIgnored) SELECT fA.uuid AS uuidIgnorer, tA.uuid AS uuidIgnored FROM accounts as fA LEFT JOIN accounts AS tA ON tA.name = ? WHERE fA.name = ?;"; private static String DELETE_IGNORE_RECORD = "DELETE aF FROM accountIgnore AS aF INNER JOIN accounts as fA ON aF.uuidIgnorer = fA.uuid INNER JOIN accounts AS tA ON aF.uuidIgnored = tA.uuid WHERE fA.name = ? AND tA.name = ?;"; public IgnoreRepository(JavaPlugin plugin) { - super(plugin, DBPool.getAccount()); - } - - @Override - protected void initialize() - { - } - - @Override - protected void update() - { + super(DBPool.getAccount()); } public boolean addIgnore(final Player caller, String name) diff --git a/Plugins/Mineplex.Core/src/mineplex/core/incognito/repository/IncognitoRepository.java b/Plugins/Mineplex.Core/src/mineplex/core/incognito/repository/IncognitoRepository.java index b27472430..adebcf4cf 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/incognito/repository/IncognitoRepository.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/incognito/repository/IncognitoRepository.java @@ -3,9 +3,10 @@ package mineplex.core.incognito.repository; import mineplex.core.database.MinecraftRepository; import mineplex.core.incognito.IncognitoManager; import mineplex.serverdata.database.DBPool; +import mineplex.serverdata.database.RepositoryBase; import mineplex.serverdata.database.column.ColumnInt; -public class IncognitoRepository extends MinecraftRepository +public class IncognitoRepository extends RepositoryBase { private static final String CREATE_TABLE = "CREATE TABLE IF NOT EXISTS incognitoStaff (accountId INT NOT NULL, status TINYINT(1) DEFAULT '0', PRIMARY KEY (accountId));"; private static final String INSERT_STATUS = "INSERT INTO incognitoStaff (accountId, status) VALUES (?, ?);"; @@ -13,7 +14,7 @@ public class IncognitoRepository extends MinecraftRepository public IncognitoRepository(IncognitoManager incognitoManager) { - super(incognitoManager.getPlugin(), DBPool.getAccount()); + super(DBPool.getAccount()); } public void setStatus(int accountId, boolean status) @@ -26,8 +27,4 @@ public class IncognitoRepository extends MinecraftRepository { executeUpdate(CREATE_TABLE); } - - protected void update() - { - } } diff --git a/Plugins/Mineplex.Core/src/mineplex/core/inventory/InventoryManager.java b/Plugins/Mineplex.Core/src/mineplex/core/inventory/InventoryManager.java index 32d51fd55..88342d0c4 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/inventory/InventoryManager.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/inventory/InventoryManager.java @@ -1,7 +1,6 @@ package mineplex.core.inventory; import mineplex.cache.player.PlayerCache; -import mineplex.cache.player.PlayerInfo; import mineplex.core.MiniDbClientPlugin; import mineplex.core.account.CoreClientManager; import mineplex.core.common.util.Callback; @@ -144,10 +143,10 @@ public class InventoryManager extends MiniDbClientPlugin { public void run() { - PlayerInfo playerInfo = PlayerCache.getInstance().getPlayer(uuid); - if (playerInfo != null) + int accountId = PlayerCache.getInstance().getAccountId(uuid); + if (accountId != -1) { - addItemToInventoryForOffline(callback, playerInfo.getAccountId(), item, count); + addItemToInventoryForOffline(callback, accountId, item, count); } else { diff --git a/Plugins/Mineplex.Core/src/mineplex/core/inventory/data/InventoryRepository.java b/Plugins/Mineplex.Core/src/mineplex/core/inventory/data/InventoryRepository.java index c13bd99e3..6bf7de0f5 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/inventory/data/InventoryRepository.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/inventory/data/InventoryRepository.java @@ -17,7 +17,7 @@ import mineplex.serverdata.database.column.ColumnVarChar; import mineplex.core.inventory.ClientInventory; import mineplex.core.inventory.ClientItem; -public class InventoryRepository extends MinecraftRepository +public class InventoryRepository extends RepositoryBase { private static String CREATE_INVENTORY_TABLE = "CREATE TABLE IF NOT EXISTS items (id INT NOT NULL AUTO_INCREMENT, name VARCHAR(100), rarity INT, PRIMARY KEY (id), INDEX mameIndex (name));"; private static String CREATE_INVENTORY_RELATION_TABLE = "CREATE TABLE IF NOT EXISTS accountInventory (id INT NOT NULL AUTO_INCREMENT, accountId INT NOT NULL, itemId INT NOT NULL, count INT NOT NULL, PRIMARY KEY (id), FOREIGN KEY (accountId) REFERENCES accounts(id), FOREIGN KEY (itemId) REFERENCES items(id), UNIQUE INDEX accountItemIndex (accountId, itemId));"; @@ -30,21 +30,7 @@ public class InventoryRepository extends MinecraftRepository public InventoryRepository(JavaPlugin plugin) { - super(plugin, DBPool.getAccount()); - } - - @Override - protected void initialize() - { - /* - executeUpdate(CREATE_INVENTORY_TABLE); - executeUpdate(CREATE_INVENTORY_RELATION_TABLE); - */ - } - - @Override - protected void update() - { + super(DBPool.getAccount()); } public void addItem(String name) diff --git a/Plugins/Mineplex.Core/src/mineplex/core/itemstack/ItemBuilder.java b/Plugins/Mineplex.Core/src/mineplex/core/itemstack/ItemBuilder.java index f506bfe18..14af0f28d 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/itemstack/ItemBuilder.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/itemstack/ItemBuilder.java @@ -53,6 +53,7 @@ public class ItemBuilder private int _amount; private Color _color; private short _data; + private short _durability; private final HashMap _enchants = new HashMap(); private final List _lore = new ArrayList(); private Material _mat; @@ -90,6 +91,7 @@ public class ItemBuilder _itemFlags.addAll(meta.getItemFlags()); _unbreakable = meta.spigot().isUnbreakable(); + _durability = item.getDurability(); } } @@ -108,6 +110,7 @@ public class ItemBuilder _mat = mat; _amount = amount; _data = data; + _durability = 0; } public ItemBuilder(Material mat, short data) @@ -115,6 +118,13 @@ public class ItemBuilder this(mat, 1, data); } + public ItemBuilder setDurability(short durability) + { + _durability = durability; + + return this; + } + public HashSet getItemFlags() { return _itemFlags; @@ -278,7 +288,8 @@ public class ItemBuilder item.addUnsafeEnchantments(_enchants); if (_glow) item.addEnchantment(UtilInv.getDullEnchantment(), 1); - + if (_durability != 0) item.setDurability(_durability); + return item; } @@ -298,7 +309,8 @@ public class ItemBuilder newBuilder.setColor(_color); // newBuilder.potion = potion; - + newBuilder.setDurability(_durability); + return newBuilder; } diff --git a/Plugins/Mineplex.Core/src/mineplex/core/itemstack/ItemStackFactory.java b/Plugins/Mineplex.Core/src/mineplex/core/itemstack/ItemStackFactory.java index 5f6453616..8ca03762a 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/itemstack/ItemStackFactory.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/itemstack/ItemStackFactory.java @@ -8,6 +8,7 @@ import java.util.List; import java.util.Map.Entry; import org.bukkit.ChatColor; +import org.bukkit.Color; import org.bukkit.Material; import org.bukkit.block.Block; import org.bukkit.craftbukkit.v1_8_R3.inventory.CraftItemStack; @@ -29,7 +30,10 @@ import org.bukkit.event.player.PlayerPickupItemEvent; import org.bukkit.inventory.CraftingInventory; import org.bukkit.inventory.ItemStack; import org.bukkit.inventory.meta.ItemMeta; +import org.bukkit.inventory.meta.LeatherArmorMeta; import org.bukkit.plugin.java.JavaPlugin; +import org.bukkit.potion.Potion; +import org.bukkit.potion.PotionType; import mineplex.core.MiniPlugin; import mineplex.core.common.util.C; @@ -1065,4 +1069,53 @@ public class ItemStackFactory extends MiniPlugin { _nameFormat = format; } + + public ItemStack createColoredLeatherArmor(int slot, Color color) + { + Material material = Material.LEATHER_HELMET; + switch (slot) + { + case 0: + material = Material.LEATHER_HELMET; + break; + case 1: + material = Material.LEATHER_CHESTPLATE; + break; + case 2: + material = Material.LEATHER_LEGGINGS; + break; + case 3: + material = Material.LEATHER_BOOTS; + break; + } + ItemStack stack = CreateStack(material); + LeatherArmorMeta leatherArmorMeta = (LeatherArmorMeta) stack.getItemMeta(); + leatherArmorMeta.setColor(color); + stack.setItemMeta(leatherArmorMeta); + return stack; + } + + /** + * Creates a potion item stack + * @param potionType + * @param level + * @return + */ + public ItemStack createCustomPotion(PotionType potionType, int level) + { + Potion potion = new Potion(potionType, level); + return potion.toItemStack(1); + } + + /** + * Creates a potion item stack + * @param potionType + * @return + */ + public ItemStack createCustomPotion(PotionType potionType) + { + return createCustomPotion(potionType, 1); + } + + } diff --git a/Plugins/Mineplex.Core/src/mineplex/core/leaderboard/StatEventsRepository.java b/Plugins/Mineplex.Core/src/mineplex/core/leaderboard/StatEventsRepository.java index fab7b1cc2..3acf6a2f8 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/leaderboard/StatEventsRepository.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/leaderboard/StatEventsRepository.java @@ -16,7 +16,7 @@ import org.bukkit.plugin.java.JavaPlugin; * @author MrTwiggy * */ -public class StatEventsRepository extends MinecraftRepository +public class StatEventsRepository extends RepositoryBase { // Insert or update stat events query @@ -37,21 +37,9 @@ public class StatEventsRepository extends MinecraftRepository */ public StatEventsRepository(JavaPlugin plugin) { - super(plugin, DBPool.getAccount()); + super(DBPool.getAccount()); } - @Override - protected void initialize() - { - //executeUpdate(CREATE_EVENTS_TABLE); - //executeUpdate(CREATE_STAT_RELATION_TABLE); - } - - @Override - protected void update() - { - - } /** * Insert (or update) a new stat event record for today into the repository. diff --git a/Plugins/Mineplex.Core/src/mineplex/core/lifetimes/Component.java b/Plugins/Mineplex.Core/src/mineplex/core/lifetimes/Component.java new file mode 100644 index 000000000..cee7da78f --- /dev/null +++ b/Plugins/Mineplex.Core/src/mineplex/core/lifetimes/Component.java @@ -0,0 +1,21 @@ +package mineplex.core.lifetimes; + +/** + * A Component defines behavior that can exist within a Lifetime. Components + * should have no impact upon the game while not active. + */ +public interface Component +{ + /** + * Activates the Component, performing any sort of required initialization. + * Components may be activated and deactivated multiple times, however a component + * will not be activated more than once without subsequent calls to deactivate. + */ + void activate(); + + /** + * Deactivates the Component, disabling any sort of functionality it provides + * and performing clean up. A Component may be subsequently reactivated. + */ + void deactivate(); +} diff --git a/Plugins/Mineplex.Core/src/mineplex/core/lifetimes/Lifetime.java b/Plugins/Mineplex.Core/src/mineplex/core/lifetimes/Lifetime.java new file mode 100644 index 000000000..1cb578bc0 --- /dev/null +++ b/Plugins/Mineplex.Core/src/mineplex/core/lifetimes/Lifetime.java @@ -0,0 +1,29 @@ +package mineplex.core.lifetimes; + +/** + * A Lifetime represents a duration for which a collection of Components + * will be active. While Lifetime does contain a method for registering + * instantiated Components, individual Lifetimes may have unique + * strategies for creating Components and activating them. Lifetime + * doesn't provide any guarantee of Component activation or deactivation + * order. Implementations of Lifetime, however, may. + *

+ * Lifetime doesn't provide mechanisms for beginning or ending a Lifetime. + * This is provided by the various implementations of Lifetime, as it varies + * between the implementations and is functionality that most consumers of + * Lifetimes will not need. + */ +public interface Lifetime +{ + /** + * Registers the provided component with this Lifetime. If the Lifetime + * is currently active, then the Component will be immediately activated. + * @param component the component to register + */ + void register(Component component); + /** + * Gets whether the Lifetime is currently active. + * @return true if the Lifetime is active + */ + boolean isActive(); +} diff --git a/Plugins/Mineplex.Core/src/mineplex/core/lifetimes/Lifetimed.java b/Plugins/Mineplex.Core/src/mineplex/core/lifetimes/Lifetimed.java new file mode 100644 index 000000000..fa08dd533 --- /dev/null +++ b/Plugins/Mineplex.Core/src/mineplex/core/lifetimes/Lifetimed.java @@ -0,0 +1,19 @@ +package mineplex.core.lifetimes; + +/** + * Represents an object that is associated with a specific lifetime. + * Multiple Lifetimed objects may be associated with the same Lifetime. + * As a roughly generalized explanation, any time functionality should + * be enabled(whether its a command, listener, etc.) it should be registered + * as a Component of a Lifetime. Any object wishing to enable functionality + * that is associated with this Lifetimed object should do so with the Lifetime + * returned by {@link #getLifetime()}. + */ +public interface Lifetimed +{ + /** + * Gets the Lifetime associated with this Lifetimed object. + * @return non-null Lifetime + */ + Lifetime getLifetime(); +} diff --git a/Plugins/Mineplex.Core/src/mineplex/core/lifetimes/ListenerComponent.java b/Plugins/Mineplex.Core/src/mineplex/core/lifetimes/ListenerComponent.java new file mode 100644 index 000000000..d6b664fb4 --- /dev/null +++ b/Plugins/Mineplex.Core/src/mineplex/core/lifetimes/ListenerComponent.java @@ -0,0 +1,54 @@ +package mineplex.core.lifetimes; + +import mineplex.core.common.util.UtilServer; +import org.apache.commons.lang.Validate; +import org.bukkit.Bukkit; +import org.bukkit.event.HandlerList; +import org.bukkit.event.Listener; + +/** + * A convenience class for Components that are a Listener. ListenerComponent + * can either be used as a wrapper class for a specific Listener, or can be + * extended by another Component to provide event registration. + */ +public class ListenerComponent implements Component, Listener +{ + private final Listener _listener; + + /** + * Creates a ListenerComponent that registers the provided Listener when + * activated and unregisters it when deactivated. The newly created + * ListenerComponent will not be registered as a Listener. When a + * ListenerComponent is created with this constructor, it is effectively + * a wrapper to bind a Listener to a specific lifetime. + * + * @param listener non-null listener to wrap + * @throws IllegalArgumentException if listener is null + */ + public ListenerComponent(Listener listener) throws IllegalArgumentException + { + Validate.notNull(listener); + _listener = listener; + } + + /** + * Creates a ListenerComponent that registers itself when activated and + * unregisters itself when deactivated. + */ + public ListenerComponent() + { + _listener = this; + } + + @Override + public void activate() + { + Bukkit.getPluginManager().registerEvents(_listener, UtilServer.getPlugin()); + } + + @Override + public void deactivate() + { + HandlerList.unregisterAll(_listener); + } +} diff --git a/Plugins/Mineplex.Core/src/mineplex/core/lifetimes/PhasedComponent.java b/Plugins/Mineplex.Core/src/mineplex/core/lifetimes/PhasedComponent.java new file mode 100644 index 000000000..417bf56b1 --- /dev/null +++ b/Plugins/Mineplex.Core/src/mineplex/core/lifetimes/PhasedComponent.java @@ -0,0 +1,7 @@ +package mineplex.core.lifetimes; + +public interface PhasedComponent extends Component +{ + + void setPhase(T phase); +} diff --git a/Plugins/Mineplex.Core/src/mineplex/core/lifetimes/PhasedLifetime.java b/Plugins/Mineplex.Core/src/mineplex/core/lifetimes/PhasedLifetime.java new file mode 100644 index 000000000..b9760e761 --- /dev/null +++ b/Plugins/Mineplex.Core/src/mineplex/core/lifetimes/PhasedLifetime.java @@ -0,0 +1,289 @@ +package mineplex.core.lifetimes; + +import com.google.common.base.Preconditions; +import mineplex.core.common.util.UtilServer; +import org.apache.commons.lang.Validate; + +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; +import java.util.Objects; + +/** + * A PhasedLifetime is a lifetime that is composed of several + * smaller lifetimes, referred to as phases. This class is provided + * in order to support a system in which Components may exist within multiple + * Lifetimes. PhasedLifetime is not thread-safe. + *

+ * Registering a Component will register it for the entirety of this Lifetime, + * unless registered with {@link #register(Component, Iterable)}. Special behavior + * is provided for instances of {@link PhasedComponent}. See {@link #register(Component, + * Iterable)} for more information. Components registered using {@link + * #register(Component)} are registered for the entire duration of the Lifetime. + */ +public class PhasedLifetime implements Lifetime +{ + private final Map> _phases = new HashMap<>(); + private final List _global = new ArrayList<>(); + private boolean _active = false; + private T _current; + + /** + * Registers the Component for all phases within the provided Iterable, + * and creates a Lifetime that is active during all those phases, and + * therefore identical to when the provided Component is active. If a change + * occurs from a Phase that the Component is active in to another phase that + * the component is active in, it will not be disabled. When this + * Lifetime ends, all Lifetimes created by this Lifetime also end, as all + * phases are considered over. + *

+ * If the Component is an instance of PhasedComponent, then any phase change + * in which one of the phases is within the provided Iterable of phases will + * result in an invocation of {@link PhasedComponent#setPhase(Object)}. This + * should not be used as a mechanism to detect when the component is being + * disabled, but rather as a means to provide specific behavior when that + * phase change occurs. If a phase change drastically changes the behavior + * of a Component such that not all functionality is active for some phases + * that a Component is registered for, you should consider refactoring that + * Component into two separate Components. + *

+ * As an example, assume that we have a PhasedLifetime with phases A-F, + * and a PhasedComponent is registered for phases A, B, and E. The chain + * of events would be as followed(italic indicates an event call to the + * PhasedComponent, an activation, or deactivation). + *

    + *
  • Lifetime started with a value of A
  • + *
  • Component is activated
  • + *
  • setPhase is called with a value of A
  • + *
  • Phase is set to B
  • + *
  • setPhase is called with a value of B
  • + *
  • Phase is set to C
  • + *
  • setPhase is called with a value of C
  • + *
  • Component is deactivated
  • + *
  • Phase is set to D
  • + *
  • Phase is set to E
  • + *
  • Component is activated
  • + *
  • setPhase is called with a value of E
  • + *
  • Phase is set to F
  • + *
  • setPhase is called with a value of F
  • + *
  • Component is deactivated
  • + *
  • Lifetime ends
  • + *
+ *

+ * If phases contains no elements, then the Component will not be + * registered. + * @param component non-null Component being registered + * @param phases non-null Iterable of phases to register the Component for + * @return a Lifetime corresponding to when the Component is active + * @throws IllegalArgumentException if component or phases is null + */ + public Lifetime register(Component component, Iterable phases) throws IllegalArgumentException { + Validate.notNull(component, "Component cannot be null"); + Validate.notNull(phases, "Phases cannot be null"); + RegisteredComponent rComponent = new RegisteredComponent(component); + for (T phase : phases) + { + _phases.computeIfAbsent(phase, (p) -> new ArrayList<>()).add(rComponent); + if (Objects.equals(phase, _current)) + { + rComponent.start(); + if (component instanceof PhasedComponent) + { + ((PhasedComponent) component).setPhase(phase); + } + } + } + return rComponent; + } + + /** + * Starts the Lifetime, activating all components that are active for + * the entire lifetime, and then activating all components that are part + * of the provided phase. + * @param phase non-null phase to start + * @throws IllegalArgumentException if phase is null + * @throws IllegalStateException if the Lifetime is currently active + */ + public void start(T phase) throws IllegalArgumentException, IllegalStateException + { + Validate.notNull(phase, "phase cannot be null"); + Preconditions.checkState(!_active, "Lifetime already started"); + _active = true; + _global.forEach(PhasedLifetime::active); + setPhase(phase); + } + + /** + * Ends the Lifetime, deactivating all components in the current phase + * and then deactivating all components that are active for the entire Lifetime. + * A Lifetime may be subsequently reactivated after it has ended. + * @throws IllegalStateException if the lifetime isn't active + */ + public void end() throws IllegalStateException + { + Preconditions.checkState(_active, "Lifetime not active"); + List toDisable = _phases.get(getPhase()); + if (toDisable != null) + { + toDisable.forEach(RegisteredComponent::end); + } + _global.forEach(PhasedLifetime::deactive); + _active = false; + _current = null; + } + + /** + * Sets the current phase to the provided value, activating components + * that are active in the phase and not currently active, and deactiving + * components that were previously active and are not registered for the + * provided phase. + * @param phase non-null + * @throws IllegalStateException if the Lifetime isn't active + * @throws IllegalArgumentException if the phase equals the current phase + * or is null + */ + public void setPhase(T phase) throws IllegalStateException, IllegalArgumentException + { + Preconditions.checkState(_active, "Lifetime not active"); + Validate.isTrue(!Objects.equals(phase, _current), "Can't set the phase to the current phase"); + Validate.notNull(phase, "the phase cannot be null"); + T oldPhase = getPhase(); + _current = phase; + List old = _phases.get(oldPhase); + List nextPhase = _phases.get(phase); + + for (Component c : _global) + { + if (c instanceof PhasedComponent) + { + ((PhasedComponent) c).setPhase(phase); + } + } + // Disable components that were active in the last phase but not in the next phase. + if (old != null) + { + List toDisable = new ArrayList<>(); + toDisable.addAll(old); + // Components that are in the next phase shouldn't be disabled. + if (nextPhase != null) + { + toDisable.removeAll(nextPhase); + } + + // Ensure that all old ones get a setPhase call before disabling them. + for (RegisteredComponent r : toDisable) + { + if (r.getComponent() instanceof PhasedComponent) + { + ((PhasedComponent) r.getComponent()).setPhase(phase); + } + } + toDisable.forEach(RegisteredComponent::end); + } + if (nextPhase != null) + { + // New but not old + List toActivate = new ArrayList<>(); + toActivate.addAll(nextPhase); + // Ensure that all components from last phase don't end up getting activated again. + if (old != null) + { + toActivate.removeAll(old); + } + // Start all the new ones + toActivate.forEach(RegisteredComponent::start); + // Give every remaining component a call to setPhase + for (RegisteredComponent r : nextPhase) + { + if (r.getComponent() instanceof PhasedComponent) + { + ((PhasedComponent) r.getComponent()).setPhase(phase); + } + } + } + } + + private static void active(Component component) + { + try + { + component.activate(); + } catch (Exception e) + { + e.printStackTrace(); + UtilServer.getPlugin().getLogger().severe("Failed to activate component: " + component); + } + } + private static void deactive(Component component) + { + try + { + component.deactivate(); + } catch (Exception e) + { + e.printStackTrace(); + UtilServer.getPlugin().getLogger().severe("Failed to deactivate component: " + component); + } + } + /** + * Gets the current Phase. If this PhasedLifetime isn't active then + * the current phase is null. + * @return the current phase, null if not active + */ + public T getPhase() + { + return _current; + } + + /** + * {@inheritDoc} + * If the Component is an instance of PhasedComponent, it will receive + * notifications of phase changes prior to any components registered + * with specific phases. Global components will also be deactivated last. + * @param component the component to register + */ + @Override + public void register(Component component) + { + _global.add(component); + if (this.isActive()) + { + component.activate(); + } + } + + @Override + public boolean isActive() + { + return _active; + } + + private static class RegisteredComponent extends SimpleLifetime implements Lifetime { + private Component _component; + + public RegisteredComponent(Component component) + { + this._component = component; + } + + public Component getComponent() + { + return _component; + } + + @Override + public void start() throws IllegalStateException + { + PhasedLifetime.active(_component); + super.start(); + } + + @Override + public void end() throws IllegalStateException + { + super.end(); + PhasedLifetime.deactive(_component); + } + } +} diff --git a/Plugins/Mineplex.Core/src/mineplex/core/lifetimes/SimpleLifetime.java b/Plugins/Mineplex.Core/src/mineplex/core/lifetimes/SimpleLifetime.java new file mode 100644 index 000000000..28dcfe45e --- /dev/null +++ b/Plugins/Mineplex.Core/src/mineplex/core/lifetimes/SimpleLifetime.java @@ -0,0 +1,96 @@ +package mineplex.core.lifetimes; + +import mineplex.core.common.util.UtilServer; +import org.apache.commons.lang3.Validate; + +import java.util.ArrayList; +import java.util.List; +import java.util.ListIterator; + +/** + * A Lifetime that is not thread-safe and is essentially a list of Components. + * All components are activated in the order that they are registered. All + * components are deactivated in the reverse order that they are registered. + * Components may not be registered during invocations of start or end. If a + * Component throws an exception during activation it will be logged, however the + * Component will still only be disabled once all other Components are disabled. + */ +public class SimpleLifetime implements Lifetime +{ + protected final List _components = new ArrayList<>(); + protected boolean _active = false; + @Override + public void register(Component component) + { + this._components.add(component); + if (this.isActive()) + { + try + { + component.activate(); + } catch (Exception e) + { + e.printStackTrace(); + UtilServer.getPlugin().getLogger().severe("Failed to active component: " + component); + } + } + } + + @Override + public boolean isActive() + { + return _active; + } + + /** + * Starts the SimpleLifetime, activating all components in the order that + * they were registered. A SimpleLifetime may be started multiple times, + * so long that every invocation of start after the first is preceded by + * an invocation of {@link #end()}. If a Component throws an exception + * during activation the exception will be logged, however no specific + * error-handling mechanism is provided. The Component will still be + * considered active and will be deactivated with all other Components. + * @throws IllegalStateException if currently active + */ + public void start() throws IllegalStateException + { + Validate.isTrue(!_active); + _active = true; + for (Component component : _components) + { + try + { + component.activate(); + } catch (Exception e) + { + e.printStackTrace(); + UtilServer.getPlugin().getLogger().severe("Failed to active component: " + component); + } + } + } + + /** + * Deactivates all components in the reverse order that they were registered. + * Any exception thrown by a Component while being deactivated will be logged, + * however no exception handling mechanism is provided. + * @throws IllegalStateException if not currently active + */ + public void end() throws IllegalStateException + { + Validate.isTrue(_active); + _active = false; + ListIterator reverseIterator = _components.listIterator(_components.size()); + while (reverseIterator.hasPrevious()) + { + Component component = reverseIterator.previous(); + try + { + component.deactivate(); + } catch (Exception e) + { + e.printStackTrace(); + UtilServer.getPlugin().getLogger().severe("Failed to deactivate component: " + component); + } + } + } +} diff --git a/Plugins/Mineplex.Core/src/mineplex/core/mavericks/DisplaySlot.java b/Plugins/Mineplex.Core/src/mineplex/core/mavericks/DisplaySlot.java index 8e38983f6..35f605f3f 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/mavericks/DisplaySlot.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/mavericks/DisplaySlot.java @@ -86,7 +86,7 @@ public class DisplaySlot } else { - UtilEnt.Vegetate(e, true); + UtilEnt.vegetate(e, true); UtilEnt.ghost(e, true, false); } _pastedEntities.add(e); diff --git a/Plugins/Mineplex.Core/src/mineplex/core/menu/builtin/ButtonOpenAnvilInput.java b/Plugins/Mineplex.Core/src/mineplex/core/menu/builtin/ButtonOpenAnvilInput.java new file mode 100644 index 000000000..393f5d60e --- /dev/null +++ b/Plugins/Mineplex.Core/src/mineplex/core/menu/builtin/ButtonOpenAnvilInput.java @@ -0,0 +1,28 @@ +package mineplex.core.menu.builtin; + +import java.util.function.Supplier; + +import org.bukkit.entity.Player; +import org.bukkit.event.inventory.ClickType; +import org.bukkit.inventory.ItemStack; + +import mineplex.core.MiniPlugin; +import mineplex.core.menu.Button; +import mineplex.core.menu.Menu; + +public abstract class ButtonOpenAnvilInput extends Button +{ + private final Supplier> _menuSupplier; + + public ButtonOpenAnvilInput(T plugin, ItemStack item, Supplier> menu) + { + super(item, plugin); + _menuSupplier = menu; + } + + @Override + public void onClick(Player player, ClickType clickType) + { + _menuSupplier.get().open(player); + } +} diff --git a/Plugins/Mineplex.Core/src/mineplex/core/menu/builtin/ButtonOpenInventory.java b/Plugins/Mineplex.Core/src/mineplex/core/menu/builtin/ButtonOpenInventory.java new file mode 100644 index 000000000..8c01dc846 --- /dev/null +++ b/Plugins/Mineplex.Core/src/mineplex/core/menu/builtin/ButtonOpenInventory.java @@ -0,0 +1,28 @@ +package mineplex.core.menu.builtin; + +import java.util.function.Supplier; + +import org.bukkit.entity.Player; +import org.bukkit.event.inventory.ClickType; +import org.bukkit.inventory.ItemStack; + +import mineplex.core.MiniPlugin; +import mineplex.core.menu.Button; +import mineplex.core.menu.Menu; + +public class ButtonOpenInventory extends Button +{ + private final Supplier> _menuSupplier; + + public ButtonOpenInventory(ItemStack item, T plugin, Supplier> menu) + { + super(item, plugin); + _menuSupplier = menu; + } + + @Override + public void onClick(Player player, ClickType clickType) + { + _menuSupplier.get().open(player); + } +} diff --git a/Plugins/Mineplex.Core/src/mineplex/core/message/MessageManager.java b/Plugins/Mineplex.Core/src/mineplex/core/message/MessageManager.java index 63c3e632e..eec908cdf 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/message/MessageManager.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/message/MessageManager.java @@ -246,7 +246,7 @@ public class MessageManager extends MiniClientPlugin Get(from).LastToTime = System.currentTimeMillis(); // Chiss or defek7 - if (GetClientManager().Get(to).GetRank() == Rank.DEVELOPER) + if (GetClientManager().Get(to).getRealOrDisguisedRank() == Rank.DEVELOPER) { UtilPlayer.message(from, C.cPurple + to.getName() + " is often AFK or minimized, due to plugin development."); UtilPlayer.message(from, C.cPurple + "Please be patient if they do not reply instantly."); diff --git a/Plugins/Mineplex.Core/src/mineplex/core/message/commands/MessageAdminCommand.java b/Plugins/Mineplex.Core/src/mineplex/core/message/commands/MessageAdminCommand.java index 738bf5e9d..021c87684 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/message/commands/MessageAdminCommand.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/message/commands/MessageAdminCommand.java @@ -1,5 +1,8 @@ package mineplex.core.message.commands; +import java.util.List; + +import org.bukkit.command.CommandSender; import org.bukkit.entity.Player; import mineplex.core.command.CommandBase; @@ -28,4 +31,10 @@ public class MessageAdminCommand extends CommandBase Plugin.sendMessage(caller, args[0], message, false, true); } } + + @Override + public List onTabComplete(CommandSender sender, String commandLabel, String[] args) + { + return tabCompletePlayerNames(sender, commandLabel, args); + } } diff --git a/Plugins/Mineplex.Core/src/mineplex/core/message/commands/MessageCommand.java b/Plugins/Mineplex.Core/src/mineplex/core/message/commands/MessageCommand.java index 53db5de4e..bdc02920f 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/message/commands/MessageCommand.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/message/commands/MessageCommand.java @@ -1,5 +1,8 @@ package mineplex.core.message.commands; +import java.util.List; + +import org.bukkit.command.CommandSender; import org.bukkit.entity.Player; import mineplex.core.command.CommandBase; @@ -10,38 +13,38 @@ import mineplex.core.message.MessageManager; public class MessageCommand extends CommandBase { - public MessageCommand(MessageManager plugin) - { - super(plugin, Rank.ALL, "m", "msg", "message", "tell", "t", "w", "whisper", "MSG"); - } + public MessageCommand(MessageManager plugin) + { + super(plugin, Rank.ALL, "m", "msg", "message", "tell", "t", "w", "whisper", "MSG"); + } - @Override - public void Execute(Player caller, String[] args) - { - if (args == null || args.length == 0) - { - Plugin.Help(caller); - } - else - { - if (args.length == 0) - { - UtilPlayer.message(caller, F.main(Plugin.getName(), "Player argument missing.")); - return; - } + @Override + public void Execute(Player caller, String[] args) + { + if (args == null || args.length == 0) + { + UtilPlayer.message(caller, F.main(Plugin.getName(), "You didn't specify someone to message!")); + } + else + { + // Parse Message + String message; + if (args.length > 1) + { + message = F.combine(args, 1, null, false); + } + else + { + message = Plugin.GetRandomMessage(); + } - // Parse Message - String message = "Beep!"; - if (args.length > 1) - { - message = F.combine(args, 1, null, false); - } - else - { - message = Plugin.GetRandomMessage(); - } + Plugin.sendMessage(caller, args[0], message, false, false); + } + } - Plugin.sendMessage(caller, args[0], message, false, false); - } - } + @Override + public List onTabComplete(CommandSender sender, String commandLabel, String[] args) + { + return tabCompletePlayerNames(sender, commandLabel, args); + } } diff --git a/Plugins/Mineplex.Core/src/mineplex/core/message/commands/ResendAdminCommand.java b/Plugins/Mineplex.Core/src/mineplex/core/message/commands/ResendAdminCommand.java index d201c296f..3d5b1ce93 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/message/commands/ResendAdminCommand.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/message/commands/ResendAdminCommand.java @@ -12,7 +12,7 @@ public class ResendAdminCommand extends CommandBase { public ResendAdminCommand(MessageManager plugin) { - super(plugin, Rank.ALL, "ra"); + super(plugin, Rank.HELPER, "ra"); } @Override @@ -24,9 +24,6 @@ public class ResendAdminCommand extends CommandBase } else { - if (!Plugin.GetClientManager().Get(caller).GetRank().has(caller, Rank.HELPER, true)) - return; - String lastTo = Plugin.Get(caller).LastAdminTo; // Get To diff --git a/Plugins/Mineplex.Core/src/mineplex/core/mount/DragonData.java b/Plugins/Mineplex.Core/src/mineplex/core/mount/DragonData.java index 1203bad95..a1d664e60 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/mount/DragonData.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/mount/DragonData.java @@ -44,7 +44,7 @@ public class DragonData extends MountData //Spawn Dragon Dragon = rider.getWorld().spawn(rider.getLocation(), EnderDragon.class); - UtilEnt.Vegetate(Dragon); + UtilEnt.vegetate(Dragon); UtilEnt.ghost(Dragon, true, false); rider.getWorld().playSound(rider.getLocation(), Sound.ENDERDRAGON_GROWL, 20f, 1f); diff --git a/Plugins/Mineplex.Core/src/mineplex/core/mount/MountManager.java b/Plugins/Mineplex.Core/src/mineplex/core/mount/MountManager.java index bbd78a15e..869f8e261 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/mount/MountManager.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/mount/MountManager.java @@ -24,10 +24,13 @@ import mineplex.core.common.util.UtilServer; import mineplex.core.disguise.DisguiseManager; import mineplex.core.donation.DonationManager; import mineplex.core.mount.types.MountBabyReindeer; +import mineplex.core.mount.types.MountCake; import mineplex.core.mount.types.MountCart; +import mineplex.core.mount.types.MountChicken; import mineplex.core.mount.types.MountDragon; import mineplex.core.mount.types.MountFreedomHorse; import mineplex.core.mount.types.MountFrost; +import mineplex.core.mount.types.MountLoveTrain; import mineplex.core.mount.types.MountMule; import mineplex.core.mount.types.MountNightmareSteed; import mineplex.core.mount.types.MountSlime; @@ -77,7 +80,9 @@ public class MountManager extends MiniPlugin _types.add(new MountFreedomHorse(this)); _types.add(new MountNightmareSteed(this)); // Hidden in this update - //_types.add(new MountChicken(this)); + _types.add(new MountChicken(this)); + _types.add(new MountCake(this)); + _types.add(new MountLoveTrain(this)); //_types.add(new MountSheep(this)); } diff --git a/Plugins/Mineplex.Core/src/mineplex/core/mount/event/MountActivateEvent.java b/Plugins/Mineplex.Core/src/mineplex/core/mount/event/MountActivateEvent.java index 09b9159c1..3b37a605b 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/mount/event/MountActivateEvent.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/mount/event/MountActivateEvent.java @@ -1,13 +1,13 @@ package mineplex.core.mount.event; -import mineplex.core.gadget.types.Gadget; -import mineplex.core.mount.Mount; - import org.bukkit.entity.Player; +import org.bukkit.event.Cancellable; import org.bukkit.event.Event; import org.bukkit.event.HandlerList; -public class MountActivateEvent extends Event +import mineplex.core.mount.Mount; + +public class MountActivateEvent extends Event implements Cancellable { private static final HandlerList handlers = new HandlerList(); @@ -42,11 +42,13 @@ public class MountActivateEvent extends Event return _player; } + @Override public void setCancelled(boolean cancel) { _cancelled = cancel; } - + + @Override public boolean isCancelled() { return _cancelled; diff --git a/Plugins/Mineplex.Core/src/mineplex/core/mount/types/MountCake.java b/Plugins/Mineplex.Core/src/mineplex/core/mount/types/MountCake.java new file mode 100644 index 000000000..f7dfca9f8 --- /dev/null +++ b/Plugins/Mineplex.Core/src/mineplex/core/mount/types/MountCake.java @@ -0,0 +1,133 @@ +package mineplex.core.mount.types; + +import org.bukkit.Material; +import org.bukkit.Sound; +import org.bukkit.entity.Horse; +import org.bukkit.entity.Player; +import org.bukkit.event.EventHandler; +import org.bukkit.inventory.ItemStack; + +import mineplex.core.common.util.C; +import mineplex.core.common.util.F; +import mineplex.core.common.util.LineFormat; +import mineplex.core.common.util.UtilAction; +import mineplex.core.common.util.UtilAlg; +import mineplex.core.common.util.UtilEnt; +import mineplex.core.common.util.UtilMath; +import mineplex.core.common.util.UtilPlayer; +import mineplex.core.common.util.UtilText; +import mineplex.core.disguise.disguises.DisguiseBlock; +import mineplex.core.mount.HorseMount; +import mineplex.core.mount.MountManager; +import mineplex.core.mount.SingleEntityMountData; +import mineplex.core.recharge.Recharge; +import mineplex.core.updater.UpdateType; +import mineplex.core.updater.event.UpdateEvent; +import mineplex.core.utils.UtilVariant; + +public class MountCake extends HorseMount +{ + public MountCake(MountManager manager) + { + super(manager, "Cake Mount", + UtilText.splitLineToArray(C.cGray + "The Lie.", LineFormat.LORE), + Material.CAKE, (byte) 0, -15, Horse.Color.BLACK, Horse.Style.NONE, Horse.Variant.HORSE, 2.0, Material.AIR); + } + + @Override + public void enableCustom(Player player) + { + player.leaveVehicle(); + player.eject(); + + //Remove other mounts + Manager.DeregisterAll(player); + + Horse horse = UtilVariant.spawnHorse(player.getLocation(), _variant); + horse.setAdult(); + horse.setAgeLock(true); + horse.setColor(_color); + horse.setStyle(_style); + horse.setOwner(player); + horse.setMaxDomestication(1); + horse.setJumpStrength(_jump); + horse.setMaxHealth(20); + horse.setHealth(horse.getMaxHealth()); + horse.getInventory().setSaddle(new ItemStack(Material.SADDLE)); + + if (horse.getVariant() == Horse.Variant.MULE) + horse.setCarryingChest(true); + + if (_armor != null) + horse.getInventory().setArmor(new ItemStack(_armor)); + + horse.setCustomName(player.getName() + "'s " + getName()); + + //Inform + UtilPlayer.message(player, F.main("Mount", "You spawned " + F.elem(getName()) + ".")); + + //Store + SingleEntityMountData mount = new SingleEntityMountData<>(player, horse); + _active.put(player, mount); + + DisguiseBlock block = new DisguiseBlock(horse, Material.CAKE_BLOCK.getId(), 0); + Manager.getDisguiseManager().disguise(block); + + UtilEnt.silence(horse, true); + } + + @EventHandler + public void updateBounce(UpdateEvent event) + { + if (event.getType() != UpdateType.TICK) + return; + + //Collide + for (SingleEntityMountData cakeData : getActive().values()) + { + Horse cake = cakeData.getEntity(); + + if (cake.getPassenger() == null) + continue; + + if (!(cake.getPassenger() instanceof Player)) + continue; + + Player player = (Player)cake.getPassenger(); + + if (!Recharge.Instance.usable(player, getName() + " Collide")) + continue; + + for (SingleEntityMountData otherData : getActive().values()) + { + Horse other = otherData.getEntity(); + if (other.equals(cake)) + continue; + + if (other.getPassenger() == null) + continue; + + if (!(other.getPassenger() instanceof Player)) + continue; + + Player otherPlayer = (Player)other.getPassenger(); + + if (!Recharge.Instance.usable(otherPlayer, getName() + " Collide")) + continue; + + //Collide + if (UtilMath.offset(cake, other) > 2) + continue; + + Recharge.Instance.useForce(player, getName() + " Collide", 500); + Recharge.Instance.useForce(otherPlayer, getName() + " Collide", 500); + + UtilAction.velocity(cake, UtilAlg.getTrajectory(other, cake), 1.2, false, 0, 0.8, 10, true); + UtilAction.velocity(other, UtilAlg.getTrajectory(cake, other), 1.2, false, 0, 0.8, 10, true); + + cake.getWorld().playSound(cake.getLocation(), Sound.SLIME_WALK, 1f, 0.75f); + other.getWorld().playSound(other.getLocation(), Sound.SLIME_WALK, 1f, 0.75f); + } + } + } +} \ No newline at end of file diff --git a/Plugins/Mineplex.Core/src/mineplex/core/mount/types/MountChicken.java b/Plugins/Mineplex.Core/src/mineplex/core/mount/types/MountChicken.java index 6c8382210..3b92556d7 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/mount/types/MountChicken.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/mount/types/MountChicken.java @@ -1,10 +1,6 @@ package mineplex.core.mount.types; import java.lang.reflect.Field; -import java.time.Month; -import java.time.YearMonth; - -import net.minecraft.server.v1_8_R3.EntityLiving; import org.bukkit.Material; import org.bukkit.Sound; @@ -12,9 +8,12 @@ import org.bukkit.craftbukkit.v1_8_R3.entity.CraftPlayer; import org.bukkit.entity.Horse; import org.bukkit.entity.Player; import org.bukkit.event.EventHandler; +import org.bukkit.event.player.PlayerAnimationEvent; +import org.bukkit.event.player.PlayerAnimationType; import org.bukkit.inventory.ItemStack; import org.bukkit.util.Vector; +import mineplex.core.common.util.C; import mineplex.core.common.util.F; import mineplex.core.common.util.LineFormat; import mineplex.core.common.util.UtilAction; @@ -29,6 +28,7 @@ import mineplex.core.recharge.Recharge; import mineplex.core.updater.UpdateType; import mineplex.core.updater.event.UpdateEvent; import mineplex.core.utils.UtilVariant; +import net.minecraft.server.v1_8_R3.EntityLiving; public class MountChicken extends HorseMount { @@ -40,13 +40,15 @@ public class MountChicken extends HorseMount super(manager, "Chicken Mount", UtilText.splitLinesToArray(new String[] { - "This isn't flying! It is falling with style." + C.cGray + "This isn't flying! It is falling with style.", + C.cRed + " ", + C.cWhite + "Left Click to Bawk" }, LineFormat.LORE), - Material.FEATHER, (byte) 0, -1, Horse.Color.BLACK, Horse.Style.NONE, Horse.Variant.HORSE, 2.0, Material.AIR, YearMonth.of(2017, Month.JANUARY)); + Material.FEATHER, (byte) 0, -15, Horse.Color.BLACK, Horse.Style.NONE, Horse.Variant.HORSE, 2.0, Material.AIR); try { _jumpField = EntityLiving.class.getDeclaredField("aY"); - _jumpField.setAccessible(false); + _jumpField.setAccessible(true); } catch (NoSuchFieldException e) { e.printStackTrace(); @@ -90,11 +92,23 @@ public class MountChicken extends HorseMount _active.put(player, mount); DisguiseChicken chicken = new DisguiseChicken(horse); - chicken.setName(player.getName() + "'s Chicken Mount"); + chicken.setName(player.getName() + "'s " + getName()); Manager.getDisguiseManager().disguise(chicken); UtilEnt.silence(horse, true); } + + @EventHandler + public void onOrderQuack(PlayerAnimationEvent event) + { + if (getActive().containsKey(event.getPlayer()) && event.getAnimationType() == PlayerAnimationType.ARM_SWING) + { + if (Recharge.Instance.use(event.getPlayer(), "Chicken Bawk", 500, false, false)) + { + event.getPlayer().getWorld().playSound(getActive().get(event.getPlayer()).getEntity().getEyeLocation(), Sound.CHICKEN_IDLE, .4F, 1.0F); + } + } + } @EventHandler public void jump(UpdateEvent event) @@ -145,5 +159,4 @@ public class MountChicken extends HorseMount } } } - -} +} \ No newline at end of file diff --git a/Plugins/Mineplex.Core/src/mineplex/core/mount/types/MountDragon.java b/Plugins/Mineplex.Core/src/mineplex/core/mount/types/MountDragon.java index 2233a9baf..6241195dc 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/mount/types/MountDragon.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/mount/types/MountDragon.java @@ -108,7 +108,7 @@ public class MountDragon extends DragonMount { if (Manager.getClientManager().Get(event.getPlayer()).GetRank().has(Rank.HERO)) { - Manager.getDonationManager().Get(event.getPlayer()).AddUnknownSalesPackagesOwned(getName()); + Manager.getDonationManager().Get(event.getPlayer()).addOwnedUnknownSalesPackage(getName()); } } } diff --git a/Plugins/Mineplex.Core/src/mineplex/core/mount/types/MountLoveTrain.java b/Plugins/Mineplex.Core/src/mineplex/core/mount/types/MountLoveTrain.java new file mode 100644 index 000000000..936bcaeff --- /dev/null +++ b/Plugins/Mineplex.Core/src/mineplex/core/mount/types/MountLoveTrain.java @@ -0,0 +1,138 @@ +package mineplex.core.mount.types; + +import org.bukkit.Material; +import org.bukkit.Sound; +import org.bukkit.entity.Horse; +import org.bukkit.entity.Player; +import org.bukkit.event.EventHandler; +import org.bukkit.inventory.ItemStack; + +import mineplex.core.common.util.C; +import mineplex.core.common.util.F; +import mineplex.core.common.util.LineFormat; +import mineplex.core.common.util.UtilAction; +import mineplex.core.common.util.UtilAlg; +import mineplex.core.common.util.UtilEnt; +import mineplex.core.common.util.UtilMath; +import mineplex.core.common.util.UtilParticle; +import mineplex.core.common.util.UtilPlayer; +import mineplex.core.common.util.UtilText; +import mineplex.core.disguise.disguises.DisguiseBlock; +import mineplex.core.mount.HorseMount; +import mineplex.core.mount.MountManager; +import mineplex.core.mount.SingleEntityMountData; +import mineplex.core.recharge.Recharge; +import mineplex.core.updater.UpdateType; +import mineplex.core.updater.event.UpdateEvent; +import mineplex.core.utils.UtilVariant; + +public class MountLoveTrain extends HorseMount +{ + + public MountLoveTrain(MountManager manager) + { + super(manager, "Love Train", + UtilText.splitLinesToArray(new String[]{C.cGray + "Woo Woo! All aboard!"}, LineFormat.LORE), + Material.WOOL, (byte) 6, -17, Horse.Color.BLACK, Horse.Style.NONE, Horse.Variant.HORSE, 2.0, Material.AIR); + } + + @Override + public void enableCustom(Player player) + { + player.leaveVehicle(); + player.eject(); + + //Remove other mounts + Manager.DeregisterAll(player); + + Horse horse = UtilVariant.spawnHorse(player.getLocation(), _variant); + horse.setAdult(); + horse.setAgeLock(true); + horse.setColor(_color); + horse.setStyle(_style); + horse.setOwner(player); + horse.setMaxDomestication(1); + horse.setJumpStrength(_jump); + horse.setMaxHealth(20); + horse.setHealth(horse.getMaxHealth()); + horse.getInventory().setSaddle(new ItemStack(Material.SADDLE)); + + if (horse.getVariant() == Horse.Variant.MULE) + horse.setCarryingChest(true); + + if (_armor != null) + horse.getInventory().setArmor(new ItemStack(_armor)); + + horse.setCustomName(player.getName() + "'s " + getName()); + + //Inform + UtilPlayer.message(player, F.main("Mount", "You spawned " + F.elem(getName()) + ".")); + + //Store + SingleEntityMountData mount = new SingleEntityMountData<>(player, horse); + _active.put(player, mount); + + DisguiseBlock block = new DisguiseBlock(horse, Material.BARRIER.getId(), 0); + Manager.getDisguiseManager().disguise(block); + + UtilEnt.silence(horse, true); + } + + @EventHandler + public void updateBounce(UpdateEvent event) + { + if (event.getType() != UpdateType.TICK) + return; + + //Collide + for (SingleEntityMountData loveTrainData : getActive().values()) + { + Horse loveTrain = loveTrainData.getEntity(); + + UtilParticle.PlayParticle(UtilParticle.ParticleType.HEART, loveTrain.getLocation(), 0.25f, 0.25f, 0.25f, 0.5f, 3, UtilParticle.ViewDist.NORMAL); + + if (loveTrain.getPassenger() == null) + continue; + + if (!(loveTrain.getPassenger() instanceof Player)) + continue; + + Player player = (Player) loveTrain.getPassenger(); + + if (!Recharge.Instance.usable(player, getName() + " Collide")) + continue; + + for (SingleEntityMountData otherData : getActive().values()) + { + Horse other = otherData.getEntity(); + if (other.equals(loveTrain)) + continue; + + if (other.getPassenger() == null) + continue; + + if (!(other.getPassenger() instanceof Player)) + continue; + + Player otherPlayer = (Player)other.getPassenger(); + + if (!Recharge.Instance.usable(otherPlayer, getName() + " Collide")) + continue; + + //Collide + if (UtilMath.offset(loveTrain, other) > 2) + continue; + + Recharge.Instance.useForce(player, getName() + " Collide", 500); + Recharge.Instance.useForce(otherPlayer, getName() + " Collide", 500); + + UtilAction.velocity(loveTrain, UtilAlg.getTrajectory(other, loveTrain), 1.2, false, 0, 0.8, 10, true); + UtilAction.velocity(other, UtilAlg.getTrajectory(loveTrain, other), 1.2, false, 0, 0.8, 10, true); + + loveTrain.getWorld().playSound(loveTrain.getLocation(), Sound.SLIME_WALK, 1f, 0.75f); + other.getWorld().playSound(other.getLocation(), Sound.SLIME_WALK, 1f, 0.75f); + } + } + } + +} diff --git a/Plugins/Mineplex.Core/src/mineplex/core/mount/types/MountNightmareSteed.java b/Plugins/Mineplex.Core/src/mineplex/core/mount/types/MountNightmareSteed.java index 1e2459c3b..a58b5ef66 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/mount/types/MountNightmareSteed.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/mount/types/MountNightmareSteed.java @@ -1,18 +1,10 @@ package mineplex.core.mount.types; +import java.awt.Color; import java.util.HashMap; import java.util.Iterator; import java.util.Map; -import mineplex.core.common.util.*; -import mineplex.core.common.util.particles.ColoredParticle; -import mineplex.core.common.util.particles.DustSpellColor; -import mineplex.core.mount.HorseMount; -import mineplex.core.mount.MountManager; -import mineplex.core.mount.SingleEntityMountData; -import mineplex.core.updater.UpdateType; -import mineplex.core.updater.event.UpdateEvent; -import org.bukkit.Color; import org.bukkit.Location; import org.bukkit.Material; import org.bukkit.block.BlockFace; @@ -21,6 +13,24 @@ import org.bukkit.entity.Horse; import org.bukkit.event.EventHandler; import org.bukkit.util.Vector; +import mineplex.core.common.util.C; +import mineplex.core.common.util.LineFormat; +import mineplex.core.common.util.UtilAlg; +import mineplex.core.common.util.UtilBlock; +import mineplex.core.common.util.UtilEnt; +import mineplex.core.common.util.UtilMath; +import mineplex.core.common.util.UtilParticle; +import mineplex.core.common.util.UtilServer; +import mineplex.core.common.util.UtilText; +import mineplex.core.common.util.UtilTime; +import mineplex.core.common.util.particles.ColoredParticle; +import mineplex.core.common.util.particles.DustSpellColor; +import mineplex.core.mount.HorseMount; +import mineplex.core.mount.MountManager; +import mineplex.core.mount.SingleEntityMountData; +import mineplex.core.updater.UpdateType; +import mineplex.core.updater.event.UpdateEvent; + public class MountNightmareSteed extends HorseMount { diff --git a/Plugins/Mineplex.Core/src/mineplex/core/mount/types/MountTitan.java b/Plugins/Mineplex.Core/src/mineplex/core/mount/types/MountTitan.java index 9bd3f4f07..556de0243 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/mount/types/MountTitan.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/mount/types/MountTitan.java @@ -137,7 +137,7 @@ public class MountTitan extends Mount { if (Manager.getClientManager().Get(event.getPlayer()).GetRank().has(Rank.TITAN)) { - Manager.getDonationManager().Get(event.getPlayer()).AddUnknownSalesPackagesOwned(getName()); + Manager.getDonationManager().Get(event.getPlayer()).addOwnedUnknownSalesPackage(getName()); } } } diff --git a/Plugins/Mineplex.Core/src/mineplex/core/npc/NpcManager.java b/Plugins/Mineplex.Core/src/mineplex/core/npc/NpcManager.java index 73c160a68..4e76af53b 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/npc/NpcManager.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/npc/NpcManager.java @@ -341,7 +341,7 @@ public class NpcManager extends MiniPlugin if (npc.getDatabaseRecord().getRadius() == 0) { - UtilEnt.Vegetate(entity); + UtilEnt.vegetate(entity); UtilEnt.silence(entity, true); UtilEnt.ghost(entity, true, false); @@ -604,7 +604,7 @@ public class NpcManager extends MiniPlugin if (npc.getDatabaseRecord().getRadius() == 0) { - UtilEnt.Vegetate(entity); + UtilEnt.vegetate(entity); UtilEnt.ghost(entity, true, false); } } diff --git a/Plugins/Mineplex.Core/src/mineplex/core/particleeffects/BabyFireworkEffect.java b/Plugins/Mineplex.Core/src/mineplex/core/particleeffects/BabyFireworkEffect.java index d0fdbc78e..fc85c203f 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/particleeffects/BabyFireworkEffect.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/particleeffects/BabyFireworkEffect.java @@ -1,8 +1,8 @@ package mineplex.core.particleeffects; +import java.awt.Color; import java.util.Random; -import org.bukkit.Color; import org.bukkit.Location; import org.bukkit.plugin.java.JavaPlugin; @@ -17,12 +17,18 @@ public class BabyFireworkEffect extends Effect private Color _fireworkColor; private Location _fireworkLocation; private Random _random = new Random(); - private int _count = 0, _fireworkCount = 0; + private int _count = 0, _fireworkCount = 0, _maxCount = -1; private boolean _multipleColors = false; private int _currentColor = 0; private Color[] _colors; + private boolean _trail = true; public BabyFireworkEffect(Location location, JavaPlugin javaPlugin, Color color) + { + this(location, javaPlugin, color, -1); + } + + public BabyFireworkEffect(Location location, JavaPlugin javaPlugin, Color color, int maxCount) { super(10, new EffectLocation(location), javaPlugin, 2); _fireworkColor = color; @@ -34,6 +40,7 @@ public class BabyFireworkEffect extends Effect } _colors = new Color[0]; + _maxCount = maxCount; } public BabyFireworkEffect(Location location, JavaPlugin javaPlugin, Color... colors) @@ -50,9 +57,30 @@ public class BabyFireworkEffect extends Effect _count = count; } + public void setTrail(boolean trail) + { + _trail = trail; + } + + @Override + public void onStart() + { + if (!_trail) + { + _count = 6; + } + } + @Override public void runEffect() { + if (_maxCount != -1) + { + if (_maxCount >= _fireworkCount) + { + stop(); + } + } if (_count == 0) { double randX = _random.nextDouble() * 2 - 1, randY = _random.nextDouble() + .5, diff --git a/Plugins/Mineplex.Core/src/mineplex/core/particleeffects/BlowAKissEffect.java b/Plugins/Mineplex.Core/src/mineplex/core/particleeffects/BlowAKissEffect.java new file mode 100644 index 000000000..066521459 --- /dev/null +++ b/Plugins/Mineplex.Core/src/mineplex/core/particleeffects/BlowAKissEffect.java @@ -0,0 +1,85 @@ +package mineplex.core.particleeffects; + +import org.bukkit.Location; +import org.bukkit.Material; +import org.bukkit.Sound; +import org.bukkit.entity.Player; +import org.bukkit.util.Vector; + +import mineplex.core.common.util.F; +import mineplex.core.common.util.UtilParticle; +import mineplex.core.common.util.UtilServer; +import mineplex.core.gadget.types.Gadget; + +public class BlowAKissEffect extends Effect +{ + + private int _particles = 100; + private int _count = 0; + private Vector _vector; + private Location _fixedLoc; + private Gadget _gadget; + private Player _player; + + public BlowAKissEffect(Player player, Location target, Gadget gadget) + { + super(-1, new EffectLocation(player), gadget.Manager.getPlugin()); + _gadget = gadget; + _player = player; + setTargetLocation(new EffectLocation(target)); + } + + @Override + public void onStart() + { + _player.getWorld().playSound(_player.getLocation(), Sound.PISTON_RETRACT, 1f, 1f); + } + + @Override + public void runEffect() + { + Location location = _effectLocation.getFixedLocation().clone().add(0, 1, 0); + if (_vector == null) + { + Location targetLoc = getTargetLocation().getFixedLocation().clone(); + Vector link = targetLoc.toVector().subtract(location.toVector()); + float length = (float) link.length(); + link.normalize(); + _vector = link.multiply(length / _particles); + _fixedLoc = location.clone().subtract(_vector); + } + for (int i = 0; i < 5; i++){ + _fixedLoc.add(_vector); + UtilParticle.PlayParticle(UtilParticle.ParticleType.HEART, _fixedLoc, 0, 0, 0, 0, 2, UtilParticle.ViewDist.LONG); + } + if (checkPlayer()) + { + stop(); + return; + } + if (_fixedLoc.getBlock().getType() != Material.AIR || _count >= 1000) + { + UtilServer.broadcast(F.main("Blow A Kiss", F.name(_player.getName()) + " wanted to kiss someone but no one was around!")); + stop(); + } + _count += 5; + } + + private boolean checkPlayer() + { + for (Player player : UtilServer.getPlayers()) + { + if (player.equals(_player)) + continue; + + if (player.getLocation().distanceSquared(_fixedLoc) <= 2.25) + { + UtilParticle.PlayParticle(UtilParticle.ParticleType.HEART, player.getLocation(), 0.25f, 0.25f, 0.25f, 0.5f, 7, UtilParticle.ViewDist.NORMAL); + UtilServer.broadcast(F.main("Blow A Kiss", F.name(_player.getName()) + " blows a kiss at " + F.name(player.getName()) + "!")); + return true; + } + } + return false; + } + +} diff --git a/Plugins/Mineplex.Core/src/mineplex/core/particleeffects/ChristmasTreeEffect.java b/Plugins/Mineplex.Core/src/mineplex/core/particleeffects/ChristmasTreeEffect.java new file mode 100644 index 000000000..bc2da7ac4 --- /dev/null +++ b/Plugins/Mineplex.Core/src/mineplex/core/particleeffects/ChristmasTreeEffect.java @@ -0,0 +1,77 @@ +package mineplex.core.particleeffects; + +import java.awt.Color; + +import org.bukkit.Location; +import org.bukkit.entity.Player; +import org.bukkit.plugin.java.JavaPlugin; + +import mineplex.core.common.util.Callback; +import mineplex.core.common.util.UtilParticle; +import mineplex.core.common.util.particles.ColoredParticle; +import mineplex.core.common.util.particles.DustSpellColor; +import mineplex.core.gadget.GadgetManager; + +public class ChristmasTreeEffect extends Effect +{ + + private Player _player; + private JavaPlugin _plugin; + private int _count = 0; + private double _currentRadius = 0; + private double _currentY = 0; + private BabyFireworkEffect _babyFireworkEffect = null; + private GadgetManager _manager; + + private static final double MAX_RADIUS = 1.; + private static final double MAX_Y = 2.5; + + public ChristmasTreeEffect(JavaPlugin plugin, Player player, GadgetManager manager) + { + super(-1, new EffectLocation(player), plugin, 5); + _player = player; + _plugin = plugin; + _manager = manager; + } + + @Override + public void runEffect() + { + if (_manager.isMoving(_player)) + { + Location loc = _player.getLocation().add(0, 1.2, 0).add(_player.getLocation().getDirection().multiply(-0.2)); + ColoredParticle coloredParticle = new ColoredParticle(UtilParticle.ParticleType.RED_DUST, new DustSpellColor(new Color(8388608)), loc); + coloredParticle.display(); + coloredParticle.setColor(new DustSpellColor(Color.GREEN)); + coloredParticle.display(); + return; + } + if (_currentY < MAX_Y) + { + double radius = MAX_RADIUS - _currentRadius; + _currentRadius += 0.1; + CircleEffect circleEffect = new CircleEffect(_plugin, _player.getLocation().clone().add(0, _currentY, 0), radius, Color.GREEN); + circleEffect.addRandomColor(Color.RED); + circleEffect.addRandomColor(Color.YELLOW); + circleEffect.start(); + _currentY += 0.25; + } + else + { + BabyFireworkEffect babyFireworkEffect = new BabyFireworkEffect(_player.getLocation().clone().add(0, MAX_Y + .5, 0), _plugin, Color.YELLOW, 1); + babyFireworkEffect.setTrail(false); + babyFireworkEffect.start(); + _babyFireworkEffect = babyFireworkEffect; + _babyFireworkEffect.setCallback(new Callback() + { + @Override + public void run(Effect data) + { + _currentY = 0; + _currentRadius = 0; + } + }); + } + } + +} diff --git a/Plugins/Mineplex.Core/src/mineplex/core/particleeffects/CircleEffect.java b/Plugins/Mineplex.Core/src/mineplex/core/particleeffects/CircleEffect.java new file mode 100644 index 000000000..8d1ae23d1 --- /dev/null +++ b/Plugins/Mineplex.Core/src/mineplex/core/particleeffects/CircleEffect.java @@ -0,0 +1,119 @@ +package mineplex.core.particleeffects; + +import java.awt.Color; +import java.util.ArrayList; +import java.util.List; + +import org.bukkit.Location; +import org.bukkit.plugin.java.JavaPlugin; +import org.bukkit.util.Vector; + +import mineplex.core.common.util.UtilMath; +import mineplex.core.common.util.UtilParticle; +import mineplex.core.common.util.particles.ColoredParticle; +import mineplex.core.common.util.particles.DustSpellColor; + +public class CircleEffect extends Effect +{ + + private double _radius; + private Color _color; + private int _steps = 0; + private boolean _instantly = true; + private List _randomColors = new ArrayList<>(); + private int _maxCircles = -1; + private int _totalCircles = 0; + + private static final double RANDOM_COLOR_CHANCE = 0.5; + private static final int PARTICLES_PER_CIRCLE = 20; + + public CircleEffect(JavaPlugin plugin, Location location, double radius, Color color) + { + super(-1, new EffectLocation(location), plugin); + _radius = radius; + _color = color; + } + + public CircleEffect(JavaPlugin plugin, Location location, double radius, Color color, boolean instantly) + { + this(plugin, location, radius, color); + _instantly = instantly; + } + + public void addRandomColor(Color color) + { + _randomColors.add(color); + } + + public void setMaxCircles(int circles) + { + _maxCircles = circles; + } + + @Override + public void runEffect() + { + if (_instantly) + { + for (int i = 0; i < PARTICLES_PER_CIRCLE; i++) + { + Location location = getEffectLocation().getFixedLocation(); + double increment = (2 * Math.PI) / PARTICLES_PER_CIRCLE; + double angle = _steps * increment; + Vector vector = new Vector(Math.cos(angle) * _radius, 0, Math.sin(angle) * _radius); + ColoredParticle coloredParticle = new ColoredParticle(UtilParticle.ParticleType.RED_DUST, new DustSpellColor(_color), location.add(vector)); + coloredParticle.display(); + if (_randomColors.size() > 0) + { + double r = UtilMath.random.nextDouble(); + if (r < RANDOM_COLOR_CHANCE) + { + coloredParticle.setColor(new DustSpellColor(getRandomColor())); + coloredParticle.display(); + } + } + _steps++; + } + stop(); + } + else + { + if (_maxCircles != -1) + { + if (_totalCircles >= _maxCircles) + { + stop(); + return; + } + } + Location location = getEffectLocation().getFixedLocation(); + double increment = (2 * Math.PI) / PARTICLES_PER_CIRCLE; + double angle = _steps * increment; + Vector vector = new Vector(Math.cos(angle) * _radius, 0, Math.sin(angle) * _radius); + ColoredParticle coloredParticle = new ColoredParticle(UtilParticle.ParticleType.RED_DUST, new DustSpellColor(_color), location.add(vector)); + coloredParticle.display(); + if (_randomColors.size() > 0) + { + double r = UtilMath.random.nextDouble(); + if (r < RANDOM_COLOR_CHANCE) + { + coloredParticle.setColor(new DustSpellColor(getRandomColor())); + coloredParticle.display(); + } + } + _steps++; + if (_steps >= PARTICLES_PER_CIRCLE) + { + _totalCircles++; + _steps = 0; + } + } + } + + private Color getRandomColor() + { + int r = UtilMath.random.nextInt(_randomColors.size()); + return _randomColors.get(r); + } + +} diff --git a/Plugins/Mineplex.Core/src/mineplex/core/particleeffects/Effect.java b/Plugins/Mineplex.Core/src/mineplex/core/particleeffects/Effect.java index 818d75c63..f72a32fbf 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/particleeffects/Effect.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/particleeffects/Effect.java @@ -3,6 +3,9 @@ package mineplex.core.particleeffects; import org.bukkit.Bukkit; import org.bukkit.plugin.java.JavaPlugin; +import mineplex.core.common.util.Callback; +import mineplex.core.particleeffects.events.EffectStopEvent; + public abstract class Effect { @@ -12,6 +15,7 @@ public abstract class Effect public EffectLocation _targetLocation; protected JavaPlugin _javaPlugin; private boolean _running = false; + private Callback _callback; public Effect(int ticks, EffectLocation effectLocation, JavaPlugin javaPlugin) { @@ -47,6 +51,10 @@ public abstract class Effect { _running = false; Bukkit.getScheduler().cancelTask(_task); + EffectStopEvent effectStopEvent = new EffectStopEvent(this); + Bukkit.getPluginManager().callEvent(effectStopEvent); + if (_callback != null) + _callback.run(this); onStop(); } @@ -83,4 +91,9 @@ public abstract class Effect return _effectLocation; } + public void setCallback(Callback callback) + { + _callback = callback; + } + } diff --git a/Plugins/Mineplex.Core/src/mineplex/core/particleeffects/FreedomFireworkEffect.java b/Plugins/Mineplex.Core/src/mineplex/core/particleeffects/FreedomFireworkEffect.java index 8ea666184..c89fd92cf 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/particleeffects/FreedomFireworkEffect.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/particleeffects/FreedomFireworkEffect.java @@ -1,6 +1,7 @@ package mineplex.core.particleeffects; -import org.bukkit.Color; +import java.awt.Color; + import org.bukkit.Location; import org.bukkit.entity.Entity; import org.bukkit.plugin.java.JavaPlugin; diff --git a/Plugins/Mineplex.Core/src/mineplex/core/particleeffects/FreedomTrailEffect.java b/Plugins/Mineplex.Core/src/mineplex/core/particleeffects/FreedomTrailEffect.java index 86f55dfa1..373b6c570 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/particleeffects/FreedomTrailEffect.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/particleeffects/FreedomTrailEffect.java @@ -1,6 +1,7 @@ package mineplex.core.particleeffects; -import org.bukkit.Color; +import java.awt.Color; + import org.bukkit.FireworkEffect; import org.bukkit.entity.Entity; import org.bukkit.plugin.java.JavaPlugin; diff --git a/Plugins/Mineplex.Core/src/mineplex/core/particleeffects/LineEffect.java b/Plugins/Mineplex.Core/src/mineplex/core/particleeffects/LineEffect.java new file mode 100644 index 000000000..15a55f406 --- /dev/null +++ b/Plugins/Mineplex.Core/src/mineplex/core/particleeffects/LineEffect.java @@ -0,0 +1,52 @@ +package mineplex.core.particleeffects; + +import java.awt.Color; + +import org.bukkit.Location; +import org.bukkit.plugin.java.JavaPlugin; +import org.bukkit.util.Vector; + +import mineplex.core.common.util.UtilParticle; +import mineplex.core.common.util.particles.ColoredParticle; +import mineplex.core.common.util.particles.DustSpellColor; + +public class LineEffect extends Effect +{ + + private int _particles = 100; + private Color _color; + private int _count = 0; + private Vector _vector; + private Location _fixedLoc; + + public LineEffect(JavaPlugin plugin, Location location, Location target, Color color) + { + super(-1, new EffectLocation(location), plugin); + setTargetLocation(new EffectLocation(target)); + _color = color; + } + + @Override + public void runEffect() + { + Location location = _effectLocation.getFixedLocation().clone().add(0, 1, 0); + if (_vector == null) + { + Location targetLoc = getTargetLocation().getFixedLocation().clone(); + Vector link = targetLoc.toVector().subtract(location.toVector()); + float length = (float) link.length(); + link.normalize(); + Vector vector = link.multiply(length / _particles); + _vector = vector; + _fixedLoc = location.clone().subtract(_vector); + } + ColoredParticle coloredParticle = new ColoredParticle(UtilParticle.ParticleType.RED_DUST, + new DustSpellColor(_color), _effectLocation.getLocation().clone()); + _fixedLoc.add(_vector); + if (_count == _particles) + { + stop(); + } + } + +} diff --git a/Plugins/Mineplex.Core/src/mineplex/core/particleeffects/LoveDoctorEffect.java b/Plugins/Mineplex.Core/src/mineplex/core/particleeffects/LoveDoctorEffect.java new file mode 100644 index 000000000..85c293e6f --- /dev/null +++ b/Plugins/Mineplex.Core/src/mineplex/core/particleeffects/LoveDoctorEffect.java @@ -0,0 +1,94 @@ +package mineplex.core.particleeffects; + +import java.util.HashMap; + +import org.bukkit.Location; +import org.bukkit.Material; +import org.bukkit.Sound; +import org.bukkit.entity.Player; +import org.bukkit.util.Vector; + +import mineplex.core.common.util.UtilAction; +import mineplex.core.common.util.UtilAlg; +import mineplex.core.common.util.UtilParticle; +import mineplex.core.common.util.UtilPlayer; +import mineplex.core.common.util.UtilServer; +import mineplex.core.gadget.types.Gadget; + +public class LoveDoctorEffect extends Effect +{ + + private int _particles = 100; + private int _count = 0; + private Vector _vector; + private Location _fixedLoc; + private Gadget _gadget; + private Player _player; + private boolean _forceStop = false; + + public LoveDoctorEffect(Player player, Location target, Gadget gadget) + { + super(-1, new EffectLocation(player), gadget.Manager.getPlugin()); + _gadget = gadget; + _player = player; + setTargetLocation(new EffectLocation(target)); + } + + @Override + public void onStart() + { + _player.getWorld().playSound(_player.getLocation(), Sound.PISTON_RETRACT, 1f, 1f); + } + + @Override + public void runEffect() + { + Location location = _effectLocation.getFixedLocation().clone().add(0, 1, 0); + if (_vector == null) + { + Location targetLoc = getTargetLocation().getFixedLocation().clone(); + Vector link = targetLoc.toVector().subtract(location.toVector()); + float length = (float) link.length(); + link.normalize(); + _vector = link.multiply(length / _particles); + _fixedLoc = location.clone().subtract(_vector); + } + for (int i = 0; i < 5; i++){ + _fixedLoc.add(_vector); + UtilParticle.PlayParticle(UtilParticle.ParticleType.HEART, _fixedLoc, 0, 0, 0, 0, 1, UtilParticle.ViewDist.LONG); + } + if (_fixedLoc.getBlock().getType() != Material.AIR ) + { + stop(); + } + else if (_count >= 1000) + { + _forceStop = true; + stop(); + } + _count += 5; + } + + @Override + public void onStop() + { + // Creates the explosion and knockback players + Location loc = _fixedLoc; + loc.getWorld().createExplosion(loc, 0f); + UtilParticle.PlayParticle(UtilParticle.ParticleType.EXPLODE, loc, 3f, 3f, 3f, 0, 32, UtilParticle.ViewDist.MAX, UtilServer.getPlayers()); + HashMap players = UtilPlayer.getInRadius(loc, 9d); + for (Player ent : players.keySet()) + { + if (_gadget.Manager.collideEvent(_player, _gadget, ent)) + continue; + + double mult = players.get(ent); + + //Knockback + UtilAction.velocity(ent, UtilAlg.getTrajectory(loc, ent.getLocation()), 2 * mult, false, 0, 1 + 1 * mult, 10, true); + LoveDoctorHitEffect loveDoctorHitEffect = new LoveDoctorHitEffect(ent); + loveDoctorHitEffect.start(); + } + } + +} diff --git a/Plugins/Mineplex.Core/src/mineplex/core/particleeffects/LoveDoctorHitEffect.java b/Plugins/Mineplex.Core/src/mineplex/core/particleeffects/LoveDoctorHitEffect.java new file mode 100644 index 000000000..5b7678fa1 --- /dev/null +++ b/Plugins/Mineplex.Core/src/mineplex/core/particleeffects/LoveDoctorHitEffect.java @@ -0,0 +1,24 @@ +package mineplex.core.particleeffects; + +import org.bukkit.Location; +import org.bukkit.entity.Player; + +import mineplex.core.common.util.UtilParticle; +import mineplex.core.common.util.UtilServer; + +public class LoveDoctorHitEffect extends Effect +{ + + public LoveDoctorHitEffect(Player player) + { + super(200, new EffectLocation(player.getLocation()), UtilServer.getPlugin()); + } + + @Override + public void runEffect() + { + Location location = getEffectLocation().getLocation(); + UtilParticle.PlayParticle(UtilParticle.ParticleType.HEART, location.clone().add(0, 1, 0), 0.75f, 0.75f, 0.75f, 0, 1, UtilParticle.ViewDist.NORMAL); + } + +} diff --git a/Plugins/Mineplex.Core/src/mineplex/core/particleeffects/MetalManEffect.java b/Plugins/Mineplex.Core/src/mineplex/core/particleeffects/MetalManEffect.java index bb5615b72..d9382e15e 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/particleeffects/MetalManEffect.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/particleeffects/MetalManEffect.java @@ -1,9 +1,9 @@ package mineplex.core.particleeffects; +import java.awt.Color; import java.util.HashMap; import java.util.HashSet; -import org.bukkit.Color; import org.bukkit.Location; import org.bukkit.Material; import org.bukkit.Sound; diff --git a/Plugins/Mineplex.Core/src/mineplex/core/particleeffects/NewYearEffect.java b/Plugins/Mineplex.Core/src/mineplex/core/particleeffects/NewYearEffect.java index f9ea7e172..114dd4c50 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/particleeffects/NewYearEffect.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/particleeffects/NewYearEffect.java @@ -1,155 +1,155 @@ -package mineplex.core.particleeffects; - -public class NewYearEffect //extends Effect -{ - - /*private static final int SECONDS_IN_A_MINUTE = 60; - - private final Location _ballLocation, _clockLocation, _timerLocation, _timerLocationTen; - - private int _seconds = 90; - private Collection _blocks = new ArrayList<>(); - private List _schematics = new ArrayList<>(); - private boolean _placed = false; - private int _currentRun = 0; - - public NewYearEffect(JavaPlugin plugin, Location location) - { - super(-1, new EffectLocation(location), plugin, 10); - _ballLocation = new Location(location.clone().getWorld(), 0, 71, 38); - _clockLocation = _ballLocation.clone().add(-12, 0, -15); - _timerLocation = _clockLocation.clone().add(19, 7, 0); - _timerLocationTen = _timerLocation.clone().add(1, 0, 0); - try - { - for (int i = 0; i <= 10; i++) - { - Schematic schematic = UtilSchematic.loadSchematic(new File("../../update/schematic/NewYearBall" + i + ".schematic")); - _schematics.add(i, schematic); - } - Schematic schematic = UtilSchematic.loadSchematic(new File("../../update/schematic/NewYearClock.schematic")); - _schematics.add(11, schematic); - } - catch (Exception e) - { - e.printStackTrace(); - } - } - - @Override - public void runEffect() - { - if (!_placed) - { - pasteSchematic(10, true); - _placed = true; - } - - if (_seconds == -60) - { - stop(); - return; - } - - if (_seconds == 0) - { - List fireworkLocations = new ArrayList<>(); - List fixedFireworkLocations = new ArrayList<>(); - int[][] fireworkCoords = new int[][] - { - {0, 77, -37}, - {-6, 71, 17}, - {6, 71, 17}, - {12, 71, 7}, - {-12, 71, 7}, - {5, 71, 92}, - {-7, 71, 92}, - {-9, 103, 37}, - {13, 107, 40} - }; - fireworkLocations.addAll(Arrays.asList(fireworkCoords)); - int[][] fixedFireworkCoords = new int[][] - { - {0, 80, 0}, - {0, 80, -32}, - {6, 80, -26}, - {-6, 80, -26} - }; - fixedFireworkLocations.addAll(Arrays.asList(fixedFireworkCoords)); - NewYearFireworkEffect newYearFireworkEffect = new NewYearFireworkEffect(_javaPlugin, fireworkLocations, fixedFireworkLocations, getEffectLocation().getFixedLocation().getWorld()); - newYearFireworkEffect.start(); - } - - if (_currentRun % 2 != 0 && _seconds >= 0) - { - //Format seconds - int totalMinutes = 0, totalSeconds = 0, placeholder; - placeholder = _seconds; - if (_seconds > SECONDS_IN_A_MINUTE) - { - while (placeholder > SECONDS_IN_A_MINUTE) - { - totalMinutes++; - placeholder -= SECONDS_IN_A_MINUTE; - } - } - totalSeconds = placeholder; - String formatted = String.format("%02d:%02d", totalMinutes, totalSeconds); - if (_seconds <= 10) - { - formatted = "| " + _seconds + " |"; - pasteSchematic(_seconds, false); - } - updateTimer(formatted, (byte) 0); - _seconds--; - } - else if (_seconds >= 0 && _seconds <= 10) - { - updateTimer("| " + _seconds + " |", (byte) 14); - } - else if (_currentRun % 2 != 0 && _seconds < 0) - { - updateTimer("2017!", (byte) 0); - _seconds--; - } - else if (_seconds < 0) - { - updateTimer("2017!", (byte) 14); - } - - _currentRun++; - } - - @Override - public void onStop() - { - _blocks.forEach(b -> b.setType(Material.AIR)); - _blocks.clear(); - updateTimer("2017!", (byte) 14); - } - - private void pasteSchematic(int second, boolean pasteClock) - { - Schematic schematic = _schematics.get(second); - if (schematic != null) - { - schematic.paste(_ballLocation, false, true); - - if (pasteClock) - { - Schematic clockSchematic = _schematics.get(11); - clockSchematic.paste(_clockLocation); - } - } - } - - private void updateTimer(String time, byte color) - { - // Clears previous blocks - _blocks.forEach(b -> b.setType(Material.AIR)); - - Collection blocks = UtilBlockText.MakeText(time, (_seconds <= 10 && _seconds >= 0) ? _timerLocationTen : _timerLocation, BlockFace.WEST, Material.STAINED_CLAY.getId(), color, UtilBlockText.TextAlign.LEFT, false); - _blocks = blocks; - }*/ - -} +package mineplex.core.particleeffects; + +public class NewYearEffect //extends Effect +{ + + /*private static final int SECONDS_IN_A_MINUTE = 60; + + private final Location _ballLocation, _clockLocation, _timerLocation, _timerLocationTen; + + private int _seconds = 90; + private Collection _blocks = new ArrayList<>(); + private List _schematics = new ArrayList<>(); + private boolean _placed = false; + private int _currentRun = 0; + + public NewYearEffect(JavaPlugin plugin, Location location) + { + super(-1, new EffectLocation(location), plugin, 10); + _ballLocation = new Location(location.clone().getWorld(), 0, 71, 38); + _clockLocation = _ballLocation.clone().add(-12, 0, -15); + _timerLocation = _clockLocation.clone().add(19, 7, 0); + _timerLocationTen = _timerLocation.clone().add(1, 0, 0); + try + { + for (int i = 0; i <= 10; i++) + { + Schematic schematic = UtilSchematic.loadSchematic(new File("../../update/schematic/NewYearBall" + i + ".schematic")); + _schematics.add(i, schematic); + } + Schematic schematic = UtilSchematic.loadSchematic(new File("../../update/schematic/NewYearClock.schematic")); + _schematics.add(11, schematic); + } + catch (Exception e) + { + e.printStackTrace(); + } + } + + @Override + public void runEffect() + { + if (!_placed) + { + pasteSchematic(10, true); + _placed = true; + } + + if (_seconds == -60) + { + stop(); + return; + } + + if (_seconds == 0) + { + List fireworkLocations = new ArrayList<>(); + List fixedFireworkLocations = new ArrayList<>(); + int[][] fireworkCoords = new int[][] + { + {0, 77, -37}, + {-6, 71, 17}, + {6, 71, 17}, + {12, 71, 7}, + {-12, 71, 7}, + {5, 71, 92}, + {-7, 71, 92}, + {-9, 103, 37}, + {13, 107, 40} + }; + fireworkLocations.addAll(Arrays.asList(fireworkCoords)); + int[][] fixedFireworkCoords = new int[][] + { + {0, 80, 0}, + {0, 80, -32}, + {6, 80, -26}, + {-6, 80, -26} + }; + fixedFireworkLocations.addAll(Arrays.asList(fixedFireworkCoords)); + NewYearFireworkEffect newYearFireworkEffect = new NewYearFireworkEffect(_javaPlugin, fireworkLocations, fixedFireworkLocations, getEffectLocation().getFixedLocation().getWorld()); + newYearFireworkEffect.start(); + } + + if (_currentRun % 2 != 0 && _seconds >= 0) + { + //Format seconds + int totalMinutes = 0, totalSeconds = 0, placeholder; + placeholder = _seconds; + if (_seconds > SECONDS_IN_A_MINUTE) + { + while (placeholder > SECONDS_IN_A_MINUTE) + { + totalMinutes++; + placeholder -= SECONDS_IN_A_MINUTE; + } + } + totalSeconds = placeholder; + String formatted = String.format("%02d:%02d", totalMinutes, totalSeconds); + if (_seconds <= 10) + { + formatted = "| " + _seconds + " |"; + pasteSchematic(_seconds, false); + } + updateTimer(formatted, (byte) 0); + _seconds--; + } + else if (_seconds >= 0 && _seconds <= 10) + { + updateTimer("| " + _seconds + " |", (byte) 14); + } + else if (_currentRun % 2 != 0 && _seconds < 0) + { + updateTimer("2017!", (byte) 0); + _seconds--; + } + else if (_seconds < 0) + { + updateTimer("2017!", (byte) 14); + } + + _currentRun++; + } + + @Override + public void onStop() + { + _blocks.forEach(b -> b.setType(Material.AIR)); + _blocks.clear(); + updateTimer("2017!", (byte) 14); + } + + private void pasteSchematic(int second, boolean pasteClock) + { + Schematic schematic = _schematics.get(second); + if (schematic != null) + { + schematic.paste(_ballLocation, false, true); + + if (pasteClock) + { + Schematic clockSchematic = _schematics.get(11); + clockSchematic.paste(_clockLocation); + } + } + } + + private void updateTimer(String time, byte color) + { + // Clears previous blocks + _blocks.forEach(b -> b.setType(Material.AIR)); + + Collection blocks = UtilBlockText.MakeText(time, (_seconds <= 10 && _seconds >= 0) ? _timerLocationTen : _timerLocation, BlockFace.WEST, Material.STAINED_CLAY.getId(), color, UtilBlockText.TextAlign.LEFT, false); + _blocks = blocks; + }*/ + +} diff --git a/Plugins/Mineplex.Core/src/mineplex/core/particleeffects/NewYearFireworkEffect.java b/Plugins/Mineplex.Core/src/mineplex/core/particleeffects/NewYearFireworkEffect.java index 86da70fd4..58e0df200 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/particleeffects/NewYearFireworkEffect.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/particleeffects/NewYearFireworkEffect.java @@ -1,46 +1,46 @@ -package mineplex.core.particleeffects; - -public class NewYearFireworkEffect //extends Effect -{ - - /*private static final int MAX_TICKS = 1200; - - private List _locations = new ArrayList<>(); - private List _fixedLocations = new ArrayList<>(); - private int _ticks = 0; - - public NewYearFireworkEffect(JavaPlugin plugin, List locations, List fixedLocations, World world) - { - super(-1, null, plugin, 5); - for (int[] locCoords : locations) - { - _locations.add(new Location(world, locCoords[0], locCoords[1], locCoords[2])); - } - for (int[] locCoords : fixedLocations) - { - _locations.add(new Location(world, locCoords[0], locCoords[1], locCoords[2])); - } - } - - @Override - public void runEffect() - { - for (int i = 0; i < 5; i++) - { - int r = UtilMath.random.nextInt(_locations.size() - 1); - Location location = _locations.get(r); - UtilFirework.launchFirework(location, UtilFirework.getRandomFireworkEffect(true, 2, 2), - new Vector((Math.random() - 0.5) * 0.05, 0.1, (Math.random() - 0.5) * 0.05), 1); - } - for (Location location : _fixedLocations) - { - UtilFirework.launchFirework(location, UtilFirework.getRandomFireworkEffect(true, 2, 2), - new Vector((Math.random() - 0.5) * 0.05, 0.1, (Math.random() - 0.5) * 0.05), 1); - } - _ticks += 5; - if (_ticks >= MAX_TICKS) - { - stop(); - } - }*/ -} +package mineplex.core.particleeffects; + +public class NewYearFireworkEffect //extends Effect +{ + + /*private static final int MAX_TICKS = 1200; + + private List _locations = new ArrayList<>(); + private List _fixedLocations = new ArrayList<>(); + private int _ticks = 0; + + public NewYearFireworkEffect(JavaPlugin plugin, List locations, List fixedLocations, World world) + { + super(-1, null, plugin, 5); + for (int[] locCoords : locations) + { + _locations.add(new Location(world, locCoords[0], locCoords[1], locCoords[2])); + } + for (int[] locCoords : fixedLocations) + { + _locations.add(new Location(world, locCoords[0], locCoords[1], locCoords[2])); + } + } + + @Override + public void runEffect() + { + for (int i = 0; i < 5; i++) + { + int r = UtilMath.random.nextInt(_locations.size() - 1); + Location location = _locations.get(r); + UtilFirework.launchFirework(location, UtilFirework.getRandomFireworkEffect(true, 2, 2), + new Vector((Math.random() - 0.5) * 0.05, 0.1, (Math.random() - 0.5) * 0.05), 1); + } + for (Location location : _fixedLocations) + { + UtilFirework.launchFirework(location, UtilFirework.getRandomFireworkEffect(true, 2, 2), + new Vector((Math.random() - 0.5) * 0.05, 0.1, (Math.random() - 0.5) * 0.05), 1); + } + _ticks += 5; + if (_ticks >= MAX_TICKS) + { + stop(); + } + }*/ +} diff --git a/Plugins/Mineplex.Core/src/mineplex/core/particleeffects/TextEffect.java b/Plugins/Mineplex.Core/src/mineplex/core/particleeffects/TextEffect.java index aca62fb56..93c5a8883 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/particleeffects/TextEffect.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/particleeffects/TextEffect.java @@ -1,87 +1,86 @@ -package mineplex.core.particleeffects; - -import java.awt.*; -import java.awt.image.BufferedImage; - -import org.bukkit.Color; -import org.bukkit.Location; -import org.bukkit.plugin.java.JavaPlugin; -import org.bukkit.util.Vector; - -import mineplex.core.common.util.UtilParticle; -import mineplex.core.common.util.UtilText; -import mineplex.core.common.util.particles.ColoredParticle; -import mineplex.core.common.util.particles.DustSpellColor; - -public class TextEffect extends Effect -{ - - private static final double IMAGE_SIZE = 0.2; - - private String _text; - private Font _font; - private boolean _realtime; - private boolean _invert; - private BufferedImage _bufferedImage; - - private ColoredParticle _coloredParticle = new ColoredParticle(UtilParticle.ParticleType.RED_DUST, new DustSpellColor(Color.GREEN), null); - - public TextEffect(JavaPlugin plugin, int ticks, String text, Location location, boolean realtime, boolean invert) throws Exception - { - super(ticks, new EffectLocation(location), plugin); - _text = text; - _font = new Font("Tahoma", Font.PLAIN, 16); - _realtime = realtime; - _invert = invert; - } - - public void setText(String text) - { - if (!_realtime) - return; - - _text = text; - } - - @Override - public void runEffect() - { - if (_text == null || _font == null) - { - stop(); - return; - } - if (_bufferedImage == null || _realtime) - { - _bufferedImage = UtilText.stringToBufferedImage(_font, _text); - } - int color = 0; - for (int y = 0; y < _bufferedImage.getHeight(); y++) - { - for (int x = 0; x < _bufferedImage.getWidth(); x++) - { - color = _bufferedImage.getRGB(x, y); - if (!_invert && java.awt.Color.black.getRGB() != color) - continue; - else if (_invert && java.awt.Color.black.getRGB() == color) - continue; - - Vector vector = new Vector((float) _bufferedImage.getWidth() / 2 - x, (float) _bufferedImage.getHeight() / 2 - y, 0).multiply(IMAGE_SIZE); - vector = rotateAroundAxisY(vector, -_effectLocation.getFixedLocation().getYaw() * (Math.PI / 180)); - _coloredParticle.setLocation(_effectLocation.getFixedLocation().clone().add(vector)); - _coloredParticle.display(); - } - } - } - - private Vector rotateAroundAxisY(Vector v, double angle) - { - double x, z, cos, sin; - cos = Math.cos(angle); - sin = Math.sin(angle); - x = v.getX() * cos + v.getZ() * sin; - z = v.getX() * -sin + v.getZ() * cos; - return v.setX(x).setZ(z); - } - -} +package mineplex.core.particleeffects; + +import java.awt.*; +import java.awt.image.BufferedImage; + +import org.bukkit.Location; +import org.bukkit.plugin.java.JavaPlugin; +import org.bukkit.util.Vector; + +import mineplex.core.common.util.UtilParticle; +import mineplex.core.common.util.UtilText; +import mineplex.core.common.util.particles.ColoredParticle; +import mineplex.core.common.util.particles.DustSpellColor; + +public class TextEffect extends Effect +{ + + private static final double IMAGE_SIZE = 0.2; + + private String _text; + private Font _font; + private boolean _realtime; + private boolean _invert; + private BufferedImage _bufferedImage; + + private ColoredParticle _coloredParticle = new ColoredParticle(UtilParticle.ParticleType.RED_DUST, new DustSpellColor(Color.GREEN), null); + + public TextEffect(JavaPlugin plugin, int ticks, String text, Location location, boolean realtime, boolean invert) throws Exception + { + super(ticks, new EffectLocation(location), plugin); + _text = text; + _font = new Font("Tahoma", Font.PLAIN, 16); + _realtime = realtime; + _invert = invert; + } + + public void setText(String text) + { + if (!_realtime) + return; + + _text = text; + } + + @Override + public void runEffect() + { + if (_text == null || _font == null) + { + stop(); + return; + } + if (_bufferedImage == null || _realtime) + { + _bufferedImage = UtilText.stringToBufferedImage(_font, _text); + } + int color = 0; + for (int y = 0; y < _bufferedImage.getHeight(); y++) + { + for (int x = 0; x < _bufferedImage.getWidth(); x++) + { + color = _bufferedImage.getRGB(x, y); + if (!_invert && java.awt.Color.black.getRGB() != color) + continue; + else if (_invert && java.awt.Color.black.getRGB() == color) + continue; + + Vector vector = new Vector((float) _bufferedImage.getWidth() / 2 - x, (float) _bufferedImage.getHeight() / 2 - y, 0).multiply(IMAGE_SIZE); + vector = rotateAroundAxisY(vector, -_effectLocation.getFixedLocation().getYaw() * (Math.PI / 180)); + _coloredParticle.setLocation(_effectLocation.getFixedLocation().clone().add(vector)); + _coloredParticle.display(); + } + } + } + + private Vector rotateAroundAxisY(Vector v, double angle) + { + double x, z, cos, sin; + cos = Math.cos(angle); + sin = Math.sin(angle); + x = v.getX() * cos + v.getZ() * sin; + z = v.getX() * -sin + v.getZ() * cos; + return v.setX(x).setZ(z); + } + +} diff --git a/Plugins/Mineplex.Core/src/mineplex/core/particleeffects/events/EffectStopEvent.java b/Plugins/Mineplex.Core/src/mineplex/core/particleeffects/events/EffectStopEvent.java new file mode 100644 index 000000000..ac29342af --- /dev/null +++ b/Plugins/Mineplex.Core/src/mineplex/core/particleeffects/events/EffectStopEvent.java @@ -0,0 +1,33 @@ +package mineplex.core.particleeffects.events; + +import org.bukkit.event.Event; +import org.bukkit.event.HandlerList; + +import mineplex.core.particleeffects.Effect; + +public class EffectStopEvent extends Event +{ + private static final HandlerList handlers = new HandlerList(); + + private Effect _effect; + + public EffectStopEvent(Effect effect) + { + _effect = effect; + } + + public Effect getEffect() + { + return _effect; + } + + public HandlerList getHandlers() + { + return handlers; + } + + public static HandlerList getHandlerList() + { + return handlers; + } +} diff --git a/Plugins/Mineplex.Core/src/mineplex/core/party/InviteData.java b/Plugins/Mineplex.Core/src/mineplex/core/party/InviteData.java index b401da6d1..b0ebe12d6 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/party/InviteData.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/party/InviteData.java @@ -1,27 +1,59 @@ package mineplex.core.party; +import java.util.UUID; + /** * Serializable invite data */ public class InviteData { + private final String _inviterName; + private final UUID _inviterUUID; + private final UUID _partyUUID; + private final String _serverName; - private String _invitedTo; - private String _serverFrom; - - public InviteData(String invitedTo, String serverFrom) + public InviteData(String inviterName, UUID inviterUUID, UUID partyUUID, String serverName) { - _invitedTo = invitedTo; - _serverFrom = serverFrom; + _inviterName = inviterName; + _inviterUUID = inviterUUID; + _partyUUID = partyUUID; + _serverName = serverName; } - public String getInvitedTo() + public String getInviterName() { - return _invitedTo; + return _inviterName; } - public String getServerFrom() + public UUID getInviterUUID() { - return _serverFrom; + return _inviterUUID; + } + + public UUID getPartyUUID() + { + return _partyUUID; + } + + public String getServerName() + { + return _serverName; + } + + @Override + public boolean equals(Object o) + { + if (this == o) return true; + if (o == null || getClass() != o.getClass()) return false; + + InviteData that = (InviteData) o; + + return _partyUUID.equals(that._partyUUID); + } + + @Override + public int hashCode() + { + return _partyUUID.hashCode(); } } diff --git a/Plugins/Mineplex.Core/src/mineplex/core/party/Lang.java b/Plugins/Mineplex.Core/src/mineplex/core/party/Lang.java index 1826241a7..57da4496a 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/party/Lang.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/party/Lang.java @@ -16,7 +16,6 @@ public enum Lang SUCCESS_SERVER_CONNECT("Sending you and your party to {0}..."), INVITE_SUCCESS_PLAYER("Successfully invited {0} to the party."), SUCCESS_INVITE("{0} has invited {1} to the party."), - INVITE_RECEIVED("You have been invited to {0}''s party! You have 60 seconds to reply."), INVITE_ACCEPT("{0} has joined the party."), INVITE_DENY("{0} declined your invite."), INVITE_EXPIRED("{0} did not respond in time."), diff --git a/Plugins/Mineplex.Core/src/mineplex/core/party/Party.java b/Plugins/Mineplex.Core/src/mineplex/core/party/Party.java index 7be8073a4..522fff3fa 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/party/Party.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/party/Party.java @@ -1,162 +1,114 @@ package mineplex.core.party; -import com.google.common.collect.Lists; -import com.google.common.collect.Maps; -import mineplex.core.common.util.UtilServer; -import mineplex.core.party.constants.PartyRemoveReason; -import mineplex.core.party.event.PartyTransferOwnerEvent; -import mineplex.core.party.event.PartyTransferOwnerEvent.TransferReason; +import java.util.ArrayList; +import java.util.Collections; +import java.util.List; +import java.util.Optional; +import java.util.UUID; + import org.bukkit.Bukkit; import org.bukkit.Sound; import org.bukkit.entity.Player; +import org.bukkit.event.Listener; -import java.util.List; -import java.util.Map; -import java.util.UUID; +import com.google.common.collect.Lists; +import com.mojang.authlib.GameProfile; + +import mineplex.core.Managers; +import mineplex.core.common.util.UtilServer; +import mineplex.core.party.constants.PartyRemoveReason; +import mineplex.core.party.rediscommands.PartyTransferRequest; +import mineplex.core.utils.UtilGameProfile; /** * The main object for Parites. */ -public class Party +public class Party implements Listener { - - /** - * This is controls whether or not the owner is currently in the menu, and kicking members - */ - private transient boolean _ownerKickMode = false; - - /** - * Asserts if this party has already been put into teams in order to prevent the Arcade from reassigning teams - */ - private transient boolean _alreadyTeamed = false; - /** * The maximum amount of players a party can have. */ private static final int PARTY_MAX_SIZE = 16; - /** - * Partners that have already been placed - */ - private transient final List _teamed; + private final PartyManager _partyManager = Managers.require(PartyManager.class); /** - * The current leader of this party + * The unique ID assigned to this party */ - private String _owner; + private UUID _uniqueId = UUID.randomUUID(); /** - * The names of all current party members + * Metadata related to the current owner of this party, stored in serializable form for transferring */ - private List _members; + private GameProfile _owner; - /** - * The UUIDS of all current party members - */ - private List _membersByUUID; - - /** - * All current pending invites - */ - private Map _invites; + private List _members = Lists.newArrayList(); /** * This party's max size */ - private int _size; + private int _size = PARTY_MAX_SIZE; - /** - * Team preferences - */ - private Map> _preferences; + private List _pendingUnrankedMembers = new ArrayList<>(); + private List _pendingMembers = new ArrayList<>(); - /** - * Empty constructor for GSON - */ - public Party() + public Party(PartyTransferRequest request) { - _teamed = Lists.newArrayList(); + _uniqueId = request.getPartyUUID(); + _owner = request.getOwnerGameProfile(); + + _pendingMembers.addAll(request.getAllMembers()); + _pendingUnrankedMembers.addAll(request.getUnrankedMembers()); + + + _partyManager.runSyncLater(() -> + { + // No one joined :( + for (UUID uuid : _pendingUnrankedMembers) + { + _partyManager.getClientManager().unreserve(uuid); + } + for (UUID uuid : _pendingMembers) + { + _partyManager.removePendingJoin(uuid); + } + // No one joined :( + if (_pendingMembers.size() == request.getAllMembers().size()) + { + _partyManager.removeParty(Party.this); + } + }, 20 * 10L); } /** - * Creates a new fresh party instance + * Creates a new party instance * * @param owner The owner / leader of the party. */ - public Party(String owner) + public Party(Player owner) { - _owner = owner; - _members = Lists.newArrayList(); - _invites = Maps.newHashMap(); + _owner = UtilGameProfile.getGameProfile(owner); _members.add(owner); - _teamed = Lists.newArrayList(); - _membersByUUID = Lists.newArrayList(); - _preferences = Maps.newHashMap(); - _membersByUUID.add(Bukkit.getPlayerExact(owner).getUniqueId()); } - public String getOwner() + public String getOwnerName() + { + return _owner.getName(); + } + + public GameProfile getOwner() { return _owner; } - /** - * Get the current members by their IGN - * - * @return The list of named party members - */ - public List getMembers() + public Optional getOwnerAsPlayer() { - return _members; + return Optional.ofNullable(Bukkit.getPlayer(_owner.getId())); } - public Map getInvites() + public UUID getUniqueId() { - return _invites; - } - - /** - * An alternate method to get the owner of the party. - * While this does not have any difference to using {@code getOwner}, it may serve a purpose in the future, should we wish to allow - * donators to name their party something custom. - * - * @return This party's name - */ - public String getName() - { - return _owner; - } - - /** - * Gets the players preferred teammate for a game - * - * @param player The player's UUID - * @return His team preference - */ - public String getPartner(UUID player, String game) - { - Map prefs = _preferences.get(player); - if (prefs == null) - { - prefs = Maps.newHashMap(); - _preferences.put(player, prefs); - return null; - } - return prefs.get(game); - } - - /** - * Set a player's partner preference - * - * @param player The player - * @param game The name of the game - * @param partner The name of his partner - */ - public void setPartner(Player player, String game, String partner) - { - Map prefs = _preferences.getOrDefault(player.getUniqueId(), Maps.newHashMap()); - prefs.put(game, partner); - _preferences.put(player.getUniqueId(), prefs); + return this._uniqueId; } /** @@ -166,7 +118,7 @@ public class Party */ public void sendMessage(String message) { - _members.stream().map(Bukkit::getPlayer).forEach(player -> player.sendMessage(message)); + getMembers().forEach(player -> player.sendMessage(message)); } public int getSize() @@ -174,161 +126,66 @@ public class Party return _size; } - /** - * Set's this party's size cap base off the current players rank - * - */ - public void setSize() - { - _size = PARTY_MAX_SIZE; - } - - /** - * Called when a player is added to the party. - * - * @param player The name of the player - */ - public void onPlayerAdd(String player) - { - _invites.remove(player); - if(_members.contains(player)) - { - return; - } - _members.add(player); - Lang.ADD_MEMBER.send(this, player); - getMembers().forEach(s -> - { - Player player1 = Bukkit.getPlayer(s); - player1.playSound(player1.getLocation(), Sound.NOTE_PLING, 1.0F, 10.0F); - }); - } - - /** - * Called when a member of the party is removed - * - * @param player The name of the player - * @param reason The reason for his removal. - */ - public void onPlayerRemove(String player, PartyRemoveReason reason) - { - if(reason == PartyRemoveReason.DISBANDED) - { - Player bukkitPlayer = Bukkit.getPlayerExact(player); - Lang.DISBANDED.send(bukkitPlayer); - bukkitPlayer.closeInventory(); - return; - } - - if(_members.size() <= 0) - { - return; - } - - if(reason == PartyRemoveReason.LEFT) - { - if(player.equalsIgnoreCase(_owner) && _members.size() > 1) - { - _owner = _members.get(0); - Lang.TRANSFER_OWNER.send(this, player, _owner); - PartyTransferOwnerEvent event = new PartyTransferOwnerEvent(this, _owner, player, TransferReason.LEFT); - UtilServer.getServer().getPluginManager().callEvent(event); - return; - } - Lang.REMOVE_PLAYER.send(this, player); - return; - } - - if(reason == PartyRemoveReason.OTHER) - { - return; - } - - if(reason == PartyRemoveReason.KICKED) - { - Lang.REMOVE_PLAYER_KICK.send(this, player); - } - } - - /** - * Gets the current state of whether or not the owner is kicking people in the UI. - * - * @return true if the owner is kicking people - */ - public boolean isOwnerKickMode() - { - return _ownerKickMode; - } - - /** - * Set's the current state of kicking players - * - * @param ownerKickMode true if the owner is kicking people - */ - public void setOwnerKickMode(boolean ownerKickMode) - { - _ownerKickMode = ownerKickMode; - } - /** * Set's the new owner for this party instance * * @param owner The new owner's name */ - public void setOwner(String owner) + public void setOwner(Player owner) { - _owner = owner; + _owner = UtilGameProfile.getGameProfile(owner); } - /** - * Get a list of all members in the party by their UUID - * - * @return A list of members by UUID - */ - public List getMembersByUUID() + public boolean isMember(Player player) { - return _membersByUUID; + return _members.contains(player); } - public boolean alreadyTeamed() + public void addMember(Player player) { - return _alreadyTeamed; - } - - public void setAlreadyTeamed(boolean alreadyTeamed) - { - _alreadyTeamed = alreadyTeamed; - } - - /** - * Check to see if this party contains a certain player name - * This is case-insensitive - * - * @param name The players name - * @return true If the player is in the party - */ - public boolean contains(String name) - { - for (UUID member : _membersByUUID) + if (_members.contains(player)) { - if (Bukkit.getPlayer(member).getName().equalsIgnoreCase(name)) - { - return true; - } + return; } - return false; + _members.add(player); + _pendingMembers.remove(player.getUniqueId()); + _pendingUnrankedMembers.remove(player.getUniqueId()); + Lang.ADD_MEMBER.send(this, player.getName()); + getMembers().forEach(player1 -> player1.playSound(player1.getLocation(), Sound.NOTE_PLING, 1.0F, 10.0F)); } - public boolean isAlreadyTeamed(UUID uuid) + public List getMembers() { - return _teamed.contains(uuid); + return Collections.unmodifiableList(_members); } - public void setTeamed(Player... players) + public boolean isOwner(Player caller) { - for (Player player : players) + return caller.getUniqueId().equals(this._owner.getId()); + } + + public void clear() + { + _owner = null; + _members.clear(); + UtilServer.Unregister(this); + } + + public void removeMember(Player player) + { + _members.remove(player); + + if (_members.size() <= 0) { - _teamed.add(player.getUniqueId()); + return; + } + + System.out.println("Removing member: " + player.getName() + " "+ player.getUniqueId() + " owner is " + _owner.getId()); + + if (player.getUniqueId().equals(_owner.getId()) && _members.size() > 0) + { + _owner = UtilGameProfile.getGameProfile(_members.get(0)); + Lang.TRANSFER_OWNER.send(this, player.getName(), _owner.getName()); } } } diff --git a/Plugins/Mineplex.Core/src/mineplex/core/party/PartyEventListener.java b/Plugins/Mineplex.Core/src/mineplex/core/party/PartyEventListener.java deleted file mode 100644 index 9f88df666..000000000 --- a/Plugins/Mineplex.Core/src/mineplex/core/party/PartyEventListener.java +++ /dev/null @@ -1,167 +0,0 @@ -package mineplex.core.party; - -import mineplex.core.common.Rank; -import mineplex.core.menu.Menu; -import mineplex.core.party.constants.PartyRemoveReason; -import mineplex.core.party.event.PartyMemberKickGUIEvent; -import mineplex.core.party.event.PartySendToServerEvent; -import mineplex.core.party.event.PartyTransferOwnerEvent; -import mineplex.core.portal.ServerTransferEvent; -import mineplex.serverdata.data.MinecraftServer; -import org.bukkit.Bukkit; -import org.bukkit.Material; -import org.bukkit.entity.Player; -import org.bukkit.event.EventHandler; -import org.bukkit.event.Listener; -import org.bukkit.event.player.PlayerInteractEvent; -import org.bukkit.event.player.PlayerJoinEvent; -import org.bukkit.event.player.PlayerQuitEvent; - -/** - * Event handler for Parties - */ -public class PartyEventListener implements Listener -{ - - private final PartyManager _plugin; - - public PartyEventListener(PartyManager plugin) - { - _plugin = plugin; - _plugin.getPluginManager().registerEvents(this, plugin.getPlugin()); - } - - @EventHandler - public void onJoin(PlayerJoinEvent event) - { - Player player = event.getPlayer(); - - String partyName = _plugin.getInviteManager().getPartyWaiting(player.getUniqueId()); - - if (partyName == null) - { - return; - } - - Party party = _plugin.getParty(partyName); - - Player bukkitPlayer = Bukkit.getPlayerExact(partyName); - - if (party == null) - { - party = new Party(partyName); - - if (bukkitPlayer != null && _plugin.getClientManager().Get(bukkitPlayer).GetRank().has(Rank.ULTRA)) - { - party.setSize(); - } else - { - party.setSize(); - } - - _plugin.addParty(party); - } - - _plugin.getInviteManager().cancelTask(player.getUniqueId()); - - _plugin.getMethodManager().addToParty(Bukkit.getPlayerExact(partyName), party); - - _plugin.getMethodManager().addToParty(player, party); - - _plugin.getInviteManager().removeFromWaiting(player.getUniqueId()); - - } - - @EventHandler - public void onQuit(PlayerQuitEvent event) - { - Player player = event.getPlayer(); - - Party party = _plugin.getParty(player); - - _plugin.getInviteManager().removeAll(player.getUniqueId()); - - if (party == null) - { - return; - } - - PartyRemoveReason reason = PartyRemoveReason.LEFT; - - if(_plugin.getJoinManager().isTransferring(player)) - { - reason = PartyRemoveReason.OTHER; - } - - _plugin.getMethodManager().removeFromParty(player, reason); - } - - - @EventHandler - public void onTransferOwner(PartyTransferOwnerEvent event) - { - _plugin.getMethodManager().transferOwner(event.getNewOwner(), event.getOldOwner()); - } - - @EventHandler - public void onKick(PartyMemberKickGUIEvent event) - { - Player clicked = Bukkit.getPlayerExact(event.getPlayerClicked()); - Lang.REMOVED.send(clicked); - _plugin.getMethodManager().removeFromParty(clicked, PartyRemoveReason.KICKED); - Menu.get(event.getOwner().getUniqueId()).resetAndUpdate(); - } - - @EventHandler - public void onTransfer(ServerTransferEvent event) - { - Player player = event.getPlayer(); - Party party = _plugin.getParty(player); - - if (party == null) - { - return; - } - - if(event.isDraggedByParty()) - { - return; - } - - event.setParty(party); - event.setCancel(true); - - if (!party.getOwner().equalsIgnoreCase(player.getName())) - { - Lang.NOT_OWNER_SERVER.send(player); - return; - } - - String server = event.getServer(); - if(server.equalsIgnoreCase("Lobby")) - { - return; - } - - _plugin.getJoinManager().requestServerJoin(event.getServer(), party); - } - - @EventHandler - public void onSend(PartySendToServerEvent event) - { - Party party = event.getParty(); - MinecraftServer server = event.getMinecraftServer(); - _plugin.getRedisManager().sendPartyInfo(server.getName(), party); - } - - @EventHandler - public void onClick(PlayerInteractEvent event) - { - if(event.hasItem() && event.getItem().getType() == Material.NAME_TAG) - { - event.setCancelled(true); - event.getPlayer().chat("/party"); - } - } - -} diff --git a/Plugins/Mineplex.Core/src/mineplex/core/party/PartyManager.java b/Plugins/Mineplex.Core/src/mineplex/core/party/PartyManager.java index 13d20aca5..a53d6906b 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/party/PartyManager.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/party/PartyManager.java @@ -1,38 +1,55 @@ package mineplex.core.party; -import com.google.common.collect.Maps; -import mineplex.core.MiniPlugin; -import mineplex.core.account.CoreClientManager; -import mineplex.core.common.util.C; -import mineplex.core.itemstack.ItemBuilder; -import mineplex.core.party.command.PartyCommand; -import mineplex.core.party.manager.PartyInviteManager; -import mineplex.core.party.manager.PartyJoinManager; -import mineplex.core.party.manager.PartyMethodManager; -import mineplex.core.party.manager.PartyRedisManager; -import mineplex.core.portal.Portal; -import mineplex.core.preferences.PreferencesManager; -import mineplex.serverdata.Region; -import mineplex.serverdata.Utility; -import mineplex.serverdata.servers.ServerManager; -import org.bukkit.Material; -import org.bukkit.entity.Player; -import org.bukkit.inventory.ItemStack; -import org.bukkit.plugin.java.JavaPlugin; - import java.io.File; +import java.util.HashMap; import java.util.Map; import java.util.UUID; +import org.bukkit.Bukkit; +import org.bukkit.Material; +import org.bukkit.entity.Player; +import org.bukkit.inventory.ItemStack; +import org.bukkit.scheduler.BukkitRunnable; +import org.bukkit.scheduler.BukkitTask; + +import mineplex.core.MiniPlugin; +import mineplex.core.account.CoreClientManager; +import mineplex.core.common.jsonchat.ChildJsonMessage; +import mineplex.core.common.jsonchat.ClickEvent; +import mineplex.core.common.jsonchat.HoverEvent; +import mineplex.core.common.util.C; +import mineplex.core.common.util.F; +import mineplex.core.common.util.UtilItem; +import mineplex.core.common.util.UtilPlayer; +import mineplex.core.common.util.UtilServer; +import mineplex.core.itemstack.ItemBuilder; +import mineplex.core.menu.Menu; +import mineplex.core.message.MessageManager; +import mineplex.core.party.command.PartyCommand; +import mineplex.core.party.constants.PartyRemoveReason; +import mineplex.core.party.manager.PartyInviteManager; +import mineplex.core.party.manager.PartyJoinManager; +import mineplex.core.party.manager.PartyRedisManager; +import mineplex.core.party.rediscommands.PartyCrossServerInviteAccept; +import mineplex.core.party.rediscommands.PartyCrossServerInviteCommand; +import mineplex.core.party.rediscommands.PartyCrossServerInviteDeny; +import mineplex.core.portal.Portal; +import mineplex.core.preferences.Preference; +import mineplex.core.preferences.PreferencesManager; +import mineplex.serverdata.Region; +import mineplex.serverdata.commands.ServerCommandManager; + public class PartyManager extends MiniPlugin { - /** * The item given to a player in his hotbar to manage the Parties via the new UI. */ - public static final ItemStack INTERFACE_ITEM = new ItemBuilder(Material.NAME_TAG).setTitle(C.cGreen + "Parties").build(); + public static final ItemStack INTERFACE_ITEM = new ItemBuilder(Material.NAME_TAG) + .setTitle(C.cGreen + "Parties") + .build(); + /** - * The slow to which it goes in. + * The slot to which it goes in. */ public static final int INTERFACE_SLOT = 5; @@ -43,66 +60,74 @@ public class PartyManager extends MiniPlugin private final PartyRedisManager _redisManager; private final PartyInviteManager _inviteManager; private final PartyJoinManager _joinManager; - private final PartyMethodManager _methodManager; + + private final MessageManager _messageManager; /** * This local instance's name */ private final String _serverName; - /** - * A map of player's in parties server wide. - */ - private final Map _players = Maps.newHashMap(); + private final Map _partiesById = new HashMap<>(); + private final Map _partiesByPlayer = new HashMap<>(); - /** - * A map of owner (name) -> party server wide - */ - private final Map _parties = Maps.newHashMap(); private final Region _region; + /** + * Maps UUID of player to UUID of party that they're supposed to join + */ + private final Map _pendingJoinMap = new HashMap<>(); - public PartyManager(JavaPlugin plugin, Portal portal, CoreClientManager clientManager, PreferencesManager preferenceManager) + + public PartyManager() { - super("Parties", plugin); - _portal = portal; - _clientManager = clientManager; - _preferencesManager = preferenceManager; + super("Parties"); + _portal = require(Portal.class); + _clientManager = require(CoreClientManager.class); + _preferencesManager = require(PreferencesManager.class); - _serverName = _plugin.getConfig().getString("serverstatus.name"); + _serverName = UtilServer.getServerName(); - _redisManager = new PartyRedisManager(this, _serverName, - Utility.generatePool(ServerManager.getMasterConnection()), - Utility.generatePool(ServerManager.getSlaveConnection())); + _redisManager = new PartyRedisManager(this, _serverName); - _inviteManager = new PartyInviteManager(this, _redisManager); + _inviteManager = new PartyInviteManager(this); _joinManager = new PartyJoinManager(this); - _methodManager = new PartyMethodManager(this); - addCommand(new PartyCommand(this)); - new PartyEventListener(this); _region = !new File("eu.dat").exists() ? Region.US : Region.EU; + _messageManager = require(MessageManager.class); } - public Party getParty(String party) + @Deprecated + public void putIntoPendingJoin(UUID player, UUID party) { - return _parties.get(party); + _pendingJoinMap.put(player, party); } - public Party getParty(Player player) + @Override + public void addCommands() { - return _players.get(player.getUniqueId()); + addCommand(new PartyCommand(this)); + } + + public Party getPartyByPlayer(UUID playerId) + { + return _partiesByPlayer.get(playerId); + } + + public Party getPartyById(UUID playerId) + { + return _partiesById.get(playerId); + } + + public Party getPartyByPlayer(Player player) + { + return _partiesByPlayer.get(player.getUniqueId()); } public void addParty(Party party) { - _parties.put(party.getName(), party); - } - - public void removeParty(Party party) - { - _parties.remove(party.getName()); + _partiesById.put(party.getUniqueId(), party); } public Portal getPortal() @@ -135,29 +160,440 @@ public class PartyManager extends MiniPlugin return _serverName; } - public PartyJoinManager getJoinManager() - { - return _joinManager; - } - - public PartyMethodManager getMethodManager() - { - return _methodManager; - } - - public Map getPlayerParties() - { - return _players; - } - - public Map getParties() - { - return _parties; - } - public Region getRegion() { return _region; } + public void denyInviteBySender(Player caller, String senderName) + { + PartyInviteManager inviteManager = getInviteManager(); + + if (!inviteManager.hasInviteFrom(caller, senderName)) + { + UtilPlayer.message(caller, F.main("Party", "You do not have a pending invite to " + F.elem(senderName) + "'s party.")); + return; + } + + InviteData invite = inviteManager.getInviteBySender(caller.getName(), senderName); + + inviteManager.removeInvite(caller, senderName); + + if (invite.getServerName().equals(_serverName)) + { + Player senderPlayer = Bukkit.getPlayerExact(senderName); + if (senderPlayer == null) + { + UtilPlayer.message(caller, F.main("Party", "You have denied your invite to " + F.elem(senderName) + "'s party, but it seems that " + F.elem(senderName) + " is no longer in this server")); + return; + } + + Party partyBySender = getPartyByPlayer(senderPlayer); + + if (partyBySender == null) + { + // todo send cancelled invitation msg when party is disbanded + UtilPlayer.message(caller, F.main("Party", "You have denied your invite to " + F.elem(senderPlayer.getName()) + "'s party, but it seems that " + F.elem(senderPlayer.getName()) + " has disbanded his party as well")); + return; + } + + UtilPlayer.message(caller, F.main("Party", "You have denied your invite to " + F.elem(senderPlayer.getName()) + "'s party")); + UtilPlayer.message(senderPlayer, F.main("Party", F.elem(caller.getName()) + " has denied your invite")); + } + else + { + Player senderPlayer = Bukkit.getPlayerExact(senderName); + if (senderPlayer != null) + { + UtilPlayer.message(caller, F.main("Party", "You have denied your invite to " + F.elem(senderPlayer.getName()) + "'s party, but it seems that " + F.elem(senderPlayer.getName()) + " has joined you in this server")); + return; + } + + UtilPlayer.message(caller, F.main("Party", "You have denied your invite to " + F.elem(senderName) + "'s party")); + + ServerCommandManager.getInstance().publishCommand(new PartyCrossServerInviteDeny( + caller.getName(), + caller.getUniqueId(), + invite.getInviterName(), + invite.getInviterUUID(), + invite.getPartyUUID() + )); + } + } + + public void acceptInviteBySender(Player caller, String senderName) + { + PartyInviteManager inviteManager = getInviteManager(); + + if (!inviteManager.hasInviteFrom(caller, senderName)) + { + UtilPlayer.message(caller, F.main("Party", "You do not have a pending invite to " + F.elem(senderName) + "'s party.")); + return; + } + + if (getPartyByPlayer(caller) != null) + { + caller.sendMessage(F.main("Party", "Please leave your party before accepting another invite!")); + return; + } + + InviteData invite = inviteManager.getInviteBySender(caller.getName(), senderName); + + inviteManager.removeInvite(caller, senderName); + + if (invite.getServerName().equals(_serverName)) + { + Player senderPlayer = Bukkit.getPlayerExact(senderName); + if (senderPlayer == null) + { + UtilPlayer.message(caller, F.main("Party", "It seems that " + F.elem(senderName) + " is no longer in this server")); + return; + } + + Party partyBySender = getPartyByPlayer(senderPlayer); + + if (partyBySender == null) + { + // todo send cancelled invitation msg when party is disbanded + UtilPlayer.message(caller, F.main("Party", "It seems that " + F.elem(senderName) + " has disbanded their party. Shucks!")); + return; + } + addToParty(caller, partyBySender); + } + else + { + Player senderPlayer = Bukkit.getPlayerExact(senderName); + if (senderPlayer != null) + { + // todo maybe auto create party (if there are no new desync issues) + UtilPlayer.message(caller, F.main("Party", "Strange. It seems that " + F.elem(senderName) + " has preemptively joined you in this server. They'll need to resend an invitation")); + return; + } + + UtilPlayer.message(caller, F.main("Party", "Please wait while I attempt to locate " + F.elem(invite.getInviterName()) + "...")); + + ServerCommandManager.getInstance().publishCommand(new PartyCrossServerInviteAccept( + caller.getName(), + caller.getUniqueId(), + invite.getInviterName(), + invite.getInviterUUID(), + invite.getPartyUUID() + )); + + runSyncLater(() -> + { + if (!caller.isOnline()) + { + return; + } + + UtilPlayer.message(caller, F.main("Party", "Uh oh. It looks like " + F.elem(invite.getInviterName()) + " has left the network - I couldn't find them!")); + }, 20 * 5L); + } + } + + /** + * @param caller The player who initiated the request + * @param target The player's target + */ + public void invite(Player caller, String target) + { + if (target.equalsIgnoreCase(caller.getName())) + { + caller.sendMessage(F.main("Party", "You cannot invite yourself!")); + return; + } + + Player possible = Bukkit.getPlayerExact(target); + + Party party = getPartyByPlayer(caller); + + // preemptively create party - it might be a slight inconvenience but it saves a lot of untangling work + if (party == null) + { + UtilPlayer.message(caller, F.main("Party", "You don't seem to have a party, so I've created a new one for you!")); + party = new Party(caller); + _partiesById.put(party.getUniqueId(), party); + addToParty(caller, party); + } + + if (!party.getOwnerName().equalsIgnoreCase(caller.getName())) + { + if (!_messageManager.isMuted(caller)) + { + party.sendMessage(F.main("Party", F.elem(caller.getName()) + " has suggested " + F.elem(target) + " be invited")); + party.getOwnerAsPlayer().ifPresent(owner -> + { + ChildJsonMessage message = new ChildJsonMessage("").extra(F.main("Party", "Click ")); + message.add(F.link("Invite " + target)) + .hover(HoverEvent.SHOW_TEXT, C.cGreen + "Clicking this will invite " + C.cYellow + target + C.cGreen + " to the party") + .click(ClickEvent.RUN_COMMAND, "/party gui invite " + target); + message.add(C.mBody + " to invite them"); + message.sendToPlayer(owner); + }); + } + return; + } + if (party.getMembers().size() >= party.getSize()) + { + Lang.PARTY_FULL.send(caller); + return; + } + if (possible != null && party.isMember(possible)) + { + Lang.ALREADY_MEMBER.send(caller, target); + return; + } + if (getInviteManager().getInviteBySender(target, caller.getName()) != null) + { + Lang.ALREADY_INVITED.send(caller, target); + return; + } + if (possible != null && !getPreferencesManager().get(possible).isActive(Preference.PARTY_REQUESTS)) + { + UtilPlayer.message(caller, F.main("Party", F.name(target) + " is not accepting invites at this time.")); + return; + } + + //Same Server + if (possible != null) + { + Lang.SUCCESS_INVITE.send(party, caller.getName(), target); + getInviteManager().inviteTo(possible.getName(), possible.getUniqueId(), caller.getName(), caller.getUniqueId(), party.getUniqueId(), getServerName()); + } + else + { + findAndInvite(caller, target, party); + } + } + + /** + * Initiates inviting a player who is no on the same server + */ + private void findAndInvite(Player caller, String target, Party destParty) + { + Map pendingInvites = getRedisManager().getPendingFindResponse().computeIfAbsent(caller.getUniqueId(), key -> new HashMap<>()); + if (!pendingInvites.containsKey(target)) + { + caller.sendMessage(F.main("Party", "Attempting to invite " + F.elem(target) + "...")); + pendingInvites.put(target, runSyncLater(new BukkitRunnable() + { + @Override + public void run() + { + if (!pendingInvites.containsKey(target)) + { + return; + } + pendingInvites.remove(target); + if (!caller.isOnline()) + { + return; + } + + Player targetPlayer = Bukkit.getPlayerExact(target); + if (targetPlayer != null) + { + UtilPlayer.message(caller, F.main("Party", "Huh. We couldn't find " + F.elem(target) + ", but it seems they've joined you in your server")); + return; + } + + caller.sendMessage(F.main("Party", "Could not locate " + F.elem(target) + ".")); + } + }, 20L * 5)); + + ServerCommandManager.getInstance().publishCommand(new PartyCrossServerInviteCommand(caller, target, destParty)); + } + else + { + caller.sendMessage(F.main("Party", "Please wait until the previous invite has completed")); + } + } + + public Party getPendingParty(Player player) + { + UUID partyUUID = _pendingJoinMap.get(player.getUniqueId()); + if (partyUUID == null) return null; + for (Party party : _partiesById.values()) + { + if (party.getUniqueId().equals(partyUUID)) + return party; + } + return null; + } + + public boolean hasPendingJoin(Player player) + { + return _pendingJoinMap.containsKey(player.getUniqueId()); + } + + public void removePendingJoin(Player player) + { + _pendingJoinMap.remove(player.getUniqueId()); + } + + public void removePendingJoin(UUID player) + { + _pendingJoinMap.remove(player); + } + + /** + * Kicks a player from the callers party + * + * @param caller The player who initiated the request + * @param target The player's target + */ + public void kickPlayer(Player caller, String target) + { + Party party = getPartyByPlayer(caller); + + if (party == null) + { + Lang.NO_PARTY.send(caller); + return; + } + + if (!party.isOwner(caller)) + { + Lang.NOT_OWNER.send(caller); + return; + } + + Player playerTarget = Bukkit.getPlayerExact(target); + + if (playerTarget == null) + { + Lang.NOT_MEMBER.send(caller, target); + return; + } + + if (!party.isMember(playerTarget)) + { + Lang.NOT_MEMBER.send(caller, target); + return; + } + + if (playerTarget == caller) + { + UtilPlayer.message(caller, F.main("Party", "You can't kick yourself!")); + return; + } + + removeFromParty(playerTarget, PartyRemoveReason.KICKED); + } + + public void addToParty(Player player, Party party) + { + _partiesByPlayer.put(player.getUniqueId(), party); + party.addMember(player); + } + + /** + * Leaves the players current party if he is in one + * + * @param caller The player who wishes to leave his party + */ + public void leaveParty(Player caller) + { + Party party = getPartyByPlayer(caller); + + if (party == null) + { + Lang.NO_PARTY.send(caller); + return; + } + + Lang.LEFT.send(caller); + removeFromParty(caller, PartyRemoveReason.LEFT); + } + + public void removeFromParty(Player player, PartyRemoveReason reason) + { + Party party = _partiesByPlayer.remove(player.getUniqueId()); + + if (party == null) + { + return; + } + + if (player.getOpenInventory() != null) + { + if (Menu.get(player.getUniqueId()) != null) + { + player.closeInventory(); + Menu.remove(player.getUniqueId()); + } + } + + party.removeMember(player); + + switch (reason) + { + case KICKED: + Lang.REMOVE_PLAYER_KICK.send(party, player.getName()); + break; + case LEFT: + Lang.REMOVE_PLAYER.send(party, player.getName()); + break; + case OTHER: + break; + case DISBANDED: + break; + case DISBANDED_BY_OWNER: + break; + } + + if (party.getMembers().size() == 0) + { + removeParty(party); + } + } + + /** + * Disbands a player's current party + * + * @param caller The player who wishes to disband his party + */ + public void disband(Player caller) + { + Party party = getPartyByPlayer(caller); + + if (party == null) + { + Lang.NO_PARTY.send(caller); + return; + } + + if (!party.isOwner(caller)) + { + Lang.NOT_OWNER.send(caller); + return; + } + + caller.sendMessage(F.main("Party", "You have disbanded your party.")); + for (Player player : party.getMembers()) + { + if (player != caller) + { + UtilPlayer.message(player, F.main("Party", "Your party has been disbanded!")); + } + } + removeParty(party); + } + + public void removeParty(Party party) + { + _joinManager.removePendingJoin(party); + _partiesById.remove(party.getUniqueId()); + _partiesByPlayer.entrySet().removeIf(ent -> ent.getValue().equals(party)); + party.clear(); + } + + public void giveItemIfNotExists(Player player) + { + if (!UtilItem.isSimilar(player.getInventory().getItem(INTERFACE_SLOT), INTERFACE_ITEM, UtilItem.ItemAttribute.NAME, UtilItem.ItemAttribute.MATERIAL)) + { + player.getInventory().setItem(PartyManager.INTERFACE_SLOT, PartyManager.INTERFACE_ITEM); + } + } } diff --git a/Plugins/Mineplex.Core/src/mineplex/core/party/command/PartyCLICommand.java b/Plugins/Mineplex.Core/src/mineplex/core/party/command/PartyCLICommand.java new file mode 100644 index 000000000..a5cdc12e6 --- /dev/null +++ b/Plugins/Mineplex.Core/src/mineplex/core/party/command/PartyCLICommand.java @@ -0,0 +1,159 @@ +package mineplex.core.party.command; + +import net.md_5.bungee.api.ChatColor; +import net.md_5.bungee.api.chat.ClickEvent; +import net.md_5.bungee.api.chat.ComponentBuilder; +import net.md_5.bungee.api.chat.HoverEvent; + +import org.bukkit.entity.Player; + +import mineplex.core.command.MultiCommandBase; +import mineplex.core.common.Rank; +import mineplex.core.common.util.F; +import mineplex.core.common.util.UtilPlayer; +import mineplex.core.party.Party; +import mineplex.core.party.PartyManager; +import mineplex.core.party.command.cli.PartyAcceptCommand; +import mineplex.core.party.command.cli.PartyDenyCommand; +import mineplex.core.party.command.cli.PartyDisbandCommand; +import mineplex.core.party.command.cli.PartyHelpCommand; +import mineplex.core.party.command.cli.PartyInviteCommand; +import mineplex.core.party.command.cli.PartyInvitesCommand; +import mineplex.core.party.command.cli.PartyKickCommand; +import mineplex.core.party.command.cli.PartyLeaveCommand; +import mineplex.core.party.command.cli.PartyTransferOwnerCommand; + +public class PartyCLICommand extends MultiCommandBase +{ + public PartyCLICommand(PartyManager plugin) + { + super(plugin, Rank.ALL, "cli", "c"); + + AddCommand(new PartyAcceptCommand(plugin)); + AddCommand(new PartyDenyCommand(plugin)); + AddCommand(new PartyDisbandCommand(plugin)); + AddCommand(new PartyInviteCommand(plugin)); + AddCommand(new PartyInvitesCommand(plugin)); + AddCommand(new PartyKickCommand(plugin)); + AddCommand(new PartyLeaveCommand(plugin)); + AddCommand(new PartyTransferOwnerCommand(plugin)); + AddCommand(new PartyHelpCommand(plugin)); + } + + @Override + protected void Help(Player caller, String[] args) + { + Party party = Plugin.getPartyByPlayer(caller); + + if (args.length > 0) + { + UtilPlayer.message(caller, F.main("Party", "That is not a valid command! Try " + F.elem("/party help") + "!")); + return; + } + + if (party == null) + { + UtilPlayer.message(caller, F.main("Party", "You're not in a party! Try " + F.elem("/party help") + "!")); + return; + } + + ComponentBuilder builder = new ComponentBuilder("") + .append("[", ComponentBuilder.FormatRetention.NONE) + .bold(true) + .color(ChatColor.AQUA) + .append("?", ComponentBuilder.FormatRetention.NONE) + .event(new HoverEvent(HoverEvent.Action.SHOW_TEXT, new ComponentBuilder("Click to view Party Help").create())) + .event(new ClickEvent(ClickEvent.Action.RUN_COMMAND, "/z help")) + .append("]", ComponentBuilder.FormatRetention.NONE) + .color(ChatColor.AQUA) + .bold(true) + .append("===========", ComponentBuilder.FormatRetention.NONE) + .color(ChatColor.AQUA) + .bold(true) + .strikethrough(true) + .append("[", ComponentBuilder.FormatRetention.NONE) + .color(ChatColor.AQUA) + .bold(true) + .append("Your Party", ComponentBuilder.FormatRetention.NONE) + .color(ChatColor.WHITE) + .bold(true) + .append("]", ComponentBuilder.FormatRetention.NONE) + .color(ChatColor.AQUA) + .bold(true) + .append("==============", ComponentBuilder.FormatRetention.NONE) + .color(ChatColor.AQUA) + .bold(true) + .strikethrough(true) + .append("\n\n", ComponentBuilder.FormatRetention.NONE); + + builder.append("Leader") + .color(party.getOwnerAsPlayer() == null ? ChatColor.GRAY : ChatColor.LIGHT_PURPLE) + .bold(true) + .append(" ", ComponentBuilder.FormatRetention.NONE) + .append(party.getOwnerName()) + .append("\n"); + + for (Player member : party.getMembers()) + { + if (member.getUniqueId().equals(party.getOwner().getId())) + continue; + + builder.append("Member") + .color(ChatColor.DARK_PURPLE) + .bold(true) + .append(" ", ComponentBuilder.FormatRetention.NONE) + .append(member.getName()); + + if (party.isOwner(caller)) + { + builder.append(" ", ComponentBuilder.FormatRetention.NONE) + .append("✕", ComponentBuilder.FormatRetention.NONE) + .color(ChatColor.RED) + .event(new HoverEvent(HoverEvent.Action.SHOW_TEXT, new ComponentBuilder("Kick " + member.getName() + " from your party").color(ChatColor.RED).create())) + .event(new ClickEvent(ClickEvent.Action.RUN_COMMAND, "/z cli kick " + member.getName())) + .append(" ", ComponentBuilder.FormatRetention.NONE) + .append("⬆", ComponentBuilder.FormatRetention.NONE) + .color(ChatColor.GOLD) + .event(new HoverEvent(HoverEvent.Action.SHOW_TEXT, new ComponentBuilder("Transfer party to " + member.getName()).color(ChatColor.GOLD).create())) + .event(new ClickEvent(ClickEvent.Action.RUN_COMMAND, "/z cli tr " + member.getName())); + } + + builder.append("\n", ComponentBuilder.FormatRetention.NONE); + } + + builder.append("\n", ComponentBuilder.FormatRetention.NONE); + + builder.append("Toggle GUI") + .color(ChatColor.GREEN) + .bold(true) + .event(new HoverEvent(HoverEvent.Action.SHOW_TEXT, new ComponentBuilder("Switch to the chest GUI instead of chat").color(ChatColor.GREEN).create())) + .event(new ClickEvent(ClickEvent.Action.RUN_COMMAND, "/z t")) + .append(" - ", ComponentBuilder.FormatRetention.NONE) + .color(ChatColor.GRAY) + .append("Leave") + .color(ChatColor.RED) + .bold(true) + .event(new HoverEvent(HoverEvent.Action.SHOW_TEXT, new ComponentBuilder("Leave your party").color(ChatColor.RED).create())) + .event(new ClickEvent(ClickEvent.Action.RUN_COMMAND, "/z cli leave")); + + if (party.isOwner(caller)) + { + builder + .append(" - ") + .color(ChatColor.GRAY) + .append("Disband") + .color(ChatColor.DARK_RED) + .bold(true) + .event(new HoverEvent(HoverEvent.Action.SHOW_TEXT, new ComponentBuilder("Disband your party").color(ChatColor.DARK_RED).create())) + .event(new ClickEvent(ClickEvent.Action.RUN_COMMAND, "/z cli disband")); + } + + builder.append("\n", ComponentBuilder.FormatRetention.NONE) + .append("======================================") + .color(ChatColor.AQUA) + .bold(true) + .strikethrough(true); + + caller.spigot().sendMessage(builder.create()); + } +} diff --git a/Plugins/Mineplex.Core/src/mineplex/core/party/command/PartyCommand.java b/Plugins/Mineplex.Core/src/mineplex/core/party/command/PartyCommand.java index 152a4eeaf..0fbaf7373 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/party/command/PartyCommand.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/party/command/PartyCommand.java @@ -1,95 +1,82 @@ package mineplex.core.party.command; -import mineplex.core.command.CommandBase; -import mineplex.core.common.Rank; -import mineplex.core.common.util.C; -import mineplex.core.common.util.F; -import mineplex.core.party.Party; -import mineplex.core.party.PartyManager; -import mineplex.core.party.ui.menus.PartyInvitesMenu; -import mineplex.core.party.ui.menus.PartyMainMenu; -import mineplex.core.party.ui.menus.PartyOwnerMenu; -import mineplex.core.party.ui.menus.PartyViewMenu; +import java.util.Arrays; +import java.util.List; + +import org.bukkit.command.CommandSender; import org.bukkit.entity.Player; +import mineplex.core.Managers; +import mineplex.core.command.MultiCommandBase; +import mineplex.core.common.Rank; +import mineplex.core.common.util.F; +import mineplex.core.common.util.UtilPlayer; +import mineplex.core.party.PartyManager; +import mineplex.core.preferences.Preference; +import mineplex.core.preferences.PreferencesManager; + /** * Command handler for party commands */ -public class PartyCommand extends CommandBase +public class PartyCommand extends MultiCommandBase { - - private final String[] HELP = { - F.main("Party", "Party Commands (Click the command!)"), - help("", "Brings up the Party GUI"), - help("", "Send an invitation to a player."), - help("leave", "Leave your current party."), - C.cBlue + "Party> " + C.cWhite + "# " + C.cGray + "- Send a message to your party.", - C.cGreenB + "All party functions have been moved to the GUI!", - C.cGreenB + "Click the NameTag in your hotbar to get started!" - }; + private final PreferencesManager _preferencesManager = Managers.require(PreferencesManager.class); public PartyCommand(PartyManager plugin) { - super(plugin, Rank.ALL, "party", "z", "partyaccept", "partydeny", "openinvitesmenu", "partyinvite"); + super(plugin, Rank.ALL, "party", "z"); + + AddCommand(new PartyGuiCommand(plugin)); + AddCommand(new PartyCLICommand(plugin)); + AddCommand(new PartyToggleCommand(plugin)); } @Override - public void Execute(Player caller, String[] args) + protected void Help(Player caller, String[] args) { - if (args.length == 0) + if (args.length > 0) { - if(_aliasUsed.equalsIgnoreCase("openinvitesmenu")) + if (!args[0].equalsIgnoreCase("cli") && !args[0].equalsIgnoreCase("gui")) { - new PartyInvitesMenu(Plugin).open(caller); - return; + String[] newArgs = new String[args.length + 1]; + System.arraycopy(args, 0, newArgs, 1, args.length); + newArgs[0] = _preferencesManager.get(caller).isActive(Preference.PARTY_DISPLAY_INVENTORY_UI) ? "gui" : "cli"; + args = newArgs; } - Party party = Plugin.getParty(caller); - if (party == null) - { - new PartyMainMenu(Plugin).open(caller); - return; - } - if (party.getOwner().equalsIgnoreCase(caller.getName())) - { - new PartyOwnerMenu(party, Plugin).open(caller); - return; - } - new PartyViewMenu(party, Plugin).open(caller); - return; } - - if(args.length == 1) + else { - String arg = args[0]; - if (_aliasUsed.equalsIgnoreCase("partyaccept")) - { - Plugin.getMethodManager().respondToInvite(caller, arg, true); - return; - } - if (_aliasUsed.equalsIgnoreCase("partydeny")) - { - Plugin.getMethodManager().respondToInvite(caller, arg, false); - return; - } - if(_aliasUsed.equalsIgnoreCase("partyinvite")) - { - Plugin.getMethodManager().invite(caller, arg); - return; - } - if(arg.equalsIgnoreCase("leave")) { - Plugin.getMethodManager().leaveParty(caller); - return; - } - Plugin.getMethodManager().invite(caller, arg); - return; + String[] newArgs = new String[1]; + newArgs[0] = _preferencesManager.get(caller).isActive(Preference.PARTY_DISPLAY_INVENTORY_UI) ? "gui" : "cli"; + args = newArgs; } - caller.sendMessage(HELP); + Execute(caller, args); } - private String help(String command, String description) + @Override + public List onTabComplete(CommandSender sender, String commandLabel, String[] args) { - return C.cBlue + "Party> " + C.cWhite + "/party " + command + C.cGray + " - " + description; - } + if (sender instanceof Player) + { + if (args.length > 0) + { + if (!args[0].equalsIgnoreCase("cli") && !args[0].equalsIgnoreCase("gui")) + { + String[] newArgs = new String[args.length + 1]; + System.arraycopy(args, 0, newArgs, 1, args.length); + newArgs[0] = _preferencesManager.get((Player) sender).isActive(Preference.PARTY_DISPLAY_INVENTORY_UI) ? "gui" : "cli"; + args = newArgs; + } + } + else + { + String[] newArgs = new String[1]; + newArgs[0] = _preferencesManager.get((Player) sender).isActive(Preference.PARTY_DISPLAY_INVENTORY_UI) ? "gui" : "cli"; + args = newArgs; + } + } + return super.onTabComplete(sender, commandLabel, args); + } } diff --git a/Plugins/Mineplex.Core/src/mineplex/core/party/command/PartyGuiCommand.java b/Plugins/Mineplex.Core/src/mineplex/core/party/command/PartyGuiCommand.java new file mode 100644 index 000000000..a22589667 --- /dev/null +++ b/Plugins/Mineplex.Core/src/mineplex/core/party/command/PartyGuiCommand.java @@ -0,0 +1,56 @@ +package mineplex.core.party.command; + +import org.bukkit.entity.Player; + +import mineplex.core.command.MultiCommandBase; +import mineplex.core.common.Rank; +import mineplex.core.party.Party; +import mineplex.core.party.PartyManager; +import mineplex.core.party.command.gui.PartyGUIAcceptInviteCommand; +import mineplex.core.party.command.gui.PartyGUIDenyInviteCommand; +import mineplex.core.party.command.gui.PartyGUIInviteCommand; +import mineplex.core.party.command.gui.PartyGUILeaveCommand; +import mineplex.core.party.command.gui.PartyOpenInviteMenuCommand; +import mineplex.core.party.ui.menus.PartyMainMenu; +import mineplex.core.party.ui.menus.PartyOwnerMenu; +import mineplex.core.party.ui.menus.PartyViewMenu; + +public class PartyGuiCommand extends MultiCommandBase +{ + public PartyGuiCommand(PartyManager plugin) + { + super(plugin, Rank.ALL, "gui", "g"); + + AddCommand(new PartyOpenInviteMenuCommand(plugin)); + AddCommand(new PartyGUIAcceptInviteCommand(plugin)); + AddCommand(new PartyGUIDenyInviteCommand(plugin)); + AddCommand(new PartyGUIInviteCommand(plugin)); + AddCommand(new PartyGUILeaveCommand(plugin)); + } + + // a hacky method for a hacky original system + @Override + protected void Help(Player caller, String[] args) + { + if (args.length == 0) + { + Party party = Plugin.getPartyByPlayer(caller); + if (party == null) + { + new PartyMainMenu(Plugin).open(caller); + } + else if (party.getOwnerName().equalsIgnoreCase(caller.getName())) + { + new PartyOwnerMenu(party, Plugin).open(caller); + } + else + { + new PartyViewMenu(party, Plugin).open(caller); + } + } + else if (args.length == 1) + { + Plugin.invite(caller, args[0]); + } + } +} diff --git a/Plugins/Mineplex.Core/src/mineplex/core/party/command/PartyToggleCommand.java b/Plugins/Mineplex.Core/src/mineplex/core/party/command/PartyToggleCommand.java new file mode 100644 index 000000000..ff61eef79 --- /dev/null +++ b/Plugins/Mineplex.Core/src/mineplex/core/party/command/PartyToggleCommand.java @@ -0,0 +1,37 @@ +package mineplex.core.party.command; + +import org.bukkit.entity.Player; + +import mineplex.core.Managers; +import mineplex.core.command.CommandBase; +import mineplex.core.common.Rank; +import mineplex.core.common.util.C; +import mineplex.core.common.util.F; +import mineplex.core.common.util.UtilPlayer; +import mineplex.core.party.PartyManager; +import mineplex.core.preferences.Preference; +import mineplex.core.preferences.PreferencesManager; + +public class PartyToggleCommand extends CommandBase +{ + private final PreferencesManager _preferencesManager = Managers.require(PreferencesManager.class); + + public PartyToggleCommand(PartyManager plugin) + { + super(plugin, Rank.ALL, "toggle", "t"); + } + + @Override + public void Execute(Player caller, String[] args) + { + _preferencesManager.get(caller).toggle(Preference.PARTY_DISPLAY_INVENTORY_UI); + if (_preferencesManager.get(caller).isActive(Preference.PARTY_DISPLAY_INVENTORY_UI)) + { + UtilPlayer.message(caller, F.main("Party", "The Party GUI is now " + C.cGreen + "enabled" + C.mBody + "!")); + } + else + { + UtilPlayer.message(caller, F.main("Party", "The Party GUI is now " + C.cRed + "disabled" + C.mBody + "!")); + } + } +} diff --git a/Plugins/Mineplex.Core/src/mineplex/core/party/command/TeamPreferenceCommand.java b/Plugins/Mineplex.Core/src/mineplex/core/party/command/TeamPreferenceCommand.java deleted file mode 100644 index ad27de3fa..000000000 --- a/Plugins/Mineplex.Core/src/mineplex/core/party/command/TeamPreferenceCommand.java +++ /dev/null @@ -1,167 +0,0 @@ -package mineplex.core.party.command; - -import com.google.common.collect.Maps; -import mineplex.core.command.CommandBase; -import mineplex.core.common.Rank; -import mineplex.core.common.util.C; -import mineplex.core.common.util.UtilPlayer; -import mineplex.core.game.GameDisplay; -import mineplex.core.party.Lang; -import mineplex.core.party.Party; -import mineplex.core.party.PartyManager; -import org.bukkit.Bukkit; -import org.bukkit.entity.Player; - -import java.util.Map; -import java.util.UUID; - -/** - * Unused for now. - */ -public class TeamPreferenceCommand extends CommandBase -{ - - private static final String[] ARGS = { - "teampref", - "teamprefs", - "teamp", - "tprefs", - "teampreferences" - }; - - private final String ACCEPT = "accept"; - private final String DENY = "deny"; - - private final String ACCEPT_COMMAND = "/teamprefs accept "; - private final String DENY_COMMAND = "/teamprefs deny "; - - private final String HEADER = "Partners"; - - //Player, Partner, GameName - private Map> INVITES = Maps.newHashMap(); - - public TeamPreferenceCommand(PartyManager plugin) - { - super(plugin, Rank.ALL, ARGS); - } - - @Override - public void Execute(Player player, String[] args) - { - if (args.length < 2) - { - Lang.PARTNER_USAGE.sendHeader(player, HEADER); - return; - } - - String arg = args[0]; - - if (arg.equalsIgnoreCase(ACCEPT) || arg.equalsIgnoreCase(DENY)) - { - Party party = Plugin.getParty(player); - - if (party == null) - { - Lang.NO_PARTY.send(player); - return; - } - - String inviter = args[1]; - boolean accept = arg.equalsIgnoreCase(ACCEPT); - Player inviterPlayer = Bukkit.getPlayerExact(inviter); - - if (inviterPlayer == null) - { - Lang.PARTNER_NOT_ONLINE.sendHeader(player, HEADER, inviter); - return; - } - - Map sent = INVITES.get(inviterPlayer.getUniqueId()); - - if (sent == null || sent.isEmpty()) - { - Lang.PARTNER_PLAYER_NOT_REQUESTED.sendHeader(player, HEADER, inviter); - return; - } - - if (sent.get(player.getName()) == null) - { - Lang.PARTNER_PLAYER_NOT_REQUESTED.sendHeader(player, HEADER, inviter); - return; - } - - String gameName = sent.remove(player.getName()); - - if (!accept) - { - Lang.PARTNER_REQUEST_DENIED_PLAYER.send(player, inviterPlayer.getName(), gameName); - Lang.PARTNER_REQUEST_DENIED_SENDER.send(inviterPlayer, player.getName(), gameName); - return; - } - - Lang.PARTNER_REQUEST_ACCEPT_PLAYER.send(player, inviterPlayer.getName(), gameName); - Lang.PARTNER_REQUEST_ACCEPT_SENDER.send(inviterPlayer, player.getName(), gameName); - party.setPartner(player, gameName, inviterPlayer.getName()); - party.setPartner(inviterPlayer, gameName, player.getName()); - return; - } - - Player target = Bukkit.getPlayerExact(arg); - String gameName = ""; - String[] game = new String[args.length - 2]; - System.arraycopy(args, 2, game, 0, game.length); - - for (String s : game) - { - gameName += s + " "; - } - - gameName = gameName.trim(); - - GameDisplay gameDisplay = GameDisplay.matchName(gameName); - - if (gameDisplay == null) - { - Lang.PARTNER_NO_GAME.sendHeader(player, HEADER, gameName); - return; - } - - gameName = gameDisplay.getName(); - - if (alreadyInvited(player, gameName, target.getName())) - { - Lang.PARTNER_ALREADY_INVITED.sendHeader(player, HEADER, target.getName(), gameName); - return; - } - - sendRequest(player, gameName, target); - } - - private void sendRequest(Player player, String game, Player partner) - { - invite(player, game, partner); - String gameName = C.cGreen + (game); - String playerName = C.cGreen + (player.getName()); - String partnerName = C.cGreen + (partner.getName()); - String acceptCommand = ACCEPT_COMMAND + player.getName(); - String declineCommand = DENY_COMMAND + player.getName(); - String acceptText = Lang.PARTNER_HOVER_TEXT_ACCEPT.toString(playerName, gameName); - String declineText = Lang.PARTNER_HOVER_TEXT_DENY.toString(playerName, gameName); - Lang.PARTNER_REQUEST_SENT.sendHeader(player, HEADER, partnerName, gameName); - Lang.PARTNER_REQUEST_RECEIVED.sendHeader(partner, HEADER, playerName, gameName); - UtilPlayer.sendAcceptOrDeny(partner, HEADER, acceptCommand, acceptText, declineCommand, declineText, null, null); - } - - private boolean alreadyInvited(Player player, String game, String partner) - { - Map sent = INVITES.get(player.getUniqueId()); - return !(sent == null || sent.isEmpty()) && sent.get(partner).equalsIgnoreCase(game); - } - - private void invite(Player player, String game, Player partner) - { - Map sent = INVITES.getOrDefault(player.getUniqueId(), Maps.newHashMap()); - sent.put(partner.getName(), game); - INVITES.put(player.getUniqueId(), sent); - } -} diff --git a/Plugins/Mineplex.Core/src/mineplex/core/party/command/cli/PartyAcceptCommand.java b/Plugins/Mineplex.Core/src/mineplex/core/party/command/cli/PartyAcceptCommand.java new file mode 100644 index 000000000..349e2fec6 --- /dev/null +++ b/Plugins/Mineplex.Core/src/mineplex/core/party/command/cli/PartyAcceptCommand.java @@ -0,0 +1,49 @@ +package mineplex.core.party.command.cli; + +import java.util.List; + +import org.bukkit.command.CommandSender; +import org.bukkit.entity.Player; + +import mineplex.core.command.CommandBase; +import mineplex.core.common.Rank; +import mineplex.core.common.util.F; +import mineplex.core.common.util.UtilPlayer; +import mineplex.core.party.InviteData; +import mineplex.core.party.PartyManager; + +public class PartyAcceptCommand extends CommandBase +{ + public PartyAcceptCommand(PartyManager plugin) + { + super(plugin, Rank.ALL, "accept", "a"); + } + + @Override + public void Execute(Player caller, String[] args) + { + if (args.length == 0) + { + UtilPlayer.message(caller, F.main("Party", "Oops. You didn't specify whose invite you're accepting!")); + return; + } + + Plugin.acceptInviteBySender(caller, args[0]); + } + + @Override + public List onTabComplete(CommandSender sender, String commandLabel, String[] args) + { + if (sender instanceof Player) + { + if (args.length == 1) + { + Player player = (Player) sender; + + return getMatches(args[0], Plugin.getInviteManager().getAllInvites(player).stream().map(InviteData::getInviterName)); + } + } + + return null; + } +} diff --git a/Plugins/Mineplex.Core/src/mineplex/core/party/command/cli/PartyBlockCommand.java b/Plugins/Mineplex.Core/src/mineplex/core/party/command/cli/PartyBlockCommand.java new file mode 100644 index 000000000..902dada8c --- /dev/null +++ b/Plugins/Mineplex.Core/src/mineplex/core/party/command/cli/PartyBlockCommand.java @@ -0,0 +1,21 @@ +package mineplex.core.party.command.cli; + +import org.bukkit.entity.Player; + +import mineplex.core.command.CommandBase; +import mineplex.core.common.Rank; +import mineplex.core.party.PartyManager; + +public class PartyBlockCommand extends CommandBase +{ + public PartyBlockCommand(PartyManager plugin) + { + super(plugin, Rank.ALL, "block", "b"); + } + + @Override + public void Execute(Player caller, String[] args) + { + + } +} diff --git a/Plugins/Mineplex.Core/src/mineplex/core/party/command/cli/PartyDenyCommand.java b/Plugins/Mineplex.Core/src/mineplex/core/party/command/cli/PartyDenyCommand.java new file mode 100644 index 000000000..5d0f52d47 --- /dev/null +++ b/Plugins/Mineplex.Core/src/mineplex/core/party/command/cli/PartyDenyCommand.java @@ -0,0 +1,48 @@ +package mineplex.core.party.command.cli; + +import java.util.List; +import java.util.stream.Collectors; + +import org.bukkit.command.CommandSender; +import org.bukkit.entity.Player; + +import mineplex.core.command.CommandBase; +import mineplex.core.common.Rank; +import mineplex.core.common.util.F; +import mineplex.core.common.util.UtilPlayer; +import mineplex.core.party.InviteData; +import mineplex.core.party.PartyManager; + +public class PartyDenyCommand extends CommandBase +{ + public PartyDenyCommand(PartyManager plugin) + { + super(plugin, Rank.ALL, "deny", "d"); + } + + @Override + public void Execute(Player caller, String[] args) + { + if (args.length == 0) + { + UtilPlayer.message(caller, F.main("Party", "Oops. You didn't specify whose invite you're denying!")); + return; + } + Plugin.denyInviteBySender(caller, args[0]); + } + + @Override + public List onTabComplete(CommandSender sender, String commandLabel, String[] args) + { + if (sender instanceof Player) + { + if (args.length == 1) + { + Player player = (Player) sender; + return getMatches(args[0], Plugin.getInviteManager().getAllInvites(player).stream().map(InviteData::getInviterName).collect(Collectors.toList())); + } + } + + return null; + } +} diff --git a/Plugins/Mineplex.Core/src/mineplex/core/party/command/cli/PartyDisbandCommand.java b/Plugins/Mineplex.Core/src/mineplex/core/party/command/cli/PartyDisbandCommand.java new file mode 100644 index 000000000..0d1265b58 --- /dev/null +++ b/Plugins/Mineplex.Core/src/mineplex/core/party/command/cli/PartyDisbandCommand.java @@ -0,0 +1,21 @@ +package mineplex.core.party.command.cli; + +import org.bukkit.entity.Player; + +import mineplex.core.command.CommandBase; +import mineplex.core.common.Rank; +import mineplex.core.party.PartyManager; + +public class PartyDisbandCommand extends CommandBase +{ + public PartyDisbandCommand(PartyManager plugin) + { + super(plugin, Rank.ALL, "disband", "db"); + } + + @Override + public void Execute(Player caller, String[] args) + { + Plugin.disband(caller); + } +} diff --git a/Plugins/Mineplex.Core/src/mineplex/core/party/command/cli/PartyHelpCommand.java b/Plugins/Mineplex.Core/src/mineplex/core/party/command/cli/PartyHelpCommand.java new file mode 100644 index 000000000..31626f8ac --- /dev/null +++ b/Plugins/Mineplex.Core/src/mineplex/core/party/command/cli/PartyHelpCommand.java @@ -0,0 +1,34 @@ +package mineplex.core.party.command.cli; + +import org.bukkit.entity.Player; + +import mineplex.core.command.CommandBase; +import mineplex.core.common.Rank; +import mineplex.core.common.util.F; +import mineplex.core.common.util.UtilPlayer; +import mineplex.core.party.PartyManager; + +public class PartyHelpCommand extends CommandBase +{ + public PartyHelpCommand(PartyManager plugin) + { + super(plugin, Rank.ALL, "help", "h"); + } + + @Override + public void Execute(Player caller, String[] args) + { + UtilPlayer.message(caller, F.main("Party", "Parties Help")); + UtilPlayer.message(caller, F.main("Party", F.elem("/party [help/h]") + " - Shows this help dialog")); + UtilPlayer.message(caller, F.main("Party", F.elem("/party [invite/i] [player]") + " - Invite [player] to your party")); + UtilPlayer.message(caller, F.main("Party", F.elem("/party [invites/is] (page)") + " - List your current pending invitations")); + UtilPlayer.message(caller, F.main("Party", F.elem("/party [kick/k] [player]") + " - Kick [player] from your party")); + UtilPlayer.message(caller, F.main("Party", F.elem("/party [accept/a] [player]") + " - Accept your invitation to [player]'s party")); + UtilPlayer.message(caller, F.main("Party", F.elem("/party [deny/d] [player]") + " - Deny your invitation to [player]'s party")); + UtilPlayer.message(caller, F.main("Party", F.elem("/party [leave/l]") + " - Leave your current party")); + UtilPlayer.message(caller, F.main("Party", F.elem("/party [disband/db]") + " - Disband your current party")); + UtilPlayer.message(caller, F.main("Party", F.elem("/party [transfer/tr] [player]") + " - Transfers ownership of the party to another player")); + UtilPlayer.message(caller, F.main("Party", F.elem("/party [gui/g]") + " - Opens the party GUI")); + UtilPlayer.message(caller, F.main("Party", F.elem("/party [toggle/t]") + " - Toggles between the GUI and the chat")); + } +} diff --git a/Plugins/Mineplex.Core/src/mineplex/core/party/command/cli/PartyInviteCommand.java b/Plugins/Mineplex.Core/src/mineplex/core/party/command/cli/PartyInviteCommand.java new file mode 100644 index 000000000..b2435ca04 --- /dev/null +++ b/Plugins/Mineplex.Core/src/mineplex/core/party/command/cli/PartyInviteCommand.java @@ -0,0 +1,47 @@ +package mineplex.core.party.command.cli; + +import java.util.Arrays; +import java.util.List; + +import org.bukkit.command.CommandSender; +import org.bukkit.entity.Player; + +import mineplex.core.command.CommandBase; +import mineplex.core.common.Rank; +import mineplex.core.common.util.F; +import mineplex.core.common.util.UtilPlayer; +import mineplex.core.party.Party; +import mineplex.core.party.PartyManager; + +public class PartyInviteCommand extends CommandBase +{ + public PartyInviteCommand(PartyManager plugin) + { + super(plugin, Rank.ALL, "invite", "i"); + } + + @Override + public void Execute(Player caller, String[] args) + { + if (args.length == 0) + { + UtilPlayer.message(caller, F.main("Party", "Oops. You didn't specify who to invite!")); + return; + } + Plugin.invite(caller, args[0]); + } + + @Override + public List onTabComplete(CommandSender sender, String commandLabel, String[] args) + { + if (sender instanceof Player) + { + Player player = (Player) sender; + Party party = Plugin.getPartyByPlayer(player); + + return tabCompletePlayerNames(sender, commandLabel, args, other -> party == null || !party.isMember(other)); + } + + return null; + } +} diff --git a/Plugins/Mineplex.Core/src/mineplex/core/party/command/cli/PartyInvitesCommand.java b/Plugins/Mineplex.Core/src/mineplex/core/party/command/cli/PartyInvitesCommand.java new file mode 100644 index 000000000..09dd58e77 --- /dev/null +++ b/Plugins/Mineplex.Core/src/mineplex/core/party/command/cli/PartyInvitesCommand.java @@ -0,0 +1,200 @@ +package mineplex.core.party.command.cli; + +import java.util.ArrayList; +import java.util.Collections; +import java.util.Comparator; +import java.util.List; +import java.util.UUID; + +import net.md_5.bungee.api.ChatColor; +import net.md_5.bungee.api.chat.BaseComponent; +import net.md_5.bungee.api.chat.ClickEvent; +import net.md_5.bungee.api.chat.ComponentBuilder; +import net.md_5.bungee.api.chat.HoverEvent; + +import org.apache.commons.lang.StringUtils; +import org.bukkit.entity.Player; + +import mineplex.core.command.CommandBase; +import mineplex.core.common.Rank; +import mineplex.core.common.util.C; +import mineplex.core.common.util.F; +import mineplex.core.common.util.UtilPlayer; +import mineplex.core.party.InviteData; +import mineplex.core.party.PartyManager; + +public class PartyInvitesCommand extends CommandBase +{ + private static int boostCount = 0; + + public PartyInvitesCommand(PartyManager plugin) + { + super(plugin, Rank.ALL, "invites", "is"); + } + + @Override + public void Execute(Player caller, String[] args) + { + if (args.length == 2 && args[0].equals("boost")) + { + boostCount = Integer.parseInt(args[1]); + return; + } + + List invites = Plugin.getInviteManager().getAllInvites(caller); + + invites.sort(Comparator.comparing(InviteData::getInviterName)); + + if (boostCount != 0) + { + invites = new ArrayList<>(); + + for (int i = 0; i < boostCount; i++) + { + invites.add(new InviteData("Player" + i, UUID.randomUUID(), UUID.randomUUID(), "Server" + i)); + } + } + + if (invites == null || invites.isEmpty()) + { + UtilPlayer.message(caller, F.main("Party", "You have no pending invites!")); + return; + } + + int totalPages = (int) Math.ceil(invites.size() / 8.0); + int page = 0; + + if (args.length != 0) + { + try + { + page = Integer.parseInt(args[0]); + } + catch (NumberFormatException ex) + { + UtilPlayer.message(caller, F.main("Party", F.elem(args[0]) + " is not a number!")); + return; + } + page = page - 1; + + if (page < 0) + { + UtilPlayer.message(caller, F.main("Party", "Page numbers must be greater than zero!")); + return; + } + else if (page >= totalPages) + { + UtilPlayer.message(caller, F.main("Party", "You only have " + F.elem(totalPages) + " pages of invites, that number is too big!")); + return; + } + } + + String header = "[" + + ChatColor.RESET + C.cWhite + C.Bold + "Party Invites (" + (page + 1) + "/" + totalPages + ")" + + ChatColor.RESET + C.cAqua + C.Strike + "]"; + + int headerChars = ChatColor.stripColor(header).length(); + + int numEqualsInHeader = (50 - headerChars) / 2; + header = C.cAqua + C.Strike + StringUtils.repeat("=", numEqualsInHeader) + header + StringUtils.repeat("=", numEqualsInHeader); + + caller.sendMessage(header); + + int start = page * 8; + + List subList = start < invites.size() ? invites.subList(start, Math.min(invites.size(), start + 8)) : Collections.emptyList(); + + for (InviteData data : subList) + { + BaseComponent[] hover = new ComponentBuilder("") + .append("Server: ") + .color(ChatColor.YELLOW) + .append(data.getServerName(), ComponentBuilder.FormatRetention.NONE) + .color(ChatColor.WHITE) + .create(); + + ComponentBuilder builder = new ComponentBuilder("") + .append("Accept") + .color(ChatColor.GREEN) + .bold(true) + .event(new HoverEvent(HoverEvent.Action.SHOW_TEXT, new ComponentBuilder("Click to accept this invite").color(ChatColor.GREEN).create())) + .event(new ClickEvent(ClickEvent.Action.RUN_COMMAND, "/party cli a " + data.getInviterName())) + .append(" - ", ComponentBuilder.FormatRetention.NONE) + .color(ChatColor.WHITE) + .append("Deny") + .color(ChatColor.RED) + .bold(true) + .event(new HoverEvent(HoverEvent.Action.SHOW_TEXT, new ComponentBuilder("Click to deny this invite").color(ChatColor.RED).create())) + .event(new ClickEvent(ClickEvent.Action.RUN_COMMAND, "/party cli d " + data.getInviterName())) + .append(" - ", ComponentBuilder.FormatRetention.NONE) + .color(ChatColor.WHITE) + .append(data.getInviterName() + " invited you to their party") + .event(new HoverEvent(HoverEvent.Action.SHOW_TEXT, hover)) + .color(ChatColor.GRAY); + + caller.spigot().sendMessage(builder.create()); + } + + int chars = ChatColor.stripColor(header).length(); + + int numEquals = (chars - 5) / 2; // 5 chars: " < > " + + ComponentBuilder pageSwitch = new ComponentBuilder("") + .append(StringUtils.repeat("=", numEquals) + "[") + .strikethrough(true) + .color(ChatColor.AQUA) + .append(" ", ComponentBuilder.FormatRetention.NONE) + .append("<", ComponentBuilder.FormatRetention.NONE) + .bold(true); + + if (page > 0) + { + BaseComponent[] prev = new ComponentBuilder("") + .append("Go to page " + page) + .color(ChatColor.GREEN) + .create(); + + pageSwitch + .color(ChatColor.GREEN) + .event(new ClickEvent(ClickEvent.Action.RUN_COMMAND, "/party is " + (page))) + .event(new HoverEvent(HoverEvent.Action.SHOW_TEXT, prev)); + + } + else + { + pageSwitch + .color(ChatColor.GRAY); + } + + pageSwitch.append(" ", ComponentBuilder.FormatRetention.NONE) + .append(">", ComponentBuilder.FormatRetention.NONE) + .bold(true); + + if (page + 1 < totalPages) + { + BaseComponent[] next = new ComponentBuilder("") + .append("Go to page " + (page + 2)) + .color(ChatColor.GREEN) + .create(); + + pageSwitch + .color(ChatColor.GREEN) + .event(new ClickEvent(ClickEvent.Action.RUN_COMMAND, "/party is " + (page + 2))) + .event(new HoverEvent(HoverEvent.Action.SHOW_TEXT, next)); + + } + else + { + pageSwitch + .color(ChatColor.GRAY); + } + + pageSwitch + .append(" ", ComponentBuilder.FormatRetention.NONE) + .append("]" + StringUtils.repeat("=", numEquals), ComponentBuilder.FormatRetention.NONE) + .strikethrough(true) + .color(ChatColor.AQUA); + + caller.spigot().sendMessage(pageSwitch.create()); + } +} diff --git a/Plugins/Mineplex.Core/src/mineplex/core/party/command/cli/PartyKickCommand.java b/Plugins/Mineplex.Core/src/mineplex/core/party/command/cli/PartyKickCommand.java new file mode 100644 index 000000000..7612a7325 --- /dev/null +++ b/Plugins/Mineplex.Core/src/mineplex/core/party/command/cli/PartyKickCommand.java @@ -0,0 +1,59 @@ +package mineplex.core.party.command.cli; + +import java.util.List; + +import org.bukkit.command.CommandSender; +import org.bukkit.entity.Player; + +import mineplex.core.command.CommandBase; +import mineplex.core.common.Rank; +import mineplex.core.common.util.F; +import mineplex.core.common.util.UtilPlayer; +import mineplex.core.party.Party; +import mineplex.core.party.PartyManager; + +public class PartyKickCommand extends CommandBase +{ + public PartyKickCommand(PartyManager plugin) + { + super(plugin, Rank.ALL, "kick", "k"); + } + + @Override + public void Execute(Player caller, String[] args) + { + Party party = Plugin.getPartyByPlayer(caller); + if (party == null) + { + UtilPlayer.message(caller, F.main("Party", "You are not in a party!")); + return; + } + if (args.length == 0) + { + UtilPlayer.message(caller, F.main("Party", "I didn't quite catch that. Who are you kicking?")); + return; + } + + if (party.getOwnerName().equals(caller.getName())) + { + Plugin.kickPlayer(caller, args[0]); + } + } + + @Override + public List onTabComplete(CommandSender sender, String commandLabel, String[] args) + { + if (sender instanceof Player) + { + Player player = (Player) sender; + Party party = Plugin.getPartyByPlayer(player); + + if (party != null && party.isOwner(player)) + { + return tabCompletePlayerNames(sender, commandLabel, args, other -> other != player && party.isMember(other)); + } + } + + return null; + } +} diff --git a/Plugins/Mineplex.Core/src/mineplex/core/party/command/cli/PartyLeaveCommand.java b/Plugins/Mineplex.Core/src/mineplex/core/party/command/cli/PartyLeaveCommand.java new file mode 100644 index 000000000..90b9f305c --- /dev/null +++ b/Plugins/Mineplex.Core/src/mineplex/core/party/command/cli/PartyLeaveCommand.java @@ -0,0 +1,21 @@ +package mineplex.core.party.command.cli; + +import org.bukkit.entity.Player; + +import mineplex.core.command.CommandBase; +import mineplex.core.common.Rank; +import mineplex.core.party.PartyManager; + +public class PartyLeaveCommand extends CommandBase +{ + public PartyLeaveCommand(PartyManager plugin) + { + super(plugin, Rank.ALL, "leave", "l"); + } + + @Override + public void Execute(Player caller, String[] args) + { + Plugin.leaveParty(caller); + } +} diff --git a/Plugins/Mineplex.Core/src/mineplex/core/party/command/cli/PartyTransferOwnerCommand.java b/Plugins/Mineplex.Core/src/mineplex/core/party/command/cli/PartyTransferOwnerCommand.java new file mode 100644 index 000000000..402b0be83 --- /dev/null +++ b/Plugins/Mineplex.Core/src/mineplex/core/party/command/cli/PartyTransferOwnerCommand.java @@ -0,0 +1,86 @@ +package mineplex.core.party.command.cli; + +import java.util.List; + +import org.bukkit.Bukkit; +import org.bukkit.command.CommandSender; +import org.bukkit.entity.Player; + +import mineplex.core.command.CommandBase; +import mineplex.core.common.Rank; +import mineplex.core.common.util.F; +import mineplex.core.common.util.UtilPlayer; +import mineplex.core.party.Lang; +import mineplex.core.party.Party; +import mineplex.core.party.PartyManager; + +public class PartyTransferOwnerCommand extends CommandBase +{ + public PartyTransferOwnerCommand(PartyManager plugin) + { + super(plugin, Rank.ALL, "transfer", "tr"); + } + + @Override + public void Execute(Player caller, String[] args) + { + Party playerParty = Plugin.getPartyByPlayer(caller); + + if (playerParty == null) + { + UtilPlayer.message(caller, F.main("Party", "Oops. You're not in a party!")); + return; + } + + if (!playerParty.getOwner().getId().equals(caller.getUniqueId())) + { + UtilPlayer.message(caller, F.main("Party", "Oops. You're not the owner of the party!")); + return; + } + + if (args.length == 0) + { + UtilPlayer.message(caller, F.main("Party", "Oops. You didn't specify who you're transferring the party to!")); + return; + } + + Player player = Bukkit.getPlayer(args[0]); + if (player == null) + { + UtilPlayer.message(caller, F.main("Party", "Could not find " + F.elem(args[0]) + "!")); + return; + } + + if (!playerParty.isMember(player)) + { + UtilPlayer.message(caller, F.main("Party", "Oops. " + F.elem(player.getName())+ " is not in your party!")); + return; + } + + if (player == caller) + { + UtilPlayer.message(caller, F.main("Party", "You can't promote yourself!")); + return; + } + + playerParty.setOwner(player); + Lang.TRANSFER_OWNER.send(playerParty, caller.getName(), player.getName()); + } + + @Override + public List onTabComplete(CommandSender sender, String commandLabel, String[] args) + { + if (sender instanceof Player) + { + Player player = (Player) sender; + Party party = Plugin.getPartyByPlayer(player); + + if (party != null && party.isOwner(player)) + { + return tabCompletePlayerNames(sender, commandLabel, args, other -> other != player && party.isMember(other)); + } + } + + return null; + } +} diff --git a/Plugins/Mineplex.Core/src/mineplex/core/party/command/gui/PartyGUIAcceptInviteCommand.java b/Plugins/Mineplex.Core/src/mineplex/core/party/command/gui/PartyGUIAcceptInviteCommand.java new file mode 100644 index 000000000..9f1f6fa80 --- /dev/null +++ b/Plugins/Mineplex.Core/src/mineplex/core/party/command/gui/PartyGUIAcceptInviteCommand.java @@ -0,0 +1,49 @@ +package mineplex.core.party.command.gui; + +import java.util.List; + +import org.bukkit.command.CommandSender; +import org.bukkit.entity.Player; + +import mineplex.core.command.CommandBase; +import mineplex.core.common.Rank; +import mineplex.core.common.util.F; +import mineplex.core.common.util.UtilPlayer; +import mineplex.core.party.InviteData; +import mineplex.core.party.PartyManager; + +public class PartyGUIAcceptInviteCommand extends CommandBase +{ + public PartyGUIAcceptInviteCommand(PartyManager plugin) + { + super(plugin, Rank.ALL, "partyaccept", "accept", "a"); + } + + @Override + public void Execute(Player caller, String[] args) + { + if (args.length == 0) + { + UtilPlayer.message(caller, F.main("Party", "Oops. You didn't specify whose invite you're accepting!")); + return; + } + + Plugin.acceptInviteBySender(caller, args[0]); + } + + @Override + public List onTabComplete(CommandSender sender, String commandLabel, String[] args) + { + if (sender instanceof Player) + { + if (args.length == 1) + { + Player player = (Player) sender; + + return getMatches(args[0], Plugin.getInviteManager().getAllInvites(player).stream().map(InviteData::getInviterName)); + } + } + + return null; + } +} diff --git a/Plugins/Mineplex.Core/src/mineplex/core/party/command/gui/PartyGUIDenyInviteCommand.java b/Plugins/Mineplex.Core/src/mineplex/core/party/command/gui/PartyGUIDenyInviteCommand.java new file mode 100644 index 000000000..6b53c1c61 --- /dev/null +++ b/Plugins/Mineplex.Core/src/mineplex/core/party/command/gui/PartyGUIDenyInviteCommand.java @@ -0,0 +1,48 @@ +package mineplex.core.party.command.gui; + +import java.util.List; +import java.util.stream.Collectors; + +import org.bukkit.command.CommandSender; +import org.bukkit.entity.Player; + +import mineplex.core.command.CommandBase; +import mineplex.core.common.Rank; +import mineplex.core.common.util.F; +import mineplex.core.common.util.UtilPlayer; +import mineplex.core.party.InviteData; +import mineplex.core.party.PartyManager; + +public class PartyGUIDenyInviteCommand extends CommandBase +{ + public PartyGUIDenyInviteCommand(PartyManager plugin) + { + super(plugin, Rank.ALL, "partydeny", "deny", "d"); + } + + @Override + public void Execute(Player caller, String[] args) + { + if (args.length == 0) + { + UtilPlayer.message(caller, F.main("Party", "Oops. You didn't specify whose invite you're denying!")); + return; + } + Plugin.denyInviteBySender(caller, args[0]); + } + + @Override + public List onTabComplete(CommandSender sender, String commandLabel, String[] args) + { + if (sender instanceof Player) + { + if (args.length == 1) + { + Player player = (Player) sender; + return getMatches(args[0], Plugin.getInviteManager().getAllInvites(player).stream().map(InviteData::getInviterName).collect(Collectors.toList())); + } + } + + return null; + } +} diff --git a/Plugins/Mineplex.Core/src/mineplex/core/party/command/gui/PartyGUIInviteCommand.java b/Plugins/Mineplex.Core/src/mineplex/core/party/command/gui/PartyGUIInviteCommand.java new file mode 100644 index 000000000..f3832cbad --- /dev/null +++ b/Plugins/Mineplex.Core/src/mineplex/core/party/command/gui/PartyGUIInviteCommand.java @@ -0,0 +1,46 @@ +package mineplex.core.party.command.gui; + +import java.util.List; + +import org.bukkit.command.CommandSender; +import org.bukkit.entity.Player; + +import mineplex.core.command.CommandBase; +import mineplex.core.common.Rank; +import mineplex.core.common.util.F; +import mineplex.core.common.util.UtilPlayer; +import mineplex.core.party.Party; +import mineplex.core.party.PartyManager; + +public class PartyGUIInviteCommand extends CommandBase +{ + public PartyGUIInviteCommand(PartyManager plugin) + { + super(plugin, Rank.ALL, "partyinvite", "invite", "i"); + } + + @Override + public void Execute(Player caller, String[] args) + { + if (args.length == 0) + { + UtilPlayer.message(caller, F.main("Party", "Oops. You didn't specify who to invite!")); + return; + } + Plugin.invite(caller, args[0]); + } + + @Override + public List onTabComplete(CommandSender sender, String commandLabel, String[] args) + { + if (sender instanceof Player) + { + Player player = (Player) sender; + Party party = Plugin.getPartyByPlayer(player); + + return tabCompletePlayerNames(sender, commandLabel, args, other -> party == null || !party.isMember(other)); + } + + return null; + } +} diff --git a/Plugins/Mineplex.Core/src/mineplex/core/party/command/gui/PartyGUILeaveCommand.java b/Plugins/Mineplex.Core/src/mineplex/core/party/command/gui/PartyGUILeaveCommand.java new file mode 100644 index 000000000..e4858300b --- /dev/null +++ b/Plugins/Mineplex.Core/src/mineplex/core/party/command/gui/PartyGUILeaveCommand.java @@ -0,0 +1,23 @@ +package mineplex.core.party.command.gui; + +import org.bukkit.entity.Player; + +import mineplex.core.command.CommandBase; +import mineplex.core.common.Rank; +import mineplex.core.common.util.F; +import mineplex.core.common.util.UtilPlayer; +import mineplex.core.party.PartyManager; + +public class PartyGUILeaveCommand extends CommandBase +{ + public PartyGUILeaveCommand(PartyManager plugin) + { + super(plugin, Rank.ALL, "leave", "l"); + } + + @Override + public void Execute(Player caller, String[] args) + { + Plugin.leaveParty(caller); + } +} diff --git a/Plugins/Mineplex.Core/src/mineplex/core/party/command/gui/PartyOpenInviteMenuCommand.java b/Plugins/Mineplex.Core/src/mineplex/core/party/command/gui/PartyOpenInviteMenuCommand.java new file mode 100644 index 000000000..0064e920c --- /dev/null +++ b/Plugins/Mineplex.Core/src/mineplex/core/party/command/gui/PartyOpenInviteMenuCommand.java @@ -0,0 +1,22 @@ +package mineplex.core.party.command.gui; + +import org.bukkit.entity.Player; + +import mineplex.core.command.CommandBase; +import mineplex.core.common.Rank; +import mineplex.core.party.PartyManager; +import mineplex.core.party.ui.menus.PartyInvitesMenu; + +public class PartyOpenInviteMenuCommand extends CommandBase +{ + public PartyOpenInviteMenuCommand(PartyManager plugin) + { + super(plugin, Rank.ALL, "openinvitesmenu", "invitesmenu", "im", "invites", "is"); + } + + @Override + public void Execute(Player caller, String[] args) + { + new PartyInvitesMenu(Plugin).open(caller); + } +} diff --git a/Plugins/Mineplex.Core/src/mineplex/core/party/constants/InviteResponse.java b/Plugins/Mineplex.Core/src/mineplex/core/party/constants/InviteResponse.java deleted file mode 100644 index 30212e51d..000000000 --- a/Plugins/Mineplex.Core/src/mineplex/core/party/constants/InviteResponse.java +++ /dev/null @@ -1,27 +0,0 @@ -package mineplex.core.party.constants; - -import mineplex.core.common.util.F; - -/** - * - */ -public enum InviteResponse -{ - - ACCEPTED("{0} has joined the party!"), - DENIED("{0} has declined joining your party."), - EXPIRED("{0} did not respond in time."); - - private String _message; - - InviteResponse(String message) - { - _message = message; - } - - public String format(String target) - { - return _message.replace("{0}", F.name(target)); - } - -} diff --git a/Plugins/Mineplex.Core/src/mineplex/core/party/constants/JoinResponseReason.java b/Plugins/Mineplex.Core/src/mineplex/core/party/constants/JoinResponseReason.java deleted file mode 100644 index 56cd100e2..000000000 --- a/Plugins/Mineplex.Core/src/mineplex/core/party/constants/JoinResponseReason.java +++ /dev/null @@ -1,26 +0,0 @@ -package mineplex.core.party.constants; - -import mineplex.core.common.util.F; - -/** - * - */ -public enum JoinResponseReason -{ - - CANNOT_JOIN_FULL(F.main("Party", "Your party cannot join full servers!")), - SUCCESS(""); - - private String _message; - - JoinResponseReason(String message) - { - _message = message; - } - - public String getMessage() - { - return _message; - } - -} diff --git a/Plugins/Mineplex.Core/src/mineplex/core/party/event/PartyDataReceivedEvent.java b/Plugins/Mineplex.Core/src/mineplex/core/party/event/PartyDataReceivedEvent.java deleted file mode 100644 index d4d25f699..000000000 --- a/Plugins/Mineplex.Core/src/mineplex/core/party/event/PartyDataReceivedEvent.java +++ /dev/null @@ -1,37 +0,0 @@ -package mineplex.core.party.event; - -import mineplex.core.party.Party; -import org.bukkit.event.Event; -import org.bukkit.event.HandlerList; - -/** - * An event called when a server receives a PartyPacket containing the information about a party - */ -public class PartyDataReceivedEvent extends Event -{ - private static final HandlerList HANDLER_LIST = new HandlerList(); - - private final Party _party; - - public PartyDataReceivedEvent(Party party) - { - _party = party; - } - - public Party getParty() - { - return _party; - } - - @Override - public HandlerList getHandlers() - { - return HANDLER_LIST; - } - - public static HandlerList getHandlerList() - { - return HANDLER_LIST; - } - -} diff --git a/Plugins/Mineplex.Core/src/mineplex/core/party/event/PartyMemberKickGUIEvent.java b/Plugins/Mineplex.Core/src/mineplex/core/party/event/PartyMemberKickGUIEvent.java deleted file mode 100644 index 885567240..000000000 --- a/Plugins/Mineplex.Core/src/mineplex/core/party/event/PartyMemberKickGUIEvent.java +++ /dev/null @@ -1,51 +0,0 @@ -package mineplex.core.party.event; - -import mineplex.core.party.Party; -import org.bukkit.entity.Player; -import org.bukkit.event.Event; -import org.bukkit.event.HandlerList; - -/** - * This event is called when an owner clicks a PartyMemberIcon while having Kick mode activated. - */ -public class PartyMemberKickGUIEvent extends Event -{ - private static final HandlerList HANDLER_LIST = new HandlerList(); - - private final Party _party; - private final String _playerClicked; - private final Player _owner; - - public PartyMemberKickGUIEvent(Party party, String playerClicked, Player owner) - { - _party = party; - _playerClicked = playerClicked; - _owner = owner; - } - - public String getPlayerClicked() - { - return _playerClicked; - } - - public Player getOwner() - { - return _owner; - } - - public Party getParty() - { - return _party; - } - - @Override - public HandlerList getHandlers() - { - return HANDLER_LIST; - } - - public static HandlerList getHandlerList() - { - return HANDLER_LIST; - } -} diff --git a/Plugins/Mineplex.Core/src/mineplex/core/party/event/PartySendToServerEvent.java b/Plugins/Mineplex.Core/src/mineplex/core/party/event/PartySendToServerEvent.java deleted file mode 100644 index 604db6eb7..000000000 --- a/Plugins/Mineplex.Core/src/mineplex/core/party/event/PartySendToServerEvent.java +++ /dev/null @@ -1,44 +0,0 @@ -package mineplex.core.party.event; - -import mineplex.core.party.Party; -import mineplex.serverdata.data.MinecraftServer; -import org.bukkit.event.Event; -import org.bukkit.event.HandlerList; - -/** - * - */ -public class PartySendToServerEvent extends Event -{ - private static final HandlerList HANDLER_LIST = new HandlerList(); - - private final Party _party; - private final MinecraftServer _minecraftServer; - - public PartySendToServerEvent(Party party, MinecraftServer minecraftServer) - { - _party = party; - _minecraftServer = minecraftServer; - } - - public Party getParty() - { - return _party; - } - - @Override - public HandlerList getHandlers() - { - return HANDLER_LIST; - } - - public static HandlerList getHandlerList() - { - return HANDLER_LIST; - } - - public MinecraftServer getMinecraftServer() - { - return _minecraftServer; - } -} diff --git a/Plugins/Mineplex.Core/src/mineplex/core/party/event/PartyTransferOwnerEvent.java b/Plugins/Mineplex.Core/src/mineplex/core/party/event/PartyTransferOwnerEvent.java deleted file mode 100644 index c21abd883..000000000 --- a/Plugins/Mineplex.Core/src/mineplex/core/party/event/PartyTransferOwnerEvent.java +++ /dev/null @@ -1,65 +0,0 @@ -package mineplex.core.party.event; - -import mineplex.core.party.Party; -import org.bukkit.event.Event; -import org.bukkit.event.HandlerList; - -/** - * An event called when an owner leaves a party - */ -public class PartyTransferOwnerEvent extends Event -{ - - public enum TransferReason - { - LEFT, - TRANSFER; - } - - private static final HandlerList HANDLER_LIST = new HandlerList(); - - private final Party _party; - private final String _newOwner; - private final String _oldOwner; - private final TransferReason _reason; - - public PartyTransferOwnerEvent(Party party, String newOwner, String oldOwner, TransferReason reason) - { - _party = party; - _newOwner = newOwner; - _oldOwner = oldOwner; - _reason = reason; - } - - public String getNewOwner() - { - return _newOwner; - } - - public String getOldOwner() - { - return _oldOwner; - } - - public TransferReason getReason() - { - return _reason; - } - - public Party getParty() - { - return _party; - } - - @Override - public HandlerList getHandlers() - { - return HANDLER_LIST; - } - - public static HandlerList getHandlerList() - { - return HANDLER_LIST; - } - -} diff --git a/Plugins/Mineplex.Core/src/mineplex/core/party/manager/PartyInviteManager.java b/Plugins/Mineplex.Core/src/mineplex/core/party/manager/PartyInviteManager.java index bfff39b40..8ecc3ee0d 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/party/manager/PartyInviteManager.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/party/manager/PartyInviteManager.java @@ -1,173 +1,155 @@ package mineplex.core.party.manager; -import com.google.common.collect.Lists; -import com.google.common.collect.Maps; -import mineplex.core.common.Rank; -import mineplex.core.common.util.C; -import mineplex.core.common.util.F; -import mineplex.core.party.InviteData; -import mineplex.core.party.Lang; -import mineplex.core.party.Party; -import mineplex.core.party.PartyManager; -import mineplex.core.party.constants.InviteResponse; -import mineplex.core.party.redis.RedisMessageType; +import java.util.ArrayList; +import java.util.Collections; +import java.util.HashMap; +import java.util.HashSet; +import java.util.Iterator; +import java.util.List; +import java.util.Map; +import java.util.Set; +import java.util.UUID; + import net.md_5.bungee.api.ChatColor; import net.md_5.bungee.api.chat.ClickEvent; import net.md_5.bungee.api.chat.ClickEvent.Action; import net.md_5.bungee.api.chat.HoverEvent; import net.md_5.bungee.api.chat.TextComponent; + import org.bukkit.Bukkit; import org.bukkit.Sound; import org.bukkit.entity.Player; import org.bukkit.scheduler.BukkitRunnable; import org.bukkit.scheduler.BukkitTask; +import org.spigotmc.CaseInsensitiveMap; -import java.util.Collection; -import java.util.List; -import java.util.Map; -import java.util.UUID; +import mineplex.core.common.util.F; +import mineplex.core.common.util.UtilPlayer; +import mineplex.core.common.util.UtilServer; +import mineplex.core.party.InviteData; +import mineplex.core.party.Party; +import mineplex.core.party.PartyManager; /** - * + * This class manages invites to parties */ public class PartyInviteManager { + // Map of Player Name (invitee) to invites (inviter) + private final Map> _activeInvites = new CaseInsensitiveMap<>(); - private final Map> _activeInvites = Maps.newHashMap(); - private final Map _invitedBy = Maps.newHashMap(); - private final Map _awaitingJoin = Maps.newHashMap(); - private final Map _players = Maps.newHashMap(); - private final Map _tasks = Maps.newHashMap(); + private final Map _tasks = new HashMap<>(); private final PartyManager _plugin; - private final PartyRedisManager _partyRedisManager; - public PartyInviteManager(PartyManager plugin, PartyRedisManager partyRedisManager) + public PartyInviteManager(PartyManager plugin) { _plugin = plugin; - _partyRedisManager = partyRedisManager; } - /** - * Responds to an invite, regardless of the server - * - * @param player The player calling - * @param party The party - * @param accept Whether or not the player accepted the invite - */ - public void respondToInvite(Player player, String party, boolean accept) + public InviteData getInviteBySender(String invitee, String sender) { - Player possible = Bukkit.getPlayerExact(party); + Set map = _activeInvites.get(invitee); - InviteData data = remove(party, player.getUniqueId()); + if (map == null) return null; - _players.remove(player.getUniqueId()); - cancelTask(player.getUniqueId()); - - if(possible != null) + for (InviteData inviteData : map) { - Party newParty = _plugin.getParty(party); - if(!accept) + if (inviteData.getInviterName().equalsIgnoreCase(sender)) { - String message = C.mHead + "Party> " + C.mBody + InviteResponse.DENIED.format(player.getName()); - if (newParty == null) - { - possible.sendMessage(message); - return; - } - newParty.sendMessage(message); - return; + return inviteData; } - if (newParty == null) + } + + return null; + } + + /** + * Checks if a caller has an invite by a sender's name + * + * @param caller + * @param sender + * @return + */ + public boolean hasInviteFrom(Player caller, String sender) + { + return getInviteBySender(caller.getName(), sender) != null; + } + + /** + * Checks if a caller has an invite by a party id + * + * @param caller + * @param partyId + * @return + */ + public boolean hasInviteTo(String caller, UUID partyId) + { + Set map = _activeInvites.get(caller); + + if (map == null) return false; + + for (InviteData inviteData : map) + { + if (inviteData.getPartyUUID().equals(partyId)) { - newParty = new Party(possible.getName()); - if(_plugin.getClientManager().Get(possible).GetRank().has(Rank.ULTRA)) - { - newParty.setSize(); - } else - { - newParty.setSize(); - } - _plugin.addParty(newParty); - _plugin.getMethodManager().addToParty(possible.getUniqueId(), newParty); + return true; } - _plugin.getMethodManager().addToParty(player.getUniqueId(), newParty); - return; } - String serverFrom = data.getServerFrom(); - - if(accept) - { - _plugin.getPortal().sendPlayerToServer(player, serverFrom); - } - - _partyRedisManager.publish(serverFrom, RedisMessageType.INVITE_PLAYER_RESPONSE, party, - player.getName(), player.getUniqueId().toString(), accept ? InviteResponse.ACCEPTED.name() : InviteResponse.DENIED.name()); + return false; } /** - * Handles a received response via redis + * Remove a player's invite to a party by id * - * @param sender The player sending the request - * @param target The player target - * @param serverFrom The server initiating the request + * @param caller + * @param partyId + * @return */ - public void handleInviteRequest(String sender, String target, String serverFrom) + public InviteData removeInviteTo(String caller, UUID partyId) { - Player player = Bukkit.getPlayerExact(target); - if (player == null) + Set map = _activeInvites.get(caller); + + if (map == null) return null; + + Iterator itr = map.iterator(); + + while (itr.hasNext()) { - //Shouldn't happen, as a "findPLayer" packet will be sent out first. - return; + InviteData ent = itr.next(); + if (ent.getPartyUUID().equals(partyId)) + { + itr.remove(); + return ent; + } } - _players.put(player.getUniqueId(), player.getName()); - inviteTo(player.getUniqueId(), sender, sender, serverFrom); - Lang.INVITE_RECEIVED.send(player, sender); - sendAcceptOrDeny(player, sender); - player.playSound(player.getLocation(), Sound.NOTE_PLING, 1.0F, 1.0F); + + return null; } /** - * Handles the response returned via redis when an invite is handled cross server - * - * @param sender The player sender - * @param target The player target - * @param targetUUID The player targets UUID - * @param response The response to this invite + * Remove a player's invite to a certain party */ - public void handleInviteResponse(String sender, String target, UUID targetUUID, InviteResponse response) + public InviteData removeInvite(Player invitee, String inviter) { - remove(sender, targetUUID); - Player player = Bukkit.getPlayer(sender); - if (player == null) - { - return; - } - String message = F.main("Party", response.format(target)); + Set map = _activeInvites.get(invitee.getName()); - Party party = _plugin.getParty(sender); - String partyName = sender; - if(party != null) + if (map == null) return null; + + Iterator itr = map.iterator(); + + while (itr.hasNext()) { - partyName = party.getName(); + InviteData ent = itr.next(); + if (ent.getInviterName().equalsIgnoreCase(inviter)) + { + itr.remove(); + return ent; + } } - switch (response) - { - case ACCEPTED: - addToPendingJoin(targetUUID, partyName); - break; - case EXPIRED: - case DENIED: - if (party == null) - { - player.sendMessage(message); - return; - } - party.sendMessage(message); - break; - } + return null; } /** @@ -175,202 +157,109 @@ public class PartyInviteManager * * @param player The player's UUID */ - public void removeAll(UUID player) + public void removeAll(Player player) { - _players.remove(player); - _invitedBy.remove(player); - _activeInvites.remove(player); - } - - /** - * Get the name of the party who is awaiting this player to join - * - * @param player The player's UUID - * @return The name of the awaiting party. - */ - public String getPartyWaiting(UUID player) - { - return _awaitingJoin.get(player); - } - - /** - * Remove the party reference that invited this player - * - * @param player The player's UUID - */ - public void removeFromWaiting(UUID player) - { - _awaitingJoin.remove(player); - } - - /** - * Add a player to the active invites map - * - * @param player The player who has been invited - * @param party The party name - */ - public void inviteTo(UUID player, String invitedBy, String party, String server) - { - addToInvite(player, invitedBy, party, server); - _tasks.put(player, new BukkitRunnable() - { - @Override - public void run() - { - if (!isInvitedTo(player, party)) - { - cancel(); - return; - } - InviteData data = remove(party, player); - Player possible = Bukkit.getPlayer(player); - String playerName = _players.remove(player); - if (possible != null) - { - playerName = possible.getName(); - possible.sendMessage(F.main("Party", "Your invite to " + F.name(party) + "'s party has expired")); - } - sendExpired(data.getServerFrom(), party, playerName, player); - } - }.runTaskLater(_plugin.getPlugin(), 20 * 60)); - } - - /** - * Checks to see if a player is invited to a specific party - * - * @param player The player who we want to check against - * @param party The name of the party to check - * @return true if the player has an invite to the specific party - */ - public boolean isInvitedTo(UUID player, String party) - { - if (!_activeInvites.containsKey(player)) - { - return false; - } - List dataList = _activeInvites.get(player); - for (InviteData data : dataList) - { - if (data.getInvitedTo().equalsIgnoreCase(party)) - { - return true; - } - } - return false; - } - - /** - * Remove a player's invite to a certain party - * - * @param party The name of the party - * @param invited The UUID of the player - */ - public InviteData remove(String party, UUID invited) - { - List data = _activeInvites.get(invited); - InviteData temp = null; - for (InviteData inviteData : data) - { - if (inviteData.getInvitedTo().equalsIgnoreCase(party)) - { - temp = inviteData; - break; - } - } - if (temp != null) - { - data.remove(temp); - } - _activeInvites.put(invited, data); - return temp; - } - - /** - * Stop the player's expired task from running - * - * @param player The UUID of the player - */ - public void cancelTask(UUID player) - { - BukkitTask task = _tasks.remove(player); - if(task != null) - { - task.cancel(); - } + _activeInvites.remove(player.getName()); } /** * Retrieves all invites currently pending for a specific player + * * @param player The player * @return All his current pending invites */ - public Collection getAllInvites(Player player) + public List getAllInvites(Player player) { - return _activeInvites.get(player.getUniqueId()); + return new ArrayList<>(_activeInvites.getOrDefault(player.getName(), Collections.emptySet())); } /** - * Send an "ExpiredPartyInvite" redis message + * Add a playerUUID to the active invites map * - * @param server The server to - * @param party The party who initiated the request (can also be a player's name) - * @param playerName The name of the invited player - * @param player The invited player's UUID + * @param inviterName + * @param inviterUUID */ - private void sendExpired(String server, String party, String playerName, UUID player) + public void inviteTo(String targetName, UUID targetUUID, String inviterName, UUID inviterUUID, UUID partyId, String server) { - _plugin.getRedisManager().publish(server, RedisMessageType.INVITE_PLAYER_RESPONSE, party, playerName, player.toString(), InviteResponse.EXPIRED.name()); - } + Set map = _activeInvites.computeIfAbsent(targetName, key -> new HashSet<>()); + InviteData inviteData = new InviteData(inviterName, inviterUUID, partyId, server); - /** - * Marks this player as having an accepted invite - * This is used to control the creation of single player parties, and makes sure a party is created ONLY if a player joins the server successfully. - * - * @param player The UUID of the player - * @param party The name of the party - */ - private void addToPendingJoin(UUID player, String party) - { - _awaitingJoin.put(player, party); - } - - /** - * Add a pending invite for a player - * - * @param invited The invited players UUUD - * @param invitedBy The person who invited him - * @param party The name of the party invited to - * @param server The server the request is from - */ - private void addToInvite(UUID invited, String invitedBy, String party, String server) - { - List inviteDatas = _activeInvites.get(invited); - if (inviteDatas == null) + if (map.add(inviteData)) { - inviteDatas = Lists.newArrayList(); + _tasks.put(targetUUID, _plugin.runSyncLater(new BukkitRunnable() + { + @Override + public void run() + { + if (!hasInviteTo(targetName, partyId)) + { + cancel(); + return; + } + InviteData data = removeInviteTo(targetName, partyId); + Player possible = Bukkit.getPlayer(targetUUID); + if (possible != null) + { + Party curParty = _plugin.getPartyById(partyId); + if (curParty != null) + { + possible.sendMessage(F.main("Party", "Your invite to " + F.name(inviterName) + "'s party has expired")); + } + else + { + UtilPlayer.message(possible, F.main("Party", "Your invite to " + F.name(inviterName) + "'s party has expired. Fortunately, that party no longer exists")); + } + } + } + }, 20 * 60)); + } + + Player player = Bukkit.getPlayer(targetUUID); + if (player != null) + { + Party party = _plugin.getPartyByPlayer(player); + if (party == null) + { + if (server.equals(UtilServer.getServerName())) + { + UtilPlayer.message(player, F.main("Party", "You have been invited to " + F.elem(inviterName) + "'s party! You have 60 seconds to reply")); + } + else + { + UtilPlayer.message(player, F.main("Party", "You have been invited to " + F.elem(inviterName) + "'s party! You have 60 seconds to reply. If you accept, you will be be sent to " + F.elem(server))); + } + } + else + { + if (server.equals(UtilServer.getServerName())) + { + UtilPlayer.message(player, F.main("Party", "You have been invited to " + F.elem(inviterName) + "'s party! You have 60 seconds to reply. If you accept, you will leave your current party")); + } + else + { + UtilPlayer.message(player, F.main("Party", "You have been invited to " + F.elem(inviterName) + "'s party! You have 60 seconds to reply. If you accept, you will leave your current party and you will be be sent to " + F.elem(server))); + } + } + sendAcceptOrDeny(player, inviterName); } - InviteData inviteData = new InviteData(party, server); - inviteDatas.add(inviteData); - _invitedBy.put(invited, invitedBy); - _activeInvites.put(invited, inviteDatas); } /** * Sends a Text Componoent clickable message to a player for easier quick responses to invites * * @param player The player who received the invite - * @param arg The name of the inviting party + * @param arg The name of the inviting party */ - public void sendAcceptOrDeny(Player player, String arg) + private void sendAcceptOrDeny(Player player, String arg) { TextComponent textComponent = new TextComponent(F.main("Party", "Reply: ")); TextComponent accept = new TextComponent("ACCEPT"); accept.setColor(ChatColor.GREEN); accept.setBold(true); - accept.setClickEvent(new ClickEvent(Action.RUN_COMMAND, "/partyaccept " + arg)); + accept.setClickEvent(new ClickEvent(Action.RUN_COMMAND, "/party cli a " + arg)); accept.setHoverEvent(new HoverEvent(HoverEvent.Action.SHOW_TEXT, new TextComponent[]{ - new TextComponent("Click to join " + F.name(arg) + "'s party") + new TextComponent("Click to join " + F.name(arg) + ChatColor.WHITE + "'s party") })); textComponent.addExtra(accept); @@ -379,9 +268,9 @@ public class PartyInviteManager TextComponent deny = new TextComponent("DENY"); deny.setColor(ChatColor.RED); deny.setBold(true); - deny.setClickEvent(new ClickEvent(Action.RUN_COMMAND, "/partydeny " + arg)); + deny.setClickEvent(new ClickEvent(Action.RUN_COMMAND, "/party cli d " + arg)); deny.setHoverEvent(new HoverEvent(HoverEvent.Action.SHOW_TEXT, new TextComponent[]{ - new TextComponent("Click to decline joining " + F.name(arg) + "'s party") + new TextComponent("Click to decline joining " + F.name(arg) + ChatColor.WHITE + "'s party") })); textComponent.addExtra(deny); @@ -390,13 +279,14 @@ public class PartyInviteManager TextComponent view = new TextComponent("VIEW"); view.setColor(ChatColor.YELLOW); view.setBold(true); - view.setClickEvent(new ClickEvent(Action.RUN_COMMAND, "/openinvitesmenu")); + view.setClickEvent(new ClickEvent(Action.RUN_COMMAND, "/party cli is")); view.setHoverEvent(new HoverEvent(HoverEvent.Action.SHOW_TEXT, new TextComponent[]{ - new TextComponent("Click to view all pending invites.") + new TextComponent("Click to view all pending invites") })); textComponent.addExtra(view); player.spigot().sendMessage(textComponent); + player.playSound(player.getLocation(), Sound.NOTE_PLING, 1.0F, 10.0F); } } diff --git a/Plugins/Mineplex.Core/src/mineplex/core/party/manager/PartyJoinManager.java b/Plugins/Mineplex.Core/src/mineplex/core/party/manager/PartyJoinManager.java index 88a7ef29c..1dcd4c746 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/party/manager/PartyJoinManager.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/party/manager/PartyJoinManager.java @@ -1,137 +1,360 @@ package mineplex.core.party.manager; +import java.util.ArrayList; +import java.util.List; +import java.util.Map; +import java.util.Random; +import java.util.UUID; +import java.util.concurrent.ConcurrentHashMap; + +import org.bukkit.entity.Player; +import org.bukkit.event.EventHandler; +import org.bukkit.event.Listener; +import org.bukkit.event.player.PlayerInteractEntityEvent; +import org.bukkit.event.player.PlayerInteractEvent; +import org.bukkit.event.player.PlayerJoinEvent; +import org.bukkit.event.player.PlayerQuitEvent; +import org.bukkit.scheduler.BukkitTask; + import com.google.common.collect.Lists; + +import mineplex.core.Managers; +import mineplex.core.command.CommandCenter; import mineplex.core.common.Rank; import mineplex.core.common.util.F; +import mineplex.core.common.util.UtilItem; +import mineplex.core.common.util.UtilPlayer; import mineplex.core.common.util.UtilServer; +import mineplex.core.party.Lang; import mineplex.core.party.Party; import mineplex.core.party.PartyManager; -import mineplex.core.party.constants.JoinResponseReason; -import mineplex.core.party.redis.RedisMessageType; -import mineplex.serverdata.servers.ServerManager; -import org.bukkit.Bukkit; -import org.bukkit.entity.Player; - -import java.util.List; -import java.util.UUID; -import java.util.stream.Collectors; +import mineplex.core.party.constants.PartyRemoveReason; +import mineplex.core.party.rediscommands.PartyTransferRequest; +import mineplex.core.party.rediscommands.PartyTransferResponse; +import mineplex.core.portal.Intent; +import mineplex.core.portal.events.GenericServerTransferEvent; +import mineplex.core.portal.events.ServerTransferEvent; +import mineplex.core.twofactor.TwoFactorAuth; +import mineplex.core.utils.UtilGameProfile; +import mineplex.serverdata.commands.ServerCommandManager; +import mineplex.serverdata.data.MinecraftServer; /** * Manages allocating slots for parties to join */ -public class PartyJoinManager +public class PartyJoinManager implements Listener { - + private final TwoFactorAuth _twofactor = Managers.require(TwoFactorAuth.class); private final PartyManager _plugin; - private final int _maxPLayers; - private final List _transferring; + private final int _maxPlayers; + + private final Map _pendingTransfers = new ConcurrentHashMap<>(); public PartyJoinManager(PartyManager plugin) { _plugin = plugin; - _maxPLayers = plugin.getPlugin().getServer().getMaxPlayers(); - _transferring = Lists.newArrayList(); - } + _maxPlayers = plugin.getPlugin().getServer().getMaxPlayers(); - /** - * Scans through the party to check if all players are some form of VIP - * If the party contains even 1 non-vip, the party cannot be sent to a full server - * - * @param party The party - * @return true if the party contains all VIP's false if it contains even 1 non-vip - */ - public boolean canJoinFullServer(Party party) - { - List players = party.getMembersByUUID().stream().map(Bukkit::getPlayer).collect(Collectors.toList()); - for (Player player : players) + UtilServer.RegisterEvents(this); + + ServerCommandManager.getInstance().registerCommandType(PartyTransferRequest.class, command -> { - Rank rank = _plugin.getClientManager().Get(player).GetRank(); - if (rank == Rank.ALL) + if (!command.isSentToThisServer()) + return; + + _plugin.runSync(() -> { - return false; - } - } - return true; + int currentPlayers = UtilServer.getPlayersCollection().size(); + if (currentPlayers + command.getUnrankedMembers().size() > _maxPlayers && !command.isCanJoinFullServers()) + { + ServerCommandManager.getInstance().publishCommand(new PartyTransferResponse(command, PartyTransferResponse.Result.NOT_ENOUGH_ROOM)); + return; + } + + for (UUID uuid : command.getUnrankedMembers()) + { + _plugin.getClientManager().reserveFor(uuid); + } + + Party newParty = new Party(command); + + _plugin.addParty(newParty); + + for (UUID uuid : command.getAllMembers()) + { + _plugin.putIntoPendingJoin(uuid, newParty.getUniqueId()); + } + + ServerCommandManager.getInstance().publishCommand(new PartyTransferResponse(command, PartyTransferResponse.Result.SUCCESS)); + }); + }); + + ServerCommandManager.getInstance().registerCommandType(PartyTransferResponse.class, command -> + { + if (!command.getOrigin().wasSentFromThisServer()) + return; + + _plugin.runSync(() -> + { + BukkitTask task = _pendingTransfers.get(command.getOrigin().getPartyUUID()); + if (task == null) + { + return; + } + + task.cancel(); + + Party party = _plugin.getPartyById(command.getOrigin().getPartyUUID()); + + switch (command.getResult()) + { + case NOT_ENOUGH_ROOM: + _pendingTransfers.remove(command.getOrigin().getPartyUUID()); + party.sendMessage(F.main("Party", "Sorry, there wasn't enough room for your party in " + F.elem(command.getFromServer()) + ".")); + break; + case SUCCESS: + party.sendMessage(F.main("Party", "Success! I've reserved some room for you in " + F.elem(command.getFromServer()) + ".")); + party.sendMessage(F.main("Party", "You will be transferred shortly.")); + List members = new ArrayList<>(party.getMembers()); + + // Clear the party first. + // We've already got a duplicate on the remote server so let's get rid of this one ASAP + party.clear(); + _plugin.removeParty(party); + + + for (Player player : members) + { + _plugin.getPortal().sendPlayer(player, command.getFromServer()); + } + break; + case UNKNOWN: + _pendingTransfers.remove(command.getOrigin().getPartyUUID()); + party.sendMessage(F.main("Party", "Uh... something went wrong?")); + break; + } + }); + }); } /** * Initiates a request to join a server for a specific party * * @param server The desired server - * @param party The requesting party + * @param party The requesting party */ - public void requestServerJoin(String server, Party party) + private void requestServerJoin(String server, Party party) { - boolean canJoinFull = canJoinFullServer(party); - _plugin.getRedisManager().publish(server, RedisMessageType.PREJOIN_SERVER_REQUEST, - _plugin.getServerName(), party.getOwner(), "" + party.getMembers().size(), "" + canJoinFull); - } - - /** - * Manages a received request - * - * @param serverFrom The server who initiated the request - * @param partySize The size of the party - * @param initiator The player who sent the request - * @param canJoinFull true if the party contains all donators or staff (full joining able players) - */ - public void handleJoinRequest(String serverFrom, int partySize, String initiator, boolean canJoinFull) - { - int currentPlayers = UtilServer.getPlayers().length; - if (currentPlayers >= _maxPLayers || (currentPlayers + partySize) >= _maxPLayers) - { - //Max number of people on. - if (!canJoinFull) - { - _plugin.getRedisManager().publish(serverFrom, RedisMessageType.PREJOIN_SERVER_RESPONSE, initiator, JoinResponseReason.CANNOT_JOIN_FULL.name(), _plugin.getServerName()); - return; - } - } - ServerManager.getServerRepository(_plugin.getRegion()).getServerStatus(_plugin.getServerName()).incrementPlayerCount(partySize); - _plugin.getRedisManager().publish(serverFrom, RedisMessageType.PREJOIN_SERVER_RESPONSE, initiator, JoinResponseReason.SUCCESS.name(), _plugin.getServerName()); - - } - - /** - * Manages a received response - * - * @param playerSender The player who sent the request - * @param server The server responding - * @param reason The reason for the response - */ - public void handleJoinResponse(String playerSender, String server, JoinResponseReason reason) - { - Player player = Bukkit.getPlayer(playerSender); - if (player == null) + if (_pendingTransfers.containsKey(party.getUniqueId())) { + party.sendMessage(F.main("Party", "Please wait until your current transfer is complete")); return; } - Party party = _plugin.getParty(player); + + List unranked = new ArrayList<>(); + List all = new ArrayList<>(); + for (Player player : party.getMembers()) + { + if (_plugin.getClientManager().Get(player).GetRank() == Rank.ALL) + { + unranked.add(player.getUniqueId()); + } + all.add(player.getUniqueId()); + } + + _pendingTransfers.put(party.getUniqueId(), _plugin.runSyncLater(() -> + { + _pendingTransfers.remove(party.getUniqueId()); + + if (party.getMembers().size() == 0) + { + return; + } + + party.sendMessage(F.main("Party", "Aww, the destination server didn't respond :(")); + }, 20 * 5L)); + + System.out.println("Sending transfer request to " + server + " for " + party.getUniqueId() + " " + party.getMembers()); + + party.sendMessage(F.main("Party", "Please wait while I check whether " + F.elem(server) + " has enough room for this party.")); + ServerCommandManager.getInstance().publishCommand(new PartyTransferRequest(party.getUniqueId(), UtilGameProfile.getGameProfile(party.getOwnerAsPlayer().get()), all, unranked, unranked.size() == 0, server)); + } + + @EventHandler + public void onTransferToGenericServer(GenericServerTransferEvent event) + { + Player player = event.getPlayer(); + Party party = _plugin.getPartyByPlayer(player); + if (party == null) { return; } - if (reason != JoinResponseReason.SUCCESS) + + // If the server wants to kick the player, let's not stop it + if (event.getIntent() == Intent.KICK || event.getIntent() == Intent.FORCE_TRANSFER) { - party.sendMessage(reason.getMessage()); + _plugin.removeFromParty(event.getPlayer(), PartyRemoveReason.KICKED); + return; } - party.sendMessage(F.main("Party", "Transferring servers...")); - _plugin.getRedisManager().sendPartyInfo(server, party); - _transferring.addAll(party.getMembersByUUID()); + + event.setCancelled(true); + + if (!party.getOwnerName().equalsIgnoreCase(player.getName())) + { + Lang.NOT_OWNER_SERVER.send(player); + return; + } + + MinecraftServer best = null; + int lowest = Integer.MAX_VALUE; + List serverList = Lists.newArrayList(_plugin.getPortal().getRepository().getServersByGroup(event.getServer().getName())); + for (MinecraftServer server : serverList) + { + int playercount = server.getPlayerCount(); + if (playercount < 20) + { + continue; + } + if (playercount < lowest) + { + lowest = playercount; + if (best == null) + { + best = server; + } + } + } + if (best == null) + { + best = serverList.get(new Random().nextInt(serverList.size())); + } + + party.sendMessage(F.main("Party", F.elem(player.getName()) + " is moving the party to " + F.elem(best.getName()))); + + requestServerJoin(best.getName(), party); } - /** - * Retrieve whether or not the player is currently transferring servers - * We wont need this information again, so calling a remove works fine. - * - * @param player The player - * @return true if the player is transferring servers - */ - public boolean isTransferring(Player player) + @EventHandler + public void onTransfer(ServerTransferEvent event) { - return _transferring.remove(player.getUniqueId()); + Player player = event.getPlayer(); + Party party = _plugin.getPartyByPlayer(player); + + if (party == null) + { + return; + } + + // If the server wants to kick the player, let's not stop it + if (event.getIntent() == Intent.KICK || event.getIntent() == Intent.FORCE_TRANSFER) + { + _plugin.removeFromParty(event.getPlayer(), PartyRemoveReason.KICKED); + + return; + } + + if (_pendingTransfers.containsKey(party.getUniqueId())) + { + return; + } + + event.setCancelled(true); + + if (event.getServer().toUpperCase().startsWith("CLANS-")) + { + party.sendMessage(F.main("Party", "You cannot join a Clans server while in a party!")); + return; + } + + if (!party.getOwnerName().equalsIgnoreCase(player.getName())) + { + Lang.NOT_OWNER_SERVER.send(player); + return; + } + + party.sendMessage(F.main("Party", F.elem(player.getName()) + " is moving the party to " + F.elem(event.getServer()))); + + requestServerJoin(event.getServer(), party); } + public void removePendingJoin(Party party) + { + _pendingTransfers.remove(party.getUniqueId()); + } + + @EventHandler + public void onJoin(PlayerJoinEvent event) + { + Player player = event.getPlayer(); + + if (_plugin.hasPendingJoin(player)) + { + Party pendingParty = _plugin.getPendingParty(player); + _plugin.removePendingJoin(player); + + if (pendingParty == null) + { + UtilPlayer.message(player, F.main("Party", "Uh oh. It seems that in the time it took for you to join this server, your inviter has disbanded their party")); + return; + } + + if (pendingParty.getOwner().getId().equals(event.getPlayer().getUniqueId())) + { + UtilPlayer.message(player, F.main("Party", "Welcome back! Your party is just as you've left it!")); + } + else + { + UtilPlayer.message(player, F.main("Party", "Welcome! Adding you to " + F.elem(pendingParty.getOwnerName()) + "'s party!")); + } + + _plugin.addToParty(player, pendingParty); + } + } + + @EventHandler + public void onQuit(PlayerQuitEvent event) + { + Player player = event.getPlayer(); + + Party party = _plugin.getPartyByPlayer(player); + + _plugin.getInviteManager().removeAll(player); + + if (party == null) + { + return; + } + + PartyRemoveReason reason = PartyRemoveReason.LEFT; + + _plugin.removeFromParty(player, reason); + } + + @EventHandler(ignoreCancelled = true) + public void onInteract(PlayerInteractEntityEvent event) + { + if (UtilItem.isSimilar(event.getPlayer().getItemInHand(), PartyManager.INTERFACE_ITEM, UtilItem.ItemAttribute.NAME)) + { + event.setCancelled(true); + event.getPlayer().updateInventory(); + CommandCenter.getCommands().get("party").Execute(event.getPlayer(), new String[0]); + } + } + + @EventHandler + public void onClick(PlayerInteractEvent event) + { + if (_twofactor.isAuthenticating(event.getPlayer())) + { + return; + } + if (UtilItem.isSimilar(event.getItem(), PartyManager.INTERFACE_ITEM, UtilItem.ItemAttribute.NAME)) + { + event.setCancelled(true); + CommandCenter.getCommands().get("party").Execute(event.getPlayer(), new String[0]); + } + } } diff --git a/Plugins/Mineplex.Core/src/mineplex/core/party/manager/PartyMethodManager.java b/Plugins/Mineplex.Core/src/mineplex/core/party/manager/PartyMethodManager.java deleted file mode 100644 index 73f739bd7..000000000 --- a/Plugins/Mineplex.Core/src/mineplex/core/party/manager/PartyMethodManager.java +++ /dev/null @@ -1,347 +0,0 @@ -package mineplex.core.party.manager; - -import com.google.common.collect.Lists; -import mineplex.core.common.util.F; -import mineplex.core.menu.Menu; -import mineplex.core.party.Lang; -import mineplex.core.party.Party; -import mineplex.core.party.PartyManager; -import mineplex.core.party.constants.PartyRemoveReason; -import mineplex.core.preferences.Preference; -import org.bukkit.Bukkit; -import org.bukkit.entity.Player; - -import java.util.List; -import java.util.UUID; - -/** - * Contains all methods used by the internal UI system - */ -public class PartyMethodManager -{ - - private PartyManager _plugin; - - public PartyMethodManager(PartyManager plugin) - { - _plugin = plugin; - } - - /** - * Invite a player to either a new party or existing one - * - * @param caller The player who initiated the request - * @param target The player's target - */ - public void invite(Player caller, String target) - { - Player possible = Bukkit.getPlayer(target); - Party party = _plugin.getParty(caller); - - if(target.equalsIgnoreCase(caller.getName())) - { - caller.sendMessage(F.main("Party", "You cannot invite yourself!")); - return; - } - - if(party != null) - { - if(!party.getOwner().equalsIgnoreCase(caller.getName())) - { - Lang.NOT_OWNER.send(caller); - return; - } - if(_plugin.getInviteManager().isInvitedTo(possible.getUniqueId(), party.getName())) - { - Lang.ALREADY_INVITED.send(caller, target); - return; - } - if(party.getMembers().contains(target)) - { - Lang.ALREADY_MEMBER.send(caller, target); - return; - } - if(_plugin.getParty(target) != null) - { - Lang.PLAYER_IN_DIFFERENT_PARTY.send(caller, target); - return; - } - if(party.getMembers().size() >= party.getSize()) - { - Lang.PARTY_FULL.send(caller); - return; - } - } - - //Same Server - if (possible != null) - { - if(!_plugin.getPreferencesManager().get(possible).isActive(Preference.PARTY_REQUESTS)) - { - caller.sendMessage(F.main("Party> ", F.name(target) + " is not accepting invites at this time.")); - return; - } - - if (party == null) - { - if(_plugin.getParty(target) != null) - { - Lang.PLAYER_IN_DIFFERENT_PARTY.send(caller, target); - return; - } - if(_plugin.getInviteManager().isInvitedTo(possible.getUniqueId(), caller.getName())) - { - Lang.ALREADY_INVITED.send(caller, target); - return; - } - Lang.INVITE_SUCCESS_PLAYER.send(caller, possible.getName()); - } else - { - Lang.SUCCESS_INVITE.send(party, caller.getName(), target); - } - - UUID uuid = possible.getUniqueId(); - - Lang.INVITE_RECEIVED.send(possible, caller.getName(), caller.getName()); - - _plugin.getInviteManager().inviteTo(uuid, caller.getName(), caller.getName(), _plugin.getServerName()); - - _plugin.getInviteManager().sendAcceptOrDeny(possible, caller.getName()); - return; - } - //Only perform this when I actually need to. - boolean can = Bukkit.getMaxPlayers() >= _plugin.getPlugin().getServer().getOnlinePlayers().size(); - if(!can) - { - Lang.SERVER_FULL.send(caller); - return; - } - - //Not on the same server - _plugin.getRedisManager().findAndInvite(target, caller.getName()); - } - - /** - * Responds to a pending invite - * - * @param caller The player who initiated the request - * @param target The player's target - * @param accept true If the player has accepted the invite - */ - public void respondToInvite(Player caller, String target, boolean accept) - { - if(_plugin.getParty(caller) != null) - { - Lang.ALREADY_IN.send(caller); - caller.sendMessage(F.main("Party", "Please leave your party before joining!")); - return; - } - - PartyInviteManager inviteManager = _plugin.getInviteManager(); - - if (!inviteManager.isInvitedTo(caller.getUniqueId(), target)) - { - //He isn't invited to this party. - Lang.NOT_INVITED.send(caller, target); - return; - } - if(!accept) - { - caller.sendMessage(F.main("Party", "You have denied the invite to " + F.name(target)) + "'s party."); - } - - inviteManager.respondToInvite(caller, target, accept); - } - - /** - * Kicks a player from the callers party - * - * @param caller The player who initiated the request - * @param target The player's target - */ - public void forceRemove(Player caller, String target) - { - Party party = _plugin.getParty(caller); - - if (party == null) - { - Lang.NO_PARTY.send(caller); - return; - } - - if (!party.getOwner().equalsIgnoreCase(caller.getName())) - { - Lang.NOT_OWNER.send(caller); - return; - } - - Player playerTarget = Bukkit.getPlayerExact(target); - - if (playerTarget == null) - { - Lang.NOT_MEMBER.send(caller, target); - return; - } - - Party targetParty = _plugin.getParty(playerTarget); - - if (targetParty == null ||!party.getMembers().contains(target)) - { - Lang.NOT_MEMBER.send(caller, target); - return; - } - - removeFromParty(playerTarget.getUniqueId(), PartyRemoveReason.KICKED); - - Lang.REMOVE_PLAYER_KICK.send(targetParty); - } - - /** - * Leaves the players current party if he is in one - * - * @param caller The player who wishes to leave his party - */ - public void leaveParty(Player caller) - { - Party party = _plugin.getParty(caller); - - if (party == null) - { - Lang.NO_PARTY.send(caller); - return; - } - - removeFromParty(caller.getUniqueId(), PartyRemoveReason.LEFT); - Lang.LEFT.send(caller); - } - - /** - * Disbands a players current party, assuming he is the leader - * - * @param caller The player who wishes to disband his party - */ - public void disband(Player caller) - { - Party party = _plugin.getParty(caller); - - if (party == null) - { - Lang.NO_PARTY.send(caller); - return; - } - - if (!party.getOwner().equalsIgnoreCase(caller.getName())) - { - Lang.NOT_OWNER.send(caller); - return; - } - caller.sendMessage(F.main("Party", "You have disbanded your party.")); - disbandParty(party); - } - - public void addToParty(UUID uuid, Party party) - { - _plugin.getPlayerParties().put(uuid, party); - Player player = Bukkit.getPlayer(uuid); - party.onPlayerAdd(player.getName()); - if(!party.getMembersByUUID().contains(uuid)) - { - party.getMembersByUUID().add(uuid); - } - } - - public void addToPartyOnTransfer(UUID uuid, Party party) - { - _plugin.getPlayerParties().put(uuid, party); - } - - public void addToParty(Player player, Party party) - { - addToParty(player.getUniqueId(), party); - } - - public void removeForTransfer(UUID uuid) - { - Party party = _plugin.getPlayerParties().remove(uuid); - if(party == null) - { - return; - } - String player = Bukkit.getPlayer(uuid).getName(); - party.onPlayerRemove(player, PartyRemoveReason.OTHER); - } - - public void removeFromParty(UUID uuid, PartyRemoveReason reason) - { - Party party = _plugin.getPlayerParties().remove(uuid); - if(party == null) - { - return; - } - - Player player = Bukkit.getPlayer(uuid); - - if(player.getOpenInventory() != null) - { - if (Menu.get(player.getUniqueId()) != null) - { - player.closeInventory(); - Menu.remove(player.getUniqueId()); - } - } - - if(reason == PartyRemoveReason.DISBANDED_BY_OWNER) - { - return; - } - party.getMembers().remove(player.getName()); - party.getMembersByUUID().remove(uuid); - party.onPlayerRemove(player.getName(), reason); - - int size = party.getMembers().size(); - if(size <= 1) - { - if(size == 0) - { - _plugin.removeParty(party); - return; - } - _plugin.getPlayerParties().remove(Bukkit.getPlayerExact(party.getMembers().get(0)).getUniqueId()); - party.onPlayerRemove(party.getMembers().get(0), PartyRemoveReason.DISBANDED); - _plugin.removeParty(party); - } - } - - public void removeFromParty(Player player, PartyRemoveReason reason) - { - removeFromParty(player.getUniqueId(), reason); - } - - public void disbandParty(Party party) - { - List members = Lists.newArrayList(party.getMembersByUUID()); - Lang.DISBANDED_BY_OWNER.send(party); - members.forEach(player -> removeFromParty(player, PartyRemoveReason.DISBANDED_BY_OWNER)); - party.getMembers().clear(); - party.getMembersByUUID().clear(); - _plugin.removeParty(party); - } - - public void transferOwner(String newOwner, String oldOwner) - { - Party party = _plugin.getParties().remove(oldOwner); - - if(party == null) - { - return; - } - - _plugin.getParties().put(newOwner, party); - party.setOwner(newOwner); - party.getMembers().remove(oldOwner); - party.getMembers().add(oldOwner); - UUID uuid = Bukkit.getPlayerExact(oldOwner).getUniqueId(); - party.getMembersByUUID().remove(uuid); - party.getMembersByUUID().add(uuid); - } -} diff --git a/Plugins/Mineplex.Core/src/mineplex/core/party/manager/PartyRedisManager.java b/Plugins/Mineplex.Core/src/mineplex/core/party/manager/PartyRedisManager.java index 9e0c9529d..4b782736d 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/party/manager/PartyRedisManager.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/party/manager/PartyRedisManager.java @@ -1,296 +1,205 @@ package mineplex.core.party.manager; -import com.google.common.collect.Maps; -import com.google.gson.Gson; -import com.google.gson.GsonBuilder; -import mineplex.core.common.util.F; -import mineplex.core.party.Lang; -import mineplex.core.party.Party; -import mineplex.core.party.PartyManager; -import mineplex.core.party.constants.InviteResponse; -import mineplex.core.party.constants.JoinResponseReason; -import mineplex.core.party.event.PartyDataReceivedEvent; -import mineplex.core.party.redis.PartyRedisListener; -import mineplex.core.party.redis.RedisMessageType; -import mineplex.core.preferences.Preference; -import org.bukkit.Bukkit; -import org.bukkit.entity.Player; -import org.bukkit.scheduler.BukkitRunnable; -import org.bukkit.scheduler.BukkitTask; -import redis.clients.jedis.Jedis; -import redis.clients.jedis.JedisPool; - -import java.util.List; +import java.util.HashMap; import java.util.Map; import java.util.UUID; -import static mineplex.core.party.redis.RedisMessageType.INVITE_PLAYER_REQUEST; -import static mineplex.core.party.redis.RedisMessageType.PARTY_INFO; +import org.bukkit.Bukkit; +import org.bukkit.entity.Player; +import org.bukkit.scheduler.BukkitTask; + +import mineplex.core.common.util.F; +import mineplex.core.common.util.UtilPlayer; +import mineplex.core.party.Party; +import mineplex.core.party.PartyManager; +import mineplex.core.party.rediscommands.PartyCrossServerInviteAccept; +import mineplex.core.party.rediscommands.PartyCrossServerInviteCommand; +import mineplex.core.party.rediscommands.PartyCrossServerInviteDeny; +import mineplex.core.party.rediscommands.PartyCrossServerInviteResponse; +import mineplex.core.portal.Portal; +import mineplex.core.preferences.Preference; +import mineplex.serverdata.commands.ServerCommandManager; -/** - * Redis system for Parties - */ public class PartyRedisManager { - protected final Gson GSON = new GsonBuilder().create(); - - protected static final String CHANNEL_BASE = "party-pubsub"; - protected static final String FIND_PLAYERS_CHANNEL = "party-player-finder"; - private final Map TASKS = Maps.newHashMap(); + private final Map> _pendingFindResponse = new HashMap<>(); private final PartyManager _plugin; - private final JedisPool _writePool; - private final String _channel; private final String _serverName; - public PartyRedisManager(PartyManager plugin, String serverName, JedisPool writePool, JedisPool readPool) + public PartyRedisManager(PartyManager plugin, String serverName) { _plugin = plugin; _serverName = serverName; - _writePool = writePool; - _channel = CHANNEL_BASE + "-" + serverName; - plugin.runAsync(() -> { - try (Jedis jedis = readPool.getResource()) - { - jedis.subscribe(new PartyRedisListener(this), _channel, FIND_PLAYERS_CHANNEL); - } - }); - } - - /** - * Send a message to a specific server - * - * @param server The destination server - * @param messageType The message to send - * @param args The arguments accompanying the request - */ - public void publish(String server, RedisMessageType messageType, String... args) - { - _plugin.runAsync(() -> { - try (Jedis jedis = _writePool.getResource()) - { - jedis.publish(CHANNEL_BASE + "-" + server, messageType.name() + "@" + messageType.format(args)); - } - }); - } - - /** - * Handle a message received on this server - * - * @param messageType The type of message received - * @param message The contents of the request - */ - public void handle(RedisMessageType messageType, String message) - { - if (messageType == PARTY_INFO) + ServerCommandManager.getInstance().registerCommandType(PartyCrossServerInviteCommand.class, command -> { - handlePartyInfo(message); - return; - } - String[] contents = message.split(","); - if (contents.length < 3) - { - return; - } - String first = contents[0]; - String second = contents[1]; - String third = contents[2]; - Bukkit.getScheduler().runTask(_plugin.getPlugin(), () -> { - switch (messageType) + _plugin.runSync(() -> { - case INVITE_PLAYER_REQUEST: - _plugin.getInviteManager().handleInviteRequest(second, third, first); - break; + Player player = Bukkit.getPlayerExact(command.getTarget()); - case INVITE_PLAYER_RESPONSE: - _plugin.getInviteManager().handleInviteResponse(first, second, UUID.fromString(third), InviteResponse.valueOf(contents[3].toUpperCase())); - break; - - case PLAYER_FIND_REQUEST: - Player player = Bukkit.getPlayerExact(second); - - if (player == null) - { - return; - } - - if(_plugin.getParty(player) != null) - { - publish(first, RedisMessageType.INVITE_PLAYER_ALREADY_IN_PARTY, _serverName, player.getName(), player.getUniqueId().toString(), third); - return; - } - - if(!_plugin.getPreferencesManager().get(player).isActive(Preference.PARTY_REQUESTS)) - { - publish(first, RedisMessageType.INVITE_PLAYER_NOT_ACCEPTING_INVITES, _serverName, player.getName(), player.getUniqueId().toString(), third); - return; - } - - publish(first, RedisMessageType.PLAYER_FIND_RESPONSE, _serverName, player.getName(), player.getUniqueId().toString(), third); - break; - - case INVITE_PLAYER_ALREADY_IN_PARTY: - handleAlreadyIn(second, contents); - break; - - case INVITE_PLAYER_NOT_ACCEPTING_INVITES: - handleNotAccepting(second, contents); - break; - - case PLAYER_FIND_RESPONSE: - UUID uuid = UUID.fromString(third); - cancelTask(second); - - Player inviter = Bukkit.getPlayerExact(contents[3]); - if (_plugin.getInviteManager().isInvitedTo(uuid, inviter.getName())) - { - Lang.ALREADY_INVITED.send(inviter, second); - return; - } - if (_plugin.getParty(inviter) == null) - { - Lang.INVITE_SUCCESS_PLAYER.send(inviter, second); - } else - { - Lang.SUCCESS_INVITE.send(_plugin.getParty(inviter), inviter.getName(), second); - } - _plugin.getInviteManager().inviteTo(uuid, inviter.getName(), inviter.getName(), _plugin.getServerName()); - publish(first, INVITE_PLAYER_REQUEST, _serverName, inviter.getName(), second); - break; - - case PREJOIN_SERVER_REQUEST: - _plugin.getJoinManager().handleJoinRequest(first, Integer.valueOf(third), second, Boolean.valueOf(contents[3])); - break; - - case PREJOIN_SERVER_RESPONSE: - _plugin.getJoinManager().handleJoinResponse(first, third, JoinResponseReason.valueOf(second.toUpperCase())); - break; - } - }); - - } - - private void handleNotAccepting(String second, String[] contents) - { - cancelTask(second); - - Player inviter = Bukkit.getPlayerExact(contents[3]); - inviter.sendMessage(F.main("Party", F.name(second) + " is not accepting invites at this time.")); - } - - private void handleAlreadyIn(String second, String[] contents) - { - cancelTask(second); - Player inviter = Bukkit.getPlayerExact(contents[3]); - Lang.ALREADY_IN.send(inviter, second); - } - - /** - * Initiates inviting a player who is no on the same server - * - * @param player The player target - * @param sender The sending player - */ - public void findAndInvite(String player, String sender) - { - Bukkit.getPlayerExact(sender).sendMessage(F.main("Party", "Locating " + F.elem(player) + "...")); - TASKS.put(player, new BukkitRunnable() - { - @Override - public void run() - { - if(!TASKS.containsKey(player)) + if (player == null || !player.isOnline()) { - cancel(); return; } - TASKS.remove(player); - Player senderPlayer = Bukkit.getPlayerExact(sender); - if (senderPlayer == null) - { - cancel(); - return; - } - if (Bukkit.getPlayerExact(player) != null) - { - cancel(); - return; - } - senderPlayer.sendMessage(F.main("Party", "Could not locate " + F.elem(player) + ".")); - } - }.runTaskLater(_plugin.getPlugin(), 20L * 5)); - _plugin.runAsync(() -> { - try (Jedis jedis = _writePool.getResource()) + if (!_plugin.getPreferencesManager().get(player).isActive(Preference.PARTY_REQUESTS)) + { + ServerCommandManager.getInstance().publishCommand(new PartyCrossServerInviteResponse(PartyCrossServerInviteResponse.Result.TARGET_NOT_ACCEPTING_INVITES, command, player)); + return; + } + + _plugin.getInviteManager().inviteTo(player.getName(), player.getUniqueId(), command.getRequesterName(), command.getRequesterUUID(), command.getPartyUUID(), command.getFromServer()); + + if (_plugin.getPartyByPlayer(player) != null) + { + ServerCommandManager.getInstance().publishCommand(new PartyCrossServerInviteResponse(PartyCrossServerInviteResponse.Result.SUCCESS_IN_PARTY, command, player)); + } + else + { + ServerCommandManager.getInstance().publishCommand(new PartyCrossServerInviteResponse(PartyCrossServerInviteResponse.Result.SUCCESS, command, player)); + } + }); + }); + + ServerCommandManager.getInstance().registerCommandType(PartyCrossServerInviteResponse.class, command -> + { + if (!command.getOrigin().wasSentFromThisServer()) + return; + + _plugin.runSync(() -> { - jedis.publish(FIND_PLAYERS_CHANNEL, RedisMessageType.PLAYER_FIND_REQUEST.format(_serverName, player, sender)); - } + Map pendingTasks = _pendingFindResponse.get(command.getOrigin().getRequesterUUID()); + + if (pendingTasks == null) + return; + + BukkitTask alertTask = pendingTasks.remove(command.getOrigin().getTarget()); + + if (alertTask == null) + return; + + alertTask.cancel(); + + Player caller = Bukkit.getPlayer(command.getOrigin().getRequesterUUID()); + + if (caller == null || !caller.isOnline()) + return; + + switch (command.getResult()) + { + case TARGET_NOT_ACCEPTING_INVITES: + UtilPlayer.message(caller, F.main("Party", "The player " + F.elem(command.getOrigin().getTarget()) + " is not accepting invites!")); + break; + case SUCCESS_IN_PARTY: + { + Party party = _plugin.getPartyByPlayer(command.getOrigin().getRequesterUUID()); + if (party == null) + { + // todo wat do + return; + } + if (!party.getOwnerName().equals(command.getOrigin().getRequesterName())) + { + //todo wat do + } + + _plugin.getInviteManager().inviteTo(command.getTargetName(), command.getTargetUUID(), command.getOrigin().getRequesterName(), command.getOrigin().getRequesterUUID(), command.getOrigin().getPartyUUID(), _plugin.getServerName()); + party.sendMessage(F.main("Party", F.elem(command.getOrigin().getRequesterName()) + " has invited " + F.elem(command.getTargetName()) + " to the party")); + break; + } + case SUCCESS: + { + Party party = _plugin.getPartyByPlayer(command.getOrigin().getRequesterUUID()); + if (party == null) + { + // todo wat do + return; + } + if (!party.getOwnerName().equals(command.getOrigin().getRequesterName())) + { + //todo wat do + } + + _plugin.getInviteManager().inviteTo(command.getTargetName(), command.getTargetUUID(), command.getOrigin().getRequesterName(), command.getOrigin().getRequesterUUID(), command.getOrigin().getPartyUUID(), _plugin.getServerName()); + party.sendMessage(F.main("Party", F.elem(command.getOrigin().getRequesterName()) + " has invited " + F.elem(command.getTargetName()) + " to the party")); + break; + } + case UNKNOWN: + UtilPlayer.message(caller, F.main("Party", "Uh oh, something went wrong while inviting " + F.elem(command.getTargetName()))); + break; + } + }); + }); + + ServerCommandManager.getInstance().registerCommandType(PartyCrossServerInviteAccept.class, command -> + { + _plugin.runSync(() -> + { + Player apparentSender = Bukkit.getPlayer(command.getInviterUUID()); + if (apparentSender != null && apparentSender.isOnline()) + { + _plugin.getInviteManager().removeInviteTo(command.getPlayerName(), command.getPartyUUID()); + + Party partyOfSender = _plugin.getPartyByPlayer(apparentSender); + if (partyOfSender == null) + { + //todo wat do + return; + } + if (!partyOfSender.getUniqueId().equals(command.getPartyUUID())) + { + //todo wat do + return; + } + + if (!partyOfSender.getOwnerName().equals(command.getInviterName())) + { + // todo ignore for now but wat do + } + + // we good + _plugin.putIntoPendingJoin(command.getPlayerUUID(), partyOfSender.getUniqueId()); + Portal.transferPlayer(command.getPlayerName(), _serverName); + } + }); + }); + + ServerCommandManager.getInstance().registerCommandType(PartyCrossServerInviteDeny.class, command -> + { + _plugin.runSync(() -> + { + Player apparentSender = Bukkit.getPlayer(command.getInviterUUID()); + if (apparentSender != null && apparentSender.isOnline()) + { + _plugin.getInviteManager().removeInviteTo(command.getPlayerName(), command.getPartyUUID()); + + Party partyOfSender = _plugin.getPartyByPlayer(apparentSender); + if (partyOfSender == null) + { + UtilPlayer.message(apparentSender, F.main("Party", F.elem(command.getPlayerName()) + " has denied your invite, but it seems you don't have a party anymore")); + return; + } + if (!partyOfSender.getUniqueId().equals(command.getPartyUUID())) + { + UtilPlayer.message(apparentSender, F.main("Party", F.elem(command.getPlayerName()) + " has denied your invite, but it seems that you've made a new party in the meantime")); + return; + } + + if (!partyOfSender.getOwnerName().equals(command.getInviterName())) + { + UtilPlayer.message(apparentSender, F.main("Party", F.elem(command.getPlayerName()) + " has denied your invite, but it seems that you are not the owner of the party anymore")); + return; + } + + UtilPlayer.message(apparentSender, F.main("Party", F.elem(command.getPlayerName()) + " has denied your invite")); + } + }); }); } - /** - * Serializes and sends a party to another server - * - * @param server The destination server - * @param party The party to be sent - */ - public void sendPartyInfo(String server, Party party) + public Map> getPendingFindResponse() { - publish(server, PARTY_INFO, GSON.toJson(party)); - List members = party.getMembersByUUID(); - party.getMembersByUUID().forEach(uuid -> _plugin.getMethodManager().removeForTransfer(uuid)); - members.stream().map(Bukkit::getPlayer).forEach(player1 -> - { - player1.leaveVehicle(); - player1.eject(); - _plugin.getPortal().sendPlayer(player1, server); - }); - _plugin.removeParty(party); - } - - /** - * Deserialize and store a received party's information - * @param json - */ - public void handlePartyInfo(String json) - { - new BukkitRunnable() - { - @Override - public void run() - { - Party party = GSON.fromJson(json, Party.class); - _plugin.addParty(party); - party.getMembersByUUID().forEach(s -> _plugin.getMethodManager().addToPartyOnTransfer(s, party)); - Bukkit.getServer().getPluginManager().callEvent(new PartyDataReceivedEvent(party)); - } - }.runTaskLater(_plugin.getPlugin(), 10L); - } - - /** - * @return This servers name - */ - public String getServerName() - { - return _serverName; - } - - /** - * @return The channel constant for finding players - */ - public String getFinder() - { - return FIND_PLAYERS_CHANNEL; - } - - public void cancelTask(String player) - { - BukkitTask task = TASKS.remove(player); - - if (task != null) - { - task.cancel(); - } + return _pendingFindResponse; } } \ No newline at end of file diff --git a/Plugins/Mineplex.Core/src/mineplex/core/party/redis/PartyRedisListener.java b/Plugins/Mineplex.Core/src/mineplex/core/party/redis/PartyRedisListener.java deleted file mode 100644 index f4c3b4d20..000000000 --- a/Plugins/Mineplex.Core/src/mineplex/core/party/redis/PartyRedisListener.java +++ /dev/null @@ -1,30 +0,0 @@ -package mineplex.core.party.redis; - -import mineplex.core.party.manager.PartyRedisManager; -import redis.clients.jedis.JedisPubSub; - -/** - * Handles incoming messages into the Party Redis System - */ -public class PartyRedisListener extends JedisPubSub -{ - - private final PartyRedisManager _redisManager; - - public PartyRedisListener(PartyRedisManager redisManager) - { - _redisManager = redisManager; - } - - @Override - public void onMessage(String channel, String message) - { - if(channel.equalsIgnoreCase(_redisManager.getFinder())) - { - _redisManager.handle(RedisMessageType.PLAYER_FIND_REQUEST, message); - return; - } - RedisMessageType type = RedisMessageType.valueOf(message.split("@")[0].toUpperCase()); - _redisManager.handle(type, message.split("@")[1]); - } -} diff --git a/Plugins/Mineplex.Core/src/mineplex/core/party/redis/RedisMessageType.java b/Plugins/Mineplex.Core/src/mineplex/core/party/redis/RedisMessageType.java deleted file mode 100644 index 533f62c75..000000000 --- a/Plugins/Mineplex.Core/src/mineplex/core/party/redis/RedisMessageType.java +++ /dev/null @@ -1,63 +0,0 @@ -package mineplex.core.party.redis; - -/** - * Messages sent within the redis messaging system - * And their corresponding arguments - */ -public enum RedisMessageType -{ - - //Message: SERVER_FROM,PLAYER_TARGET,PLAYER_SENDER - PLAYER_FIND_REQUEST(1, "{0},{1},{2}"), - //Message: SERVER_ON,PLAYER_TARGET_NAME,PLAYER_TARGET_UUID,PLAYER_SENDER - PLAYER_FIND_RESPONSE(2, "{0},{1},{2},{3}"), - - //Message: SERVER_FROM,PLAYER_SENDER,PLAYER_TARGET - INVITE_PLAYER_REQUEST(3, "{0},{1},{2}"), - //Message: PLAYER_SENDER,PLAYER_TARGET_NAME,PLAYER_TARGET_UUID,RESPONSE - INVITE_PLAYER_RESPONSE(4, "{0},{1},{2},{3}"), - //Message: PLAYER_SENDER,PLAYER_TARGET_NAME,PLAYER_TARGET_UUID,RESPONSE - INVITE_PLAYER_ALREADY_IN_PARTY(5, "{0},{1},{2},{3}"), - //Message: PLAYER_SENDER,PLAYER_TARGET_NAME,PLAYER_TARGET_UUID,RESPONSE - INVITE_PLAYER_NOT_ACCEPTING_INVITES(5, "{0},{1},{2},{3}"), - - //Message: SERVER_FROM,PLAYER_INITIATING,PARTY_SIZE,_CAN_JOIN_FULL - PREJOIN_SERVER_REQUEST(6, "{0},{1},{2},{3}"), - //Message: PLAYER_INITIATING,REASON,SERVER - PREJOIN_SERVER_RESPONSE(7, "{0},{1},{2}"), - - //Message: JSON Party - PARTY_INFO(8, "{0}"), - TEST_CONN(9, "{0}") - ; - - private int _id; - private String _contents; - - RedisMessageType(int id, String contents) - { - _id = id; - _contents = contents; - } - - public int getId() - { - return _id; - } - - /** - * Format this message - * @param args The contents to be sent with this message - * @return A formatted message - */ - public String format(String... args) - { - String message = _contents; - for(int i = 0; i < args.length; i++) - { - message = message.replace("{" + i + "}", args[i]); - } - return message; - } - -} diff --git a/Plugins/Mineplex.Core/src/mineplex/core/party/rediscommands/PartyCrossServerInviteAccept.java b/Plugins/Mineplex.Core/src/mineplex/core/party/rediscommands/PartyCrossServerInviteAccept.java new file mode 100644 index 000000000..b6c7e80dc --- /dev/null +++ b/Plugins/Mineplex.Core/src/mineplex/core/party/rediscommands/PartyCrossServerInviteAccept.java @@ -0,0 +1,50 @@ +package mineplex.core.party.rediscommands; + +import java.util.UUID; + +import mineplex.serverdata.commands.ServerCommand; + +public class PartyCrossServerInviteAccept extends ServerCommand +{ + private final String _playerName; + private final UUID _playerUUID; + + private final String _inviterName; + private final UUID _inviterUUID; + + private final UUID _partyUUID; + + public PartyCrossServerInviteAccept(String playerName, UUID playerUUID, String inviterName, UUID inviterUUID, UUID partyUUID) + { + _playerName = playerName; + _playerUUID = playerUUID; + _inviterName = inviterName; + _inviterUUID = inviterUUID; + _partyUUID = partyUUID; + } + + public String getPlayerName() + { + return _playerName; + } + + public UUID getPlayerUUID() + { + return _playerUUID; + } + + public String getInviterName() + { + return _inviterName; + } + + public UUID getInviterUUID() + { + return _inviterUUID; + } + + public UUID getPartyUUID() + { + return _partyUUID; + } +} diff --git a/Plugins/Mineplex.Core/src/mineplex/core/party/rediscommands/PartyCrossServerInviteCommand.java b/Plugins/Mineplex.Core/src/mineplex/core/party/rediscommands/PartyCrossServerInviteCommand.java new file mode 100644 index 000000000..d35bc1a0b --- /dev/null +++ b/Plugins/Mineplex.Core/src/mineplex/core/party/rediscommands/PartyCrossServerInviteCommand.java @@ -0,0 +1,44 @@ +package mineplex.core.party.rediscommands; + +import java.util.UUID; + +import org.bukkit.entity.Player; + +import mineplex.core.party.Party; +import mineplex.serverdata.commands.ServerCommand; + +public class PartyCrossServerInviteCommand extends ServerCommand +{ + private final String _requesterName; + private final UUID _requesterUUID; + private final String _target; + private final UUID _partyUUID; + + public PartyCrossServerInviteCommand(Player caller, String target, Party destParty) + { + _target = target; + _requesterName = caller.getName(); + _requesterUUID = caller.getUniqueId(); + _partyUUID = destParty.getUniqueId(); + } + + public String getTarget() + { + return _target; + } + + public String getRequesterName() + { + return _requesterName; + } + + public UUID getRequesterUUID() + { + return _requesterUUID; + } + + public UUID getPartyUUID() + { + return _partyUUID; + } +} diff --git a/Plugins/Mineplex.Core/src/mineplex/core/party/rediscommands/PartyCrossServerInviteDeny.java b/Plugins/Mineplex.Core/src/mineplex/core/party/rediscommands/PartyCrossServerInviteDeny.java new file mode 100644 index 000000000..cfc37736b --- /dev/null +++ b/Plugins/Mineplex.Core/src/mineplex/core/party/rediscommands/PartyCrossServerInviteDeny.java @@ -0,0 +1,50 @@ +package mineplex.core.party.rediscommands; + +import java.util.UUID; + +import mineplex.serverdata.commands.ServerCommand; + +public class PartyCrossServerInviteDeny extends ServerCommand +{ + private final String _playerName; + private final UUID _playerUUID; + + private final String _inviterName; + private final UUID _inviterUUID; + + private final UUID _partyUUID; + + public PartyCrossServerInviteDeny(String playerName, UUID playerUUID, String inviterName, UUID inviterUUID, UUID partyUUID) + { + _playerName = playerName; + _playerUUID = playerUUID; + _inviterName = inviterName; + _inviterUUID = inviterUUID; + _partyUUID = partyUUID; + } + + public String getPlayerName() + { + return _playerName; + } + + public UUID getPlayerUUID() + { + return _playerUUID; + } + + public String getInviterName() + { + return _inviterName; + } + + public UUID getInviterUUID() + { + return _inviterUUID; + } + + public UUID getPartyUUID() + { + return _partyUUID; + } +} diff --git a/Plugins/Mineplex.Core/src/mineplex/core/party/rediscommands/PartyCrossServerInviteResponse.java b/Plugins/Mineplex.Core/src/mineplex/core/party/rediscommands/PartyCrossServerInviteResponse.java new file mode 100644 index 000000000..bfc49a223 --- /dev/null +++ b/Plugins/Mineplex.Core/src/mineplex/core/party/rediscommands/PartyCrossServerInviteResponse.java @@ -0,0 +1,58 @@ +package mineplex.core.party.rediscommands; + +import java.util.UUID; + +import org.bukkit.entity.Player; + +import com.google.gson.annotations.SerializedName; + +import mineplex.serverdata.commands.ServerCommand; + +public class PartyCrossServerInviteResponse extends ServerCommand +{ + private final Result _result; + private final PartyCrossServerInviteCommand _origin; + + private final String _targetName; + private final UUID _targetUUID; + + public PartyCrossServerInviteResponse(Result result, PartyCrossServerInviteCommand origin, Player target) + { + _result = result; + _origin = origin; + + _targetName = target.getName(); + _targetUUID = target.getUniqueId(); + } + + public Result getResult() + { + return _result == null ? Result.UNKNOWN : _result; + } + + public PartyCrossServerInviteCommand getOrigin() + { + return _origin; + } + + public String getTargetName() + { + return _targetName; + } + + public UUID getTargetUUID() + { + return _targetUUID; + } + + public enum Result + { + @SerializedName("success-in-party") + SUCCESS_IN_PARTY, + @SerializedName("not-accepting-invites") + TARGET_NOT_ACCEPTING_INVITES, + @SerializedName("success") + SUCCESS, + UNKNOWN + } +} diff --git a/Plugins/Mineplex.Core/src/mineplex/core/party/rediscommands/PartyTransferRequest.java b/Plugins/Mineplex.Core/src/mineplex/core/party/rediscommands/PartyTransferRequest.java new file mode 100644 index 000000000..b647deef4 --- /dev/null +++ b/Plugins/Mineplex.Core/src/mineplex/core/party/rediscommands/PartyTransferRequest.java @@ -0,0 +1,53 @@ +package mineplex.core.party.rediscommands; + +import java.util.List; +import java.util.UUID; + +import com.mojang.authlib.GameProfile; + +import mineplex.serverdata.commands.ServerCommand; + +public class PartyTransferRequest extends ServerCommand +{ + private final UUID _partyUUID; + private final List _allMembers; + private final List _unrankedMembers; + private final boolean _canJoinFullServers; + + private final GameProfile _ownerGameProfile; + + public PartyTransferRequest(UUID partyUUID, GameProfile ownerGameProfile, List allMembers, List unrankedMembers, boolean canJoinFullServers, String destServer) + { + super(destServer); + _partyUUID = partyUUID; + _ownerGameProfile = ownerGameProfile; + _allMembers = allMembers; + _unrankedMembers = unrankedMembers; + _canJoinFullServers = canJoinFullServers; + } + + public UUID getPartyUUID() + { + return _partyUUID; + } + + public List getAllMembers() + { + return _allMembers; + } + + public List getUnrankedMembers() + { + return _unrankedMembers; + } + + public boolean isCanJoinFullServers() + { + return _canJoinFullServers; + } + + public GameProfile getOwnerGameProfile() + { + return _ownerGameProfile; + } +} diff --git a/Plugins/Mineplex.Core/src/mineplex/core/party/rediscommands/PartyTransferResponse.java b/Plugins/Mineplex.Core/src/mineplex/core/party/rediscommands/PartyTransferResponse.java new file mode 100644 index 000000000..ee881e537 --- /dev/null +++ b/Plugins/Mineplex.Core/src/mineplex/core/party/rediscommands/PartyTransferResponse.java @@ -0,0 +1,36 @@ +package mineplex.core.party.rediscommands; + +import com.google.gson.annotations.SerializedName; + +import mineplex.serverdata.commands.ServerCommand; + +public class PartyTransferResponse extends ServerCommand +{ + private final PartyTransferRequest _origin; + private final Result _result; + + public PartyTransferResponse(PartyTransferRequest origin, Result result) + { + _origin = origin; + _result = result; + } + + public PartyTransferRequest getOrigin() + { + return _origin; + } + + public Result getResult() + { + return _result; + } + + public enum Result + { + @SerializedName("not-enough-room") + NOT_ENOUGH_ROOM, + @SerializedName("success") + SUCCESS, + UNKNOWN + } +} diff --git a/Plugins/Mineplex.Core/src/mineplex/core/party/ui/PartyMenu.java b/Plugins/Mineplex.Core/src/mineplex/core/party/ui/PartyMenu.java index e66709c56..3c009de31 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/party/ui/PartyMenu.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/party/ui/PartyMenu.java @@ -13,15 +13,8 @@ import org.bukkit.Material; */ public abstract class PartyMenu extends Menu { - - protected static final Button PURCHASE_MORE_SLOTS = new IconButton(new ItemBuilder(Material.REDSTONE_BLOCK) - .setTitle(C.cRed + C.Bold + "Locked!") - .setLore(" ", C.cGray + "Purchase a rank @ mineplex.com/shop", C.cGray + "Purchasing a rank increases your", C.cGray + "party size to allow 10 people!") - .build()); - public PartyMenu(String name, PartyManager plugin) { super(name, plugin); } - } diff --git a/Plugins/Mineplex.Core/src/mineplex/core/party/ui/button/PartyMemberIcon.java b/Plugins/Mineplex.Core/src/mineplex/core/party/ui/button/PartyMemberIcon.java index 5be48d2c9..fd15e6a97 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/party/ui/button/PartyMemberIcon.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/party/ui/button/PartyMemberIcon.java @@ -1,36 +1,52 @@ package mineplex.core.party.ui.button; -import mineplex.core.common.util.C; -import mineplex.core.common.util.UtilServer; -import mineplex.core.itemstack.ItemBuilder; -import mineplex.core.party.Party; -import mineplex.core.party.event.PartyMemberKickGUIEvent; -import mineplex.core.party.ui.button.tools.PartyButton; -import org.bukkit.ChatColor; +import org.bukkit.Bukkit; import org.bukkit.Material; import org.bukkit.entity.Player; import org.bukkit.event.inventory.ClickType; import org.bukkit.inventory.ItemStack; +import com.mojang.authlib.GameProfile; + +import mineplex.core.Managers; +import mineplex.core.common.util.C; +import mineplex.core.itemstack.ItemBuilder; +import mineplex.core.menu.Menu; +import mineplex.core.party.Lang; +import mineplex.core.party.Party; +import mineplex.core.party.PartyManager; +import mineplex.core.party.constants.PartyRemoveReason; +import mineplex.core.party.ui.button.tools.PartyButton; +import mineplex.core.utils.UtilGameProfile; + /** * The button representing a Party member. */ public class PartyMemberIcon extends PartyButton { + private final String _name; private ItemStack _itemStack; - public PartyMemberIcon(String player, Party party, boolean owner) + public PartyMemberIcon(GameProfile playerProfile, Party party, boolean owner, boolean isOwnerView) { super(null, party, null); ItemBuilder builder = new ItemBuilder(Material.SKULL_ITEM, 1, (byte) 3) - .setTitle(C.cYellow + player) - .setPlayerHead(player); - if(owner) + .setTitle(C.cYellow + playerProfile.getName()); + if (owner) { builder.addLore(" ", C.cGreenB + "Leader"); } + + if (!owner && isOwnerView) + { + builder.addLore(" ", C.cRed + "Shift-Right-Click to kick"); + } _itemStack = builder.build(); + + UtilGameProfile.setGameProfile(playerProfile, _itemStack); + + _name = playerProfile.getName(); } @Override @@ -39,29 +55,23 @@ public class PartyMemberIcon extends PartyButton return _itemStack; } - /** - * Called when a player clicks one of the member icons - * - * @param clicker The player who clicked - * @param clicked The itemstack he clicked - */ - public void onClick(Player clicker, ItemStack clicked) - { - if (!getParty().isOwnerKickMode()) - { - return; - } - if(!getParty().getOwner().equalsIgnoreCase(clicker.getName())) - { - return; - } - String name = ChatColor.stripColor(clicked.getItemMeta().getDisplayName()); - UtilServer.getPluginManager().callEvent(new PartyMemberKickGUIEvent(getParty(), name, clicker)); - } - @Override public void onClick(Player player, ClickType clickType) { + if (!getParty().getOwnerName().equalsIgnoreCase(player.getName())) + { + return; + } + if (clickType == ClickType.SHIFT_RIGHT) + { + Player target = Bukkit.getPlayerExact(_name); + if (target != null && !getParty().isOwner(target) && target != player && getParty().isMember(target)) + { + Lang.REMOVED.send(target); + Managers.require(PartyManager.class).removeFromParty(target, PartyRemoveReason.KICKED); + Menu.get(player.getUniqueId()).resetAndUpdate(); + } + } } } diff --git a/Plugins/Mineplex.Core/src/mineplex/core/party/ui/button/tools/LeavePartyButton.java b/Plugins/Mineplex.Core/src/mineplex/core/party/ui/button/tools/LeavePartyButton.java index 174a46ab6..1b746ecc0 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/party/ui/button/tools/LeavePartyButton.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/party/ui/button/tools/LeavePartyButton.java @@ -32,7 +32,7 @@ public class LeavePartyButton extends Button { return; } - getPlugin().getMethodManager().leaveParty(player); + getPlugin().leaveParty(player); player.closeInventory(); } diff --git a/Plugins/Mineplex.Core/src/mineplex/core/party/ui/button/tools/invite/DenyAllButton.java b/Plugins/Mineplex.Core/src/mineplex/core/party/ui/button/tools/invite/DenyAllButton.java index 7ae041d6f..7afa2d395 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/party/ui/button/tools/invite/DenyAllButton.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/party/ui/button/tools/invite/DenyAllButton.java @@ -1,15 +1,16 @@ package mineplex.core.party.ui.button.tools.invite; -import mineplex.core.common.util.C; -import mineplex.core.menu.Button; -import mineplex.core.itemstack.ItemBuilder; -import mineplex.core.party.PartyManager; -import mineplex.core.party.ui.menus.PartyInvitesMenu; import org.bukkit.Material; import org.bukkit.entity.Player; import org.bukkit.event.inventory.ClickType; import org.bukkit.inventory.ItemStack; +import mineplex.core.common.util.C; +import mineplex.core.itemstack.ItemBuilder; +import mineplex.core.menu.Button; +import mineplex.core.party.PartyManager; +import mineplex.core.party.ui.menus.PartyInvitesMenu; + /** * Deny's all invites currently pending */ @@ -17,9 +18,9 @@ public class DenyAllButton extends Button { private static final ItemStack ITEM = new ItemBuilder(Material.REDSTONE_BLOCK) - .setTitle(C.cRed + "Delete all Invites") - .setLore(" ", C.cGray + "This will remove all pending invites.") - .build(); + .setTitle(C.cRed + "Delete all Invites") + .setLore(" ", C.cGray + "This will remove all pending invites.") + .build(); public DenyAllButton(PartyManager plugin) { @@ -29,7 +30,7 @@ public class DenyAllButton extends Button @Override public void onClick(Player player, ClickType clickType) { - getPlugin().getInviteManager().getAllInvites(player).forEach(inviteData -> getPlugin().getMethodManager().respondToInvite(player, inviteData.getInvitedTo(), false)); + getPlugin().getInviteManager().getAllInvites(player).forEach(inviteData -> getPlugin().denyInviteBySender(player, inviteData.getInviterName())); new PartyInvitesMenu(getPlugin()).open(player); } } \ No newline at end of file diff --git a/Plugins/Mineplex.Core/src/mineplex/core/party/ui/button/tools/invite/InviteButton.java b/Plugins/Mineplex.Core/src/mineplex/core/party/ui/button/tools/invite/InviteButton.java index 01478575f..2dfe161e8 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/party/ui/button/tools/invite/InviteButton.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/party/ui/button/tools/invite/InviteButton.java @@ -1,12 +1,13 @@ package mineplex.core.party.ui.button.tools.invite; +import org.bukkit.Material; +import org.bukkit.entity.Player; +import org.bukkit.event.inventory.ClickType; + import mineplex.core.common.util.C; import mineplex.core.itemstack.ItemBuilder; import mineplex.core.menu.Button; import mineplex.core.party.PartyManager; -import org.bukkit.Material; -import org.bukkit.entity.Player; -import org.bukkit.event.inventory.ClickType; /** * Represents an invitation, to which a player can accept or deny @@ -19,23 +20,24 @@ public class InviteButton extends Button public InviteButton(String name, PartyManager plugin) { super(new ItemBuilder(Material.SKULL_ITEM) - .setTitle(C.cYellow + name) - .setLore(" ", C.cYellow + "Right-Click " + C.cGray + "to deny the invite", C.cYellow + "Left-Click " + C.cGray + "to accept the invite") - .setData((short) 3) - .setPlayerHead(name) - .build(), plugin); + .setTitle(C.cYellow + name) + .setLore(" ", C.cYellow + "Right-Click " + C.cGray + "to deny the invite", C.cYellow + "Left-Click " + C.cGray + "to accept the invite") + .setData((short) 3) + .setPlayerHead(name) + .build(), plugin); _name = name; } @Override public void onClick(Player player, ClickType clickType) { - if(clickType == ClickType.LEFT) + if (clickType == ClickType.LEFT) { - getPlugin().getMethodManager().respondToInvite(player, _name, true); - } else if(clickType == ClickType.RIGHT) + getPlugin().acceptInviteBySender(player, _name); + } + else if (clickType == ClickType.RIGHT) { - getPlugin().getMethodManager().respondToInvite(player, _name, false); + getPlugin().denyInviteBySender(player, _name); } player.closeInventory(); } diff --git a/Plugins/Mineplex.Core/src/mineplex/core/party/ui/button/tools/invite/NextPageButton.java b/Plugins/Mineplex.Core/src/mineplex/core/party/ui/button/tools/invite/NextPageButton.java index 386cf1962..0412c987d 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/party/ui/button/tools/invite/NextPageButton.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/party/ui/button/tools/invite/NextPageButton.java @@ -42,7 +42,7 @@ public class NextPageButton extends Button List data = _menu.getDataForPage(_menu.getCurrentPage()); for(int i = 0; i < data.size(); i++) { - _menu.setButton(i + _menu.getStartingSlot(), new InviteButton(data.get(i).getInvitedTo(), getPlugin())); + _menu.setButton(i + _menu.getStartingSlot(), new InviteButton(data.get(i).getInviterName(), getPlugin())); } _menu.update(); } diff --git a/Plugins/Mineplex.Core/src/mineplex/core/party/ui/button/tools/invite/PrevPageButton.java b/Plugins/Mineplex.Core/src/mineplex/core/party/ui/button/tools/invite/PrevPageButton.java index e0bf5d315..91d91806b 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/party/ui/button/tools/invite/PrevPageButton.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/party/ui/button/tools/invite/PrevPageButton.java @@ -41,7 +41,7 @@ public class PrevPageButton extends Button List data = _menu.getDataForPage(_menu.getCurrentPage()); for(int i = 0; i < data.size(); i++) { - _menu.setButton(i + _menu.getStartingSlot(), new InviteButton(data.get(i).getInvitedTo(), getPlugin())); + _menu.setButton(i + _menu.getStartingSlot(), new InviteButton(data.get(i).getInviterName(), getPlugin())); } _menu.update(); } diff --git a/Plugins/Mineplex.Core/src/mineplex/core/party/ui/button/tools/owner/AddPlayerButton.java b/Plugins/Mineplex.Core/src/mineplex/core/party/ui/button/tools/owner/AddPlayerButton.java index 72bad2bed..ec2a4e0c6 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/party/ui/button/tools/owner/AddPlayerButton.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/party/ui/button/tools/owner/AddPlayerButton.java @@ -19,7 +19,7 @@ public class AddPlayerButton extends PartyButton private static final ItemStack ITEM = new ItemBuilder(Material.SIGN) .setTitle(C.cYellow + "Invite a Player") - .setLore(" ", C.cGray + "Brings up the Inviting Anvil!", C.cGray + "Simply type a player's name", C.cGray + "and click the paper to invite him") + .setLore(" ", C.cGray + "Brings up the Inviting Anvil!", C.cGray + "Simply type a player's name", C.cGray + "and click the paper to invite them") .build(); public AddPlayerButton(PartyManager plugin, Party party) diff --git a/Plugins/Mineplex.Core/src/mineplex/core/party/ui/button/tools/owner/DisbandPartyButton.java b/Plugins/Mineplex.Core/src/mineplex/core/party/ui/button/tools/owner/DisbandPartyButton.java index ce2afa915..5105dd77a 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/party/ui/button/tools/owner/DisbandPartyButton.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/party/ui/button/tools/owner/DisbandPartyButton.java @@ -32,7 +32,7 @@ public class DisbandPartyButton extends Button { return; } - getPlugin().getMethodManager().disband(player); + getPlugin().disband(player); player.closeInventory(); } } \ No newline at end of file diff --git a/Plugins/Mineplex.Core/src/mineplex/core/party/ui/button/tools/owner/KickPlayerButton.java b/Plugins/Mineplex.Core/src/mineplex/core/party/ui/button/tools/owner/KickPlayerButton.java deleted file mode 100644 index 48069adf2..000000000 --- a/Plugins/Mineplex.Core/src/mineplex/core/party/ui/button/tools/owner/KickPlayerButton.java +++ /dev/null @@ -1,56 +0,0 @@ -package mineplex.core.party.ui.button.tools.owner; - -import mineplex.core.common.util.C; -import mineplex.core.common.util.F; -import mineplex.core.itemstack.ItemBuilder; -import mineplex.core.party.Party; -import mineplex.core.party.ui.PartyMenu; -import mineplex.core.party.ui.button.tools.PartyButton; -import org.bukkit.Material; -import org.bukkit.entity.Player; -import org.bukkit.event.inventory.ClickType; -import org.bukkit.inventory.ItemStack; - -/** - * Toggles {@code {@link Party#isOwnerKickMode()}} - */ -public class KickPlayerButton extends PartyButton -{ - - private static final ItemStack ITEM_OFF = new ItemBuilder(Material.IRON_AXE) - .setTitle(C.cYellow + "Kick Players") - .setLore(" ", F.elem("Right-Click") + " to enter " + C.cGreen + "Kick Mode", - C.cGray + "While activated, click on a player's head", C.cGray + "to remove them from the party") - .build(); - - private static final ItemStack ITEM_ON = new ItemBuilder(Material.IRON_AXE) - .setTitle(C.cYellow + "Kick Players") - .setLore(" ", F.elem("Right-Click") + " to leave " + C.cRed + "Kick Mode", - C.cGray + "While activated, click on a player's head", C.cGray + "to remove them from the party") - .setGlow(true) - .build(); - - - public KickPlayerButton(Party party) - { - super(ITEM_OFF, party, null); - } - - @Override - public void onClick(Player player, ClickType clickType) - { - if(clickType != ClickType.RIGHT) - { - return; - } - getParty().setOwnerKickMode(!getParty().isOwnerKickMode()); - if (getParty().isOwnerKickMode()) - { - setItemStack(ITEM_ON); - } else - { - setItemStack(ITEM_OFF); - } - PartyMenu.get(player.getUniqueId()).update(); - } -} \ No newline at end of file diff --git a/Plugins/Mineplex.Core/src/mineplex/core/party/ui/button/tools/owner/SelectServerButton.java b/Plugins/Mineplex.Core/src/mineplex/core/party/ui/button/tools/owner/SelectServerButton.java index 5c2fed842..676263b1d 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/party/ui/button/tools/owner/SelectServerButton.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/party/ui/button/tools/owner/SelectServerButton.java @@ -1,15 +1,16 @@ package mineplex.core.party.ui.button.tools.owner; +import org.bukkit.Material; +import org.bukkit.entity.Player; +import org.bukkit.event.inventory.ClickType; +import org.bukkit.inventory.ItemStack; + import mineplex.core.common.util.C; import mineplex.core.common.util.UtilServer; import mineplex.core.itemstack.ItemBuilder; import mineplex.core.party.Party; import mineplex.core.party.event.PartySelectServerEvent; import mineplex.core.party.ui.button.tools.PartyButton; -import org.bukkit.Material; -import org.bukkit.entity.Player; -import org.bukkit.event.inventory.ClickType; -import org.bukkit.inventory.ItemStack; /** * Opens the server selection menu @@ -18,9 +19,9 @@ public class SelectServerButton extends PartyButton { private static final ItemStack ITEM = new ItemBuilder(Material.COMPASS) - .setTitle(C.cYellow + "Select Server") - .setLore(" ", C.cGray + "Brings up the Server Selection GUI") - .build(); + .setTitle(C.cYellow + "Select Server") + .setLore(" ", C.cGray + "Brings up the Server Selection GUI") + .build(); public SelectServerButton(Party party) { diff --git a/Plugins/Mineplex.Core/src/mineplex/core/party/ui/menus/PartyInvitesMenu.java b/Plugins/Mineplex.Core/src/mineplex/core/party/ui/menus/PartyInvitesMenu.java index fbba8908a..ae7cf1252 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/party/ui/menus/PartyInvitesMenu.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/party/ui/menus/PartyInvitesMenu.java @@ -20,6 +20,8 @@ import org.bukkit.Material; import org.bukkit.Sound; import org.bukkit.entity.Player; +import java.util.Comparator; +import java.util.HashMap; import java.util.List; import java.util.Map; import java.util.stream.Collectors; @@ -69,7 +71,7 @@ public class PartyInvitesMenu extends PartyMenu buttons[BACK_BUTTON_SLOT] = new BackButton(getPlugin()); - List all = (List) getPlugin().getInviteManager().getAllInvites(player); + List all = getPlugin().getInviteManager().getAllInvites(player); if (all == null || all.isEmpty()) { @@ -81,6 +83,8 @@ public class PartyInvitesMenu extends PartyMenu return pane(buttons); } + all.sort(Comparator.comparing(InviteData::getInviterName)); + buttons[DENY_ALL_BUTTON_SLOW] = new DenyAllButton(getPlugin()); if (_filterBy == null || _filterBy.isEmpty()) @@ -94,7 +98,7 @@ public class PartyInvitesMenu extends PartyMenu if (showFiltered) { - all = all.stream().filter(inviteData -> inviteData.getInvitedTo().contains(_filterBy)).collect(Collectors.toList()); + all = all.stream().filter(inviteData -> inviteData.getInviterName().contains(_filterBy)).collect(Collectors.toList()); } if (showFiltered && all.isEmpty()) @@ -125,7 +129,7 @@ public class PartyInvitesMenu extends PartyMenu buttons[NEXT_PAGE_SLOT] = new NextPageButton(this, getPlugin()); _pagesNeeded = pagesNeeded; - _pagesOfData = Maps.newHashMap(); + _pagesOfData = new HashMap<>(); int page = 0; @@ -150,7 +154,7 @@ public class PartyInvitesMenu extends PartyMenu { for (int i = 0; i < all.size(); i++) { - String to = all.get(i).getInvitedTo(); + String to = all.get(i).getInviterName(); buttons[STARTING_SLOT + i] = new InviteButton(to, getPlugin()); } } diff --git a/Plugins/Mineplex.Core/src/mineplex/core/party/ui/menus/PartyMainMenu.java b/Plugins/Mineplex.Core/src/mineplex/core/party/ui/menus/PartyMainMenu.java index 055203db3..d12dc6851 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/party/ui/menus/PartyMainMenu.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/party/ui/menus/PartyMainMenu.java @@ -1,22 +1,24 @@ package mineplex.core.party.ui.menus; +import org.bukkit.Material; +import org.bukkit.entity.Player; +import org.bukkit.inventory.ItemStack; + +import mineplex.core.common.util.C; +import mineplex.core.itemstack.ItemBuilder; import mineplex.core.menu.Button; +import mineplex.core.menu.Menu; +import mineplex.core.menu.builtin.ButtonOpenInventory; import mineplex.core.party.PartyManager; -import mineplex.core.party.ui.PartyMenu; import mineplex.core.party.ui.button.tools.main.InvitePlayerButton; import mineplex.core.party.ui.button.tools.main.ViewInvitesButton; -import org.bukkit.entity.Player; -/** - * The main GUI for parties. - */ -public class PartyMainMenu extends PartyMenu +public class PartyMainMenu extends Menu { - - private final int INV_SIZE = 9; - - private final int INVITE_PLAYER_BUTTON_SLOT = 3; - private final int VIEW_INVITES_BUTTON_SLOT = 5; + private static final ItemStack VIEW_INVITES_ITEM = new ItemBuilder(Material.BOOK) + .setTitle(C.cYellow + "View Invites") + .setLore(" ", C.cGray + "Manage invites to parties.") + .build(); public PartyMainMenu(PartyManager plugin) { @@ -26,10 +28,10 @@ public class PartyMainMenu extends PartyMenu @Override protected Button[] setUp(Player player) { - Button[] buttons = new Button[INV_SIZE]; + Button[] buttons = new Button[9]; - buttons[INVITE_PLAYER_BUTTON_SLOT] = new InvitePlayerButton(getPlugin()); - buttons[VIEW_INVITES_BUTTON_SLOT] = new ViewInvitesButton(getPlugin()); + buttons[3] = new InvitePlayerButton(getPlugin()); + buttons[5] = new ButtonOpenInventory<>(VIEW_INVITES_ITEM, getPlugin(), () -> new PartyInvitesMenu(getPlugin())); return buttons; } diff --git a/Plugins/Mineplex.Core/src/mineplex/core/party/ui/menus/PartyOwnerMenu.java b/Plugins/Mineplex.Core/src/mineplex/core/party/ui/menus/PartyOwnerMenu.java index 563cfaef4..0b1c4c071 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/party/ui/menus/PartyOwnerMenu.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/party/ui/menus/PartyOwnerMenu.java @@ -1,5 +1,10 @@ package mineplex.core.party.ui.menus; +import java.util.ArrayList; +import java.util.List; + +import org.bukkit.entity.Player; + import mineplex.core.menu.Button; import mineplex.core.party.Party; import mineplex.core.party.PartyManager; @@ -8,14 +13,9 @@ import mineplex.core.party.ui.button.PartyMemberIcon; import mineplex.core.party.ui.button.tools.LeavePartyButton; import mineplex.core.party.ui.button.tools.owner.AddPlayerButton; import mineplex.core.party.ui.button.tools.owner.DisbandPartyButton; -import mineplex.core.party.ui.button.tools.owner.KickPlayerButton; import mineplex.core.party.ui.button.tools.owner.SelectServerButton; import mineplex.core.party.ui.button.tools.owner.TransferOwnerButton; -import org.bukkit.Bukkit; -import org.bukkit.entity.Player; - -import java.util.List; -import java.util.UUID; +import mineplex.core.utils.UtilGameProfile; /** * The display menu for managing parties by the owner @@ -31,7 +31,6 @@ public class PartyOwnerMenu extends PartyMenu private final int SKIP_TO_SLOT = 29; private final int SKIP_TO_SLOT_2 = 38; private final int ADD_PLAYER_BUTTON_SLOT = 1; - private final int KICK_PLAYER_BUTTON_SLOT = 4; private final int TRANSFER_OWNER_BUTTON_SLOT = 7; private final int SELECT_SERVER_BUTTON_SLOT = 46; private final int LEAVE_PARTY_BUTTON_SLOT = 49; @@ -43,11 +42,6 @@ public class PartyOwnerMenu extends PartyMenu { super("Manage Party", plugin); _party = party; - //We want this disabled by default - if(_party.isOwnerKickMode()) - { - _party.setOwnerKickMode(false); - } } @Override @@ -56,8 +50,6 @@ public class PartyOwnerMenu extends PartyMenu Button[] buttons = new Button[INV_SIZE]; //Tools buttons[ADD_PLAYER_BUTTON_SLOT] = new AddPlayerButton(getPlugin(), _party); - //Kick player - buttons[KICK_PLAYER_BUTTON_SLOT] = new KickPlayerButton(_party); //Transfer ownership buttons[TRANSFER_OWNER_BUTTON_SLOT] = new TransferOwnerButton(_party, getPlugin()); //Go to server @@ -67,23 +59,24 @@ public class PartyOwnerMenu extends PartyMenu //Disband buttons[DISBAND_PARTY_BUTTON_SLOW] = new DisbandPartyButton(getPlugin()); - List members = _party.getMembers(); - members.remove(_party.getOwner()); - buttons[OWNER_HEAD_SLOT] = new PartyMemberIcon(_party.getOwner(), _party, true); + List members = new ArrayList<>(_party.getMembers()); + _party.getOwnerAsPlayer().ifPresent(members::remove); + buttons[OWNER_HEAD_SLOT] = new PartyMemberIcon(_party.getOwner(), _party, true, true); int slot = STARTING_SLOT; //Players - for (String member: members) + for (Player member : members) { if (slot == CUT_OFF_SLOT) { slot = SKIP_TO_SLOT; - } else if (slot == CUT_OFF_SLOT_2) + } + else if (slot == CUT_OFF_SLOT_2) { slot = SKIP_TO_SLOT_2; } - buttons[slot++] = new PartyMemberIcon(Bukkit.getPlayerExact(member).getName(), _party, false); + buttons[slot++] = new PartyMemberIcon(UtilGameProfile.getGameProfile(member), _party, false, true); } return pane(buttons); diff --git a/Plugins/Mineplex.Core/src/mineplex/core/party/ui/menus/PartyViewMenu.java b/Plugins/Mineplex.Core/src/mineplex/core/party/ui/menus/PartyViewMenu.java index f907b7875..3037c42a1 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/party/ui/menus/PartyViewMenu.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/party/ui/menus/PartyViewMenu.java @@ -1,5 +1,10 @@ package mineplex.core.party.ui.menus; +import java.util.ArrayList; +import java.util.List; + +import org.bukkit.entity.Player; + import mineplex.core.menu.Button; import mineplex.core.party.Party; import mineplex.core.party.PartyManager; @@ -7,11 +12,7 @@ import mineplex.core.party.ui.PartyMenu; import mineplex.core.party.ui.button.PartyMemberIcon; import mineplex.core.party.ui.button.tools.LeavePartyButton; import mineplex.core.party.ui.button.tools.view.SuggestPlayerButton; -import org.bukkit.Bukkit; -import org.bukkit.entity.Player; - -import java.util.List; -import java.util.UUID; +import mineplex.core.utils.UtilGameProfile; /** * The menu a player see's when he is a member, and not an owner, of a party. @@ -33,7 +34,7 @@ public class PartyViewMenu extends PartyMenu public PartyViewMenu(Party party, PartyManager plugin) { - super(party.getName() + "'s Party", plugin); + super(party.getOwnerName() + "'s Party", plugin); _party = party; } @@ -46,23 +47,24 @@ public class PartyViewMenu extends PartyMenu //Suggest Player buttons[SUGGEST_PLAYER_BUTTON_SLOT] = new SuggestPlayerButton(_party, getPlugin()); - List members = _party.getMembers(); - members.remove(_party.getOwner()); - buttons[OWNER_HEAD_SLOT] = new PartyMemberIcon(_party.getOwner(), _party, true); + List members = new ArrayList<>(_party.getMembers()); + _party.getOwnerAsPlayer().ifPresent(members::remove); + buttons[OWNER_HEAD_SLOT] = new PartyMemberIcon(_party.getOwner(), _party, true, false); int slot = STARTING_SLOT; //Players - for (String member : members) + for (Player member : members) { if (slot == CUT_OFF_SLOT) { slot = SKIP_TO_SLOT; - } else if (slot == CUT_OFF_SLOT_2) + } + else if (slot == CUT_OFF_SLOT_2) { slot = SKIP_TO_SLOT_2; } - buttons[slot++] = new PartyMemberIcon(Bukkit.getPlayer(member).getName(), _party, false); + buttons[slot++] = new PartyMemberIcon(UtilGameProfile.getGameProfile(member), _party, false, false); } return pane(buttons); diff --git a/Plugins/Mineplex.Core/src/mineplex/core/party/ui/menus/input/InviteFilterMenu.java b/Plugins/Mineplex.Core/src/mineplex/core/party/ui/menus/input/InviteFilterMenu.java index 24de3bc87..36c0fd03e 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/party/ui/menus/input/InviteFilterMenu.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/party/ui/menus/input/InviteFilterMenu.java @@ -14,7 +14,7 @@ public class InviteFilterMenu extends PlayerInputActionMenu public InviteFilterMenu(PartyManager partyManager, Player player, Party party) { - super(partyManager, player, party); + super(partyManager, player); } @Override diff --git a/Plugins/Mineplex.Core/src/mineplex/core/party/ui/menus/input/PartyInvitePlayerMenu.java b/Plugins/Mineplex.Core/src/mineplex/core/party/ui/menus/input/PartyInvitePlayerMenu.java index 4e30ebc07..c269ed6dc 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/party/ui/menus/input/PartyInvitePlayerMenu.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/party/ui/menus/input/PartyInvitePlayerMenu.java @@ -14,17 +14,19 @@ public class PartyInvitePlayerMenu extends PlayerNameMenu { private PartyManager _partyManager; + private Party _party; public PartyInvitePlayerMenu(PartyManager partyManager, Player player, Party party) { - super(partyManager, partyManager.getClientManager(), player, party); + super(partyManager, partyManager.getClientManager(), player); _partyManager = partyManager; + this._party = party; } @Override public void onSuccess(String name) { - _partyManager.getMethodManager().invite(_player, name); + _partyManager.invite(_player, name); _player.playSound(_player.getLocation(), Sound.NOTE_PLING, 1, 1.6f); _player.closeInventory(); if (_party == null) diff --git a/Plugins/Mineplex.Core/src/mineplex/core/party/ui/menus/input/PartyTransferOwnerMenu.java b/Plugins/Mineplex.Core/src/mineplex/core/party/ui/menus/input/PartyTransferOwnerMenu.java index 91305bfdc..5d29253fb 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/party/ui/menus/input/PartyTransferOwnerMenu.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/party/ui/menus/input/PartyTransferOwnerMenu.java @@ -1,10 +1,14 @@ package mineplex.core.party.ui.menus.input; +import org.bukkit.Bukkit; +import org.bukkit.entity.Player; + import mineplex.core.anvilMenu.player.PlayerNameMenu; +import mineplex.core.common.util.F; +import mineplex.core.common.util.UtilPlayer; import mineplex.core.party.Lang; import mineplex.core.party.Party; import mineplex.core.party.PartyManager; -import org.bukkit.entity.Player; /** * @@ -13,23 +17,37 @@ public class PartyTransferOwnerMenu extends PlayerNameMenu { private PartyManager _partyManager; + private Party _party; public PartyTransferOwnerMenu(PartyManager partyManager, Player player, Party party) { - super(partyManager, partyManager.getClientManager(), player, party); + super(partyManager, partyManager.getClientManager(), player); _partyManager = partyManager; + this._party = party; } @Override public void onSuccess(String name) { - if(!_party.contains(name)) + Player player = Bukkit.getPlayer(name); + if (player == null) + { + UtilPlayer.message(_player, F.main("Party", "Could not find " + F.elem(name) + "!")); + return; + } + if (!_party.isMember(player)) { Lang.NOT_MEMBER.send(_player, name); return; } - _partyManager.getMethodManager().transferOwner(name, _player.getName()); + if (player == _player) + { + UtilPlayer.message(_player, F.main("Party", "You can't promote yourself!")); + return; + } + + _party.setOwner(player); Lang.TRANSFER_OWNER.send(_party, _player.getName(), name); _player.closeInventory(); _player.chat("/party"); diff --git a/Plugins/Mineplex.Core/src/mineplex/core/party/ui/menus/input/PlayerSuggestPlayerMenu.java b/Plugins/Mineplex.Core/src/mineplex/core/party/ui/menus/input/PlayerSuggestPlayerMenu.java index d6fb40f38..bcc8f95f3 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/party/ui/menus/input/PlayerSuggestPlayerMenu.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/party/ui/menus/input/PlayerSuggestPlayerMenu.java @@ -17,35 +17,42 @@ import org.bukkit.entity.Player; */ public class PlayerSuggestPlayerMenu extends PlayerNameMenu { + private Party _party; public PlayerSuggestPlayerMenu(PartyManager partyManager, Player player, Party party) { - super(partyManager, partyManager.getClientManager(), player, party); + super(partyManager, partyManager.getClientManager(), player); + this._party = party; } @Override public void onSuccess(String name) { - if(_party == null || _party.getOwner() == null) + if(_party == null || _party.getOwnerName() == null) { Lang.NO_PARTY.send(_player); return; } - if(_party.contains(name)) + Player target = Bukkit.getPlayer(name); + + if (target != null) { - Lang.ALREADY_MEMBER.send(_player, name); - return; + if (_party.isMember(target)) + { + Lang.ALREADY_MEMBER.send(_player, name); + return; + } } - Player player = Bukkit.getPlayerExact(_party.getOwner()); + Player player = Bukkit.getPlayerExact(_party.getOwnerName()); _party.sendMessage(C.mHead + "Party> " + F.name(_player.getName()) + " has suggested " + F.name(name) + " be invited."); ChildJsonMessage message = new ChildJsonMessage("").extra(F.main("Party", "Click ")); message.add(F.link("Invite " + name)) .hover(HoverEvent.SHOW_TEXT, C.cGreen + "Clicking this will invite " + C.cYellow + name + C.cGreen + " to the party") - .click(ClickEvent.RUN_COMMAND, "/partyinvite " + name); + .click(ClickEvent.RUN_COMMAND, "/party gui invite " + name); message.add(C.mBody + " to invite them"); message.sendToPlayer(player); diff --git a/Plugins/Mineplex.Core/src/mineplex/core/personalServer/PersonalServerManager.java b/Plugins/Mineplex.Core/src/mineplex/core/personalServer/PersonalServerManager.java index 24b4eb9e5..976814e4d 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/personalServer/PersonalServerManager.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/personalServer/PersonalServerManager.java @@ -20,6 +20,7 @@ import mineplex.core.common.util.C; import mineplex.core.common.util.F; import mineplex.core.common.util.UtilMath; import mineplex.core.common.util.UtilPlayer; +import mineplex.core.communities.Community; import mineplex.core.itemstack.ItemStackFactory; import mineplex.core.recharge.Recharge; import mineplex.serverdata.Region; @@ -36,6 +37,7 @@ public class PersonalServerManager extends MiniPlugin private int _interfaceSlot = 6; private ItemStack _interfaceItem; + private boolean _useInterfaceItem = true; private boolean _giveInterfaceItem = true; public PersonalServerManager(JavaPlugin plugin, CoreClientManager clientManager) @@ -65,6 +67,10 @@ public class PersonalServerManager extends MiniPlugin @EventHandler public void openServer(PlayerInteractEvent event) { + if (!_useInterfaceItem) + { + return; + } if (_interfaceItem.equals(event.getPlayer().getItemInHand())) { if (!Recharge.Instance.use(event.getPlayer(), "Host Server Melon", 30000, false, false)) @@ -124,7 +130,7 @@ public class PersonalServerManager extends MiniPlugin Rank rank = _clientManager.Get(player).GetRank(); - if (eventServer || rank.has(Rank.SNR_MODERATOR) || rank == Rank.YOUTUBE || rank == Rank.TWITCH) + if (rank.has(Rank.SNR_MODERATOR) || rank == Rank.YOUTUBE || rank == Rank.TWITCH) { ram = 2048; cpu = 4; @@ -140,6 +146,34 @@ public class PersonalServerManager extends MiniPlugin createGroup(player, serverName, ram, cpu, 40, 80, "Smash", eventServer); } + public void hostCommunityServer(Player host, Community community) + { + int ram = 2048; + int cpu = 4; + + runAsync(() -> + { + for (ServerGroup existingServerGroup : _repository.getServerGroups(null)) + { + if (existingServerGroup.getPrefix().equalsIgnoreCase("COM-" + community.getName()) || existingServerGroup.getName().equalsIgnoreCase("COM-" + community.getId())) + { + host.sendMessage(F.main(getName(), "Your server is still being created or already exists. If you have just started it up, wait 20 seconds and type /server COM-" + community.getName() + "-1.")); + return; + } + } + + final ServerGroup serverGroup = new ServerGroup("COM-" + community.getId(), "COM-" + community.getName(), "COM-" + community.getId(), ram, cpu, 1, 0, UtilMath.random.nextInt(250) + 19999, "", true, "Lobby_MCS.zip", "Arcade.jar", "plugins/Arcade/", 15, 20, + true, false, false, community.getFavoriteGame().name(), "", "", "Community", true, false, false, true, false, false, true, false, false, false, false, true, true, true, false, false, "", _us ? Region.US : Region.EU, "", "", "", ""); + + _repository.updateServerGroup(serverGroup); + runSync(() -> + { + host.sendMessage(F.main(getName(), "COM-" + community.getName() + "-1 successfully created. You will be able to join it shortly.")); + host.sendMessage(F.main(getName(), "In around 10 seconds, type /server COM-" + community.getName() + "-1.")); + }); + }); + } + private void createGroup(final Player host, final String serverName, final int ram, final int cpu, final int minPlayers, final int maxPlayers, final String games, final boolean event) { getPlugin().getServer().getScheduler().runTaskAsynchronously(getPlugin(), new Runnable() @@ -185,4 +219,9 @@ public class PersonalServerManager extends MiniPlugin { return _clientManager; } + + public void setUseInterfaceItem(boolean use) + { + _useInterfaceItem = use; + } } diff --git a/Plugins/Mineplex.Core/src/mineplex/core/pet/GrimReaperPetManager.java b/Plugins/Mineplex.Core/src/mineplex/core/pet/FlyingPetManager.java similarity index 85% rename from Plugins/Mineplex.Core/src/mineplex/core/pet/GrimReaperPetManager.java rename to Plugins/Mineplex.Core/src/mineplex/core/pet/FlyingPetManager.java index 781c0b884..1779e723c 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/pet/GrimReaperPetManager.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/pet/FlyingPetManager.java @@ -1,31 +1,32 @@ package mineplex.core.pet; -import mineplex.core.common.util.UtilAlg; -import mineplex.core.common.util.UtilMath; import org.bukkit.Location; -import org.bukkit.entity.Blaze; +import org.bukkit.entity.Creature; import org.bukkit.entity.Player; import org.bukkit.util.Vector; -public class GrimReaperPetManager +import mineplex.core.common.util.UtilAlg; +import mineplex.core.common.util.UtilMath; + +public class FlyingPetManager { /** - * Makes the Grim Reaper Pet fly around the player + * Makes the Flying pets fly around the player * Copied from {@link mineplex.core.gadget.gadgets.particle.ParticleFairyData} */ private Player _player; - private Blaze _blaze; + private Creature _pet; private Location _grimReaperLoc, _target; private Vector _direction; private double _speed; private long _idleTime; - public GrimReaperPetManager(Player player, Blaze blaze) + public FlyingPetManager(Player player, Creature pet) { _player = player; - _blaze = blaze; + _pet = pet; _grimReaperLoc = player.getEyeLocation(); _target = getNewTarget(); _speed = 0.2; @@ -73,8 +74,8 @@ public class GrimReaperPetManager if (UtilMath.offset(_grimReaperLoc, _target) > 0.1) _grimReaperLoc.add(_direction.clone().multiply(_speed)); - _blaze.teleport(_grimReaperLoc); - _blaze.setVelocity(new Vector(0, .25, 0)); + _pet.teleport(_grimReaperLoc); + _pet.setVelocity(new Vector(0, .25, 0)); } private Location getNewTarget() diff --git a/Plugins/Mineplex.Core/src/mineplex/core/pet/PetManager.java b/Plugins/Mineplex.Core/src/mineplex/core/pet/PetManager.java index 58c17bea5..3b7a1b0e3 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/pet/PetManager.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/pet/PetManager.java @@ -1,5 +1,6 @@ package mineplex.core.pet; +import java.awt.Color; import java.util.Collection; import java.util.HashMap; import java.util.Iterator; @@ -30,6 +31,7 @@ import org.bukkit.entity.Villager; import org.bukkit.entity.Zombie; import org.bukkit.event.EventHandler; import org.bukkit.event.EventPriority; +import org.bukkit.event.entity.EntityCombustEvent; import org.bukkit.event.entity.EntityDamageEvent; import org.bukkit.event.entity.EntityDamageEvent.DamageCause; import org.bukkit.event.entity.EntityTargetEvent; @@ -40,6 +42,7 @@ import org.bukkit.inventory.ItemStack; import org.bukkit.plugin.java.JavaPlugin; import org.bukkit.potion.PotionEffect; import org.bukkit.potion.PotionEffectType; +import org.bukkit.util.Vector; import com.google.gson.Gson; @@ -49,6 +52,8 @@ import mineplex.core.account.event.ClientWebResponseEvent; import mineplex.core.blockrestore.BlockRestore; import mineplex.core.common.Rank; import mineplex.core.common.shape.ShapeWings; +import mineplex.core.common.skin.SkinData; +import mineplex.core.common.util.F; import mineplex.core.common.util.NautHashMap; import mineplex.core.common.util.UtilAction; import mineplex.core.common.util.UtilAlg; @@ -56,15 +61,17 @@ import mineplex.core.common.util.UtilEnt; import mineplex.core.common.util.UtilParticle; import mineplex.core.common.util.UtilParticle.ParticleType; import mineplex.core.common.util.UtilParticle.ViewDist; +import mineplex.core.common.util.UtilPlayer; import mineplex.core.common.util.UtilServer; import mineplex.core.disguise.DisguiseManager; import mineplex.core.disguise.disguises.DisguiseChicken; import mineplex.core.disguise.disguises.DisguiseGuardian; +import mineplex.core.disguise.disguises.DisguiseVillager; import mineplex.core.disguise.disguises.DisguiseWither; import mineplex.core.disguise.disguises.DisguiseZombie; import mineplex.core.donation.DonationManager; -import mineplex.core.events.AddConditionEvent; import mineplex.core.inventory.InventoryManager; +import mineplex.core.itemstack.ItemStackFactory; import mineplex.core.pet.repository.PetRepository; import mineplex.core.pet.repository.token.ClientPetTokenWrapper; import mineplex.core.updater.UpdateType; @@ -90,19 +97,24 @@ public class PetManager extends MiniClientPlugin private CoreClientManager _clientManager; private InventoryManager _inventoryManager; - private Map _grimReaperMorphs = new HashMap<>(); + private Map _flyingPets = new HashMap<>(); + private Map _trueLovePets = new HashMap<>(); - private ShapeWings _wings = new ShapeWings(ParticleType.RED_DUST.particleName, new org.bukkit.util.Vector(0.2,0.2,0.2), 1, 0, false, ShapeWings.DEFAULT_ROTATION, ShapeWings.SMALL_ANGEL_WING_PATTERN); - private ShapeWings _wingsEdge = new ShapeWings(ParticleType.RED_DUST.particleName, new org.bukkit.util.Vector(0.1,0.1,0.1), 1, 0, true, ShapeWings.DEFAULT_ROTATION, ShapeWings.SMALL_ANGEL_WING_PATTERN); + private ShapeWings _grimReaperWings = new ShapeWings(ParticleType.RED_DUST.particleName, new org.bukkit.util.Vector(0.2, 0.2, 0.2), 1, 0, false, ShapeWings.DEFAULT_ROTATION, ShapeWings.SMALL_ANGEL_WING_PATTERN); + private ShapeWings _grimReaperWingsEdge = new ShapeWings(ParticleType.RED_DUST.particleName, new org.bukkit.util.Vector(0.1, 0.1, 0.1), 1, 0, true, ShapeWings.DEFAULT_ROTATION, ShapeWings.SMALL_ANGEL_WING_PATTERN); + + private ShapeWings _cupidWings = new ShapeWings(UtilParticle.ParticleType.RED_DUST.particleName, new Vector(1, 1, 1), 1, 0, false, ShapeWings.DEFAULT_ROTATION, ShapeWings.SMALL_HEART_WING_PATTERN); + private ShapeWings _cupidWingsWhite = new ShapeWings(UtilParticle.ParticleType.RED_DUST.particleName, new Vector(1, 1, 1), 1, 0, '%', ShapeWings.DEFAULT_ROTATION, ShapeWings.SMALL_HEART_WING_PATTERN); + private ShapeWings _cupidWingsEdge = new ShapeWings(UtilParticle.ParticleType.RED_DUST.particleName, new Vector(0, 0, 0), 1, 0, true, ShapeWings.DEFAULT_ROTATION, ShapeWings.SMALL_HEART_WING_PATTERN); public PetManager(JavaPlugin plugin, CoreClientManager clientManager, DonationManager donationManager - , InventoryManager inventoryManager, DisguiseManager disguiseManager, mineplex.core.creature.Creature creatureModule, BlockRestore restore, String webAddress) + , InventoryManager inventoryManager, DisguiseManager disguiseManager, mineplex.core.creature.Creature creatureModule, BlockRestore restore) { super("Pet Manager", plugin); _creatureModule = creatureModule; _disguiseManager = disguiseManager; - _repository = new PetRepository(plugin, webAddress); + _repository = new PetRepository(); _blockRestore = restore; _donationManager = donationManager; _clientManager = clientManager; @@ -157,8 +169,12 @@ public class PetManager extends MiniClientPlugin if (player != null && player.isOnline()) { - getActivePet(playerName).setCustomNameVisible(true); - getActivePet(playerName).setCustomName(_petRenameQueue.get(playerName)); + Creature activePet = getActivePet(playerName); + if (activePet != null) + { + activePet.setCustomNameVisible(true); + activePet.setCustomName(_petRenameQueue.get(playerName)); + } } } @@ -213,7 +229,7 @@ public class PetManager extends MiniClientPlugin witherDisguise.setInvulTime(530); Creature silverfish = (Creature) _creatureModule.SpawnEntity(location, EntityType.SILVERFISH); - UtilEnt.Vegetate(silverfish, true); + UtilEnt.vegetate(silverfish, true); UtilEnt.silence(silverfish, true); silverfish.addPotionEffect(new PotionEffect(PotionEffectType.INVISIBILITY, Integer.MAX_VALUE, 0)); pet.setPassenger(silverfish); @@ -222,6 +238,28 @@ public class PetManager extends MiniClientPlugin _creatureModule.SetForce(false); } + // Baby zombie + else if (entityType.equals(EntityType.RABBIT)) + { + for (int x = -5; x < 5; x++) + { + for (int y = 0; y < 255; y++) + { + for (int z = -5; z < 5; z++) + { + Location spawnLoc = location.clone().add(x, 0, z); + spawnLoc.setY(y); + Block block = spawnLoc.getBlock(); + if (block.getType().equals(Material.WATER) || block.getType().equals(Material.STATIONARY_WATER)) + { + UtilPlayer.message(player, F.main("Pets", "You cannot spawn that pet there!")); + return; + } + } + } + } + pet = (Creature)_creatureModule.SpawnEntity(location, petType.getEntityType()); + } //Default Spawn else { @@ -235,7 +273,7 @@ public class PetManager extends MiniClientPlugin pet.setCustomName(Get(player).getPets().get(petType)); } - if (pet instanceof Zombie) + if (petType.equals(PetType.ZOMBIE)) { ((Zombie) pet).setBaby(true); pet.getEquipment().setHelmet(new ItemStack(Material.PUMPKIN)); @@ -286,10 +324,6 @@ public class PetManager extends MiniClientPlugin } else if (pet instanceof Blaze) { - - AddConditionEvent event = new AddConditionEvent("Pet", pet, pet, AddConditionEvent.CoreConditionType.SILENCE, 0, -1, true, Material.SNOW_BALL, (byte) 0, false, false); - Bukkit.getPluginManager().callEvent(event); - DisguiseZombie disguiseZombie = new DisguiseZombie(pet); disguiseZombie.setBaby(true); disguiseZombie.setHelmet(new ItemStack(Material.SKULL_ITEM, 1, (short) SkullType.WITHER.ordinal())); @@ -303,8 +337,64 @@ public class PetManager extends MiniClientPlugin } _disguiseManager.disguise(disguiseZombie); - GrimReaperPetManager grimReaperPetManager = new GrimReaperPetManager(player, (Blaze) pet); - _grimReaperMorphs.put((Blaze) pet, grimReaperPetManager); + FlyingPetManager flyingPetManager = new FlyingPetManager(player, pet); + _flyingPets.put(pet, flyingPetManager); + UtilEnt.silence(pet, true); + } + else if (petType.equals(PetType.GINGERBREAD_MAN)) + { + Zombie zombie = (Zombie) pet; + zombie.setBaby(true); + zombie.getEquipment().setHelmet(SkinData.GINGERBREAD.getSkull()); + zombie.getEquipment().setChestplate(ItemStackFactory.Instance.createColoredLeatherArmor(1, org.bukkit.Color.fromRGB(203, 122, 56))); + zombie.getEquipment().setLeggings(ItemStackFactory.Instance.createColoredLeatherArmor(2, org.bukkit.Color.fromRGB(203, 122, 56))); + zombie.getEquipment().setBoots(ItemStackFactory.Instance.createColoredLeatherArmor(3, org.bukkit.Color.fromRGB(203, 122, 56))); + + UtilEnt.silence(zombie, true); + + if (Get(player).getPets().get(entityType) != null && Get(player).getPets().get(entityType).length() > 0) + { + zombie.setCustomName(Get(player).getPets().get(entityType)); + zombie.setCustomNameVisible(true); + } + } + else if (petType.equals(PetType.CUPID_PET)) + { + Zombie zombie = (Zombie) pet; + UtilEnt.silence(zombie, true); + + DisguiseVillager disguiseVillager = new DisguiseVillager(zombie); + disguiseVillager.setBaby(); + disguiseVillager.setHeldItem(new ItemStack(Material.BOW)); + + if (Get(player).getPets().get(entityType) != null && Get(player).getPets().get(entityType).length() > 0) + { + disguiseVillager.setName(Get(player).getPets().get(entityType)); + disguiseVillager.setCustomNameVisible(true); + } + + _disguiseManager.disguise(disguiseVillager); + FlyingPetManager flyingPetManager = new FlyingPetManager(player, pet); + _flyingPets.put(pet, flyingPetManager); + } + else if (petType.equals(PetType.TRUE_LOVE_PET)) + { + Zombie zombie = (Zombie) pet; + zombie.setBaby(true); + + UtilEnt.silence(zombie, true); + + if (Get(player).getPets().get(entityType) != null && Get(player).getPets().get(entityType).length() > 0) + { + zombie.setCustomName(Get(player).getPets().get(entityType)); + zombie.setCustomNameVisible(true); + } + + // Spawns villager + Villager villager = _creatureModule.SpawnEntity(zombie.getLocation(), Villager.class); + villager.setBaby(); + UtilEnt.silence(villager, true); + _trueLovePets.put(zombie, new TrueLoveData(player, zombie, villager)); } _activePetOwnerTypes.put(player.getName(), petType); @@ -317,7 +407,7 @@ public class PetManager extends MiniClientPlugin ((Ageable)pet).setAgeLock(true); } - UtilEnt.Vegetate(pet); + UtilEnt.vegetate(pet); } public Creature getPet(Player player) @@ -337,7 +427,13 @@ public class PetManager extends MiniClientPlugin if (pet instanceof Blaze) { - _grimReaperMorphs.remove(pet); + _flyingPets.remove(pet); + } + + if (_trueLovePets.containsKey(pet)) + { + _trueLovePets.get(pet).remove(); + _trueLovePets.remove(pet); } pet.remove(); @@ -407,27 +503,56 @@ public class PetManager extends MiniClientPlugin @EventHandler public void onUpdate(UpdateEvent event) { - for(Creature pet : _activePetOwners.values()) + + for (Entry entry : _activePetOwners.entrySet()) { - if(pet instanceof PigZombie && event.getType() == UpdateType.TICK) + String playerName = entry.getKey(); + Creature creature = entry.getValue(); + + if (event.getType() == UpdateType.TICK) { - UtilParticle.PlayParticleToAll(ParticleType.LARGE_SMOKE, pet.getLocation(), 0.2f,0.0f,0.2f, 0.0f, 4, ViewDist.NORMAL); - if(event.getTick()%3 == 0) pet.getWorld().playSound(pet.getLocation(), Sound.BLAZE_BREATH, 0.03f, 0f); - if(!((CraftPigZombie)pet).getHandle().isSilent()) + if (creature instanceof PigZombie) { - ((CraftPigZombie)pet).getHandle().setSilent(true); + UtilParticle.PlayParticleToAll(ParticleType.LARGE_SMOKE, creature.getLocation(), 0.2f, 0.0f, 0.2f, 0.0f, 4, ViewDist.NORMAL); + if(event.getTick() % 3 == 0) creature.getWorld().playSound(creature.getLocation(), Sound.BLAZE_BREATH, 0.03f, 0f); + if(!((CraftPigZombie) creature).getHandle().isSilent()) + { + ((CraftPigZombie) creature).getHandle().setSilent(true); + } } } - if (pet instanceof Blaze && event.getType() == UpdateType.FAST) + else if (event.getType() == UpdateType.FAST) { - Location loc = pet.getLocation().clone().add(0, .5, 0).add(pet.getLocation().getDirection().multiply(-0.2)); - - if (event.getType() == UpdateType.FAST) _wings.display(loc); - if (event.getType() == UpdateType.FAST) _wingsEdge.display(loc); + if (creature instanceof Blaze) + { + Location loc = creature.getLocation().clone().add(0, .5, 0).add(creature.getLocation().getDirection().multiply(-0.2)); + _grimReaperWings.display(loc); + _grimReaperWingsEdge.display(loc); + } + else + { + PetType petType = getActivePetType(playerName); + if (petType == PetType.CUPID_PET) + { + Location loc = creature.getLocation().clone().add(0, .5, 0).add(creature.getLocation().getDirection().multiply(-0.2)); + _cupidWings.displayColored(loc, Color.PINK); + _cupidWingsWhite.displayColored(loc, Color.WHITE); + _cupidWingsEdge.displayColored(loc, Color.BLACK); + } + } + } + else if (event.getType() == UpdateType.SEC) + { + PetType petType = getActivePetType(playerName); + if (petType == PetType.CUPID_PET) + { + Location loc = creature.getLocation().clone().add(0, .5, 0); + UtilParticle.PlayParticle(ParticleType.HEART, loc, 0.25f, 0.25f, 0.25f, 0.25f, 3, ViewDist.NORMAL); + } } } - + if (event.getType() != UpdateType.FAST) return; @@ -511,20 +636,53 @@ public class PetManager extends MiniClientPlugin } /** - * Makes the Grim Reaper pet fly around the player + * Makes the Flying pet fly around the player * Copied from {@link mineplex.core.gadget.gadgets.particle.ParticleFairyData} * @param event */ @EventHandler public void grimReaperFly(UpdateEvent event) { - for (Entry entry : _grimReaperMorphs.entrySet()) + for (Entry entry : _flyingPets.entrySet()) { - GrimReaperPetManager grimReaperPetManager = entry.getValue(); - grimReaperPetManager.update(); + FlyingPetManager flyingPetManager = entry.getValue(); + flyingPetManager.update(); } } - + + @EventHandler + public void trueLovePetWalk(UpdateEvent event) + { + if (event.getType() != UpdateType.FASTEST) + return; + + Iterator> iterator = _trueLovePets.entrySet().iterator(); + while (iterator.hasNext()) + { + Entry entry = iterator.next(); + Creature zombie = entry.getKey(); + UtilParticle.PlayParticle(ParticleType.HEART, zombie.getLocation().add(0, 0.25, 0), 0.25f, 0.25f, 0.25f, 0, 1, ViewDist.NORMAL); + TrueLoveData trueLoveData = entry.getValue(); + trueLoveData.update(); + } + } + + /** + * Blocks zombie pets catching fire + * @param event + */ + @EventHandler + public void noFire(EntityCombustEvent event) + { + if (event.getEntity() instanceof Zombie) + { + if (_activePetOwners.containsValue((Creature) event.getEntity())) + { + event.setCancelled(true); + } + } + } + @Override protected PetClient addPlayer(UUID uuid) { @@ -567,4 +725,9 @@ public class PetManager extends MiniClientPlugin return _activePetOwners.values(); } + public mineplex.core.creature.Creature getCreatureModule() + { + return _creatureModule; + } + } diff --git a/Plugins/Mineplex.Core/src/mineplex/core/pet/PetType.java b/Plugins/Mineplex.Core/src/mineplex/core/pet/PetType.java index 4072f41c1..d3aba90ab 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/pet/PetType.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/pet/PetType.java @@ -1,5 +1,7 @@ package mineplex.core.pet; +import java.time.Month; +import java.time.YearMonth; import java.util.Optional; import org.bukkit.Material; @@ -26,6 +28,9 @@ public enum PetType SKELETON("Guardian", EntityType.SKELETON, -13), RABBIT("Baby Zombie", EntityType.RABBIT, -9, "They're so cute - until a pack of them chases down your family and eats them."), BLAZE("Grim Reaper", EntityType.BLAZE, -8, "Aww isn't he so cute with his little wings and little scythe?"), + GINGERBREAD_MAN("Gingerbread Man", EntityType.ZOMBIE, -16, "Looks like you can catch him after all."), + CUPID_PET("Cupid", EntityType.ZOMBIE, -17, "Sometimes you need a little extra help finding true Love. Why not have Cupid help you out?", Material.BOW, (byte) 0), + TRUE_LOVE_PET("True Love", EntityType.ZOMBIE, -14, "Sometimes love means chasing the person of your dreams until you catch them.", Material.APPLE, YearMonth.of(2017, Month.FEBRUARY)) // TODO CHECK IF LOBBY IS 1.9+ // Not in this update //SHULKER("Shulker Pet", EntityType.BAT, 0, "Is it a turtle or an alien? Either way its shot can be really UPLIFTING.") @@ -36,6 +41,7 @@ public enum PetType private final Optional _lore; private final Material _material; private final byte _data; + private YearMonth _yearMonth; PetType(String name, EntityType entityType, int price) { @@ -67,6 +73,17 @@ public enum PetType _data = data; } + PetType(String name, EntityType entityType, int price, String lore, Material material, YearMonth yearMonth) + { + this(name, entityType, price, lore, material, (byte) 0, yearMonth); + } + + PetType(String name, EntityType entityType, int price, String lore, Material material, byte data, YearMonth yearMonth) + { + this(name, entityType, price, lore, material, data); + _yearMonth = yearMonth; + } + public String getName() { return _name; @@ -97,6 +114,11 @@ public enum PetType return _data; } + public YearMonth getYearMonth() + { + return _yearMonth; + } + public PetSalesPackage toSalesPackage(String tagName) { return new PetSalesPackage(this, tagName); diff --git a/Plugins/Mineplex.Core/src/mineplex/core/pet/TrueLoveData.java b/Plugins/Mineplex.Core/src/mineplex/core/pet/TrueLoveData.java new file mode 100644 index 000000000..eee0487e3 --- /dev/null +++ b/Plugins/Mineplex.Core/src/mineplex/core/pet/TrueLoveData.java @@ -0,0 +1,66 @@ +package mineplex.core.pet; + +import org.bukkit.Location; +import org.bukkit.entity.Player; +import org.bukkit.entity.Villager; +import org.bukkit.entity.Zombie; +import org.bukkit.util.Vector; + +public class TrueLoveData +{ + + private Player _player; + private Zombie _zombie; + private Villager _villager; + private int _step = 0; + + private static final int POINTS = 12; + private static final float RADIUS = 1.75F; + + public TrueLoveData(Player player, Zombie zombie, Villager villager) + { + _player = player; + _zombie = zombie; + _villager = villager; + } + + public void update() + { + double increment = (2 * Math.PI) / POINTS; + + // Villager + double angle = _step * increment; + Vector vector = new Vector(Math.cos(angle) * RADIUS, 0, Math.sin(angle) * RADIUS); + _villager.setVelocity(new Vector(0,0,0)); + _villager.teleport(_player.getLocation().clone().add(vector)); + // Make villager look at right location + angle = (_step + 1) * increment; + vector = new Vector(Math.cos(angle) * RADIUS, 0, Math.sin(angle) * RADIUS); + Location targetLoc = _player.getLocation().clone().add(vector); + Vector directionBetweenLocs = targetLoc.toVector().subtract(_villager.getEyeLocation().toVector()); + Location villagerLoc = _villager.getLocation().setDirection(directionBetweenLocs); + _villager.teleport(villagerLoc); + + // Zombie + angle = (_step - 3) * increment; + vector = new Vector(Math.cos(angle) * RADIUS, 0, Math.sin(angle) * RADIUS); + _zombie.setVelocity(new Vector(0, 0, 0)); + _zombie.teleport(_player.getLocation().clone().add(vector)); + // Make zombie look at right location + angle = (_step - 2) * increment; + vector = new Vector(Math.cos(angle) * RADIUS, 0, Math.sin(angle) * RADIUS); + targetLoc = _player.getLocation().clone().add(vector); + directionBetweenLocs = targetLoc.toVector().subtract(_zombie.getEyeLocation().toVector()); + Location zombieLoc = _zombie.getLocation().setDirection(directionBetweenLocs); + _zombie.teleport(zombieLoc); + + _step++; + } + + public void remove() + { + _villager.remove(); + _zombie.remove(); + } + +} diff --git a/Plugins/Mineplex.Core/src/mineplex/core/pet/repository/PetRepository.java b/Plugins/Mineplex.Core/src/mineplex/core/pet/repository/PetRepository.java index 9dc141afb..c373aef52 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/pet/repository/PetRepository.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/pet/repository/PetRepository.java @@ -1,56 +1,23 @@ package mineplex.core.pet.repository; -import java.util.List; - -import org.bukkit.plugin.java.JavaPlugin; - -import com.google.gson.reflect.TypeToken; - import mineplex.core.database.MinecraftRepository; import mineplex.core.pet.repository.token.PetChangeToken; -import mineplex.core.pet.repository.token.PetExtraToken; -import mineplex.core.server.remotecall.AsyncJsonWebCall; -import mineplex.core.server.remotecall.JsonWebCall; import mineplex.serverdata.database.DBPool; public class PetRepository extends MinecraftRepository { - private String _webAddress; - - public PetRepository(JavaPlugin plugin, String webAddress) + public PetRepository() { - super(plugin, DBPool.getAccount()); - - _webAddress = webAddress; + super(DBPool.getAccount()); } public void AddPet(final PetChangeToken token) { - new AsyncJsonWebCall(_webAddress + "Pets/AddPet").Execute(token); - } - - public void RemovePet(final PetChangeToken token) - { - new AsyncJsonWebCall(_webAddress + "Pets/RemovePet").Execute(token); - } - - public List GetPetExtras(List petExtraTokens) - { - return new JsonWebCall(_webAddress + "Pets/GetPetExtras").Execute(new TypeToken>(){}.getType(), petExtraTokens); + handleAsyncMSSQLCall("Pets/AddPet", token); } public void UpdatePet(final PetChangeToken token) { - new AsyncJsonWebCall(_webAddress + "Pets/UpdatePet").Execute(token); - } - - @Override - protected void initialize() - { - } - - @Override - protected void update() - { + handleAsyncMSSQLCall("Pets/UpdatePet", token); } } diff --git a/Plugins/Mineplex.Core/src/mineplex/core/playwire/PlayWireManager.java b/Plugins/Mineplex.Core/src/mineplex/core/playwire/PlayWireManager.java index 017b3a0d1..1dab55afc 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/playwire/PlayWireManager.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/playwire/PlayWireManager.java @@ -32,7 +32,7 @@ public class PlayWireManager extends MiniDbClientPlugin private static final int MAX_TICKETS_PER_PERIOD = 5; private final long COOL_DOWN = TimeUnit.HOURS.getMilliseconds() * 24; private static final int REWARD_MESSAGE_DELAY_SECONDS = 10; - + private final CoreClientManager _clientManager; private final PlayWireRepository _repository; @@ -96,12 +96,12 @@ public class PlayWireManager extends MiniDbClientPlugin final PlayWireClientData client = Get(player); if (client == null || client.getAccountId() == -1) { - player.sendMessage(ResponseType.UNFILLED.getMessage()); + player.sendMessage(ResponseType.UNFILLED.getMessage(Managers.get(BonusManager.class).getCreeperName())); return; } if (!canRedeemTickets(client)) { - player.sendMessage(ResponseType.UNCOUNTED.getMessage(UtilTime.MakeStr(client.getTicketRefresh() - System.currentTimeMillis()))); + player.sendMessage(ResponseType.UNCOUNTED.getMessage(Managers.get(BonusManager.class).getCreeperName(), UtilTime.MakeStr(client.getTicketRefresh() - System.currentTimeMillis()))); return; } @@ -127,11 +127,11 @@ public class PlayWireManager extends MiniDbClientPlugin try (Connection c = DBPool.getAccount().getConnection(); Statement statement = c.createStatement()) { final String query = "UPDATE bonus SET tickets = tickets + 1 WHERE accountId = " + accountId + ";SELECT tickets FROM bonus WHERE accountId = " + accountId; - + statement.execute(query); statement.getUpdateCount(); statement.getMoreResults(); - + ResultSet rs = statement.getResultSet(); if (rs.next()) { @@ -149,7 +149,7 @@ public class PlayWireManager extends MiniDbClientPlugin } }); Managers.get(BonusManager.class).addPendingExplosion(player, player.getName()); - Bukkit.getScheduler().runTaskLater(getClientManager().getPlugin(), () -> UtilPlayer.message(player, ResponseType.COUNTED.getMessage(client.getTicketsRemaining() + "")), REWARD_MESSAGE_DELAY_SECONDS * 20L); + Bukkit.getScheduler().runTaskLater(getClientManager().getPlugin(), () -> UtilPlayer.message(player, ResponseType.COUNTED.getMessage(Managers.get(BonusManager.class).getCreeperName(), client.getTicketsRemaining() + "")), REWARD_MESSAGE_DELAY_SECONDS * 20L); }); } @@ -175,9 +175,10 @@ public class PlayWireManager extends MiniDbClientPlugin if (response == ResponseType.COUNTED) { attemptRedeem(player); - } else + } + else { - player.sendMessage(response.getMessage()); + player.sendMessage(response.getMessage(Managers.get(BonusManager.class).getCreeperName())); } } @@ -194,7 +195,6 @@ public class PlayWireManager extends MiniDbClientPlugin { PlayWireClientData client = new PlayWireClientData(accountId, MAX_TICKETS_PER_PERIOD, -1L); Set(uuid, client); - _repository.attemptPlayWire(client, null, false); } } diff --git a/Plugins/Mineplex.Core/src/mineplex/core/playwire/ResponseType.java b/Plugins/Mineplex.Core/src/mineplex/core/playwire/ResponseType.java index 25f51ff47..8e4483e68 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/playwire/ResponseType.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/playwire/ResponseType.java @@ -7,10 +7,10 @@ import mineplex.core.common.util.F; */ public enum ResponseType { - COUNTED(F.main("Carl", "Rewarded " + F.elem("1 Carl Spin Ticket") + " for watching the Ad! You have " + F.elem("%elem%") + " tickets remaining for the current 24 hour period!")), - UNCOUNTED(F.main("Carl", "You already received your " + F.elem("5 Carl Spin Tickets") + " for the current 24 hour period! Your available tickets will refresh in " + F.elem("%elem%") + "!")), - BLOCKED(F.main("Carl", "You have an AdBlocker on, but tried to watch the Ad! Ssssssslight problem there!")), - UNFILLED(F.main("Carl", "Ssssomething went wrong with the Ad, we'll get it ssssorted ASAP. Try again in a few minutessss!")),; + COUNTED(F.main("%creeper%", "Rewarded " + F.elem("1 Spin Ticket") + " for watching the Ad! You have " + F.elem("%elem%") + " tickets remaining for the current 24 hour period!")), + UNCOUNTED(F.main("%creeper%", "You already received your " + F.elem("5 Spin Tickets") + " for the current 24 hour period! Your available tickets will refresh in " + F.elem("%elem%") + "!")), + BLOCKED(F.main("%creeper%", "You have an AdBlocker on, but tried to watch the Ad! Ssssssslight problem there!")), + UNFILLED(F.main("%creeper%", "Ssssomething went wrong with the Ad, we'll get it ssssorted ASAP. Try again in a few minutessss!")),; private String _message; @@ -19,9 +19,10 @@ public enum ResponseType _message = message; } - public String getMessage(String... elements) + public String getMessage(String creeperName, String... elements) { String message = _message; + message = message.replaceFirst("%creeper%", creeperName); if (elements.length > 0) { for (int i = 0; i < elements.length; i++) diff --git a/Plugins/Mineplex.Core/src/mineplex/core/poll/PollManager.java b/Plugins/Mineplex.Core/src/mineplex/core/poll/PollManager.java index 12cd6f22e..ddca26a97 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/poll/PollManager.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/poll/PollManager.java @@ -16,9 +16,11 @@ import com.google.gson.JsonObject; import net.minecraft.server.v1_8_R3.IChatBaseComponent.ChatSerializer; import net.minecraft.server.v1_8_R3.PacketPlayOutChat; + import mineplex.core.MiniDbClientPlugin; import mineplex.core.account.CoreClientManager; import mineplex.core.common.Rank; +import mineplex.core.common.currency.GlobalCurrency; import mineplex.core.common.util.C; import mineplex.core.common.util.Callback; import mineplex.core.common.util.F; @@ -114,7 +116,7 @@ public class PollManager extends MiniDbClientPlugin player.sendMessage(""); for (int i = 1; i <= answers.length; i++) { - if (answers[i-1] != null && answers[i-1].length() > 0) + if (answers[i - 1] != null && answers[i - 1].length() > 0) { String message = C.cGreen + i + ". " + answers[i - 1]; // Base message object @@ -156,47 +158,27 @@ public class PollManager extends MiniDbClientPlugin Get(player).addAnswer(poll.getId(), answer); // Here we add the answer into the database, and once that is successful we give the coin reward - _plugin.getServer().getScheduler().runTaskAsynchronously(_plugin, new Runnable() + _plugin.getServer().getScheduler().runTaskAsynchronously(_plugin, () -> { - @Override - public void run() + if (_repository.addPollAnswer(uuid, poll.getId(), answer)) { - if (_repository.addPollAnswer(uuid, poll.getId(), answer)) + UtilPlayer.message(player, F.main("Carl", "Thanks for your response!")); + player.playSound(player.getEyeLocation(), Sound.LEVEL_UP, 1F, 0); + // Poll response successful, give coins + _donationManager.rewardCurrency(GlobalCurrency.GEM, player, "Poll", poll.getCoinReward(), gemSuccessful -> { - // Poll response successful, give coins - _donationManager.RewardGems(new Callback() + if (gemSuccessful) { - @Override - public void run(Boolean completed) + UtilPlayer.message(player, F.main("Carl", "You received " + F.elem(poll.getCoinReward() + "") + " Gems!")); + } + _donationManager.rewardCurrency(GlobalCurrency.TREASURE_SHARD, player, "Poll", poll.getCoinReward(), completed -> + { + if (completed) { - if (completed) - { - _donationManager.RewardCoins(new Callback() - { - @Override - public void run(Boolean completed) - { - if (completed) - { - // Need to get out of Async code - _plugin.getServer().getScheduler().runTask(_plugin, new Runnable() - { - @Override - public void run() - { - UtilPlayer.message(player, F.main("Carl", "Thanks for your response!")); - player.playSound(player.getEyeLocation(), Sound.LEVEL_UP, 1F, 0); - UtilPlayer.message(player, F.main("Carl", "You received " + F.elem(poll.getCoinReward() + "") + " Gems!")); - UtilPlayer.message(player, F.main("Carl", "You received " + F.elem(poll.getCoinReward() + "") + " Coins!")); - } - }); - } - } - }, "Poll", name, accountId, poll.getCoinReward()); - } + UtilPlayer.message(player, F.main("Carl", "You received " + F.elem(poll.getCoinReward() + "") + " Coins!")); } - }, "Poll", name, uuid, poll.getCoinReward()); - } + }); + }); } }); } diff --git a/Plugins/Mineplex.Core/src/mineplex/core/poll/PollRepository.java b/Plugins/Mineplex.Core/src/mineplex/core/poll/PollRepository.java index dbf24772d..b65345cf4 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/poll/PollRepository.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/poll/PollRepository.java @@ -18,7 +18,7 @@ import mineplex.serverdata.database.column.ColumnVarChar; /** * Created by Shaun on 8/16/2014. */ -public class PollRepository extends MinecraftRepository +public class PollRepository extends RepositoryBase { private static String CREATE_POLL_TABLE = "CREATE TABLE IF NOT EXISTS polls (id INT NOT NULL AUTO_INCREMENT, enabled BIT(1), question VARCHAR(256) NOT NULL, answerA VARCHAR(256) NOT NULL, answerB VARCHAR(256), answerC VARCHAR(256), answerD VARCHAR(256), coinReward INT NOT NULL, displayType INT DEFAULT 0 NOT NULL, PRIMARY KEY (id));"; private static String CREATE_RELATION_TABLE = "CREATE TABLE IF NOT EXISTS accountPolls (id INT NOT NULL AUTO_INCREMENT, accountId INT NOT NULL, pollId INT NOT NULL, value TINYINT(1) NOT NULL, PRIMARY KEY (id), FOREIGN KEY (accountId) REFERENCES accounts(id), FOREIGN KEY (pollId) REFERENCES polls(id), UNIQUE INDEX accountPollIndex (accountId, pollId));"; @@ -30,20 +30,7 @@ public class PollRepository extends MinecraftRepository public PollRepository(JavaPlugin plugin) { - super(plugin, DBPool.getAccount()); - } - - @Override - protected void initialize() - { - //executeUpdate(CREATE_POLL_TABLE); - //executeUpdate(CREATE_RELATION_TABLE); - } - - @Override - protected void update() - { - + super(DBPool.getAccount()); } public List retrievePolls() diff --git a/Plugins/Mineplex.Core/src/mineplex/core/portal/Commands/SendCommand.java b/Plugins/Mineplex.Core/src/mineplex/core/portal/Commands/SendCommand.java index 40bfe8476..f0c7c59bf 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/portal/Commands/SendCommand.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/portal/Commands/SendCommand.java @@ -1,4 +1,4 @@ -package mineplex.core.portal.Commands; +package mineplex.core.portal.commands; import org.bukkit.entity.Player; diff --git a/Plugins/Mineplex.Core/src/mineplex/core/portal/Commands/ServerCommand.java b/Plugins/Mineplex.Core/src/mineplex/core/portal/Commands/ServerCommand.java index c6f76dfda..5511e0105 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/portal/Commands/ServerCommand.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/portal/Commands/ServerCommand.java @@ -1,4 +1,4 @@ -package mineplex.core.portal.Commands; +package mineplex.core.portal.commands; import org.bukkit.entity.Player; @@ -8,6 +8,7 @@ import mineplex.core.common.util.C; import mineplex.core.common.util.Callback; import mineplex.core.common.util.F; import mineplex.core.common.util.UtilPlayer; +import mineplex.core.portal.Intent; import mineplex.core.portal.Portal; public class ServerCommand extends CommandBase @@ -27,7 +28,6 @@ public class ServerCommand extends CommandBase { UtilPlayer.message(player, F.main(Plugin.getName(), C.cGray + "You are currently on server: " + C.cGold + serverName)); - return; } else if (args.length == 1) { @@ -58,21 +58,21 @@ public class ServerCommand extends CommandBase if (servUp.contains("STAFF")) { - if (playerRank.has(Rank.HELPER)) - Plugin.sendPlayerToServer(player, args[0]); - else + if (!playerRank.has(Rank.HELPER)) deniedAccess = true; } else if (servUp.contains("TEST")) { - if (playerRank.has(Rank.MODERATOR)) - Plugin.sendPlayerToServer(player, args[0]); - else + if (!playerRank.has(Rank.MODERATOR)) deniedAccess = true; } - else + else if (servUp.startsWith("CLANS-")) { - Plugin.sendPlayerToServer(player, args[0]); + if (!playerRank.has(Rank.HELPER)) + { + UtilPlayer.message(player, F.main(Plugin.getName(), "Clans servers can only be joined via the Clans Hub!")); + return; + } } if (deniedAccess) @@ -81,6 +81,10 @@ public class ServerCommand extends CommandBase player, F.main(Plugin.getName(), C.cRed + "You don't have permission to join " + C.cGold + args[0])); } + else + { + Plugin.sendPlayerToServer(player, args[0], Intent.PLAYER_REQUEST); + } } }); } @@ -89,7 +93,6 @@ public class ServerCommand extends CommandBase { UtilPlayer.message(player, F.main(Plugin.getName(), C.cRed + "Your arguments are inappropriate for this command!")); - return; } } } diff --git a/Plugins/Mineplex.Core/src/mineplex/core/portal/GenericServer.java b/Plugins/Mineplex.Core/src/mineplex/core/portal/GenericServer.java new file mode 100644 index 000000000..94059bbb3 --- /dev/null +++ b/Plugins/Mineplex.Core/src/mineplex/core/portal/GenericServer.java @@ -0,0 +1,33 @@ +package mineplex.core.portal; + +/** + * Groups of servers with no specific id + */ +public enum GenericServer +{ + /** + * The Hubs, such as Lobby-1 + */ + HUB("Lobby"), + /** + * The Clans Hubs, such as ClansHub-1 + */ + CLANS_HUB("ClansHub"), + /** + * The Beta Hubs, such as BetaHub-1 + */ + BETA_HUB("BetaHub"), + ; + + private final String _name; + + GenericServer(String name) + { + this._name = name; + } + + public String getName() + { + return _name; + } +} diff --git a/Plugins/Mineplex.Core/src/mineplex/core/portal/Intent.java b/Plugins/Mineplex.Core/src/mineplex/core/portal/Intent.java new file mode 100644 index 000000000..5bf35f346 --- /dev/null +++ b/Plugins/Mineplex.Core/src/mineplex/core/portal/Intent.java @@ -0,0 +1,20 @@ +package mineplex.core.portal; + +/** + * The intention for transferring a player. Different intents will cause different behaviours to occur + */ +public enum Intent +{ + /** + * Requested by a player (i.e. /server) + */ + PLAYER_REQUEST, + /** + * Forcibly kicked by the server (i.e. MPS kick) + */ + KICK, + /** + * A transfer was initiated from a remote server (i.e. /send) + */ + FORCE_TRANSFER +} diff --git a/Plugins/Mineplex.Core/src/mineplex/core/portal/Portal.java b/Plugins/Mineplex.Core/src/mineplex/core/portal/Portal.java index c02952384..5d0d5eb88 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/portal/Portal.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/portal/Portal.java @@ -1,6 +1,20 @@ package mineplex.core.portal; -import com.google.common.collect.Lists; +import java.io.ByteArrayOutputStream; +import java.io.DataOutputStream; +import java.io.IOException; +import java.util.Collections; +import java.util.HashSet; +import java.util.Set; +import java.util.UUID; + +import org.bukkit.Bukkit; +import org.bukkit.ChatColor; +import org.bukkit.Sound; +import org.bukkit.entity.Player; +import org.bukkit.event.EventHandler; +import org.bukkit.event.player.PlayerJoinEvent; + import mineplex.core.MiniPlugin; import mineplex.core.account.CoreClientManager; import mineplex.core.common.Rank; @@ -8,189 +22,149 @@ import mineplex.core.common.util.C; import mineplex.core.common.util.Callback; import mineplex.core.common.util.F; import mineplex.core.common.util.UtilPlayer; +import mineplex.core.common.util.UtilServer; import mineplex.core.common.util.UtilTabTitle; -import mineplex.core.party.Party; -import mineplex.core.party.event.PartySendToServerEvent; -import mineplex.core.portal.Commands.SendCommand; -import mineplex.core.portal.Commands.ServerCommand; +import mineplex.core.portal.commands.SendCommand; +import mineplex.core.portal.commands.ServerCommand; +import mineplex.core.portal.events.GenericServerTransferEvent; +import mineplex.core.portal.events.ServerTransferEvent; import mineplex.serverdata.Region; import mineplex.serverdata.commands.ServerCommandManager; -import mineplex.serverdata.commands.ServerTransfer; import mineplex.serverdata.commands.TransferCommand; +import mineplex.serverdata.commands.TransferUUIDCommand; import mineplex.serverdata.data.MinecraftServer; import mineplex.serverdata.servers.ServerManager; import mineplex.serverdata.servers.ServerRepository; -import org.bukkit.Bukkit; -import org.bukkit.ChatColor; -import org.bukkit.Sound; -import org.bukkit.entity.Player; -import org.bukkit.event.EventHandler; -import org.bukkit.event.player.PlayerJoinEvent; -import org.bukkit.plugin.java.JavaPlugin; - -import java.io.ByteArrayOutputStream; -import java.io.DataOutputStream; -import java.io.IOException; -import java.util.HashSet; -import java.util.List; -import java.util.Random; public class Portal extends MiniPlugin { // The singleton instance of Portal private static Portal instance; - public static Portal getInstance() { return instance; } - - private ServerRepository _repository; - private CoreClientManager _clientManager; - private HashSet _connectingPlayers = new HashSet(); - - private Region _region; - private String _serverName; - - public Portal(JavaPlugin plugin, CoreClientManager clientManager, String serverName) + + public static Portal getInstance() { - super("Portal", plugin); + return instance; + } + + private final CoreClientManager _clientManager = require(CoreClientManager.class); + + private final ServerRepository _repository; + private final Set _connectingPlayers = Collections.synchronizedSet(new HashSet<>()); + + public Portal() + { + super("Portal"); instance = this; - _clientManager = clientManager; - _region = plugin.getConfig().getBoolean("serverstatus.us") ? Region.US : Region.EU; - _serverName = serverName; - _repository = ServerManager.getServerRepository(_region); - + _repository = ServerManager.getServerRepository(getPlugin().getConfig().getBoolean("serverstatus.us") ? Region.US : Region.EU); + Bukkit.getMessenger().registerOutgoingPluginChannel(getPlugin(), "BungeeCord"); - - // Register the server command type for future use - ServerCommandManager.getInstance().registerCommandType("TransferCommand", TransferCommand.class, new TransferHandler()); + + ServerCommandManager.getInstance().registerCommandType(TransferCommand.class, command -> + { + Player player = Bukkit.getPlayerExact(command.getPlayerName()); + + if (player != null && player.isOnline()) + { + sendPlayerToServer(player, command.getTargetServer(), Intent.FORCE_TRANSFER); + } + }); + ServerCommandManager.getInstance().registerCommandType(TransferUUIDCommand.class, command -> + { + Player player = Bukkit.getPlayer(command.getPlayerUUID()); + + if (player != null && player.isOnline()) + { + sendPlayerToServer(player, command.getTargetServer(), Intent.FORCE_TRANSFER); + } + }); } - @EventHandler - public void join(PlayerJoinEvent event) + public void sendAllPlayersToGenericServer(GenericServer hub, Intent kick) { - Player player = event.getPlayer(); - //Player List - String serverName = _plugin.getConfig().getString("serverstatus.name"); - UtilTabTitle.setHeaderAndFooter(player, C.Bold + "Mineplex Network " + C.cGreen + serverName, "Visit " + C.cGreen + "www.mineplex.com" + ChatColor.RESET + " for News, Forums and Shop"); - } - - public void sendAllPlayers(String serverName) - { - for (Player player : Bukkit.getOnlinePlayers()) + for (Player player : UtilServer.GetPlayers()) { - sendPlayerToServer(player, serverName); + sendPlayerToGenericServer(player, hub, kick); } } - - public void sendPlayerToServer(Player player, String serverName) - { - sendPlayerToServer(player, serverName, false); - } - - public void sendPlayerToServer(final Player player, final String serverName, boolean draggedByParty) + + public void sendPlayerToGenericServer(Player player, GenericServer genericServer, Intent intent) { if (_connectingPlayers.contains(player.getName())) return; - ServerTransferEvent event = new ServerTransferEvent(player, serverName, draggedByParty); - Bukkit.getPluginManager().callEvent(event); + GenericServerTransferEvent event = new GenericServerTransferEvent(player, genericServer, intent); + UtilServer.CallEvent(event); - final boolean override = serverName.equalsIgnoreCase("Lobby") || serverName.equalsIgnoreCase("ClansHub"); - final Rank playerRank = _clientManager.Get(player).GetRank(); - - if (event.getParty() != null && override) - { - Party party = event.getParty(); - if(!party.getOwner().equalsIgnoreCase(player.getName())) - { - return; - } - sendParty(party); - return; - } - - if (event.getParty() != null && serverName.toUpperCase().startsWith("CLANS-")) - { - event.getParty().sendMessage(F.main(getName(), "You cannot join Clans while in a party!")); - return; - } - - if (override) - { - sendPlayer(player, serverName); - return; - } - - if (event.isCancel()) + if (event.isCancelled()) { return; } - runAsync(() -> { + sendPlayer(player, genericServer.getName()); + } + + public void sendPlayerToServer(Player player, String serverName, Intent intent) + { + if (_connectingPlayers.contains(player.getName())) + return; + + ServerTransferEvent event = new ServerTransferEvent(player, serverName, intent); + UtilServer.CallEvent(event); + + if (event.isCancelled()) + { + return; + } + + Rank playerRank = _clientManager.Get(player).GetRank(); + + runAsync(() -> + { final MinecraftServer server = _repository.getServerStatus(serverName); if (server == null) return; - - Bukkit.getServer().getScheduler().runTask(_plugin, () -> { + + runSync(() -> + { + if (server.getGroup().equalsIgnoreCase("Clans") && server.getMotd().equalsIgnoreCase("Restarting soon")) + { + UtilPlayer.message(player, F.main(getName(), C.cGold + "serverName" + C.cRed + " is restarting!")); + return; + } if (server.getPlayerCount() < server.getMaxPlayerCount() || playerRank.has(Rank.ULTRA)) { sendPlayer(player, serverName); } else + { UtilPlayer.message(player, F.main(getName(), C.cGold + serverName + C.cRed + " is full!")); + } }); }); } - private void sendParty(Party party) - { - ServerRepository repository = ServerManager.getServerRepository(_region); - MinecraftServer best = null; - List serverList = Lists.newArrayList(repository.getServersByGroup("Lobby")); - int lowest = Integer.MAX_VALUE; - for (MinecraftServer server : serverList) - { - int playercount = server.getPlayerCount(); - if (playercount < 20) - { - continue; - } - if (playercount < lowest) - { - lowest = playercount; - if (best == null) - { - best = server; - } - } - } - if (best == null) - { - //Well, fuck. - best = serverList.get(new Random().nextInt(serverList.size())); - } - - PartySendToServerEvent serverEvent = new PartySendToServerEvent(party, best); - getPluginManager().callEvent(serverEvent); - } - public static void transferPlayer(String playerName, String serverName) - { - ServerTransfer serverTransfer = new ServerTransfer(playerName, serverName); - TransferCommand transferCommand = new TransferCommand(serverTransfer); - transferCommand.publish(); + { + new TransferCommand(playerName, serverName).publish(); } - + + public static void transferPlayer(UUID playerUUID, String serverName) + { + new TransferUUIDCommand(playerUUID, serverName).publish(); + } + public void doesServerExist(final String serverName, final Callback callback) { if (callback == null) return; - - Bukkit.getScheduler().runTaskAsynchronously(getPlugin(), () -> { - final boolean serverExists = ServerManager.getServerRepository(_region).serverExists(serverName); - Bukkit.getScheduler().runTask(getPlugin(), () -> callback.run(serverExists)); + runAsync(() -> + { + boolean result = _repository.serverExists(serverName); + runSync(() -> callback.run(result)); }); } @@ -200,7 +174,7 @@ public class Portal extends MiniPlugin addCommand(new SendCommand(this)); } - public void sendToHub(Player player, String message) + public void sendToHub(Player player, String message, Intent intent) { if (message != null) { @@ -210,42 +184,50 @@ public class Portal extends MiniPlugin } player.playSound(player.getLocation(), Sound.ENDERDRAGON_GROWL, 10f, 1f); - sendPlayerToServer(player, "Lobby"); + sendPlayerToGenericServer(player, GenericServer.HUB, intent); } - + + /** + * Directly sends a player to the provided server name, bypassing all validation + * + * @param player The player to send + * @param serverName The destination server + */ public void sendPlayer(final Player player, String serverName) { ByteArrayOutputStream b = new ByteArrayOutputStream(); DataOutputStream out = new DataOutputStream(b); - - try + + try { - out.writeUTF("Connect"); - out.writeUTF(serverName); + out.writeUTF("Connect"); + out.writeUTF(serverName); } - catch (IOException e) + catch (IOException ignored) { - // Can never happen } - finally - { - try - { - out.close(); - } - catch (IOException e) - { - e.printStackTrace(); - } - } - + player.sendPluginMessage(getPlugin(), "BungeeCord", b.toByteArray()); _connectingPlayers.add(player.getName()); - + getScheduler().scheduleSyncDelayedTask(getPlugin(), () -> _connectingPlayers.remove(player.getName()), 20L); - - UtilPlayer.message(player, F.main(getName(), "You have been sent from " + C.cGold + _serverName + C.cGray + " to " + C.cGold + serverName)); + + UtilPlayer.message(player, F.main(getName(), "You have been sent from " + C.cGold + UtilServer.getServerName() + C.cGray + " to " + C.cGold + serverName)); } + @EventHandler + private void setTabHeaderAndFooterOnJoin(PlayerJoinEvent event) + { + UtilTabTitle.setHeaderAndFooter( + event.getPlayer(), + C.Bold + "Mineplex Network " + C.cGreen + UtilServer.getServerName(), + "Visit " + C.cGreen + "www.mineplex.com" + ChatColor.RESET + " for News, Forums and Shop" + ); + } + + public ServerRepository getRepository() + { + return _repository; + } } diff --git a/Plugins/Mineplex.Core/src/mineplex/core/portal/ServerTransferEvent.java b/Plugins/Mineplex.Core/src/mineplex/core/portal/ServerTransferEvent.java deleted file mode 100644 index 8a19c65c0..000000000 --- a/Plugins/Mineplex.Core/src/mineplex/core/portal/ServerTransferEvent.java +++ /dev/null @@ -1,74 +0,0 @@ -package mineplex.core.portal; - -import mineplex.core.party.Party; -import org.bukkit.entity.Player; -import org.bukkit.event.Event; -import org.bukkit.event.HandlerList; - -public class ServerTransferEvent extends Event -{ - - private static final HandlerList _handlers = new HandlerList(); - private Player _player; - private String _server; - private Party _party; - private boolean _draggedByParty; - private boolean _cancel; - - public ServerTransferEvent(Player player, String server, boolean draggedByParty) - { - _player = player; - _server = server; - _draggedByParty = draggedByParty; - } - - public boolean isDraggedByParty() - { - return _draggedByParty; - } - - public void setDraggedByParty(boolean draggedByParty) - { - _draggedByParty = draggedByParty; - } - - public HandlerList getHandlers() - { - return _handlers; - } - - public static HandlerList getHandlerList() - { - return _handlers; - } - - public Player getPlayer() - { - return _player; - } - - public String getServer() - { - return _server; - } - - public boolean isCancel() - { - return _cancel; - } - - public void setCancel(boolean cancel) - { - _cancel = cancel; - } - - public Party getParty() - { - return _party; - } - - public void setParty(Party party) - { - _party = party; - } -} diff --git a/Plugins/Mineplex.Core/src/mineplex/core/portal/TransferHandler.java b/Plugins/Mineplex.Core/src/mineplex/core/portal/TransferHandler.java deleted file mode 100644 index 991d1e677..000000000 --- a/Plugins/Mineplex.Core/src/mineplex/core/portal/TransferHandler.java +++ /dev/null @@ -1,27 +0,0 @@ -package mineplex.core.portal; - -import mineplex.serverdata.commands.CommandCallback; -import mineplex.serverdata.commands.ServerCommand; -import mineplex.serverdata.commands.ServerTransfer; -import mineplex.serverdata.commands.TransferCommand; -import org.bukkit.Bukkit; -import org.bukkit.entity.Player; - -public class TransferHandler implements CommandCallback -{ - public void run(ServerCommand command) - { - if (command instanceof TransferCommand) - { - TransferCommand transferCommand = (TransferCommand) command; - ServerTransfer transfer = transferCommand.getTransfer(); - - Player player = Bukkit.getPlayerExact(transfer.getPlayerName()); - - if (player != null && player.isOnline()) - { - Portal.getInstance().sendPlayerToServer(player, transfer.getServerName()); - } - } - } -} diff --git a/Plugins/Mineplex.Core/src/mineplex/core/portal/events/GenericServerTransferEvent.java b/Plugins/Mineplex.Core/src/mineplex/core/portal/events/GenericServerTransferEvent.java new file mode 100644 index 000000000..b0b130e38 --- /dev/null +++ b/Plugins/Mineplex.Core/src/mineplex/core/portal/events/GenericServerTransferEvent.java @@ -0,0 +1,65 @@ +package mineplex.core.portal.events; + +import org.bukkit.entity.Player; +import org.bukkit.event.Cancellable; +import org.bukkit.event.Event; +import org.bukkit.event.HandlerList; + +import mineplex.core.portal.GenericServer; +import mineplex.core.portal.Intent; + +public class GenericServerTransferEvent extends Event implements Cancellable +{ + private static final HandlerList HANDLER_LIST = new HandlerList(); + + private Player _player; + private GenericServer _server; + private boolean _cancel = false; + + private Intent _intent; + + public GenericServerTransferEvent(Player player, GenericServer server, Intent intent) + { + _player = player; + _server = server; + _intent = intent; + } + + public Player getPlayer() + { + return _player; + } + + public GenericServer getServer() + { + return _server; + } + + public Intent getIntent() + { + return _intent; + } + + @Override + public boolean isCancelled() + { + return this._cancel; + } + + @Override + public void setCancelled(boolean b) + { + this._cancel = b; + } + + public HandlerList getHandlers() + { + return HANDLER_LIST; + } + + public static HandlerList getHandlerList() + { + return HANDLER_LIST; + } + +} diff --git a/Plugins/Mineplex.Core/src/mineplex/core/portal/events/ServerTransferEvent.java b/Plugins/Mineplex.Core/src/mineplex/core/portal/events/ServerTransferEvent.java new file mode 100644 index 000000000..cdc3d41e0 --- /dev/null +++ b/Plugins/Mineplex.Core/src/mineplex/core/portal/events/ServerTransferEvent.java @@ -0,0 +1,64 @@ +package mineplex.core.portal.events; + +import org.bukkit.entity.Player; +import org.bukkit.event.Cancellable; +import org.bukkit.event.Event; +import org.bukkit.event.HandlerList; + +import mineplex.core.portal.Intent; + +public class ServerTransferEvent extends Event implements Cancellable +{ + private static final HandlerList HANDLER_LIST = new HandlerList(); + + private Player _player; + private String _server; + private boolean _cancel = false; + + private Intent _intent; + + public ServerTransferEvent(Player player, String server, Intent intent) + { + _player = player; + _server = server; + _intent = intent; + } + + public Player getPlayer() + { + return _player; + } + + public String getServer() + { + return _server; + } + + public Intent getIntent() + { + return _intent; + } + + @Override + public boolean isCancelled() + { + return this._cancel; + } + + @Override + public void setCancelled(boolean b) + { + this._cancel = b; + } + + public HandlerList getHandlers() + { + return HANDLER_LIST; + } + + public static HandlerList getHandlerList() + { + return HANDLER_LIST; + } + +} diff --git a/Plugins/Mineplex.Core/src/mineplex/core/powerplayclub/PowerPlayClubRepository.java b/Plugins/Mineplex.Core/src/mineplex/core/powerplayclub/PowerPlayClubRepository.java index c40eb8fb6..e28b0509f 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/powerplayclub/PowerPlayClubRepository.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/powerplayclub/PowerPlayClubRepository.java @@ -9,10 +9,8 @@ import java.time.LocalDate; import java.time.YearMonth; import java.util.ArrayList; import java.util.HashMap; -import java.util.HashSet; import java.util.List; import java.util.Map; -import java.util.Set; import java.util.UUID; import java.util.concurrent.CompletableFuture; import java.util.concurrent.CompletionException; @@ -104,14 +102,15 @@ public class PowerPlayClubRepository implements Listener { Player player = event.getPlayer(); PowerPlayData cached = getCachedData(player); - PowerPlayClubRewards.rewardsForMonths(cached.getUsableCosmeticMonths()).stream() - .map(PowerPlayClubRewards.PowerPlayClubItem::getPrize) - .forEach(_donationManager.Get(player)::AddUnknownSalesPackagesOwned); + + List list = PowerPlayClubRewards.rewardsForMonths(cached.getUsableCosmeticMonths()); + + PowerPlayClubRewards.rewardsForMonths(cached.getUsableCosmeticMonths()).forEach(item -> item.reward(player)); // Gives Metal Man for anyone subscribed if (cached.getUsableCosmeticMonths().size() > 0) { - _donationManager.Get(player).AddUnknownSalesPackagesOwned("Metal Man Morph"); + _donationManager.Get(player).addOwnedUnknownSalesPackage("Metal Man Morph"); } } diff --git a/Plugins/Mineplex.Core/src/mineplex/core/powerplayclub/PowerPlayClubRewards.java b/Plugins/Mineplex.Core/src/mineplex/core/powerplayclub/PowerPlayClubRewards.java index 1d7606146..3d5f61a42 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/powerplayclub/PowerPlayClubRewards.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/powerplayclub/PowerPlayClubRewards.java @@ -8,18 +8,20 @@ import java.util.Set; import java.util.concurrent.CompletableFuture; import java.util.stream.Collectors; -import org.bukkit.Material; import org.bukkit.entity.Player; -import org.bukkit.inventory.ItemStack; import com.google.common.collect.ImmutableMap; -import mineplex.core.common.skin.SkinData; +import mineplex.core.Managers; import mineplex.core.common.util.BukkitFuture; import mineplex.core.common.util.F; import mineplex.core.common.util.UtilPlayer; +import mineplex.core.donation.DonationManager; import mineplex.core.inventory.InventoryManager; import mineplex.core.inventory.data.Item; +import mineplex.core.pet.PetClient; +import mineplex.core.pet.PetManager; +import mineplex.core.pet.PetType; public class PowerPlayClubRewards { @@ -27,31 +29,73 @@ public class PowerPlayClubRewards public static final int CHESTS_PER_MONTH = 1; private static final Map rewards = ImmutableMap.builder() - .put(YearMonth.of(2016, Month.SEPTEMBER), new PowerPlayClubItem("Squid Morph", new ItemStack(Material.INK_SACK))) - .put(YearMonth.of(2016, Month.OCTOBER), new PowerPlayClubItem("Witch Morph", SkinData.WITCH.getSkull())) - .put(YearMonth.of(2016, Month.NOVEMBER), new PowerPlayClubItem("Turkey Morph", SkinData.TURKEY.getSkull())) - .put(YearMonth.of(2017, Month.JANUARY), new PowerPlayClubItem("Chicken Mount", new ItemStack(Material.GLASS))) + .put(YearMonth.of(2016, Month.SEPTEMBER), new UnknownSalesPackageItem("Squid Morph")) + .put(YearMonth.of(2016, Month.OCTOBER), new UnknownSalesPackageItem("Witch Morph")) + .put(YearMonth.of(2016, Month.NOVEMBER), new UnknownSalesPackageItem("Turkey Morph")) + .put(YearMonth.of(2016, Month.DECEMBER), new UnknownSalesPackageItem("Santa Morph")) + .put(YearMonth.of(2017, Month.JANUARY), new UnknownSalesPackageItem("Over Easy Morph")) + .put(YearMonth.of(2017, Month.FEBRUARY), new PetItem(PetType.TRUE_LOVE_PET)) + .put(YearMonth.of(2017, Month.MARCH), new UnknownSalesPackageItem("Gold Pot Morph")) .build(); - public static class PowerPlayClubItem + public interface PowerPlayClubItem { - private final String _prize; - private final ItemStack _display; + // The name of the Power Play Club prize to be shown as lore in Carl's GUI + String getPrizeName(); + // Give the player this reward + void reward(Player player); + } - PowerPlayClubItem(String prize, ItemStack display) + private static class UnknownSalesPackageItem implements PowerPlayClubItem + { + private static final DonationManager _donationManager = Managers.require(DonationManager.class); + private final String _name; + + UnknownSalesPackageItem(String name) { - _prize = prize; - _display = display; + _name = name; } - public String getPrize() + @Override + public String getPrizeName() { - return _prize; + return _name; } - public ItemStack getDisplay() + @Override + public void reward(Player player) { - return _display; + _donationManager.Get(player).addOwnedUnknownSalesPackage(_name); + } + } + + private static class PetItem implements PowerPlayClubItem + { + private final PetType _type; + + PetItem(PetType type) + { + _type = type; + } + + @Override + public String getPrizeName() + { + return _type.getName() + " Pet"; + } + + @Override + public void reward(Player player) + { + PetManager petManager = Managers.get(PetManager.class); + if (petManager != null) + { + PetClient client = petManager.Get(player); + if (!client.getPets().containsKey(_type)) + { + client.getPets().put(_type, _type.getName()); + } + } } } diff --git a/Plugins/Mineplex.Core/src/mineplex/core/powerplayclub/PowerPlayData.java b/Plugins/Mineplex.Core/src/mineplex/core/powerplayclub/PowerPlayData.java index 178916f39..f478de57c 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/powerplayclub/PowerPlayData.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/powerplayclub/PowerPlayData.java @@ -33,7 +33,7 @@ public class PowerPlayData { if (subscriptions.isEmpty()) { - return new PowerPlayData(Optional.empty(), Collections.emptySet(), Collections.emptySet()); + return new PowerPlayData(Optional.empty(), new HashSet<>(), new HashSet<>()); } final LocalDate today = LocalDate.now(); @@ -138,7 +138,7 @@ public class PowerPlayData } } - enum SubscriptionDuration + public static enum SubscriptionDuration { MONTH, YEAR } diff --git a/Plugins/Mineplex.Core/src/mineplex/core/preferences/Preference.java b/Plugins/Mineplex.Core/src/mineplex/core/preferences/Preference.java index 389d80fb3..fbeb15eb2 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/preferences/Preference.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/preferences/Preference.java @@ -20,11 +20,13 @@ import java.util.Map; public enum Preference { - HUB_GAMES(true, PreferenceCategory.USER, Material.FIREBALL, "Hub Player Stacker"), + HUB_GAMES(true, PreferenceCategory.USER, Material.FIREBALL, "Hub Games"), SHOW_PLAYERS(true, PreferenceCategory.USER, Material.EYE_OF_ENDER, "Hub Player Visibility"), SHOW_CHAT(true, PreferenceCategory.USER, Material.PAPER, "Player Chat"), PRIVATE_MESSAGING(true, PreferenceCategory.USER, Material.MAP, "Private Messaging"), - PARTY_REQUESTS(true, PreferenceCategory.USER, Material.SKULL_ITEM, "Party Requests"), + + // TIM WHY DID YOU MAKE THE ID ORDINAL YOU DHAJDHJGHADJHGFAJHFSJDHAJDHSJHJA + PARTY_REQUESTS(true, PreferenceCategory.SOCIAL, Material.SKULL_ITEM, "Party Requests"), INVISIBILITY(false, PreferenceCategory.EXCLUSIVE, Material.NETHER_STAR, "Hub Invisibility & Flight"), FORCE_FIELD(false, PreferenceCategory.EXCLUSIVE, Material.SLIME_BALL, "Hub Forcefield"), @@ -32,8 +34,8 @@ public enum Preference SHOW_USER_REPORTS(false, PreferenceCategory.EXCLUSIVE, Material.BOOK, "User Reports"), IGNORE_VELOCITY(false, PreferenceCategory.EXCLUSIVE, Material.SADDLE, "Hub Ignore Velocity"), - PENDING_FRIEND_REQUESTS(true, PreferenceCategory.FRIEND, Material.RED_ROSE, "Show Pending Friend Requests"), - FRIENDS_DISPLAY_INVENTORY_UI(true, PreferenceCategory.FRIEND, Material.CHEST, "Display Friend GUI"), + PENDING_FRIEND_REQUESTS(true, PreferenceCategory.SOCIAL, Material.RED_ROSE, "Show Pending Friend Requests"), + FRIENDS_DISPLAY_INVENTORY_UI(true, PreferenceCategory.SOCIAL, Material.CHEST, "Display Friend GUI"), CLAN_TIPS(true, PreferenceCategory.MISC, Material.IRON_SWORD, "Show Clan Tips"), HUB_MUSIC(true, PreferenceCategory.MISC, Material.NOTE_BLOCK, "Hub Music"), @@ -41,6 +43,10 @@ public enum Preference AUTO_JOIN_NEXT_GAME(true, PreferenceCategory.GAME_PLAY, Material.DIAMOND_SWORD, "Auto Join Next Game", "Feel like playing again?", "Enable this, and when you're out", "a 15 second timer will start", "when it ends, it'll send you", "to another game!"), DISABLE_WARNING(true, PreferenceCategory.GAME_PLAY, Material.BARRIER, "Disable Automatic Warning", "Know what you're doing?", "Disable this to not receive", "a message warning you about Auto-Join"), COUNTDOWN_ON_CLICK(false, PreferenceCategory.GAME_PLAY, Material.WATCH, "Countdown to Join", "See that fancy text when you're out?", "If you click it, and this is enabled", "a 15 second time will countdown", "until you are sent to a new game"), + + COMMUNITY_INVITES(true, PreferenceCategory.SOCIAL, Material.BOOK, "Show Community Invites"), + + PARTY_DISPLAY_INVENTORY_UI(true, PreferenceCategory.SOCIAL, Material.CHEST, "Display Parties GUI") ; private static final Map PREFERENCE_MAP = Maps.newHashMap(); diff --git a/Plugins/Mineplex.Core/src/mineplex/core/preferences/PreferenceCategory.java b/Plugins/Mineplex.Core/src/mineplex/core/preferences/PreferenceCategory.java index 7e99cd29e..1f870bd4e 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/preferences/PreferenceCategory.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/preferences/PreferenceCategory.java @@ -15,7 +15,7 @@ public enum PreferenceCategory EXCLUSIVE("Exclusive", Material.DIAMOND), GAME_PLAY("Game Mechanic", Material.REDSTONE_COMPARATOR), MISC("Miscellaneous", Material.COMPASS), - FRIEND("Friend", Material.CHEST), + SOCIAL("Social", Material.RED_ROSE), ; private String _name; diff --git a/Plugins/Mineplex.Core/src/mineplex/core/preferences/PreferencesRepository.java b/Plugins/Mineplex.Core/src/mineplex/core/preferences/PreferencesRepository.java index 0363d05ac..a1b7c422e 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/preferences/PreferencesRepository.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/preferences/PreferencesRepository.java @@ -3,13 +3,14 @@ package mineplex.core.preferences; import mineplex.core.database.MinecraftRepository; import mineplex.core.progression.util.SQLStatement; import mineplex.serverdata.database.DBPool; +import mineplex.serverdata.database.RepositoryBase; import mineplex.serverdata.database.column.ColumnInt; import java.sql.Connection; import java.sql.PreparedStatement; import java.sql.SQLException; -public class PreferencesRepository extends MinecraftRepository +public class PreferencesRepository extends RepositoryBase { private static String UPSERT_ACCOUNT = "INSERT INTO `preferences` VALUES(?, ?, ?) ON DUPLICATE KEY UPDATE `value`= ?"; @@ -19,20 +20,10 @@ public class PreferencesRepository extends MinecraftRepository public PreferencesRepository(PreferencesManager plugin) { - super(plugin.getPlugin(), DBPool.getAccount()); + super(DBPool.getAccount()); _manager = plugin; } - @Override - protected void initialize() - { - } - - @Override - protected void update() - { - } - /** * Save a player's preferences in SQL * @@ -101,7 +92,7 @@ public class PreferencesRepository extends MinecraftRepository public void async(Runnable runnable) { - getPlugin().getServer().getScheduler().runTaskAsynchronously(getPlugin(), runnable); + _manager.runAsync(runnable); } /** diff --git a/Plugins/Mineplex.Core/src/mineplex/core/preferences/ui/ExclusivePreferencesPage.java b/Plugins/Mineplex.Core/src/mineplex/core/preferences/ui/ExclusivePreferencesPage.java deleted file mode 100644 index e69de29bb..000000000 diff --git a/Plugins/Mineplex.Core/src/mineplex/core/progression/KitProgressionRepository.java b/Plugins/Mineplex.Core/src/mineplex/core/progression/KitProgressionRepository.java index 35e6ca273..8683a5cfa 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/progression/KitProgressionRepository.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/progression/KitProgressionRepository.java @@ -1,9 +1,12 @@ package mineplex.core.progression; +import mineplex.core.common.util.UtilServer; import mineplex.core.database.MinecraftRepository; import mineplex.core.progression.data.PlayerKit; import mineplex.core.progression.util.SQLStatement; import mineplex.serverdata.database.DBPool; +import mineplex.serverdata.database.RepositoryBase; + import org.bukkit.Bukkit; import java.sql.Connection; @@ -15,7 +18,7 @@ import java.util.UUID; /** * Handles all things database related. */ -public class KitProgressionRepository extends MinecraftRepository +public class KitProgressionRepository extends RepositoryBase { private final String CREATE_TABLE = "CREATE TABLE IF NOT EXISTS `kitProgression` (" + @@ -33,20 +36,10 @@ public class KitProgressionRepository extends MinecraftRepository public KitProgressionRepository(KitProgressionManager plugin) { - super(plugin.getPlugin(), DBPool.getAccount()); + super(DBPool.getAccount()); _kitProgressionManager = plugin; } - @Override - protected void initialize() - { - } - - @Override - protected void update() - { - } - /** * Inserts data for a kit into the database * This will update the info if the kit is already in there @@ -82,7 +75,7 @@ public class KitProgressionRepository extends MinecraftRepository if (effect == -1) { //Something went wrong uh oh - this.getPlugin().getLogger().severe("Inserting new Kit Data for " + playerKit.getUuid() + " failed!"); + _kitProgressionManager.getPlugin().getLogger().severe("Inserting new Kit Data for " + playerKit.getUuid() + " failed!"); } } catch (SQLException e) { @@ -127,7 +120,7 @@ public class KitProgressionRepository extends MinecraftRepository int effect = executeUpdate(statement); if (effect == -1) { - this.getPlugin().getLogger().severe("Updating default value for" + playerKit.getUuid().toString() + "'s kit failed!"); + _kitProgressionManager.getPlugin().getLogger().severe("Updating default value for" + playerKit.getUuid().toString() + "'s kit failed!"); } } catch (SQLException e) { @@ -246,7 +239,7 @@ public class KitProgressionRepository extends MinecraftRepository private void async(Runnable runnable) { - Bukkit.getScheduler().runTaskAsynchronously(_plugin, runnable); + UtilServer.runAsync(runnable); } } diff --git a/Plugins/Mineplex.Core/src/mineplex/core/progression/data/KitUpgradeProcessor.java b/Plugins/Mineplex.Core/src/mineplex/core/progression/data/KitUpgradeProcessor.java index 5349485a6..e8cff97ee 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/progression/data/KitUpgradeProcessor.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/progression/data/KitUpgradeProcessor.java @@ -1,6 +1,7 @@ package mineplex.core.progression.data; import mineplex.core.server.util.TransactionResponse; + import org.bukkit.Sound; import org.bukkit.entity.Player; import org.bukkit.inventory.Inventory; @@ -19,7 +20,7 @@ public class KitUpgradeProcessor implements ConfirmationProcessor private Player _player; private ProgressiveKit _kit; private int _upgradeLevel; - + public KitUpgradeProcessor(KitProgressionManager manager, Player player, ProgressiveKit kit, int upgradeLevel) { _manager = manager; @@ -39,25 +40,26 @@ public class KitUpgradeProcessor implements ConfirmationProcessor String packageName = _kit.getInternalName() + "." + _upgradeLevel; int cost = Calculations.getGemsCost(_upgradeLevel); // Use UnknownPackages for this right now as it handles overspending gems properly - _manager.getDonationManager().purchaseUnknownSalesPackage(data -> - { - if (data == TransactionResponse.Success) - { - _kit.upgrade(_upgradeLevel, _player.getUniqueId()); + _manager.getDonationManager().purchaseUnknownSalesPackage(_player, packageName, GlobalCurrency.GEM, cost, false, + data -> + { + if (data == TransactionResponse.Success) + { + _kit.upgrade(_upgradeLevel, _player.getUniqueId()); - _player.playSound(_player.getLocation(), Sound.CAT_MEOW, 5.0f, 1.0f); - _player.sendMessage(F.main("Kit Progression", "Purchased upgrades for " + _kit.getDisplayName() + " level " + _upgradeLevel)); + _player.playSound(_player.getLocation(), Sound.CAT_MEOW, 5.0f, 1.0f); + _player.sendMessage(F.main("Kit Progression", "Purchased upgrades for " + _kit.getDisplayName() + " level " + _upgradeLevel)); - callback.resolve("Success! You now own this upgrade!"); - } - else if (data == TransactionResponse.InsufficientFunds) - { - callback.reject("Insufficient funds!"); - } - else - { - callback.reject("There was an error processing your transaction. Try again later"); - } - }, _player, packageName, GlobalCurrency.GEM, cost, false); + callback.resolve("Success! You now own this upgrade!"); + } + else if (data == TransactionResponse.InsufficientFunds) + { + callback.reject("Insufficient funds!"); + } + else + { + callback.reject("There was an error processing your transaction. Try again later"); + } + }); } } diff --git a/Plugins/Mineplex.Core/src/mineplex/core/punish/Command/PunishCommand.java b/Plugins/Mineplex.Core/src/mineplex/core/punish/Command/PunishCommand.java index 65e7affe0..1f9166e6e 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/punish/Command/PunishCommand.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/punish/Command/PunishCommand.java @@ -143,6 +143,6 @@ public class PunishCommand extends CommandBase @Override public List onTabComplete(CommandSender sender, String commandLabel, String[] args) { - return args.length == 1 ? getPlayerMatches((Player)sender, args[0]) : null; + return tabCompletePlayerNames(sender, commandLabel, args); } } diff --git a/Plugins/Mineplex.Core/src/mineplex/core/punish/Punish.java b/Plugins/Mineplex.Core/src/mineplex/core/punish/Punish.java index 4575de030..1a26d65c4 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/punish/Punish.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/punish/Punish.java @@ -1,6 +1,7 @@ package mineplex.core.punish; import java.util.HashMap; +import java.util.function.Consumer; import java.util.logging.Level; import mineplex.core.account.CoreClient; @@ -17,10 +18,12 @@ import org.bukkit.event.player.PlayerQuitEvent; import org.bukkit.plugin.java.JavaPlugin; import com.google.gson.Gson; +import com.google.gson.JsonObject; import mineplex.core.MiniPlugin; import mineplex.core.account.CoreClientManager; import mineplex.core.account.event.ClientWebResponseEvent; +import mineplex.core.common.Constants; import mineplex.core.common.Rank; import mineplex.core.common.util.C; import mineplex.core.common.util.Callback; @@ -35,6 +38,8 @@ import mineplex.core.punish.Tokens.PunishClientToken; import mineplex.core.punish.Tokens.PunishmentToken; import mineplex.core.updater.UpdateType; import mineplex.core.updater.event.UpdateEvent; +import mineplex.serverdata.commands.AddPunishCommand; +import mineplex.serverdata.commands.RemovePunishCommand; import mineplex.serverdata.commands.ServerCommandManager; public class Punish extends MiniPlugin @@ -43,13 +48,13 @@ public class Punish extends MiniPlugin private PunishRepository _repository; private CoreClientManager _clientManager; - public Punish(JavaPlugin plugin, String webServerAddress, CoreClientManager clientManager) + public Punish(JavaPlugin plugin, CoreClientManager clientManager) { super("Punish", plugin); _punishClients = new HashMap(); _clientManager = clientManager; - _repository = new PunishRepository(webServerAddress); + _repository = new PunishRepository(); ServerCommandManager.getInstance().registerCommandType("PunishCommand", mineplex.serverdata.commands.PunishCommand.class, new PunishmentHandler(this)); } @@ -167,6 +172,11 @@ public class Punish extends MiniPlugin } public void AddPunishment(String playerName, final Category category, final String reason, String callerName, final int severity, boolean ban, long duration, final boolean silent) + { + AddPunishment(playerName, category, reason, callerName, severity, ban, duration, silent, null); + } + + public void AddPunishment(String playerName, final Category category, final String reason, String callerName, final int severity, boolean ban, long duration, final boolean silent, Consumer callback) { Player player = Bukkit.getPlayerExact(playerName); if (player != null) @@ -233,6 +243,10 @@ public class Punish extends MiniPlugin } else if (banResult == PunishmentResponse.Punished) { + runAsync(() -> + { + new AddPunishCommand(finalPlayerName, severity, category.name(), sentence.name(), reason, duration, finalCallerName, caller != null ? caller.getUniqueId().toString() : null).publish(); + }); final String durationString = UtilTime.convertString(finalDuration < 0 ? -1 : (long)(finalDuration * 3600000), 1, TimeUnit.FIT); if (sentence == PunishmentSentence.Ban) @@ -250,8 +264,8 @@ public class Punish extends MiniPlugin if (player != null) player.kickPlayer(kickReason); - else - new mineplex.serverdata.commands.PunishCommand(finalPlayerName, true, false, kickReason).publish(); + + new mineplex.serverdata.commands.PunishCommand(finalPlayerName, true, false, kickReason).publish(); } }); @@ -277,8 +291,8 @@ public class Punish extends MiniPlugin UtilPlayer.message(player, F.main("Punish", F.elem(C.cGray + C.Bold + "Reason: ") + reason)); player.playSound(player.getLocation(), Sound.CAT_MEOW, 1f, 1f); } - else - new mineplex.serverdata.commands.PunishCommand(finalPlayerName, false, finalDuration != 0, F.main("Punish", F.elem(C.cGray + C.Bold + "Report Ban Reason: ") + reason)).publish(); + + new mineplex.serverdata.commands.PunishCommand(finalPlayerName, false, finalDuration != 0, F.main("Punish", F.elem(C.cGray + C.Bold + "Report Ban Reason: ") + reason)).publish(); _repository.LoadPunishClient(finalPlayerName, new Callback() { @@ -316,8 +330,8 @@ public class Punish extends MiniPlugin UtilPlayer.message(player, F.main("Punish", F.elem(C.cGray + C.Bold + "Reason: ") + reason)); player.playSound(player.getLocation(), Sound.CAT_MEOW, 1f, 1f); } - else - new mineplex.serverdata.commands.PunishCommand(finalPlayerName, false, finalDuration != 0, F.main("Punish", F.elem(C.cGray + C.Bold + (finalDuration != 0 ? "Mute" : "Warning") + " Reason: ") + reason)).publish(); + + new mineplex.serverdata.commands.PunishCommand(finalPlayerName, false, finalDuration != 0, F.main("Punish", F.elem(C.cGray + C.Bold + (finalDuration != 0 ? "Mute" : "Warning") + " Reason: ") + reason)).publish(); _repository.LoadPunishClient(finalPlayerName, new Callback() { @@ -328,6 +342,10 @@ public class Punish extends MiniPlugin }); } } + if (callback != null) + { + callback.accept(banResult); + } } @@ -382,17 +400,24 @@ public class Punish extends MiniPlugin } } - public void RemovePunishment(int punishmentId, String target, final Player admin, String reason, Callback callback) + public void RemovePunishment(Punishment punishment, String target, final Player admin, String reason, Callback callback) { CoreClient client = _clientManager.Get(admin); - _repository.RemovePunishment(callback, punishmentId, target, reason, client.getName()); + _repository.RemovePunishment(string -> + { + runAsync(() -> + { + PunishmentResponse punishResponse = PunishmentResponse.valueOf(string); + if (punishResponse == PunishmentResponse.PunishmentRemoved) + { + ServerCommandManager.getInstance().publishCommand(new RemovePunishCommand(Constants.GSON.fromJson(Constants.GSON.toJson(punishment), JsonObject.class), target, admin.getName(), admin.getUniqueId(), reason)); + } + }); + + callback.run(string); + }, punishment.GetPunishmentId(), target, reason, client.getName()); } - public void RemoveBan(String name, String reason) - { - _repository.RemoveBan(name, reason); - } - public CoreClientManager GetClients() { return _clientManager; diff --git a/Plugins/Mineplex.Core/src/mineplex/core/punish/PunishRepository.java b/Plugins/Mineplex.Core/src/mineplex/core/punish/PunishRepository.java index 3ed3d380d..01fe48342 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/punish/PunishRepository.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/punish/PunishRepository.java @@ -3,25 +3,24 @@ package mineplex.core.punish; import java.util.List; import com.google.gson.reflect.TypeToken; + import mineplex.core.common.util.Callback; +import mineplex.core.database.MinecraftRepository; import mineplex.core.punish.Tokens.PunishClientToken; import mineplex.core.punish.Tokens.PunishToken; import mineplex.core.punish.Tokens.RemovePunishToken; -import mineplex.core.server.remotecall.AsyncJsonWebCall; -import mineplex.core.server.remotecall.JsonWebCall; +import mineplex.serverdata.database.DBPool; -public class PunishRepository +public class PunishRepository extends MinecraftRepository { - private String _webAddress; - - public PunishRepository(String webServerAddress) + public PunishRepository() { - _webAddress = webServerAddress; + super(DBPool.getAccount()); } - + public void Punish(Callback callback, String target, String category, PunishmentSentence punishment, String reason, double duration, String admin, int severity) { - PunishToken token = new PunishToken(); + PunishToken token = new PunishToken(); token.Target = target; token.Category = category; token.Sentence = punishment.toString(); @@ -30,7 +29,7 @@ public class PunishRepository token.Admin = admin; token.Severity = severity; - new AsyncJsonWebCall(_webAddress + "PlayerAccount/Punish").Execute(String.class, callback, token); + handleMSSQLCall("PlayerAccount/Punish", token, String.class, callback::run); } public void RemovePunishment(Callback callback, int id, String target, String reason, String admin) @@ -41,34 +40,16 @@ public class PunishRepository token.Reason = reason; token.Admin = admin; - new AsyncJsonWebCall(_webAddress + "PlayerAccount/RemovePunishment").Execute(String.class, callback, token); + handleMSSQLCall("PlayerAccount/RemovePunishment", token, String.class, callback::run); } - - public void LoadPunishClient(String target, Callback callback) + + public void LoadPunishClient(String target, Callback callback) { - new AsyncJsonWebCall(_webAddress + "PlayerAccount/GetPunishClient").Execute(PunishClientToken.class, callback, target); + handleMSSQLCall("PlayerAccount/GetPunishClient", target, PunishClientToken.class, callback::run); } - + public void MatchPlayerName(final Callback> callback, final String userName) { - Thread asyncThread = new Thread(new Runnable() - { - public void run() - { - List tokenList = new JsonWebCall(_webAddress + "PlayerAccount/GetMatches").Execute(new TypeToken>(){}.getType(), userName); - callback.run(tokenList); - } - }); - - asyncThread.start(); - } - - public void RemoveBan(String name, String reason) - { - RemovePunishToken token = new RemovePunishToken(); - token.Target = name; - token.Reason = reason; - - new JsonWebCall(_webAddress + "PlayerAccount/RemoveBan").Execute(String.class, token); + handleMSSQLCall("PlayerAccount/GetMatches", userName, new TypeToken>(){}.getType(), callback::run); } } diff --git a/Plugins/Mineplex.Core/src/mineplex/core/punish/UI/PunishPage.java b/Plugins/Mineplex.Core/src/mineplex/core/punish/UI/PunishPage.java index e28ddbcfd..0886521c8 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/punish/UI/PunishPage.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/punish/UI/PunishPage.java @@ -7,6 +7,19 @@ import java.util.HashMap; import java.util.List; import java.util.Map.Entry; +import org.bukkit.ChatColor; +import org.bukkit.Material; +import org.bukkit.craftbukkit.v1_8_R3.inventory.CraftInventoryCustom; +import org.bukkit.enchantments.Enchantment; +import org.bukkit.entity.Player; +import org.bukkit.event.EventHandler; +import org.bukkit.event.HandlerList; +import org.bukkit.event.Listener; +import org.bukkit.event.inventory.ClickType; +import org.bukkit.event.inventory.InventoryClickEvent; +import org.bukkit.event.inventory.InventoryCloseEvent; +import org.bukkit.inventory.ItemStack; + import mineplex.core.Managers; import mineplex.core.antihack.AntiHack; import mineplex.core.common.Rank; @@ -26,19 +39,6 @@ import mineplex.core.punish.PunishmentSorter; import mineplex.core.shop.item.IButton; import mineplex.core.shop.item.ShopItem; -import org.bukkit.ChatColor; -import org.bukkit.Material; -import org.bukkit.craftbukkit.v1_8_R3.inventory.CraftInventoryCustom; -import org.bukkit.enchantments.Enchantment; -import org.bukkit.entity.Player; -import org.bukkit.event.EventHandler; -import org.bukkit.event.HandlerList; -import org.bukkit.event.Listener; -import org.bukkit.event.inventory.ClickType; -import org.bukkit.event.inventory.InventoryClickEvent; -import org.bukkit.event.inventory.InventoryCloseEvent; -import org.bukkit.inventory.ItemStack; - public class PunishPage extends CraftInventoryCustom implements Listener { private Punish _plugin; @@ -76,7 +76,7 @@ public class PunishPage extends CraftInventoryCustom implements Listener _player.openInventory(this); _plugin.registerEvents(this); } - + private void BuildPage() { // Player head @@ -267,7 +267,6 @@ public class PunishPage extends CraftInventoryCustom implements Listener } } catch (Exception e) {} - AddButton(41, new ShopItem(Material.INK_SACK, (byte)1, "Severity 3",new String[] { @@ -512,7 +511,7 @@ public class PunishPage extends CraftInventoryCustom implements Listener public void RemovePunishment(final Punishment punishment, final ItemStack item) { - _plugin.RemovePunishment(punishment.GetPunishmentId(), _target, _player, _reason, new Callback() + _plugin.RemovePunishment(punishment, _target, _player, _reason, new Callback() { @Override public void run(String result) diff --git a/Plugins/Mineplex.Core/src/mineplex/core/rankGiveaway/eternal/EternalCommand.java b/Plugins/Mineplex.Core/src/mineplex/core/rankGiveaway/eternal/EternalCommand.java new file mode 100644 index 000000000..182b19556 --- /dev/null +++ b/Plugins/Mineplex.Core/src/mineplex/core/rankGiveaway/eternal/EternalCommand.java @@ -0,0 +1,46 @@ +package mineplex.core.rankGiveaway.eternal; + +import org.bukkit.Bukkit; +import org.bukkit.Location; +import org.bukkit.entity.Player; + +import mineplex.core.command.CommandBase; +import mineplex.core.common.Rank; +import mineplex.core.common.util.F; +import mineplex.core.common.util.UtilPlayer; + +public class EternalCommand extends CommandBase +{ + public EternalCommand(EternalGiveawayManager plugin) + { + super(plugin, Rank.OWNER, "eternaltest"); + } + + @Override + public void Execute(Player caller, String[] args) + { + if (args.length == 0) + { + Plugin.attemptToGiveEternal(caller, () -> + { + Location location = caller.getLocation().add(0.5, 0.5, 0.5); + new EternalGiveawayAnimation(Plugin, location, 3000L); + }); + } + else + { + String target = args[1]; + Player player = Bukkit.getPlayer(target); + if (player == null) + { + UtilPlayer.message(caller, F.main("Eternal", "That player is not online")); + return; + } + Plugin.attemptToGiveEternal(player, () -> + { + Location location = caller.getLocation().add(0.5, 0.5, 0.5); + new EternalGiveawayAnimation(Plugin, location, 3000L); + }); + } + } +} diff --git a/Plugins/Mineplex.Core/src/mineplex/core/rankGiveaway/eternal/EternalGiveawayAnimation.java b/Plugins/Mineplex.Core/src/mineplex/core/rankGiveaway/eternal/EternalGiveawayAnimation.java new file mode 100644 index 000000000..f933a5acc --- /dev/null +++ b/Plugins/Mineplex.Core/src/mineplex/core/rankGiveaway/eternal/EternalGiveawayAnimation.java @@ -0,0 +1,61 @@ +package mineplex.core.rankGiveaway.eternal; + +import org.bukkit.Bukkit; +import org.bukkit.Color; +import org.bukkit.FireworkEffect.Type; +import org.bukkit.Location; +import org.bukkit.Sound; +import org.bukkit.entity.Player; +import org.bukkit.event.EventHandler; +import org.bukkit.event.EventPriority; +import org.bukkit.event.HandlerList; +import org.bukkit.event.Listener; + +import mineplex.core.common.util.UtilFirework; +import mineplex.core.common.util.UtilServer; +import mineplex.core.common.util.UtilTime; +import mineplex.core.updater.UpdateType; +import mineplex.core.updater.event.UpdateEvent; + +public class EternalGiveawayAnimation implements Listener +{ + private Location _location; + private Long _duration, _startTime, _worldTime; + + public EternalGiveawayAnimation(EternalGiveawayManager manager, Location start, Long duration) + { + _location = start.clone(); + _duration = duration; + _startTime = System.currentTimeMillis(); + Bukkit.getPluginManager().registerEvents(this, manager.getPlugin()); + } + + public EternalGiveawayAnimation(EternalGiveawayManager manager, Location start) + { + this(manager, start, 11111L); + } + + @EventHandler(priority = EventPriority.MONITOR) + public void tick(UpdateEvent event) + { + if (event.getType() != UpdateType.TICK) + return; + + if (UtilTime.elapsed(_startTime, _duration)) + { + remove(); + return; + } + + for (Player player : UtilServer.getPlayers()) + { + player.playSound(_location, Sound.ORB_PICKUP, 5, 5); + UtilFirework.packetPlayFirework(player, _location, Type.BURST, Color.fromRGB(255, 105, 180), true, false); + } + } + + private void remove() + { + HandlerList.unregisterAll(this); + } +} diff --git a/Plugins/Mineplex.Core/src/mineplex/core/rankGiveaway/eternal/EternalGiveawayManager.java b/Plugins/Mineplex.Core/src/mineplex/core/rankGiveaway/eternal/EternalGiveawayManager.java new file mode 100644 index 000000000..ad0ac15ba --- /dev/null +++ b/Plugins/Mineplex.Core/src/mineplex/core/rankGiveaway/eternal/EternalGiveawayManager.java @@ -0,0 +1,106 @@ +package mineplex.core.rankGiveaway.eternal; + +import java.util.Random; + +import org.bukkit.entity.Player; +import org.bukkit.plugin.java.JavaPlugin; + +import mineplex.core.MiniPlugin; +import mineplex.core.account.CoreClientManager; +import mineplex.core.common.Rank; +import mineplex.core.common.util.Callback; +import mineplex.core.rankGiveaway.redis.EternalGiveawayMessage; +import mineplex.core.rankGiveaway.redis.GiveawayMessageHandler; +import mineplex.core.status.ServerStatusManager; +import mineplex.serverdata.Region; +import mineplex.serverdata.commands.ServerCommandManager; + +public class EternalGiveawayManager extends MiniPlugin +{ + + private static final double RANK_FIND_CHANCE = 0.001; + + private EternalGiveawayRepository _repository; + private CoreClientManager _clientManager; + private ServerStatusManager _statusManager; + private Random _random; + + public EternalGiveawayManager(JavaPlugin plugin, CoreClientManager clientManager, ServerStatusManager statusManager) + { + super("Eternal Giveaway", plugin); + + _repository = new EternalGiveawayRepository(plugin); + _clientManager = clientManager; + _statusManager = statusManager; + _random = new Random(); + + ServerCommandManager.getInstance().registerCommandType("EternalGiveawayMessage", EternalGiveawayMessage.class, new GiveawayMessageHandler(plugin)); + } + + @Override + public void addCommands() + { + addCommand(new EternalCommand(this)); + } + + public void openPumpkin(final Player player, final Runnable onSuccess) + { + double rand = _random.nextDouble(); + if (!hasEternal(player) && rand < RANK_FIND_CHANCE) + { + attemptToGiveEternal(player, onSuccess); + } + } + + protected void attemptToGiveEternal(Player player, Runnable onSuccess) + { + final int accountId = _clientManager.getAccountId(player); + final Region region = getRegion(); + final String serverName = getServerName(); + + if (accountId == -1) return; + + // Need to check database that we can give away a rank + runAsync(() -> + { + final boolean pass = _repository.canGiveaway(region); + + if (pass && _repository.addEternal(accountId, region, serverName)) + { + runSync(() -> giveRank(rank -> + { + if (rank == Rank.ETERNAL) + { + EternalGiveawayMessage message = new EternalGiveawayMessage(player.getName(), _repository.getEternalCount() + 1); + message.publish(); + if (onSuccess != null) onSuccess.run(); + } + }, Rank.ETERNAL, player)); + } + }); + } + + /** + * Confirm that the player doesn't already have ETERNAL rank + */ + private boolean hasEternal(Player player) + { + return _clientManager.hasRank(player, Rank.ETERNAL); + } + + public Region getRegion() + { + return _statusManager.getRegion(); + } + + public String getServerName() + { + return _statusManager.getCurrentServerName(); + } + + private void giveRank(Callback callback, Rank rank, Player player) + { + _clientManager.Get(player).SetRank(rank, false); + _clientManager.getRepository().saveRank(callback, player.getName(), player.getUniqueId(), rank, true); + } +} diff --git a/Plugins/Mineplex.Core/src/mineplex/core/rankGiveaway/eternal/EternalGiveawayRepository.java b/Plugins/Mineplex.Core/src/mineplex/core/rankGiveaway/eternal/EternalGiveawayRepository.java new file mode 100644 index 000000000..867d5d5c6 --- /dev/null +++ b/Plugins/Mineplex.Core/src/mineplex/core/rankGiveaway/eternal/EternalGiveawayRepository.java @@ -0,0 +1,72 @@ +package mineplex.core.rankGiveaway.eternal; + +import java.sql.CallableStatement; +import java.sql.Connection; +import java.sql.Types; + +import org.bukkit.plugin.java.JavaPlugin; + +import mineplex.core.database.MinecraftRepository; +import mineplex.serverdata.Region; +import mineplex.serverdata.database.DBPool; +import mineplex.serverdata.database.RepositoryBase; +import mineplex.serverdata.database.column.ColumnInt; +import mineplex.serverdata.database.column.ColumnVarChar; + +public class EternalGiveawayRepository extends RepositoryBase +{ + private static final String ADD_ETERNAL = "INSERT INTO eternalGiveaway (accountId, region, serverName) VALUES (?, ?, ?)"; + + private int _eternalCount; + + public EternalGiveawayRepository(JavaPlugin plugin) + { + super(DBPool.getAccount()); + _eternalCount = 0; + } + + @Override + protected void initialize() + { + + } + + @Override + protected void update() + { + + } + + public boolean addEternal(int accountId, Region region, String serverName) + { + return 1 == executeUpdate(ADD_ETERNAL, new ColumnInt("accountId", accountId), new ColumnVarChar("region", 10, region.name()), new ColumnVarChar("serverName", 64, serverName)); + } + + public boolean canGiveaway(Region region) + { + try (Connection connection = getConnection(); + CallableStatement callableStatement = connection.prepareCall("{call check_eternalGiveaway(?, ?, ?)}")) + { + callableStatement.setString(1, region.name()); + callableStatement.registerOutParameter(2, Types.BOOLEAN); + callableStatement.registerOutParameter(3, Types.INTEGER); + callableStatement.executeUpdate(); + + boolean pass = callableStatement.getBoolean(2); + int eternalCount = callableStatement.getInt(3); + + _eternalCount = eternalCount; + return pass; + } + catch (Exception e) + { + e.printStackTrace(); + } + return false; + } + + public int getEternalCount() + { + return _eternalCount; + } +} diff --git a/Plugins/Mineplex.Core/src/mineplex/core/rankGiveaway/redis/EternalGiveawayMessage.java b/Plugins/Mineplex.Core/src/mineplex/core/rankGiveaway/redis/EternalGiveawayMessage.java new file mode 100644 index 000000000..28c909a46 --- /dev/null +++ b/Plugins/Mineplex.Core/src/mineplex/core/rankGiveaway/redis/EternalGiveawayMessage.java @@ -0,0 +1,32 @@ +package mineplex.core.rankGiveaway.redis; + +import mineplex.serverdata.commands.ServerCommand; + +public class EternalGiveawayMessage extends ServerCommand +{ + private String _playerName; + private int _eternalCount; + + public EternalGiveawayMessage(String playerName, int eternalCount) + { + _playerName = playerName; + _eternalCount = eternalCount; + } + + public String getPlayerName() + { + return _playerName; + } + + public int getEternalCount() + { + return _eternalCount; + } + + @Override + public void run() + { + // Handled in Command Callback + } +} + diff --git a/Plugins/Mineplex.Core/src/mineplex/core/rankGiveaway/redis/GiveawayMessageHandler.java b/Plugins/Mineplex.Core/src/mineplex/core/rankGiveaway/redis/GiveawayMessageHandler.java index 557b227e1..ccea12e19 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/rankGiveaway/redis/GiveawayMessageHandler.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/rankGiveaway/redis/GiveawayMessageHandler.java @@ -44,5 +44,22 @@ public class GiveawayMessageHandler implements CommandCallback player.playSound(player.getEyeLocation(), Sound.AMBIENCE_CAVE, 1, 1); } } + else if (command instanceof EternalGiveawayMessage) + { + EternalGiveawayMessage message = ((EternalGiveawayMessage) command); + String playerName = message.getPlayerName(); + int count = message.getEternalCount(); + String countString = count + UtilTime.getDayOfMonthSuffix(count); + String chatMessage = C.cPurple + playerName + C.cWhite + " found Eternal Rank in a " + C.cPurple + "Thanksgiving Chicken"; + UtilTextMiddle.display(C.cDPurple + C.Bold + "ETERNAL", chatMessage, 20, 80, 20, UtilServer.getPlayers()); + World world = UtilServer.getPlayers().length > 0 ? UtilServer.getPlayers()[0].getWorld() : Bukkit.getWorlds().get(0); + LightFlicker lightFlicker = new LightFlicker(world); + lightFlicker.runTaskTimer(_plugin, 1, 1); + + for (Player player : UtilServer.getPlayers()) + { + player.playSound(player.getEyeLocation(), Sound.AMBIENCE_CAVE, 1, 1); + } + } } } diff --git a/Plugins/Mineplex.Core/src/mineplex/core/rankGiveaway/titangiveaway/TitanGiveawayRepository.java b/Plugins/Mineplex.Core/src/mineplex/core/rankGiveaway/titangiveaway/TitanGiveawayRepository.java index a9157e562..bc8201eae 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/rankGiveaway/titangiveaway/TitanGiveawayRepository.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/rankGiveaway/titangiveaway/TitanGiveawayRepository.java @@ -8,11 +8,12 @@ import mineplex.core.database.MinecraftRepository; import org.bukkit.plugin.java.JavaPlugin; import mineplex.serverdata.database.DBPool; +import mineplex.serverdata.database.RepositoryBase; import mineplex.serverdata.database.column.ColumnInt; import mineplex.serverdata.database.column.ColumnVarChar; import mineplex.serverdata.Region; -public class TitanGiveawayRepository extends MinecraftRepository +public class TitanGiveawayRepository extends RepositoryBase { private static final String ADD_TITAN = "INSERT INTO titanGiveaway (accountId, region, serverName) VALUES (?, ?, ?)"; @@ -20,22 +21,10 @@ public class TitanGiveawayRepository extends MinecraftRepository public TitanGiveawayRepository(JavaPlugin plugin) { - super(plugin, DBPool.getAccount()); + super(DBPool.getAccount()); _titanCount = 0; } - @Override - protected void initialize() - { - - } - - @Override - protected void update() - { - - } - public boolean addTitan(int accountId, Region region, String serverName) { return 1 == executeUpdate(ADD_TITAN, new ColumnInt("accountId", accountId), new ColumnVarChar("region", 10, region.name()), new ColumnVarChar("serverName", 64, serverName)); diff --git a/Plugins/Mineplex.Core/src/mineplex/core/recharge/Recharge.java b/Plugins/Mineplex.Core/src/mineplex/core/recharge/Recharge.java index 6422651d6..ce46f7dfb 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/recharge/Recharge.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/recharge/Recharge.java @@ -12,8 +12,6 @@ import org.bukkit.event.entity.PlayerDeathEvent; import org.bukkit.plugin.java.JavaPlugin; import mineplex.core.MiniPlugin; -import mineplex.core.updater.event.UpdateEvent; -import mineplex.core.updater.UpdateType; import mineplex.core.account.event.ClientUnloadEvent; import mineplex.core.common.util.F; import mineplex.core.common.util.NautHashMap; @@ -21,6 +19,8 @@ import mineplex.core.common.util.UtilPlayer; import mineplex.core.common.util.UtilServer; import mineplex.core.common.util.UtilTime; import mineplex.core.common.util.UtilTime.TimeUnit; +import mineplex.core.updater.UpdateType; +import mineplex.core.updater.event.UpdateEvent; public class Recharge extends MiniPlugin { @@ -207,10 +207,23 @@ public class Recharge extends MiniPlugin } public boolean usable(Player player, String ability, boolean inform) + { + return usable(player, ability, inform, null); + } + + /** + * Checks if cooldown is over, using a custom message or not + * @param player The player to be checked + * @param ability The ability to be checked + * @param inform Should it inform the player? + * @param message The custom message (if NULL, default message will be shown) + * @return If the ability is in cooldown or not for that player + */ + public boolean usable(Player player, String ability, boolean inform, String message) { if (!Get(player).containsKey(ability)) return true; - + if (Get(player).get(ability).GetRemaining() <= 0) { return true; @@ -218,9 +231,20 @@ public class Recharge extends MiniPlugin else { if (inform && !Get(player).get(ability).DisplayForce && !Get(player).get(ability).AttachItem) - UtilPlayer.message(player, F.main("Recharge", "You cannot use " + F.skill(ability) + " for " + - F.time(UtilTime.convertString((Get(player).get(ability).GetRemaining()), 1, TimeUnit.FIT)) + ".")); - + { + if (message == null) + { + UtilPlayer.message(player, F.main("Recharge", "You cannot use " + F.skill(ability) + " for " + + F.time(UtilTime.convertString((Get(player).get(ability).GetRemaining()), 1, TimeUnit.FIT)) + ".")); + } + else + { + UtilPlayer.message(player, F.main("Recharge", message.replace("%a", F.skill(ability)) + .replace("%t", F.time(UtilTime.convertString(Get(player).get(ability).GetRemaining(), + 1, TimeUnit.FIT))))); + } + } + return false; } } diff --git a/Plugins/Mineplex.Core/src/mineplex/core/report/ReportManager.java b/Plugins/Mineplex.Core/src/mineplex/core/report/ReportManager.java index ed08e2d49..eabff2edb 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/report/ReportManager.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/report/ReportManager.java @@ -867,4 +867,5 @@ public class ReportManager { return NAME + " #" + reportId; } + } diff --git a/Plugins/Mineplex.Core/src/mineplex/core/report/data/ReportRepository.java b/Plugins/Mineplex.Core/src/mineplex/core/report/data/ReportRepository.java index fb1e6ffb6..8a491b798 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/report/data/ReportRepository.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/report/data/ReportRepository.java @@ -372,7 +372,7 @@ public class ReportRepository if (!resultSet.wasNull()) { SnapshotMetadata snapshotMetadata = _reportManager.getSnapshotManager().getRepository() - .getSnapshotMetadata(snapshotId).join(); + .getSnapshotMetadata(connection, snapshotId).join(); report.setSnapshotMetadata(snapshotMetadata); } diff --git a/Plugins/Mineplex.Core/src/mineplex/core/resourcepack/ResourcePackManager.java b/Plugins/Mineplex.Core/src/mineplex/core/resourcepack/ResourcePackManager.java index 2ba415206..8afb55087 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/resourcepack/ResourcePackManager.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/resourcepack/ResourcePackManager.java @@ -24,6 +24,8 @@ import mineplex.core.common.util.C; import mineplex.core.common.util.NautHashMap; import mineplex.core.common.util.UtilPlayer; import mineplex.core.common.util.UtilTime; +import mineplex.core.portal.GenericServer; +import mineplex.core.portal.Intent; import mineplex.core.portal.Portal; import mineplex.core.resourcepack.redis.RedisUnloadResPack; import mineplex.core.updater.event.UpdateEvent; @@ -187,7 +189,7 @@ public class ResourcePackManager extends MiniPlugin implements CommandCallback private void returnHubNoResPack(Player player) { player.playSound(player.getLocation(), Sound.ENDERDRAGON_GROWL, 10f, 1f); - _portal.sendPlayerToServer(player, "Lobby"); + _portal.sendPlayerToGenericServer(player, GenericServer.HUB, Intent.KICK); } private void returnHubNoResPack(Player player, String message) diff --git a/Plugins/Mineplex.Core/src/mineplex/core/reward/RewardManager.java b/Plugins/Mineplex.Core/src/mineplex/core/reward/RewardManager.java index b5a0f5b35..a80f5cf4b 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/reward/RewardManager.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/reward/RewardManager.java @@ -26,7 +26,9 @@ import mineplex.core.gadget.gadgets.arrowtrail.party.ArrowTrailConfetti; import mineplex.core.gadget.gadgets.arrowtrail.shadow.ArrowTrailShadow; import mineplex.core.gadget.gadgets.arrowtrail.vampire.ArrowTrailBlood; import mineplex.core.gadget.gadgets.arrowtrail.wisdom.ArrowTrailEnchant; +import mineplex.core.gadget.gadgets.balloons.BalloonType; import mineplex.core.gadget.gadgets.death.candycane.DeathCandyCane; +import mineplex.core.gadget.gadgets.death.christmas.DeathPresentDanger; import mineplex.core.gadget.gadgets.death.cupidslove.DeathCupidsBrokenHeart; import mineplex.core.gadget.gadgets.death.emerald.DeathEmerald; import mineplex.core.gadget.gadgets.death.freedom.DeathFreedom; @@ -71,11 +73,16 @@ import mineplex.core.gadget.gadgets.morph.MorphChicken; import mineplex.core.gadget.gadgets.morph.MorphCow; import mineplex.core.gadget.gadgets.morph.MorphEnderman; import mineplex.core.gadget.gadgets.morph.MorphGrimReaper; +import mineplex.core.gadget.gadgets.morph.MorphLoveDoctor; import mineplex.core.gadget.gadgets.morph.MorphPumpkinKing; import mineplex.core.gadget.gadgets.morph.MorphSlime; import mineplex.core.gadget.gadgets.morph.MorphSnowman; import mineplex.core.gadget.gadgets.morph.MorphUncleSam; import mineplex.core.gadget.gadgets.morph.MorphVillager; +import mineplex.core.gadget.gadgets.outfit.freezesuit.OutfitFreezeSuitBoots; +import mineplex.core.gadget.gadgets.outfit.freezesuit.OutfitFreezeSuitChestplate; +import mineplex.core.gadget.gadgets.outfit.freezesuit.OutfitFreezeSuitHelmet; +import mineplex.core.gadget.gadgets.outfit.freezesuit.OutfitFreezeSuitLeggings; import mineplex.core.gadget.gadgets.outfit.ravesuit.OutfitRaveSuitBoots; import mineplex.core.gadget.gadgets.outfit.ravesuit.OutfitRaveSuitChestplate; import mineplex.core.gadget.gadgets.outfit.ravesuit.OutfitRaveSuitHelmet; @@ -84,12 +91,14 @@ import mineplex.core.gadget.gadgets.outfit.spacesuit.OutfitSpaceSuitBoots; import mineplex.core.gadget.gadgets.outfit.spacesuit.OutfitSpaceSuitChestplate; import mineplex.core.gadget.gadgets.outfit.spacesuit.OutfitSpaceSuitHelmet; import mineplex.core.gadget.gadgets.outfit.spacesuit.OutfitSpaceSuitLeggings; +import mineplex.core.gadget.gadgets.particle.ParticleChristmasTree; import mineplex.core.gadget.gadgets.particle.ParticleCoalFumes; import mineplex.core.gadget.gadgets.particle.ParticleFairy; import mineplex.core.gadget.gadgets.particle.ParticleFireRings; import mineplex.core.gadget.gadgets.particle.ParticleWingsAngel; import mineplex.core.gadget.gadgets.particle.ParticleWingsDemons; import mineplex.core.gadget.gadgets.particle.ParticleWingsInfernal; +import mineplex.core.gadget.gadgets.particle.ParticleWingsLove; import mineplex.core.gadget.gadgets.particle.ParticleWingsPixie; import mineplex.core.gadget.gadgets.particle.ParticleYinYang; import mineplex.core.gadget.gadgets.particle.candycane.ParticleCandyCane; @@ -103,14 +112,17 @@ import mineplex.core.gadget.gadgets.particle.party.ParticlePartyTime; import mineplex.core.gadget.gadgets.particle.shadow.ParticleFoot; import mineplex.core.gadget.gadgets.particle.vampire.ParticleBlood; import mineplex.core.gadget.gadgets.particle.wisdom.ParticleEnchant; +import mineplex.core.gadget.gadgets.taunts.BlowAKissTaunt; import mineplex.core.gadget.gadgets.wineffect.WinEffectBabyChicken; import mineplex.core.gadget.gadgets.wineffect.WinEffectFlames; import mineplex.core.gadget.gadgets.wineffect.WinEffectHalloween; import mineplex.core.gadget.gadgets.wineffect.WinEffectLavaTrap; import mineplex.core.gadget.gadgets.wineffect.WinEffectLightningStrike; +import mineplex.core.gadget.gadgets.wineffect.WinEffectLoveIsABattlefield; import mineplex.core.gadget.gadgets.wineffect.WinEffectMrPunchMan; import mineplex.core.gadget.gadgets.wineffect.WinEffectRiseOfTheElderGuardian; import mineplex.core.gadget.gadgets.wineffect.WinEffectSnowTrails; +import mineplex.core.gadget.gadgets.wineffect.WinEffectWinterWarfare; import mineplex.core.gadget.types.Gadget; import mineplex.core.gadget.types.GadgetType; import mineplex.core.gadget.types.HatGadget; @@ -118,9 +130,12 @@ import mineplex.core.gadget.types.ItemGadget; import mineplex.core.inventory.InventoryManager; import mineplex.core.mount.Mount; import mineplex.core.mount.types.MountBabyReindeer; +import mineplex.core.mount.types.MountCake; import mineplex.core.mount.types.MountCart; +import mineplex.core.mount.types.MountChicken; import mineplex.core.mount.types.MountFreedomHorse; import mineplex.core.mount.types.MountFrost; +import mineplex.core.mount.types.MountLoveTrain; import mineplex.core.mount.types.MountMule; import mineplex.core.mount.types.MountNightmareSteed; import mineplex.core.mount.types.MountSlime; @@ -130,11 +145,15 @@ import mineplex.core.mount.types.MountValentinesSheep; import mineplex.core.mount.types.MountZombie; import mineplex.core.pet.PetManager; import mineplex.core.pet.PetType; +import mineplex.core.powerplayclub.PowerPlayData.SubscriptionDuration; import mineplex.core.reward.RewardPool.Type; import mineplex.core.reward.rewards.ChestReward; +import mineplex.core.reward.rewards.ExperienceReward; import mineplex.core.reward.rewards.GameAmplifierReward; +import mineplex.core.reward.rewards.GemReward; import mineplex.core.reward.rewards.InventoryReward; import mineplex.core.reward.rewards.PetReward; +import mineplex.core.reward.rewards.PowerPlayReward; import mineplex.core.reward.rewards.RankReward; import mineplex.core.reward.rewards.RuneAmplifierReward; import mineplex.core.reward.rewards.SpinTicketReward; @@ -150,10 +169,10 @@ public class RewardManager private CoreClientManager _clientManager; private DonationManager _donationManager; - private StatsManager _statsManager; private InventoryManager _inventoryManager; private GadgetManager _gadgetManager; private PetManager _petManager; + private StatsManager _statsManager; private final double _gadgetMultiplier = 1; @@ -167,9 +186,9 @@ public class RewardManager private int _legendaryShards = 5000; public RewardManager(CoreClientManager clientManager, DonationManager donationManager, InventoryManager inventoryManager, - PetManager petManager, StatsManager statsManager, GadgetManager gadgetManager) + PetManager petManager, GadgetManager gadgetManager, StatsManager statsManager) { - _rewardPools = new EnumMap(RewardPool.Type.class); + _rewardPools = new EnumMap<>(RewardPool.Type.class); _random = new Random(); for (RewardPool.Type type : RewardPool.Type.values()) @@ -179,10 +198,10 @@ public class RewardManager _clientManager = clientManager; _donationManager = donationManager; - _statsManager = statsManager; _inventoryManager = inventoryManager; _gadgetManager = gadgetManager; _petManager = petManager; + _statsManager = statsManager; _commonAmmoMin *= _gadgetMultiplier; _commonAmmoMax *= _gadgetMultiplier; @@ -203,7 +222,8 @@ public class RewardManager { RewardRarity rarity = RewardRarity.COMMON; - addReward(Type.CARL_SPINNER, new TreasureShardReward(_clientManager, _donationManager, getAmmoMin(rarity), getAmmoMax(rarity), 25, rarity)); + addReward(Type.CARL_SPINNER, new GemReward(_donationManager, getAmmoMin(rarity), getAmmoMax(rarity), 25, 0, rarity)); + addReward(Type.CARL_SPINNER, new ExperienceReward(_statsManager, getAmmoMin(rarity)*5, getAmmoMax(rarity)*5, 25, 0, rarity)); //Normal Gadgets addInventoryReward(Type.NORMAL, getGadget(ItemBatGun.class), rarity, 10, getShards(rarity), 4, 10); @@ -223,13 +243,17 @@ public class RewardManager //Valentines addInventoryReward(Type.VALENTINES_GIFT, getGadget(ItemBow.class), rarity, 300, 0, 1, 5); + + // INFUSED CHESTS + } public void addUncommon() { RewardRarity rarity = RewardRarity.UNCOMMON; - addReward(Type.CARL_SPINNER, new TreasureShardReward(_clientManager, _donationManager, getAmmoMin(rarity), getAmmoMax(rarity), 1200, rarity)); + addReward(Type.CARL_SPINNER, new GemReward(_donationManager, getAmmoMin(rarity), getAmmoMax(rarity), 1200, 0, rarity)); + addReward(Type.CARL_SPINNER, new ExperienceReward(_statsManager, getAmmoMin(rarity)*5, getAmmoMax(rarity)*5, 1200, 0, rarity)); //Gadgets addInventoryReward(Type.NORMAL, getGadget(ItemBatGun.class), rarity, 250, 0, 20, 40); @@ -290,14 +314,31 @@ public class RewardManager addHat(Type.OMEGA, HatType.PUMPKIN, rarity, 75); addHat(Type.OMEGA, HatType.PRESENT, rarity, 5); addHat(Type.OMEGA, HatType.SNOWMAN, rarity, 5); - + + addBalloon(Type.OMEGA,BalloonType.BABY_COW, rarity, 10, 100); + addBalloon(Type.OMEGA, BalloonType.BABY_PIG, rarity, 10, 100); + addBalloon(Type.OMEGA, BalloonType.BABY_SHEEP, rarity, 15, 100); + + // Minestrike Skins + addMineStrikeSkin(Type.MINESTRIKE, MineStrikeSkin.P2000_Fire_Elemental, rarity, 100, 500); + addMineStrikeSkin(Type.MINESTRIKE, MineStrikeSkin.M4A4_Howl, rarity, 100, 500); + addMineStrikeSkin(Type.MINESTRIKE, MineStrikeSkin.Steyr_AUG_Torque, rarity, 100, 500); + + // Balloons + addBalloon(Type.NORMAL, BalloonType.BABY_COW, rarity, 10, 100); + addBalloon(Type.NORMAL, BalloonType.BABY_PIG, rarity, 10, 100); + addBalloon(Type.NORMAL, BalloonType.BABY_SHEEP, rarity, 15, 100); + + // INFUSED CHESTS + } public void addRare() { RewardRarity rarity = RewardRarity.RARE; - addReward(Type.CARL_SPINNER, new TreasureShardReward(_clientManager, _donationManager, getAmmoMin(rarity), getAmmoMax(rarity), 150, rarity)); + addReward(Type.CARL_SPINNER, new GemReward(_donationManager, getAmmoMin(rarity), getAmmoMax(rarity), 150, 0, rarity)); + addReward(Type.CARL_SPINNER, new ExperienceReward(_statsManager, getAmmoMin(rarity)*5, getAmmoMax(rarity)*5, 150, 0, rarity)); //Morphs addGadget(Type.NORMAL, getGadget(MorphVillager.class), rarity, 83); @@ -350,7 +391,7 @@ public class RewardManager addGadget(Type.NORMAL, getGadget(ParticlePartyTime.class), rarity, 12); //Game Modifiers MineStrike - addMineStrikeSkin(Type.NORMAL, MineStrikeSkin.AWP_Asiimov, rarity, 200); + /*addMineStrikeSkin(Type.NORMAL, MineStrikeSkin.AWP_Asiimov, rarity, 200); addMineStrikeSkin(Type.NORMAL, MineStrikeSkin.P90_Asiimov, rarity, 200); addMineStrikeSkin(Type.NORMAL, MineStrikeSkin.SSG_08_Blood_in_the_Water, rarity, 50); addMineStrikeSkin(Type.NORMAL, MineStrikeSkin.Galil_AR_Eco, rarity, 20); @@ -361,10 +402,19 @@ public class RewardManager addMineStrikeSkin(Type.NORMAL, MineStrikeSkin.PP_Bizon_Streak, rarity, 40); addMineStrikeSkin(Type.NORMAL, MineStrikeSkin.CZ75_Auto_Tigris, rarity, 100); addMineStrikeSkin(Type.NORMAL, MineStrikeSkin.Steyr_AUG_Torque, rarity, 30); - addMineStrikeSkin(Type.NORMAL, MineStrikeSkin.XM1014_Tranquility, rarity, 30); - - + addMineStrikeSkin(Type.NORMAL, MineStrikeSkin.XM1014_Tranquility, rarity, 30);*/ + addMineStrikeSkin(Type.MINESTRIKE, MineStrikeSkin.SSG_08_Blood_in_the_Water, rarity, 150, 1000); + addMineStrikeSkin(Type.MINESTRIKE, MineStrikeSkin.Galil_AR_Eco, rarity, 150, 1000); + addMineStrikeSkin(Type.MINESTRIKE, MineStrikeSkin.Nova_Koi, rarity, 100, 1000); + addMineStrikeSkin(Type.MINESTRIKE, MineStrikeSkin.Knife_M9_Bayonette_Fade, rarity, 30, 2500); + addMineStrikeSkin(Type.MINESTRIKE, MineStrikeSkin.PP_Bizon_Streak, rarity, 150, 1000); + addMineStrikeSkin(Type.MINESTRIKE, MineStrikeSkin.CZ75_Auto_Tigris, rarity, 100, 1000); + addMineStrikeSkin(Type.MINESTRIKE, MineStrikeSkin.XM1014_Tranquility, rarity, 100, 1000); + addMineStrikeSkin(Type.MINESTRIKE, MineStrikeSkin.Desert_Eagle_Golden_Gun, rarity, 30, 2500); + addMineStrikeSkin(Type.MINESTRIKE, MineStrikeSkin.P90_Asiimov, rarity, 100, 1000); + addMineStrikeSkin(Type.MINESTRIKE, MineStrikeSkin.SG553_Pulse, rarity, 100, 1000); + // VALENTINES //Hats addHat(Type.VALENTINES_GIFT, HatType.COMPANION_BLOCK, rarity, 100, 0); @@ -448,25 +498,69 @@ public class RewardManager addGadget(Type.OMEGA, getGadget(ParticleCandyCane.class), rarity, 25); + addBalloon(Type.OMEGA, BalloonType.BABY_ZOMBIE, rarity, 25, 500); + addBalloon(Type.OMEGA, BalloonType.BABY_MUSHROOM, rarity, 50, 500); + addBalloon(Type.OMEGA, BalloonType.BABY_OCELOT, rarity, 50, 500); + addBalloon(Type.OMEGA, BalloonType.BABY_WOLF, rarity, 75, 500); + addBalloon(Type.OMEGA, BalloonType.BABY_VILLAGER, rarity, 25, 500); + addBalloon(Type.OMEGA, BalloonType.BABY_SLIME, rarity, 25, 500); + addBalloon(Type.OMEGA, BalloonType.BAT, rarity, 50, 500); + + // Balloons + addBalloon(Type.NORMAL, BalloonType.BABY_ZOMBIE, rarity, 25, 500); + addBalloon(Type.NORMAL, BalloonType.BABY_MUSHROOM, rarity, 50, 500); + addBalloon(Type.NORMAL, BalloonType.BABY_OCELOT, rarity, 50, 500); + addBalloon(Type.NORMAL, BalloonType.BABY_WOLF, rarity, 75, 500); + addBalloon(Type.NORMAL, BalloonType.BABY_VILLAGER, rarity, 25, 500); + addBalloon(Type.NORMAL, BalloonType.BABY_SLIME, rarity, 25, 500); + addBalloon(Type.NORMAL, BalloonType.BAT, rarity, 50, 500); + // HAUNTED CHEST addGadget(Type.HAUNTED, getGadget(DoubleJumpHalloween.class), rarity, 10); addHat(Type.HAUNTED, HatType.PUMPKIN, rarity, 10); addGadget(Type.HAUNTED, getGadget(ArrowTrailHalloween.class), rarity, 100); - //TRICK OR TREAT + // TRICK OR TREAT addReward(Type.TRICK_OR_TREAT, new SpinTicketReward(_clientManager, 1, 3, rarity, 150, 0)); addReward(Type.TRICK_OR_TREAT, new GameAmplifierReward(_inventoryManager, 1, 2, rarity, 150, 0)); addReward(Type.TRICK_OR_TREAT, new RuneAmplifierReward(_inventoryManager, 20, 1, 3, rarity, 120, 0)); addReward(Type.TRICK_OR_TREAT, new UnknownPackageReward(_donationManager, "Clan Banner Access", "Wear/Place Clan Banner", "Clan Banner Usage", new ItemStack(Material.BANNER), rarity, 110, 0)); addReward(Type.TRICK_OR_TREAT, new ChestReward(_inventoryManager, TreasureType.OLD, 1, 5, rarity, 150, 0)); addReward(Type.TRICK_OR_TREAT, new ChestReward(_inventoryManager, TreasureType.ANCIENT, 1, 5, rarity, 80, 0)); + + // INFUSED CHESTS + addHat(Type.INFUSED_CHESTS, HatType.COMPANION_BLOCK, rarity, 100); + addHat(Type.INFUSED_CHESTS, HatType.LOVESTRUCK, rarity, 100); + addHat(Type.INFUSED_CHESTS, HatType.SECRET_PACKAGE, rarity, 100); + addHat(Type.INFUSED_CHESTS, HatType.TEDDY_BEAR, rarity, 100); + + // THANKFUL + addReward(Type.THANKFUL, new SpinTicketReward(_clientManager, 1, 3, rarity, 150, 0)); + addReward(Type.THANKFUL, new RuneAmplifierReward(_inventoryManager, 20, 1, 3, rarity, 120, 0)); + addReward(Type.THANKFUL, new UnknownPackageReward(_donationManager, "Clan Banner Access", "Wear/Place Clan Banner", "Clan Banner Usage", new ItemStack(Material.BANNER), rarity, 110, 0)); + addReward(Type.THANKFUL, new ChestReward(_inventoryManager, TreasureType.OLD, 1, 5, rarity, 150, 0)); + addReward(Type.THANKFUL, new ChestReward(_inventoryManager, TreasureType.ANCIENT, 1, 5, rarity, 80, 0)); + + // GINGERBREAD CHEST + addGadget(Type.GINGERBREAD, getGadget(ParticleChristmasTree.class), rarity, 25); + addGadget(Type.GINGERBREAD, getGadget(OutfitFreezeSuitChestplate.class), rarity, 100); + addGadget(Type.GINGERBREAD, getGadget(OutfitFreezeSuitLeggings.class), rarity, 100); + addGadget(Type.GINGERBREAD, getGadget(OutfitFreezeSuitBoots.class), rarity, 50); + + // LOVE CHEST + addMount(Type.LOVECHEST, getMount(MountLoveTrain.class), rarity, 30, 500); + + addPetReward(Type.LOVECHEST, PetType.CUPID_PET, rarity, 50, 500); + + addGadget(Type.LOVECHEST, getGadget(WinEffectLoveIsABattlefield.class), rarity, 100, 500); } public void addLegendary() { RewardRarity rarity = RewardRarity.LEGENDARY; - addReward(Type.CARL_SPINNER, new TreasureShardReward(_clientManager, _donationManager, getAmmoMin(rarity), getAmmoMax(rarity), 10, rarity)); + addReward(Type.CARL_SPINNER, new GemReward(_donationManager, getAmmoMin(rarity), getAmmoMax(rarity), 10, 0, rarity)); + addReward(Type.CARL_SPINNER, new ExperienceReward(_statsManager, getAmmoMin(rarity)*5, getAmmoMax(rarity)*5, 10, 0, rarity)); //REGULAR @@ -507,7 +601,7 @@ public class RewardManager addGadget(Type.NORMAL, getGadget(WinEffectRiseOfTheElderGuardian.class), rarity, 4); //GameModifier MineStrike - addMineStrikeSkin(Type.NORMAL, MineStrikeSkin.AWP_Asiimov, rarity, 8); + /*addMineStrikeSkin(Type.NORMAL, MineStrikeSkin.AWP_Asiimov, rarity, 8); addMineStrikeSkin(Type.NORMAL, MineStrikeSkin.P90_Asiimov, rarity, 8); addMineStrikeSkin(Type.NORMAL, MineStrikeSkin.Desert_Eagle_Blaze, rarity, 10); addMineStrikeSkin(Type.NORMAL, MineStrikeSkin.Glock_18_Fade, rarity, 20); @@ -516,7 +610,19 @@ public class RewardManager addMineStrikeSkin(Type.NORMAL, MineStrikeSkin.P250_Muertos, rarity, 20); addMineStrikeSkin(Type.NORMAL, MineStrikeSkin.FAMAS_Pulse, rarity, 33); addMineStrikeSkin(Type.NORMAL, MineStrikeSkin.SG553_Pulse, rarity, 33); - addMineStrikeSkin(Type.NORMAL, MineStrikeSkin.AK_47_Vulcan, rarity, 5); + addMineStrikeSkin(Type.NORMAL, MineStrikeSkin.AK_47_Vulcan, rarity, 5);*/ + addMineStrikeSkin(Type.MINESTRIKE, MineStrikeSkin.Desert_Eagle_Blaze, rarity, 100, 5000); + addMineStrikeSkin(Type.MINESTRIKE, MineStrikeSkin.Glock_18_Fade, rarity, 100, 5000); + addMineStrikeSkin(Type.MINESTRIKE, MineStrikeSkin.P250_Muertos, rarity, 100, 5000); + addMineStrikeSkin(Type.MINESTRIKE, MineStrikeSkin.AK_47_Vulcan, rarity, 100, 5000); + addMineStrikeSkin(Type.MINESTRIKE, MineStrikeSkin.Knife_Counter_Terrorist_Sword, rarity, 50, 6500); + addMineStrikeSkin(Type.MINESTRIKE, MineStrikeSkin.Knife_Terrorist_Sword, rarity, 50, 6500); + addMineStrikeSkin(Type.MINESTRIKE, MineStrikeSkin.Knife_M9_Bayonette_Glass, rarity, 50, 6500); + addMineStrikeSkin(Type.MINESTRIKE, MineStrikeSkin.AK_47_Guardian, rarity, 10, 7500); + addMineStrikeSkin(Type.MINESTRIKE, MineStrikeSkin.AWP_Asiimov, rarity, 100, 5000); + addMineStrikeSkin(Type.MINESTRIKE, MineStrikeSkin.FAMAS_Pulse, rarity, 100, 5000); + addMineStrikeSkin(Type.MINESTRIKE, MineStrikeSkin.XM1014_Pig_Gun, rarity, 10, 7500); + addMineStrikeSkin(Type.MINESTRIKE, MineStrikeSkin.M4A4_Enderman, rarity, 10, 7500); //WINTER @@ -606,18 +712,64 @@ public class RewardManager addHat(Type.OMEGA, HatType.GRINCH, rarity, 25); + addBalloon(Type.OMEGA, BalloonType.SQUID, rarity, 10, 5000); + addBalloon(Type.OMEGA, BalloonType.SILVERFISH, rarity, 30, 5000); + addBalloon(Type.OMEGA, BalloonType.GUARDIAN, rarity, 30, 5000); + /*addBalloon(Type.OMEGA, BalloonType.DRAGON_EGG, rarity, 10, 5000); + addBalloon(Type.OMEGA, BalloonType.DIAMOND_BLOCK, rarity, 10, 5000); + addBalloon(Type.OMEGA, BalloonType.IRON_BLOCK, rarity, 20, 5000); + addBalloon(Type.OMEGA, BalloonType.GOLD_BLOCK, rarity, 30, 5000);*/ + addBalloon(Type.OMEGA, BalloonType.EMERALD_BLOCK, rarity, 15, 5000); + + // Balloon + addBalloon(Type.NORMAL, BalloonType.SQUID, rarity, 10, 5000); + addBalloon(Type.NORMAL, BalloonType.SILVERFISH, rarity, 30, 5000); + addBalloon(Type.NORMAL, BalloonType.GUARDIAN, rarity, 30, 5000); + /*addBalloon(Type.NORMAL, BalloonType.DRAGON_EGG, rarity, 10, 5000); + addBalloon(Type.NORMAL, BalloonType.DIAMOND_BLOCK, rarity, 10, 5000); + addBalloon(Type.NORMAL, BalloonType.IRON_BLOCK, rarity, 20, 5000); + addBalloon(Type.NORMAL, BalloonType.GOLD_BLOCK, rarity, 30, 5000);*/ + addBalloon(Type.NORMAL, BalloonType.EMERALD_BLOCK, rarity, 15, 5000); + // HAUNTED addPetReward(Type.HAUNTED, PetType.RABBIT, rarity, 100); addGadget(Type.HAUNTED, getGadget(MorphGrimReaper.class), rarity, 25); addGadget(Type.HAUNTED, getGadget(WinEffectHalloween.class), rarity, 50); addMount(Type.HAUNTED, getMount(MountNightmareSteed.class), rarity, 60); - //TRICK OR TREAT + // TRICK OR TREAT addReward(Type.TRICK_OR_TREAT, new ChestReward(_inventoryManager, TreasureType.MYTHICAL, 1, 3, rarity, 50, 0)); addReward(Type.TRICK_OR_TREAT, new ChestReward(_inventoryManager, TreasureType.ILLUMINATED, 1, 1, rarity, 30, 0)); addMount(Type.TRICK_OR_TREAT, getMount(MountZombie.class), rarity, 25); addPetReward(Type.TRICK_OR_TREAT, PetType.ZOMBIE, rarity, 10); addGadget(Type.TRICK_OR_TREAT, getGadget(MorphPumpkinKing.class), rarity, 5); + + + // INFUSED CHESTS + addGadget(Type.INFUSED_CHESTS, getGadget(ArrowTrailCupid.class), rarity, 100, 5000); + addGadget(Type.INFUSED_CHESTS, getGadget(DeathCupidsBrokenHeart.class), rarity, 100, 5000); + addGadget(Type.INFUSED_CHESTS, getGadget(ParticleHeart.class), rarity, 100, 5000); + addGadget(Type.INFUSED_CHESTS, getGadget(DoubleJumpCupidsWings.class), rarity, 100, 5000); + + // THANKFUL + addReward(Type.THANKFUL, new ChestReward(_inventoryManager, TreasureType.MYTHICAL, 1, 3, rarity, 50, 0)); + addReward(Type.THANKFUL, new ChestReward(_inventoryManager, TreasureType.ILLUMINATED, 1, 1, rarity, 30, 0)); + addReward(Type.THANKFUL, new ChestReward(_inventoryManager, TreasureType.ILLUMINATED, 1, 1, rarity, 30, 0)); + addMount(Type.THANKFUL, getMount(MountChicken.class), rarity, 5); + addMount(Type.THANKFUL, getMount(MountCake.class), rarity, 10); + addPetReward(Type.THANKFUL, PetType.VILLAGER, rarity, 10); + addPetReward(Type.THANKFUL, PetType.PIG_ZOMBIE, rarity, 10); + + // GINGERBREAD + addGadget(Type.GINGERBREAD, getGadget(DeathPresentDanger.class), rarity, 25); + addGadget(Type.GINGERBREAD, getGadget(WinEffectWinterWarfare.class), rarity, 25); + addGadget(Type.GINGERBREAD, getGadget(OutfitFreezeSuitHelmet.class), rarity, 1); + addPetReward(Type.GINGERBREAD, PetType.GINGERBREAD_MAN, rarity, 10); + + // LOVE CHEST + addGadget(Type.LOVECHEST, getGadget(MorphLoveDoctor.class), rarity, 30, 5000); + addGadget(Type.LOVECHEST, getGadget(BlowAKissTaunt.class), rarity, 50, 5000); + addGadget(Type.LOVECHEST, getGadget(ParticleWingsLove.class), rarity, 10, 5000); } public UnknownPackageReward addMount(Type type, Mount mount, RewardRarity rarity, int weight) @@ -675,6 +827,10 @@ public class RewardManager display = CountryFlag.USA.getBanner(); } } + if (gadget.hasDisplayItem()) + { + display = gadget.getDisplayItem(); + } UnknownPackageReward reward = new UnknownPackageReward(_donationManager, gadget.getGadgetType().getCategoryType(), displayName, gadget.getName(), display, rarity, @@ -709,6 +865,17 @@ public class RewardManager Gadget gadget = _gadgetManager.getHatGadget(hatType); return addGadget(type, gadget, gadget.getDisplayName(), rarity, weight, shards); } + + public UnknownPackageReward addBalloon(Type type, BalloonType balloonType, RewardRarity rarity, int weight) + { + return addBalloon(type, balloonType, rarity, weight, getShards(rarity)); + } + + public UnknownPackageReward addBalloon(Type type, BalloonType balloonType, RewardRarity rarity, int weight, int shards) + { + Gadget gadget = _gadgetManager.getBalloonGadget(balloonType); + return addGadget(type, gadget, gadget.getDisplayName(), rarity, weight, shards); + } public InventoryReward addInventoryReward(RewardPool.Type type, ItemGadget gadget, RewardRarity rarity, int weight) { @@ -814,20 +981,28 @@ public class RewardManager if(pool == Type.NORMAL) { _rewardPools.get(Type.CARL_SPINNER).add(reward); + _rewardPools.get(Type.MYTHICAL).add(reward); if(!(reward instanceof InventoryReward)) { _rewardPools.get(Type.ILLUMINATED).add(reward); } } - _rewardPools.get(pool).add(reward); + if (pool != Type.INFUSED_CHESTS && pool != Type.INFUSED_GADGETS) + { + _rewardPools.get(pool).add(reward); + } + else + { + if (pool != Type.INFUSED_GADGETS) + _rewardPools.get(Type.ILLUMINATED).add(reward); + _rewardPools.get(Type.MYTHICAL).add(reward); + } } public Reward[] getRewards(Player player, RewardPool.Type pool, RewardType type) { - int amount = 4; - if(type == RewardType.ILLUMINATED_CHEST || type == RewardType.FREEDOM_CHEST || type == RewardType.OMEGA_CHEST - || type == RewardType.HAUNTED_CHEST) amount = 1; + int amount = pool.getChestAmount(); int currentReward = 0; Reward[] rewards = new Reward[amount]; @@ -907,10 +1082,15 @@ public class RewardManager //Dont give Rank Upgrade if already has Titan if (rarity == RewardRarity.MYTHICAL) { - if (canGiveMythical && (type == RewardType.MYTHICAL_CHEST || type == RewardType.TRICK_OR_TREAT_CHEST) && !_clientManager.Get(player).GetRank().has(Rank.TITAN)) + PowerPlayReward rew = new PowerPlayReward(_clientManager, SubscriptionDuration.MONTH, rarity, 0, 0); + if (canGiveMythical && (type == RewardType.MYTHICAL_CHEST || type == RewardType.TRICK_OR_TREAT_CHEST || type == RewardType.THANKFUL_CHEST) && !_clientManager.Get(player).GetRank().has(Rank.TITAN)) { return new RankReward(_clientManager, 0, 0, rarity); } + else if (canGiveMythical && (type == RewardType.THANKFUL_CHEST) && rew.canGiveReward(player)) + { + return rew; + } else if (!canGiveMythical || _clientManager.Get(player).GetRank().has(Rank.LEGEND)) { rarity = RewardRarity.LEGENDARY; diff --git a/Plugins/Mineplex.Core/src/mineplex/core/reward/RewardPool.java b/Plugins/Mineplex.Core/src/mineplex/core/reward/RewardPool.java index 086909b66..dc9f2cd9f 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/reward/RewardPool.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/reward/RewardPool.java @@ -4,12 +4,11 @@ import java.util.ArrayList; import java.util.EnumMap; import java.util.List; -import mineplex.core.reward.rewards.GemReward; -import mineplex.core.reward.rewards.InventoryReward; +import org.bukkit.entity.Player; +import mineplex.core.reward.rewards.InventoryReward; import mineplex.core.reward.rewards.TreasureShardReward; import mineplex.core.reward.rewards.UnknownPackageReward; -import org.bukkit.entity.Player; /** * Used to separate different "Reward Pools". This allows us to have treasure chests with different loot. @@ -53,24 +52,43 @@ public class RewardPool NORMAL(true), WINTER_HOLIDAY(true), VALENTINES_GIFT(false), - ILLUMINATED(false), - FREEDOM(false), - OMEGA(false), - HAUNTED(false), + ILLUMINATED(false, 1), + FREEDOM(false, 1), + OMEGA(false, 1), + HAUNTED(false, 1), TRICK_OR_TREAT(false), + INFUSED_CHESTS(false), + INFUSED_GADGETS(true), + MYTHICAL(true), + THANKFUL(false), + GINGERBREAD(false, 1), + MINESTRIKE(true, 2), + LOVECHEST(false, 1), CARL_SPINNER(true); private boolean _useDuplicates; + private int _chestAmount; + + Type(boolean useDuplicates, int amount) + { + _useDuplicates = useDuplicates; + _chestAmount = amount; + } Type(boolean useDuplicates) { - _useDuplicates = useDuplicates; + this(useDuplicates, 4); } public boolean getUseDuplicates() { return _useDuplicates; } + + public int getChestAmount() + { + return _chestAmount; + } public boolean canGive(Player player, Reward reward) { @@ -96,13 +114,6 @@ public class RewardPool } } } - if (this == Type.CARL_SPINNER) - { - if (reward instanceof GemReward) - { - return false; - } - } return true; } diff --git a/Plugins/Mineplex.Core/src/mineplex/core/reward/RewardType.java b/Plugins/Mineplex.Core/src/mineplex/core/reward/RewardType.java index 3d673f360..f235c8dda 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/reward/RewardType.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/reward/RewardType.java @@ -5,21 +5,25 @@ import java.util.ArrayList; public enum RewardType { //% Chances Mythic Legend Rare Uncommon - GAME_LOOT( 0.000001, 0.00001, 0.0001, 3), - - OLD_CHEST( 0, 0.06, 0.8, 16), - ANCIENT_CHEST( 0, 2, 8, 32), - MYTHICAL_CHEST( 0.1, 4, 16, 72), - WINTER_CHEST( 0, 5, 18, 32), - ILLUMINATED_CHEST( 0, 2, 16, 72), - FREEDOM_CHEST( 0, 5, 18, 0), - HAUNTED_CHEST( 0, 5, 18, 0), - OMEGA_CHEST( 0, 32, 16, 2), + GAME_LOOT( 0.000001, 0.00001, 0.0001, 3), + + OLD_CHEST( 0, 0.06, 0.8, 16), + ANCIENT_CHEST( 0, 2, 8, 32), + MYTHICAL_CHEST( 0.1, 4, 16, 72), + WINTER_CHEST( 0, 5, 18, 32), + ILLUMINATED_CHEST( 0, 2, 16, 72), + FREEDOM_CHEST( 0, 5, 18, 0), + HAUNTED_CHEST( 0, 5, 18, 0), + OMEGA_CHEST( 0, 32, 16, 2), TRICK_OR_TREAT_CHEST(0.1, 2, 16, 0), - VALENTINES_GIFT( 0, 7, 20, 20), + THANKFUL_CHEST( 0.1, 2, 16, 0), + GINGERBREAD_CHEST( 0, 2, 16, 0), + MINESTRIKE_CHEST( 0, 2, 16, 0), + LOVE_CHEST( 0, 6, 18, 0), + VALENTINES_GIFT( 0, 7, 20, 20), - SPINNER_FILLER( 0.1, 1, 4, 20), - SPINNER_REAL( 0.000001, 0.05, 0.4, 5); + SPINNER_FILLER( 0.1, 1, 4, 20), + SPINNER_REAL( 0.000001, 0.05, 0.4, 5); private double _mythicalChance; private double _legendaryChance; @@ -44,7 +48,7 @@ public enum RewardType else if (rand <= _legendaryChance) rarity = RewardRarity.LEGENDARY; else if (rand <= _rareChance) rarity = RewardRarity.RARE; else if (rand <= _uncommonChance || requiresUncommon) rarity = RewardRarity.UNCOMMON; - + return rarity; } diff --git a/Plugins/Mineplex.Core/src/mineplex/core/reward/rewards/GemReward.java b/Plugins/Mineplex.Core/src/mineplex/core/reward/rewards/GemReward.java index cae7f75e7..626e69890 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/reward/rewards/GemReward.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/reward/rewards/GemReward.java @@ -6,6 +6,7 @@ import org.bukkit.Material; import org.bukkit.entity.Player; import org.bukkit.inventory.ItemStack; +import mineplex.core.common.currency.GlobalCurrency; import mineplex.core.common.util.Callback; import mineplex.core.donation.DonationManager; import mineplex.core.reward.Reward; @@ -40,14 +41,7 @@ public class GemReward extends Reward { int GemsToReward = _random.nextInt(_maxGemCount - _minGemCount) + _minGemCount; - _donationManager.RewardGems(new Callback() - { - @Override - public void run(Boolean data) - { - - } - }, "Treasure Chest", player.getName(), player.getUniqueId(), GemsToReward); + _donationManager.rewardCurrency(GlobalCurrency.GEM, player, "Treasure Chest", GemsToReward); return new RewardData(null, getRarity().getColor() + GemsToReward + " Gems", new ItemStack(Material.EMERALD), getRarity()); } diff --git a/Plugins/Mineplex.Core/src/mineplex/core/reward/rewards/PetReward.java b/Plugins/Mineplex.Core/src/mineplex/core/reward/rewards/PetReward.java index 19f500c87..23e4e179a 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/reward/rewards/PetReward.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/reward/rewards/PetReward.java @@ -41,7 +41,7 @@ public class PetReward extends UnknownPackageReward if (_inventoryManager.getClientManager().Get(player) != null) token.AccountId = _inventoryManager.getClientManager().Get(player).getAccountId(); else - token.AccountId = PlayerCache.getInstance().getPlayer(player.getUniqueId()).getAccountId(); + token.AccountId = PlayerCache.getInstance().getAccountId(player.getUniqueId()); token.Name = player.getName(); token.PetType = _petType.toString(); diff --git a/Plugins/Mineplex.Core/src/mineplex/core/reward/rewards/PowerPlayReward.java b/Plugins/Mineplex.Core/src/mineplex/core/reward/rewards/PowerPlayReward.java new file mode 100644 index 000000000..ac86ed21f --- /dev/null +++ b/Plugins/Mineplex.Core/src/mineplex/core/reward/rewards/PowerPlayReward.java @@ -0,0 +1,68 @@ +package mineplex.core.reward.rewards; + +import java.time.LocalDate; + +import org.bukkit.Material; +import org.bukkit.entity.Player; +import org.bukkit.inventory.ItemStack; +import org.bukkit.metadata.FixedMetadataValue; + +import mineplex.core.Managers; +import mineplex.core.account.CoreClientManager; +import mineplex.core.bonuses.BonusManager; +import mineplex.core.common.util.UtilServer; +import mineplex.core.powerplayclub.PowerPlayData.SubscriptionDuration; +import mineplex.core.reward.Reward; +import mineplex.core.reward.RewardData; +import mineplex.core.reward.RewardRarity; +import mineplex.core.reward.RewardType; + +public class PowerPlayReward extends Reward +{ + private CoreClientManager _clientManager; + private SubscriptionDuration _duration; + + public PowerPlayReward(CoreClientManager clientManager, SubscriptionDuration duration, RewardRarity rarity, int weight, int shardValue) + { + super(rarity, weight, shardValue); + + _clientManager = clientManager; + _duration = duration; + } + + @Override + public RewardData giveRewardCustom(Player player, RewardType rewardType) + { + if (_clientManager.getAccountId(player) == -1) + { + return getFakeRewardData(player); + } + + Managers.get(BonusManager.class).getPowerPlayClubRepository().addSubscription(_clientManager.getAccountId(player), LocalDate.now(), _duration.toString().toLowerCase()); + player.setMetadata("GIVEN-PPC-REWARD", new FixedMetadataValue(UtilServer.getPlugin(), System.currentTimeMillis())); + + return new RewardData(getRarity().getDarkColor() + "Power Play Subscription", getRarity().getColor() + "1 " + _duration.toString().toLowerCase() + " Power Play Club Subscription", new ItemStack(Material.FIREBALL), getRarity()); + } + + @Override + public RewardData getFakeRewardData(Player player) + { + return new RewardData(getRarity().getDarkColor() + "Power Play Subscription", getRarity().getColor() + "Power Play Subscription", new ItemStack(Material.FIREBALL), getRarity()); + } + + @Override + public boolean canGiveReward(Player player) + { + return !(Managers.get(BonusManager.class).getPowerPlayClubRepository().getCachedData(player).isSubscribed() || player.hasMetadata("GIVEN-PPC-REWARD")); + } + + @Override + public boolean equals(Object obj) + { + if (obj instanceof PowerPlayReward) + { + return true; + } + return false; + } +} \ No newline at end of file diff --git a/Plugins/Mineplex.Core/src/mineplex/core/reward/rewards/RankReward.java b/Plugins/Mineplex.Core/src/mineplex/core/reward/rewards/RankReward.java index c42b26dd1..4e3cdf4f4 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/reward/rewards/RankReward.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/reward/rewards/RankReward.java @@ -2,6 +2,10 @@ package mineplex.core.reward.rewards; import java.util.Random; +import org.bukkit.Material; +import org.bukkit.entity.Player; +import org.bukkit.inventory.ItemStack; + import mineplex.core.account.CoreClientManager; import mineplex.core.common.Rank; import mineplex.core.reward.RankRewardData; @@ -10,10 +14,6 @@ import mineplex.core.reward.RewardData; import mineplex.core.reward.RewardRarity; import mineplex.core.reward.RewardType; -import org.bukkit.Material; -import org.bukkit.entity.Player; -import org.bukkit.inventory.ItemStack; - public class RankReward extends Reward { private Random _random; @@ -34,10 +34,11 @@ public class RankReward extends Reward if (_clientManager.Get(player).GetRank() == Rank.ALL) rank = Rank.ULTRA; else if (_clientManager.Get(player).GetRank() == Rank.ULTRA) rank = Rank.HERO; else if (_clientManager.Get(player).GetRank() == Rank.HERO) rank = Rank.LEGEND; - else if ((rewardType == RewardType.MYTHICAL_CHEST || rewardType == RewardType.TRICK_OR_TREAT_CHEST) && _clientManager.Get(player).GetRank() == Rank.LEGEND) rank = Rank.TITAN; + else if ((rewardType == RewardType.MYTHICAL_CHEST || rewardType == RewardType.TRICK_OR_TREAT_CHEST || rewardType == RewardType.THANKFUL_CHEST) && _clientManager.Get(player).GetRank() == Rank.LEGEND) rank = Rank.TITAN; + else if ((rewardType == RewardType.MYTHICAL_CHEST || rewardType == RewardType.TRICK_OR_TREAT_CHEST || rewardType == RewardType.THANKFUL_CHEST) && _clientManager.Get(player).GetRank() == Rank.TITAN) rank = Rank.ETERNAL; if (rewardType == RewardType.MYTHICAL_CHEST && _random.nextDouble() < 0.01) // 1 Percent - rank = Rank.TITAN; + rank = Rank.ETERNAL; if (rank == null) return new RewardData(null, getRarity().getColor() + "Rank Upgrade Error", new ItemStack(Material.PAPER), getRarity()); @@ -55,6 +56,7 @@ public class RankReward extends Reward if (_clientManager.Get(player).GetRank() == Rank.ALL) rank = Rank.ULTRA; else if (_clientManager.Get(player).GetRank() == Rank.ULTRA) rank = Rank.HERO; else if (_clientManager.Get(player).GetRank() == Rank.HERO) rank = Rank.LEGEND; + else if (_clientManager.Get(player).GetRank() == Rank.LEGEND) rank = Rank.TITAN; if (rank == null) return new RewardData(null, getRarity().getColor() + "Rank Upgrade Error", new ItemStack(Material.PAPER), getRarity()); diff --git a/Plugins/Mineplex.Core/src/mineplex/core/reward/rewards/RuneAmplifierReward.java b/Plugins/Mineplex.Core/src/mineplex/core/reward/rewards/RuneAmplifierReward.java index 96ac448ee..97d86faa8 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/reward/rewards/RuneAmplifierReward.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/reward/rewards/RuneAmplifierReward.java @@ -51,13 +51,13 @@ public class RuneAmplifierReward extends Reward _inventoryManager.addItemToInventory(player, "Rune Amplifier " + _minutes, amountToGive); - return new RewardData(getRarity().getDarkColor() + "Rune Amplifier", getRarity().getColor() + amountToGive + " " + _minutes + " minute Amplifier", new ItemStack(Material.NETHER_STAR), getRarity()); + return new RewardData(getRarity().getDarkColor() + "Clans Amplifier", getRarity().getColor() + amountToGive + " " + _minutes + " minute Clans Amplifier", new ItemStack(Material.NETHER_STAR), getRarity()); } @Override public RewardData getFakeRewardData(Player player) { - return new RewardData(getRarity().getDarkColor() + "Rune Amplifier", getRarity().getColor() + _minutes + " minute Amplifier", new ItemStack(Material.NETHER_STAR), getRarity()); + return new RewardData(getRarity().getDarkColor() + "Clans Amplifier", getRarity().getColor() + _minutes + " minute Clans Amplifier", new ItemStack(Material.NETHER_STAR), getRarity()); } @Override diff --git a/Plugins/Mineplex.Core/src/mineplex/core/reward/rewards/TreasureShardReward.java b/Plugins/Mineplex.Core/src/mineplex/core/reward/rewards/TreasureShardReward.java index 5f9c368e5..d3535ae40 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/reward/rewards/TreasureShardReward.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/reward/rewards/TreasureShardReward.java @@ -1,7 +1,10 @@ package mineplex.core.reward.rewards; +import mineplex.core.account.CoreClient; import mineplex.core.account.CoreClientManager; +import mineplex.core.common.currency.GlobalCurrency; import mineplex.core.common.util.UtilMath; + import org.bukkit.Bukkit; import org.bukkit.Material; import org.bukkit.entity.Player; @@ -61,7 +64,7 @@ public class TreasureShardReward extends Reward rewardData = new RewardData(null, getRarity().getColor() + shards + " Treasure Shards", new ItemStack(Material.PRISMARINE_SHARD), getRarity()); } - int accountId = _clientManager.getAccountId(player); + CoreClient client = _clientManager.Get(player); // Give shards 5 seconds later for better effect Bukkit.getScheduler().runTaskLater(_donationManager.getPlugin(), new Runnable() @@ -69,7 +72,7 @@ public class TreasureShardReward extends Reward @Override public void run() { - _donationManager.rewardCoinsUntilSuccess(null, "Treasure", player.getName(), accountId, shards); + _donationManager.rewardCurrencyUntilSuccess(GlobalCurrency.TREASURE_SHARD, client, "Treasure", shards); } }, 100); diff --git a/Plugins/Mineplex.Core/src/mineplex/core/reward/rewards/UnknownPackageReward.java b/Plugins/Mineplex.Core/src/mineplex/core/reward/rewards/UnknownPackageReward.java index 99f29d7b8..48ce5dc23 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/reward/rewards/UnknownPackageReward.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/reward/rewards/UnknownPackageReward.java @@ -46,7 +46,7 @@ public class UnknownPackageReward extends Reward @Override protected RewardData giveRewardCustom(Player player, RewardType type) { - _donationManager.PurchaseUnknownSalesPackage(null, player.getName(), _donationManager.getClientManager().Get(player).getAccountId(), _packageName, GlobalCurrency.TREASURE_SHARD, 0, true); + _donationManager.purchaseUnknownSalesPackage(player, _packageName, GlobalCurrency.TREASURE_SHARD, 0, true, null); return new RewardData(getRarity().getDarkColor() + _header, getRarity().getColor() + _name, _itemStack, getRarity()); } @@ -60,7 +60,7 @@ public class UnknownPackageReward extends Reward return false; } boolean hasItem = false; - if (_donationManager.Get(player).OwnsUnknownPackage(_packageName)) + if (_donationManager.Get(player).ownsUnknownSalesPackage(_packageName)) { hasItem = true; } @@ -68,7 +68,7 @@ public class UnknownPackageReward extends Reward { for (String altName : _alternativeNames) { - if (_donationManager.Get(player).OwnsUnknownPackage(altName)) + if (_donationManager.Get(player).ownsUnknownSalesPackage(altName)) { hasItem = true; } diff --git a/Plugins/Mineplex.Core/src/mineplex/core/scoreboard/MineplexScoreboard.java b/Plugins/Mineplex.Core/src/mineplex/core/scoreboard/MineplexScoreboard.java index d0324884d..833d19637 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/scoreboard/MineplexScoreboard.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/scoreboard/MineplexScoreboard.java @@ -53,6 +53,8 @@ public class MineplexScoreboard // The list of available trackers, implemented as a queue private final LinkedList _availableTrackers = new LinkedList<>(); + // The set of custom trackers + private final Set _customTrackers = new HashSet<>(); // The list of registered lines, which have been calculated, in the order of registration // The ScoreboardLine at index 0 is the one at the top of the scoreboard @@ -257,4 +259,9 @@ public class MineplexScoreboard { this._availableTrackers.add(tracker); } + + Set getCustomTrackers() + { + return _customTrackers; + } } diff --git a/Plugins/Mineplex.Core/src/mineplex/core/scoreboard/ScoreboardElement.java b/Plugins/Mineplex.Core/src/mineplex/core/scoreboard/ScoreboardElement.java index e86b873d8..ba8524830 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/scoreboard/ScoreboardElement.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/scoreboard/ScoreboardElement.java @@ -5,14 +5,31 @@ import org.bukkit.ChatColor; import org.bukkit.scoreboard.Objective; import org.bukkit.scoreboard.Team; +import java.util.ArrayList; import java.util.HashSet; +import java.util.List; import java.util.Set; import java.util.concurrent.atomic.AtomicInteger; +import java.util.regex.Matcher; +import java.util.regex.Pattern; + +import com.google.common.collect.Sets; // fixme bulk send prefix/suffix packets? public class ScoreboardElement { - private static final Set CUSTOM_TRACKER_TRACKER = new HashSet<>(); + private static final Pattern COLOR_PATTERN = Pattern.compile("(?i)" + String.valueOf('§') + "[0-9A-F]"); + private static final char[] CHARS = "1234567890abcdefklmnor".toCharArray(); + + private static final List HAS_COLOR_TRACKERS = new ArrayList<>(); + + static + { + for (char c : CHARS) + { + HAS_COLOR_TRACKERS.add("§" + String.valueOf(c)); + } + } private static final AtomicInteger COUNTER = new AtomicInteger(); @@ -27,6 +44,8 @@ public class ScoreboardElement private String _customTracker; + private Set _customTrackerTracker; + private String _oldValue; private int _lineNumber; @@ -37,6 +56,7 @@ public class ScoreboardElement this._sidebar = sidebar; this._line = line; this._tracker = tracker; + this._customTrackerTracker = scoreboard.getCustomTrackers(); this._team = scoreboard.getHandle().registerNewTeam("SBE" + String.valueOf(COUNTER.getAndIncrement())); this._team.addEntry(this._tracker); this._lineNumber = lineNumber; @@ -54,6 +74,7 @@ public class ScoreboardElement this._oldValue = value; + // If everything can be fit in the prefix, go ahead and do that if (value.length() <= 16) { if (!StringUtils.equals(this._team.getPrefix(), value)) @@ -69,6 +90,7 @@ public class ScoreboardElement String right = value.substring(16); String ending = ChatColor.getLastColors(left); right = ending + right; + // If everything can be fit in the prefix and suffix (don't forget about color codes!), do that if (right.length() <= 16) { if (!StringUtils.equals(this._team.getPrefix(), left)) @@ -80,48 +102,47 @@ public class ScoreboardElement } else { - right = value.substring(16); - - // ensure unique custom trackers - if (right.length() <= 40) + String temp = value.substring(16); + temp = ending + temp; + Matcher matcher = COLOR_PATTERN.matcher(ending); + boolean hasColors = matcher.find(); + if (!hasColors) { - if (_customTracker == null || !_customTracker.equals(right)) - { - if (!CUSTOM_TRACKER_TRACKER.add(right)) - { - String resets = ChatColor.RESET.toString(); - while (!CUSTOM_TRACKER_TRACKER.add(resets + ending + right)) - { - resets += ChatColor.RESET.toString(); - } + temp = ChatColor.WHITE + temp; + } - right = resets + ending + right; - } + String tracker = null; + int index = 0; + + // Determine the most suitable tracker. The scoreboard only has 15 lines so we should never need to append more than 2 characters + while (tracker == null) + { + String temp1 = HAS_COLOR_TRACKERS.get(index++) + temp; + String substr = temp1.length() <= 40 ? temp1 : temp1.substring(0, 40); + if (substr.equals(_customTracker) || _customTrackerTracker.add(substr)) + { + tracker = substr; + temp = temp1; } } - if (right.length() <= 40) + if (_customTracker == null || !_customTracker.equals(tracker)) + { + clearCustomTracker(); + } + + // If everything can be fit in the tracker, do that + if (temp.length() <= 40) { if (this._customTracker == null) { - this._customTracker = right; + this._customTracker = temp; this._scoreboard.getHandle().resetScores(this._tracker); this._team.addEntry(this._customTracker); this._sidebar.getScore(this._customTracker).setScore(this._lineNumber); } - else if (!right.equals(this._customTracker)) - { - this._scoreboard.getHandle().resetScores(this._customTracker); - this._team.removeEntry(this._customTracker); - CUSTOM_TRACKER_TRACKER.remove(this._customTracker); - - this._customTracker = right; - - this._team.addEntry(this._customTracker); - this._sidebar.getScore(this._customTracker).setScore(this._lineNumber); - } if (!StringUtils.equals(this._team.getPrefix(), left)) this._team.setPrefix(left); @@ -130,64 +151,30 @@ public class ScoreboardElement } else { - CUSTOM_TRACKER_TRACKER.remove(right); + // Otherwise try to use the prefix + right = temp.substring(40); - String middle = right.substring(0, 40); - right = right.substring(40); - - if (_customTracker == null || !_customTracker.equals(middle)) + // It's too long for even the suffix. Trim and move on + if (right.length() > 16) { - if (!CUSTOM_TRACKER_TRACKER.add(middle)) - { - String resets = ChatColor.RESET.toString(); - while (!CUSTOM_TRACKER_TRACKER.add(resets + ending + middle)) - { - resets += ChatColor.RESET.toString(); - } - - middle = resets + ending + middle; - - if (middle.length() > 40) - { - right = right + middle.substring(40); - middle = middle.substring(0, 40); - } - } + right = right.substring(0, 16); + System.out.println("WARNING: Trimmed suffix from '" + temp.substring(40) + "' to '" + right + "'"); } - if (right.length() <= 16) + if (this._customTracker == null) { - if (this._customTracker == null) - { - this._customTracker = middle; + this._customTracker = tracker; - this._scoreboard.getHandle().resetScores(this._tracker); + this._scoreboard.getHandle().resetScores(this._tracker); - this._team.addEntry(this._customTracker); - this._sidebar.getScore(this._customTracker).setScore(this._lineNumber); - - } - else if (!middle.equals(this._customTracker)) - { - this._scoreboard.getHandle().resetScores(this._customTracker); - this._team.removeEntry(this._customTracker); - CUSTOM_TRACKER_TRACKER.remove(this._customTracker); - - this._customTracker = middle; - - this._team.addEntry(this._customTracker); - this._sidebar.getScore(this._customTracker).setScore(this._lineNumber); - } - - if (!StringUtils.equals(this._team.getPrefix(), left)) - this._team.setPrefix(left); - if (!StringUtils.equals(this._team.getSuffix(), right)) - this._team.setSuffix(right); - } - else - { - throw new IllegalArgumentException("The following scoreboard line is too damn long: " + value); + this._team.addEntry(this._customTracker); + this._sidebar.getScore(this._customTracker).setScore(this._lineNumber); } + + if (!StringUtils.equals(this._team.getPrefix(), left)) + this._team.setPrefix(left); + if (!StringUtils.equals(this._team.getSuffix(), right)) + this._team.setSuffix(right); } } } @@ -218,7 +205,7 @@ public class ScoreboardElement if (this._customTracker != null) { this._scoreboard.getHandle().resetScores(this._customTracker); - CUSTOM_TRACKER_TRACKER.remove(this._customTracker); + _customTrackerTracker.remove(this._customTracker); } this._scoreboard.returnTracker(this._tracker); this._team = null; @@ -232,7 +219,7 @@ public class ScoreboardElement { this._scoreboard.getHandle().resetScores(this._customTracker); this._team.removeEntry(this._customTracker); - CUSTOM_TRACKER_TRACKER.remove(this._customTracker); + _customTrackerTracker.remove(this._customTracker); this._customTracker = null; this._team.addEntry(this._tracker); diff --git a/Plugins/Mineplex.Core/src/mineplex/core/scoreboard/WritableMineplexScoreboard.java b/Plugins/Mineplex.Core/src/mineplex/core/scoreboard/WritableMineplexScoreboard.java index dfd1b4267..308952849 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/scoreboard/WritableMineplexScoreboard.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/scoreboard/WritableMineplexScoreboard.java @@ -29,7 +29,7 @@ public class WritableMineplexScoreboard extends MineplexScoreboard private final List _lines; // The list of lines currently buffered for drawing - private final List _bufferedLines = new ArrayList<>(15); + protected final List _bufferedLines = new ArrayList<>(15); // The list of lines which were drawn in the last draw private final List _drawnLines = new ArrayList<>(15); diff --git a/Plugins/Mineplex.Core/src/mineplex/core/server/remotecall/AsyncJsonWebCall.java b/Plugins/Mineplex.Core/src/mineplex/core/server/remotecall/AsyncJsonWebCall.java deleted file mode 100644 index 3c2676c69..000000000 --- a/Plugins/Mineplex.Core/src/mineplex/core/server/remotecall/AsyncJsonWebCall.java +++ /dev/null @@ -1,63 +0,0 @@ -package mineplex.core.server.remotecall; - -import mineplex.core.common.util.Callback; - -public class AsyncJsonWebCall extends JsonWebCall -{ - public AsyncJsonWebCall(String url) - { - super(url); - } - - public void Execute() - { - Thread asyncThread = new Thread(new Runnable() - { - public void run() - { - AsyncJsonWebCall.super.Execute(); - } - }); - - asyncThread.start(); - } - - public void Execute(final Object argument) - { - Thread asyncThread = new Thread(new Runnable() - { - public void run() - { - AsyncJsonWebCall.super.Execute(argument); - } - }); - - asyncThread.start(); - } - - public void Execute(final Class callbackClass, final Callback callback) - { - Thread asyncThread = new Thread(new Runnable() - { - public void run() - { - AsyncJsonWebCall.super.Execute(callbackClass, callback); - } - }); - - asyncThread.start(); - } - - public void Execute(final Class callbackClass, final Callback callback, final Object argument) - { - Thread asyncThread = new Thread(new Runnable() - { - public void run() - { - AsyncJsonWebCall.super.Execute(callbackClass, callback, argument); - } - }); - - asyncThread.start(); - } -} diff --git a/Plugins/Mineplex.Core/src/mineplex/core/shop/ShopBase.java b/Plugins/Mineplex.Core/src/mineplex/core/shop/ShopBase.java index a20567c0b..6ee09a020 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/shop/ShopBase.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/shop/ShopBase.java @@ -1,13 +1,15 @@ package mineplex.core.shop; -import mineplex.core.MiniPlugin; import mineplex.core.account.CoreClientManager; import mineplex.core.common.util.NautHashMap; import mineplex.core.donation.DonationManager; +import mineplex.core.lifetimes.Lifetimed; +import mineplex.core.lifetimes.ListenerComponent; import mineplex.core.npc.event.NpcDamageByEntityEvent; import mineplex.core.npc.event.NpcInteractEntityEvent; import mineplex.core.shop.page.ShopPageBase; import net.minecraft.server.v1_8_R3.EntityPlayer; +import org.bukkit.Bukkit; import org.bukkit.ChatColor; import org.bukkit.craftbukkit.v1_8_R3.entity.CraftPlayer; import org.bukkit.craftbukkit.v1_8_R3.event.CraftEventFactory; @@ -16,16 +18,19 @@ import org.bukkit.entity.LivingEntity; import org.bukkit.entity.Player; import org.bukkit.event.EventHandler; import org.bukkit.event.EventPriority; -import org.bukkit.event.Listener; import org.bukkit.event.inventory.InventoryClickEvent; import org.bukkit.event.inventory.InventoryCloseEvent; import org.bukkit.event.inventory.InventoryDragEvent; import org.bukkit.event.inventory.InventoryOpenEvent; import org.bukkit.event.player.PlayerQuitEvent; +import java.util.HashMap; import java.util.HashSet; +import java.util.Map; +import java.util.Set; +import java.util.UUID; -public abstract class ShopBase implements Listener +public abstract class ShopBase extends ListenerComponent { private NautHashMap _errorThrottling; private NautHashMap _purchaseBlock; @@ -34,9 +39,9 @@ public abstract class ShopBase implements Listene private CoreClientManager _clientManager; private DonationManager _donationManager; private String _name; - private NautHashMap>> _playerPageMap; + private Map>> _playerPageMap = new HashMap<>(); - private HashSet _openedShop = new HashSet(); + private Set _openedShop = new HashSet<>(); public ShopBase(PluginType plugin, CoreClientManager clientManager, DonationManager donationManager, String name) { @@ -44,12 +49,11 @@ public abstract class ShopBase implements Listene _clientManager = clientManager; _donationManager = donationManager; _name = name; - - _playerPageMap = new NautHashMap>>(); + _errorThrottling = new NautHashMap(); _purchaseBlock = new NautHashMap(); - _plugin.registerEvents(this); + _plugin.getLifetime().register(this); } @EventHandler(priority = EventPriority.LOWEST) @@ -83,17 +87,17 @@ public abstract class ShopBase implements Listene public boolean attemptShopOpen(Player player) { - if (!_openedShop.contains(player.getName())) + if (!_openedShop.contains(player.getUniqueId())) { if (!canOpenShop(player)) return false; - _openedShop.add(player.getName()); + _openedShop.add(player.getUniqueId()); openShopForPlayer(player); - if (!_playerPageMap.containsKey(player.getName())) + if (!_playerPageMap.containsKey(player.getUniqueId())) { - _playerPageMap.put(player.getName(), buildPagesFor(player)); + _playerPageMap.put(player.getUniqueId(), buildPagesFor(player)); } openPageForPlayer(player, getOpeningPageForPlayer(player)); @@ -106,7 +110,7 @@ public abstract class ShopBase implements Listene protected ShopPageBase> getOpeningPageForPlayer(HumanEntity player) { - return _playerPageMap.get(player.getName()); + return _playerPageMap.get(player.getUniqueId()); } @EventHandler @@ -145,16 +149,9 @@ public abstract class ShopBase implements Listene @EventHandler public void onInventoryClose(InventoryCloseEvent event) { - if (_playerPageMap.containsKey(event.getPlayer().getName()) && _playerPageMap.get(event.getPlayer().getName()).getTitle() != null && _playerPageMap.get(event.getPlayer().getName()).getTitle().equalsIgnoreCase(event.getInventory().getTitle())) + if (_playerPageMap.containsKey(event.getPlayer().getUniqueId()) && _playerPageMap.get(event.getPlayer().getUniqueId()).getTitle() != null && _playerPageMap.get(event.getPlayer().getUniqueId()).getTitle().equalsIgnoreCase(event.getInventory().getTitle())) { - _playerPageMap.get(event.getPlayer().getName()).playerClosed(); - _playerPageMap.get(event.getPlayer().getName()).dispose(); - - _playerPageMap.remove(event.getPlayer().getName()); - - closeShopForPlayer((Player) event.getPlayer()); - - _openedShop.remove(event.getPlayer().getName()); + removePlayer((Player) event.getPlayer()); } } @@ -164,19 +161,41 @@ public abstract class ShopBase implements Listene if (!event.isCancelled()) return; - if (_playerPageMap.containsKey(event.getPlayer().getName()) && _playerPageMap.get(event.getPlayer().getName()).getTitle() != null && _playerPageMap.get(event.getPlayer().getName()).getTitle().equalsIgnoreCase(event.getInventory().getTitle())) + if (_playerPageMap.containsKey(event.getPlayer().getUniqueId()) && _playerPageMap.get(event.getPlayer().getUniqueId()).getTitle() != null && _playerPageMap.get(event.getPlayer().getUniqueId()).getTitle().equalsIgnoreCase(event.getInventory().getTitle())) { - _playerPageMap.get(event.getPlayer().getName()).playerClosed(); - _playerPageMap.get(event.getPlayer().getName()).dispose(); - - _playerPageMap.remove(event.getPlayer().getName()); - - closeShopForPlayer((Player) event.getPlayer()); - - _openedShop.remove(event.getPlayer().getName()); + removePlayer((Player) event.getPlayer()); } } - + + protected void removePlayer(Player player) + { + _playerPageMap.get(player.getUniqueId()).playerClosed(); + _playerPageMap.get(player.getUniqueId()).dispose(); + + _playerPageMap.remove(player.getUniqueId()); + + closeShopForPlayer(player); + + _openedShop.remove(player.getUniqueId()); + } + + @Override + public void deactivate() + { + super.deactivate(); + _playerPageMap.entrySet().stream().map(Map.Entry::getKey).map(Bukkit::getPlayer).forEach(p -> { + if (_playerPageMap.get(p.getName()).getTitle().equals(p.getOpenInventory().getTitle())) + { + p.closeInventory(); + } + removePlayer(p); + }); + _playerPageMap.clear(); + _openedShop.clear(); + _purchaseBlock.clear(); + _errorThrottling.clear(); + } + protected boolean canOpenShop(Player player) { return true; @@ -189,25 +208,18 @@ public abstract class ShopBase implements Listene @EventHandler public void onPlayerQuit(PlayerQuitEvent event) { - if (_playerPageMap.containsKey(event.getPlayer().getName())) + if (_playerPageMap.containsKey(event.getPlayer().getUniqueId())) { - _playerPageMap.get(event.getPlayer().getName()).playerClosed(); - _playerPageMap.get(event.getPlayer().getName()).dispose(); - + removePlayer(event.getPlayer()); event.getPlayer().closeInventory(); - closeShopForPlayer(event.getPlayer()); - - _playerPageMap.remove(event.getPlayer().getName()); - - _openedShop.remove(event.getPlayer().getName()); } } public void openPageForPlayer(Player player, ShopPageBase> page) { - if (_playerPageMap.containsKey(player.getName())) + if (_playerPageMap.containsKey(player.getUniqueId())) { - _playerPageMap.get(player.getName()).playerClosed(); + _playerPageMap.get(player.getUniqueId()).playerClosed(); } setCurrentPageForPlayer(player, page); @@ -224,7 +236,7 @@ public abstract class ShopBase implements Listene public void setCurrentPageForPlayer(Player player, ShopPageBase> page) { - _playerPageMap.put(player.getName(), page); + _playerPageMap.put(player.getUniqueId(), page); } public void addPlayerProcessError(Player player) @@ -240,7 +252,7 @@ public abstract class ShopBase implements Listene return !_purchaseBlock.containsKey(player.getName()) || (System.currentTimeMillis() - _purchaseBlock.get(player.getName()) > 10000); } - public NautHashMap>> getPageMap() + public Map>> getPageMap() { return _playerPageMap; } @@ -249,7 +261,7 @@ public abstract class ShopBase implements Listene public boolean isPlayerInShop(HumanEntity player) { - return _playerPageMap.containsKey(player.getName()); + return _playerPageMap.containsKey(player.getUniqueId()); } protected PluginType getPlugin() @@ -272,12 +284,12 @@ public abstract class ShopBase implements Listene return _name; } - protected NautHashMap>> getPlayerPageMap() + protected Map>> getPlayerPageMap() { return _playerPageMap; } - protected HashSet getOpenedShop() + protected Set getOpenedShop() { return _openedShop; } diff --git a/Plugins/Mineplex.Core/src/mineplex/core/shop/item/SalesPackageProcessor.java b/Plugins/Mineplex.Core/src/mineplex/core/shop/item/SalesPackageProcessor.java index 8fd1e6fd2..dace58009 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/shop/item/SalesPackageProcessor.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/shop/item/SalesPackageProcessor.java @@ -1,5 +1,7 @@ package mineplex.core.shop.item; +import mineplex.core.account.CoreClient; +import mineplex.core.account.CoreClientManager; import mineplex.core.common.currency.GlobalCurrency; import mineplex.core.common.util.C; import mineplex.core.donation.DonationManager; @@ -7,10 +9,16 @@ import mineplex.core.itemstack.ItemBuilder; import mineplex.core.server.util.TransactionResponse; import mineplex.core.shop.confirmation.ConfirmationCallback; import mineplex.core.shop.confirmation.ConfirmationProcessor; + import org.bukkit.entity.Player; import org.bukkit.inventory.Inventory; -public class SalesPackageProcessor implements ConfirmationProcessor { +import static mineplex.core.Managers.require; + +public class SalesPackageProcessor implements ConfirmationProcessor +{ + private final CoreClientManager _clientManager = require(CoreClientManager.class); + private final GlobalCurrency _currencyType; private final SalesPackageBase _salesItem; private final DonationManager _donationManager; @@ -35,13 +43,14 @@ public class SalesPackageProcessor implements ConfirmationProcessor { @Override public void process(ConfirmationCallback callback) { + CoreClient client = _clientManager.Get(_player); if (_salesItem.isKnown()) { - _donationManager.PurchaseKnownSalesPackage(response -> showResults(callback, response), _player.getName(), _player.getUniqueId(), _salesItem.getCost(_currencyType), _salesItem.getSalesPackageId()); + _donationManager.purchaseKnownSalesPackage(client, _salesItem.getSalesPackageId(), response -> showResults(callback, response)); } else { - _donationManager.PurchaseUnknownSalesPackage(response -> showResults(callback, response), _player.getName(), _donationManager.getClientManager().Get(_player).getAccountId(), _salesItem.getName(), _currencyType, _salesItem.getCost(_currencyType), _salesItem.oneTimePurchase()); + _donationManager.purchaseUnknownSalesPackage(client, _salesItem.getName(), _currencyType, _salesItem.getCost(_currencyType), _salesItem.oneTimePurchase(), response -> showResults(callback, response)); } } diff --git a/Plugins/Mineplex.Core/src/mineplex/core/shop/page/ShopPageBase.java b/Plugins/Mineplex.Core/src/mineplex/core/shop/page/ShopPageBase.java index 7f1a8c525..086506dfd 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/shop/page/ShopPageBase.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/shop/page/ShopPageBase.java @@ -1,5 +1,14 @@ package mineplex.core.shop.page; + +import mineplex.core.account.CoreClient; +import mineplex.core.account.CoreClientManager; +import mineplex.core.common.util.NautHashMap; +import mineplex.core.common.util.UtilInv; +import mineplex.core.donation.DonationManager; +import mineplex.core.lifetimes.Lifetimed; +import mineplex.core.shop.ShopBase; +import mineplex.core.shop.item.IButton; import org.bukkit.Sound; import org.bukkit.craftbukkit.v1_8_R3.entity.CraftPlayer; import org.bukkit.craftbukkit.v1_8_R3.inventory.CraftInventoryCustom; @@ -11,16 +20,7 @@ import org.bukkit.event.inventory.InventoryClickEvent; import org.bukkit.inventory.Inventory; import org.bukkit.inventory.ItemStack; -import mineplex.core.MiniPlugin; -import mineplex.core.account.CoreClient; -import mineplex.core.account.CoreClientManager; -import mineplex.core.common.util.NautHashMap; -import mineplex.core.common.util.UtilInv; -import mineplex.core.donation.DonationManager; -import mineplex.core.shop.ShopBase; -import mineplex.core.shop.item.IButton; - -public abstract class ShopPageBase> extends CraftInventoryCustom implements Listener +public abstract class ShopPageBase> extends CraftInventoryCustom implements Listener { protected PluginType _plugin; protected CoreClientManager _clientManager; diff --git a/Plugins/Mineplex.Core/src/mineplex/core/spawn/SpawnRepository.java b/Plugins/Mineplex.Core/src/mineplex/core/spawn/SpawnRepository.java index 78fda20c2..393a68e1b 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/spawn/SpawnRepository.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/spawn/SpawnRepository.java @@ -13,7 +13,7 @@ import mineplex.serverdata.database.RepositoryBase; import mineplex.serverdata.database.ResultSetCallable; import mineplex.serverdata.database.column.ColumnVarChar; -public class SpawnRepository extends MinecraftRepository +public class SpawnRepository extends RepositoryBase { private static String CREATE_SPAWN_TABLE = "CREATE TABLE IF NOT EXISTS spawns (id INT NOT NULL AUTO_INCREMENT, serverName VARCHAR(100), location VARCHAR(100), PRIMARY KEY (id), INDEX serverNameIndex (serverName));"; private static String RETRIEVE_SPAWNS = "SELECT location FROM spawns WHERE serverName = ?;"; @@ -24,20 +24,9 @@ public class SpawnRepository extends MinecraftRepository public SpawnRepository(JavaPlugin plugin, String serverName) { - super(plugin, DBPool.getAccount()); + super(DBPool.getAccount()); _serverName = serverName; } - - @Override - protected void initialize() - { - //executeUpdate(CREATE_SPAWN_TABLE); - } - - @Override - protected void update() - { - } public void addSpawn(String location) { diff --git a/Plugins/Mineplex.Core/src/mineplex/core/sponsorbranding/BrandingManager.java b/Plugins/Mineplex.Core/src/mineplex/core/sponsorbranding/BrandingManager.java index 944be5f58..883975960 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/sponsorbranding/BrandingManager.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/sponsorbranding/BrandingManager.java @@ -3,28 +3,29 @@ package mineplex.core.sponsorbranding; import java.awt.image.BufferedImage; import java.io.File; import java.io.IOException; +import java.net.URL; import java.util.concurrent.ConcurrentHashMap; import javax.imageio.ImageIO; -import mineplex.core.MiniPlugin; - import org.bukkit.Location; import org.bukkit.block.BlockFace; -import org.bukkit.plugin.java.JavaPlugin; +import mineplex.core.MiniPlugin; +import mineplex.core.ReflectivelyCreateMiniPlugin; /** * * Manager for creating billboards with branding logos */ +@ReflectivelyCreateMiniPlugin public class BrandingManager extends MiniPlugin { private ConcurrentHashMap _posts = new ConcurrentHashMap(); private ConcurrentHashMap _imgCache = new ConcurrentHashMap(); - public BrandingManager(JavaPlugin plugin) + private BrandingManager() { - super("Branding Manager", plugin); + super("Branding Manager"); } private BufferedImage getImage(String fileName) @@ -56,6 +57,28 @@ public class BrandingManager extends MiniPlugin return image; } + private BufferedImage getImage(URL url) + { + if (_imgCache.containsKey(url.toString())) + { + return _imgCache.get(url.toString()); + } + + BufferedImage image = null; + + try + { + image = ImageIO.read(url); + _imgCache.put(url.toString(), image); + } + catch (IOException e) + { + e.printStackTrace(); + } + + return image; + } + /** * Generates a billboard with a stored logo * @param location The center of the billboard @@ -75,6 +98,22 @@ public class BrandingManager extends MiniPlugin _posts.put(_posts.size(), bp); } + public void createPost(Location location, BlockFace facing, URL url) + { + BufferedImage image = getImage(url); + + if (image == null) + { + System.out.println("ERROR! Invalid image url!"); + return; + } + + BrandingPost brandingPost = new BrandingPost(location, facing, image); + brandingPost.spawn(); + // Umm why not use a List? + _posts.put(_posts.size(), brandingPost); + } + /** * Clears away all existing billboards */ diff --git a/Plugins/Mineplex.Core/src/mineplex/core/sponsorbranding/BrandingPost.java b/Plugins/Mineplex.Core/src/mineplex/core/sponsorbranding/BrandingPost.java index 49039ff4d..54f469646 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/sponsorbranding/BrandingPost.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/sponsorbranding/BrandingPost.java @@ -68,6 +68,8 @@ public class BrandingPost int width = (int) Math.ceil(_img.getWidth() / 128); int height = (int) Math.ceil(_img.getHeight() / 128); + Bukkit.broadcastMessage("width=" + width + " height=" + height); + switch (_facing) { case EAST: @@ -160,6 +162,7 @@ public class BrandingPost ItemStack item = getMapItem(x, y, _img); i.setItem(item); + Bukkit.broadcastMessage(x + " <- X Y -> " + y); _ents.add(i); } } diff --git a/Plugins/Mineplex.Core/src/mineplex/core/stats/PlayerStats.java b/Plugins/Mineplex.Core/src/mineplex/core/stats/PlayerStats.java index 8bf28aa5b..8b9f4e229 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/stats/PlayerStats.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/stats/PlayerStats.java @@ -1,41 +1,72 @@ package mineplex.core.stats; -import java.util.Set; - -import mineplex.core.common.util.NautHashMap; +import java.util.Collections; +import java.util.HashMap; +import java.util.Map; +/** + * Represents a player's statistic information. This object is thread-safe + */ public class PlayerStats { - private NautHashMap _statHash = new NautHashMap(); - - public long addStat(String statName, long value) + private final Object lock = new Object(); + + private Map _stats = new HashMap<>(); + + /** + * Add a value to the specified stat + * + * @param statName The name of the stat + * @param value The value, must be positive + * @return The new value for the specified stat + */ + long addStat(String statName, long value) { - value = Math.max(0L, value); - - if (!_statHash.containsKey(statName)) + synchronized (lock) { - _statHash.put(statName, 0L); + return _stats.merge(statName, Math.max(0, value), Long::sum); } - - _statHash.put(statName, _statHash.get(statName) + value); - - return _statHash.get(statName); - } - - public long setStat(String statName, long value) - { - _statHash.put(statName, value); - - return _statHash.get(statName); - } - - public long getStat(String statName) - { - return _statHash.containsKey(statName) ? _statHash.get(statName) : 0L; } - public Set getStatsNames() - { - return _statHash.keySet(); + /** + * Sets the value of the specified stat + * + * @param statName The name of the stat + * @param value The value, must be positive + * @return The new value for the specified stat + */ + long setStat(String statName, long value) + { + synchronized (lock) + { + _stats.put(statName, value); + return value; + } + } + + /** + * Gets the value for the specified stat + * + * @param statName The name of the stat + * @return The value of the stat if it exists, or 0 if it does not + */ + public long getStat(String statName) + { + synchronized (lock) + { + return _stats.getOrDefault(statName, 0L); + } + } + + /** + * Returns a view of the all the stats. This view will not be updated + */ + public Map getStats() + { + synchronized (lock) + { + // make it unmodifiable so that people who try to edit it will get an exception instead of silently failing + return Collections.unmodifiableMap(new HashMap<>(_stats)); + } } } diff --git a/Plugins/Mineplex.Core/src/mineplex/core/stats/Stat.java b/Plugins/Mineplex.Core/src/mineplex/core/stats/Stat.java index 534251521..a2dcec041 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/stats/Stat.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/stats/Stat.java @@ -2,6 +2,22 @@ package mineplex.core.stats; public class Stat { - public int Id; - public String Name; + private int id; + private String name; + + public Stat(int id, String name) + { + this.id = id; + this.name = name; + } + + public int getId() + { + return id; + } + + public String getName() + { + return name; + } } diff --git a/Plugins/Mineplex.Core/src/mineplex/core/stats/StatsManager.java b/Plugins/Mineplex.Core/src/mineplex/core/stats/StatsManager.java index 8b52886cb..29804bc5b 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/stats/StatsManager.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/stats/StatsManager.java @@ -2,306 +2,299 @@ package mineplex.core.stats; import java.sql.ResultSet; import java.sql.SQLException; -import java.util.Iterator; +import java.util.HashMap; +import java.util.HashSet; +import java.util.Map; +import java.util.Set; import java.util.UUID; +import java.util.concurrent.Future; +import java.util.function.Consumer; -import mineplex.cache.player.PlayerInfo; import org.bukkit.Bukkit; import org.bukkit.entity.Player; import org.bukkit.event.EventHandler; import org.bukkit.event.player.PlayerJoinEvent; import org.bukkit.plugin.java.JavaPlugin; -import mineplex.cache.player.PlayerCache; import mineplex.core.MiniDbClientPlugin; +import mineplex.core.account.CoreClient; import mineplex.core.account.CoreClientManager; -import mineplex.core.common.util.NautHashMap; import mineplex.core.common.util.UtilServer; +import mineplex.core.common.util.UtilTasks; import mineplex.core.stats.command.GiveStatCommand; import mineplex.core.stats.command.MasterBuilderUnban; +import mineplex.core.stats.command.SetLevelCommand; import mineplex.core.stats.command.TimeCommand; import mineplex.core.stats.event.StatChangeEvent; +import mineplex.core.thread.ThreadPool; +import mineplex.core.updater.UpdateType; +import mineplex.core.utils.UtilScheduler; +/** + * This manager handles player statistics + */ public class StatsManager extends MiniDbClientPlugin { - private static final Object _statSync = new Object(); - - private StatsRepository _repository; - - private NautHashMap _stats = new NautHashMap(); - private NautHashMap> _statUploadQueue = new NautHashMap<>(); - private NautHashMap> _statUploadQueueOverRidable = new NautHashMap<>(); + private static final Object STATS_LOCK = new Object(); - private Runnable _saveRunnable; - - public StatsManager(JavaPlugin plugin, CoreClientManager clientManager) + private final CoreClientManager _coreClientManager; + private final StatsRepository _repository; + + private final Map _stats = new HashMap<>(); + private final Map> _statUploadQueue = new HashMap<>(); + private final Map> _statUploadQueueOverRidable = new HashMap<>(); + + public StatsManager(JavaPlugin plugin, CoreClientManager clientManager) { super("Stats Manager", plugin, clientManager); - _repository = new StatsRepository(plugin); - - if (_saveRunnable == null) + _repository = new StatsRepository(); + _coreClientManager = clientManager; + + UtilScheduler.runAsyncEvery(UpdateType.SEC, () -> { - _saveRunnable = new Runnable() - { - public void run() - { - saveStats(); - overRidableSaveStats(); - } - }; - - plugin.getServer().getScheduler().runTaskTimerAsynchronously(plugin, _saveRunnable, 20L, 20L); - } - + save(_statUploadQueue, _repository::saveStats, "increment"); + save(_statUploadQueueOverRidable, map -> _repository.saveStats(map, true), "override"); + }); + for (Stat stat : _repository.retrieveStats()) { - _stats.put(stat.Name, stat.Id); + _stats.put(stat.getName(), stat.getId()); } } - - @EventHandler - public void onPlayerJoin(PlayerJoinEvent event) + + /** + * Gets offline stats for the specified player name + * + * @return A Future to listen to, if you are already off the main thread + */ + public Future getOfflinePlayerStats(String playerName) { - PlayerStats playerStats = Get(event.getPlayer()); - - final int accountId = getClientManager().getAccountId(event.getPlayer()); - - for (String statName : playerStats.getStatsNames()) + return getOfflinePlayerStats(playerName, null); + } + + /** + * Gets offline stats for the specified player name + * + * @param action The action to perform with the fetched PlayerStats. This action will be performed on the main thread. Can be null + * @return A Future to listen to, should you already be off the main thread + */ + public Future getOfflinePlayerStats(String playerName, Consumer action) + { + return ThreadPool.ASYNC.submit(() -> { - if (!_stats.containsKey(statName)) - continue; - - final int statId = _stats.get(statName); - - if (playerStats.getStat(statName) == -1) + PlayerStats stats = _repository.loadOfflinePlayerStats(playerName); + UtilTasks.onMainThread(action).accept(stats); + return stats; + }); + } + + + /** + * Increments a stat for the given player by the specified amount + * + * @param value The value, must be greater or equal to zero + */ + public void incrementStat(Player player, String statName, long value) + { + if (value < 0) + return; + + CoreClient client = _coreClientManager.Get(player); + + long oldValue = Get(player).getStat(statName); + long newValue = Get(player).addStat(statName, value); + + UtilServer.getServer().getPluginManager().callEvent(new StatChangeEvent(player, statName, oldValue, newValue)); + registerNewStat(statName, () -> addToQueue(statName, client, value)); + } + + + /** + * Sets the value of a stat for the given player + * + * @param value The value, must be greater or equal to zero + */ + public void setStat(Player player, String statName, long value) + { + if (value < 0) + return; + + CoreClient client = _coreClientManager.Get(player); + + long oldValue = Get(player).getStat(statName); + Get(player).setStat(statName, value); + + UtilServer.getServer().getPluginManager().callEvent(new StatChangeEvent(player, statName, oldValue, value)); + registerNewStat(statName, () -> addToOverRidableQueue(statName, client, value)); + } + + /** + * Increments a stat for the given account ID of an offline player by the specified amount + */ + public void incrementStat(final int accountId, final String statName, final long value) + { + registerNewStat(statName, () -> + { + Map> uploadQueue = new HashMap<>(); + uploadQueue.computeIfAbsent(accountId, key -> new HashMap<>()).put(_stats.get(statName), value); + + _repository.saveStats(uploadQueue, false); + }); + } + + /** + * Sets the value of a stat for the given account ID of an offline player + * + * @param value The value, must be greater or equal to zero + */ + public void setStat(final int accountId, final String statName, final long value) + { + if (value < 0) + return; + + registerNewStat(statName, () -> + { + Map> uploadQueue = new HashMap<>(); + uploadQueue.computeIfAbsent(accountId, key -> new HashMap<>()).put(_stats.get(statName), value); + + _repository.saveStats(uploadQueue, true); + }); + } + + private void addToOverRidableQueue(String statName, CoreClient client, long value) + { + if (client.getAccountId() == -1) + { + System.out.println(String.format("Error: Tried to add %s/%s to overridable queue with -1 account id", client.getName(), client.getUniqueId())); + return; + } + + synchronized (STATS_LOCK) + { + _statUploadQueueOverRidable + .computeIfAbsent(client, key -> new HashMap<>()) + .put(statName, value); + } + } + + private void addToQueue(String statName, CoreClient client, long value) + { + if (client.getAccountId() == -1) + { + System.out.println(String.format("Error: Tried to add %s/%s to increment queue with -1 account id", client.getName(), client.getUniqueId())); + return; + } + + synchronized (STATS_LOCK) + { + _statUploadQueue + .computeIfAbsent(client, key -> new HashMap<>()) + .merge(statName, value, Long::sum); + } + } + + protected void save(Map> statsMap, Consumer>> action, String type) + { + if (statsMap.isEmpty()) + return; + + Map> uploadQueue = new HashMap<>(); + + try + { + synchronized (STATS_LOCK) { - runAsync(new Runnable() + statsMap.entrySet().removeIf(entry -> { - public void run() + CoreClient client = entry.getKey(); + if (Bukkit.getPlayer(client.getUniqueId()) != null) + return false; + + Map uploadStats = uploadQueue.computeIfAbsent(client.getAccountId(), key -> new HashMap<>()); + + entry.getValue().entrySet() + .stream() + .sorted(Map.Entry.comparingByKey()) + .forEach(ent -> { - _repository.setStat(accountId, statId, 0); - } + // Sanity check + if (_stats.containsKey(ent.getKey())) + { + uploadStats.merge(_stats.get(ent.getKey()), ent.getValue(), Long::sum); + System.out.println(String.format("Saving stat '%s' for '%s', value '%s', type '%s'", ent.getKey(), client.getName() == null ? client.getUniqueId().toString() : client.getName(), uploadStats.get(_stats.get(ent.getKey())), type)); + } + }); + + return true; }); } } - } - - public void incrementStat(final Player player, final String statName, final long value) - { - incrementStat(player, statName, value, false); - } - - public void incrementStat(final Player player, final String statName, final long value, boolean overRide) - { - if (value <= 0) - return; - - long newValue = Get(player).addStat(statName, value); - - //Event - UtilServer.getServer().getPluginManager().callEvent(new StatChangeEvent(player.getName(), statName, newValue - value, newValue)); - - // Verify stat is in our local cache, if not add it remotely. - registerNewStat(statName, new Runnable() - { - @Override - public void run() - { - if(overRide) - { - addToOverRidableQueue(statName, player, value); - } - else - { - addToQueue(statName, player, value); - } - } - }); - } - - private void addToOverRidableQueue(String statName, Player player, long value) - { - synchronized (_statSync) - { - if (!_statUploadQueueOverRidable.containsKey(player.getUniqueId())) - _statUploadQueueOverRidable.put(player.getUniqueId(), new NautHashMap()); - - if (!_statUploadQueueOverRidable.get(player.getUniqueId()).containsKey(statName)) - _statUploadQueueOverRidable.get(player.getUniqueId()).put(statName, 0L); - - _statUploadQueueOverRidable.get(player.getUniqueId()).put(statName, _statUploadQueueOverRidable.get(player.getUniqueId()).get(statName) + value); - } - } - - protected void overRidableSaveStats() - { - if (_statUploadQueueOverRidable.isEmpty()) - return; - - try - { - NautHashMap> uploadQueue = new NautHashMap>(); - - synchronized (_statSync) - { - for (Iterator statIterator = _statUploadQueueOverRidable.keySet().iterator(); statIterator.hasNext();) - { - UUID player = statIterator.next(); - - if (Bukkit.getPlayer(player) != null) - continue; - - try - { - PlayerInfo info = PlayerCache.getInstance().getPlayer(player); - - uploadQueue.put(info.getAccountId(), new NautHashMap<>()); - - for (String statName : _statUploadQueueOverRidable.get(player).keySet()) - { - int statId = _stats.get(statName); - uploadQueue.get(info.getAccountId()).put(statId, _statUploadQueueOverRidable.get(player).get(statName)); - System.out.println(info.getName() + " saving stat : " + statName + " overriding " + _statUploadQueueOverRidable.get(player).get(statName)); - } - - statIterator.remove(); - } - catch (Exception e) - { - //System.out.println("[StatsManager] AccountId was not set for " + player.getName()); - } - } - } - - _repository.saveStats(uploadQueue, true); - } catch (Exception exception) { exception.printStackTrace(); } - } - - private void addToQueue(String statName, Player player, long value) - { - synchronized (_statSync) + finally { - if (!_statUploadQueue.containsKey(player.getUniqueId())) - _statUploadQueue.put(player.getUniqueId(), new NautHashMap()); - - if (!_statUploadQueue.get(player.getUniqueId()).containsKey(statName)) - _statUploadQueue.get(player.getUniqueId()).put(statName, 0L); - - _statUploadQueue.get(player.getUniqueId()).put(statName, _statUploadQueue.get(player.getUniqueId()).get(statName) + value); + action.accept(uploadQueue); } } - protected void saveStats() - { - if (_statUploadQueue.isEmpty()) - return; - - try - { - NautHashMap> uploadQueue = new NautHashMap>(); - - synchronized (_statSync) - { - for (Iterator statIterator = _statUploadQueue.keySet().iterator(); statIterator.hasNext();) - { - UUID player = statIterator.next(); - - if (Bukkit.getPlayer(player) != null) - continue; - - try - { - PlayerInfo info = PlayerCache.getInstance().getPlayer(player); - - uploadQueue.put(info.getAccountId(), new NautHashMap()); - - for (String statName : _statUploadQueue.get(player).keySet()) - { - int statId = _stats.get(statName); - uploadQueue.get(info.getAccountId()).put(statId, _statUploadQueue.get(player).get(statName)); - System.out.println(info.getName() + " saving stat : " + statName + " adding " + _statUploadQueue.get(player).get(statName)); - } - - statIterator.remove(); - } - catch (Exception e) - { - //System.out.println("[StatsManager] AccountId was not set for " + player.getName()); - } - } - } - - _repository.saveStats(uploadQueue); - } - catch (Exception exception) - { - exception.printStackTrace(); - } - } - - public boolean incrementStat(final int accountId, final String statName, final long value) - { - return incrementStat(accountId, statName, value, false); - } - - public boolean incrementStat(final int accountId, final String statName, final long value, boolean overRide) - { - // This will register a new stat if we don't have one, otherwise it will just run the callback - registerNewStat(statName, new Runnable() - { - @Override - public void run() - { - final NautHashMap> uploadQueue = new NautHashMap>(); - uploadQueue.put(accountId, new NautHashMap()); - uploadQueue.get(accountId).put(_stats.get(statName), value); - - _repository.saveStats(uploadQueue, overRide); - } - }); - - return true; - } - private void registerNewStat(final String statName, final Runnable callback) { - runAsync(new Runnable() + runAsync(() -> { - public void run() + synchronized (STATS_LOCK) { - synchronized (_statSync) + if (_stats.containsKey(statName)) { - if (_stats.containsKey(statName)) - { - if (callback != null) callback.run(); - return; - } - - _repository.addStat(statName); - - _stats.clear(); - - for (Stat stat : _repository.retrieveStats()) - { - _stats.put(stat.Name, stat.Id); - } - if (callback != null) callback.run(); + return; } + + _repository.registerNewStat(statName); + + _stats.clear(); + + for (Stat stat : _repository.retrieveStats()) + { + _stats.put(stat.getName(), stat.getId()); + } + + if (callback != null) callback.run(); } }); } - - - - public int getStatId(String statName) + + @EventHandler + private void onPlayerJoin(PlayerJoinEvent event) { - return _stats.get(statName); + Set statsToReset = new HashSet<>(); + + Get(event.getPlayer()).getStats().forEach((stat, amount) -> + { + if (!_stats.containsKey(stat)) + return; + + if (amount == -1) + { + statsToReset.add(stat); + } + }); + + statsToReset.forEach(stat -> + { + setStat(event.getPlayer(), stat, 0); + }); + } + + @Override + public void addCommands() + { + addCommand(new TimeCommand(this)); + addCommand(new GiveStatCommand(this)); + addCommand(new SetLevelCommand(this)); + addCommand(new MasterBuilderUnban(this)); } @Override @@ -310,23 +303,25 @@ public class StatsManager extends MiniDbClientPlugin return new PlayerStats(); } - public PlayerStats getOfflinePlayerStats(String playerName) throws SQLException - { - return _repository.loadOfflinePlayerStats(playerName); - } - - @Override - public void addCommands() - { - addCommand(new TimeCommand(this)); - addCommand(new GiveStatCommand(this)); - addCommand(new MasterBuilderUnban(this)); - } - @Override public void processLoginResultSet(String playerName, UUID uuid, int accountId, ResultSet resultSet) throws SQLException { - Set(uuid, _repository.loadClientInformation(resultSet)); + PlayerStats playerStats = new PlayerStats(); + + while (resultSet.next()) + { + try + { + playerStats.addStat(resultSet.getString(1), resultSet.getLong(2)); + } + catch (Exception ex) + { + ex.printStackTrace(); + playerStats.addStat(resultSet.getString(1), -1); + } + } + + Set(uuid, playerStats); } @Override diff --git a/Plugins/Mineplex.Core/src/mineplex/core/stats/StatsRepository.java b/Plugins/Mineplex.Core/src/mineplex/core/stats/StatsRepository.java index cb5ec1320..518021120 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/stats/StatsRepository.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/stats/StatsRepository.java @@ -1,20 +1,11 @@ package mineplex.core.stats; -import java.sql.ResultSet; -import java.sql.SQLException; import java.util.ArrayList; import java.util.Collections; import java.util.List; +import java.util.Map; +import java.util.Objects; -import mineplex.core.common.util.NautHashMap; -import mineplex.core.database.MinecraftRepository; -import mineplex.serverdata.database.DBPool; -import mineplex.serverdata.database.RepositoryBase; -import mineplex.serverdata.database.ResultSetCallable; -import mineplex.serverdata.database.column.ColumnVarChar; -import mineplex.database.Tables; - -import org.bukkit.plugin.java.JavaPlugin; import org.jooq.DSLContext; import org.jooq.Insert; import org.jooq.Record2; @@ -24,59 +15,69 @@ import org.jooq.Update; import org.jooq.impl.DSL; import org.jooq.types.ULong; -public class StatsRepository extends MinecraftRepository -{ - private static String RETRIEVE_STATS = "SELECT id, name FROM stats;"; - private static String INSERT_STAT = "INSERT INTO stats (name) VALUES (?);"; +import mineplex.core.database.MinecraftRepository; +import mineplex.database.Tables; +import mineplex.serverdata.database.DBPool; +import mineplex.serverdata.database.RepositoryBase; +import mineplex.serverdata.database.column.ColumnVarChar; - - public StatsRepository(JavaPlugin plugin) +public class StatsRepository extends RepositoryBase +{ + private static final String RETRIEVE_STATS = "SELECT id, name FROM stats;"; + private static final String INSERT_STAT = "INSERT INTO stats (name) VALUES (?);"; + + public StatsRepository() { - super(plugin, DBPool.getAccount()); + super(DBPool.getAccount()); } - @Override - protected void initialize() { } - - @Override - protected void update() { } - + /** + * Retrieves all the remote registered stats + * + * @return The list of stats + */ public List retrieveStats() { - final List stats = new ArrayList(); - - executeQuery(RETRIEVE_STATS, new ResultSetCallable() - { - public void processResultSet(ResultSet resultSet) throws SQLException - { - while (resultSet.next()) - { - Stat stat = new Stat(); - - stat.Id = resultSet.getInt(1); - stat.Name = resultSet.getString(2); + List stats = new ArrayList<>(); - stats.add(stat); - } + executeQuery(RETRIEVE_STATS, resultSet -> + { + while (resultSet.next()) + { + stats.add(new Stat(resultSet.getInt(1), resultSet.getString(2))); } }); - + return stats; } - - public void addStat(String name) + + /** + * Registers a stat with the remote server + * + * @param name The name of the stat + */ + public void registerNewStat(String name) { executeUpdate(INSERT_STAT, new ColumnVarChar("name", 100, name)); } - - public void saveStats(NautHashMap> uploadQueue) + + /** + * Saves the given stats + * + * @param uploadQueue A map of account ID to a map of stat IDS to values + */ + public void saveStats(Map> uploadQueue) { saveStats(uploadQueue, false); } - - @SuppressWarnings("rawtypes") - public void saveStats(NautHashMap> uploadQueue, boolean overRideStat) + /** + * Saves the given stats + * + * @param uploadQueue A map of account ID to a map of stat IDS to values + * @param overrideStat Whether to replace the remote value, or to add to it + */ + public void saveStats(Map> uploadQueue, boolean overrideStat) { try { @@ -89,22 +90,22 @@ public class StatsRepository extends MinecraftRepository { for (Integer statId : uploadQueue.get(accountId).keySet()) { - if(overRideStat) + if (overrideStat) { Update update = context .update(Tables.accountStat) .set(Tables.accountStat.value, ULong.valueOf(uploadQueue.get(accountId).get(statId))) .where(Tables.accountStat.accountId.eq(accountId)) .and(Tables.accountStat.statId.eq(statId)); - updates.add(update); + updates.add(update); } else { Update update = context - .update(Tables.accountStat) - .set(Tables.accountStat.value, Tables.accountStat.value.plus(uploadQueue.get(accountId).get(statId))) - .where(Tables.accountStat.accountId.eq(accountId)) - .and(Tables.accountStat.statId.eq(statId)); + .update(Tables.accountStat) + .set(Tables.accountStat.value, Tables.accountStat.value.plus(uploadQueue.get(accountId).get(statId))) + .where(Tables.accountStat.accountId.eq(accountId)) + .and(Tables.accountStat.statId.eq(statId)); updates.add(update); } @@ -126,16 +127,21 @@ public class StatsRepository extends MinecraftRepository inserts.set(i, null); } - inserts.removeAll(Collections.singleton(null)); + inserts.removeIf(Objects::isNull); context.batch(inserts).execute(); } catch (Exception e) { + System.out.println("Failed to save stats: " + uploadQueue); e.printStackTrace(); } } + + /** + * Gets offline stats for the specified player name. This performs SQL on the current thread + */ public PlayerStats loadOfflinePlayerStats(String playerName) { PlayerStats playerStats = null; @@ -168,43 +174,4 @@ public class StatsRepository extends MinecraftRepository return playerStats; } - - public PlayerStats loadClientInformation(ResultSet resultSet) throws SQLException - { - final PlayerStats playerStats = new PlayerStats(); - - while (resultSet.next()) - { - try - { - playerStats.addStat(resultSet.getString(1), resultSet.getLong(2)); - } - catch (Exception ex) - { - ex.printStackTrace(); - playerStats.addStat(resultSet.getString(1), -1); - } - } - - return playerStats; - } - - public void setStat(int accountId, int statId, long value) - { - try - { - DSLContext context = DSL.using(getConnectionPool(), SQLDialect.MYSQL); - - context - .update(Tables.accountStat) - .set(Tables.accountStat.value, ULong.valueOf(value)) - .where(Tables.accountStat.accountId.eq(accountId)) - .and(Tables.accountStat.statId.eq(statId)) - .execute(); - } - catch (Exception e) - { - e.printStackTrace(); - } - } } diff --git a/Plugins/Mineplex.Core/src/mineplex/core/stats/command/GiveStatCommand.java b/Plugins/Mineplex.Core/src/mineplex/core/stats/command/GiveStatCommand.java index 688a8aaa8..79fa1d233 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/stats/command/GiveStatCommand.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/stats/command/GiveStatCommand.java @@ -1,8 +1,8 @@ package mineplex.core.stats.command; +import org.apache.commons.lang3.StringUtils; import org.bukkit.entity.Player; -import mineplex.core.account.CoreClient; import mineplex.core.command.CommandBase; import mineplex.core.common.Rank; import mineplex.core.common.util.F; @@ -21,43 +21,45 @@ public class GiveStatCommand extends CommandBase { if (args.length < 3) { - UtilPlayer.message(caller, F.main("Stats", "/givestat ")); + UtilPlayer.message(caller, F.main("Stats", "/givestat [player] [amount] [stat name]")); return; } - + + Player player = UtilPlayer.searchOnline(caller, args[0], true); + + int amount; + try { - Player player = UtilPlayer.searchOnline(caller, args[0], true); - - String tempStatName = args[1]; - - for (int i = 2; i < args.length - 1; i++) - { - tempStatName += " " + args[i]; - } - - final String statName = tempStatName; - - if (player == null) - { - Plugin.getClientManager().loadClientByName(args[0], client -> - { - if (client != null) - Plugin.incrementStat(client.getAccountId(), statName, Long.parseLong(args[args.length - 1])); - else - caller.sendMessage(F.main(Plugin.getName(), "Couldn't find " + args[0] + "'s account!")); - }); - } - else - { - Plugin.incrementStat(player, statName, Integer.parseInt(args[args.length - 1])); - } - - UtilPlayer.message(caller, F.main("Stats", "Applied " + F.elem(Integer.parseInt(args[args.length - 1]) + " " + statName) + " to " + F.elem(player.getName()) + ".")); + amount = Integer.parseInt(args[1]); } - catch (Exception e) + catch (NumberFormatException ex) { - UtilPlayer.message(caller, F.main("Stats", "/givestat ")); + UtilPlayer.message(caller, F.main("Stats", F.elem(args[1]) + " is not a number")); + return; + } + + String statName = StringUtils.join(args, " ", 2, args.length); + + if (player == null) + { + Plugin.getClientManager().loadClientByName(args[0], client -> + { + if (client != null) + { + Plugin.incrementStat(client.getAccountId(), statName, amount); + UtilPlayer.message(caller, F.main("Stats", "Applied " + F.elem(amount + " " + statName) + " to " + F.elem(args[0]) + ".")); + } + else + { + caller.sendMessage(F.main("Stats", "Couldn't find " + args[0] + "'s account!")); + } + }); + } + else + { + Plugin.incrementStat(player, statName, amount); + UtilPlayer.message(caller, F.main("Stats", "Applied " + F.elem(amount + " " + statName) + " to " + F.elem(player.getName()) + ".")); } } } \ No newline at end of file diff --git a/Plugins/Mineplex.Core/src/mineplex/core/stats/command/MasterBuilderUnban.java b/Plugins/Mineplex.Core/src/mineplex/core/stats/command/MasterBuilderUnban.java index a5784bd2d..fb8d77cc9 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/stats/command/MasterBuilderUnban.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/stats/command/MasterBuilderUnban.java @@ -1,21 +1,15 @@ package mineplex.core.stats.command; -import java.util.Iterator; -import java.util.List; +import org.bukkit.entity.Player; -import mineplex.core.account.CoreClient; import mineplex.core.command.CommandBase; import mineplex.core.common.Rank; -import mineplex.core.common.util.Callback; import mineplex.core.common.util.F; import mineplex.core.common.util.UtilPlayer; import mineplex.core.stats.StatsManager; -import org.bukkit.entity.Player; - public class MasterBuilderUnban extends CommandBase { - public MasterBuilderUnban(StatsManager plugin) { super(plugin, Rank.ADMIN, "buildunban"); @@ -24,75 +18,50 @@ public class MasterBuilderUnban extends CommandBase @Override public void Execute(Player caller, String[] args) { - if(args.length != 1) + if (args.length != 1) { - UtilPlayer.message(caller, F.main("MasterBuilder Unban", "/buildunban ")); + UtilPlayer.message(caller, F.main("MasterBuilder Unban", "/buildunban [player]")); return; } - try + Plugin.getClientManager().getRepository().matchPlayerName(matches -> { - Plugin.getClientManager().getRepository().matchPlayerName(new Callback>() + boolean matchedExact = false; + + for (String match : matches) { - - @Override - public void run(List matches) + if (match.equalsIgnoreCase(args[0])) { - boolean matchedExact = false; - - for (String match : matches) - { - if (match.equalsIgnoreCase(args[0])) - { - matchedExact = true; - } - } - - if (matchedExact) - { - for (Iterator matchIterator = matches.iterator(); matchIterator.hasNext();) - { - if (!matchIterator.next().equalsIgnoreCase(args[0])) - { - matchIterator.remove(); - } - } - } - UtilPlayer.searchOffline(matches, new Callback() - { - @Override - public void run(String target) - { - if(target == null) - { - caller.sendMessage(F.main("MasterBuilder Unban", "Couldn't find " + args[0] + "'s account!")); - return; - } - Plugin.getClientManager().loadClientByName(target, theClient -> - { - if(theClient != null) - { - Plugin.incrementStat(theClient.getAccountId(), "Global.Build Draw Abuse", 0, true); // True = Resets the stat - caller.sendMessage(F.main("MasterBuilder Unban", "The user " + target + " has been unbanned from Master Builders")); - } - else - { - caller.sendMessage(F.main("MasterBuilder Unban", "Couldn't find " + target + "'s client!")); - return; - } - }); - } - }, caller, args[0], false); + matchedExact = true; } - - }, args[0]); - - } - catch(Exception e) - { - e.printStackTrace(); - caller.sendMessage(F.main("MasterBuilder Unban", "Exception caught! Please contact Morten and explain what happened.")); - } + } + + if (matchedExact) + { + matches.removeIf(s -> !s.equalsIgnoreCase(args[0])); + } + + UtilPlayer.searchOffline(matches, target -> + { + if (target == null) + { + caller.sendMessage(F.main("MasterBuilder Unban", "Couldn't find " + F.elem(args[0]) + "'s account!")); + return; + } + + Plugin.getClientManager().loadClientByName(target, theClient -> + { + if (theClient == null) + { + caller.sendMessage(F.main("MasterBuilder Unban", "Couldn't find " + F.elem(target) + "'s client!")); + return; + } + + Plugin.setStat(theClient.getAccountId(), "Global.Build Draw Abuse", 0); + caller.sendMessage(F.main("MasterBuilder Unban", "The user " + F.elem(target) + " has been unbanned from Master Builders")); + }); + }, caller, args[0], false); + }, args[0]); } } diff --git a/Plugins/Mineplex.Core/src/mineplex/core/stats/command/SetLevelCommand.java b/Plugins/Mineplex.Core/src/mineplex/core/stats/command/SetLevelCommand.java new file mode 100644 index 000000000..0cea4ef87 --- /dev/null +++ b/Plugins/Mineplex.Core/src/mineplex/core/stats/command/SetLevelCommand.java @@ -0,0 +1,63 @@ +package mineplex.core.stats.command; + +import org.bukkit.entity.Player; + +import mineplex.core.achievement.Achievement; +import mineplex.core.command.CommandBase; +import mineplex.core.common.Rank; +import mineplex.core.common.util.F; +import mineplex.core.common.util.UtilPlayer; +import mineplex.core.stats.StatsManager; + +public class SetLevelCommand extends CommandBase +{ + public SetLevelCommand(StatsManager plugin) + { + super(plugin, Rank.ADMIN, "setlevel"); + } + + @Override + public void Execute(Player caller, String[] args) + { + if (args.length != 2) + { + UtilPlayer.message(caller, F.main("Stats", "/setlevel [player] [level]")); + return; + } + + Player target = UtilPlayer.searchOnline(caller, args[0], true); + + if (target == null) + { + return; + } + + int level; + + try + { + level = Integer.parseInt(args[1]); + } + catch (NumberFormatException ex) + { + UtilPlayer.message(caller, F.main("Stats", F.elem(args[1]) + " is not a number")); + return; + } + + if (level < 0 || level > 100) + { + UtilPlayer.message(caller, F.main("Stats", "That level is invalid")); + return; + } + + int amountNeeded = 0; + + for (int i = 0; i < level; i++) + { + amountNeeded += Achievement.GLOBAL_MINEPLEX_LEVEL.getLevels()[i]; + } + + Plugin.setStat(target, Achievement.GLOBAL_MINEPLEX_LEVEL.getStats()[0], amountNeeded); + UtilPlayer.message(caller, F.main("Stats", "Updated " + F.elem(target.getName()) + "'s level to " + F.elem(level))); + } +} diff --git a/Plugins/Mineplex.Core/src/mineplex/core/stats/command/TimeCommand.java b/Plugins/Mineplex.Core/src/mineplex/core/stats/command/TimeCommand.java index 42fe8b841..62b815568 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/stats/command/TimeCommand.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/stats/command/TimeCommand.java @@ -1,6 +1,6 @@ package mineplex.core.stats.command; -import java.sql.SQLException; +import java.util.function.Consumer; import org.bukkit.entity.Player; @@ -12,9 +12,6 @@ import mineplex.core.common.util.UtilTime; import mineplex.core.stats.PlayerStats; import mineplex.core.stats.StatsManager; -/** - * Created by Shaun on 10/2/2014. - */ public class TimeCommand extends CommandBase { public TimeCommand(StatsManager plugin) @@ -25,54 +22,34 @@ public class TimeCommand extends CommandBase @Override public void Execute(final Player caller, final String[] args) { - if (args == null || args.length == 0) + if (args.length == 0) { - UtilPlayer.message(caller, F.main("Time", "Usage: /time ")); + UtilPlayer.message(caller, F.main("Time", "/time [player]")); + return; } - else + + Player target = UtilPlayer.searchOnline(caller, args[0], true); + + Consumer statsConsumer = stats -> { - Player target = UtilPlayer.searchOnline(caller, args[0], false); - - if (target == null) + if (stats == null) { - Plugin.getPlugin().getServer().getScheduler().runTaskAsynchronously(Plugin.getPlugin(), new Runnable() - { - @Override - public void run() - { - try - { - final PlayerStats stats = Plugin.getOfflinePlayerStats(args[0]); - - Plugin.getPlugin().getServer().getScheduler().runTask(Plugin.getPlugin(), new Runnable() - { - @Override - public void run() - { - if (stats == null) - { - UtilPlayer.message(caller, F.main("Time", "Player " + F.elem(args[0]) + " not found!")); - } - else - { - long time = stats.getStat("Global.TimeInGame"); - UtilPlayer.message(caller, F.main("Time", F.name(args[0]) + " has spent " + F.elem(UtilTime.convertString(time * 1000L, 1, UtilTime.TimeUnit.FIT)) + " in game")); - } - } - }); - } - catch (SQLException e) - { - e.printStackTrace(); - } - } - }); + UtilPlayer.message(caller, F.main("Time", "Player " + F.elem(args[0]) + " not found!")); } else { - long time = Plugin.Get(target).getStat("Global.TimeInGame"); - UtilPlayer.message(caller, F.main("Time", F.name(target.getName()) + " has spent " + F.elem(UtilTime.convertString(time * 1000L, 1, UtilTime.TimeUnit.FIT)) + " in game")); + long time = stats.getStat("Global.TimeInGame"); + UtilPlayer.message(caller, F.main("Time", F.name(args[0]) + " has spent " + F.elem(UtilTime.convertString(time * 1000L, 1, UtilTime.TimeUnit.FIT)) + " in game")); } + }; + + if (target == null) + { + Plugin.getOfflinePlayerStats(args[0], statsConsumer); + } + else + { + statsConsumer.accept(Plugin.Get(target)); } } } \ No newline at end of file diff --git a/Plugins/Mineplex.Core/src/mineplex/core/stats/event/StatChangeEvent.java b/Plugins/Mineplex.Core/src/mineplex/core/stats/event/StatChangeEvent.java index 2dc93919f..6ec3d68fe 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/stats/event/StatChangeEvent.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/stats/event/StatChangeEvent.java @@ -2,53 +2,47 @@ package mineplex.core.stats.event; import org.bukkit.entity.Player; -import org.bukkit.event.Event; import org.bukkit.event.HandlerList; +import org.bukkit.event.player.PlayerEvent; -public class StatChangeEvent extends Event +public class StatChangeEvent extends PlayerEvent { - private static final HandlerList handlers = new HandlerList(); - - private String _player; - private String _statName; - private long _valueBefore; - private long _valueAfter; - - public StatChangeEvent(String player, String statName, long valueBefore, long valueAfter) - { - _player = player; - _statName = statName; - _valueBefore = valueBefore; - _valueAfter = valueAfter; - } - - public HandlerList getHandlers() - { - return handlers; - } - - public static HandlerList getHandlerList() - { - return handlers; - } - - public String getPlayerName() - { - return _player; - } - - public String getStatName() - { - return _statName; - } - - public long getValueBefore() - { - return _valueBefore; - } - - public long getValueAfter() - { - return _valueAfter; - } + private static final HandlerList handlers = new HandlerList(); + + private String _statName; + private long _valueBefore; + private long _valueAfter; + + public StatChangeEvent(Player player, String statName, long valueBefore, long valueAfter) + { + super(player); + _statName = statName; + _valueBefore = valueBefore; + _valueAfter = valueAfter; + } + + public HandlerList getHandlers() + { + return handlers; + } + + public static HandlerList getHandlerList() + { + return handlers; + } + + public String getStatName() + { + return _statName; + } + + public long getValueBefore() + { + return _valueBefore; + } + + public long getValueAfter() + { + return _valueAfter; + } } diff --git a/Plugins/Mineplex.Core/src/mineplex/core/status/ServerStatusManager.java b/Plugins/Mineplex.Core/src/mineplex/core/status/ServerStatusManager.java index e4109626e..596ab3aa5 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/status/ServerStatusManager.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/status/ServerStatusManager.java @@ -1,7 +1,9 @@ package mineplex.core.status; import java.io.File; +import java.lang.reflect.Constructor; import java.util.Collection; +import java.util.UUID; import org.bukkit.Bukkit; import org.bukkit.entity.Player; @@ -9,8 +11,15 @@ import org.bukkit.event.EventHandler; import org.bukkit.event.server.ServerListPingEvent; import org.bukkit.plugin.java.JavaPlugin; +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.mojang.authlib.GameProfile; +import com.mojang.authlib.properties.PropertyMap; +import com.mojang.util.UUIDTypeAdapter; + import mineplex.core.MiniPlugin; import mineplex.core.account.CoreClientManager; +import mineplex.core.common.Constants; import mineplex.core.common.util.Callback; import mineplex.core.monitor.LagMeter; import mineplex.core.updater.UpdateType; @@ -28,77 +37,77 @@ public class ServerStatusManager extends MiniPlugin { // The default timeout (in seconds) before the ServerStatus expires. public final int DEFAULT_SERVER_TIMEOUT = 30; - + private ServerRepository _repository; private CoreClientManager _clientManager; private LagMeter _lagMeter; - + private String _name; private Region _region; - + private boolean _enabled = true; - + private long _startUpDate; public ServerStatusManager(JavaPlugin plugin, CoreClientManager clientManager, LagMeter lagMeter) { super("Server Status Manager", plugin); - + _startUpDate = Utility.currentTimeSeconds(); _clientManager = clientManager; _lagMeter = lagMeter; - + if (new File("IgnoreUpdates.dat").exists() && !(new File("EnableStatus.dat").exists())) _enabled = false; - + setupConfigValues(); - + _name = plugin.getConfig().getString("serverstatus.name"); - + _region = plugin.getConfig().getBoolean("serverstatus.us") ? Region.US : Region.EU; - - ServerCommandManager.getInstance().initializeServer(_name); + + ServerCommandManager.getInstance().initializeServer(_name, Constants.GSON); ServerCommandManager.getInstance().registerCommandType("SuicideCommand", SuicideCommand.class, new SuicideHandler(this, _name, _region)); - + _repository = ServerManager.getServerRepository(_region); saveServerStatus(); } - + private void setupConfigValues() { - try - { + try + { getPlugin().getConfig().addDefault("serverstatus.connectionurl", "db.mineplex.com:3306"); getPlugin().getConfig().set("serverstatus.connectionurl", getPlugin().getConfig().getString("serverstatus.connectionurl")); - + getPlugin().getConfig().addDefault("serverstatus.username", "MilitaryPolice"); getPlugin().getConfig().set("serverstatus.username", getPlugin().getConfig().getString("serverstatus.username")); - + getPlugin().getConfig().addDefault("serverstatus.password", "CUPr6Wuw2Rus$qap"); getPlugin().getConfig().set("serverstatus.password", getPlugin().getConfig().getString("serverstatus.password")); - + getPlugin().getConfig().addDefault("serverstatus.us", true); getPlugin().getConfig().set("serverstatus.us", getPlugin().getConfig().getBoolean("serverstatus.us")); - + getPlugin().getConfig().addDefault("serverstatus.name", "TEST-1"); getPlugin().getConfig().set("serverstatus.name", getPlugin().getConfig().getString("serverstatus.name")); - + getPlugin().getConfig().addDefault("serverstatus.group", "Testing"); getPlugin().getConfig().set("serverstatus.group", getPlugin().getConfig().getString("serverstatus.group")); - + getPlugin().saveConfig(); - } - catch (Exception e) - { - e.printStackTrace(); - } + } + catch (Exception e) + { + e.printStackTrace(); + } } - + public void retrieveServerStatuses(final Callback> callback) { if (!_enabled) return; - + getPlugin().getServer().getScheduler().runTaskAsynchronously(getPlugin(), new Runnable() { public void run() @@ -110,17 +119,17 @@ public class ServerStatusManager extends MiniPlugin } }); } - + @EventHandler public void saveServerStatus(UpdateEvent event) { if (event.getType() != UpdateType.FASTER) return; - + if (_enabled) saveServerStatus(); } - + /** * Save the current {@link MinecraftServer} snapshot of this server to * the {@link ServerRepository}. @@ -134,26 +143,26 @@ public class ServerStatusManager extends MiniPlugin { MinecraftServer server = _repository.getServerStatus(serverSnapshot.getName()); int timeout = DEFAULT_SERVER_TIMEOUT; - + if (server != null && !server.getPublicAddress().equalsIgnoreCase(serverSnapshot.getPublicAddress())) { timeout = -DEFAULT_SERVER_TIMEOUT; } - + _repository.updataServerStatus(serverSnapshot, timeout); } }); } - + /** - * @return a newly instanced {@link MinecraftServer} snapshot that represents the + * @return a newly instanced {@link MinecraftServer} snapshot that represents the * current internal state of this minecraft server. */ private MinecraftServer generateServerSnapshot() { ServerListPingEvent event = new ServerListPingEvent(null, getPlugin().getServer().getMotd(), getPlugin().getServer().getOnlinePlayers().size(), getPlugin().getServer().getMaxPlayers()); getPluginManager().callEvent(event); - + String motd = _enabled ? event.getMotd() : "Restarting"; int playerCount = _clientManager.getPlayerCountIncludingConnecting(); int maxPlayerCount = event.getMaxPlayers(); @@ -163,9 +172,9 @@ public class ServerStatusManager extends MiniPlugin String group = _plugin.getConfig().getString("serverstatus.group") + ""; int ram = (int) ((Runtime.getRuntime().maxMemory() - Runtime.getRuntime().freeMemory()) / 1048576); int maxRam = (int) (Runtime.getRuntime().maxMemory() / 1048576); - + int donorsOnline = 0; - + for (Player player : Bukkit.getOnlinePlayers()) { if (_clientManager.Get(player).GetRank().isDonor()) @@ -173,9 +182,9 @@ public class ServerStatusManager extends MiniPlugin donorsOnline++; } } - - return new MinecraftServer(_name, group, motd, address, port, playerCount, - maxPlayerCount, tps, ram, maxRam, _startUpDate, donorsOnline); + + return new MinecraftServer(_name, group, motd, address, port, playerCount, + maxPlayerCount, tps, ram, maxRam, _startUpDate, donorsOnline); } public String getCurrentServerName() @@ -187,7 +196,7 @@ public class ServerStatusManager extends MiniPlugin { if (!_enabled) return; - + getPlugin().getServer().getScheduler().runTaskAsynchronously(getPlugin(), new Runnable() { public void run() diff --git a/Plugins/Mineplex.Core/src/mineplex/core/status/SuicideHandler.java b/Plugins/Mineplex.Core/src/mineplex/core/status/SuicideHandler.java index a3f59cc44..0ec0f1582 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/status/SuicideHandler.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/status/SuicideHandler.java @@ -1,6 +1,8 @@ package mineplex.core.status; import mineplex.core.common.util.F; +import mineplex.core.portal.GenericServer; +import mineplex.core.portal.Intent; import mineplex.core.portal.Portal; import mineplex.serverdata.Region; import mineplex.serverdata.commands.CommandCallback; @@ -42,7 +44,7 @@ public class SuicideHandler implements CommandCallback { public void run() { - Portal.getInstance().sendAllPlayers("Lobby"); + Portal.getInstance().sendAllPlayersToGenericServer(GenericServer.HUB, Intent.KICK); } }, 60L); diff --git a/Plugins/Mineplex.Core/src/mineplex/core/task/TaskManager.java b/Plugins/Mineplex.Core/src/mineplex/core/task/TaskManager.java index a5dc99212..9f73c6365 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/task/TaskManager.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/task/TaskManager.java @@ -4,12 +4,14 @@ import java.sql.ResultSet; import java.sql.SQLException; import java.util.List; import java.util.UUID; +import java.util.function.Consumer; import mineplex.cache.player.PlayerCache; import mineplex.core.MiniDbClientPlugin; import mineplex.core.account.CoreClientManager; import mineplex.core.common.util.Callback; import mineplex.core.common.util.NautHashMap; +import mineplex.core.common.util.UtilTasks; import mineplex.core.task.repository.TaskRepository; import org.bukkit.Bukkit; @@ -25,7 +27,7 @@ public class TaskManager extends MiniDbClientPlugin private NautHashMap _tasks = new NautHashMap(); - public TaskManager(JavaPlugin plugin, CoreClientManager clientManager, String webServerAddress) + public TaskManager(JavaPlugin plugin, CoreClientManager clientManager) { super("Task Manager", plugin, clientManager); @@ -54,7 +56,7 @@ public class TaskManager extends MiniDbClientPlugin return new TaskClient(); } - public void addTaskForOfflinePlayer(final Callback callback, final UUID uuid, final String task) + public void addTaskForOfflinePlayer(Consumer callback, final UUID uuid, final String task) { Bukkit.getServer().getScheduler().runTaskAsynchronously(getPlugin(), new Runnable() { @@ -75,16 +77,20 @@ public class TaskManager extends MiniDbClientPlugin updateTasks(); } - final boolean success = _repository.addAccountTask(PlayerCache.getInstance().getPlayer(uuid).getAccountId(), getTaskId(task)); - - if (callback != null) + int accountId = PlayerCache.getInstance().getAccountId(uuid); + + if (accountId != -1) { - Bukkit.getServer().getScheduler().runTask(getPlugin(), new Runnable() + UtilTasks.onMainThread(callback).accept(_repository.addAccountTask(accountId, getTaskId(task))); + } + else + { + ClientManager.loadAccountIdFromUUID(uuid, id -> { - public void run() - { - callback.run(success); - } + if (id > 0) + UtilTasks.onMainThread(callback).accept(_repository.addAccountTask(accountId, getTaskId(task))); + else + UtilTasks.onMainThread(callback).accept(false); }); } } @@ -114,27 +120,24 @@ public class TaskManager extends MiniDbClientPlugin } } - addTaskForOfflinePlayer(new Callback() + addTaskForOfflinePlayer(success -> { - public void run(Boolean success) + if (!success) { - if (!success.booleanValue()) + System.out.println("Add task FAILED for " + player.getName()); + + synchronized (_taskLock) { - System.out.println("Add task FAILED for " + player.getName()); - - synchronized (_taskLock) + if (_tasks.containsKey(taskName)) { - if (_tasks.containsKey(taskName)) - { - Get(player).TasksCompleted.remove(_tasks.get(taskName)); - } + Get(player).TasksCompleted.remove(_tasks.get(taskName)); } } - - if (callback != null) - { - callback.run(success); - } + } + + if (callback != null) + { + callback.run(success); } }, player.getUniqueId(), taskName); } diff --git a/Plugins/Mineplex.Core/src/mineplex/core/task/repository/TaskRepository.java b/Plugins/Mineplex.Core/src/mineplex/core/task/repository/TaskRepository.java index 35766c91d..429e2874d 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/task/repository/TaskRepository.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/task/repository/TaskRepository.java @@ -16,7 +16,7 @@ import mineplex.serverdata.database.column.ColumnVarChar; import mineplex.core.task.Task; import mineplex.core.task.TaskClient; -public class TaskRepository extends MinecraftRepository +public class TaskRepository extends RepositoryBase { private static String ADD_ACCOUNT_TASK = "INSERT INTO accountTasks (accountId, taskId) VALUES (?, ?);"; @@ -25,17 +25,7 @@ public class TaskRepository extends MinecraftRepository public TaskRepository(JavaPlugin plugin) { - super(plugin, DBPool.getAccount()); - } - - @Override - protected void initialize() - { - } - - @Override - protected void update() - { + super(DBPool.getAccount()); } public boolean addAccountTask(int accountId, int taskId) diff --git a/Plugins/Mineplex.Core/src/mineplex/core/teleport/command/LocateCommand.java b/Plugins/Mineplex.Core/src/mineplex/core/teleport/command/LocateCommand.java index db276f9f4..c2ef276c7 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/teleport/command/LocateCommand.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/teleport/command/LocateCommand.java @@ -12,7 +12,7 @@ public class LocateCommand extends CommandBase { public LocateCommand(Teleport plugin) { - super(plugin, Rank.MODERATOR, "locate", "where", "find"); + super(plugin, Rank.HELPER, "locate", "where", "find"); } @Override diff --git a/Plugins/Mineplex.Core/src/mineplex/core/texttutorial/TextTutorialManager.java b/Plugins/Mineplex.Core/src/mineplex/core/texttutorial/TextTutorialManager.java index 57c4d924c..cd444453e 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/texttutorial/TextTutorialManager.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/texttutorial/TextTutorialManager.java @@ -3,16 +3,19 @@ package mineplex.core.texttutorial; import java.util.HashSet; import java.util.Iterator; +import org.bukkit.Bukkit; import org.bukkit.Sound; import org.bukkit.entity.LivingEntity; import org.bukkit.entity.Player; import org.bukkit.event.EventHandler; import org.bukkit.event.player.PlayerInteractEntityEvent; import org.bukkit.event.player.PlayerInteractEvent; +import org.bukkit.event.player.PlayerJoinEvent; import org.bukkit.event.player.PlayerQuitEvent; import org.bukkit.plugin.java.JavaPlugin; import mineplex.core.MiniPlugin; +import mineplex.core.common.currency.GlobalCurrency; import mineplex.core.common.util.C; import mineplex.core.common.util.Callback; import mineplex.core.common.util.F; @@ -37,8 +40,15 @@ public class TextTutorialManager extends MiniPlugin _donationManager = donationManager; _taskManager = taskManager; + + _tutorials = new HashSet<>(); } + public void addTutorial(Tutorial tutorial) + { + _tutorials.add(tutorial); + } + @EventHandler public void startTutorial(PlayerInteractEntityEvent event) { @@ -60,6 +70,12 @@ public class TextTutorialManager extends MiniPlugin { UtilPlayer.message(event.getPlayer(), F.main("Tutorial", "You started " + F.elem(tut.getName()) + ".")); tut.startTutorial(event.getPlayer()); + + for (Player other : Bukkit.getOnlinePlayers()) + { + other.hidePlayer(event.getPlayer()); + } + return; } } @@ -91,10 +107,16 @@ public class TextTutorialManager extends MiniPlugin else { iterator.remove(); - + tut.stopTutorial(player); + //Inform UtilPlayer.message(player, F.main("Tutorial", "You completed " + F.elem(tut.getName()) + ".")); + for (Player other : Bukkit.getOnlinePlayers()) + { + other.showPlayer(player); + } + //Gems if (tut.getGemReward() > 0) { @@ -104,19 +126,16 @@ public class TextTutorialManager extends MiniPlugin { public void run(Boolean completed) { - _donationManager.RewardGems(new Callback() + _donationManager.rewardCurrency(GlobalCurrency.GEM, player, "Tutorial " + tut.getName(), tut.getGemReward(), success -> { - public void run(Boolean completed) + if (completed) { - if (completed) - { - UtilPlayer.message(player, F.main("Tutorial", "You received " + F.elem(C.cGreen + tut.getGemReward() + " Gems") + ".")); + UtilPlayer.message(player, F.main("Tutorial", "You received " + F.elem(C.cGreen + tut.getGemReward() + " Gems") + ".")); - //Sound - player.playSound(player.getLocation(), Sound.LEVEL_UP, 2f, 1.5f); - } + //Sound + player.playSound(player.getLocation(), Sound.LEVEL_UP, 2f, 1.5f); } - }, "Tutorial " + tut.getName(), player.getName(), player.getUniqueId(), tut.getGemReward()); + }); } }, player, tut.getTaskId()); } @@ -127,6 +146,20 @@ public class TextTutorialManager extends MiniPlugin } } + @EventHandler + public void hidePlayer(PlayerJoinEvent event) + { + Player player = event.getPlayer(); + + for (Player other : Bukkit.getOnlinePlayers()) + { + if (isInTutorial(other)) + { + player.hidePlayer(other); + } + } + } + @EventHandler public void playerQuit(PlayerQuitEvent event) { diff --git a/Plugins/Mineplex.Core/src/mineplex/core/texttutorial/tutorial/Tutorial.java b/Plugins/Mineplex.Core/src/mineplex/core/texttutorial/tutorial/Tutorial.java index 362139c9c..d864d6813 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/texttutorial/tutorial/Tutorial.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/texttutorial/tutorial/Tutorial.java @@ -20,6 +20,8 @@ public abstract class Tutorial _name = name; _taskId = taskId; _gemReward = gemReward; + _phases = new ArrayList<>(); + _playerMap = new HashMap<>(); } public String getName() diff --git a/Plugins/Mineplex.Core/src/mineplex/core/thank/ThankManager.java b/Plugins/Mineplex.Core/src/mineplex/core/thank/ThankManager.java index be164a8bf..44291ba7f 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/thank/ThankManager.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/thank/ThankManager.java @@ -2,12 +2,14 @@ package mineplex.core.thank; import mineplex.core.MiniDbClientPlugin; import mineplex.core.account.CoreClientManager; +import mineplex.core.common.currency.GlobalCurrency; import mineplex.core.common.util.Callback; import mineplex.core.common.util.F; import mineplex.core.common.util.UtilPlayer; import mineplex.core.donation.DonationManager; import mineplex.core.recharge.Recharge; import mineplex.core.thank.command.ThankCommand; + import org.bukkit.entity.Player; import org.bukkit.plugin.java.JavaPlugin; @@ -33,7 +35,7 @@ public class ThankManager extends MiniDbClientPlugin _donationManager = donationManager; - _thankRepository = new ThankRepository(plugin); + _thankRepository = new ThankRepository(); } @Override @@ -46,13 +48,13 @@ public class ThankManager extends MiniDbClientPlugin * Attempt to thank a player. This can be used to distribute rewards to players, give players rewards for using * amplifiers, and allow players to thank anyone inside a game. * - * @param receiver The player who is being thanked - * @param sender The player thanking receiver + * @param receiver The player who is being thanked + * @param sender The player thanking receiver * @param receiverReward The Treasure Shard reward for the receiver - * @param senderReward The Treasure Shard reward for the sender - * @param reason The reason that player is being thanked + * @param senderReward The Treasure Shard reward for the sender + * @param reason The reason that player is being thanked * @param ignoreCooldown Should we ignore all thank cooldowns - * @param callback Callback for processing the result + * @param callback Callback for processing the result */ public void thankPlayer(Player receiver, Player sender, int receiverReward, int senderReward, String reason, boolean ignoreCooldown, Callback callback) { @@ -63,18 +65,19 @@ public class ThankManager extends MiniDbClientPlugin return; } - int senderAccountId = ClientManager.getAccountId(sender); int receiverAccountId = ClientManager.getAccountId(receiver); - thankPlayer(receiver.getName(), receiverAccountId, sender.getName(), senderAccountId, receiverReward, senderReward, reason, ignoreCooldown, result -> + thankPlayer(receiver.getName(), receiverAccountId, sender, receiverReward, senderReward, reason, ignoreCooldown, result -> { if (result == ThankResult.SUCCESS) { // Reload their thank data if the player is online! - runAsync(() -> { + runAsync(() -> + { try { Set(receiver, _thankRepository.getThankData(receiverAccountId)); - } catch (SQLException e) + } + catch (SQLException e) { e.printStackTrace(); } @@ -88,7 +91,7 @@ public class ThankManager extends MiniDbClientPlugin /** * Called when a player wants to "claim" all pending rewards that they haven't claimed yet * - * @param player The player claiming their thank rewards + * @param player The player claiming their thank rewards * @param callback Callback with the result of the claim */ public void claimThanks(Player player, Callback callback) @@ -102,15 +105,17 @@ public class ThankManager extends MiniDbClientPlugin return; } - runAsync(() -> { + runAsync(() -> + { try { ClaimThankResult result = _thankRepository.claimThank(accountId); - runSync(() -> { + runSync(() -> + { if (result != null && result.getClaimed() > 0) { Set(player, new ThankData(0)); - _donationManager.rewardCoinsUntilSuccess(null, "Thank", player.getName(), accountId, result.getClaimed()); + _donationManager.rewardCurrencyUntilSuccess(GlobalCurrency.TREASURE_SHARD, player, "Thank", result.getClaimed()); } callback.run(result); }); @@ -127,18 +132,19 @@ public class ThankManager extends MiniDbClientPlugin * Attempt to thank a player. This can be used to distribute rewards to players, give players rewards for using * amplifiers, and allow players to thank anyone inside a game. * - * @param receiverName Name of the player being thanked + * @param receiverName Name of the player being thanked * @param receiverAccountId Account id of the player being thanked - * @param senderName Name of the player sending the thanks - * @param senderAccountId Account id of the player sending the thanks - * @param receiverReward The Treasure Shard reward for the receiver - * @param senderReward The Treasure Shard reward for the sender - * @param reason The reason that player is being thanked - * @param ignoreCooldown Should we ignore all thank cooldowns - * @param callback Callback for processing the result + * @param sender The player sending the thanks + * @param receiverReward The Treasure Shard reward for the receiver + * @param senderReward The Treasure Shard reward for the sender + * @param reason The reason that player is being thanked + * @param ignoreCooldown Should we ignore all thank cooldowns + * @param callback Callback for processing the result */ - public void thankPlayer(String receiverName, int receiverAccountId, String senderName, int senderAccountId, int receiverReward, int senderReward, String reason, boolean ignoreCooldown, Callback callback) + public void thankPlayer(String receiverName, int receiverAccountId, Player sender, int receiverReward, int senderReward, String reason, boolean ignoreCooldown, Callback callback) { + int senderAccountId = getClientManager().getAccountId(sender); + // Break out on bad account id if (senderAccountId == -1 || receiverAccountId == -1) { @@ -153,15 +159,17 @@ public class ThankManager extends MiniDbClientPlugin return; } - runAsync(() -> { + runAsync(() -> + { try { boolean success = _thankRepository.thank(receiverAccountId, senderAccountId, receiverReward, reason, ignoreCooldown); - runSync(() -> { + runSync(() -> + { if (success) { // Reward Shards for the sender now. The player being thanked can claim their shards at Carl. - _donationManager.rewardCoinsUntilSuccess(null, "Thank", senderName, senderAccountId, senderReward); + _donationManager.rewardCurrencyUntilSuccess(GlobalCurrency.TREASURE_SHARD, sender, "Thank", senderReward); } callback.run(success ? ThankResult.SUCCESS : ThankResult.COOLDOWN_DATABASE); @@ -182,7 +190,7 @@ public class ThankManager extends MiniDbClientPlugin } @Override - public void processLoginResultSet(String playerName, UUID playerUUID, int accountId, ResultSet resultSet) throws SQLException + public void processLoginResultSet(String playerName, UUID playerUUID, int accountId, ResultSet resultSet) throws SQLException { if (resultSet.next()) { diff --git a/Plugins/Mineplex.Core/src/mineplex/core/thank/ThankRepository.java b/Plugins/Mineplex.Core/src/mineplex/core/thank/ThankRepository.java index d426009fa..1e2d752e6 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/thank/ThankRepository.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/thank/ThankRepository.java @@ -4,32 +4,19 @@ import mineplex.core.database.MinecraftRepository; import mineplex.database.routines.AddThank; import mineplex.database.routines.ClaimThank; import mineplex.serverdata.database.DBPool; -import mineplex.serverdata.database.ResultSetCallable; +import mineplex.serverdata.database.RepositoryBase; import mineplex.serverdata.database.column.ColumnInt; import org.bukkit.plugin.java.JavaPlugin; -import org.jooq.Configuration; -import java.sql.ResultSet; import java.sql.SQLException; -public class ThankRepository extends MinecraftRepository +public class ThankRepository extends RepositoryBase { private static final String GET_THANK_DATA = "SELECT SUM(thankAmount) FROM accountThankTransactions WHERE receiverId = ? AND claimed = FALSE"; - public ThankRepository(JavaPlugin plugin) + public ThankRepository() { - super(plugin, DBPool.getAccount()); - } - - @Override - protected void initialize() - { - } - - @Override - protected void update() - { - + super(DBPool.getAccount()); } public boolean thank(int receiverAccountId, int senderAccountId, int thankAmount, String reason, boolean ignoreCooldown) diff --git a/Plugins/Mineplex.Core/src/mineplex/core/thereallyoldscoreboardapiweshouldremove/PlayerScoreboard.java b/Plugins/Mineplex.Core/src/mineplex/core/thereallyoldscoreboardapiweshouldremove/PlayerScoreboard.java index 7655e3bc4..8a7175388 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/thereallyoldscoreboardapiweshouldremove/PlayerScoreboard.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/thereallyoldscoreboardapiweshouldremove/PlayerScoreboard.java @@ -38,9 +38,9 @@ public class PlayerScoreboard for (Rank rank : Rank.values()) { if (rank != Rank.ALL) - _scoreboard.registerNewTeam(rank.Name).setPrefix(rank.getTag(true, true) + ChatColor.RESET + " "); + _scoreboard.registerNewTeam(rank.ScoreboardTag).setPrefix(rank.getTag(true, true) + ChatColor.RESET + " "); else - _scoreboard.registerNewTeam(rank.Name).setPrefix(""); + _scoreboard.registerNewTeam(rank.ScoreboardTag).setPrefix(""); } _scoreboard.registerNewTeam("Party").setPrefix(ChatColor.LIGHT_PURPLE + C.Bold + "Party" + ChatColor.RESET + " "); @@ -53,8 +53,8 @@ public class PlayerScoreboard if (_manager.getClients().Get(otherPlayer) == null) continue; - String rankName = _manager.getClients().Get(player).GetRank().Name; - String otherRankName = _manager.getClients().Get(otherPlayer).GetRank().Name; + String rankName = _manager.getClients().Get(player).GetRank().ScoreboardTag; + String otherRankName = _manager.getClients().Get(otherPlayer).GetRank().ScoreboardTag; //Add Other to Self _scoreboard.getTeam(otherRankName).addPlayer(otherPlayer); diff --git a/Plugins/Mineplex.Core/src/mineplex/core/thereallyoldscoreboardapiweshouldremove/elements/ScoreboardElementRank.java b/Plugins/Mineplex.Core/src/mineplex/core/thereallyoldscoreboardapiweshouldremove/elements/ScoreboardElementRank.java index 17f4629bd..87b0c237d 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/thereallyoldscoreboardapiweshouldremove/elements/ScoreboardElementRank.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/thereallyoldscoreboardapiweshouldremove/elements/ScoreboardElementRank.java @@ -19,11 +19,11 @@ public class ScoreboardElementRank implements ScoreboardElement { output.add(manager.getClients().Get(player).GetRank().Name); } - else if (manager.getDonation().Get(player).OwnsUnknownPackage("SuperSmashMobs ULTRA") || - manager.getDonation().Get(player).OwnsUnknownPackage("Survival Games ULTRA") || - manager.getDonation().Get(player).OwnsUnknownPackage("Minigames ULTRA") || - manager.getDonation().Get(player).OwnsUnknownPackage("CastleSiege ULTRA") || - manager.getDonation().Get(player).OwnsUnknownPackage("Champions ULTRA")) + else if (manager.getDonation().Get(player).ownsUnknownSalesPackage("SuperSmashMobs ULTRA") || + manager.getDonation().Get(player).ownsUnknownSalesPackage("Survival Games ULTRA") || + manager.getDonation().Get(player).ownsUnknownSalesPackage("Minigames ULTRA") || + manager.getDonation().Get(player).ownsUnknownSalesPackage("CastleSiege ULTRA") || + manager.getDonation().Get(player).ownsUnknownSalesPackage("Champions ULTRA")) { output.add("Single Ultra"); } diff --git a/Plugins/Mineplex.Core/src/mineplex/core/titles/TitleData.java b/Plugins/Mineplex.Core/src/mineplex/core/titles/TitleData.java new file mode 100644 index 000000000..6f680157a --- /dev/null +++ b/Plugins/Mineplex.Core/src/mineplex/core/titles/TitleData.java @@ -0,0 +1,16 @@ +package mineplex.core.titles; + +public class TitleData +{ + private final String _selectedTitle; + + public TitleData(String selectedTitle) + { + this._selectedTitle = selectedTitle; + } + + public String getTrackId() + { + return _selectedTitle; + } +} diff --git a/Plugins/Mineplex.Core/src/mineplex/core/titles/Titles.java b/Plugins/Mineplex.Core/src/mineplex/core/titles/Titles.java new file mode 100644 index 000000000..4ebce3925 --- /dev/null +++ b/Plugins/Mineplex.Core/src/mineplex/core/titles/Titles.java @@ -0,0 +1,1101 @@ +package mineplex.core.titles; + +import java.sql.ResultSet; +import java.sql.SQLException; +import java.util.Arrays; +import java.util.HashMap; +import java.util.List; +import java.util.Map; +import java.util.UUID; +import java.util.concurrent.atomic.AtomicInteger; +import java.util.stream.Collectors; + +import net.md_5.bungee.api.ChatColor; +import net.md_5.bungee.api.chat.BaseComponent; +import net.md_5.bungee.api.chat.ClickEvent; +import net.md_5.bungee.api.chat.ComponentBuilder; +import net.md_5.bungee.api.chat.HoverEvent; +import net.minecraft.server.v1_8_R3.DataWatcher; +import net.minecraft.server.v1_8_R3.EntityArmorStand; +import net.minecraft.server.v1_8_R3.EntityPlayer; +import net.minecraft.server.v1_8_R3.EntitySlime; +import net.minecraft.server.v1_8_R3.Items; +import net.minecraft.server.v1_8_R3.MathHelper; +import net.minecraft.server.v1_8_R3.PacketPlayOutAttachEntity; +import net.minecraft.server.v1_8_R3.PacketPlayOutEntityDestroy; +import net.minecraft.server.v1_8_R3.PacketPlayOutEntityMetadata; +import net.minecraft.server.v1_8_R3.PacketPlayOutHeldItemSlot; +import net.minecraft.server.v1_8_R3.PacketPlayOutNamedEntitySpawn; +import net.minecraft.server.v1_8_R3.PacketPlayOutNewAttachEntity; +import net.minecraft.server.v1_8_R3.PacketPlayOutSpawnEntityLiving; +import net.minecraft.server.v1_8_R3.PacketPlayOutWindowItems; +import net.minecraft.server.v1_8_R3.World; + +import org.bukkit.Bukkit; +import org.bukkit.Material; +import org.bukkit.Sound; +import org.bukkit.craftbukkit.v1_8_R3.CraftWorld; +import org.bukkit.craftbukkit.v1_8_R3.entity.CraftPlayer; +import org.bukkit.craftbukkit.v1_8_R3.inventory.CraftItemStack; +import org.bukkit.entity.EntityType; +import org.bukkit.entity.Player; +import org.bukkit.event.EventHandler; +import org.bukkit.event.EventPriority; +import org.bukkit.event.player.PlayerInteractEvent; +import org.bukkit.event.player.PlayerJoinEvent; +import org.bukkit.event.player.PlayerQuitEvent; +import org.bukkit.event.player.PlayerToggleSneakEvent; +import org.bukkit.inventory.ItemStack; +import org.bukkit.scheduler.BukkitRunnable; +import org.bukkit.scheduler.BukkitTask; + +import mineplex.core.Managers; +import mineplex.core.MiniDbClientPlugin; +import mineplex.core.ReflectivelyCreateMiniPlugin; +import mineplex.core.account.CoreClientManager; +import mineplex.core.book.BookBuilder; +import mineplex.core.common.DummyEntity; +import mineplex.core.common.MinecraftVersion; +import mineplex.core.common.util.C; +import mineplex.core.common.util.F; +import mineplex.core.common.util.LineFormat; +import mineplex.core.common.util.UtilEnt; +import mineplex.core.common.util.UtilEvent; +import mineplex.core.common.util.UtilPlayer; +import mineplex.core.common.util.UtilServer; +import mineplex.core.common.util.UtilText; +import mineplex.core.gadget.GadgetManager; +import mineplex.core.gadget.types.GadgetType; +import mineplex.core.itemstack.ItemBuilder; +import mineplex.core.packethandler.IPacketHandler; +import mineplex.core.packethandler.PacketHandler; +import mineplex.core.packethandler.PacketInfo; +import mineplex.core.titles.commands.TrackCommand; +import mineplex.core.titles.tracks.Track; +import mineplex.core.titles.tracks.TrackFormat; +import mineplex.core.titles.tracks.TrackManager; +import mineplex.core.titles.tracks.TrackTier; +import mineplex.core.twofactor.TwoFactorAuth; + +/** + * This manager handles displaying titles above a player's head, as well as their tracks + */ +@ReflectivelyCreateMiniPlugin +public class Titles extends MiniDbClientPlugin implements IPacketHandler +{ + public static int BOOK_SLOT = 7; + + // Maps player to their selected track + private final Map _selectedTrack = new HashMap<>(); + private final Map _trackAnimationProgress = new HashMap<>(); + + // Maps player to map of player and the id for the armorstand nametag + private final Map> _armorStandIds = new HashMap<>(); + // Maps player to map of player and all ids that it owns + private final Map>> _allIds = new HashMap<>(); + + private final TrackManager _trackManager = require(TrackManager.class); + private final TitlesRepository _titlesRepository = new TitlesRepository(); + + private final GadgetManager _gadgetManager = require(GadgetManager.class); + private final TwoFactorAuth _twofactor = require(TwoFactorAuth.class); + + private final BaseComponent[] CLICK_ENABLE_TRACK = new ComponentBuilder("") + .append("Click to enable this track") + .color(ChatColor.GREEN) + .create(); + + private final BaseComponent[] CLICK_DISABLE_TRACK = new ComponentBuilder("") + .append("Click to disable this track") + .color(ChatColor.RED) + .create(); + + private static final BaseComponent[] RETURN_TO_TABLE_OF_CONTENTS = new ComponentBuilder("") + .append("Click to return to Table of Contents") + .color(ChatColor.YELLOW) + .create(); + + private boolean _disabled; + + private Titles() + { + super("Titles", UtilServer.getPlugin(), Managers.require(CoreClientManager.class)); + + require(PacketHandler.class).addPacketHandler(this, PacketHandler.ListenerPriority.LOW, PacketPlayOutNamedEntitySpawn.class, PacketPlayOutEntityDestroy.class); + } + + @Override + public void processLoginResultSet(String playerName, UUID uuid, int accountId, ResultSet resultSet) throws SQLException + { + if (resultSet.next()) + { + Set(uuid, new TitleData(resultSet.getString(1))); + } + } + + @Override + public String getQuery(int accountId, String uuid, String name) + { + return "SELECT trackName FROM accountTitle WHERE accountId = '" + accountId + "';"; + } + + @Override + protected TitleData addPlayer(UUID uuid) + { + return new TitleData(null); + } + + @Override + public void addCommands() + { + addCommand(new TrackCommand(this)); + } + + @EventHandler + private void onJoin(PlayerJoinEvent event) + { + if (Get(event.getPlayer()) != null) + { + Track track = _trackManager.getTrackById(Get(event.getPlayer()).getTrackId()); + if (track != null && track.getRequirements().getTier(event.getPlayer()) != null) + { + toggleActiveTrack(event.getPlayer(), track); + } + } + } + + @EventHandler + private void onQuit(PlayerQuitEvent event) + { + _armorStandIds.values().forEach(map -> map.keySet().removeIf(key -> key.equals(event.getPlayer().getUniqueId()))); + _allIds.values().forEach(map -> map.keySet().removeIf(key -> key.equals(event.getPlayer().getUniqueId()))); + _selectedTrack.remove(event.getPlayer().getUniqueId()); + BukkitTask task = _trackAnimationProgress.remove(event.getPlayer().getUniqueId()); + if (task != null) + { + task.cancel(); + } + } + + @EventHandler + public void onInteract(PlayerInteractEvent event) + { + if (!_twofactor.isAuthenticating(event.getPlayer()) && event.getItem() != null && UtilEvent.isAction(event, UtilEvent.ActionType.R)) + { + boolean cancel = false; + + if (event.getItem().getType() == Material.WRITTEN_BOOK) + { + cancel = true; + giveBook(event.getPlayer(), true); + } + else if (event.getItem().getType() == Material.BOOK) + { + if (UtilPlayer.getVersion(event.getPlayer()) == MinecraftVersion.Version1_8) + { + UtilPlayer.message(event.getPlayer(), F.main("Track", "Titles are not available for 1.8.x!")); + event.getPlayer().playSound(event.getPlayer().getLocation(), Sound.ANVIL_LAND, 1f, 1f); + cancel = true; + } + } + + if (cancel) + event.setCancelled(true); + } + } + + @EventHandler(priority = EventPriority.MONITOR, ignoreCancelled = true) + public void onSneak(PlayerToggleSneakEvent event) + { + if (event.isSneaking()) + { + updateTitle(event.getPlayer(), (String) null); + } + else + { + updateTitle(event.getPlayer(), getActiveTrack(event.getPlayer())); + } + } + + public void setOrToggleTrackForPlayer(Player player, Track track, boolean clickedBook) + { + if (_disabled) + { + UtilPlayer.message(player, F.main("Track", "Tracks are disabled right now!")); + return; + } + + toggleActiveTrack(player, track); + + giveBook(player, clickedBook); + + runAsync(() -> + { + _titlesRepository.savePlayerSelection(player, getActiveTrack(player)); + }); + } + + public Track getActiveTrack(Player player) + { + return _selectedTrack.get(player.getUniqueId()); + } + + public void giveBookIfNotExists(Player player, boolean open) + { + if (player.getInventory().getItem(BOOK_SLOT) != null) + { + Material type = player.getInventory().getItem(BOOK_SLOT).getType(); + if (type == Material.WRITTEN_BOOK || type == Material.BOOK) + { + return; + } + } + + giveBook(player, open); + } + + public void giveBook(Player player, boolean open) + { + switch (UtilPlayer.getVersion(player)) + { + case Version1_9: + case Version1_8: + giveBook19(player, open); + break; + case ALL: + break; + } + } + + private void giveBook18(Player player, boolean open) + { + ItemStack book = new ItemBuilder(Material.BOOK) + .setTitle(ChatColor.GREEN + "Titles " + ChatColor.WHITE + "- " + ChatColor.RED + "Unavailable") + .setLore( + ChatColor.RESET + "" + ChatColor.GRAY + "by Mineplex Games", + ChatColor.RESET + "" + ChatColor.GRAY + "Original", + "", + ChatColor.RESET + "" + ChatColor.GRAY + "Unavailable in 1.8.x" + ) + .setGlow(true) + .build(); + + player.getInventory().setItem(BOOK_SLOT, book); + } + + private void giveBook19(Player player, boolean open) + { + EntityPlayer entityPlayer = ((CraftPlayer) player).getHandle(); + net.minecraft.server.v1_8_R3.ItemStack book; + if (player.getInventory().getItem(BOOK_SLOT) != null && player.getInventory().getItem(BOOK_SLOT).getType() == Material.WRITTEN_BOOK) + { + book = ((CraftItemStack) player.getInventory().getItem(BOOK_SLOT)).getHandle(); + } + else + { + book = new net.minecraft.server.v1_8_R3.ItemStack(Items.WRITTEN_BOOK); + ((CraftPlayer) player).getHandle().inventory.setItem(BOOK_SLOT, book); + } + + List tracks = _trackManager.getAllTracks(); + + tracks.removeIf(track -> track.getRequirements().getTier(player) == null && track.hideIfUnowned()); + + tracks.sort((a, b) -> + { + if (a.hideIfUnowned() && !b.hideIfUnowned()) + { + return -1; + } + else if (!a.hideIfUnowned() && b.hideIfUnowned()) + { + return 1; + } + else + { + return a.getShortName().compareTo(b.getShortName()); + } + }); + + String bookTitle = C.cGreen + "Titles"; + + if (getActiveTrack(player) != null) + { + Track track = getActiveTrack(player); + if (track.getRequirements().getTier(player) != null) + { + bookTitle += ChatColor.RESET + " - " + ChatColor.RESET + track.getRequirements().getTier(player).getDisplayName(); + } + } + + BookBuilder bookBuilder = BookBuilder.newBuilder() + .title(bookTitle) + .author("Mineplex Games"); + + // Build Table of Contents + { + int pagesRequired = (int) Math.ceil(tracks.size() / 10.0); + int currentPage = 1; + int current = 0; + int trackPage = pagesRequired + 1; + while (current < tracks.size()) + { + List subList = tracks.subList(current, Math.min(current + 10, tracks.size())); + + ComponentBuilder tableOfContentsComponents = new ComponentBuilder("") + .append("Table of Contents") + .color(ChatColor.DARK_RED) + .bold(true) + .append("\n", ComponentBuilder.FormatRetention.NONE) + .append("Page " + currentPage + "/" + pagesRequired, ComponentBuilder.FormatRetention.NONE) + .color(ChatColor.RED) + .append("\n\n", ComponentBuilder.FormatRetention.NONE); + + for (Track track : subList) + { + if (track.getRequirements().getTier(player) != null) + { + if (getActiveTrack(player) == track) + { + tableOfContentsComponents + .append("[+]", ComponentBuilder.FormatRetention.NONE) + .color(ChatColor.DARK_GREEN) + .event(new HoverEvent(HoverEvent.Action.SHOW_TEXT, CLICK_DISABLE_TRACK)) + .event(new ClickEvent(ClickEvent.Action.RUN_COMMAND, "/track " + track.getId() + " open")); + } + else + { + tableOfContentsComponents + .append("[-]", ComponentBuilder.FormatRetention.NONE) + .color(ChatColor.RED) + .event(new HoverEvent(HoverEvent.Action.SHOW_TEXT, CLICK_ENABLE_TRACK)) + .event(new ClickEvent(ClickEvent.Action.RUN_COMMAND, "/track " + track.getId() + " open")); + } + } + else + { + tableOfContentsComponents + .append("[x]", ComponentBuilder.FormatRetention.NONE) + .color(ChatColor.GRAY); + } + tableOfContentsComponents + .append(" ", ComponentBuilder.FormatRetention.NONE) + .append(track.getShortName()) + .color(ChatColor.BLACK) + .event(new ClickEvent(ClickEvent.Action.CHANGE_PAGE, String.valueOf(trackPage++))) + .event(new HoverEvent(HoverEvent.Action.SHOW_TEXT, createTrackHover(player, track, true))); + + if (track.getRequirements().getNextTier(player) == null) + { + tableOfContentsComponents + .append(" ", ComponentBuilder.FormatRetention.NONE) + .append("★", ComponentBuilder.FormatRetention.NONE) + .color(ChatColor.DARK_AQUA); + } + tableOfContentsComponents + .append("\n", ComponentBuilder.FormatRetention.NONE); + } + + bookBuilder.newPage().component(tableOfContentsComponents.create()); + + current += 10; + currentPage++; + } + } + + for (Track track : tracks) + { + ComponentBuilder pageContent = new ComponentBuilder(""); + pageContent + .append("☰") + .event(new ClickEvent(ClickEvent.Action.CHANGE_PAGE, "1")) + .event(new HoverEvent(HoverEvent.Action.SHOW_TEXT, RETURN_TO_TABLE_OF_CONTENTS)) + .append(" ", ComponentBuilder.FormatRetention.NONE) + .append(track.getShortName()) + .bold(true) + .event(new HoverEvent(HoverEvent.Action.SHOW_TEXT, createTrackHover(player, track, false))); + if (track.getRequirements().getTier(player) != null) + { + if (getActiveTrack(player) == track) + { + pageContent + .color(ChatColor.DARK_GREEN) + .event(new ClickEvent(ClickEvent.Action.RUN_COMMAND, "/track " + track.getId() + " open")); + } + else + { + pageContent + .color(ChatColor.BLACK) + .event(new ClickEvent(ClickEvent.Action.RUN_COMMAND, "/track " + track.getId() + " open")); + } + } + else + { + pageContent + .color(ChatColor.BLACK); + } + pageContent + .append("\n\n", ComponentBuilder.FormatRetention.NONE) + .append("Next Tier ") + .color(ChatColor.DARK_AQUA) + .bold(true) + .append("\n", ComponentBuilder.FormatRetention.NONE); + + TrackTier nextTier = track.getRequirements().getNextTier(player); + if (nextTier != null) + { + ComponentBuilder progressHover = new ComponentBuilder("") + .append("Progress: ") + .color(ChatColor.YELLOW) + .append(String.valueOf(nextTier.get(player)), ComponentBuilder.FormatRetention.NONE) + .color(ChatColor.WHITE) + .append("/") + .append(String.valueOf(nextTier.getGoal())); + + + int totalTicks = 20; + double progress = nextTier.getProgress(player); + String percent = ((int) (progress * 100.0)) + "%"; + int ticks = ((int) (progress * totalTicks * 1.0)); + pageContent.append("[", ComponentBuilder.FormatRetention.NONE); + StringBuilder pipes = new StringBuilder(); + for (int i = 0; i < ticks; i++) + { + pipes.append("|"); + } + BaseComponent[] components = progressHover.create(); + + pageContent + .append(pipes.toString(), ComponentBuilder.FormatRetention.NONE) + .color(ChatColor.DARK_GREEN) + .event(new HoverEvent(HoverEvent.Action.SHOW_TEXT, components)); + pipes.setLength(0); + for (int i = ticks; i < totalTicks; i++) + { + pipes.append("|"); + } + pageContent + .append(pipes.toString(), ComponentBuilder.FormatRetention.NONE) + .color(ChatColor.GRAY) + .event(new HoverEvent(HoverEvent.Action.SHOW_TEXT, components)) + .append("] (" + percent + ")", ComponentBuilder.FormatRetention.NONE) + .color(ChatColor.BLACK); + } + else + { + pageContent + .append("No more tiers!"); + } + + pageContent + .append("\n\n") + .append("Progress") + .color(ChatColor.DARK_AQUA) + .bold(true) + .append("\n", ComponentBuilder.FormatRetention.NONE); + + for (TrackTier tier : track.getRequirements().getTiers()) + { + int rank = track.getRequirements().getRank(tier); + + ComponentBuilder tierHover = new ComponentBuilder("") + .append(track.getLongName()) + .color(track.getColor()) + .bold(true) + .append(" Tier " + rank, ComponentBuilder.FormatRetention.NONE) + .color(tier.getFormat().getColor()) + .append("\n\n", ComponentBuilder.FormatRetention.NONE); + + if (tier.getDescription() != null) + { + tierHover + .append( + Arrays.stream( + UtilText.splitLineToArray(tier.getDescription(), LineFormat.LORE) + ).collect(Collectors.joining("\n")), + ComponentBuilder.FormatRetention.NONE + ) + .append("\n\n", ComponentBuilder.FormatRetention.NONE); + } + tierHover + .append("Title: ") + .color(ChatColor.YELLOW); + + tierHover.append("", ComponentBuilder.FormatRetention.NONE); + tier.getFormat().preFormat(tierHover); + tierHover.append(tier.getTitle(), ComponentBuilder.FormatRetention.NONE); + tier.getFormat().format(tierHover); + tierHover.append("", ComponentBuilder.FormatRetention.NONE); + tier.getFormat().postFormat(tierHover); + + tierHover.append("\n", ComponentBuilder.FormatRetention.NONE) + .append("Progress: ") + .color(ChatColor.YELLOW) + .append(Math.min(tier.get(player), tier.getGoal()) + "/" + tier.getGoal(), ComponentBuilder.FormatRetention.NONE) + .color(ChatColor.WHITE); + + if (tier.getProgress(player) >= 1.0) + { + tierHover + .append("\n\n", ComponentBuilder.FormatRetention.NONE) + .append("Complete!") + .color(ChatColor.AQUA); + } + + pageContent + .append(track.getShortName() + " " + UtilText.toRomanNumeral(rank), ComponentBuilder.FormatRetention.NONE) + .color(tier.getProgress(player) >= 1.0 ? ChatColor.DARK_GREEN : ChatColor.GRAY) + .event(new HoverEvent(HoverEvent.Action.SHOW_TEXT, tierHover.create())) + .append("\n", ComponentBuilder.FormatRetention.NONE); + } + + bookBuilder.newPage().component(pageContent.create()); + } + + book.setTag(bookBuilder.toCompound()); + + entityPlayer.playerConnection.sendPacket(new PacketPlayOutWindowItems(entityPlayer.activeContainer.windowId, entityPlayer.activeContainer.a())); + + if (open) + { + int old = entityPlayer.inventory.itemInHandIndex; + if (old != BOOK_SLOT) + { + entityPlayer.playerConnection.sendPacket(new PacketPlayOutHeldItemSlot(BOOK_SLOT)); + } + ((CraftPlayer) player).getHandle().openBook(book); + if (old != BOOK_SLOT) + { + entityPlayer.playerConnection.sendPacket(new PacketPlayOutHeldItemSlot(old)); + } + } + } + + private BaseComponent[] createTrackHover(Player player, Track track, boolean isMainPage) + { + ComponentBuilder trackHover = new ComponentBuilder("") + .append(track.getLongName()) + .color(track.getColor()) + .bold(true) + .append("\n\n", ComponentBuilder.FormatRetention.NONE) + .append( + Arrays.stream( + UtilText.splitLineToArray(track.getDescription(), LineFormat.LORE) + ).collect(Collectors.joining("\n")), + ComponentBuilder.FormatRetention.NONE + ) + .color(ChatColor.WHITE) + .append("\n\n", ComponentBuilder.FormatRetention.NONE); + + if (!isMainPage) + { + track.getRequirements().appendLore(trackHover); + + if (track.getRequirements().getTier(player) != null) + { + if (getActiveTrack(player) == track) + { + trackHover + .append("Click to disable: ", ComponentBuilder.FormatRetention.NONE) + .color(ChatColor.RED); + } + else + { + trackHover + .append("Click to enable: ", ComponentBuilder.FormatRetention.NONE) + .color(ChatColor.GREEN); + } + TrackTier tier = track.getRequirements().getTier(player); + trackHover.append("", ComponentBuilder.FormatRetention.NONE); + tier.getFormat().preFormat(trackHover); + trackHover.append(tier.getTitle(), ComponentBuilder.FormatRetention.NONE); + tier.getFormat().format(trackHover); + trackHover.append("", ComponentBuilder.FormatRetention.NONE); + tier.getFormat().postFormat(trackHover); + } + else + { + trackHover + .append("You have not unlocked any tiers in this track!", ComponentBuilder.FormatRetention.NONE) + .color(ChatColor.GRAY); + } + trackHover + .append("\n\n", ComponentBuilder.FormatRetention.NONE); + } + else + { + if (track.getRequirements().getNextTier(player) != null) + { + TrackTier nextTier = track.getRequirements().getNextTier(player); + + trackHover + .append("Progress: ") + .color(ChatColor.YELLOW) + .append(String.valueOf(nextTier.get(player)), ComponentBuilder.FormatRetention.NONE) + .color(ChatColor.WHITE) + .append("/") + .append(String.valueOf(nextTier.getGoal())) + .append("\n\n"); + } + trackHover + .append("Click to view this track", ComponentBuilder.FormatRetention.NONE) + .color(ChatColor.GREEN) + .append("\n\n", ComponentBuilder.FormatRetention.NONE); + } + trackHover + .append("ID: ") + .color(ChatColor.YELLOW) + .append(track.getId(), ComponentBuilder.FormatRetention.NONE) + .color(ChatColor.WHITE); + + return trackHover.create(); + } + + private void toggleActiveTrack(Player player, Track track) + { + if (getActiveTrack(player) != track) + { + if (track.getRequirements().getTier(player) != null) + { + _selectedTrack.put(player.getUniqueId(), track); + if (!_trackAnimationProgress.containsKey(player.getUniqueId())) + { + _trackAnimationProgress.put(player.getUniqueId(), runSyncTimer(new BukkitRunnable() + { + private AtomicInteger _lastRun = new AtomicInteger(); + private int _frame = 0; + + @Override + public void run() + { + Track curTrack = _selectedTrack.get(player.getUniqueId()); + if (curTrack != null) + { + TrackTier curTier = curTrack.getRequirements().getTier(player); + if (curTier != null) + { + TrackFormat format = curTier.getFormat(); + if (format.isAnimated()) + { + if (_lastRun.get() > format.getDelay()) + { + _lastRun.set(0); + + List lines = format.getAnimatedLines(); + if (_frame >= lines.size()) + { + _frame = 0; + } + + updateTitle(player, lines.get(_frame)); + + _frame++; + } + _lastRun.incrementAndGet(); + } + } + } + } + }, 0L, 1L)); + } + UtilPlayer.message(player, F.main("Track", "Your active track has been updated to " + track.getColor() + track.getLongName())); + } + else + { + UtilPlayer.message(player, F.main("Track", "Uh oh. Couldn't set your active track because you don't have any unlocked tiers on " + track.getColor() + track.getLongName() + C.mBody + "!")); + } + } + else + { + _selectedTrack.remove(player.getUniqueId()); + UtilPlayer.message(player, F.main("Track", "Your have disabled your active track")); + } + + updateTitle(player, getActiveTrack(player)); + } + + private void updateTitle(Player player, Track track) + { + if (_disabled) + return; + + if (track != null && track.getRequirements().getTier(player) != null) + { + TrackTier currentTier = track.getRequirements().getTier(player); + updateTitle(player, currentTier.getDisplayName()); + } + else + { + updateTitle(player, (String) null); + } + } + + + private void updateTitle(Player player, String str) + { + if (_disabled) + return; + + Map map = _armorStandIds.get(player.getEntityId()); + + if (map == null) return; + + map.forEach((uuid, entityId) -> + { + Player other = Bukkit.getPlayer(uuid); + if (other == null) + return; + + updateArmorStand(player, other, str, entityId); + }); + } + + @Override + public void handle(PacketInfo packetInfo) + { + if (packetInfo.isCancelled()) + return; + + if (_disabled) + return; + + if (packetInfo.getPacket() instanceof PacketPlayOutNamedEntitySpawn) + { + PacketPlayOutNamedEntitySpawn packet = (PacketPlayOutNamedEntitySpawn) packetInfo.getPacket(); + Player owner = (Player) UtilEnt.getEntityById(packet.a); + if (_gadgetManager.getActive(owner, GadgetType.MORPH) == null) + { + summonForEntity(packetInfo.getPlayer(), owner); + } + } + else if (packetInfo.getPacket() instanceof PacketPlayOutEntityDestroy) + { + PacketPlayOutEntityDestroy packet = (PacketPlayOutEntityDestroy) packetInfo.getPacket(); + for (int id : packet.a) + { + destroyForEntity(packetInfo.getPlayer(), id); + } + } + } + + private void summonForEntity(Player receiver, Player player) + { + switch (UtilPlayer.getVersion(receiver)) + { + case Version1_9: + summonForEntity19(receiver, player); + break; + case Version1_8: + summonForEntity18(receiver, player); + break; + case ALL: + // do nothing + break; + } + } + + private void summonForEntity19(Player receiver, Player player) + { + World world = ((CraftWorld) receiver.getWorld()).getHandle(); + + DataWatcher armorStandWatcher = getArmorStandWatcher(player, null); + armorStandWatcher.a(10, (byte) 0x10, EntityArmorStand.META_ARMOR_OPTION, (byte) 0x10); // Small + + DataWatcher squidWatcher = new DataWatcher(new DummyEntity(world)); + squidWatcher.a(0, (byte) 0x20, net.minecraft.server.v1_8_R3.Entity.META_ENTITYDATA, (byte) 0x20); + + DataWatcher slimeWatcher = new DataWatcher(new DummyEntity(world)); + slimeWatcher.a(0, (byte) 0x20, net.minecraft.server.v1_8_R3.Entity.META_ENTITYDATA, (byte) 0x20); + slimeWatcher.a(16, -1, EntitySlime.META_SIZE, -1); + + PacketPlayOutSpawnEntityLiving spawnSlime = new PacketPlayOutSpawnEntityLiving(); + spawnSlime.a = UtilEnt.getNewEntityId(); + spawnSlime.b = EntityType.SLIME.getTypeId(); + spawnSlime.c = MathHelper.floor(player.getLocation().getX() * 32.0D); + spawnSlime.d = -150; + spawnSlime.e = MathHelper.floor(player.getLocation().getZ() * 32.0D); + spawnSlime.i = 0; + spawnSlime.j = 0; + spawnSlime.k = 0; + spawnSlime.f = 0; + spawnSlime.g = 0; + spawnSlime.h = 0; + spawnSlime.uuid = UUID.randomUUID(); + spawnSlime.l = slimeWatcher; + + PacketPlayOutSpawnEntityLiving spawnSquid = new PacketPlayOutSpawnEntityLiving(); + spawnSquid.a = UtilEnt.getNewEntityId(); + spawnSquid.b = EntityType.SQUID.getTypeId(); + spawnSquid.c = MathHelper.floor(player.getLocation().getX() * 32.0D); + spawnSquid.d = -150; + spawnSquid.e = MathHelper.floor(player.getLocation().getZ() * 32.0D); + spawnSquid.i = 0; + spawnSquid.j = 0; + spawnSquid.k = 0; + spawnSquid.f = 0; + spawnSquid.g = 0; + spawnSquid.h = 0; + spawnSquid.uuid = UUID.randomUUID(); + spawnSquid.l = squidWatcher; + + PacketPlayOutSpawnEntityLiving spawnArmorStand = new PacketPlayOutSpawnEntityLiving(); + spawnArmorStand.a = UtilEnt.getNewEntityId(); + spawnArmorStand.b = EntityType.ARMOR_STAND.getTypeId(); + spawnArmorStand.c = MathHelper.floor(player.getLocation().getX() * 32.0D); + spawnArmorStand.d = -150; + spawnArmorStand.e = MathHelper.floor(player.getLocation().getZ() * 32.0D); + spawnArmorStand.i = 0; + spawnArmorStand.j = 0; + spawnArmorStand.k = 0; + spawnArmorStand.f = 0; + spawnArmorStand.g = 0; + spawnArmorStand.h = 0; + spawnArmorStand.uuid = UUID.randomUUID(); + spawnArmorStand.l = armorStandWatcher; + + PacketPlayOutNewAttachEntity attachSlimeToPlayer = new PacketPlayOutNewAttachEntity(player.getEntityId(), new int[]{spawnSlime.a}); + PacketPlayOutNewAttachEntity attachSquidtoSlime = new PacketPlayOutNewAttachEntity(spawnSlime.a, new int[]{spawnSquid.a}); + PacketPlayOutNewAttachEntity attachArmorStandToSquid = new PacketPlayOutNewAttachEntity(spawnSquid.a, new int[]{spawnArmorStand.a}); + + _armorStandIds.computeIfAbsent(player.getEntityId(), key -> new HashMap<>()).put(receiver.getUniqueId(), spawnArmorStand.a); + _allIds.computeIfAbsent(player.getEntityId(), key -> new HashMap<>()).put(receiver.getUniqueId(), Arrays.asList(spawnSlime.a, spawnSquid.a, spawnArmorStand.a)); + + runSync(() -> + { + ((CraftPlayer) receiver).getHandle().playerConnection.networkManager.handle(spawnSlime); + ((CraftPlayer) receiver).getHandle().playerConnection.networkManager.handle(spawnSquid); + ((CraftPlayer) receiver).getHandle().playerConnection.networkManager.handle(spawnArmorStand); + ((CraftPlayer) receiver).getHandle().playerConnection.networkManager.handle(attachSlimeToPlayer); + ((CraftPlayer) receiver).getHandle().playerConnection.networkManager.handle(attachSquidtoSlime); + ((CraftPlayer) receiver).getHandle().playerConnection.networkManager.handle(attachArmorStandToSquid); + + updateTitle(player, getActiveTrack(player)); + }); + } + + // Unused, but I've put my heart and soul into it and so it's staying here + private void summonForEntity18(Player receiver, Player player) + { + World world = ((CraftWorld) receiver.getWorld()).getHandle(); + + DataWatcher armorStandWatcher = getArmorStandWatcher(player, null); + armorStandWatcher.a(10, (byte) 0x10, EntityArmorStand.META_ARMOR_OPTION, (byte) 0x10); // Small + + DataWatcher squidWatcher = new DataWatcher(new DummyEntity(world)); + squidWatcher.a(0, (byte) 0x20, net.minecraft.server.v1_8_R3.Entity.META_ENTITYDATA, (byte) 0x20); + + DataWatcher slimeWatcher = new DataWatcher(new DummyEntity(world)); + slimeWatcher.a(0, (byte) 0x20, net.minecraft.server.v1_8_R3.Entity.META_ENTITYDATA, (byte) 0x20); + slimeWatcher.a(16, (byte) -1, EntitySlime.META_SIZE, -1); + + PacketPlayOutSpawnEntityLiving spawnSlime = new PacketPlayOutSpawnEntityLiving(); + spawnSlime.a = UtilEnt.getNewEntityId(); + spawnSlime.b = EntityType.SLIME.getTypeId(); + spawnSlime.c = MathHelper.floor(player.getLocation().getX() * 32.0D); + spawnSlime.d = -150; + spawnSlime.e = MathHelper.floor(player.getLocation().getZ() * 32.0D); + spawnSlime.i = 0; + spawnSlime.j = 0; + spawnSlime.k = 0; + spawnSlime.f = 0; + spawnSlime.g = 0; + spawnSlime.h = 0; + spawnSlime.uuid = UUID.randomUUID(); + spawnSlime.l = slimeWatcher; + + PacketPlayOutSpawnEntityLiving spawnSquid = new PacketPlayOutSpawnEntityLiving(); + spawnSquid.a = UtilEnt.getNewEntityId(); + spawnSquid.b = EntityType.WOLF.getTypeId(); + spawnSquid.c = MathHelper.floor(player.getLocation().getX() * 32.0D); + spawnSquid.d = -150; + spawnSquid.e = MathHelper.floor(player.getLocation().getZ() * 32.0D); + spawnSquid.i = 0; + spawnSquid.j = 0; + spawnSquid.k = 0; + spawnSquid.f = 0; + spawnSquid.g = 0; + spawnSquid.h = 0; + spawnSquid.uuid = UUID.randomUUID(); + spawnSquid.l = squidWatcher; + + PacketPlayOutSpawnEntityLiving spawnArmorStand = new PacketPlayOutSpawnEntityLiving(); + spawnArmorStand.a = UtilEnt.getNewEntityId(); + spawnArmorStand.b = EntityType.ARMOR_STAND.getTypeId(); + spawnArmorStand.c = MathHelper.floor(player.getLocation().getX() * 32.0D); + spawnArmorStand.d = -150; + spawnArmorStand.e = MathHelper.floor(player.getLocation().getZ() * 32.0D); + spawnArmorStand.i = 0; + spawnArmorStand.j = 0; + spawnArmorStand.k = 0; + spawnArmorStand.f = 0; + spawnArmorStand.g = 0; + spawnArmorStand.h = 0; + spawnArmorStand.uuid = UUID.randomUUID(); + spawnArmorStand.l = armorStandWatcher; + + PacketPlayOutAttachEntity attachSlimeToPlayer = new PacketPlayOutAttachEntity(); + attachSlimeToPlayer.a = 0; + attachSlimeToPlayer.b = spawnSlime.a; + attachSlimeToPlayer.c = player.getEntityId(); + + PacketPlayOutAttachEntity attachSquidtoSlime = new PacketPlayOutAttachEntity(); + attachSquidtoSlime.a = 0; + attachSquidtoSlime.b = spawnSquid.a; + attachSquidtoSlime.c = spawnSlime.a; + + PacketPlayOutAttachEntity attachArmorStandToSquid = new PacketPlayOutAttachEntity(); + attachArmorStandToSquid.a = 0; + attachArmorStandToSquid.b = spawnArmorStand.a; + attachArmorStandToSquid.c = spawnSquid.a; + + _armorStandIds.computeIfAbsent(player.getEntityId(), key -> new HashMap<>()).put(receiver.getUniqueId(), spawnArmorStand.a); + _allIds.computeIfAbsent(player.getEntityId(), key -> new HashMap<>()).put(receiver.getUniqueId(), Arrays.asList(spawnSlime.a, spawnSquid.a, spawnArmorStand.a)); + + runSync(() -> + { + ((CraftPlayer) receiver).getHandle().playerConnection.networkManager.handle(spawnSlime); + ((CraftPlayer) receiver).getHandle().playerConnection.networkManager.handle(spawnSquid); + ((CraftPlayer) receiver).getHandle().playerConnection.networkManager.handle(spawnArmorStand); + ((CraftPlayer) receiver).getHandle().playerConnection.networkManager.handle(attachSlimeToPlayer); + ((CraftPlayer) receiver).getHandle().playerConnection.networkManager.handle(attachSquidtoSlime); + ((CraftPlayer) receiver).getHandle().playerConnection.networkManager.handle(attachArmorStandToSquid); + + updateTitle(player, getActiveTrack(player)); + }); + } + + private void updateArmorStand(Player owner, Player receiver, String newName, int entityId) + { + if (_disabled) + return; + + switch (UtilPlayer.getVersion(receiver)) + { + case Version1_9: + updateArmorStand19(owner, receiver, newName, entityId); + break; + case Version1_8: + updateArmorStand18(owner, receiver, newName, entityId); + break; + case ALL: + // do nothing + break; + } + } + + private void updateArmorStand19(Player owner, Player player, String newName, int entityId) + { + DataWatcher armorStandWatcher = getArmorStandWatcher(owner, newName); + armorStandWatcher.a(10, (byte) 0x10, EntityArmorStand.META_ARMOR_OPTION, (byte) 0x10); // Small + + PacketPlayOutEntityMetadata entityMetadata = new PacketPlayOutEntityMetadata(); + entityMetadata.a = entityId; + entityMetadata.b = armorStandWatcher.c(); + + ((CraftPlayer) player).getHandle().playerConnection.networkManager.handle(entityMetadata); + } + + private void updateArmorStand18(Player owner, Player player, String newName, int entityId) + { + DataWatcher armorStandWatcher = getArmorStandWatcher(owner, newName); + + PacketPlayOutEntityMetadata entityMetadata = new PacketPlayOutEntityMetadata(); + entityMetadata.a = entityId; + entityMetadata.b = armorStandWatcher.c(); + + ((CraftPlayer) player).getHandle().playerConnection.networkManager.handle(entityMetadata); + } + + private void destroyForEntity(Player receiver, int id) + { + Map innerMap = _armorStandIds.get(id); + if (innerMap != null) + { + innerMap.remove(receiver.getUniqueId()); + + if (innerMap.isEmpty()) + { + _armorStandIds.remove(id); + } + } + + Map> allIdsMap = _allIds.get(id); + + if (allIdsMap != null) + { + List ids = allIdsMap.remove(receiver.getUniqueId()); + if (ids != null) + { + int[] idsArr = ids.stream().mapToInt(Integer::intValue).toArray(); + + PacketPlayOutEntityDestroy destroy = new PacketPlayOutEntityDestroy(idsArr); + ((CraftPlayer) receiver).getHandle().playerConnection.networkManager.handle(destroy); + } + + if (allIdsMap.isEmpty()) + { + _allIds.remove(id); + } + } + } + + private DataWatcher getArmorStandWatcher(Player ownerOfTrack, String newName) + { + World world = ((CraftWorld) ownerOfTrack.getWorld()).getHandle(); + + DataWatcher armorStandWatcher = new DataWatcher(new DummyEntity(world)); + armorStandWatcher.a(0, (byte) 0x20, net.minecraft.server.v1_8_R3.Entity.META_ENTITYDATA, (byte) 0x20); + armorStandWatcher.a(1, (short) 300, net.minecraft.server.v1_8_R3.Entity.META_AIR, 0); + + if (newName != null && !newName.isEmpty()) + { + armorStandWatcher.a(2, newName, net.minecraft.server.v1_8_R3.Entity.META_CUSTOMNAME, newName); + armorStandWatcher.a(3, (byte) 1, net.minecraft.server.v1_8_R3.Entity.META_CUSTOMNAME_VISIBLE, true); + } + else + { + armorStandWatcher.a(2, "", net.minecraft.server.v1_8_R3.Entity.META_CUSTOMNAME, ""); + armorStandWatcher.a(3, (byte) 0, net.minecraft.server.v1_8_R3.Entity.META_CUSTOMNAME_VISIBLE, false); + } + + return armorStandWatcher; + } + + public void forceEnable() + { + if (_disabled) + { + _disabled = false; + + for (Player player : UtilServer.getPlayers()) + { + for (Player player1 : UtilServer.getPlayers()) + { + if (player != player1) + { + summonForEntity(player, player1); + } + } + } + } + } + + public void forceDisable() + { + if (!_disabled) + { + _disabled = true; + + for (Player player : UtilServer.getPlayers()) + { + for (Player player1 : UtilServer.getPlayers()) + { + if (player != player1) + { + destroyForEntity(player, player1.getEntityId()); + } + } + } + } + } +} diff --git a/Plugins/Mineplex.Core/src/mineplex/core/titles/TitlesRepository.java b/Plugins/Mineplex.Core/src/mineplex/core/titles/TitlesRepository.java new file mode 100644 index 000000000..787022050 --- /dev/null +++ b/Plugins/Mineplex.Core/src/mineplex/core/titles/TitlesRepository.java @@ -0,0 +1,65 @@ +package mineplex.core.titles; + +import java.sql.Connection; +import java.sql.PreparedStatement; +import java.sql.SQLException; + +import org.bukkit.entity.Player; + +import mineplex.core.Managers; +import mineplex.core.account.CoreClientManager; +import mineplex.core.titles.tracks.Track; +import mineplex.serverdata.database.DBPool; +import mineplex.serverdata.database.RepositoryBase; + +public class TitlesRepository extends RepositoryBase +{ + /* + CREATE TABLE `accountTitle` ( + `accountId` int(11) NOT NULL, + `trackName` VARCHAR(16) NOT NULL, + PRIMARY KEY (`accountId`), + CONSTRAINT `accountTitle_account` FOREIGN KEY (`accountId`) REFERENCES `accounts` (`id`) ON DELETE NO ACTION ON UPDATE NO ACTION + ); + */ + private static final String UPSERT_TITLE = "INSERT INTO accountTitle (accountId, trackName) VALUES (?, ?) ON DUPLICATE KEY UPDATE trackName = ?;"; + private static final String DELETE_TITLE = "DELETE FROM accountTitle WHERE accountId = ?;"; + + private final CoreClientManager _coreClientManager = Managers.require(CoreClientManager.class); + + public TitlesRepository() + { + super(DBPool.getAccount()); + } + + void savePlayerSelection(Player player, Track track) + { + int accountId = this._coreClientManager.getAccountId(player); + if (accountId == -1) + { + System.err.print("Got account id -1 for player " + player.getName() + ". Aborting track saving"); + return; + } + try (Connection connection = getConnection()) + { + if (track != null) + { + PreparedStatement statement = connection.prepareStatement(UPSERT_TITLE); + statement.setInt(1, accountId); + statement.setString(2, track.getId()); + statement.setString(3, track.getId()); + statement.executeUpdate(); + } + else + { + PreparedStatement statement = connection.prepareStatement(DELETE_TITLE); + statement.setInt(1, accountId); + statement.executeUpdate(); + } + } + catch (SQLException e) + { + e.printStackTrace(); + } + } +} diff --git a/Plugins/Mineplex.Core/src/mineplex/core/titles/commands/TrackCommand.java b/Plugins/Mineplex.Core/src/mineplex/core/titles/commands/TrackCommand.java new file mode 100644 index 000000000..0617028ff --- /dev/null +++ b/Plugins/Mineplex.Core/src/mineplex/core/titles/commands/TrackCommand.java @@ -0,0 +1,55 @@ +package mineplex.core.titles.commands; + +import org.bukkit.entity.Player; + +import mineplex.core.Managers; +import mineplex.core.account.CoreClientManager; +import mineplex.core.command.CommandBase; +import mineplex.core.common.MinecraftVersion; +import mineplex.core.common.Rank; +import mineplex.core.common.util.F; +import mineplex.core.common.util.UtilPlayer; +import mineplex.core.titles.Titles; +import mineplex.core.titles.tracks.Track; +import mineplex.core.titles.tracks.TrackManager; + +public class TrackCommand extends CommandBase +{ + private final TrackManager _trackManager; + + public TrackCommand(Titles plugin) + { + super(plugin, Rank.ALL, "track"); + + _trackManager = Managers.require(TrackManager.class); + } + + @Override + public void Execute(Player caller, String[] args) + { + if (args.length == 0) + { + if (Plugin.getActiveTrack(caller) == null) + { + UtilPlayer.message(caller, F.main("Track", "You must specify the ID of a track to enable")); + } + else + { + Plugin.setOrToggleTrackForPlayer(caller, Plugin.getActiveTrack(caller), false); + } + return; + } + Track track = _trackManager.getTrackById(args[0]); + if (track == null) + { + UtilPlayer.message(caller, F.main("Track", "That is not a valid track")); + return; + } + if (track.getRequirements().getTier(caller) == null) + { + UtilPlayer.message(caller, F.main("Track", "You have not unlocked any tiers on that track")); + return; + } + Plugin.setOrToggleTrackForPlayer(caller, track, args.length > 1); + } +} diff --git a/Plugins/Mineplex.Core/src/mineplex/core/titles/tracks/DongerTrack.java b/Plugins/Mineplex.Core/src/mineplex/core/titles/tracks/DongerTrack.java new file mode 100644 index 000000000..9d03b4eb1 --- /dev/null +++ b/Plugins/Mineplex.Core/src/mineplex/core/titles/tracks/DongerTrack.java @@ -0,0 +1,28 @@ +package mineplex.core.titles.tracks; + +import java.util.Set; + +import net.md_5.bungee.api.ChatColor; + +import com.google.common.collect.Sets; + +public class DongerTrack extends Track +{ + private static final Set OWNERS = Sets.newHashSet( + "b86b54da-93dd-46f9-be33-27bd92aa36d7", + "a20d59d1-cfd8-4116-ac27-45d9c7eb4a97" + ); + + protected DongerTrack() + { + super("donger", ChatColor.AQUA, "Donger", "Donger", "ヽ༼ຈل͜ຈ༽ノ", true); + special(); + getRequirements() + .addTier(new TrackTier( + "ヽ༼ຈل͜ຈ༽ノ", + null, + player -> OWNERS.contains(player.getUniqueId().toString().toLowerCase()), + new TrackFormat(ChatColor.AQUA, ChatColor.BLUE) + )); + } +} diff --git a/Plugins/Mineplex.Core/src/mineplex/core/titles/tracks/EarlyBirdTrack.java b/Plugins/Mineplex.Core/src/mineplex/core/titles/tracks/EarlyBirdTrack.java new file mode 100644 index 000000000..9e7551900 --- /dev/null +++ b/Plugins/Mineplex.Core/src/mineplex/core/titles/tracks/EarlyBirdTrack.java @@ -0,0 +1,65 @@ +package mineplex.core.titles.tracks; + +import java.sql.ResultSet; +import java.sql.SQLException; +import java.util.Set; +import java.util.UUID; + +import net.md_5.bungee.api.ChatColor; + +import org.bukkit.event.EventHandler; +import org.bukkit.event.player.PlayerQuitEvent; + +import com.google.common.collect.Sets; + +import mineplex.core.Managers; +import mineplex.core.account.CoreClientManager; +import mineplex.core.account.ILoginProcessor; + +public class EarlyBirdTrack extends Track +{ + private final Set _wonEternal = Sets.newConcurrentHashSet(); + + protected EarlyBirdTrack() + { + super("early-bird", ChatColor.AQUA, "Early Bird", "Early Bird", "This track is unlocked by receiving the Eternal rank from chickens in the 2016 Thanksgiving Event", true); + special(); + getRequirements() + .addTier(new TrackTier( + "Early Bird", + null, + player -> _wonEternal.contains(player.getUniqueId()), + new TrackFormat(ChatColor.AQUA, ChatColor.AQUA) + )); + + Managers.require(CoreClientManager.class).addStoredProcedureLoginProcessor(new ILoginProcessor() + { + @Override + public String getName() + { + return "eternal-fetcher"; + } + + @Override + public void processLoginResultSet(String playerName, UUID uuid, int accountId, ResultSet resultSet) throws SQLException + { + if (resultSet.next()) + { + _wonEternal.add(uuid); + } + } + + @Override + public String getQuery(int accountId, String uuid, String name) + { + return "SELECT * FROM eternalGiveaway WHERE accountId = '" + accountId + "';"; + } + }); + } + + @EventHandler + public void onQuit(PlayerQuitEvent event) + { + _wonEternal.remove(event.getPlayer().getUniqueId()); + } +} diff --git a/Plugins/Mineplex.Core/src/mineplex/core/titles/tracks/GemCollectorTrack.java b/Plugins/Mineplex.Core/src/mineplex/core/titles/tracks/GemCollectorTrack.java new file mode 100644 index 000000000..f3dfde3e5 --- /dev/null +++ b/Plugins/Mineplex.Core/src/mineplex/core/titles/tracks/GemCollectorTrack.java @@ -0,0 +1,68 @@ +package mineplex.core.titles.tracks; + +import net.md_5.bungee.api.ChatColor; + +import org.bukkit.entity.Player; + +import mineplex.core.gadget.set.SetEmerald; + +public class GemCollectorTrack extends Track +{ + public GemCollectorTrack() + { + super("gem-collector", "Gem Collector", "This track is unlocked by earning gems in games"); + getRequirements() + .addTier(new TrackTier( + "Gem Beggar", + "Gain 1,000 Gem Points", + this::getStat, + 1000, + new TrackFormat(ChatColor.GRAY) + )) + .addTier(new TrackTier( + "Respectable Gem Miner", + "Gain 25,000 Gem Points", + this::getStat, + 25000, + new TrackFormat(ChatColor.LIGHT_PURPLE) + )) + .addTier(new TrackTier( + "Middle Class", + "Gain 50,000 Gem Points", + this::getStat, + 50000, + new TrackFormat(ChatColor.BLUE, null) + )) + .addTier(new TrackTier( + "Gems, Gems, Gems", + "Gain 75,000 Gem Points", + this::getStat, + 75000, + new TrackFormat(ChatColor.GREEN, null) + )) + .addTier(new TrackTier( + "Gem McScrooge", + "Gain 100,000 Gem Points", + this::getStat, + 100000, + new TrackFormat(ChatColor.RED, ChatColor.RED) + )); + + getRequirements() + .withRequirement(1, "Gem Earned in games") + .withSetBonus(SetEmerald.class, 2); + } + + /** + * Call this method when the specified Player has earned gems + */ + public void earnedGems(Player player, int gems) + { + if (gems <= 0) return; + + if (isSetActive(player, SetEmerald.class)) + gems *= 2; + + incrementFor(player, gems); + } +} diff --git a/Plugins/Mineplex.Core/src/mineplex/core/titles/tracks/HappyGaryTrack.java b/Plugins/Mineplex.Core/src/mineplex/core/titles/tracks/HappyGaryTrack.java new file mode 100644 index 000000000..fe75d1bf4 --- /dev/null +++ b/Plugins/Mineplex.Core/src/mineplex/core/titles/tracks/HappyGaryTrack.java @@ -0,0 +1,36 @@ +package mineplex.core.titles.tracks; + +import java.util.Set; + +import net.md_5.bungee.api.ChatColor; + +import com.google.common.collect.Sets; + +import mineplex.core.Managers; +import mineplex.core.account.CoreClientManager; +import mineplex.core.common.Rank; + +public class HappyGaryTrack extends Track +{ + private final CoreClientManager _coreClientManager = Managers.require(CoreClientManager.class); + + protected HappyGaryTrack() + { + super("happygary", ChatColor.GOLD, "Happy Gary", "Happy Gary", "ᐛ", true); + special(); + getRequirements() + .addTier(new TrackTier( + "☆゚°˖* ᕕ(ᐛ)ᕗ", + null, + player -> _coreClientManager.hasRank(player, Rank.ADMIN), + new TrackFormat(ChatColor.GOLD, ChatColor.GOLD) + .animated(1, + "☆゚°˖* ᕕ(ᐛ)ᕗ", + "*☆゚°˖ ᕕ(ᐛ)ᕗ", + "˖*☆゚° ᕕ(ᐛ)ᕗ", + "°˖*☆゚ ᕕ(ᐛ)ᕗ", + "゚°˖*☆ ᕕ(ᐛ)ᕗ" + ) + )); + } +} diff --git a/Plugins/Mineplex.Core/src/mineplex/core/titles/tracks/HolidayCheerTrack.java b/Plugins/Mineplex.Core/src/mineplex/core/titles/tracks/HolidayCheerTrack.java new file mode 100644 index 000000000..547a84087 --- /dev/null +++ b/Plugins/Mineplex.Core/src/mineplex/core/titles/tracks/HolidayCheerTrack.java @@ -0,0 +1,211 @@ +package mineplex.core.titles.tracks; + +import java.util.HashMap; +import java.util.HashSet; +import java.util.Map; +import java.util.Set; + +import net.md_5.bungee.api.ChatColor; + +import org.bukkit.entity.Player; +import org.bukkit.event.EventHandler; + +import mineplex.core.Managers; +import mineplex.core.gadget.GadgetManager; +import mineplex.core.gadget.event.ItemGadgetUseEvent; +import mineplex.core.gadget.event.PlayerUseCoalEvent; +import mineplex.core.gadget.gadgets.item.ItemBow; +import mineplex.core.gadget.gadgets.item.ItemFlowerGift; +import mineplex.core.gadget.gadgets.item.ItemFreezeCannon; +import mineplex.core.gadget.gadgets.item.ItemLovePotion; +import mineplex.core.gadget.gadgets.item.ItemSnowball; +import mineplex.core.gadget.set.SetCupidsLove; +import mineplex.core.gadget.set.SetFreedom; +import mineplex.core.gadget.set.SetFrostLord; +import mineplex.core.gadget.types.Gadget; +import mineplex.core.gadget.types.GadgetSet; +import mineplex.core.treasure.TreasureType; +import mineplex.core.treasure.event.TreasureStartEvent; + +public class HolidayCheerTrack extends Track +{ + private static final Set HOLIDAY_CHESTS = new HashSet<>(); + private static final Set> HOLIDAY_SETS = new HashSet<>(); + private static final Map, Integer> POINTS = new HashMap<>(); + + static + { + POINTS.put(ItemFlowerGift.class, 1); + POINTS.put(ItemBow.class, 1); + POINTS.put(ItemSnowball.class, 1); + POINTS.put(ItemFreezeCannon.class, 1); + POINTS.put(ItemLovePotion.class, 10); + + HOLIDAY_CHESTS.add(TreasureType.CHRISTMAS); + HOLIDAY_CHESTS.add(TreasureType.FREEDOM); + HOLIDAY_CHESTS.add(TreasureType.HAUNTED); + HOLIDAY_CHESTS.add(TreasureType.THANKFUL); + HOLIDAY_CHESTS.add(TreasureType.TRICK_OR_TREAT); + HOLIDAY_CHESTS.add(TreasureType.GINGERBREAD); + HOLIDAY_CHESTS.add(TreasureType.LOVE_CHEST); + + HOLIDAY_SETS.add(SetFreedom.class); + HOLIDAY_SETS.add(SetCupidsLove.class); + HOLIDAY_SETS.add(SetFrostLord.class); + } + + private final GadgetManager _gadgetManager = Managers.require(GadgetManager.class); + + public HolidayCheerTrack() + { + super("holiday-cheer", "Holiday Cheer", "This track is unlocked by participating in Holiday Events"); + getRequirements() + .addTier(new TrackTier( + "School's Out", + "Gain 1,000 Holiday Points", + this::getStat, + 1000, + new TrackFormat(ChatColor.GRAY) + )) + .addTier(new TrackTier( + "Every Day's a Holiday", + "Gain 2,000 Holiday Points", + this::getStat, + 2000, + new TrackFormat(ChatColor.LIGHT_PURPLE) + )) + .addTier(new TrackTier( + "I Party With Pumplings", + "Gain 3,000 Holiday Points", + this::getStat, + 3000, + new TrackFormat(ChatColor.BLUE, null) + )) + .addTier(new TrackTier( + "Celebration Addict", + "Gain 5,000 Holiday Points", + this::getStat, + 5000, + new TrackFormat(ChatColor.GREEN, null) + )) + .addTier(new TrackTier( + "Has Santa's Number", + "Gain 10,000 Holiday Points", + this::getStat, + 10000, + new TrackFormat(ChatColor.RED, ChatColor.RED) + )); + + getRequirements() + .withRequirement(100, "Special Holiday Event Chests") + .withRequirement(5, "game played in Holiday Games") + .withRequirement(25, "win in Holiday Games"); + + getRequirements() + .withRequirement(POINTS.get(ItemLovePotion.class), _gadgetManager.getGadget(ItemLovePotion.class).getName()) + .withRequirement(1, "Holiday Gadget"); + + HOLIDAY_SETS.forEach(clazz -> getRequirements().withSetBonus(clazz, 2)); + } + + @EventHandler + public void onUseCosmetic(TreasureStartEvent event) + { + if (!HOLIDAY_CHESTS.contains(event.getTreasureType())) + return; + + int points = 100; + + for (Class set : HOLIDAY_SETS) + { + if (isSetActive(event.getPlayer(), set)) + { + points *= 2; + break; + } + } + + incrementFor(event.getPlayer(), points); + } + + @EventHandler + public void onUseCosmetic(ItemGadgetUseEvent event) + { + if (!POINTS.containsKey(event.getGadget().getClass())) + return; + + int basePoints = POINTS.get(event.getGadget().getClass()); + + for (Class set : HOLIDAY_SETS) + { + if (isSetActive(event.getPlayer(), set)) + { + basePoints *= 2; + break; + } + } + + if (basePoints != 0) + { + incrementFor(event.getPlayer(), basePoints); + } + } + + @EventHandler + public void onUseCosmetic(PlayerUseCoalEvent event) + { + int basePoints = event.getCost(); + + for (Class set : HOLIDAY_SETS) + { + if (isSetActive(event.getPlayer(), set)) + { + basePoints *= 2; + break; + } + } + + if (basePoints != 0) + { + incrementFor(event.getPlayer(), basePoints); + } + } + + /** + * Call this method when the specified Player has won a holiday-themed game + */ + public void wonGame(Player player) + { + int basePoints = 25; + + for (Class set : HOLIDAY_SETS) + { + if (isSetActive(player, set)) + { + basePoints *= 2; + break; + } + } + + incrementFor(player, basePoints); + } + + /** + * Call this method when the specified Player has won a round in a holiday-themed game + */ + public void wonRound(Player player) + { + int basePoints = 5; + + for (Class set : HOLIDAY_SETS) + { + if (isSetActive(player, set)) + { + basePoints *= 2; + break; + } + } + + incrementFor(player, basePoints); + } +} diff --git a/Plugins/Mineplex.Core/src/mineplex/core/titles/tracks/KitCollectorTrack.java b/Plugins/Mineplex.Core/src/mineplex/core/titles/tracks/KitCollectorTrack.java new file mode 100644 index 000000000..df1366f33 --- /dev/null +++ b/Plugins/Mineplex.Core/src/mineplex/core/titles/tracks/KitCollectorTrack.java @@ -0,0 +1,81 @@ +package mineplex.core.titles.tracks; + +import net.md_5.bungee.api.ChatColor; + +import org.bukkit.entity.Player; + +import mineplex.core.Managers; +import mineplex.core.achievement.AchievementCategory; +import mineplex.core.donation.DonationManager; +import mineplex.core.game.GameDisplay; + +public class KitCollectorTrack extends Track +{ + private static final int ACHIEVEMENT_KIT_BONUS = 5; + +// private static final Map + + private final DonationManager _donationManager = Managers.require(DonationManager.class); + + public KitCollectorTrack() + { + super("kit-collector", "Kit Collector", "The Kit Collector tree is unlocked by having kits unlocked"); + getRequirements() + .addTier(new TrackTier( + "Kit Collector", + "Gain 25 Kit Collector Points", + this::getStat, + 20, + new TrackFormat(ChatColor.GRAY) + )) + .addTier(new TrackTier( + "Kit Hoarder", + "Gain 50 Kit Collector Points", + this::getStat, + 50, + new TrackFormat(ChatColor.BLUE, null) + )) + .addTier(new TrackTier( + "I Have Too Many Kits", + "Gain 100 Kit Collector Points", + this::getStat, + 100, + new TrackFormat(ChatColor.RED, ChatColor.RED) + )); + } + + private int getUnlockedKits(Player player) + { + int ownedKits = 0; + + for (String unknownPackage : _donationManager.Get(player).getOwnedUnknownSalesPackages()) + { + for (GameDisplay gameDisplay : GameDisplay.values()) + { + if (unknownPackage.startsWith(gameDisplay.getKitGameName() + " ")) + { + ownedKits++; + break; + } + } + } + + for (AchievementCategory category : AchievementCategory.values()) + { + int[] gameIDs = category.GameId; + if (gameIDs != null) + { + for (int id : gameIDs) + { + GameDisplay display = GameDisplay.getById(id); + if (display != null) + { + + } + } + } + } + + return ownedKits; + } +} diff --git a/Plugins/Mineplex.Core/src/mineplex/core/titles/tracks/LeaderTrack.java b/Plugins/Mineplex.Core/src/mineplex/core/titles/tracks/LeaderTrack.java new file mode 100644 index 000000000..80b14ce33 --- /dev/null +++ b/Plugins/Mineplex.Core/src/mineplex/core/titles/tracks/LeaderTrack.java @@ -0,0 +1,25 @@ +package mineplex.core.titles.tracks; + +import net.md_5.bungee.api.ChatColor; + +import mineplex.core.Managers; +import mineplex.core.account.CoreClientManager; +import mineplex.core.common.Rank; + +public class LeaderTrack extends Track +{ + private final CoreClientManager _coreClientManager = Managers.require(CoreClientManager.class); + + protected LeaderTrack() + { + super("leader", ChatColor.DARK_RED, "Leader", "What's a Leader?", "also wat does dev mean", true); + special(); + getRequirements() + .addTier(new TrackTier( + "What's a Leader?", + null, + player -> _coreClientManager.Get(player).GetRank().has(Rank.LT), + new TrackFormat(ChatColor.DARK_RED, ChatColor.RED) + )); + } +} diff --git a/Plugins/Mineplex.Core/src/mineplex/core/titles/tracks/LevelerTrack.java b/Plugins/Mineplex.Core/src/mineplex/core/titles/tracks/LevelerTrack.java new file mode 100644 index 000000000..f079f9d52 --- /dev/null +++ b/Plugins/Mineplex.Core/src/mineplex/core/titles/tracks/LevelerTrack.java @@ -0,0 +1,53 @@ +package mineplex.core.titles.tracks; + +import net.md_5.bungee.api.ChatColor; + +import mineplex.core.Managers; +import mineplex.core.achievement.Achievement; +import mineplex.core.achievement.AchievementManager; + +public class LevelerTrack extends Track +{ + private final AchievementManager _achievementManager = Managers.require(AchievementManager.class); + + public LevelerTrack() + { + super("leveler", "Leveler", "This track is unlocked by earning Mineplex levels"); + getRequirements() + .addTier(new TrackTier( + "Mineplex Sophomore", + "Reach level 20", + player -> (long) _achievementManager.get(player, Achievement.GLOBAL_MINEPLEX_LEVEL).getLevel(), + 20, + new TrackFormat(ChatColor.GRAY) + )) + .addTier(new TrackTier( + "Tree Climber", + "Reach level 40", + player -> (long) _achievementManager.get(player, Achievement.GLOBAL_MINEPLEX_LEVEL).getLevel(), + 40, + new TrackFormat(ChatColor.LIGHT_PURPLE) + )) + .addTier(new TrackTier( + "Chiss' Cat", + "Reach level 60", + player -> (long) _achievementManager.get(player, Achievement.GLOBAL_MINEPLEX_LEVEL).getLevel(), + 60, + new TrackFormat(ChatColor.BLUE, null) + )) + .addTier(new TrackTier( + "Honorary Guardian", + "Reach level 80", + player -> (long) _achievementManager.get(player, Achievement.GLOBAL_MINEPLEX_LEVEL).getLevel(), + 80, + new TrackFormat(ChatColor.GREEN, null) + )) + .addTier(new TrackTier( + "Friend of Douglas", + "Reach level 100", + player -> (long) _achievementManager.get(player, Achievement.GLOBAL_MINEPLEX_LEVEL).getLevel(), + 100, + new TrackFormat(ChatColor.RED, ChatColor.RED) + )); + } +} diff --git a/Plugins/Mineplex.Core/src/mineplex/core/titles/tracks/LuckyTrack.java b/Plugins/Mineplex.Core/src/mineplex/core/titles/tracks/LuckyTrack.java new file mode 100644 index 000000000..a79ffe7ec --- /dev/null +++ b/Plugins/Mineplex.Core/src/mineplex/core/titles/tracks/LuckyTrack.java @@ -0,0 +1,148 @@ +package mineplex.core.titles.tracks; + +import java.util.EnumMap; +import java.util.HashSet; +import java.util.Set; + +import net.md_5.bungee.api.ChatColor; + +import org.bukkit.Material; +import org.bukkit.entity.Player; +import org.bukkit.event.EventHandler; +import org.bukkit.inventory.Inventory; +import org.bukkit.inventory.ItemStack; + +import mineplex.core.reward.Reward; +import mineplex.core.reward.RewardRarity; +import mineplex.core.treasure.TreasureType; +import mineplex.core.treasure.event.TreasureStartEvent; + +public class LuckyTrack extends Track +{ + private static final EnumMap MULTIPLIER = new EnumMap<>(TreasureType.class); + private static final EnumMap POINTS = new EnumMap<>(RewardRarity.class); + private static final Set IRON = new HashSet<>(); + private static final Set DIAMOND = new HashSet<>(); + + static + { + POINTS.put(RewardRarity.RARE, 1); + POINTS.put(RewardRarity.LEGENDARY, 5); + POINTS.put(RewardRarity.MYTHICAL, 50); + + MULTIPLIER.put(TreasureType.FREEDOM, 2); + MULTIPLIER.put(TreasureType.HAUNTED, 2); + MULTIPLIER.put(TreasureType.CHRISTMAS, 2); + MULTIPLIER.put(TreasureType.TRICK_OR_TREAT, 2); + MULTIPLIER.put(TreasureType.OMEGA, 3); + + IRON.add(Material.IRON_SPADE); + IRON.add(Material.IRON_PICKAXE); + IRON.add(Material.IRON_AXE); + IRON.add(Material.IRON_SWORD); + IRON.add(Material.IRON_HOE); + IRON.add(Material.IRON_INGOT); + IRON.add(Material.IRON_HELMET); + IRON.add(Material.IRON_CHESTPLATE); + IRON.add(Material.IRON_LEGGINGS); + IRON.add(Material.IRON_BOOTS); + + DIAMOND.add(Material.DIAMOND_SPADE); + DIAMOND.add(Material.DIAMOND_PICKAXE); + DIAMOND.add(Material.DIAMOND_AXE); + DIAMOND.add(Material.DIAMOND_SWORD); + DIAMOND.add(Material.DIAMOND_HOE); + DIAMOND.add(Material.DIAMOND); + DIAMOND.add(Material.DIAMOND_HELMET); + DIAMOND.add(Material.DIAMOND_CHESTPLATE); + DIAMOND.add(Material.DIAMOND_LEGGINGS); + DIAMOND.add(Material.DIAMOND_BOOTS); + } + + public LuckyTrack() + { + super("lucky", "Lucky", "This track is unlocked by getting fortunate chest drops"); + getRequirements() + .addTier(new TrackTier( + "Lucky", + "Gain 1,000 Lucky Points", + this::getStat, + 1000, + new TrackFormat(ChatColor.GRAY) + )) + .addTier(new TrackTier( + "Charmed", + "Gain 2,000 Lucky Points", + this::getStat, + 2000, + new TrackFormat(ChatColor.LIGHT_PURPLE) + )) + .addTier(new TrackTier( + "Fortune Favored", + "Gain 3,000 Lucky Points", + this::getStat, + 3000, + new TrackFormat(ChatColor.BLUE, null) + )) + .addTier(new TrackTier( + "Golden", + "Gain 5,000 Lucky Points", + this::getStat, + 5000, + new TrackFormat(ChatColor.GREEN, null) + )) + .addTier(new TrackTier( + "Hashtag Blessed", + "Gain 10,000 Lucky Points", + this::getStat, + 10000, + new TrackFormat(ChatColor.RED, ChatColor.RED) + )); + + getRequirements() + .withRequirement(1, "Rare Item") + .withRequirement(5, "Legendary Item") + .withRequirement(50, "Mythical Item") + .withRequirement(1, "per game chest with", "Iron Item") + .withRequirement(3, "per game chest with", "Diamond Item") + .withBonus("Event Chests", "from", 2) + .withBonus("Omega Chests", "from", 3); + } + + @EventHandler + public void onUseCosmetic(TreasureStartEvent event) + { + for (Reward reward : event.getRewards()) + { + if (!POINTS.containsKey(reward.getRarity())) + continue; + + int basePoints = POINTS.get(reward.getRarity()); + + if (MULTIPLIER.get(event.getTreasureType()) != null) + basePoints *= MULTIPLIER.get(event.getTreasureType()); + + incrementFor(event.getPlayer(), basePoints); + } + } + + public void handleLoot(Player player, Inventory inventory) + { + boolean foundIron = false; + boolean foundDiamond = false; + boolean foundBow = false; + for (ItemStack item : inventory) + { + if (item != null) + { + if (IRON.contains(item.getType())) foundIron = true; + if (DIAMOND.contains(item.getType())) foundDiamond = true; + if (item.getType() == Material.BOW) foundBow = true; + } + } + + if (foundIron) incrementFor(player, 1); + if (foundDiamond) incrementFor(player, 3); + if (foundBow) incrementFor(player, 1); + } +} diff --git a/Plugins/Mineplex.Core/src/mineplex/core/titles/tracks/MineplexMasteryTrack.java b/Plugins/Mineplex.Core/src/mineplex/core/titles/tracks/MineplexMasteryTrack.java new file mode 100644 index 000000000..6135da8af --- /dev/null +++ b/Plugins/Mineplex.Core/src/mineplex/core/titles/tracks/MineplexMasteryTrack.java @@ -0,0 +1,56 @@ +package mineplex.core.titles.tracks; + +import net.md_5.bungee.api.ChatColor; + +import org.bukkit.entity.Player; + +import mineplex.core.Managers; +import mineplex.core.game.GameDisplay; +import mineplex.core.stats.StatsManager; + +public class MineplexMasteryTrack extends Track +{ + private final StatsManager _statsManager; + + protected MineplexMasteryTrack() + { + super("mineplex-mastery", "Mineplex Mastery", "This track is unlocked by winning different games on Mineplex"); + getRequirements() + .addTier(new TrackTier( + "Mineplex Initiate", + "Win at least one game in 10 different Mineplex Games", + this::getGames, + 10, + new TrackFormat(ChatColor.GRAY) + )) + .addTier(new TrackTier( + "Mineplex Veteran", + "Win at least one game in 20 different Mineplex Games", + this::getGames, + 20, + new TrackFormat(ChatColor.BLUE, null) + )) + .addTier(new TrackTier( + "Mineplex Master", + "Win at least one game in 30 different Mineplex Games", + this::getGames, + 30, + new TrackFormat(ChatColor.RED, ChatColor.RED) + )); + _statsManager = Managers.require(StatsManager.class); + } + + private long getGames(Player player) + { + int count = 0; + for (GameDisplay display : GameDisplay.values()) + { + if (_statsManager.Get(player).getStat(display.getName() + ".TrackWins") > 0) + { + count++; + } + } + + return count; + } +} diff --git a/Plugins/Mineplex.Core/src/mineplex/core/titles/tracks/PartyAnimalTrack.java b/Plugins/Mineplex.Core/src/mineplex/core/titles/tracks/PartyAnimalTrack.java new file mode 100644 index 000000000..96426f84d --- /dev/null +++ b/Plugins/Mineplex.Core/src/mineplex/core/titles/tracks/PartyAnimalTrack.java @@ -0,0 +1,79 @@ +package mineplex.core.titles.tracks; + +import java.util.HashMap; +import java.util.Map; + +import net.md_5.bungee.api.ChatColor; + +import org.bukkit.event.EventHandler; + +import mineplex.core.gadget.event.ItemGadgetUseEvent; +import mineplex.core.gadget.gadgets.item.ItemCoinBomb; +import mineplex.core.gadget.gadgets.item.ItemFirework; +import mineplex.core.gadget.gadgets.item.ItemPartyPopper; +import mineplex.core.gadget.set.SetParty; +import mineplex.core.gadget.types.Gadget; + +public class PartyAnimalTrack extends Track +{ + private static final Map, Integer> POINTS = new HashMap<>(); + + static + { + POINTS.put(ItemFirework.class, 1); + POINTS.put(ItemPartyPopper.class, 20); + POINTS.put(ItemCoinBomb.class, 50); + } + + public PartyAnimalTrack() + { + super("party-animal", "Party Animal", "This track is unlocked by partying with your friends and celebrating!"); + getRequirements() + .addTier(new TrackTier( + "Party Animal", + "Gain 10,000 Party Points", + this::getStat, + 10000, + new TrackFormat(ChatColor.GRAY) + )) + .addTier(new TrackTier( + "Can't Stop Won't Stop", + "Gain 25,000 Party Points", + this::getStat, + 25000, + new TrackFormat(ChatColor.BLUE, null) + )) + .addTier(new TrackTier( + "Life is a Party", + "Gain 50,000 Party Points", + this::getStat, + 50000, + new TrackFormat(ChatColor.RED, ChatColor.RED) + )); + + getRequirements() + .withRequirement(1, "for using", "Fireworks") + .withRequirement(20, "for using" ,"Party Poppers") + .withRequirement(50, "for using", "Treasure Party Bombs") + .withSetBonus(SetParty.class, 2); + } + + @EventHandler + public void onUseCosmetic(ItemGadgetUseEvent event) + { + if (!POINTS.containsKey(event.getGadget().getClass())) + return; + + int basePoints = POINTS.get(event.getGadget().getClass()); + + if (isSetActive(event.getPlayer(), SetParty.class)) + { + basePoints = basePoints * 2; + } + + if (basePoints != 0) + { + incrementFor(event.getPlayer(), basePoints); + } + } +} diff --git a/Plugins/Mineplex.Core/src/mineplex/core/titles/tracks/PeacefulTrack.java b/Plugins/Mineplex.Core/src/mineplex/core/titles/tracks/PeacefulTrack.java new file mode 100644 index 000000000..123856b8d --- /dev/null +++ b/Plugins/Mineplex.Core/src/mineplex/core/titles/tracks/PeacefulTrack.java @@ -0,0 +1,77 @@ +package mineplex.core.titles.tracks; + +import java.util.HashSet; +import java.util.Set; + +import net.md_5.bungee.api.ChatColor; + +import org.bukkit.entity.Player; + +import mineplex.core.gadget.set.SetMusic; +import mineplex.core.game.GameDisplay; + +public class PeacefulTrack extends Track +{ + private static final Set PEACEFUL_GAMES = new HashSet<>(); + + static + { + PEACEFUL_GAMES.add(GameDisplay.SpeedBuilders); + PEACEFUL_GAMES.add(GameDisplay.Build); + PEACEFUL_GAMES.add(GameDisplay.Draw); + PEACEFUL_GAMES.add(GameDisplay.DragonEscape); + PEACEFUL_GAMES.add(GameDisplay.DragonEscapeTeams); + PEACEFUL_GAMES.add(GameDisplay.Dragons); + PEACEFUL_GAMES.add(GameDisplay.DragonsTeams); + PEACEFUL_GAMES.add(GameDisplay.MonsterMaze); + } + + public PeacefulTrack() + { + super("peaceful", "Peaceful", "This track is unlocked by winning games that do not require PvP to win"); + getRequirements() + .addTier(new TrackTier( + "Peaceful", + "Gain 100 Peaceful Points", + this::getStat, + 100, + new TrackFormat(ChatColor.GRAY) + )) + .addTier(new TrackTier( + "Tranquil", + "Gain 500 Peaceful Points", + this::getStat, + 500, + new TrackFormat(ChatColor.BLUE, null) + )) + .addTier(new TrackTier( + "Pacifist", + "Gain 1,000 Peaceful Points", + this::getStat, + 1000, + new TrackFormat(ChatColor.RED, ChatColor.RED) + )); + + getRequirements() + .withRequirement(1, "per win in a", "Peaceful Game") + .withSetBonus(SetMusic.class, 2); + } + + /** + * Call this method when the specified Player has won a game + */ + public void wonGame(Player player, GameDisplay gameDisplay) + { + if (!PEACEFUL_GAMES.contains(gameDisplay)) + return; + + int points = 1; + + if (isSetActive(player, SetMusic.class)) + { + points *= 2; + } + + incrementFor(player, points); + } +} diff --git a/Plugins/Mineplex.Core/src/mineplex/core/titles/tracks/PerfectionistTrack.java b/Plugins/Mineplex.Core/src/mineplex/core/titles/tracks/PerfectionistTrack.java new file mode 100644 index 000000000..ceb768357 --- /dev/null +++ b/Plugins/Mineplex.Core/src/mineplex/core/titles/tracks/PerfectionistTrack.java @@ -0,0 +1,65 @@ +package mineplex.core.titles.tracks; + +import net.md_5.bungee.api.ChatColor; + +import org.bukkit.entity.Player; + +import mineplex.core.Managers; + +public class PerfectionistTrack extends Track +{ + private final TrackManager _trackManager = Managers.require(TrackManager.class); + + public PerfectionistTrack() + { + super("perfectionist", "Perfectionist", "This track is unlocked by completing other title lines"); + getRequirements() + .addTier(new TrackTier( + "A Bold Journey", + "Complete 2 title track", + this::getCompletedTracks, + 2, + new TrackFormat(ChatColor.GRAY) + )) + .addTier(new TrackTier( + "Endurer", + "Complete 5 title tracks", + this::getCompletedTracks, + 5, + new TrackFormat(ChatColor.BLUE, null) + )) + .addTier(new TrackTier( + "You've Probably Heard of Me", + "Complete 10 title tracks", + this::getCompletedTracks, + 10, + new TrackFormat(ChatColor.GREEN, null) + )) + .addTier(new TrackTier( + "Doer of Things", + "Complete 15 title tracks", + this::getCompletedTracks, + 15, + new TrackFormat(ChatColor.RED, ChatColor.RED) + )); + } + + private long getCompletedTracks(Player player) + { + int completed = 0; + + for (Track track : _trackManager.getAllTracks()) + { + if (track == this) + continue; + if (track.isSpecial()) + continue; + if (track.getRequirements().getNextTier(player) == null) + { + completed++; + } + } + + return completed; + } +} diff --git a/Plugins/Mineplex.Core/src/mineplex/core/titles/tracks/PowerPlayTrack.java b/Plugins/Mineplex.Core/src/mineplex/core/titles/tracks/PowerPlayTrack.java new file mode 100644 index 000000000..72730bc78 --- /dev/null +++ b/Plugins/Mineplex.Core/src/mineplex/core/titles/tracks/PowerPlayTrack.java @@ -0,0 +1,25 @@ +package mineplex.core.titles.tracks; + +import net.md_5.bungee.api.ChatColor; + +import mineplex.core.Managers; +import mineplex.core.bonuses.BonusManager; +import mineplex.core.powerplayclub.PowerPlayClubRepository; + +public class PowerPlayTrack extends Track +{ + private final PowerPlayClubRepository _powerPlayClubRepository = Managers.require(BonusManager.class).getPowerPlayClubRepository(); + + protected PowerPlayTrack() + { + super("power-play", ChatColor.AQUA, "Power Play", "Power Play VIP", "This track is unlocked by subscribing to the Power Play Club"); + getRequirements() + .addTier(new TrackTier( + "Power Play Club", + null, + player -> _powerPlayClubRepository.getCachedData(player).isSubscribed() ? 1L : 0L, + 1, + new TrackFormat(ChatColor.AQUA, ChatColor.AQUA) + )); + } +} diff --git a/Plugins/Mineplex.Core/src/mineplex/core/titles/tracks/SnekTrack.java b/Plugins/Mineplex.Core/src/mineplex/core/titles/tracks/SnekTrack.java new file mode 100644 index 000000000..7d2f1ad51 --- /dev/null +++ b/Plugins/Mineplex.Core/src/mineplex/core/titles/tracks/SnekTrack.java @@ -0,0 +1,27 @@ +package mineplex.core.titles.tracks; + +import java.util.Set; + +import net.md_5.bungee.api.ChatColor; + +import com.google.common.collect.Sets; + +public class SnekTrack extends Track +{ + private static final Set OWNERS = Sets.newHashSet( + "b86b54da-93dd-46f9-be33-27bd92aa36d7" + ); + + protected SnekTrack() + { + super("snek", ChatColor.DARK_GREEN, "Snek", "Snek", "oh you have do me a frighten", true); + special(); + getRequirements() + .addTier(new TrackTier( + "Snek", + "hiss", + player -> OWNERS.contains(player.getUniqueId().toString().toLowerCase()), + new TrackFormat(ChatColor.DARK_GREEN, ChatColor.GREEN) + )); + } +} diff --git a/Plugins/Mineplex.Core/src/mineplex/core/titles/tracks/SurvivorTrack.java b/Plugins/Mineplex.Core/src/mineplex/core/titles/tracks/SurvivorTrack.java new file mode 100644 index 000000000..31b4dca30 --- /dev/null +++ b/Plugins/Mineplex.Core/src/mineplex/core/titles/tracks/SurvivorTrack.java @@ -0,0 +1,33 @@ +package mineplex.core.titles.tracks; + +import net.md_5.bungee.api.ChatColor; + +public class SurvivorTrack extends Track +{ + public SurvivorTrack() + { + super("survivor", "Survivor", "This track is unlocked by playing consecutive games without dying"); + getRequirements() + .addTier(new TrackTier( + "Survivor", + "Survive 5 consecutive games without dying", + this::getStat, + 5, + new TrackFormat(ChatColor.GRAY) + )) + .addTier(new TrackTier( + "Endurer", + "Survive 10 consecutive games without dying", + this::getStat, + 10, + new TrackFormat(ChatColor.BLUE, null) + )) + .addTier(new TrackTier( + "Unkillable", + "Survive 20 consecutive games without dying", + this::getStat, + 20, + new TrackFormat(ChatColor.RED, ChatColor.RED) + )); + } +} diff --git a/Plugins/Mineplex.Core/src/mineplex/core/titles/tracks/SweetToothTrack.java b/Plugins/Mineplex.Core/src/mineplex/core/titles/tracks/SweetToothTrack.java new file mode 100644 index 000000000..b3bd8ca15 --- /dev/null +++ b/Plugins/Mineplex.Core/src/mineplex/core/titles/tracks/SweetToothTrack.java @@ -0,0 +1,79 @@ +package mineplex.core.titles.tracks; + +import java.util.HashMap; +import java.util.Map; + +import net.md_5.bungee.api.ChatColor; + +import org.bukkit.event.EventHandler; + +import mineplex.core.gadget.event.ItemGadgetUseEvent; +import mineplex.core.gadget.event.PlayerConsumeMelonEvent; +import mineplex.core.gadget.gadgets.item.ItemLovePotion; +import mineplex.core.gadget.set.SetCandyCane; +import mineplex.core.gadget.types.Gadget; + +public class SweetToothTrack extends Track +{ + private static final Map, Integer> POINTS = new HashMap<>(); + + static + { + POINTS.put(ItemLovePotion.class, 75); + } + + public SweetToothTrack() + { + super("sweet-tooth", "Sweet Tooth", "This track is unlocked by consuming Watermelon and other Sweets!"); + getRequirements() + .addTier(new TrackTier( + "Sweet Tooth", + "Consume 10,000 Sweet Points", + this::getStat, + 10000, + new TrackFormat(ChatColor.GRAY) + )) + .addTier(new TrackTier( + "Cavity Prone", + "Consume 25,000 Sweet Points", + this::getStat, + 25000, + new TrackFormat(ChatColor.BLUE, null) + )) + .addTier(new TrackTier( + "Candy Addict", + "Consume 50,000 Sweet Points", + this::getStat, + 50000, + new TrackFormat(ChatColor.RED, ChatColor.RED) + )); + + getRequirements() + .withRequirement(1, "Watermelon consumed") + .withRequirement(75, "Love Potion consumed") + .withSetBonus(SetCandyCane.class, 2); + } + + @EventHandler + public void onUseCosmetic(ItemGadgetUseEvent event) + { + int basePoints = POINTS.getOrDefault(event.getGadget().getClass(), 0); + + if (isSetActive(event.getPlayer(), SetCandyCane.class)) basePoints *= 2; + + if (basePoints != 0) + { + incrementFor(event.getPlayer(), basePoints); + } + } + + @EventHandler + public void onConsumeMelon(PlayerConsumeMelonEvent event) + { + int basePoints = 1; + + if (isSetActive(event.getPlayer(), SetCandyCane.class)) basePoints *= 2; + + incrementFor(event.getPlayer(), basePoints); + } +} diff --git a/Plugins/Mineplex.Core/src/mineplex/core/titles/tracks/TableFlipTrack.java b/Plugins/Mineplex.Core/src/mineplex/core/titles/tracks/TableFlipTrack.java new file mode 100644 index 000000000..4924fe3ef --- /dev/null +++ b/Plugins/Mineplex.Core/src/mineplex/core/titles/tracks/TableFlipTrack.java @@ -0,0 +1,39 @@ +package mineplex.core.titles.tracks; + +import net.md_5.bungee.api.ChatColor; + +import mineplex.core.Managers; +import mineplex.core.account.CoreClientManager; +import mineplex.core.common.Rank; + +public class TableFlipTrack extends Track +{ + private final CoreClientManager _coreClientManager = Managers.require(CoreClientManager.class); + + protected TableFlipTrack() + { + super("tableflip", ChatColor.AQUA, "Tableflip", "Tableflip", "(╯°□°)╯ ︵ ┻━┻", true); + special(); + getRequirements() + .addTier(new TrackTier( + "(╯°□°)╯ ︵ ┻━┻", + null, + player -> _coreClientManager.hasRank(player, Rank.ADMIN), + new TrackFormat(ChatColor.AQUA, ChatColor.AQUA) + .animated(5, + "(\\°-°)\\ ┬┬", + "(\\°-°)\\ ┬┬", + "(\\°-°)\\ ┬┬", + "(\\°□°)\\ ┬┬", + "(-°□°)- ┬┬", + "(╯°□°)╯ ︵ ]", + "(╯°□°)╯ ︵ ┻━┻", + "(╯°□°)╯ ︵ [", + "(╯°□°)╯ ︵ ┬┬", + "(╯°□°)╯ ︵ ┬┬", + "(╯°□°)╯ ︵ ┬┬", + "(╯°□°)╯ ︵ ┬┬" + ) + )); + } +} diff --git a/Plugins/Mineplex.Core/src/mineplex/core/titles/tracks/Track.java b/Plugins/Mineplex.Core/src/mineplex/core/titles/tracks/Track.java new file mode 100644 index 000000000..225733a00 --- /dev/null +++ b/Plugins/Mineplex.Core/src/mineplex/core/titles/tracks/Track.java @@ -0,0 +1,130 @@ +package mineplex.core.titles.tracks; + +import net.md_5.bungee.api.ChatColor; + +import org.apache.commons.lang3.Validate; +import org.bukkit.entity.Player; +import org.bukkit.event.Listener; + +import mineplex.core.Managers; +import mineplex.core.common.util.UtilServer; +import mineplex.core.gadget.GadgetManager; +import mineplex.core.gadget.types.GadgetSet; +import mineplex.core.stats.StatsManager; +import mineplex.database.tables.Stats; + +import static mineplex.core.Managers.require; + +public class Track implements Listener +{ + private final String _id; + private final String _shortName; + private final String _longName; + private final String _desc; + private final ChatColor _color; + private final boolean _hideIfUnowned; + + private final TrackRequirements _trackRequirements; + + private final GadgetManager _gadgetManager = require(GadgetManager.class); + private final StatsManager _statsManager = require(StatsManager.class); + + private boolean _special = false; + + protected Track(String trackId, String shortName, String description) + { + this(trackId, ChatColor.DARK_AQUA, shortName, shortName, description); + } + + protected Track(String trackId, String shortName, String description, boolean hideIfUnowned) + { + this(trackId, ChatColor.DARK_AQUA, shortName, shortName, description, hideIfUnowned); + } + + protected Track(String trackId, ChatColor color, String shortName, String longName, String description) + { + this(trackId, color, shortName, longName, description, false); + } + + protected Track(String trackId, ChatColor color, String shortName, String longName, String description, boolean hideIfUnowned) + { + // Book limits + Validate.isTrue(shortName.length() <= 16, "Short name cannot be longer than 16 characters"); + Validate.isTrue(trackId.length() <= 16, "ID cannot be longer than 16 characters"); + + this._id = trackId; + this._shortName = shortName; + this._longName = longName; + this._desc = description; + this._color = color; + this._trackRequirements = new TrackRequirements(this); + this._hideIfUnowned = hideIfUnowned; + + UtilServer.RegisterEvents(this); + } + + protected void special() + { + this._special = true; + } + + public boolean isSpecial() + { + return this._special; + } + + public final TrackRequirements getRequirements() + { + return this._trackRequirements; + } + + public final String getStatName() + { + return "track." + _id; + } + + public final void incrementFor(Player player, int amount) + { + _statsManager.incrementStat(player, getStatName(), amount); + } + + public final long getStat(Player player) + { + return _statsManager.Get(player).getStat(getStatName()); + } + + public final boolean isSetActive(Player player, Class setClass) + { + return _gadgetManager.getGadgetSet(setClass).isActive(player); + } + + public String getId() + { + return _id; + } + + public String getShortName() + { + return _shortName; + } + + public String getLongName() + { + return _longName; + } + + public String getDescription() + { + return _desc; + } + + public ChatColor getColor() + { + return this._color; + } + + public boolean hideIfUnowned() + { + return this._hideIfUnowned; + } +} diff --git a/Plugins/Mineplex.Core/src/mineplex/core/titles/tracks/TrackFormat.java b/Plugins/Mineplex.Core/src/mineplex/core/titles/tracks/TrackFormat.java new file mode 100644 index 000000000..de3fb1d3d --- /dev/null +++ b/Plugins/Mineplex.Core/src/mineplex/core/titles/tracks/TrackFormat.java @@ -0,0 +1,108 @@ +package mineplex.core.titles.tracks; + +import java.util.ArrayList; +import java.util.Arrays; +import java.util.List; + +import net.md_5.bungee.api.ChatColor; +import net.md_5.bungee.api.chat.BaseComponent; +import net.md_5.bungee.api.chat.ComponentBuilder; +import net.md_5.bungee.chat.ComponentSerializer; + +public class TrackFormat +{ + private final ChatColor _chatColor; + private final ChatColor _magicPrefixSuffix; + + private List _lines; + private int _ticks; + + public TrackFormat(ChatColor color) + { + this(color, null); + } + + public TrackFormat(ChatColor color, ChatColor prefixSuffixColor) + { + this._chatColor = color; + this._magicPrefixSuffix = prefixSuffixColor; + } + + public TrackFormat animated(int ticks, String... lines) + { + _ticks = ticks; + _lines = new ArrayList<>(); + for (String line : lines) + { + ComponentBuilder builder = new ComponentBuilder(""); + preFormat(builder); + builder.append(line); + format(builder); + builder.append("", ComponentBuilder.FormatRetention.NONE); + postFormat(builder); + _lines.add(BaseComponent.toLegacyText(builder.create())); + } + return this; + } + + public void preFormat(ComponentBuilder component) + { + if (_magicPrefixSuffix != null) + { + component + .append("A", ComponentBuilder.FormatRetention.NONE) + .obfuscated(true) + .color(_magicPrefixSuffix) + .append(" ", ComponentBuilder.FormatRetention.NONE); + } + else + { + component + .append("", ComponentBuilder.FormatRetention.NONE); + } + } + + public void postFormat(ComponentBuilder component) + { + if (_magicPrefixSuffix != null) + { + component + .append(" ", ComponentBuilder.FormatRetention.NONE) + .append("A", ComponentBuilder.FormatRetention.NONE) + .obfuscated(true) + .color(_magicPrefixSuffix) + .append("", ComponentBuilder.FormatRetention.NONE); + } + else + { + component + .append("", ComponentBuilder.FormatRetention.NONE); + } + } + + public void format(ComponentBuilder component) + { + component + .color(_chatColor); + } + + public ChatColor getColor() + { + return this._chatColor; + } + + public List getAnimatedLines() + { + return _lines; + } + + public boolean isAnimated() + { + return _lines != null && !_lines.isEmpty(); + } + + public int getDelay() + { + return _ticks; + } +} diff --git a/Plugins/Mineplex.Core/src/mineplex/core/titles/tracks/TrackManager.java b/Plugins/Mineplex.Core/src/mineplex/core/titles/tracks/TrackManager.java new file mode 100644 index 000000000..1e6e3b91c --- /dev/null +++ b/Plugins/Mineplex.Core/src/mineplex/core/titles/tracks/TrackManager.java @@ -0,0 +1,67 @@ +package mineplex.core.titles.tracks; + +import java.util.ArrayList; +import java.util.HashMap; +import java.util.LinkedHashMap; +import java.util.List; +import java.util.Map; + +import mineplex.core.MiniPlugin; +import mineplex.core.ReflectivelyCreateMiniPlugin; + +@ReflectivelyCreateMiniPlugin +public class TrackManager extends MiniPlugin +{ + private final Map, Track> _registeredTracks = new LinkedHashMap<>(); + private final Map _trackById = new HashMap<>(); + + private TrackManager() + { + super("Track Manager"); + + registerTrack(new LeaderTrack()); + registerTrack(new EarlyBirdTrack()); + registerTrack(new SnekTrack()); + registerTrack(new DongerTrack()); + registerTrack(new WizardTrack()); + registerTrack(new TableFlipTrack()); + registerTrack(new HappyGaryTrack()); + + registerTrack(new PowerPlayTrack()); + registerTrack(new MineplexMasteryTrack()); + registerTrack(new SweetToothTrack()); + registerTrack(new PartyAnimalTrack()); + registerTrack(new TreasureHunterTrack()); + registerTrack(new LuckyTrack()); + registerTrack(new UnluckyTrack()); + registerTrack(new HolidayCheerTrack()); +// registerTrack(new KitCollectorTrack()); + registerTrack(new GemCollectorTrack()); + registerTrack(new WarriorTrack()); + registerTrack(new PeacefulTrack()); +// registerTrack(new SurvivorTrack()); + registerTrack(new LevelerTrack()); + registerTrack(new PerfectionistTrack()); + } + + private void registerTrack(Track track) + { + _registeredTracks.put(track.getClass(), track); + _trackById.put(track.getId(), track); + } + + public final T getTrack(Class clazz) + { + return clazz.cast(_registeredTracks.get(clazz)); + } + + public final Track getTrackById(String id) + { + return _trackById.get(id); + } + + public final List getAllTracks() + { + return new ArrayList<>(_registeredTracks.values()); + } +} diff --git a/Plugins/Mineplex.Core/src/mineplex/core/titles/tracks/TrackRequirements.java b/Plugins/Mineplex.Core/src/mineplex/core/titles/tracks/TrackRequirements.java new file mode 100644 index 000000000..0bfe42547 --- /dev/null +++ b/Plugins/Mineplex.Core/src/mineplex/core/titles/tracks/TrackRequirements.java @@ -0,0 +1,159 @@ +package mineplex.core.titles.tracks; + +import java.util.ArrayList; +import java.util.Collections; +import java.util.List; +import java.util.function.Consumer; + +import net.md_5.bungee.api.ChatColor; +import net.md_5.bungee.api.chat.ComponentBuilder; + +import org.bukkit.entity.Player; + +import mineplex.core.Managers; +import mineplex.core.common.util.UtilText; +import mineplex.core.gadget.GadgetManager; +import mineplex.core.gadget.types.GadgetSet; + +public class TrackRequirements +{ + private final Track _track; + private final List _tierRequirements = new ArrayList<>(); + + private List _lore = new ArrayList<>(); + private List _bonuses = new ArrayList<>(); + + private final GadgetManager _gadgetManager = Managers.require(GadgetManager.class); + + public TrackRequirements(Track track) + { + this._track = track; + } + + public TrackRequirements addTier(TrackTier tier) + { + this._tierRequirements.add(tier); + return this; + } + + public TrackTier getTier(int tier) + { + return this._tierRequirements.get(tier); + } + + public TrackTier getTier(Player player) + { + for (int i = _tierRequirements.size() - 1; i >= 0; i--) + { + if (_tierRequirements.get(i).test(player)) + { + return _tierRequirements.get(i); + } + } + return null; + } + + public TrackTier getNextTier(Player player) + { + for (int i = _tierRequirements.size() - 1; i >= 0; i--) + { + if (_tierRequirements.get(i).test(player)) + { + if (i == _tierRequirements.size() - 1) + { + return null; + } + else + { + return _tierRequirements.get(i + 1); + } + } + } + return _tierRequirements.get(0); + } + + public List getTiers() + { + return Collections.unmodifiableList(this._tierRequirements); + } + + public int getRank(TrackTier tier) + { + return _tierRequirements.indexOf(tier) + 1; + } + + public TrackRequirements withRequirement(int points, String perName) + { + return withRequirement(points, "per", perName); + } + + public TrackRequirements withRequirement(int points, String verb, String name) + { + _lore.add(new PointWrapper(points, name, builder -> + { + builder.append("+ ", ComponentBuilder.FormatRetention.NONE) + .append(points + " " + UtilText.plural("point", points) + " ", ComponentBuilder.FormatRetention.NONE) + .color(ChatColor.GREEN) + .append(verb, ComponentBuilder.FormatRetention.NONE) + .append(" ", ComponentBuilder.FormatRetention.NONE) + .append(name) + .color(ChatColor.GREEN) + .append("\n", ComponentBuilder.FormatRetention.NONE); + })); + _lore.sort((a, b) -> + { + int result = Integer.compare(b._pts, a._pts); + return result == 0 ? ChatColor.stripColor(b._name).compareTo(ChatColor.stripColor(a._name)) : result; + }); + return this; + } + + public TrackRequirements withSetBonus(Class clazz, int bonusMultiplier) + { + return withBonus(_gadgetManager.getGadgetSet(clazz).getName() + " Set", "with", bonusMultiplier); + } + + public TrackRequirements withBonus(String name, String verb, int multiplier) + { + _bonuses.add(new PointWrapper(multiplier, name, builder -> + { + builder.append(multiplier + "x", ComponentBuilder.FormatRetention.NONE) + .color(ChatColor.GREEN) + .append(" points ", ComponentBuilder.FormatRetention.NONE) + .append(verb, ComponentBuilder.FormatRetention.NONE) + .append(" ", ComponentBuilder.FormatRetention.NONE) + .append(name) + .color(ChatColor.GREEN) + .append("\n", ComponentBuilder.FormatRetention.NONE); + })); + _bonuses.sort((a, b) -> + { + int result = Integer.compare(b._pts, a._pts); + return result == 0 ? ChatColor.stripColor(b._name).compareTo(ChatColor.stripColor(a._name)) : result; + }); + return this; + } + + public void appendLore(ComponentBuilder builder) + { + _lore.forEach(wrapper -> wrapper._consumer.accept(builder)); + _bonuses.forEach(wrapper -> wrapper._consumer.accept(builder)); + + if (!_bonuses.isEmpty() || !_lore.isEmpty()) + builder.append("\n"); + } + + private class PointWrapper + { + private int _pts; + private String _name; + private Consumer _consumer; + + public PointWrapper(int pts, String name, Consumer consumer) + { + _pts = pts; + _name = name; + _consumer = consumer; + } + } +} diff --git a/Plugins/Mineplex.Core/src/mineplex/core/titles/tracks/TrackTier.java b/Plugins/Mineplex.Core/src/mineplex/core/titles/tracks/TrackTier.java new file mode 100644 index 000000000..ef82d2769 --- /dev/null +++ b/Plugins/Mineplex.Core/src/mineplex/core/titles/tracks/TrackTier.java @@ -0,0 +1,82 @@ +package mineplex.core.titles.tracks; + +import java.util.function.Function; +import java.util.function.Predicate; + +import net.md_5.bungee.api.chat.BaseComponent; +import net.md_5.bungee.api.chat.ComponentBuilder; + +import org.bukkit.entity.Player; + +public class TrackTier +{ + private final String _title; + private final String _description; + private final Function _current; + private final int _goal; + private final TrackFormat _format; + + public TrackTier(String title, String description, Predicate condition, TrackFormat format) + { + this._title = title; + this._current = player -> condition.test(player) ? 1L : 0L; + this._goal = 1; + this._description = description; + this._format = format; + } + + public TrackTier(String title, String description, Function current, int goal, TrackFormat format) + { + this._title = title; + this._current = current; + this._goal = goal; + this._description = description; + this._format = format; + } + + public boolean test(Player player) + { + return getProgress(player) >= 1.0; + } + + public double getProgress(Player player) + { + return ((double) get(player)) / _goal; + } + + public long get(Player player) + { + return _current.apply(player); + } + + public String getTitle() + { + return this._title; + } + + public String getDescription() + { + return this._description; + } + + public int getGoal() + { + return _goal; + } + + public TrackFormat getFormat() + { + return this._format; + } + + public String getDisplayName() + { + ComponentBuilder builder = new ComponentBuilder(""); + getFormat().preFormat(builder); + builder.append(getTitle(), ComponentBuilder.FormatRetention.NONE); + getFormat().format(builder); + getFormat().postFormat(builder); + + return BaseComponent.toLegacyText(builder.create()); + } +} diff --git a/Plugins/Mineplex.Core/src/mineplex/core/titles/tracks/TreasureHunterTrack.java b/Plugins/Mineplex.Core/src/mineplex/core/titles/tracks/TreasureHunterTrack.java new file mode 100644 index 000000000..24348b954 --- /dev/null +++ b/Plugins/Mineplex.Core/src/mineplex/core/titles/tracks/TreasureHunterTrack.java @@ -0,0 +1,94 @@ +package mineplex.core.titles.tracks; + +import java.util.EnumMap; + +import net.md_5.bungee.api.ChatColor; + +import org.bukkit.event.EventHandler; + +import mineplex.core.gadget.set.SetWisdom; +import mineplex.core.treasure.TreasureType; +import mineplex.core.treasure.event.TreasureStartEvent; + +public class TreasureHunterTrack extends Track +{ + private static final EnumMap POINTS = new EnumMap<>(TreasureType.class); + + static + { + POINTS.put(TreasureType.OLD, 1); + POINTS.put(TreasureType.ANCIENT, 3); + POINTS.put(TreasureType.MYTHICAL, 5); + POINTS.put(TreasureType.ILLUMINATED, 10); + POINTS.put(TreasureType.FREEDOM, 25); + POINTS.put(TreasureType.HAUNTED, 25); + POINTS.put(TreasureType.CHRISTMAS, 25); + POINTS.put(TreasureType.TRICK_OR_TREAT, 25); + POINTS.put(TreasureType.THANKFUL, 25); + POINTS.put(TreasureType.GINGERBREAD, 25); + POINTS.put(TreasureType.LOVE_CHEST, 25); + POINTS.put(TreasureType.OMEGA, 50); + POINTS.put(TreasureType.MINESTRIKE, 3); + } + + public TreasureHunterTrack() + { + super("treasure-hunter", "Treasure Hunter", "This track is unlocked by opening chests in the lobby"); + getRequirements() + .addTier(new TrackTier( + "Rookie Treasure Hunter", + "Gain 100 Treasure Points", + this::getStat, + 100, + new TrackFormat(ChatColor.GRAY) + )) + .addTier(new TrackTier( + "Advanced Treasure Hunter", + "Gain 250 Treasure Points", + this::getStat, + 250, + new TrackFormat(ChatColor.LIGHT_PURPLE) + )) + .addTier(new TrackTier( + "Veteran Treasure Hunter", + "Gain 500 Treasure Points", + this::getStat, + 500, + new TrackFormat(ChatColor.BLUE, null) + )) + .addTier(new TrackTier( + "Legendary Treasure Hunter", + "Gain 1,000 Treasure Points", + this::getStat, + 1000, + new TrackFormat(ChatColor.GREEN, null) + )) + .addTier(new TrackTier( + "Master Treasure Hunter", + "Gain 2,000 Treasure Points", + this::getStat, + 2000, + new TrackFormat(ChatColor.RED, ChatColor.RED) + )); + + POINTS.forEach((type, value) -> getRequirements().withRequirement(value, type.getName())); + getRequirements() + .withSetBonus(SetWisdom.class, 2); + } + + @EventHandler + public void onUseCosmetic(TreasureStartEvent event) + { + if (POINTS.containsKey(event.getTreasureType())) + { + int basePoints = POINTS.get(event.getTreasureType()); + + if (isSetActive(event.getPlayer(), SetWisdom.class)) + { + basePoints *= 2; + } + + incrementFor(event.getPlayer(), basePoints); + } + } +} diff --git a/Plugins/Mineplex.Core/src/mineplex/core/titles/tracks/UnluckyTrack.java b/Plugins/Mineplex.Core/src/mineplex/core/titles/tracks/UnluckyTrack.java new file mode 100644 index 000000000..a23a3b332 --- /dev/null +++ b/Plugins/Mineplex.Core/src/mineplex/core/titles/tracks/UnluckyTrack.java @@ -0,0 +1,127 @@ +package mineplex.core.titles.tracks; + +import java.util.EnumMap; +import java.util.HashSet; +import java.util.Set; + +import net.md_5.bungee.api.ChatColor; + +import org.bukkit.Material; +import org.bukkit.entity.Player; +import org.bukkit.event.EventHandler; +import org.bukkit.inventory.Inventory; +import org.bukkit.inventory.ItemStack; + +import mineplex.core.reward.Reward; +import mineplex.core.reward.RewardRarity; +import mineplex.core.treasure.event.TreasureStartEvent; + +public class UnluckyTrack extends Track +{ + private static final EnumMap POINTS = new EnumMap<>(RewardRarity.class); + private static final Set IRON = new HashSet<>(); + private static final Set DIAMOND = new HashSet<>(); + + static + { + POINTS.put(RewardRarity.COMMON, 1); + POINTS.put(RewardRarity.UNCOMMON, 5); + + IRON.add(Material.IRON_SPADE); + IRON.add(Material.IRON_PICKAXE); + IRON.add(Material.IRON_AXE); + IRON.add(Material.IRON_SWORD); + IRON.add(Material.IRON_HOE); + IRON.add(Material.IRON_INGOT); + IRON.add(Material.IRON_HELMET); + IRON.add(Material.IRON_CHESTPLATE); + IRON.add(Material.IRON_LEGGINGS); + IRON.add(Material.IRON_BOOTS); + + DIAMOND.add(Material.DIAMOND_SPADE); + DIAMOND.add(Material.DIAMOND_PICKAXE); + DIAMOND.add(Material.DIAMOND_AXE); + DIAMOND.add(Material.DIAMOND_SWORD); + DIAMOND.add(Material.DIAMOND_HOE); + DIAMOND.add(Material.DIAMOND); + DIAMOND.add(Material.DIAMOND_HELMET); + DIAMOND.add(Material.DIAMOND_CHESTPLATE); + DIAMOND.add(Material.DIAMOND_LEGGINGS); + DIAMOND.add(Material.DIAMOND_BOOTS); + } + + public UnluckyTrack() + { + super("unlucky", "Unlucky", "This track is unlocked by getting bad chest drops"); + getRequirements() + .addTier(new TrackTier( + "Unlucky", + "Gain 1,000 Unlucky Points", + this::getStat, + 1000, + new TrackFormat(ChatColor.GRAY) + )) + .addTier(new TrackTier( + "Cursed", + "Gain 2,000 Unlucky Points", + this::getStat, + 2000, + new TrackFormat(ChatColor.LIGHT_PURPLE) + )) + .addTier(new TrackTier( + "Accident Prone", + "Gain 3,000 Unlucky Points", + this::getStat, + 3000, + new TrackFormat(ChatColor.BLUE, null) + )) + .addTier(new TrackTier( + "Corroded", + "Gain 5,000 Unlucky Points", + this::getStat, + 5000, + new TrackFormat(ChatColor.GREEN, null) + )) + .addTier(new TrackTier( + "Things Don't Go My Way", + "Gain 10,000 Unlucky Points", + this::getStat, + 10000, + new TrackFormat(ChatColor.RED, ChatColor.RED) + )); + + getRequirements() + .withRequirement(1, "Common Item") + .withRequirement(5, "Uncommon Item") + .withRequirement(1, "per game chest without", "Diamond/Iron/Food"); + } + + @EventHandler + public void onUseCosmetic(TreasureStartEvent event) + { + for (Reward reward : event.getRewards()) + { + if (!POINTS.containsKey(reward.getRarity())) + continue; + + int basePoints = POINTS.get(reward.getRarity()); + + incrementFor(event.getPlayer(), basePoints); + } + } + + public void handleLoot(Player player, Inventory inventory) + { + for (ItemStack item : inventory) + { + if (item != null) + { + if (IRON.contains(item.getType())) return; + if (DIAMOND.contains(item.getType())) return; + if (item.getType().isEdible()) return; + } + } + + incrementFor(player, 1); + } +} diff --git a/Plugins/Mineplex.Core/src/mineplex/core/titles/tracks/WarriorTrack.java b/Plugins/Mineplex.Core/src/mineplex/core/titles/tracks/WarriorTrack.java new file mode 100644 index 000000000..fb6c129af --- /dev/null +++ b/Plugins/Mineplex.Core/src/mineplex/core/titles/tracks/WarriorTrack.java @@ -0,0 +1,68 @@ +package mineplex.core.titles.tracks; + +import net.md_5.bungee.api.ChatColor; + +import org.bukkit.entity.Player; + +import mineplex.core.gadget.set.SetVampire; + +public class WarriorTrack extends Track +{ + public WarriorTrack() + { + super("warrior", "Warrior", "This track is unlocked by earning kills in PvP games"); + getRequirements() + .addTier(new TrackTier( + "Warrior in Training", + "Gain 500 Warrior Points", + this::getStat, + 500, + new TrackFormat(ChatColor.GRAY) + )) + .addTier(new TrackTier( + "Savage", + "Gain 1,000 Warrior Points", + this::getStat, + 1000, + new TrackFormat(ChatColor.LIGHT_PURPLE) + )) + .addTier(new TrackTier( + "Berserker", + "Gain 2,000 Warrior Points", + this::getStat, + 2000, + new TrackFormat(ChatColor.BLUE, null) + )) + .addTier(new TrackTier( + "Duelist", + "Gain 5,000 Warrior Points", + this::getStat, + 5000, + new TrackFormat(ChatColor.GREEN, null) + )) + .addTier(new TrackTier( + "Champion", + "Gain 10,000 Warrior Points", + this::getStat, + 10000, + new TrackFormat(ChatColor.RED, ChatColor.RED) + )); + + getRequirements() + .withRequirement(1, "Kill") + .withSetBonus(SetVampire.class, 2); + } + + /** + * Call this method when the specified Player has earned kills + */ + public void earnedKill(Player player, int kills) + { + if (kills <= 0) return; + + if (isSetActive(player, SetVampire.class)) + kills *= 2; + + incrementFor(player, kills); + } +} diff --git a/Plugins/Mineplex.Core/src/mineplex/core/titles/tracks/WizardTrack.java b/Plugins/Mineplex.Core/src/mineplex/core/titles/tracks/WizardTrack.java new file mode 100644 index 000000000..768c67620 --- /dev/null +++ b/Plugins/Mineplex.Core/src/mineplex/core/titles/tracks/WizardTrack.java @@ -0,0 +1,36 @@ +package mineplex.core.titles.tracks; + +import java.util.Set; + +import net.md_5.bungee.api.ChatColor; + +import com.google.common.collect.Sets; + +// hmu t3 +public class WizardTrack extends Track +{ + private static final Set OWNERS = Sets.newHashSet( + "b86b54da-93dd-46f9-be33-27bd92aa36d7", + "2016b565-0a63-4a2d-800b-b786ac256288" + ); + + protected WizardTrack() + { + super("wizard", ChatColor.DARK_PURPLE, "Wizard", "Wizard", "(ノ◕ヮ◕)ノ*:・゚✧", true); + special(); + getRequirements() + .addTier(new TrackTier( + "(ノ◕ヮ◕)ノ*:・゚✧", + null, + player -> OWNERS.contains(player.getUniqueId().toString().toLowerCase()), + new TrackFormat(ChatColor.DARK_PURPLE, ChatColor.DARK_PURPLE) + .animated(5, + "(ノ◕ヮ◕)ノ*", + "(ノ◕ヮ◕)ノ*:・゚", + "(ノ◕ヮ◕)ノ*:・゚✧", + "(ノ◕ヮ◕)ノ*:・゚✧", + "(ノ◕ヮ◕)ノ*:・゚✧" + ) + )); + } +} diff --git a/Plugins/Mineplex.Core/src/mineplex/core/tournament/TournamentRepository.java b/Plugins/Mineplex.Core/src/mineplex/core/tournament/TournamentRepository.java index 115d2855d..97382390b 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/tournament/TournamentRepository.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/tournament/TournamentRepository.java @@ -12,11 +12,12 @@ import mineplex.core.database.MinecraftRepository; import mineplex.core.tournament.data.Tournament; import mineplex.core.tournament.data.TournamentInviteStatus; import mineplex.serverdata.database.DBPool; +import mineplex.serverdata.database.RepositoryBase; import mineplex.serverdata.database.ResultSetCallable; import mineplex.serverdata.database.column.ColumnInt; import mineplex.serverdata.database.column.ColumnVarChar; -public class TournamentRepository extends MinecraftRepository +public class TournamentRepository extends RepositoryBase { private static String REGISTER_FOR_TOURNAMENT = "INSERT INTO tournamentTeams(accountId, tournamentId, status) VALUES (?, ?, ?);"; private static String UNREGISTER_FOR_TOURNAMENT = "DELETE FROM TTI FROM tournamentTeamInvites AS TTI INNER JOIN tournamentTeams AS TT ON TT.id = TTI.teamId WHERE TTI.accountId = ? AND TT.tournamentId = ?;"; @@ -25,7 +26,7 @@ public class TournamentRepository extends MinecraftRepository public TournamentRepository(JavaPlugin plugin) { - super(plugin, DBPool.getAccount()); + super(DBPool.getAccount()); } public int registerForTournament(int accountId, int tournamentId) @@ -83,10 +84,4 @@ public class TournamentRepository extends MinecraftRepository return tournaments; } - - @Override - protected void initialize() { } - - @Override - protected void update() { } } diff --git a/Plugins/Mineplex.Core/src/mineplex/core/treasure/Treasure.java b/Plugins/Mineplex.Core/src/mineplex/core/treasure/Treasure.java index 1b22eb01e..71b04ad99 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/treasure/Treasure.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/treasure/Treasure.java @@ -1,29 +1,54 @@ package mineplex.core.treasure; -import java.util.*; +import java.awt.Color; +import java.util.ArrayList; +import java.util.Iterator; +import java.util.LinkedList; +import java.util.List; +import java.util.Random; +import java.util.Set; import java.util.concurrent.ConcurrentHashMap; -import mineplex.core.blockrestore.BlockRestore; -import mineplex.core.common.Rank; -import mineplex.core.common.util.*; -import mineplex.core.common.util.UtilParticle.ViewDist; -import mineplex.core.common.util.particles.ColoredParticle; -import mineplex.core.common.util.particles.DustSpellColor; -import mineplex.core.hologram.HologramManager; -import mineplex.core.reward.*; -import mineplex.core.status.ServerStatusManager; -import mineplex.core.rankGiveaway.redis.TitanChestGiveawayMessage; -import mineplex.core.treasure.animation.*; import net.minecraft.server.v1_8_R3.BlockPosition; import net.minecraft.server.v1_8_R3.PacketPlayOutBlockAction; + import org.bukkit.Bukkit; -import org.bukkit.Color; import org.bukkit.Effect; import org.bukkit.Material; import org.bukkit.block.Block; import org.bukkit.craftbukkit.v1_8_R3.util.CraftMagicNumbers; import org.bukkit.entity.Player; +import mineplex.core.blockrestore.BlockRestore; +import mineplex.core.common.Rank; +import mineplex.core.common.util.C; +import mineplex.core.common.util.Callback; +import mineplex.core.common.util.F; +import mineplex.core.common.util.UtilParticle; +import mineplex.core.common.util.UtilParticle.ViewDist; +import mineplex.core.common.util.UtilPlayer; +import mineplex.core.common.util.UtilServer; +import mineplex.core.common.util.particles.ColoredParticle; +import mineplex.core.common.util.particles.DustSpellColor; +import mineplex.core.hologram.HologramManager; +import mineplex.core.rankGiveaway.redis.TitanChestGiveawayMessage; +import mineplex.core.reward.RankRewardData; +import mineplex.core.reward.Reward; +import mineplex.core.reward.RewardData; +import mineplex.core.reward.RewardRarity; +import mineplex.core.reward.RewardType; +import mineplex.core.status.ServerStatusManager; +import mineplex.core.treasure.animation.Animation; +import mineplex.core.treasure.animation.BlockChangeAnimation; +import mineplex.core.treasure.animation.ChestOpenAnimation; +import mineplex.core.treasure.animation.ChestSpawnAnimation; +import mineplex.core.treasure.animation.FreedomChestAnimation; +import mineplex.core.treasure.animation.LootLegendaryAnimation; +import mineplex.core.treasure.animation.LootMythicalAnimation; +import mineplex.core.treasure.animation.LootRareAnimation; +import mineplex.core.treasure.animation.LootUncommonAnimation; +import mineplex.core.treasure.animation.TreasureRemoveAnimation; + /** * Created by Shaun on 8/27/2014. */ @@ -184,6 +209,12 @@ public class Treasure block.getLocation().add(.5 + rX, .7, .5 + rZ)); coloredParticle.display(); } + else if (_treasureType == TreasureType.LOVE_CHEST) + { + int r = (int) (Math.random() * 2); + double rX = Math.random() * 2 - 1, rZ = Math.random() * 2 - 1; + UtilParticle.PlayParticle(type, block.getLocation().add(.5 + rX, .7, .5 + rZ), .5f, .5f, .5f, .25f, 1, ViewDist.NORMAL); + } else { UtilParticle.PlayParticle(type, block.getLocation().add(0.5, 0.5, 0.5), 0.5F, 0.5F, 0.5F, 0.2F, 0, diff --git a/Plugins/Mineplex.Core/src/mineplex/core/treasure/TreasureLocation.java b/Plugins/Mineplex.Core/src/mineplex/core/treasure/TreasureLocation.java index 7bf4ec023..b729b5d15 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/treasure/TreasureLocation.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/treasure/TreasureLocation.java @@ -1,5 +1,6 @@ package mineplex.core.treasure; +import java.util.Arrays; import java.util.List; import org.bukkit.Bukkit; @@ -27,6 +28,7 @@ import mineplex.core.common.util.F; import mineplex.core.common.util.UtilAction; import mineplex.core.common.util.UtilAlg; import mineplex.core.common.util.UtilPlayer; +import mineplex.core.common.util.UtilServer; import mineplex.core.common.util.UtilText; import mineplex.core.common.util.UtilTextMiddle; import mineplex.core.donation.DonationManager; @@ -39,6 +41,7 @@ import mineplex.core.inventory.InventoryManager; import mineplex.core.reward.Reward; import mineplex.core.status.ServerStatusManager; import mineplex.core.treasure.event.TreasureFinishEvent; +import mineplex.core.treasure.event.TreasurePreStartEvent; import mineplex.core.treasure.event.TreasureStartEvent; import mineplex.core.treasure.gui.TreasureShop; import mineplex.core.updater.UpdateType; @@ -104,7 +107,7 @@ public class TreasureLocation implements Listener return; } - TreasureStartEvent event = new TreasureStartEvent(player, treasureType); + TreasurePreStartEvent event = new TreasurePreStartEvent(player, treasureType); Bukkit.getPluginManager().callEvent(event); if (event.isCancelled()) @@ -135,7 +138,7 @@ public class TreasureLocation implements Listener } if(treasureType == TreasureType.ILLUMINATED || treasureType == TreasureType.FREEDOM || treasureType == TreasureType.OMEGA - || treasureType == TreasureType.HAUNTED) + || treasureType == TreasureType.HAUNTED || treasureType == TreasureType.GINGERBREAD || treasureType == TreasureType.LOVE_CHEST) { if(!_treasureManager.hasItemsToGivePlayer(treasureType.getRewardPool(), player)) { @@ -169,6 +172,9 @@ public class TreasureLocation implements Listener Bukkit.broadcastMessage(F.main("Treasure", F.name(player.getName()) + " is opening " + pron + name)); } + TreasureStartEvent startEvent = new TreasureStartEvent(player, treasureType, Arrays.asList(rewards)); + UtilServer.CallEvent(startEvent); + Treasure treasure = new Treasure(player, rewards, treasureType.getRewardType(), _chestBlock, _chestSpawns, treasureType, _treasureManager.getBlockRestore(), _hologramManager, _statusManager); _currentTreasure = treasure; @@ -319,7 +325,8 @@ public class TreasureLocation implements Listener event.setTo(newTo); } } - else + else if (event.getFrom().getWorld().equals(_currentTreasure.getCenterBlock().getWorld()) && + event.getTo().getWorld().equals(_currentTreasure.getCenterBlock().getWorld())) { Location fromLocation = event.getFrom(); Location toLocation = event.getTo(); diff --git a/Plugins/Mineplex.Core/src/mineplex/core/treasure/TreasureStyle.java b/Plugins/Mineplex.Core/src/mineplex/core/treasure/TreasureStyle.java index 81c1af8d1..aab8d9172 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/treasure/TreasureStyle.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/treasure/TreasureStyle.java @@ -62,6 +62,34 @@ public enum TreasureStyle ParticleType.RED_DUST, Sound.IRONGOLEM_HIT, Sound.IRONGOLEM_THROW + ), + THANKFUL( + ParticleType.HAPPY_VILLAGER, + ParticleType.HAPPY_VILLAGER, + ParticleType.HAPPY_VILLAGER, + Sound.CHICKEN_IDLE, + Sound.CHICKEN_EGG_POP + ), + GINGERBREAD( + ParticleType.SNOW_SHOVEL, + ParticleType.SNOW_SHOVEL, + ParticleType.SNOW_SHOVEL, + Sound.DIG_SNOW, + Sound.DIG_SNOW + ), + MINESTRIKE( + ParticleType.FIREWORKS_SPARK, + ParticleType.FIREWORKS_SPARK, + ParticleType.INSTANT_SPELL, + Sound.EXPLODE, + Sound.EXPLODE + ), + LOVECHEST( + ParticleType.HEART, + ParticleType.HEART, + ParticleType.HEART, + Sound.VILLAGER_YES, + Sound.VILLAGER_YES ); private ParticleType _secondaryParticle; diff --git a/Plugins/Mineplex.Core/src/mineplex/core/treasure/TreasureType.java b/Plugins/Mineplex.Core/src/mineplex/core/treasure/TreasureType.java index 80cfff9fd..8766e644a 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/treasure/TreasureType.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/treasure/TreasureType.java @@ -12,7 +12,7 @@ public enum TreasureType ANCIENT(C.cGold + "Ancient Treasure", "Ancient Chest", "Ancient", RewardType.ANCIENT_CHEST, Material.TRAPPED_CHEST, TreasureStyle.ANCIENT, RewardPool.Type.NORMAL, true, 5000), - MYTHICAL(C.cRed + "Mythical Treasure", "Mythical Chest", "Mythical", RewardType.MYTHICAL_CHEST, Material.ENDER_CHEST, TreasureStyle.MYTHICAL, RewardPool.Type.NORMAL, true, 10000), + MYTHICAL(C.cRed + "Mythical Treasure", "Mythical Chest", "Mythical", RewardType.MYTHICAL_CHEST, Material.ENDER_CHEST, TreasureStyle.MYTHICAL, RewardPool.Type.MYTHICAL, true, 10000), CHRISTMAS(C.cDGreen + "Winter Holiday Treasure", "Winter Chest", "Christmas", RewardType.WINTER_CHEST, Material.CHEST, TreasureStyle.CHRISTMAS, RewardPool.Type.WINTER_HOLIDAY, false, 15000), @@ -24,7 +24,15 @@ public enum TreasureType HAUNTED(C.cGold + "Haunted Chest", "Haunted Chest", "Haunted", RewardType.HAUNTED_CHEST, Material.CHEST, TreasureStyle.HALLOWEEN, RewardPool.Type.HAUNTED, true, 35000), - TRICK_OR_TREAT(C.cGold + "Trick or Treat Treasure", "Trick or Treat Chest", "TrickOrTreat", RewardType.TRICK_OR_TREAT_CHEST, Material.CHEST, TreasureStyle.HALLOWEEN, RewardPool.Type.TRICK_OR_TREAT, true, 20000); + TRICK_OR_TREAT(C.cGold + "Trick or Treat Treasure", "Trick or Treat Chest", "TrickOrTreat", RewardType.TRICK_OR_TREAT_CHEST, Material.CHEST, TreasureStyle.HALLOWEEN, RewardPool.Type.TRICK_OR_TREAT, true, 20000), + + THANKFUL(C.cGold + "Thankful Treasure", "Thankful Chest", "ThankFul", RewardType.THANKFUL_CHEST, Material.CHEST, TreasureStyle.THANKFUL, RewardPool.Type.THANKFUL, true, 20000), + + GINGERBREAD(C.cRed + "Gingerbread " + C.cGreen + "Treasure", "Gingerbread Chest", "Gingerbread", RewardType.GINGERBREAD_CHEST, Material.CHEST, TreasureStyle.GINGERBREAD, RewardPool.Type.GINGERBREAD, true, 20000), + + MINESTRIKE(C.cGold + "Minestrike Treasure", "Minestrike Chest", "MinestrikeChest", RewardType.MINESTRIKE_CHEST, Material.CHEST, TreasureStyle.MINESTRIKE, RewardPool.Type.MINESTRIKE, true, 10000), + + LOVE_CHEST(C.cRed + "Love Treasure", "Love Chest", "LoveChest", RewardType.LOVE_CHEST, Material.CHEST, TreasureStyle.LOVECHEST, RewardPool.Type.LOVECHEST, true, 20000); private final String _name; private final RewardType _rewardType; diff --git a/Plugins/Mineplex.Core/src/mineplex/core/treasure/animation/BlockChangeAnimation.java b/Plugins/Mineplex.Core/src/mineplex/core/treasure/animation/BlockChangeAnimation.java index 5dbc7ebd4..f98716e24 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/treasure/animation/BlockChangeAnimation.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/treasure/animation/BlockChangeAnimation.java @@ -5,7 +5,10 @@ import java.util.List; import org.bukkit.Material; import org.bukkit.block.Block; import org.bukkit.block.BlockFace; +import org.bukkit.block.Skull; +import mineplex.core.common.skin.SkinData; +import mineplex.core.common.util.UtilBlock; import mineplex.core.treasure.BlockInfo; import mineplex.core.treasure.Treasure; import mineplex.core.treasure.TreasureType; @@ -81,6 +84,16 @@ public class BlockChangeAnimation extends Animation mat = Material.WOOL; data = 1; } + else if (getTreasure().getTreasureType() == TreasureType.GINGERBREAD) + { + mat = Material.STAINED_CLAY; + data = 13; + } + else if (getTreasure().getTreasureType() == TreasureType.LOVE_CHEST) + { + mat = Material.WOOL; + data = 6; + } else continue; @@ -118,6 +131,16 @@ public class BlockChangeAnimation extends Animation mat = Material.WOOL; data = 15; } + else if (getTreasure().getTreasureType() == TreasureType.GINGERBREAD) + { + mat = Material.STAINED_CLAY; + data = 14; + } + else if (getTreasure().getTreasureType() == TreasureType.LOVE_CHEST) + { + mat = Material.WOOL; + data = 14; + } else continue; @@ -174,6 +197,44 @@ public class BlockChangeAnimation extends Animation } } } + else if (getTreasure().getTreasureType() == TreasureType.GINGERBREAD) + { + for (Block c : _chests) + { + if (c.equals(b)) + { + _blockInfoList.add(new BlockInfo(b)); + try + { + Skull skull = UtilBlock.blockToSkull(c, SkinData.GINGERBREAD); + if (skull != null) + { + skull.setRotation(getSkullDirection(skull.getBlock())); + skull.update(); + } + else + { + c.setType(Material.AIR); + } + } catch (Exception e) + { + e.printStackTrace(); + } + } + } + } + else if (getTreasure().getTreasureType() == TreasureType.LOVE_CHEST) + { + for (Block c : _chests) + { + if (c.equals(b)) + { + _blockInfoList.add(new BlockInfo(b)); + b.setType(Material.WOOL); + b.setData((byte) 6); + } + } + } } } @@ -209,4 +270,22 @@ public class BlockChangeAnimation extends Animation } return direction; } + + private BlockFace getSkullDirection(Block block) + { + byte direction = getDirection(block); + switch (direction) + { + case (byte) 0: + return BlockFace.SOUTH; + case (byte) 1: + return BlockFace.WEST; + case (byte) 2: + return BlockFace.NORTH; + case (byte) 3: + return BlockFace.EAST; + default: + return BlockFace.SOUTH; + } + } } diff --git a/Plugins/Mineplex.Core/src/mineplex/core/treasure/animation/ChestSpawnAnimation.java b/Plugins/Mineplex.Core/src/mineplex/core/treasure/animation/ChestSpawnAnimation.java index f581e576c..ce268629c 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/treasure/animation/ChestSpawnAnimation.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/treasure/animation/ChestSpawnAnimation.java @@ -1,8 +1,11 @@ package mineplex.core.treasure.animation; +import java.awt.Color; import java.util.List; -import org.bukkit.Color; +import net.minecraft.server.v1_8_R3.BlockPosition; +import net.minecraft.server.v1_8_R3.MathHelper; + import org.bukkit.Location; import org.bukkit.block.Block; import org.bukkit.craftbukkit.v1_8_R3.CraftWorld; @@ -28,11 +31,10 @@ import mineplex.core.common.util.particles.DustSpellColor; import mineplex.core.disguise.DisguiseManager; import mineplex.core.disguise.disguises.DisguiseBat; import mineplex.core.particleeffects.BabyFireworkEffect; +import mineplex.core.particleeffects.CircleEffect; import mineplex.core.treasure.BlockInfo; import mineplex.core.treasure.Treasure; import mineplex.core.treasure.TreasureType; -import net.minecraft.server.v1_8_R3.BlockPosition; -import net.minecraft.server.v1_8_R3.MathHelper; /** * Created by Shaun on 8/29/2014. @@ -111,11 +113,11 @@ public class ChestSpawnAnimation extends Animation { float scale = (float)((double)(ANIMATION_DURATION - getTicks()) / (double)ANIMATION_DURATION); - //Move Paticle Forwards + //Move Particle Forwards _particleLocation.add(_particleDirection); - //Play Particels - if (getTreasure().getTreasureType() == TreasureType.OLD) + //Play Particles + if (getTreasure().getTreasureType() == TreasureType.OLD || getTreasure().getTreasureType() == TreasureType.LOVE_CHEST) { UtilParticle.PlayParticle(getTreasure().getTreasureType().getStyle().getSecondaryParticle(), _centerLocation, 0.1f, 0.1f, 0.1f, 0, 1, ViewDist.NORMAL, UtilServer.getPlayers()); @@ -132,7 +134,7 @@ public class ChestSpawnAnimation extends Animation UtilParticle.PlayParticle(getTreasure().getTreasureType().getStyle().getSecondaryParticle(), newLoc, 0f, 0f, 0f, 0, 1, ViewDist.NORMAL, UtilServer.getPlayers()); } - else if (getTreasure().getTreasureType() == TreasureType.MYTHICAL) + else if (getTreasure().getTreasureType() == TreasureType.MYTHICAL || getTreasure().getTreasureType() == TreasureType.MINESTRIKE) { float y = 5 * scale; double width = 0.7 * ((double) getTicks() / (double) ANIMATION_DURATION); @@ -143,9 +145,17 @@ public class ChestSpawnAnimation extends Animation float x = (float) (Math.sin(getTicks()/4D + lead)); float z = (float) (Math.cos(getTicks()/4D + lead)); - - UtilParticle.PlayParticle(getTreasure().getTreasureType().getStyle().getSecondaryParticle(), _centerLocation.clone().add(x * width, y, z * width), 0f, 0f, 0f, 0, 1, - ViewDist.NORMAL, UtilServer.getPlayers()); + + if (getTreasure().getTreasureType() == TreasureType.MYTHICAL) + { + UtilParticle.PlayParticle(getTreasure().getTreasureType().getStyle().getSecondaryParticle(), _centerLocation.clone().add(x * width, y, z * width), 0f, 0f, 0f, 0, 1, + ViewDist.NORMAL, UtilServer.getPlayers()); + } + else + { + ColoredParticle coloredParticle = new ColoredParticle(ParticleType.RED_DUST, new DustSpellColor(Color.YELLOW), _centerLocation.clone().add(x * width, y, z * width)); + coloredParticle.display(); + } } } else if (getTreasure().getTreasureType() == TreasureType.CHRISTMAS) @@ -155,7 +165,7 @@ public class ChestSpawnAnimation extends Animation UtilParticle.PlayParticle(ParticleType.SNOW_SHOVEL, _centerLocation.clone().add(0, 5, 0), spread, 0.1f, spread, 0, 30, ViewDist.NORMAL, UtilServer.getPlayers()); } - else if (getTreasure().getTreasureType() == TreasureType.ILLUMINATED) + else if (getTreasure().getTreasureType() == TreasureType.ILLUMINATED || getTreasure().getTreasureType() == TreasureType.THANKFUL) { Location loc = _centerLocation.clone(); loc.add(Vector.getRandom().subtract(Vector.getRandom()).multiply(0.5)); @@ -203,6 +213,12 @@ public class ChestSpawnAnimation extends Animation _circleAmount++; } + else if (getTreasure().getTreasureType() == TreasureType.GINGERBREAD) + { + CircleEffect circleEffect = new CircleEffect(_javaPlugin, _centerLocation.clone().add(0, 0.5, 0), 1.3, Color.GREEN); + circleEffect.setMaxCircles(2); + circleEffect.start(); + } else if (getTreasure().getTreasureType() == TreasureType.HAUNTED || getTreasure().getTreasureType() == TreasureType.TRICK_OR_TREAT) { float x = (float) (Math.sin(getTicks()/4D)); @@ -233,7 +249,7 @@ public class ChestSpawnAnimation extends Animation //Spawn Chest if (getTicks() >= ANIMATION_DURATION) { - if(getTreasure().getTreasureType() == TreasureType.ILLUMINATED) + if(getTreasure().getTreasureType() == TreasureType.ILLUMINATED || getTreasure().getTreasureType() == TreasureType.GINGERBREAD) { UtilBlock.setQuick(_block.getWorld(), _block.getX(), _block.getY(), _block.getZ(), 0, (byte) 0); } @@ -260,11 +276,22 @@ public class ChestSpawnAnimation extends Animation if (particleType != null) { - if (getTreasure().getTreasureType() != TreasureType.FREEDOM && getTreasure().getTreasureType() != TreasureType.HAUNTED) + if (getTreasure().getTreasureType() == TreasureType.MINESTRIKE) + { + ColoredParticle coloredParticle = new ColoredParticle(ParticleType.RED_DUST, new DustSpellColor(Color.YELLOW), _centerLocation.clone().add(0, 1, 0)); + coloredParticle.display(50); + } + else if (getTreasure().getTreasureType() != TreasureType.FREEDOM && getTreasure().getTreasureType() != TreasureType.HAUNTED + && getTreasure().getTreasureType() != TreasureType.GINGERBREAD && getTreasure().getTreasureType() != TreasureType.LOVE_CHEST) { UtilParticle.PlayParticle(particleType, _centerLocation, 0.2f, 0.2f, 0.2f, 0, 50, ViewDist.NORMAL, UtilServer.getPlayers()); } + else if (getTreasure().getTreasureType() == TreasureType.LOVE_CHEST) + { + UtilParticle.PlayParticle(particleType, _centerLocation, 0.2f, 0.2f, 0.2f, 0, 15, + ViewDist.NORMAL, UtilServer.getPlayers()); + } else if (getTreasure().getTreasureType() == TreasureType.FREEDOM) { int r = (int) (Math.random() * 3); @@ -273,6 +300,14 @@ public class ChestSpawnAnimation extends Animation _centerLocation.clone().add(.5, .5, .5)); coloredParticle.display(); } + else if (getTreasure().getTreasureType() == TreasureType.GINGERBREAD) + { + int r = (int) (Math.random() * 3); + ColoredParticle coloredParticle = new ColoredParticle(ParticleType.RED_DUST, + new DustSpellColor(Color.GREEN), + _centerLocation.clone().add(.5, .5, .5)); + coloredParticle.display(); + } else { int r = (int) (Math.random() * 2); diff --git a/Plugins/Mineplex.Core/src/mineplex/core/treasure/event/TreasurePreStartEvent.java b/Plugins/Mineplex.Core/src/mineplex/core/treasure/event/TreasurePreStartEvent.java new file mode 100644 index 000000000..d384c61db --- /dev/null +++ b/Plugins/Mineplex.Core/src/mineplex/core/treasure/event/TreasurePreStartEvent.java @@ -0,0 +1,57 @@ +package mineplex.core.treasure.event; + +import mineplex.core.treasure.TreasureType; +import org.bukkit.entity.Player; +import org.bukkit.event.Cancellable; +import org.bukkit.event.Event; +import org.bukkit.event.HandlerList; + +/** + * Created by shaun on 14-09-12. + */ +public class TreasurePreStartEvent extends Event implements Cancellable +{ + private static final HandlerList handlers = new HandlerList(); + + private Player _player; + private TreasureType _treasureType; + private boolean _cancelled = false; + + public TreasurePreStartEvent(Player player, TreasureType treasureType) + { + _player = player; + _treasureType = treasureType; + } + + public Player getPlayer() + { + return _player; + } + + public TreasureType getTreasureType() + { + return _treasureType; + } + + @Override + public boolean isCancelled() + { + return _cancelled; + } + + @Override + public void setCancelled(boolean cancelled) + { + _cancelled = cancelled; + } + + public HandlerList getHandlers() + { + return handlers; + } + + public static HandlerList getHandlerList() + { + return handlers; + } +} \ No newline at end of file diff --git a/Plugins/Mineplex.Core/src/mineplex/core/treasure/event/TreasureStartEvent.java b/Plugins/Mineplex.Core/src/mineplex/core/treasure/event/TreasureStartEvent.java index 0c541f079..771de876a 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/treasure/event/TreasureStartEvent.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/treasure/event/TreasureStartEvent.java @@ -1,26 +1,28 @@ package mineplex.core.treasure.event; -import mineplex.core.treasure.TreasureType; +import java.util.Collections; +import java.util.List; + import org.bukkit.entity.Player; -import org.bukkit.event.Cancellable; import org.bukkit.event.Event; import org.bukkit.event.HandlerList; -/** - * Created by shaun on 14-09-12. - */ -public class TreasureStartEvent extends Event implements Cancellable +import mineplex.core.reward.Reward; +import mineplex.core.treasure.TreasureType; + +public class TreasureStartEvent extends Event { private static final HandlerList handlers = new HandlerList(); private Player _player; private TreasureType _treasureType; - private boolean _cancelled = false; + private List _rewards; - public TreasureStartEvent(Player player, TreasureType treasureType) + public TreasureStartEvent(Player player, TreasureType treasureType, List rewards) { _player = player; _treasureType = treasureType; + _rewards = rewards; } public Player getPlayer() @@ -33,16 +35,9 @@ public class TreasureStartEvent extends Event implements Cancellable return _treasureType; } - @Override - public boolean isCancelled() + public List getRewards() { - return _cancelled; - } - - @Override - public void setCancelled(boolean cancelled) - { - _cancelled = cancelled; + return Collections.unmodifiableList(_rewards); } public HandlerList getHandlers() @@ -54,4 +49,4 @@ public class TreasureStartEvent extends Event implements Cancellable { return handlers; } -} \ No newline at end of file +} diff --git a/Plugins/Mineplex.Core/src/mineplex/core/treasure/gui/BuyChestButton.java b/Plugins/Mineplex.Core/src/mineplex/core/treasure/gui/BuyChestButton.java index a0ee33418..ef1e9775a 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/treasure/gui/BuyChestButton.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/treasure/gui/BuyChestButton.java @@ -57,6 +57,32 @@ public class BuyChestButton implements IButton return; } } + if (_chestType == TreasureType.THANKFUL) + { + if (!new File("../../update/files/EnableThankful.dat").exists()) + { + player.sendMessage(F.main("Treasure", "That chest is no longer available for purchase!")); + return; + } + } + if (_chestType == TreasureType.GINGERBREAD) + { + player.sendMessage(F.main("Treasure", "That chest is no longer available for purchase!")); + return; + } + if (_chestType == TreasureType.LOVE_CHEST) + { + if (!new File("../../update/files/EnableLoveChest.dat").exists()) + { + player.sendMessage(F.main("Treasure", "That chest is no longer available for purchase!")); + return; + } + if (!_page.getPlugin().hasItemsToGivePlayer(_chestType.getRewardPool(), player)) + { + player.sendMessage(F.main("Treasure", "You seem to have all treasures for this chest unlocked already!")); + return; + } + } if (_chestType == TreasureType.FREEDOM || _chestType == TreasureType.HAUNTED) { if (!_page.getPlugin().hasItemsToGivePlayer(_chestType.getRewardPool(), player)) @@ -72,7 +98,7 @@ public class BuyChestButton implements IButton } if (!_page.getPlugin().hasItemsToGivePlayer(_chestType.getRewardPool(), player) && (_chestType == TreasureType.ILLUMINATED || _chestType == TreasureType.OMEGA - || _chestType == TreasureType.HAUNTED)) + || _chestType == TreasureType.HAUNTED || _chestType == TreasureType.GINGERBREAD)) { player.sendMessage(F.main("Treasure", "You seem to have all treasures for this chest unlocked already!")); return; @@ -81,7 +107,11 @@ public class BuyChestButton implements IButton _page.getShop().openPageForPlayer(player, new ConfirmationPage<>(player, _page, new SalesPackageProcessor(player, GlobalCurrency.TREASURE_SHARD, salesPackage, _page.getDonationManager(), () -> { _inventoryManager.addItemToInventory(player, _chestName, 1); - _page.refresh(); + player.closeInventory(); + TreasurePage page = new TreasurePage(_page.getTreasureManager(), _page.getTreasureShop(), _page.getTreasureLocation(), + _page.getClientManager(), _page.getDonationManager(), _page.getInventoryManager(), + _page.getGadgetManager(), player, _page.getActualPage()); + _page.getTreasureShop().openPageForPlayer(player, page); }), salesPackage.buildIcon())); } } \ No newline at end of file diff --git a/Plugins/Mineplex.Core/src/mineplex/core/treasure/gui/TreasurePage.java b/Plugins/Mineplex.Core/src/mineplex/core/treasure/gui/TreasurePage.java index a4124c3a9..4fda07f6c 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/treasure/gui/TreasurePage.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/treasure/gui/TreasurePage.java @@ -1,5 +1,6 @@ package mineplex.core.treasure.gui; +import java.io.File; import java.util.ArrayList; import java.util.List; @@ -15,6 +16,8 @@ import mineplex.core.common.currency.GlobalCurrency; import mineplex.core.common.skin.SkinData; import mineplex.core.common.util.C; import mineplex.core.common.util.F; +import mineplex.core.common.util.LineFormat; +import mineplex.core.common.util.UtilText; import mineplex.core.donation.DonationManager; import mineplex.core.gadget.GadgetManager; import mineplex.core.gadget.gadgets.arrowtrail.freedom.ArrowTrailFreedom; @@ -25,23 +28,36 @@ import mineplex.core.gadget.gadgets.particle.freedom.ParticleFreedom; import mineplex.core.gadget.types.Gadget; import mineplex.core.gadget.types.GadgetType; import mineplex.core.inventory.InventoryManager; +import mineplex.core.itemstack.ItemStackFactory; import mineplex.core.mount.Mount; import mineplex.core.shop.item.ShopItem; import mineplex.core.shop.page.ShopPageBase; import mineplex.core.treasure.TreasureLocation; import mineplex.core.treasure.TreasureManager; import mineplex.core.treasure.TreasureType; +import mineplex.core.treasure.gui.pages.NextPageButton; +import mineplex.core.treasure.gui.pages.PreviousPageButton; public class TreasurePage extends ShopPageBase { + + private TreasureManager _treasureManager; + private TreasureShop _treasureShop; private TreasureLocation _treasureLocation; private InventoryManager _inventoryManager; private GadgetManager _gadgetManager; + private int _actualPage = 1; + + private List _specialTreasures = new ArrayList<>(); + private List _normalTreasures = new ArrayList<>(); + private List _seasonalTreasures = new ArrayList<>(); public TreasurePage(TreasureManager plugin, TreasureShop shop, TreasureLocation treasureLocation, CoreClientManager clientManager, DonationManager donationManager, InventoryManager inventoryManager, GadgetManager gadgetManager, Player player) { - super(plugin, shop, clientManager, donationManager, "Open Treasure", player, 54); + super(plugin, shop, clientManager, donationManager, "Open Treasure - Page 1", player, 54); + _treasureManager = plugin; + _treasureShop = shop; _treasureLocation = treasureLocation; _inventoryManager = inventoryManager; _gadgetManager = gadgetManager; @@ -49,8 +65,62 @@ public class TreasurePage extends ShopPageBase buildPage(); } + public TreasurePage(TreasureManager plugin, TreasureShop shop, TreasureLocation treasureLocation, CoreClientManager clientManager, DonationManager donationManager, InventoryManager inventoryManager, GadgetManager gadgetManager, Player player, int actualPage) + { + super(plugin, shop, clientManager, donationManager, "Open Treasure - Page " + actualPage, player, 54); + + _treasureManager = plugin; + _treasureShop = shop; + _treasureLocation = treasureLocation; + _inventoryManager = inventoryManager; + _gadgetManager = gadgetManager; + _actualPage = actualPage; + + buildPage(); + } + + public TreasureManager getTreasureManager() + { + return _treasureManager; + } + + public TreasureShop getTreasureShop() + { + return _treasureShop; + } + + public TreasureLocation getTreasureLocation() + { + return _treasureLocation; + } + + public InventoryManager getInventoryManager() + { + return _inventoryManager; + } + + public GadgetManager getGadgetManager() + { + return _gadgetManager; + } + + public int getActualPage() + { + return _actualPage; + } + @Override - protected void buildPage() + public void buildPage() + { + addAllChests(); + + if (_actualPage == 1) + buildFirstPage(); + else + buildSecondPage(); + } + + private void addAllChests() { int treasureShards = getDonationManager().Get(getPlayer()).getBalance(GlobalCurrency.TREASURE_SHARD); @@ -63,6 +133,18 @@ public class TreasurePage extends ShopPageBase int omegaCount = _inventoryManager.Get(getPlayer()).getItemCount(TreasureType.OMEGA.getItemName()); int hauntedCount = _inventoryManager.Get(getPlayer()).getItemCount(TreasureType.HAUNTED.getItemName()); int trickCount = _inventoryManager.Get(getPlayer()).getItemCount(TreasureType.TRICK_OR_TREAT.getItemName()); + int thankCount = _inventoryManager.Get(getPlayer()).getItemCount(TreasureType.THANKFUL.getItemName()); + int gingerbreadCount = _inventoryManager.Get(getPlayer()).getItemCount(TreasureType.GINGERBREAD.getItemName()); + int minestrikeCount = _inventoryManager.Get(getPlayer()).getItemCount(TreasureType.MINESTRIKE.getItemName()); + int loveCount = _inventoryManager.Get(getPlayer()).getItemCount(TreasureType.LOVE_CHEST.getItemName()); + + boolean availableChristmas = false; + boolean availableFreedom = false; + boolean availableHaunted = false; + boolean availableTrick = false; + boolean availableThank = false; + boolean availableGingerbread = false; + boolean availableLove = new File("../../update/files/EnableLoveChest.dat").exists(); List shardLore = new ArrayList<>(); shardLore.add(" "); @@ -81,7 +163,7 @@ public class TreasurePage extends ShopPageBase basicLore.add(C.cGray + "many kinds of loot."); basicLore.add(" "); if (basicCount > 0) - basicLore.add(ChatColor.RESET + C.cGreen + "Click to Open!"); + basicLore.add(C.cGreen + "Click to Open!"); else { basicLore.add(ChatColor.RESET + "Click to craft for " + C.cAqua + "1000 Treasure Shards"); @@ -98,7 +180,7 @@ public class TreasurePage extends ShopPageBase heroicLore.add(C.cGray + "temples hidden in Minecrafts worlds."); heroicLore.add(" "); if (heroicCount > 0) - heroicLore.add(ChatColor.RESET + C.cGreen + "Click to Open!"); + heroicLore.add(C.cGreen + "Click to Open!"); else { heroicLore.add(ChatColor.RESET + "Click to craft for " + C.cAqua + "5000 Treasure Shards"); @@ -118,7 +200,7 @@ public class TreasurePage extends ShopPageBase legendaryLore.add(C.cGray + "location of these chests on their own."); legendaryLore.add(" "); if (legendaryCount > 0) - legendaryLore.add(ChatColor.RESET + C.cGreen + "Click to Open!"); + legendaryLore.add(C.cGreen + "Click to Open!"); else { legendaryLore.add(ChatColor.RESET + "Click to craft for " + C.cAqua + "10000 Treasure Shards"); @@ -137,14 +219,10 @@ public class TreasurePage extends ShopPageBase christmasLore.add(C.cGray + "accessed in the deepest parts of Winter..."); christmasLore.add(" "); if (christmasCount > 0) - christmasLore.add(ChatColor.RESET + C.cGreen + "Click to Open!"); + christmasLore.add(C.cGreen + "Click to Open!"); else { - /* - christmasLore.add(ChatColor.RESET + "Click to craft for " + C.cAqua + "15000 Treasure Shards"); - christmasLore.add(" "); - christmasLore.add(ChatColor.RESET + "or Purchase at: " + C.cYellow + "www.mineplex.com/shop"); - */ + christmasLore.add(C.cRed + "This item is no longer available!"); } List illuminatedLore = new ArrayList(); @@ -156,7 +234,7 @@ public class TreasurePage extends ShopPageBase illuminatedLore.add(C.cGray + "treasure from the darkness."); illuminatedLore.add(" "); if (illuminatedCount > 0) - illuminatedLore.add(ChatColor.RESET + C.cGreen + "Click to Open!"); + illuminatedLore.add(C.cGreen + "Click to Open!"); else { illuminatedLore.add(ChatColor.RESET + "Click to craft for " + C.cAqua + "20000 Treasure Shards"); @@ -173,7 +251,7 @@ public class TreasurePage extends ShopPageBase freedomLore.add(C.cGray + "of the apple tree he cut down..."); freedomLore.add(" "); if (freedomCount > 0 && !hasAllFreedomItems(getPlayer())) - freedomLore.add(ChatColor.RESET + C.cGreen + "Click to Open!"); + freedomLore.add(C.cGreen + "Click to Open!"); else { freedomLore.add(C.cRed + "This item is no longer available!"); @@ -190,7 +268,7 @@ public class TreasurePage extends ShopPageBase omegaLore.add(C.cGray + "loot that has been lost..."); omegaLore.add(" "); if (omegaCount > 0) - omegaLore.add(ChatColor.RESET + C.cGreen + "Click to Open!"); + omegaLore.add(C.cGreen + "Click to Open!"); else { @@ -206,13 +284,13 @@ public class TreasurePage extends ShopPageBase hauntedLore.add(" "); if (hauntedCount > 0 && !hasAllHauntedItems(getPlayer())) { - hauntedLore.add(ChatColor.RESET + C.cGreen + "Click to Open!"); + hauntedLore.add(C.cGreen + "Click to Open!"); } else { hauntedLore.add(C.cRed + "This item is no longer available!"); } - + List trickLore = Lists.newArrayList(); trickLore.add(" "); trickLore.add(F.value("Trick or Treat Chests Owned", "" + trickCount)); @@ -223,54 +301,319 @@ public class TreasurePage extends ShopPageBase trickLore.add(" "); if (trickCount > 0) { - trickLore.add(ChatColor.RESET + C.cGreen + "Click to Open!"); + trickLore.add(C.cGreen + "Click to Open!"); } else { - trickLore.add(ChatColor.RESET + "Click to craft for " + C.cAqua + "20000 Treasure Shards"); - trickLore.add(" "); - hauntedLore.add(ChatColor.RESET + "or Purchase at: " + C.cYellow + "www.mineplex.com/shop"); + if (!availableTrick) + { + trickLore.add(C.cRed + "This item is no longer available!"); + } + else + { + trickLore.add(ChatColor.RESET + "Click to craft for " + C.cAqua + "20000 Treasure Shards"); + trickLore.add(" "); + trickLore.add(ChatColor.RESET + "or Purchase at: " + C.cYellow + "www.mineplex.com/shop"); + } + } + + List thankLore = Lists.newArrayList(); + thankLore.add(" "); + thankLore.add(F.value("Thankful Chests Owned", "" + thankCount)); + thankLore.add(" "); + thankLore.add(C.cGray + "The Thankful Chest is our way of"); + thankLore.add(C.cGray + "showing thanks to you, containing items from Rank Upgrades to"); + thankLore.add(C.cGray + "Power Play Club Subscriptions, among other things!"); + thankLore.add(" "); + if (thankCount > 0) + { + thankLore.add(C.cGreen + "Click to Open!"); + } + else + { + if (!availableThank) + { + thankLore.add(C.cRed + "This item is no longer available!"); + } + else + { + thankLore.add(ChatColor.RESET + "Click to craft for " + C.cAqua + "20000 Treasure Shards"); + thankLore.add(" "); + thankLore.add(ChatColor.RESET + "or Purchase at: " + C.cYellow + "www.mineplex.com/shop"); + } + } + + List gingerbreadLore = Lists.newArrayList(); + gingerbreadLore.add(" "); + gingerbreadLore.add(F.value("Gingerbread Chests Owned", "" + gingerbreadCount)); + gingerbreadLore.add(" "); + gingerbreadLore.addAll(UtilText.splitLine(C.cGray + "The legendary burglar, " + + "the Gingerbread Man, has finally been caught! Now, for the first time his loot is available for auction." + + " There are 8 pieces available for to collect and no duplicates can be obtained from this chest!", + LineFormat.LORE)); + gingerbreadLore.add(" "); + if (gingerbreadCount > 0) + { + gingerbreadLore.add(C.cGreen + "Click to Open!"); + } + else + { + gingerbreadLore.add(C.cRed + "This item is no longer available!"); + } + + List minestrikeLore = Lists.newArrayList(); + minestrikeLore.add(" "); + minestrikeLore.add(F.value("Minestrike Chests Owned", "" + minestrikeCount)); + minestrikeLore.add(" "); + minestrikeLore.addAll(UtilText.splitLines(new String[] + { + C.cGray + "The Minestrike Chest is the only place to get the unique skins for Minestrike weapons!", + "", + C.cWhite + "Each use opens two chests. Can give duplicates." + }, LineFormat.LORE)); + minestrikeLore.add(" "); + if (minestrikeCount > 0) + { + minestrikeLore.add(C.cGreen + "Click to Open!"); + } + else + { + minestrikeLore.add(ChatColor.RESET + "Click to craft for " + C.cAqua + "10000 Treasure Shards"); + minestrikeLore.add(" "); + minestrikeLore.add(ChatColor.RESET + "or Purchase at: " + C.cYellow + "www.mineplex.com/shop"); + } + + List lovechestLore = Lists.newArrayList(); + lovechestLore.add(" "); + lovechestLore.add(F.value("Love Chests Owned", "" + loveCount)); + lovechestLore.add(" "); + lovechestLore.addAll(UtilText.splitLines(new String[]{C.cGray + "Cupid and his hunters have searched far and wide to collect a whole bunch of lovey dovey items. 6 items, no duplicates."}, LineFormat.LORE)); + lovechestLore.add(" "); + if (loveCount > 0) + { + lovechestLore.add(C.cGreen + "Click to Open!"); + } + else + { + if (!availableLove) + { + lovechestLore.add(C.cRed + "This item is no longer available"); + } + else + { + lovechestLore.add(ChatColor.RESET + "Click to craft for " + C.cAqua + TreasureType.LOVE_CHEST.getPurchasePrice() + " Treasure Shards"); + lovechestLore.add(" "); + lovechestLore.add(ChatColor.RESET + "or Purchase at: " + C.cYellow + "www.mineplex.com/shop"); + } } ShopItem shards = new ShopItem(Material.PRISMARINE_SHARD, C.cAqua + C.Bold + treasureShards + " Treasure Shards", shardLore.toArray(new String[0]), 0, false); + + // Normal chests ShopItem basic = new ShopItem(Material.CHEST, C.cGreen + C.Bold + "Old Treasure", basicLore.toArray(new String[0]), 0, false, false); ShopItem heroic = new ShopItem(Material.TRAPPED_CHEST, C.cGold + C.Bold + "Ancient Treasure", heroicLore.toArray(new String[0]), 0, false, false); ShopItem legendary = new ShopItem(Material.ENDER_CHEST, C.cRed + C.Bold + "Mythical Treasure", legendaryLore.toArray(new String[0]), 0, false, false); - ItemStack christmas = SkinData.PRESENT.getSkull(C.cDGreen + C.Bold + "Winter Holiday Treasure", christmasLore); ItemStack illuminated = new ShopItem(Material.SEA_LANTERN, C.cDAqua + C.Bold + "Illuminated Treasure", illuminatedLore.toArray(new String[0]), 0, false, false); - ItemStack freedom = SkinData.FREEDOM_CHEST.getSkull(C.cRedB + "Freedom " + C.cBlueB + "Treasure", freedomLore); ItemStack omega = SkinData.OMEGA_CHEST.getSkull(C.cAquaB + "Omega Treasure", omegaLore); + ItemStack minestrike = new ShopItem(Material.TNT, C.cGoldB + "Minestrike Treasure", minestrikeLore.toArray(new String[0]), 0, false, false); + + // Seasonal chests + ItemStack christmas = SkinData.PRESENT.getSkull(C.cDGreen + C.Bold + "Winter Holiday Treasure", christmasLore); + ItemStack freedom = SkinData.FREEDOM_CHEST.getSkull(C.cRedB + "Freedom " + C.cBlueB + "Treasure", freedomLore); ItemStack haunted = SkinData.HAUNTED_CHEST.getSkull(C.cGoldB + "Haunted Treasure", hauntedLore); ItemStack trick = new ShopItem(Material.SKULL_ITEM, C.cGoldB + "Trick or Treat Treasure", trickLore.toArray(new String[0]), 0, false, false); + ItemStack thank = new ShopItem(Material.COOKED_CHICKEN, C.cGoldB + "Thankful Treasure", thankLore.toArray(new String[0]), 0, false, false); + ItemStack gingerbread = SkinData.GINGERBREAD.getSkull(C.cRedB + "Gingerbread" + C.cGreenB + " Treasure", gingerbreadLore); + ItemStack lovechest = new ShopItem(Material.WOOL, (byte) 6, C.cRedB + "Love Chest", lovechestLore.toArray(new String[0]), 0, false, false); + // Adds shard item addItem(49, shards); - addChest(4, trick, TreasureType.TRICK_OR_TREAT, trickCount); - addChest(10, christmas, TreasureType.CHRISTMAS, christmasCount); - addChest(12, freedom, TreasureType.FREEDOM, freedomCount); - addChest(14, haunted, TreasureType.HAUNTED, hauntedCount); - addChest(16, omega, TreasureType.OMEGA, omegaCount); - addChest(28, basic, TreasureType.OLD, basicCount); - addChest(30, heroic, TreasureType.ANCIENT, heroicCount); - addChest(32, legendary, TreasureType.MYTHICAL, legendaryCount); - addChest(34, illuminated, TreasureType.ILLUMINATED, illuminatedCount); + // Adds chests to lists, to handle them later + + // Normal chests + TreasurePageItem oldTreasureItem = new TreasurePageItem(basic, basicCount, TreasureType.OLD); + TreasurePageItem ancientTreasureItem = new TreasurePageItem(heroic, heroicCount, TreasureType.ANCIENT); + TreasurePageItem mythicalTreasureItem = new TreasurePageItem(legendary, legendaryCount, TreasureType.MYTHICAL); + TreasurePageItem illuminatedTreasureItem = new TreasurePageItem(illuminated, illuminatedCount, TreasureType.ILLUMINATED); + TreasurePageItem omegaTreasureItem = new TreasurePageItem(omega, omegaCount, TreasureType.OMEGA); + TreasurePageItem minestrikeTreasureItem = new TreasurePageItem(minestrike, minestrikeCount, TreasureType.MINESTRIKE); + + // Seasonal chests + TreasurePageItem winterTreasureItem = new TreasurePageItem(christmas, christmasCount, TreasureType.CHRISTMAS); + TreasurePageItem freedomTreasureItem = new TreasurePageItem(freedom, freedomCount, TreasureType.FREEDOM); + TreasurePageItem hauntedTreasureItem = new TreasurePageItem(haunted, hauntedCount, TreasureType.HAUNTED); + TreasurePageItem trickTreasureItem = new TreasurePageItem(trick, trickCount, TreasureType.TRICK_OR_TREAT); + TreasurePageItem thankTreasureItem = new TreasurePageItem(thank, thankCount, TreasureType.THANKFUL); + TreasurePageItem gingerbreadTreasureItem = new TreasurePageItem(gingerbread, gingerbreadCount, TreasureType.GINGERBREAD); + TreasurePageItem loveChestItem = new TreasurePageItem(lovechest, loveCount, TreasureType.LOVE_CHEST); + + _normalTreasures.add(oldTreasureItem); + _normalTreasures.add(ancientTreasureItem); + _normalTreasures.add(mythicalTreasureItem); + _normalTreasures.add(illuminatedTreasureItem); + _normalTreasures.add(omegaTreasureItem); + _normalTreasures.add(minestrikeTreasureItem); + + if (availableLove) + _specialTreasures.add(loveChestItem); + else + _seasonalTreasures.add(loveChestItem); + + if (availableChristmas) + _specialTreasures.add(winterTreasureItem); + else + _seasonalTreasures.add(winterTreasureItem); + + if (availableFreedom) + _specialTreasures.add(freedomTreasureItem); + else + _seasonalTreasures.add(freedomTreasureItem); + + if (availableHaunted) + _specialTreasures.add(hauntedTreasureItem); + else + _seasonalTreasures.add(hauntedTreasureItem); + + if (availableTrick) + _specialTreasures.add(trickTreasureItem); + else + _seasonalTreasures.add(trickTreasureItem); + + if (availableThank) + _specialTreasures.add(thankTreasureItem); + else + _seasonalTreasures.add(thankTreasureItem); + + if (availableGingerbread) + _specialTreasures.add(gingerbreadTreasureItem); + else + _seasonalTreasures.add(gingerbreadTreasureItem); } - private void addChest(int slot, ItemStack item, TreasureType treasureType, int owned) + private void buildFirstPage() { + int i = 0; + if (_specialTreasures.size() >= 0) + { + int[] specialDisplayPositions = getSpecialDisplayOrder(); + for (TreasurePageItem treasurePageItem : _specialTreasures) + { + addChest(treasurePageItem, specialDisplayPositions[i]); + i++; + } + } + + i = 0; + int[] normalDisplayPositions = getNormalDisplayOrder(); + for (TreasurePageItem treasurePageItem : _normalTreasures) + { + addChest(treasurePageItem, normalDisplayPositions[i]); + i++; + } + + ItemStack nextPage = ItemStackFactory.Instance.CreateStack(Material.ARROW, (byte) 0, 1, C.cGreen + "Next Page"); + NextPageButton nextPageButton = new NextPageButton(this, _player); + addButton(53, nextPage, nextPageButton); + } + + private void buildSecondPage() + { + int i = 0; + int[] seasonalDisplayPositions = getSeasonalDisplayOrder(); + for (TreasurePageItem treasurePageItem : _seasonalTreasures) + { + addChest(treasurePageItem, seasonalDisplayPositions[i]); + i++; + } + + ItemStack previousPage = ItemStackFactory.Instance.CreateStack(Material.ARROW, (byte) 0, 1, C.cGreen + "Previous Page"); + PreviousPageButton previousPageButton = new PreviousPageButton(this, _player); + addButton(45, previousPage, previousPageButton); + } + + private void addChest(TreasurePageItem treasurePageItem, int position) + { + ItemStack item = treasurePageItem.getItem(); + int owned = treasurePageItem.getCount(); + TreasureType treasureType = treasurePageItem.getTreasureType(); + if (owned > 0) { - addButton(slot, item, new OpenTreasureButton(getPlayer(), _treasureLocation, treasureType)); + addButton(position, item, new OpenTreasureButton(getPlayer(), _treasureLocation, treasureType)); } else if (treasureType.isPurchasable()) { - addButton(slot, item, new BuyChestButton(_inventoryManager, this, treasureType.getItemName(), Material.CHEST, treasureType.getPurchasePrice(), treasureType)); - } + addButton(position, item, new BuyChestButton(_inventoryManager, this, treasureType.getItemName(), Material.CHEST, treasureType.getPurchasePrice(), treasureType)); + } else { - setItem(slot, item); + setItem(position, item); } } + private int[] getSpecialDisplayOrder() + { + int specialTreasuresSize = _specialTreasures.size(); + switch (specialTreasuresSize) + { + case 1: + return new int[]{4}; + case 2: + return new int[]{3, 5}; + case 3: + return new int[]{2, 4, 6}; + case 4: + return new int[]{1, 3, 5, 7}; + } + return new int[]{4}; + } + + private int[] getNormalDisplayOrder() + { + int normalTreasuresSize = _normalTreasures.size(); + switch (normalTreasuresSize) + { + case 5: + return new int[]{20, 22, 24, 39, 41}; + case 6: + return new int[]{19, 21, 23, 25, 38, 42}; + case 7: + return new int[]{19, 21, 23, 25, 38, 40, 42}; + case 8: + return new int[]{19, 21, 23, 25, 37, 39, 41, 43}; + case 9: + return new int[]{19, 21, 23, 25, 31, 37, 39, 41, 43}; + case 10: + return new int[]{19, 21, 23, 25, 29, 33, 37, 39, 41, 43}; + case 11: + return new int[]{19, 21, 23, 25, 29, 31, 33, 37, 39, 32, 43}; + } + return new int[]{20, 22, 24, 39, 41}; + } + + private int[] getSeasonalDisplayOrder() + { + int seasonalTreasuresSize = _seasonalTreasures.size(); + switch (seasonalTreasuresSize) + { + case 5: + return new int[]{11, 13, 15, 30, 32}; + case 6: + return new int[]{10, 12, 14, 16, 29, 33}; + case 7: + return new int[]{10, 12, 14, 16, 29, 31, 33}; + case 8: + return new int[]{10, 12, 14, 16, 28, 30, 32, 34}; + case 9: + return new int[]{10, 12, 14, 16, 22, 28, 30, 32, 34}; + case 10: + return new int[]{10, 12, 14, 16, 20, 24, 28, 30, 32, 34}; + case 11: + return new int[]{10, 12, 14, 16, 20, 22, 24, 28, 30, 32, 34}; + } + return new int[]{11, 13, 15, 30, 32}; + } + public boolean hasAllFreedomItems(Player player) { return !getPlugin().hasItemsToGivePlayer(TreasureType.FREEDOM.getRewardPool(), player); @@ -313,4 +656,5 @@ public class TreasurePage extends ShopPageBase } return amount; } + } diff --git a/Plugins/Mineplex.Core/src/mineplex/core/treasure/gui/TreasurePageItem.java b/Plugins/Mineplex.Core/src/mineplex/core/treasure/gui/TreasurePageItem.java new file mode 100644 index 000000000..6a68fce5c --- /dev/null +++ b/Plugins/Mineplex.Core/src/mineplex/core/treasure/gui/TreasurePageItem.java @@ -0,0 +1,35 @@ +package mineplex.core.treasure.gui; + +import org.bukkit.inventory.ItemStack; + +import mineplex.core.treasure.TreasureType; + +public class TreasurePageItem +{ + + private final ItemStack _item; + private final int _count; + private final TreasureType _treasureType; + + public TreasurePageItem(ItemStack item, int count, TreasureType treasureType) + { + _item = item; + _count = count; + _treasureType = treasureType; + } + + public ItemStack getItem() + { + return _item; + } + + public int getCount() + { + return _count; + } + + public TreasureType getTreasureType() + { + return _treasureType; + } +} diff --git a/Plugins/Mineplex.Core/src/mineplex/core/treasure/gui/pages/NextPageButton.java b/Plugins/Mineplex.Core/src/mineplex/core/treasure/gui/pages/NextPageButton.java new file mode 100644 index 000000000..a26b6446c --- /dev/null +++ b/Plugins/Mineplex.Core/src/mineplex/core/treasure/gui/pages/NextPageButton.java @@ -0,0 +1,32 @@ +package mineplex.core.treasure.gui.pages; + +import org.bukkit.entity.Player; +import org.bukkit.event.inventory.ClickType; + +import mineplex.core.shop.item.IButton; +import mineplex.core.treasure.gui.TreasurePage; + +public class NextPageButton implements IButton +{ + + private TreasurePage _treasurePage; + private Player _player; + + public NextPageButton(TreasurePage treasurePage, Player player) + { + _treasurePage = treasurePage; + _player = player; + } + + @Override + public void onClick(Player player, ClickType clickType) + { + if (_player != player) + return; + player.closeInventory(); + TreasurePage nextPage = new TreasurePage(_treasurePage.getTreasureManager(), _treasurePage.getTreasureShop(), _treasurePage.getTreasureLocation(), + _treasurePage.getClientManager(), _treasurePage.getDonationManager(), _treasurePage.getInventoryManager(), + _treasurePage.getGadgetManager(), _player, _treasurePage.getActualPage() + 1); + _treasurePage.getTreasureShop().openPageForPlayer(player, nextPage); + } +} diff --git a/Plugins/Mineplex.Core/src/mineplex/core/treasure/gui/pages/PreviousPageButton.java b/Plugins/Mineplex.Core/src/mineplex/core/treasure/gui/pages/PreviousPageButton.java new file mode 100644 index 000000000..f6684b427 --- /dev/null +++ b/Plugins/Mineplex.Core/src/mineplex/core/treasure/gui/pages/PreviousPageButton.java @@ -0,0 +1,33 @@ +package mineplex.core.treasure.gui.pages; + +import org.bukkit.entity.Player; +import org.bukkit.event.inventory.ClickType; + +import mineplex.core.shop.item.IButton; +import mineplex.core.treasure.gui.TreasurePage; + +public class PreviousPageButton implements IButton +{ + + private TreasurePage _treasurePage; + private Player _player; + + public PreviousPageButton(TreasurePage treasurePage, Player player) + { + _treasurePage = treasurePage; + _player = player; + } + + @Override + public void onClick(Player player, ClickType clickType) + { + if (_player != player) + return; + player.closeInventory(); + TreasurePage previousPage = new TreasurePage(_treasurePage.getTreasureManager(), _treasurePage.getTreasureShop(), _treasurePage.getTreasureLocation(), + _treasurePage.getClientManager(), _treasurePage.getDonationManager(), _treasurePage.getInventoryManager(), + _treasurePage.getGadgetManager(), _player, _treasurePage.getActualPage() - 1); + _treasurePage.getTreasureShop().openPageForPlayer(player, previousPage); + } + +} diff --git a/Plugins/Mineplex.Core/src/mineplex/core/twofactor/TwoFactorAuth.java b/Plugins/Mineplex.Core/src/mineplex/core/twofactor/TwoFactorAuth.java new file mode 100644 index 000000000..32107d3f6 --- /dev/null +++ b/Plugins/Mineplex.Core/src/mineplex/core/twofactor/TwoFactorAuth.java @@ -0,0 +1,399 @@ +package mineplex.core.twofactor; + +import java.util.HashMap; +import java.util.HashSet; +import java.util.Map; +import java.util.Set; +import java.util.UUID; + +import org.bukkit.Bukkit; +import org.bukkit.Material; +import org.bukkit.entity.Player; +import org.bukkit.event.EventHandler; +import org.bukkit.event.EventPriority; +import org.bukkit.event.inventory.InventoryClickEvent; +import org.bukkit.event.inventory.InventoryDragEvent; +import org.bukkit.event.player.AsyncPlayerChatEvent; +import org.bukkit.event.player.PlayerCommandPreprocessEvent; +import org.bukkit.event.player.PlayerDropItemEvent; +import org.bukkit.event.player.PlayerInteractEntityEvent; +import org.bukkit.event.player.PlayerInteractEvent; +import org.bukkit.event.player.PlayerItemHeldEvent; +import org.bukkit.event.player.PlayerJoinEvent; +import org.bukkit.event.player.PlayerMoveEvent; +import org.bukkit.event.player.PlayerQuitEvent; +import org.bukkit.inventory.ItemStack; +import org.bukkit.map.MapRenderer; +import org.bukkit.map.MapView; + +import com.warrenstrange.googleauth.GoogleAuthenticator; +import com.warrenstrange.googleauth.GoogleAuthenticatorConfig; + +import mineplex.core.Managers; +import mineplex.core.MiniClientPlugin; +import mineplex.core.ReflectivelyCreateMiniPlugin; +import mineplex.core.account.CoreClientManager; +import mineplex.core.command.CommandBase; +import mineplex.core.common.Rank; +import mineplex.core.common.util.BukkitFuture; +import mineplex.core.common.util.F; +import mineplex.core.common.util.UtilServer; +import mineplex.core.recharge.Recharge; +import mineplex.serverdata.commands.TwoFactorResetCommand; +import mineplex.serverdata.database.DBPool; + +@ReflectivelyCreateMiniPlugin +public class TwoFactorAuth extends MiniClientPlugin +{ + private final Map setupData = new HashMap<>(); + private final Set authenticating = new HashSet<>(); + + private static final GoogleAuthenticator authenticator = new GoogleAuthenticator( + new GoogleAuthenticatorConfig.GoogleAuthenticatorConfigBuilder().setWindowSize(5).build() + ); + private final CoreClientManager _clientManager = Managers.require(CoreClientManager.class); + private final TwoFactorRepository _repository = new TwoFactorRepository(DBPool.getAccount()); + + public TwoFactorAuth() + { + super("Two-factor Authentication"); + _clientManager.addStoredProcedureLoginProcessor( + _repository.buildSecretKeyLoginProcessor((uuid, secretKey) -> Get(uuid).setSecretKey(secretKey)) + ); + _clientManager.addStoredProcedureLoginProcessor( + _repository.buildLastIpLoginProcessor((uuid, ip) -> Get(uuid).setLastLoginIp(ip)) + ); + } + + @Override + public void addCommands() + { + addCommand(new CommandBase(this, Rank.MAPDEV, "2fa", "tfa") + { + @Override + public void Execute(Player caller, String[] args) + { + if (args.length < 1 || !args[0].toLowerCase().equals("reset")) + { + if (_clientManager.Get(caller).GetRank(true).has(Rank.ADMIN)) + { + caller.sendMessage(F.main("2FA", "Usage: /2fa reset [player]")); + } + else + { + caller.sendMessage(F.main("2FA", "Usage: /2fa reset")); + } + return; + } + + if (args.length == 1) // Resetting their own 2FA + { + caller.sendMessage(F.main("2FA", "Resetting 2FA..")); + runAsync(() -> + { + new TwoFactorResetCommand(caller.getName(), caller.getUniqueId().toString(), caller.getName(), caller.getUniqueId().toString()).publish(); + }); + _repository.deletePlayerData(_clientManager.getAccountId(caller)).whenComplete(BukkitFuture.complete((__, err) -> + { + if (err != null) + { + caller.sendMessage(F.main("2FA", "Something went wrong. Have you already reset 2FA?")); + err.printStackTrace(); + } + else + { + caller.sendMessage(F.main("2FA", "Successfully reset.")); + setup2FA(caller); + } + })); + return; + } + + if (!_clientManager.Get(caller).GetRank(true).has(Rank.ADMIN)) + { + caller.sendMessage(F.main("2FA", "Only admins can reset 2FA for other players")); + return; + } + + _clientManager.getOrLoadClient(args[1], client -> + { + if (client == null) + { + caller.sendMessage(F.main("2FA", "Couldn't find player with the name \"" + args[1] + "\"")); + return; + } + + caller.sendMessage(F.main("2FA", "Resetting 2FA for \"" + client.getName() + "\"")); + runAsync(() -> + { + new TwoFactorResetCommand(caller.getName(), caller.getUniqueId().toString(), client.getName(), client.getUniqueId() == null ? "null" : client.getUniqueId().toString()).publish(); + }); + _repository.deletePlayerData(client.getAccountId()).whenComplete(BukkitFuture.complete((__, err) -> + { + if (err != null) + { + caller.sendMessage(F.main("2FA", "Something went wrong. Maybe they've already reset 2FA?")); + } + else + { + caller.sendMessage(F.main("2FA", "Successfully reset.")); + if (client.GetPlayer() != null) + { + setup2FA(client.GetPlayer()); + } + } + })); + }); + } + }); + } + + public boolean isAuthenticating(Player player) + { + return authenticating.contains(player.getUniqueId()) || setupData.containsKey(player.getUniqueId()); + } + + private void setup2FA(Player player) + { + String secret = authenticator.createCredentials().getKey(); + + MapView view = Bukkit.createMap(player.getWorld()); + for (MapRenderer renderer : view.getRenderers()) + { + view.removeRenderer(renderer); + } + view.addRenderer(new TwoFactorMapRenderer(player, UtilServer.isTestServer() ? "Mineplex%20Test" : "Mineplex", secret)); + + ItemStack stack = new ItemStack(Material.MAP); + stack.setDurability(view.getId()); + + // Find first free hotbar slot + int slot = 0; + for (int i = 0; i < 9; i++) + { + if (player.getInventory().getItem(i) == null) + { + slot = i; + break; + } + } + + player.getInventory().setHeldItemSlot(slot); + player.getInventory().setItemInHand(stack); + + setupData.put(player.getUniqueId(), secret); + player.sendMessage(F.main("2FA", "Setting up two-factor authentication.")); + } + + @EventHandler + public void onJoin(PlayerJoinEvent event) + { + Player player = event.getPlayer(); + + TwoFactorData data = Get(player); + + if ((data.getLastLoginIp().isPresent() && player.getAddress().getAddress().toString().substring(1).equals(data.getLastLoginIp().get())) || _clientManager.Get(player).GetRank(true) == Rank.SUPPORT) + { + player.sendMessage(F.main("2FA", "Authenticated")); + return; + } + + if (data.getSecretKey().isPresent()) + { + // Hooray 2FA + player.sendMessage(F.main("2FA", "Please enter your two-factor auth code")); + authenticating.add(player.getUniqueId()); + } + else + { + // 2FA not set up yet. + if (_clientManager.Get(player).GetRank(true).has(Rank.MAPDEV)) + { + runSync(() -> setup2FA(event.getPlayer())); + } + } + } + + @EventHandler + public void onQuit(PlayerQuitEvent event) + { + Player player = event.getPlayer(); + if (setupData.remove(player.getUniqueId()) != null) + { + player.setItemInHand(null); + } + authenticating.remove(player.getUniqueId()); + } + + @EventHandler(priority = EventPriority.LOWEST) + public void onChat(AsyncPlayerChatEvent event) + { + Player player = event.getPlayer(); + + String secret = null; // Check setup data first + + if (setupData.containsKey(player.getUniqueId())) + { + secret = setupData.get(player.getUniqueId()); + } + else if (authenticating.contains(player.getUniqueId())) + { + secret = Get(player).getSecretKey().get(); + } + + if (secret == null) + { + return; + } + + // Hooray 2FA - let's see if their message matches their auth code + + event.setCancelled(true); + + int code; + try + { + code = Integer.parseInt(event.getMessage().replaceAll(" ", "")); + } + catch (NumberFormatException e) + { + player.sendMessage(F.main("2FA", "Invalid authentication code (not a number).")); + return; + } + + if (!authenticator.authorize(secret, code)) + { + player.sendMessage(F.main("2FA", "Invalid authentication code.")); + return; + } + + // Success! + + player.sendMessage(F.main("2FA", "Authorized for 24 hours.")); + + if (setupData.containsKey(player.getUniqueId())) + { + // Remove setup map + save secret + player.setItemInHand(null); + Get(player).setSecretKey(secret); + + player.sendMessage(F.main("2FA", "Saving secret..")); + _repository.saveSecret(player, secret).whenComplete(BukkitFuture.complete((v, throwable) -> + { + if (!player.isOnline()) + { + return; + } + + if (throwable != null) + { + Get(player).setSecretKey(null); + player.sendMessage(F.main("2FA", "Something went wrong. Please try again in a moment.")); + } + else + { + player.sendMessage(F.main("2FA", "Secret key saved.")); + } + })); + } + + _repository.saveLogin(player, player.getAddress().getAddress().toString().substring(1)); + + setupData.remove(player.getUniqueId()); + authenticating.remove(player.getUniqueId()); + } + + // Cancel relevant events + + @EventHandler(ignoreCancelled = true) + public void onChangeHeldItem(PlayerItemHeldEvent event) + { + Player player = event.getPlayer(); + if (setupData.containsKey(player.getUniqueId())) + { + event.setCancelled(true); + } + } + + @EventHandler(priority = EventPriority.LOWEST, ignoreCancelled = true) + public void onClick(InventoryClickEvent event) + { + Player player = (Player) event.getWhoClicked(); + if (isAuthenticating(player)) + { + event.setCancelled(true); + } + } + + @EventHandler(priority = EventPriority.LOWEST, ignoreCancelled = true) + public void onDrag(InventoryDragEvent event) + { + Player player = (Player) event.getWhoClicked(); + if (isAuthenticating(player)) + { + event.setCancelled(true); + } + } + + @EventHandler(priority = EventPriority.LOWEST, ignoreCancelled = true) + public void onDrop(PlayerDropItemEvent event) + { + Player player = event.getPlayer(); + if (isAuthenticating(player)) + { + event.setCancelled(true); + } + } + + @EventHandler(priority = EventPriority.LOWEST) + public void onInteract(PlayerInteractEvent event) + { + Player player = event.getPlayer(); + if (isAuthenticating(player)) + { + event.setCancelled(true); + } + } + + @EventHandler(priority = EventPriority.LOWEST, ignoreCancelled = true) + public void onInteractWithEntity(PlayerInteractEntityEvent event) + { + Player player = event.getPlayer(); + if (isAuthenticating(player)) + { + event.setCancelled(true); + } + } + + @EventHandler(priority = EventPriority.LOWEST) + public void onCommand(PlayerCommandPreprocessEvent event) + { + Player player = event.getPlayer(); + if (isAuthenticating(player)) + { + event.setMessage("/"); + event.setCancelled(true); + } + } + + @EventHandler(priority = EventPriority.LOWEST, ignoreCancelled = true) + public void onMove(PlayerMoveEvent event) + { + Player player = event.getPlayer(); + if (isAuthenticating(player)) + { + if (Recharge.Instance.use(player, "two-factor message cooldown", 3000L, false, false)) + { + player.sendMessage(F.main("2FA", "Please enter your two-factor auth code")); + } + event.getTo().setX(event.getFrom().getX()); + event.getTo().setZ(event.getFrom().getZ()); + } + } + + @Override + protected TwoFactorData addPlayer(UUID uuid) + { + return new TwoFactorData(); + } +} diff --git a/Plugins/Mineplex.Core/src/mineplex/core/twofactor/TwoFactorData.java b/Plugins/Mineplex.Core/src/mineplex/core/twofactor/TwoFactorData.java new file mode 100644 index 000000000..faff1adb3 --- /dev/null +++ b/Plugins/Mineplex.Core/src/mineplex/core/twofactor/TwoFactorData.java @@ -0,0 +1,29 @@ +package mineplex.core.twofactor; + +import java.util.Optional; + +public class TwoFactorData +{ + private String _secretKey; + private String _lastIp; + + public Optional getSecretKey() + { + return Optional.ofNullable(_secretKey); + } + + public Optional getLastLoginIp() + { + return Optional.ofNullable(_lastIp); + } + + public void setSecretKey(String secretKey) + { + _secretKey = secretKey; + } + + public void setLastLoginIp(String lastIp) + { + _lastIp = lastIp; + } +} diff --git a/Plugins/Mineplex.Core/src/mineplex/core/twofactor/TwoFactorMapRenderer.java b/Plugins/Mineplex.Core/src/mineplex/core/twofactor/TwoFactorMapRenderer.java new file mode 100644 index 000000000..f987683c6 --- /dev/null +++ b/Plugins/Mineplex.Core/src/mineplex/core/twofactor/TwoFactorMapRenderer.java @@ -0,0 +1,155 @@ +package mineplex.core.twofactor; + +import java.util.Arrays; + +import org.bukkit.entity.Player; +import org.bukkit.map.MapCanvas; +import org.bukkit.map.MapFont; +import org.bukkit.map.MapRenderer; +import org.bukkit.map.MapView; +import org.bukkit.map.MinecraftFont; + +import com.google.common.base.Joiner; +import com.google.common.base.Splitter; +import com.google.common.collect.ImmutableMap; +import com.google.zxing.BarcodeFormat; +import com.google.zxing.EncodeHintType; +import com.google.zxing.WriterException; +import com.google.zxing.common.BitMatrix; +import com.google.zxing.qrcode.QRCodeWriter; + +public class TwoFactorMapRenderer extends MapRenderer +{ + private static final String SETUP_TEXT = + "\u00A7100;Two-factor Auth Setup\n\n" + + "\u00A744;1. Use your device to\n" + + "scan the QR code, or\n" + + "enter your \u00A716;secret code:\n" + + "\u00A728;%s\n\n" + + "\u00A744;2. Type the\n" + + "code from\n" + + "the app\n" + + "in chat."; + private static final MapFont FONT = MinecraftFont.Font; + private static final byte QR_COLOR = (byte)116; // Black + private static final QRCodeWriter writer = new QRCodeWriter(); + + private final Player _player; + private final byte[][] contents = new byte[128][128]; + + public TwoFactorMapRenderer(Player player, String issuer, String secret) + { + _player = player; + + BitMatrix matrix; + try + { + matrix = writer.encode(String.format("otpauth://totp/%s?secret=%s&issuer=%s", _player.getName(), secret, issuer), BarcodeFormat.QR_CODE, 32, 32, ImmutableMap.of(EncodeHintType.MARGIN, 0)); + + } + catch (WriterException e) + { + e.printStackTrace(); + return; + } + + // Set background color to white + for (byte[] column : contents) + { + Arrays.fill(column, (byte)32); + } + + String spacedSecret = Joiner.on(' ').join(Splitter.fixedLength(4).split(secret)); + renderText(contents, 2, 2, String.format(SETUP_TEXT, spacedSecret)); + renderQR(contents, 62, 62, matrix, 2); + + } + + private static void renderText(byte[][] contents, int startX, int startY, String text) + { + int x = startX; + int y = startY; + byte color = (byte)44; + + for (int i = 0; i < text.length(); i++) + { + char c = text.charAt(i); + if (c == '\n') + { + x = startX; + y += FONT.getHeight() + 1; + continue; + } + + if (c == '\u00A7') + { + int end = text.indexOf(';', i); + if (end >= 0) + { + color = Byte.parseByte(text.substring(i+1, end)); + i = end; + continue; + } + } + + MapFont.CharacterSprite sprite = FONT.getChar(c); + for (int k = 0; k < sprite.getWidth(); k++) + { + for (int l = 0; l < FONT.getHeight(); l++) + { + if (sprite.get(l, k)) + { + if (x+k >= 128 || y+l >= 128) + { + continue; + } + contents[x+k][y+l] = color; + } + } + } + x += sprite.getWidth() + 1; + } + } + + private static void renderQR(byte[][] contents, int x, int y, BitMatrix matrix, int scale) + { + for (int matrixX = 0 ; matrixX < matrix.getWidth(); matrixX++) + { + for (int matrixY = 0; matrixY < matrix.getHeight(); matrixY++) + { + + if (matrix.get(matrixX, matrixY)) + { + for (int i = 0; i < scale; i++) + { + for (int k = 0; k < scale; k++) + { + if (x + (matrixX * scale) + i >= 128 || y + (matrixY * scale) + k >= 128) + { + continue; + } + contents[x + (matrixX * scale) + i][y + (matrixY * scale) + k] = QR_COLOR; + } + } + } + } + } + } + + @Override + public void render(MapView mapView, MapCanvas mapCanvas, Player player) + { + if (player != _player) + { + return; + } + + for (int x = 0; x < 128; x++) + { + for (int y = 0; y < 128; y++) + { + mapCanvas.setPixel(x, y, contents[x][y]); + } + } + } +} diff --git a/Plugins/Mineplex.Core/src/mineplex/core/twofactor/TwoFactorRepository.java b/Plugins/Mineplex.Core/src/mineplex/core/twofactor/TwoFactorRepository.java new file mode 100644 index 000000000..b2afff3c0 --- /dev/null +++ b/Plugins/Mineplex.Core/src/mineplex/core/twofactor/TwoFactorRepository.java @@ -0,0 +1,147 @@ +package mineplex.core.twofactor; + +import javax.sql.DataSource; +import java.sql.Connection; +import java.sql.PreparedStatement; +import java.sql.ResultSet; +import java.sql.SQLException; +import java.util.UUID; +import java.util.concurrent.CompletableFuture; +import java.util.concurrent.CompletionException; +import java.util.function.BiConsumer; + +import org.bukkit.entity.Player; + +import mineplex.core.Managers; +import mineplex.core.account.CoreClientManager; +import mineplex.core.account.ILoginProcessor; + +public class TwoFactorRepository +{ + private static final String INSERT_SECRET_KEY = "INSERT INTO twofactor (accountId,secretKey) VALUES (?,?);"; + private static final String DELETE_SECRET_KEY = "DELETE FROM twofactor WHERE accountId=?;"; + private static final String INSERT_LOGIN = "INSERT INTO twofactor_history (accountId,ip,loginTime) VALUES (?,?,NOW());"; + private static final String DELETE_RECENT_LOGINS = "DELETE FROM twofactor_history WHERE accountId=? AND loginTime >= DATE_SUB(NOW(), INTERVAL 1 DAY);"; + private final CoreClientManager _clientManager = Managers.require(CoreClientManager.class); + private final DataSource _dataSource; + + public TwoFactorRepository(DataSource source) + { + _dataSource = source; + } + + public ILoginProcessor buildSecretKeyLoginProcessor(BiConsumer consumer) + { + return new ILoginProcessor() + { + @Override + public String getName() + { + return "Two-factor auth secret key grabber"; + } + + @Override + public void processLoginResultSet(String playerName, UUID uuid, int accountId, ResultSet resultSet) throws SQLException + { + if (resultSet.next()) + { + consumer.accept(uuid, resultSet.getString(1)); + } + } + + @Override + public String getQuery(int accountId, String uuid, String name) + { + return "SELECT secretKey FROM twofactor WHERE accountId=" + accountId + ";"; + } + }; + } + + public ILoginProcessor buildLastIpLoginProcessor(BiConsumer consumer) + { + return new ILoginProcessor() + { + @Override + public String getName() + { + return "Two-factor auth last login grabber"; + } + + @Override + public void processLoginResultSet(String playerName, UUID uuid, int accountId, ResultSet resultSet) throws SQLException + { + if (resultSet.next()) + { + consumer.accept(uuid, resultSet.getString(1)); + } + } + + @Override + public String getQuery(int accountId, String uuid, String name) + { + return "SELECT ip FROM twofactor_history WHERE accountId=" + accountId + " AND loginTime >= DATE_SUB(NOW(), INTERVAL 1 DAY) ORDER BY loginTime DESC;"; + } + }; + } + + public CompletableFuture saveSecret(Player player, String secret) + { + int accountId = _clientManager.Get(player).getAccountId(); + + return CompletableFuture.runAsync(() -> + { + try (Connection connection = _dataSource.getConnection()) + { + PreparedStatement statement = connection.prepareStatement(INSERT_SECRET_KEY); + statement.setInt(1, accountId); + statement.setString(2, secret); + statement.executeUpdate(); + } + catch (SQLException e) + { + throw new CompletionException(e); + } + }); + } + + public CompletableFuture saveLogin(Player player, String ip) + { + int accountId = _clientManager.Get(player).getAccountId(); + + return CompletableFuture.runAsync(() -> + { + try (Connection connection = _dataSource.getConnection()) + { + PreparedStatement statement = connection.prepareStatement(INSERT_LOGIN); + statement.setInt(1, accountId); + statement.setString(2, ip); + statement.executeUpdate(); + } + catch (SQLException e) + { + throw new CompletionException(e); + } + }); + } + + public CompletableFuture deletePlayerData(int accountId) + { + return CompletableFuture.runAsync(() -> + { + try (Connection connection = _dataSource.getConnection()) + { + PreparedStatement statement = connection.prepareStatement(DELETE_SECRET_KEY); + statement.setInt(1, accountId); + statement.executeUpdate(); + + statement = connection.prepareStatement(DELETE_RECENT_LOGINS); + statement.setInt(1, accountId); + statement.executeUpdate(); + } + catch (SQLException e) + { + throw new CompletionException(e); + } + }); + } +} diff --git a/Plugins/Mineplex.Core/src/mineplex/core/updater/FileUpdater.java b/Plugins/Mineplex.Core/src/mineplex/core/updater/FileUpdater.java index 5df3e3a33..be2a4a954 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/updater/FileUpdater.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/updater/FileUpdater.java @@ -6,13 +6,13 @@ import java.io.FilenameFilter; import java.io.IOException; import java.util.Properties; -import mineplex.core.updater.command.BuildVersionCommand; -import mineplex.core.updater.command.RestartServerCommand; import org.apache.commons.codec.digest.DigestUtils; +import org.apache.commons.lang.StringUtils; import org.bukkit.Bukkit; import org.bukkit.entity.Player; import org.bukkit.event.EventHandler; import org.bukkit.event.EventPriority; +import org.bukkit.event.server.ServerCommandEvent; import org.bukkit.event.server.ServerListPingEvent; import org.bukkit.plugin.java.JavaPlugin; @@ -20,7 +20,11 @@ import mineplex.core.MiniPlugin; import mineplex.core.common.util.C; import mineplex.core.common.util.F; import mineplex.core.common.util.NautHashMap; +import mineplex.core.portal.GenericServer; +import mineplex.core.portal.Intent; import mineplex.core.portal.Portal; +import mineplex.core.updater.command.BuildVersionCommand; +import mineplex.core.updater.command.RestartServerCommand; import mineplex.core.updater.event.RestartServerEvent; import mineplex.core.updater.event.UpdateEvent; import mineplex.serverdata.Region; @@ -34,19 +38,21 @@ public class FileUpdater extends MiniPlugin private String _serverName; private Region _region; + private final GenericServer _transferHub; private boolean _needUpdate; private boolean _enabled = true; private Properties _buildProperties; - public FileUpdater(JavaPlugin plugin, Portal portal, String serverName, Region region) + public FileUpdater(JavaPlugin plugin, Portal portal, String serverName, Region region, GenericServer transferHub) { super("File Updater", plugin); _portal = portal; _serverName = serverName; _region = region; + _transferHub = transferHub; GetPluginMd5s(); @@ -65,6 +71,22 @@ public class FileUpdater extends MiniPlugin addCommand(new RestartServerCommand(this)); addCommand(new BuildVersionCommand(this)); } + + @EventHandler + public void onServerCommand(ServerCommandEvent event) + { + if (event.getCommand().startsWith("updatekickall ")) + { + String[] args = event.getCommand().split(" "); + String message = StringUtils.join(args, " ", 1, args.length); + + for (Player player : Bukkit.getOnlinePlayers()) + { + player.sendMessage(F.main("Updater", message)); + _portal.sendPlayerToGenericServer(player, _transferHub, Intent.KICK); + } + } + } @EventHandler public void tryToRestart(UpdateEvent event) @@ -90,7 +112,7 @@ public class FileUpdater extends MiniPlugin { public void run() { - _portal.sendAllPlayers("Lobby"); + _portal.sendAllPlayersToGenericServer(_transferHub, Intent.KICK); } }, 60L); diff --git a/Plugins/Mineplex.Core/src/mineplex/core/updater/RestartHandler.java b/Plugins/Mineplex.Core/src/mineplex/core/updater/RestartHandler.java index de7e613fe..e37961ef9 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/updater/RestartHandler.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/updater/RestartHandler.java @@ -1,6 +1,8 @@ package mineplex.core.updater; import mineplex.core.common.util.F; +import mineplex.core.portal.GenericServer; +import mineplex.core.portal.Intent; import mineplex.core.portal.Portal; import mineplex.serverdata.Region; import mineplex.serverdata.commands.CommandCallback; @@ -60,7 +62,7 @@ public class RestartHandler implements CommandCallback, Listener { public void run() { - Portal.getInstance().sendAllPlayers("Lobby"); + Portal.getInstance().sendAllPlayersToGenericServer(GenericServer.HUB, Intent.KICK); } }, 60L); diff --git a/Plugins/Mineplex.Core/src/mineplex/core/utils/UtilGameProfile.java b/Plugins/Mineplex.Core/src/mineplex/core/utils/UtilGameProfile.java index 4d48e4ccc..5ee0a41ce 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/utils/UtilGameProfile.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/utils/UtilGameProfile.java @@ -1,16 +1,5 @@ package mineplex.core.utils; -import com.google.common.cache.Cache; -import com.google.common.cache.CacheBuilder; -import com.mojang.authlib.GameProfile; -import mineplex.core.Managers; -import mineplex.core.profileCache.ProfileCacheManager; -import mineplex.core.thread.ThreadPool; -import net.minecraft.server.v1_8_R3.EntityPlayer; -import net.minecraft.server.v1_8_R3.MinecraftServer; -import org.bukkit.craftbukkit.v1_8_R3.entity.CraftPlayer; -import org.bukkit.entity.Player; - import java.lang.reflect.Field; import java.lang.reflect.Modifier; import java.util.UUID; @@ -19,6 +8,23 @@ import java.util.concurrent.TimeUnit; import java.util.function.Consumer; import java.util.regex.Pattern; +import net.minecraft.server.v1_8_R3.EntityPlayer; +import net.minecraft.server.v1_8_R3.MinecraftServer; + +import org.bukkit.craftbukkit.v1_8_R3.entity.CraftPlayer; +import org.bukkit.entity.Player; +import org.bukkit.inventory.ItemStack; +import org.bukkit.inventory.meta.ItemMeta; +import org.bukkit.inventory.meta.SkullMeta; + +import com.google.common.cache.Cache; +import com.google.common.cache.CacheBuilder; +import com.mojang.authlib.GameProfile; + +import mineplex.core.Managers; +import mineplex.core.profileCache.ProfileCacheManager; +import mineplex.core.thread.ThreadPool; + public class UtilGameProfile { private static final Cache TEXTURES = CacheBuilder.newBuilder() @@ -28,13 +34,12 @@ public class UtilGameProfile /** * Get a {@link GameProfile} given a username. - * + *

* If you desperately must block the current thread, you may pass a null Consumer and use Future.get() * * @param username The username of the player - * @param nonNull If true, an OfflinePlayer GameProfile will be returned should the username not be valid - * @param fetched The Consumer which will receive the GameProfile instance. This Consumer will not be called on the main thread - * + * @param nonNull If true, an OfflinePlayer GameProfile will be returned should the username not be valid + * @param fetched The Consumer which will receive the GameProfile instance. This Consumer will not be called on the main thread * @return The GameProfile - always an unique instance */ public static Future getProfileByName(String username, boolean nonNull, Consumer fetched) @@ -95,7 +100,6 @@ public class UtilGameProfile * Clones a GameProfile * * @param input The GameProfile to clone - * * @return A copy of the GameProfile */ public static GameProfile clone(GameProfile input) @@ -112,7 +116,6 @@ public class UtilGameProfile * Convert a string to a legal username equivalent * * @param in The original username - * * @returns A legal version of the username (with illegal characters stripped out */ public static String legalize(String in) @@ -122,6 +125,7 @@ public class UtilGameProfile private static final Field GAME_PROFILE_NAME_FIELD; private static final Field GAME_PROFILE_ID_FIELD; + private static final Field SKULL_META_PROFILE_FIELD; static { @@ -131,6 +135,8 @@ public class UtilGameProfile GAME_PROFILE_NAME_FIELD.setAccessible(true); GAME_PROFILE_ID_FIELD = GameProfile.class.getDeclaredField("id"); GAME_PROFILE_ID_FIELD.setAccessible(true); + SKULL_META_PROFILE_FIELD = Class.forName("org.bukkit.craftbukkit.v1_8_R3.inventory.CraftMetaSkull").getDeclaredField("profile"); + SKULL_META_PROFILE_FIELD.setAccessible(true); Field modifiersField = Field.class.getDeclaredField("modifiers"); modifiersField.setAccessible(true); @@ -174,4 +180,28 @@ public class UtilGameProfile { return clone(((CraftPlayer) player).getProfile()); } + + public static void setGameProfile(Player player, ItemStack stack) + { + setGameProfile(getGameProfile(player), stack); + } + + public static void setGameProfile(GameProfile profile, ItemStack stack) + { + ItemMeta meta = stack.getItemMeta(); + if (meta instanceof SkullMeta) + { + SkullMeta skullMeta = (SkullMeta) meta; + try + { + SKULL_META_PROFILE_FIELD.set(skullMeta, profile); + } + catch (IllegalAccessException e) + { + e.printStackTrace(); + } + + stack.setItemMeta(skullMeta); + } + } } diff --git a/Plugins/Mineplex.Core/src/mineplex/core/utils/UtilScheduler.java b/Plugins/Mineplex.Core/src/mineplex/core/utils/UtilScheduler.java new file mode 100644 index 000000000..c0c9ff0e3 --- /dev/null +++ b/Plugins/Mineplex.Core/src/mineplex/core/utils/UtilScheduler.java @@ -0,0 +1,22 @@ +package mineplex.core.utils; + +import org.bukkit.plugin.Plugin; +import org.bukkit.scheduler.BukkitTask; + +import mineplex.core.common.util.UtilServer; +import mineplex.core.updater.UpdateType; + +public class UtilScheduler +{ + public static BukkitTask runEvery(UpdateType speed, Runnable action) + { + Plugin plugin = UtilServer.getPlugin(); + return plugin.getServer().getScheduler().runTaskTimer(plugin, action, 0, (int) Math.ceil(speed.getMilliseconds() / 50.0)); + } + + public static BukkitTask runAsyncEvery(UpdateType speed, Runnable action) + { + Plugin plugin = UtilServer.getPlugin(); + return plugin.getServer().getScheduler().runTaskTimerAsynchronously(plugin, action, 0, (int) Math.ceil(speed.getMilliseconds() / 50.0)); + } +} diff --git a/Plugins/Mineplex.Core/src/mineplex/core/utils/UtilVariant.java b/Plugins/Mineplex.Core/src/mineplex/core/utils/UtilVariant.java index 8134ca1f5..c6e38ee1d 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/utils/UtilVariant.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/utils/UtilVariant.java @@ -34,6 +34,7 @@ public class UtilVariant World world = ((CraftWorld) location.getWorld()).getHandle(); EntityZombie zombie = new EntityZombie(world); + zombie.setLocation(location.getX(), location.getY(), location.getZ(), location.getYaw(), location.getPitch()); zombie.setVillager(true); world.addEntity(zombie, CreatureSpawnEvent.SpawnReason.CUSTOM); @@ -45,6 +46,7 @@ public class UtilVariant World world = ((CraftWorld) location.getWorld()).getHandle(); EntitySkeleton skeleton = new EntitySkeleton(world); + skeleton.setLocation(location.getX(), location.getY(), location.getZ(), location.getYaw(), location.getPitch()); skeleton.setSkeletonType(1); world.addEntity(skeleton, CreatureSpawnEvent.SpawnReason.CUSTOM); @@ -56,6 +58,7 @@ public class UtilVariant World world = ((CraftWorld) location.getWorld()).getHandle(); EntityGuardian guardian = new EntityGuardian(world); + guardian.setLocation(location.getX(), location.getY(), location.getZ(), location.getYaw(), location.getPitch()); guardian.setElder(true); world.addEntity(guardian, CreatureSpawnEvent.SpawnReason.CUSTOM); diff --git a/Plugins/Mineplex.Core/src/mineplex/core/valentines/ValentinesGiftRepository.java b/Plugins/Mineplex.Core/src/mineplex/core/valentines/ValentinesGiftRepository.java index 0115bd9a3..99fdd9cc3 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/valentines/ValentinesGiftRepository.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/valentines/ValentinesGiftRepository.java @@ -6,26 +6,15 @@ import mineplex.serverdata.database.RepositoryBase; import mineplex.serverdata.database.column.ColumnInt; import org.bukkit.plugin.java.JavaPlugin; -public class ValentinesGiftRepository extends MinecraftRepository +public class ValentinesGiftRepository extends RepositoryBase { private String GIVE_GIFT = "INSERT INTO accountValentinesGift (senderId, targetId) VALUES (?, ?);"; public ValentinesGiftRepository(JavaPlugin plugin) { - super(plugin, DBPool.getAccount()); + super(DBPool.getAccount()); } - @Override - protected void initialize() - { - - } - - @Override - protected void update() - { - - } public boolean giveGift(int senderId, int targetId) { diff --git a/Plugins/Mineplex.Core/src/mineplex/core/visibility/VisibilityData.java b/Plugins/Mineplex.Core/src/mineplex/core/visibility/VisibilityData.java index 2c5f57637..851a0b73c 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/visibility/VisibilityData.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/visibility/VisibilityData.java @@ -4,7 +4,7 @@ import java.util.Iterator; import mineplex.core.common.util.NautHashMap; import mineplex.core.recharge.Recharge; -import mineplex.core.timing.TimingManager; +import mineplex.core.common.timing.TimingManager; import org.bukkit.craftbukkit.v1_8_R3.entity.CraftPlayer; import org.bukkit.entity.Player; diff --git a/Plugins/Mineplex.Core/src/mineplex/core/visibility/VisibilityManager.java b/Plugins/Mineplex.Core/src/mineplex/core/visibility/VisibilityManager.java index 26fe0e706..dfd21d10c 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/visibility/VisibilityManager.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/visibility/VisibilityManager.java @@ -5,7 +5,7 @@ import java.util.Iterator; import mineplex.core.MiniPlugin; import mineplex.core.common.util.NautHashMap; import mineplex.core.common.util.UtilServer; -import mineplex.core.timing.TimingManager; +import mineplex.core.common.timing.TimingManager; import mineplex.core.updater.UpdateType; import mineplex.core.updater.event.UpdateEvent; diff --git a/Plugins/Mineplex.Core/src/mineplex/core/youtube/YoutubeClient.java b/Plugins/Mineplex.Core/src/mineplex/core/youtube/YoutubeClient.java index fb28e1cba..3e8bb6685 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/youtube/YoutubeClient.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/youtube/YoutubeClient.java @@ -5,19 +5,31 @@ import java.time.LocalDate; public class YoutubeClient { private LocalDate _clickDate; + private LocalDate _specificDate; - public YoutubeClient(LocalDate date) + public YoutubeClient(LocalDate date, LocalDate specificDate) { - this._clickDate = date; + _clickDate = date; + _specificDate = specificDate; } public LocalDate getClickDate() { return _clickDate; } + + public LocalDate getSpecificDate() + { + return _specificDate; + } public void setClickDate(LocalDate date) { _clickDate = date; } -} + + public void setSpecificDate(LocalDate date) + { + _specificDate = date; + } +} \ No newline at end of file diff --git a/Plugins/Mineplex.Core/src/mineplex/core/youtube/YoutubeManager.java b/Plugins/Mineplex.Core/src/mineplex/core/youtube/YoutubeManager.java index fd68c2475..9f26d96da 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/youtube/YoutubeManager.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/youtube/YoutubeManager.java @@ -1,14 +1,5 @@ package mineplex.core.youtube; -import mineplex.core.MiniDbClientPlugin; -import mineplex.core.account.CoreClientManager; -import mineplex.core.common.util.F; -import mineplex.core.common.util.UtilPlayer; -import mineplex.core.donation.DonationManager; -import org.bukkit.Bukkit; -import org.bukkit.entity.Player; -import org.bukkit.plugin.java.JavaPlugin; - import java.sql.ResultSet; import java.sql.SQLException; import java.time.LocalDate; @@ -16,6 +7,18 @@ import java.time.ZoneOffset; import java.time.ZonedDateTime; import java.util.UUID; +import org.bukkit.Bukkit; +import org.bukkit.entity.Player; +import org.bukkit.plugin.java.JavaPlugin; + +import mineplex.core.MiniDbClientPlugin; +import mineplex.core.account.CoreClientManager; +import mineplex.core.account.ILoginProcessor; +import mineplex.core.common.currency.GlobalCurrency; +import mineplex.core.common.util.F; +import mineplex.core.common.util.UtilPlayer; +import mineplex.core.donation.DonationManager; + public class YoutubeManager extends MiniDbClientPlugin { private static final int REWARD_MESSAGE_DELAY_SECONDS = 30; @@ -27,6 +30,31 @@ public class YoutubeManager extends MiniDbClientPlugin super("YoutubeManager", plugin, clientManager); _donationManager = donationManager; _repository = new YoutubeRepository(this); + + clientManager.addStoredProcedureLoginProcessor(new ILoginProcessor() + { + @Override + public String getName() + { + return "specific-youtuber-click"; + } + + @Override + public void processLoginResultSet(String playerName, UUID uuid, int accountId, ResultSet resultSet) throws SQLException + { + boolean hasRow = resultSet.next(); + if (hasRow) + { + YoutubeManager.this.Get(uuid).setSpecificDate(resultSet.getDate(1).toLocalDate()); + } + } + + @Override + public String getQuery(int accountId, String uuid, String name) + { + return "SELECT clicktime FROM specificYoutube WHERE accountId=" + accountId + ";"; + } + }); } public boolean canYoutube(Player player) @@ -44,19 +72,72 @@ public class YoutubeManager extends MiniDbClientPlugin return !date.equals(utc); } + + public boolean canSpecificYoutube(Player player) + { + YoutubeClient client = Get(player); + LocalDate date = client.getSpecificDate(); - public void attemptYoutube(Player player) + if (date == null) + { + return true; + } + + ZonedDateTime utcZoned = ZonedDateTime.now(ZoneOffset.UTC); + LocalDate utc = utcZoned.toLocalDate(); + + return !date.equals(utc); + } + + public void attemptYoutube(Player player, boolean clans, final int clansServerId) { if (!canYoutube(player)) { return; } YoutubeClient client = Get(player); + final int accountId = getClientManager().getAccountId(player); client.setClickDate(ZonedDateTime.now(ZoneOffset.UTC).toLocalDate()); _repository.attemptYoutube(player, client, () -> { - _donationManager.RewardCoinsLater("YouTube", player, 250); - Bukkit.getScheduler().runTaskLater(getClientManager().getPlugin(), () -> UtilPlayer.message(player, F.main("Carl", "Rewarded " + F.elem("250 Treasure Shards") + " for watching the YouTube video")), REWARD_MESSAGE_DELAY_SECONDS * 20L); + if (clans && clansServerId != -1) + { + _donationManager.getGoldRepository().rewardGold(success -> + { + Bukkit.getScheduler().runTaskLater(getClientManager().getPlugin(), () -> UtilPlayer.message(player, F.main("Carl", "Rewarded " + F.elem("250 Gold") + " on your home server for watching the YouTube video")), REWARD_MESSAGE_DELAY_SECONDS * 20L); + }, clansServerId, accountId, 250); + } + else + { + _donationManager.rewardCurrency(GlobalCurrency.TREASURE_SHARD, player, "YouTube", 250); + Bukkit.getScheduler().runTaskLater(getClientManager().getPlugin(), () -> UtilPlayer.message(player, F.main("Carl", "Rewarded " + F.elem("250 Treasure Shards") + " for watching the YouTube video")), REWARD_MESSAGE_DELAY_SECONDS * 20L); + } + }); + } + + public void attemptSpecificYoutube(Player player, final boolean clans, final int clansServerId) + { + if (!canYoutube(player)) + { + return; + } + YoutubeClient client = Get(player); + final int accountId = getClientManager().getAccountId(player); + client.setSpecificDate(ZonedDateTime.now(ZoneOffset.UTC).toLocalDate()); + _repository.attemptSpecificYoutube(player, client, () -> + { + if (clans && clansServerId != -1) + { + _donationManager.getGoldRepository().rewardGold(success -> + { + Bukkit.getScheduler().runTaskLater(getClientManager().getPlugin(), () -> UtilPlayer.message(player, F.main("Carl", "Rewarded " + F.elem("250 Gold") + " on your home server for watching the YouTube video")), REWARD_MESSAGE_DELAY_SECONDS * 20L); + }, clansServerId, accountId, 250); + } + else + { + _donationManager.rewardCurrency(GlobalCurrency.TREASURE_SHARD, player, "YouTube", 250); + Bukkit.getScheduler().runTaskLater(getClientManager().getPlugin(), () -> UtilPlayer.message(player, F.main("Carl", "Rewarded " + F.elem("250 Treasure Shards") + " for watching the YouTube video")), REWARD_MESSAGE_DELAY_SECONDS * 20L); + } }); } @@ -65,9 +146,9 @@ public class YoutubeManager extends MiniDbClientPlugin { boolean hasRow = resultSet.next(); if (hasRow) - Set(uuid, new YoutubeClient(resultSet.getDate(1).toLocalDate())); + Set(uuid, new YoutubeClient(resultSet.getDate(1).toLocalDate(), null)); else - Set(uuid, new YoutubeClient(null)); + Set(uuid, new YoutubeClient(null, null)); } @Override @@ -79,6 +160,6 @@ public class YoutubeManager extends MiniDbClientPlugin @Override protected YoutubeClient addPlayer(UUID uuid) { - return new YoutubeClient(null); + return new YoutubeClient(null, null); } -} +} \ No newline at end of file diff --git a/Plugins/Mineplex.Core/src/mineplex/core/youtube/YoutubeRepository.java b/Plugins/Mineplex.Core/src/mineplex/core/youtube/YoutubeRepository.java index 7e437d0cf..1b8a64319 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/youtube/YoutubeRepository.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/youtube/YoutubeRepository.java @@ -39,5 +39,26 @@ public class YoutubeRepository } }); } + + public void attemptSpecificYoutube(Player player, YoutubeClient client, Runnable runnable) + { + int accountId = _manager.getClientManager().Get(player).getAccountId(); -} + Bukkit.getScheduler().runTaskAsynchronously(_manager.getPlugin(), () -> + { + try (Connection connection = DBPool.getAccount().getConnection()) + { + PreparedStatement statement = connection.prepareStatement("REPLACE INTO specificYoutube (accountId, clicktime) VALUES (?, ?)"); + statement.setInt(1, accountId); + statement.setDate(2, Date.valueOf(client.getSpecificDate())); + statement.executeUpdate(); + + runnable.run(); + } + catch (SQLException e) + { + e.printStackTrace(); + } + }); + } +} \ No newline at end of file diff --git a/Plugins/Mineplex.Core/test/mineplex/core/lifetimes/LoggingComponent.java b/Plugins/Mineplex.Core/test/mineplex/core/lifetimes/LoggingComponent.java new file mode 100644 index 000000000..d2f61d538 --- /dev/null +++ b/Plugins/Mineplex.Core/test/mineplex/core/lifetimes/LoggingComponent.java @@ -0,0 +1,32 @@ +package mineplex.core.lifetimes; + +import java.util.List; + +public class LoggingComponent implements PhasedComponent { + private final List _events; + private final String _name; + + public LoggingComponent(List events, String name) + { + _events = events; + this._name = name; + } + + @Override + public void activate() + { + _events.add(this._name + " activated"); + } + + @Override + public void deactivate() + { + _events.add(this._name + " deactivated"); + } + + @Override + public void setPhase(Object phase) + { + _events.add(this._name + " setPhase " + phase); + } +} \ No newline at end of file diff --git a/Plugins/Mineplex.Core/test/mineplex/core/lifetimes/PhasedLifetimeTest.java b/Plugins/Mineplex.Core/test/mineplex/core/lifetimes/PhasedLifetimeTest.java new file mode 100644 index 000000000..3d62001c8 --- /dev/null +++ b/Plugins/Mineplex.Core/test/mineplex/core/lifetimes/PhasedLifetimeTest.java @@ -0,0 +1,99 @@ +package mineplex.core.lifetimes; + +import org.junit.Assert; +import org.junit.Test; + +import java.util.ArrayList; +import java.util.Arrays; +import java.util.Collections; +import java.util.List; + +public class PhasedLifetimeTest +{ + PhasedLifetime _lifetime = new PhasedLifetime<>(); + List _events = new ArrayList<>(); + @Test + public void testTwoPhaseComponent() + { + Assert.assertFalse(_lifetime.isActive()); + _lifetime.register(new LoggingComponent(_events, "component"), Arrays.asList(Phase.A, Phase.B)); + _lifetime.start(Phase.A); + Assert.assertTrue(_lifetime.isActive()); + Assert.assertEquals(Arrays.asList("component activated", "component setPhase A"), _events); + _lifetime.setPhase(Phase.B); + Assert.assertEquals(Arrays.asList("component activated", "component setPhase A", "component setPhase B"), _events); + _lifetime.setPhase(Phase.C); + Assert.assertEquals(Arrays.asList("component activated", "component setPhase A", "component setPhase B", "component setPhase C", "component deactivated"), _events); + _lifetime.end(); + Assert.assertEquals(Arrays.asList("component activated", "component setPhase A", "component setPhase B", "component setPhase C", "component deactivated"), _events); + Assert.assertFalse(_lifetime.isActive()); + } + @Test + public void testGlobalComponent() + { + _lifetime.register(new LoggingComponent(_events, "component")); + _lifetime.start(Phase.A); + Assert.assertEquals(Arrays.asList("component activated", "component setPhase A"), _events); + _lifetime.setPhase(Phase.B); + Assert.assertEquals(Arrays.asList("component activated", "component setPhase A", "component setPhase B"), _events); + _lifetime.end(); + Assert.assertEquals(Arrays.asList("component activated", "component setPhase A", "component setPhase B", "component deactivated"), _events); + } + + @Test + public void testLateRegistration() + { + _lifetime.start(Phase.A); + _lifetime.register(new LoggingComponent(_events, "component"), Arrays.asList(Phase.A, Phase.B)); + Assert.assertEquals(Arrays.asList("component activated", "component setPhase A"), _events); + _lifetime.setPhase(Phase.B); + Assert.assertEquals(Arrays.asList("component activated", "component setPhase A", "component setPhase B"), _events); + _lifetime.end(); + Assert.assertEquals(Arrays.asList("component activated", "component setPhase A", "component setPhase B", "component deactivated"), _events); + } + @Test + public void testSinglePhase() + { + _lifetime.register(new LoggingComponent(_events, "component"), Collections.singletonList(Phase.B)); + _lifetime.start(Phase.A); + Assert.assertEquals(Collections.emptyList(), _events); + _lifetime.setPhase(Phase.B); + Assert.assertEquals(Arrays.asList("component activated", "component setPhase B"), _events); + _lifetime.setPhase(Phase.C); + Assert.assertEquals(Arrays.asList("component activated", "component setPhase B", "component setPhase C", "component deactivated"), _events); + _lifetime.end(); + Assert.assertEquals(Arrays.asList("component activated", "component setPhase B", "component setPhase C", "component deactivated"), _events); + } + @Test + public void testComponentLifetimes() + { + _lifetime.register(new LoggingComponent(_events, "component"), Collections.singletonList(Phase.B)).register(new LoggingComponent(_events, "child")); + _lifetime.start(Phase.A); + Assert.assertEquals(Collections.emptyList(), _events); + _lifetime.setPhase(Phase.B); + Assert.assertEquals(Arrays.asList("component activated", "child activated", "component setPhase B"), _events); + _lifetime.setPhase(Phase.C); + Assert.assertEquals(Arrays.asList("component activated", "child activated","component setPhase B", "component setPhase C", "child deactivated", "component deactivated"), _events); + _lifetime.end(); + Assert.assertEquals(Arrays.asList("component activated", "child activated", "component setPhase B", "component setPhase C", "child deactivated", "component deactivated"), _events); + } + @Test + public void testEarlyShutdown() + { + _lifetime.register(new LoggingComponent(_events, "component"), Arrays.asList(Phase.B, Phase.C)); + _lifetime.start(Phase.A); + Assert.assertEquals(Collections.emptyList(), _events); + _lifetime.setPhase(Phase.B); + Assert.assertEquals(Arrays.asList("component activated", "component setPhase B"), _events); + _lifetime.end(); + Assert.assertEquals(Arrays.asList("component activated", "component setPhase B", "component deactivated"), _events); + + } + enum Phase + { + A, + B, + C, + ; + } +} diff --git a/Plugins/Mineplex.Core/test/mineplex/core/lifetimes/SimpleLifetimeTest.java b/Plugins/Mineplex.Core/test/mineplex/core/lifetimes/SimpleLifetimeTest.java new file mode 100644 index 000000000..061a1decc --- /dev/null +++ b/Plugins/Mineplex.Core/test/mineplex/core/lifetimes/SimpleLifetimeTest.java @@ -0,0 +1,41 @@ +package mineplex.core.lifetimes; + +import org.junit.Assert; +import org.junit.Test; + +import java.util.ArrayList; +import java.util.Arrays; +import java.util.List; + +public class SimpleLifetimeTest +{ + private final SimpleLifetime _lifetime = new SimpleLifetime(); + private final List _events = new ArrayList<>(); + @Test + public void testAddition() + { + _lifetime.register(new LoggingComponent(_events,"a")); + _lifetime.start(); + _lifetime.end(); + Assert.assertEquals(_events, Arrays.asList("a activated", "a deactivated")); + } + @Test + public void testLateAddition() + { + _lifetime.start(); + _lifetime.register(new LoggingComponent(_events,"a")); + _lifetime.end(); + Assert.assertEquals(_events, Arrays.asList("a activated", "a deactivated")); + } + @Test + public void testActivationOrder() + { + _lifetime.register(new LoggingComponent(_events,"a")); + _lifetime.register(new LoggingComponent(_events,"b")); + _lifetime.start(); + _lifetime.end(); + Assert.assertEquals(_events, Arrays.asList("a activated", "b activated", "b deactivated", "a deactivated")); + } + + +} diff --git a/Plugins/Mineplex.Database/src/mineplex/database/Routines.java b/Plugins/Mineplex.Database/src/mineplex/database/Routines.java index e4d6ad2b1..f0b76e0c4 100644 --- a/Plugins/Mineplex.Database/src/mineplex/database/Routines.java +++ b/Plugins/Mineplex.Database/src/mineplex/database/Routines.java @@ -81,6 +81,19 @@ public class Routines { p.execute(configuration); return p; } + + /** + * Call Account.check_clans_daily + */ + public static mineplex.database.routines.Check_clans_daily callCheckClansDaily(org.jooq.Configuration configuration, java.lang.Integer accountId_in, java.lang.Integer serverId_in, java.lang.Integer goldChange) { + mineplex.database.routines.Check_clans_daily p = new mineplex.database.routines.Check_clans_daily(); + p.setAccountId_in(accountId_in); + p.setServerId_in(serverId_in); + p.setGoldChange(goldChange); + + p.execute(configuration); + return p; + } /** * Call Account.check_giveaway @@ -131,6 +144,19 @@ public class Routines { p.execute(configuration); return p; } + + /** + * Call Account.check_clans_vote + */ + public static mineplex.database.routines.Check_clans_vote callCheckClansVote(org.jooq.Configuration configuration, java.lang.Integer accountId_in, java.lang.Integer serverId_in, java.lang.Integer goldChange) { + mineplex.database.routines.Check_clans_vote p = new mineplex.database.routines.Check_clans_vote(); + p.setAccountId_in(accountId_in); + p.setServerId_in(serverId_in); + p.setGoldChange(goldChange); + + p.execute(configuration); + return p; + } /** * Call Account.claimThank diff --git a/Plugins/Mineplex.Database/src/mineplex/database/routines/Check_clans_daily.java b/Plugins/Mineplex.Database/src/mineplex/database/routines/Check_clans_daily.java new file mode 100644 index 000000000..7ae4425c4 --- /dev/null +++ b/Plugins/Mineplex.Database/src/mineplex/database/routines/Check_clans_daily.java @@ -0,0 +1,93 @@ +/** + * This class is generated by jOOQ + */ +package mineplex.database.routines; + +/** + * This class is generated by jOOQ. + */ +@javax.annotation.Generated( + value = { + "http://www.jooq.org", + "jOOQ version:3.5.2" + }, + comments = "This class is generated by jOOQ" +) +@java.lang.SuppressWarnings({ "all", "unchecked", "rawtypes" }) +public class Check_clans_daily extends org.jooq.impl.AbstractRoutine implements java.io.Serializable, java.lang.Cloneable { + + private static final long serialVersionUID = -1266580733; + + /** + * The parameter Account.check_clans_daily.accountId_in. + */ + public static final org.jooq.Parameter accountId_in = createParameter("accountId_in", org.jooq.impl.SQLDataType.INTEGER, false); + + /** + * The parameter Account.check_clans_daily.serverId_in. + */ + public static final org.jooq.Parameter serverId_in = createParameter("serverId_in", org.jooq.impl.SQLDataType.INTEGER, false); + + /** + * The parameter Account.check_clans_daily.goldChange. + */ + public static final org.jooq.Parameter goldChange = createParameter("goldChange", org.jooq.impl.SQLDataType.INTEGER, false); + + /** + * The parameter Account.check_clans_daily.pass. + */ + public static final org.jooq.Parameter pass = createParameter("pass", org.jooq.impl.SQLDataType.TINYINT, false); + + /** + * The parameter Account.check_clans_daily.outTime. + */ + public static final org.jooq.Parameter outTime = createParameter("outTime", org.jooq.impl.SQLDataType.TIMESTAMP, false); + + /** + * Create a new routine call instance + */ + public Check_clans_daily() { + super("check_clans_daily", mineplex.database.Account.Account); + + addInParameter(accountId_in); + addInParameter(serverId_in); + addInParameter(goldChange); + addOutParameter(pass); + addOutParameter(outTime); + } + + /** + * Set the accountId_in parameter IN value to the routine + */ + public void setAccountId_in(java.lang.Integer value) { + setValue(mineplex.database.routines.Check_clans_daily.accountId_in, value); + } + + /** + * Set the serverId_in parameter IN value to the routine + */ + public void setServerId_in(java.lang.Integer value) { + setValue(mineplex.database.routines.Check_clans_daily.serverId_in, value); + } + + /** + * Set the goldChange parameter IN value to the routine + */ + public void setGoldChange(java.lang.Integer value) { + setValue(mineplex.database.routines.Check_clans_daily.goldChange, value); + } + + /** + * Get the pass parameter OUT value from the routine + */ + public java.lang.Byte getPass() { + return getValue(pass); + } + + /** + * Get the outTime parameter OUT value from the routine + */ + public java.sql.Timestamp getOutTime() { + return getValue(outTime); + } +} \ No newline at end of file diff --git a/Plugins/Mineplex.Database/src/mineplex/database/routines/Check_clans_vote.java b/Plugins/Mineplex.Database/src/mineplex/database/routines/Check_clans_vote.java new file mode 100644 index 000000000..3c3c01af2 --- /dev/null +++ b/Plugins/Mineplex.Database/src/mineplex/database/routines/Check_clans_vote.java @@ -0,0 +1,93 @@ +/** + * This class is generated by jOOQ + */ +package mineplex.database.routines; + +/** + * This class is generated by jOOQ. + */ +@javax.annotation.Generated( + value = { + "http://www.jooq.org", + "jOOQ version:3.5.2" + }, + comments = "This class is generated by jOOQ" +) +@java.lang.SuppressWarnings({ "all", "unchecked", "rawtypes" }) +public class Check_clans_vote extends org.jooq.impl.AbstractRoutine implements java.io.Serializable, java.lang.Cloneable { + + private static final long serialVersionUID = 2035299030; + + /** + * The parameter Account.check_clans_vote.accountId_in. + */ + public static final org.jooq.Parameter accountId_in = createParameter("accountId_in", org.jooq.impl.SQLDataType.INTEGER, false); + + /** + * The parameter Account.check_clans_vote.serverId_in. + */ + public static final org.jooq.Parameter serverId_in = createParameter("serverId_in", org.jooq.impl.SQLDataType.INTEGER, false); + + /** + * The parameter Account.check_clans_vote.goldChange. + */ + public static final org.jooq.Parameter goldChange = createParameter("goldChange", org.jooq.impl.SQLDataType.INTEGER, false); + + /** + * The parameter Account.check_clans_vote.pass. + */ + public static final org.jooq.Parameter pass = createParameter("pass", org.jooq.impl.SQLDataType.TINYINT, false); + + /** + * The parameter Account.check_clans_vote.outTime. + */ + public static final org.jooq.Parameter outTime = createParameter("outTime", org.jooq.impl.SQLDataType.DATE, false); + + /** + * Create a new routine call instance + */ + public Check_clans_vote() { + super("check_clans_vote", mineplex.database.Account.Account); + + addInParameter(accountId_in); + addInParameter(serverId_in); + addInParameter(goldChange); + addOutParameter(pass); + addOutParameter(outTime); + } + + /** + * Set the accountId_in parameter IN value to the routine + */ + public void setAccountId_in(java.lang.Integer value) { + setValue(mineplex.database.routines.Check_clans_daily.accountId_in, value); + } + + /** + * Set the serverId_in parameter IN value to the routine + */ + public void setServerId_in(java.lang.Integer value) { + setValue(mineplex.database.routines.Check_clans_daily.serverId_in, value); + } + + /** + * Set the goldChange parameter IN value to the routine + */ + public void setGoldChange(java.lang.Integer value) { + setValue(mineplex.database.routines.Check_clans_daily.goldChange, value); + } + + /** + * Get the pass parameter OUT value from the routine + */ + public java.lang.Byte getPass() { + return getValue(pass); + } + + /** + * Get the outTime parameter OUT value from the routine + */ + public java.sql.Date getOutTime() { + return getValue(outTime); + } +} \ No newline at end of file diff --git a/Plugins/Mineplex.Database/src/mineplex/database/tables/Bonus.java b/Plugins/Mineplex.Database/src/mineplex/database/tables/Bonus.java index 4547730a3..780c9faf5 100644 --- a/Plugins/Mineplex.Database/src/mineplex/database/tables/Bonus.java +++ b/Plugins/Mineplex.Database/src/mineplex/database/tables/Bonus.java @@ -40,6 +40,11 @@ public class Bonus extends org.jooq.impl.TableImplAccount.bonus.dailytime. */ public final org.jooq.TableField dailytime = createField("dailytime", org.jooq.impl.SQLDataType.TIMESTAMP, this, ""); + + /** + * The column Account.bonus.clansdailytime. + */ + public final org.jooq.TableField clansdailytime = createField("clansdailytime", org.jooq.impl.SQLDataType.TIMESTAMP, this, ""); /** * The column Account.bonus.ranktime. @@ -50,6 +55,11 @@ public class Bonus extends org.jooq.impl.TableImplAccount.bonus.votetime. */ public final org.jooq.TableField votetime = createField("votetime", org.jooq.impl.SQLDataType.DATE, this, ""); + + /** + * The column Account.bonus.clansvotetime. + */ + public final org.jooq.TableField clansvotetime = createField("clansvotetime", org.jooq.impl.SQLDataType.DATE, this, ""); /** * The column Account.bonus.dailyStreak. diff --git a/Plugins/Mineplex.Database/src/mineplex/database/tables/records/BonusRecord.java b/Plugins/Mineplex.Database/src/mineplex/database/tables/records/BonusRecord.java index ee1c0bb21..3d5b40da5 100644 --- a/Plugins/Mineplex.Database/src/mineplex/database/tables/records/BonusRecord.java +++ b/Plugins/Mineplex.Database/src/mineplex/database/tables/records/BonusRecord.java @@ -14,7 +14,7 @@ package mineplex.database.tables.records; comments = "This class is generated by jOOQ" ) @java.lang.SuppressWarnings({ "all", "unchecked", "rawtypes" }) -public class BonusRecord extends org.jooq.impl.UpdatableRecordImpl implements java.io.Serializable, java.lang.Cloneable, org.jooq.Record9 { +public class BonusRecord extends org.jooq.impl.UpdatableRecordImpl implements java.io.Serializable, java.lang.Cloneable, org.jooq.Record11 { private static final long serialVersionUID = -785434679; @@ -45,103 +45,131 @@ public class BonusRecord extends org.jooq.impl.UpdatableRecordImplAccount.bonus.clansdailytime. + */ + public void setClansDailytime(java.sql.Timestamp value) { + setValue(2, value); + } + + /** + * Getter for Account.bonus.clansdailytime. + */ + public java.sql.Timestamp getClansDailytime() { + return (java.sql.Timestamp) getValue(2); + } /** * Setter for Account.bonus.ranktime. */ public void setRanktime(java.sql.Date value) { - setValue(2, value); + setValue(3, value); } /** * Getter for Account.bonus.ranktime. */ public java.sql.Date getRanktime() { - return (java.sql.Date) getValue(2); + return (java.sql.Date) getValue(3); } /** * Setter for Account.bonus.votetime. */ public void setVotetime(java.sql.Date value) { - setValue(3, value); + setValue(4, value); } /** * Getter for Account.bonus.votetime. */ public java.sql.Date getVotetime() { - return (java.sql.Date) getValue(3); + return (java.sql.Date) getValue(4); + } + + /** + * Setter for Account.bonus.clansvotetime. + */ + public void setClansVotetime(java.sql.Date value) { + setValue(5, value); + } + + /** + * Getter for Account.bonus.votetime. + */ + public java.sql.Date getClansVotetime() { + return (java.sql.Date) getValue(5); } /** * Setter for Account.bonus.dailyStreak. */ public void setDailyStreak(java.lang.Integer value) { - setValue(4, value); + setValue(6, value); } /** * Getter for Account.bonus.dailyStreak. */ public java.lang.Integer getDailyStreak() { - return (java.lang.Integer) getValue(4); + return (java.lang.Integer) getValue(6); } /** * Setter for Account.bonus.maxDailyStreak. */ public void setMaxDailyStreak(java.lang.Integer value) { - setValue(5, value); + setValue(7, value); } /** * Getter for Account.bonus.maxDailyStreak. */ public java.lang.Integer getMaxDailyStreak() { - return (java.lang.Integer) getValue(5); + return (java.lang.Integer) getValue(7); } /** * Setter for Account.bonus.voteStreak. */ public void setVoteStreak(java.lang.Integer value) { - setValue(6, value); + setValue(8, value); } /** * Getter for Account.bonus.voteStreak. */ public java.lang.Integer getVoteStreak() { - return (java.lang.Integer) getValue(6); + return (java.lang.Integer) getValue(8); } /** * Setter for Account.bonus.maxVoteStreak. */ public void setMaxVoteStreak(java.lang.Integer value) { - setValue(7, value); + setValue(9, value); } /** * Getter for Account.bonus.maxVoteStreak. */ public java.lang.Integer getMaxVoteStreak() { - return (java.lang.Integer) getValue(7); + return (java.lang.Integer) getValue(9); } /** * Setter for Account.bonus.tickets. */ public void setTickets(java.lang.Integer value) { - setValue(8, value); + setValue(10, value); } /** * Getter for Account.bonus.tickets. */ public java.lang.Integer getTickets() { - return (java.lang.Integer) getValue(8); + return (java.lang.Integer) getValue(10); } // ------------------------------------------------------------------------- @@ -164,16 +192,16 @@ public class BonusRecord extends org.jooq.impl.UpdatableRecordImpl fieldsRow() { - return (org.jooq.Row9) super.fieldsRow(); + public org.jooq.Row11 fieldsRow() { + return (org.jooq.Row11) super.fieldsRow(); } /** * {@inheritDoc} */ @Override - public org.jooq.Row9 valuesRow() { - return (org.jooq.Row9) super.valuesRow(); + public org.jooq.Row11 valuesRow() { + return (org.jooq.Row11) super.valuesRow(); } /** @@ -191,13 +219,13 @@ public class BonusRecord extends org.jooq.impl.UpdatableRecordImpl field2() { return mineplex.database.tables.Bonus.bonus.dailytime; } - + /** * {@inheritDoc} */ @Override - public org.jooq.Field field3() { - return mineplex.database.tables.Bonus.bonus.ranktime; + public org.jooq.Field field3() { + return mineplex.database.tables.Bonus.bonus.clansdailytime; } /** @@ -205,23 +233,23 @@ public class BonusRecord extends org.jooq.impl.UpdatableRecordImpl field4() { + return mineplex.database.tables.Bonus.bonus.ranktime; + } + + /** + * {@inheritDoc} + */ + @Override + public org.jooq.Field field5() { return mineplex.database.tables.Bonus.bonus.votetime; } - + /** * {@inheritDoc} */ @Override - public org.jooq.Field field5() { - return mineplex.database.tables.Bonus.bonus.dailyStreak; - } - - /** - * {@inheritDoc} - */ - @Override - public org.jooq.Field field6() { - return mineplex.database.tables.Bonus.bonus.maxDailyStreak; + public org.jooq.Field field6() { + return mineplex.database.tables.Bonus.bonus.clansvotetime; } /** @@ -229,7 +257,7 @@ public class BonusRecord extends org.jooq.impl.UpdatableRecordImpl field7() { - return mineplex.database.tables.Bonus.bonus.voteStreak; + return mineplex.database.tables.Bonus.bonus.dailyStreak; } /** @@ -237,7 +265,7 @@ public class BonusRecord extends org.jooq.impl.UpdatableRecordImpl field8() { - return mineplex.database.tables.Bonus.bonus.maxVoteStreak; + return mineplex.database.tables.Bonus.bonus.maxDailyStreak; } /** @@ -245,6 +273,22 @@ public class BonusRecord extends org.jooq.impl.UpdatableRecordImpl field9() { + return mineplex.database.tables.Bonus.bonus.voteStreak; + } + + /** + * {@inheritDoc} + */ + @Override + public org.jooq.Field field10() { + return mineplex.database.tables.Bonus.bonus.maxVoteStreak; + } + + /** + * {@inheritDoc} + */ + @Override + public org.jooq.Field field11() { return mineplex.database.tables.Bonus.bonus.tickets; } @@ -263,13 +307,13 @@ public class BonusRecord extends org.jooq.impl.UpdatableRecordImpl> _cachedUUIDs = new NautHashMap>(); private static Object _commandLock = new Object(); - + public long _lastPoll = System.currentTimeMillis() - 120000; - + private SimpleDateFormat _dateFormat = new SimpleDateFormat("MM-dd-yyyy HH:mm:ss"); - + public Enjin(EnjinTranslator plugin, CoreClientManager clientManager, DonationManager donationManager, InventoryManager inventoryManager) { super("Enjin", plugin); - + _clientManager = clientManager; _donationManager = donationManager; _inventoryManager = inventoryManager; - _punish = new Punish(plugin, plugin.GetWebServerAddress(), clientManager); + _punish = new Punish(plugin, clientManager); _purchaseManager = new PurchaseManager(plugin); _powerPlayClubRepository = new PowerPlayClubRepository(plugin, clientManager, donationManager); - + plugin.getCommand("enjin_mineplex").setExecutor(this); plugin.getCommand("pull").setExecutor(this); } - + @EventHandler public void expireCachedUUIDs(UpdateEvent event) { if (event.getType() != UpdateType.MIN_01) return; - - for (Iterator>> iterator = _cachedUUIDs.entrySet().iterator(); iterator.hasNext();) + + for (Iterator>> iterator = _cachedUUIDs.entrySet().iterator(); iterator.hasNext(); ) { Entry> entry = iterator.next(); - + if (System.currentTimeMillis() > entry.getValue().getValue()) iterator.remove(); } @@ -86,12 +86,12 @@ public class Enjin extends MiniPlugin implements CommandExecutor try { if (sender instanceof Player) - ((Player)sender).kickPlayer("Like bananas? I don't. Here take these and go have fun."); - + ((Player) sender).kickPlayer("Like bananas? I don't. Here take these and go have fun."); + if (label.equalsIgnoreCase("enjin_mineplex")) { final String name = args[1]; - + _clientManager.loadClientByName(name, client -> { if (client == null) @@ -119,14 +119,14 @@ public class Enjin extends MiniPlugin implements CommandExecutor final UUID playerUUID = uuid; _cachedUUIDs.put(name, new AbstractMap.SimpleEntry(playerUUID, System.currentTimeMillis() + 240000)); - + if (args[0].equalsIgnoreCase("chargeback")) { _punish.AddPunishment(name, Category.Other, "Chargeback", "Strutt20", 1, true, -1, true); System.out.println("[" + _dateFormat.format(new Date()) + "] " + name + " was banned for charging back!"); return; } - + if (!checkForClansPurchase(args, name, client)) { if (!checkForBoosterPurchase(args, name, playerUUID, client)) @@ -161,7 +161,7 @@ public class Enjin extends MiniPlugin implements CommandExecutor { exception.printStackTrace(); } - + try { Thread.sleep(20); @@ -171,18 +171,18 @@ public class Enjin extends MiniPlugin implements CommandExecutor e.printStackTrace(); } } - + return true; } - protected boolean checkForRankPurchase(String[] args, final String name, final UUID playerUUID, final CoreClient client) + protected boolean checkForRankPurchase(String[] args, final String name, final UUID playerUUID, final CoreClient client) { if (args.length != 4 || !args[0].equalsIgnoreCase("rank")) return false; final Rank rank = mineplex.core.common.Rank.valueOf(args[2]); final boolean perm = Boolean.parseBoolean(args[3]); - + _clientManager.loadClientByName(name, loadedClient -> { if (rank == Rank.ALL || loadedClient.GetRank() == Rank.ALL || !loadedClient.GetRank().has(rank) || loadedClient.GetRank() == rank) @@ -197,102 +197,96 @@ public class Enjin extends MiniPlugin implements CommandExecutor _purchaseManager.addAccountPurchaseToQueue(client.getAccountId(), rank.Name + (perm ? " Permanent" : " Monthly"), 1, false); } }); - + return true; } - protected boolean checkForPurchase(String[] args, final String name, final CoreClient client) + protected boolean checkForPurchase(String[] args, final String name, final CoreClient client) { if (args.length < 3 || !args[0].equalsIgnoreCase("purchase")) return false; - + final int amount = Integer.parseInt(args[2]); String tempName = args[4]; - + for (int i = 5; i < args.length; i++) { tempName += " " + args[i]; } - + final String packageName = tempName; - - _donationManager.PurchaseUnknownSalesPackage(new Callback() + + _donationManager.purchaseUnknownSalesPackage(client, amount == 1 ? packageName : packageName + " " + amount, GlobalCurrency.GEM, 0, false, data -> { - public void run(TransactionResponse data) + if (data == TransactionResponse.Success) { - if (data == TransactionResponse.Success) + _inventoryManager.addItemToInventoryForOffline(new Callback() { - _inventoryManager.addItemToInventoryForOffline(new Callback() + public void run(Boolean success) { - public void run(Boolean success) + if (success) { - if (success) - { - _purchaseManager.addAccountPurchaseToQueue(client.getAccountId(), packageName, amount, true); - System.out.println("[" + _dateFormat.format(new Date()) + "] " + name + " received " + amount + " " + packageName + "."); - } - else - { - System.out.println("[" + _dateFormat.format(new Date()) + "] ERROR processing " + name + " " + packageName + ". Queuing for run later."); - _purchaseManager.addAccountPurchaseToQueue(client.getAccountId(), packageName, amount, false); - } + _purchaseManager.addAccountPurchaseToQueue(client.getAccountId(), packageName, amount, true); + System.out.println("[" + _dateFormat.format(new Date()) + "] " + name + " received " + amount + " " + packageName + "."); } - }, client.getAccountId(), packageName, amount); - } - else - { - System.out.println("[" + _dateFormat.format(new Date()) + "] ERROR processing " + name + " " + amount + ". Queuing for run later."); - _purchaseManager.addAccountPurchaseToQueue(client.getAccountId(), packageName, amount, data == TransactionResponse.Success); - } + else + { + System.out.println("[" + _dateFormat.format(new Date()) + "] ERROR processing " + name + " " + packageName + ". Queuing for run later."); + _purchaseManager.addAccountPurchaseToQueue(client.getAccountId(), packageName, amount, false); + } + } + }, client.getAccountId(), packageName, amount); } - }, name, client.getAccountId(), amount == 1 ? packageName : packageName + " " + amount, GlobalCurrency.GEM, 0, false); - + else + { + System.out.println("[" + _dateFormat.format(new Date()) + "] ERROR processing " + name + " " + amount + ". Queuing for run later."); + _purchaseManager.addAccountPurchaseToQueue(client.getAccountId(), packageName, amount, false); + } + }); + return true; } - protected boolean checkForCoinPurchase(String[] args, final String name, final UUID playerUUID, final CoreClient client) + protected boolean checkForCoinPurchase(String[] args, final String name, final UUID playerUUID, final CoreClient client) { if (args.length != 3 || !args[0].equalsIgnoreCase("coin")) return false; - + final int amount = Integer.parseInt(args[2]); - _donationManager.RewardCoins(new Callback() + _donationManager.rewardCurrency(GlobalCurrency.TREASURE_SHARD, client, "purchase", amount, response -> { - public void run (Boolean response) - { - if (response) - System.out.println("[" + _dateFormat.format(new Date()) + "] " + name + " received " + amount + " coins."); - else - System.out.println("[" + _dateFormat.format(new Date()) + "] ERROR processing " + name + " " + amount + " coins. Queuing for run later."); - - _purchaseManager.addAccountPurchaseToQueue(client.getAccountId(), "Coins", amount, response); - } - }, "purchase", name, client.getAccountId(), amount); - + if (response) + System.out.println("[" + _dateFormat.format(new Date()) + "] " + name + " received " + amount + " coins."); + else + System.out.println("[" + _dateFormat.format(new Date()) + "] ERROR processing " + name + " " + amount + " coins. Queuing for run later."); + + _purchaseManager.addAccountPurchaseToQueue(client.getAccountId(), "Coins", amount, response); + }); + return true; } - protected boolean checkForBoosterPurchase(String[] args, final String name, final UUID playerUUID, final CoreClient client) + protected boolean checkForBoosterPurchase(String[] args, final String name, final UUID playerUUID, final CoreClient client) { if (args.length != 3 || !args[0].equalsIgnoreCase("booster")) return false; - + final int amount = Integer.parseInt(args[2]); _inventoryManager.addItemToInventoryForOffline(new Callback() { - public void run (Boolean response) + public void run(Boolean response) { if (response) System.out.println("[" + _dateFormat.format(new Date()) + "] " + name + " received " + amount + " gem boosters."); else System.out.println("[" + _dateFormat.format(new Date()) + "] ERROR processing " + name + " " + amount + " gem boosters. Queuing for run later."); - + _purchaseManager.addAccountPurchaseToQueue(client.getAccountId(), "Gem Boosters", amount, response); } }, client.getAccountId(), "Game Booster", amount); - + return true; } @@ -310,15 +304,16 @@ public class Enjin extends MiniPlugin implements CommandExecutor _powerPlayClubRepository.addSubscription(client.getAccountId(), date, duration); - } else if (args[2].equalsIgnoreCase("cancel")) + } + else if (args[2].equalsIgnoreCase("cancel")) { // TODO: cancel it in our logs? I don't think this is necessary. } return false; } - - protected boolean checkForClansPurchase(String[] args, final String name, final CoreClient client) + + protected boolean checkForClansPurchase(String[] args, final String name, final CoreClient client) { if (args.length >= 3 && args[0].equalsIgnoreCase("clansBanner")) { @@ -328,37 +323,34 @@ public class Enjin extends MiniPlugin implements CommandExecutor purchase = "Clan Banner Editor"; } final String packageName = purchase; - - _donationManager.PurchaseUnknownSalesPackage(new Callback() + + _donationManager.purchaseUnknownSalesPackage(client, packageName, GlobalCurrency.GEM, 0, false, data -> { - public void run(TransactionResponse data) + if (data == TransactionResponse.Success) { - if (data == TransactionResponse.Success) + _inventoryManager.addItemToInventoryForOffline(new Callback() { - _inventoryManager.addItemToInventoryForOffline(new Callback() + public void run(Boolean success) { - public void run(Boolean success) + if (success) { - if (success) - { - _purchaseManager.addAccountPurchaseToQueue(client.getAccountId(), packageName, 1, true); - System.out.println("[" + _dateFormat.format(new Date()) + "] " + name + " received their " + packageName + " access."); - } - else - { - System.out.println("[" + _dateFormat.format(new Date()) + "] ERROR processing " + name + " " + packageName + ". Queuing for run later."); - _purchaseManager.addAccountPurchaseToQueue(client.getAccountId(), packageName, 1, false); - } + _purchaseManager.addAccountPurchaseToQueue(client.getAccountId(), packageName, 1, true); + System.out.println("[" + _dateFormat.format(new Date()) + "] " + name + " received their " + packageName + " access."); } - }, client.getAccountId(), packageName, 1); - } - else - { - System.out.println("[" + _dateFormat.format(new Date()) + "] ERROR processing " + name + " 1" + ". Queuing for run later."); - _purchaseManager.addAccountPurchaseToQueue(client.getAccountId(), packageName, 1, data == TransactionResponse.Success); - } + else + { + System.out.println("[" + _dateFormat.format(new Date()) + "] ERROR processing " + name + " " + packageName + ". Queuing for run later."); + _purchaseManager.addAccountPurchaseToQueue(client.getAccountId(), packageName, 1, false); + } + } + }, client.getAccountId(), packageName, 1); } - }, name, client.getAccountId(), packageName, GlobalCurrency.GEM, 0, false); + else + { + System.out.println("[" + _dateFormat.format(new Date()) + "] ERROR processing " + name + " 1" + ". Queuing for run later."); + _purchaseManager.addAccountPurchaseToQueue(client.getAccountId(), packageName, 1, false); + } + }); //enjin_mineplex clansBanner AlexTheCoder true return true; } @@ -367,10 +359,10 @@ public class Enjin extends MiniPlugin implements CommandExecutor //enjin_mineplex clansAmplifier AlexTheCoder 20 1 final String item = "Rune Amplifier " + args[2]; final int amount = Integer.parseInt(args[3]); - + _inventoryManager.addItemToInventoryForOffline(new Callback() { - public void run (Boolean response) + public void run(Boolean response) { if (response) System.out.println("[" + _dateFormat.format(new Date()) + "] " + name + " received " + amount + " rune amplifiers."); @@ -381,7 +373,7 @@ public class Enjin extends MiniPlugin implements CommandExecutor } }, client.getAccountId(), item, amount); } - + return false; } } diff --git a/Plugins/Mineplex.EnjinTranslator/src/mineplex/enjinTranslator/EnjinTranslator.java b/Plugins/Mineplex.EnjinTranslator/src/mineplex/enjinTranslator/EnjinTranslator.java index ec5810121..60451cab7 100644 --- a/Plugins/Mineplex.EnjinTranslator/src/mineplex/enjinTranslator/EnjinTranslator.java +++ b/Plugins/Mineplex.EnjinTranslator/src/mineplex/enjinTranslator/EnjinTranslator.java @@ -1,5 +1,6 @@ package mineplex.enjinTranslator; +import mineplex.core.common.Constants; import mineplex.core.account.CoreClientManager; import mineplex.core.command.CommandCenter; import mineplex.core.donation.DonationManager; @@ -7,25 +8,25 @@ import mineplex.core.inventory.InventoryManager; import mineplex.core.updater.Updater; import org.bukkit.plugin.java.JavaPlugin; +import static mineplex.core.Managers.require; + public class EnjinTranslator extends JavaPlugin { - private String WEB_CONFIG = "webServer"; - @Override public void onEnable() { - getConfig().addDefault(WEB_CONFIG, "http://accounts.mineplex.com/"); - getConfig().set(WEB_CONFIG, getConfig().getString(WEB_CONFIG)); + getConfig().addDefault(Constants.WEB_CONFIG_KEY, Constants.WEB_ADDRESS); + getConfig().set(Constants.WEB_CONFIG_KEY, getConfig().getString(Constants.WEB_CONFIG_KEY)); saveConfig(); //Static Modules CommandCenter.Initialize(this); //Core Modules - CoreClientManager clientManager = new CoreClientManager(this, GetWebServerAddress()); + CoreClientManager clientManager = new CoreClientManager(this); CommandCenter.Instance.setClientManager(clientManager); - DonationManager donationManager = new DonationManager(this, clientManager, GetWebServerAddress()); + DonationManager donationManager = require(DonationManager.class); //Main Modules new Enjin(this, clientManager, donationManager, new InventoryManager(this, clientManager)); @@ -35,8 +36,7 @@ public class EnjinTranslator extends JavaPlugin public String GetWebServerAddress() { - String webServerAddress = getConfig().getString(WEB_CONFIG); - return webServerAddress; + return getConfig().getString(Constants.WEB_CONFIG_KEY); } } diff --git a/Plugins/Mineplex.EnjinTranslator/src/mineplex/enjinTranslator/TempRepository.java b/Plugins/Mineplex.EnjinTranslator/src/mineplex/enjinTranslator/TempRepository.java index 73cba9a30..91ddd00c9 100644 --- a/Plugins/Mineplex.EnjinTranslator/src/mineplex/enjinTranslator/TempRepository.java +++ b/Plugins/Mineplex.EnjinTranslator/src/mineplex/enjinTranslator/TempRepository.java @@ -8,27 +8,17 @@ import mineplex.serverdata.database.RepositoryBase; import mineplex.serverdata.database.column.ColumnInt; import mineplex.serverdata.database.column.ColumnVarChar; -public class TempRepository extends MinecraftRepository +public class TempRepository extends RepositoryBase { private static String INSERT_CLIENT_INVENTORY = "INSERT INTO accountInventory (accountId, itemId, count) SELECT accounts.id, 5, ? FROM accounts WHERE accounts.name = ? ON DUPLICATE KEY UPDATE count=count + VALUES(count);"; public TempRepository(JavaPlugin plugin) { - super(plugin, DBPool.getAccount()); + super(DBPool.getAccount()); } public void addGemBooster(String name, int amount) { executeUpdate(INSERT_CLIENT_INVENTORY, new ColumnInt("count", amount), new ColumnVarChar("name", 100, name)); } - - @Override - protected void initialize() - { - } - - @Override - protected void update() - { - } } diff --git a/Plugins/Mineplex.EnjinTranslator/src/mineplex/enjinTranslator/purchase/data/PurchaseRepository.java b/Plugins/Mineplex.EnjinTranslator/src/mineplex/enjinTranslator/purchase/data/PurchaseRepository.java index 0c2fe000a..ba90e4807 100644 --- a/Plugins/Mineplex.EnjinTranslator/src/mineplex/enjinTranslator/purchase/data/PurchaseRepository.java +++ b/Plugins/Mineplex.EnjinTranslator/src/mineplex/enjinTranslator/purchase/data/PurchaseRepository.java @@ -15,7 +15,7 @@ import mineplex.serverdata.database.column.ColumnBoolean; import mineplex.serverdata.database.column.ColumnInt; import mineplex.serverdata.database.column.ColumnVarChar; -public class PurchaseRepository extends MinecraftRepository +public class PurchaseRepository extends RepositoryBase { private static String INSERT_ACCOUNT_PURCHASE = "INSERT INTO accountPurchases (accountId, packageId, amount, date, success) VALUES (?, ?, ?, now(), ?);"; @@ -24,14 +24,8 @@ public class PurchaseRepository extends MinecraftRepository public PurchaseRepository(JavaPlugin plugin) { - super(plugin, DBPool.getAccount()); + super(DBPool.getAccount()); } - - @Override - protected void initialize() { } - - @Override - protected void update() { } public void addPackage(String name, ResultSetCallable callable) { diff --git a/Plugins/Mineplex.Game.Clans.Compensation/plugin.yml b/Plugins/Mineplex.Game.Clans.Compensation/plugin.yml new file mode 100644 index 000000000..1ee7068c6 --- /dev/null +++ b/Plugins/Mineplex.Game.Clans.Compensation/plugin.yml @@ -0,0 +1,4 @@ +name: Compensation +main: mineplex.game.clans.compensation.ClansCompensation +version: 1.0 +depend: [Clans] \ No newline at end of file diff --git a/Plugins/Mineplex.Game.Clans.Compensation/pom.xml b/Plugins/Mineplex.Game.Clans.Compensation/pom.xml new file mode 100644 index 000000000..008bc9980 --- /dev/null +++ b/Plugins/Mineplex.Game.Clans.Compensation/pom.xml @@ -0,0 +1,24 @@ + + + 4.0.0 + + + com.mineplex + mineplex-plugin + dev-SNAPSHOT + ../plugin.xml + + + ClansCompensation + mineplex-game-clans-compensation + + + + ${project.groupId} + mineplex-game-clans + ${project.version} + provided + + + diff --git a/Plugins/Mineplex.Game.Clans.Compensation/src/mineplex/game/clans/compensation/ClansCompensation.java b/Plugins/Mineplex.Game.Clans.Compensation/src/mineplex/game/clans/compensation/ClansCompensation.java new file mode 100644 index 000000000..f73364d6c --- /dev/null +++ b/Plugins/Mineplex.Game.Clans.Compensation/src/mineplex/game/clans/compensation/ClansCompensation.java @@ -0,0 +1,777 @@ +package mineplex.game.clans.compensation; + +import java.io.BufferedReader; +import java.io.BufferedWriter; +import java.io.DataInputStream; +import java.io.File; +import java.io.FileInputStream; +import java.io.FileWriter; +import java.io.IOException; +import java.io.InputStreamReader; +import java.util.ArrayList; +import java.util.List; +import java.util.Random; +import java.util.UUID; + +import org.apache.commons.io.FileUtils; +import org.bukkit.Bukkit; +import org.bukkit.Color; +import org.bukkit.FireworkEffect; +import org.bukkit.Material; +import org.bukkit.block.Block; +import org.bukkit.block.Chest; +import org.bukkit.entity.Player; +import org.bukkit.event.EventHandler; +import org.bukkit.event.Listener; +import org.bukkit.event.player.PlayerJoinEvent; +import org.bukkit.inventory.ItemStack; +import org.bukkit.plugin.java.JavaPlugin; + +import mineplex.core.common.util.C; +import mineplex.core.common.util.Callback; +import mineplex.core.common.util.F; +import mineplex.core.common.util.UtilFirework; +import mineplex.core.common.util.UtilPlayer; +import mineplex.core.itemstack.ItemBuilder; +import mineplex.core.itemstack.ItemStackFactory; +import mineplex.game.clans.clans.ClanInfo; +import mineplex.game.clans.clans.ClansManager; +import mineplex.game.clans.clans.amplifiers.AmplifierManager.AmplifierType; +import mineplex.game.clans.core.repository.ClanTerritory; +import mineplex.game.clans.items.ItemType; +import mineplex.game.clans.items.RareItemFactory; +import mineplex.game.clans.items.attributes.armor.ConqueringArmorAttribute; +import mineplex.game.clans.items.attributes.armor.PaddedAttribute; +import mineplex.game.clans.items.attributes.armor.ReinforcedAttribute; +import mineplex.game.clans.items.attributes.armor.SlantedAttribute; +import mineplex.game.clans.items.attributes.bow.HeavyArrowsAttribute; +import mineplex.game.clans.items.attributes.bow.HuntingAttribute; +import mineplex.game.clans.items.attributes.bow.InverseAttribute; +import mineplex.game.clans.items.attributes.bow.LeechingAttribute; +import mineplex.game.clans.items.attributes.bow.RecursiveAttribute; +import mineplex.game.clans.items.attributes.bow.ScorchingAttribute; +import mineplex.game.clans.items.attributes.bow.SlayingAttribute; +import mineplex.game.clans.items.attributes.weapon.ConqueringAttribute; +import mineplex.game.clans.items.attributes.weapon.FlamingAttribute; +import mineplex.game.clans.items.attributes.weapon.FrostedAttribute; +import mineplex.game.clans.items.attributes.weapon.HasteAttribute; +import mineplex.game.clans.items.attributes.weapon.JaggedAttribute; +import mineplex.game.clans.items.attributes.weapon.SharpAttribute; +import mineplex.game.clans.items.economy.GoldToken; +import mineplex.game.clans.items.legendaries.AlligatorsTooth; +import mineplex.game.clans.items.legendaries.GiantsBroadsword; +import mineplex.game.clans.items.legendaries.HyperAxe; +import mineplex.game.clans.items.legendaries.MagneticMaul; +import mineplex.game.clans.items.legendaries.MeridianScepter; +import mineplex.game.clans.items.legendaries.WindBlade; + +public class ClansCompensation extends JavaPlugin implements Listener +{ + private final List _compensating = new ArrayList<>(); + private boolean _debug; + + @Override + public void onEnable() + { + System.out.println("[INFO] Enabling ClansCompensation"); + Bukkit.getPluginManager().registerEvents(this, this); + ClansManager.getInstance().addCommand(new CompensationCommand(ClansManager.getInstance(), this)); + loadUUIDs(uuids -> + { + _compensating.clear(); + _compensating.addAll(uuids); + }); + try + { + _debug = new File(new File(".").getCanonicalPath() + File.separator + "DebugCompensation.dat").exists(); + } + catch (IOException e) + { + _debug = false; + } + } + + @Override + public void onDisable() + { + System.out.println("[INFO] Disabling ClansCompensation"); + saveUUIDs(false); + } + + @EventHandler + public void onJoin(PlayerJoinEvent event) + { + if (canClaim(event.getPlayer().getUniqueId())) + { + UtilPlayer.message(event.getPlayer(), F.main("Compensation", "You have a compensation package ready to open! Run /compensation to get started!")); + } + } + + public boolean canClaim(UUID uuid) + { + if (_debug) + { + return true; + } + return _compensating.contains(uuid); + } + + public void claim(Player player) + { + if (_debug || _compensating.remove(player.getUniqueId())) + { + Block[] possible = new Block[] + { + player.getLocation().getBlock().getRelative(1, 0, 0), + player.getLocation().getBlock().getRelative(-1, 0, 0), + player.getLocation().getBlock().getRelative(0, 0, 1), + player.getLocation().getBlock().getRelative(0, 0, -1) + }; + + Block spawn = null; + Block spawn2 = null; + for (Block block : possible) + { + if (spawn != null && spawn2 != null) + { + break; + } + ClanTerritory claim = ClansManager.getInstance().getClanUtility().getClaim(block.getLocation()); + if (claim != null) + { + if (ClansManager.getInstance().getClan(player) == null) + { + continue; + } + ClanInfo clan = ClansManager.getInstance().getClan(player); + if (!clan.getName().equals(claim.Owner)) + { + continue; + } + } + ClansManager.getInstance().getBlockRestore().restore(block); + if (block.getType() != Material.AIR) + { + continue; + } + boolean overlap = false; + for (int x = -1; x <= 1; x++) + { + for (int z = -1; z <= 1; z++) + { + Block check = block.getRelative(x, 0, z); + if (check.getType() == Material.CHEST) + { + overlap = true; + } + } + } + if (overlap) + { + continue; + } + + if (spawn == null) + { + spawn = block; + continue; + } + if (spawn2 == null) + { + spawn2 = block; + continue; + } + } + + if (spawn == null || spawn2 == null) + { + UtilPlayer.message(player, F.main("Compensation", "Try that again in a different spot!")); + if (!_debug) + { + _compensating.add(player.getUniqueId()); + } + return; + } + else + { + spawn.setType(Material.CHEST); + spawn2.setType(Material.CHEST); + Chest one = (Chest)spawn.getState(); + Chest two = (Chest)spawn2.getState(); + FireworkEffect effect = FireworkEffect.builder().with(FireworkEffect.Type.BALL).withColor(Color.MAROON).withFade(Color.NAVY).withFlicker().build(); + UtilFirework.playFirework(spawn.getLocation().add(0.5, 0.5, 0.5), effect); + UtilFirework.playFirework(spawn2.getLocation().add(0.5, 0.5, 0.5), effect); + + List items = new ArrayList<>(); + { + UtilPlayer.message(player, F.main("Compensation", "You received two " + F.name(AmplifierType.SIXTY.getDisplayName() + "s") + "!")); + ClansManager.getInstance().getInventoryManager().addItemToInventory(player, AmplifierType.SIXTY.getFullItemName(), 2); + for (int i = 0; i < 10; i++) + { + items.add(new GoldToken(50000).toItemStack()); + } + items.add(ItemStackFactory.Instance.CreateStack(Material.BEACON, (byte) 0, 1, C.cGold + "Supply Drop")); + items.add(new ItemStack(Material.DIAMOND_HELMET, 5)); + items.add(new ItemStack(Material.DIAMOND_CHESTPLATE, 5)); + items.add(new ItemStack(Material.DIAMOND_LEGGINGS, 5)); + items.add(new ItemStack(Material.DIAMOND_BOOTS, 5)); + items.add(new ItemStack(Material.IRON_HELMET, 5)); + items.add(new ItemStack(Material.IRON_CHESTPLATE, 5)); + items.add(new ItemStack(Material.IRON_LEGGINGS, 5)); + items.add(new ItemStack(Material.IRON_BOOTS, 5)); + items.add(new ItemStack(Material.GOLD_HELMET, 5)); + items.add(new ItemStack(Material.GOLD_CHESTPLATE, 5)); + items.add(new ItemStack(Material.GOLD_LEGGINGS, 5)); + items.add(new ItemStack(Material.GOLD_BOOTS, 5)); + items.add(new ItemStack(Material.CHAINMAIL_HELMET, 5)); + items.add(new ItemStack(Material.CHAINMAIL_CHESTPLATE, 5)); + items.add(new ItemStack(Material.CHAINMAIL_LEGGINGS, 5)); + items.add(new ItemStack(Material.CHAINMAIL_BOOTS, 5)); + items.add(new ItemStack(Material.LEATHER_HELMET, 5)); + items.add(new ItemStack(Material.LEATHER_CHESTPLATE, 5)); + items.add(new ItemStack(Material.LEATHER_LEGGINGS, 5)); + items.add(new ItemStack(Material.LEATHER_BOOTS, 5)); + items.add(new ItemStack(Material.DIAMOND_SWORD, 5)); + items.add(new ItemStack(Material.DIAMOND_AXE, 5)); + items.add(new ItemStack(Material.GOLD_SWORD, 5)); + items.add(new ItemStack(Material.GOLD_AXE, 5)); + items.add(new ItemStack(Material.IRON_SWORD, 5)); + items.add(new ItemStack(Material.IRON_AXE, 5)); + items.add(new ItemStack(Material.BOW, 5)); + items.add(new ItemBuilder(Material.ENCHANTMENT_TABLE).setTitle(C.cGreenB + "Class Shop").build()); + items.add(new ItemStack(Material.ANVIL, 3)); + Random rand = new Random(); + for (int i = 0; i < 3; i++) + { + int picked = rand.nextInt(24 * 3); + RareItemFactory factory; + switch (picked) + { + case 0: + factory = new RareItemFactory(ItemType.LEGENDARY); + factory.setLegendary(WindBlade.class); + factory.setSuffix(HasteAttribute.class); + items.add(factory.fabricate()); + break; + case 1: + factory = new RareItemFactory(ItemType.WEAPON); + factory.setType(Material.DIAMOND_AXE); + factory.setSuperPrefix(FrostedAttribute.class); + items.add(factory.fabricate()); + break; + case 2: + factory = new RareItemFactory(ItemType.WEAPON); + factory.setType(Material.IRON_SWORD); + factory.setSuperPrefix(FlamingAttribute.class); + factory.setPrefix(JaggedAttribute.class); + items.add(factory.fabricate()); + break; + case 3: + factory = new RareItemFactory(ItemType.LEGENDARY); + factory.setLegendary(AlligatorsTooth.class); + items.add(factory.fabricate()); + break; + case 4: + factory = new RareItemFactory(ItemType.BOW); + factory.setType(Material.BOW); + factory.setSuperPrefix(LeechingAttribute.class); + items.add(factory.fabricate()); + break; + case 5: + factory = new RareItemFactory(ItemType.WEAPON); + factory.setType(Material.DIAMOND_AXE); + factory.setPrefix(JaggedAttribute.class); + factory.setSuffix(ConqueringAttribute.class); + items.add(factory.fabricate()); + break; + case 6: + factory = new RareItemFactory(ItemType.LEGENDARY); + factory.setLegendary(GiantsBroadsword.class); + items.add(factory.fabricate()); + break; + case 7: + factory = new RareItemFactory(ItemType.WEAPON); + factory.setType(Material.DIAMOND_SWORD); + factory.setSuffix(HasteAttribute.class); + items.add(factory.fabricate()); + break; + case 8: + factory = new RareItemFactory(ItemType.WEAPON); + factory.setType(Material.DIAMOND_SWORD); + factory.setSuperPrefix(FlamingAttribute.class); + items.add(factory.fabricate()); + break; + case 9: + factory = new RareItemFactory(ItemType.LEGENDARY); + factory.setLegendary(MagneticMaul.class); + factory.setSuffix(HasteAttribute.class); + items.add(factory.fabricate()); + break; + case 10: + factory = new RareItemFactory(ItemType.WEAPON); + factory.setType(Material.GOLD_SWORD); + factory.setPrefix(JaggedAttribute.class); + items.add(factory.fabricate()); + break; + case 11: + factory = new RareItemFactory(ItemType.WEAPON); + factory.setType(Material.DIAMOND_AXE); + factory.setSuperPrefix(FlamingAttribute.class); + items.add(factory.fabricate()); + break; + case 12: + factory = new RareItemFactory(ItemType.LEGENDARY); + factory.setLegendary(MeridianScepter.class); + items.add(factory.fabricate()); + break; + case 13: + factory = new RareItemFactory(ItemType.WEAPON); + factory.setType(Material.DIAMOND_SWORD); + factory.setPrefix(JaggedAttribute.class); + factory.setSuffix(ConqueringAttribute.class); + items.add(factory.fabricate()); + break; + case 14: + factory = new RareItemFactory(ItemType.WEAPON); + factory.setType(Material.IRON_SWORD); + factory.setSuperPrefix(FlamingAttribute.class); + items.add(factory.fabricate()); + break; + case 15: + factory = new RareItemFactory(ItemType.LEGENDARY); + factory.setLegendary(AlligatorsTooth.class); + items.add(factory.fabricate()); + break; + case 16: + factory = new RareItemFactory(ItemType.WEAPON); + factory.setType(Material.DIAMOND_SWORD); + factory.setSuperPrefix(FrostedAttribute.class); + factory.setPrefix(JaggedAttribute.class); + items.add(factory.fabricate()); + break; + case 17: + factory = new RareItemFactory(ItemType.WEAPON); + factory.setType(Material.GOLD_AXE); + factory.setSuperPrefix(FlamingAttribute.class); + items.add(factory.fabricate()); + break; + case 18: + factory = new RareItemFactory(ItemType.LEGENDARY); + factory.setLegendary(WindBlade.class); + factory.setSuffix(ConqueringAttribute.class); + items.add(factory.fabricate()); + break; + case 19: + factory = new RareItemFactory(ItemType.WEAPON); + factory.setType(Material.IRON_SWORD); + factory.setSuperPrefix(FrostedAttribute.class); + factory.setSuffix(HasteAttribute.class); + items.add(factory.fabricate()); + break; + case 20: + factory = new RareItemFactory(ItemType.WEAPON); + factory.setType(Material.DIAMOND_AXE); + factory.setSuperPrefix(FrostedAttribute.class); + factory.setPrefix(JaggedAttribute.class); + items.add(factory.fabricate()); + break; + case 21: + factory = new RareItemFactory(ItemType.LEGENDARY); + factory.setLegendary(GiantsBroadsword.class); + factory.setSuffix(HasteAttribute.class); + items.add(factory.fabricate()); + break; + case 22: + factory = new RareItemFactory(ItemType.WEAPON); + factory.setType(Material.DIAMOND_SWORD); + factory.setSuffix(ConqueringAttribute.class); + items.add(factory.fabricate()); + break; + case 23: + factory = new RareItemFactory(ItemType.BOW); + factory.setType(Material.BOW); + factory.setPrefix(RecursiveAttribute.class); + items.add(factory.fabricate()); + break; + case 24: + factory = new RareItemFactory(ItemType.LEGENDARY); + factory.setLegendary(HyperAxe.class); + factory.setSuperPrefix(FlamingAttribute.class); + items.add(factory.fabricate()); + break; + case 25: + factory = new RareItemFactory(ItemType.BOW); + factory.setType(Material.BOW); + factory.setPrefix(HeavyArrowsAttribute.class); + items.add(factory.fabricate()); + break; + case 26: + factory = new RareItemFactory(ItemType.WEAPON); + factory.setType(Material.GOLD_SWORD); + factory.setPrefix(JaggedAttribute.class); + items.add(factory.fabricate()); + break; + case 27: + factory = new RareItemFactory(ItemType.LEGENDARY); + factory.setLegendary(MeridianScepter.class); + items.add(factory.fabricate()); + break; + case 28: + factory = new RareItemFactory(ItemType.WEAPON); + factory.setType(Material.GOLD_SWORD); + factory.setPrefix(JaggedAttribute.class); + items.add(factory.fabricate()); + break; + case 29: + factory = new RareItemFactory(ItemType.WEAPON); + factory.setType(Material.DIAMOND_AXE); + factory.setSuffix(HasteAttribute.class); + items.add(factory.fabricate()); + break; + case 30: + factory = new RareItemFactory(ItemType.LEGENDARY); + factory.setLegendary(WindBlade.class); + items.add(factory.fabricate()); + break; + case 31: + factory = new RareItemFactory(ItemType.BOW); + factory.setType(Material.BOW); + factory.setSuperPrefix(ScorchingAttribute.class); + factory.setSuffix(SlayingAttribute.class); + items.add(factory.fabricate()); + break; + case 32: + factory = new RareItemFactory(ItemType.WEAPON); + factory.setType(Material.DIAMOND_SWORD); + factory.setSuperPrefix(FlamingAttribute.class); + items.add(factory.fabricate()); + break; + case 33: + factory = new RareItemFactory(ItemType.LEGENDARY); + factory.setLegendary(HyperAxe.class); + items.add(factory.fabricate()); + break; + case 34: + factory = new RareItemFactory(ItemType.WEAPON); + factory.setType(Material.IRON_SWORD); + factory.setSuperPrefix(FlamingAttribute.class); + factory.setPrefix(JaggedAttribute.class); + items.add(factory.fabricate()); + break; + case 35: + factory = new RareItemFactory(ItemType.WEAPON); + factory.setType(Material.DIAMOND_AXE); + factory.setSuperPrefix(FrostedAttribute.class); + items.add(factory.fabricate()); + break; + case 36: + factory = new RareItemFactory(ItemType.LEGENDARY); + factory.setLegendary(GiantsBroadsword.class); + items.add(factory.fabricate()); + break; + case 37: + factory = new RareItemFactory(ItemType.BOW); + factory.setType(Material.BOW); + factory.setPrefix(InverseAttribute.class); + items.add(factory.fabricate()); + break; + case 38: + factory = new RareItemFactory(ItemType.ARMOR); + factory.setType(Material.DIAMOND_CHESTPLATE); + factory.setPrefix(ReinforcedAttribute.class); + items.add(factory.fabricate()); + break; + case 39: + factory = new RareItemFactory(ItemType.LEGENDARY); + factory.setLegendary(WindBlade.class); + items.add(factory.fabricate()); + break; + case 40: + factory = new RareItemFactory(ItemType.ARMOR); + factory.setType(Material.LEATHER_BOOTS); + factory.setPrefix(SlantedAttribute.class); + items.add(factory.fabricate()); + break; + case 41: + factory = new RareItemFactory(ItemType.WEAPON); + factory.setType(Material.IRON_SWORD); + factory.setSuperPrefix(FrostedAttribute.class); + items.add(factory.fabricate()); + break; + case 42: + factory = new RareItemFactory(ItemType.LEGENDARY); + factory.setLegendary(GiantsBroadsword.class); + items.add(factory.fabricate()); + break; + case 43: + factory = new RareItemFactory(ItemType.ARMOR); + factory.setType(Material.IRON_LEGGINGS); + factory.setPrefix(PaddedAttribute.class); + items.add(factory.fabricate()); + break; + case 44: + factory = new RareItemFactory(ItemType.WEAPON); + factory.setType(Material.GOLD_SWORD); + factory.setPrefix(SharpAttribute.class); + items.add(factory.fabricate()); + break; + case 45: + factory = new RareItemFactory(ItemType.LEGENDARY); + factory.setLegendary(MeridianScepter.class); + items.add(factory.fabricate()); + break; + case 46: + factory = new RareItemFactory(ItemType.ARMOR); + factory.setType(Material.CHAINMAIL_CHESTPLATE); + factory.setPrefix(SlantedAttribute.class); + items.add(factory.fabricate()); + break; + case 47: + factory = new RareItemFactory(ItemType.WEAPON); + factory.setType(Material.IRON_SWORD); + factory.setSuffix(ConqueringAttribute.class); + items.add(factory.fabricate()); + break; + case 48: + factory = new RareItemFactory(ItemType.LEGENDARY); + factory.setLegendary(MagneticMaul.class); + factory.setPrefix(SharpAttribute.class); + items.add(factory.fabricate()); + break; + case 49: + factory = new RareItemFactory(ItemType.ARMOR); + factory.setType(Material.IRON_HELMET); + factory.setSuffix(ConqueringArmorAttribute.class); + items.add(factory.fabricate()); + break; + case 50: + factory = new RareItemFactory(ItemType.WEAPON); + factory.setType(Material.DIAMOND_SWORD); + factory.setSuffix(HasteAttribute.class); + items.add(factory.fabricate()); + break; + case 51: + factory = new RareItemFactory(ItemType.LEGENDARY); + factory.setLegendary(AlligatorsTooth.class); + factory.setSuperPrefix(FrostedAttribute.class); + items.add(factory.fabricate()); + break; + case 52: + factory = new RareItemFactory(ItemType.ARMOR); + factory.setType(Material.LEATHER_BOOTS); + factory.setPrefix(ReinforcedAttribute.class); + items.add(factory.fabricate()); + break; + case 53: + factory = new RareItemFactory(ItemType.ARMOR); + factory.setType(Material.IRON_LEGGINGS); + factory.setPrefix(SlantedAttribute.class); + items.add(factory.fabricate()); + break; + case 54: + factory = new RareItemFactory(ItemType.LEGENDARY); + factory.setLegendary(HyperAxe.class); + items.add(factory.fabricate()); + break; + case 55: + factory = new RareItemFactory(ItemType.BOW); + factory.setType(Material.BOW); + factory.setPrefix(RecursiveAttribute.class); + items.add(factory.fabricate()); + break; + case 56: + factory = new RareItemFactory(ItemType.ARMOR); + factory.setType(Material.CHAINMAIL_BOOTS); + factory.setPrefix(PaddedAttribute.class); + items.add(factory.fabricate()); + break; + case 57: + factory = new RareItemFactory(ItemType.LEGENDARY); + factory.setLegendary(GiantsBroadsword.class); + factory.setSuffix(ConqueringAttribute.class); + items.add(factory.fabricate()); + break; + case 58: + factory = new RareItemFactory(ItemType.ARMOR); + factory.setType(Material.IRON_HELMET); + factory.setPrefix(SlantedAttribute.class); + factory.setSuffix(ConqueringArmorAttribute.class); + items.add(factory.fabricate()); + break; + case 59: + factory = new RareItemFactory(ItemType.BOW); + factory.setType(Material.BOW); + factory.setPrefix(InverseAttribute.class); + items.add(factory.fabricate()); + break; + case 60: + factory = new RareItemFactory(ItemType.LEGENDARY); + factory.setLegendary(WindBlade.class); + factory.setPrefix(JaggedAttribute.class); + items.add(factory.fabricate()); + break; + case 61: + factory = new RareItemFactory(ItemType.WEAPON); + factory.setType(Material.DIAMOND_AXE); + factory.setSuperPrefix(FrostedAttribute.class); + items.add(factory.fabricate()); + break; + case 62: + factory = new RareItemFactory(ItemType.ARMOR); + factory.setType(Material.LEATHER_BOOTS); + factory.setPrefix(PaddedAttribute.class); + items.add(factory.fabricate()); + break; + case 63: + factory = new RareItemFactory(ItemType.LEGENDARY); + factory.setLegendary(AlligatorsTooth.class); + items.add(factory.fabricate()); + break; + case 64: + factory = new RareItemFactory(ItemType.WEAPON); + factory.setType(Material.GOLD_AXE); + factory.setPrefix(JaggedAttribute.class); + items.add(factory.fabricate()); + break; + case 65: + factory = new RareItemFactory(ItemType.WEAPON); + factory.setType(Material.DIAMOND_SWORD); + factory.setSuperPrefix(FlamingAttribute.class); + items.add(factory.fabricate()); + break; + case 66: + factory = new RareItemFactory(ItemType.LEGENDARY); + factory.setLegendary(MeridianScepter.class); + factory.setSuperPrefix(FlamingAttribute.class); + items.add(factory.fabricate()); + break; + case 67: + factory = new RareItemFactory(ItemType.WEAPON); + factory.setType(Material.IRON_AXE); + factory.setSuperPrefix(FrostedAttribute.class); + items.add(factory.fabricate()); + break; + case 68: + factory = new RareItemFactory(ItemType.BOW); + factory.setType(Material.BOW); + factory.setPrefix(HuntingAttribute.class); + items.add(factory.fabricate()); + break; + case 69: + factory = new RareItemFactory(ItemType.LEGENDARY); + factory.setLegendary(HyperAxe.class); + factory.setPrefix(JaggedAttribute.class); + items.add(factory.fabricate()); + break; + case 70: + factory = new RareItemFactory(ItemType.ARMOR); + factory.setType(Material.DIAMOND_CHESTPLATE); + factory.setPrefix(ReinforcedAttribute.class); + items.add(factory.fabricate()); + break; + case 71: + factory = new RareItemFactory(ItemType.WEAPON); + factory.setType(Material.IRON_AXE); + factory.setSuperPrefix(FlamingAttribute.class); + items.add(factory.fabricate()); + break; + } + } + for (int slot = 0; slot < one.getBlockInventory().getSize(); slot++) + { + if (items.isEmpty()) + { + break; + } + one.getBlockInventory().setItem(slot, items.remove(0)); + } + for (int slot = 0; slot < two.getBlockInventory().getSize(); slot++) + { + if (items.isEmpty()) + { + break; + } + two.getBlockInventory().setItem(slot, items.remove(0)); + } + } + } + } + } + + private void loadUUIDs(Callback> uuidCallback) + { + ClansManager.getInstance().runAsync(() -> + { + List ret = new ArrayList<>(); + try + { + FileInputStream fstream = new FileInputStream(new File(".").getCanonicalPath() + File.separator + "compensating.dat"); + DataInputStream in = new DataInputStream(fstream); + BufferedReader br = new BufferedReader(new InputStreamReader(in)); + String line = null; + while ((line = br.readLine()) != null) + { + UUID uuid = UUID.fromString(line); + ret.add(uuid); + } + br.close(); + in.close(); + fstream.close(); + + uuidCallback.run(ret); + } + catch (Exception e) + { + e.printStackTrace(); + uuidCallback.run(ret); + } + }); + } + + private void saveUUIDs(boolean async) + { + Runnable r = () -> + { + try + { + File storage = new File(new File(".").getCanonicalPath() + File.separator + "compensating.dat"); + if (storage.exists()) + { + FileUtils.deleteQuietly(storage); + } + + if (!_compensating.isEmpty()) + { + storage.createNewFile(); + + FileWriter fstream = new FileWriter(storage); + BufferedWriter out = new BufferedWriter(fstream); + + out.write(_compensating.get(0).toString()); + + for (int i = 1; i < _compensating.size(); i++) + { + UUID comp = _compensating.get(i); + out.write("\n"); + out.write(comp.toString()); + } + out.close(); + fstream.close(); + } + } + catch (IOException e) + { + e.printStackTrace(); + } + }; + + if (async) + { + ClansManager.getInstance().runAsync(r); + } + else + { + r.run(); + } + } +} \ No newline at end of file diff --git a/Plugins/Mineplex.Game.Clans.Compensation/src/mineplex/game/clans/compensation/CompensationCommand.java b/Plugins/Mineplex.Game.Clans.Compensation/src/mineplex/game/clans/compensation/CompensationCommand.java new file mode 100644 index 000000000..6e0d344fb --- /dev/null +++ b/Plugins/Mineplex.Game.Clans.Compensation/src/mineplex/game/clans/compensation/CompensationCommand.java @@ -0,0 +1,64 @@ +package mineplex.game.clans.compensation; + +import java.util.Random; + +import org.bukkit.entity.Player; + +import mineplex.core.command.CommandBase; +import mineplex.core.common.Rank; +import mineplex.core.common.util.C; +import mineplex.core.common.util.F; +import mineplex.core.common.util.UtilPlayer; +import mineplex.game.clans.clans.ClansManager; +import net.md_5.bungee.api.ChatColor; +import net.md_5.bungee.api.chat.ClickEvent; +import net.md_5.bungee.api.chat.ComponentBuilder; +import net.md_5.bungee.api.chat.HoverEvent; +import net.md_5.bungee.api.chat.TextComponent; + +public class CompensationCommand extends CommandBase +{ + private final ClansCompensation _main; + private final String _secretKey; + + public CompensationCommand(ClansManager plugin, ClansCompensation main) + { + super(plugin, Rank.ALL, "compensation"); + + _main = main; + char[] characters = "abcdefghijklmnopqrstuvwxyz".toCharArray(); + StringBuilder keyBuilder = new StringBuilder(); + Random rand = new Random(); + while (keyBuilder.length() < 10) + { + keyBuilder.append(characters[rand.nextInt(characters.length)]); + } + _secretKey = keyBuilder.toString(); + } + + @Override + public void Execute(Player caller, String[] args) + { + if (_main.canClaim(caller.getUniqueId())) + { + if (args.length >= 1 && args[0].equals(_secretKey)) + { + _main.claim(caller); + } + else + { + TextComponent message = new TextComponent("Confirm"); + message.setClickEvent(new ClickEvent(ClickEvent.Action.RUN_COMMAND, "/compensation " + _secretKey)); + message.setHoverEvent(new HoverEvent(HoverEvent.Action.SHOW_TEXT, new ComponentBuilder("Redeem your items").create())); + message.setColor(ChatColor.GREEN); + message.setBold(true); + caller.sendMessage(C.cRedB + "WARNING: " + C.cGray + "You are about to claim several free items. Other players may attempt to steal these items from you, so it is highly recommended that you only run this command inside of your own base. Are you sure you wish to claim your items at this time?"); + caller.spigot().sendMessage(message); + } + } + else + { + UtilPlayer.message(caller, F.main("Compensation", "You do not have a compensation package!")); + } + } +} \ No newline at end of file diff --git a/Plugins/Mineplex.Game.Clans.Core/src/mineplex/game/clans/core/repository/ClanRepository.java b/Plugins/Mineplex.Game.Clans.Core/src/mineplex/game/clans/core/repository/ClanRepository.java index 229ebaacf..f0078e3d7 100644 --- a/Plugins/Mineplex.Game.Clans.Core/src/mineplex/game/clans/core/repository/ClanRepository.java +++ b/Plugins/Mineplex.Game.Clans.Core/src/mineplex/game/clans/core/repository/ClanRepository.java @@ -37,7 +37,7 @@ import org.jooq.DSLContext; import static mineplex.database.Tables.*; import static org.jooq.impl.DSL.*; -public class ClanRepository extends MinecraftRepository +public class ClanRepository extends RepositoryBase { private static String CREATE_CLAN_TABLE = "CREATE TABLE IF NOT EXISTS clans (id INT NOT NULL AUTO_INCREMENT, serverId INT NOT NULL, name VARCHAR(100), description VARCHAR(140), home VARCHAR(140), admin BIT(1), dateCreated DATETIME, lastOnline DATETIME, energy INT, PRIMARY KEY (id), INDEX clanName (name));"; private static String CREATE_ACCOUNT_CLAN_TABLE = "CREATE TABLE IF NOT EXISTS accountClan (id INT NOT NULL AUTO_INCREMENT, accountId INT, clanId INT, clanRole VARCHAR(140), PRIMARY KEY (id), FOREIGN KEY (accountId) REFERENCES accounts(id), FOREIGN KEY (clanId) REFERENCES clans(id), INDEX clanIdIndex (clanId));"; @@ -88,7 +88,7 @@ public class ClanRepository extends MinecraftRepository public ClanRepository(JavaPlugin plugin, String serverName, boolean isClansServer) { - super(plugin, DBPool.getAccount()); + super(DBPool.getAccount()); _serverName = serverName; _serverId = -1; @@ -399,11 +399,6 @@ public class ClanRepository extends MinecraftRepository System.out.println("Finished loading clans from database..."); return clans.values(); } - - @Override - protected void update() - { - } public boolean deleteClan(int clanId) { diff --git a/Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/Clans.java b/Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/Clans.java index e36940f3a..8df0e0df1 100644 --- a/Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/Clans.java +++ b/Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/Clans.java @@ -1,12 +1,24 @@ package mineplex.game.clans; +import net.minecraft.server.v1_8_R3.MinecraftServer; + +import org.bukkit.Bukkit; +import org.bukkit.Location; +import org.bukkit.Material; +import org.bukkit.World; +import org.bukkit.craftbukkit.v1_8_R3.CraftWorld; +import org.bukkit.plugin.java.JavaPlugin; +import org.spigotmc.SpigotConfig; + +import mineplex.core.common.Constants; import mineplex.core.CustomTagFix; import mineplex.core.FoodDupeFix; import mineplex.core.TimingsFix; import mineplex.core.account.CoreClientManager; import mineplex.core.achievement.AchievementManager; import mineplex.core.antihack.AntiHack; -import mineplex.core.antihack.AntiHackGuardian; +import mineplex.core.antihack.guardians.AntiHackGuardian; +import mineplex.core.antihack.guardians.GuardianManager; import mineplex.core.blockrestore.BlockRestore; import mineplex.core.chat.Chat; import mineplex.core.chatsnap.SnapshotManager; @@ -34,9 +46,11 @@ import mineplex.core.memory.MemoryFix; import mineplex.core.message.MessageManager; import mineplex.core.monitor.LagMeter; import mineplex.core.packethandler.PacketHandler; +import mineplex.core.portal.GenericServer; import mineplex.core.portal.Portal; import mineplex.core.preferences.PreferencesManager; import mineplex.core.punish.Punish; +import mineplex.core.rankGiveaway.eternal.EternalGiveawayManager; import mineplex.core.recharge.Recharge; import mineplex.core.report.ReportManager; import mineplex.core.report.ReportPlugin; @@ -46,6 +60,7 @@ import mineplex.core.spawn.Spawn; import mineplex.core.stats.StatsManager; import mineplex.core.status.ServerStatusManager; import mineplex.core.teleport.Teleport; +import mineplex.core.twofactor.TwoFactorAuth; import mineplex.core.updater.FileUpdater; import mineplex.core.updater.Updater; import mineplex.core.visibility.VisibilityManager; @@ -58,21 +73,12 @@ import mineplex.game.clans.shop.mining.MiningShop; import mineplex.game.clans.shop.pvp.PvpShop; import mineplex.game.clans.spawn.travel.TravelShop; import mineplex.game.clans.world.WorldManager; -import net.minecraft.server.v1_8_R3.MinecraftServer; -import org.bukkit.Bukkit; -import org.bukkit.Location; -import org.bukkit.Material; -import org.bukkit.World; -import org.bukkit.craftbukkit.v1_8_R3.CraftWorld; -import org.bukkit.plugin.java.JavaPlugin; -import org.spigotmc.SpigotConfig; import static mineplex.core.Managers.require; public class Clans extends JavaPlugin { public static final String MAP = "Season 2"; - private String WEB_CONFIG = "webServer"; // Modules private CoreClientManager _clientManager; @@ -85,17 +91,15 @@ public class Clans extends JavaPlugin Bukkit.setSpawnRadius(0); // Configs - getConfig().addDefault(WEB_CONFIG, "http://accounts.mineplex.com/"); - getConfig().set(WEB_CONFIG, getConfig().getString(WEB_CONFIG)); + getConfig().addDefault(Constants.WEB_CONFIG_KEY, Constants.WEB_ADDRESS); + getConfig().set(Constants.WEB_CONFIG_KEY, getConfig().getString(Constants.WEB_CONFIG_KEY)); saveConfig(); - String webServerAddress = getConfig().getString(WEB_CONFIG); - // Logger.initialize(this); // Static Modules CommandCenter.Initialize(this); - _clientManager = new CoreClientManager(this, webServerAddress); + _clientManager = new CoreClientManager(this); CommandCenter.Instance.setClientManager(_clientManager); require(TimingsFix.class); @@ -108,7 +112,7 @@ public class Clans extends JavaPlugin VisibilityManager.Initialize(this); // new ProfileCacheManager(this); - _donationManager = new DonationManager(this, _clientManager, webServerAddress); + _donationManager = require(DonationManager.class); new FallingBlocks(this); @@ -127,19 +131,22 @@ public class Clans extends JavaPlugin Give.Initialize(this); Teleport teleport = new Teleport(this, _clientManager); - Portal portal = new Portal(this, _clientManager, serverStatusManager.getCurrentServerName()); - new FileUpdater(this, portal, serverStatusManager.getCurrentServerName(), serverStatusManager.getRegion()); + Portal portal = new Portal(); + new FileUpdater(this, portal, serverStatusManager.getCurrentServerName(), serverStatusManager.getRegion(), GenericServer.CLANS_HUB); ClansBanManager clansBans = new ClansBanManager(this, _clientManager, _donationManager); - Punish punish = new Punish(this, webServerAddress, _clientManager); + Punish punish = new Punish(this, _clientManager); DisguiseManager disguiseManager = require(DisguiseManager.class); Creature creature = new Creature(this); AntiHack antiHack = require(AntiHack.class); - antiHack.setKick(false); - Bukkit.getScheduler().runTask(this, antiHack::enableNewAnticheat); + GuardianManager guardianManager = require(GuardianManager.class); + + Bukkit.getScheduler().runTask(this, antiHack::enableAnticheat); + + new EternalGiveawayManager(this, _clientManager, serverStatusManager); { // West Shop @@ -152,7 +159,7 @@ public class Clans extends JavaPlugin Location spawn = new Location(Bukkit.getWorld("world"), -422, 95, 8); for (int i = 0; i < 10; i++) { - antiHack.registerGuardian(new AntiHackGuardian(spawn.clone(), maxX, minX, maxY, minY, maxZ, minZ)); + guardianManager.registerGuardian(new AntiHackGuardian(spawn.clone(), maxX, minX, maxY, minY, maxZ, minZ)); } } @@ -167,7 +174,7 @@ public class Clans extends JavaPlugin Location spawn = new Location(Bukkit.getWorld("world"), 424, 95, -8); for (int i = 0; i < 10; i++) { - antiHack.registerGuardian(new AntiHackGuardian(spawn.clone(), maxX, minX, maxY, minY, maxZ, minZ)); + guardianManager.registerGuardian(new AntiHackGuardian(spawn.clone(), maxX, minX, maxY, minY, maxZ, minZ)); } } @@ -182,7 +189,7 @@ public class Clans extends JavaPlugin Location spawn = new Location(Bukkit.getWorld("world"), 9, 210, -393); for (int i = 0; i < 10; i++) { - antiHack.registerGuardian(new AntiHackGuardian(spawn.clone(), maxX, minX, maxY, minY, maxZ, minZ)); + guardianManager.registerGuardian(new AntiHackGuardian(spawn.clone(), maxX, minX, maxY, minY, maxZ, minZ)); } } @@ -197,7 +204,7 @@ public class Clans extends JavaPlugin Location spawn = new Location(Bukkit.getWorld("world"), 8, 210, 390); for (int i = 0; i < 10; i++) { - antiHack.registerGuardian(new AntiHackGuardian(spawn.clone(), maxX, minX, maxY, minY, maxZ, minZ)); + guardianManager.registerGuardian(new AntiHackGuardian(spawn.clone(), maxX, minX, maxY, minY, maxZ, minZ)); } } @@ -212,11 +219,11 @@ public class Clans extends JavaPlugin Location spawn = new Location(Bukkit.getWorld("world"), 0, 100, 0); for (int i = 0; i < 40; i++) { - antiHack.registerGuardian(new AntiHackGuardian(spawn.clone(), maxX, minX, maxY, minY, maxZ, minZ)); + guardianManager.registerGuardian(new AntiHackGuardian(spawn.clone(), maxX, minX, maxY, minY, maxZ, minZ)); } } - BlockRestore blockRestore = new BlockRestore(this); + BlockRestore blockRestore = require(BlockRestore.class); IgnoreManager ignoreManager = new IgnoreManager(this, _clientManager, preferenceManager, portal); @@ -246,7 +253,7 @@ public class Clans extends JavaPlugin GearManager customGear = new GearManager(this, packetHandler, _clientManager, _donationManager); HologramManager hologram = new HologramManager(this, packetHandler); - _clansManager = new ClansManager(this, clansBans, serverStatusManager.getCurrentServerName(), incognito, packetHandler, punish, _clientManager, _donationManager, preferenceManager, blockRestore, statsManager, teleport, chat, customGear, hologram, inventory, webServerAddress); + _clansManager = new ClansManager(this, clansBans, serverStatusManager.getCurrentServerName(), incognito, packetHandler, punish, _clientManager, _donationManager, preferenceManager, blockRestore, statsManager, teleport, chat, customGear, hologram, inventory); new Recipes(this); new Farming(this); new BuildingShop(_clansManager, _clientManager, _donationManager); @@ -256,6 +263,8 @@ public class Clans extends JavaPlugin new MiningShop(_clansManager, _clientManager, _donationManager); new WorldManager(this); + require(TwoFactorAuth.class); + // Disable spigot item merging for (World world : getServer().getWorlds()) { diff --git a/Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/clans/ClansManager.java b/Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/clans/ClansManager.java index 0b1a36e50..989eb95b7 100644 --- a/Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/clans/ClansManager.java +++ b/Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/clans/ClansManager.java @@ -41,7 +41,6 @@ import com.google.common.io.ByteStreams; import mineplex.core.Managers; import mineplex.core.MiniClientPlugin; import mineplex.core.account.CoreClientManager; -import mineplex.core.achievement.Achievement; import mineplex.core.achievement.AchievementManager; import mineplex.core.blockrestore.BlockRestore; import mineplex.core.chat.Chat; @@ -55,6 +54,7 @@ import mineplex.core.common.util.UtilBlock; import mineplex.core.common.util.UtilPlayer; import mineplex.core.common.util.UtilServer; import mineplex.core.common.util.UtilTextMiddle; +import mineplex.core.communities.CommunityManager; import mineplex.core.creature.Creature; import mineplex.core.creature.event.CreatureSpawnCustomEvent; import mineplex.core.disguise.DisguiseManager; @@ -71,6 +71,9 @@ import mineplex.core.menu.MenuManager; import mineplex.core.movement.Movement; import mineplex.core.npc.NpcManager; import mineplex.core.packethandler.PacketHandler; +import mineplex.core.personalServer.PersonalServerManager; +import mineplex.core.portal.GenericServer; +import mineplex.core.portal.Intent; import mineplex.core.portal.Portal; import mineplex.core.preferences.PreferencesManager; import mineplex.core.projectile.ProjectileManager; @@ -200,6 +203,7 @@ public class ClansManager extends MiniClientPluginimplements IRelati private ClassManager _classManager; private BannerManager _bannerManager; private AmplifierManager _amplifierManager; + private RestartManager _restartManager; private SafeLog _safeLog; @@ -248,7 +252,7 @@ public class ClansManager extends MiniClientPluginimplements IRelati // Spawn area - public ClansManager(JavaPlugin plugin, ClansBanManager clansBans, String serverName, IncognitoManager incognitoManager, PacketHandler packetHandler, Punish punish, CoreClientManager clientManager, DonationManager donationManager, PreferencesManager preferencesManager, BlockRestore blockRestore, StatsManager statsManager, Teleport teleport, Chat chat, GearManager gearManager, HologramManager hologramManager, InventoryManager inventoryManager, String webServerAddress) + public ClansManager(JavaPlugin plugin, ClansBanManager clansBans, String serverName, IncognitoManager incognitoManager, PacketHandler packetHandler, Punish punish, CoreClientManager clientManager, DonationManager donationManager, PreferencesManager preferencesManager, BlockRestore blockRestore, StatsManager statsManager, Teleport teleport, Chat chat, GearManager gearManager, HologramManager hologramManager, InventoryManager inventoryManager) { super("Clans Manager", plugin); @@ -284,7 +288,7 @@ public class ClansManager extends MiniClientPluginimplements IRelati _worldEvent = new WorldEventManager(plugin, this, _damageManager, _lootManager, blockRestore, _clanRegions, null); - _taskManager = new TaskManager(plugin, _clientManager, webServerAddress); + _taskManager = new TaskManager(plugin, _clientManager); ClanTips = new ClanTips(plugin, this, preferencesManager); @@ -337,11 +341,13 @@ public class ClansManager extends MiniClientPluginimplements IRelati itemIgnore.add("Proximity Explosive"); itemIgnore.add("Proximity Zapper"); - ItemFactory itemFactory = new ItemFactory(plugin, blockRestore, _condition, _damageManager, energy, fire, _projectileManager, webServerAddress, itemIgnore); - SkillFactory skillManager = new SkillFactory(plugin, _damageManager, this, _combatManager, _condition, _projectileManager, _disguiseManager, blockRestore, fire, new Movement(plugin), teleport, energy, webServerAddress); + ItemFactory itemFactory = new ItemFactory(plugin, blockRestore, _condition, _damageManager, energy, fire, _projectileManager, itemIgnore); + SkillFactory skillManager = new SkillFactory(plugin, _damageManager, this, _combatManager, _condition, _projectileManager, _disguiseManager, blockRestore, fire, new Movement(plugin), teleport, energy); skillManager.RemoveSkill("Dwarf Toss", "Block Toss"); skillManager.removeSkill("Whirlwind Axe"); skillManager.removeSkill("Shield Smash"); + skillManager.removeSkill("Illusion"); + skillManager.removeSkill("Smoke Bomb"); // Check if any Ice Prison blocks will be placed inside a safe zone // fixme Is there any way of checking the destination beforehand? // Although if the user is trying to launch an Ice Prison into a safezone they should know better @@ -374,7 +380,7 @@ public class ClansManager extends MiniClientPluginimplements IRelati }); _worldEvent.setFactory(skillManager); - _classManager = new ClassManager(plugin, _clientManager, donationManager, skillManager, itemFactory, webServerAddress); + _classManager = new ClassManager(plugin, _clientManager, donationManager, skillManager, itemFactory); // Register redis based server commands ServerCommandManager.getInstance().registerCommandType(ClanDeleteCommand.class, new ClanDeleteCommandHandler()); @@ -403,6 +409,9 @@ public class ClansManager extends MiniClientPluginimplements IRelati loadClan(token, false); } _bannerManager.loadBanners(this); + + new PersonalServerManager(plugin, _clientManager).setUseInterfaceItem(false); + new CommunityManager(plugin, _clientManager); Bukkit.getMessenger().registerOutgoingPluginChannel(plugin, "Replay|Restrict"); @@ -463,7 +472,7 @@ public class ClansManager extends MiniClientPluginimplements IRelati _netherManager = new NetherManager(this); _amplifierManager = new AmplifierManager(plugin); - new RestartManager(plugin); + _restartManager = new RestartManager(plugin); } @Override @@ -1207,10 +1216,10 @@ public class ClansManager extends MiniClientPluginimplements IRelati _worldEvent.onDisable(); _goldManager.onDisable(); _playTracker.onDisable(); - _bannerManager.onDisable(); - _amplifierManager.onDisable(); _netherManager.onDisable(); _safeLog.onDisable(); + _restartManager.onDisable(); + _observerManager.onDisable(); } @EventHandler(priority = EventPriority.HIGHEST) @@ -1263,7 +1272,7 @@ public class ClansManager extends MiniClientPluginimplements IRelati { if (event.getMessage().toLowerCase().equals("/lobby") || event.getMessage().toLowerCase().equals("/hub") || event.getMessage().toLowerCase().equals("/leave")) { - Portal.getInstance().sendPlayerToServer(event.getPlayer(), "ClansHub"); + Portal.getInstance().sendPlayerToGenericServer(event.getPlayer(), GenericServer.CLANS_HUB, Intent.PLAYER_REQUEST); event.setCancelled(true); } } diff --git a/Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/clans/ban/ClansBanManager.java b/Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/clans/ban/ClansBanManager.java index b519c1448..56c12bdec 100644 --- a/Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/clans/ban/ClansBanManager.java +++ b/Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/clans/ban/ClansBanManager.java @@ -1,8 +1,24 @@ package mineplex.game.clans.clans.ban; import java.util.HashMap; +import java.util.Map; import java.util.UUID; +import org.bukkit.Bukkit; +import org.bukkit.entity.Player; +import org.bukkit.event.EventHandler; +import org.bukkit.event.EventPriority; +import org.bukkit.event.block.BlockBreakEvent; +import org.bukkit.event.block.BlockPlaceEvent; +import org.bukkit.event.entity.EntityDamageEvent.DamageCause; +import org.bukkit.event.entity.EntityTargetLivingEntityEvent; +import org.bukkit.event.player.AsyncPlayerPreLoginEvent; +import org.bukkit.event.player.PlayerMoveEvent; +import org.bukkit.event.player.PlayerQuitEvent; +import org.bukkit.plugin.java.JavaPlugin; +import org.bukkit.potion.PotionEffect; +import org.bukkit.potion.PotionEffectType; + import mineplex.core.MiniPlugin; import mineplex.core.account.CoreClientManager; import mineplex.core.common.Rank; @@ -25,28 +41,13 @@ import mineplex.game.clans.clans.event.ClansCommandExecutedEvent; import mineplex.minecraft.game.classcombat.Skill.event.SkillTriggerEvent; import mineplex.minecraft.game.core.damage.CustomDamageEvent; -import org.bukkit.Bukkit; -import org.bukkit.entity.Player; -import org.bukkit.event.EventHandler; -import org.bukkit.event.EventPriority; -import org.bukkit.event.block.BlockBreakEvent; -import org.bukkit.event.block.BlockPlaceEvent; -import org.bukkit.event.entity.EntityDamageEvent.DamageCause; -import org.bukkit.event.entity.EntityTargetLivingEntityEvent; -import org.bukkit.event.player.AsyncPlayerPreLoginEvent; -import org.bukkit.event.player.PlayerMoveEvent; -import org.bukkit.event.player.PlayerQuitEvent; -import org.bukkit.plugin.java.JavaPlugin; -import org.bukkit.potion.PotionEffect; -import org.bukkit.potion.PotionEffectType; - public class ClansBanManager extends MiniPlugin { private static final long FREEZE_MESSAGE_INTERVAL = 10000; private final CoreClientManager _clientManager; private final DonationManager _donationManager; private final ClansBanRepository _repository; - private final HashMap _frozen = new HashMap<>(); + private final Map _frozen = new HashMap<>(); public ClansBanManager(JavaPlugin plugin, CoreClientManager clientManager, DonationManager donationManager) { @@ -106,7 +107,7 @@ public class ClansBanManager extends MiniPlugin } catch (Exception ignored) {} } - @EventHandler(priority = EventPriority.LOWEST) + @EventHandler(priority = EventPriority.LOW) public void onQuit(PlayerQuitEvent event) { Float walkSpeed = _frozen.remove(event.getPlayer().getUniqueId()); @@ -116,7 +117,7 @@ public class ClansBanManager extends MiniPlugin event.getPlayer().removePotionEffect(PotionEffectType.JUMP); for (Player staff : UtilServer.GetPlayers()) { - if (_clientManager.hasRank(staff, Rank.HELPER)) + if (_clientManager.hasRank(staff, Rank.CMOD)) { UtilPlayer.message(staff, F.main(getName(), F.elem(event.getPlayer().getName()) + " has logged out while frozen!")); } @@ -236,13 +237,10 @@ public class ClansBanManager extends MiniPlugin @EventHandler public void onTpHome(ClansCommandExecutedEvent event) { - if (event.getCommand().equalsIgnoreCase("tphome")) + if (isFrozen(event.getPlayer())) { - if (isFrozen(event.getPlayer())) - { - event.setCancelled(true); - UtilPlayer.message(event.getPlayer(), F.main(getName(), "You cannot teleport to your Clan home while frozen!")); - } + event.setCancelled(true); + UtilPlayer.message(event.getPlayer(), F.main(getName(), "You cannot use that command while frozen!")); } } @@ -268,7 +266,7 @@ public class ClansBanManager extends MiniPlugin player.addPotionEffect(new PotionEffect(PotionEffectType.JUMP, 999999, -10)); for (Player alert : UtilServer.GetPlayers()) { - if (_clientManager.hasRank(alert, Rank.HELPER)) + if (_clientManager.hasRank(alert, Rank.CMOD)) { UtilPlayer.message(alert, F.main(getName(), F.elem(player.getName()) + " has been frozen by " + F.elem(staff.getName()) + "!")); } @@ -289,7 +287,7 @@ public class ClansBanManager extends MiniPlugin player.removePotionEffect(PotionEffectType.JUMP); for (Player alert : UtilServer.GetPlayers()) { - if (_clientManager.hasRank(alert, Rank.HELPER)) + if (_clientManager.hasRank(alert, Rank.CMOD)) { UtilPlayer.message(alert, F.main(getName(), F.elem(player.getName()) + " has been unfrozen by " + F.elem(staff.getName()) + "!")); continue; diff --git a/Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/clans/ban/ClansBanRepository.java b/Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/clans/ban/ClansBanRepository.java index 9248f8605..3d5c798cc 100644 --- a/Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/clans/ban/ClansBanRepository.java +++ b/Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/clans/ban/ClansBanRepository.java @@ -4,6 +4,7 @@ import mineplex.core.Managers; import mineplex.core.account.CoreClientManager; import mineplex.core.database.MinecraftRepository; import mineplex.serverdata.database.DBPool; +import mineplex.serverdata.database.RepositoryBase; import mineplex.serverdata.database.column.ColumnInt; import org.bukkit.plugin.java.JavaPlugin; @@ -14,7 +15,7 @@ import java.util.Optional; import java.util.UUID; import java.util.concurrent.CompletableFuture; -public class ClansBanRepository extends MinecraftRepository +public class ClansBanRepository extends RepositoryBase { private static final String BAN_PLAYER = "INSERT INTO clanBans (uuid, admin, reason, banTime, unbanTime, permanent, removed) VALUES (?, ?, ?, ?, ?, ?, ?);"; private static final String REMOVE_BAN = "UPDATE clanBans SET removed = 1 WHERE id = ?;"; @@ -22,7 +23,7 @@ public class ClansBanRepository extends MinecraftRepository public ClansBanRepository(JavaPlugin plugin) { - super(plugin, DBPool.getAccount()); + super(DBPool.getAccount()); } public CompletableFuture> ban(UUID uuid, String admin, long time, String reason) @@ -110,12 +111,6 @@ public class ClansBanRepository extends MinecraftRepository } }); } - - @Override - protected void initialize() {} - - @Override - protected void update() {} public void removeBan(ClansBan ban) { diff --git a/Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/clans/banners/BannerManager.java b/Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/clans/banners/BannerManager.java index ec2400792..307e1590d 100644 --- a/Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/clans/banners/BannerManager.java +++ b/Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/clans/banners/BannerManager.java @@ -1,6 +1,7 @@ package mineplex.game.clans.clans.banners; import java.util.HashMap; +import java.util.Map; import org.bukkit.Bukkit; import org.bukkit.Material; @@ -38,7 +39,7 @@ import net.minecraft.server.v1_8_R3.MinecraftServer; */ public class BannerManager extends MiniPlugin { - public final HashMap LoadedBanners = new HashMap<>(); + public final Map LoadedBanners = new HashMap<>(); private final BlockFace[] _radial = { BlockFace.SOUTH, BlockFace.SOUTH_WEST, BlockFace.WEST, BlockFace.NORTH_WEST, BlockFace.NORTH, BlockFace.NORTH_EAST, BlockFace.EAST, BlockFace.SOUTH_EAST }; private BannerRepository _repo; @@ -59,11 +60,11 @@ public class BannerManager extends MiniPlugin public int getBannerUnlockLevel(Player player) { int level = 0; - if (ClansManager.getInstance().getDonationManager().Get(player).OwnsUnknownPackage("Clan Banner Usage")) + if (ClansManager.getInstance().getDonationManager().Get(player).ownsUnknownSalesPackage("Clan Banner Usage")) { level = 1; } - if (ClansManager.getInstance().getDonationManager().Get(player).OwnsUnknownPackage("Clan Banner Editor")) + if (ClansManager.getInstance().getDonationManager().Get(player).ownsUnknownSalesPackage("Clan Banner Editor")) { level = 2; } diff --git a/Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/clans/banners/BannerRepository.java b/Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/clans/banners/BannerRepository.java index bb64c57fc..8d236bcd9 100644 --- a/Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/clans/banners/BannerRepository.java +++ b/Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/clans/banners/BannerRepository.java @@ -1,25 +1,26 @@ package mineplex.game.clans.clans.banners; import java.util.Arrays; -import java.util.HashMap; import java.util.LinkedList; import java.util.List; - -import mineplex.core.database.MinecraftRepository; -import mineplex.game.clans.clans.ClanInfo; -import mineplex.game.clans.clans.ClansManager; -import mineplex.serverdata.database.DBPool; -import mineplex.serverdata.database.column.ColumnInt; -import mineplex.serverdata.database.column.ColumnVarChar; +import java.util.Map; import org.bukkit.DyeColor; import org.bukkit.block.banner.PatternType; import org.bukkit.plugin.java.JavaPlugin; +import mineplex.core.database.MinecraftRepository; +import mineplex.game.clans.clans.ClanInfo; +import mineplex.game.clans.clans.ClansManager; +import mineplex.serverdata.database.DBPool; +import mineplex.serverdata.database.RepositoryBase; +import mineplex.serverdata.database.column.ColumnInt; +import mineplex.serverdata.database.column.ColumnVarChar; + /** * Database repository class for banners */ -public class BannerRepository extends MinecraftRepository +public class BannerRepository extends RepositoryBase { private static final String CREATE = "CREATE TABLE IF NOT EXISTS clanBanners (clanId INT NOT NULL," + "baseColor VARCHAR(15)," @@ -35,7 +36,7 @@ public class BannerRepository extends MinecraftRepository public BannerRepository(JavaPlugin plugin, BannerManager bannerManager) { - super(plugin, DBPool.getAccount()); + super(DBPool.getAccount()); _bannerManager = bannerManager; } @@ -44,7 +45,7 @@ public class BannerRepository extends MinecraftRepository * @param map The hashmap to load the banner into * @param clan The clan whose banner to fetch */ - public void loadBanner(final HashMap map, ClanInfo clan) + public void loadBanner(final Map map, ClanInfo clan) { _bannerManager.runAsync(() -> { @@ -89,7 +90,7 @@ public class BannerRepository extends MinecraftRepository * @param map The hashmap to load the banner into * @param clan The clan whose banner to fetch */ - public void loadBanners(final HashMap map, ClansManager clanManager) + public void loadBanners(final Map map, ClansManager clanManager) { _bannerManager.runAsync(() -> { @@ -162,13 +163,4 @@ public class BannerRepository extends MinecraftRepository executeUpdate(DELETE_BANNER, new ColumnInt("clanId", clan.getId())); }); } - - @Override - protected void initialize() - { - //executeUpdate(CREATE); - } - - @Override - protected void update() {} } diff --git a/Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/clans/commands/ClansCommand.java b/Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/clans/commands/ClansCommand.java index db1320461..39511c874 100644 --- a/Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/clans/commands/ClansCommand.java +++ b/Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/clans/commands/ClansCommand.java @@ -28,7 +28,6 @@ import mineplex.core.common.util.UtilTime.TimeUnit; import mineplex.core.common.util.UtilWorld; import mineplex.core.delayedtask.DelayedTask; import mineplex.core.delayedtask.DelayedTaskClient; -import mineplex.core.incognito.IncognitoManager; import mineplex.core.recharge.Recharge; import mineplex.game.clans.clans.ClanInfo; import mineplex.game.clans.clans.ClanRole; @@ -138,6 +137,14 @@ public class ClansCommand extends CommandBase private void forceJoin(Player caller, String[] args) { + ClansCommandExecutedEvent event = new ClansCommandExecutedEvent(caller, "forcejoin", args); + UtilServer.getServer().getPluginManager().callEvent(event); + + if (event.isCancelled()) + { + return; + } + if (!Plugin.getClientManager().hasRank(caller, Rank.ADMIN)) { UtilPlayer.message(caller, F.main("Clans", "This requires ADMIN+ permission.")); @@ -243,7 +250,14 @@ public class ClansCommand extends CommandBase public void create(final Player caller, final String[] args) { - System.out.println("CREATE COMMAND"); +// System.out.println("CREATE COMMAND"); + ClansCommandExecutedEvent event = new ClansCommandExecutedEvent(caller, "create", args); + UtilServer.getServer().getPluginManager().callEvent(event); + + if (event.isCancelled()) + { + return; + } ClientClan client = Plugin.Get(caller); @@ -336,11 +350,27 @@ public class ClansCommand extends CommandBase public void delete(final Player caller, String[] args) { + ClansCommandExecutedEvent event = new ClansCommandExecutedEvent(caller, "disband", args); + UtilServer.getServer().getPluginManager().callEvent(event); + + if (event.isCancelled()) + { + return; + } + Plugin.getClanUtility().delete(caller); } public void invite(Player caller, String[] args) { + ClansCommandExecutedEvent event = new ClansCommandExecutedEvent(caller, "invite", args); + UtilServer.getServer().getPluginManager().callEvent(event); + + if (event.isCancelled()) + { + return; + } + ClanInfo clan = Plugin.getClanUtility().getClanByPlayer(caller); if (clan == null) @@ -375,6 +405,13 @@ public class ClansCommand extends CommandBase // // return; // } + ClansCommandExecutedEvent event = new ClansCommandExecutedEvent(caller, "stuck"); + UtilServer.getServer().getPluginManager().callEvent(event); + + if (event.isCancelled()) + { + return; + } if (DelayedTask.Instance.HasTask(caller, "Spawn Teleport")) { @@ -460,6 +497,14 @@ public class ClansCommand extends CommandBase public void join(final Player caller, String[] args) { + ClansCommandExecutedEvent cevent = new ClansCommandExecutedEvent(caller, "join", args); + UtilServer.getServer().getPluginManager().callEvent(cevent); + + if (cevent.isCancelled()) + { + return; + } + if (Plugin.getClanMemberUuidMap().containsKey(caller.getUniqueId())) { UtilPlayer.message(caller, F.main("Clans", "You are already in a Clan.")); @@ -532,6 +577,14 @@ public class ClansCommand extends CommandBase public void leave(final Player caller, String[] args) { + ClansCommandExecutedEvent event = new ClansCommandExecutedEvent(caller, "leave"); + UtilServer.getServer().getPluginManager().callEvent(event); + + if (event.isCancelled()) + { + return; + } + final ClanInfo clan = Plugin.getClanUtility().getClanByPlayer(caller); if (clan == null) @@ -569,6 +622,14 @@ public class ClansCommand extends CommandBase public void kick(final Player caller, String[] args) { + ClansCommandExecutedEvent event = new ClansCommandExecutedEvent(caller, "kick", args); + UtilServer.getServer().getPluginManager().callEvent(event); + + if (event.isCancelled()) + { + return; + } + final ClanInfo clan = Plugin.getClanUtility().getClanByPlayer(caller); if (clan == null) @@ -590,6 +651,14 @@ public class ClansCommand extends CommandBase public void promote(Player caller, String[] args) { + ClansCommandExecutedEvent event = new ClansCommandExecutedEvent(caller, "promote", args); + UtilServer.getServer().getPluginManager().callEvent(event); + + if (event.isCancelled()) + { + return; + } + ClanInfo clan = Plugin.getClanUtility().getClanByPlayer(caller); if (clan == null) @@ -611,6 +680,14 @@ public class ClansCommand extends CommandBase public void demote(Player caller, String[] args) { + ClansCommandExecutedEvent event = new ClansCommandExecutedEvent(caller, "demote", args); + UtilServer.getServer().getPluginManager().callEvent(event); + + if (event.isCancelled()) + { + return; + } + ClanInfo clan = Plugin.getClanUtility().getClanByPlayer(caller); if (clan == null) @@ -632,6 +709,14 @@ public class ClansCommand extends CommandBase public void ally(Player caller, String[] args) { + ClansCommandExecutedEvent event = new ClansCommandExecutedEvent(caller, "ally", args); + UtilServer.getServer().getPluginManager().callEvent(event); + + if (event.isCancelled()) + { + return; + } + ClanInfo cA = Plugin.getClanUtility().getClanByPlayer(caller); if (cA == null) @@ -761,6 +846,14 @@ public class ClansCommand extends CommandBase public void neutral(Player caller, String[] args) { + ClansCommandExecutedEvent event = new ClansCommandExecutedEvent(caller, "neutral", args); + UtilServer.getServer().getPluginManager().callEvent(event); + + if (event.isCancelled()) + { + return; + } + ClanInfo cA = Plugin.getClanMemberUuidMap().get(caller.getUniqueId()); if (cA == null) @@ -843,6 +936,14 @@ public class ClansCommand extends CommandBase } } + ClansCommandExecutedEvent event = new ClansCommandExecutedEvent(caller, "unclaim"); + UtilServer.getServer().getPluginManager().callEvent(event); + + if (event.isCancelled()) + { + return; + } + Plugin.getClanUtility().unclaim(caller, caller.getLocation().getChunk()); } @@ -867,11 +968,27 @@ public class ClansCommand extends CommandBase public void unclaimall(Player caller) { + ClansCommandExecutedEvent event = new ClansCommandExecutedEvent(caller, "unclaimall"); + UtilServer.getServer().getPluginManager().callEvent(event); + + if (event.isCancelled()) + { + return; + } + Plugin.getClanUtility().unclaimAll(caller); } public void map(Player caller, String[] args) { + ClansCommandExecutedEvent event = new ClansCommandExecutedEvent(caller, "map"); + UtilServer.getServer().getPluginManager().callEvent(event); + + if (event.isCancelled()) + { + return; + } + Plugin.getItemMapManager().setMap(caller); } @@ -1048,7 +1165,7 @@ public class ClansCommand extends CommandBase public void infoClan(Player caller, String search) { - System.out.println(search); +// System.out.println(search); if (search == null) { @@ -1089,12 +1206,12 @@ public class ClansCommand extends CommandBase if (clan == null) return; -// if (_clansManager.getNetherManager().isInNether(caller)) -// { -// _clansManager.message(caller, "You are currently in " + F.clansNether("The Nether") + "."); -// -// return; -// } + if (_clansManager.getNetherManager().isInNether(caller)) + { + _clansManager.message(caller, "You are currently in " + F.clansNether("The Nether") + "."); + + return; + } UtilPlayer.message(caller, clan.mTerritory()); } diff --git a/Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/clans/map/ItemMapManager.java b/Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/clans/map/ItemMapManager.java index fc736b4f8..ba36f3406 100644 --- a/Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/clans/map/ItemMapManager.java +++ b/Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/clans/map/ItemMapManager.java @@ -24,7 +24,6 @@ import org.bukkit.event.EventPriority; import org.bukkit.event.block.Action; import org.bukkit.event.entity.ItemSpawnEvent; import org.bukkit.event.entity.PlayerDeathEvent; -import org.bukkit.event.inventory.InventoryClickEvent; import org.bukkit.event.player.PlayerInteractEntityEvent; import org.bukkit.event.player.PlayerInteractEvent; import org.bukkit.event.player.PlayerItemHeldEvent; @@ -32,13 +31,10 @@ import org.bukkit.event.player.PlayerJoinEvent; import org.bukkit.event.player.PlayerQuitEvent; import org.bukkit.event.player.PlayerTeleportEvent; import org.bukkit.event.world.ChunkLoadEvent; -import org.bukkit.event.world.ChunkUnloadEvent; -import org.bukkit.inventory.Inventory; import org.bukkit.inventory.ItemStack; import org.bukkit.map.MapRenderer; import org.bukkit.map.MapView; -import com.google.common.base.Objects; import com.google.common.collect.HashMultiset; import com.google.common.collect.Iterables; import com.google.common.collect.Multisets; @@ -46,7 +42,7 @@ import com.google.common.collect.Multisets; import mineplex.core.MiniPlugin; import mineplex.core.common.util.UtilTime.TimeUnit; import mineplex.core.itemstack.ItemBuilder; -import mineplex.core.portal.ServerTransferEvent; +import mineplex.core.portal.events.ServerTransferEvent; import mineplex.core.updater.UpdateType; import mineplex.core.updater.event.UpdateEvent; import mineplex.game.clans.clans.ClansManager; diff --git a/Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/clans/nameblacklist/repository/ClanNameBlacklistRepository.java b/Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/clans/nameblacklist/repository/ClanNameBlacklistRepository.java index 2b011adc7..662900a31 100644 --- a/Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/clans/nameblacklist/repository/ClanNameBlacklistRepository.java +++ b/Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/clans/nameblacklist/repository/ClanNameBlacklistRepository.java @@ -10,10 +10,11 @@ import mineplex.core.common.util.Callback; import mineplex.core.database.MinecraftRepository; import mineplex.game.clans.clans.nameblacklist.ClansBlacklist; import mineplex.serverdata.database.DBPool; +import mineplex.serverdata.database.RepositoryBase; import mineplex.serverdata.database.column.ColumnTimestamp; import mineplex.serverdata.database.column.ColumnVarChar; -public class ClanNameBlacklistRepository extends MinecraftRepository +public class ClanNameBlacklistRepository extends RepositoryBase { private static final String CREATE = "CREATE TABLE IF NOT EXISTS clanNameBlacklist (" + "clanName VARCHAR(20) NOT NULL, " @@ -29,7 +30,7 @@ public class ClanNameBlacklistRepository extends MinecraftRepository public ClanNameBlacklistRepository(JavaPlugin plugin, ClansBlacklist blacklist) { - super(plugin, DBPool.getAccount()); + super(DBPool.getAccount()); _blacklist = blacklist; } @@ -60,11 +61,6 @@ public class ClanNameBlacklistRepository extends MinecraftRepository callback.run(list); }); } - - @Override - protected void initialize() - { - } @Override protected void update() diff --git a/Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/clans/nether/NetherManager.java b/Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/clans/nether/NetherManager.java index 13ea3c37d..79f0dab91 100644 --- a/Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/clans/nether/NetherManager.java +++ b/Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/clans/nether/NetherManager.java @@ -493,12 +493,12 @@ public class NetherManager extends MiniPlugin @EventHandler public void onTpHome(ClansCommandExecutedEvent event) { - if (event.getCommand().equalsIgnoreCase("tphome")) + if (event.getCommand().equalsIgnoreCase("tphome") || event.getCommand().equalsIgnoreCase("stuck")) { if (isInNether(event.getPlayer())) { event.setCancelled(true); - UtilPlayer.message(event.getPlayer(), F.main(getName(), "You cannot teleport to your Clan home while in " + F.clansNether("The Nether") + "!")); + UtilPlayer.message(event.getPlayer(), F.main(getName(), "You cannot teleport while in " + F.clansNether("The Nether") + "!")); } } } diff --git a/Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/clans/nether/PortalRepository.java b/Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/clans/nether/PortalRepository.java index 6074de105..789de1e55 100644 --- a/Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/clans/nether/PortalRepository.java +++ b/Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/clans/nether/PortalRepository.java @@ -3,6 +3,7 @@ package mineplex.game.clans.clans.nether; import mineplex.core.common.util.UtilWorld; import mineplex.core.database.MinecraftRepository; import mineplex.serverdata.database.DBPool; +import mineplex.serverdata.database.RepositoryBase; import mineplex.serverdata.database.column.ColumnBoolean; import mineplex.serverdata.database.column.ColumnInt; import mineplex.serverdata.database.column.ColumnVarChar; @@ -12,7 +13,7 @@ import org.bukkit.plugin.java.JavaPlugin; /** * Database repository class for nether portals */ -public class PortalRepository extends MinecraftRepository +public class PortalRepository extends RepositoryBase { private static final String CREATE = "CREATE TABLE IF NOT EXISTS clansNetherPortals (id INT NOT NULL AUTO_INCREMENT," + "cornerOne VARCHAR(30)," @@ -28,7 +29,7 @@ public class PortalRepository extends MinecraftRepository public PortalRepository(JavaPlugin plugin, NetherManager portalManager) { - super(plugin, DBPool.getAccount()); + super(DBPool.getAccount()); _nether = portalManager; } @@ -95,15 +96,4 @@ public class PortalRepository extends MinecraftRepository executeUpdate(DELETE_PORTAL, new ColumnInt("id", id)); }); } - - @Override - protected void initialize() - { - executeUpdate(CREATE); - } - - @Override - protected void update() - { - } } \ No newline at end of file diff --git a/Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/clans/playtime/command/PlayTimeCommand.java b/Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/clans/playtime/command/PlayTimeCommand.java index 30b82b248..61b9fc451 100644 --- a/Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/clans/playtime/command/PlayTimeCommand.java +++ b/Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/clans/playtime/command/PlayTimeCommand.java @@ -38,36 +38,16 @@ public class PlayTimeCommand extends CommandBase if (target == null) { - Plugin.getPlugin().getServer().getScheduler().runTaskAsynchronously(Plugin.getPlugin(), new Runnable() + Plugin.getOfflinePlayerStats(args[0], stats -> { - @Override - public void run() + if (stats == null) { - try - { - final PlayerStats stats = Plugin.getOfflinePlayerStats(args[0]); - - Plugin.getPlugin().getServer().getScheduler().runTask(Plugin.getPlugin(), new Runnable() - { - @Override - public void run() - { - if (stats == null) - { - UtilPlayer.message(caller, F.main("Clans", "Player " + F.elem(args[0]) + " not found!")); - } - else - { - long time = stats.getStat(ClansPlayerStats.PLAY_TIME.id()); - UtilPlayer.message(caller, F.main("Clans", F.name(args[0]) + " has spent " + F.elem(UtilTime.convertString(time * 1000L, 1, UtilTime.TimeUnit.FIT)) + " playing Clans.")); - } - } - }); - } - catch (SQLException e) - { - UtilPlayer.message(caller, F.main("Clans", F.name(target.getName()) + " does not have any play time in Clans.")); - } + UtilPlayer.message(caller, F.main("Clans", "Player " + F.elem(args[0]) + " not found!")); + } + else + { + long time = stats.getStat(ClansPlayerStats.PLAY_TIME.id()); + UtilPlayer.message(caller, F.main("Clans", F.name(args[0]) + " has spent " + F.elem(UtilTime.convertString(time * 1000L, 1, UtilTime.TimeUnit.FIT)) + " playing Clans.")); } }); } diff --git a/Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/clans/siege/repository/OutpostRepository.java b/Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/clans/siege/repository/OutpostRepository.java index 6ff1675e6..e6b53a15d 100644 --- a/Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/clans/siege/repository/OutpostRepository.java +++ b/Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/clans/siege/repository/OutpostRepository.java @@ -18,12 +18,13 @@ import mineplex.game.clans.clans.siege.outpost.OutpostState; import mineplex.game.clans.clans.siege.outpost.OutpostType; import mineplex.game.clans.clans.siege.repository.tokens.OutpostToken; import mineplex.serverdata.database.DBPool; +import mineplex.serverdata.database.RepositoryBase; import mineplex.serverdata.database.column.ColumnByte; import mineplex.serverdata.database.column.ColumnInt; import mineplex.serverdata.database.column.ColumnTimestamp; import mineplex.serverdata.database.column.ColumnVarChar; -public class OutpostRepository extends MinecraftRepository +public class OutpostRepository extends RepositoryBase { private OutpostManager _manager; @@ -47,7 +48,7 @@ public class OutpostRepository extends MinecraftRepository public OutpostRepository(JavaPlugin plugin, OutpostManager manager) { - super(plugin, DBPool.getAccount()); + super(DBPool.getAccount()); _manager = manager; } @@ -115,11 +116,6 @@ public class OutpostRepository extends MinecraftRepository executeUpdate(CREATE); } - @Override - protected void update() - { - } - public void updateOutpost(OutpostToken token) { executeUpdate(UPDATE_OUTPOST, diff --git a/Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/clans/siege/repository/SiegeWeaponRepository.java b/Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/clans/siege/repository/SiegeWeaponRepository.java index d7cf00793..8f69a596d 100644 --- a/Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/clans/siege/repository/SiegeWeaponRepository.java +++ b/Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/clans/siege/repository/SiegeWeaponRepository.java @@ -3,9 +3,7 @@ package mineplex.game.clans.clans.siege.repository; import java.sql.ResultSet; import java.sql.SQLException; import java.sql.Timestamp; -import java.util.HashMap; import java.util.List; -import java.util.Map; import org.bukkit.plugin.java.JavaPlugin; @@ -18,11 +16,12 @@ import mineplex.game.clans.clans.ClanInfo; import mineplex.game.clans.clans.siege.SiegeManager; import mineplex.game.clans.clans.siege.repository.tokens.SiegeWeaponToken; import mineplex.serverdata.database.DBPool; +import mineplex.serverdata.database.RepositoryBase; import mineplex.serverdata.database.column.ColumnInt; import mineplex.serverdata.database.column.ColumnTimestamp; import mineplex.serverdata.database.column.ColumnVarChar; -public class SiegeWeaponRepository extends MinecraftRepository +public class SiegeWeaponRepository extends RepositoryBase { private static final String CREATE = "CREATE TABLE IF NOT EXISTS clansSiegeWeapons (uniqueId INT NOT NULL," + "serverId INT NOT NULL," @@ -48,7 +47,7 @@ public class SiegeWeaponRepository extends MinecraftRepository public SiegeWeaponRepository(JavaPlugin plugin, SiegeManager siegeManager) { - super(plugin, DBPool.getAccount()); + super(DBPool.getAccount()); _siegeManager = siegeManager; } @@ -158,15 +157,4 @@ public class SiegeWeaponRepository extends MinecraftRepository new ColumnTimestamp("lastFired", new Timestamp(token.LastFired)), new ColumnVarChar("entities", 100, "")); } - - @Override - protected void initialize() - { - //executeUpdate(CREATE); - } - - @Override - protected void update() - { - } } diff --git a/Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/clans/siege/weapon/Cannon.java b/Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/clans/siege/weapon/Cannon.java index fab2296fb..9a558b8c5 100644 --- a/Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/clans/siege/weapon/Cannon.java +++ b/Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/clans/siege/weapon/Cannon.java @@ -1,14 +1,9 @@ package mineplex.game.clans.clans.siege.weapon; -import java.util.List; -import java.util.stream.Collectors; -import java.util.stream.Stream; - import org.bukkit.Bukkit; import org.bukkit.Location; import org.bukkit.Material; import org.bukkit.Sound; -import org.bukkit.block.Block; import org.bukkit.entity.ArmorStand; import org.bukkit.entity.Player; import org.bukkit.entity.Slime; @@ -41,13 +36,11 @@ import mineplex.game.clans.clans.ClanInfo; import mineplex.game.clans.clans.ClansGame; import mineplex.game.clans.clans.ClansManager; import mineplex.game.clans.clans.siege.SiegeManager; -import mineplex.game.clans.clans.siege.events.SiegeWeaponExplodeEvent; import mineplex.game.clans.clans.siege.repository.tokens.SiegeWeaponToken; import mineplex.game.clans.clans.siege.weapon.projectile.WeaponProjectile; import mineplex.game.clans.clans.siege.weapon.util.AccessRule; import mineplex.game.clans.clans.siege.weapon.util.AccessType; import mineplex.game.clans.clans.siege.weapon.util.WeaponStateInfo; -import mineplex.game.clans.core.repository.ClanTerritory; public class Cannon extends SiegeWeapon { @@ -324,7 +317,7 @@ public class Cannon extends SiegeWeapon Slime filler = _location.getWorld().spawn(_location.clone(), Slime.class); UtilEnt.silence(filler, true); - UtilEnt.Vegetate(filler); + UtilEnt.vegetate(filler); filler.setSize(-1); filler.addPotionEffect(new PotionEffect(PotionEffectType.INVISIBILITY, 99999999, 1, true, false)); @@ -334,7 +327,7 @@ public class Cannon extends SiegeWeapon Slime playerMount = _location.getWorld().spawn(_location.clone(), Slime.class); UtilEnt.silence(playerMount, true); - UtilEnt.Vegetate(playerMount); + UtilEnt.vegetate(playerMount); playerMount.setSize(-1); playerMount.addPotionEffect(new PotionEffect(PotionEffectType.INVISIBILITY, 99999999, 1, true, false)); diff --git a/Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/economy/ClansCurrency.java b/Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/economy/ClansCurrency.java index ee0947382..65f58c39a 100644 --- a/Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/economy/ClansCurrency.java +++ b/Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/economy/ClansCurrency.java @@ -4,6 +4,7 @@ import mineplex.core.common.currency.Currency; import mineplex.core.common.util.C; import org.bukkit.Material; -public class ClansCurrency { +public class ClansCurrency +{ public static final Currency GOLD = new Currency("Gold", "Gold", C.cGold, Material.GOLD_NUGGET); } diff --git a/Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/economy/GemTransfer.java b/Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/economy/GemTransfer.java index c0e12f9df..3fda5e499 100644 --- a/Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/economy/GemTransfer.java +++ b/Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/economy/GemTransfer.java @@ -4,8 +4,6 @@ import java.text.DateFormat; import java.text.SimpleDateFormat; import java.util.Date; -import org.bukkit.entity.Player; - import mineplex.serverdata.data.Data; public class GemTransfer implements Data diff --git a/Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/economy/GoldCommand.java b/Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/economy/GoldCommand.java index fe7aa8421..3455f5d58 100644 --- a/Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/economy/GoldCommand.java +++ b/Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/economy/GoldCommand.java @@ -1,12 +1,12 @@ package mineplex.game.clans.economy; -import mineplex.core.account.CoreClient; +import org.bukkit.entity.Player; + import mineplex.core.command.CommandBase; import mineplex.core.common.Rank; import mineplex.core.common.util.Callback; import mineplex.core.common.util.F; import mineplex.core.common.util.UtilPlayer; -import org.bukkit.entity.Player; public class GoldCommand extends CommandBase { @@ -38,7 +38,9 @@ public class GoldCommand extends CommandBase Plugin.getClientManager().loadClientByName(targetName, client -> { if (client != null) + { rewardGold(caller, null, targetName, client.getAccountId(), goldString); + } else { UtilPlayer.message(caller, F.main("Gold", "Could not find player " + F.name(targetName))); diff --git a/Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/economy/GoldData.java b/Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/economy/GoldData.java index 9de4d3d9d..e245169e2 100644 --- a/Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/economy/GoldData.java +++ b/Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/economy/GoldData.java @@ -4,15 +4,18 @@ public class GoldData { private int balance; - public void addBalance(int amount) { + public void addBalance(int amount) + { balance += amount; } - public void setBalance(int amount) { + public void setBalance(int amount) + { balance = amount; } - public int getBalance() { + public int getBalance() + { return balance; } -} +} \ No newline at end of file diff --git a/Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/economy/GoldManager.java b/Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/economy/GoldManager.java index 43f125e28..43da489eb 100644 --- a/Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/economy/GoldManager.java +++ b/Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/economy/GoldManager.java @@ -1,17 +1,15 @@ package mineplex.game.clans.economy; -import mineplex.core.MiniDbClientPlugin; -import mineplex.core.account.CoreClientManager; -import mineplex.core.common.currency.GlobalCurrency; -import mineplex.core.common.util.*; -import mineplex.core.donation.DonationManager; -import mineplex.core.donation.Donor; -import mineplex.core.updater.UpdateType; -import mineplex.core.updater.event.UpdateEvent; -import mineplex.game.clans.clans.ClansDataAccessLayer; -import mineplex.game.clans.clans.ClansManager; -import mineplex.game.clans.items.economy.GoldToken; -import mineplex.game.clans.shop.bank.BankShop; +import java.sql.ResultSet; +import java.sql.SQLException; +import java.util.HashMap; +import java.util.HashSet; +import java.util.Iterator; +import java.util.List; +import java.util.Map; +import java.util.Set; +import java.util.UUID; + import org.bukkit.Location; import org.bukkit.Material; import org.bukkit.Sound; @@ -27,20 +25,37 @@ import org.bukkit.metadata.FixedMetadataValue; import org.bukkit.metadata.MetadataValue; import org.bukkit.util.Vector; -import java.sql.ResultSet; -import java.sql.SQLException; -import java.util.*; +import mineplex.core.MiniDbClientPlugin; +import mineplex.core.account.CoreClientManager; +import mineplex.core.common.currency.GlobalCurrency; +import mineplex.core.common.util.C; +import mineplex.core.common.util.Callback; +import mineplex.core.common.util.F; +import mineplex.core.common.util.UtilAction; +import mineplex.core.common.util.UtilPlayer; +import mineplex.core.donation.DonationManager; +import mineplex.core.donation.Donor; +import mineplex.core.updater.UpdateType; +import mineplex.core.updater.event.UpdateEvent; +import mineplex.game.clans.clans.ClansDataAccessLayer; +import mineplex.game.clans.clans.ClansManager; +import mineplex.game.clans.items.economy.GoldToken; +import mineplex.game.clans.shop.bank.BankShop; public class GoldManager extends MiniDbClientPlugin { - public static final double GEM_CONVERSION_RATE = 16; // The number of gold coins when converted from a single gem - - public static final double DEATH_TAX = 0.04d; // Percentage of gold lost on death + public static final double GEM_CONVERSION_RATE = 16; // The number of gold coins when converted from a single gem + + public static final double DEATH_TAX = 0.04d; // Percentage of gold lost on death public static final String META_STRING = "clans.goldAmount"; - + private static GoldManager _instance; - public static GoldManager getInstance() { return _instance; } - + + public static GoldManager getInstance() + { + return _instance; + } + private DonationManager _donationManager; private final int _serverId; private TransferTracker _transferTracker; @@ -48,8 +63,6 @@ public class GoldManager extends MiniDbClientPlugin private Map _playerPickupMap; private BankShop _bankShop; - private final GoldRepository _repository; - public GoldManager(ClansManager plugin, CoreClientManager clientManager, DonationManager donationManager, ClansDataAccessLayer dataAccessLayer) { super("Clans Gold", plugin.getPlugin(), clientManager); @@ -61,7 +74,6 @@ public class GoldManager extends MiniDbClientPlugin _itemSet = new HashSet(); _playerPickupMap = new HashMap(); _bankShop = new BankShop(plugin, clientManager, donationManager); - _repository = new GoldRepository(_serverId); } @Override @@ -76,11 +88,11 @@ public class GoldManager extends MiniDbClientPlugin { final Player player = event.getEntity(); final Player killer = player.getKiller(); - + int gold = getGold(player); final int droppedGold = (int) (gold * DEATH_TAX); final Location deathLocation = player.getLocation(); - + if (droppedGold > 0) { deductGold(new Callback() @@ -106,7 +118,7 @@ public class GoldManager extends MiniDbClientPlugin }, player, droppedGold); } } - + @EventHandler public void playerCmd(PlayerCommandPreprocessEvent event) { @@ -117,7 +129,7 @@ public class GoldManager extends MiniDbClientPlugin } } - @EventHandler (ignoreCancelled = true) + @EventHandler(ignoreCancelled = true) public void onPickup(PlayerPickupItemEvent event) { if (_itemSet.contains(event.getItem())) @@ -178,31 +190,31 @@ public class GoldManager extends MiniDbClientPlugin } } } - + public int getGold(Player player) { return Get(player).getBalance(); } - + public int getGems(Player player) { return getDonor(player).getBalance(GlobalCurrency.GEM); } - + public void transferGemsToCoins(Player player, int gemAmount) { int gemCount = getGems(player); int goldCount = (int) (((double) gemAmount) * GEM_CONVERSION_RATE); - + if (gemCount >= gemAmount) { - _donationManager.RewardGemsLater("GoldManager", player, -gemAmount); + _donationManager.rewardCurrency(GlobalCurrency.GEM, player, "GoldManager", -gemAmount); addGold(player, goldCount); notify(player, String.format("You have transferred %d gems into %d gold coins!", gemAmount, goldCount)); _transferTracker.insertTransfer(player); } } - + /** * @param player - the player to be checked for whether they can transfer gems into coins * @return true, if the player has not converted gems into coins within the @@ -215,7 +227,7 @@ public class GoldManager extends MiniDbClientPlugin public void cashIn(Player player, GoldToken token) { - int value = token.getGoldValue(); + int value = token.getGoldValue(); addGold(player, value); notify(player, String.format("You have cashed in a gold token worth %dg!", value)); } @@ -228,7 +240,7 @@ public class GoldManager extends MiniDbClientPlugin public void dropGold(Location location, int amount, double velMult) { int count = amount / 1000; - + if (count > 75) { double x = Math.random() * 2 * Math.PI; @@ -236,7 +248,7 @@ public class GoldManager extends MiniDbClientPlugin dropGold(location, amount, velocity, velMult, "Gold " + 0); return; } - + int extraGold = amount % 1000; for (int i = 0; i < count; i++) @@ -267,11 +279,11 @@ public class GoldManager extends MiniDbClientPlugin item.setMetadata(META_STRING, new FixedMetadataValue(getPlugin(), amount)); _itemSet.add(item); - + // Velocity UtilAction.velocity(item, velocity, velMult, false, 0, 0.2, 0.2, false); } - + public void purchaseToken(final Player player, final int tokenValue) { final GoldToken token = new GoldToken(tokenValue); @@ -291,13 +303,13 @@ public class GoldManager extends MiniDbClientPlugin } }, player, tokenValue); } - + private Donor getDonor(Player player) { return _donationManager.Get(player); } - + public static void notify(Player player, String message) { UtilPlayer.message(player, F.main("Gold", message)); @@ -314,43 +326,46 @@ public class GoldManager extends MiniDbClientPlugin public void setGold(final Callback callback, final String caller, final String name, final int accountId, final int amount, final boolean updateTotal) { - _repository.setGold(new Callback() + _donationManager.getGoldRepository().setGold(success -> { - public void run(Boolean success) + if (success) { - if (success) + if (updateTotal) { - if (updateTotal) - { - GoldData data = Get(name); + GoldData data = Get(name); - if (data != null) - { - data.setBalance(amount); - } + if (data != null) + { + data.setBalance(amount); } } - else - { - System.out.println("SET GOLD FAILED..."); - } - - if (callback != null) - callback.run(success); } - }, accountId, amount); + else + { + System.out.println("SET GOLD FAILED..."); + } + + if (callback != null) + { + callback.run(success); + } + }, _serverId, accountId, amount); } public void addGold(Player player, int amount) { if (amount >= 0) + { rewardGold(null, player, amount, true); + } } public void deductGold(Callback resultCallback, Player player, int amount) { if (amount > 0) + { rewardGold(resultCallback, player, -amount, true); + } } public void rewardGold(final Callback callback, final Player player, final int amount, final boolean updateTotal) @@ -369,33 +384,31 @@ public class GoldManager extends MiniDbClientPlugin return; } - _repository.rewardGold(new Callback() + _donationManager.getGoldRepository().rewardGold(success -> { - public void run(Boolean success) + if (success) { - if (success) + if (updateTotal) { - if (updateTotal) - { - GoldData data = Get(name); + GoldData data = Get(name); - if (data != null) - { - data.addBalance(amount); - } + if (data != null) + { + data.addBalance(amount); } } - else - { - System.out.println("REWARD GOLD FAILED..."); - } - - if (callback != null) - callback.run(success); } - }, accountId, amount); - } + else + { + System.out.println("REWARD GOLD FAILED..."); + } + if (callback != null) + { + callback.run(success); + } + }, _serverId, accountId, amount); + } @Override public String getQuery(int accountId, String uuid, String name) @@ -409,7 +422,7 @@ public class GoldManager extends MiniDbClientPlugin if (resultSet.next()) { Get(playerUUID).setBalance(resultSet.getInt(1)); - + if (resultSet.getInt(1) < 0) { setGold(new Callback() @@ -431,7 +444,8 @@ public class GoldManager extends MiniDbClientPlugin } @Override - protected GoldData addPlayer(UUID uuid) { + protected GoldData addPlayer(UUID uuid) + { return new GoldData(); } -} +} \ No newline at end of file diff --git a/Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/economy/GoldPurchaseProcessor.java b/Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/economy/GoldPurchaseProcessor.java index 43df9ade0..9f1c71a79 100644 --- a/Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/economy/GoldPurchaseProcessor.java +++ b/Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/economy/GoldPurchaseProcessor.java @@ -9,7 +9,8 @@ import org.bukkit.Sound; import org.bukkit.entity.Player; import org.bukkit.inventory.Inventory; -public class GoldPurchaseProcessor implements ConfirmationProcessor { +public class GoldPurchaseProcessor implements ConfirmationProcessor +{ private final Player _player; private final int _price; private final GoldManager _goldManager; @@ -24,7 +25,8 @@ public class GoldPurchaseProcessor implements ConfirmationProcessor { } @Override - public void init(Inventory inventory) { + public void init(Inventory inventory) + { inventory.setItem(4, new ItemBuilder(ClansCurrency.GOLD.getDisplayMaterial()).setTitle(ClansCurrency.GOLD.getPrefix()).addLore(C.cGray + _price + " " + ClansCurrency.GOLD.getPrefix() + " will be", C.cGray + "deducted from your account balance").build()); } @@ -33,7 +35,9 @@ public class GoldPurchaseProcessor implements ConfirmationProcessor { int goldCount = _goldManager.Get(_player).getBalance(); if (_price > goldCount) + { showResults(callback, TransactionResponse.InsufficientFunds); + } else { _goldManager.rewardGold(data -> @@ -71,4 +75,4 @@ public class GoldPurchaseProcessor implements ConfirmationProcessor { break; } } -} +} \ No newline at end of file diff --git a/Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/economy/SetGoldCommand.java b/Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/economy/SetGoldCommand.java index 526805366..b44c0d834 100644 --- a/Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/economy/SetGoldCommand.java +++ b/Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/economy/SetGoldCommand.java @@ -1,14 +1,12 @@ package mineplex.game.clans.economy; -import mineplex.core.account.CoreClient; +import org.bukkit.entity.Player; + import mineplex.core.command.CommandBase; import mineplex.core.common.Rank; import mineplex.core.common.util.Callback; import mineplex.core.common.util.F; import mineplex.core.common.util.UtilPlayer; -import mineplex.core.donation.DonationManager; - -import org.bukkit.entity.Player; public class SetGoldCommand extends CommandBase { @@ -67,4 +65,4 @@ public class SetGoldCommand extends CommandBase } }, caller.getName(), targetName, accountId, gold, true); } -} +} \ No newline at end of file diff --git a/Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/economy/TransferTracker.java b/Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/economy/TransferTracker.java index 140a2872e..b68aea0ba 100644 --- a/Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/economy/TransferTracker.java +++ b/Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/economy/TransferTracker.java @@ -34,4 +34,4 @@ public class TransferTracker GemTransfer transfer = _repository.getElement(player.getName()); return transfer != null && transfer.transferWasToday(); } -} +} \ No newline at end of file diff --git a/Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/fields/repository/FieldRepository.java b/Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/fields/repository/FieldRepository.java index 6e604d3f8..5b4de59bd 100644 --- a/Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/fields/repository/FieldRepository.java +++ b/Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/fields/repository/FieldRepository.java @@ -16,7 +16,7 @@ import mineplex.serverdata.database.column.ColumnDouble; import mineplex.serverdata.database.column.ColumnInt; import mineplex.serverdata.database.column.ColumnVarChar; -public class FieldRepository extends MinecraftRepository +public class FieldRepository extends RepositoryBase { private static String ALL_STRING = "ALL"; @@ -35,7 +35,7 @@ public class FieldRepository extends MinecraftRepository public FieldRepository(JavaPlugin plugin) { - super(plugin, DBPool.getAccount()); + super(DBPool.getAccount()); } public List getFieldBlocks(String server) @@ -179,10 +179,4 @@ public class FieldRepository extends MinecraftRepository executeUpdate(CREATE_FIELD_ORE_TABLE); executeUpdate(CREATE_FIELD_MONSTER_TABLE); } - - @Override - protected void update() - { - } - } diff --git a/Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/gameplay/Gameplay.java b/Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/gameplay/Gameplay.java index cafa0fe65..70b87da02 100644 --- a/Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/gameplay/Gameplay.java +++ b/Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/gameplay/Gameplay.java @@ -1,5 +1,6 @@ package mineplex.game.clans.gameplay; +import java.util.Arrays; import java.util.HashMap; import java.util.HashSet; import java.util.Map; @@ -82,6 +83,7 @@ public class Gameplay extends MiniPlugin { private static final int MAX_BUILD_HEIGHT = 120; private static final int MIN_CHEST_HEIGHT = 30; + private static final Material[] REDSTONE_TYPES = new Material[] {Material.ACTIVATOR_RAIL, Material.REDSTONE, Material.REDSTONE_BLOCK, Material.REDSTONE_COMPARATOR, Material.REDSTONE_WIRE, Material.REDSTONE_COMPARATOR_OFF, Material.REDSTONE_COMPARATOR_ON, Material.REDSTONE_LAMP_OFF, Material.REDSTONE_LAMP_ON, Material.REDSTONE_TORCH_OFF, Material.REDSTONE_TORCH_ON, Material.DIODE, Material.DIODE_BLOCK_OFF, Material.DIODE_BLOCK_ON, Material.DETECTOR_RAIL}; private ClansManager _clansManager; private BlockRestore _blockRestore; private DamageManager _damageManager; @@ -222,7 +224,7 @@ public class Gameplay extends MiniPlugin @EventHandler(priority = EventPriority.LOWEST) public void RedstoneCancel(BlockPlaceEvent event) { - if (event.getBlock().getType().toString().startsWith("REDSTONE")) + if (Arrays.asList(REDSTONE_TYPES).contains(event.getBlock().getType())) { UtilPlayer.message(event.getPlayer(), F.main("Game", "You cannot place redstone based items.")); event.setCancelled(true); diff --git a/Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/gameplay/safelog/SafeLog.java b/Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/gameplay/safelog/SafeLog.java index 154ac45b3..44efed198 100644 --- a/Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/gameplay/safelog/SafeLog.java +++ b/Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/gameplay/safelog/SafeLog.java @@ -14,6 +14,7 @@ import org.bukkit.event.player.PlayerKickEvent; import org.bukkit.event.player.PlayerQuitEvent; import org.bukkit.plugin.java.JavaPlugin; +import mineplex.core.Managers; import mineplex.core.MiniPlugin; import mineplex.core.common.util.C; import mineplex.core.common.util.F; @@ -22,8 +23,10 @@ import mineplex.core.common.util.UtilServer; import mineplex.core.common.util.UtilTextMiddle; import mineplex.core.common.util.UtilTime; import mineplex.game.clans.clans.ClanTips.TipType; +import mineplex.game.clans.clans.ban.ClansBanManager; import mineplex.game.clans.clans.ClansManager; import mineplex.game.clans.gameplay.safelog.npc.NPCManager; +import mineplex.game.clans.restart.RestartManager; public class SafeLog extends MiniPlugin { @@ -62,6 +65,16 @@ public class SafeLog extends MiniPlugin return; } + if (Managers.get(ClansBanManager.class).isFrozen(player)) + { + isSafeLog = true; + } + + if (Managers.get(RestartManager.class).isRestarting()) + { + isSafeLog = true; + } + if (!isSafeLog) { if (!_clansManager.getIncognitoManager().Get(player).Status) @@ -149,5 +162,4 @@ public class SafeLog extends MiniPlugin { onPlayerJoin(event.getPlayer()); } - -} +} \ No newline at end of file diff --git a/Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/gameplay/safelog/npc/CombatLogNPC.java b/Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/gameplay/safelog/npc/CombatLogNPC.java index 1d0dd2814..24417d878 100644 --- a/Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/gameplay/safelog/npc/CombatLogNPC.java +++ b/Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/gameplay/safelog/npc/CombatLogNPC.java @@ -195,7 +195,7 @@ public class CombatLogNPC skel.setMetadata("CombatLogNPC", new FixedMetadataValue(ClansManager.getInstance().getPlugin(), player.getUniqueId().toString())); skel.teleport(spawnLoc); skel.setHealth(_spawnHealth); - UtilEnt.Vegetate(skel); + UtilEnt.vegetate(skel); UtilEnt.silence(skel, true); skel.getEquipment().setHelmet(player.getInventory().getHelmet()); @@ -239,5 +239,4 @@ public class CombatLogNPC { _lastDamager = damager; } - -} +} \ No newline at end of file diff --git a/Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/gameplay/safelog/npc/NPCManager.java b/Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/gameplay/safelog/npc/NPCManager.java index 186433d54..ef71f42d4 100644 --- a/Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/gameplay/safelog/npc/NPCManager.java +++ b/Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/gameplay/safelog/npc/NPCManager.java @@ -256,4 +256,4 @@ public class NPCManager extends MiniPlugin return null; } -} +} \ No newline at end of file diff --git a/Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/legacytutorial/Tutorial.java b/Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/legacytutorial/Tutorial.java index 6dc7d8966..8840daa19 100644 --- a/Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/legacytutorial/Tutorial.java +++ b/Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/legacytutorial/Tutorial.java @@ -22,6 +22,7 @@ import org.bukkit.event.player.PlayerPickupItemEvent; import org.bukkit.inventory.ItemStack; import org.bukkit.util.Vector; +import mineplex.core.common.currency.GlobalCurrency; import mineplex.core.common.jsonchat.ClickEvent; import mineplex.core.common.jsonchat.JsonMessage; import mineplex.core.common.util.C; @@ -48,11 +49,9 @@ import mineplex.game.clans.clans.playtime.Playtime; import mineplex.game.clans.economy.GoldManager; /** - * * I call this a tutorial, even though it is more accurately, "a set of * achievements or goals, that are in some-what of a tutorial fashion." But that * would be too long of a class name, so I'll stick with "Tutorial" for now. - * */ public abstract class Tutorial implements ScoreboardElement, Listener { @@ -60,32 +59,32 @@ public abstract class Tutorial implements ScoreboardElement, Listener public static String TUTORIAL_COMPLETE_TASK = "tatatatatat%sDone"; //do not change public static String TUTORIAL_REWARD_TASK = "tatatatatat%sRewardGiven"; //do not change public static String SKIPPED_TASK = "tatatatata%sSkip"; - + protected final TutorialManager _manager; protected final GoldManager _goldManager; protected final ClansManager _clansManager; protected final TaskManager _taskManager; protected final DonationManager _donationManager; - -// protected final LinkedHashMap> _tasks; + + // protected final LinkedHashMap> _tasks; private final ArrayList> _tasks; protected final LinkedHashMap> _nameToTask; protected final LinkedHashMap _inTutorial; - + protected boolean _doScoreboard; protected boolean _ghostMode; - + protected boolean _startOnJoin; - + protected String _technicalName; protected String _displayName; - + protected int _goldReward = -1; protected int _gemReward = -1; protected int _coinReward = -1; - + protected Playtime _playtime; - + public Tutorial(final GoldManager goldManager, final Playtime playtime, final TaskManager taskManager, final ClansManager clansManager, final DonationManager donationManager, final TutorialManager manager, final PacketHandler packetHandler) { _clansManager = clansManager; @@ -97,36 +96,36 @@ public abstract class Tutorial implements ScoreboardElement, Listener _inTutorial = new LinkedHashMap<>(); _nameToTask = new LinkedHashMap<>(); _playtime = playtime; - + _manager.getPluginManager().registerEvents(this, _manager.getPlugin()); } - + @Override public List getLines(final ScoreboardManager manager, final Player player, final List out) { final List lines = new ArrayList<>(); - + if (!isInTutorial(player)) { return lines; } - + if (!_doScoreboard) { return lines; } - + if (get(player).CurrentTask == null) { return lines; } - + out.clear(); - + final TutorialClient client = _inTutorial.get(player.getName()); - + lines.add(C.cAqua + "Tutorial"); - + for (final TutorialTask task : _tasks) { if (get(player).CurrentTask.equals(task)) @@ -142,9 +141,9 @@ public abstract class Tutorial implements ScoreboardElement, Listener lines.add(C.cRed + task.getID() + ". " + task.getDisplayName()); } } - + lines.add(C.cYellow + "To skip, type: /skiptutorial"); - + return lines; } @@ -152,20 +151,20 @@ public abstract class Tutorial implements ScoreboardElement, Listener { return _tasks.get(index); } - + protected void addTask(TutorialTask task) { _tasks.add(task); _nameToTask.put(task.getTechnicalName(), task); } - + protected boolean hasFinishedTask(Player player, TutorialTask task) { if (get(player).QueuedFinish) { return true; } - + return get(player).CurrentTask.getID() < task.getID(); } @@ -173,17 +172,17 @@ public abstract class Tutorial implements ScoreboardElement, Listener { return _tasks.get(_tasks.size() - 1); } - + protected void finishTask(final Player player, final TutorialTask task) { if (player == null) { return; } - + get(player).LastDescriptionSentTime = 0; get(player).CurrentTask.visibleFinish(player); - + // 6 Seconds for player to read the finish message (sent by the line above) // (will be instant if get(player).CurrentTask.getFinishMessage() is null). _manager.getPlugin().getServer().getScheduler().scheduleSyncDelayedTask(_manager.getPlugin(), new Runnable() @@ -194,7 +193,7 @@ public abstract class Tutorial implements ScoreboardElement, Listener // Cycle to next task, or null if last task. get(player).CurrentTask = task.equals(lastTask) ? null : _tasks.get(task.getDataId() + 1); System.out.println("Next Task: " + get(player).CurrentTask); - + if (!_taskManager.hasCompletedTask(player, String.format(TASK_COMPLETE_TASK, _technicalName, task.getTechnicalName()))) { _taskManager.completedTask(new Callback() @@ -219,7 +218,7 @@ public abstract class Tutorial implements ScoreboardElement, Listener } }, 30L); } - + player.playSound(player.getLocation(), Sound.LEVEL_UP, 2f, 1.5f); } }, player, String.format(TASK_COMPLETE_TASK, _technicalName, task.getTechnicalName())); @@ -227,12 +226,12 @@ public abstract class Tutorial implements ScoreboardElement, Listener } }, get(player).CurrentTask._finishMessage == null ? 1L : 6 * 20L); } - + public TutorialTask getTask(final String technicalName) { return _nameToTask.get(technicalName); } - + @EventHandler(ignoreCancelled = true, priority = EventPriority.LOWEST) public void onPickupItem(final PlayerPickupItemEvent event) { @@ -241,7 +240,7 @@ public abstract class Tutorial implements ScoreboardElement, Listener event.setCancelled(true); } } - + @EventHandler(ignoreCancelled = true, priority = EventPriority.LOWEST) public void onDropItem(final PlayerDropItemEvent event) { @@ -250,7 +249,7 @@ public abstract class Tutorial implements ScoreboardElement, Listener event.setCancelled(true); } } - + @EventHandler(ignoreCancelled = true, priority = EventPriority.LOWEST) public void onBreakBlock(final BlockBreakEvent event) { @@ -259,7 +258,7 @@ public abstract class Tutorial implements ScoreboardElement, Listener event.setCancelled(true); } } - + @EventHandler(ignoreCancelled = true, priority = EventPriority.LOWEST) public void onPlaceBlock(final BlockPlaceEvent event) { @@ -268,7 +267,7 @@ public abstract class Tutorial implements ScoreboardElement, Listener event.setCancelled(true); } } - + private void finishFor(final Player player) { // if (player.getOpenInventory() != null) @@ -279,14 +278,14 @@ public abstract class Tutorial implements ScoreboardElement, Listener _manager.finishTutorial(player); _inTutorial.remove(player.getName()); onFinished(player); - + if (_playtime.Get(player).FirstSession) { _playtime.Get(player).StartTime = System.currentTimeMillis(); _playtime.Get(player).FirstSession = false; TaskManager.Instance.completedTask(null, player, ClansPlayerTasks.FIRST_SESSION.id()); } - + _manager.getPlugin().getServer().getScheduler().scheduleSyncDelayedTask(_manager.getPlugin(), new Runnable() { public void run() @@ -307,25 +306,27 @@ public abstract class Tutorial implements ScoreboardElement, Listener _goldManager.addGold(player, _goldReward); UtilPlayer.message(player, F.main("Tutorials", "You have been awarded " + F.elem(_goldReward + " Gold") + ".")); } - + if (_gemReward != -1) { - _donationManager.RewardGems(new Callback() { - public void run(Boolean data) + _donationManager.rewardCurrency(GlobalCurrency.GEM, player, "Clans", _gemReward, success -> + { + if (success) { UtilPlayer.message(player, F.main("Tutorials", "You have been awarded " + F.elem(_goldReward + " Gems") + ".")); } - }, "Clans", player.getName(), player.getUniqueId(), _gemReward); + }); } - + if (_coinReward != -1) { - _donationManager.RewardCoins(new Callback() { - public void run(Boolean data) + _donationManager.rewardCurrency(GlobalCurrency.TREASURE_SHARD, player, "Clans", _coinReward, success -> + { + if (success) { UtilPlayer.message(player, F.main("Tutorials", "You have been awarded " + F.elem(_coinReward + " Coins") + ".")); } - }, "Clans", player.getName(), _clansManager.getClientManager().getAccountId(player), _coinReward); + }); } } }, player, String.format(TUTORIAL_REWARD_TASK, _technicalName)); @@ -340,7 +341,7 @@ public abstract class Tutorial implements ScoreboardElement, Listener UtilInv.remove(player, Material.IRON_BOOTS, (byte) 0, 1); ItemStack[] armor = player.getInventory().getArmorContents(); - for (int i = 0 ; i < armor.length; i++) + for (int i = 0; i < armor.length; i++) { if (UtilItem.isIronProduct(armor[i])) { @@ -349,7 +350,7 @@ public abstract class Tutorial implements ScoreboardElement, Listener } player.getInventory().setArmorContents(armor); } - + _manager.getPlugin().getServer().getScheduler().scheduleSyncDelayedTask(_manager.getPlugin(), new Runnable() { public void run() @@ -367,7 +368,7 @@ public abstract class Tutorial implements ScoreboardElement, Listener player.showPlayer(other); } } - + for (int i = 0; i < 8; i++) { final int index = i; @@ -386,7 +387,7 @@ public abstract class Tutorial implements ScoreboardElement, Listener } }, 20 * 2); } - + // Implementation left to sub classes. protected void onFinished(final Player player) { @@ -395,25 +396,25 @@ public abstract class Tutorial implements ScoreboardElement, Listener protected void onFinishedDelay(final Player player) { } - + // Implementation left to sub classes. protected void onBegin(final Player player) { } - + public void startFor(final Player player) { if (!_manager.isInTutorial(player)) { _manager.setTutorial(player, this); } - + _inTutorial.put(player.getName(), new TutorialClient(player, this)); - + get(player).CurrentTask.startFor(player); - + player.playSound(player.getLocation(), Sound.LEVEL_UP, 2f, 1.5f); - + if (_ghostMode) { for (Player other : UtilServer.getPlayers()) @@ -422,18 +423,18 @@ public abstract class Tutorial implements ScoreboardElement, Listener player.hidePlayer(other); } } - + onBegin(player); } - + public void cancelFor(final Player player) { get(player).CurrentTask.cleanup(player); get(player).CurrentTaskStartTime = -1; _inTutorial.remove(player.getName()); - + _manager.finishTutorial(player); - + if (_ghostMode) { for (Player other : UtilServer.getPlayers()) @@ -442,7 +443,7 @@ public abstract class Tutorial implements ScoreboardElement, Listener player.showPlayer(other); } } - + if (_playtime.Get(player).FirstSession) { _playtime.Get(player).StartTime = System.currentTimeMillis(); @@ -450,61 +451,61 @@ public abstract class Tutorial implements ScoreboardElement, Listener TaskManager.Instance.completedTask(null, player, ClansPlayerTasks.FIRST_SESSION.id()); } } - + public boolean isInTutorial(final Player player) { return _inTutorial.containsKey(player.getName()); } - + public boolean isInTutorial(final String player) { return _inTutorial.containsKey(player); } - + public boolean hasCompleted(final Player player) { return _taskManager.hasCompletedTask(player, String.format(TUTORIAL_COMPLETE_TASK, _technicalName)); } - + public boolean hasSkipped(final Player player) { return _taskManager.hasCompletedTask(player, String.format(SKIPPED_TASK, _technicalName)); } - + public void skip(final Player player) { new JsonMessage("") .extra( - F.main( - "Tutorial", - "Are you sure you want to skip the tutorial? We " - )) + F.main( + "Tutorial", + "Are you sure you want to skip the tutorial? We " + )) .extra("strongly") - .color("gold") + .color("gold") .extra(" advise you do complete it. You will be rewarded with armor, weapons and") - .color("gray") + .color("gray") .extra(" 30000 Gold") - .color("yellow") + .color("yellow") .extra("!") - .color("gray") - - .sendToPlayer(player); - + .color("gray") + + .sendToPlayer(player); + new JsonMessage("") .extra( - F.main( - "Tutorial", - "Click " - )) + F.main( + "Tutorial", + "Click " + )) .extra("here") - .color("aqua") - .click(ClickEvent.RUN_COMMAND, "/yesiconfirmiwanttoskip") + .color("aqua") + .click(ClickEvent.RUN_COMMAND, "/yesiconfirmiwanttoskip") .extra(" here to confirm you want to skip the tutorial!") - .color("gray") - - .sendToPlayer(player); + .color("gray") + + .sendToPlayer(player); } - + public void doSkip(final Player player) { _taskManager.completedTask(new Callback() @@ -515,17 +516,17 @@ public abstract class Tutorial implements ScoreboardElement, Listener } }, player, String.format(SKIPPED_TASK, _technicalName)); } - + public String getTechnicalName() { return _technicalName; } - + public TutorialClient get(final Player player) { return _inTutorial.get(player.getName()); } - + @EventHandler public void onClanTip(ClanTipEvent event) { @@ -534,7 +535,7 @@ public abstract class Tutorial implements ScoreboardElement, Listener event.setCancelled(true); } } - + @EventHandler public void taskInfo(final UpdateEvent evt) { @@ -542,7 +543,7 @@ public abstract class Tutorial implements ScoreboardElement, Listener { return; } - + for (Player player : UtilServer.getPlayers()) { if (isInTutorial(player)) @@ -559,12 +560,12 @@ public abstract class Tutorial implements ScoreboardElement, Listener continue; } } - + get(player).CurrentTask.trySendDescription(player, false); } } } - + @EventHandler public void chat(final AsyncPlayerChatEvent evt) { @@ -572,9 +573,9 @@ public abstract class Tutorial implements ScoreboardElement, Listener { return; } - + Iterator iterator = evt.getRecipients().iterator(); - + while (iterator.hasNext()) { if (isInTutorial(iterator.next())) @@ -582,7 +583,7 @@ public abstract class Tutorial implements ScoreboardElement, Listener iterator.remove(); } } - + evt.setCancelled(true); } diff --git a/Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/restart/RestartManager.java b/Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/restart/RestartManager.java index 23d5fd391..52571a49a 100644 --- a/Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/restart/RestartManager.java +++ b/Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/restart/RestartManager.java @@ -5,14 +5,22 @@ import java.util.LinkedList; import org.bukkit.Bukkit; import org.bukkit.event.EventHandler; +import org.bukkit.event.EventPriority; +import org.bukkit.event.player.PlayerLoginEvent; +import org.bukkit.event.player.PlayerLoginEvent.Result; +import org.bukkit.event.server.ServerListPingEvent; import org.bukkit.plugin.java.JavaPlugin; +import mineplex.core.Managers; import mineplex.core.MiniPlugin; import mineplex.core.common.util.C; import mineplex.core.common.util.F; +import mineplex.core.common.util.UtilServer; import mineplex.core.common.util.UtilTextMiddle; import mineplex.core.common.util.UtilTime; import mineplex.core.common.util.UtilTime.TimeUnit; +import mineplex.core.portal.GenericServer; +import mineplex.core.portal.Intent; import mineplex.core.portal.Portal; import mineplex.core.slack.SlackAPI; import mineplex.core.slack.SlackMessage; @@ -20,6 +28,7 @@ import mineplex.core.slack.SlackTeam; import mineplex.core.updater.UpdateType; import mineplex.core.updater.event.UpdateEvent; import mineplex.game.clans.clans.ClansManager; +import mineplex.game.clans.gameplay.safelog.npc.NPCManager; import net.minecraft.server.v1_8_R3.MinecraftServer; public class RestartManager extends MiniPlugin @@ -38,11 +47,12 @@ public class RestartManager extends MiniPlugin super("Restart Manager", plugin); _serverName = plugin.getConfig().getString("serverstatus.name"); - _testServer = plugin.getConfig().getString("serverstatus.group").equalsIgnoreCase("Testing"); + _testServer = UtilServer.isTestServer(); - if (inRestartZone(Calendar.HOUR_OF_DAY)) + int hour = Calendar.getInstance().get(Calendar.HOUR_OF_DAY); + if (inRestartZone(hour)) { - _restartUnlock = System.currentTimeMillis() + 1000 + UtilTime.convert(MAX_RESTART_TIME - Calendar.HOUR_OF_DAY, TimeUnit.HOURS, TimeUnit.MILLISECONDS); + _restartUnlock = System.currentTimeMillis() + 1000 + UtilTime.convert(MAX_RESTART_TIME - hour, TimeUnit.HOURS, TimeUnit.MILLISECONDS); } else { @@ -68,7 +78,7 @@ public class RestartManager extends MiniPlugin private boolean tryRestartTime() { - if (!inRestartZone(Calendar.HOUR_OF_DAY) || System.currentTimeMillis() < _restartUnlock) + if (!inRestartZone(Calendar.getInstance().get(Calendar.HOUR_OF_DAY)) || System.currentTimeMillis() < _restartUnlock) { return false; } @@ -100,6 +110,20 @@ public class RestartManager extends MiniPlugin return restart; } + public boolean isRestarting() + { + return _restarting; + } + + @Override + public void disable() + { + if (!_testServer) + { + SlackAPI.getInstance().sendMessage(SlackTeam.DEVELOPER, "#clans-server-status", new SlackMessage("Clans Uptime", "crossed_swords", _serverName + " has shut down!"), true); + } + } + public void restart() { Bukkit.broadcastMessage(F.main("Clans", "This Clans server will be restarting in " + F.elem(UtilTime.MakeStr(120000)) + "!")); @@ -107,6 +131,24 @@ public class RestartManager extends MiniPlugin _restartTime = System.currentTimeMillis() + 120000; } + @EventHandler(priority = EventPriority.HIGHEST) + public void reflectMotd(ServerListPingEvent event) + { + if (_restarting) + { + event.setMotd("Restarting soon"); + } + } + + @EventHandler + public void blockLogin(PlayerLoginEvent event) + { + if (_restarting) + { + event.disallow(Result.KICK_OTHER, C.cRed + "This server is restarting!"); + } + } + @EventHandler public void checkRestart(UpdateEvent event) { @@ -133,7 +175,8 @@ public class RestartManager extends MiniPlugin if (System.currentTimeMillis() >= _restartTime) { _restarting = true; - Portal.getInstance().sendAllPlayers("ClansHub"); + NPCManager.getInstance().disable(); + Portal.getInstance().sendAllPlayersToGenericServer(GenericServer.CLANS_HUB, Intent.KICK); runSyncLater(() -> { if (!_testServer) diff --git a/Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/spawn/travel/TravelPage.java b/Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/spawn/travel/TravelPage.java index 6140d1ad2..25b584e64 100644 --- a/Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/spawn/travel/TravelPage.java +++ b/Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/spawn/travel/TravelPage.java @@ -15,6 +15,8 @@ import mineplex.core.common.util.C; import mineplex.core.common.util.UtilBlock; import mineplex.core.donation.DonationManager; import mineplex.core.itemstack.ItemBuilder; +import mineplex.core.portal.GenericServer; +import mineplex.core.portal.Intent; import mineplex.core.portal.Portal; import mineplex.core.shop.item.IButton; import mineplex.core.shop.page.ShopPageBase; @@ -138,7 +140,7 @@ public class TravelPage extends ShopPageBase { public void onClick(Player player, ClickType clickType) { - Portal.getInstance().sendPlayerToServer(player, "Lobby"); + Portal.getInstance().sendPlayerToGenericServer(player, GenericServer.HUB, Intent.PLAYER_REQUEST); } }); } diff --git a/Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/tutorial/command/FinishCommand.java b/Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/tutorial/command/FinishCommand.java index e0e32c1dc..f402cc601 100644 --- a/Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/tutorial/command/FinishCommand.java +++ b/Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/tutorial/command/FinishCommand.java @@ -4,6 +4,7 @@ import org.bukkit.entity.Player; import mineplex.core.command.CommandBase; import mineplex.core.common.Rank; +import mineplex.core.common.util.UtilServer; import mineplex.game.clans.tutorial.TutorialManager; public class FinishCommand extends CommandBase @@ -16,8 +17,7 @@ public class FinishCommand extends CommandBase @Override public void Execute(Player caller, String[] args) { - boolean testServer = Plugin.getPlugin().getConfig().getString("serverstatus.group").equalsIgnoreCase("Testing"); - if (_commandCenter.GetClientManager().hasRank(caller, testServer ? Rank.ALL : Rank.JNR_DEV)) + if (_commandCenter.GetClientManager().hasRank(caller, UtilServer.isTestServer() ? Rank.ALL : Rank.JNR_DEV)) { Plugin.finishTutorial(caller); } diff --git a/Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/tutorial/command/TutorialCommand.java b/Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/tutorial/command/TutorialCommand.java index f13e5bfde..137b4135f 100644 --- a/Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/tutorial/command/TutorialCommand.java +++ b/Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/tutorial/command/TutorialCommand.java @@ -4,6 +4,7 @@ import mineplex.core.command.MultiCommandBase; import mineplex.core.common.Rank; import mineplex.core.common.util.F; import mineplex.core.common.util.UtilPlayer; +import mineplex.core.common.util.UtilServer; import mineplex.game.clans.tutorial.TutorialManager; import org.bukkit.entity.Player; @@ -26,8 +27,7 @@ public class TutorialCommand extends MultiCommandBase @Override public void Execute(Player caller, String[] args) { - boolean testServer = Plugin.getPlugin().getConfig().getString("serverstatus.group").equalsIgnoreCase("Testing"); - if (_commandCenter.GetClientManager().hasRank(caller, testServer ? Rank.ALL : Rank.JNR_DEV)) + if (_commandCenter.GetClientManager().hasRank(caller, UtilServer.isTestServer() ? Rank.ALL : Rank.JNR_DEV)) { super.Execute(caller, args); } diff --git a/Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/tutorial/tutorials/clans/objective/AttackEnemyObjective.java b/Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/tutorial/tutorials/clans/objective/AttackEnemyObjective.java index 2b6449d02..2bf5e0555 100644 --- a/Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/tutorial/tutorials/clans/objective/AttackEnemyObjective.java +++ b/Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/tutorial/tutorials/clans/objective/AttackEnemyObjective.java @@ -94,7 +94,7 @@ public class AttackEnemyObjective extends OrderedObjective shooter.setCustomName(name); shooter.setCustomNameVisible(true); - UtilEnt.Vegetate(shooter); + UtilEnt.vegetate(shooter); shooter.teleport(location); shooter.setHealth(shooter.getMaxHealth()); diff --git a/Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/tutorial/tutorials/clans/repository/TutorialRepository.java b/Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/tutorial/tutorials/clans/repository/TutorialRepository.java index 415f9ae6e..a81ababe2 100644 --- a/Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/tutorial/tutorials/clans/repository/TutorialRepository.java +++ b/Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/tutorial/tutorials/clans/repository/TutorialRepository.java @@ -7,10 +7,11 @@ import mineplex.core.common.util.EnclosedObject; import mineplex.core.common.util.UUIDFetcher; import mineplex.core.database.MinecraftRepository; import mineplex.serverdata.database.DBPool; +import mineplex.serverdata.database.RepositoryBase; import mineplex.serverdata.database.column.ColumnInt; import mineplex.serverdata.database.column.ColumnVarChar; -public class TutorialRepository extends MinecraftRepository +public class TutorialRepository extends RepositoryBase { private static final String CREATE_TABLE = "CREATE TABLE IF NOT EXISTS clansTutorial (uuid VARCHAR(36), timesPlayed INT, PRIMARY KEY (uuid));"; private static final String GET = "SELECT * FROM clansTutorial WHERE uuid = ?;"; @@ -21,7 +22,7 @@ public class TutorialRepository extends MinecraftRepository public TutorialRepository(CoreClientManager clientManager) { - super(clientManager.getPlugin(), DBPool.getAccount()); + super(DBPool.getAccount()); _clientManager = clientManager; } @@ -60,9 +61,4 @@ public class TutorialRepository extends MinecraftRepository { executeUpdate(CREATE_TABLE); } - - protected void update() - { - } - } diff --git a/Plugins/Mineplex.Hub.Clans/src/mineplex/clanshub/ClansHub.java b/Plugins/Mineplex.Hub.Clans/src/mineplex/clanshub/ClansHub.java index bb78c2da8..e44061aad 100644 --- a/Plugins/Mineplex.Hub.Clans/src/mineplex/clanshub/ClansHub.java +++ b/Plugins/Mineplex.Hub.Clans/src/mineplex/clanshub/ClansHub.java @@ -1,11 +1,16 @@ package mineplex.clanshub; +import org.bukkit.Bukkit; +import org.bukkit.Location; +import org.bukkit.plugin.java.JavaPlugin; + import mineplex.core.CustomTagFix; import mineplex.core.PacketsInteractionFix; import mineplex.core.account.CoreClientManager; import mineplex.core.achievement.AchievementManager; import mineplex.core.antihack.AntiHack; -import mineplex.core.antihack.AntiHackGuardian; +import mineplex.core.antihack.guardians.AntiHackGuardian; +import mineplex.core.antihack.guardians.GuardianManager; import mineplex.core.aprilfools.AprilFoolsManager; import mineplex.core.blockrestore.BlockRestore; import mineplex.core.boosters.BoosterManager; @@ -33,10 +38,13 @@ import mineplex.core.packethandler.PacketHandler; import mineplex.core.party.PartyManager; import mineplex.core.pet.PetManager; import mineplex.core.poll.PollManager; +import mineplex.core.portal.GenericServer; import mineplex.core.portal.Portal; import mineplex.core.preferences.PreferencesManager; import mineplex.core.profileCache.ProfileCacheManager; import mineplex.core.punish.Punish; +import mineplex.core.rankGiveaway.eternal.EternalGiveawayManager; +import mineplex.core.rankGiveaway.titangiveaway.TitanGiveawayManager; import mineplex.core.recharge.Recharge; import mineplex.core.resourcepack.ResourcePackManager; import mineplex.core.serverConfig.ServerConfiguration; @@ -45,7 +53,9 @@ import mineplex.core.status.ServerStatusManager; import mineplex.core.task.TaskManager; import mineplex.core.teleport.Teleport; import mineplex.core.thank.ThankManager; -import mineplex.core.rankGiveaway.titangiveaway.TitanGiveawayManager; +import mineplex.core.titles.Titles; +import mineplex.core.titles.tracks.TrackManager; +import mineplex.core.twofactor.TwoFactorAuth; import mineplex.core.updater.FileUpdater; import mineplex.core.updater.Updater; import mineplex.core.velocity.VelocityFix; @@ -53,9 +63,6 @@ import mineplex.core.visibility.VisibilityManager; import mineplex.minecraft.game.core.combat.CombatManager; import mineplex.minecraft.game.core.condition.ConditionManager; import mineplex.minecraft.game.core.damage.DamageManager; -import org.bukkit.Bukkit; -import org.bukkit.Location; -import org.bukkit.plugin.java.JavaPlugin; import static mineplex.core.Managers.require; @@ -84,19 +91,22 @@ public class ClansHub extends JavaPlugin //Static Modules require(ProfileCacheManager.class); CommandCenter.Initialize(this); - CoreClientManager clientManager = new CoreClientManager(this, webServerAddress); + CoreClientManager clientManager = new CoreClientManager(this); CommandCenter.Instance.setClientManager(clientManager); // new ProfileCacheManager(this); ItemStackFactory.Initialize(this, false); Recharge.Initialize(this); VisibilityManager.Initialize(this); Give.Initialize(this); - Punish punish = new Punish(this, webServerAddress, clientManager); - BlockRestore blockRestore = new BlockRestore(this); - DonationManager donationManager = new DonationManager(this, clientManager, webServerAddress); + Punish punish = new Punish(this, clientManager); + BlockRestore blockRestore = require(BlockRestore.class); + DonationManager donationManager = require(DonationManager.class); ServerConfiguration serverConfiguration = new ServerConfiguration(this, clientManager); + // Publish our server status now, to give us more time to start up + ServerStatusManager serverStatusManager = new ServerStatusManager(this, clientManager, new LagMeter(this, clientManager)); + //Other Modules PacketHandler packetHandler = require(PacketHandler.class); DisguiseManager disguiseManager = require(DisguiseManager.class); @@ -109,20 +119,20 @@ public class ClansHub extends JavaPlugin Creature creature = new Creature(this); NpcManager npcManager = new NpcManager(this, creature); InventoryManager inventoryManager = new InventoryManager(this, clientManager); - PetManager petManager = new PetManager(this, clientManager, donationManager, inventoryManager, disguiseManager, creature, blockRestore, webServerAddress); + PetManager petManager = new PetManager(this, clientManager, donationManager, inventoryManager, disguiseManager, creature, blockRestore); PollManager pollManager = new PollManager(this, clientManager, donationManager); //Main Modules - ServerStatusManager serverStatusManager = new ServerStatusManager(this, clientManager, new LagMeter(this, clientManager)); new TitanGiveawayManager(this, clientManager, serverStatusManager); - Portal portal = new Portal(this, clientManager, serverStatusManager.getCurrentServerName()); + Portal portal = new Portal(); AntiHack antiHack = require(AntiHack.class); + GuardianManager guardianManager = require(GuardianManager.class); for (int i = 0; i < 8; i++) { - antiHack.registerGuardian(new AntiHackGuardian(new Location(Bukkit.getWorld("world"), 0, 195, 0), 25, -8, 195, 185, 17, -16)); + guardianManager.registerGuardian(new AntiHackGuardian(new Location(Bukkit.getWorld("world"), 0, 195, 0), 25, -8, 195, 185, 17, -16)); } IgnoreManager ignoreManager = new IgnoreManager(this, clientManager, preferenceManager, portal); @@ -133,14 +143,14 @@ public class ClansHub extends JavaPlugin EloManager eloManager = new EloManager(this, clientManager); AchievementManager achievementManager = new AchievementManager(statsManager, clientManager, donationManager, incognito, eloManager); - PartyManager partyManager = new PartyManager(this, portal, clientManager, preferenceManager); + PartyManager partyManager = new PartyManager(); CustomDataManager customDataManager = new CustomDataManager(this, clientManager); ConditionManager condition = new ConditionManager(this); ThankManager thankManager = new ThankManager(this, clientManager, donationManager); BoosterManager boosterManager = new BoosterManager(this, "", clientManager, donationManager, inventoryManager, thankManager); - HubManager hubManager = new HubManager(this, blockRestore, clientManager, incognito, donationManager, inventoryManager, condition, disguiseManager, new TaskManager(this, clientManager, webServerAddress), portal, partyManager, preferenceManager, petManager, pollManager, statsManager, achievementManager, new HologramManager(this, packetHandler), npcManager, packetHandler, punish, serverStatusManager, customDataManager, thankManager, boosterManager); + HubManager hubManager = new HubManager(this, blockRestore, clientManager, incognito, donationManager, inventoryManager, condition, disguiseManager, new TaskManager(this, clientManager), portal, partyManager, preferenceManager, petManager, pollManager, statsManager, achievementManager, new HologramManager(this, packetHandler), npcManager, packetHandler, punish, serverStatusManager, customDataManager, thankManager, boosterManager); HologramManager hologramManager = new HologramManager(this, packetHandler); @@ -149,7 +159,7 @@ public class ClansHub extends JavaPlugin Chat chat = new Chat(this, incognito, clientManager, preferenceManager, achievementManager, serverStatusManager.getCurrentServerName()); new MessageManager(this, incognito, clientManager, preferenceManager, ignoreManager, punish, friendManager, chat); new MemoryFix(this); - new FileUpdater(this, portal, serverStatusManager.getCurrentServerName(), serverStatusManager.getRegion()); + new FileUpdater(this, portal, serverStatusManager.getCurrentServerName(), serverStatusManager.getRegion(), GenericServer.CLANS_HUB); new CustomTagFix(this, packetHandler); new PacketsInteractionFix(this, packetHandler); new ResourcePackManager(this, portal); @@ -157,6 +167,8 @@ public class ClansHub extends JavaPlugin AprilFoolsManager.Initialize(this, clientManager, disguiseManager); + new EternalGiveawayManager(this, clientManager, serverStatusManager); + CombatManager combatManager = new CombatManager(this); DamageManager damage = new DamageManager(this, combatManager, npcManager, disguiseManager, condition); @@ -165,6 +177,10 @@ public class ClansHub extends JavaPlugin //Updates getServer().getScheduler().scheduleSyncRepeatingTask(this, new Updater(this), 1, 1); + + require(TrackManager.class); + require(Titles.class); + require(TwoFactorAuth.class); } @Override diff --git a/Plugins/Mineplex.Hub.Clans/src/mineplex/clanshub/ClansServerShop.java b/Plugins/Mineplex.Hub.Clans/src/mineplex/clanshub/ClansServerShop.java index 23065a997..e56cdcda7 100644 --- a/Plugins/Mineplex.Hub.Clans/src/mineplex/clanshub/ClansServerShop.java +++ b/Plugins/Mineplex.Hub.Clans/src/mineplex/clanshub/ClansServerShop.java @@ -29,7 +29,7 @@ public class ClansServerShop extends ShopBase @Override protected boolean canOpenShop(Player player) { - Party party = getPlugin().getPartyManager().getParty(player); + Party party = getPlugin().getPartyManager().getPartyByPlayer(player); if (party != null) { diff --git a/Plugins/Mineplex.Hub.Clans/src/mineplex/clanshub/ClansTransferManager.java b/Plugins/Mineplex.Hub.Clans/src/mineplex/clanshub/ClansTransferManager.java index f91e02691..4bbbf3c9d 100644 --- a/Plugins/Mineplex.Hub.Clans/src/mineplex/clanshub/ClansTransferManager.java +++ b/Plugins/Mineplex.Hub.Clans/src/mineplex/clanshub/ClansTransferManager.java @@ -6,6 +6,14 @@ import java.util.HashMap; import java.util.List; import java.util.UUID; +import org.bukkit.Sound; +import org.bukkit.entity.Player; +import org.bukkit.event.EventHandler; +import org.bukkit.event.entity.EntityPortalEnterEvent; +import org.bukkit.plugin.java.JavaPlugin; + +import com.google.common.collect.Lists; + import mineplex.core.MiniDbClientPlugin; import mineplex.core.account.CoreClientManager; import mineplex.core.common.util.F; @@ -16,12 +24,10 @@ import mineplex.core.common.util.UtilTime; import mineplex.core.donation.DonationManager; import mineplex.core.npc.event.NpcDamageByEntityEvent; import mineplex.core.npc.event.NpcInteractEntityEvent; -import mineplex.core.party.Lang; -import mineplex.core.party.Party; import mineplex.core.party.PartyManager; +import mineplex.core.portal.Intent; import mineplex.core.portal.Portal; import mineplex.core.recharge.Recharge; -import mineplex.core.shop.page.ShopPageBase; import mineplex.core.updater.UpdateType; import mineplex.core.updater.event.UpdateEvent; import mineplex.game.clans.core.repository.tokens.SimpleClanToken; @@ -29,14 +35,6 @@ import mineplex.serverdata.Region; import mineplex.serverdata.data.MinecraftServer; import mineplex.serverdata.servers.ServerManager; -import org.bukkit.Sound; -import org.bukkit.entity.Player; -import org.bukkit.event.EventHandler; -import org.bukkit.event.entity.EntityPortalEnterEvent; -import org.bukkit.plugin.java.JavaPlugin; - -import com.google.common.collect.Lists; - /** * Server selection controller for clans */ @@ -92,7 +90,7 @@ public class ClansTransferManager extends MiniDbClientPlugin { for (ServerInfo server : _servers.values()) { - if (server.Name.equalsIgnoreCase(name)) + if (server.Name.equalsIgnoreCase(name) && !server.MOTD.equalsIgnoreCase("Restarting soon")) { return server; } @@ -111,6 +109,7 @@ public class ClansTransferManager extends MiniDbClientPlugin { ServerInfo info = new ServerInfo(); info.Name = server.getName(); + info.MOTD = server.getMotd(); info.CurrentPlayers = server.getPlayerCount(); info.MaxPlayers = server.getMaxPlayerCount(); _servers.put(server, info); @@ -124,21 +123,10 @@ public class ClansTransferManager extends MiniDbClientPlugin */ public void selectServer(Player player, ServerInfo serverInfo) { - Party party = _party.getParty(player); - if (party != null) - { - if(!party.getOwner().equalsIgnoreCase(player.getName())) - { - Lang.NOT_OWNER_SERVER.send(player); - return; - } - _party.getJoinManager().requestServerJoin(serverInfo.Name, party); - return; - } player.leaveVehicle(); player.eject(); - _portal.sendPlayerToServer(player, serverInfo.Name); + _portal.sendPlayerToServer(player, serverInfo.Name, Intent.PLAYER_REQUEST); } @EventHandler @@ -164,20 +152,16 @@ public class ClansTransferManager extends MiniDbClientPlugin }); } - @SuppressWarnings("rawtypes") @EventHandler public void refreshPages(UpdateEvent event) { if (event.getType() != UpdateType.SEC) return; - - for (ShopPageBase page : _serverShop.getPageMap().values()) + + _serverShop.getPageMap().values().stream().filter(page -> page instanceof ClansServerPage).forEach(page -> { - if (page instanceof ClansServerPage) - { - ((ClansServerPage)page).update(); - } - } + ((ClansServerPage) page).update(); + }); } @EventHandler @@ -195,7 +179,7 @@ public class ClansTransferManager extends MiniDbClientPlugin UtilAction.velocity(player, UtilAlg.getTrajectory(player.getLocation(), _hub.GetSpawn()), 1, true, 0.5, 0, 1.0, true); return; } - if (_party.getParty(player) != null) + if (_party.getPartyByPlayer(player) != null) { player.playSound(player.getLocation(), Sound.ITEM_BREAK, 1, .6f); player.sendMessage(F.main("Party", "You cannot join Clans while in a party.")); @@ -238,7 +222,7 @@ public class ClansTransferManager extends MiniDbClientPlugin } if (event.getNpc().getName().contains("Return")) { - _portal.sendToHub(event.getPlayer(), "Returning to Mineplex!"); + _portal.sendToHub(event.getPlayer(), "Returning to Mineplex!", Intent.PLAYER_REQUEST); } } @@ -257,7 +241,7 @@ public class ClansTransferManager extends MiniDbClientPlugin } if (event.getNpc().getName().contains("Return") && Recharge.Instance.use(player, "Return to Mineplex", 1000, false, false)) { - _portal.sendToHub(player, "Returning to Mineplex!"); + _portal.sendToHub(player, "Returning to Mineplex!", Intent.PLAYER_REQUEST); } } diff --git a/Plugins/Mineplex.Hub.Clans/src/mineplex/clanshub/HubManager.java b/Plugins/Mineplex.Hub.Clans/src/mineplex/clanshub/HubManager.java index 44ce0a05f..565300ef3 100644 --- a/Plugins/Mineplex.Hub.Clans/src/mineplex/clanshub/HubManager.java +++ b/Plugins/Mineplex.Hub.Clans/src/mineplex/clanshub/HubManager.java @@ -1,86 +1,16 @@ package mineplex.clanshub; -import mineplex.clanshub.commands.ForcefieldRadius; -import mineplex.clanshub.commands.GadgetToggle; -import mineplex.clanshub.commands.GameModeCommand; -import mineplex.clanshub.profile.gui.GUIProfile; -import mineplex.core.Managers; -import mineplex.core.MiniPlugin; -import mineplex.core.account.CoreClient; -import mineplex.core.account.CoreClientManager; -import mineplex.core.achievement.AchievementManager; -import mineplex.core.benefit.BenefitManager; -import mineplex.core.blockrestore.BlockRestore; -import mineplex.core.bonuses.BonusManager; -import mineplex.core.boosters.BoosterManager; -import mineplex.core.botspam.BotSpamManager; -import mineplex.core.chat.ChatFormat; -import mineplex.core.chat.IChatMessageFormatter; -import mineplex.core.common.Rank; -import mineplex.core.common.util.C; -import mineplex.core.common.util.F; -import mineplex.core.common.util.UtilInv; -import mineplex.core.common.util.UtilMath; -import mineplex.core.common.util.UtilPlayer; -import mineplex.core.common.util.UtilServer; -import mineplex.core.common.util.UtilTextBottom; -import mineplex.core.common.util.UtilTextTop; -import mineplex.core.common.util.UtilTime; -import mineplex.core.common.util.UtilWorld; -import mineplex.core.cosmetic.CosmeticManager; -import mineplex.core.customdata.CustomDataManager; -import mineplex.core.disguise.DisguiseManager; -import mineplex.core.disguise.disguises.DisguiseBase; -import mineplex.core.disguise.disguises.DisguiseWither; -import mineplex.core.donation.DonationManager; -import mineplex.core.facebook.FacebookManager; -import mineplex.core.gadget.GadgetManager; -import mineplex.core.gadget.event.GadgetCollideEntityEvent; -import mineplex.core.gadget.gadgets.morph.MorphWither; -import mineplex.core.gadget.types.Gadget; -import mineplex.core.gadget.types.GadgetType; -import mineplex.core.hologram.HologramManager; -import mineplex.core.incognito.IncognitoManager; -import mineplex.core.incognito.events.IncognitoHidePlayerEvent; -import mineplex.core.inventory.InventoryManager; -import mineplex.core.menu.MenuManager; -import mineplex.core.message.PrivateMessageEvent; -import mineplex.core.mount.Mount; -import mineplex.core.mount.MountManager; -import mineplex.core.mount.types.MountDragon; -import mineplex.core.notifier.NotificationManager; -import mineplex.core.npc.NpcManager; -import mineplex.core.packethandler.PacketHandler; -import mineplex.core.party.Party; -import mineplex.core.party.PartyManager; -import mineplex.core.pet.PetManager; -import mineplex.core.playerCount.PlayerCountManager; -import mineplex.core.playwire.PlayWireManager; -import mineplex.core.poll.PollManager; -import mineplex.core.portal.Portal; -import mineplex.core.preferences.Preference; -import mineplex.core.preferences.PreferencesManager; -import mineplex.core.projectile.ProjectileManager; -import mineplex.core.punish.Punish; -import mineplex.core.stats.StatsManager; -import mineplex.core.status.ServerStatusManager; -import mineplex.core.task.TaskManager; -import mineplex.core.thank.ThankManager; -import mineplex.core.treasure.TreasureLocation; -import mineplex.core.treasure.TreasureManager; -import mineplex.core.updater.UpdateType; -import mineplex.core.updater.event.UpdateEvent; -import mineplex.core.valentines.ValentinesGiftManager; -import mineplex.core.youtube.YoutubeManager; -import mineplex.minecraft.game.core.combat.DeathMessageType; -import mineplex.minecraft.game.core.combat.event.CombatDeathEvent; -import mineplex.minecraft.game.core.condition.ConditionManager; +import java.util.ArrayList; +import java.util.HashMap; +import java.util.Iterator; + import net.md_5.bungee.api.chat.ComponentBuilder; import net.md_5.bungee.api.chat.HoverEvent; import net.md_5.bungee.api.chat.HoverEvent.Action; import net.md_5.bungee.api.chat.TextComponent; import net.minecraft.server.v1_8_R3.EntityInsentient; import net.minecraft.server.v1_8_R3.EntityPlayer; + import org.bukkit.Bukkit; import org.bukkit.ChatColor; import org.bukkit.GameMode; @@ -115,10 +45,87 @@ import org.bukkit.scoreboard.DisplaySlot; import org.bukkit.scoreboard.Objective; import org.bukkit.scoreboard.Scoreboard; -import java.util.ArrayList; -import java.util.HashMap; -import java.util.Iterator; -import java.util.UUID; +import mineplex.clanshub.commands.ForcefieldRadius; +import mineplex.clanshub.commands.GadgetToggle; +import mineplex.clanshub.commands.GameModeCommand; +import mineplex.clanshub.profile.gui.GUIProfile; +import mineplex.clanshub.salesannouncements.SalesAnnouncementManager; +import mineplex.core.Managers; +import mineplex.core.MiniPlugin; +import mineplex.core.account.CoreClient; +import mineplex.core.account.CoreClientManager; +import mineplex.core.achievement.AchievementManager; +import mineplex.core.benefit.BenefitManager; +import mineplex.core.blockrestore.BlockRestore; +import mineplex.core.bonuses.BonusManager; +import mineplex.core.boosters.BoosterManager; +import mineplex.core.botspam.BotSpamManager; +import mineplex.core.chat.ChatFormat; +import mineplex.core.chat.IChatMessageFormatter; +import mineplex.core.common.Rank; +import mineplex.core.common.util.C; +import mineplex.core.common.util.F; +import mineplex.core.common.util.UtilInv; +import mineplex.core.common.util.UtilMath; +import mineplex.core.common.util.UtilPlayer; +import mineplex.core.common.util.UtilServer; +import mineplex.core.common.util.UtilTextBottom; +import mineplex.core.common.util.UtilTextTop; +import mineplex.core.common.util.UtilTime; +import mineplex.core.common.util.UtilWorld; +import mineplex.core.communities.CommunityManager; +import mineplex.core.cosmetic.CosmeticManager; +import mineplex.core.customdata.CustomDataManager; +import mineplex.core.disguise.DisguiseManager; +import mineplex.core.disguise.disguises.DisguiseBase; +import mineplex.core.disguise.disguises.DisguiseWither; +import mineplex.core.donation.DonationManager; +import mineplex.core.facebook.FacebookManager; +import mineplex.core.gadget.GadgetManager; +import mineplex.core.gadget.event.GadgetCollideEntityEvent; +import mineplex.core.gadget.gadgets.morph.MorphWither; +import mineplex.core.gadget.types.Gadget; +import mineplex.core.gadget.types.GadgetType; +import mineplex.core.hologram.HologramManager; +import mineplex.core.incognito.IncognitoManager; +import mineplex.core.incognito.events.IncognitoHidePlayerEvent; +import mineplex.core.inventory.InventoryManager; +import mineplex.core.menu.MenuManager; +import mineplex.core.message.PrivateMessageEvent; +import mineplex.core.mount.Mount; +import mineplex.core.mount.MountManager; +import mineplex.core.mount.types.MountDragon; +import mineplex.core.notifier.NotificationManager; +import mineplex.core.npc.NpcManager; +import mineplex.core.packethandler.PacketHandler; +import mineplex.core.party.Party; +import mineplex.core.party.PartyManager; +import mineplex.core.personalServer.PersonalServerManager; +import mineplex.core.pet.PetManager; +import mineplex.core.playerCount.PlayerCountManager; +import mineplex.core.playwire.PlayWireManager; +import mineplex.core.poll.PollManager; +import mineplex.core.portal.GenericServer; +import mineplex.core.portal.Intent; +import mineplex.core.portal.Portal; +import mineplex.core.preferences.Preference; +import mineplex.core.preferences.PreferencesManager; +import mineplex.core.projectile.ProjectileManager; +import mineplex.core.punish.Punish; +import mineplex.core.stats.StatsManager; +import mineplex.core.status.ServerStatusManager; +import mineplex.core.task.TaskManager; +import mineplex.core.thank.ThankManager; +import mineplex.core.treasure.TreasureLocation; +import mineplex.core.treasure.TreasureManager; +import mineplex.core.twofactor.TwoFactorAuth; +import mineplex.core.updater.UpdateType; +import mineplex.core.updater.event.UpdateEvent; +import mineplex.core.valentines.ValentinesGiftManager; +import mineplex.core.youtube.YoutubeManager; +import mineplex.minecraft.game.core.combat.DeathMessageType; +import mineplex.minecraft.game.core.combat.event.CombatDeathEvent; +import mineplex.minecraft.game.core.condition.ConditionManager; /** * Main manager for clans hub @@ -149,6 +156,7 @@ public class HubManager extends MiniPlugin implements IChatMessageFormatter private Punish _punishManager; private IncognitoManager _incognito; private BonusManager _bonusManager; + private final TwoFactorAuth _twofactor = Managers.require(TwoFactorAuth.class); private Location _spawn; private int _scoreboardTick = 0; @@ -191,7 +199,7 @@ public class HubManager extends MiniPlugin implements IChatMessageFormatter FacebookManager facebookManager = new FacebookManager(plugin, clientManager, donationManager, inventoryManager); YoutubeManager youtubeManager = new YoutubeManager(plugin, clientManager, donationManager); PlayWireManager playWireManager = new PlayWireManager(plugin, clientManager); - _bonusManager = new BonusManager(plugin, null, playWireManager, clientManager, donationManager, pollManager , npcManager, hologramManager, statsManager, _inventoryManager, petManager, facebookManager, youtubeManager, _gadgetManager, thankManager); + _bonusManager = new BonusManager(plugin, null, playWireManager, clientManager, donationManager, pollManager , npcManager, hologramManager, statsManager, _inventoryManager, petManager, facebookManager, youtubeManager, _gadgetManager, thankManager, "Carter"); World world = _spawn.getWorld(); _treasureManager = new TreasureManager(_plugin, clientManager, serverStatusManager, donationManager, _inventoryManager, petManager, _gadgetManager, _blockRestore, hologramManager, statsManager, _bonusManager.getRewardManager()); @@ -255,6 +263,11 @@ public class HubManager extends MiniPlugin implements IChatMessageFormatter _serverName = getPlugin().getConfig().getString("serverstatus.name"); _serverName = _serverName.substring(0, Math.min(16, _serverName.length())); + + new SalesAnnouncementManager(plugin); + + new PersonalServerManager(plugin, _clientManager).setUseInterfaceItem(false); + new CommunityManager(plugin, _clientManager); } @Override @@ -272,24 +285,6 @@ public class HubManager extends MiniPlugin implements IChatMessageFormatter event.setMotd("Restarting soon"); } } - - /** - * Checks if an entity can be bumped - * @param ent The entity to check - * @return Whether the entity can be bumped - */ - public boolean BumpDisabled(Entity ent) - { - if (ent == null) - return false; - - if (ent instanceof Player) - { - return !_preferences.get((Player)ent).isActive(Preference.HUB_GAMES); - } - - return true; - } @EventHandler public void redirectStopCommand(PlayerCommandPreprocessEvent event) @@ -302,7 +297,7 @@ public class HubManager extends MiniPlugin implements IChatMessageFormatter { public void run() { - _portal.sendAllPlayers("Lobby"); + _portal.sendAllPlayersToGenericServer(GenericServer.HUB, Intent.KICK); Bukkit.getServer().getScheduler().scheduleSyncDelayedTask(_plugin, new Runnable() { @@ -341,7 +336,7 @@ public class HubManager extends MiniPlugin implements IChatMessageFormatter { public void run() { - _portal.sendPlayerToServer(event.getPlayer(), "ClansHub"); + _portal.sendPlayerToGenericServer(event.getPlayer(), GenericServer.CLANS_HUB, Intent.KICK); } }); @@ -399,9 +394,9 @@ public class HubManager extends MiniPlugin implements IChatMessageFormatter for (Rank rank : Rank.values()) { if (rank != Rank.ALL) - board.registerNewTeam(rank.Name).setPrefix(rank.getTag(true, true) + ChatColor.RESET + " "); + board.registerNewTeam(rank.ScoreboardTag).setPrefix(rank.getTag(true, true) + ChatColor.RESET + " "); else - board.registerNewTeam(rank.Name).setPrefix(""); + board.registerNewTeam(rank.ScoreboardTag).setPrefix(""); } for (Player otherPlayer : Bukkit.getOnlinePlayers()) @@ -409,8 +404,8 @@ public class HubManager extends MiniPlugin implements IChatMessageFormatter if (_clientManager.Get(otherPlayer) == null) continue; - String rankName = _clientManager.Get(player).GetRank().Name; - String otherRankName = _clientManager.Get(otherPlayer).GetRank().Name; + String rankName = _clientManager.Get(player).GetRank().ScoreboardTag; + String otherRankName = _clientManager.Get(otherPlayer).GetRank().ScoreboardTag; //Add Other to Self board.getTeam(otherRankName).addPlayer(otherPlayer); @@ -484,23 +479,15 @@ public class HubManager extends MiniPlugin implements IChatMessageFormatter if (rank != Rank.ALL) rankStr = rank.getTag(true, true) + " "; //Party Chat - if (event.getMessage().charAt(0) == '#') + if (event.getMessage().charAt(0) == '@') { - Party party = _partyManager.getParty(player); + Party party = _partyManager.getPartyByPlayer(player); if (party != null) { - event.getRecipients().clear(); - event.setMessage(event.getMessage().substring(1, event.getMessage().length())); event.setFormat(levelStr + C.cDPurple + C.Bold + "Party " + C.cWhite + C.Bold + playerName + " " + C.cPurple + "%2$s"); - for (UUID name : party.getMembersByUUID()) - { - Player other = Bukkit.getPlayer(name); - - if (other != null) - event.getRecipients().add(other); - } + event.getRecipients().removeIf(other -> !party.getMembers().contains(other)); } else { @@ -523,10 +510,12 @@ public class HubManager extends MiniPlugin implements IChatMessageFormatter component.addExtra(playerNameText); component.addExtra(" " + ChatColor.WHITE + event.getMessage()); - for (Player other : UtilServer.getPlayers()) + if (!event.isCancelled()) { - if (!event.isCancelled()) + for (Player other : event.getRecipients()) + { other.spigot().sendMessage(component); + } } event.setCancelled(true); } @@ -981,7 +970,7 @@ public class HubManager extends MiniPlugin implements IChatMessageFormatter @EventHandler public void openProfile(PlayerInteractEvent event) { - if(event.getItem() == null || event.getItem().getType() != Material.SKULL_ITEM) + if(_twofactor.isAuthenticating(event.getPlayer()) || event.getItem() == null || event.getItem().getType() != Material.SKULL_ITEM) return; new GUIProfile(getPlugin(), event.getPlayer(), _preferences, _achievementManager).openInventory();; diff --git a/Plugins/Mineplex.Hub.Clans/src/mineplex/clanshub/ServerInfo.java b/Plugins/Mineplex.Hub.Clans/src/mineplex/clanshub/ServerInfo.java index 1bb5643db..e51c34ff6 100644 --- a/Plugins/Mineplex.Hub.Clans/src/mineplex/clanshub/ServerInfo.java +++ b/Plugins/Mineplex.Hub.Clans/src/mineplex/clanshub/ServerInfo.java @@ -6,6 +6,7 @@ package mineplex.clanshub; public class ServerInfo { public String Name; + public String MOTD; public int CurrentPlayers = 0; public int MaxPlayers = 0; diff --git a/Plugins/Mineplex.Hub.Clans/src/mineplex/clanshub/salesannouncements/RankSelectionButton.java b/Plugins/Mineplex.Hub.Clans/src/mineplex/clanshub/salesannouncements/RankSelectionButton.java new file mode 100644 index 000000000..c482fbf81 --- /dev/null +++ b/Plugins/Mineplex.Hub.Clans/src/mineplex/clanshub/salesannouncements/RankSelectionButton.java @@ -0,0 +1,41 @@ +package mineplex.clanshub.salesannouncements; + +import org.bukkit.Material; +import org.bukkit.event.inventory.ClickType; + +import mineplex.core.common.Rank; +import mineplex.core.common.util.C; +import mineplex.core.itemstack.ItemBuilder; + +public class RankSelectionButton extends SalesAnnouncementGUIButton +{ + private SalesAnnouncementCreationPage _page; + private Rank _rank; + + public RankSelectionButton(Rank rank, SalesAnnouncementCreationPage page) + { + super(new ItemBuilder(Material.REDSTONE_BLOCK).setTitle(rank.getColor() + (rank.Name.isEmpty() ? "Default" : rank.Name)).addLore(C.cRed + "Click to Toggle On").build()); + _rank = rank; + _page = page; + } + + @Override + public void update() {} + + @Override + public void handleClick(ClickType type) + { + if (_page.Selected.contains(_rank)) + { + Button = new ItemBuilder(Material.REDSTONE_BLOCK).setTitle(_rank.getColor() + (_rank.Name.isEmpty() ? "Default" : _rank.Name)).addLore(C.cRed + "Click to Toggle On").build(); + _page.Selected.remove(_rank); + _page.updateButtons(true); + } + else + { + Button = new ItemBuilder(Material.EMERALD_BLOCK).setTitle(_rank.getColor() + (_rank.Name.isEmpty() ? "Default" : _rank.Name)).addLore(C.cGreen + "Click to Toggle Off").build(); + _page.Selected.add(_rank); + _page.updateButtons(true); + } + } +} \ No newline at end of file diff --git a/Plugins/Mineplex.Hub.Clans/src/mineplex/clanshub/salesannouncements/RankSelectionFinalizeButton.java b/Plugins/Mineplex.Hub.Clans/src/mineplex/clanshub/salesannouncements/RankSelectionFinalizeButton.java new file mode 100644 index 000000000..ac60332f8 --- /dev/null +++ b/Plugins/Mineplex.Hub.Clans/src/mineplex/clanshub/salesannouncements/RankSelectionFinalizeButton.java @@ -0,0 +1,40 @@ +package mineplex.clanshub.salesannouncements; + +import org.bukkit.Material; +import org.bukkit.event.inventory.ClickType; + +import mineplex.core.common.util.C; +import mineplex.core.itemstack.ItemBuilder; + +public class RankSelectionFinalizeButton extends SalesAnnouncementGUIButton +{ + private SalesAnnouncementCreationPage _page; + + public RankSelectionFinalizeButton(SalesAnnouncementCreationPage page) + { + super(new ItemBuilder(Material.REDSTONE_BLOCK).setTitle(C.cRed + "Click to Finalize").addLore(C.cRed + "You must select at least one rank!").build()); + _page = page; + } + + @Override + public void update() + { + if (_page.Selected.isEmpty()) + { + Button = new ItemBuilder(Material.REDSTONE_BLOCK).setTitle(C.cRed + "Click to Finalize").addLore(C.cRed + "You must select at least one rank!").build(); + } + else + { + Button = new ItemBuilder(Material.EMERALD_BLOCK).setTitle(C.cGreen + "Click to Finalize").build(); + } + } + + @Override + public void handleClick(ClickType type) + { + if (!_page.Selected.isEmpty()) + { + _page.finalizeSelection(); + } + } +} \ No newline at end of file diff --git a/Plugins/Mineplex.Hub.Clans/src/mineplex/clanshub/salesannouncements/SalesAnnouncementButton.java b/Plugins/Mineplex.Hub.Clans/src/mineplex/clanshub/salesannouncements/SalesAnnouncementButton.java new file mode 100644 index 000000000..a901422fe --- /dev/null +++ b/Plugins/Mineplex.Hub.Clans/src/mineplex/clanshub/salesannouncements/SalesAnnouncementButton.java @@ -0,0 +1,40 @@ +package mineplex.clanshub.salesannouncements; + +import org.bukkit.event.inventory.ClickType; + +public class SalesAnnouncementButton extends SalesAnnouncementGUIButton +{ + private SalesAnnouncementData _data; + private SalesAnnouncementPage _page; + + public SalesAnnouncementButton(SalesAnnouncementData data, SalesAnnouncementPage page) + { + super(data.getButtonForm()); + _data = data; + _page = page; + } + + public int getId() + { + return _data.getId(); + } + + @Override + public void update() + { + Button = _data.getButtonForm(); + } + + @Override + public void handleClick(ClickType type) + { + if (type == ClickType.RIGHT) + { + _page.deleteAnnouncement(_data); + } + else + { + _page.toggleAnnouncement(_data); + } + } +} \ No newline at end of file diff --git a/Plugins/Mineplex.Hub.Clans/src/mineplex/clanshub/salesannouncements/SalesAnnouncementCommand.java b/Plugins/Mineplex.Hub.Clans/src/mineplex/clanshub/salesannouncements/SalesAnnouncementCommand.java new file mode 100644 index 000000000..7a36de786 --- /dev/null +++ b/Plugins/Mineplex.Hub.Clans/src/mineplex/clanshub/salesannouncements/SalesAnnouncementCommand.java @@ -0,0 +1,40 @@ +package mineplex.clanshub.salesannouncements; + +import org.bukkit.entity.Player; + +import mineplex.core.command.CommandBase; +import mineplex.core.common.Rank; +import mineplex.core.common.util.F; +import mineplex.core.common.util.UtilPlayer; + +public class SalesAnnouncementCommand extends CommandBase +{ + public SalesAnnouncementCommand(SalesAnnouncementManager plugin) + { + super(plugin, Rank.ADMIN, "sales"); + } + + @Override + public void Execute(Player caller, String[] args) + { + if (args.length > 1 && args[0].equalsIgnoreCase("add")) + { + StringBuilder message = new StringBuilder(); + message.append(args[1]); + for (int i = 2; i < args.length; i++) + { + message.append(" " + args[i]); + } + + new SalesAnnouncementCreationPage(caller, message.toString()); + } + else if (args.length >= 1) + { + UtilPlayer.message(caller, F.main(Plugin.getName(), "Usage is /sales add (can take chat color codes)")); + } + else + { + new SalesAnnouncementPage(caller, Plugin); + } + } +} \ No newline at end of file diff --git a/Plugins/Mineplex.Hub.Clans/src/mineplex/clanshub/salesannouncements/SalesAnnouncementCreationPage.java b/Plugins/Mineplex.Hub.Clans/src/mineplex/clanshub/salesannouncements/SalesAnnouncementCreationPage.java new file mode 100644 index 000000000..c718b50bd --- /dev/null +++ b/Plugins/Mineplex.Hub.Clans/src/mineplex/clanshub/salesannouncements/SalesAnnouncementCreationPage.java @@ -0,0 +1,120 @@ +package mineplex.clanshub.salesannouncements; + +import java.util.HashMap; +import java.util.List; +import java.util.Map; + +import org.bukkit.Bukkit; +import org.bukkit.entity.Player; +import org.bukkit.event.EventHandler; +import org.bukkit.event.HandlerList; +import org.bukkit.event.Listener; +import org.bukkit.event.inventory.InventoryClickEvent; +import org.bukkit.inventory.Inventory; + +import com.google.common.collect.Lists; + +import mineplex.core.Managers; +import mineplex.core.common.Rank; +import mineplex.core.common.util.C; +import mineplex.core.common.util.UtilServer; +import mineplex.core.updater.UpdateType; +import mineplex.core.updater.event.UpdateEvent; + +public class SalesAnnouncementCreationPage implements Listener +{ + private Player _viewer; + private Inventory _inv; + private String _message; + private Map _buttons = new HashMap<>(); + public List Selected = Lists.newArrayList(); + + public SalesAnnouncementCreationPage(Player player, String message) + { + _viewer = player; + _message = message; + _inv = Bukkit.createInventory(player, 9 * 4, C.cGreen + "Select Ranks"); + setup(); + _viewer.openInventory(_inv); + UtilServer.RegisterEvents(this); + } + + private void setup() + { + for (int i = 0; i < Rank.values().length; i++) + { + Rank rank = Rank.values()[i]; + _buttons.put(i, new RankSelectionButton(rank, this)); + } + _buttons.put(31, new RankSelectionFinalizeButton(this)); + updateButtons(false); + } + + private void disable() + { + HandlerList.unregisterAll(this); + } + + public void finalizeSelection() + { + Managers.get(SalesAnnouncementManager.class).createAnnouncement(_viewer, Selected.toArray(new Rank[Selected.size()]), _message); + Managers.get(SalesAnnouncementManager.class).runSyncLater(() -> _viewer.closeInventory(), 1L); + } + + public void updateButtons(boolean callUpdate) + { + _inv.clear(); + _buttons.entrySet().stream().filter(entry -> entry.getKey() != 31).forEach(entry -> + { + if (callUpdate) + { + entry.getValue().update(); + } + _inv.setItem(entry.getKey(), entry.getValue().Button); + }); + if (callUpdate) + { + _buttons.get(31).update(); + } + _inv.setItem(31, _buttons.get(31).Button); + _viewer.updateInventory(); + } + + @EventHandler + public void onUpdate(UpdateEvent event) + { + if (event.getType() != UpdateType.TICK) + { + return; + } + + if (event.getType() == UpdateType.TICK) + { + if (_viewer.getOpenInventory() == null || _viewer.getOpenInventory().getTopInventory() == null || !_viewer.getOpenInventory().getTopInventory().getTitle().equals(_inv.getTitle())) + { + disable(); + return; + } + } + } + + @EventHandler + public void handleClick(InventoryClickEvent event) + { + if (event.getClickedInventory() == null || !event.getClickedInventory().getTitle().equals(_inv.getTitle())) + { + return; + } + if (!_viewer.getName().equals(event.getWhoClicked().getName())) + { + return; + } + event.setCancelled(true); + Integer slot = event.getSlot(); + if (!_buttons.containsKey(slot)) + { + return; + } + _buttons.get(slot).handleClick(event.getClick()); + } +} \ No newline at end of file diff --git a/Plugins/Mineplex.Hub.Clans/src/mineplex/clanshub/salesannouncements/SalesAnnouncementData.java b/Plugins/Mineplex.Hub.Clans/src/mineplex/clanshub/salesannouncements/SalesAnnouncementData.java new file mode 100644 index 000000000..f12564495 --- /dev/null +++ b/Plugins/Mineplex.Hub.Clans/src/mineplex/clanshub/salesannouncements/SalesAnnouncementData.java @@ -0,0 +1,75 @@ +package mineplex.clanshub.salesannouncements; + +import java.util.Arrays; + +import org.bukkit.ChatColor; +import org.bukkit.Material; +import org.bukkit.inventory.ItemStack; + +import mineplex.core.common.Rank; +import mineplex.core.common.util.C; +import mineplex.core.itemstack.ItemBuilder; + +public class SalesAnnouncementData +{ + private final int _id; + private final Rank[] _displayTo; + private final String _message; + private boolean _enabled; + + public SalesAnnouncementData(int id, Rank[] displayTo, String message, boolean enabled) + { + _id = id; + _displayTo = displayTo; + _message = message; + _enabled = enabled; + } + + public int getId() + { + return _id; + } + + public Rank[] getDisplayTo() + { + return _displayTo; + } + + public boolean shouldDisplayTo(Rank rank) + { + return Arrays.asList(_displayTo).contains(rank); + } + + public String getMessage(boolean raw) + { + return raw ? _message : ChatColor.translateAlternateColorCodes('&', _message); + } + + public ItemStack getButtonForm() + { + Material type = Material.REDSTONE_BLOCK; + String lore = C.cRed + "Click to Enable, Right-Click to Delete"; + String excerpt = getMessage(false); + if (excerpt.length() > 9) + { + excerpt = excerpt.substring(0, 9) + C.Reset + "..."; + } + if (_enabled) + { + type = Material.EMERALD_BLOCK; + lore = C.cGreen + "Click to Disable, Right-Click to Delete"; + } + + return new ItemBuilder(type).setTitle("ID: " + getId()).setLore(excerpt, C.cRed + " ", lore).build(); + } + + public boolean isEnabled() + { + return _enabled; + } + + public void setEnabled(boolean enabled) + { + _enabled = enabled; + } +} \ No newline at end of file diff --git a/Plugins/Mineplex.Hub.Clans/src/mineplex/clanshub/salesannouncements/SalesAnnouncementDeleteCommand.java b/Plugins/Mineplex.Hub.Clans/src/mineplex/clanshub/salesannouncements/SalesAnnouncementDeleteCommand.java new file mode 100644 index 000000000..90c08ad87 --- /dev/null +++ b/Plugins/Mineplex.Hub.Clans/src/mineplex/clanshub/salesannouncements/SalesAnnouncementDeleteCommand.java @@ -0,0 +1,25 @@ +package mineplex.clanshub.salesannouncements; + +import mineplex.serverdata.commands.ServerCommand; + +public class SalesAnnouncementDeleteCommand extends ServerCommand +{ + private String _id; + private String _from; + + public SalesAnnouncementDeleteCommand(String id, String from) + { + _id = id; + _from = from; + } + + public String getId() + { + return _id; + } + + public String getFrom() + { + return _from; + } +} \ No newline at end of file diff --git a/Plugins/Mineplex.Hub.Clans/src/mineplex/clanshub/salesannouncements/SalesAnnouncementDeleteHandler.java b/Plugins/Mineplex.Hub.Clans/src/mineplex/clanshub/salesannouncements/SalesAnnouncementDeleteHandler.java new file mode 100644 index 000000000..215789987 --- /dev/null +++ b/Plugins/Mineplex.Hub.Clans/src/mineplex/clanshub/salesannouncements/SalesAnnouncementDeleteHandler.java @@ -0,0 +1,28 @@ +package mineplex.clanshub.salesannouncements; + +import mineplex.serverdata.commands.CommandCallback; +import mineplex.serverdata.commands.ServerCommand; + +public class SalesAnnouncementDeleteHandler implements CommandCallback +{ + private final SalesAnnouncementManager _manager; + + public SalesAnnouncementDeleteHandler(SalesAnnouncementManager manager) + { + _manager = manager; + } + + @Override + public void run(ServerCommand command) + { + if (!(command instanceof SalesAnnouncementDeleteCommand)) + { + return; + } + if (_manager.getServer().equalsIgnoreCase(((SalesAnnouncementDeleteCommand) command).getFrom())) + { + return; + } + _manager.handleRemoteDeletion(Integer.parseInt(((SalesAnnouncementDeleteCommand)command).getId())); + } +} \ No newline at end of file diff --git a/Plugins/Mineplex.Hub.Clans/src/mineplex/clanshub/salesannouncements/SalesAnnouncementGUIButton.java b/Plugins/Mineplex.Hub.Clans/src/mineplex/clanshub/salesannouncements/SalesAnnouncementGUIButton.java new file mode 100644 index 000000000..9c98fca47 --- /dev/null +++ b/Plugins/Mineplex.Hub.Clans/src/mineplex/clanshub/salesannouncements/SalesAnnouncementGUIButton.java @@ -0,0 +1,18 @@ +package mineplex.clanshub.salesannouncements; + +import org.bukkit.event.inventory.ClickType; +import org.bukkit.inventory.ItemStack; + +public abstract class SalesAnnouncementGUIButton +{ + public ItemStack Button = null; + + public SalesAnnouncementGUIButton(ItemStack button) + { + Button = button; + } + + public abstract void update(); + + public abstract void handleClick(ClickType type); +} \ No newline at end of file diff --git a/Plugins/Mineplex.Hub.Clans/src/mineplex/clanshub/salesannouncements/SalesAnnouncementManager.java b/Plugins/Mineplex.Hub.Clans/src/mineplex/clanshub/salesannouncements/SalesAnnouncementManager.java new file mode 100644 index 000000000..82398a078 --- /dev/null +++ b/Plugins/Mineplex.Hub.Clans/src/mineplex/clanshub/salesannouncements/SalesAnnouncementManager.java @@ -0,0 +1,142 @@ +package mineplex.clanshub.salesannouncements; + +import java.util.List; + +import org.bukkit.entity.Player; +import org.bukkit.event.EventHandler; +import org.bukkit.event.player.PlayerJoinEvent; +import org.bukkit.plugin.java.JavaPlugin; + +import com.google.common.collect.Lists; + +import mineplex.core.Managers; +import mineplex.core.MiniPlugin; +import mineplex.core.account.CoreClientManager; +import mineplex.core.common.Rank; +import mineplex.core.common.util.C; +import mineplex.core.common.util.F; +import mineplex.core.common.util.UtilPlayer; +import mineplex.core.common.util.UtilServer; +import mineplex.serverdata.commands.ServerCommandManager; + +public class SalesAnnouncementManager extends MiniPlugin +{ + private static final String LINE = C.cDGreenB + C.Strike + "============================================="; + private final List _data = Lists.newArrayList(); + private final SalesAnnouncementRepository _repo; + + public SalesAnnouncementManager(JavaPlugin plugin) + { + super("Sales", plugin); + _repo = new SalesAnnouncementRepository(plugin); + _repo.loadAnnouncements(_data); + + addCommand(new SalesAnnouncementCommand(this)); + + ServerCommandManager.getInstance().registerCommandType("SalesAnnouncementUpdate", SalesAnnouncementUpdateCommand.class, new SalesAnnouncementUpdateHandler(this)); + ServerCommandManager.getInstance().registerCommandType("SalesAnnouncementDelete", SalesAnnouncementDeleteCommand.class, new SalesAnnouncementDeleteHandler(this)); + } + + public List getLoadedAnnouncements() + { + return _data; + } + + public String getServer() + { + return getPlugin().getConfig().getString("serverstatus.name"); + } + + public void createAnnouncement(Player creator, Rank[] displayTo, String message) + { + if (_data.size() >= 9 * 6) + { + UtilPlayer.message(creator, F.main(getName(), "There are too many existing Sales Announcements to create a new one! Try deleting some!")); + return; + } + _repo.createAnnouncement(displayTo, message, data -> + { + UtilPlayer.message(creator, F.main(getName(), "Announcement successfully created!")); + _data.add(data); + new SalesAnnouncementUpdateCommand(data.getId() + "", getServer()).publish(); + }); + } + + public void deleteAnnouncement(Player deletor, SalesAnnouncementData data, boolean forceRemoveFromList) + { + if (forceRemoveFromList) + { + _data.remove(data); + } + _repo.deleteAnnouncement(data, () -> + { + UtilPlayer.message(deletor, F.main(getName(), "Successfully deleted announcement!")); + if (!forceRemoveFromList) + { + _data.remove(data); + } + new SalesAnnouncementDeleteCommand(data.getId() + "", getServer()).publish(); + }); + } + + public void toggleAnnouncement(Player toggler, SalesAnnouncementData data) + { + data.setEnabled(!data.isEnabled()); + _repo.updateAnnouncementStatus(data, () -> + { + UtilPlayer.message(toggler, F.main(getName(), "Successfully toggled announcement!")); + new SalesAnnouncementUpdateCommand(data.getId() + "", getServer()).publish(); + }); + } + + public void handleRemoteDeletion(int id) + { + _data.removeIf(data -> data.getId() == id); + UtilServer.CallEvent(new SalesAnnouncementRemoteListUpdateEvent()); + } + + public void handleRemoteUpdate(int id) + { + if (_data.stream().filter(data -> data.getId() == id).toArray().length > 0) + { + _repo.loadAnnouncement(id, data -> + { + _data.stream().filter(existing -> existing.getId() == data.getId()).forEach(existing -> existing.setEnabled(data.isEnabled())); + UtilServer.CallEvent(new SalesAnnouncementRemoteListUpdateEvent()); + }); + } + else + { + _repo.loadAnnouncement(id, data -> + { + _data.add(data); + UtilServer.CallEvent(new SalesAnnouncementRemoteListUpdateEvent()); + }); + } + } + + @EventHandler + public void onJoin(PlayerJoinEvent event) + { + if (_data.isEmpty() || _data.stream().filter(data -> data.isEnabled()).toArray().length == 0) + { + return; + } + Player player = event.getPlayer(); + Rank rank = Managers.get(CoreClientManager.class).Get(player).GetRank(); + + runSyncLater(() -> + { + _data.stream().filter(data -> data.isEnabled() && data.shouldDisplayTo(rank)).forEach(data -> + { + player.sendMessage(" "); + player.sendMessage(LINE); + player.sendMessage(" "); + player.sendMessage(data.getMessage(false)); + player.sendMessage(" "); + player.sendMessage(LINE); + player.sendMessage(" "); + }); + }, 5L); + } +} \ No newline at end of file diff --git a/Plugins/Mineplex.Hub.Clans/src/mineplex/clanshub/salesannouncements/SalesAnnouncementPage.java b/Plugins/Mineplex.Hub.Clans/src/mineplex/clanshub/salesannouncements/SalesAnnouncementPage.java new file mode 100644 index 000000000..c81eb6b76 --- /dev/null +++ b/Plugins/Mineplex.Hub.Clans/src/mineplex/clanshub/salesannouncements/SalesAnnouncementPage.java @@ -0,0 +1,121 @@ +package mineplex.clanshub.salesannouncements; + +import java.util.HashMap; +import java.util.Map; + +import org.bukkit.Bukkit; +import org.bukkit.entity.Player; +import org.bukkit.event.EventHandler; +import org.bukkit.event.HandlerList; +import org.bukkit.event.Listener; +import org.bukkit.event.inventory.InventoryClickEvent; +import org.bukkit.inventory.Inventory; + +import mineplex.core.common.util.C; +import mineplex.core.common.util.UtilServer; +import mineplex.core.updater.UpdateType; +import mineplex.core.updater.event.UpdateEvent; + +public class SalesAnnouncementPage implements Listener +{ + private Player _viewer; + private Inventory _inv; + private SalesAnnouncementManager _manager; + private Map _buttons = new HashMap<>(); + + public SalesAnnouncementPage(Player player, SalesAnnouncementManager manager) + { + _viewer = player; + _manager = manager; + _inv = Bukkit.createInventory(player, 9 * 6, C.cGreen + "All Sales Announcements"); + setup(); + _viewer.openInventory(_inv); + UtilServer.RegisterEvents(this); + } + + private void setup() + { + _buttons.clear(); + for (int i = 0; i < _manager.getLoadedAnnouncements().size(); i++) + { + SalesAnnouncementData data = _manager.getLoadedAnnouncements().get(i); + _buttons.put(i, new SalesAnnouncementButton(data, this)); + } + updateButtons(false); + } + + private void disable() + { + HandlerList.unregisterAll(this); + } + + public void deleteAnnouncement(SalesAnnouncementData data) + { + _manager.deleteAnnouncement(_viewer, data, true); + _manager.runSyncLater(() -> setup(), 2L); + } + + public void toggleAnnouncement(SalesAnnouncementData data) + { + _manager.toggleAnnouncement(_viewer, data); + updateButtons(true); + } + + public void updateButtons(boolean callUpdate) + { + _inv.clear(); + _buttons.entrySet().stream().forEach(entry -> + { + if (callUpdate) + { + entry.getValue().update(); + } + _inv.setItem(entry.getKey(), entry.getValue().Button); + }); + _viewer.updateInventory(); + } + + @EventHandler + public void onUpdate(UpdateEvent event) + { + if (event.getType() != UpdateType.TICK) + { + return; + } + + if (event.getType() == UpdateType.TICK) + { + if (_viewer.getOpenInventory() == null || _viewer.getOpenInventory().getTopInventory() == null || !_viewer.getOpenInventory().getTopInventory().getTitle().equals(_inv.getTitle())) + { + disable(); + return; + } + } + } + + @EventHandler + public void handleClick(InventoryClickEvent event) + { + if (event.getClickedInventory() == null || !event.getClickedInventory().getTitle().equals(_inv.getTitle())) + { + return; + } + if (!_viewer.getName().equals(event.getWhoClicked().getName())) + { + return; + } + event.setCancelled(true); + Integer slot = event.getSlot(); + if (!_buttons.containsKey(slot)) + { + return; + } + _buttons.get(slot).handleClick(event.getClick()); + } + + @EventHandler + public void onListChange(SalesAnnouncementRemoteListUpdateEvent event) + { + setup(); + } +} \ No newline at end of file diff --git a/Plugins/Mineplex.Hub.Clans/src/mineplex/clanshub/salesannouncements/SalesAnnouncementRemoteListUpdateEvent.java b/Plugins/Mineplex.Hub.Clans/src/mineplex/clanshub/salesannouncements/SalesAnnouncementRemoteListUpdateEvent.java new file mode 100644 index 000000000..d8578fa03 --- /dev/null +++ b/Plugins/Mineplex.Hub.Clans/src/mineplex/clanshub/salesannouncements/SalesAnnouncementRemoteListUpdateEvent.java @@ -0,0 +1,21 @@ +package mineplex.clanshub.salesannouncements; + +import org.bukkit.event.Event; +import org.bukkit.event.HandlerList; + +public class SalesAnnouncementRemoteListUpdateEvent extends Event +{ + private static final HandlerList handlers = new HandlerList(); + + public SalesAnnouncementRemoteListUpdateEvent() {} + + public HandlerList getHandlers() + { + return handlers; + } + + public static HandlerList getHandlerList() + { + return handlers; + } +} \ No newline at end of file diff --git a/Plugins/Mineplex.Hub.Clans/src/mineplex/clanshub/salesannouncements/SalesAnnouncementRepository.java b/Plugins/Mineplex.Hub.Clans/src/mineplex/clanshub/salesannouncements/SalesAnnouncementRepository.java new file mode 100644 index 000000000..6876ba6f2 --- /dev/null +++ b/Plugins/Mineplex.Hub.Clans/src/mineplex/clanshub/salesannouncements/SalesAnnouncementRepository.java @@ -0,0 +1,175 @@ +package mineplex.clanshub.salesannouncements; + +import java.util.List; + +import org.bukkit.Bukkit; +import org.bukkit.plugin.java.JavaPlugin; + +import com.google.common.collect.Lists; + +import mineplex.core.common.Rank; +import mineplex.core.common.util.Callback; +import mineplex.core.database.MinecraftRepository; +import mineplex.serverdata.database.DBPool; +import mineplex.serverdata.database.RepositoryBase; +import mineplex.serverdata.database.column.ColumnBoolean; +import mineplex.serverdata.database.column.ColumnInt; +import mineplex.serverdata.database.column.ColumnVarChar; + +public class SalesAnnouncementRepository extends RepositoryBase +{ + private static final String CREATE_TABLE = "CREATE TABLE IF NOT EXISTS salesAnnouncements (id INT NOT NULL AUTO_INCREMENT, ranks VARCHAR(250), message VARCHAR(256), enabled BOOL, PRIMARY KEY (id));"; + + private static final String GET_ANNOUNCEMENTS = "SELECT * FROM salesAnnouncements;"; + private static final String GET_ANNOUNCEMENT = "SELECT * FROM salesAnnouncements WHERE id=?;"; + private static final String UPDATE_ANNOUNCEMENT_STATUS = "UPDATE salesAnnouncements SET enabled=? WHERE id=?;"; + private static final String INSERT_ANNOUNCEMENT = "INSERT INTO salesAnnouncements (ranks, message, enabled) VALUES(?, ?, ?);"; + private static final String DELETE_ANNOUNCEMENT = "DELETE FROM salesAnnouncements WHERE id=?;"; + + private final JavaPlugin _plugin; + + public SalesAnnouncementRepository(JavaPlugin plugin) + { + super(DBPool.getAccount()); + _plugin = plugin; + } + + private void runAsync(Runnable runnable) + { + Bukkit.getScheduler().runTaskAsynchronously(_plugin, runnable); + } + + private void runSync(Runnable runnable) + { + Bukkit.getScheduler().runTask(_plugin, runnable); + } + + public void loadAnnouncements(final List announcementList) + { + runAsync(() -> + { + executeQuery(GET_ANNOUNCEMENTS, resultSet -> + { + final List data = Lists.newArrayList(); + while (resultSet.next()) + { + int id = resultSet.getInt("id"); + String rankString = resultSet.getString("ranks"); + List ranks = Lists.newArrayList(); + if (rankString.contains(",") && !rankString.startsWith(",") && !rankString.endsWith(",")) + { + for (String rankStr : rankString.split(",")) + { + ranks.add(Rank.valueOf(rankStr)); + } + } + else + { + ranks.add(Rank.valueOf(rankString)); + } + Rank[] displayTo = ranks.toArray(new Rank[ranks.size()]); + String message = resultSet.getString("message"); + boolean enabled = resultSet.getBoolean("enabled"); + + data.add(new SalesAnnouncementData(id, displayTo, message, enabled)); + } + + runSync(() -> + { + announcementList.clear(); + data.forEach(sData -> announcementList.add(sData)); + }); + }); + }); + } + + public void loadAnnouncement(final int id, final Callback callback) + { + runAsync(() -> + { + executeQuery(GET_ANNOUNCEMENT, resultSet -> + { + if (resultSet.next()) + { + int aId = resultSet.getInt("id"); + String rankString = resultSet.getString("ranks"); + List ranks = Lists.newArrayList(); + if (rankString.contains(",") && !rankString.startsWith(",") && !rankString.endsWith(",")) + { + for (String rankStr : rankString.split(",")) + { + ranks.add(Rank.valueOf(rankStr)); + } + } + else + { + ranks.add(Rank.valueOf(rankString)); + } + Rank[] displayTo = ranks.toArray(new Rank[ranks.size()]); + String message = resultSet.getString("message"); + boolean enabled = resultSet.getBoolean("enabled"); + + final SalesAnnouncementData data = new SalesAnnouncementData(aId, displayTo, message, enabled); + runSync(() -> + { + callback.run(data); + }); + } + }, new ColumnInt("id", id)); + }); + } + + public void createAnnouncement(final Rank[] displayTo, final String message, Callback callback) + { + runAsync(() -> + { + String rankStr = displayTo[0].toString(); + for (int i = 1; i < displayTo.length; i++) + { + rankStr += ("," + displayTo[i].toString()); + } + executeInsert(INSERT_ANNOUNCEMENT, resultSet -> + { + if (resultSet.next()) + { + int id = resultSet.getInt(1); + final SalesAnnouncementData data = new SalesAnnouncementData(id, displayTo, message, true); + if (callback != null) + { + runSync(() -> callback.run(data)); + } + } + }, new ColumnVarChar("ranks", 250, rankStr), new ColumnVarChar("message", 256, message), new ColumnBoolean("enabled", true)); + }); + } + + public void updateAnnouncementStatus(SalesAnnouncementData data, Runnable after) + { + runAsync(() -> + { + executeUpdate(UPDATE_ANNOUNCEMENT_STATUS, new ColumnBoolean("enabled", data.isEnabled()), new ColumnInt("id", data.getId())); + if (after != null) + { + runSync(after); + } + }); + } + + public void deleteAnnouncement(SalesAnnouncementData data, Runnable after) + { + runAsync(() -> + { + executeUpdate(DELETE_ANNOUNCEMENT, new ColumnInt("id", data.getId())); + if (after != null) + { + runSync(after); + } + }); + } + + @Override + protected void initialize() {} + + @Override + protected void update() {} +} \ No newline at end of file diff --git a/Plugins/Mineplex.Hub.Clans/src/mineplex/clanshub/salesannouncements/SalesAnnouncementUpdateCommand.java b/Plugins/Mineplex.Hub.Clans/src/mineplex/clanshub/salesannouncements/SalesAnnouncementUpdateCommand.java new file mode 100644 index 000000000..8c1c52054 --- /dev/null +++ b/Plugins/Mineplex.Hub.Clans/src/mineplex/clanshub/salesannouncements/SalesAnnouncementUpdateCommand.java @@ -0,0 +1,25 @@ +package mineplex.clanshub.salesannouncements; + +import mineplex.serverdata.commands.ServerCommand; + +public class SalesAnnouncementUpdateCommand extends ServerCommand +{ + private String _id; + private String _from; + + public SalesAnnouncementUpdateCommand(String id, String from) + { + _id = id; + _from = from; + } + + public String getId() + { + return _id; + } + + public String getFrom() + { + return _from; + } +} \ No newline at end of file diff --git a/Plugins/Mineplex.Hub.Clans/src/mineplex/clanshub/salesannouncements/SalesAnnouncementUpdateHandler.java b/Plugins/Mineplex.Hub.Clans/src/mineplex/clanshub/salesannouncements/SalesAnnouncementUpdateHandler.java new file mode 100644 index 000000000..1c56c5ca6 --- /dev/null +++ b/Plugins/Mineplex.Hub.Clans/src/mineplex/clanshub/salesannouncements/SalesAnnouncementUpdateHandler.java @@ -0,0 +1,28 @@ +package mineplex.clanshub.salesannouncements; + +import mineplex.serverdata.commands.CommandCallback; +import mineplex.serverdata.commands.ServerCommand; + +public class SalesAnnouncementUpdateHandler implements CommandCallback +{ + private final SalesAnnouncementManager _manager; + + public SalesAnnouncementUpdateHandler(SalesAnnouncementManager manager) + { + _manager = manager; + } + + @Override + public void run(ServerCommand command) + { + if (!(command instanceof SalesAnnouncementUpdateCommand)) + { + return; + } + if (_manager.getServer().equalsIgnoreCase(((SalesAnnouncementUpdateCommand) command).getFrom())) + { + return; + } + _manager.handleRemoteUpdate(Integer.parseInt(((SalesAnnouncementUpdateCommand)command).getId())); + } +} \ No newline at end of file diff --git a/Plugins/Mineplex.Hub/src/mineplex/hub/Hub.java b/Plugins/Mineplex.Hub/src/mineplex/hub/Hub.java index 0b2ed154d..c4f8cdec8 100644 --- a/Plugins/Mineplex.Hub/src/mineplex/hub/Hub.java +++ b/Plugins/Mineplex.Hub/src/mineplex/hub/Hub.java @@ -10,7 +10,8 @@ import mineplex.core.PacketsInteractionFix; import mineplex.core.account.CoreClientManager; import mineplex.core.achievement.AchievementManager; import mineplex.core.antihack.AntiHack; -import mineplex.core.antihack.AntiHackGuardian; +import mineplex.core.antihack.guardians.AntiHackGuardian; +import mineplex.core.antihack.guardians.GuardianManager; import mineplex.core.aprilfools.AprilFoolsManager; import mineplex.core.blockrestore.BlockRestore; import mineplex.core.boosters.BoosterManager; @@ -20,6 +21,7 @@ import mineplex.core.chatsnap.SnapshotManager; import mineplex.core.chatsnap.SnapshotPlugin; import mineplex.core.chatsnap.SnapshotRepository; import mineplex.core.command.CommandCenter; +import mineplex.core.common.Constants; import mineplex.core.common.events.ServerShutdownEvent; import mineplex.core.creature.Creature; import mineplex.core.customdata.CustomDataManager; @@ -45,11 +47,14 @@ import mineplex.core.party.PartyManager; import mineplex.core.personalServer.PersonalServerManager; import mineplex.core.pet.PetManager; import mineplex.core.poll.PollManager; +import mineplex.core.portal.GenericServer; import mineplex.core.portal.Portal; import mineplex.core.preferences.PreferencesManager; import mineplex.core.profileCache.ProfileCacheManager; import mineplex.core.projectile.ProjectileManager; import mineplex.core.punish.Punish; +import mineplex.core.rankGiveaway.eternal.EternalGiveawayManager; +import mineplex.core.rankGiveaway.titangiveaway.TitanGiveawayManager; import mineplex.core.recharge.Recharge; import mineplex.core.report.ReportManager; import mineplex.core.report.ReportPlugin; @@ -61,13 +66,14 @@ import mineplex.core.status.ServerStatusManager; import mineplex.core.task.TaskManager; import mineplex.core.teleport.Teleport; import mineplex.core.thank.ThankManager; -import mineplex.core.rankGiveaway.titangiveaway.TitanGiveawayManager; +import mineplex.core.titles.Titles; +import mineplex.core.titles.tracks.TrackManager; +import mineplex.core.twofactor.TwoFactorAuth; import mineplex.core.updater.FileUpdater; import mineplex.core.updater.Updater; import mineplex.core.velocity.VelocityFix; import mineplex.core.visibility.VisibilityManager; import mineplex.hub.modules.BillboardManager; -import mineplex.hub.modules.StackerManager; import mineplex.hub.queue.QueueManager; import mineplex.hub.server.ServerManager; import mineplex.minecraft.game.classcombat.Class.ClassManager; @@ -85,20 +91,16 @@ import static mineplex.core.Managers.require; public class Hub extends JavaPlugin implements IRelation { - private String WEB_CONFIG = "webServer"; - private NpcManager _npcManager; @Override public void onEnable() { Bukkit.setSpawnRadius(0); - getConfig().addDefault(WEB_CONFIG, "http://accounts.mineplex.com/"); - getConfig().set(WEB_CONFIG, getConfig().getString(WEB_CONFIG)); + getConfig().addDefault(Constants.WEB_CONFIG_KEY, Constants.WEB_ADDRESS); + getConfig().set(Constants.WEB_CONFIG_KEY, getConfig().getString(Constants.WEB_CONFIG_KEY)); saveConfig(); - String webServerAddress = getConfig().getString(WEB_CONFIG); - //Logger.initialize(this); //Velocity Fix @@ -107,19 +109,22 @@ public class Hub extends JavaPlugin implements IRelation //Static Modules require(ProfileCacheManager.class); CommandCenter.Initialize(this); - CoreClientManager clientManager = new CoreClientManager(this, webServerAddress); + CoreClientManager clientManager = new CoreClientManager(this); CommandCenter.Instance.setClientManager(clientManager); // new ProfileCacheManager(this); ItemStackFactory.Initialize(this, false); Recharge.Initialize(this); VisibilityManager.Initialize(this); Give.Initialize(this); - Punish punish = new Punish(this, webServerAddress, clientManager); - BlockRestore blockRestore = new BlockRestore(this); - DonationManager donationManager = new DonationManager(this, clientManager, webServerAddress); + Punish punish = new Punish(this, clientManager); + BlockRestore blockRestore = require(BlockRestore.class); + DonationManager donationManager = require(DonationManager.class); ServerConfiguration serverConfiguration = new ServerConfiguration(this, clientManager); + // Publish our server status now, to give us more time to start up + ServerStatusManager serverStatusManager = new ServerStatusManager(this, clientManager, new LagMeter(this, clientManager)); + //Other Modules PacketHandler packetHandler = require(PacketHandler.class); DisguiseManager disguiseManager = require(DisguiseManager.class); @@ -133,23 +138,23 @@ public class Hub extends JavaPlugin implements IRelation NpcManager npcManager = new NpcManager(this, creature); _npcManager = npcManager; InventoryManager inventoryManager = new InventoryManager(this, clientManager); - PetManager petManager = new PetManager(this, clientManager, donationManager, inventoryManager, disguiseManager, creature, blockRestore, webServerAddress); + PetManager petManager = new PetManager(this, clientManager, donationManager, inventoryManager, disguiseManager, creature, blockRestore); PollManager pollManager = new PollManager(this, clientManager, donationManager); //new TournamentManager(this, clientManager, donationManager); ProjectileManager throwManager = new ProjectileManager(this); //Main Modules - ServerStatusManager serverStatusManager = new ServerStatusManager(this, clientManager, new LagMeter(this, clientManager)); new TitanGiveawayManager(this, clientManager, serverStatusManager); - Portal portal = new Portal(this, clientManager, serverStatusManager.getCurrentServerName()); + Portal portal = new Portal(); AntiHack antiHack = require(AntiHack.class); + GuardianManager guardianManager = require(GuardianManager.class); for (int i = 0; i < 8; i++) { - antiHack.registerGuardian(new AntiHackGuardian(new Location(Bukkit.getWorld("world"), 0, 100, 0), 50, -50, 105, 95, 50, -50)); + guardianManager.registerGuardian(new AntiHackGuardian(new Location(Bukkit.getWorld("world"), 0, 100, 0), 50, -50, 105, 95, 50, -50)); } IgnoreManager ignoreManager = new IgnoreManager(this, clientManager, preferenceManager, portal); @@ -160,7 +165,7 @@ public class Hub extends JavaPlugin implements IRelation EloManager eloManager = new EloManager(this, clientManager); AchievementManager achievementManager = new AchievementManager(statsManager, clientManager, donationManager, incognito, eloManager); - PartyManager partyManager = new PartyManager(this, portal, clientManager, preferenceManager); + PartyManager partyManager = new PartyManager(); SkillConditionManager conditionManager = new SkillConditionManager(this); @@ -170,17 +175,17 @@ public class Hub extends JavaPlugin implements IRelation String boosterGroup = serverConfiguration.getServerGroup().getBoosterGroup(); ThankManager thankManager = new ThankManager(this, clientManager, donationManager); BoosterManager boosterManager = new BoosterManager(this, boosterGroup, clientManager, donationManager, inventoryManager, thankManager); - HubManager hubManager = new HubManager(this, blockRestore, clientManager, incognito, donationManager, inventoryManager, conditionManager, disguiseManager, new TaskManager(this, clientManager, webServerAddress), portal, partyManager, preferenceManager, petManager, pollManager, statsManager, achievementManager, new HologramManager(this, packetHandler), npcManager, personalServerManager, packetHandler, punish, serverStatusManager, customDataManager, thankManager, boosterManager); + HubManager hubManager = new HubManager(this, blockRestore, clientManager, incognito, donationManager, inventoryManager, conditionManager, disguiseManager, new TaskManager(this, clientManager), portal, partyManager, preferenceManager, petManager, pollManager, statsManager, achievementManager, new HologramManager(this, packetHandler), npcManager, personalServerManager, packetHandler, punish, serverStatusManager, customDataManager, thankManager, boosterManager); HologramManager hologramManager = new HologramManager(this, packetHandler); QueueManager queueManager = new QueueManager(this, clientManager, donationManager, eloManager, partyManager); - ServerManager serverManager = new ServerManager(this, clientManager, donationManager, portal, partyManager, serverStatusManager, hubManager, new StackerManager(hubManager), queueManager, boosterManager); + ServerManager serverManager = new ServerManager(this, clientManager, donationManager, portal, partyManager, serverStatusManager, hubManager, queueManager, boosterManager); new FountainManager(this, clientManager, donationManager, hologramManager, statsManager, serverManager); Chat chat = new Chat(this, incognito, clientManager, preferenceManager, achievementManager, serverStatusManager.getCurrentServerName()); new MessageManager(this, incognito, clientManager, preferenceManager, ignoreManager, punish, friendManager, chat); new MemoryFix(this); - new FileUpdater(this, portal, serverStatusManager.getCurrentServerName(), serverStatusManager.getRegion()); + new FileUpdater(this, portal, serverStatusManager.getCurrentServerName(), serverStatusManager.getRegion(), GenericServer.HUB); new CustomTagFix(this, packetHandler); new PacketsInteractionFix(this, packetHandler); new ResourcePackManager(this, portal); @@ -194,6 +199,8 @@ public class Hub extends JavaPlugin implements IRelation AprilFoolsManager.Initialize(this, clientManager, disguiseManager); + new EternalGiveawayManager(this, clientManager, serverStatusManager); + CombatManager combatManager = new CombatManager(this); @@ -206,9 +213,9 @@ public class Hub extends JavaPlugin implements IRelation Energy energy = new Energy(this); energy.setEnabled(false); - ItemFactory itemFactory = new ItemFactory(this, blockRestore, conditionManager, damage, energy, fire, throwManager, webServerAddress); - SkillFactory skillManager = new SkillFactory(this, damage, this, combatManager, conditionManager, throwManager, disguiseManager, blockRestore, fire, new Movement(this), teleport, energy, webServerAddress); - ClassManager classManager = new ClassManager(this, clientManager, donationManager, hubManager.GetGadget(), skillManager, itemFactory, webServerAddress); + ItemFactory itemFactory = new ItemFactory(this, blockRestore, conditionManager, damage, energy, fire, throwManager); + SkillFactory skillManager = new SkillFactory(this, damage, this, combatManager, conditionManager, throwManager, disguiseManager, blockRestore, fire, new Movement(this), teleport, energy); + ClassManager classManager = new ClassManager(this, clientManager, donationManager, hubManager.GetGadget(), skillManager, itemFactory); ClassShopManager shopManager = new ClassShopManager(this, classManager, skillManager, itemFactory, achievementManager, clientManager); @@ -221,8 +228,12 @@ public class Hub extends JavaPlugin implements IRelation //Updates getServer().getScheduler().scheduleSyncRepeatingTask(this, new Updater(this), 1, 1); - BrandingManager brandingManager = new BrandingManager(this); + BrandingManager brandingManager = require(BrandingManager.class); new BillboardManager(this, brandingManager); + + require(TrackManager.class); + require(Titles.class); + require(TwoFactorAuth.class); } @Override diff --git a/Plugins/Mineplex.Hub/src/mineplex/hub/HubManager.java b/Plugins/Mineplex.Hub/src/mineplex/hub/HubManager.java index 50eb8abc6..8ac9b1e7c 100644 --- a/Plugins/Mineplex.Hub/src/mineplex/hub/HubManager.java +++ b/Plugins/Mineplex.Hub/src/mineplex/hub/HubManager.java @@ -60,11 +60,13 @@ import mineplex.core.common.Rank; import mineplex.core.common.currency.GlobalCurrency; import mineplex.core.common.util.C; import mineplex.core.common.util.F; +import mineplex.core.common.util.UtilEnt; import mineplex.core.common.util.UtilInv; import mineplex.core.common.util.UtilMath; import mineplex.core.common.util.UtilPlayer; import mineplex.core.common.util.UtilServer; import mineplex.core.common.util.UtilTime; +import mineplex.core.communities.CommunityManager; import mineplex.core.cosmetic.CosmeticManager; import mineplex.core.customdata.CustomDataManager; import mineplex.core.disguise.DisguiseManager; @@ -95,6 +97,8 @@ import mineplex.core.pet.PetManager; import mineplex.core.playerCount.PlayerCountManager; import mineplex.core.playwire.PlayWireManager; import mineplex.core.poll.PollManager; +import mineplex.core.portal.GenericServer; +import mineplex.core.portal.Intent; import mineplex.core.portal.Portal; import mineplex.core.preferences.Preference; import mineplex.core.preferences.PreferencesManager; @@ -106,7 +110,9 @@ import mineplex.core.stats.StatsManager; import mineplex.core.status.ServerStatusManager; import mineplex.core.task.TaskManager; import mineplex.core.thank.ThankManager; +import mineplex.core.titles.Titles; import mineplex.core.treasure.TreasureManager; +import mineplex.core.twofactor.TwoFactorAuth; import mineplex.core.updater.UpdateType; import mineplex.core.updater.event.UpdateEvent; import mineplex.core.valentines.ValentinesGiftManager; @@ -125,7 +131,7 @@ import mineplex.hub.modules.ParkourManager; import mineplex.hub.modules.SoccerManager; import mineplex.hub.modules.ValentinesManager; import mineplex.hub.modules.WorldManager; -import mineplex.hub.modules.nonpremium.NonPremiumManager; +import mineplex.hub.modules.salesannouncements.SalesAnnouncementManager; import mineplex.hub.profile.gui.GUIProfile; import mineplex.minecraft.game.classcombat.Skill.event.SkillTriggerEvent; import mineplex.minecraft.game.classcombat.item.event.ItemTriggerEvent; @@ -170,6 +176,7 @@ public class HubManager extends MiniClientPlugin implements IChatMess // private HalloweenSpookinessManager _halloweenManager; // private TrickOrTreatManager _trickOrTreatManager; private MavericksManager _mavericksManager; + private final TwoFactorAuth _twofactor = Managers.require(TwoFactorAuth.class); private Location _spawn; @@ -220,7 +227,7 @@ public class HubManager extends MiniClientPlugin implements IChatMess YoutubeManager youtubeManager = new YoutubeManager(plugin, clientManager, donationManager); PlayWireManager playWireManager = new PlayWireManager(plugin, clientManager); - _bonusManager = new BonusManager(plugin, null, playWireManager, clientManager, donationManager, pollManager , npcManager, hologramManager, statsManager, _inventoryManager, petManager, facebookManager, youtubeManager, _gadgetManager, thankManager); + _bonusManager = new BonusManager(plugin, null, playWireManager, clientManager, donationManager, pollManager , npcManager, hologramManager, statsManager, _inventoryManager, petManager, facebookManager, youtubeManager, _gadgetManager, thankManager, "Carl"); _treasureManager = new TreasureManager(_plugin, clientManager, serverStatusManager, donationManager, _inventoryManager, petManager, _gadgetManager, _blockRestore, hologramManager, statsManager, _bonusManager.getRewardManager()); CosmeticManager cosmeticManager = new CosmeticManager(_plugin, clientManager, donationManager, _inventoryManager, _gadgetManager, _mountManager, petManager, _treasureManager, boosterManager); @@ -273,7 +280,9 @@ public class HubManager extends MiniClientPlugin implements IChatMess _valentinesManager = new ValentinesManager(plugin, clientManager, donationManager); - new NonPremiumManager(plugin, clientManager); + new SalesAnnouncementManager(plugin); + + new CommunityManager(plugin, _clientManager); ScoreboardManager scoreboardManager = new ScoreboardManager(plugin) { @@ -283,9 +292,9 @@ public class HubManager extends MiniClientPlugin implements IChatMess for (Rank rank : Rank.values()) { if (rank == Rank.ALL) - scoreboard.getHandle().registerNewTeam(rank.Name).setPrefix(""); + scoreboard.getHandle().registerNewTeam(rank.ScoreboardTag).setPrefix(""); else - scoreboard.getHandle().registerNewTeam(rank.Name).setPrefix(rank.getTag(true, true) + ChatColor.RESET + " "); + scoreboard.getHandle().registerNewTeam(rank.ScoreboardTag).setPrefix(rank.getTag(true, true) + ChatColor.RESET + " "); } scoreboard.register(HubScoreboardLine.SERVER_TITLE) @@ -346,7 +355,7 @@ public class HubManager extends MiniClientPlugin implements IChatMess for (MineplexScoreboard scoreboard : getScoreboards().values()) { - scoreboard.getHandle().getTeam(client.getRealOrDisguisedRank().Name).addEntry(playerName); + scoreboard.getHandle().getTeam(client.getRealOrDisguisedRank().ScoreboardTag).addEntry(playerName); } if (get(player) != null) @@ -354,7 +363,7 @@ public class HubManager extends MiniClientPlugin implements IChatMess for (Player player1 : Bukkit.getOnlinePlayers()) { client = GetClients().Get(player1); - get(player).getHandle().getTeam(client.getRealOrDisguisedRank().Name).addEntry(player1.getName()); + get(player).getHandle().getTeam(client.getRealOrDisguisedRank().ScoreboardTag).addEntry(player1.getName()); } } } @@ -368,7 +377,7 @@ public class HubManager extends MiniClientPlugin implements IChatMess for (MineplexScoreboard scoreboard : getScoreboards().values()) { - scoreboard.getHandle().getTeam(client.getRealOrDisguisedRank().Name).removeEntry(playerName); + scoreboard.getHandle().getTeam(client.getRealOrDisguisedRank().ScoreboardTag).removeEntry(playerName); } } @@ -377,11 +386,11 @@ public class HubManager extends MiniClientPlugin implements IChatMess String rankName; if (rank.has(Rank.ULTRA)) rankName = rank.Name; - else if (donor.OwnsUnknownPackage("SuperSmashMobs ULTRA") || - donor.OwnsUnknownPackage("Survival Games ULTRA") || - donor.OwnsUnknownPackage("Minigames ULTRA") || - donor.OwnsUnknownPackage("CastleSiege ULTRA") || - donor.OwnsUnknownPackage("Champions ULTRA")) + else if (donor.ownsUnknownSalesPackage("SuperSmashMobs ULTRA") || + donor.ownsUnknownSalesPackage("Survival Games ULTRA") || + donor.ownsUnknownSalesPackage("Minigames ULTRA") || + donor.ownsUnknownSalesPackage("CastleSiege ULTRA") || + donor.ownsUnknownSalesPackage("Champions ULTRA")) rankName = "Single Ultra"; else rankName = "No Rank"; @@ -409,19 +418,6 @@ public class HubManager extends MiniClientPlugin implements IChatMess } } - public boolean BumpDisabled(Entity ent) - { - if (ent == null) - return false; - - if (ent instanceof Player) - { - return !_preferences.get((Player) ent).isActive(Preference.HUB_GAMES); - } - - return true; - } - @EventHandler public void redirectStopCommand(PlayerCommandPreprocessEvent event) { @@ -433,7 +429,7 @@ public class HubManager extends MiniClientPlugin implements IChatMess { public void run() { - _portal.sendAllPlayers("Lobby"); + _portal.sendAllPlayersToGenericServer(GenericServer.HUB, Intent.KICK); Bukkit.getServer().getScheduler().scheduleSyncDelayedTask(_plugin, new Runnable() { @@ -494,7 +490,7 @@ public class HubManager extends MiniClientPlugin implements IChatMess { public void run() { - _portal.sendPlayerToServer(event.getPlayer(), "Lobby"); + _portal.sendPlayerToGenericServer(event.getPlayer(), GenericServer.HUB, Intent.KICK); } }); @@ -509,10 +505,8 @@ public class HubManager extends MiniClientPlugin implements IChatMess public void AdminOP(PlayerJoinEvent event) { // Give developers operator on their servers - boolean testServer = _plugin.getConfig().getString("serverstatus.group").equalsIgnoreCase("Testing"); - Rank minimum = Rank.OWNER; - if (testServer) + if (UtilServer.isTestServer() || UtilServer.isDevServer()) { minimum = Rank.JNR_DEV; } @@ -566,6 +560,7 @@ public class HubManager extends MiniClientPlugin implements IChatMess //only give it in the hub player.getInventory().setItem(PartyManager.INTERFACE_SLOT, PartyManager.INTERFACE_ITEM); + require(Titles.class).giveBook(player, false); } @EventHandler @@ -632,20 +627,20 @@ public class HubManager extends MiniClientPlugin implements IChatMess //Party Chat if (event.getMessage().charAt(0) == '@') { - Party party = _partyManager.getParty(player); + Party party = _partyManager.getPartyByPlayer(player); if (party != null) { - event.getRecipients().clear(); - - event.setMessage(event.getMessage().substring(1, event.getMessage().length())); - event.setFormat(levelStr + C.cDPurple + C.Bold + "Party " + C.cWhite + C.Bold + playerName + " " + C.cPurple + "%2$s"); - - for (String uuid: party.getMembers()) + if (event.getMessage().length() > 1) { - Player other = Bukkit.getPlayer(uuid); + event.setMessage(event.getMessage().substring(1, event.getMessage().length()).trim()); + event.setFormat(levelStr + C.cDPurple + C.Bold + "Party " + C.cWhite + C.Bold + playerName + " " + C.cPurple + "%2$s"); - if (other != null) - event.getRecipients().add(other); + event.getRecipients().removeIf(other -> !party.getMembers().contains(other)); + } + else + { + UtilPlayer.message(player, F.main("Party", "Where's the message?")); + event.setCancelled(true); } } else @@ -668,11 +663,11 @@ public class HubManager extends MiniClientPlugin implements IChatMess component.addExtra(playerNameText); component.addExtra(" " + ChatColor.WHITE + event.getMessage()); - for (Player other : UtilServer.getPlayers()) + if (!event.isCancelled()) { - if (!event.isCancelled()) + for (Player other : event.getRecipients()) { - other.spigot().sendMessage(component); + other.spigot().sendMessage(component); } } event.setCancelled(true); @@ -716,9 +711,11 @@ public class HubManager extends MiniClientPlugin implements IChatMess event.getEntity().leaveVehicle(); event.getEntity().teleport(GetSpawn()); } - else - event.getEntity().remove(); + { + if (!UtilEnt.hasFlag(event.getEntity(), UtilEnt.FLAG_NO_REMOVE)) + event.getEntity().remove(); + } event.setCancelled(true); } @@ -886,20 +883,6 @@ public class HubManager extends MiniClientPlugin implements IChatMess return UtilTime.elapsed(_portalTime.get(player.getName()), 5000); } - public boolean hasPlayerStackingEnabled(LivingEntity ent) - { - if (!(ent instanceof Player)) - return true; - - if (BumpDisabled(ent)) - return false; - - if (!getPreferences().get((Player) ent).isActive(Preference.SHOW_PLAYERS)) - return false; - - return true; - } - @EventHandler public void SkillTrigger(SkillTriggerEvent event) { @@ -1003,7 +986,7 @@ public class HubManager extends MiniClientPlugin implements IChatMess @EventHandler public void openProfile(PlayerInteractEvent event) { - if (event.getItem() == null || event.getItem().getType() != Material.SKULL_ITEM) + if (_twofactor.isAuthenticating(event.getPlayer()) || event.getItem() == null || event.getItem().getType() != Material.SKULL_ITEM) return; new GUIProfile(getPlugin(), event.getPlayer(), _preferences, _achievementManager, _personalServerManager).openInventory(); diff --git a/Plugins/Mineplex.Hub/src/mineplex/hub/mail/MailRepository.java b/Plugins/Mineplex.Hub/src/mineplex/hub/mail/MailRepository.java index 7e7659b83..e4440d29c 100644 --- a/Plugins/Mineplex.Hub/src/mineplex/hub/mail/MailRepository.java +++ b/Plugins/Mineplex.Hub/src/mineplex/hub/mail/MailRepository.java @@ -8,37 +8,25 @@ import mineplex.core.database.MinecraftRepository; import org.bukkit.plugin.java.JavaPlugin; import mineplex.serverdata.database.DBPool; -import mineplex.serverdata.database.RepositoryBase; import mineplex.database.Tables; import mineplex.database.tables.records.MailRecord; +import mineplex.serverdata.database.RepositoryBase; import org.jooq.DSLContext; import org.jooq.Result; import org.jooq.impl.DSL; -public class MailRepository extends MinecraftRepository +public class MailRepository extends RepositoryBase { private MailManager _manager; public MailRepository(JavaPlugin plugin, MailManager manager) { - super(plugin, DBPool.getAccount()); + super(DBPool.getAccount()); _manager = manager; } - @Override - protected void initialize() - { - - } - - @Override - protected void update() - { - - } - public PlayerMailData loadMailData(ResultSet resultSet) throws SQLException { PlayerMailData data = new PlayerMailData(); diff --git a/Plugins/Mineplex.Hub/src/mineplex/hub/modules/BillboardManager.java b/Plugins/Mineplex.Hub/src/mineplex/hub/modules/BillboardManager.java index adfa01b62..d1dd5df72 100644 --- a/Plugins/Mineplex.Hub/src/mineplex/hub/modules/BillboardManager.java +++ b/Plugins/Mineplex.Hub/src/mineplex/hub/modules/BillboardManager.java @@ -4,9 +4,6 @@ import mineplex.core.MiniPlugin; import mineplex.core.common.events.ServerShutdownEvent; import mineplex.core.sponsorbranding.BrandingManager; -import org.bukkit.Bukkit; -import org.bukkit.Location; -import org.bukkit.block.BlockFace; import org.bukkit.entity.ItemFrame; import org.bukkit.event.EventHandler; import org.bukkit.event.entity.EntityDamageEvent; diff --git a/Plugins/Mineplex.Hub/src/mineplex/hub/modules/HalloweenSpookinessManager.java b/Plugins/Mineplex.Hub/src/mineplex/hub/modules/HalloweenSpookinessManager.java index 3f033bcd6..10e7b7068 100644 --- a/Plugins/Mineplex.Hub/src/mineplex/hub/modules/HalloweenSpookinessManager.java +++ b/Plugins/Mineplex.Hub/src/mineplex/hub/modules/HalloweenSpookinessManager.java @@ -113,7 +113,7 @@ public class HalloweenSpookinessManager extends MiniPlugin Skeleton skeleton = loc.getWorld().spawn(loc, Skeleton.class); UtilEnt.silence(skeleton, true); - UtilEnt.Vegetate(skeleton); + UtilEnt.vegetate(skeleton); UtilEnt.ghost(skeleton, true, false); skeleton.getEquipment().setItemInHand(ItemStackFactory.Instance.CreateStack(0)); diff --git a/Plugins/Mineplex.Hub/src/mineplex/hub/modules/MavericksManager.java b/Plugins/Mineplex.Hub/src/mineplex/hub/modules/MavericksManager.java index e84d6a60b..b2fe7dd90 100644 --- a/Plugins/Mineplex.Hub/src/mineplex/hub/modules/MavericksManager.java +++ b/Plugins/Mineplex.Hub/src/mineplex/hub/modules/MavericksManager.java @@ -80,7 +80,7 @@ public class MavericksManager extends MiniPlugin @EventHandler public void onUpdate(UpdateEvent event) { - if(event.getType() != UpdateType.SLOW) return; + if(event.getType() != UpdateType.MIN_01) return; Function, ? extends CompletionStage> updateTask = BukkitFuture.accept((list) -> { diff --git a/Plugins/Mineplex.Hub/src/mineplex/hub/modules/NewsManager.java b/Plugins/Mineplex.Hub/src/mineplex/hub/modules/NewsManager.java index 2667a203b..0679e29ba 100644 --- a/Plugins/Mineplex.Hub/src/mineplex/hub/modules/NewsManager.java +++ b/Plugins/Mineplex.Hub/src/mineplex/hub/modules/NewsManager.java @@ -253,47 +253,14 @@ public class NewsManager extends MiniPlugin { if (event.getType() != UpdateType.FASTEST) return; + + if (_news.length == 0) + return; String text = ""; double healthPercent = 1; - if (Manager.Type == HubType.Christmas) - { - _animationIndex = (_animationIndex + 1) % 40; - - if (_animationIndex == 2) text = C.cWhite + " ❄ " + C.cRed + " Massive Winter Sale " + C.cGreenB + " U" + C.cWhiteB + "P TO 50% OFF " + C.cYellow + " www.mineplex.com/shop " + C.cWhite + " ❄"; - if (_animationIndex == 3) text = C.cWhite + " ❄ " + C.cRed + " Massive Winter Sale " + C.cGreenB + " UP" + C.cWhiteB + " TO 50% OFF " + C.cYellow + " www.mineplex.com/shop " + C.cWhite + " ❄"; - if (_animationIndex == 4) text = C.cWhite + " ❄ " + C.cRed + " Massive Winter Sale " + C.cGreenB + " UP " + C.cWhiteB + "TO 50% OFF " + C.cYellow + " www.mineplex.com/shop " + C.cWhite + " ❄"; - if (_animationIndex == 5) text = C.cWhite + " ❄ " + C.cRed + " Massive Winter Sale " + C.cGreenB + " UP T" + C.cWhiteB + "O 50% OFF " + C.cYellow + " www.mineplex.com/shop " + C.cWhite + " ❄"; - if (_animationIndex == 6) text = C.cWhite + " ❄ " + C.cRed + " Massive Winter Sale " + C.cGreenB + " UP TO" + C.cWhiteB + " 50% OFF " + C.cYellow + " www.mineplex.com/shop " + C.cWhite + " ❄"; - if (_animationIndex == 7) text = C.cWhite + " ❄ " + C.cRed + " Massive Winter Sale " + C.cGreenB + " UP TO " + C.cWhiteB + "50% OFF " + C.cYellow + " www.mineplex.com/shop " + C.cWhite + " ❄"; - if (_animationIndex == 8) text = C.cWhite + " ❄ " + C.cRed + " Massive Winter Sale " + C.cGreenB + " UP TO 5" + C.cWhiteB + "0% OFF " + C.cYellow + " www.mineplex.com/shop " + C.cWhite + " ❄"; - if (_animationIndex == 9) text = C.cWhite + " ❄ " + C.cRed + " Massive Winter Sale " + C.cGreenB + " UP TO 50" + C.cWhiteB + "% OFF " + C.cYellow + " www.mineplex.com/shop " + C.cWhite + " ❄"; - if (_animationIndex == 10) text = C.cWhite + " ❄ " + C.cRed + " Massive Winter Sale " + C.cGreenB + " UP TO 50%" + C.cWhiteB + " OFF " + C.cYellow + " www.mineplex.com/shop " + C.cWhite + " ❄"; - if (_animationIndex == 11) text = C.cWhite + " ❄ " + C.cRed + " Massive Winter Sale " + C.cGreenB + " UP TO 50% " + C.cWhiteB + "OFF " + C.cYellow + " www.mineplex.com/shop " + C.cWhite + " ❄"; - if (_animationIndex == 11) text = C.cWhite + " ❄ " + C.cRed + " Massive Winter Sale " + C.cGreenB + " UP TO 50% O" + C.cWhiteB + "FF " + C.cYellow + " www.mineplex.com/shop " + C.cWhite + " ❄"; - if (_animationIndex == 12) text = C.cWhite + " ❄ " + C.cRed + " Massive Winter Sale " + C.cGreenB + " UP TO 50% OF" + C.cWhiteB + "F " + C.cYellow + " www.mineplex.com/shop " + C.cWhite + " ❄"; - if (_animationIndex == 13) text = C.cWhite + " ❄ " + C.cRed + " Massive Winter Sale " + C.cGreenB + " UP TO 50% OFF" + C.cWhiteB + " " + C.cYellow + " www.mineplex.com/shop " + C.cWhite + " ❄"; - - if (_animationIndex == 14) text = C.cWhite + " ❄ " + C.cRed + " Massive Winter Sale " + C.cGreenB + " UP TO 50% OFF" + C.cWhiteB + " " + C.cYellow + " www.mineplex.com/shop " + C.cWhite + " ❄"; - if (_animationIndex == 15) text = C.cWhite + " ❄ " + C.cRed + " Massive Winter Sale " + C.cWhiteB + " UP TO 50% OFF" + C.cGreenB + " " + C.cYellow + " www.mineplex.com/shop " + C.cWhite + " ❄"; - if (_animationIndex == 16) text = C.cWhite + " ❄ " + C.cRed + " Massive Winter Sale " + C.cGreenB + " UP TO 50% OFF" + C.cWhiteB + " " + C.cYellow + " www.mineplex.com/shop " + C.cWhite + " ❄"; - if (_animationIndex == 17) text = C.cWhite + " ❄ " + C.cRed + " Massive Winter Sale " + C.cWhiteB + " UP TO 50% OFF" + C.cGreenB + " " + C.cYellow + " www.mineplex.com/shop " + C.cWhite + " ❄"; - if (_animationIndex == 18) text = C.cWhite + " ❄ " + C.cRed + " Massive Winter Sale " + C.cGreenB + " UP TO 50% OFF" + C.cWhiteB + " " + C.cYellow + " www.mineplex.com/shop " + C.cWhite + " ❄"; - if (_animationIndex == 19) text = C.cWhite + " ❄ " + C.cRed + " Massive Winter Sale " + C.cWhiteB + " UP TO 50% OFF" + C.cGreenB + " " + C.cYellow + " www.mineplex.com/shop " + C.cWhite + " ❄"; - if (_animationIndex == 20) text = C.cWhite + " ❄ " + C.cRed + " Massive Winter Sale " + C.cGreenB + " UP TO 50% OFF" + C.cWhiteB + " " + C.cYellow + " www.mineplex.com/shop " + C.cWhite + " ❄"; - if (_animationIndex == 21) text = C.cWhite + " ❄ " + C.cRed + " Massive Winter Sale " + C.cWhiteB + " UP TO 50% OFF" + C.cGreenB + " " + C.cYellow + " www.mineplex.com/shop " + C.cWhite + " ❄"; - if (_animationIndex == 22) text = C.cWhite + " ❄ " + C.cRed + " Massive Winter Sale " + C.cGreenB + " UP TO 50% OFF" + C.cWhiteB + " " + C.cYellow + " www.mineplex.com/shop " + C.cWhite + " ❄"; - if (_animationIndex == 23) text = C.cWhite + " ❄ " + C.cRed + " Massive Winter Sale " + C.cWhiteB + " UP TO 50% OFF" + C.cGreenB + " " + C.cYellow + " www.mineplex.com/shop " + C.cWhite + " ❄"; - if (_animationIndex == 24) text = C.cWhite + " ❄ " + C.cRed + " Massive Winter Sale " + C.cGreenB + " UP TO 50% OFF" + C.cWhiteB + " " + C.cYellow + " www.mineplex.com/shop " + C.cWhite + " ❄"; - if (_animationIndex == 25) text = C.cWhite + " ❄ " + C.cRed + " Massive Winter Sale " + C.cWhiteB + " UP TO 50% OFF" + C.cGreenB + " " + C.cYellow + " www.mineplex.com/shop " + C.cWhite + " ❄"; - if (_animationIndex == 26) text = C.cWhite + " ❄ " + C.cRed + " Massive Winter Sale " + C.cGreenB + " UP TO 50% OFF" + C.cWhiteB + " " + C.cYellow + " www.mineplex.com/shop " + C.cWhite + " ❄"; - - if (_animationIndex >= 27) - text = C.cWhite + " ❄ " + C.cRed + " Massive Winter Sale " + C.cGreenB + " " + C.cWhiteB + "50% OFF ALL RANKS " + C.cYellow + " www.mineplex.com/shop " + C.cWhite + " ❄"; - - } - else if (Manager.Type == HubType.Halloween) + if (Manager.Type == HubType.Halloween) { /** * @author Mysticate diff --git a/Plugins/Mineplex.Hub/src/mineplex/hub/modules/ParkourManager.java b/Plugins/Mineplex.Hub/src/mineplex/hub/modules/ParkourManager.java index c887fc433..e7a6ba292 100644 --- a/Plugins/Mineplex.Hub/src/mineplex/hub/modules/ParkourManager.java +++ b/Plugins/Mineplex.Hub/src/mineplex/hub/modules/ParkourManager.java @@ -1,31 +1,14 @@ package mineplex.hub.modules; -import com.google.common.collect.Lists; -import com.google.common.collect.Maps; -import mineplex.core.MiniPlugin; -import mineplex.core.common.util.C; -import mineplex.core.common.util.Callback; -import mineplex.core.common.util.F; -import mineplex.core.common.util.UtilBlock; -import mineplex.core.common.util.UtilEnt; -import mineplex.core.common.util.UtilEvent; -import mineplex.core.common.util.UtilEvent.ActionType; -import mineplex.core.common.util.UtilMath; -import mineplex.core.common.util.UtilPlayer; -import mineplex.core.common.util.UtilServer; -import mineplex.core.common.util.UtilTime; -import mineplex.core.donation.DonationManager; -import mineplex.core.gadget.event.GadgetBlockEvent; -import mineplex.core.gadget.event.GadgetEnableEvent; -import mineplex.core.gadget.types.MusicGadget; -import mineplex.core.mount.event.MountActivateEvent; -import mineplex.core.recharge.Recharge; -import mineplex.core.task.TaskManager; -import mineplex.core.treasure.event.TreasureStartEvent; -import mineplex.core.updater.UpdateType; -import mineplex.core.updater.event.UpdateEvent; -import mineplex.hub.HubManager; -import mineplex.hub.modules.parkour.ParkourData; +import java.util.Arrays; +import java.util.HashSet; +import java.util.Iterator; +import java.util.List; +import java.util.Map; +import java.util.UUID; +import java.util.WeakHashMap; +import java.util.stream.Collectors; + import org.bukkit.Bukkit; import org.bukkit.Location; import org.bukkit.Material; @@ -48,39 +31,59 @@ import org.bukkit.event.player.PlayerVelocityEvent; import org.bukkit.potion.PotionEffect; import org.bukkit.util.Vector; -import java.util.Arrays; -import java.util.HashSet; -import java.util.Iterator; -import java.util.List; -import java.util.Map; -import java.util.UUID; -import java.util.WeakHashMap; -import java.util.stream.Collectors; +import com.google.common.collect.Lists; +import com.google.common.collect.Maps; + +import mineplex.core.MiniPlugin; +import mineplex.core.common.currency.GlobalCurrency; +import mineplex.core.common.util.C; +import mineplex.core.common.util.Callback; +import mineplex.core.common.util.F; +import mineplex.core.common.util.UtilBlock; +import mineplex.core.common.util.UtilEnt; +import mineplex.core.common.util.UtilEvent; +import mineplex.core.common.util.UtilEvent.ActionType; +import mineplex.core.common.util.UtilMath; +import mineplex.core.common.util.UtilPlayer; +import mineplex.core.common.util.UtilServer; +import mineplex.core.common.util.UtilTime; +import mineplex.core.donation.DonationManager; +import mineplex.core.gadget.event.GadgetBlockEvent; +import mineplex.core.gadget.event.GadgetEnableEvent; +import mineplex.core.gadget.types.MusicGadget; +import mineplex.core.mount.event.MountActivateEvent; +import mineplex.core.recharge.Recharge; +import mineplex.core.task.TaskManager; +import mineplex.core.treasure.event.TreasurePreStartEvent; +import mineplex.core.updater.UpdateType; +import mineplex.core.updater.event.UpdateEvent; +import mineplex.hub.HubManager; +import mineplex.hub.modules.parkour.ParkourData; public class ParkourManager extends MiniPlugin { private final String[] RUINS_DESCRIPTION = { - "This is an extremely difficult parkour.", - "You will need to find the correct way through", - "the ruins, overcoming many challenging jumps.", + "This is an extremely difficult parkour.", + "You will need to find the correct way through", + "the ruins, overcoming many challenging jumps.", }; private final String[] GWEN_DESCRIPTION = { - "Can you escape from our Guardians?", - "I hear they have infested the water", - "sending anyone who falls in back to the start!", + "Can you escape from our Guardians?", + "I hear they have infested the water", + "sending anyone who falls in back to the start!", }; private final String[] LAVA_DESCRIPTION = { - "This parkour is HOT! It's so hot that you", - "must keep sprinting for the entire course,", - "or you will die in flames!" + "This parkour is HOT! It's so hot that you", + "must keep sprinting for the entire course,", + "or you will die in flames!" }; private final String[] DESERT_DESCRIPTION = { - "Ever heard of Prince of Persia", - "well, this isn't as exciting.", - "yet...." + "Ever heard of Prince of Persia", + "well, this isn't as exciting.", + "yet...." }; private final int RUINS_GEMS = 10000; @@ -114,24 +117,24 @@ public class ParkourManager extends MiniPlugin _donationManager = donation; _parkour.add(new ParkourData("Ruins Parkour", RUINS_DESCRIPTION, RUINS_GEMS, - new Location(Manager.GetSpawn().getWorld(), 113.5, 66, -46.5), - new Location(Manager.GetSpawn().getWorld(), 124, 86, 18), - new Location(Manager.GetSpawn().getWorld(), 105, 57, -53))); + new Location(Manager.GetSpawn().getWorld(), 113.5, 66, -46.5), + new Location(Manager.GetSpawn().getWorld(), 124, 86, 18), + new Location(Manager.GetSpawn().getWorld(), 105, 57, -53))); _parkour.add(new ParkourData("G.W.E.N Parkour", GWEN_DESCRIPTION, GWEN_GEMS, - new Location(Manager.GetSpawn().getWorld(), 55.5, 68, -94.5), - new Location(Manager.GetSpawn().getWorld(), 106, 96, -142), - new Location(Manager.GetSpawn().getWorld(), 52, 61, -81))); + new Location(Manager.GetSpawn().getWorld(), 55.5, 68, -94.5), + new Location(Manager.GetSpawn().getWorld(), 106, 96, -142), + new Location(Manager.GetSpawn().getWorld(), 52, 61, -81))); _parkour.add(new ParkourData("Lava Parkour", LAVA_DESCRIPTION, LAVA_GEMS, - new Location(Manager.GetSpawn().getWorld(), -93.5, 67, 37.5), - new Location(Manager.GetSpawn().getWorld(), -144, 97, -21), - new Location(Manager.GetSpawn().getWorld(), -88, 62, 41))); + new Location(Manager.GetSpawn().getWorld(), -93.5, 67, 37.5), + new Location(Manager.GetSpawn().getWorld(), -144, 97, -21), + new Location(Manager.GetSpawn().getWorld(), -88, 62, 41))); _parkour.add(new ParkourData("Desert Village Parkour", DESERT_DESCRIPTION, DESERT_GEMS, - new Location(Manager.GetSpawn().getWorld(), -63.5, 69, -32.5), - new Location(Manager.GetSpawn().getWorld(), -57, 82, -35), - new Location(Manager.GetSpawn().getWorld(), -122, 45, 57))); + new Location(Manager.GetSpawn().getWorld(), -63.5, 69, -32.5), + new Location(Manager.GetSpawn().getWorld(), -57, 82, -35), + new Location(Manager.GetSpawn().getWorld(), -122, 45, 57))); _lavaParkourReturn = new Location(Manager.GetSpawn().getWorld(), -89.5, 68, 36.5); _lavaParkourReturn.setYaw(90); @@ -156,7 +159,8 @@ public class ParkourManager extends MiniPlugin Manager.GetGadget().disableAll(player); player.setVelocity(new Vector(0, -1, 0)); - } else + } + else { player.setAllowFlight(true); _active.remove(player.getUniqueId()); @@ -208,9 +212,9 @@ public class ParkourManager extends MiniPlugin _parkour.stream() - .filter(data -> UtilMath.offset(player.getLocation(), data.NPC) < 6) - .filter(data -> Recharge.Instance.use(player, data.Name + " Info", 300000, false, false)) - .forEach(data -> data.Inform(player)); + .filter(data -> UtilMath.offset(player.getLocation(), data.NPC) < 6) + .filter(data -> Recharge.Instance.use(player, data.Name + " Info", 300000, false, false)) + .forEach(data -> data.Inform(player)); } } @@ -223,14 +227,15 @@ public class ParkourManager extends MiniPlugin } List players = Lists.newArrayList(_active.keySet().stream().map(Bukkit::getPlayer).collect(Collectors.toList())); - for(Player player : players) + for (Player player : players) { player.leaveVehicle(); player.eject(); - if(!InsideParkour(player.getLocation())) + if (!InsideParkour(player.getLocation())) { setParkourMode(player, false, null); - } else + } + else { for (PotionEffect potionEffect : player.getActivePotionEffects()) { @@ -293,6 +298,8 @@ public class ParkourManager extends MiniPlugin if (!(event.getEntity() instanceof Player)) { + if (event.getEntity().hasMetadata("balloon")) + return; event.getEntity().remove(); return; } @@ -335,7 +342,7 @@ public class ParkourManager extends MiniPlugin @EventHandler(priority = EventPriority.LOWEST) public void onTeam(PlayerCommandPreprocessEvent event) { - if(event.getMessage().startsWith("/team ") && isParkourMode(event.getPlayer())) + if (event.getMessage().startsWith("/team ") && isParkourMode(event.getPlayer())) { event.setCancelled(true); event.getPlayer().sendMessage(F.main("Team", "You cannot join a team while in parkour mode!")); @@ -441,7 +448,8 @@ public class ParkourManager extends MiniPlugin if (isParkourMode(player)) { setParkourMode(player, false, data); - } else + } + else { setParkourMode(player, true, data); } @@ -468,7 +476,7 @@ public class ParkourManager extends MiniPlugin ParkourData data = _active.get(player.getUniqueId()); - if(!ent.getCustomName().contains(data.Name)) + if (!ent.getCustomName().contains(data.Name)) { UtilPlayer.message(player, F.main("Parkour", "This is not the entity you are looking for...")); player.teleport(data.NPC); @@ -489,23 +497,21 @@ public class ParkourManager extends MiniPlugin { public void run(Boolean completed) { - _donationManager.RewardGems(new Callback() + _donationManager.rewardCurrency(GlobalCurrency.GEM, player, "Parkour " + fData.Name, fData.Gems, success -> { - public void run(Boolean completed) + if (completed) { - if (completed) - { - UtilPlayer.message(player, F.main("Parkour", "You received " + F.elem(C.cGreen + fData.Gems + " Gems") + ".")); + UtilPlayer.message(player, F.main("Parkour", "You received " + F.elem(C.cGreen + fData.Gems + " Gems") + ".")); - //Sound - player.playSound(player.getLocation(), Sound.LEVEL_UP, 2f, 1.5f); - } else - { - _taskManager.Get(player).TasksCompleted.remove(_taskManager.getTaskId(fData.Name)); - UtilPlayer.message(player, F.main("Parkour", "There was an error giving " + F.elem(C.cGreen + fData.Gems + " Gems to you. Please click the NPC again.") + ".")); - } + //Sound + player.playSound(player.getLocation(), Sound.LEVEL_UP, 2f, 1.5f); } - }, "Parkour " + fData.Name, player.getName(), player.getUniqueId(), fData.Gems); + else + { + _taskManager.Get(player).TasksCompleted.remove(_taskManager.getTaskId(fData.Name)); + UtilPlayer.message(player, F.main("Parkour", "There was an error giving " + F.elem(C.cGreen + fData.Gems + " Gems to you. Please click the NPC again.") + ".")); + } + }); //Sound player.playSound(player.getLocation(), Sound.LEVEL_UP, 2f, 1.5f); @@ -546,7 +552,7 @@ public class ParkourManager extends MiniPlugin } @EventHandler - public void preventTreasureNearParkour(TreasureStartEvent event) + public void preventTreasureNearParkour(TreasurePreStartEvent event) { if (InsideParkour(event.getPlayer().getLocation())) { diff --git a/Plugins/Mineplex.Hub/src/mineplex/hub/modules/SoccerManager.java b/Plugins/Mineplex.Hub/src/mineplex/hub/modules/SoccerManager.java index cdb17aa96..73ef20d70 100644 --- a/Plugins/Mineplex.Hub/src/mineplex/hub/modules/SoccerManager.java +++ b/Plugins/Mineplex.Hub/src/mineplex/hub/modules/SoccerManager.java @@ -159,7 +159,7 @@ public class SoccerManager extends MiniPlugin _ball = mid.getWorld().spawn(mid, Slime.class); _ball.setSize(2); - UtilEnt.Vegetate(_ball); + UtilEnt.vegetate(_ball); UtilEnt.ghost(_ball, true, false); _ballVel = new Vector(0,-0.1,0); diff --git a/Plugins/Mineplex.Hub/src/mineplex/hub/modules/StackerManager.java b/Plugins/Mineplex.Hub/src/mineplex/hub/modules/StackerManager.java deleted file mode 100644 index c6b639b22..000000000 --- a/Plugins/Mineplex.Hub/src/mineplex/hub/modules/StackerManager.java +++ /dev/null @@ -1,372 +0,0 @@ -package mineplex.hub.modules; - -import java.util.HashSet; - -import org.bukkit.Bukkit; -import org.bukkit.GameMode; -import org.bukkit.Material; -import org.bukkit.Sound; -import org.bukkit.block.Block; -import org.bukkit.craftbukkit.v1_8_R3.inventory.CraftInventoryCrafting; -import org.bukkit.entity.ArmorStand; -import org.bukkit.entity.Bat; -import org.bukkit.entity.EnderDragon; -import org.bukkit.entity.Entity; -import org.bukkit.entity.Horse; -import org.bukkit.entity.LivingEntity; -import org.bukkit.entity.Minecart; -import org.bukkit.entity.Player; -import org.bukkit.entity.Wither; -import org.bukkit.event.EventHandler; -import org.bukkit.event.player.PlayerInteractAtEntityEvent; -import org.bukkit.event.player.PlayerInteractEvent; -import org.bukkit.inventory.Inventory; -import org.bukkit.inventory.ItemStack; -import org.bukkit.util.Vector; - -import mineplex.core.Managers; -import mineplex.core.MiniPlugin; -import mineplex.core.common.util.F; -import mineplex.core.common.util.UtilAction; -import mineplex.core.common.util.UtilAlg; -import mineplex.core.common.util.UtilEnt; -import mineplex.core.common.util.UtilEvent; -import mineplex.core.common.util.UtilEvent.ActionType; -import mineplex.core.common.util.UtilGear; -import mineplex.core.common.util.UtilPlayer; -import mineplex.core.event.StackerEvent; -import mineplex.core.gadget.gadgets.item.ItemBatGun; -import mineplex.core.gadget.gadgets.morph.MorphBlock; -import mineplex.core.gadget.gadgets.morph.MorphGrimReaper; -import mineplex.core.gadget.types.GadgetType; -import mineplex.core.pet.PetManager; -import mineplex.core.projectile.IThrown; -import mineplex.core.projectile.ProjectileManager; -import mineplex.core.projectile.ProjectileUser; -import mineplex.core.recharge.Recharge; -import mineplex.hub.HubManager; - -public class StackerManager extends MiniPlugin implements IThrown -{ - public HubManager Manager; - - private ProjectileManager _projectileManager; - - private HashSet _tempStackShift = new HashSet(); - - public StackerManager(HubManager manager) - { - super("Stacker", manager.getPlugin()); - - Manager = manager; - - _projectileManager = Managers.get(ProjectileManager.class); - } - - @EventHandler - public void GrabEntity(PlayerInteractAtEntityEvent event) - { - if (event.isCancelled()) - return; - - Entity stackee = event.getRightClicked(); - if (stackee == null) - return; - - if(Manager.GetMount().isMount(stackee)) - return; - - if (!(stackee instanceof LivingEntity)) - return; - - if (stackee instanceof Horse) - return; - - if (stackee instanceof EnderDragon) - return; - - if (Manager.getMavericksManager().isStatueEntity(stackee)) - return; - - if (stackee instanceof Player && ((Player)stackee).getGameMode() != GameMode.SURVIVAL) - return; - - if(stackee instanceof ArmorStand) - { - return; - } - - if(stackee instanceof Minecart) - { - return; - } - - Player stacker = event.getPlayer(); - - if (stacker.getGameMode() != GameMode.SURVIVAL) - return; - - if (UtilGear.isMat(stacker.getItemInHand(), Material.SNOW_BALL)) - return; - - StackerEvent stackerEvent = new StackerEvent(stacker); - Bukkit.getServer().getPluginManager().callEvent(stackerEvent); - if (stackerEvent.isCancelled()) - return; - - //Parkour Disable - if (Manager.GetParkour().InsideParkour(stacker.getLocation())) - { - if (!stackee.isCustomNameVisible()) - UtilPlayer.message(stacker, F.main("Parkour", "You cannot Stack/Throw near Parkour Challenges.")); - - return; - } - - if (stacker.getVehicle() != null || _tempStackShift.contains(stacker)) - { - UtilPlayer.message(stacker, F.main("Stacker", "You cannot stack while stacked...")); - return; - } - - if (Manager.GetGadget().getActive(stacker, GadgetType.MORPH) instanceof MorphBlock) - { - UtilPlayer.message(stacker, F.main("Stacker", "You cannot stack while using the Block Morph.")); - return; - } - - if (Manager.GetGadget().getActive(stacker, GadgetType.MORPH) instanceof MorphGrimReaper) - { - if (stacker.getItemInHand().getType() == Material.WOOD_HOE) - { - return; - } - } - - if (Manager.GetTreasure().isOpening(stacker)) - return; - - stackerEvent = new StackerEvent(stackee); - Bukkit.getServer().getPluginManager().callEvent(stackerEvent); - if (stackerEvent.isCancelled()) - return; - - if (stackee instanceof Player) - { - Player stackeePlayer = (Player) stackee; - - if (!Manager.hasPlayerStackingEnabled(stacker)) - { - UtilPlayer.message(stacker, F.main("Stacker", "You have player stacking disabled.")); - return; - } - - if (!Manager.hasPlayerStackingEnabled((stackeePlayer))) - { - UtilPlayer.message(stacker, F.main("Stacker", F.name(UtilEnt.getName(stackee)) + " has player stacking disabled.")); - return; - } - - if (Manager.GetTreasure().isOpening(stackeePlayer)) - { - UtilPlayer.message(stacker, F.main("Stacker", F.main("Stacker", F.name(UtilEnt.getName(stackee)) + " is opening a chest!"))); - return; - } - - Inventory top = stackeePlayer.getOpenInventory().getTopInventory(); - - if (!(top instanceof CraftInventoryCrafting) && hasItems(top)) - { - String message = F.main("Stacker", F.name(UtilEnt.getName(stackee)) + " cannot be stacked right now."); - - if (top.getHolder() != null) - { - if (top.getHolder().equals(stackeePlayer)) - { - UtilPlayer.message(stacker, message); - return; - } - } - - UtilPlayer.message(stacker, message); - return; - } - } - - if (stackee instanceof LivingEntity) - { - ItemBatGun batGun = (ItemBatGun) Manager.GetGadget().getGadget(ItemBatGun.class); - - if (stackee instanceof Bat) - { - Bat bat = (Bat) stackee; - - if (batGun.isThrownBat(bat)) - return; - } - - PetManager petManager = Manager.getPetManager(); - LivingEntity livingStackee = (LivingEntity) stackee; - boolean cannotStack = petManager.getPets().contains(stackee) || stackee instanceof Wither || stackee instanceof EnderDragon; - - if (cannotStack || livingStackee.isCustomNameVisible()) - { - // Prevent from showing this message when players right-click on game npc's. - if (cannotStack) - UtilPlayer.message(stacker, F.main("Stacker", "You cannot stack this entity.")); - - return; - } - } - - while (stackee.getVehicle() != null) - stackee = stackee.getVehicle(); - - if (stackee.equals(stacker)) - return; - - Entity top = stacker; - while (top.getPassenger() != null) - top = top.getPassenger(); - - if (!Recharge.Instance.use(stacker, "Stacker", 500, true, false)) - return; - - top.setPassenger(stackee); - - UtilPlayer.message(stacker, F.main("Stacker", "You stacked " + F.name(UtilEnt.getName(stackee)) + ".")); - UtilPlayer.message(stackee, F.main("Stacker", "You were stacked by " + F.name(stacker.getName()) + ".")); - UtilPlayer.message(stackee, F.main("Stacker", "Push " + F.skill("Crouch") + " to escape!")); - - //Portal Delay - Manager.SetPortalDelay(stacker); - Manager.SetPortalDelay(stackee); - - event.setCancelled(true); - } - - @EventHandler - public void ThrowEntity(PlayerInteractEvent event) - { - if (!UtilEvent.isAction(event, ActionType.L)) - return; - - Player thrower = event.getPlayer(); - - if (thrower.getVehicle() != null) - return; - - Entity throwee = thrower.getPassenger(); - if (throwee == null) - return; - - StackerEvent stackerEvent = new StackerEvent(thrower); - Bukkit.getServer().getPluginManager().callEvent(stackerEvent); - if (stackerEvent.isCancelled()) - return; - - thrower.eject(); - - Entity throweeStack = throwee.getPassenger(); - if (throweeStack != null) - { - throwee.eject(); - throweeStack.leaveVehicle(); - - final Entity fThrower = thrower; - final Entity fThroweeStack = throweeStack; - - _tempStackShift.add(throweeStack); - - getPlugin().getServer().getScheduler().scheduleSyncDelayedTask(getPlugin(), new Runnable() - { - public void run() - { - if ((fThrower instanceof Player && !((Player)fThrower).isOnline()) - || (fThroweeStack instanceof Player && !((Player)fThroweeStack).isOnline())) - { - fThrower.setPassenger(fThroweeStack); - } - - _tempStackShift.remove(fThroweeStack); - } - }, 2); - } - - //Parkour Disable - if (Manager.GetParkour().InsideParkour(thrower.getLocation())) - { - UtilPlayer.message(thrower, F.main("Parkour", "You cannot Stack/Throw near Parkour Challenges.")); - return; - } - - UtilPlayer.message(thrower, F.main("Stacker", "You threw " + F.name(UtilEnt.getName(throwee)) + ".")); - UtilPlayer.message(throwee, F.main("Stacker", "You were thrown by " + F.name(thrower.getName()) + ".")); - - UtilAction.velocity(throwee, thrower.getLocation().getDirection(), 1.8, false, 0, 0.3, 2, false); - - _projectileManager.AddThrow(throwee, thrower, this, 4000, true, false, true, false, 0.5f); - - //Portal Delay - Manager.SetPortalDelay(thrower); - Manager.SetPortalDelay(throwee); - } - - @Override - public void Collide(LivingEntity target, Block block, ProjectileUser data) - { - if (target == null) - return; - - if (target.getCustomName() != null || (target.getPassenger() != null && target.getPassenger() instanceof LivingEntity && ((LivingEntity)target.getPassenger()).getCustomName() != null)) - return; - - if (!Manager.hasPlayerStackingEnabled(target)) - return; - - //Velocity - UtilAction.velocity(target, UtilAlg.getTrajectory2d(data.getThrown(), target), 1, true, 0.8, 0, 10, true); - - Entity rider = target.getPassenger(); - while (rider != null) - { - //Portal Delay - Manager.SetPortalDelay(rider); - - rider.leaveVehicle(); - UtilAction.velocity(rider, new Vector(0.25 - Math.random()/2, Math.random()/2, 0.25 - Math.random()/2)); - rider = rider.getPassenger(); - } - - UtilPlayer.message(target, F.main("Stacker", F.name(UtilEnt.getName(data.getThrower())) + " hit you with " + F.name(UtilEnt.getName(data.getThrown())))); - - //Effect - data.getThrown().getWorld().playSound(data.getThrown().getLocation(), Sound.HURT_FLESH, 1f, 1f); - - //Portal Delay - Manager.SetPortalDelay(target); - } - - private boolean hasItems(Inventory inventory) - { - for (ItemStack item : inventory.getContents()) - { - if (item != null) - return true; - } - - return false; - } - - @Override - public void Idle(ProjectileUser data) - { - - } - - @Override - public void Expire(ProjectileUser data) - { - - } -} diff --git a/Plugins/Mineplex.Hub/src/mineplex/hub/modules/ValentinesManager.java b/Plugins/Mineplex.Hub/src/mineplex/hub/modules/ValentinesManager.java index d0ce99b44..e90cd3b17 100644 --- a/Plugins/Mineplex.Hub/src/mineplex/hub/modules/ValentinesManager.java +++ b/Plugins/Mineplex.Hub/src/mineplex/hub/modules/ValentinesManager.java @@ -11,6 +11,7 @@ import mineplex.core.server.util.TransactionResponse; import mineplex.core.updater.UpdateType; import mineplex.core.updater.event.UpdateEvent; import mineplex.hub.modules.valentines.Courtship; + import org.bukkit.entity.Player; import org.bukkit.entity.Sheep; import org.bukkit.event.EventHandler; @@ -22,56 +23,56 @@ public class ValentinesManager extends MiniPlugin * Created by: Mysticate * Timestamp: February 6, 2016 */ - + private final boolean _enabled = true; - + private final String _prefix = C.cDPurple + "Polly"; private final String _identifier = "Polly the Pink Sheep"; private final String _reward = "Loving Sheeples"; // The sales package to reward - + private final float _dropRate = .1F; - + private CoreClientManager _client; private DonationManager _donation; - + private Courtship _active = null; private long _lastEnd = -1; - + public ValentinesManager(JavaPlugin plugin, CoreClientManager client, DonationManager donation) { super("Valentines Sheep Manager", plugin); - + _client = client; _donation = donation; } @EventHandler public void onGadget(GadgetCollideEntityEvent event) - { + { if (!_enabled) return; - + if (!(event.getGadget() instanceof ItemLovePotion)) return; - + if (!(event.getOther() instanceof Sheep)) return; - + Player player = event.getPlayer(); - + if (!event.getOther().getCustomName().contains(_identifier)) return; - + if (_lastEnd != -1 && !UtilTime.elapsed(_lastEnd, 1000)) return; - + if (_active != null) { UtilPlayer.message(player, F.main("Cupid", "Someone is already courting " + F.elem(_prefix) + "!")); return; } - - if (_donation.Get(player).OwnsUnknownPackage(_reward)) + + if (_donation.Get(player).ownsUnknownSalesPackage(_reward)) { UtilPlayer.message(player, F.main(_prefix, "I already love you!")); return; @@ -82,13 +83,13 @@ public class ValentinesManager extends MiniPlugin final boolean success = UtilMath.random.nextFloat() > 1 - _dropRate; _active = new Courtship(this, player, (Sheep) event.getOther(), _prefix, success); } - + @EventHandler public void onTick(UpdateEvent event) { if (_active == null) return; - + if (event.getType() == UpdateType.TICK) { if (_active.tick()) @@ -98,30 +99,21 @@ public class ValentinesManager extends MiniPlugin } } } - + public void giveReward(Player player) { - _donation.PurchaseUnknownSalesPackage(new Callback() + _donation.purchaseUnknownSalesPackage(_client.Get(player), _reward, GlobalCurrency.TREASURE_SHARD, 0, true, data -> { - @Override - public void run(TransactionResponse data) + if (data == TransactionResponse.AlreadyOwns || data == TransactionResponse.Failed) { -// if (data == TransactionResponse.AlreadyOwns) -// { -// UtilPlayer.message(player, "owned but it worked"); -// } -// - if (data == TransactionResponse.AlreadyOwns || data == TransactionResponse.Failed) - { - UtilPlayer.message(player, F.main("Error", "An error occured while rewarding " + F.elem(_reward) + ".")); - return; - } - - if (data == TransactionResponse.Success) - { - UtilPlayer.message(player, F.main("Reward", "You recieved " + F.elem(_reward + " Mount") + " from " + F.elem(_prefix) + "!")); - } + UtilPlayer.message(player, F.main("Error", "An error occured while rewarding " + F.elem(_reward) + ".")); + return; } - }, player.getName(), _client.getAccountId(player), _reward, GlobalCurrency.TREASURE_SHARD, 0, true); + + if (data == TransactionResponse.Success) + { + UtilPlayer.message(player, F.main("Reward", "You recieved " + F.elem(_reward + " Mount") + " from " + F.elem(_prefix) + "!")); + } + }); } } diff --git a/Plugins/Mineplex.Hub/src/mineplex/hub/modules/WorldManager.java b/Plugins/Mineplex.Hub/src/mineplex/hub/modules/WorldManager.java index 0d83153c4..d791e7ee6 100644 --- a/Plugins/Mineplex.Hub/src/mineplex/hub/modules/WorldManager.java +++ b/Plugins/Mineplex.Hub/src/mineplex/hub/modules/WorldManager.java @@ -74,7 +74,7 @@ public class WorldManager extends MiniPlugin world.setGameRuleValue("doDaylightCycle", "false"); - if (Manager.Type == HubType.Halloween) + if (Manager.Type == HubType.Halloween || Manager.Type == HubType.Christmas) { world.setTime(13850); } else diff --git a/Plugins/Mineplex.Hub/src/mineplex/hub/modules/mavericks/basketball/BasketballGame.java b/Plugins/Mineplex.Hub/src/mineplex/hub/modules/mavericks/basketball/BasketballGame.java index 0b5660ee7..122cd21be 100644 --- a/Plugins/Mineplex.Hub/src/mineplex/hub/modules/mavericks/basketball/BasketballGame.java +++ b/Plugins/Mineplex.Hub/src/mineplex/hub/modules/mavericks/basketball/BasketballGame.java @@ -97,7 +97,7 @@ public class BasketballGame implements Listener { _velocity = -7; Entity e = loc.getWorld().spawnEntity(loc, EntityType.SLIME); - UtilEnt.Vegetate(e, true); + UtilEnt.vegetate(e, true); UtilEnt.ghost(e, true, false); ((Slime)e).setSize(1); diff --git a/Plugins/Mineplex.Hub/src/mineplex/hub/modules/nonpremium/MessageRepository.java b/Plugins/Mineplex.Hub/src/mineplex/hub/modules/nonpremium/MessageRepository.java deleted file mode 100644 index d42fcef34..000000000 --- a/Plugins/Mineplex.Hub/src/mineplex/hub/modules/nonpremium/MessageRepository.java +++ /dev/null @@ -1,84 +0,0 @@ -package mineplex.hub.modules.nonpremium; - -import mineplex.core.progression.util.SQLStatement; -import mineplex.serverdata.database.DBPool; -import org.bukkit.Bukkit; -import org.bukkit.plugin.java.JavaPlugin; - -import java.sql.Connection; -import java.sql.ResultSet; -import java.sql.SQLException; - -/** - * - */ -public class MessageRepository -{ - - private static final String SCHEMA = "CREATE TABLE IF NOT EXISTS nonPremiumJoinMessage (message VARCHAR(256));"; - - private static final String QUERY = "SELECT `message` FROM `nonPremiumJoinMessage`;"; - private static final String UPDATE = "UPDATE `nonPremiumJoinMessage` SET `message` = ?;"; - private static final String INSERT = "INSERT INTO `nonPremiumJoinMessage` VALUES(?);"; - - private final JavaPlugin _plugin; - private String _message; - - public MessageRepository(JavaPlugin plugin) - { - _plugin = plugin; - } - - /** - * Update the message globally. - * - * @param message The new string literal message - */ - public void updateMessage(String message) - { - _message = message; - async(() -> { - try (Connection connection = DBPool.getAccount().getConnection()) - { - ResultSet resultSet = new SQLStatement(QUERY).prepare(connection).executeQuery(); - - if (!resultSet.next()) - { - new SQLStatement(INSERT).set(1, message).prepare(connection).executeUpdate(); - - } else - { - new SQLStatement(UPDATE).set(1, message).prepare(connection).executeUpdate(); - } - } catch (SQLException e) - { - e.printStackTrace(); - } - }); - } - - private void async(Runnable runnable) - { - Bukkit.getScheduler().runTaskAsynchronously(_plugin, runnable); - } - - public String getMessage() - { - if (_message == null) - { - try (Connection connection = DBPool.getAccount().getConnection()) - { - ResultSet resultSet = new SQLStatement(QUERY).prepare(connection).executeQuery(); - if (resultSet == null || !resultSet.next()) - { - return null; - } - _message = resultSet.getString(1); - } catch (SQLException e) - { - e.printStackTrace(); - } - } - return _message; - } -} diff --git a/Plugins/Mineplex.Hub/src/mineplex/hub/modules/nonpremium/NPUMCommand.java b/Plugins/Mineplex.Hub/src/mineplex/hub/modules/nonpremium/NPUMCommand.java deleted file mode 100644 index cb4796759..000000000 --- a/Plugins/Mineplex.Hub/src/mineplex/hub/modules/nonpremium/NPUMCommand.java +++ /dev/null @@ -1,47 +0,0 @@ -package mineplex.hub.modules.nonpremium; - -import mineplex.core.command.CommandBase; -import mineplex.core.common.Rank; -import mineplex.core.common.util.C; -import mineplex.core.common.util.F; -import org.bukkit.ChatColor; -import org.bukkit.entity.Player; - -/** - * - */ -public class NPUMCommand extends CommandBase -{ - - public NPUMCommand(NonPremiumManager plugin) - { - super(plugin, Rank.ADMIN, "updatemessage"); - } - - @Override - public void Execute(Player caller, String[] args) - { - if(!Plugin.getClientManager().Get(caller).GetRank().has(Rank.ADMIN)) { - caller.sendMessage(C.cRed + "No."); - return; - } - - if(args.length == 0) { - caller.sendMessage(F.main("NPUM", "Invalid Command Arguments. Usage: /updatemessage \"Message here\". Use '&' for color codes. Spaces are allowed.")); - return; - } - - StringBuilder message = new StringBuilder(); - - for(int i = 0; i < args.length; i++) { - message.append(args[i]); - if((i + 1) != args.length) { - message.append(" "); - } - } - - Plugin.setMessage(message.toString(), true); - caller.sendMessage(F.main("NPUM", "Non-Premium User message updated. New message: ")); - caller.sendMessage(ChatColor.translateAlternateColorCodes('&', message.toString())); - } -} diff --git a/Plugins/Mineplex.Hub/src/mineplex/hub/modules/nonpremium/NonPremiumManager.java b/Plugins/Mineplex.Hub/src/mineplex/hub/modules/nonpremium/NonPremiumManager.java deleted file mode 100644 index 78967ecde..000000000 --- a/Plugins/Mineplex.Hub/src/mineplex/hub/modules/nonpremium/NonPremiumManager.java +++ /dev/null @@ -1,84 +0,0 @@ -package mineplex.hub.modules.nonpremium; - -import mineplex.core.MiniPlugin; -import mineplex.core.account.CoreClientManager; -import mineplex.core.common.Rank; -import mineplex.core.common.util.C; -import mineplex.serverdata.commands.ServerCommandManager; -import org.bukkit.ChatColor; -import org.bukkit.entity.Player; -import org.bukkit.event.EventHandler; -import org.bukkit.event.player.PlayerJoinEvent; -import org.bukkit.plugin.java.JavaPlugin; - -/** - * - */ -public class NonPremiumManager extends MiniPlugin -{ - - private static final String LINE = C.cDGreenB + C.Strike + "============================================="; - - private String _message; - private MessageRepository _messageRepository; - private CoreClientManager _clientManager; - - public NonPremiumManager(JavaPlugin plugin, CoreClientManager clientManager) - { - super("NonPremiumPlayerManager", plugin); - addCommand(new NPUMCommand(this)); - _clientManager = clientManager; - _messageRepository = new MessageRepository(plugin); - _message = _messageRepository.getMessage(); - UpdateMessageHandler handler = new UpdateMessageHandler(this); - ServerCommandManager.getInstance().registerCommandType(UpdateMessageCommand.class, handler); - } - - @EventHandler - public void onJoin(PlayerJoinEvent event) - { - Player player = event.getPlayer(); - Rank rank = _clientManager.Get(player).GetRank(); - - if (_message == null) - { - return; - } - - if (rank != Rank.ALL) - { - return; - } - - getPlugin().getServer().getScheduler().runTaskLater(getPlugin(), () -> { - player.sendMessage(" "); - player.sendMessage(LINE); - player.sendMessage(" "); - player.sendMessage(ChatColor.translateAlternateColorCodes('&', _message)); - player.sendMessage(" "); - player.sendMessage(LINE); - player.sendMessage(" "); - player.sendMessage(" "); - }, 5L); - } - - public void setMessage(String message, boolean updateDB) - { - _message = message; - if (!updateDB) - { - return; - } - _messageRepository.updateMessage(message); - ServerCommandManager.getInstance().publishCommand(new UpdateMessageCommand(message, getServer())); - } - - public CoreClientManager getClientManager() - { - return _clientManager; - } - - public String getServer() { - return getPlugin().getConfig().getString("serverstatus.name"); - } -} diff --git a/Plugins/Mineplex.Hub/src/mineplex/hub/modules/nonpremium/UpdateMessageCommand.java b/Plugins/Mineplex.Hub/src/mineplex/hub/modules/nonpremium/UpdateMessageCommand.java deleted file mode 100644 index c0033eaf0..000000000 --- a/Plugins/Mineplex.Hub/src/mineplex/hub/modules/nonpremium/UpdateMessageCommand.java +++ /dev/null @@ -1,28 +0,0 @@ -package mineplex.hub.modules.nonpremium; - -import mineplex.serverdata.commands.ServerCommand; - -/** - * - */ -public class UpdateMessageCommand extends ServerCommand -{ - - private String _message; - private String _from; - - public UpdateMessageCommand(String message, String from) { - _message = message; - _from = from; - } - - public String getMessage() - { - return _message; - } - - public String getFrom() - { - return _from; - } -} diff --git a/Plugins/Mineplex.Hub/src/mineplex/hub/modules/nonpremium/UpdateMessageHandler.java b/Plugins/Mineplex.Hub/src/mineplex/hub/modules/nonpremium/UpdateMessageHandler.java deleted file mode 100644 index 19b11bf36..000000000 --- a/Plugins/Mineplex.Hub/src/mineplex/hub/modules/nonpremium/UpdateMessageHandler.java +++ /dev/null @@ -1,29 +0,0 @@ -package mineplex.hub.modules.nonpremium; - -import mineplex.serverdata.commands.CommandCallback; -import mineplex.serverdata.commands.ServerCommand; - -/** - * - */ -public class UpdateMessageHandler implements CommandCallback -{ - - private final NonPremiumManager _manager; - - public UpdateMessageHandler(NonPremiumManager manager) { - _manager = manager; - } - - @Override - public void run(ServerCommand command) - { - if(!(command instanceof UpdateMessageCommand)) { - return; - } - if(_manager.getServer().equalsIgnoreCase(((UpdateMessageCommand) command).getFrom())) { - return; - } - _manager.setMessage(((UpdateMessageCommand) command).getMessage(), false); - } -} diff --git a/Plugins/Mineplex.Hub/src/mineplex/hub/modules/salesannouncements/RankSelectionButton.java b/Plugins/Mineplex.Hub/src/mineplex/hub/modules/salesannouncements/RankSelectionButton.java new file mode 100644 index 000000000..a517e831e --- /dev/null +++ b/Plugins/Mineplex.Hub/src/mineplex/hub/modules/salesannouncements/RankSelectionButton.java @@ -0,0 +1,41 @@ +package mineplex.hub.modules.salesannouncements; + +import org.bukkit.Material; +import org.bukkit.event.inventory.ClickType; + +import mineplex.core.common.Rank; +import mineplex.core.common.util.C; +import mineplex.core.itemstack.ItemBuilder; + +public class RankSelectionButton extends SalesAnnouncementGUIButton +{ + private SalesAnnouncementCreationPage _page; + private Rank _rank; + + public RankSelectionButton(Rank rank, SalesAnnouncementCreationPage page) + { + super(new ItemBuilder(Material.REDSTONE_BLOCK).setTitle(rank.getColor() + (rank.Name.isEmpty() ? "Default" : rank.Name)).addLore(C.cRed + "Click to Toggle On").build()); + _rank = rank; + _page = page; + } + + @Override + public void update() {} + + @Override + public void handleClick(ClickType type) + { + if (_page.Selected.contains(_rank)) + { + Button = new ItemBuilder(Material.REDSTONE_BLOCK).setTitle(_rank.getColor() + (_rank.Name.isEmpty() ? "Default" : _rank.Name)).addLore(C.cRed + "Click to Toggle On").build(); + _page.Selected.remove(_rank); + _page.updateButtons(true); + } + else + { + Button = new ItemBuilder(Material.EMERALD_BLOCK).setTitle(_rank.getColor() + (_rank.Name.isEmpty() ? "Default" : _rank.Name)).addLore(C.cGreen + "Click to Toggle Off").build(); + _page.Selected.add(_rank); + _page.updateButtons(true); + } + } +} \ No newline at end of file diff --git a/Plugins/Mineplex.Hub/src/mineplex/hub/modules/salesannouncements/RankSelectionFinalizeButton.java b/Plugins/Mineplex.Hub/src/mineplex/hub/modules/salesannouncements/RankSelectionFinalizeButton.java new file mode 100644 index 000000000..7bb128566 --- /dev/null +++ b/Plugins/Mineplex.Hub/src/mineplex/hub/modules/salesannouncements/RankSelectionFinalizeButton.java @@ -0,0 +1,40 @@ +package mineplex.hub.modules.salesannouncements; + +import org.bukkit.Material; +import org.bukkit.event.inventory.ClickType; + +import mineplex.core.common.util.C; +import mineplex.core.itemstack.ItemBuilder; + +public class RankSelectionFinalizeButton extends SalesAnnouncementGUIButton +{ + private SalesAnnouncementCreationPage _page; + + public RankSelectionFinalizeButton(SalesAnnouncementCreationPage page) + { + super(new ItemBuilder(Material.REDSTONE_BLOCK).setTitle(C.cRed + "Click to Finalize").addLore(C.cRed + "You must select at least one rank!").build()); + _page = page; + } + + @Override + public void update() + { + if (_page.Selected.isEmpty()) + { + Button = new ItemBuilder(Material.REDSTONE_BLOCK).setTitle(C.cRed + "Click to Finalize").addLore(C.cRed + "You must select at least one rank!").build(); + } + else + { + Button = new ItemBuilder(Material.EMERALD_BLOCK).setTitle(C.cGreen + "Click to Finalize").build(); + } + } + + @Override + public void handleClick(ClickType type) + { + if (!_page.Selected.isEmpty()) + { + _page.finalizeSelection(); + } + } +} \ No newline at end of file diff --git a/Plugins/Mineplex.Hub/src/mineplex/hub/modules/salesannouncements/SalesAnnouncementButton.java b/Plugins/Mineplex.Hub/src/mineplex/hub/modules/salesannouncements/SalesAnnouncementButton.java new file mode 100644 index 000000000..303f85ad7 --- /dev/null +++ b/Plugins/Mineplex.Hub/src/mineplex/hub/modules/salesannouncements/SalesAnnouncementButton.java @@ -0,0 +1,40 @@ +package mineplex.hub.modules.salesannouncements; + +import org.bukkit.event.inventory.ClickType; + +public class SalesAnnouncementButton extends SalesAnnouncementGUIButton +{ + private SalesAnnouncementData _data; + private SalesAnnouncementPage _page; + + public SalesAnnouncementButton(SalesAnnouncementData data, SalesAnnouncementPage page) + { + super(data.getButtonForm()); + _data = data; + _page = page; + } + + public int getId() + { + return _data.getId(); + } + + @Override + public void update() + { + Button = _data.getButtonForm(); + } + + @Override + public void handleClick(ClickType type) + { + if (type == ClickType.RIGHT) + { + _page.deleteAnnouncement(_data); + } + else + { + _page.toggleAnnouncement(_data); + } + } +} \ No newline at end of file diff --git a/Plugins/Mineplex.Hub/src/mineplex/hub/modules/salesannouncements/SalesAnnouncementCommand.java b/Plugins/Mineplex.Hub/src/mineplex/hub/modules/salesannouncements/SalesAnnouncementCommand.java new file mode 100644 index 000000000..58f7f4930 --- /dev/null +++ b/Plugins/Mineplex.Hub/src/mineplex/hub/modules/salesannouncements/SalesAnnouncementCommand.java @@ -0,0 +1,40 @@ +package mineplex.hub.modules.salesannouncements; + +import org.bukkit.entity.Player; + +import mineplex.core.command.CommandBase; +import mineplex.core.common.Rank; +import mineplex.core.common.util.F; +import mineplex.core.common.util.UtilPlayer; + +public class SalesAnnouncementCommand extends CommandBase +{ + public SalesAnnouncementCommand(SalesAnnouncementManager plugin) + { + super(plugin, Rank.ADMIN, "sales"); + } + + @Override + public void Execute(Player caller, String[] args) + { + if (args.length > 1 && args[0].equalsIgnoreCase("add")) + { + StringBuilder message = new StringBuilder(); + message.append(args[1]); + for (int i = 2; i < args.length; i++) + { + message.append(" " + args[i]); + } + + new SalesAnnouncementCreationPage(caller, message.toString()); + } + else if (args.length >= 1) + { + UtilPlayer.message(caller, F.main(Plugin.getName(), "Usage is /sales add (can take chat color codes)")); + } + else + { + new SalesAnnouncementPage(caller, Plugin); + } + } +} \ No newline at end of file diff --git a/Plugins/Mineplex.Hub/src/mineplex/hub/modules/salesannouncements/SalesAnnouncementCreationPage.java b/Plugins/Mineplex.Hub/src/mineplex/hub/modules/salesannouncements/SalesAnnouncementCreationPage.java new file mode 100644 index 000000000..2abfe0b12 --- /dev/null +++ b/Plugins/Mineplex.Hub/src/mineplex/hub/modules/salesannouncements/SalesAnnouncementCreationPage.java @@ -0,0 +1,120 @@ +package mineplex.hub.modules.salesannouncements; + +import java.util.HashMap; +import java.util.List; +import java.util.Map; + +import org.bukkit.Bukkit; +import org.bukkit.entity.Player; +import org.bukkit.event.EventHandler; +import org.bukkit.event.HandlerList; +import org.bukkit.event.Listener; +import org.bukkit.event.inventory.InventoryClickEvent; +import org.bukkit.inventory.Inventory; + +import com.google.common.collect.Lists; + +import mineplex.core.Managers; +import mineplex.core.common.Rank; +import mineplex.core.common.util.C; +import mineplex.core.common.util.UtilServer; +import mineplex.core.updater.UpdateType; +import mineplex.core.updater.event.UpdateEvent; + +public class SalesAnnouncementCreationPage implements Listener +{ + private Player _viewer; + private Inventory _inv; + private String _message; + private Map _buttons = new HashMap<>(); + public List Selected = Lists.newArrayList(); + + public SalesAnnouncementCreationPage(Player player, String message) + { + _viewer = player; + _message = message; + _inv = Bukkit.createInventory(player, 9 * 4, C.cGreen + "Select Ranks"); + setup(); + _viewer.openInventory(_inv); + UtilServer.RegisterEvents(this); + } + + private void setup() + { + for (int i = 0; i < Rank.values().length; i++) + { + Rank rank = Rank.values()[i]; + _buttons.put(i, new RankSelectionButton(rank, this)); + } + _buttons.put(31, new RankSelectionFinalizeButton(this)); + updateButtons(false); + } + + private void disable() + { + HandlerList.unregisterAll(this); + } + + public void finalizeSelection() + { + Managers.get(SalesAnnouncementManager.class).createAnnouncement(_viewer, Selected.toArray(new Rank[Selected.size()]), _message); + Managers.get(SalesAnnouncementManager.class).runSyncLater(() -> _viewer.closeInventory(), 1L); + } + + public void updateButtons(boolean callUpdate) + { + _inv.clear(); + _buttons.entrySet().stream().filter(entry -> entry.getKey() != 31).forEach(entry -> + { + if (callUpdate) + { + entry.getValue().update(); + } + _inv.setItem(entry.getKey(), entry.getValue().Button); + }); + if (callUpdate) + { + _buttons.get(31).update(); + } + _inv.setItem(31, _buttons.get(31).Button); + _viewer.updateInventory(); + } + + @EventHandler + public void onUpdate(UpdateEvent event) + { + if (event.getType() != UpdateType.TICK) + { + return; + } + + if (event.getType() == UpdateType.TICK) + { + if (_viewer.getOpenInventory() == null || _viewer.getOpenInventory().getTopInventory() == null || !_viewer.getOpenInventory().getTopInventory().getTitle().equals(_inv.getTitle())) + { + disable(); + return; + } + } + } + + @EventHandler + public void handleClick(InventoryClickEvent event) + { + if (event.getClickedInventory() == null || !event.getClickedInventory().getTitle().equals(_inv.getTitle())) + { + return; + } + if (!_viewer.getName().equals(event.getWhoClicked().getName())) + { + return; + } + event.setCancelled(true); + Integer slot = event.getSlot(); + if (!_buttons.containsKey(slot)) + { + return; + } + _buttons.get(slot).handleClick(event.getClick()); + } +} \ No newline at end of file diff --git a/Plugins/Mineplex.Hub/src/mineplex/hub/modules/salesannouncements/SalesAnnouncementData.java b/Plugins/Mineplex.Hub/src/mineplex/hub/modules/salesannouncements/SalesAnnouncementData.java new file mode 100644 index 000000000..a7663e430 --- /dev/null +++ b/Plugins/Mineplex.Hub/src/mineplex/hub/modules/salesannouncements/SalesAnnouncementData.java @@ -0,0 +1,75 @@ +package mineplex.hub.modules.salesannouncements; + +import java.util.Arrays; + +import org.bukkit.ChatColor; +import org.bukkit.Material; +import org.bukkit.inventory.ItemStack; + +import mineplex.core.common.Rank; +import mineplex.core.common.util.C; +import mineplex.core.itemstack.ItemBuilder; + +public class SalesAnnouncementData +{ + private final int _id; + private final Rank[] _displayTo; + private final String _message; + private boolean _enabled; + + public SalesAnnouncementData(int id, Rank[] displayTo, String message, boolean enabled) + { + _id = id; + _displayTo = displayTo; + _message = message; + _enabled = enabled; + } + + public int getId() + { + return _id; + } + + public Rank[] getDisplayTo() + { + return _displayTo; + } + + public boolean shouldDisplayTo(Rank rank) + { + return Arrays.asList(_displayTo).contains(rank); + } + + public String getMessage(boolean raw) + { + return raw ? _message : ChatColor.translateAlternateColorCodes('&', _message); + } + + public ItemStack getButtonForm() + { + Material type = Material.REDSTONE_BLOCK; + String lore = C.cRed + "Click to Enable, Right-Click to Delete"; + String excerpt = getMessage(false); + if (excerpt.length() > 9) + { + excerpt = excerpt.substring(0, 9) + C.Reset + "..."; + } + if (_enabled) + { + type = Material.EMERALD_BLOCK; + lore = C.cGreen + "Click to Disable, Right-Click to Delete"; + } + + return new ItemBuilder(type).setTitle("ID: " + getId()).setLore(excerpt, C.cRed + " ", lore).build(); + } + + public boolean isEnabled() + { + return _enabled; + } + + public void setEnabled(boolean enabled) + { + _enabled = enabled; + } +} \ No newline at end of file diff --git a/Plugins/Mineplex.Hub/src/mineplex/hub/modules/salesannouncements/SalesAnnouncementDeleteCommand.java b/Plugins/Mineplex.Hub/src/mineplex/hub/modules/salesannouncements/SalesAnnouncementDeleteCommand.java new file mode 100644 index 000000000..f8244ec41 --- /dev/null +++ b/Plugins/Mineplex.Hub/src/mineplex/hub/modules/salesannouncements/SalesAnnouncementDeleteCommand.java @@ -0,0 +1,25 @@ +package mineplex.hub.modules.salesannouncements; + +import mineplex.serverdata.commands.ServerCommand; + +public class SalesAnnouncementDeleteCommand extends ServerCommand +{ + private String _id; + private String _from; + + public SalesAnnouncementDeleteCommand(String id, String from) + { + _id = id; + _from = from; + } + + public String getId() + { + return _id; + } + + public String getFrom() + { + return _from; + } +} \ No newline at end of file diff --git a/Plugins/Mineplex.Hub/src/mineplex/hub/modules/salesannouncements/SalesAnnouncementDeleteHandler.java b/Plugins/Mineplex.Hub/src/mineplex/hub/modules/salesannouncements/SalesAnnouncementDeleteHandler.java new file mode 100644 index 000000000..ec8a8934d --- /dev/null +++ b/Plugins/Mineplex.Hub/src/mineplex/hub/modules/salesannouncements/SalesAnnouncementDeleteHandler.java @@ -0,0 +1,28 @@ +package mineplex.hub.modules.salesannouncements; + +import mineplex.serverdata.commands.CommandCallback; +import mineplex.serverdata.commands.ServerCommand; + +public class SalesAnnouncementDeleteHandler implements CommandCallback +{ + private final SalesAnnouncementManager _manager; + + public SalesAnnouncementDeleteHandler(SalesAnnouncementManager manager) + { + _manager = manager; + } + + @Override + public void run(ServerCommand command) + { + if (!(command instanceof SalesAnnouncementDeleteCommand)) + { + return; + } + if (_manager.getServer().equalsIgnoreCase(((SalesAnnouncementDeleteCommand) command).getFrom())) + { + return; + } + _manager.handleRemoteDeletion(Integer.parseInt(((SalesAnnouncementDeleteCommand)command).getId())); + } +} \ No newline at end of file diff --git a/Plugins/Mineplex.Hub/src/mineplex/hub/modules/salesannouncements/SalesAnnouncementGUIButton.java b/Plugins/Mineplex.Hub/src/mineplex/hub/modules/salesannouncements/SalesAnnouncementGUIButton.java new file mode 100644 index 000000000..0a802b592 --- /dev/null +++ b/Plugins/Mineplex.Hub/src/mineplex/hub/modules/salesannouncements/SalesAnnouncementGUIButton.java @@ -0,0 +1,18 @@ +package mineplex.hub.modules.salesannouncements; + +import org.bukkit.event.inventory.ClickType; +import org.bukkit.inventory.ItemStack; + +public abstract class SalesAnnouncementGUIButton +{ + public ItemStack Button = null; + + public SalesAnnouncementGUIButton(ItemStack button) + { + Button = button; + } + + public abstract void update(); + + public abstract void handleClick(ClickType type); +} \ No newline at end of file diff --git a/Plugins/Mineplex.Hub/src/mineplex/hub/modules/salesannouncements/SalesAnnouncementManager.java b/Plugins/Mineplex.Hub/src/mineplex/hub/modules/salesannouncements/SalesAnnouncementManager.java new file mode 100644 index 000000000..f91f399f8 --- /dev/null +++ b/Plugins/Mineplex.Hub/src/mineplex/hub/modules/salesannouncements/SalesAnnouncementManager.java @@ -0,0 +1,142 @@ +package mineplex.hub.modules.salesannouncements; + +import java.util.List; + +import org.bukkit.entity.Player; +import org.bukkit.event.EventHandler; +import org.bukkit.event.player.PlayerJoinEvent; +import org.bukkit.plugin.java.JavaPlugin; + +import com.google.common.collect.Lists; + +import mineplex.core.Managers; +import mineplex.core.MiniPlugin; +import mineplex.core.account.CoreClientManager; +import mineplex.core.common.Rank; +import mineplex.core.common.util.C; +import mineplex.core.common.util.F; +import mineplex.core.common.util.UtilPlayer; +import mineplex.core.common.util.UtilServer; +import mineplex.serverdata.commands.ServerCommandManager; + +public class SalesAnnouncementManager extends MiniPlugin +{ + private static final String LINE = C.cDGreenB + C.Strike + "============================================="; + private final List _data = Lists.newArrayList(); + private final SalesAnnouncementRepository _repo; + + public SalesAnnouncementManager(JavaPlugin plugin) + { + super("Sales", plugin); + _repo = new SalesAnnouncementRepository(plugin); + _repo.loadAnnouncements(_data); + + addCommand(new SalesAnnouncementCommand(this)); + + ServerCommandManager.getInstance().registerCommandType("SalesAnnouncementUpdate", SalesAnnouncementUpdateCommand.class, new SalesAnnouncementUpdateHandler(this)); + ServerCommandManager.getInstance().registerCommandType("SalesAnnouncementDelete", SalesAnnouncementDeleteCommand.class, new SalesAnnouncementDeleteHandler(this)); + } + + public List getLoadedAnnouncements() + { + return _data; + } + + public String getServer() + { + return getPlugin().getConfig().getString("serverstatus.name"); + } + + public void createAnnouncement(Player creator, Rank[] displayTo, String message) + { + if (_data.size() >= 9 * 6) + { + UtilPlayer.message(creator, F.main(getName(), "There are too many existing Sales Announcements to create a new one! Try deleting some!")); + return; + } + _repo.createAnnouncement(displayTo, message, data -> + { + UtilPlayer.message(creator, F.main(getName(), "Announcement successfully created!")); + _data.add(data); + new SalesAnnouncementUpdateCommand(data.getId() + "", getServer()).publish(); + }); + } + + public void deleteAnnouncement(Player deletor, SalesAnnouncementData data, boolean forceRemoveFromList) + { + if (forceRemoveFromList) + { + _data.remove(data); + } + _repo.deleteAnnouncement(data, () -> + { + UtilPlayer.message(deletor, F.main(getName(), "Successfully deleted announcement!")); + if (!forceRemoveFromList) + { + _data.remove(data); + } + new SalesAnnouncementDeleteCommand(data.getId() + "", getServer()).publish(); + }); + } + + public void toggleAnnouncement(Player toggler, SalesAnnouncementData data) + { + data.setEnabled(!data.isEnabled()); + _repo.updateAnnouncementStatus(data, () -> + { + UtilPlayer.message(toggler, F.main(getName(), "Successfully toggled announcement!")); + new SalesAnnouncementUpdateCommand(data.getId() + "", getServer()).publish(); + }); + } + + public void handleRemoteDeletion(int id) + { + _data.removeIf(data -> data.getId() == id); + UtilServer.CallEvent(new SalesAnnouncementRemoteListUpdateEvent()); + } + + public void handleRemoteUpdate(int id) + { + if (_data.stream().filter(data -> data.getId() == id).toArray().length > 0) + { + _repo.loadAnnouncement(id, data -> + { + _data.stream().filter(existing -> existing.getId() == data.getId()).forEach(existing -> existing.setEnabled(data.isEnabled())); + UtilServer.CallEvent(new SalesAnnouncementRemoteListUpdateEvent()); + }); + } + else + { + _repo.loadAnnouncement(id, data -> + { + _data.add(data); + UtilServer.CallEvent(new SalesAnnouncementRemoteListUpdateEvent()); + }); + } + } + + @EventHandler + public void onJoin(PlayerJoinEvent event) + { + if (_data.isEmpty() || _data.stream().filter(data -> data.isEnabled()).toArray().length == 0) + { + return; + } + Player player = event.getPlayer(); + Rank rank = Managers.get(CoreClientManager.class).Get(player).GetRank(); + + runSyncLater(() -> + { + _data.stream().filter(data -> data.isEnabled() && data.shouldDisplayTo(rank)).forEach(data -> + { + player.sendMessage(" "); + player.sendMessage(LINE); + player.sendMessage(" "); + player.sendMessage(data.getMessage(false)); + player.sendMessage(" "); + player.sendMessage(LINE); + player.sendMessage(" "); + }); + }, 5L); + } +} \ No newline at end of file diff --git a/Plugins/Mineplex.Hub/src/mineplex/hub/modules/salesannouncements/SalesAnnouncementPage.java b/Plugins/Mineplex.Hub/src/mineplex/hub/modules/salesannouncements/SalesAnnouncementPage.java new file mode 100644 index 000000000..c2be6a7b8 --- /dev/null +++ b/Plugins/Mineplex.Hub/src/mineplex/hub/modules/salesannouncements/SalesAnnouncementPage.java @@ -0,0 +1,121 @@ +package mineplex.hub.modules.salesannouncements; + +import java.util.HashMap; +import java.util.Map; + +import org.bukkit.Bukkit; +import org.bukkit.entity.Player; +import org.bukkit.event.EventHandler; +import org.bukkit.event.HandlerList; +import org.bukkit.event.Listener; +import org.bukkit.event.inventory.InventoryClickEvent; +import org.bukkit.inventory.Inventory; + +import mineplex.core.common.util.C; +import mineplex.core.common.util.UtilServer; +import mineplex.core.updater.UpdateType; +import mineplex.core.updater.event.UpdateEvent; + +public class SalesAnnouncementPage implements Listener +{ + private Player _viewer; + private Inventory _inv; + private SalesAnnouncementManager _manager; + private Map _buttons = new HashMap<>(); + + public SalesAnnouncementPage(Player player, SalesAnnouncementManager manager) + { + _viewer = player; + _manager = manager; + _inv = Bukkit.createInventory(player, 9 * 6, C.cGreen + "All Sales Announcements"); + setup(); + _viewer.openInventory(_inv); + UtilServer.RegisterEvents(this); + } + + private void setup() + { + _buttons.clear(); + for (int i = 0; i < _manager.getLoadedAnnouncements().size(); i++) + { + SalesAnnouncementData data = _manager.getLoadedAnnouncements().get(i); + _buttons.put(i, new SalesAnnouncementButton(data, this)); + } + updateButtons(false); + } + + private void disable() + { + HandlerList.unregisterAll(this); + } + + public void deleteAnnouncement(SalesAnnouncementData data) + { + _manager.deleteAnnouncement(_viewer, data, true); + _manager.runSyncLater(() -> setup(), 2L); + } + + public void toggleAnnouncement(SalesAnnouncementData data) + { + _manager.toggleAnnouncement(_viewer, data); + updateButtons(true); + } + + public void updateButtons(boolean callUpdate) + { + _inv.clear(); + _buttons.entrySet().stream().forEach(entry -> + { + if (callUpdate) + { + entry.getValue().update(); + } + _inv.setItem(entry.getKey(), entry.getValue().Button); + }); + _viewer.updateInventory(); + } + + @EventHandler + public void onUpdate(UpdateEvent event) + { + if (event.getType() != UpdateType.TICK) + { + return; + } + + if (event.getType() == UpdateType.TICK) + { + if (_viewer.getOpenInventory() == null || _viewer.getOpenInventory().getTopInventory() == null || !_viewer.getOpenInventory().getTopInventory().getTitle().equals(_inv.getTitle())) + { + disable(); + return; + } + } + } + + @EventHandler + public void handleClick(InventoryClickEvent event) + { + if (event.getClickedInventory() == null || !event.getClickedInventory().getTitle().equals(_inv.getTitle())) + { + return; + } + if (!_viewer.getName().equals(event.getWhoClicked().getName())) + { + return; + } + event.setCancelled(true); + Integer slot = event.getSlot(); + if (!_buttons.containsKey(slot)) + { + return; + } + _buttons.get(slot).handleClick(event.getClick()); + } + + @EventHandler + public void onListChange(SalesAnnouncementRemoteListUpdateEvent event) + { + setup(); + } +} \ No newline at end of file diff --git a/Plugins/Mineplex.Hub/src/mineplex/hub/modules/salesannouncements/SalesAnnouncementRemoteListUpdateEvent.java b/Plugins/Mineplex.Hub/src/mineplex/hub/modules/salesannouncements/SalesAnnouncementRemoteListUpdateEvent.java new file mode 100644 index 000000000..8c47da415 --- /dev/null +++ b/Plugins/Mineplex.Hub/src/mineplex/hub/modules/salesannouncements/SalesAnnouncementRemoteListUpdateEvent.java @@ -0,0 +1,21 @@ +package mineplex.hub.modules.salesannouncements; + +import org.bukkit.event.Event; +import org.bukkit.event.HandlerList; + +public class SalesAnnouncementRemoteListUpdateEvent extends Event +{ + private static final HandlerList handlers = new HandlerList(); + + public SalesAnnouncementRemoteListUpdateEvent() {} + + public HandlerList getHandlers() + { + return handlers; + } + + public static HandlerList getHandlerList() + { + return handlers; + } +} \ No newline at end of file diff --git a/Plugins/Mineplex.Hub/src/mineplex/hub/modules/salesannouncements/SalesAnnouncementRepository.java b/Plugins/Mineplex.Hub/src/mineplex/hub/modules/salesannouncements/SalesAnnouncementRepository.java new file mode 100644 index 000000000..844a3b5ee --- /dev/null +++ b/Plugins/Mineplex.Hub/src/mineplex/hub/modules/salesannouncements/SalesAnnouncementRepository.java @@ -0,0 +1,175 @@ +package mineplex.hub.modules.salesannouncements; + +import java.util.List; + +import org.bukkit.Bukkit; +import org.bukkit.plugin.java.JavaPlugin; + +import com.google.common.collect.Lists; + +import mineplex.core.common.Rank; +import mineplex.core.common.util.Callback; +import mineplex.core.database.MinecraftRepository; +import mineplex.serverdata.database.DBPool; +import mineplex.serverdata.database.RepositoryBase; +import mineplex.serverdata.database.column.ColumnBoolean; +import mineplex.serverdata.database.column.ColumnInt; +import mineplex.serverdata.database.column.ColumnVarChar; + +public class SalesAnnouncementRepository extends RepositoryBase +{ + private static final String CREATE_TABLE = "CREATE TABLE IF NOT EXISTS salesAnnouncements (id INT NOT NULL AUTO_INCREMENT, ranks VARCHAR(250), message VARCHAR(256), enabled BOOL, PRIMARY KEY (id));"; + + private static final String GET_ANNOUNCEMENTS = "SELECT * FROM salesAnnouncements;"; + private static final String GET_ANNOUNCEMENT = "SELECT * FROM salesAnnouncements WHERE id=?;"; + private static final String UPDATE_ANNOUNCEMENT_STATUS = "UPDATE salesAnnouncements SET enabled=? WHERE id=?;"; + private static final String INSERT_ANNOUNCEMENT = "INSERT INTO salesAnnouncements (ranks, message, enabled) VALUES(?, ?, ?);"; + private static final String DELETE_ANNOUNCEMENT = "DELETE FROM salesAnnouncements WHERE id=?;"; + + private final JavaPlugin _plugin; + + public SalesAnnouncementRepository(JavaPlugin plugin) + { + super(DBPool.getAccount()); + _plugin = plugin; + } + + private void runAsync(Runnable runnable) + { + Bukkit.getScheduler().runTaskAsynchronously(_plugin, runnable); + } + + private void runSync(Runnable runnable) + { + Bukkit.getScheduler().runTask(_plugin, runnable); + } + + public void loadAnnouncements(final List announcementList) + { + runAsync(() -> + { + executeQuery(GET_ANNOUNCEMENTS, resultSet -> + { + final List data = Lists.newArrayList(); + while (resultSet.next()) + { + int id = resultSet.getInt("id"); + String rankString = resultSet.getString("ranks"); + List ranks = Lists.newArrayList(); + if (rankString.contains(",") && !rankString.startsWith(",") && !rankString.endsWith(",")) + { + for (String rankStr : rankString.split(",")) + { + ranks.add(Rank.valueOf(rankStr)); + } + } + else + { + ranks.add(Rank.valueOf(rankString)); + } + Rank[] displayTo = ranks.toArray(new Rank[ranks.size()]); + String message = resultSet.getString("message"); + boolean enabled = resultSet.getBoolean("enabled"); + + data.add(new SalesAnnouncementData(id, displayTo, message, enabled)); + } + + runSync(() -> + { + announcementList.clear(); + data.forEach(sData -> announcementList.add(sData)); + }); + }); + }); + } + + public void loadAnnouncement(final int id, final Callback callback) + { + runAsync(() -> + { + executeQuery(GET_ANNOUNCEMENT, resultSet -> + { + if (resultSet.next()) + { + int aId = resultSet.getInt("id"); + String rankString = resultSet.getString("ranks"); + List ranks = Lists.newArrayList(); + if (rankString.contains(",") && !rankString.startsWith(",") && !rankString.endsWith(",")) + { + for (String rankStr : rankString.split(",")) + { + ranks.add(Rank.valueOf(rankStr)); + } + } + else + { + ranks.add(Rank.valueOf(rankString)); + } + Rank[] displayTo = ranks.toArray(new Rank[ranks.size()]); + String message = resultSet.getString("message"); + boolean enabled = resultSet.getBoolean("enabled"); + + final SalesAnnouncementData data = new SalesAnnouncementData(aId, displayTo, message, enabled); + runSync(() -> + { + callback.run(data); + }); + } + }, new ColumnInt("id", id)); + }); + } + + public void createAnnouncement(final Rank[] displayTo, final String message, Callback callback) + { + runAsync(() -> + { + String rankStr = displayTo[0].toString(); + for (int i = 1; i < displayTo.length; i++) + { + rankStr += ("," + displayTo[i].toString()); + } + executeInsert(INSERT_ANNOUNCEMENT, resultSet -> + { + if (resultSet.next()) + { + int id = resultSet.getInt(1); + final SalesAnnouncementData data = new SalesAnnouncementData(id, displayTo, message, true); + if (callback != null) + { + runSync(() -> callback.run(data)); + } + } + }, new ColumnVarChar("ranks", 250, rankStr), new ColumnVarChar("message", 256, message), new ColumnBoolean("enabled", true)); + }); + } + + public void updateAnnouncementStatus(SalesAnnouncementData data, Runnable after) + { + runAsync(() -> + { + executeUpdate(UPDATE_ANNOUNCEMENT_STATUS, new ColumnBoolean("enabled", data.isEnabled()), new ColumnInt("id", data.getId())); + if (after != null) + { + runSync(after); + } + }); + } + + public void deleteAnnouncement(SalesAnnouncementData data, Runnable after) + { + runAsync(() -> + { + executeUpdate(DELETE_ANNOUNCEMENT, new ColumnInt("id", data.getId())); + if (after != null) + { + runSync(after); + } + }); + } + + @Override + protected void initialize() {} + + @Override + protected void update() {} +} \ No newline at end of file diff --git a/Plugins/Mineplex.Hub/src/mineplex/hub/modules/salesannouncements/SalesAnnouncementUpdateCommand.java b/Plugins/Mineplex.Hub/src/mineplex/hub/modules/salesannouncements/SalesAnnouncementUpdateCommand.java new file mode 100644 index 000000000..698154e7c --- /dev/null +++ b/Plugins/Mineplex.Hub/src/mineplex/hub/modules/salesannouncements/SalesAnnouncementUpdateCommand.java @@ -0,0 +1,25 @@ +package mineplex.hub.modules.salesannouncements; + +import mineplex.serverdata.commands.ServerCommand; + +public class SalesAnnouncementUpdateCommand extends ServerCommand +{ + private String _id; + private String _from; + + public SalesAnnouncementUpdateCommand(String id, String from) + { + _id = id; + _from = from; + } + + public String getId() + { + return _id; + } + + public String getFrom() + { + return _from; + } +} \ No newline at end of file diff --git a/Plugins/Mineplex.Hub/src/mineplex/hub/modules/salesannouncements/SalesAnnouncementUpdateHandler.java b/Plugins/Mineplex.Hub/src/mineplex/hub/modules/salesannouncements/SalesAnnouncementUpdateHandler.java new file mode 100644 index 000000000..a9143764f --- /dev/null +++ b/Plugins/Mineplex.Hub/src/mineplex/hub/modules/salesannouncements/SalesAnnouncementUpdateHandler.java @@ -0,0 +1,28 @@ +package mineplex.hub.modules.salesannouncements; + +import mineplex.serverdata.commands.CommandCallback; +import mineplex.serverdata.commands.ServerCommand; + +public class SalesAnnouncementUpdateHandler implements CommandCallback +{ + private final SalesAnnouncementManager _manager; + + public SalesAnnouncementUpdateHandler(SalesAnnouncementManager manager) + { + _manager = manager; + } + + @Override + public void run(ServerCommand command) + { + if (!(command instanceof SalesAnnouncementUpdateCommand)) + { + return; + } + if (_manager.getServer().equalsIgnoreCase(((SalesAnnouncementUpdateCommand) command).getFrom())) + { + return; + } + _manager.handleRemoteUpdate(Integer.parseInt(((SalesAnnouncementUpdateCommand)command).getId())); + } +} \ No newline at end of file diff --git a/Plugins/Mineplex.Hub/src/mineplex/hub/modules/trickortreat/TrickDialogue.java b/Plugins/Mineplex.Hub/src/mineplex/hub/modules/trickortreat/TrickDialogue.java index 3585b6579..6b21b9189 100644 --- a/Plugins/Mineplex.Hub/src/mineplex/hub/modules/trickortreat/TrickDialogue.java +++ b/Plugins/Mineplex.Hub/src/mineplex/hub/modules/trickortreat/TrickDialogue.java @@ -8,6 +8,7 @@ import org.bukkit.Sound; import org.bukkit.entity.Player; import org.bukkit.Note.Tone; +import mineplex.core.common.currency.GlobalCurrency; import mineplex.core.common.util.C; import mineplex.core.common.util.Callback; import mineplex.core.common.util.F; @@ -16,11 +17,11 @@ import mineplex.core.common.util.UtilPlayer; import mineplex.core.task.TaskManager; import mineplex.hub.modules.TrickOrTreatManager; -public class TrickDialogue +public class TrickDialogue { private TrickOrTreatManager _plugin; private TaskManager _taskManager; - + private String _task; private Player _player; private long _time; @@ -30,7 +31,7 @@ public class TrickDialogue private boolean _delayOne; private boolean _delayTwo; private boolean _delayThree; - + public TrickDialogue(TrickOrTreatManager plugin, String task, Player player, String villagerName, boolean trick) { _plugin = plugin; @@ -46,16 +47,16 @@ public class TrickDialogue { return _time; } - + public boolean originalUpdateDialogue() { if (!_player.isOnline()) return true; - + if (!_delayOne && System.currentTimeMillis() - _time > 250) { _delayOne = true; - + _player.playNote(_player.getLocation(), Instrument.PIANO, Note.natural(1, Tone.D)); _player.playNote(_player.getLocation(), Instrument.PIANO, Note.natural(1, Tone.A)); _time = System.currentTimeMillis(); @@ -63,18 +64,18 @@ public class TrickDialogue else if (_delayOne && !_delayTwo && System.currentTimeMillis() - _time > 1000) { _delayTwo = true; - + if (_trick) //Trick UtilPlayer.message(_player, C.cGoldB + _villagerName + ": " + C.cYellowB + "I choose... TRICK!"); else UtilPlayer.message(_player, C.cGoldB + _villagerName + ": " + C.cYellowB + "I choose... TREAT!"); - + _time = System.currentTimeMillis(); } else if (_delayTwo && !_delayThree && System.currentTimeMillis() - _time > 750) { _delayThree = true; - + if (_trick) { _plugin.runAsync(new Runnable() @@ -82,7 +83,7 @@ public class TrickDialogue public void run() { _taskManager.completedTask(null, _player, _task); - + _plugin.runSync(new Runnable() { @Override @@ -105,87 +106,73 @@ public class TrickDialogue _taskManager.completedTask(new Callback() { @Override - public void run(Boolean data) + public void run(Boolean data) { if (!data) return; - + if (UtilMath.r(10) > 5) //Coins { final int amount = Math.max(new Random().nextInt(100) + 100, (int) Math.floor(new Random().nextDouble() * 600)); - _plugin.getDonationManager().RewardCoins(new Callback() + _plugin.getDonationManager().rewardCurrency(GlobalCurrency.TREASURE_SHARD, _player, "Treat " + _villagerName, amount, completed -> { - public void run(final Boolean completed) + _plugin.runSync(() -> { - _plugin.runSync(new Runnable() + if (completed) { - @Override - public void run() - { - if (completed) - { - UtilPlayer.message(_player, F.main("Treat", "You received " + F.elem(C.cYellow + amount + " Coins") + " from " + F.name(_villagerName) + ".")); - - //Sound - _player.playSound(_player.getLocation(), Sound.LEVEL_UP, 2f, 1.5f); - } - else - { - UtilPlayer.message(_player, F.main("Treat", "There was an error giving " + F.elem(C.cYellow + amount + " Coins") + " to you. Please visit that villager again.") + "."); - } - } - }); - } - }, "Treat " + _villagerName, _player.getName(), _plugin.getClientManager().getAccountId(_player), amount); + UtilPlayer.message(_player, F.main("Treat", "You received " + F.elem(C.cYellow + amount + " Coins") + " from " + F.name(_villagerName) + ".")); + + //Sound + _player.playSound(_player.getLocation(), Sound.LEVEL_UP, 2f, 1.5f); + } + else + { + UtilPlayer.message(_player, F.main("Treat", "There was an error giving " + F.elem(C.cYellow + amount + " Coins") + " to you. Please visit that villager again.") + "."); + } + }); + }); } else //Gems { final int amount = Math.max(new Random().nextInt(100) + 100, (int) Math.floor(new Random().nextDouble() * 600)); - _plugin.getDonationManager().RewardGems(new Callback() + _plugin.getDonationManager().rewardCurrency(GlobalCurrency.GEM, _player, "Treat " + _villagerName, amount, success -> { - public void run(final Boolean completed) + _plugin.runSync(() -> { - _plugin.runSync(new Runnable() + if (success) { - @Override - public void run() - { - if (completed) - { - UtilPlayer.message(_player, F.main("Treat", "You received " + F.elem(C.cGreen + amount + " Gems") + " from " + F.name(_villagerName) + ".")); - - //Sound - _player.playSound(_player.getLocation(), Sound.LEVEL_UP, 2f, 1.5f); - } - else - { - UtilPlayer.message(_player, F.main("Treat", "There was an error giving " + F.elem(C.cGreen + amount + " Gems") + " to you. Please visit that villager again.") + "."); - } - } - }); - } - }, "Treat " + _villagerName, _player.getName(), _player.getUniqueId(), amount); + UtilPlayer.message(_player, F.main("Treat", "You received " + F.elem(C.cGreen + amount + " Gems") + " from " + F.name(_villagerName) + ".")); + + //Sound + _player.playSound(_player.getLocation(), Sound.LEVEL_UP, 2f, 1.5f); + } + else + { + UtilPlayer.message(_player, F.main("Treat", "There was an error giving " + F.elem(C.cGreen + amount + " Gems") + " to you. Please visit that villager again.") + "."); + } + }); + }); } } }, _player, _task); } }); } - + _time = System.currentTimeMillis(); } else if (_delayOne && _delayTwo && _delayThree) return true; - + return false; } - public Player getPlayer() + public Player getPlayer() { return _player; } - public void shutdown() + public void shutdown() { _plugin = null; _taskManager = null; diff --git a/Plugins/Mineplex.Hub/src/mineplex/hub/queue/ui/QueuePage.java b/Plugins/Mineplex.Hub/src/mineplex/hub/queue/ui/QueuePage.java index 48efd5a9d..52e3b0bdf 100644 --- a/Plugins/Mineplex.Hub/src/mineplex/hub/queue/ui/QueuePage.java +++ b/Plugins/Mineplex.Hub/src/mineplex/hub/queue/ui/QueuePage.java @@ -8,14 +8,13 @@ import mineplex.core.shop.item.ShopItem; import mineplex.core.shop.page.ShopPageBase; import mineplex.hub.queue.PlayerMatchStatus; import mineplex.hub.queue.QueueManager; -import org.bukkit.Bukkit; + import org.bukkit.ChatColor; import org.bukkit.Material; import org.bukkit.entity.Player; import org.bukkit.event.inventory.ClickType; import java.util.List; -import java.util.stream.Collectors; public class QueuePage extends ShopPageBase { @@ -130,15 +129,15 @@ public class QueuePage extends ShopPageBase private void queuePlayer(int gameType, Player player) { - Party party = getPlugin().getPartyManager().getParty(player); + Party party = getPlugin().getPartyManager().getPartyByPlayer(player); if(party == null) { getPlugin().queuePlayer(gameType, player); return; } - if(party.getOwner().equalsIgnoreCase(player.getName())) + if(party.getOwnerName().equalsIgnoreCase(player.getName())) { - List players = party.getMembers().stream().map(Bukkit::getPlayer).collect(Collectors.toList()); + List players = party.getMembers(); getPlugin().queuePlayer(gameType, players.toArray(new Player[players.size()])); } buildPage(); diff --git a/Plugins/Mineplex.Hub/src/mineplex/hub/queue/ui/QueueShop.java b/Plugins/Mineplex.Hub/src/mineplex/hub/queue/ui/QueueShop.java index 7f1b163fc..5d65e8c20 100644 --- a/Plugins/Mineplex.Hub/src/mineplex/hub/queue/ui/QueueShop.java +++ b/Plugins/Mineplex.Hub/src/mineplex/hub/queue/ui/QueueShop.java @@ -29,22 +29,6 @@ public class QueueShop extends ShopBase return new QueuePage(getPlugin(), this, getClientManager(), getDonationManager(), " " + ChatColor.UNDERLINE + "Queuer 9001", player); } - @Override - protected boolean canOpenShop(Player player) - { - Party party = getPlugin().getPartyManager().getParty(player); - - if (party != null && !player.getName().equalsIgnoreCase(party.getOwner())) - { - player.playSound(player.getLocation(), Sound.ITEM_BREAK, 1, .6f); - player.sendMessage(F.main("Party", "Only Party Leaders can join games.")); - player.sendMessage(F.main("Party", "Type " + C.cGreen + "/party leave" + C.cGray + " if you wish to leave your party.")); - return false; - } - - return true; - } - @EventHandler public void UpdatePages(UpdateEvent event) { diff --git a/Plugins/Mineplex.Hub/src/mineplex/hub/server/ServerInfo.java b/Plugins/Mineplex.Hub/src/mineplex/hub/server/ServerInfo.java index 8e562b866..7a2dae3c7 100644 --- a/Plugins/Mineplex.Hub/src/mineplex/hub/server/ServerInfo.java +++ b/Plugins/Mineplex.Hub/src/mineplex/hub/server/ServerInfo.java @@ -1,6 +1,7 @@ package mineplex.hub.server; import mineplex.core.common.Rank; +import mineplex.core.common.util.UtilServer; import mineplex.serverdata.data.MinecraftServer; public class ServerInfo @@ -22,19 +23,6 @@ public class ServerInfo public boolean isDevServer() { - try - { - int index = Name.lastIndexOf('-'); - if (index != -1) - { - int id = Integer.parseInt(Name.substring(index + 1)); - return id >= 777; - } - } - catch (NumberFormatException ex) - { - return false; - } - return false; + return UtilServer.isDevServer(Name); } } \ No newline at end of file diff --git a/Plugins/Mineplex.Hub/src/mineplex/hub/server/ServerManager.java b/Plugins/Mineplex.Hub/src/mineplex/hub/server/ServerManager.java index 62fcc457a..97e5c11a0 100644 --- a/Plugins/Mineplex.Hub/src/mineplex/hub/server/ServerManager.java +++ b/Plugins/Mineplex.Hub/src/mineplex/hub/server/ServerManager.java @@ -1,41 +1,14 @@ package mineplex.hub.server; -import mineplex.core.MiniPlugin; -import mineplex.core.account.CoreClientManager; -import mineplex.core.boosters.BoosterManager; -import mineplex.core.brawl.fountain.BrawlShopProvider; -import mineplex.core.common.Rank; -import mineplex.core.common.util.C; -import mineplex.core.common.util.Callback; -import mineplex.core.common.util.F; -import mineplex.core.common.util.NautHashMap; -import mineplex.core.common.util.UtilAction; -import mineplex.core.common.util.UtilAlg; -import mineplex.core.common.util.UtilPlayer; -import mineplex.core.common.util.UtilTime; -import mineplex.core.common.util.UtilTime.TimeUnit; -import mineplex.core.donation.DonationManager; -import mineplex.core.itemstack.ItemStackFactory; -import mineplex.core.party.Lang; -import mineplex.core.party.Party; -import mineplex.core.party.PartyManager; -import mineplex.core.party.event.PartySelectServerEvent; -import mineplex.core.portal.Portal; -import mineplex.core.shop.ShopBase; -import mineplex.core.status.ServerStatusManager; -import mineplex.core.updater.UpdateType; -import mineplex.core.updater.event.UpdateEvent; -import mineplex.hub.HubManager; -import mineplex.hub.modules.StackerManager; -import mineplex.hub.queue.QueueManager; -import mineplex.hub.server.ui.LobbyShop; -import mineplex.hub.server.ui.QuickShop; -import mineplex.hub.server.ui.ServerCountSorter; -import mineplex.hub.server.ui.ServerNpcShop; -import mineplex.hub.server.ui.clans.ClansServerShop; -import mineplex.serverdata.Region; -import mineplex.serverdata.data.MinecraftServer; -import mineplex.serverdata.data.ServerGroup; +import java.util.ArrayList; +import java.util.Collection; +import java.util.Collections; +import java.util.HashSet; +import java.util.Iterator; +import java.util.List; +import java.util.Random; +import java.util.Set; + import org.bukkit.Bukkit; import org.bukkit.ChatColor; import org.bukkit.Material; @@ -52,14 +25,42 @@ import org.bukkit.event.player.PlayerQuitEvent; import org.bukkit.plugin.java.JavaPlugin; import org.bukkit.util.Vector; -import java.util.ArrayList; -import java.util.Collection; -import java.util.Collections; -import java.util.HashSet; -import java.util.Iterator; -import java.util.List; -import java.util.Random; -import java.util.Set; +import mineplex.core.Managers; +import mineplex.core.MiniPlugin; +import mineplex.core.account.CoreClientManager; +import mineplex.core.boosters.BoosterManager; +import mineplex.core.brawl.fountain.BrawlShopProvider; +import mineplex.core.common.Rank; +import mineplex.core.common.util.C; +import mineplex.core.common.util.Callback; +import mineplex.core.common.util.F; +import mineplex.core.common.util.NautHashMap; +import mineplex.core.common.util.UtilAction; +import mineplex.core.common.util.UtilAlg; +import mineplex.core.common.util.UtilPlayer; +import mineplex.core.common.util.UtilTime; +import mineplex.core.common.util.UtilTime.TimeUnit; +import mineplex.core.donation.DonationManager; +import mineplex.core.itemstack.ItemStackFactory; +import mineplex.core.party.PartyManager; +import mineplex.core.party.event.PartySelectServerEvent; +import mineplex.core.portal.Intent; +import mineplex.core.portal.Portal; +import mineplex.core.shop.ShopBase; +import mineplex.core.status.ServerStatusManager; +import mineplex.core.twofactor.TwoFactorAuth; +import mineplex.core.updater.UpdateType; +import mineplex.core.updater.event.UpdateEvent; +import mineplex.hub.HubManager; +import mineplex.hub.queue.QueueManager; +import mineplex.hub.server.ui.LobbyShop; +import mineplex.hub.server.ui.QuickShop; +import mineplex.hub.server.ui.ServerCountSorter; +import mineplex.hub.server.ui.ServerNpcShop; +import mineplex.hub.server.ui.clans.ClansServerShop; +import mineplex.serverdata.Region; +import mineplex.serverdata.data.MinecraftServer; +import mineplex.serverdata.data.ServerGroup; public class ServerManager extends MiniPlugin implements BrawlShopProvider { @@ -78,6 +79,7 @@ public class ServerManager extends MiniPlugin implements BrawlShopProvider private ServerStatusManager _statusManager; private HubManager _hubManager; private BoosterManager _boosterManager; + private final TwoFactorAuth _twofactor = Managers.require(TwoFactorAuth.class); private NautHashMap _queueCooldowns = new NautHashMap(); private NautHashMap> _serverKeyInfoMap = new NautHashMap>(); @@ -99,7 +101,7 @@ public class ServerManager extends MiniPlugin implements BrawlShopProvider private boolean _retrieving = false; private long _lastRetrieve = 0; - public ServerManager(JavaPlugin plugin, CoreClientManager clientManager, DonationManager donationManager, Portal portal, PartyManager partyManager, ServerStatusManager statusManager, HubManager hubManager, StackerManager stackerManager, QueueManager queueManager, BoosterManager boosterManager) + public ServerManager(JavaPlugin plugin, CoreClientManager clientManager, DonationManager donationManager, Portal portal, PartyManager partyManager, ServerStatusManager statusManager, HubManager hubManager, QueueManager queueManager, BoosterManager boosterManager) { super("Server Manager", plugin); @@ -200,9 +202,14 @@ public class ServerManager extends MiniPlugin implements BrawlShopProvider _joinTime.remove(event.getPlayer().getName()); } - @EventHandler(priority = EventPriority.LOWEST) + @EventHandler public void playerInteract(PlayerInteractEvent event) { + if (_twofactor.isAuthenticating(event.getPlayer())) + { + return; + } + if (event.getItem() != null && event.getItem().getType() == Material.COMPASS) { _quickShop.attemptShopOpen(event.getPlayer()); @@ -454,21 +461,10 @@ public class ServerManager extends MiniPlugin implements BrawlShopProvider public void selectServer(Player player, ServerInfo serverInfo) { - Party party = _partyManager.getParty(player); - if(party != null) - { - if(!party.getOwner().equalsIgnoreCase(player.getName())) - { - Lang.NOT_OWNER_SERVER.send(player); - return; - } - _partyManager.getJoinManager().requestServerJoin(serverInfo.Name, party); - return; - } player.leaveVehicle(); player.eject(); - _portal.sendPlayerToServer(player, serverInfo.Name); + _portal.sendPlayerToServer(player, serverInfo.Name, Intent.PLAYER_REQUEST); } /** @@ -685,7 +681,7 @@ public class ServerManager extends MiniPlugin implements BrawlShopProvider { int slots = 0; - if (!_clientManager.Get(player).GetRank().has(Rank.ULTRA) && !_donationManager.Get(player).OwnsUnknownPackage(serverType + " ULTRA")) + if (!_clientManager.Get(player).GetRank().has(Rank.ULTRA) && !_donationManager.Get(player).ownsUnknownSalesPackage(serverType + " ULTRA")) slots++; return slots; diff --git a/Plugins/Mineplex.Hub/src/mineplex/hub/server/ui/LobbyShop.java b/Plugins/Mineplex.Hub/src/mineplex/hub/server/ui/LobbyShop.java index 0f72b00b7..636f236ef 100644 --- a/Plugins/Mineplex.Hub/src/mineplex/hub/server/ui/LobbyShop.java +++ b/Plugins/Mineplex.Hub/src/mineplex/hub/server/ui/LobbyShop.java @@ -28,7 +28,7 @@ public class LobbyShop extends ShopBase { for (ShopPageBase> page : getPlayerPageMap().values()) { - if (page instanceof LobbyMenu) + if (page instanceof LobbyMenu) { ((LobbyMenu)page).Update(); } diff --git a/Plugins/Mineplex.Hub/src/mineplex/hub/server/ui/MinestrikeServerTypePage.java b/Plugins/Mineplex.Hub/src/mineplex/hub/server/ui/MinestrikeServerTypePage.java new file mode 100644 index 000000000..ef8df629a --- /dev/null +++ b/Plugins/Mineplex.Hub/src/mineplex/hub/server/ui/MinestrikeServerTypePage.java @@ -0,0 +1,58 @@ + +package mineplex.hub.server.ui; + +import org.bukkit.Material; +import org.bukkit.entity.Player; + +import mineplex.core.account.CoreClientManager; +import mineplex.core.common.util.C; +import mineplex.core.donation.DonationManager; +import mineplex.core.itemstack.ItemBuilder; +import mineplex.core.shop.page.ShopPageBase; +import mineplex.hub.server.ServerManager; +import mineplex.serverdata.data.ServerGroup; + +public class MinestrikeServerTypePage extends ShopPageBase +{ + + private ServerGroup _serverGroup; + + public MinestrikeServerTypePage(ServerManager plugin, ServerNpcShop shop, CoreClientManager clientManager, + DonationManager donationManager, Player player, ServerGroup serverGroup) + { + super(plugin, shop, clientManager, donationManager, serverGroup.getServerNpcName(), player, 27); + + _serverGroup = serverGroup; + + buildPage(); + } + + @Override + protected void buildPage() + { + setItem(12, new ItemBuilder(Material.SKULL_ITEM, 1, (byte) 3).setTitle(C.Reset + C.cYellow + "MineStrike Classic") + .addLore(new String[] + { + C.Reset + "", + C.Reset + C.cGreen + "Click to Play", + }).build()); + + setItem(14, new ItemBuilder(Material.SKULL_ITEM, 2, (byte) 3).setTitle(C.Reset + C.cYellow + "StrikeGames") + .addLore(new String[] + { + C.Reset + "", + C.Reset + C.cGray + "Survival Games with MineStrike weapons", + C.Reset + "", + C.Reset + C.cGreen + "Click to Play" + }).build()); + + getButtonMap().put(12, (player, __) -> getShop().openPageForPlayer(player, new ServerNpcPage(getPlugin(), getShop(), getClientManager(), getDonationManager(), "MineStrike Classic", player, "MS"))); + getButtonMap().put(14, (player, __) -> getShop().openPageForPlayer(player, new ServerNpcPage(getPlugin(), getShop(), getClientManager(), getDonationManager(), "StrikeGames", player, "MS2"))); + } + + public void Update() + { + getButtonMap().clear(); + buildPage(); + } +} diff --git a/Plugins/Mineplex.Hub/src/mineplex/hub/server/ui/QuickShop.java b/Plugins/Mineplex.Hub/src/mineplex/hub/server/ui/QuickShop.java index 08c04b028..5a273d255 100644 --- a/Plugins/Mineplex.Hub/src/mineplex/hub/server/ui/QuickShop.java +++ b/Plugins/Mineplex.Hub/src/mineplex/hub/server/ui/QuickShop.java @@ -23,12 +23,9 @@ public class QuickShop extends ShopBase public void UpdatePages() { - for (ShopPageBase> page : getPlayerPageMap().values()) + getPlayerPageMap().values().stream().filter(page -> page instanceof ServerGameMenu).forEach(page -> { - if (page instanceof ServerGameMenu) - { - ((ServerGameMenu)page).Update(); - } - } + ((ServerGameMenu) page).Update(); + }); } } diff --git a/Plugins/Mineplex.Hub/src/mineplex/hub/server/ui/ServerGameMenu.java b/Plugins/Mineplex.Hub/src/mineplex/hub/server/ui/ServerGameMenu.java index 863ccbd64..f4ccf801a 100644 --- a/Plugins/Mineplex.Hub/src/mineplex/hub/server/ui/ServerGameMenu.java +++ b/Plugins/Mineplex.Hub/src/mineplex/hub/server/ui/ServerGameMenu.java @@ -50,7 +50,7 @@ public class ServerGameMenu extends ShopPageBase C.Reset + "If you lose, chickens will devour you!" }, "BBB", "Bawk_Bawk_Battles", new SelectBawkButton(this)); - add(3, Material.QUARTZ_BLOCK, C.cYellowB + "Speed Builders " + C.cGray + "Competitive Building", new String[] + add(4, Material.QUARTZ_BLOCK, C.cYellowB + "Speed Builders " + C.cGray + "Competitive Building", new String[] { C.Reset + "", C.Reset + "Memorize Gwen the Guardian's builds", @@ -58,15 +58,6 @@ public class ServerGameMenu extends ShopPageBase C.Reset + "The least correct builder is eliminated.", }, "SB", "Speed_Builders", new SelectSBButton(this)); - add(5, Material.BOW, C.cYellowB + "OITQ Payload " + C.cGray + "Fast Paced Tug of War", new String[] - { - (_extraValue ? C.cAquaB : C.cWhiteB) + "NEW GAME", - C.Reset + "", - C.Reset + "1.9 Team-Based Combat Game", - C.Reset + "Keep the Payload away from your base", - C.Reset + "or die trying!", - }, "OITQP", "OITQ_Payload", new SelectOITQPButton(this)); - add(7, Material.TNT, C.cYellowB + "Dragon Escape " + C.cGray + "Fast Paced Parkour", new String[] { (_extraValue ? C.cAquaB : C.cWhiteB) + "FEATURED ARCADE GAME", @@ -275,7 +266,9 @@ public class ServerGameMenu extends ShopPageBase C.Reset + "Death Tag", C.Reset + "Bacon Brawl", C.Reset + "Bawk Bawk Battles", - C.Reset + "Monster Maze").setHideInfo(true)); + C.Reset + "Monster Maze", + C.Reset + "Wither Assault", + C.Reset + "Evolution").setHideInfo(true)); _minigameCycle.add(new ItemBuilder(Material.GOLD_BOOTS) .setTitle(C.Reset + C.Bold + C.cYellow + "Arcade " + C.cGray + "Mixed Games").addLore(C.Reset + "", @@ -293,7 +286,9 @@ public class ServerGameMenu extends ShopPageBase C.Reset + "Death Tag", C.Reset + "Bacon Brawl", C.Reset + "Bawk Bawk Battles", - C.Reset + "Monster Maze").setHideInfo(true)); + C.Reset + "Monster Maze", + C.Reset + "Wither Assault", + C.Reset + "Evolution").setHideInfo(true)); _minigameCycle.add(new ItemBuilder(Material.DRAGON_EGG) .setTitle(C.Reset + C.Bold + C.cYellow + "Arcade " + C.cGray + "Mixed Games").addLore(C.Reset + "", @@ -311,7 +306,9 @@ public class ServerGameMenu extends ShopPageBase C.Reset + "Death Tag", C.Reset + "Bacon Brawl", C.Reset + "Bawk Bawk Battles", - C.Reset + "Monster Maze").setHideInfo(true)); + C.Reset + "Monster Maze", + C.Reset + "Wither Assault", + C.Reset + "Evolution").setHideInfo(true)); _minigameCycle.add(new ItemBuilder(Material.BOW) .setTitle(C.Reset + C.Bold + C.cYellow + "Arcade " + C.cGray + "Mixed Games").addLore(C.Reset + "", @@ -329,7 +326,9 @@ public class ServerGameMenu extends ShopPageBase C.Reset + "Death Tag", C.Reset + "Bacon Brawl", C.Reset + "Bawk Bawk Battles", - C.Reset + "Monster Maze").setHideInfo(true)); + C.Reset + "Monster Maze", + C.Reset + "Wither Assault", + C.Reset + "Evolution").setHideInfo(true)); _minigameCycle.add(new ItemBuilder(Material.LEATHER_BOOTS) .setTitle(C.Reset + C.Bold + C.cYellow + "Arcade " + C.cGray + "Mixed Games").addLore(C.Reset + "", @@ -347,7 +346,9 @@ public class ServerGameMenu extends ShopPageBase C.Reset + "Death Tag", C.Reset + "Bacon Brawl", C.Reset + "Bawk Bawk Battles", - C.Reset + "Monster Maze").setHideInfo(true)); + C.Reset + "Monster Maze", + C.Reset + "Wither Assault", + C.Reset + "Evolution").setHideInfo(true)); _minigameCycle.add(new ItemBuilder(Material.EMERALD) .setTitle(C.Reset + C.Bold + C.cYellow + "Arcade " + C.cGray + "Mixed Games").addLore(C.Reset + "", @@ -365,7 +366,9 @@ public class ServerGameMenu extends ShopPageBase C.Reset + "Death Tag", C.Reset + "Bacon Brawl", C.Reset + "Bawk Bawk Battles", - C.Reset + "Monster Maze").setHideInfo(true)); + C.Reset + "Monster Maze", + C.Reset + "Wither Assault", + C.Reset + "Evolution").setHideInfo(true)); _minigameCycle.add(new ItemBuilder(Material.LAVA_BUCKET) .setTitle(C.Reset + C.Bold + C.cYellow + "Arcade " + C.cGray + "Mixed Games").addLore(C.Reset + "", @@ -383,7 +386,9 @@ public class ServerGameMenu extends ShopPageBase C.Reset + "Death Tag", C.Reset + "Bacon Brawl", C.Reset + "Bawk Bawk Battles", - C.Reset + "Monster Maze").setHideInfo(true)); + C.Reset + "Monster Maze", + C.Reset + "Wither Assault", + C.Reset + "Evolution").setHideInfo(true)); _minigameCycle.add(new ItemBuilder(Material.DIAMOND_BARDING) .setTitle(C.Reset + C.Bold + C.cYellow + "Arcade " + C.cGray + "Mixed Games").addLore(C.Reset + "", @@ -401,7 +406,9 @@ public class ServerGameMenu extends ShopPageBase C.Reset + "Death Tag", C.Reset + "Bacon Brawl", C.Reset + "Bawk Bawk Battles", - C.Reset + "Monster Maze").setHideInfo(true)); + C.Reset + "Monster Maze", + C.Reset + "Wither Assault", + C.Reset + "Evolution").setHideInfo(true)); _minigameCycle.add(new ItemBuilder(Material.STAINED_CLAY, 1, (byte) 14) .setTitle(C.Reset + C.Bold + C.cYellow + "Arcade " + C.cGray + "Mixed Games").addLore(C.Reset + "", @@ -419,7 +426,9 @@ public class ServerGameMenu extends ShopPageBase C.Reset + "Death Tag", C.Reset + "Bacon Brawl", C.Reset + "Bawk Bawk Battles", - C.Reset + "Monster Maze").setHideInfo(true)); + C.Reset + "Monster Maze", + C.Reset + "Wither Assault", + C.Reset + "Evolution").setHideInfo(true)); _minigameCycle.add(new ItemBuilder(Material.IRON_BOOTS) .setTitle(C.Reset + C.Bold + C.cYellow + "Arcade " + C.cGray + "Mixed Games").addLore(C.Reset + "", @@ -437,7 +446,9 @@ public class ServerGameMenu extends ShopPageBase C.Reset + C.Bold + C.cGreen + "Death Tag", C.Reset + "Bacon Brawl", C.Reset + "Bawk Bawk Battles", - C.Reset + "Monster Maze").setHideInfo(true)); + C.Reset + "Monster Maze", + C.Reset + "Wither Assault", + C.Reset + "Evolution").setHideInfo(true)); _minigameCycle.add(new ItemBuilder(Material.PORK) .setTitle(C.Reset + C.Bold + C.cYellow + "Arcade " + C.cGray + "Mixed Games").addLore(C.Reset + "", @@ -455,7 +466,9 @@ public class ServerGameMenu extends ShopPageBase C.Reset + "Death Tag", C.Reset + C.Bold + C.cGreen + "Bacon Brawl", C.Reset + "Bawk Bawk Battles", - C.Reset + "Monster Maze").setHideInfo(true)); + C.Reset + "Monster Maze", + C.Reset + "Wither Assault", + C.Reset + "Evolution").setHideInfo(true)); _minigameCycle.add(new ItemBuilder(Material.EGG) .setTitle(C.Reset + C.Bold + C.cYellow + "Arcade " + C.cGray + "Mixed Games").addLore(C.Reset + "", @@ -473,7 +486,9 @@ public class ServerGameMenu extends ShopPageBase C.Reset + "Death Tag", C.Reset + "Bacon Brawl", C.Reset + C.Bold + C.cGreen + "Bawk Bawk Battles", - C.Reset + "Monster Maze").setHideInfo(true)); + C.Reset + "Monster Maze", + C.Reset + "Wither Assault", + C.Reset + "Evolution").setHideInfo(true)); _minigameCycle.add(new ItemBuilder(Material.EMPTY_MAP) .setTitle(C.Reset + C.Bold + C.cYellow + "Arcade " + C.cGray + "Mixed Games").addLore(C.Reset + "", @@ -491,7 +506,49 @@ public class ServerGameMenu extends ShopPageBase C.Reset + "Death Tag", C.Reset + "Bacon Brawl", C.Reset + "Bawk Bawk Battles", - C.Reset + C.Bold + C.cGreen + "Monster Maze").setHideInfo(true)); + C.Reset + C.Bold + C.cGreen + "Monster Maze", + C.Reset + "Wither Assault", + C.Reset + "Evolution").setHideInfo(true)); + + _minigameCycle.add(new ItemBuilder(Material.SKULL_ITEM).setData((short)1) + .setTitle(C.Reset + C.Bold + C.cYellow + "Arcade " + C.cGray + "Mixed Games").addLore(C.Reset + "", + C.Reset + "Play all of these fun minigames and more!", + C.Reset + "", + C.Reset + "Super Spleef", + C.Reset + "Runner", + C.Reset + "Dragons", + C.Reset + "One in the Quiver", + C.Reset + "Dragon Escape", + C.Reset + "Sneaky Assassins", + C.Reset + "Micro Battle", + C.Reset + "Super Paintball", + C.Reset + "Turf Wars", + C.Reset + "Death Tag", + C.Reset + "Bacon Brawl", + C.Reset + "Bawk Bawk Battles", + C.Reset + "Monster Maze", + C.Reset + C.Bold + C.cGreen + "Wither Assault", + C.Reset + "Evolution").setHideInfo(true)); + + _minigameCycle.add(new ItemBuilder(Material.IRON_INGOT) + .setTitle(C.Reset + C.Bold + C.cYellow + "Arcade " + C.cGray + "Mixed Games").addLore(C.Reset + "", + C.Reset + "Play all of these fun minigames and more!", + C.Reset + "", + C.Reset + "Super Spleef", + C.Reset + "Runner", + C.Reset + "Dragons", + C.Reset + "One in the Quiver", + C.Reset + "Dragon Escape", + C.Reset + "Sneaky Assassins", + C.Reset + "Micro Battle", + C.Reset + "Super Paintball", + C.Reset + "Turf Wars", + C.Reset + "Death Tag", + C.Reset + "Bacon Brawl", + C.Reset + "Bawk Bawk Battles", + C.Reset + "Monster Maze", + C.Reset + "Wither Assault", + C.Reset + C.Bold + C.cGreen + "Evolution").setHideInfo(true)); } private void createSuperSmashCycle() diff --git a/Plugins/Mineplex.Hub/src/mineplex/hub/server/ui/ServerNpcPage.java b/Plugins/Mineplex.Hub/src/mineplex/hub/server/ui/ServerNpcPage.java index 5a81eec49..08804cb72 100644 --- a/Plugins/Mineplex.Hub/src/mineplex/hub/server/ui/ServerNpcPage.java +++ b/Plugins/Mineplex.Hub/src/mineplex/hub/server/ui/ServerNpcPage.java @@ -92,7 +92,7 @@ public class ServerNpcPage extends ShopPageInventory lore = new ArrayList(); @@ -506,7 +506,7 @@ public class ServerNpcPage extends ShopPageInventory { @@ -26,31 +23,20 @@ public class ServerNpcShop extends ShopBase @Override protected ShopPageBase> buildPagesFor(Player player) { - if (_serverGroup.getPrefix().equalsIgnoreCase("SSM") || _serverGroup.getPrefix().equalsIgnoreCase("SKY") || _serverGroup.getPrefix().equalsIgnoreCase("HG")) + switch (_serverGroup.getPrefix().toUpperCase()) { - return new ServerTypePage(getPlugin(), this, getClientManager(), getDonationManager(), player, _serverGroup); - } - else - { - return new ServerNpcPage(getPlugin(), this, getClientManager(), getDonationManager(), _serverGroup.getServerNpcName(), player, _serverGroup.getPrefix()); - } - - } + case "SSM": + case "SKY": + case "HG": + return new ServerTypePage(getPlugin(), this, getClientManager(), getDonationManager(), player, _serverGroup); - @Override - protected boolean canOpenShop(Player player) - { - Party party = getPlugin().getPartyManager().getParty(player); + case "MS": + return new MinestrikeServerTypePage(getPlugin(), this, getClientManager(), getDonationManager(), player, _serverGroup); - if (party != null && !player.getName().equalsIgnoreCase(party.getOwner())) - { - player.playSound(player.getLocation(), Sound.ITEM_BREAK, 1, .6f); - player.sendMessage(F.main("Party", "Only Party Leaders can join games.")); - player.sendMessage(F.main("Party", "Type " + C.cGreen + "/party leave" + C.cGray + " if you wish to leave your party.")); - return false; + default: + return new ServerNpcPage(getPlugin(), this, getClientManager(), getDonationManager(), _serverGroup.getServerNpcName(), player, _serverGroup.getPrefix()); } - - return true; + } public void UpdatePages() diff --git a/Plugins/Mineplex.Hub/src/mineplex/hub/server/ui/button/JoinServerButton.java b/Plugins/Mineplex.Hub/src/mineplex/hub/server/ui/button/JoinServerButton.java index 6d1e17dca..10c2735de 100644 --- a/Plugins/Mineplex.Hub/src/mineplex/hub/server/ui/button/JoinServerButton.java +++ b/Plugins/Mineplex.Hub/src/mineplex/hub/server/ui/button/JoinServerButton.java @@ -8,7 +8,6 @@ import mineplex.core.shop.item.IButton; import mineplex.core.shop.page.ShopPageBase; import mineplex.hub.server.ServerInfo; import mineplex.hub.server.ServerManager; -import mineplex.hub.server.ui.IServerPage; public class JoinServerButton implements IButton { @@ -38,7 +37,7 @@ public class JoinServerButton implements IButton System.out.println("Selecting server :" + serverInfo.Name); int slots = _serverManager.getRequiredSlots(player, serverInfo.ServerType); - if (serverInfo.getAvailableSlots() < slots && !(_page.getDonationManager().Get(_player).OwnsUnknownPackage(serverInfo.ServerType + " ULTRA") || _page.getClient().GetRank().has(Rank.ULTRA))) + if (serverInfo.getAvailableSlots() < slots && !(_page.getDonationManager().Get(_player).ownsUnknownSalesPackage(serverInfo.ServerType + " ULTRA") || _page.getClient().GetRank().has(Rank.ULTRA))) { _page.playDenySound(player); diff --git a/Plugins/Mineplex.Hub/src/mineplex/hub/server/ui/clans/ClanMoveServerShop.java b/Plugins/Mineplex.Hub/src/mineplex/hub/server/ui/clans/ClanMoveServerShop.java index 84f99ce39..ad1cf8335 100644 --- a/Plugins/Mineplex.Hub/src/mineplex/hub/server/ui/clans/ClanMoveServerShop.java +++ b/Plugins/Mineplex.Hub/src/mineplex/hub/server/ui/clans/ClanMoveServerShop.java @@ -36,7 +36,7 @@ public class ClanMoveServerShop extends ShopBase @Override protected boolean canOpenShop(Player player) { - Party party = getPlugin().getPartyManager().getParty(player); + Party party = getPlugin().getPartyManager().getPartyByPlayer(player); if (party != null) { diff --git a/Plugins/Mineplex.Hub/src/mineplex/hub/server/ui/clans/ClansServerShop.java b/Plugins/Mineplex.Hub/src/mineplex/hub/server/ui/clans/ClansServerShop.java index 7ab0eb1b6..34238b6ba 100644 --- a/Plugins/Mineplex.Hub/src/mineplex/hub/server/ui/clans/ClansServerShop.java +++ b/Plugins/Mineplex.Hub/src/mineplex/hub/server/ui/clans/ClansServerShop.java @@ -27,7 +27,7 @@ public class ClansServerShop extends ShopBase @Override protected boolean canOpenShop(Player player) { - Party party = getPlugin().getPartyManager().getParty(player); + Party party = getPlugin().getPartyManager().getPartyByPlayer(player); if (party != null) { diff --git a/Plugins/Mineplex.Hub/src/mineplex/hub/tutorial/TutorialManager.java b/Plugins/Mineplex.Hub/src/mineplex/hub/tutorial/TutorialManager.java index 58332d12c..327705754 100644 --- a/Plugins/Mineplex.Hub/src/mineplex/hub/tutorial/TutorialManager.java +++ b/Plugins/Mineplex.Hub/src/mineplex/hub/tutorial/TutorialManager.java @@ -13,6 +13,7 @@ import org.bukkit.event.player.PlayerMoveEvent; import org.bukkit.event.player.PlayerQuitEvent; import mineplex.core.MiniPlugin; +import mineplex.core.common.currency.GlobalCurrency; import mineplex.core.common.util.C; import mineplex.core.common.util.Callback; import mineplex.core.common.util.F; @@ -30,39 +31,39 @@ public class TutorialManager extends MiniPlugin { //Tutorials private HashSet _tutorials; - + //Modules protected DonationManager _donationManager; protected TaskManager _taskManager; - - public TutorialManager(HubManager manager, DonationManager donation, TaskManager task, TextManager text) + + public TutorialManager(HubManager manager, DonationManager donation, TaskManager task, TextManager text) { super("Tutorial Manager", manager.getPlugin()); - + _taskManager = task; _donationManager = donation; - + _tutorials = new HashSet(); - + _tutorials.add(new WelcomeTutorial(manager, text)); _tutorials.add(new PartyTutorial(manager)); } - + @EventHandler public void EntityInteract(PlayerInteractEntityEvent event) { if (InTutorial(event.getPlayer())) return; - + if (!(event.getRightClicked() instanceof LivingEntity)) return; - - LivingEntity ent = (LivingEntity)event.getRightClicked(); - + + LivingEntity ent = (LivingEntity) event.getRightClicked(); + String name = ent.getCustomName(); if (name == null) return; - + for (Tutorial tut : _tutorials) { if (name.contains(tut.GetTutName())) @@ -100,7 +101,7 @@ public class TutorialManager extends MiniPlugin { if (event.getType() != UpdateType.TICK) return; - + for (final Tutorial tut : _tutorials) { Iterator tuteIterator = tut.GetTutorial().keySet().iterator(); @@ -122,30 +123,27 @@ public class TutorialManager extends MiniPlugin else { tuteIterator.remove(); - + //Inform UtilPlayer.message(player, F.main("Tutorial", "You completed " + F.elem(tut.GetTutName()) + ".")); - + //Gems - if (!_taskManager.hasCompletedTask(player, tut.GetTask())) + if (!_taskManager.hasCompletedTask(player, tut.GetTask())) { _taskManager.completedTask(new Callback() { public void run(Boolean completed) { - _donationManager.RewardGems(new Callback() + _donationManager.rewardCurrency(GlobalCurrency.GEM, player, "Tutorial " + tut.GetTutName(), tut.GetGems(), success -> { - public void run(Boolean completed) + if (success) { - if (completed) - { - UtilPlayer.message(player, F.main("Tutorial", "You received " + F.elem(C.cGreen + tut.GetGems() + " Gems") + ".")); - - //Sound - player.playSound(player.getLocation(), Sound.LEVEL_UP, 2f, 1.5f); - } + UtilPlayer.message(player, F.main("Tutorial", "You received " + F.elem(C.cGreen + tut.GetGems() + " Gems") + ".")); + + //Sound + player.playSound(player.getLocation(), Sound.LEVEL_UP, 2f, 1.5f); } - }, "Tutorial " + tut.GetTutName(), player.getName(), player.getUniqueId(), tut.GetGems()); + }); } }, player, tut.GetTask()); } @@ -154,13 +152,13 @@ public class TutorialManager extends MiniPlugin } } } - + public boolean InTutorial(Player player) { for (Tutorial tut : _tutorials) if (tut.InTutorial(player)) return true; - + return false; } } diff --git a/Plugins/Mineplex.MapParser/src/mineplex/mapparser/GameType.java b/Plugins/Mineplex.MapParser/src/mineplex/mapparser/GameType.java index 1f4262d28..5bc34de18 100644 --- a/Plugins/Mineplex.MapParser/src/mineplex/mapparser/GameType.java +++ b/Plugins/Mineplex.MapParser/src/mineplex/mapparser/GameType.java @@ -2,12 +2,14 @@ package mineplex.mapparser; public enum GameType { - //Mini + // Stand Alone Other("Other"), Unknown("Unknown"), Lobby("Lobby"), Event("Mineplex Event"), + GemHunters("Gem Hunters"), + // Games BaconBrawl("Bacon Brawl"), Barbarians("A Barbarians Life"), Bridge("The Bridges"), @@ -67,13 +69,13 @@ public enum GameType UHC("Ultra Hardcore"), WitherAssault("Wither Assault"), Wizards("Wizards"), - ZombieSurvival("Zombie Survival"), + ZombieSurvival("Zombie Survival"), + // Build States Upload("Upload"), Submissions("Submissions"), InProgress("In Progress"), - None("None"); String _name; diff --git a/Plugins/Mineplex.Minecraft.Game.ClassCombat/src/mineplex/minecraft/game/classcombat/Class/ClassManager.java b/Plugins/Mineplex.Minecraft.Game.ClassCombat/src/mineplex/minecraft/game/classcombat/Class/ClassManager.java index 4afa557f3..d54b4149b 100644 --- a/Plugins/Mineplex.Minecraft.Game.ClassCombat/src/mineplex/minecraft/game/classcombat/Class/ClassManager.java +++ b/Plugins/Mineplex.Minecraft.Game.ClassCombat/src/mineplex/minecraft/game/classcombat/Class/ClassManager.java @@ -49,7 +49,7 @@ public class ClassManager extends MiniClientPlugin implements IClas private ConcurrentHashMap> _messageSuppressed; public ClassManager(JavaPlugin plugin, CoreClientManager clientManager, DonationManager donationManager, - SkillFactory skillFactory, ItemFactory itemFactory, String webAddress) + SkillFactory skillFactory, ItemFactory itemFactory) { super("Class Manager", plugin); @@ -58,7 +58,7 @@ public class ClassManager extends MiniClientPlugin implements IClas _donationManager = donationManager; _skillFactory = skillFactory; _itemFactory = itemFactory; - _repository = new ClassRepository(webAddress); + _repository = new ClassRepository(); _classes = new HashMap(); _classSalesPackageIdMap = new HashMap(); _messageSuppressed = new ConcurrentHashMap>(); @@ -67,7 +67,7 @@ public class ClassManager extends MiniClientPlugin implements IClas } public ClassManager(JavaPlugin plugin, CoreClientManager clientManager, DonationManager donationManager, GadgetManager gadgetManager, - SkillFactory skillFactory, ItemFactory itemFactory, String webAddress) + SkillFactory skillFactory, ItemFactory itemFactory) { super("Class Manager", plugin); @@ -77,7 +77,7 @@ public class ClassManager extends MiniClientPlugin implements IClas _gadgetManager = gadgetManager; _skillFactory = skillFactory; _itemFactory = itemFactory; - _repository = new ClassRepository(webAddress); + _repository = new ClassRepository(); _classes = new HashMap(); _classSalesPackageIdMap = new HashMap(); _messageSuppressed = new ConcurrentHashMap>(); diff --git a/Plugins/Mineplex.Minecraft.Game.ClassCombat/src/mineplex/minecraft/game/classcombat/Class/ClientClass.java b/Plugins/Mineplex.Minecraft.Game.ClassCombat/src/mineplex/minecraft/game/classcombat/Class/ClientClass.java index 123874341..fe9fcdd82 100644 --- a/Plugins/Mineplex.Minecraft.Game.ClassCombat/src/mineplex/minecraft/game/classcombat/Class/ClientClass.java +++ b/Plugins/Mineplex.Minecraft.Game.ClassCombat/src/mineplex/minecraft/game/classcombat/Class/ClientClass.java @@ -575,7 +575,7 @@ public class ClientClass if (skillName == null || skill == null || expectedType == null) return false; - if (!skillName.isEmpty() && (skill == null || skill.GetSkillType() != expectedType || (!skill.IsFree() && !_donor.OwnsUnknownPackage("Champions " + skillName) && !_client.GetRank().has(Rank.ULTRA) && !_donor.OwnsUnknownPackage("Competitive ULTRA")))) + if (!skillName.isEmpty() && (skill == null || skill.GetSkillType() != expectedType || (!skill.IsFree() && !_donor.ownsUnknownSalesPackage("Champions " + skillName) && !_client.GetRank().has(Rank.ULTRA) && !_donor.ownsUnknownSalesPackage("Competitive ULTRA")))) return false; } catch (NullPointerException ex) diff --git a/Plugins/Mineplex.Minecraft.Game.ClassCombat/src/mineplex/minecraft/game/classcombat/Class/repository/ClassRepository.java b/Plugins/Mineplex.Minecraft.Game.ClassCombat/src/mineplex/minecraft/game/classcombat/Class/repository/ClassRepository.java index 829315b8a..5de148ac0 100644 --- a/Plugins/Mineplex.Minecraft.Game.ClassCombat/src/mineplex/minecraft/game/classcombat/Class/repository/ClassRepository.java +++ b/Plugins/Mineplex.Minecraft.Game.ClassCombat/src/mineplex/minecraft/game/classcombat/Class/repository/ClassRepository.java @@ -1,32 +1,18 @@ package mineplex.minecraft.game.classcombat.Class.repository; -import java.util.List; - -import com.google.gson.reflect.TypeToken; - -import mineplex.core.server.remotecall.AsyncJsonWebCall; -import mineplex.core.server.remotecall.JsonWebCall; -import mineplex.minecraft.game.classcombat.Class.repository.token.ClassToken; +import mineplex.core.database.MinecraftRepository; import mineplex.minecraft.game.classcombat.Class.repository.token.CustomBuildToken; +import mineplex.serverdata.database.DBPool; -public class ClassRepository +public class ClassRepository extends MinecraftRepository { - private String _webAddress; - - public ClassRepository(String webAddress) + public ClassRepository() { - _webAddress = webAddress; - } - - public List GetClasses(List pvpClasses) - { - return new JsonWebCall(_webAddress + "Dominate/GetClasses").Execute(new TypeToken>() - { - }.getType(), pvpClasses); + super(DBPool.getAccount()); } public void SaveCustomBuild(CustomBuildToken token) { - new AsyncJsonWebCall(_webAddress + "PlayerAccount/SaveCustomBuild").Execute(token); + handleAsyncMSSQLCall("PlayerAccount/SaveCustomBuild", token); } } diff --git a/Plugins/Mineplex.Minecraft.Game.ClassCombat/src/mineplex/minecraft/game/classcombat/Skill/Assassin/Blink.java b/Plugins/Mineplex.Minecraft.Game.ClassCombat/src/mineplex/minecraft/game/classcombat/Skill/Assassin/Blink.java index 2da9df000..bd50cddd3 100644 --- a/Plugins/Mineplex.Minecraft.Game.ClassCombat/src/mineplex/minecraft/game/classcombat/Skill/Assassin/Blink.java +++ b/Plugins/Mineplex.Minecraft.Game.ClassCombat/src/mineplex/minecraft/game/classcombat/Skill/Assassin/Blink.java @@ -4,6 +4,7 @@ import java.util.HashMap; import org.bukkit.Bukkit; import org.bukkit.Effect; +import org.bukkit.GameMode; import org.bukkit.Location; import org.bukkit.Material; import org.bukkit.block.Block; @@ -112,7 +113,7 @@ public class Blink extends SkillActive //Lock Players for (Player cur : player.getWorld().getPlayers()) { - if (cur.equals(player)) + if (cur.equals(player) || cur.getGameMode() == GameMode.SPECTATOR) continue; if (UtilMath.offset(newTarget, cur.getLocation()) > 1) diff --git a/Plugins/Mineplex.Minecraft.Game.ClassCombat/src/mineplex/minecraft/game/classcombat/Skill/Assassin/Illusion.java b/Plugins/Mineplex.Minecraft.Game.ClassCombat/src/mineplex/minecraft/game/classcombat/Skill/Assassin/Illusion.java index 43b9624ec..8c6261db8 100644 --- a/Plugins/Mineplex.Minecraft.Game.ClassCombat/src/mineplex/minecraft/game/classcombat/Skill/Assassin/Illusion.java +++ b/Plugins/Mineplex.Minecraft.Game.ClassCombat/src/mineplex/minecraft/game/classcombat/Skill/Assassin/Illusion.java @@ -3,7 +3,6 @@ package mineplex.minecraft.game.classcombat.Skill.Assassin; import java.util.ArrayList; import java.util.HashMap; import java.util.HashSet; -import java.util.Set; import java.util.UUID; import org.bukkit.Material; @@ -17,7 +16,6 @@ import org.bukkit.event.EventPriority; import org.bukkit.event.block.Action; import org.bukkit.event.entity.EntityDeathEvent; import org.bukkit.inventory.ItemStack; -import org.bukkit.metadata.FixedMetadataValue; import mineplex.minecraft.game.classcombat.Class.IPvpClass.ClassType; import mineplex.core.updater.event.UpdateEvent; @@ -95,7 +93,7 @@ public class Illusion extends SkillActive Skeleton skel = player.getWorld().spawn(player.getLocation(), Skeleton.class); skel.teleport(player.getLocation()); - UtilEnt.Vegetate(skel); + UtilEnt.vegetate(skel); UtilEnt.silence(skel, true); skel.setMaxHealth(14); diff --git a/Plugins/Mineplex.Minecraft.Game.ClassCombat/src/mineplex/minecraft/game/classcombat/Skill/Ranger/RopedArrow.java b/Plugins/Mineplex.Minecraft.Game.ClassCombat/src/mineplex/minecraft/game/classcombat/Skill/Ranger/RopedArrow.java index 524aca959..8b6f4e2bc 100644 --- a/Plugins/Mineplex.Minecraft.Game.ClassCombat/src/mineplex/minecraft/game/classcombat/Skill/Ranger/RopedArrow.java +++ b/Plugins/Mineplex.Minecraft.Game.ClassCombat/src/mineplex/minecraft/game/classcombat/Skill/Ranger/RopedArrow.java @@ -91,7 +91,7 @@ public class RopedArrow extends SkillActive _arrows.add(event.getProjectile()); - UtilEnt.Leash(player, event.getProjectile(), false, false); + UtilEnt.leash(player, event.getProjectile(), false, false); } @EventHandler diff --git a/Plugins/Mineplex.Minecraft.Game.ClassCombat/src/mineplex/minecraft/game/classcombat/Skill/SkillFactory.java b/Plugins/Mineplex.Minecraft.Game.ClassCombat/src/mineplex/minecraft/game/classcombat/Skill/SkillFactory.java index 8bc9f565b..ffc77893f 100644 --- a/Plugins/Mineplex.Minecraft.Game.ClassCombat/src/mineplex/minecraft/game/classcombat/Skill/SkillFactory.java +++ b/Plugins/Mineplex.Minecraft.Game.ClassCombat/src/mineplex/minecraft/game/classcombat/Skill/SkillFactory.java @@ -98,7 +98,6 @@ import mineplex.minecraft.game.classcombat.Skill.Ranger.WolfsFury; import mineplex.minecraft.game.classcombat.Skill.Ranger.WolfsPounce; import mineplex.minecraft.game.classcombat.Skill.repository.SkillRepository; import mineplex.minecraft.game.classcombat.Skill.repository.token.SkillToken; -import mineplex.minecraft.game.classcombat.item.Throwable.ProximityManager; import mineplex.minecraft.game.core.IRelation; import mineplex.minecraft.game.core.combat.CombatManager; import mineplex.minecraft.game.core.condition.ConditionManager; @@ -128,13 +127,13 @@ public class SkillFactory extends MiniPlugin implements ISkillFactory private HashMap _skillMap; private HashMap _skillSalesPackageMap; - public SkillFactory(JavaPlugin plugin, DamageManager damageManager, IRelation relation, - CombatManager combatManager, ConditionManager conditionManager, ProjectileManager projectileManager, DisguiseManager disguiseManager, - BlockRestore blockRestore, Fire fire, Movement movement, Teleport teleport, Energy energy, String webAddress) + public SkillFactory(JavaPlugin plugin, DamageManager damageManager, IRelation relation, + CombatManager combatManager, ConditionManager conditionManager, ProjectileManager projectileManager, DisguiseManager disguiseManager, + BlockRestore blockRestore, Fire fire, Movement movement, Teleport teleport, Energy energy) { super("Skill Factory", plugin); - _repository = new SkillRepository(webAddress); + _repository = new SkillRepository(); _damageManager = damageManager; _relation = relation; _combatManager = combatManager; diff --git a/Plugins/Mineplex.Minecraft.Game.ClassCombat/src/mineplex/minecraft/game/classcombat/Skill/repository/SkillRepository.java b/Plugins/Mineplex.Minecraft.Game.ClassCombat/src/mineplex/minecraft/game/classcombat/Skill/repository/SkillRepository.java index 1d923bfe9..b9f244dc8 100644 --- a/Plugins/Mineplex.Minecraft.Game.ClassCombat/src/mineplex/minecraft/game/classcombat/Skill/repository/SkillRepository.java +++ b/Plugins/Mineplex.Minecraft.Game.ClassCombat/src/mineplex/minecraft/game/classcombat/Skill/repository/SkillRepository.java @@ -4,20 +4,19 @@ import java.util.List; import com.google.gson.reflect.TypeToken; -import mineplex.core.server.remotecall.JsonWebCall; import mineplex.minecraft.game.classcombat.Skill.repository.token.SkillToken; +import mineplex.core.database.MinecraftRepository; +import mineplex.serverdata.database.DBPool; -public class SkillRepository +public class SkillRepository extends MinecraftRepository { - private String _webAddress; - - public SkillRepository(String webAddress) + public SkillRepository() { - _webAddress = webAddress; + super(DBPool.getAccount()); } - - public List GetSkills(List skills) + + public List GetSkills(List skills) { - return new JsonWebCall(_webAddress + "Dominate/GetSkills").Execute(new TypeToken>(){}.getType(), skills); + return handleSyncMSSQLCall("Dominate/GetSkills", skills, new TypeToken>(){}.getType()); } } diff --git a/Plugins/Mineplex.Minecraft.Game.ClassCombat/src/mineplex/minecraft/game/classcombat/item/ItemFactory.java b/Plugins/Mineplex.Minecraft.Game.ClassCombat/src/mineplex/minecraft/game/classcombat/item/ItemFactory.java index d6c49bf34..4351a0801 100644 --- a/Plugins/Mineplex.Minecraft.Game.ClassCombat/src/mineplex/minecraft/game/classcombat/item/ItemFactory.java +++ b/Plugins/Mineplex.Minecraft.Game.ClassCombat/src/mineplex/minecraft/game/classcombat/item/ItemFactory.java @@ -33,12 +33,12 @@ public class ItemFactory extends MiniPlugin implements IItemFactory private HashMap _items; private HashSet _ignore; - public ItemFactory(JavaPlugin plugin, BlockRestore blockRestore, ConditionManager condition, DamageManager damage, Energy energy, Fire fire, ProjectileManager projectileManager, String webAddress) + public ItemFactory(JavaPlugin plugin, BlockRestore blockRestore, ConditionManager condition, DamageManager damage, Energy energy, Fire fire, ProjectileManager projectileManager) { - this(plugin, blockRestore, condition, damage, energy, fire, projectileManager, webAddress, new HashSet()); + this(plugin, blockRestore, condition, damage, energy, fire, projectileManager, new HashSet()); } - public ItemFactory(JavaPlugin plugin, BlockRestore blockRestore, ConditionManager condition, DamageManager damage, Energy energy, Fire fire, ProjectileManager projectileManager, String webAddress, HashSet ignore) + public ItemFactory(JavaPlugin plugin, BlockRestore blockRestore, ConditionManager condition, DamageManager damage, Energy energy, Fire fire, ProjectileManager projectileManager, HashSet ignore) { super("Item Factory", plugin); @@ -67,10 +67,10 @@ public class ItemFactory extends MiniPlugin implements IItemFactory e.printStackTrace(); } - PopulateFactory(webAddress); + PopulateFactory(); } - private void PopulateFactory(String webAddress) + private void PopulateFactory() { _items.clear(); diff --git a/Plugins/Mineplex.Minecraft.Game.ClassCombat/src/mineplex/minecraft/game/classcombat/item/repository/ItemRepository.java b/Plugins/Mineplex.Minecraft.Game.ClassCombat/src/mineplex/minecraft/game/classcombat/item/repository/ItemRepository.java deleted file mode 100644 index 16ff6926d..000000000 --- a/Plugins/Mineplex.Minecraft.Game.ClassCombat/src/mineplex/minecraft/game/classcombat/item/repository/ItemRepository.java +++ /dev/null @@ -1,22 +0,0 @@ -package mineplex.minecraft.game.classcombat.item.repository; - -import java.util.List; - -import com.google.gson.reflect.TypeToken; - -import mineplex.core.server.remotecall.JsonWebCall; - -public class ItemRepository -{ - private String _webAddress; - - public ItemRepository(String webAddress) - { - _webAddress = webAddress; - } - - public List GetItems(List items) - { - return new JsonWebCall(_webAddress + "Dominate/GetItems").Execute(new TypeToken>(){}.getType(), items); - } -} diff --git a/Plugins/Mineplex.Minecraft.Game.ClassCombat/src/mineplex/minecraft/game/classcombat/item/repository/ItemToken.java b/Plugins/Mineplex.Minecraft.Game.ClassCombat/src/mineplex/minecraft/game/classcombat/item/repository/ItemToken.java deleted file mode 100644 index 9a819d4b0..000000000 --- a/Plugins/Mineplex.Minecraft.Game.ClassCombat/src/mineplex/minecraft/game/classcombat/item/repository/ItemToken.java +++ /dev/null @@ -1,11 +0,0 @@ -package mineplex.minecraft.game.classcombat.item.repository; - -import mineplex.core.donation.repository.GameSalesPackageToken; - -public class ItemToken -{ - public String Name; - public String Material; - - public GameSalesPackageToken SalesPackage; -} diff --git a/Plugins/Mineplex.Minecraft.Game.ClassCombat/src/mineplex/minecraft/game/classcombat/shop/ClassCombatShop.java b/Plugins/Mineplex.Minecraft.Game.ClassCombat/src/mineplex/minecraft/game/classcombat/shop/ClassCombatShop.java index d29892b44..9026c4576 100644 --- a/Plugins/Mineplex.Minecraft.Game.ClassCombat/src/mineplex/minecraft/game/classcombat/shop/ClassCombatShop.java +++ b/Plugins/Mineplex.Minecraft.Game.ClassCombat/src/mineplex/minecraft/game/classcombat/shop/ClassCombatShop.java @@ -63,7 +63,7 @@ public class ClassCombatShop extends ShopBase public boolean attemptShopOpen(Player player) { - if (!getOpenedShop().contains(player.getName())) + if (!getOpenedShop().contains(player.getUniqueId())) { if (!canOpenShop(player)) return false; @@ -87,12 +87,12 @@ public class ClassCombatShop extends ShopBase page = new CustomBuildPage(getPlugin(), this, getClientManager(), getDonationManager(), player, _gameClass); } - getOpenedShop().add(player.getName()); + getOpenedShop().add(player.getUniqueId()); openShopForPlayer(player); - if (!getPlayerPageMap().containsKey(player.getName())) + if (!getPlayerPageMap().containsKey(player.getUniqueId())) { - getPlayerPageMap().put(player.getName(), page); + getPlayerPageMap().put(player.getUniqueId(), page); } openPageForPlayer(player, page); diff --git a/Plugins/Mineplex.Minecraft.Game.ClassCombat/src/mineplex/minecraft/game/classcombat/shop/page/SkillPage.java b/Plugins/Mineplex.Minecraft.Game.ClassCombat/src/mineplex/minecraft/game/classcombat/shop/page/SkillPage.java index bfa289da2..f6d0b809c 100644 --- a/Plugins/Mineplex.Minecraft.Game.ClassCombat/src/mineplex/minecraft/game/classcombat/shop/page/SkillPage.java +++ b/Plugins/Mineplex.Minecraft.Game.ClassCombat/src/mineplex/minecraft/game/classcombat/shop/page/SkillPage.java @@ -394,7 +394,7 @@ public class SkillPage extends ShopPageBase private boolean isSkillLocked(ISkill skill) { - if (skill.IsFree() || getClientManager().Get(getPlayer()).GetRank().has(Rank.HELPER) || getDonationManager().Get(getPlayer()).OwnsUnknownPackage("Champions ULTRA") || getDonationManager().Get(getPlayer()).OwnsUnknownPackage("Champions " + skill.GetName())) + if (skill.IsFree() || getClientManager().Get(getPlayer()).GetRank().has(Rank.HELPER) || getDonationManager().Get(getPlayer()).ownsUnknownSalesPackage("Champions ULTRA") || getDonationManager().Get(getPlayer()).ownsUnknownSalesPackage("Champions " + skill.GetName())) return false; return true; @@ -402,7 +402,7 @@ public class SkillPage extends ShopPageBase private boolean isItemLocked(Item item) { - if (item.isFree() || getClientManager().Get(getPlayer()).GetRank().has(Rank.HELPER) || getDonationManager().Get(getPlayer()).OwnsUnknownPackage("Champions ULTRA") || getDonationManager().Get(getPlayer()).OwnsUnknownPackage("Champions " + item.GetName())) + if (item.isFree() || getClientManager().Get(getPlayer()).GetRank().has(Rank.HELPER) || getDonationManager().Get(getPlayer()).ownsUnknownSalesPackage("Champions ULTRA") || getDonationManager().Get(getPlayer()).ownsUnknownSalesPackage("Champions " + item.GetName())) return false; return true; diff --git a/Plugins/Mineplex.Minecraft.Game.Core/src/mineplex/minecraft/game/core/boss/broodmother/SpiderCreature.java b/Plugins/Mineplex.Minecraft.Game.Core/src/mineplex/minecraft/game/core/boss/broodmother/SpiderCreature.java index a4b657260..c438f7351 100644 --- a/Plugins/Mineplex.Minecraft.Game.Core/src/mineplex/minecraft/game/core/boss/broodmother/SpiderCreature.java +++ b/Plugins/Mineplex.Minecraft.Game.Core/src/mineplex/minecraft/game/core/boss/broodmother/SpiderCreature.java @@ -5,7 +5,6 @@ import java.util.Collections; import java.util.Comparator; import java.util.HashMap; import java.util.Iterator; -import java.util.List; import java.util.Map.Entry; import org.bukkit.Bukkit; @@ -20,8 +19,6 @@ import org.bukkit.event.HandlerList; import org.bukkit.event.entity.EntityDamageEvent.DamageCause; import org.bukkit.util.Vector; -import com.google.common.collect.Lists; - import mineplex.core.common.util.UtilAlg; import mineplex.core.common.util.UtilBlock; import mineplex.core.common.util.UtilEnt; @@ -61,7 +58,7 @@ public class SpiderCreature extends EventCreature @Override protected void spawnCustom() { - UtilEnt.Vegetate(getEntity()); + UtilEnt.vegetate(getEntity()); } @Override diff --git a/Plugins/Mineplex.Minecraft.Game.Core/src/mineplex/minecraft/game/core/boss/broodmother/SpiderMinionCreature.java b/Plugins/Mineplex.Minecraft.Game.Core/src/mineplex/minecraft/game/core/boss/broodmother/SpiderMinionCreature.java index 15eb9a843..1fb301cd2 100644 --- a/Plugins/Mineplex.Minecraft.Game.Core/src/mineplex/minecraft/game/core/boss/broodmother/SpiderMinionCreature.java +++ b/Plugins/Mineplex.Minecraft.Game.Core/src/mineplex/minecraft/game/core/boss/broodmother/SpiderMinionCreature.java @@ -49,7 +49,7 @@ public class SpiderMinionCreature extends EventCreature @Override protected void spawnCustom() { - UtilEnt.Vegetate(getEntity(), true); + UtilEnt.vegetate(getEntity(), true); getEntity().setVelocity(new Vector(UtilMath.rr(0.5, true), 0.4, UtilMath.rr(0.4, true))); } diff --git a/Plugins/Mineplex.Minecraft.Game.Core/src/mineplex/minecraft/game/core/boss/ironwizard/GolemCreature.java b/Plugins/Mineplex.Minecraft.Game.Core/src/mineplex/minecraft/game/core/boss/ironwizard/GolemCreature.java index be4e87f8c..b2fefc3ba 100644 --- a/Plugins/Mineplex.Minecraft.Game.Core/src/mineplex/minecraft/game/core/boss/ironwizard/GolemCreature.java +++ b/Plugins/Mineplex.Minecraft.Game.Core/src/mineplex/minecraft/game/core/boss/ironwizard/GolemCreature.java @@ -40,7 +40,6 @@ import org.bukkit.entity.IronGolem; import org.bukkit.entity.Player; import org.bukkit.event.EventHandler; import org.bukkit.event.HandlerList; -import org.bukkit.event.entity.EntityDamageEvent.DamageCause; import org.bukkit.util.Vector; public class GolemCreature extends EventCreature @@ -124,7 +123,7 @@ public class GolemCreature extends EventCreature @Override protected void spawnCustom() { - UtilEnt.Vegetate(getEntity()); + UtilEnt.vegetate(getEntity()); // EntityInsentient creature = (EntityInsentient) ((CraftEntity) getEntity()).getHandle(); // creature.Vegetated = false; diff --git a/Plugins/Mineplex.Minecraft.Game.Core/src/mineplex/minecraft/game/core/boss/skeletonking/SkeletonCreature.java b/Plugins/Mineplex.Minecraft.Game.Core/src/mineplex/minecraft/game/core/boss/skeletonking/SkeletonCreature.java index 45cae347e..36e892a07 100644 --- a/Plugins/Mineplex.Minecraft.Game.Core/src/mineplex/minecraft/game/core/boss/skeletonking/SkeletonCreature.java +++ b/Plugins/Mineplex.Minecraft.Game.Core/src/mineplex/minecraft/game/core/boss/skeletonking/SkeletonCreature.java @@ -79,7 +79,7 @@ public class SkeletonCreature extends EventCreature @Override protected void spawnCustom() { - UtilEnt.Vegetate(getEntity()); + UtilEnt.vegetate(getEntity()); getEntity().setSkeletonType(SkeletonType.WITHER); getEntity().getEquipment().setItemInHand(new ItemStack(Material.RECORD_6)); //Meridian Scepter getEntity().getEquipment().setItemInHandDropChance(0.f); diff --git a/Plugins/Mineplex.Minecraft.Game.Core/src/mineplex/minecraft/game/core/boss/skeletonking/abilities/SkeletonArcherShield.java b/Plugins/Mineplex.Minecraft.Game.Core/src/mineplex/minecraft/game/core/boss/skeletonking/abilities/SkeletonArcherShield.java index c393c73e3..558cbcfb6 100644 --- a/Plugins/Mineplex.Minecraft.Game.Core/src/mineplex/minecraft/game/core/boss/skeletonking/abilities/SkeletonArcherShield.java +++ b/Plugins/Mineplex.Minecraft.Game.Core/src/mineplex/minecraft/game/core/boss/skeletonking/abilities/SkeletonArcherShield.java @@ -82,7 +82,7 @@ public class SkeletonArcherShield extends BossAbility protected void spawnCustom() { getEntity().addPotionEffect(new PotionEffect(PotionEffectType.INVISIBILITY, 10000, 0)); - UtilEnt.Vegetate(getEntity()); + UtilEnt.vegetate(getEntity()); UtilEnt.ghost(getEntity(), true, false); Vector dir = new Vector(UtilMath.rr(1, true), 0, UtilMath.rr(1, true)).normalize().multiply(_seperator); diff --git a/Plugins/Mineplex.Minecraft.Game.Core/src/mineplex/minecraft/game/core/combat/CombatComponent.java b/Plugins/Mineplex.Minecraft.Game.Core/src/mineplex/minecraft/game/core/combat/CombatComponent.java index 45a9d5c51..8f308e43c 100644 --- a/Plugins/Mineplex.Minecraft.Game.Core/src/mineplex/minecraft/game/core/combat/CombatComponent.java +++ b/Plugins/Mineplex.Minecraft.Game.Core/src/mineplex/minecraft/game/core/combat/CombatComponent.java @@ -4,6 +4,7 @@ import java.nio.charset.StandardCharsets; import java.util.HashMap; import java.util.LinkedList; import java.util.List; +import java.util.Map; import java.util.UUID; import mineplex.core.common.util.F; @@ -39,12 +40,12 @@ public class CombatComponent } } - public void AddDamage(String source, double dmg, List mod) + public void AddDamage(String source, double dmg, List mod, Map metadata) { if (source == null) source = "-"; - GetDamage().addFirst(new CombatDamage(source, dmg, mod)); + GetDamage().addFirst(new CombatDamage(source, dmg, mod, metadata)); LastDamage = System.currentTimeMillis(); } diff --git a/Plugins/Mineplex.Minecraft.Game.Core/src/mineplex/minecraft/game/core/combat/CombatDamage.java b/Plugins/Mineplex.Minecraft.Game.Core/src/mineplex/minecraft/game/core/combat/CombatDamage.java index c0dedb230..b2997285a 100644 --- a/Plugins/Mineplex.Minecraft.Game.Core/src/mineplex/minecraft/game/core/combat/CombatDamage.java +++ b/Plugins/Mineplex.Minecraft.Game.Core/src/mineplex/minecraft/game/core/combat/CombatDamage.java @@ -1,7 +1,8 @@ package mineplex.minecraft.game.core.combat; -import java.util.ArrayList; +import java.util.HashMap; import java.util.List; +import java.util.Map; import mineplex.minecraft.game.core.damage.DamageChange; @@ -10,14 +11,20 @@ public class CombatDamage private String _name; private double _dmg; private long _time; - private List _mod = new ArrayList<>(); + private List _mod; + private Map _metadata; public CombatDamage(String name, double dmg, List mod) + { + this(name, dmg, mod, new HashMap<>()); + } + public CombatDamage(String name, double dmg, List mod, Map metadata) { _name = name; _dmg = dmg; _time = System.currentTimeMillis(); _mod = mod; + _metadata = metadata; } public String GetName() @@ -39,4 +46,17 @@ public class CombatDamage { return _mod; } + + /** + * Retrieves metadata that was associated with this damage via + * {@link mineplex.minecraft.game.core.damage.CustomDamageEvent#setMetadata(String, Object)}. + *

+ * There is no standardized metadata that should be expected. Metadata is meant to be used + * on a per-minigame basis to store additional information about the damage. + * @return a non-null map containing the metadata + */ + public Map getMetadata() + { + return _metadata; + } } diff --git a/Plugins/Mineplex.Minecraft.Game.Core/src/mineplex/minecraft/game/core/combat/CombatLog.java b/Plugins/Mineplex.Minecraft.Game.Core/src/mineplex/minecraft/game/core/combat/CombatLog.java index 879fc3c30..89a04fe90 100644 --- a/Plugins/Mineplex.Minecraft.Game.Core/src/mineplex/minecraft/game/core/combat/CombatLog.java +++ b/Plugins/Mineplex.Minecraft.Game.Core/src/mineplex/minecraft/game/core/combat/CombatLog.java @@ -3,15 +3,16 @@ package mineplex.minecraft.game.core.combat; import java.util.HashMap; import java.util.LinkedList; import java.util.List; - -import mineplex.core.common.util.F; -import mineplex.core.common.util.UtilTime; -import mineplex.minecraft.game.core.damage.DamageChange; +import java.util.Map; import org.bukkit.ChatColor; import org.bukkit.entity.LivingEntity; import org.bukkit.entity.Player; +import mineplex.core.common.util.F; +import mineplex.core.common.util.UtilTime; +import mineplex.minecraft.game.core.damage.DamageChange; + public class CombatLog { private LinkedList _damager = new LinkedList(); @@ -34,6 +35,7 @@ public class CombatLog { _expireTime = expireTime; _player = new CombatComponent(player.getName(), player); + _lastCombatEngaged = 0; // Just so taunts can be used before pvp } public LinkedList GetAttackers() @@ -47,12 +49,17 @@ public class CombatLog } public void Attacked(String damagerName, double damage, - LivingEntity damagerEnt, String attackName, List mod) + LivingEntity damagerEnt, String attackName, List mod) + { + this.Attacked(damagerName, damage, damagerEnt, attackName, mod, new HashMap<>()); + } + public void Attacked(String damagerName, double damage, + LivingEntity damagerEnt, String attackName, List mod, Map metadata) { // Add Attacked CombatComponent comp = GetEnemy(damagerName, damagerEnt); - comp.AddDamage(attackName, damage, mod); + comp.AddDamage(attackName, damage, mod, metadata); // Set Last LastDamager = comp; diff --git a/Plugins/Mineplex.Minecraft.Game.Core/src/mineplex/minecraft/game/core/combat/CombatManager.java b/Plugins/Mineplex.Minecraft.Game.Core/src/mineplex/minecraft/game/core/combat/CombatManager.java index b6591802f..ab3cc5171 100644 --- a/Plugins/Mineplex.Minecraft.Game.Core/src/mineplex/minecraft/game/core/combat/CombatManager.java +++ b/Plugins/Mineplex.Minecraft.Game.Core/src/mineplex/minecraft/game/core/combat/CombatManager.java @@ -307,11 +307,10 @@ public class CombatManager extends MiniPlugin Get((Player)event.GetDamagerEntity(true)).SetLastCombatEngaged(System.currentTimeMillis()); Get(event.GetDamageePlayer()).SetLastCombatEngaged(System.currentTimeMillis()); } - Get(event.GetDamageePlayer()).Attacked( UtilEnt.getName(event.GetDamagerEntity(true)), (int) event.GetDamage(), event.GetDamagerEntity(true), - reason, event.GetDamageMod()); + reason, event.GetDamageMod(), event.getMetadata()); } // Damager is WORLD else @@ -409,9 +408,9 @@ public class CombatManager extends MiniPlugin if (event.GetReason() != null) reason = event.GetReason(); - + Get(event.GetDamageePlayer()).Attacked(source, - (int) event.GetDamage(), null, reason, event.GetDamageMod()); + (int) event.GetDamage(), null, reason, event.GetDamageMod(), event.getMetadata()); } } @@ -488,8 +487,8 @@ public class CombatManager extends MiniPlugin if (log.GetAssists() > 0) killPlayer += " + " + log.GetAssists(); - String weapon = log.GetKiller().GetLastDamageSource(); - + String weapon = (String) log.GetKiller().GetDamage().getFirst().getMetadata().get("customWeapon"); + weapon = weapon == null ? log.GetKiller().GetLastDamageSource() : weapon; UtilPlayer.message( cur, F.main("Death", diff --git a/Plugins/Mineplex.Minecraft.Game.Core/src/mineplex/minecraft/game/core/damage/CustomDamageEvent.java b/Plugins/Mineplex.Minecraft.Game.Core/src/mineplex/minecraft/game/core/damage/CustomDamageEvent.java index ec3781d43..a4830cb56 100644 --- a/Plugins/Mineplex.Minecraft.Game.Core/src/mineplex/minecraft/game/core/damage/CustomDamageEvent.java +++ b/Plugins/Mineplex.Minecraft.Game.Core/src/mineplex/minecraft/game/core/damage/CustomDamageEvent.java @@ -2,7 +2,9 @@ package mineplex.minecraft.game.core.damage; import java.util.ArrayList; import java.util.HashMap; +import java.util.Map; +import org.apache.commons.lang.Validate; import org.bukkit.ChatColor; import org.bukkit.Location; import org.bukkit.entity.LivingEntity; @@ -29,6 +31,7 @@ public class CustomDamageEvent extends Event implements Cancellable private HashMap _knockbackMod = new HashMap(); + private Map _metadata = new HashMap<>(); //Ents private LivingEntity _damageeEntity; private Player _damageePlayer; @@ -368,6 +371,34 @@ public class CustomDamageEvent extends Event implements Cancellable return IsCancelled(); } + /** + * Associates the provided metadata key with the provided value. + * Metadata can later be retrieved from individual {@link + * mineplex.minecraft.game.core.combat.CombatDamage} instances acquired + * from the {@link mineplex.minecraft.game.core.combat.CombatLog}. + * + * @param key non-null key to associate the value with + * @param value nullable value + * @throws IllegalArgumentException if key is null + */ + public void setMetadata(String key, Object value) + { + Validate.notNull(key); + _metadata.put(key, value); + } + + /** + * Gets all Metadata associated with this event. There is + * no standardized metadata that should be expected. + * + * @see #setMetadata(String, Object) + * @return non-null map of metadata + */ + public Map getMetadata() + { + return _metadata; + } + @Override @Deprecated /** diff --git a/Plugins/Mineplex.Minecraft.Game.Core/src/mineplex/minecraft/game/core/damage/DamageManager.java b/Plugins/Mineplex.Minecraft.Game.Core/src/mineplex/minecraft/game/core/damage/DamageManager.java index ebb331257..f1905d25a 100644 --- a/Plugins/Mineplex.Minecraft.Game.Core/src/mineplex/minecraft/game/core/damage/DamageManager.java +++ b/Plugins/Mineplex.Minecraft.Game.Core/src/mineplex/minecraft/game/core/damage/DamageManager.java @@ -345,7 +345,7 @@ public class DamageManager extends MiniPlugin Player damagee = event.GetDamageePlayer(); //Not Survival - if (damagee.getGameMode() != GameMode.SURVIVAL) + if (damagee.getGameMode() != GameMode.SURVIVAL && damagee.getGameMode() != GameMode.ADVENTURE) { event.SetCancelled("Damagee in Creative"); return; @@ -373,7 +373,7 @@ public class DamageManager extends MiniPlugin Player damager = event.GetDamagerPlayer(true); //Not Survival - if (damager.getGameMode() != GameMode.SURVIVAL) + if (damager.getGameMode() != GameMode.SURVIVAL && damager.getGameMode() != GameMode.ADVENTURE) { event.SetCancelled("Damager in Creative"); return; diff --git a/Plugins/Mineplex.Minecraft.Game.Core/src/mineplex/minecraft/game/core/explosion/CustomExplosion.java b/Plugins/Mineplex.Minecraft.Game.Core/src/mineplex/minecraft/game/core/explosion/CustomExplosion.java index f7984765a..220e2cb7f 100644 --- a/Plugins/Mineplex.Minecraft.Game.Core/src/mineplex/minecraft/game/core/explosion/CustomExplosion.java +++ b/Plugins/Mineplex.Minecraft.Game.Core/src/mineplex/minecraft/game/core/explosion/CustomExplosion.java @@ -252,7 +252,6 @@ public class CustomExplosion extends Explosion continue; double d7 = entity.f(this.posX, this.posY, this.posZ) / this._size; // XXX - if (d7 <= 1.0D) { double d0 = entity.locX - this.posX; diff --git a/Plugins/Mineplex.ServerData/pom.xml b/Plugins/Mineplex.ServerData/pom.xml index 40275a893..84a00934c 100644 --- a/Plugins/Mineplex.ServerData/pom.xml +++ b/Plugins/Mineplex.ServerData/pom.xml @@ -28,5 +28,10 @@ redis.clients jedis + + org.jooq + jooq + 3.5.2 + diff --git a/Plugins/Mineplex.ServerData/src/mineplex/serverdata/Utility.java b/Plugins/Mineplex.ServerData/src/mineplex/serverdata/Utility.java index 8d8f2daf3..a8f3b2575 100644 --- a/Plugins/Mineplex.ServerData/src/mineplex/serverdata/Utility.java +++ b/Plugins/Mineplex.ServerData/src/mineplex/serverdata/Utility.java @@ -2,15 +2,14 @@ package mineplex.serverdata; import java.util.concurrent.ConcurrentHashMap; +import com.google.gson.Gson; + import mineplex.serverdata.servers.ConnectionData; import mineplex.serverdata.servers.ServerManager; + import redis.clients.jedis.Jedis; import redis.clients.jedis.JedisPool; import redis.clients.jedis.JedisPoolConfig; -import redis.clients.jedis.exceptions.JedisConnectionException; - -import com.google.gson.Gson; -import com.google.gson.GsonBuilder; /** * Utility offers various necessary utility-based methods for use in Mineplex.ServerData. @@ -23,7 +22,7 @@ public class Utility private static long _millisTimeDifference; // The Gson instance used to serialize/deserialize objects in JSON form. - private static Gson _gson = new GsonBuilder().create(); + private static Gson _gson = new Gson(); public static Gson getGson() { return _gson; } // map of all instantiated connection pools, distinguished by their ip:port combination diff --git a/Plugins/Mineplex.ServerData/src/mineplex/serverdata/commands/AddPunishCommand.java b/Plugins/Mineplex.ServerData/src/mineplex/serverdata/commands/AddPunishCommand.java new file mode 100644 index 000000000..6844e4302 --- /dev/null +++ b/Plugins/Mineplex.ServerData/src/mineplex/serverdata/commands/AddPunishCommand.java @@ -0,0 +1,32 @@ +package mineplex.serverdata.commands; + +import java.util.UUID; + +public class AddPunishCommand extends ServerCommand +{ + private final String _target; + private final String _category; + private final String _sentence; + private final String _reason; + private final long _duration; + private final String _admin; + private final String _adminUUID; + private final int _severity; + + public AddPunishCommand(String finalPlayerName, int severity, String category, String sentence, String reason, long duration, String finalCallerName, String uuid) + { + this._target = finalPlayerName; + this._severity = severity; + this._category = category; + this._sentence = sentence; + this._reason = reason; + this._duration = duration; + this._admin = finalCallerName; + this._adminUUID = uuid; + } + + @Override + public void run() + { + } +} diff --git a/Plugins/Mineplex.ServerData/src/mineplex/serverdata/commands/PlayerJoinCommand.java b/Plugins/Mineplex.ServerData/src/mineplex/serverdata/commands/PlayerJoinCommand.java index b41ba4555..424ae0c33 100644 --- a/Plugins/Mineplex.ServerData/src/mineplex/serverdata/commands/PlayerJoinCommand.java +++ b/Plugins/Mineplex.ServerData/src/mineplex/serverdata/commands/PlayerJoinCommand.java @@ -5,10 +5,12 @@ import java.util.UUID; public class PlayerJoinCommand extends ServerCommand { private String _uuid; + private String _name; - public PlayerJoinCommand(UUID uuid) + public PlayerJoinCommand(UUID uuid, String name) { _uuid = uuid.toString(); + _name = name; } @Override @@ -21,4 +23,9 @@ public class PlayerJoinCommand extends ServerCommand { return _uuid; } -} + + public String getName() + { + return _name; + } +} \ No newline at end of file diff --git a/Plugins/Mineplex.ServerData/src/mineplex/serverdata/commands/RemovePunishCommand.java b/Plugins/Mineplex.ServerData/src/mineplex/serverdata/commands/RemovePunishCommand.java new file mode 100644 index 000000000..d34aad2f1 --- /dev/null +++ b/Plugins/Mineplex.ServerData/src/mineplex/serverdata/commands/RemovePunishCommand.java @@ -0,0 +1,28 @@ +package mineplex.serverdata.commands; + +import java.util.UUID; + +import com.google.gson.JsonObject; + +public class RemovePunishCommand extends ServerCommand +{ + private final JsonObject _punishment; + private final String _target; + private final String _admin; + private final String _adminUUID; + private final String _reason; + + public RemovePunishCommand(JsonObject punishment, String target, String admin, UUID adminUUID, String reason) + { + _punishment = punishment; + _target = target; + _admin = admin; + _adminUUID = adminUUID.toString(); + _reason = reason; + } + + @Override + public void run() + { + } +} diff --git a/Plugins/Mineplex.ServerData/src/mineplex/serverdata/commands/ServerCommand.java b/Plugins/Mineplex.ServerData/src/mineplex/serverdata/commands/ServerCommand.java index 5f6e546b8..de588f1d2 100644 --- a/Plugins/Mineplex.ServerData/src/mineplex/serverdata/commands/ServerCommand.java +++ b/Plugins/Mineplex.ServerData/src/mineplex/serverdata/commands/ServerCommand.java @@ -1,16 +1,21 @@ package mineplex.serverdata.commands; -public abstract class ServerCommand +import java.util.UUID; + +public abstract class ServerCommand { + private final UUID _commandId = UUID.randomUUID(); + private final String _fromServer = ServerCommandManager.getInstance().getServerName(); // The names of servers targetted to receive this ServerCommand. private String[] _targetServers; - - /** - * Class constructor - * @param targetServers - */ + + public ServerCommand() + { + _targetServers = new String[0]; + } + public ServerCommand(String... targetServers) { _targetServers = targetServers; @@ -30,6 +35,11 @@ public abstract class ServerCommand return _targetServers; } + + public String getFromServer() + { + return this._fromServer; + } /** * Run the command on it's destination target server. @@ -67,4 +77,26 @@ public abstract class ServerCommand { ServerCommandManager.getInstance().publishCommand(this); } + + public boolean wasSentFromThisServer() + { + return ServerCommandManager.getInstance().getServerName().equals(_fromServer); + } + + public boolean isSentToThisServer() + { + for (String targetServer : _targetServers) + { + if (ServerCommandManager.getInstance().getServerName().equals(targetServer)) + { + return true; + } + } + return false; + } + + public UUID getCommandId() + { + return _commandId; + } } diff --git a/Plugins/Mineplex.ServerData/src/mineplex/serverdata/commands/ServerCommandManager.java b/Plugins/Mineplex.ServerData/src/mineplex/serverdata/commands/ServerCommandManager.java index 089f29e97..259a5ef5f 100644 --- a/Plugins/Mineplex.ServerData/src/mineplex/serverdata/commands/ServerCommandManager.java +++ b/Plugins/Mineplex.ServerData/src/mineplex/serverdata/commands/ServerCommandManager.java @@ -3,6 +3,8 @@ package mineplex.serverdata.commands; import java.util.HashMap; import java.util.Map; +import com.google.gson.Gson; + import mineplex.serverdata.Utility; import mineplex.serverdata.servers.ServerManager; import redis.clients.jedis.Jedis; @@ -23,8 +25,18 @@ public class ServerCommandManager private Map _commandTypes; private String _localServerName; - public void initializeServer(String serverName) { _localServerName = serverName; } + private Gson _gson; + public void initializeServer(String serverName, Gson gson) + { + _localServerName = serverName; + _gson = gson; + } + public boolean isServerInitialized() { return _localServerName != null; } + public String getServerName() + { + return this._localServerName; + } /** * Private class constructor to prevent non-singleton instances. @@ -71,7 +83,7 @@ public class ServerCommandManager public void run() { String commandType = serverCommand.getClass().getSimpleName(); - String serializedCommand = Utility.serialize(serverCommand); + String serializedCommand = _gson.toJson(serverCommand); try(Jedis jedis = _writePool.getResource()) { @@ -97,7 +109,7 @@ public class ServerCommandManager if (_commandTypes.containsKey(commandType)) { Class commandClazz = _commandTypes.get(commandType).getCommandType(); - final ServerCommand serverCommand = Utility.deserialize(serializedCommand, commandClazz); + final ServerCommand serverCommand = _gson.fromJson(serializedCommand, commandClazz); if (serverCommand.isTargetServer(_localServerName)) { diff --git a/Plugins/Mineplex.ServerData/src/mineplex/serverdata/commands/TransferCommand.java b/Plugins/Mineplex.ServerData/src/mineplex/serverdata/commands/TransferCommand.java index 15ac416ba..84abfa91e 100644 --- a/Plugins/Mineplex.ServerData/src/mineplex/serverdata/commands/TransferCommand.java +++ b/Plugins/Mineplex.ServerData/src/mineplex/serverdata/commands/TransferCommand.java @@ -1,31 +1,24 @@ package mineplex.serverdata.commands; -/** - * The TransferCommand is sent across the server network to notify - * servers to transfer players to other destinations. - * @author Ty - * - */ public class TransferCommand extends ServerCommand { + private final String _playerName; + private final String _targetServer; - // The ServerTransfer to be sent to another server for enactment - private ServerTransfer _transfer; - public ServerTransfer getTransfer() { return _transfer; } - - /** - * Class constructor - * @param transfer - the {@link ServerTransfer} to notify another server of - */ - public TransferCommand(ServerTransfer transfer) + public TransferCommand(String playerName, String targetServer) { - _transfer = transfer; + _playerName = playerName; + _targetServer = targetServer; } - - @Override - public void run() + + public String getPlayerName() { - // Utilitizes a callback functionality to seperate dependencies + return _playerName; + } + + public String getTargetServer() + { + return _targetServer; } } diff --git a/Plugins/Mineplex.ServerData/src/mineplex/serverdata/commands/TransferUUIDCommand.java b/Plugins/Mineplex.ServerData/src/mineplex/serverdata/commands/TransferUUIDCommand.java new file mode 100644 index 000000000..78ee73283 --- /dev/null +++ b/Plugins/Mineplex.ServerData/src/mineplex/serverdata/commands/TransferUUIDCommand.java @@ -0,0 +1,25 @@ +package mineplex.serverdata.commands; + +import java.util.UUID; + +public class TransferUUIDCommand extends ServerCommand +{ + private final UUID _playerUUID; + private final String _targetServer; + + public TransferUUIDCommand(UUID playerUUID, String targetServer) + { + _playerUUID = playerUUID; + _targetServer = targetServer; + } + + public UUID getPlayerUUID() + { + return _playerUUID; + } + + public String getTargetServer() + { + return _targetServer; + } +} diff --git a/Plugins/Mineplex.ServerData/src/mineplex/serverdata/commands/TwoFactorResetCommand.java b/Plugins/Mineplex.ServerData/src/mineplex/serverdata/commands/TwoFactorResetCommand.java new file mode 100644 index 000000000..45c698e5f --- /dev/null +++ b/Plugins/Mineplex.ServerData/src/mineplex/serverdata/commands/TwoFactorResetCommand.java @@ -0,0 +1,17 @@ +package mineplex.serverdata.commands; + +public class TwoFactorResetCommand extends ServerCommand +{ + private String _adminName; + private String _adminUUID; + private String _targetName; + private String _targetUUID; + + public TwoFactorResetCommand(String adminName, String adminUUID, String targetName, String targetUUID) + { + _adminName = adminName; + _adminUUID = adminUUID; + _targetName = targetName; + _targetUUID = targetUUID; + } +} diff --git a/Plugins/Mineplex.ServerData/src/mineplex/serverdata/commands/UpdateRankCommand.java b/Plugins/Mineplex.ServerData/src/mineplex/serverdata/commands/UpdateRankCommand.java new file mode 100644 index 000000000..e3c2478c7 --- /dev/null +++ b/Plugins/Mineplex.ServerData/src/mineplex/serverdata/commands/UpdateRankCommand.java @@ -0,0 +1,17 @@ +package mineplex.serverdata.commands; + +public class UpdateRankCommand extends ServerCommand +{ + private String _callerName; + private String _callerUUID; + private String _targetName; + private String _targetRankNew; + + public UpdateRankCommand(String callerName, String callerUUID, String targetName, String targetRankNew) + { + _callerName = callerName; + _callerUUID = callerUUID; + _targetName = targetName; + _targetRankNew = targetRankNew; + } +} diff --git a/Plugins/Mineplex.ServerData/src/mineplex/serverdata/data/DataRepository.java b/Plugins/Mineplex.ServerData/src/mineplex/serverdata/data/DataRepository.java index fb9f9e7c4..03500ca2a 100644 --- a/Plugins/Mineplex.ServerData/src/mineplex/serverdata/data/DataRepository.java +++ b/Plugins/Mineplex.ServerData/src/mineplex/serverdata/data/DataRepository.java @@ -1,6 +1,8 @@ package mineplex.serverdata.data; import java.util.Collection; +import java.util.List; +import java.util.Map; /** * DataRepository is used to store {@link Data} objects in a central database @@ -18,6 +20,8 @@ public interface DataRepository public Collection getElements(Collection dataIds); + public Map getElementsMap(List dataIds); + public void addElement(T element, int timeout); public void addElement(T element); diff --git a/Plugins/Mineplex.ServerData/src/mineplex/serverdata/data/PlayerStatus.java b/Plugins/Mineplex.ServerData/src/mineplex/serverdata/data/PlayerStatus.java index 5cb4d9072..ee9eb3eca 100644 --- a/Plugins/Mineplex.ServerData/src/mineplex/serverdata/data/PlayerStatus.java +++ b/Plugins/Mineplex.ServerData/src/mineplex/serverdata/data/PlayerStatus.java @@ -1,14 +1,18 @@ package mineplex.serverdata.data; -import mineplex.serverdata.data.Data; +import java.util.UUID; public class PlayerStatus implements Data { - // The name of this server. + // The uuid of this player. + private UUID _uuid; + public UUID getUUID() { return _uuid; } + + // The name of this player. private String _name; public String getName() { return _name; } - // The current message of the day (MOTD) of the server. + // The current server occupied by this player. private String _server; public String getServer() { return _server; } @@ -17,19 +21,18 @@ public class PlayerStatus implements Data * @param name * @param server */ - public PlayerStatus(String name, String server) + public PlayerStatus(UUID uuid, String name, String server) { + _uuid = uuid; _name = name; _server = server; } /** * Unique identifying String ID associated with this {@link PlayerStatus}. - * - * Use the lowercase name so we can have case-insensitive lookup */ public String getDataId() { - return _name.toLowerCase(); + return _uuid.toString(); } -} +} \ No newline at end of file diff --git a/Plugins/Mineplex.ServerData/src/mineplex/serverdata/data/ServerGroup.java b/Plugins/Mineplex.ServerData/src/mineplex/serverdata/data/ServerGroup.java index ba3295037..04c2c5118 100644 --- a/Plugins/Mineplex.ServerData/src/mineplex/serverdata/data/ServerGroup.java +++ b/Plugins/Mineplex.ServerData/src/mineplex/serverdata/data/ServerGroup.java @@ -325,7 +325,8 @@ public class ServerGroup String serverName = server.getName(); try { - int serverNum = Integer.parseInt(serverName.split("-")[1]); + String[] nameArgs = serverName.split("-"); + int serverNum = Integer.parseInt(nameArgs[nameArgs.length - 1]); if (serverNum == id) { diff --git a/Plugins/Mineplex.ServerData/src/mineplex/serverdata/database/DBPool.java b/Plugins/Mineplex.ServerData/src/mineplex/serverdata/database/DBPool.java index acc786379..d948b6e73 100644 --- a/Plugins/Mineplex.ServerData/src/mineplex/serverdata/database/DBPool.java +++ b/Plugins/Mineplex.ServerData/src/mineplex/serverdata/database/DBPool.java @@ -18,6 +18,7 @@ public final class DBPool private static DataSource MINEPLEX_STATS; private static DataSource PLAYER_STATS; private static DataSource SERVER_STATS; + private static DataSource MSSQL_MOCK; private static DataSource openDataSource(String url, String username, String password) { @@ -30,14 +31,22 @@ public final class DBPool source.setUrl(url); source.setUsername(username); source.setPassword(password); - source.setMaxTotal(4); - source.setMaxIdle(4); + source.setMaxTotal(5); + source.setMaxIdle(5); source.setTimeBetweenEvictionRunsMillis(180 * 1000); source.setSoftMinEvictableIdleTimeMillis(180 * 1000); return source; } + public static DataSource getMssqlMock() + { + if (MSSQL_MOCK == null) + loadDataSources(); + + return MSSQL_MOCK; + } + public static DataSource getAccount() { if (ACCOUNT == null) @@ -138,6 +147,8 @@ public final class DBPool PLAYER_STATS = openDataSource("jdbc:mysql://" + dbHost, userName, password); else if (dbSource.toUpperCase().equalsIgnoreCase("SERVER_STATS")) SERVER_STATS = openDataSource("jdbc:mysql://" + dbHost, userName, password); + else if (dbSource.toUpperCase().equalsIgnoreCase("MSSQL_MOCK")) + MSSQL_MOCK = openDataSource("jdbc:mysql://" + dbHost, userName, password); } } } diff --git a/Plugins/Mineplex.ServerData/src/mineplex/serverdata/database/DatabaseRunnable.java b/Plugins/Mineplex.ServerData/src/mineplex/serverdata/database/DatabaseRunnable.java index 4817a9dc4..6aa95c8f3 100644 --- a/Plugins/Mineplex.ServerData/src/mineplex/serverdata/database/DatabaseRunnable.java +++ b/Plugins/Mineplex.ServerData/src/mineplex/serverdata/database/DatabaseRunnable.java @@ -1,27 +1,38 @@ package mineplex.serverdata.database; +import java.util.concurrent.atomic.AtomicInteger; + +import org.omg.CORBA.ACTIVITY_REQUIRED; + public class DatabaseRunnable { private Runnable _runnable; - private int _failedAttempts = 0; - - public DatabaseRunnable(Runnable runnable) + private String _errorMessage; + private AtomicInteger _failedAttempts = new AtomicInteger(0); + + public DatabaseRunnable(Runnable runnable, String error) { _runnable = runnable; + _errorMessage = error; } - + public void run() { _runnable.run(); } - + + public String getErrorMessage() + { + return _errorMessage; + } + public void incrementFailCount() { - _failedAttempts++; + _failedAttempts.getAndIncrement(); } public int getFailedCounts() { - return _failedAttempts; + return _failedAttempts.get(); } } diff --git a/Plugins/Mineplex.ServerData/src/mineplex/serverdata/database/RepositoryBase.java b/Plugins/Mineplex.ServerData/src/mineplex/serverdata/database/RepositoryBase.java index 28650bc01..f5066fea9 100644 --- a/Plugins/Mineplex.ServerData/src/mineplex/serverdata/database/RepositoryBase.java +++ b/Plugins/Mineplex.ServerData/src/mineplex/serverdata/database/RepositoryBase.java @@ -8,6 +8,10 @@ import java.sql.Statement; import javax.sql.DataSource; +import org.jooq.DSLContext; +import org.jooq.SQLDialect; +import org.jooq.impl.DSL; + import mineplex.serverdata.database.column.Column; public abstract class RepositoryBase @@ -39,9 +43,15 @@ public abstract class RepositoryBase }).start(); } - protected abstract void initialize(); + protected void initialize() + { + + } - protected abstract void update(); + protected void update() + { + + } /** * @return the {@link DataSource} used by the repository for connection pooling. @@ -69,6 +79,16 @@ public abstract class RepositoryBase return null; } } + + protected int executeUpdate(Connection connection, String query, Runnable onSQLError, Column...columns) + { + return executeInsert(connection, query, null, onSQLError, columns); + } + + protected int executeUpdate(String query, Runnable onSQLError, Column...columns) + { + return executeInsert(query, null, columns); + } /** * Execute a query against the repository. @@ -81,13 +101,12 @@ public abstract class RepositoryBase return executeInsert(query, null, columns); } - protected int executeInsert(String query, ResultSetCallable callable, Column...columns) + protected int executeInsert(Connection connection, String query, ResultSetCallable callable, Runnable onSQLError, Column...columns) { int affectedRows = 0; // Automatic resource management for handling/closing objects. try ( - Connection connection = getConnection(); PreparedStatement preparedStatement = connection.prepareStatement(query, Statement.RETURN_GENERATED_KEYS) ) { @@ -106,6 +125,10 @@ public abstract class RepositoryBase catch (SQLException exception) { exception.printStackTrace(); + if (onSQLError != null) + { + onSQLError.run(); + } } catch (Exception exception) { @@ -115,7 +138,53 @@ public abstract class RepositoryBase return affectedRows; } - protected void executeQuery(PreparedStatement statement, ResultSetCallable callable, Column...columns) + protected int executeInsert(String query, ResultSetCallable callable, Runnable onSQLError, Column...columns) + { + int affectedRows = 0; + + // Automatic resource management for handling/closing objects. + try ( + Connection connection = getConnection(); + ) + { + affectedRows = executeInsert(connection, query, callable, onSQLError, columns); + } + catch (SQLException exception) + { + exception.printStackTrace(); + } + catch (Exception exception) + { + exception.printStackTrace(); + } + + return affectedRows; + } + + protected int executeInsert(String query, ResultSetCallable callable, Column...columns) + { + int affectedRows = 0; + + // Automatic resource management for handling/closing objects. + try ( + Connection connection = getConnection(); + ) + { + affectedRows = executeInsert(connection, query, callable, null, columns); + } + catch (SQLException exception) + { + exception.printStackTrace(); + } + catch (Exception exception) + { + exception.printStackTrace(); + } + + return affectedRows; + } + + protected void executeQuery(PreparedStatement statement, ResultSetCallable callable, Runnable onSQLError, Column...columns) { try { @@ -135,6 +204,10 @@ public abstract class RepositoryBase catch (SQLException exception) { exception.printStackTrace(); + if (onSQLError != null) + { + onSQLError.run(); + } } catch (Exception exception) { @@ -142,11 +215,34 @@ public abstract class RepositoryBase } } - protected void executeQuery(String query, ResultSetCallable callable, Column...columns) - { + protected void executeQuery(PreparedStatement statement, ResultSetCallable callable, Column...columns) + { + executeQuery(statement, callable, null, columns); + } + + protected void executeQuery(Connection connection, String query, ResultSetCallable callable, Runnable onSQLError, Column...columns) + { + // Automatic resource management for handling/closing objects. + try ( + PreparedStatement preparedStatement = connection.prepareStatement(query) + ) + { + executeQuery(preparedStatement, callable, onSQLError, columns); + } + catch (SQLException exception) + { + exception.printStackTrace(); + } + catch (Exception exception) + { + exception.printStackTrace(); + } + } + + protected void executeQuery(Connection connection, String query, ResultSetCallable callable, Column...columns) + { // Automatic resource management for handling/closing objects. try ( - Connection connection = getConnection(); PreparedStatement preparedStatement = connection.prepareStatement(query) ) { @@ -161,4 +257,47 @@ public abstract class RepositoryBase exception.printStackTrace(); } } -} + + protected void executeQuery(String query, ResultSetCallable callable, Runnable onSQLError, Column...columns) + { + // Automatic resource management for handling/closing objects. + try ( + Connection connection = getConnection(); + ) + { + executeQuery(connection, query, callable, onSQLError, columns); + } + catch (SQLException exception) + { + exception.printStackTrace(); + } + catch (Exception exception) + { + exception.printStackTrace(); + } + } + + protected void executeQuery(String query, ResultSetCallable callable, Column...columns) + { + // Automatic resource management for handling/closing objects. + try ( + Connection connection = getConnection(); + ) + { + executeQuery(connection, query, callable, columns); + } + catch (SQLException exception) + { + exception.printStackTrace(); + } + catch (Exception exception) + { + exception.printStackTrace(); + } + } + + protected DSLContext jooq() + { + return DSL.using(DBPool.getAccount(), SQLDialect.MYSQL); + } +} \ No newline at end of file diff --git a/Plugins/Mineplex.ServerData/src/mineplex/serverdata/redis/RedisDataRepository.java b/Plugins/Mineplex.ServerData/src/mineplex/serverdata/redis/RedisDataRepository.java index 5ccfd291a..55f3a2d58 100644 --- a/Plugins/Mineplex.ServerData/src/mineplex/serverdata/redis/RedisDataRepository.java +++ b/Plugins/Mineplex.ServerData/src/mineplex/serverdata/redis/RedisDataRepository.java @@ -2,8 +2,10 @@ package mineplex.serverdata.redis; import java.util.ArrayList; import java.util.Collection; +import java.util.HashMap; import java.util.HashSet; import java.util.List; +import java.util.Map; import java.util.Set; import mineplex.serverdata.Region; @@ -102,7 +104,40 @@ public class RedisDataRepository extends RedisRepository impleme return elements; } - + + @Override + public Map getElementsMap(List dataIds) + { + Map elements = new HashMap<>(); + + try(Jedis jedis = getResource(false)) + { + Pipeline pipeline = jedis.pipelined(); + + List> responses = new ArrayList<>(); + for (String dataId : dataIds) + { + responses.add(pipeline.get(generateKey(dataId))); + } + + // Block until all requests have received pipelined responses + pipeline.sync(); + + for (int i = 0; i < responses.size(); i++) + { + String key = dataIds.get(i); + + Response response = responses.get(i); + String serializedData = response.get(); + T element = deserialize(serializedData); + + elements.put(key, element); + } + } + + return elements; + } + @Override public T getElement(String dataId) { diff --git a/Plugins/Mineplex.ServerData/src/mineplex/serverdata/redis/RedisServerRepository.java b/Plugins/Mineplex.ServerData/src/mineplex/serverdata/redis/RedisServerRepository.java index 15120076e..2f5537437 100644 --- a/Plugins/Mineplex.ServerData/src/mineplex/serverdata/redis/RedisServerRepository.java +++ b/Plugins/Mineplex.ServerData/src/mineplex/serverdata/redis/RedisServerRepository.java @@ -222,7 +222,8 @@ public class RedisServerRepository extends RedisRepository implements ServerRepo if (data.entrySet().size() == 0) { - System.out.println("Encountered empty map! Skipping..."); + // please no +// System.out.println("Encountered empty map! Skipping..."); continue; } diff --git a/Plugins/Mineplex.ServerData/src/mineplex/serverdata/redis/atomic/RedisStringRepository.java b/Plugins/Mineplex.ServerData/src/mineplex/serverdata/redis/atomic/RedisStringRepository.java new file mode 100644 index 000000000..910d61b38 --- /dev/null +++ b/Plugins/Mineplex.ServerData/src/mineplex/serverdata/redis/atomic/RedisStringRepository.java @@ -0,0 +1,59 @@ +package mineplex.serverdata.redis.atomic; + +import mineplex.serverdata.Region; +import mineplex.serverdata.redis.RedisRepository; +import mineplex.serverdata.servers.ConnectionData; + +import redis.clients.jedis.Jedis; +import redis.clients.jedis.Response; +import redis.clients.jedis.Transaction; +import static mineplex.serverdata.Utility.currentTimeMillis; + +public class RedisStringRepository extends RedisRepository +{ + private final String _dataKey; + + public RedisStringRepository(ConnectionData writeConn, ConnectionData readConn, Region region, String dataKey) + { + super(writeConn, readConn, region); + this._dataKey = dataKey; + } + + public void set(String key, String value) + { + try (Jedis jedis = getResource(true)) + { + jedis.set(generateKey(key), value); + } + } + + public String get(String key) + { + String element; + + try (Jedis jedis = getResource(false)) + { + element = jedis.get(generateKey(key)); + } + + return element; + } + + public void del(String key) + { + try (Jedis jedis = getResource(true)) + { + jedis.del(generateKey(key)); + } + } + + private String getElementSetKey() + { + return concatenate("data", _dataKey, getRegion().toString()); + } + + private String generateKey(String dataId) + { + return concatenate(getElementSetKey(), dataId); + } +} diff --git a/Plugins/Mineplex.ServerMonitor/src/mineplex/servermonitor/ServerMonitor.java b/Plugins/Mineplex.ServerMonitor/src/mineplex/servermonitor/ServerMonitor.java index 2bb711a58..086e356f2 100644 --- a/Plugins/Mineplex.ServerMonitor/src/mineplex/servermonitor/ServerMonitor.java +++ b/Plugins/Mineplex.ServerMonitor/src/mineplex/servermonitor/ServerMonitor.java @@ -211,6 +211,14 @@ public class ServerMonitor System.out.println("Removed MPS : " + groupStatus.getName()); } + if (groupStatus.getServerType().equalsIgnoreCase("Community")) + { + _repository.removeServerGroup(groupStatus); + _serverGroupMap.remove(groupStatus.getName()); + groupStatusIterator.remove(); + + System.out.println("Removed MCS : " + groupStatus.getName()); + } } } @@ -226,7 +234,8 @@ public class ServerMonitor try { MinecraftServer server = serverIterator.next(); - int serverNum = Integer.parseInt(server.getName().split("-")[1]); + String[] nameArgs = server.getName().split("-"); + int serverNum = Integer.parseInt(nameArgs[nameArgs.length - 1]); if (serverMap.containsKey(serverNum)) { diff --git a/Plugins/Mineplex.ServerMonitor/src/mineplex/servermonitor/ServerSorter.java b/Plugins/Mineplex.ServerMonitor/src/mineplex/servermonitor/ServerSorter.java index 06ea39063..dd97c296d 100644 --- a/Plugins/Mineplex.ServerMonitor/src/mineplex/servermonitor/ServerSorter.java +++ b/Plugins/Mineplex.ServerMonitor/src/mineplex/servermonitor/ServerSorter.java @@ -9,9 +9,11 @@ public class ServerSorter implements Comparator @Override public int compare(MinecraftServer first, MinecraftServer second) { - if (Integer.parseInt(first.getName().split("-")[1]) < Integer.parseInt(second.getName().split("-")[1])) + String[] args1 = first.getName().split("-"); + String[] args2 = second.getName().split("-"); + if (Integer.parseInt(args1[args1.length - 1]) < Integer.parseInt(args2[args2.length - 1])) return -1; - else if (Integer.parseInt(second.getName().split("-")[1]) < Integer.parseInt(first.getName().split("-")[1])) + else if (Integer.parseInt(args2[args2.length - 1]) < Integer.parseInt(args1[args1.length - 1])) return 1; return 0; diff --git a/Plugins/Mineplex.ServerMonitor/src/mineplex/servermonitor/StatusHistoryRepository.java b/Plugins/Mineplex.ServerMonitor/src/mineplex/servermonitor/StatusHistoryRepository.java index 5fd639283..9b293056f 100644 --- a/Plugins/Mineplex.ServerMonitor/src/mineplex/servermonitor/StatusHistoryRepository.java +++ b/Plugins/Mineplex.ServerMonitor/src/mineplex/servermonitor/StatusHistoryRepository.java @@ -260,16 +260,4 @@ public class StatusHistoryRepository extends RepositoryBase } } } - - @Override - protected void initialize() - { - - } - - @Override - protected void update() - { - - } } diff --git a/Plugins/Mineplex.StaffServer/src/mineplex/staffServer/StaffServer.java b/Plugins/Mineplex.StaffServer/src/mineplex/staffServer/StaffServer.java index 5d84a00fd..78526833a 100644 --- a/Plugins/Mineplex.StaffServer/src/mineplex/staffServer/StaffServer.java +++ b/Plugins/Mineplex.StaffServer/src/mineplex/staffServer/StaffServer.java @@ -1,10 +1,21 @@ package mineplex.staffServer; +import java.util.UUID; + +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 org.spigotmc.SpigotConfig; + import com.mojang.authlib.GameProfile; + import mineplex.core.account.CoreClientManager; import mineplex.core.achievement.AchievementManager; import mineplex.core.chat.Chat; import mineplex.core.command.CommandCenter; +import mineplex.core.common.Constants; import mineplex.core.common.Rank; import mineplex.core.creature.Creature; import mineplex.core.disguise.DisguiseManager; @@ -15,6 +26,7 @@ import mineplex.core.memory.MemoryFix; import mineplex.core.monitor.LagMeter; import mineplex.core.npc.NpcManager; import mineplex.core.packethandler.PacketHandler; +import mineplex.core.portal.GenericServer; import mineplex.core.portal.Portal; import mineplex.core.powerplayclub.PowerPlayClubRepository; import mineplex.core.preferences.PreferencesManager; @@ -27,49 +39,38 @@ import mineplex.core.updater.FileUpdater; import mineplex.core.updater.Updater; import mineplex.staffServer.customerSupport.CustomerSupport; import mineplex.staffServer.salespackage.SalesPackageManager; -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 org.spigotmc.SpigotConfig; - -import java.util.UUID; import static mineplex.core.Managers.require; public class StaffServer extends JavaPlugin { - private String WEB_CONFIG = "webServer"; - @Override public void onEnable() { - getConfig().addDefault(WEB_CONFIG, "http://accounts.mineplex.com/"); - getConfig().set(WEB_CONFIG, getConfig().getString(WEB_CONFIG)); + getConfig().addDefault(Constants.WEB_CONFIG_KEY, Constants.WEB_ADDRESS); + getConfig().set(Constants.WEB_CONFIG_KEY, getConfig().getString(Constants.WEB_CONFIG_KEY)); saveConfig(); - - String webServerAddress = getConfig().getString(WEB_CONFIG); - + //Static Modules CommandCenter.Initialize(this); - CoreClientManager clientManager = new CoreClientManager(this, webServerAddress, Rank.DEVELOPER); + CoreClientManager clientManager = new CoreClientManager(this, Rank.DEVELOPER); CommandCenter.Instance.setClientManager(clientManager); Recharge.Initialize(this); - DonationManager donationManager = new DonationManager(this, clientManager, webServerAddress); + DonationManager donationManager = require(DonationManager.class); - Punish punish = new Punish(this, webServerAddress, clientManager); + Punish punish = new Punish(this, clientManager); new NpcManager(this, new Creature(this)); ServerStatusManager serverStatusManager = new ServerStatusManager(this, clientManager, new LagMeter(this, clientManager)); PreferencesManager preferenceManager = new PreferencesManager(this, null, clientManager); preferenceManager.GiveItem = false; - Portal portal = new Portal(this, clientManager, serverStatusManager.getCurrentServerName()); + Portal portal = new Portal(); EloManager eloManager = new EloManager(this, clientManager); StatsManager statsManager = new StatsManager(this, clientManager); new Chat(this, null, clientManager, preferenceManager, new AchievementManager(statsManager, clientManager, donationManager, null, eloManager), serverStatusManager.getCurrentServerName()); new MemoryFix(this); - new FileUpdater(this, portal, serverStatusManager.getCurrentServerName(), serverStatusManager.getRegion()); + new FileUpdater(this, portal, serverStatusManager.getCurrentServerName(), serverStatusManager.getRegion(), GenericServer.HUB); require(PacketHandler.class); require(DisguiseManager.class); @@ -90,17 +91,16 @@ public class StaffServer extends JavaPlugin ((CraftServer)getServer()).getHandle().addWhitelist(new GameProfile(UUID.fromString("377bdea3-badc-448d-81c1-65db43b17ea4"), "Strutt20")); ((CraftServer)getServer()).getHandle().addWhitelist(new GameProfile(UUID.fromString("cf1b629c-cc55-4eb4-be9e-3ca86dfc7b9d"), "mannalou")); - ((CraftServer)getServer()).getHandle().addWhitelist(new GameProfile(UUID.fromString("adaa7613-6683-400f-baf8-7272c04b2cb4"), "Timmy48081_")); + ((CraftServer)getServer()).getHandle().addWhitelist(new GameProfile(UUID.fromString("adaa7613-6683-400f-baf8-7272c04b2cb4"), "Tmmy")); ((CraftServer)getServer()).getHandle().addWhitelist(new GameProfile(UUID.fromString("231fb752-9556-489b-8428-f47c7598e061"), "Nuclear_Poptart")); - ((CraftServer)getServer()).getHandle().addWhitelist(new GameProfile(UUID.fromString("efaf9a17-2304-4f42-8433-421523c308dc"), "B2_mp")); ((CraftServer)getServer()).getHandle().addWhitelist(new GameProfile(UUID.fromString("492ff708-fe76-4c5a-b9ed-a747b5fa20a0"), "Cherdy8s")); ((CraftServer)getServer()).getHandle().addWhitelist(new GameProfile(UUID.fromString("6edf17d5-6bb2-4ed9-92e9-bed8e96fff68"), "BlueBeetleHD")); ((CraftServer)getServer()).getHandle().addWhitelist(new GameProfile(UUID.fromString("a47a4d04-9f51-44ba-9d35-8de6053e9289"), "AlexTheCoder")); - + ((CraftServer)getServer()).getHandle().addWhitelist(new GameProfile(UUID.fromString("63ad2db3-7c62-4a10-ac58-d267973190ce"), "Crumplex")); + ((CraftServer)getServer()).getHandle().addOp(new GameProfile(UUID.fromString("cf1b629c-cc55-4eb4-be9e-3ca86dfc7b9d"), "mannalou")); ((CraftServer)getServer()).getHandle().addOp(new GameProfile(UUID.fromString("377bdea3-badc-448d-81c1-65db43b17ea4"), "Strutt20")); - ((CraftServer)getServer()).getHandle().addOp(new GameProfile(UUID.fromString("efaf9a17-2304-4f42-8433-421523c308dc"), "B2_mp")); - ((CraftServer)getServer()).getHandle().addOp(new GameProfile(UUID.fromString("6edf17d5-6bb2-4ed9-92e9-bed8e96fff68"), "BlueBeetleHD")); + ((CraftServer)getServer()).getHandle().addOp(new GameProfile(UUID.fromString("6edf17d5-6bb2-4ed9-92e9-bed8e96fff68"), "BlueBeetleHD")); require(ProfileCacheManager.class); } diff --git a/Plugins/Mineplex.StaffServer/src/mineplex/staffServer/customerSupport/CustomerSupport.java b/Plugins/Mineplex.StaffServer/src/mineplex/staffServer/customerSupport/CustomerSupport.java index 8c5ee0d7c..41e6239be 100644 --- a/Plugins/Mineplex.StaffServer/src/mineplex/staffServer/customerSupport/CustomerSupport.java +++ b/Plugins/Mineplex.StaffServer/src/mineplex/staffServer/customerSupport/CustomerSupport.java @@ -10,6 +10,7 @@ import java.util.HashSet; import java.util.List; import java.util.Locale; import java.util.UUID; +import java.util.concurrent.ExecutionException; import org.bukkit.Bukkit; import org.bukkit.GameMode; @@ -139,10 +140,12 @@ public class CustomerSupport extends MiniPlugin implements ResultSetCallable 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 + "Shards: " + C.cYellow + donor.getBalance(GlobalCurrency.TREASURE_SHARD)); - caller.sendMessage(C.cBlue + "Gems: " + C.cYellow + donor.getBalance(GlobalCurrency.GEM)); + StringBuilder basic = new StringBuilder(C.cBlue + "Name: " + C.cYellow + playerName); + basic.append(" "); + basic.append(C.cBlue + "Rank: " + C.cYellow + (client.GetRank() == null ? C.cRed + "Error rank null!" : (client.GetRank().Name.isEmpty() ? "Regular" : client.GetRank().Name))); + basic.append(" "); + basic.append(C.cBlue + "Gems: " + C.cYellow + donor.getBalance(GlobalCurrency.GEM)); + caller.sendMessage(basic.toString()); int enjinCoinsReceived = 0; int oldChestsReceived = 0; @@ -159,6 +162,10 @@ public class CustomerSupport extends MiniPlugin implements ResultSetCallable int hauntedChestsReceived = 0; int hauntedChestsOpened = 0; int trickOrTreatChestsReceived = 0; + int thankfulChestsReceived = 0; + int gingerbreadChestsReceived = 0; + int minestrikeChestsReceived = 0; + int loveChestsReceived = 0; for (CoinTransactionToken transaction : donor.getCoinTransactions()) { @@ -270,6 +277,48 @@ public class CustomerSupport extends MiniPlugin implements ResultSetCallable } } + if (transaction.SalesPackageName.startsWith("Thankful Chest")) + { + if (transaction.Coins == 0 && transaction.Gems == 0) + { + if (transaction.SalesPackageName.split(" ").length == 3) + thankfulChestsReceived += Integer.parseInt(transaction.SalesPackageName.split(" ")[2]); + else if (transaction.SalesPackageName.split(" ").length == 2) + thankfulChestsReceived += 1; + } + + } + if (transaction.SalesPackageName.startsWith("Gingerbread Chest")) + { + if (transaction.Coins == 0 && transaction.Gems == 0) + { + if (transaction.SalesPackageName.split(" ").length == 3) + gingerbreadChestsReceived += Integer.parseInt(transaction.SalesPackageName.split(" ")[2]); + else if (transaction.SalesPackageName.split(" ").length == 2) + gingerbreadChestsReceived += 1; + } + + } + if (transaction.SalesPackageName.startsWith("Minestrike Chest")) + { + if (transaction.Coins == 0 && transaction.Gems == 0) + { + if (transaction.SalesPackageName.split(" ").length == 3) + minestrikeChestsReceived += Integer.parseInt(transaction.SalesPackageName.split(" ")[2]); + else if (transaction.SalesPackageName.split(" ").length == 2) + minestrikeChestsReceived += 1; + } + } + if (transaction.SalesPackageName.startsWith("Love Chest")) + { + if (transaction.Coins == 0 && transaction.Gems == 0) + { + if (transaction.SalesPackageName.split(" ").length == 3) + loveChestsReceived += Integer.parseInt(transaction.SalesPackageName.split(" ")[2]); + else if (transaction.SalesPackageName.split(" ").length == 2) + loveChestsReceived += 1; + } + } if (transaction.SalesPackageName.startsWith("Valentines Gift")) { if (transaction.Coins == 0 && transaction.Gems == 0) @@ -318,30 +367,41 @@ public class CustomerSupport extends MiniPlugin implements ResultSetCallable { try { - PlayerStats playerStats = statsManager.getOfflinePlayerStats(playerName); + PlayerStats playerStats = statsManager.getOfflinePlayerStats(playerName).get(); if (playerStats != null) { hauntedChestsOpened = (int) playerStats.getStat("Global.Treasure.Haunted"); } - } catch (SQLException e) + } + catch (InterruptedException | ExecutionException e) { e.printStackTrace(); } } - + + StringBuilder shards = new StringBuilder(C.cBlue + "Enjin Shard Total Received: " + C.cYellow + enjinCoinsReceived); + shards.append(" "); + shards.append(C.cBlue + "Shards: " + C.cYellow + donor.getBalance(GlobalCurrency.TREASURE_SHARD)); + caller.sendMessage(shards.toString()); // Strutt20 asked me to remove some stuff from the menu - caller.sendMessage(C.cBlue + "Enjin Shard 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 + "Illuminated Chests Received: " + C.cYellow + illuminatedChestsReceived); + caller.sendMessage(C.cBlue + "Old Chests Received: " + C.cYellow + oldChestsReceived + " " + C.cBlue + "Ancient Chests Received: " + C.cYellow + ancientChestsReceived); + caller.sendMessage(C.cBlue + "Mythical Chests Received: " + C.cYellow + mythicalChestsReceived + " " + C.cBlue + "Illuminated Chests Received: " + C.cYellow + illuminatedChestsReceived); caller.sendMessage(C.cBlue + "Omega Chests Received: " + C.cYellow + omegaChestsReceived); - caller.sendMessage(C.cBlue + "Haunted Chests Received: " + C.cYellow + hauntedChestsReceived); - caller.sendMessage(C.cBlue + "Haunted Chests Opened: " + C.cYellow + hauntedChestsOpened); - caller.sendMessage(C.cBlue + "Trick or Treat Chests Received: " + C.cYellow + trickOrTreatChestsReceived); + caller.sendMessage(C.cBlue + "Haunted Chests Received: " + C.cYellow + hauntedChestsReceived + " " + C.cBlue + "Haunted Chests Opened: " + C.cYellow + hauntedChestsOpened); + caller.sendMessage(C.cBlue + "Trick or Treat Chests Received: " + C.cYellow + trickOrTreatChestsReceived + " " + C.cBlue + "Thankful Chests Received: " + C.cYellow + thankfulChestsReceived); + caller.sendMessage(C.cBlue + "Gingerbread Chests Received: " + C.cYellow + gingerbreadChestsReceived + " " + C.cBlue + "Minestrike Chests Received: " + C.cYellow + minestrikeChestsReceived); + caller.sendMessage(C.cBlue + "Love Chests Received: " + C.cYellow + loveChestsReceived); caller.sendMessage(C.cBlue + "Game Amplifiers Received: " + C.cYellow + boostersReceived); - caller.sendMessage(C.cBlue + "Rune Amplifiers (20 min) Received: " + C.cYellow + runeAmplifier20); - caller.sendMessage(C.cBlue + "Rune Amplifiers (60 min) Received: " + C.cYellow + runeAmplifier60); + caller.sendMessage(C.cBlue + "Rune Amplifiers (20 min/60 min) Received: " + C.cYellow + runeAmplifier20 + "/" + runeAmplifier60); + caller.sendMessage(C.cBlue + "Clan Banner Usage: " + getLockedFreedomStr(client.getUniqueId(), "Clan Banner Usage") + " " + C.cBlue + "Clan Banner Editor: " + getLockedFreedomStr(client.getUniqueId(), "Clan Banner Editor")); + YearMonth yearMonth = YearMonth.now(); + caller.sendMessage(C.cBlue + "Power Play Subscription (" + yearMonth.getMonth().getDisplayName(TextStyle.FULL, Locale.US) + ") " + (powerPlayData.isSubscribed() ? C.cGreen + "Active" : C.cRed + "Inactive")); + if (powerPlayData.isSubscribed()) + { + caller.sendMessage(C.cBlue + "Power Play Chest/Amplifiers (" + yearMonth.getMonth().getDisplayName(TextStyle.FULL, Locale.US) + ") " + (powerPlayData.getUnclaimedMonths().contains(YearMonth.now()) ? C.cGreen + "Unclaimed" : C.cRed + "Claimed")); + LocalDate nextClaimDate = powerPlayData.getNextClaimDate().get(); // Guaranteed by isSubscribed() + caller.sendMessage(C.cBlue + "Power Play Next Claim Date " + C.cYellow + nextClaimDate.getMonth().getDisplayName(TextStyle.FULL, Locale.US) + " " + nextClaimDate.getDayOfMonth()); + } caller.sendMessage(C.cBlue + "Monthly Bonus Log (Last 6 entries):"); if (_accountBonusLog.containsKey(client.getAccountId())) @@ -354,19 +414,6 @@ public class CustomerSupport extends MiniPlugin implements ResultSetCallable caller.sendMessage(C.cDGreen + C.Strike + "============================================="); _salesPackageManager.displaySalesPackages(caller, playerName); - caller.sendMessage(C.cDGreen + C.Strike + "============================================="); - caller.sendMessage(C.cBlue + "Clan Banner Usage: " + getLockedFreedomStr(client.getUniqueId(), "Clan Banner Usage")); - caller.sendMessage(C.cBlue + "Clan Banner Editor: " + getLockedFreedomStr(client.getUniqueId(), "Clan Banner Editor")); - caller.sendMessage(C.cDGreen + C.Strike + "============================================="); - YearMonth yearMonth = YearMonth.now(); - caller.sendMessage(C.cBlue + "Power Play Subscription (" + yearMonth.getMonth().getDisplayName(TextStyle.FULL, Locale.US) + ") " + (powerPlayData.isSubscribed() ? C.cGreen + "Active" : C.cRed + "Inactive")); - if (powerPlayData.isSubscribed()) - { - caller.sendMessage(C.cBlue + "Power Play Chest/Amplifiers (" + yearMonth.getMonth().getDisplayName(TextStyle.FULL, Locale.US) + ") " + (powerPlayData.getUnclaimedMonths().contains(YearMonth.now()) ? C.cGreen + "Unclaimed" : C.cRed + "Claimed")); - LocalDate nextClaimDate = powerPlayData.getNextClaimDate().get(); // Guaranteed by isSubscribed() - caller.sendMessage(C.cBlue + "Power Play Next Claim Date " + C.cYellow + nextClaimDate.getMonth().getDisplayName(TextStyle.FULL, Locale.US) + " " + nextClaimDate.getDayOfMonth()); - } - _accountBonusLog.remove(client.getAccountId()); } }); @@ -450,7 +497,7 @@ public class CustomerSupport extends MiniPlugin implements ResultSetCallable private String getLockedFreedomStr(UUID uuid, String name) { - if (_donationManager.Get(uuid).OwnsUnknownPackage(name)) + if (_donationManager.Get(uuid).ownsUnknownSalesPackage(name)) { return C.cGreen + C.Bold + "Unlocked"; } diff --git a/Plugins/Mineplex.StaffServer/src/mineplex/staffServer/customerSupport/CustomerSupportRepository.java b/Plugins/Mineplex.StaffServer/src/mineplex/staffServer/customerSupport/CustomerSupportRepository.java index 877a4c71d..286c3ac9c 100644 --- a/Plugins/Mineplex.StaffServer/src/mineplex/staffServer/customerSupport/CustomerSupportRepository.java +++ b/Plugins/Mineplex.StaffServer/src/mineplex/staffServer/customerSupport/CustomerSupportRepository.java @@ -4,19 +4,14 @@ import org.bukkit.plugin.java.JavaPlugin; import mineplex.core.database.MinecraftRepository; import mineplex.serverdata.database.DBPool; +import mineplex.serverdata.database.RepositoryBase; -public class CustomerSupportRepository extends MinecraftRepository +public class CustomerSupportRepository extends RepositoryBase { public CustomerSupportRepository(JavaPlugin plugin) { - super(plugin, DBPool.getAccount()); + super(DBPool.getAccount()); } - - @Override - protected void initialize() { } - - @Override - protected void update() { } public void loadBonusLogForAccountId(int accountId, CustomerSupport customerSupport) { diff --git a/Plugins/Mineplex.StaffServer/src/mineplex/staffServer/password/PasswordRepository.java b/Plugins/Mineplex.StaffServer/src/mineplex/staffServer/password/PasswordRepository.java index 07fa746c1..b3d1986f1 100644 --- a/Plugins/Mineplex.StaffServer/src/mineplex/staffServer/password/PasswordRepository.java +++ b/Plugins/Mineplex.StaffServer/src/mineplex/staffServer/password/PasswordRepository.java @@ -13,7 +13,7 @@ import mineplex.serverdata.database.RepositoryBase; import mineplex.serverdata.database.ResultSetCallable; import mineplex.serverdata.database.column.ColumnVarChar; -public class PasswordRepository extends MinecraftRepository +public class PasswordRepository extends RepositoryBase { private static String CREATE_SERVER_PASSWORD_TABLE = "CREATE TABLE IF NOT EXISTS serverPassword (id INT NOT NULL AUTO_INCREMENT, server VARCHAR(100), password VARCHAR(100), PRIMARY KEY (id));"; private static String RETRIEVE_SERVER_PASSWORD = "SELECT password FROM serverPassword WHERE server = ?;"; @@ -25,21 +25,10 @@ public class PasswordRepository extends MinecraftRepository public PasswordRepository(JavaPlugin plugin, String serverName) { - super(plugin, DBPool.getAccount()); + super(DBPool.getAccount()); _serverName = serverName; } - @Override - protected void initialize() - { - //executeUpdate(CREATE_SERVER_PASSWORD_TABLE); - } - - @Override - protected void update() - { - } - public String retrievePassword() { final List passwords = new ArrayList(); diff --git a/Plugins/Mineplex.StaffServer/src/mineplex/staffServer/salespackage/SalesPackageManager.java b/Plugins/Mineplex.StaffServer/src/mineplex/staffServer/salespackage/SalesPackageManager.java index 1edf932ea..a8ac55cf0 100644 --- a/Plugins/Mineplex.StaffServer/src/mineplex/staffServer/salespackage/SalesPackageManager.java +++ b/Plugins/Mineplex.StaffServer/src/mineplex/staffServer/salespackage/SalesPackageManager.java @@ -22,12 +22,16 @@ import mineplex.staffServer.salespackage.salespackages.ClanBannerUsage; import mineplex.staffServer.salespackage.salespackages.Coins; import mineplex.staffServer.salespackage.salespackages.DefaultRank; import mineplex.staffServer.salespackage.salespackages.FreedomChest; +import mineplex.staffServer.salespackage.salespackages.GingerbreadChest; import mineplex.staffServer.salespackage.salespackages.HauntedChest; import mineplex.staffServer.salespackage.salespackages.IlluminatedChest; +import mineplex.staffServer.salespackage.salespackages.LifetimeEternal; import mineplex.staffServer.salespackage.salespackages.LifetimeHero; import mineplex.staffServer.salespackage.salespackages.LifetimeLegend; import mineplex.staffServer.salespackage.salespackages.LifetimeTitan; import mineplex.staffServer.salespackage.salespackages.LifetimeUltra; +import mineplex.staffServer.salespackage.salespackages.LoveChest; +import mineplex.staffServer.salespackage.salespackages.MinestrikeChest; import mineplex.staffServer.salespackage.salespackages.MythicalChest; import mineplex.staffServer.salespackage.salespackages.OldChest; import mineplex.staffServer.salespackage.salespackages.OmegaChest; @@ -35,6 +39,7 @@ import mineplex.staffServer.salespackage.salespackages.Pet; import mineplex.staffServer.salespackage.salespackages.PowerPlayClub; import mineplex.staffServer.salespackage.salespackages.RuneAmplifier; import mineplex.staffServer.salespackage.salespackages.SalesPackageBase; +import mineplex.staffServer.salespackage.salespackages.ThankfulChest; import mineplex.staffServer.salespackage.salespackages.TrickOrTreatChest; public class SalesPackageManager extends MiniPlugin @@ -58,7 +63,7 @@ public class SalesPackageManager extends MiniPlugin _statsManager = statsManager; _powerPlayRepo = powerPlayRepo; - _petRepo = new PetRepository(plugin, plugin.getConfig().getString("webServer")); + _petRepo = new PetRepository(); //Strutt20 asked me to remove some of the stuff from the menu @@ -72,6 +77,7 @@ public class SalesPackageManager extends MiniPlugin AddSalesPackage(new LifetimeHero(this)); AddSalesPackage(new LifetimeLegend(this)); AddSalesPackage(new LifetimeTitan(this)); + AddSalesPackage(new LifetimeEternal(this)); //AddSalesPackage(new GemHunter(this, 4)); //AddSalesPackage(new GemHunter(this, 8)); AddSalesPackage(new ApplyKits(this)); @@ -80,6 +86,7 @@ public class SalesPackageManager extends MiniPlugin AddSalesPackage(new MythicalChest(this)); AddSalesPackage(new IlluminatedChest(this)); AddSalesPackage(new FreedomChest(this)); + AddSalesPackage(new GingerbreadChest(this)); //AddSalesPackage(new ValentinesGift(this)); //AddSalesPackage(new FrostLord(this)); //AddSalesPackage(new EasterBunny(this)); @@ -91,7 +98,10 @@ public class SalesPackageManager extends MiniPlugin AddSalesPackage(new PowerPlayClub(this, true)); AddSalesPackage(new OmegaChest(this)); AddSalesPackage(new HauntedChest(this)); + AddSalesPackage(new MinestrikeChest(this)); + AddSalesPackage(new LoveChest(this)); AddSalesPackage(new TrickOrTreatChest(this)); + AddSalesPackage(new ThankfulChest(this)); for (PetType petType : PetType.values()) { @@ -160,7 +170,8 @@ public class SalesPackageManager extends MiniPlugin { coinBuilder = coinBuilder.extra("[").color("gray").extra(salesPackage.getName()).color("green").click("run_command", "/display " + playerName + " " + salesPackage.getName()).extra("] ").color("gray"); } - else if (salesPackage instanceof MythicalChest || salesPackage instanceof AncientChest || salesPackage instanceof OldChest || salesPackage instanceof IlluminatedChest || salesPackage instanceof FreedomChest || salesPackage instanceof HauntedChest || salesPackage instanceof TrickOrTreatChest) + else if (salesPackage instanceof MythicalChest || salesPackage instanceof AncientChest || salesPackage instanceof OldChest || salesPackage instanceof IlluminatedChest || salesPackage instanceof FreedomChest || salesPackage instanceof HauntedChest || salesPackage instanceof TrickOrTreatChest + || salesPackage instanceof ThankfulChest || salesPackage instanceof GingerbreadChest || salesPackage instanceof MinestrikeChest || salesPackage instanceof LoveChest) { chestBuilder = chestBuilder.extra("[").color("gray").extra(salesPackage.getName()).color("green").click("run_command", "/display " + playerName + " " + salesPackage.getName()).extra("] ").color("gray"); } diff --git a/Plugins/Mineplex.StaffServer/src/mineplex/staffServer/salespackage/command/CoinCommand.java b/Plugins/Mineplex.StaffServer/src/mineplex/staffServer/salespackage/command/CoinCommand.java index f4d3cca6f..48a56f825 100644 --- a/Plugins/Mineplex.StaffServer/src/mineplex/staffServer/salespackage/command/CoinCommand.java +++ b/Plugins/Mineplex.StaffServer/src/mineplex/staffServer/salespackage/command/CoinCommand.java @@ -7,6 +7,7 @@ import org.bukkit.entity.Player; import mineplex.core.account.CoreClient; import mineplex.core.command.CommandBase; import mineplex.core.common.Rank; +import mineplex.core.common.currency.GlobalCurrency; import mineplex.core.common.util.Callback; import mineplex.core.common.util.F; import mineplex.core.common.util.UUIDFetcher; @@ -29,11 +30,11 @@ public class CoinCommand extends CommandBase final String playerName = args[0]; final int amount = Integer.parseInt(args[1]); - Plugin.getClientManager().loadClientByName(playerName, client -> + Plugin.getClientManager().getOrLoadClient(playerName, client -> { if (client != null) { - Plugin.getDonationManager().RewardCoins(completed -> + Plugin.getDonationManager().rewardCurrency(GlobalCurrency.TREASURE_SHARD, client, caller.getName(), amount, completed -> { if (completed) { @@ -43,7 +44,7 @@ public class CoinCommand extends CommandBase { UtilPlayer.message(caller, F.main(Plugin.getName(), "There was an error giving " + F.elem(amount + "Shards") + " to " + F.name(playerName) + ".")); } - }, caller.getName(), playerName, client.getAccountId(), amount); + }); } else caller.sendMessage(F.main(Plugin.getName(), "Couldn't find " + playerName + "'s account!")); diff --git a/Plugins/Mineplex.StaffServer/src/mineplex/staffServer/salespackage/command/GemHunterCommand.java b/Plugins/Mineplex.StaffServer/src/mineplex/staffServer/salespackage/command/GemHunterCommand.java index f77065d03..877e81be4 100644 --- a/Plugins/Mineplex.StaffServer/src/mineplex/staffServer/salespackage/command/GemHunterCommand.java +++ b/Plugins/Mineplex.StaffServer/src/mineplex/staffServer/salespackage/command/GemHunterCommand.java @@ -1,6 +1,5 @@ package mineplex.staffServer.salespackage.command; -import mineplex.core.account.CoreClient; import mineplex.core.command.CommandBase; import mineplex.core.common.Rank; import mineplex.core.common.currency.GlobalCurrency; @@ -36,7 +35,7 @@ public class GemHunterCommand extends CommandBase { if (client != null) { - Plugin.getDonationManager().PurchaseUnknownSalesPackage(null, playerName, client.getAccountId(), "Gem Hunter Level " + amount, GlobalCurrency.GEM, 0, false); + Plugin.getDonationManager().purchaseUnknownSalesPackage(client, "Gem Hunter Level " + amount, GlobalCurrency.GEM, 0, false, null); Plugin.getStatsManager().incrementStat(client.getAccountId(), "Global.GemsEarned", experience); caller.sendMessage(F.main(Plugin.getName(), "Added Level " + amount + " Gem Hunter to " + playerName + "'s account!")); } diff --git a/Plugins/Mineplex.StaffServer/src/mineplex/staffServer/salespackage/command/ItemCommand.java b/Plugins/Mineplex.StaffServer/src/mineplex/staffServer/salespackage/command/ItemCommand.java index 1efa6afbe..3c3f64728 100644 --- a/Plugins/Mineplex.StaffServer/src/mineplex/staffServer/salespackage/command/ItemCommand.java +++ b/Plugins/Mineplex.StaffServer/src/mineplex/staffServer/salespackage/command/ItemCommand.java @@ -1,6 +1,5 @@ package mineplex.staffServer.salespackage.command; -import mineplex.core.account.CoreClient; import mineplex.core.command.CommandBase; import mineplex.core.common.Rank; import mineplex.core.common.currency.GlobalCurrency; @@ -9,6 +8,7 @@ import mineplex.core.common.util.F; import mineplex.core.common.util.UtilPlayer; import mineplex.core.server.util.TransactionResponse; import mineplex.staffServer.salespackage.SalesPackageManager; + import org.bukkit.entity.Player; import java.util.UUID; @@ -51,40 +51,37 @@ public class ItemCommand extends CommandBase if (uuid != null) { - Plugin.getDonationManager().PurchaseUnknownSalesPackage(new Callback() + Plugin.getDonationManager().purchaseUnknownSalesPackage(client, (amount == 1 ? itemName : itemName + " " + amount), GlobalCurrency.GEM, 0, false, data -> { - public void run(TransactionResponse data) + if (category.equalsIgnoreCase("ITEM")) { - if (category.equalsIgnoreCase("ITEM")) + Plugin.getInventoryManager().addItemToInventoryForOffline(new Callback() { - Plugin.getInventoryManager().addItemToInventoryForOffline(new Callback() + public void run(Boolean success) { - public void run(Boolean success) + if (success) { - if (success) - { - UtilPlayer.message(caller, F.main(Plugin.getName(), playerName + " received " + amount + " " + itemName + ".")); - } - else - { - UtilPlayer.message(caller, F.main(Plugin.getName(), "ERROR processing " + playerName + " " + amount + " " + itemName + ".")); - } + UtilPlayer.message(caller, F.main(Plugin.getName(), playerName + " received " + amount + " " + itemName + ".")); } - }, uuid, itemName, amount); - } - else + else + { + UtilPlayer.message(caller, F.main(Plugin.getName(), "ERROR processing " + playerName + " " + amount + " " + itemName + ".")); + } + } + }, uuid, itemName, amount); + } + else + { + if (data == TransactionResponse.Success || data == TransactionResponse.AlreadyOwns) { - if (data == TransactionResponse.Success || data == TransactionResponse.AlreadyOwns) - { - UtilPlayer.message(caller, F.main(Plugin.getName(), playerName + " received " + amount + " " + itemName + ".")); - } - else if (data == TransactionResponse.Failed || data == TransactionResponse.InsufficientFunds) - { - UtilPlayer.message(caller, F.main(Plugin.getName(), "ERROR processing " + playerName + " " + amount + " " + itemName + ".")); - } + UtilPlayer.message(caller, F.main(Plugin.getName(), playerName + " received " + amount + " " + itemName + ".")); + } + else if (data == TransactionResponse.Failed || data == TransactionResponse.InsufficientFunds) + { + UtilPlayer.message(caller, F.main(Plugin.getName(), "ERROR processing " + playerName + " " + amount + " " + itemName + ".")); } } - }, playerName, client.getAccountId(), (amount == 1 ? itemName : itemName + " " + amount), GlobalCurrency.GEM, 0, false); + }); } else caller.sendMessage(F.main(Plugin.getName(), "Couldn't find " + playerName + "'s account!")); diff --git a/Plugins/Mineplex.StaffServer/src/mineplex/staffServer/salespackage/command/LifetimeEternalCommand.java b/Plugins/Mineplex.StaffServer/src/mineplex/staffServer/salespackage/command/LifetimeEternalCommand.java new file mode 100644 index 000000000..9f2437ddc --- /dev/null +++ b/Plugins/Mineplex.StaffServer/src/mineplex/staffServer/salespackage/command/LifetimeEternalCommand.java @@ -0,0 +1,33 @@ +package mineplex.staffServer.salespackage.command; + +import org.bukkit.Bukkit; +import org.bukkit.entity.Player; +import org.bukkit.event.player.PlayerCommandPreprocessEvent; + +import mineplex.core.command.CommandBase; +import mineplex.core.common.Rank; +import mineplex.staffServer.salespackage.SalesPackageManager; + +public class LifetimeEternalCommand extends CommandBase +{ + public LifetimeEternalCommand(SalesPackageManager plugin) + { + super(plugin, Rank.MODERATOR, "lifetimeeternal"); + } + + @Override + public void Execute(Player caller, String[] args) + { + resetCommandCharge(caller); + Bukkit.getServer().getPluginManager().callEvent(new PlayerCommandPreprocessEvent(caller, "/sales rank " + args[0] + " ETERNAL true")); + + resetCommandCharge(caller); + Bukkit.getServer().getPluginManager().callEvent(new PlayerCommandPreprocessEvent(caller, "/sales item " + args[0] + " 2 Item Mythical Chest")); + + resetCommandCharge(caller); + Bukkit.getServer().getPluginManager().callEvent(new PlayerCommandPreprocessEvent(caller, "/sales item " + args[0] + " 2 Item Illuminated Chest")); + + resetCommandCharge(caller); + Bukkit.getServer().getPluginManager().callEvent(new PlayerCommandPreprocessEvent(caller, "/sales item " + args[0] + " 1 Item Omega Chest")); + } +} \ No newline at end of file diff --git a/Plugins/Mineplex.StaffServer/src/mineplex/staffServer/salespackage/command/RankCommand.java b/Plugins/Mineplex.StaffServer/src/mineplex/staffServer/salespackage/command/RankCommand.java index 21fad01ea..d46ae258e 100644 --- a/Plugins/Mineplex.StaffServer/src/mineplex/staffServer/salespackage/command/RankCommand.java +++ b/Plugins/Mineplex.StaffServer/src/mineplex/staffServer/salespackage/command/RankCommand.java @@ -34,7 +34,7 @@ public class RankCommand extends CommandBase final Rank rankEnum = Rank.valueOf(rank); - if (rankEnum == Rank.HERO || rankEnum == Rank.ULTRA || rankEnum == Rank.LEGEND || rankEnum == Rank.TITAN || rankEnum == Rank.ALL) + if (rankEnum == Rank.HERO || rankEnum == Rank.ULTRA || rankEnum == Rank.LEGEND || rankEnum == Rank.TITAN || rankEnum == Rank.ETERNAL || rankEnum == Rank.ALL) { Plugin.getClientManager().SaveRank(playerName, uuid, mineplex.core.common.Rank.valueOf(rank), perm); caller.sendMessage(F.main(Plugin.getName(), playerName + "'s rank has been updated to " + rank + "!")); diff --git a/Plugins/Mineplex.StaffServer/src/mineplex/staffServer/salespackage/command/Sales.java b/Plugins/Mineplex.StaffServer/src/mineplex/staffServer/salespackage/command/Sales.java index 40040e1d0..565f61ced 100644 --- a/Plugins/Mineplex.StaffServer/src/mineplex/staffServer/salespackage/command/Sales.java +++ b/Plugins/Mineplex.StaffServer/src/mineplex/staffServer/salespackage/command/Sales.java @@ -22,6 +22,7 @@ public class Sales extends MultiCommandBase AddCommand(new LifetimeHeroCommand(plugin)); AddCommand(new LifetimeLegendCommand(plugin)); AddCommand(new LifetimeTitanCommand(plugin)); + AddCommand(new LifetimeEternalCommand(plugin)); AddCommand(new KitsCommand(plugin)); AddCommand(new PowerPlayCommand(plugin)); AddCommand(new PetCommand(plugin)); diff --git a/Plugins/Mineplex.StaffServer/src/mineplex/staffServer/salespackage/salespackages/GingerbreadChest.java b/Plugins/Mineplex.StaffServer/src/mineplex/staffServer/salespackage/salespackages/GingerbreadChest.java new file mode 100644 index 000000000..c016dcfe1 --- /dev/null +++ b/Plugins/Mineplex.StaffServer/src/mineplex/staffServer/salespackage/salespackages/GingerbreadChest.java @@ -0,0 +1,22 @@ +package mineplex.staffServer.salespackage.salespackages; + +import org.bukkit.entity.Player; + +import mineplex.staffServer.salespackage.SalesPackageManager; + +public class GingerbreadChest extends SalesPackageBase +{ + + public GingerbreadChest(SalesPackageManager manager) + { + super(manager, "1 Gingerbread Chest"); + } + + public void displayToAgent(Player agent, String playerName) + { + addButton(agent, "/sales item " + playerName + " 1 Item Gingerbread Chest", "Give 1 Gingerbread Chest."); + agent.sendMessage(" "); + addBackButton(agent, playerName); + } + +} diff --git a/Plugins/Mineplex.StaffServer/src/mineplex/staffServer/salespackage/salespackages/LifetimeEternal.java b/Plugins/Mineplex.StaffServer/src/mineplex/staffServer/salespackage/salespackages/LifetimeEternal.java new file mode 100644 index 000000000..a8148e67b --- /dev/null +++ b/Plugins/Mineplex.StaffServer/src/mineplex/staffServer/salespackage/salespackages/LifetimeEternal.java @@ -0,0 +1,24 @@ +package mineplex.staffServer.salespackage.salespackages; + +import mineplex.staffServer.salespackage.SalesPackageManager; + +import org.bukkit.entity.Player; + +public class LifetimeEternal extends SalesPackageBase +{ + public LifetimeEternal(SalesPackageManager manager) + { + super(manager, "Lifetime Eternal"); + } + + public void displayToAgent(Player agent, String playerName) + { + addButton(agent, "/sales rank " + playerName + " ETERNAL true", "Lifetime Eternal."); + addButton(agent, "/sales item " + playerName + " 2 Item Mythical Chest", "2 Mythical Chests."); + addButton(agent, "/sales item " + playerName + " 2 Item Illuminated Chest", "2 Illuminated Chests."); + addButton(agent, "/sales item " + playerName + " 1 Item Omega Chest", "1 Omega Chest."); + addButton(agent, "Apply All", "/sales lifetimeeternal " + playerName, "Apply all above."); + agent.sendMessage(" "); + addBackButton(agent, playerName); + } +} diff --git a/Plugins/Mineplex.StaffServer/src/mineplex/staffServer/salespackage/salespackages/LoveChest.java b/Plugins/Mineplex.StaffServer/src/mineplex/staffServer/salespackage/salespackages/LoveChest.java new file mode 100644 index 000000000..f30b159bf --- /dev/null +++ b/Plugins/Mineplex.StaffServer/src/mineplex/staffServer/salespackage/salespackages/LoveChest.java @@ -0,0 +1,20 @@ +package mineplex.staffServer.salespackage.salespackages; + +import org.bukkit.entity.Player; + +import mineplex.staffServer.salespackage.SalesPackageManager; + +public class LoveChest extends SalesPackageBase +{ + public LoveChest(SalesPackageManager manager) + { + super(manager, "1 Love Chest"); + } + + public void displayToAgent(Player agent, String playerName) + { + addButton(agent, "/sales item " + playerName + " 1 Item Love Chest", "Give 1 Love Chest."); + agent.sendMessage(" "); + addBackButton(agent, playerName); + } +} diff --git a/Plugins/Mineplex.StaffServer/src/mineplex/staffServer/salespackage/salespackages/MinestrikeChest.java b/Plugins/Mineplex.StaffServer/src/mineplex/staffServer/salespackage/salespackages/MinestrikeChest.java new file mode 100644 index 000000000..20af53a5d --- /dev/null +++ b/Plugins/Mineplex.StaffServer/src/mineplex/staffServer/salespackage/salespackages/MinestrikeChest.java @@ -0,0 +1,20 @@ +package mineplex.staffServer.salespackage.salespackages; + +import org.bukkit.entity.Player; + +import mineplex.staffServer.salespackage.SalesPackageManager; + +public class MinestrikeChest extends SalesPackageBase +{ + public MinestrikeChest(SalesPackageManager manager) + { + super(manager, "1 Minestrike Chest"); + } + + public void displayToAgent(Player agent, String playerName) + { + addButton(agent, "/sales item " + playerName + " 1 Item Minestrike Chest", "Give 1 Minestrike Chest."); + agent.sendMessage(" "); + addBackButton(agent, playerName); + } +} \ No newline at end of file diff --git a/Plugins/Mineplex.StaffServer/src/mineplex/staffServer/salespackage/salespackages/ThankfulChest.java b/Plugins/Mineplex.StaffServer/src/mineplex/staffServer/salespackage/salespackages/ThankfulChest.java new file mode 100644 index 000000000..037605455 --- /dev/null +++ b/Plugins/Mineplex.StaffServer/src/mineplex/staffServer/salespackage/salespackages/ThankfulChest.java @@ -0,0 +1,19 @@ +package mineplex.staffServer.salespackage.salespackages; + +import mineplex.staffServer.salespackage.SalesPackageManager; +import org.bukkit.entity.Player; + +public class ThankfulChest extends SalesPackageBase +{ + public ThankfulChest(SalesPackageManager manager) + { + super(manager, "1 Thankful Chest"); + } + + public void displayToAgent(Player agent, String playerName) + { + addButton(agent, "/sales item " + playerName + " 1 Item Thankful Chest", "Give 1 Thankful Chest."); + agent.sendMessage(" "); + addBackButton(agent, playerName); + } +} \ No newline at end of file diff --git a/Plugins/Mineplex.Votifier/plugin.yml b/Plugins/Mineplex.Votifier/plugin.yml new file mode 100644 index 000000000..75a40f893 --- /dev/null +++ b/Plugins/Mineplex.Votifier/plugin.yml @@ -0,0 +1,3 @@ +name: MineplexVotifier +main: mineplex.votifier.Votifier +version: 0.1 \ No newline at end of file diff --git a/Plugins/Mineplex.Votifier/pom.xml b/Plugins/Mineplex.Votifier/pom.xml new file mode 100644 index 000000000..23f4e3d0e --- /dev/null +++ b/Plugins/Mineplex.Votifier/pom.xml @@ -0,0 +1,26 @@ + + 4.0.0 + + + com.mineplex + mineplex-plugin + dev-SNAPSHOT + ../plugin.xml + + + MineplexVotifier + mineplex-votifier + + + + ${project.groupId} + mineplex-core + ${project.version} + + + com.vexsoftware + votifier + + + \ No newline at end of file diff --git a/Plugins/Mineplex.Votifier/src/mineplex/votifier/Votifier.java b/Plugins/Mineplex.Votifier/src/mineplex/votifier/Votifier.java new file mode 100644 index 000000000..50ef4dadc --- /dev/null +++ b/Plugins/Mineplex.Votifier/src/mineplex/votifier/Votifier.java @@ -0,0 +1,35 @@ +package mineplex.votifier; + +import org.bukkit.plugin.java.JavaPlugin; + +import mineplex.core.Managers; +import mineplex.core.account.CoreClientManager; +import mineplex.core.bonuses.BonusManager; +import mineplex.core.command.CommandCenter; +import mineplex.core.donation.DonationManager; +import mineplex.core.inventory.InventoryManager; +import mineplex.core.stats.StatsManager; + +public class Votifier extends JavaPlugin +{ + private String WEB_CONFIG = "webServer"; + + @Override + public void onEnable() + { + getConfig().addDefault(WEB_CONFIG, "http://accounts.mineplex.com/"); + getConfig().set(WEB_CONFIG, getConfig().getString(WEB_CONFIG)); + saveConfig(); + + String webServerAddress = getConfig().getString(WEB_CONFIG); + + CommandCenter.Initialize(this); + CoreClientManager clientManager = new CoreClientManager(this); + DonationManager donationManager = Managers.require(DonationManager.class); + BonusManager bonusManager = new BonusManager(this, clientManager, donationManager); + InventoryManager inventoryManager = new InventoryManager(this, clientManager); + StatsManager statsManager = new StatsManager(this, clientManager); + + VotifierManager vote = new VotifierManager(this, clientManager, donationManager, bonusManager, inventoryManager, statsManager); + } +} \ No newline at end of file diff --git a/Plugins/Mineplex.Votifier/src/mineplex/votifier/VotifierManager.java b/Plugins/Mineplex.Votifier/src/mineplex/votifier/VotifierManager.java new file mode 100644 index 000000000..2bb683ac8 --- /dev/null +++ b/Plugins/Mineplex.Votifier/src/mineplex/votifier/VotifierManager.java @@ -0,0 +1,409 @@ +package mineplex.votifier; + +import java.io.File; +import java.io.IOException; +import java.sql.Date; +import java.util.HashSet; +import java.util.Set; +import java.util.UUID; + +import org.bukkit.event.EventHandler; +import org.bukkit.plugin.java.JavaPlugin; +import org.jooq.DSLContext; +import org.jooq.Record1; +import org.jooq.SQLDialect; +import org.jooq.impl.DSL; + +import com.vexsoftware.votifier.model.Vote; +import com.vexsoftware.votifier.model.VotifierEvent; + +import mineplex.core.MiniPlugin; +import mineplex.core.account.CoreClientManager; +import mineplex.core.bonuses.BonusAmount; +import mineplex.core.bonuses.BonusManager; +import mineplex.core.bonuses.redis.VotifierCommand; +import mineplex.core.common.Pair; +import mineplex.core.common.currency.GlobalCurrency; +import mineplex.core.common.util.Callback; +import mineplex.core.common.util.UUIDFetcher; +import mineplex.core.donation.DonationManager; +import mineplex.core.inventory.InventoryManager; +import mineplex.core.stats.StatsManager; +import mineplex.core.treasure.TreasureType; +import mineplex.database.Tables; +import mineplex.database.tables.records.BonusRecord; +import mineplex.serverdata.Region; +import mineplex.serverdata.Utility; +import mineplex.serverdata.commands.ServerCommand; +import mineplex.serverdata.data.PlayerStatus; +import mineplex.serverdata.database.DBPool; +import mineplex.serverdata.redis.RedisConfig; +import mineplex.serverdata.redis.RedisDataRepository; +import mineplex.serverdata.servers.ServerManager; +import redis.clients.jedis.Jedis; +import redis.clients.jedis.JedisPool; + +public class VotifierManager extends MiniPlugin +{ + private CoreClientManager _clientManager; + private DonationManager _donationManager; + private BonusManager _bonusManager; + private InventoryManager _inventoryManager; + private StatsManager _statsManager; + + private RedisConfig _usConfig; + private RedisConfig _euConfig; + private RedisDataRepository _usPlayerRepo; + private RedisDataRepository _euPlayerRepo; + private JedisPool _usWritePool; + private JedisPool _euWritePool; + + private final boolean ClansVotifier; + + public VotifierManager(JavaPlugin plugin, CoreClientManager clientManager, DonationManager donationManager, BonusManager bonusManager, InventoryManager inventoryManager, StatsManager statsManager) + { + super("Votifier", plugin); + + _clientManager = clientManager; + _donationManager = donationManager; + _bonusManager = bonusManager; + _inventoryManager = inventoryManager; + _statsManager = statsManager; + + _usConfig = ServerManager.loadConfig("us-redis.dat"); + _euConfig = ServerManager.loadConfig("eu-redis.dat"); + + _usPlayerRepo = new RedisDataRepository(_usConfig.getConnection(true, "DefaultConnection"), + _usConfig.getConnection(false, "DefaultConnection"), Region.US, PlayerStatus.class, "playerStatus"); + _euPlayerRepo = new RedisDataRepository(_euConfig.getConnection(true, "DefaultConnection"), + _euConfig.getConnection(false, "DefaultConnection"), Region.EU, PlayerStatus.class, "playerStatus"); + + _usWritePool = Utility.generatePool(_usConfig.getConnection(true, "DefaultConnection")); + _euWritePool = Utility.generatePool(_euConfig.getConnection(true, "DefaultConnection")); + + boolean found = false; + try + { + found = new File(new File(".").getCanonicalPath() + File.separator + "ClansVotifier.dat").exists(); + } + catch (IOException e) + { + e.printStackTrace(); + } + ClansVotifier = found; + } + + @EventHandler + public void handleVote(VotifierEvent event) + { + final Vote vote = event.getVote(); + final String playerName = vote.getUsername(); + + System.out.println("New Vote: " + playerName); + + runAsync(new Runnable() + { + @Override + public void run() + { + UUID uuid = UUIDFetcher.getUUIDOf(playerName); + if (uuid == null) + { + System.out.println("Failed to load UUID of " + playerName + " from UUIDFetcher. Trying with database"); + uuid = _clientManager.loadUUIDFromDB(playerName); + + if (uuid == null) + { + System.out.println("Failed to load UUID from database. Giving up on " + playerName); + } + } + + String lowerPlayerName = playerName.toLowerCase(); + final PlayerStatus usStatus = _usPlayerRepo.getElement(lowerPlayerName); + final PlayerStatus euStatus = _euPlayerRepo.getElement(lowerPlayerName); + + System.out.println("Loaded " + playerName + " with uuid " + uuid); + System.out.println("Attempting to award bonus"); + final UUID finalUuid = uuid; + awardBonus(playerName, finalUuid, new Callback() + { + @Override + public void run(final Integer reward) + { + runSync(new Runnable() + { + @Override + public void run() + { + if (usStatus != null) + { + System.out.println("Found " + playerName + " on US " + usStatus.getServer()); + notifyServer(playerName, reward, Region.US, usStatus.getServer()); + } + + if (euStatus != null) + { + System.out.println("Found " + playerName + " on EU " + euStatus.getServer()); + notifyServer(playerName, reward, Region.EU, euStatus.getServer()); + } + } + }); + } + }); + } + }); + System.out.println(); + System.out.println(); + +// UUID uuid = _clientManager.loadUUIDFromDB(playerName); +// if (uuid != null) +// { +// System.out.println("Found UUID:" + uuid.toString()); +// if (playerName.equalsIgnoreCase("Phinary")) +// { +// System.out.println("award bonus"); +// awardBonus(uuid); +// } +// } +// else +// { +// System.out.println("Failed to load UUID for player: " + playerName); +// } + +// PlayerStatus usStatus = _usPlayerRepo.getElement(playerName); +// if (usStatus != null) +// { +// System.out.println("Found on US Server: " + usStatus.getServer()); +// writePool = _usWritePool; +// serverName = usStatus.getServer(); +// } +// +// PlayerStatus euStatus = _euPlayerRepo.getElement(playerName); +// if (euStatus != null) +// { +// System.out.println("Found on EU Server: " + euStatus.getServer()); +// writePool = _euWritePool; +// serverName = euStatus.getServer(); +// } + + // Currently we just notify all servers, and the server with the player on it can deal with it +// notifyServer(playerName, true); + } + + private void notifyServer(String playerName, int reward, Region region, String targetServer) + { + JedisPool writePool = region == Region.EU ? _euWritePool : _usWritePool; + + VotifierCommand command = new VotifierCommand(playerName, reward, ClansVotifier, targetServer); + publishCommand(command, writePool); + } + + private void awardBonus(final String playerName, final UUID uuid, final Callback onComplete) + { + DSLContext create = DSL.using(DBPool.getAccount(), SQLDialect.MYSQL); + + Record1 idRecord = create.select(Tables.accounts.id).from(Tables.accounts).where(Tables.accounts.uuid.eq(uuid.toString())).fetchOne(); + if (idRecord != null) + { + final int accountId = idRecord.value1(); + final BonusRecord client = _bonusManager.getRepository().loadRecord(playerName, accountId); + final int homeServerId = _bonusManager.getRepository().loadClansServerId(accountId); + if (homeServerId == -1 && ClansVotifier) + { + return; + } + final BonusAmount amount = ClansVotifier ? _bonusManager.getClansVoteBonusAmount(homeServerId) : _bonusManager.getVoteBonusAmount(client.getVoteStreak()); + + _bonusManager.getRepository().attemptVoteBonus(accountId, ClansVotifier, new Callback>() + { + @Override + public void run(Pair pair) + { + if (pair.getLeft()) + { + // Reward Amount + final int gems = amount.getTotalGems(); + final int gold = amount.getTotalGold(); + final int shards = amount.getTotalShards(); + final int tickets = amount.getTickets(); + int experience = amount.getTotalExperience(); + int oldChests = amount.getOldChests(); + int ancientChests = amount.getAncientChests(); + int mythicalChests = amount.getMythicalChests(); + int illuminatedChests = amount.getIlluminatedChests(); + int omegaChests = amount.getOmegaChests(); + + if (oldChests > 0) + { + _inventoryManager.addItemToInventoryForOffline(data -> + { + if (data) + { + System.out.println("Gave " + oldChests + " old chest(s) to " + playerName); + } + else + { + System.out.println("Failed to give " + oldChests + " old chest(s) to " + playerName); + } + }, accountId, TreasureType.OLD.getItemName(), oldChests); + } + + if (ancientChests > 0) + { + _inventoryManager.addItemToInventoryForOffline(data -> + { + if (data) + { + System.out.println("Gave " + ancientChests + " ancient chest(s) to " + playerName); + } + else + { + System.out.println("Failed to give " + ancientChests + " ancient chest(s) to " + playerName); + } + }, accountId, TreasureType.ANCIENT.getItemName(), ancientChests); + } + + if (mythicalChests > 0) + { + _inventoryManager.addItemToInventoryForOffline(data -> + { + if (data) + { + System.out.println("Gave " + mythicalChests + " mythical chest(s) to " + playerName); + } + else + { + System.out.println("Failed to give " + mythicalChests + " mythical chest(s) to " + playerName); + } + }, accountId, TreasureType.MYTHICAL.getItemName(), mythicalChests); + } + + if (illuminatedChests > 0) + { + _inventoryManager.addItemToInventoryForOffline(data -> + { + if (data) + { + System.out.println("Gave " + illuminatedChests + " illuminated chest(s) to " + playerName); + } + else + { + System.out.println("Failed to give " + illuminatedChests + " illuminated chest(s) to " + playerName); + } + }, accountId, TreasureType.ILLUMINATED.getItemName(), illuminatedChests); + } + + if (omegaChests > 0) + { + _inventoryManager.addItemToInventoryForOffline(data -> + { + if (data) + { + System.out.println("Gave " + omegaChests + " omega chest(s) to " + playerName); + } + else + { + System.out.println("Failed to give " + omegaChests + " omega chest(s) to " + playerName); + } + }, accountId, TreasureType.OMEGA.getItemName(), omegaChests); + } + + if (gems > 0) + { + _donationManager.rewardCurrency(GlobalCurrency.GEM, playerName, uuid, "Votifier", gems, data -> + { + if (data) + { + System.out.println("Gave " + gems + " gems to " + playerName); + } + else + { + System.out.println("Failed to give " + gems + " gems to " + playerName); + } + }); + } + + if (gold > 0) + { + Set serverIds = new HashSet<>(); + serverIds.addAll(amount.getGold().getServerIds()); + serverIds.addAll(amount.getBonusGold().getServerIds()); + for (Integer serverId : serverIds) + { + int goldCount = amount.getGold().getGoldFor(serverId) + amount.getBonusGold().getGoldFor(serverId); + _donationManager.getGoldRepository().rewardGold(data -> + { + if (data) + { + System.out.println("Gave " + goldCount + " gold to " + playerName + " on clans server id " + serverId); + } + else + { + System.out.println("Failed to give " + goldCount + " gold to " + playerName + " on clans server id " + serverId); + } + }, serverId, accountId, goldCount); + } + } + + if (shards > 0) + { + _donationManager.rewardCurrency(GlobalCurrency.TREASURE_SHARD, playerName, uuid, "Votifier", shards, data -> + { + if (data) + { + System.out.println("Gave " + shards + " shards to " + playerName); + } + else + { + System.out.println("Failed to give " + shards + " shards to " + playerName); + } + }); + } + + if (experience > 0) + { + _statsManager.incrementStat(accountId, "Global.ExpEarned", experience); + System.out.println("Gave " + experience + " experience to " + playerName); + } + + if (tickets > 0) + { + client.setTickets(client.getTickets() + tickets); + } + + // Check if we need to reset vote streak + _bonusManager.updateVoteStreak(client); + client.setVotetime(pair.getRight()); + + // Update Streak + _bonusManager.incrementVoteStreak(client); + + client.store(); + System.out.println("Awarded " + tickets + " carl ticket(s) to " + playerName); + onComplete.run(ClansVotifier ? amount.getTotalGold() : amount.getTotalGems()); + } + else + { + System.out.println(playerName + " attempted to vote, vote bonus returned false!"); + } + } + }); + } + } + + private void publishCommand(final ServerCommand serverCommand, final JedisPool writePool) + { + new Thread(new Runnable() + { + public void run() + { + try (Jedis jedis = writePool.getResource()) + { + String commandType = serverCommand.getClass().getSimpleName(); + String serializedCommand = Utility.serialize(serverCommand); + jedis.publish("commands.server" + ":" + commandType, serializedCommand); + } + } + }).start(); + } +} \ No newline at end of file diff --git a/Plugins/Nautilus.Game.Arcade.UHC.WorldGen/plugin.yml b/Plugins/Nautilus.Game.Arcade.UHC.WorldGen/plugin.yml new file mode 100644 index 000000000..66259a492 --- /dev/null +++ b/Plugins/Nautilus.Game.Arcade.UHC.WorldGen/plugin.yml @@ -0,0 +1,3 @@ +name: UHC-WorldGen +main: nautilus.game.arcade.uhc.WorldGen +version: 0.1 \ No newline at end of file diff --git a/Plugins/Nautilus.Game.Arcade.UHC.WorldGen/pom.xml b/Plugins/Nautilus.Game.Arcade.UHC.WorldGen/pom.xml new file mode 100644 index 000000000..52ebd07c0 --- /dev/null +++ b/Plugins/Nautilus.Game.Arcade.UHC.WorldGen/pom.xml @@ -0,0 +1,28 @@ + + 4.0.0 + + + com.mineplex + mineplex-plugin + dev-SNAPSHOT + ../plugin.xml + + + UHC WorldGen + nautilus-game-arcade-uhc-worldgen + + + + com.mineplex + spigot + 1.8.8-1.9-SNAPSHOT + compile + + + org.zeroturnaround + zt-zip + 1.9 + + + diff --git a/Plugins/Nautilus.Game.Arcade.UHC.WorldGen/src/nautilus/game/arcade/uhc/WorldGen.java b/Plugins/Nautilus.Game.Arcade.UHC.WorldGen/src/nautilus/game/arcade/uhc/WorldGen.java new file mode 100644 index 000000000..24d2483e7 --- /dev/null +++ b/Plugins/Nautilus.Game.Arcade.UHC.WorldGen/src/nautilus/game/arcade/uhc/WorldGen.java @@ -0,0 +1,336 @@ +package nautilus.game.arcade.uhc; + +import java.io.File; +import java.io.FileInputStream; +import java.io.IOException; +import java.net.HttpURLConnection; +import java.net.URL; +import java.nio.charset.StandardCharsets; +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; +import java.util.concurrent.ThreadLocalRandom; +import java.util.logging.Level; + +import net.minecraft.server.v1_8_R3.BiomeBase; + +import org.apache.commons.io.FileUtils; +import org.bukkit.Bukkit; +import org.bukkit.Chunk; +import org.bukkit.Difficulty; +import org.bukkit.World; +import org.bukkit.WorldBorder; +import org.bukkit.WorldCreator; +import org.bukkit.configuration.file.YamlConfiguration; +import org.bukkit.craftbukkit.v1_8_R3.CraftWorld; +import org.bukkit.entity.Entity; +import org.bukkit.event.EventHandler; +import org.bukkit.event.Listener; +import org.bukkit.event.player.AsyncPlayerPreLoginEvent; +import org.bukkit.event.world.ChunkUnloadEvent; +import org.bukkit.event.world.WorldInitEvent; +import org.bukkit.plugin.java.JavaPlugin; +import org.spigotmc.WatchdogThread; +import org.zeroturnaround.zip.ByteSource; +import org.zeroturnaround.zip.FileSource; +import org.zeroturnaround.zip.ZipEntrySource; +import org.zeroturnaround.zip.ZipUtil; +import org.zeroturnaround.zip.commons.IOUtils; + +public class WorldGen extends JavaPlugin implements Listener +{ + // The world will be -MAP_SIZE to MAP_SIZE large + private static final int MAP_SIZE = 1000; + private static final int VIEW_DISTANCE = 5; + + private static final String API_HOST_FILE = "api-config.dat"; + private static final Map API_HOST_MAP = new HashMap<>(); + + static + { + try + { + File configFile = new File(API_HOST_FILE); + YamlConfiguration configuration = YamlConfiguration.loadConfiguration(configFile); + + for (String key : configuration.getKeys(false)) + { + String ip = configuration.getConfigurationSection(key).getString("ip"); + // Use parseInt to catch non-ints instead of a 0 + int port = Integer.parseInt(configuration.getConfigurationSection(key).getString("port")); + if (ip == null) + { + throw new NullPointerException(); + } + + API_HOST_MAP.put(key, ip + ":" + port); + } + } + catch (Throwable t) + { + t.printStackTrace(); + } + } + + @EventHandler + public void login(AsyncPlayerPreLoginEvent event) + { + event.setKickMessage("get out"); + event.setLoginResult(AsyncPlayerPreLoginEvent.Result.KICK_OTHER); + } + + @EventHandler + public void unload(ChunkUnloadEvent event) + { + event.setCancelled(true); + } + + @EventHandler + public void init(WorldInitEvent event) + { + // Prevent any eager generation + event.getWorld().setKeepSpawnInMemory(false); + } + + @Override + public void onEnable() + { + getLogger().info("Cleaning up other worlds"); + for (World world : getServer().getWorlds()) + { + world.setKeepSpawnInMemory(false); + world.setSpawnFlags(false, false); + world.setAmbientSpawnLimit(0); + world.setAnimalSpawnLimit(0); + world.setMonsterSpawnLimit(0); + world.setWaterAnimalSpawnLimit(0); + world.getEntities().forEach(Entity::remove); + for (Chunk chunk : world.getLoadedChunks()) + { + chunk.unload(false, false); + } + getServer().unloadWorld(world, false); + getLogger().info("Unloaded " + world.getName()); + } + + getLogger().info("Replacing biomes"); + BiomeBase.getBiomes()[BiomeBase.OCEAN.id] = BiomeBase.PLAINS; + BiomeBase.getBiomes()[BiomeBase.DEEP_OCEAN.id] = BiomeBase.PLAINS; + BiomeBase.getBiomes()[BiomeBase.SWAMPLAND.id] = BiomeBase.PLAINS; + BiomeBase.getBiomes()[BiomeBase.RIVER.id] = BiomeBase.PLAINS; + + getLogger().info("Forcing system GC"); + System.gc(); + + WatchdogThread.doStop(); + + getServer().getPluginManager().registerEvents(this, this); + + File root = new File("."); + + if (!root.exists()) + { + getLogger().severe("Root folder does not exist. Aborting"); + System.exit(0); + return; + } + + File outputDirectory = new File(root, "output"); + if (!outputDirectory.exists()) + { + if (!outputDirectory.mkdir()) + { + getLogger().severe("Could not create output folder. Aborting"); + System.exit(0); + return; + } + } + + long seed = ThreadLocalRandom.current().nextLong(); + + File outputFile = new File(outputDirectory, "UHC_Map" + seed + ".zip"); + + if (outputFile.exists()) + { + getLogger().info("Seed " + seed + " has already been generated. Skipping"); + System.exit(0); + return; + } + + try + { + if (!outputFile.createNewFile()) + { + getLogger().severe("Could not create new output file. Aborting"); + System.exit(0); + return; + } + } + catch (IOException e) + { + getLogger().log(Level.SEVERE, "Could not create new output file. Aborting", e); + System.exit(0); + return; + } + + File previousSession = new File("generating"); + + if (previousSession.exists()) + { + if (!FileUtils.deleteQuietly(previousSession)) + { + getLogger().severe("Could not delete previous generation session. Aborting"); + System.exit(0); + return; + } + } + + getLogger().info("Generating world seed " + seed); + + World world = new WorldCreator("generating") + .environment(World.Environment.NORMAL) + .seed(seed) + .createWorld(); + world.setKeepSpawnInMemory(false); + world.setDifficulty(Difficulty.HARD); + WorldBorder border = world.getWorldBorder(); + border.setCenter(0.0, 0.0); + border.setSize(MAP_SIZE * 2); + + int minChunkX = (-MAP_SIZE >> 4) - VIEW_DISTANCE; + int minChunkZ = (-MAP_SIZE >> 4) - VIEW_DISTANCE; + int maxChunkX = (MAP_SIZE >> 4) + VIEW_DISTANCE; + int maxChunkZ = (MAP_SIZE >> 4) + VIEW_DISTANCE; + + net.minecraft.server.v1_8_R3.WorldServer nmsWorld = ((CraftWorld) world).getHandle(); +// +// Field mfield = nmsWorld.getClass().getDeclaredField("M"); +// mfield.setAccessible(true); +// +// HashTreeSet treeSet = ((HashTreeSet) mfield.get(nmsWorld)); + + for (int x = minChunkX; x <= maxChunkX; x++) + { + getLogger().info("Generating x coord " + x); + for (int z = minChunkZ; z <= maxChunkZ; z++) + { + world.getChunkAt(x, z).load(true); + nmsWorld.a(true); + // Manually tick blocks - this should be the equivalent of letting a full server tick run once + // between each chunk generation, except we cut out the extra useless stuff + } + +// System.out.println("M: " + treeSet.size()); +// System.out.println("E: " + nmsWorld.entityList.size()); +// System.out.println("TE: " + nmsWorld.tileEntityList.size()); +// System.out.println("C: " + nmsWorld.chunkProviderServer.chunks.size()); + } + + for (int x = minChunkX; x <= maxChunkX; x++) + { + getLogger().info("Unloading x coord " + x); + for (int z = minChunkZ; z <= maxChunkZ; z++) + { + world.getChunkAt(x, z).unload(true, false); + } + +// System.out.println("M: " + treeSet.size()); +// System.out.println("E: " + nmsWorld.entityList.size()); +// System.out.println("TE: " + nmsWorld.tileEntityList.size()); +// System.out.println("C: " + nmsWorld.chunkProviderServer.chunks.size()); + } + + getLogger().info("Unloading and saving world"); + + Bukkit.unloadWorld(world, true); + + getLogger().info("Finished unloading and saving world"); + + StringBuilder worldconfig = new StringBuilder(); + worldconfig.append("MAP_NAME:UHC World").append(System.lineSeparator()); + worldconfig.append("MAP_AUTHOR:Mineplex").append(System.lineSeparator()); + worldconfig.append("MIN_X:").append(-MAP_SIZE).append(System.lineSeparator()); + worldconfig.append("MIN_Z:").append(-MAP_SIZE).append(System.lineSeparator()); + worldconfig.append("MAX_X:").append(MAP_SIZE).append(System.lineSeparator()); + worldconfig.append("MAX_Z:").append(MAP_SIZE).append(System.lineSeparator()); + for (int i = 1; i <= 60; i++) + { + worldconfig.append("TEAM_NAME:").append(i).append(System.lineSeparator()); + worldconfig.append("TEAM_SPAWNS:0,0,0").append(System.lineSeparator()); + } + + File worldFolder = new File(root, "generating"); + + File regionFolder = new File(worldFolder, "region"); + + File[] regionFiles = regionFolder.listFiles(); + + if (regionFiles == null) + { + getLogger().severe("Unexpected null region files. Aborting"); + System.exit(0); + return; + } + + List zipEntrySourceList = new ArrayList<>(); + zipEntrySourceList.add(new ByteSource("WorldConfig.dat", worldconfig.toString().getBytes(StandardCharsets.UTF_8))); + for (File file : regionFiles) + { + zipEntrySourceList.add(new FileSource("region/" + file.getName(), file)); + } + zipEntrySourceList.add(new FileSource("level.dat", new File(worldFolder, "level.dat"))); + + ZipUtil.pack(zipEntrySourceList.toArray(new ZipEntrySource[zipEntrySourceList.size()]), outputFile); + + FileUtils.deleteQuietly(worldFolder); + + try + { + getLogger().info("Uploading " + seed + "!"); + + URL url = new URL("http://" + API_HOST_MAP.get("ENDERCHEST") + "/map/uhc/upload?name=" + outputFile.getName()); + HttpURLConnection connection = (HttpURLConnection) url.openConnection(); + connection.setRequestMethod("POST"); + connection.setDoOutput(true); + IOUtils.copy(new FileInputStream(outputFile), connection.getOutputStream()); + connection.connect(); + + if (connection.getResponseCode() != 200) + { + if (connection.getResponseCode() == 409) + { + getLogger().warning("Oops - Server rejected " + seed + " because it was already generated"); + + if (!outputFile.delete()) + { + getLogger().warning("Could not clean up " + seed); + } + } + else + { + getLogger().severe("Failed to upload " + seed + ": " + connection.getResponseCode() + " " + connection.getResponseMessage()); + } + } + else + { + getLogger().info("Uploaded " + seed + "!"); + + if (!outputFile.delete()) + { + getLogger().warning("Could not clean up " + seed); + } + } + } + catch (IOException e) + { + getLogger().log(Level.SEVERE, "An error occurred while uploading " + seed + "!", e); + } + finally + { + getLogger().info("Finished generating world seed " + seed); + } + + Bukkit.shutdown(); + } +} diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/Arcade.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/Arcade.java index 422862f46..6478db304 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/Arcade.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/Arcade.java @@ -1,24 +1,32 @@ package nautilus.game.arcade; +import java.io.File; +import java.util.HashMap; + +import net.minecraft.server.v1_8_R3.MinecraftServer; + +import org.bukkit.Bukkit; +import org.bukkit.entity.Player; +import org.bukkit.plugin.java.JavaPlugin; +import org.spigotmc.SpigotConfig; + import mineplex.core.CustomTagFix; import mineplex.core.FoodDupeFix; import mineplex.core.PacketsInteractionFix; import mineplex.core.TimingsFix; -import mineplex.core.chatsnap.SnapshotRepository; -import mineplex.core.customdata.CustomDataManager; -import mineplex.core.chatsnap.SnapshotManager; -import mineplex.core.chatsnap.SnapshotPlugin; -import mineplex.core.globalpacket.GlobalPacketManager; -import net.minecraft.server.v1_8_R3.BiomeBase; -import net.minecraft.server.v1_8_R3.MinecraftServer; import mineplex.core.account.CoreClientManager; import mineplex.core.achievement.AchievementManager; import mineplex.core.antihack.AntiHack; +import mineplex.core.antihack.logging.AntihackLogger; import mineplex.core.blockrestore.BlockRestore; import mineplex.core.blood.Blood; import mineplex.core.boosters.BoosterManager; import mineplex.core.chat.Chat; +import mineplex.core.chatsnap.SnapshotManager; +import mineplex.core.chatsnap.SnapshotPlugin; +import mineplex.core.chatsnap.SnapshotRepository; import mineplex.core.command.CommandCenter; +import mineplex.core.common.Constants; import mineplex.core.common.events.ServerShutdownEvent; import mineplex.core.common.util.FileUtil; import mineplex.core.common.util.UtilServer; @@ -46,6 +54,7 @@ import mineplex.core.npc.NpcManager; import mineplex.core.packethandler.PacketHandler; import mineplex.core.pet.PetManager; import mineplex.core.poll.PollManager; +import mineplex.core.portal.GenericServer; import mineplex.core.portal.Portal; import mineplex.core.preferences.PreferencesManager; import mineplex.core.profileCache.ProfileCacheManager; @@ -59,29 +68,20 @@ import mineplex.core.stats.StatsManager; import mineplex.core.status.ServerStatusManager; import mineplex.core.teleport.Teleport; import mineplex.core.thank.ThankManager; +import mineplex.core.twofactor.TwoFactorAuth; import mineplex.core.updater.FileUpdater; import mineplex.core.updater.Updater; import mineplex.core.velocity.VelocityFix; import mineplex.core.visibility.VisibilityManager; import mineplex.minecraft.game.core.combat.CombatManager; import mineplex.minecraft.game.core.damage.DamageManager; + +import nautilus.game.arcade.anticheatmetadata.GameInfoMetadata; import nautilus.game.arcade.game.GameServerConfig; -import net.minecraft.server.v1_8_R3.BiomeBase; -import net.minecraft.server.v1_8_R3.MinecraftServer; -import org.bukkit.Bukkit; -import org.bukkit.entity.Player; -import org.bukkit.plugin.java.JavaPlugin; -import org.spigotmc.SpigotConfig; - -import java.io.File; -import java.util.HashMap; - import static mineplex.core.Managers.require; public class Arcade extends JavaPlugin -{ - private String WEB_CONFIG = "webServer"; - +{ //Modules private CoreClientManager _clientManager; private DonationManager _donationManager; @@ -99,17 +99,15 @@ public class Arcade extends JavaPlugin DeleteFolders(); //Configs - getConfig().addDefault(WEB_CONFIG, "http://accounts.mineplex.com/"); - getConfig().set(WEB_CONFIG, getConfig().getString(WEB_CONFIG)); + getConfig().addDefault(Constants.WEB_CONFIG_KEY, Constants.WEB_ADDRESS); + getConfig().set(Constants.WEB_CONFIG_KEY, getConfig().getString(Constants.WEB_CONFIG_KEY)); saveConfig(); - - String webServerAddress = getConfig().getString(WEB_CONFIG); //Logger.initialize(this); //Static Modules CommandCenter.Initialize(this); - _clientManager = new CoreClientManager(this, webServerAddress); + _clientManager = new CoreClientManager(this); CommandCenter.Instance.setClientManager(_clientManager); require(ProfileCacheManager.class); @@ -120,11 +118,14 @@ public class Arcade extends JavaPlugin Recharge.Initialize(this); VisibilityManager.Initialize(this); Give.Initialize(this); - + + // Publish our server status now, to give us more time to start up + ServerStatusManager serverStatusManager = new ServerStatusManager(this, _clientManager, new LagMeter(this, _clientManager)); + //Velocity Fix new VelocityFix(this); - _donationManager = new DonationManager(this, _clientManager, webServerAddress); + _donationManager = require(DonationManager.class); _serverConfiguration = new ServerConfiguration(this, _clientManager); @@ -136,21 +137,19 @@ public class Arcade extends JavaPlugin incognito.setPreferencesManager(preferenceManager); Creature creature = new Creature(this); - ServerStatusManager serverStatusManager = new ServerStatusManager(this, _clientManager, new LagMeter(this, _clientManager)); LeaderboardManager leaderboardManager = new LeaderboardManager(this, _clientManager); Teleport teleport = new Teleport(this, _clientManager); - Portal portal = new Portal(this, _clientManager, serverStatusManager.getCurrentServerName()); - new FileUpdater(this, portal, serverStatusManager.getCurrentServerName(), serverStatusManager.getRegion()); + Portal portal = new Portal(); + new FileUpdater(this, portal, serverStatusManager.getCurrentServerName(), serverStatusManager.getRegion(), GenericServer.HUB); DisguiseManager disguiseManager = require(DisguiseManager.class); NpcManager npcmanager = new NpcManager(this, creature); _damageManager = new DamageManager(this, new CombatManager(this), npcmanager, disguiseManager, null); - Punish punish = new Punish(this, webServerAddress, _clientManager); + Punish punish = new Punish(this, _clientManager); - AntiHack antiHack = require(AntiHack.class); - antiHack.setKick(false); + require(AntiHack.class); IgnoreManager ignoreManager = new IgnoreManager(this, _clientManager, preferenceManager, portal); StatsManager statsManager = new StatsManager(this, _clientManager); @@ -165,28 +164,31 @@ public class Arcade extends JavaPlugin new SnapshotPlugin(this, snapshotManager, _clientManager); new ReportPlugin(this, reportManager); - BlockRestore blockRestore = new BlockRestore(this); + BlockRestore blockRestore = require(BlockRestore.class); ProjectileManager projectileManager = new ProjectileManager(this); HologramManager hologramManager = new HologramManager(this, packetHandler); //Inventory InventoryManager inventoryManager = new InventoryManager(this, _clientManager); - PetManager petManager = new PetManager(this, _clientManager, _donationManager, inventoryManager, disguiseManager, creature, blockRestore, webServerAddress); + PetManager petManager = new PetManager(this, _clientManager, _donationManager, inventoryManager, disguiseManager, creature, blockRestore); MountManager mountManager = new MountManager(this, _clientManager, _donationManager, blockRestore, disguiseManager); GadgetManager gadgetManager = new GadgetManager(this, _clientManager, _donationManager, inventoryManager, mountManager, petManager, preferenceManager, disguiseManager, blockRestore, projectileManager, achievementManager, packetHandler, hologramManager, incognito); ThankManager thankManager = new ThankManager(this, _clientManager, _donationManager); BoosterManager boosterManager = new BoosterManager(this, _serverConfiguration.getServerGroup().getBoosterGroup(), _clientManager, _donationManager, inventoryManager, thankManager); CosmeticManager cosmeticManager = new CosmeticManager(this, _clientManager, _donationManager, inventoryManager, gadgetManager, mountManager, petManager, null, boosterManager); cosmeticManager.setInterfaceSlot(6); + gadgetManager.setActiveItemSlot(3); cosmeticManager.disableTeamArmor(); CustomDataManager customDataManager = new CustomDataManager(this, _clientManager); - + //Arcade Manager PollManager pollManager = new PollManager(this, _clientManager, _donationManager); - _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, eloManager, thankManager, boosterManager); - + _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, pollManager, npcmanager, customDataManager, punish, eloManager, thankManager, boosterManager); + + require(AntihackLogger.class).registerMetadata(new GameInfoMetadata()); + new GlobalPacketManager(this, _clientManager, serverStatusManager, inventoryManager, _donationManager, petManager, statsManager, _gameManager.getBonusManager().getRewardManager()); //new BroadcastManager(this, _gameManager); @@ -195,18 +197,14 @@ public class Arcade extends JavaPlugin new CustomTagFix(this, packetHandler); new PacketsInteractionFix(this, packetHandler); new FoodDupeFix(this); + + require(TwoFactorAuth.class); //Updates getServer().getScheduler().scheduleSyncRepeatingTask(this, new Updater(this), 1, 1); MinecraftServer.getServer().getPropertyManager().setProperty("debug", false); SpigotConfig.debug = false; - - // Remove nasty biomes from natural terrain generation, used for UHC - BiomeBase.getBiomes()[BiomeBase.OCEAN.id] = BiomeBase.PLAINS; - BiomeBase.getBiomes()[BiomeBase.DEEP_OCEAN.id] = BiomeBase.PLAINS; - BiomeBase.getBiomes()[BiomeBase.SWAMPLAND.id] = BiomeBase.PLAINS; - BiomeBase.getBiomes()[BiomeBase.RIVER.id] = BiomeBase.PLAINS; } @Override diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/ArcadeManager.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/ArcadeManager.java index 7f06f6036..af4d8cea5 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/ArcadeManager.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/ArcadeManager.java @@ -46,6 +46,7 @@ import mineplex.core.boosters.BoosterManager; import mineplex.core.chat.Chat; import mineplex.core.common.Rank; import mineplex.core.common.currency.GlobalCurrency; +import mineplex.core.common.timing.TimingManager; import mineplex.core.common.util.C; import mineplex.core.common.util.F; import mineplex.core.common.util.UtilAction; @@ -53,6 +54,7 @@ import mineplex.core.common.util.UtilGear; import mineplex.core.common.util.UtilInv; import mineplex.core.common.util.UtilPlayer; import mineplex.core.common.util.UtilServer; +import mineplex.core.communities.CommunityManager; import mineplex.core.cosmetic.CosmeticManager; import mineplex.core.creature.Creature; import mineplex.core.customdata.CustomDataManager; @@ -69,6 +71,7 @@ import mineplex.core.events.EnableArcadeSpawnEvent; import mineplex.core.explosion.Explosion; import mineplex.core.explosion.ExplosionEvent; import mineplex.core.facebook.FacebookManager; +import mineplex.core.gadget.event.ToggleMobsEvent; import mineplex.core.gadget.types.Gadget; import mineplex.core.gadget.types.GadgetType; import mineplex.core.hologram.HologramManager; @@ -81,6 +84,8 @@ import mineplex.core.movement.Movement; import mineplex.core.npc.NpcManager; import mineplex.core.packethandler.PacketHandler; import mineplex.core.party.PartyManager; +import mineplex.core.party.event.PartySelectServerEvent; +import mineplex.core.personalServer.PersonalServerManager; import mineplex.core.pet.PetManager; import mineplex.core.playwire.PlayWireManager; import mineplex.core.poll.PollManager; @@ -89,6 +94,8 @@ import mineplex.core.preferences.PreferencesManager; import mineplex.core.progression.KitProgressionManager; import mineplex.core.projectile.ProjectileManager; import mineplex.core.punish.Punish; +import mineplex.core.rankGiveaway.eternal.EternalGiveawayManager; +import mineplex.core.rankGiveaway.titangiveaway.TitanGiveawayManager; import mineplex.core.resourcepack.ResourcePackManager; import mineplex.core.scoreboard.MineplexScoreboard; import mineplex.core.scoreboard.ScoreboardManager; @@ -98,8 +105,8 @@ import mineplex.core.status.ServerStatusManager; import mineplex.core.task.TaskManager; import mineplex.core.teleport.Teleport; import mineplex.core.thank.ThankManager; -import mineplex.core.timing.TimingManager; -import mineplex.core.rankGiveaway.titangiveaway.TitanGiveawayManager; +import mineplex.core.titles.Titles; +import mineplex.core.titles.tracks.TrackManager; import mineplex.core.valentines.ValentinesGiftManager; import mineplex.core.youtube.YoutubeManager; import mineplex.minecraft.game.classcombat.Class.ClassManager; @@ -118,8 +125,6 @@ import mineplex.minecraft.game.core.fire.Fire; import mineplex.serverdata.Region; import nautilus.game.arcade.addons.SoupAddon; -import nautilus.game.arcade.addons.TeamArmorAddon; -import nautilus.game.arcade.addons.compass.CompassAddon; import nautilus.game.arcade.booster.GameBoosterManager; import nautilus.game.arcade.command.CancelNextGameCommand; import nautilus.game.arcade.command.GameCmdModeCommand; @@ -128,6 +133,7 @@ import nautilus.game.arcade.command.GoToNextGameCommand; import nautilus.game.arcade.command.KitUnlockCommand; import nautilus.game.arcade.command.OpenGameMechPrefsCommand; import nautilus.game.arcade.command.RequiredRankCommand; +import nautilus.game.arcade.command.TauntCommand; import nautilus.game.arcade.command.WriteCommand; import nautilus.game.arcade.events.GameStateChangeEvent; import nautilus.game.arcade.game.Game; @@ -137,7 +143,6 @@ import nautilus.game.arcade.game.GameTeam; import nautilus.game.arcade.game.GameTeam.PlayerState; import nautilus.game.arcade.game.games.event.EventModule; import nautilus.game.arcade.game.games.minecraftleague.MinecraftLeague; -import nautilus.game.arcade.game.games.uhc.UHC; import nautilus.game.arcade.managers.GameAchievementManager; import nautilus.game.arcade.managers.GameCreationManager; import nautilus.game.arcade.managers.GameFlagManager; @@ -227,6 +232,7 @@ public class ArcadeManager extends MiniPlugin implements IRelation private ServerUptimeManager _serverUptimeManager; private ScoreboardManager _scoreboardManager; private NextBestGameManager _nextBestGameManager; + private TrackManager _trackManager; private IncognitoManager _incognitoManager; @@ -251,16 +257,18 @@ public class ArcadeManager extends MiniPlugin implements IRelation //Game commands public static final String GAME_CMD_MODE_FILE = "GAME_CMD_MODE.dat"; - private boolean _gameCommandMode; - + private Rank _gameCommandRank; + public final boolean IsHolidayEnabled; + private final Titles _titles; + public ArcadeManager(Arcade plugin, ServerStatusManager serverStatusManager, GameServerConfig serverConfig, - CoreClientManager clientManager, DonationManager donationManager, DamageManager damageManager, - StatsManager statsManager, IncognitoManager incognitoManager, AchievementManager achievementManager, DisguiseManager disguiseManager, Creature creature, Teleport teleport, Blood blood, Chat chat, - Portal portal, PreferencesManager preferences, InventoryManager inventoryManager, PacketHandler packetHandler, - CosmeticManager cosmeticManager, ProjectileManager projectileManager, PetManager petManager, HologramManager hologramManager, String webAddress, PollManager pollManager, - NpcManager npcManager, CustomDataManager customDataManager, Punish punish, EloManager eloManager, ThankManager thankManager, BoosterManager boosterManager) + CoreClientManager clientManager, DonationManager donationManager, DamageManager damageManager, + StatsManager statsManager, IncognitoManager incognitoManager, AchievementManager achievementManager, DisguiseManager disguiseManager, Creature creature, Teleport teleport, Blood blood, Chat chat, + Portal portal, PreferencesManager preferences, InventoryManager inventoryManager, PacketHandler packetHandler, + CosmeticManager cosmeticManager, ProjectileManager projectileManager, PetManager petManager, HologramManager hologramManager, PollManager pollManager, + NpcManager npcManager, CustomDataManager customDataManager, Punish punish, EloManager eloManager, ThankManager thankManager, BoosterManager boosterManager) { super("Game Manager", plugin); @@ -279,7 +287,7 @@ public class ArcadeManager extends MiniPlugin implements IRelation _conditionManager = new SkillConditionManager(plugin); - _brandingManager = new BrandingManager(plugin); + _brandingManager = require(BrandingManager.class); _boosterManager = boosterManager; @@ -303,9 +311,9 @@ public class ArcadeManager extends MiniPlugin implements IRelation _packetHandler = packetHandler; - _partyManager = new PartyManager(plugin, portal, _clientManager, preferences); + _partyManager = new PartyManager(); _statsManager = statsManager; - _taskManager = new TaskManager(plugin, clientManager, webAddress); + _taskManager = new TaskManager(plugin, clientManager); _achievementManager = achievementManager; _inventoryManager = inventoryManager; _cosmeticManager = cosmeticManager; @@ -334,7 +342,7 @@ public class ArcadeManager extends MiniPlugin implements IRelation FacebookManager facebookManager = new FacebookManager(plugin, clientManager, donationManager, inventoryManager); YoutubeManager youtubeManager = new YoutubeManager(plugin, clientManager, donationManager); PlayWireManager playWireManager = new PlayWireManager(plugin, clientManager); - _bonusManager = new BonusManager(plugin, _gameLobbyManager.getCarl(), playWireManager, clientManager, donationManager, pollManager , npcManager, hologramManager, statsManager, _inventoryManager, petManager, facebookManager, youtubeManager, _cosmeticManager.getGadgetManager(), thankManager); + _bonusManager = new BonusManager(plugin, _gameLobbyManager.getCarl(), playWireManager, clientManager, donationManager, pollManager, npcManager, hologramManager, statsManager, _inventoryManager, petManager, facebookManager, youtubeManager, _cosmeticManager.getGadgetManager(), thankManager, "Carl"); new GameLootManager(this, petManager, _bonusManager.getRewardManager()); _spectatorManager = new GameSpectatorManager(this); @@ -343,32 +351,32 @@ public class ArcadeManager extends MiniPlugin implements IRelation _hologramManager = hologramManager; _idleManager = new IdleManager(this); TitanGiveawayManager titanGiveaway = new TitanGiveawayManager(getPlugin(), clientManager, serverStatusManager); + EternalGiveawayManager eternalGiveawayManager = new EternalGiveawayManager(getPlugin(), clientManager, serverStatusManager); + + IsHolidayEnabled = false; + if (IsHolidayEnabled) + new HolidayManager(this, titanGiveaway, eternalGiveawayManager); - new HolidayManager(this, titanGiveaway); - IsHolidayEnabled = true; - new ValentinesGiftManager(plugin, clientManager, _bonusManager.getRewardManager(), inventoryManager, _cosmeticManager.getGadgetManager(), statsManager); new GameTestingManager(this); require(PlayerDisguiseManager.class); new GameBoosterManager(plugin, boosterManager, hologramManager, npcManager, serverConfig.BoosterGroup); // Game Addons - new CompassAddon(plugin, this); new SoupAddon(plugin, this); - new TeamArmorAddon(plugin, this); //Champions Modules _energy = new Energy(plugin); _itemFactory = new ItemFactory(_plugin, _blockRestore, _conditionManager, damageManager, _energy, - _fire, _projectileManager, webAddress); + _fire, _projectileManager); _skillFactory = new SkillFactory(plugin, damageManager, this, _damageManager.GetCombatManager(), _conditionManager, _projectileManager, _disguiseManager, _blockRestore, _fire, new Movement(plugin), teleport, - _energy, webAddress); + _energy); - _classManager = new ClassManager(plugin, clientManager, donationManager, _cosmeticManager.getGadgetManager(), _skillFactory, _itemFactory, - webAddress); + _classManager = new ClassManager(plugin, clientManager, donationManager, _cosmeticManager.getGadgetManager(), _skillFactory, _itemFactory + ); _classShopManager = new ClassShopManager(_plugin, _classManager, _skillFactory, _itemFactory, _achievementManager, clientManager); @@ -382,22 +390,26 @@ public class ArcadeManager extends MiniPlugin implements IRelation _progressionKitManager = new ProgressingKitManager(this); _serverUptimeManager = new ServerUptimeManager(this); - if (GetHost() != null && !GetHost().isEmpty()) + if (GetHost() != null && !GetHost().isEmpty() && !GetHost().startsWith("COM-")) { Bukkit.getScheduler().runTaskLater(plugin, () -> Portal.transferPlayer(GetHost(), _serverStatusManager.getCurrentServerName()), 80L); } loadRequiredRank(); - _gameCommandMode = checkGameCommandMode(); + _gameCommandRank = checkGameCommandMode() ? Rank.ALL : Rank.JNR_DEV; Region region = new File("eu.dat").exists() ? Region.EU : Region.US; - _nextBestGameManager = new NextBestGameManager(serverConfig.ServerGroup, region, _partyManager); + _nextBestGameManager = new NextBestGameManager(serverConfig.ServerGroup, region, _partyManager); addCommand(new GoToNextGameCommand(this)); addCommand(new OpenGameMechPrefsCommand(this)); addCommand(new CancelNextGameCommand(this)); + addCommand(new TauntCommand(this)); + + new PersonalServerManager(plugin, _clientManager).setUseInterfaceItem(false); + new CommunityManager(plugin, _clientManager); _scoreboardManager = new ScoreboardManager(_plugin) { @@ -408,7 +420,7 @@ public class ArcadeManager extends MiniPlugin implements IRelation for (MineplexScoreboard scoreboard : getScoreboards().values()) { - scoreboard.getHandle().getTeam(client.getRealOrDisguisedRank().Name).addEntry(playerName); + scoreboard.getHandle().getTeam(client.getRealOrDisguisedRank().ScoreboardTag).addEntry(playerName); } Player player = Bukkit.getPlayerExact(playerName); @@ -419,7 +431,7 @@ public class ArcadeManager extends MiniPlugin implements IRelation { client = GetClients().Get(player1); - get(player).getHandle().getTeam(client.getRealOrDisguisedRank().Name).addEntry(player1.getName()); + get(player).getHandle().getTeam(client.getRealOrDisguisedRank().ScoreboardTag).addEntry(player1.getName()); } } @@ -452,7 +464,7 @@ public class ArcadeManager extends MiniPlugin implements IRelation for (MineplexScoreboard scoreboard : getScoreboards().values()) { - scoreboard.getHandle().getTeam(client.getRealOrDisguisedRank().Name).removeEntry(playerName); + scoreboard.getHandle().getTeam(client.getRealOrDisguisedRank().ScoreboardTag).removeEntry(playerName); } } @@ -462,9 +474,9 @@ public class ArcadeManager extends MiniPlugin implements IRelation for (Rank rank : Rank.values()) { if (rank == Rank.ALL) - scoreboard.getHandle().registerNewTeam(rank.Name).setPrefix(""); + scoreboard.getHandle().registerNewTeam(rank.ScoreboardTag).setPrefix(""); else - scoreboard.getHandle().registerNewTeam(rank.Name).setPrefix(rank.getTag(true, true) + ChatColor.RESET + " "); + scoreboard.getHandle().registerNewTeam(rank.ScoreboardTag).setPrefix(rank.getTag(true, true) + ChatColor.RESET + " "); } scoreboard.register(ArcadeScoreboardLine.PLAYERS_SPACER) @@ -491,26 +503,23 @@ public class ArcadeManager extends MiniPlugin implements IRelation @Override public void draw(MineplexScoreboard scoreboard) { - if (GetGame() != null && GetGame().GetCountdown() >= 0) + if (GetGame() != null) { if (GetGame().GetCountdown() > 0) scoreboard.setSidebarName(C.Bold + "§lStarting in " + C.cGreen + "§l" + GetGame().GetCountdown() + (GetGame().GetCountdown() == 1 ? " Second" : " Seconds")); else if (GetGame().GetCountdown() == 0) scoreboard.setSidebarName(ChatColor.WHITE + "§lIn Progress..."); + else if (GetGame().GetState() == GameState.Recruit) + scoreboard.setSidebarName(ChatColor.GREEN + "§l" + "Waiting for players"); + else if (GetGame().GetState() == GameState.Loading) + scoreboard.setSidebarName(ChatColor.GREEN + "§l" + "Loading..."); } else { - if (GetGame() instanceof UHC && !((UHC) GetGame()).isMapLoaded()) - { - scoreboard.setSidebarName(((UHC) GetGame()).getObjectiveName(_gameLobbyManager.getColorTick())); - } - else - { - scoreboard.setSidebarName(ChatColor.GREEN + "§l" + "Waiting for Players"); - } + scoreboard.setSidebarName(ChatColor.GREEN + "§l" + "Waiting for game"); } - scoreboard.get(ArcadeScoreboardLine.PLAYERS_VALUE).write( _gameManager.getValidPlayersForGameStart().size() + "/" + GetPlayerFull()); + scoreboard.get(ArcadeScoreboardLine.PLAYERS_VALUE).write(_gameManager.getValidPlayersForGameStart().size() + "/" + GetPlayerFull()); scoreboard.get(ArcadeScoreboardLine.GEM_VALUE).write(donationManager.Get(scoreboard.getOwner()).getBalance(GlobalCurrency.GEM)); if (GetGame() != null) @@ -566,6 +575,9 @@ public class ArcadeManager extends MiniPlugin implements IRelation }; new MenuManager(_plugin); Managers.put(_scoreboardManager, ScoreboardManager.class); + _trackManager = require(TrackManager.class); + _titles = require(Titles.class); + Titles.BOOK_SLOT = 4; } @Override @@ -885,7 +897,7 @@ public class ArcadeManager extends MiniPlugin implements IRelation { _specList.remove(event.getPlayer()); if (_game.GetTeam(event.getPlayer()) != null) - _game.GetTeam(event.getPlayer()).SetPlayerState(event.getPlayer(), PlayerState.IN); + _game.SetPlayerState(event.getPlayer(), PlayerState.IN); } if (isSpectator(event.getPlayer())) @@ -910,7 +922,7 @@ public class ArcadeManager extends MiniPlugin implements IRelation return; } - if (!GetServerConfig().PublicServer || GetServerConfig().PlayerServerWhitelist) + if (!GetServerConfig().PublicServer || GetServerConfig().PlayerServerWhitelist || _gameHostManager.isCommunityServer()) { event.setMotd(ChatColor.GRAY + "Private"); return; @@ -921,20 +933,16 @@ public class ArcadeManager extends MiniPlugin implements IRelation + "|" + ((_game == null || _game.WorldData == null) ? "Unknown" : _game.WorldData.MapName); if (_gameHostManager.isPrivateServer() && _gameHostManager.hasRank(Rank.TWITCH)) - extrainformation += "|HostRank." + _gameHostManager.getHostRank().toString(); - - //Always Joinable - // if (_game != null && _game.JoinInProgress) - // { - // event.setMotd(ChatColor.GREEN + "Recruiting" + extrainformation); - // } - //UHC Timed - if (_game != null && (_game.GetType() == GameType.UHC || _game.getClass().getSuperclass().equals(UHC.class))) { - event.setMotd(((UHC) _game).getMotdStatus() + extrainformation); + extrainformation += "|HostRank." + _gameHostManager.getHostRank().toString(); + } + //Always Joinable + /*if (_game != null && _game.JoinInProgress) + { + event.setMotd(ChatColor.GREEN + "Recruiting" + extrainformation); } //Recruiting - else if (_game == null || _game.GetState() == GameState.Recruit) + else */if (_game == null || _game.GetState() == GameState.Recruit) { if (_game != null && _game.GetCountdown() != -1) { @@ -951,10 +959,16 @@ public class ArcadeManager extends MiniPlugin implements IRelation event.setMotd(ChatColor.YELLOW + "In Progress" + extrainformation); } - if (this.getPlugin().getConfig().getString("serverstatus.group").equalsIgnoreCase("Testing")) + if (UtilServer.isTestServer(false)) event.setMotd(ChatColor.GOLD + "Private Mineplex Test Server"); } + @EventHandler + public void onClickCompassPartyIcon(PartySelectServerEvent event) + { + UtilPlayer.message(event.getPlayer(), F.main("Party", "This option cannot be used here")); + } + @EventHandler public void MessageJoin(PlayerJoinEvent event) { @@ -1120,7 +1134,7 @@ public class ArcadeManager extends MiniPlugin implements IRelation return; } else if (_clientManager.Get(event.getPlayer().getUniqueId()).GetRank().has(event.getPlayer(), Rank.ULTRA, false) - || _donationManager.Get(event.getPlayer().getUniqueId()).OwnsUnknownPackage(_serverConfig.ServerType + " ULTRA")) + || _donationManager.Get(event.getPlayer().getUniqueId()).ownsUnknownSalesPackage(_serverConfig.ServerType + " ULTRA")) { if (GetGame() != null && GetGame().DontAllowOverfill) @@ -1153,9 +1167,8 @@ public class ArcadeManager extends MiniPlugin implements IRelation public void AdminOP(PlayerJoinEvent event) { // Give developers operator on their servers - boolean testServer = _plugin.getConfig().getString("serverstatus.group").equalsIgnoreCase("Testing"); Rank minimum = Rank.OWNER; - if (testServer) + if (UtilServer.isTestServer() || UtilServer.isDevServer()) { minimum = Rank.JNR_DEV; } @@ -1267,28 +1280,31 @@ public class ArcadeManager extends MiniPlugin implements IRelation System.out.println("Searching Maps in: " + folder); - for (File file : folder.listFiles()) + if (folder.listFiles() != null) { - if (!file.isFile()) + for (File file : folder.listFiles()) { - System.out.println(file.getName() + " is not a file!"); - continue; + if (!file.isFile()) + { + System.out.println(file.getName() + " is not a file!"); + continue; + } + + String name = file.getName(); + + if (name.length() < 5) + continue; + + name = name.substring(name.length() - 4, name.length()); + + if (!name.equals(".zip")) + { + System.out.println(file.getName() + " is not a zip."); + continue; + } + + maps.add(file.getName().substring(0, file.getName().length() - 4)); } - - String name = file.getName(); - - if (name.length() < 5) - continue; - - name = name.substring(name.length() - 4, name.length()); - - if (!name.equals(".zip")) - { - System.out.println(file.getName() + " is not a zip."); - continue; - } - - maps.add(file.getName().substring(0, file.getName().length() - 4)); } for (String map : maps) @@ -1580,6 +1596,7 @@ public class ArcadeManager extends MiniPlugin implements IRelation //Disable if (event.GetState() == GameState.Recruit) { + getTitles().forceEnable(); getCosmeticManager().setActive(true); getCosmeticManager().setHideParticles(false); } @@ -1880,21 +1897,23 @@ public class ArcadeManager extends MiniPlugin implements IRelation } /** - * @return Whether this server is in game command mode. + * Returns the minimum rank requirement to use game commands. + * + * @return The minimum rank requirement. */ - public boolean isGameCommandMode() + public Rank getGameCommandRank() { - return _gameCommandMode; + return _gameCommandRank; } /** - * Sets this server's game command mode state. + * Sets this server's minimum rank requirement to use game commands. * - * @param state Whether to enable or disable game commands. + * @param rank The minimum rank requirement. */ - public void setGameCommandMode(boolean state) + public void setGameCommandMode(Rank rank) { - _gameCommandMode = state; + _gameCommandRank = rank; } /** @@ -1907,16 +1926,15 @@ public class ArcadeManager extends MiniPlugin implements IRelation */ public boolean canPlayerUseGameCmd(Player player) { - if (_gameCommandMode) + if (_gameCommandRank == null) { - // When enabled, anyone can use game commands. - return true; + player.sendMessage(F.main("Game", "Game commands are currently disabled")); + return false; } - // Check whether they are of high enough rank status. - if (!GetClients().hasRank(player, Rank.JNR_DEV)) + if (!GetClients().hasRank(player, _gameCommandRank) && !(_gameHostManager.isEventServer() && _gameHostManager.isAdmin(player, false))) { - player.sendMessage(F.main("Server", "You are not allowed to use game commands.")); + player.sendMessage(F.main("Game", "You are not allowed to use game commands.")); return false; } @@ -1974,6 +1992,7 @@ public class ArcadeManager extends MiniPlugin implements IRelation /** * Allows mob spawning from core + * * @param event */ @EventHandler @@ -1987,6 +2006,7 @@ public class ArcadeManager extends MiniPlugin implements IRelation /** * Allows adding a condition from another modules + * * @param event */ @EventHandler @@ -1995,6 +2015,20 @@ public class ArcadeManager extends MiniPlugin implements IRelation _conditionManager.AddCondition(new Condition(_conditionManager, event)); } + /** + * Allows toggling mob spawning from another module + * + * @param event + */ + @EventHandler + public void toggleMobSpawning(ToggleMobsEvent event) + { + if (_game != null) + { + _game.CreatureAllowOverride = event.enable(); + } + } + public ProgressingKitManager getProgressionKitManager() { return _progressionKitManager; @@ -2020,4 +2054,13 @@ public class ArcadeManager extends MiniPlugin implements IRelation return _nextBestGameManager; } + public TrackManager getTrackManager() + { + return this._trackManager; + } + + public Titles getTitles() + { + return this._titles; + } } diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/GameType.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/GameType.java index 04991cd3d..66bef53c0 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/GameType.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/GameType.java @@ -110,10 +110,12 @@ import nautilus.game.arcade.game.games.survivalgames.modes.UHCSurvivalgames; import nautilus.game.arcade.game.games.tug.Tug; import nautilus.game.arcade.game.games.turfforts.TurfForts; import nautilus.game.arcade.game.games.typewars.TypeWars; -import nautilus.game.arcade.game.games.uhc.UHC; +import nautilus.game.arcade.game.games.uhc.UHCSolo; +import nautilus.game.arcade.game.games.uhc.UHCSoloSpeed; +import nautilus.game.arcade.game.games.uhc.UHCTeams; +import nautilus.game.arcade.game.games.uhc.UHCTeamsSpeed; import nautilus.game.arcade.game.games.uhc.modes.Assassins; import nautilus.game.arcade.game.games.uhc.modes.BloodDiamonds; -import nautilus.game.arcade.game.games.uhc.modes.CutClean; import nautilus.game.arcade.game.games.uhc.modes.GodBattles; import nautilus.game.arcade.game.games.valentines.Valentines; import nautilus.game.arcade.game.games.wither.WitherGame; @@ -192,7 +194,10 @@ public enum GameType SurvivalGamesTeams(TeamSurvivalGames.class, GameDisplay.SurvivalGamesTeams, new GameType[]{GameType.SurvivalGames}, false), Tug(Tug.class, GameDisplay.Tug), TurfWars(TurfForts.class, GameDisplay.TurfWars), - UHC(UHC.class, GameDisplay.UHC), + UHC(UHCTeams.class, GameDisplay.UHC), + UHCSolo(UHCSolo.class, GameDisplay.UHCSolo, new GameType[] { GameType.UHC }, false), + UHCSoloSpeed(UHCSoloSpeed.class, GameDisplay.UHCSoloSpeed, new GameType[] { GameType.UHC }, false), + UHCTeamsSpeed(UHCTeamsSpeed.class, GameDisplay.UHCTeamsSpeed, new GameType[] { GameType.UHC }, false), WitherAssault(WitherGame.class, GameDisplay.WitherAssault), Wizards(Wizards.class, GameDisplay.Wizards, new Pair[] { @@ -209,6 +214,11 @@ public enum GameType Gladiators(Gladiators.class, GameDisplay.Gladiators), Skyfall(SoloSkyfall.class, GameDisplay.Skyfall), SkyfallTeams(TeamSkyfall.class, GameDisplay.SkyfallTeams, new GameType[]{GameType.Skyfall}, false), + StrikeGames(StrikeGames.class, new GameMode[]{}, GameDisplay.StrikeGames, new Pair[] + { + Pair.create(MinecraftVersion.Version1_8, "http://file.mineplex.com/ResStrikeGames18.zip"), + Pair.create(MinecraftVersion.Version1_9, "http://file.mineplex.com/ResStrikeGames19.zip") + }, true, new GameType[]{GameType.SurvivalGames}, false, false), BouncyBalls(BouncyBalls.class, GameDisplay.BouncyBalls), @@ -242,18 +252,17 @@ public enum GameType new GameMode(Elementalist.class, GameType.Skywars, "Elementalist"), new GameMode(TeamBuild.class, GameType.Build, "Team Master Builders"), new GameMode(DukesOfDecoration.class, GameType.Build, "Dukes Of Decoration"), - new GameMode(CutClean.class, GameType.UHC, "Cut Clean"), new GameMode(GodBattles.class, GameType.UHC, "God Battles"), new GameMode(BloodDiamonds.class, GameType.UHC, "Blood Diamonds"), new GameMode(Assassins.class, GameType.UHC, "Assassins"), new GameMode(OverpoweredSurvival.class, GameType.SurvivalGames, "OP Survival Games"), new GameMode(UHCSurvivalgames.class, GameType.SurvivalGames, "UHC Survivalgames"), new GameMode(ChangingKits.class, GameType.SurvivalGames, "Changing Kits"), - new GameMode(StrikeGames.class, GameType.SurvivalGames, "Strike Games", new Pair[] - { - Pair.create(MinecraftVersion.Version1_8, "http://file.mineplex.com/ResStrikeGames18.zip"), - Pair.create(MinecraftVersion.Version1_9, "http://file.mineplex.com/ResStrikeGames19.zip") - }, true), + //new GameMode(StrikeGames.class, GameType.SurvivalGames, "Strike Games", new Pair[] + //{ + // Pair.create(MinecraftVersion.Version1_8, "http://file.mineplex.com/ResStrikeGames18.zip"), + // Pair.create(MinecraftVersion.Version1_9, "http://file.mineplex.com/ResStrikeGames19.zip") + //}, true), new GameMode(TinyWinners.class, GameType.Micro, "Tiny Winners"), new GameMode(OverpoweredMicroBattles.class, GameType.Micro, "OP Micro Battles"), new GameMode(CookieFight.class, GameType.Micro, "Cookie Fight"), @@ -370,6 +379,11 @@ public enum GameType return _ownMaps; } + public GameDisplay getDisplay() + { + return this._display; + } + public String GetName() { return _display.getName(); diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/addons/TeamArmorAddon.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/addons/TeamArmorAddon.java deleted file mode 100644 index 5e723449f..000000000 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/addons/TeamArmorAddon.java +++ /dev/null @@ -1,99 +0,0 @@ -package nautilus.game.arcade.addons; - -import org.bukkit.Material; -import org.bukkit.entity.Player; -import org.bukkit.event.EventHandler; -import org.bukkit.event.inventory.InventoryClickEvent; -import org.bukkit.event.player.PlayerInteractEvent; -import org.bukkit.inventory.ItemStack; -import org.bukkit.inventory.meta.LeatherArmorMeta; -import org.bukkit.plugin.java.JavaPlugin; - -import mineplex.core.MiniPlugin; -import mineplex.core.common.util.UtilGear; -import nautilus.game.arcade.ArcadeManager; -import nautilus.game.arcade.events.PlayerKitGiveEvent; - -public class TeamArmorAddon extends MiniPlugin -{ - public ArcadeManager Manager; - - public TeamArmorAddon(JavaPlugin plugin, ArcadeManager manager) - { - super("Team Armor Addon", plugin); - - Manager = manager; - } - - @EventHandler - public void GiveArmor(PlayerKitGiveEvent event) - { - Player player = event.getPlayer(); - - if (event.getGame().TeamArmor) - { - ItemStack helm = new ItemStack(Material.LEATHER_HELMET); - LeatherArmorMeta metaHelm = (LeatherArmorMeta)helm.getItemMeta(); - metaHelm.setColor(Manager.GetGame().GetTeam(player).GetColorBase()); - helm.setItemMeta(metaHelm); - player.getInventory().setHelmet(helm); - - ItemStack armor = new ItemStack(Material.LEATHER_CHESTPLATE); - LeatherArmorMeta meta = (LeatherArmorMeta)armor.getItemMeta(); - meta.setColor(Manager.GetGame().GetTeam(player).GetColorBase()); - armor.setItemMeta(meta); - player.getInventory().setChestplate(armor); - - ItemStack legs = new ItemStack(Material.LEATHER_LEGGINGS); - LeatherArmorMeta metaLegs = (LeatherArmorMeta)legs.getItemMeta(); - metaLegs.setColor(Manager.GetGame().GetTeam(player).GetColorBase()); - legs.setItemMeta(metaLegs); - player.getInventory().setLeggings(legs); - - ItemStack boots = new ItemStack(Material.LEATHER_BOOTS); - LeatherArmorMeta metaBoots = (LeatherArmorMeta)boots.getItemMeta(); - metaBoots.setColor(Manager.GetGame().GetTeam(player).GetColorBase()); - boots.setItemMeta(metaBoots); - player.getInventory().setBoots(boots); - } - - if (event.getGame().TeamArmorHotbar && event.getGame().InProgress()) - { - ItemStack armor = new ItemStack(Material.LEATHER_CHESTPLATE); - LeatherArmorMeta meta = (LeatherArmorMeta)armor.getItemMeta(); - meta.setColor(Manager.GetGame().GetTeam(player).GetColorBase()); - meta.setDisplayName(Manager.GetGame().GetTeam(player).GetFormattedName()); - armor.setItemMeta(meta); - player.getInventory().setItem(8, armor.clone()); - } - } - - @EventHandler - public void EquipCancel(PlayerInteractEvent event) - { - if (Manager.GetGame() == null) - return; - - if (!Manager.GetGame().TeamArmorHotbar) - return; - - if (UtilGear.isMat(event.getPlayer().getItemInHand(), Material.LEATHER_CHESTPLATE)) - event.setCancelled(true); - } - - @EventHandler - public void ClickCancel(InventoryClickEvent event) - { - if (Manager.GetGame() == null) - return; - - if (!Manager.GetGame().TeamArmorHotbar) - return; - - if (!Manager.GetGame().InProgress()) - return; - - event.setCancelled(true); - event.getWhoClicked().closeInventory(); - } -} diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/addons/compass/CompassAddon.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/addons/compass/CompassAddon.java deleted file mode 100644 index a941648c9..000000000 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/addons/compass/CompassAddon.java +++ /dev/null @@ -1,286 +0,0 @@ -package nautilus.game.arcade.addons.compass; - -import java.util.HashSet; - -import mineplex.core.MiniPlugin; -import mineplex.core.common.util.C; -import mineplex.core.common.util.F; -import mineplex.core.common.util.UtilGear; -import mineplex.core.common.util.UtilInv; -import mineplex.core.common.util.UtilMath; -import mineplex.core.common.util.UtilPlayer; -import mineplex.core.common.util.UtilServer; -import mineplex.core.common.util.UtilTextBottom; -import mineplex.core.common.util.UtilTime; -import mineplex.core.recharge.Recharge; -import mineplex.core.updater.UpdateType; -import mineplex.core.updater.event.UpdateEvent; -import nautilus.game.arcade.ArcadeManager; -import nautilus.game.arcade.events.GameStateChangeEvent; -import nautilus.game.arcade.game.Game; -import nautilus.game.arcade.game.GameTeam; -import nautilus.game.arcade.gui.spectatorMenu.SpectatorShop; - -import org.bukkit.Bukkit; -import org.bukkit.Material; -import org.bukkit.entity.Player; -import org.bukkit.event.EventHandler; -import org.bukkit.event.block.Action; -import org.bukkit.event.entity.PlayerDeathEvent; -import org.bukkit.event.player.PlayerDropItemEvent; -import org.bukkit.event.player.PlayerInteractEvent; -import org.bukkit.inventory.ItemStack; -import org.bukkit.inventory.meta.ItemMeta; -import org.bukkit.plugin.java.JavaPlugin; - -public class CompassAddon extends MiniPlugin -{ - private static final long MODE_SWITCH_TIME = 3000; - - public ArcadeManager Manager; - - private SpectatorShop _spectatorShop; - - private boolean _showTeam; - private long _lastChanged; - - public CompassAddon(JavaPlugin plugin, ArcadeManager manager) - { - super("Compass Addon", plugin); - - Manager = manager; - - _spectatorShop = new SpectatorShop(this, manager, manager.GetClients(), manager.GetDonation()); - } - - @EventHandler - public void Update(UpdateEvent event) - { - if (event.getType() != UpdateType.FASTER) - return; - - if (Manager.GetGame() == null) - return; - - if (!Manager.GetGame().IsLive()) - return; - - for (Player player : UtilServer.getPlayers()) - { - if (!Manager.GetGame().CompassEnabled && Manager.GetGame().IsAlive(player)) - continue; - - GameTeam team = Manager.GetGame().GetTeam(player); - - Player target = null; - GameTeam targetTeam = null; - double bestDist = 0; - - for (Player other : Manager.GetGame().GetPlayers(true)) - { - if (other.equals(player)) - continue; - - GameTeam otherTeam = Manager.GetGame().GetTeam(other); - - if (!Manager.GetGame().TeamMode) - { - //Same Team (Not Solo Game) && Alive - if (Manager.GetGame().GetTeamList().size() > 1 && (team != null && team.equals(otherTeam)) && Manager.GetGame().IsAlive(player)) - continue; - } - else - { - - if (UtilTime.elapsed(_lastChanged, MODE_SWITCH_TIME)) - { - _lastChanged = System.currentTimeMillis(); - _showTeam = !_showTeam; - } - - if (_showTeam) - { - if (!team.equals(otherTeam)) - continue; - } - else - { - if (team.equals(otherTeam)) - continue; - } - } - - double dist = UtilMath.offset(player, other); - - if (target == null || dist < bestDist) - { - CompassAttemptTargetEvent tE = new CompassAttemptTargetEvent(player, other); - Bukkit.getServer().getPluginManager().callEvent(tE); - - if (tE.isCancelled()) - continue; - - target = other; - targetTeam = otherTeam; - bestDist = dist; - } - } - - if (target != null) - { - if (Manager.GetGame().CompassGiveItem || (Manager.GetGame().CompassGiveItemSpectators && Manager.isSpectator(player))) - if (!player.getInventory().contains(Material.COMPASS)) - { - if (player.getOpenInventory() == null || player.getOpenInventory().getCursor() == null || player.getOpenInventory().getCursor().getType() != Material.COMPASS) - { - ItemStack stack = new ItemStack(Material.COMPASS); - - ItemMeta itemMeta = stack.getItemMeta(); - itemMeta.setDisplayName(C.cGreen + C.Bold + "Tracking Compass"); - stack.setItemMeta(itemMeta); - - player.getInventory().addItem(stack); - } - } - - - player.setCompassTarget(target.getLocation()); - - double heightDiff = target.getLocation().getY() - player.getLocation().getY(); - - //Action Bar - if (UtilGear.isMat(player.getItemInHand(), Material.COMPASS)) - { - UtilTextBottom.display( - " " + C.cWhite + C.Bold + "Nearest Player: " + targetTeam.GetColor() + target.getName() + - " " + C.cWhite + C.Bold + "Distance: " + targetTeam.GetColor() + UtilMath.trim(1, bestDist) + - " " + C.cWhite + C.Bold + "Height: " + targetTeam.GetColor() + UtilMath.trim(1, heightDiff), player); - } - } - } - } - - @EventHandler - public void DropItem(PlayerDropItemEvent event) - { - if (Manager.GetGame() == null || !Manager.GetGame().CompassEnabled) - return; - - if (!UtilInv.IsItem(event.getItemDrop().getItemStack(), Material.COMPASS, (byte)0)) - return; - - //Cancel - event.setCancelled(true); - - //Inform - UtilPlayer.message(event.getPlayer(), F.main("Game", "You cannot drop " + F.item("Target Compass") + ".")); - } - - @EventHandler - public void DeathRemove(PlayerDeathEvent event) - { - if (Manager.GetGame() == null || !Manager.GetGame().CompassEnabled) - return; - - HashSet remove = new HashSet(); - - for (org.bukkit.inventory.ItemStack item : event.getDrops()) - if (UtilInv.IsItem(item, Material.COMPASS, (byte)0)) - remove.add(item); - - for (org.bukkit.inventory.ItemStack item : remove) - event.getDrops().remove(item); - } - - @EventHandler - public void SpectatorTeleport(PlayerInteractEvent event) - { - if (Manager.GetGame() == null) - return; - - if (event.getAction() == Action.PHYSICAL) - return; - - Player player = event.getPlayer(); - - if (!UtilGear.isMat(player.getItemInHand(), Material.COMPASS)) - return; - - if (Manager.GetGame().IsAlive(player)) - return; - - event.setCancelled(true); - - if (event.getAction() == Action.LEFT_CLICK_AIR || event.getAction() == Action.LEFT_CLICK_BLOCK) - { - // Teleport to nearest player when you left click compass - - if (!Recharge.Instance.use(player, "Spectate", 3000, true, false)) - { - return; - } - - spectateNearestPlayer(player); - } - else - { - // Right click - open spectator menu - - _spectatorShop.attemptShopOpen(player); - } - } - - private void spectateNearestPlayer(Player spectator) - { - GameTeam team = Manager.GetGame().GetTeam(spectator); - - Player target = null; - double bestDist = 0; - - for (Player other : Manager.GetGame().GetPlayers(true)) - { - GameTeam otherTeam = Manager.GetGame().GetTeam(other); - - //Same Team (Not Solo Game) && Alive - if (Manager.GetGame().GetTeamList().size() > 1 && (team != null && team.equals(otherTeam)) && Manager.GetGame().IsAlive(spectator)) - continue; - - double dist = UtilMath.offset(spectator, other); - - if (target == null || dist < bestDist) - { - target = other; - bestDist = dist; - } - } - - if (target != null) - { - spectator.teleport(target.getLocation().add(0, 1, 0)); - } - } - - @EventHandler - public void closeShop(GameStateChangeEvent event) - { - // Close shop when a game ends - if (event.GetState().equals(Game.GameState.End)) - { - for (Player player : UtilServer.getPlayers()) - { - if (_spectatorShop.isPlayerInShop(player)) - player.closeInventory(); - } - } - } - - @EventHandler - public void updateShop(UpdateEvent event) - { - if (event.getType() != UpdateType.SEC) - return; - - _spectatorShop.update(); - } - -} diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/anticheatmetadata/GameInfoMetadata.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/anticheatmetadata/GameInfoMetadata.java new file mode 100644 index 000000000..8cf07119d --- /dev/null +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/anticheatmetadata/GameInfoMetadata.java @@ -0,0 +1,207 @@ +package nautilus.game.arcade.anticheatmetadata; + +import java.util.ArrayList; +import java.util.HashMap; +import java.util.Map; +import java.util.UUID; + +import org.bukkit.Bukkit; +import org.bukkit.entity.Player; +import org.bukkit.event.EventHandler; +import org.bukkit.event.player.PlayerJoinEvent; + +import com.google.gson.JsonArray; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; + +import mineplex.core.antihack.logging.AnticheatMetadata; +import mineplex.core.common.util.UtilServer; + +import nautilus.game.arcade.ArcadeManager; +import nautilus.game.arcade.events.GameStateChangeEvent; +import nautilus.game.arcade.game.Game; +import nautilus.game.arcade.kit.Kit; +import nautilus.game.arcade.kit.ProgressingKit; +import nautilus.game.arcade.managers.GameHostManager; +import static mineplex.core.Managers.require; + +public class GameInfoMetadata extends AnticheatMetadata +{ + private static final String KEY_GAME_INFO = "game-info"; + private static final String KEY_GAME_MAP = "map"; + private static final String KEY_GAME_TYPE = "type"; + private static final String KEY_GAME_MODE = "mode"; + private static final String KEY_CURRENT_STATE = "current-state"; + private static final String KEY_STATE_START_TIME = "current-state-start-time"; + private static final String KEY_JOIN_GAME_TIME = "join-game-time-ms"; + + private static final String KEY_STATE_TIMES = "state-times"; + + private static final String KEY_KIT_INFO = "kit-info"; + private static final String KEY_KIT_NAME = "name"; + private static final String KEY_KIT_LEVEL = "level"; + + private static final String KEY_MPS = "mps"; + private static final String KEY_OWNER = "owner"; + + private static final String KEY_STATS = "stats"; + + private static final String KEY_WINNER = "winner"; + + private final Map _allGames = new HashMap<>(); + private final Map _currentGame = new HashMap<>(); + + private final ArcadeManager _arcadeManager = require(ArcadeManager.class); + + @Override + public String getId() + { + return "game-info"; + } + + @EventHandler + public void onJoin(PlayerJoinEvent event) + { + _allGames.put(event.getPlayer().getUniqueId(), new JsonArray()); + + JsonObject currentGame = buildCurrentGame(); + + if (currentGame != null) + { + _currentGame.put(event.getPlayer().getUniqueId(), currentGame); + } + } + + private JsonObject buildCurrentGame() + { + Game game = _arcadeManager.GetGame(); + + if (game == null) + return null; + + JsonObject currentGame = new JsonObject(); + + JsonObject gameInfo = new JsonObject(); + gameInfo.addProperty(KEY_GAME_MAP, game.WorldData.File); + gameInfo.addProperty(KEY_GAME_TYPE, game.GetName()); + gameInfo.addProperty(KEY_GAME_MODE, game.GetMode()); + gameInfo.addProperty(KEY_CURRENT_STATE, game.GetState().name()); + gameInfo.addProperty(KEY_STATE_START_TIME, game.GetStateTime()); + gameInfo.addProperty(KEY_JOIN_GAME_TIME, System.currentTimeMillis()); + + if (_arcadeManager.GetGameHostManager() != null && _arcadeManager.GetGameHostManager().isPrivateServer()) + { + GameHostManager gameHostManager = _arcadeManager.GetGameHostManager(); + + JsonObject mpsInfo = new JsonObject(); + mpsInfo.addProperty(KEY_OWNER, _arcadeManager.GetHost()); + + currentGame.add(KEY_MPS, mpsInfo); + } + + currentGame.add(KEY_GAME_INFO, gameInfo); + + JsonObject stateStartTimes = new JsonObject(); + stateStartTimes.addProperty(game.GetState().name(), game.GetStateTime()); + + currentGame.add(KEY_STATE_TIMES, stateStartTimes); + + return currentGame; + } + + @EventHandler + public void onStateChange(GameStateChangeEvent event) + { + if (event.GetState() == Game.GameState.Recruit) + { + for (Player player : UtilServer.getPlayersCollection()) + { + if (!_currentGame.containsKey(player.getUniqueId())) + { + _currentGame.put(player.getUniqueId(), buildCurrentGame()); + } + } + } + + if (event.GetState() == Game.GameState.Live) + { + _currentGame.forEach((id, obj) -> + { + Player player = Bukkit.getPlayer(id); + if (player != null) + { + Kit kit = event.GetGame().GetKit(player); + if (kit != null) + { + JsonObject kitInfo = new JsonObject(); + kitInfo.addProperty(KEY_KIT_NAME, kit.GetName()); + + if (kit instanceof ProgressingKit) + { + ProgressingKit pk = (ProgressingKit) kit; + kitInfo.addProperty(KEY_KIT_LEVEL, pk.getLevel(player.getUniqueId())); + } + + obj.add(KEY_KIT_INFO, kitInfo); + } + } + }); + + } + + _currentGame.values().forEach(obj -> + { + obj.get(KEY_STATE_TIMES).getAsJsonObject().addProperty(event.GetState().name(), System.currentTimeMillis()); + }); + + if (event.GetState() == Game.GameState.Dead) + { + new ArrayList<>(_currentGame.keySet()).forEach(ent -> archivePlayer(event.GetGame(), ent)); + } + } + + private void archivePlayer(Game game, UUID uuid) + { + JsonObject gameObj = _currentGame.remove(uuid); + + if (gameObj == null) + return; + + _allGames.get(uuid).add(gameObj); + + if (game == null) + return; + + Player player = Bukkit.getPlayer(uuid); + + if (player == null) + return; + + Map stats = game.GetStats().get(player); + + if (stats != null) + { + JsonObject statsObject = new JsonObject(); + stats.forEach(statsObject::addProperty); + + gameObj.add(KEY_STATS, statsObject); + } + + gameObj.addProperty(KEY_WINNER, game.Winner); + } + + @Override + public JsonElement build(UUID player) + { + archivePlayer(_arcadeManager.GetGame(), player); + + return _allGames.get(player); + } + + @Override + public void remove(UUID player) + { + _allGames.remove(player); + _currentGame.remove(player); + } +} diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/booster/GameBoosterManager.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/booster/GameBoosterManager.java index 52d1f27fc..832ba44f4 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/booster/GameBoosterManager.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/booster/GameBoosterManager.java @@ -84,7 +84,7 @@ public class GameBoosterManager extends MiniPlugin { Booster booster = event.getBooster(); - boolean isTesting = event.getBoosterGroup().equalsIgnoreCase("Testing"); + boolean isTesting = UtilServer.isTestServer(); if (event.getBoosterGroup().equals(_boosterGroup)) { diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/command/CancelNextGameCommand.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/command/CancelNextGameCommand.java index 8ac096981..ea04eefa4 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/command/CancelNextGameCommand.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/command/CancelNextGameCommand.java @@ -19,6 +19,6 @@ public class CancelNextGameCommand extends CommandBase @Override public void Execute(Player caller, String[] args) { - Plugin.getNextBestGameManager().cancel(caller, Plugin.getPartyManager().getParty(caller)); + Plugin.getNextBestGameManager().cancel(caller, Plugin.getPartyManager().getPartyByPlayer(caller)); } } diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/command/GameCmdModeCommand.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/command/GameCmdModeCommand.java index 7bd1080e4..fa0cd3003 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/command/GameCmdModeCommand.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/command/GameCmdModeCommand.java @@ -9,6 +9,8 @@ import mineplex.core.command.CommandBase; import mineplex.core.common.Rank; import mineplex.core.common.util.C; import mineplex.core.common.util.F; + +import io.netty.util.internal.chmv8.ForkJoinPool.ManagedBlocker; import nautilus.game.arcade.ArcadeManager; /** @@ -18,29 +20,34 @@ public class GameCmdModeCommand extends CommandBase { public GameCmdModeCommand(ArcadeManager plugin) { - super(plugin, Rank.JNR_DEV, "gamecmdmode"); + super(plugin, Rank.JNR_DEV, "gamecmdrank"); } @Override public void Execute(Player caller, String[] args) { - File file = new File(ArcadeManager.GAME_CMD_MODE_FILE); - - if (Plugin.isGameCommandMode()) + if (args.length < 1) { - // Disable game command mode. - if (file.exists()) - { - file.delete(); - } - - Plugin.setGameCommandMode(false); - caller.sendMessage(F.main("Server", "Game commands are now " + C.cRed + "disabled" + - C.cGray + ".")); + caller.sendMessage(F.main("Game", "/gamecmdrank ")); + return; } - else + + File file = new File(ArcadeManager.GAME_CMD_MODE_FILE); + Rank rank = Plugin.getGameCommandRank(); + Rank newRank = null; + + try + { + newRank = Rank.valueOf(args[0]); + } + catch (IllegalArgumentException e) + { + caller.sendMessage(F.main("Game", C.cRedB + "Invalid rank!")); + return; + } + + if (newRank == Rank.ALL) { - // Enable game command mode. if (!file.exists()) { try @@ -52,10 +59,16 @@ public class GameCmdModeCommand extends CommandBase e.printStackTrace(); } } - - Plugin.setGameCommandMode(true); - caller.sendMessage(F.main("Server", "Game commands are now " + C.cGreen + "enabled" + - C.cGray + ".")); } + else + { + if (file.exists()) + { + file.delete(); + } + } + + Plugin.setGameCommandMode(newRank); + caller.sendMessage(F.main("Game", "Players now need at least rank " + newRank.getTag(true, true) + C.cGray + " to use game commands.")); } } diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/command/GameCommand.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/command/GameCommand.java index e82fbefbd..9ddf2cfc9 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/command/GameCommand.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/command/GameCommand.java @@ -1,19 +1,23 @@ package nautilus.game.arcade.command; -import mineplex.core.common.util.F; -import mineplex.core.common.util.UtilPlayer; import org.bukkit.entity.Player; -import nautilus.game.arcade.ArcadeManager; import mineplex.core.command.MultiCommandBase; import mineplex.core.common.Rank; +import mineplex.core.common.util.F; +import mineplex.core.common.util.UtilPlayer; + +import nautilus.game.arcade.ArcadeManager; +import static nautilus.game.arcade.command.SetCommand.MAP_PREFIX; +import static nautilus.game.arcade.command.SetCommand.MODE_PREFIX; +import static nautilus.game.arcade.command.SetCommand.SOURCE_PREFIX; public class GameCommand extends MultiCommandBase { public GameCommand(ArcadeManager plugin) { super(plugin, Rank.ALL, "game"); - + AddCommand(new StartCommand(Plugin)); AddCommand(new StopCommand(Plugin)); AddCommand(new SetCommand(Plugin)); @@ -24,11 +28,10 @@ public class GameCommand extends MultiCommandBase { if (Plugin.canPlayerUseGameCmd(caller)) { - UtilPlayer.message(caller, F.main(Plugin.getName(), "Commands List:")); - UtilPlayer.message(caller, F.help("/game start", "Start the current game", Rank.ALL)); - UtilPlayer.message(caller, F.help("/game stop", "Stop the current game", Rank.ALL)); - UtilPlayer.message(caller, F.help("/game set (MapSource) (Map)", "Set the current game or next game", Rank.ALL)); - UtilPlayer.message(caller, F.main("Tip", "Use TAB for games/maps!")); + UtilPlayer.message(caller, F.main("Game", "Available Commands")); + UtilPlayer.message(caller, F.help("/game start", "Start the current game", Plugin.getGameCommandRank())); + UtilPlayer.message(caller, F.help("/game stop", "Stop the current game", Plugin.getGameCommandRank())); + caller.sendMessage(F.help(String.format("/game set [%s(gamemode)] [%s(mapsource)] [%s(mapname)]", MODE_PREFIX, SOURCE_PREFIX, MAP_PREFIX), "Set the current game or next game", Plugin.getGameCommandRank())); } } } diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/command/RequiredRankCommand.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/command/RequiredRankCommand.java index fbb89b22d..410a5454d 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/command/RequiredRankCommand.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/command/RequiredRankCommand.java @@ -7,6 +7,7 @@ import mineplex.core.command.CommandBase; import mineplex.core.common.Rank; import mineplex.core.common.util.F; import mineplex.core.common.util.UtilPlayer; +import mineplex.core.common.util.UtilServer; public class RequiredRankCommand extends CommandBase { @@ -22,7 +23,7 @@ public class RequiredRankCommand extends CommandBase @Override public void Execute(Player caller, String[] args) { - if(!_manager.getPlugin().getConfig().getString("serverstatus.group").equalsIgnoreCase("Testing")) + if(!UtilServer.isTestServer()) { UtilPlayer.message(caller, F.main("Command", "This is not a test server..")); return; diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/command/SetCommand.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/command/SetCommand.java index bdf234ebf..0365b2441 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/command/SetCommand.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/command/SetCommand.java @@ -1,29 +1,38 @@ package nautilus.game.arcade.command; -import mineplex.core.command.CommandBase; -import mineplex.core.common.Rank; -import mineplex.core.common.util.C; -import mineplex.core.common.util.F; -import mineplex.core.common.util.UtilPlayer; -import nautilus.game.arcade.ArcadeManager; -import nautilus.game.arcade.GameType; -import org.bukkit.ChatColor; +import java.util.ArrayList; +import java.util.Arrays; +import java.util.Collections; +import java.util.List; +import java.util.stream.Collectors; + import org.bukkit.command.CommandSender; import org.bukkit.entity.Player; -import java.util.ArrayList; -import java.util.List; +import mineplex.core.command.CommandBase; +import mineplex.core.common.Rank; +import mineplex.core.common.util.F; +import mineplex.core.common.util.UtilPlayer; + +import nautilus.game.arcade.ArcadeManager; +import nautilus.game.arcade.GameMode; +import nautilus.game.arcade.GameType; +import nautilus.game.arcade.game.Game; public class SetCommand extends CommandBase -{ +{ + public static final String MODE_PREFIX = "@e"; + public static final String SOURCE_PREFIX = "@s"; + public static final String MAP_PREFIX = "@m"; + public SetCommand(ArcadeManager plugin) { super(plugin, Rank.ALL, "set"); } - - @Override + + @Override public void Execute(Player caller, String[] args) - { + { if (Plugin.GetGame() == null) return; @@ -34,84 +43,398 @@ public class SetCommand extends CommandBase if (args.length == 0) { - caller.sendMessage(F.help("/game set (MapSource) (Map)", "Set the current game or next game", Rank.ADMIN)); - return; + caller.sendMessage(F.help(String.format("/game set [%s(gamemode)] [%s(mapsource)] [%s(mapname)]", MODE_PREFIX, SOURCE_PREFIX, MAP_PREFIX), "Set the current game or next game", Plugin.getGameCommandRank())); + return; } - - String game = args[0].toLowerCase(); - - if (args.length >= 2) + + if (!isValid(args)) { - String map = ""; - String source = game; - Plugin.GetGameCreationManager().MapSource = game; - - for(String token : args) - { - if(token.startsWith("@s")) - { - Plugin.GetGameCreationManager().MapSource = token.substring(1); - source = token.substring(2); - } - else if(token.startsWith("@m")) - { - Plugin.GetGameCreationManager().MapPref = token.substring(1); - map = token.substring(2); - } - else if(token.startsWith("@e")) - { - Plugin.GetGameCreationManager().ModePref = token.substring(2); - } - } - - UtilPlayer.message(caller, C.cAqua + C.Bold + "Map Preference: " + ChatColor.RESET + source + ":" + map); + UtilPlayer.message(caller, F.main("Game", "The order of the arguments is invalid")); + return; } - + + String game = args[0]; + //Parse Game - ArrayList matches = new ArrayList<>(); - for (GameType type : GameType.values()) - { - if (type.toString().toLowerCase().equals(game)) - { - matches.clear(); - matches.add(type); - break; - } - - if (type.toString().toLowerCase().contains(game)) - { - matches.add(type); - } - } - + List matches = matchGameType(game, false); + if (matches.size() == 0) { - caller.sendMessage("No results for: " + game); + UtilPlayer.message(caller, F.main("Game", "Could not find a GameType matching " + F.elem(game))); return; } - + if (matches.size() > 1) { - caller.sendMessage("Matched multiple games;"); - for (GameType cur : matches) - caller.sendMessage(cur.toString()); + UtilPlayer.message(caller, F.main("Game", "Found multiple GameTypes matching " + F.elem(game))); + UtilPlayer.sendMatches(caller, "Game", matches, Enum::name); return; } - - GameType type = matches.get(0); - Plugin.GetGame().setGame(type, caller, true); - if(Plugin.getPlugin().getConfig().getString("serverstatus.group").equalsIgnoreCase("Testing")) + + GameType gameType = matches.get(0); + + String gameModeStr = findGameMode(args); + GameMode selectedMode = null; + String mapSourceStr = findGameSource(args); + GameType selectedSource = null; + String mapStr = findMap(args); + String selectedMap = null; + + if (gameModeStr != null) + { + if (!gameType.hasGamemodes()) + { + UtilPlayer.message(caller, F.main("Game", "The selected GameType, " + F.elem(game) + ", does not have any GameModes")); + return; + } + List matchedGameModes = matchGameMode(gameType, gameModeStr, false); + if (matchedGameModes.size() == 0) + { + UtilPlayer.message(caller, F.main("Game", "Could not find a GameMode matching " + F.elem(gameModeStr))); + return; + } + if (matchedGameModes.size() > 1) + { + UtilPlayer.message(caller, F.main("Game", "Found multiple GameModes matching " + F.elem(gameModeStr))); + UtilPlayer.sendMatches(caller, "Game", matchedGameModes, gameMode -> gameMode.getName().replaceAll(" ", "")); + return; + } + selectedMode = matchedGameModes.get(0); + } + + if (mapSourceStr != null) + { + Class gameClass = gameType.getGameClass(); + + if (selectedMode != null) + { + gameClass = selectedMode.getGameClass(); + } + + List matchedGameTypes = getSources(gameType, gameClass, mapSourceStr, false); + if (matchedGameTypes.size() == 0) + { + UtilPlayer.message(caller, F.main("Game", "Could not find a MapSource matching " + F.elem(mapSourceStr))); + return; + } + if (matchedGameTypes.size() > 1) + { + UtilPlayer.message(caller, F.main("Game", "Found multiple MapSource matching " + F.elem(mapSourceStr))); + UtilPlayer.sendMatches(caller, "Game", matchedGameTypes, Enum::name); + return; + } + selectedSource = matchedGameTypes.get(0); + } + + if (mapStr != null) + { + Class gameClass = gameType.getGameClass(); + if (selectedMode != null) + { + gameClass = selectedMode.getGameClass(); + } + + List matchedMaps; + + // No particular source specified, we'll use all of them + if (selectedSource == null) + { + List mapTypes = Arrays.asList(Game.GetWorldHostNames(gameType, gameClass)); + matchedMaps = matchMaps(mapTypes, mapStr, false); + } + else + { + matchedMaps = matchMaps(Collections.singletonList(selectedSource), mapStr, false); + } + + if (matchedMaps.size() == 0) + { + UtilPlayer.message(caller, F.main("Game", "Could not find a Map matching " + F.elem(mapStr))); + return; + } + if (matchedMaps.size() > 1) + { + UtilPlayer.message(caller, F.main("Game", "Found multiple Maps matching " + F.elem(mapStr))); + UtilPlayer.sendMatches(caller, "Game", matchedMaps); + return; + } + + selectedMap = matchedMaps.get(0); + } + + if (selectedMode != null) + { + UtilPlayer.message(caller, F.main("Game", "Game Mode preference set to " + F.elem(selectedMode.getName()))); + Plugin.GetGameCreationManager().ModePref = selectedMode; + } + if (selectedSource != null) + { + UtilPlayer.message(caller, F.main("Game", "Map Source preference set to " + F.elem(selectedSource.name()))); + Plugin.GetGameCreationManager().MapSource = selectedSource; + } + if (selectedMap != null) + { + UtilPlayer.message(caller, F.main("Game", "Map preference set to " + F.elem(selectedMap))); + Plugin.GetGameCreationManager().MapPref = selectedMap; + } + + Plugin.GetGame().setGame(matches.get(0), caller, true); + if (Plugin.getPlugin().getConfig().getString("serverstatus.group").equalsIgnoreCase("Testing")) { Plugin.GetGameList().clear(); - Plugin.GetGameList().add(type); + Plugin.GetGameList().add(matches.get(0)); } } + private List matchGameType(String input, boolean isTabCompletion) + { + return matchGameType(input, GameType.values(), isTabCompletion); + } + + private List matchGameType(String input, GameType[] sources, boolean isTabCompletion) + { + input = input.toLowerCase(); + + List matches = new ArrayList<>(); + for (GameType type : sources) + { + String match = type.name().toLowerCase(); + if (match.equals(input)) + { + return Collections.singletonList(type); + } + else if (isTabCompletion ? match.startsWith(input) : match.contains(input)) + { + matches.add(type); + } + } + + if (matches.isEmpty()) + { + for (GameType type : sources) + { + String match = type.getDisplay().getName().replaceAll(" ", "").toLowerCase(); + if (match.equals(input)) + { + return Collections.singletonList(type); + } + else if (isTabCompletion ? match.startsWith(input) : match.contains(input)) + { + matches.add(type); + } + } + } + + return matches; + } + + private List matchGameMode(GameType type, String input, boolean isTabCompletion) + { + input = input.toLowerCase(); + + if (!type.hasGamemodes()) return Collections.emptyList(); + + List matches = new ArrayList<>(); + + for (GameMode gameMode : type.getGameModes()) + { + String match = gameMode.getName().replaceAll(" ", "").toLowerCase(); + if (match.equals(input)) + { + return Collections.singletonList(gameMode); + } + else if (isTabCompletion ? match.startsWith(input) : match.contains(input)) + { + matches.add(gameMode); + } + } + + return matches; + } + + private List getSources(GameType type, Class gameClass, String input, boolean isTabCompletion) + { + return matchGameType(input, Game.GetWorldHostNames(type, gameClass), isTabCompletion); + } + + private List matchMaps(List source, String input, boolean isTabCompletion) + { + input = input.toLowerCase(); + + List allMapNames = source.stream().flatMap(type -> Plugin.LoadFiles(type.GetName()).stream()).collect(Collectors.toList()); + + List matches = new ArrayList<>(); + + for (String map : allMapNames) + { + String match = map.replaceAll(" ", "").toLowerCase(); + if (match.equals(input)) + { + return Collections.singletonList(map.replaceAll(" ", "")); + } + else if (isTabCompletion ? match.startsWith(input) : match.contains(input)) + { + matches.add(map.replaceAll(" ", "")); + } + } + + return matches; + } + + private boolean isValid(String[] args) + { + boolean hasGameSource = false; + boolean hasMap = false; + for (String string : args) + { + if (string.startsWith(MODE_PREFIX)) + { + if (hasGameSource || hasMap) + return false; + } + else if (string.startsWith(SOURCE_PREFIX)) + { + if (hasMap) + return false; + hasGameSource = true; + } + else if (string.startsWith(MAP_PREFIX)) + { + hasMap = true; + } + } + + return true; + } + + private String findGameMode(String[] args) + { + for (String string : args) + { + if (string.startsWith(MODE_PREFIX)) + { + return string.substring(MODE_PREFIX.length()); + } + } + return null; + } + + private String findGameSource(String[] args) + { + for (String string : args) + { + if (string.startsWith(SOURCE_PREFIX)) + { + return string.substring(SOURCE_PREFIX.length()); + } + } + return null; + } + + private String findMap(String[] args) + { + for (String string : args) + { + if (string.startsWith(MAP_PREFIX)) + { + return string.substring(MAP_PREFIX.length()); + } + } + return null; + } + @Override public List onTabComplete(CommandSender sender, String commandLabel, String[] args) { - String lastArg = args[args.length - 1]; + if (!(sender instanceof Player) || !Plugin.canPlayerUseGameCmd((Player) sender)) + { + return null; + } - return getMatches(lastArg, GameType.values()); + if (args.length == 1) + { + return matchGameType(args[0], true).stream().map(Enum::name).collect(Collectors.toList()); + } + else + { + if (isValid(args)) + { + List matches = matchGameType(args[0], true); + + if (matches.size() == 1) + { + GameType gameType = matches.get(0); + + String gameModeStr = findGameMode(args); + String gameSourceStr = findGameSource(args); + String mapStr = findMap(args); + + String lastArg = args[args.length - 1]; + if (lastArg.startsWith(MODE_PREFIX)) + { + if (gameType.hasGamemodes()) + { + return matchGameMode(gameType, gameModeStr, true).stream().map(mode -> MODE_PREFIX + mode.getName().replaceAll(" ", "")).collect(Collectors.toList()); + } + } + else if (lastArg.startsWith(SOURCE_PREFIX)) + { + Class gameClass = gameType.getGameClass(); + if (gameType.hasGamemodes()) + { + // If there are gamemodes, you must provide a gamemode type + if (gameModeStr == null) + return null; + + List matchedModes = matchGameMode(gameType, gameModeStr, true); + + // If more than one mode has been matched, we can't show sources + if (matchedModes.size() != 1) + return null; + + gameClass = matchedModes.get(0).getGameClass(); + } + + return getSources(gameType, gameClass, gameSourceStr, true).stream().map(type -> SOURCE_PREFIX + type.name().replaceAll(" ", "")).collect(Collectors.toList()); + } + else if (lastArg.startsWith(MAP_PREFIX)) + { + Class gameClass = gameType.getGameClass(); + + if (gameType.hasGamemodes()) + { + // If the game has a gamemode, the mode type must be set + if (gameModeStr == null) + return null; + + List matchedModes = matchGameMode(gameType, gameModeStr, true); + + // If more than one mode has been matched, we can't show maps + if (matchedModes.size() != 1) + return null; + + gameClass = matchedModes.get(0).getGameClass(); + } + + // No particular source specified, we'll use all of them + if (gameSourceStr == null) + { + List mapTypes = Arrays.asList(Game.GetWorldHostNames(gameType, gameClass)); + return matchMaps(mapTypes, mapStr, true).stream().map(str -> MAP_PREFIX + str).collect(Collectors.toList()); + } + + List sources = getSources(gameType, gameClass, gameSourceStr, true); + + // If a source has been provided, it must be valid + if (sources.size() != 1) + return null; + + return matchMaps(sources, mapStr, true).stream().map(str -> MAP_PREFIX + str).collect(Collectors.toList()); + } + } + } + } + + return null; } } diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/command/StartCommand.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/command/StartCommand.java index d45a14ada..2a754461e 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/command/StartCommand.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/command/StartCommand.java @@ -7,6 +7,8 @@ import nautilus.game.arcade.game.Game.GameState; import mineplex.core.command.CommandBase; import mineplex.core.common.Rank; import mineplex.core.common.util.C; +import mineplex.core.common.util.F; +import mineplex.core.common.util.UtilPlayer; public class StartCommand extends CommandBase { @@ -25,21 +27,29 @@ public class StartCommand extends CommandBase if (Plugin.GetGame() == null || Plugin.GetGame().GetState() == GameState.Loading) { - caller.sendMessage(C.cRed + C.Bold + "Game is loading..."); + UtilPlayer.message(caller, F.main("Game", "The game is currently loading, it cannot be started!")); return; } if (Plugin.GetGame().GetState() != GameState.Recruit) { - caller.sendMessage(C.cRed + C.Bold + "Game is already in progress..."); + UtilPlayer.message(caller, F.main("Game", "The game is already starting, it cannot be started again!")); return; } - int seconds; + int seconds = 10; + if(args.length > 0) - seconds = Integer.parseInt(args[0]); - else - seconds = 10; + { + try + { + seconds = Integer.parseInt(args[0]); + } + catch (NumberFormatException ex) + { + UtilPlayer.message(caller, F.main("Game", F.elem(args[0]) + " is not a number!")); + } + } Plugin.GetGameManager().StateCountdown(Plugin.GetGame(), seconds, true); diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/command/StopCommand.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/command/StopCommand.java index bfc1dfa27..3b46e0c55 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/command/StopCommand.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/command/StopCommand.java @@ -8,6 +8,8 @@ import nautilus.game.arcade.game.Game.GameState; import mineplex.core.command.CommandBase; import mineplex.core.common.Rank; import mineplex.core.common.util.C; +import mineplex.core.common.util.F; +import mineplex.core.common.util.UtilPlayer; public class StopCommand extends CommandBase { @@ -25,11 +27,14 @@ public class StopCommand extends CommandBase } if (Plugin.GetGame() == null) - return; - - if (Plugin.GetGame().GetState() == GameState.End || Plugin.GetGame().GetState() == GameState.End) { - caller.sendMessage("Game is already ending..."); + UtilPlayer.message(caller, F.main("Game", "There is no game to stop!")); + return; + } + + if (Plugin.GetGame().GetState() == GameState.End || Plugin.GetGame().GetState() == GameState.WinRoom) + { + UtilPlayer.message(caller, F.main("Game", "The game is already ending, it cannot be ended again")); return; } else if (Plugin.GetGame().GetState() == GameState.Recruit) diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/command/TauntCommand.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/command/TauntCommand.java new file mode 100644 index 000000000..bc17eb83d --- /dev/null +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/command/TauntCommand.java @@ -0,0 +1,51 @@ +package nautilus.game.arcade.command; + +import org.bukkit.Bukkit; +import org.bukkit.entity.Player; + +import mineplex.core.Managers; +import mineplex.core.command.CommandBase; +import mineplex.core.common.Rank; +import mineplex.core.common.util.UtilPlayer; +import mineplex.core.common.util.UtilTime; +import mineplex.core.gadget.event.TauntCommandEvent; +import mineplex.core.gadget.gadgets.taunts.GameType; +import mineplex.minecraft.game.core.combat.CombatManager; + +import nautilus.game.arcade.ArcadeManager; +import nautilus.game.arcade.game.Game; + +public class TauntCommand extends CommandBase +{ + + private ArcadeManager _arcadeManager; + + public TauntCommand(ArcadeManager manager) + { + super(manager, Rank.ALL, "taunt"); + _arcadeManager = manager; + } + + @Override + public void Execute(Player player, String[] args) + { + boolean pvp = false; + CombatManager combatManager = Managers.get(CombatManager.class); + if (combatManager != null) + { + pvp = UtilTime.elapsed(combatManager.Get(player).GetLastCombatEngaged(), 5000 * 60); + } + Game game = _arcadeManager.GetGame(); + GameType gameType = GameType.NONE; + if (game != null) + { + gameType = GameType.valueOf(game.GetType().toString().toUpperCase()); + } + TauntCommandEvent event = new TauntCommandEvent(player, _arcadeManager.isGameInProgress(), + _arcadeManager.GetGame().IsAlive(player), UtilPlayer.isSpectator(player), combatManager.Get(player).GetLastCombatEngaged(), + gameType); + Bukkit.getPluginManager().callEvent(event); + } + + +} diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/DebugCommand.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/DebugCommand.java new file mode 100644 index 000000000..fec572ef5 --- /dev/null +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/DebugCommand.java @@ -0,0 +1,17 @@ +package nautilus.game.arcade.game; + +import mineplex.core.Managers; +import mineplex.core.command.CommandBase; +import mineplex.core.common.Rank; +import nautilus.game.arcade.ArcadeManager; +import org.bukkit.entity.Player; + +public abstract class DebugCommand extends CommandBase +{ + public DebugCommand(String commandName, Rank requiredRank, Rank... specificRanks) + { + super(Managers.get(ArcadeManager.class), requiredRank, specificRanks, commandName); + } + + public abstract void Execute(Player caller, String[] args); +} diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/Game.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/Game.java index 430870814..572189cc2 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/Game.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/Game.java @@ -13,6 +13,9 @@ import java.util.Optional; import java.util.Set; import java.util.UUID; +import mineplex.core.lifetimes.Lifetimed; +import mineplex.core.lifetimes.ListenerComponent; +import mineplex.core.lifetimes.PhasedLifetime; import org.apache.commons.lang3.tuple.Triple; import org.bukkit.Bukkit; import org.bukkit.ChatColor; @@ -48,6 +51,8 @@ import com.mojang.authlib.GameProfile; import mineplex.core.Managers; import mineplex.core.antihack.AntiHack; +import mineplex.core.command.CommandCenter; +import mineplex.core.common.Rank; import mineplex.core.common.util.C; import mineplex.core.common.util.F; import mineplex.core.common.util.NautHashMap; @@ -72,6 +77,7 @@ import mineplex.core.utils.UtilGameProfile; import mineplex.minecraft.game.classcombat.event.ClassCombatCreatureAllowSpawnEvent; import mineplex.minecraft.game.core.combat.DeathMessageType; import mineplex.minecraft.game.core.combat.event.CombatDeathEvent; + import nautilus.game.arcade.ArcadeFormat; import nautilus.game.arcade.ArcadeManager; import nautilus.game.arcade.GameType; @@ -79,13 +85,11 @@ import nautilus.game.arcade.events.GameStateChangeEvent; import nautilus.game.arcade.events.PlayerGameRespawnEvent; import nautilus.game.arcade.events.PlayerStateChangeEvent; import nautilus.game.arcade.game.GameTeam.PlayerState; -import nautilus.game.arcade.game.games.hideseek.HideSeek; -import nautilus.game.arcade.game.games.minestrike.Minestrike; -import nautilus.game.arcade.game.games.sneakyassassins.SneakyAssassins; -import nautilus.game.arcade.game.games.survivalgames.SurvivalGames; -import nautilus.game.arcade.game.games.uhc.UHC; -import nautilus.game.arcade.game.games.wither.WitherGame; +import nautilus.game.arcade.game.games.build.Build; +import nautilus.game.arcade.game.games.draw.Draw; +import nautilus.game.arcade.game.games.speedbuilders.SpeedBuilders; import nautilus.game.arcade.game.modules.Module; +import nautilus.game.arcade.game.modules.compass.CompassModule; import nautilus.game.arcade.kit.ChampionsKit; import nautilus.game.arcade.kit.Kit; import nautilus.game.arcade.kit.KitAvailability; @@ -109,9 +113,8 @@ import nautilus.game.arcade.world.WorldData; import net.minecraft.server.v1_8_R3.EntityItem; import net.minecraft.server.v1_8_R3.PacketPlayInUseEntity; -public abstract class Game implements Listener +public abstract class Game extends ListenerComponent implements Lifetimed { - private final static int MAX_TICK_SPEED_MEASUREMENT = 40; public long getGameLiveTime() @@ -135,6 +138,7 @@ public abstract class Game implements Listener private GameType _gameType; protected String[] _gameDesc; + private PhasedLifetime _lifetime = new PhasedLifetime<>(); // Map private HashMap> _files; @@ -281,13 +285,7 @@ public abstract class Game implements Listener public boolean DontAllowOverfill = false; // Addons - public boolean CompassEnabled = false; - public boolean CompassGiveItem = true; - public boolean CompassGiveItemSpectators = true; - public boolean SoupEnabled = true; - public boolean TeamArmor = false; - public boolean TeamArmorHotbar = false; public boolean GiveClock = true; @@ -296,10 +294,10 @@ public abstract class Game implements Listener public long PrepareTime = 9000; public boolean PlaySoundGameStart = true; - public double XpMult = 1; + public double XpMult = 2; public boolean SpeedMeasurement = false; - + // Chat Stats public final ChatStatData Kills = new ChatStatData("Kills", "Kills", true); public final ChatStatData Assists = new ChatStatData("Assists", "Assists", true); @@ -365,6 +363,8 @@ public abstract class Game implements Listener // Used for "%player% is your teammate" public boolean ShowTeammateMessage = false; + + public boolean ShowEveryoneSpecChat = true; public boolean ForceTeamSize = true; public int PlayersPerTeam = 2; @@ -383,11 +383,13 @@ public abstract class Game implements Listener private Map, Module> _modules = new HashMap<>(); private HashMap>> _playerPastLocs = new HashMap<>(); - + private Set _debugCommands = new HashSet<>(); + public Game(ArcadeManager manager, GameType gameType, Kit[] kits, String[] gameDesc) { Manager = manager; + _lifetime.register(this); // Player List UtilTabTitle.broadcastHeaderAndFooter(C.cGold + C.Bold + gameType.GetName(), "Visit " + C.cGreen + "www.mineplex.com" + ChatColor.RESET + " for News, Forums and Shop"); @@ -418,9 +420,9 @@ public abstract class Game implements Listener ArrayList list = new ArrayList(); for (String cur : _files.get(game)) { - if (cur.toLowerCase().contains(Manager.GetGameCreationManager().MapPref.toLowerCase())) + if (cur.replaceAll(" ", "").toLowerCase().contains(Manager.GetGameCreationManager().MapPref.toLowerCase())) { - if (game.GetName().toLowerCase().contains(Manager.GetGameCreationManager().MapSource.toLowerCase())) + if (Manager.GetGameCreationManager().MapSource == null || game == Manager.GetGameCreationManager().MapSource) { list.add(cur); System.out.print("Map Preference: " + cur); @@ -470,14 +472,14 @@ public abstract class Game implements Listener System.out.println("Loading " + GetName() + "..."); } - public T registerModule(T module) + // You should never use this so please don't. Use Module.register instead + public final void registerModule(Module module) { if (!_modules.containsKey(module.getClass())) { _modules.put(module.getClass(), module); UtilServer.RegisterEvents(module); module.initialize(this); - return module; } else { @@ -495,6 +497,23 @@ public abstract class Game implements Listener } } + public void registerDebugCommand(DebugCommand debugCommand) + { + if (UtilServer.isTestServer()) + { + debugCommand.setRequiredRank(Rank.SNR_MODERATOR); + } + _debugCommands.add(debugCommand); + for (String string : debugCommand.Aliases()) + { + if (CommandCenter.getCommands().containsKey(string.toLowerCase())) + { + throw new IllegalArgumentException("Existing command: " + string.toLowerCase()); + } + } + CommandCenter.Instance.addCommand(debugCommand); + } + public void setKits(Kit[] kits) { _kits = kits; @@ -511,34 +530,39 @@ public abstract class Game implements Listener } public GameType[] GetWorldHostNames() + { + return GetWorldHostNames(GetType(), getClass()); + } + + public static GameType[] GetWorldHostNames(GameType targetType, Class gameMode) { GameType[] mapSource = new GameType[] { - GetType() + targetType }; - if (GetType().getMapSource() != null) + if (targetType.getMapSource() != null) { - if (GetType().ownMaps()) + if (targetType.ownMaps()) { int i = 1; - mapSource = new GameType[GetType().getMapSource().length + 1]; - for (GameType type : GetType().getMapSource()) + mapSource = new GameType[targetType.getMapSource().length + 1]; + for (GameType type : targetType.getMapSource()) { mapSource[i] = type; i++; } - mapSource[0] = GetType(); + mapSource[0] = targetType; } else { - mapSource = GetType().getMapSource(); + mapSource = targetType.getMapSource(); } } - if (GetType().isUsingGameModesMaps()) + if (targetType.isUsingGameModesMaps()) { - GameType mode = GetType().getModeGameType(getClass()); + GameType mode = targetType.getModeGameType(gameMode); if (mode.getMapSource() != null) return mode.getMapSource(); @@ -548,36 +572,6 @@ public abstract class Game implements Listener return mapSource; } - public String GetGameNamebyMap(String game, String map) - { - for (GameType type : _files.keySet()) - { - if (type.GetName().toLowerCase().contains(game.toLowerCase())) - { - for (String string : _files.get(type)) - { - if (string.toLowerCase().contains(map.toLowerCase())) - { - return type.GetName(); - } - } - } - } - return null; - } - - public GameType GetGameByMapList(ArrayList maps) - { - for (GameType game : _files.keySet()) - { - if (maps.equals(_files.get(game))) - { - return game; - } - } - return null; - } - public String GetMode() { return null; @@ -658,6 +652,68 @@ public abstract class Game implements Listener return _gameState; } + public void prepareToRecruit() + { + generateTeams(); + recruit(); + } + + public void recruit() + { + SetState(GameState.Recruit); + } + + + public void generateTeams() + { + int count = 1; + + for (String team : WorldData.SpawnLocs.keySet()) + { + ChatColor color; + + if (team.equalsIgnoreCase("RED")) color = ChatColor.RED; + else if (team.equalsIgnoreCase("YELLOW")) color = ChatColor.YELLOW; + else if (team.equalsIgnoreCase("GREEN")) color = ChatColor.GREEN; + else if (team.equalsIgnoreCase("BLUE")) color = ChatColor.AQUA; + else + { + color = ChatColor.DARK_GREEN; + + if (GetTeamList().size()%14 == 0) if (WorldData.SpawnLocs.size() > 1) color = ChatColor.RED; + if (GetTeamList().size()%14 == 1) color = ChatColor.YELLOW; + if (GetTeamList().size()%14 == 2) color = ChatColor.GREEN; + if (GetTeamList().size()%14 == 3) color = ChatColor.AQUA; + if (GetTeamList().size()%14 == 4) color = ChatColor.GOLD; + if (GetTeamList().size()%14 == 5) color = ChatColor.LIGHT_PURPLE; + if (GetTeamList().size()%14 == 6) color = ChatColor.DARK_BLUE; + if (GetTeamList().size()%14 == 7) color = ChatColor.WHITE; + if (GetTeamList().size()%14 == 8) color = ChatColor.BLUE; + if (GetTeamList().size()%14 == 9) color = ChatColor.DARK_GREEN; + if (GetTeamList().size()%14 == 10) color = ChatColor.DARK_PURPLE; + if (GetTeamList().size()%14 == 11) color = ChatColor.DARK_RED; + if (GetTeamList().size()%14 == 12) color = ChatColor.DARK_AQUA; + } + + //Random Names + String teamName = team; + if (WorldData.SpawnLocs.size() > 12) + { + teamName = String.valueOf(count); + count++; + } + + GameTeam newTeam = new GameTeam(this, teamName, color, WorldData.SpawnLocs.get(team)); + AddTeam(newTeam); + } + + //Restrict Kits + RestrictKits(); + + //Parse Data + ParseData(); + } + public void SetState(GameState state) { _gameState = state; @@ -665,30 +721,14 @@ public abstract class Game implements Listener if (this._gameState == Game.GameState.Prepare) { - Managers.get(AntiHack.class).enableNewAnticheat(); - if (this instanceof HideSeek) + if (!(this instanceof SpeedBuilders) && !(this instanceof Build) && !(this instanceof Draw)) { - Managers.get(AntiHack.class).registerFilter(player -> - { - if (GetTeam(player) == ((HideSeek) this).getHiders()) - { - return false; - } - return true; - }); - } - else if (this instanceof SurvivalGames || this instanceof Minestrike || this instanceof SneakyAssassins || this instanceof UHC || this instanceof WitherGame) - { - Managers.get(AntiHack.class).registerFilter(player -> - { - return false; - }); + Managers.get(AntiHack.class).enableAnticheat(); } } else if (this._gameState == Game.GameState.End) { - Managers.get(AntiHack.class).disableNewAnticheat(); - Managers.get(AntiHack.class).registerFilter(null); + Managers.get(AntiHack.class).disableAnticheat(); } @@ -698,6 +738,9 @@ public abstract class Game implements Listener for (Player player : UtilServer.getPlayers()) player.leaveVehicle(); + + _lifetime.setPhase(state); + // Event GameStateChangeEvent stateEvent = new GameStateChangeEvent(this, state); UtilServer.getServer().getPluginManager().callEvent(stateEvent); @@ -769,14 +812,15 @@ public abstract class Game implements Listener { ProgressingKit progressingKit = (ProgressingKit) kit; - if(!progressingKit.hasUpgrades()) + if (!progressingKit.hasUpgrades()) { - for(Perk perk : progressingKit.getNonUpgradePerks()) + for (Perk perk : progressingKit.getNonUpgradePerks()) { UtilServer.RegisterEvents(perk); perk.registeredEvents(); } - } else + } + else { for (Perk[] upgradePerks : progressingKit.getPerks()) { @@ -862,6 +906,29 @@ public abstract class Game implements Listener // Use this to parse in extra location data from maps } + public boolean loadNecessaryChunks(long maxMilliseconds) + { + long endTime = System.currentTimeMillis() + maxMilliseconds; + + int minX = WorldData.MinX >> 4; + int minZ = WorldData.MinZ >> 4; + int maxX = WorldData.MaxX >> 4; + int maxZ = WorldData.MaxZ >> 4; + + for (int x = minX; x <= maxX; x++) + { + for (int z = minZ; z <= maxZ; z++) + { + if (System.currentTimeMillis() >= endTime) + return false; + + WorldData.World.getChunkAt(x, z); + } + } + + return true; + } + public void SetPlayerTeam(Player player, GameTeam team, boolean in) { // Clean Old Team @@ -1092,6 +1159,25 @@ public abstract class Game implements Listener return GetKit(player).GetName().equals(kit.GetName()); } + public void disqualify(Player player) + { + RemoveTeamPreference(player); + GetPlayerKits().remove(player); + GetPlayerGems().remove(player); + + //Remove Team + GameTeam team = GetTeam(player); + if (team != null) + { + if (InProgress()) + SetPlayerState(player, PlayerState.OUT); + else + team.RemovePlayer(player); + } + + Manager.addSpectator(player, false); + } + public boolean SetPlayerState(Player player, PlayerState state) { GameTeam team = GetTeam(player); @@ -1158,6 +1244,11 @@ public abstract class Game implements Listener return false; } + public boolean shouldHeal(Player player) + { + return true; + } + public ArrayList GetPlayers(boolean aliveOnly) { ArrayList players = new ArrayList(); @@ -1568,6 +1659,11 @@ public abstract class Game implements Listener if (!UtilTime.elapsed(_helpTimer, 8000)) return; + + if (Manager.GetGameHostManager().isCommunityServer()) + { + return; + } if (_helpColor == ChatColor.YELLOW) _helpColor = ChatColor.GOLD; @@ -1786,18 +1882,6 @@ public abstract class Game implements Listener SetState(GameState.End); } - @EventHandler - public void disableParticles(GameStateChangeEvent event) - { - if (event.GetState() == GameState.Prepare && Manager.getCosmeticManager().getGadgetManager().hideParticles()) - { - for (Player player : GetPlayers(false)) - { - getArcadeManager().getCosmeticManager().getGadgetManager().removeGadgetType(player, GadgetType.PARTICLE); - } - } - } - @EventHandler public void onGameStart(GameStateChangeEvent event) { @@ -2256,7 +2340,11 @@ public abstract class Game implements Listener public void disable() { + cleanupModules(); + cleanupCommands(); Managers.get(AntiHack.class).resetIgnoredChecks(); + getLifetime().end(); + getStatTrackers().forEach(HandlerList::unregisterAll); } @EventHandler @@ -2354,8 +2442,20 @@ public abstract class Game implements Listener this._modules.clear(); } + public void cleanupCommands() + { + this._debugCommands.forEach(command -> CommandCenter.Instance.removeCommand(command)); + this._debugCommands.clear(); + } + public T getModule(Class clazz) { return clazz.cast(_modules.get(clazz)); } + + @Override + public PhasedLifetime getLifetime() + { + return _lifetime; + } } diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/GameComponent.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/GameComponent.java new file mode 100644 index 000000000..2dba42c07 --- /dev/null +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/GameComponent.java @@ -0,0 +1,37 @@ +package nautilus.game.arcade.game; + +import mineplex.core.lifetimes.Lifetime; +import mineplex.core.lifetimes.Lifetimed; +import mineplex.core.lifetimes.ListenerComponent; + +import java.util.Arrays; + +public class GameComponent extends ListenerComponent implements Lifetimed +{ + private final Lifetime _lifetime; + private final T _game; + + public GameComponent(T game, Game.GameState...active) + { + _game = game; + if (active == null || active.length == 0) + { + // Active for the entire duration of the game. + _lifetime = game.getLifetime(); + _lifetime.register(this); + } else + { + _lifetime = game.getLifetime().register(this, Arrays.asList(active)); + } + } + + @Override + public Lifetime getLifetime() + { + return _lifetime; + } + + public T getGame() { + return _game; + } +} diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/TeamGame.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/TeamGame.java index c59d26e5a..3fa641486 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/TeamGame.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/TeamGame.java @@ -10,6 +10,8 @@ import nautilus.game.arcade.ArcadeManager; import nautilus.game.arcade.GameType; import nautilus.game.arcade.events.PlayerStateChangeEvent; import nautilus.game.arcade.game.GameTeam.PlayerState; +import nautilus.game.arcade.game.modules.RejoinModule; +import nautilus.game.arcade.game.modules.RejoinModule.RejoinPlayerData; import nautilus.game.arcade.kit.Kit; import org.bukkit.entity.Player; import org.bukkit.event.EventHandler; @@ -25,15 +27,8 @@ import java.util.List; public abstract class TeamGame extends Game { - public long RejoinTime = 120000; - protected ArrayList _places = new ArrayList(); - public NautHashMap RejoinTimes = new NautHashMap(); - public NautHashMap RejoinTeam = new NautHashMap(); - public NautHashMap RejoinKit = new NautHashMap(); - public NautHashMap RejoinHealth = new NautHashMap(); - public TeamGame(ArcadeManager manager, GameType gameType, Kit[] kits, String[] gameDesc) { super(manager, gameType, kits, gameDesc); @@ -74,137 +69,6 @@ public abstract class TeamGame extends Game return; team.RemovePlayer(player); - - if (player.isDead()) - return; - - if (player.getWorld().getName().equalsIgnoreCase("world")) - return; - - if (!QuitOut) - { - //Store - RejoinTimes.put(player.getName(), System.currentTimeMillis()); - RejoinTeam.put(player.getName(), team); - - if (GetKit(player) != null) - RejoinKit.put(player.getName(), GetKit(player)); - - RejoinHealth.put(player.getName(), player.getHealth()); - - if (!GetLocationStore().containsKey(player.getName())) - { - GetLocationStore().put(player.getName(), player.getLocation()); - } - - //Announcement - Announce(team.GetColor() + C.Bold + player.getName() + " has disconnected! " + UtilTime.convert(RejoinTime, 0, TimeUnit.MINUTES) + " minutes to rejoin.", false); - } - } - - @EventHandler(priority = EventPriority.LOWEST) - public void PlayerLoginAllow(PlayerLoginEvent event) - { - if (!InProgress() || QuitOut) - return; - - //Rejoined - GameTeam team = RejoinTeam.remove(event.getPlayer().getName()); - if (team != null && RejoinTimes.remove(event.getPlayer().getName()) != null) - { - team.AddPlayer(event.getPlayer(), true); - Announce(team.GetColor() + C.Bold + event.getPlayer().getName() + " has reconnected!", false); - - - Kit kit = RejoinKit.remove(event.getPlayer().getName()); - if (kit != null) - _playerKit.put(event.getPlayer(), kit); - -// final Player player = event.getPlayer(); -// Bukkit.getScheduler().runTaskLater(Manager.getPlugin(), new Runnable() -// { -// @Override -// public void run() -// { -// if (RejoinHealth.containsKey(player.getName())) -// { -// double health = RejoinHealth.remove(player.getName()); -// player.setHealth(health); -// player.sendMessage("DEBUG: restored hp to " + health); -// } -// } -// }, 20); - } - } - - //Do this on Join, not Login, otherwise player no get heal. - @EventHandler (priority = EventPriority.MONITOR) - public void playerRejoinGame(PlayerJoinEvent event) - { - if (!InProgress() || QuitOut) - return; - - Player player = event.getPlayer(); - - if (RejoinHealth.containsKey(player.getName())) - { - double health = RejoinHealth.remove(player.getName()); - if (health > 0) - { - getArcadeManager().runSyncLater(() -> - { - player.setHealth(health); - }, 1L); - } - } - } - - @EventHandler - public void PlayerRejoinExpire(UpdateEvent event) - { - if (event.getType() != UpdateType.SEC || QuitOut) - return; - - Iterator rejoinIterator = RejoinTimes.keySet().iterator(); - - while (rejoinIterator.hasNext()) - { - String name = rejoinIterator.next(); - - if (!UtilTime.elapsed(RejoinTimes.get(name), RejoinTime)) - continue; - - rejoinIterator.remove(); - - //Get Team (By Name) - GameTeam team = RejoinTeam.remove(name); - if (team != null) - Announce(team.GetColor() + C.Bold + name + " did not reconnect in time!", false); - - RejoinKit.remove(name); - RejoinHealth.remove(name); - } - } - - @EventHandler - public void RejoinCommand(PlayerCommandPreprocessEvent event) - { - if (!QuitOut && event.getPlayer().isOp() && event.getMessage().startsWith("/allowrejoin")) - { - String[] toks = event.getMessage().split(" "); - - if (toks.length <= 1) - { - event.getPlayer().sendMessage("Missing Param!"); - } - else - { - RejoinTimes.put(toks[1], System.currentTimeMillis()); - event.getPlayer().sendMessage("Allowed " + toks[1] + " to rejoin!"); - } - - event.setCancelled(true); - } } public void EndCheck() @@ -221,8 +85,13 @@ public abstract class TeamGame extends Game if (!QuitOut) { //Offline Player Team - for (GameTeam team : RejoinTeam.values()) - teamsAlive.add(team); + if (getModule(RejoinModule.class) != null) + { + for (RejoinPlayerData data : getModule(RejoinModule.class).getData()) + { + teamsAlive.add(data.getTeam()); + } + } } if (teamsAlive.size() <= 1) diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/baconbrawl/BaconBrawl.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/baconbrawl/BaconBrawl.java index adc29452f..d6574a600 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/baconbrawl/BaconBrawl.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/baconbrawl/BaconBrawl.java @@ -14,6 +14,7 @@ import nautilus.game.arcade.game.SoloGame; import nautilus.game.arcade.game.games.baconbrawl.kits.KitMamaPig; import nautilus.game.arcade.game.games.baconbrawl.kits.KitPig; import nautilus.game.arcade.game.games.baconbrawl.kits.KitSheepPig; +import nautilus.game.arcade.game.modules.compass.CompassModule; import nautilus.game.arcade.kit.Kit; public class BaconBrawl extends SoloGame @@ -48,6 +49,12 @@ public class BaconBrawl extends SoloGame DamageDealt, DamageTaken ); + + new CompassModule() + .setGiveCompass(true) + .setGiveCompassToSpecs(true) + .setGiveCompassToAlive(false) + .register(this); } @EventHandler diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/baconbrawl/kits/KitSheepPig.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/baconbrawl/kits/KitSheepPig.java index 725f5b910..2f9c89563 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/baconbrawl/kits/KitSheepPig.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/baconbrawl/kits/KitSheepPig.java @@ -73,7 +73,7 @@ public class KitSheepPig extends ProgressingKit sheep.setColor(DyeColor.PINK); } - UtilEnt.Vegetate(entity); + UtilEnt.vegetate(entity); SpawnCustom(entity); diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/barbarians/Barbarians.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/barbarians/Barbarians.java index c48e919eb..116bc9ef4 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/barbarians/Barbarians.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/barbarians/Barbarians.java @@ -14,6 +14,7 @@ import nautilus.game.arcade.ArcadeManager; import nautilus.game.arcade.GameType; import nautilus.game.arcade.game.SoloGame; import nautilus.game.arcade.game.games.barbarians.kits.*; +import nautilus.game.arcade.game.modules.compass.CompassModule; import nautilus.game.arcade.kit.Kit; import nautilus.game.arcade.managers.chat.ChatStatData; import nautilus.game.arcade.stats.BlockBreakStatTracker; @@ -40,7 +41,10 @@ public class Barbarians extends SoloGame }); this.DamageTeamSelf = true; - this.CompassEnabled = true; + + new CompassModule() + .setGiveCompassToAlive(true) + .register(this); this.BlockBreakAllow.add(5); this.BlockBreakAllow.add(17); diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/barbarians/kits/KitArcher.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/barbarians/kits/KitArcher.java index afeb88449..9f3688900 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/barbarians/kits/KitArcher.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/barbarians/kits/KitArcher.java @@ -34,10 +34,10 @@ public class KitArcher extends ProgressingKit }; private static final ItemStack[] ARMOR = { - ItemStackFactory.Instance.CreateStack(Material.CHAINMAIL_HELMET), - ItemStackFactory.Instance.CreateStack(Material.CHAINMAIL_CHESTPLATE), + ItemStackFactory.Instance.CreateStack(Material.CHAINMAIL_BOOTS), ItemStackFactory.Instance.CreateStack(Material.CHAINMAIL_LEGGINGS), - ItemStackFactory.Instance.CreateStack(Material.CHAINMAIL_BOOTS) + ItemStackFactory.Instance.CreateStack(Material.CHAINMAIL_CHESTPLATE), + ItemStackFactory.Instance.CreateStack(Material.CHAINMAIL_HELMET) }; private static final ItemStack IN_HAND = new ItemStack(Material.BOW); diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/barbarians/kits/KitBomber.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/barbarians/kits/KitBomber.java index bbb59fa86..cf72093e7 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/barbarians/kits/KitBomber.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/barbarians/kits/KitBomber.java @@ -34,10 +34,10 @@ public class KitBomber extends ProgressingKit }; private static final ItemStack[] ARMOR = { - ItemStackFactory.Instance.CreateStack(Material.CHAINMAIL_HELMET), - ItemStackFactory.Instance.CreateStack(Material.CHAINMAIL_CHESTPLATE), - ItemStackFactory.Instance.CreateStack(Material.CHAINMAIL_LEGGINGS), - ItemStackFactory.Instance.CreateStack(Material.CHAINMAIL_BOOTS) + ItemStackFactory.Instance.CreateStack(Material.CHAINMAIL_BOOTS), + ItemStackFactory.Instance.CreateStack(Material.CHAINMAIL_LEGGINGS), + ItemStackFactory.Instance.CreateStack(Material.CHAINMAIL_CHESTPLATE), + ItemStackFactory.Instance.CreateStack(Material.CHAINMAIL_HELMET) }; private static final ItemStack IN_HAND = new ItemStack(Material.TNT); diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/barbarians/kits/KitBrute.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/barbarians/kits/KitBrute.java index 10cdea1ac..8e79b03b1 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/barbarians/kits/KitBrute.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/barbarians/kits/KitBrute.java @@ -31,10 +31,10 @@ public class KitBrute extends ProgressingKit }; private static final ItemStack[] ARMOR = { - ItemStackFactory.Instance.CreateStack(Material.IRON_HELMET), - ItemStackFactory.Instance.CreateStack(Material.IRON_CHESTPLATE), - ItemStackFactory.Instance.CreateStack(Material.IRON_LEGGINGS), - ItemStackFactory.Instance.CreateStack(Material.IRON_BOOTS) + ItemStackFactory.Instance.CreateStack(Material.IRON_BOOTS), + ItemStackFactory.Instance.CreateStack(Material.IRON_LEGGINGS), + ItemStackFactory.Instance.CreateStack(Material.IRON_CHESTPLATE), + ItemStackFactory.Instance.CreateStack(Material.IRON_HELMET) }; private static final ItemStack IN_HAND = new ItemStack(Material.IRON_AXE); diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/basketball/Basketball.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/basketball/Basketball.java index 4493f5f19..95b05a1f6 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/basketball/Basketball.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/basketball/Basketball.java @@ -26,6 +26,8 @@ import nautilus.game.arcade.game.TeamGame; import nautilus.game.arcade.game.games.basketball.data.ScoringManager; import nautilus.game.arcade.game.games.basketball.data.ThrowData; import nautilus.game.arcade.game.games.basketball.kit.BasketballPlayerKit; +import nautilus.game.arcade.game.modules.TeamArmorModule; +import nautilus.game.arcade.game.modules.compass.CompassModule; import nautilus.game.arcade.kit.Kit; import net.minecraft.server.v1_8_R3.BlockPosition; import org.bukkit.Bukkit; @@ -92,9 +94,7 @@ public class Basketball extends TeamGame "Left Click an opposing player to try and steal the ball" } ); - - this.TeamArmor = true; - this.TeamArmorHotbar = true; + this.HealthSet = 20; this.HungerSet = 20; this.Damage = false; @@ -102,6 +102,17 @@ public class Basketball extends TeamGame this.AllowParticles = false; this.GameTimeout = -1; _score = new ScoringManager(this); + + new CompassModule() + .setGiveCompass(true) + .setGiveCompassToSpecs(true) + .setGiveCompassToAlive(false) + .register(this); + + new TeamArmorModule() + .giveTeamArmor() + .giveHotbarItem() + .register(this); } private boolean isOutOfBounds(Location loc, boolean ball) @@ -137,7 +148,7 @@ public class Basketball extends TeamGame this.CreatureAllowOverride = true; _velocity = -7; Entity e = Manager.GetCreature().SpawnEntity(loc, EntityType.SLIME); - UtilEnt.Vegetate(e, true); + UtilEnt.vegetate(e, true); UtilEnt.ghost(e, true, false); ((Slime)e).setSize(1); this.CreatureAllowOverride = false; diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/bossbattles/BossBattles.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/bossbattles/BossBattles.java index bf8e86089..9c12bd47d 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/bossbattles/BossBattles.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/bossbattles/BossBattles.java @@ -19,6 +19,7 @@ import nautilus.game.arcade.game.games.champions.kits.KitBrute; import nautilus.game.arcade.game.games.champions.kits.KitKnight; import nautilus.game.arcade.game.games.champions.kits.KitMage; import nautilus.game.arcade.game.games.champions.kits.KitRanger; +import nautilus.game.arcade.game.modules.compass.CompassModule; import nautilus.game.arcade.kit.Kit; import org.bukkit.Bukkit; import org.bukkit.Location; @@ -55,6 +56,12 @@ public class BossBattles extends TeamGame CreatureAllowOverride = true; PrepareFreeze = false; + new CompassModule() + .setGiveCompass(true) + .setGiveCompassToSpecs(true) + .setGiveCompassToAlive(false) + .register(this); + // registerChatStats(Kills); // Game giving constant errors when loading. } diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/bossbattles/displays/IronWizardDisplay.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/bossbattles/displays/IronWizardDisplay.java index 614728267..fb08f2abf 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/bossbattles/displays/IronWizardDisplay.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/bossbattles/displays/IronWizardDisplay.java @@ -8,8 +8,6 @@ import nautilus.game.arcade.game.games.bossbattles.BossBattles; import org.bukkit.Location; import org.bukkit.entity.EntityType; import org.bukkit.entity.IronGolem; -import org.bukkit.event.EventHandler; -import org.bukkit.event.player.PlayerInteractEntityEvent; public class IronWizardDisplay extends BossDisplay { @@ -27,7 +25,7 @@ public class IronWizardDisplay extends BossDisplay _golem = (IronGolem) getLocation().getWorld().spawnEntity(getLocation(), EntityType.IRON_GOLEM); _golem.teleport(getLocation()); - UtilEnt.Vegetate(_golem); + UtilEnt.vegetate(_golem); addEntity(_golem); } diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/bossbattles/displays/SlimeKingDisplay.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/bossbattles/displays/SlimeKingDisplay.java index a2da07725..d5f46afc5 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/bossbattles/displays/SlimeKingDisplay.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/bossbattles/displays/SlimeKingDisplay.java @@ -7,10 +7,7 @@ import nautilus.game.arcade.game.games.bossbattles.BossBattles; import org.bukkit.Location; import org.bukkit.entity.EntityType; -import org.bukkit.entity.IronGolem; import org.bukkit.entity.Slime; -import org.bukkit.event.EventHandler; -import org.bukkit.event.player.PlayerInteractEntityEvent; public class SlimeKingDisplay extends BossDisplay { @@ -31,7 +28,7 @@ public class SlimeKingDisplay extends BossDisplay _slime.teleport(getLocation()); - UtilEnt.Vegetate(_slime); + UtilEnt.vegetate(_slime); addEntity(_slime); } diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/bossbattles/displays/SnakeDisplay.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/bossbattles/displays/SnakeDisplay.java index 44a373b6f..e4ff3e152 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/bossbattles/displays/SnakeDisplay.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/bossbattles/displays/SnakeDisplay.java @@ -7,11 +7,7 @@ import nautilus.game.arcade.game.games.bossbattles.BossBattles; import org.bukkit.Location; import org.bukkit.entity.EntityType; -import org.bukkit.entity.IronGolem; import org.bukkit.entity.Sheep; -import org.bukkit.entity.Slime; -import org.bukkit.event.EventHandler; -import org.bukkit.event.player.PlayerInteractEntityEvent; public class SnakeDisplay extends BossDisplay { @@ -30,7 +26,7 @@ public class SnakeDisplay extends BossDisplay _sheep.teleport(getLocation()); - UtilEnt.Vegetate(_sheep); + UtilEnt.vegetate(_sheep); addEntity(_sheep); } diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/bossbattles/displays/SpiderDisplay.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/bossbattles/displays/SpiderDisplay.java index 1afd06f6a..219083d9c 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/bossbattles/displays/SpiderDisplay.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/bossbattles/displays/SpiderDisplay.java @@ -29,7 +29,7 @@ public class SpiderDisplay extends BossDisplay Entity entity = getLocation().getWorld().spawnEntity(getLocation(), EntityType.SPIDER); - UtilEnt.Vegetate(entity); + UtilEnt.vegetate(entity); this.addEntity(entity); } diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/bouncyballs/Ball.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/bouncyballs/Ball.java index c8ab8f459..d59015956 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/bouncyballs/Ball.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/bouncyballs/Ball.java @@ -108,7 +108,7 @@ public class Ball _ball = _ballSpawn.getWorld().spawn(_ballSpawn, Slime.class); _ball.setSize(2); - UtilEnt.Vegetate(_ball); + UtilEnt.vegetate(_ball); UtilEnt.ghost(_ball, false, false); _host.CreatureAllowOverride = false; diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/bouncyballs/BouncyBalls.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/bouncyballs/BouncyBalls.java index ce464297f..652a197ef 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/bouncyballs/BouncyBalls.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/bouncyballs/BouncyBalls.java @@ -14,6 +14,7 @@ import nautilus.game.arcade.GameType; import nautilus.game.arcade.game.SoloGame; import nautilus.game.arcade.game.games.bouncyballs.kits.*; import nautilus.game.arcade.game.games.bouncyballs.Ball; +import nautilus.game.arcade.game.modules.compass.CompassModule; import nautilus.game.arcade.kit.Kit; import nautilus.game.arcade.managers.chat.ChatStatData; @@ -37,6 +38,12 @@ public class BouncyBalls extends SoloGame this.HungerSet = 20; + new CompassModule() + .setGiveCompass(true) + .setGiveCompassToSpecs(true) + .setGiveCompassToAlive(false) + .register(this); + // registerChatStats(); } diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/bridge/Bridge.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/bridge/Bridge.java index 93e34e5c9..a6d5d92f3 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/bridge/Bridge.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/bridge/Bridge.java @@ -18,6 +18,7 @@ import nautilus.game.arcade.game.Game; import nautilus.game.arcade.game.GameTeam; import nautilus.game.arcade.game.TeamGame; import nautilus.game.arcade.game.games.bridge.kits.*; +import nautilus.game.arcade.game.modules.compass.CompassModule; import nautilus.game.arcade.kit.Kit; import nautilus.game.arcade.ore.OreHider; import nautilus.game.arcade.ore.OreObsfucation; @@ -205,7 +206,9 @@ public class Bridge extends TeamGame implements OreObsfucation WorldWaterDamage = 0; WorldBoundaryKill = false; - CompassEnabled = true; + new CompassModule() + .setGiveCompassToAlive(true) + .register(this); DeathDropItems = true; @@ -1582,12 +1585,12 @@ public class Bridge extends TeamGame implements OreObsfucation if (team.GetPlayers(true).size() > 0) teamsAlive.add(team); - if (!QuitOut) - { - //Offline Player Team - for (GameTeam team : RejoinTeam.values()) - teamsAlive.add(team); - } +// if (!QuitOut) +// { +// //Offline Player Team +// for (GameTeam team : RejoinTeam.values()) +// teamsAlive.add(team); +// } if (teamsAlive.size() <= 1) { diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/build/Build.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/build/Build.java index e9a7cec4a..1a0458b5d 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/build/Build.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/build/Build.java @@ -91,6 +91,8 @@ import mineplex.core.common.util.UtilTextMiddle; import mineplex.core.common.util.UtilTime; import mineplex.core.explosion.ExplosionEvent; import mineplex.core.itemstack.ItemStackFactory; +import mineplex.core.portal.GenericServer; +import mineplex.core.portal.Intent; import mineplex.core.recharge.Recharge; import mineplex.core.updater.UpdateType; import mineplex.core.updater.event.UpdateEvent; @@ -104,6 +106,7 @@ import nautilus.game.arcade.game.GameTeam; import nautilus.game.arcade.game.games.build.gui.MobShop; import nautilus.game.arcade.game.games.build.gui.OptionsShop; import nautilus.game.arcade.game.games.build.kits.KitBuilder; +import nautilus.game.arcade.game.modules.compass.CompassModule; import nautilus.game.arcade.kit.Kit; import nautilus.game.arcade.managers.chat.ChatStatData; import nautilus.game.arcade.stats.BlockBreakStatTracker; @@ -162,6 +165,12 @@ public class Build extends Game public Build(ArcadeManager manager) { this(manager, GameType.Build); + + new CompassModule() + .setGiveCompass(true) + .setGiveCompassToSpecs(true) + .setGiveCompassToAlive(false) + .register(this); } protected Build(ArcadeManager manager, GameType gameType) @@ -639,7 +648,7 @@ public class Build extends Game UtilPlayer.message(_viewData.Player, C.cWhite + C.Bold + "Inappropriate Builds can result in a Master Buildres ban."); //Return to Hub - getArcadeManager().GetPortal().sendPlayerToServer(_viewData.Player, "Lobby"); + getArcadeManager().GetPortal().sendPlayerToGenericServer(_viewData.Player, GenericServer.HUB, Intent.KICK); } protected void tallyScores() @@ -1659,7 +1668,7 @@ public class Build extends Game UtilPlayer.message(player, C.cRed + C.Bold + "You have been flagged as an Inappropriate Builder!"); UtilPlayer.message(player, C.cRed + C.Bold + "As a result, you are banned from this game."); player.playSound(player.getLocation(), Sound.ENDERDRAGON_GROWL, 10f, 1f); - getArcadeManager().GetPortal().sendPlayerToServer(player, "Lobby"); + getArcadeManager().GetPortal().sendPlayerToGenericServer(player, GenericServer.HUB, Intent.KICK); } } } diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/build/BuildData.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/build/BuildData.java index fa4c8fe05..433d8363d 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/build/BuildData.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/build/BuildData.java @@ -197,7 +197,7 @@ public class BuildData } Entities.add(entity); - UtilEnt.Vegetate(entity, true); + UtilEnt.vegetate(entity, true); UtilEnt.ghost(entity, true, false); return true; } @@ -412,11 +412,11 @@ public class BuildData return; } - for (; x <= Math.max(CornerA.getBlockX(), CornerB.getBlockX()) ; x++) + for (int dx = x; dx <= Math.max(CornerA.getBlockX(), CornerB.getBlockX()) ; dx++) { - for (; z <= Math.max(CornerA.getBlockZ(), CornerB.getBlockZ()) ; z++) + for (int dz = z; dz <= Math.max(CornerA.getBlockZ(), CornerB.getBlockZ()) ; dz++) { - MapUtil.QuickChangeBlockAt(player.getWorld(), x, y, z, mat, data); + MapUtil.QuickChangeBlockAt(player.getWorld(), dx, y, dz, mat, data); } } } diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/build/gui/MobShop.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/build/gui/MobShop.java index 812e90336..c95c24145 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/build/gui/MobShop.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/build/gui/MobShop.java @@ -25,17 +25,17 @@ public class MobShop extends ShopBase public boolean attemptShopOpen(Player player, BuildData data, Entity entity) { - if (!getOpenedShop().contains(player.getName())) + if (!getOpenedShop().contains(player.getUniqueId())) { if (!canOpenShop(player)) return false; - getOpenedShop().add(player.getName()); + getOpenedShop().add(player.getUniqueId()); openShopForPlayer(player); - if (!getPlayerPageMap().containsKey(player.getName())) + if (!getPlayerPageMap().containsKey(player.getUniqueId())) { - getPlayerPageMap().put(player.getName(), buildPagesFor(player, data, entity)); + getPlayerPageMap().put(player.getUniqueId(), buildPagesFor(player, data, entity)); } openPageForPlayer(player, getOpeningPageForPlayer(player)); diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/build/modes/TeamBuild.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/build/modes/TeamBuild.java index ef5e41c08..b668eead5 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/build/modes/TeamBuild.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/build/modes/TeamBuild.java @@ -17,6 +17,9 @@ import mineplex.core.common.util.UtilMath; import mineplex.core.common.util.UtilPlayer; import mineplex.core.common.util.UtilTextMiddle; import mineplex.core.common.util.UtilTime; +import mineplex.core.portal.GenericServer; +import mineplex.core.portal.Intent; + import nautilus.game.arcade.ArcadeManager; import nautilus.game.arcade.GameType; import nautilus.game.arcade.events.GameStateChangeEvent; @@ -42,7 +45,7 @@ public class TeamBuild extends Build TeamMode = true; - registerModule(new TeamModule()); + new TeamModule().register(this); TeamPerSpawn = true; FillTeamsInOrderToCount = 2; @@ -102,7 +105,7 @@ public class TeamBuild extends Build Announce(C.cWhite + C.Bold + player.getName() + " has been reported for an inappropriate build.", false); //Return to Hub - getArcadeManager().GetPortal().sendPlayerToServer(player, "Lobby"); + getArcadeManager().GetPortal().sendPlayerToGenericServer(player, GenericServer.HUB, Intent.KICK); } getViewData().Spawn.getWorld().playSound(getViewData().Spawn, Sound.ENDERDRAGON_GROWL, 10f, 1f); diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/buildmavericks/BuildMavericks.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/buildmavericks/BuildMavericks.java index 7d8f96b27..25c540cd3 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/buildmavericks/BuildMavericks.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/buildmavericks/BuildMavericks.java @@ -10,6 +10,8 @@ import nautilus.game.arcade.ArcadeManager; import nautilus.game.arcade.GameType; import nautilus.game.arcade.game.games.build.Build; import nautilus.game.arcade.game.games.build.BuildData; +import nautilus.game.arcade.game.modules.compass.CompassModule; + import org.bukkit.Location; import org.bukkit.entity.Player; @@ -45,6 +47,12 @@ public class BuildMavericks extends Build _reposetory = new MavericksBuildRepository(); _notifyFailure = false; + + new CompassModule() + .setGiveCompass(true) + .setGiveCompassToSpecs(true) + .setGiveCompassToAlive(false) + .register(this); } @Override diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/cards/Cards.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/cards/Cards.java index f038c1fb2..f1d583e86 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/cards/Cards.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/cards/Cards.java @@ -13,6 +13,7 @@ import nautilus.game.arcade.events.PlayerPrepareTeleportEvent; import nautilus.game.arcade.game.SoloGame; import nautilus.game.arcade.game.games.GameScore; import nautilus.game.arcade.game.games.cards.kits.KitPlayer; +import nautilus.game.arcade.game.modules.compass.CompassModule; import nautilus.game.arcade.kit.Kit; import org.bukkit.Location; @@ -72,6 +73,12 @@ public class Cards extends SoloGame _cardFactory = new CardFactory(); registerChatStats(); + + new CompassModule() + .setGiveCompass(true) + .setGiveCompassToSpecs(true) + .setGiveCompassToAlive(false) + .register(this); } @Override diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/castlesiege/CastleSiege.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/castlesiege/CastleSiege.java index 7a8bffcce..a5a67d2d0 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/castlesiege/CastleSiege.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/castlesiege/CastleSiege.java @@ -69,6 +69,7 @@ import nautilus.game.arcade.game.games.castlesiege.kits.KitHumanPeasant; import nautilus.game.arcade.game.games.castlesiege.kits.KitUndeadArcher; import nautilus.game.arcade.game.games.castlesiege.kits.KitUndeadGhoul; import nautilus.game.arcade.game.games.castlesiege.kits.KitUndeadZombie; +import nautilus.game.arcade.game.modules.compass.CompassModule; import nautilus.game.arcade.kit.Kit; import nautilus.game.arcade.kit.NullKit; import nautilus.game.arcade.stats.BloodThirstyStatTracker; @@ -230,6 +231,12 @@ public class CastleSiege extends TeamGame ); registerChatStats(); + + new CompassModule() + .setGiveCompass(true) + .setGiveCompassToSpecs(true) + .setGiveCompassToAlive(false) + .register(this); } @Override diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/castlesiege/kits/KitHumanKnight.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/castlesiege/kits/KitHumanKnight.java index d918b34eb..ec8a3ddbc 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/castlesiege/kits/KitHumanKnight.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/castlesiege/kits/KitHumanKnight.java @@ -45,10 +45,10 @@ public class KitHumanKnight extends KitHuman }; private static final ItemStack[] ARMOR = { - ItemStackFactory.Instance.CreateStack(Material.IRON_HELMET), - ItemStackFactory.Instance.CreateStack(Material.IRON_CHESTPLATE), - ItemStackFactory.Instance.CreateStack(Material.IRON_LEGGINGS), - ItemStackFactory.Instance.CreateStack(Material.IRON_BOOTS) + ItemStackFactory.Instance.CreateStack(Material.IRON_BOOTS), + ItemStackFactory.Instance.CreateStack(Material.IRON_LEGGINGS), + ItemStackFactory.Instance.CreateStack(Material.IRON_CHESTPLATE), + ItemStackFactory.Instance.CreateStack(Material.IRON_HELMET) }; public static final ItemStack IN_HAND = new ItemStack(Material.IRON_SWORD); diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/castlesiege/kits/KitHumanMarksman.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/castlesiege/kits/KitHumanMarksman.java index 1b01d6622..fcd021465 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/castlesiege/kits/KitHumanMarksman.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/castlesiege/kits/KitHumanMarksman.java @@ -41,10 +41,10 @@ public class KitHumanMarksman extends KitHuman }; private static final ItemStack[] ARMOR = { - ItemStackFactory.Instance.CreateStack(Material.CHAINMAIL_HELMET), - ItemStackFactory.Instance.CreateStack(Material.CHAINMAIL_CHESTPLATE), - ItemStackFactory.Instance.CreateStack(Material.CHAINMAIL_LEGGINGS), - ItemStackFactory.Instance.CreateStack(Material.CHAINMAIL_BOOTS) + ItemStackFactory.Instance.CreateStack(Material.CHAINMAIL_BOOTS), + ItemStackFactory.Instance.CreateStack(Material.CHAINMAIL_LEGGINGS), + ItemStackFactory.Instance.CreateStack(Material.CHAINMAIL_CHESTPLATE), + ItemStackFactory.Instance.CreateStack(Material.CHAINMAIL_HELMET) }; public static final ItemStack IN_HAND = new ItemStack(Material.BOW); diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/christmas/Christmas.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/christmas/Christmas.java index 5733e3108..794bc4cc6 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/christmas/Christmas.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/christmas/Christmas.java @@ -23,9 +23,8 @@ import org.bukkit.event.player.PlayerCommandPreprocessEvent; import org.bukkit.event.player.PlayerInteractAtEntityEvent; import org.bukkit.util.Vector; +import mineplex.core.common.currency.GlobalCurrency; import mineplex.core.common.util.C; -import mineplex.core.common.util.Callback; -import mineplex.core.common.util.F; import mineplex.core.common.util.MapUtil; import mineplex.core.common.util.UtilBlock; import mineplex.core.common.util.UtilMath; @@ -35,6 +34,7 @@ import mineplex.core.common.util.UtilTime; import mineplex.core.packethandler.IPacketHandler; import mineplex.core.packethandler.PacketInfo; import mineplex.core.recharge.Recharge; +import mineplex.core.titles.tracks.HolidayCheerTrack; import mineplex.core.updater.UpdateType; import mineplex.core.updater.event.UpdateEvent; import mineplex.minecraft.game.core.damage.CustomDamageEvent; @@ -51,6 +51,7 @@ import nautilus.game.arcade.game.games.christmas.parts.Part2; import nautilus.game.arcade.game.games.christmas.parts.Part3; import nautilus.game.arcade.game.games.christmas.parts.Part4; import nautilus.game.arcade.game.games.christmas.parts.Part5; +import nautilus.game.arcade.game.modules.compass.CompassModule; import nautilus.game.arcade.kit.Kit; import net.minecraft.server.v1_8_R3.PacketPlayOutAttachEntity; import net.minecraft.server.v1_8_R3.PacketPlayOutEntityDestroy; @@ -131,6 +132,7 @@ public class Christmas extends SoloGame } } }; + public boolean ReachedEnding = false; public Christmas(ArcadeManager manager) { @@ -157,6 +159,12 @@ public class Christmas extends SoloGame DamageDealt, DamageTaken ); + + new CompassModule() + .setGiveCompass(true) + .setGiveCompassToSpecs(true) + .setGiveCompassToAlive(false) + .register(this); } //parse 129 19 47 48 103 86 137 56 22 45 121 14 15 16 87 88 89 153 173 172 162 @@ -277,6 +285,7 @@ public class Christmas extends SoloGame { if ((_part == null || _part.IsDone()) && _parts != null && !_parts.isEmpty()) { + if (_part != null) HandlerList.unregisterAll(_part); @@ -477,29 +486,22 @@ public class Christmas extends SoloGame if (!player.isOnline()) continue; - if (Manager.GetTaskManager().hasCompletedTask(player, "CC Reward 2015")) + if (IsAlive(player)) + { + Manager.getTrackManager().getTrack(HolidayCheerTrack.class).wonGame(player); + } + + Manager.getTrackManager().getTrack(HolidayCheerTrack.class).wonRound(player); + + if (Manager.GetDonation().Get(player).ownsUnknownSalesPackage("Christmas Kings Head")) { SetCustomWinMessage(player, "You already earned your reward"); } else { - SetCustomWinMessage(player, "You earned " + C.cYellow + "2x Winter Holiday Treasure"); + SetCustomWinMessage(player, "You earned " + C.cYellow + "Christmas King Morph"); - Manager.GetTaskManager().completedTask(new Callback() - { - @Override - public void run(Boolean data) - { - if (data) - { - Manager.getInventoryManager().addItemToInventory(player, "Winter Chest", 2); - } - else - { - UtilPlayer.message(player, F.main("Inventory", "An error occured while giving you " + C.cRed + "2x Winter Holiday Treasure" + C.cGray + ".")); - } - } - }, player, "CC Reward 2015"); + Manager.GetDonation().purchaseUnknownSalesPackage(player, "Christmas Kings Head", GlobalCurrency.TREASURE_SHARD, 0, true, null); } } @@ -514,6 +516,7 @@ public class Christmas extends SoloGame { for (Player player : GetPlayers(false)) { + Manager.getTrackManager().getTrack(HolidayCheerTrack.class).wonRound(player); Manager.GetGame().AddGems(player, 10, "Participation", false, false); } @@ -521,10 +524,11 @@ public class Christmas extends SoloGame AnnounceEnd(_badGuys); SetState(GameState.End); } - else if (UtilTime.elapsed(GetStateTime(), _gameTime)) + else if (UtilTime.elapsed(GetStateTime(), _gameTime) && !ReachedEnding) { for (Player player : GetPlayers(false)) { + Manager.getTrackManager().getTrack(HolidayCheerTrack.class).wonRound(player); Manager.GetGame().AddGems(player, 10, "Participation", false, false); } @@ -665,9 +669,12 @@ public class Christmas extends SoloGame Scoreboard.write(C.cWhite + GetPlayers(true).size()); //Time - Scoreboard.writeNewLine(); - Scoreboard.write(C.cYellowB + "Time Left"); - Scoreboard.write(C.cWhite + UtilTime.MakeStr(_gameTime - (System.currentTimeMillis() - GetStateTime()))); + if (!ReachedEnding) + { + Scoreboard.writeNewLine(); + Scoreboard.write(C.cYellowB + "Time Left"); + Scoreboard.write(C.cWhite + UtilTime.MakeStr(_gameTime - (System.currentTimeMillis() - GetStateTime()))); + } Scoreboard.draw(); } diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/christmas/Sleigh.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/christmas/Sleigh.java index 26ef62540..1e63440f4 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/christmas/Sleigh.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/christmas/Sleigh.java @@ -51,7 +51,7 @@ public class Sleigh Target = loc.clone(); CentralEntity = loc.getWorld().spawn(loc, Chicken.class); - UtilEnt.Vegetate(CentralEntity, true); + UtilEnt.vegetate(CentralEntity, true); UtilEnt.ghost(CentralEntity, true, false); Host.Manager.GetCondition().Factory().Invisible("Sleigh", (LivingEntity) CentralEntity, null, Double.MAX_VALUE, 3, false, false, true); diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/christmas/SleighHorse.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/christmas/SleighHorse.java index 8bbe45336..cbd84ff1c 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/christmas/SleighHorse.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/christmas/SleighHorse.java @@ -187,7 +187,7 @@ public class SleighHorse horseId = UtilEnt.getNewEntityId(false); _previousDir = getAngles(_lastFacing.getYaw()); Ent = _lastFacing.getWorld().spawn(_lastFacing.subtract(0, 0.5, 0), Horse.class); - UtilEnt.Vegetate(Ent); + UtilEnt.vegetate(Ent); UtilEnt.ghost(Ent, true, false); Ent.setRemoveWhenFarAway(false); diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/christmas/SleighPart.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/christmas/SleighPart.java index 877d36049..0181704a7 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/christmas/SleighPart.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/christmas/SleighPart.java @@ -36,7 +36,7 @@ public class SleighPart Ent.setAgeLock(true); Ent.setRemoveWhenFarAway(false); - UtilEnt.Vegetate(Ent, true); + UtilEnt.vegetate(Ent, true); UtilEnt.ghost(Ent, true, false); sleigh.Host.Manager.GetCondition().Factory().Invisible("Sleigh", Ent, null, Double.MAX_VALUE, 3, false, false, true); @@ -87,7 +87,7 @@ public class SleighPart return null; Skeleton skel = Ent.getWorld().spawn(Ent.getLocation().add(0, 1, 0), Skeleton.class); - UtilEnt.Vegetate(skel); + UtilEnt.vegetate(skel); UtilEnt.ghost(skel, true, false); ItemStack head = new ItemStack(Material.LEATHER_HELMET); @@ -169,7 +169,7 @@ public class SleighPart newTop.setAgeLock(true); newTop.setRemoveWhenFarAway(false); - UtilEnt.Vegetate(newTop, true); + UtilEnt.vegetate(newTop, true); UtilEnt.ghost(newTop, true, false); sleigh.Host.Manager.GetCondition().Factory().Invisible("Sleigh", newTop, null, Double.MAX_VALUE, 3, false, false, true); diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/christmas/content/BossSnowmanPattern.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/christmas/content/BossSnowmanPattern.java index 0b0909fd9..b3a571140 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/christmas/content/BossSnowmanPattern.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/christmas/content/BossSnowmanPattern.java @@ -1,7 +1,6 @@ package nautilus.game.arcade.game.games.christmas.content; import java.util.ArrayList; -import java.util.HashMap; import java.util.Iterator; import mineplex.core.common.util.UtilAction; @@ -9,11 +8,10 @@ import mineplex.core.common.util.UtilEnt; import mineplex.core.common.util.UtilMath; import mineplex.core.common.util.UtilTime; import mineplex.core.recharge.Recharge; -import nautilus.game.arcade.game.games.christmas.Christmas; + import nautilus.game.arcade.game.games.christmas.parts.Part5; import net.minecraft.server.v1_8_R3.EntityCreature; -import org.bukkit.Effect; import org.bukkit.Location; import org.bukkit.craftbukkit.v1_8_R3.entity.CraftCreature; import org.bukkit.entity.Player; @@ -116,7 +114,7 @@ public class BossSnowmanPattern Location loc = _spawnA.get(i); Snowman ent = loc.getWorld().spawn(loc, Snowman.class); - UtilEnt.Vegetate(ent); + UtilEnt.vegetate(ent); UtilEnt.ghost(ent, true, false); _ents.add(new BossSnowman(ent, loc, _aDir)); } @@ -129,7 +127,7 @@ public class BossSnowmanPattern Location loc = _spawnB.get(i); Snowman ent = loc.getWorld().spawn(loc, Snowman.class); - UtilEnt.Vegetate(ent); + UtilEnt.vegetate(ent); UtilEnt.ghost(ent, true, false); _ents.add(new BossSnowman(ent, loc, _bDir)); } diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/christmas/content/CaveGiant.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/christmas/content/CaveGiant.java index 65c5b40d1..98fd71794 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/christmas/content/CaveGiant.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/christmas/content/CaveGiant.java @@ -10,7 +10,6 @@ import nautilus.game.arcade.game.games.christmas.parts.Part4; import org.bukkit.Location; import org.bukkit.Sound; -import org.bukkit.entity.Entity; import org.bukkit.entity.Giant; import org.bukkit.entity.Player; import org.bukkit.event.entity.EntityDamageEvent.DamageCause; @@ -30,7 +29,7 @@ public class CaveGiant Host.Host.CreatureAllowOverride = true; _ent = loc.getWorld().spawn(loc, Giant.class); Host.Host.CreatureAllowOverride = false; - UtilEnt.Vegetate(_ent); + UtilEnt.vegetate(_ent); _ent.setMaxHealth(300); _ent.setHealth(300); diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/christmas/content/PumpkinKing.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/christmas/content/PumpkinKing.java index 75aca805b..37404c6a5 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/christmas/content/PumpkinKing.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/christmas/content/PumpkinKing.java @@ -47,7 +47,7 @@ public class PumpkinKing Host.Host.CreatureAllowOverride = true; _ent = UtilVariant.spawnWitherSkeleton(loc); Host.Host.CreatureAllowOverride = false; - UtilEnt.Vegetate(_ent); + UtilEnt.vegetate(_ent); UtilEnt.ghost(_ent, true, false); _ent.getEquipment().setHelmet(new ItemStack(Material.PUMPKIN)); diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/christmas/content/SnowmanBoss.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/christmas/content/SnowmanBoss.java index 82b334134..649c3cff4 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/christmas/content/SnowmanBoss.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/christmas/content/SnowmanBoss.java @@ -51,7 +51,7 @@ public class SnowmanBoss _heart = _spawn.getWorld().spawn(_spawn, IronGolem.class); _heart.setMaxHealth(1400); _heart.setHealth(1400); - UtilEnt.Vegetate(_heart); + UtilEnt.vegetate(_heart); Host.CreatureAllowOverride = false; diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/christmas/content/SnowmanMaze.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/christmas/content/SnowmanMaze.java index e65212177..3a6d3c6fd 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/christmas/content/SnowmanMaze.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/christmas/content/SnowmanMaze.java @@ -262,7 +262,7 @@ public class SnowmanMaze Snowman ent = loc.getWorld().spawn(loc, Snowman.class); Host.CreatureAllowOverride = false; - UtilEnt.Vegetate(ent); + UtilEnt.vegetate(ent); UtilEnt.ghost(ent, true, false); _ents.put(ent, new SnowmanWaypoint(ent.getLocation())); } diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/christmas/content/SnowmanMinion.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/christmas/content/SnowmanMinion.java index 19bc79523..0bc2f4d6c 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/christmas/content/SnowmanMinion.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/christmas/content/SnowmanMinion.java @@ -20,7 +20,7 @@ public class SnowmanMinion public SnowmanMinion(Snowman ent) { Ent = ent; - UtilEnt.Vegetate(Ent); + UtilEnt.vegetate(Ent); Ent.setMaxHealth(100); Ent.setHealth(Ent.getMaxHealth()); diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/christmas/content/SnowmanWaveA.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/christmas/content/SnowmanWaveA.java index db9a10f0d..71f5f0a68 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/christmas/content/SnowmanWaveA.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/christmas/content/SnowmanWaveA.java @@ -96,7 +96,7 @@ public class SnowmanWaveA Host.CreatureAllowOverride = true; Snowman ent = loc.getWorld().spawn(loc, Snowman.class); Host.CreatureAllowOverride = false; - UtilEnt.Vegetate(ent); + UtilEnt.vegetate(ent); UtilEnt.ghost(ent, true, false); _ents.add(ent); } diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/christmas/content/SnowmanWaveB.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/christmas/content/SnowmanWaveB.java index 0e2568a54..9a73bdde7 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/christmas/content/SnowmanWaveB.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/christmas/content/SnowmanWaveB.java @@ -6,7 +6,6 @@ import java.util.Iterator; import mineplex.core.common.util.UtilAction; import mineplex.core.common.util.UtilEnt; import mineplex.core.common.util.UtilMath; -import mineplex.core.common.util.UtilTime; import mineplex.core.recharge.Recharge; import nautilus.game.arcade.game.games.christmas.Christmas; import net.minecraft.server.v1_8_R3.EntityCreature; @@ -93,7 +92,7 @@ public class SnowmanWaveB Host.CreatureAllowOverride = true; Snowman ent = loc.getWorld().spawn(loc, Snowman.class); Host.CreatureAllowOverride = false; - UtilEnt.Vegetate(ent); + UtilEnt.vegetate(ent); UtilEnt.ghost(ent, true, false); _ents.add(ent); } diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/christmas/parts/Part4.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/christmas/parts/Part4.java index 146402ed2..7d25a24bd 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/christmas/parts/Part4.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/christmas/parts/Part4.java @@ -3,6 +3,7 @@ package nautilus.game.arcade.game.games.christmas.parts; import java.util.ArrayList; import java.util.Iterator; +import org.bukkit.Bukkit; import org.bukkit.Effect; import org.bukkit.Location; import org.bukkit.Material; @@ -179,11 +180,11 @@ public class Part4 extends Part //Create Location loc = UtilAlg.Random(_mobSpawns); - + Host.CreatureAllowOverride = true; Zombie ent = UtilVariant.spawnZombieVillager(loc); Host.CreatureAllowOverride = false; - + ent.getEquipment().setItemInHand(new ItemStack(Material.WOOD_PICKAXE)); ent.getEquipment().setChestplate(new ItemStack(Material.LEATHER_CHESTPLATE)); ent.getEquipment().setLeggings(new ItemStack(Material.LEATHER_LEGGINGS)); diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/christmas/parts/Part5.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/christmas/parts/Part5.java index b91aa0d13..5c1ae3233 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/christmas/parts/Part5.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/christmas/parts/Part5.java @@ -109,6 +109,7 @@ public class Part5 extends Part @Override public void Activate() { + Host.ReachedEnding = true; _bossSnowmen = new BossSnowmanPattern(this, _snowmenA, _snowmenB, GetSleighWaypoint()); _bossFloor = new BossFloor(this, _floor); _bossMob = new BossMobs(this, _mobs); @@ -353,7 +354,7 @@ public class Part5 extends Part public void Skip(PlayerCommandPreprocessEvent event) { if (event.getMessage().equals("/boss")) - if (event.getPlayer().getName().equals("Chiss")) + if (event.getPlayer().isOp()) { event.setCancelled(true); diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/common/CaptureTheFlag.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/common/CaptureTheFlag.java index 79e1cdd00..364e73e8a 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/common/CaptureTheFlag.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/common/CaptureTheFlag.java @@ -34,6 +34,7 @@ import nautilus.game.arcade.game.games.common.ctf_data.CarrierCombatDeathEvent; import nautilus.game.arcade.game.games.common.ctf_data.Flag; import nautilus.game.arcade.game.games.common.dominate_data.PlayerData; import nautilus.game.arcade.game.games.common.dominate_data.Resupply; +import nautilus.game.arcade.game.modules.compass.CompassModule; import nautilus.game.arcade.kit.Kit; import org.bukkit.Bukkit; @@ -98,7 +99,13 @@ public class CaptureTheFlag extends TeamGame this.DeathOut = false; this.PrepareFreeze = true; this.HungerSet = 20; - this.WorldTimeSet = 2000; + this.WorldTimeSet = 2000; + + new CompassModule() + .setGiveCompass(true) + .setGiveCompassToSpecs(true) + .setGiveCompassToAlive(false) + .register(this); this.DeathSpectateSecs = 10; } @@ -716,7 +723,7 @@ public class CaptureTheFlag extends TeamGame { boolean authorized = Manager.GetClients().Get(event.getPlayer()).GetRank().has(Rank.JNR_DEV); - if (Manager.getPlugin().getConfig().getString("serverstatus.group").equalsIgnoreCase("Testing")) + if (UtilServer.isTestServer()) if (Manager.GetClients().Get(event.getPlayer()).GetRank().has(Rank.SNR_MODERATOR)) authorized = true; diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/common/Domination.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/common/Domination.java index 951315a30..6ced2b90f 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/common/Domination.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/common/Domination.java @@ -23,6 +23,7 @@ import nautilus.game.arcade.game.games.common.dominate_data.CapturePoint; import nautilus.game.arcade.game.games.common.dominate_data.Emerald; import nautilus.game.arcade.game.games.common.dominate_data.PlayerData; import nautilus.game.arcade.game.games.common.dominate_data.Resupply; +import nautilus.game.arcade.game.modules.compass.CompassModule; import nautilus.game.arcade.kit.Kit; import org.bukkit.ChatColor; import org.bukkit.Location; @@ -81,6 +82,12 @@ public class Domination extends TeamGame this.DeathSpectateSecs = 10; //this.QuitOut = false; + + new CompassModule() + .setGiveCompass(true) + .setGiveCompassToSpecs(true) + .setGiveCompassToAlive(false) + .register(this); } @Override diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/common/TeamDeathmatch.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/common/TeamDeathmatch.java index f6d2bc073..7beb30f63 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/common/TeamDeathmatch.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/common/TeamDeathmatch.java @@ -22,6 +22,7 @@ import nautilus.game.arcade.game.GameTeam.PlayerState; import nautilus.game.arcade.game.TeamGame; import nautilus.game.arcade.game.games.common.dominate_data.CapturePointTDM; import nautilus.game.arcade.game.games.common.dominate_data.Resupply; +import nautilus.game.arcade.game.modules.compass.CompassModule; import nautilus.game.arcade.kit.Kit; import org.bukkit.Location; @@ -63,8 +64,11 @@ public class TeamDeathmatch extends TeamGame this.DeathOut = true; this.HungerSet = 20; - this.WorldTimeSet = 2000; - this.CompassEnabled = true; + this.WorldTimeSet = 2000; + + new CompassModule() + .setGiveCompassToAlive(true) + .register(this); //this.EloRanking = true; //this.EloSetting.setEloSetting(2); diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/deathtag/DeathTag.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/deathtag/DeathTag.java index 218e5d601..0102bcd04 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/deathtag/DeathTag.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/deathtag/DeathTag.java @@ -20,6 +20,7 @@ import nautilus.game.arcade.game.games.deathtag.kits.KitChaser; import nautilus.game.arcade.game.games.deathtag.kits.KitRunnerArcher; import nautilus.game.arcade.game.games.deathtag.kits.KitRunnerBasher; import nautilus.game.arcade.game.games.deathtag.kits.KitRunnerTraitor; +import nautilus.game.arcade.game.modules.compass.CompassModule; import nautilus.game.arcade.kit.Kit; import nautilus.game.arcade.kit.NullKit; import nautilus.game.arcade.stats.ComeAtMeBroStatTracker; @@ -73,7 +74,9 @@ public class DeathTag extends SoloGame this.DeathOut = false; this.HungerSet = 20; - this.CompassEnabled = true; + new CompassModule() + .setGiveCompassToAlive(true) + .register(this); this.PrepareFreeze = false; diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/dragonescape/DragonEscape.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/dragonescape/DragonEscape.java index 23d67fb7e..20b2fedd9 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/dragonescape/DragonEscape.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/dragonescape/DragonEscape.java @@ -59,6 +59,7 @@ import nautilus.game.arcade.game.games.dragonescape.kits.KitDigger; import nautilus.game.arcade.game.games.dragonescape.kits.KitDisruptor; import nautilus.game.arcade.game.games.dragonescape.kits.KitLeaper; import nautilus.game.arcade.game.games.dragonescape.kits.KitWarper; +import nautilus.game.arcade.game.modules.compass.CompassModule; import nautilus.game.arcade.kit.Kit; import nautilus.game.arcade.managers.chat.ChatStatData; import nautilus.game.arcade.stats.DistanceTraveledStatTracker; @@ -140,6 +141,12 @@ public class DragonEscape extends SoloGame BlankLine, new ChatStatData("kit", "Kit", true) ); + + new CompassModule() + .setGiveCompass(true) + .setGiveCompassToSpecs(true) + .setGiveCompassToAlive(false) + .register(this); } @Override diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/dragonescape/DragonEscapeTeams.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/dragonescape/DragonEscapeTeams.java index 5e43f436e..ccd49cdb6 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/dragonescape/DragonEscapeTeams.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/dragonescape/DragonEscapeTeams.java @@ -40,6 +40,7 @@ import nautilus.game.arcade.events.PlayerPrepareTeleportEvent; import nautilus.game.arcade.game.GameTeam; import nautilus.game.arcade.game.TeamGame; import nautilus.game.arcade.game.games.dragonescape.kits.*; +import nautilus.game.arcade.game.modules.TeamArmorModule; import nautilus.game.arcade.kit.Kit; import nautilus.game.arcade.managers.chat.ChatStatData; @@ -79,8 +80,6 @@ public class DragonEscapeTeams extends TeamGame this.DamagePvP = false; this.HungerSet = 20; - - this.TeamArmorHotbar = true; registerChatStats( Deaths, @@ -88,6 +87,9 @@ public class DragonEscapeTeams extends TeamGame BlankLine, new ChatStatData("kit", "Kit", true) ); + new TeamArmorModule() + .giveHotbarItem() + .register(this); } @Override diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/dragonriders/DragonData.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/dragonriders/DragonData.java index 50df5fe35..0a6a50d84 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/dragonriders/DragonData.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/dragonriders/DragonData.java @@ -41,7 +41,7 @@ public class DragonData //Spawn Dragon manager.GetGame().CreatureAllowOverride = true; Dragon = rider.getWorld().spawn(rider.getLocation(), EnderDragon.class); - UtilEnt.Vegetate(Dragon); + UtilEnt.vegetate(Dragon); manager.GetGame().CreatureAllowOverride = false; rider.getWorld().playSound(rider.getLocation(), Sound.ENDERDRAGON_GROWL, 20f, 1f); diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/dragonriders/DragonRiders.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/dragonriders/DragonRiders.java index bccf6f3a1..fa568ff46 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/dragonriders/DragonRiders.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/dragonriders/DragonRiders.java @@ -4,6 +4,7 @@ import nautilus.game.arcade.ArcadeManager; import nautilus.game.arcade.GameType; import nautilus.game.arcade.game.SoloGame; import nautilus.game.arcade.game.games.dragonriders.kits.KitRider; +import nautilus.game.arcade.game.modules.compass.CompassModule; import nautilus.game.arcade.kit.Kit; public class DragonRiders extends SoloGame @@ -27,5 +28,11 @@ public class DragonRiders extends SoloGame //Chat stats registerChatStats(); + + new CompassModule() + .setGiveCompass(true) + .setGiveCompassToSpecs(true) + .setGiveCompassToAlive(false) + .register(this); } } diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/dragons/Dragons.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/dragons/Dragons.java index 2ec7e7daa..46b956a9d 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/dragons/Dragons.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/dragons/Dragons.java @@ -28,6 +28,7 @@ import nautilus.game.arcade.events.PlayerStateChangeEvent; import nautilus.game.arcade.game.SoloGame; import nautilus.game.arcade.game.GameTeam.PlayerState; import nautilus.game.arcade.game.games.dragons.kits.*; +import nautilus.game.arcade.game.modules.compass.CompassModule; import nautilus.game.arcade.kit.Kit; import nautilus.game.arcade.kit.Perk; import nautilus.game.arcade.kit.perks.PerkSparkler; @@ -73,6 +74,12 @@ public class Dragons extends SoloGame BlankLine, new ChatStatData("kit", "Kit", true) ); + + new CompassModule() + .setGiveCompass(true) + .setGiveCompassToSpecs(true) + .setGiveCompassToAlive(false) + .register(this); } @Override @@ -155,7 +162,7 @@ public class Dragons extends SoloGame { CreatureAllowOverride = true; EnderDragon ent = GetSpectatorLocation().getWorld().spawn(_dragonSpawns.get(0), EnderDragon.class); - UtilEnt.Vegetate(ent); + UtilEnt.vegetate(ent); CreatureAllowOverride = false; ent.getWorld().playSound(ent.getLocation(), Sound.ENDERDRAGON_GROWL, 20f, 1f); diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/dragons/DragonsTeams.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/dragons/DragonsTeams.java index b088fe019..e3b557e9f 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/dragons/DragonsTeams.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/dragons/DragonsTeams.java @@ -29,6 +29,7 @@ import nautilus.game.arcade.game.GameTeam; import nautilus.game.arcade.game.GameTeam.PlayerState; import nautilus.game.arcade.game.TeamGame; import nautilus.game.arcade.game.games.dragons.kits.*; +import nautilus.game.arcade.game.modules.TeamArmorModule; import nautilus.game.arcade.kit.Kit; import nautilus.game.arcade.kit.Perk; import nautilus.game.arcade.kit.perks.PerkSparkler; @@ -67,9 +68,6 @@ public class DragonsTeams extends TeamGame this.HungerSet = 20; this.WorldWaterDamage = 4; this.PrepareFreeze = false; - - this.TeamArmor = true; - this.TeamArmorHotbar = true; registerChatStats( Deaths, @@ -77,6 +75,11 @@ public class DragonsTeams extends TeamGame BlankLine, new ChatStatData("kit", "Kit", true) ); + + new TeamArmorModule() + .giveTeamArmor() + .giveHotbarItem() + .register(this); } @Override @@ -156,7 +159,7 @@ public class DragonsTeams extends TeamGame { CreatureAllowOverride = true; EnderDragon ent = GetSpectatorLocation().getWorld().spawn(_dragonSpawns.get(0), EnderDragon.class); - UtilEnt.Vegetate(ent); + UtilEnt.vegetate(ent); CreatureAllowOverride = false; ent.getWorld().playSound(ent.getLocation(), Sound.ENDERDRAGON_GROWL, 20f, 1f); diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/draw/Draw.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/draw/Draw.java index 0033b5a6d..483fdf15e 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/draw/Draw.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/draw/Draw.java @@ -56,6 +56,7 @@ import nautilus.game.arcade.game.games.draw.tools.Tool; import nautilus.game.arcade.game.games.draw.tools.ToolCircle; import nautilus.game.arcade.game.games.draw.tools.ToolLine; import nautilus.game.arcade.game.games.draw.tools.ToolSquare; +import nautilus.game.arcade.game.modules.compass.CompassModule; import nautilus.game.arcade.kit.Kit; import nautilus.game.arcade.managers.chat.ChatStatData; import nautilus.game.arcade.stats.DrawGuessStatTracker; @@ -226,7 +227,12 @@ public class Draw extends SoloGame new ChatStatData("TotalGuess", "Total Guess'", true), new ChatStatData("PureLuck", "Lucky Guess'", true) ); - + + new CompassModule() + .setGiveCompass(true) + .setGiveCompassToSpecs(true) + .setGiveCompassToAlive(false) + .register(this); } @Override diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/event/EventGame.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/event/EventGame.java index c2d56aebb..68767903c 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/event/EventGame.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/event/EventGame.java @@ -19,6 +19,7 @@ import nautilus.game.arcade.GameType; import nautilus.game.arcade.events.GameStateChangeEvent; import nautilus.game.arcade.game.Game; import nautilus.game.arcade.game.games.event.kits.KitPlayer; +import nautilus.game.arcade.game.modules.compass.CompassModule; import nautilus.game.arcade.kit.Kit; import nautilus.game.arcade.managers.GameHostManager; import org.bukkit.*; @@ -117,6 +118,12 @@ public class EventGame extends Game this.CreatureAllow = true; _customAreas = new HashMap<>(); + + new CompassModule() + .setGiveCompass(true) + .setGiveCompassToSpecs(true) + .setGiveCompassToAlive(false) + .register(this); } @EventHandler @@ -1219,17 +1226,14 @@ public class EventGame extends Game } final int gems = price; - Manager.GetDonation().RewardGems(new Callback() + Manager.GetDonation().rewardCurrency(GlobalCurrency.GEM, event.getPlayer(), "Gem Sign", -price, completed -> { - public void run(Boolean completed) + if (completed) { - if (completed) - { - UtilPlayer.message(event.getPlayer(), F.main("Event", "You bought an item for " + gems + " Gems.")); - event.getPlayer().getInventory().addItem(new ItemStack(mat)); - } + UtilPlayer.message(event.getPlayer(), F.main("Event", "You bought an item for " + gems + " Gems.")); + event.getPlayer().getInventory().addItem(new ItemStack(mat)); } - }, "Gem Sign", event.getPlayer().getName(), event.getPlayer().getUniqueId(), -price); + }); } public class EventArea diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/event/EventModule.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/event/EventModule.java index 0ceb25143..bb7c61020 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/event/EventModule.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/event/EventModule.java @@ -442,7 +442,7 @@ public class EventModule extends MiniPlugin try { for(Player target : UtilServer.getPlayers()) - Manager.GetDonation().Get(target).AddUnknownSalesPackagesOwned(gadget); + Manager.GetDonation().Get(target).addOwnedUnknownSalesPackage(gadget); } catch (Exception e) { diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/evolution/Evolution.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/evolution/Evolution.java index 73d5fc452..fa0e6a7ae 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/evolution/Evolution.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/evolution/Evolution.java @@ -29,6 +29,7 @@ import nautilus.game.arcade.game.games.evolution.kits.KitEvolveSpeed; import nautilus.game.arcade.game.games.evolution.kits.KitHealth; import nautilus.game.arcade.game.games.evolution.mobs.*; import nautilus.game.arcade.game.games.evolution.trackers.*; +import nautilus.game.arcade.game.modules.compass.CompassModule; import nautilus.game.arcade.kit.Kit; import nautilus.game.arcade.kit.ProgressingKit; import nautilus.game.arcade.stats.KillFastStatTracker; @@ -117,8 +118,10 @@ public class Evolution extends SoloGame GemKillDeathRespawn = 2; GemAssistDeathRespawn = .5; - CompassEnabled = true; - CompassGiveItem = false; + new CompassModule() + .setGiveCompassToAlive(true) + .setGiveCompass(false) + .register(this); AutomaticRespawn = false; DeathSpectateSecs = 4.0; diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/evolution/evolve/EvolveManager.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/evolution/evolve/EvolveManager.java index 4f1f48b2e..8dd32aebd 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/evolution/evolve/EvolveManager.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/evolution/evolve/EvolveManager.java @@ -12,7 +12,7 @@ import mineplex.core.hologram.HologramManager; import mineplex.core.updater.UpdateType; import mineplex.core.updater.event.UpdateEvent; import mineplex.minecraft.game.core.damage.CustomDamageEvent; -import nautilus.game.arcade.addons.compass.CompassAttemptTargetEvent; +import nautilus.game.arcade.game.modules.compass.CompassAttemptTargetEvent; import nautilus.game.arcade.game.games.evolution.EvoKit; import nautilus.game.arcade.game.games.evolution.Evolution; import nautilus.game.arcade.game.games.evolution.events.EvolutionAbilityUseEvent; @@ -182,8 +182,11 @@ public class EvolveManager implements Listener { if (!Host.IsLive()) return; - - if (isEvolving(event.getTarget())) + + if (!(event.getTarget() instanceof Player)) + return; + + if (isEvolving((Player) event.getTarget())) event.setCancelled(true); } diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/gladiators/Gladiators.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/gladiators/Gladiators.java index 59dd19d6c..6ee11eb55 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/gladiators/Gladiators.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/gladiators/Gladiators.java @@ -65,6 +65,7 @@ import nautilus.game.arcade.game.games.gladiators.trackers.PrecisionTracker; import nautilus.game.arcade.game.games.gladiators.trackers.SwiftKillTracker; import nautilus.game.arcade.game.games.gladiators.trackers.UntouchableTracker; import nautilus.game.arcade.game.games.gladiators.tutorial.TutorialGladiators; +import nautilus.game.arcade.game.modules.compass.CompassModule; import nautilus.game.arcade.gametutorial.events.GameTutorialStartEvent; import nautilus.game.arcade.kit.Kit; import nautilus.game.arcade.managers.chat.ChatStatData; @@ -145,6 +146,14 @@ public class Gladiators extends SoloGame _firstRound = true; _hotbarEditor = new HotbarEditor(manager.getPlugin(), this); + + new CompassModule() + .setGiveCompass(true) + .setGiveCompassToSpecs(true) + .setGiveCompassToAlive(false) + .register(this); + + StrictAntiHack = true; } @EventHandler @@ -172,7 +181,7 @@ public class Gladiators extends SoloGame DisguisePlayer player = new DisguisePlayer(zombie, (zombie.equals(zombie1) ? tiger : random)); Manager.GetDisguise().disguise(player); - UtilEnt.Vegetate(zombie); + UtilEnt.vegetate(zombie); zombie.getEquipment().setHelmet(ArenaType.ORANGE.getLoadout().getHelmet()); zombie.getEquipment().setChestplate(ArenaType.ORANGE.getLoadout().getChestplate()); zombie.getEquipment().setLeggings(ArenaType.ORANGE.getLoadout().getLeggings()); @@ -1115,6 +1124,7 @@ public class Gladiators extends SoloGame @Override public void disable() { + super.disable(); _hotbarEditor.deregisterSelf(); // De-register as listener _hotbarEditor.onDisable(); // Fully disable } diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/gladiators/hotbar/HotbarEditor.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/gladiators/hotbar/HotbarEditor.java index da6897997..88b9411c9 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/gladiators/hotbar/HotbarEditor.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/gladiators/hotbar/HotbarEditor.java @@ -25,6 +25,7 @@ import mineplex.core.MiniPlugin; import mineplex.core.common.util.C; import mineplex.core.common.util.F; import mineplex.core.common.util.UtilInv; +import mineplex.core.common.util.UtilItem; import mineplex.core.common.util.UtilMath; import mineplex.core.itemstack.ItemBuilder; import nautilus.game.arcade.events.GameStateChangeEvent; @@ -124,9 +125,8 @@ public class HotbarEditor extends MiniPlugin { ItemStack item = event.getItem(); - if (item != null && item.isSimilar(_item)) + if (UtilItem.isSimilar(item, _item, UtilItem.ItemAttribute.NAME)) { - HotbarInventory.open(event.getPlayer(), this); } } diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/gladiators/modes/ChampionsGladiators.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/gladiators/modes/ChampionsGladiators.java index eb649e456..dd740ef73 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/gladiators/modes/ChampionsGladiators.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/gladiators/modes/ChampionsGladiators.java @@ -43,8 +43,7 @@ public class ChampionsGladiators extends Gladiators Manager.getClassManager().GetItemFactory().getProximityManager().setProxyLimit(6); - StrictAntiHack = true; - TeamArmor = false; + StrictAntiHack = true; new ChampionsFixes(this); diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/gravity/Gravity.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/gravity/Gravity.java index 6178db711..817b87c82 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/gravity/Gravity.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/gravity/Gravity.java @@ -29,7 +29,6 @@ import org.bukkit.event.entity.EntityDamageEvent.DamageCause; import org.bukkit.event.entity.EntityShootBowEvent; import org.bukkit.event.player.PlayerDropItemEvent; import org.bukkit.event.player.PlayerInteractEvent; -import org.bukkit.event.player.PlayerJoinEvent; import org.bukkit.util.Vector; import mineplex.core.common.util.C; @@ -44,7 +43,6 @@ import mineplex.core.common.util.UtilPlayer; import mineplex.core.common.util.UtilServer; import mineplex.core.common.util.UtilTextMiddle; import mineplex.core.common.util.UtilTime; -import mineplex.core.common.util.UtilWorld; import mineplex.core.common.util.UtilParticle.ParticleType; import mineplex.core.common.util.UtilParticle.ViewDist; import mineplex.core.recharge.Recharge; @@ -61,6 +59,7 @@ import nautilus.game.arcade.game.games.gravity.objects.GravityBomb; import nautilus.game.arcade.game.games.gravity.objects.GravityDebris; import nautilus.game.arcade.game.games.gravity.objects.GravityHook; import nautilus.game.arcade.game.games.gravity.objects.GravityPlayer; +import nautilus.game.arcade.game.modules.compass.CompassModule; import nautilus.game.arcade.kit.Kit; public class Gravity extends SoloGame @@ -112,7 +111,9 @@ public class Gravity extends SoloGame this.WorldTimeSet = 18000; - this.CompassEnabled = true; + new CompassModule() + .setGiveCompassToAlive(true) + .register(this); this.WorldBoundaryKill = false; @@ -332,12 +333,12 @@ public class Gravity extends SoloGame this.CreatureAllowOverride = false; slime.setSize(1); - UtilEnt.Vegetate(slime, true); + UtilEnt.vegetate(slime, true); UtilEnt.ghost(slime, true, false); GravityHook hook = new GravityHook(this, slime, 4, velocity); - UtilEnt.Leash(hook.Base, player, false, false); + UtilEnt.leash(hook.Base, player, false, false); _hooks.put(player, hook); diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/gravity/GravityObject.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/gravity/GravityObject.java index 34c83e330..7b68f58d1 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/gravity/GravityObject.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/gravity/GravityObject.java @@ -9,7 +9,6 @@ import mineplex.core.common.util.UtilParticle.ViewDist; import mineplex.core.disguise.disguises.DisguiseBat; import nautilus.game.arcade.game.games.gravity.objects.*; -import org.bukkit.Effect; import org.bukkit.Sound; import org.bukkit.entity.Entity; import org.bukkit.entity.Player; @@ -58,7 +57,7 @@ public abstract class GravityObject Bat.setSitting(true); Host.Manager.GetDisguise().disguise(Bat); - UtilEnt.Vegetate(Base, true); + UtilEnt.vegetate(Base, true); //UtilEnt.ghost(Base, true, true); Host.Manager.GetCondition().Factory().Invisible(null, Base, null, 9999, 1, false, false, false); } diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/halloween/Halloween.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/halloween/Halloween.java index a2160dda5..5a5c5417a 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/halloween/Halloween.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/halloween/Halloween.java @@ -55,6 +55,7 @@ import nautilus.game.arcade.game.games.halloween.waves.Wave5; import nautilus.game.arcade.game.games.halloween.waves.WaveBase; import nautilus.game.arcade.game.games.halloween.waves.WaveBoss; import nautilus.game.arcade.game.games.halloween.waves.WaveVictory; +import nautilus.game.arcade.game.modules.compass.CompassModule; import nautilus.game.arcade.kit.Kit; import nautilus.game.arcade.managers.chat.ChatStatData; import net.minecraft.server.v1_8_R3.PacketPlayOutNamedSoundEffect; @@ -167,6 +168,12 @@ public class Halloween extends SoloGame C.cAqua + "Stick together to survive.", C.cGreen + "The Pumpkin King gets harder over time!", }; + + new CompassModule() + .setGiveCompass(true) + .setGiveCompassToSpecs(true) + .setGiveCompassToAlive(false) + .register(this); } @Override @@ -481,7 +488,7 @@ public class Halloween extends SoloGame if (!player.isOnline()) continue; - Manager.GetDonation().PurchaseUnknownSalesPackage(null, player.getName(), Manager.GetClients().Get(player).getAccountId(), "Decrepit Warhorse", GlobalCurrency.TREASURE_SHARD, 0, true); + Manager.GetDonation().purchaseUnknownSalesPackage(Manager.GetClients().Get(player), "Decrepit Warhorse", GlobalCurrency.TREASURE_SHARD, 0, true, null); } } diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/halloween/creatures/PumpkinKing.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/halloween/creatures/PumpkinKing.java index cff83a8df..b2d3b7431 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/halloween/creatures/PumpkinKing.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/halloween/creatures/PumpkinKing.java @@ -27,7 +27,6 @@ import nautilus.game.arcade.game.games.halloween.Halloween; import nautilus.game.arcade.game.games.halloween.HalloweenAudio; import net.minecraft.server.v1_8_R3.EntityArrow; import net.minecraft.server.v1_8_R3.EntityCreature; -import net.minecraft.server.v1_8_R3.Navigation; import net.minecraft.server.v1_8_R3.NavigationAbstract; import org.bukkit.Effect; @@ -391,7 +390,7 @@ public class PumpkinKing extends CreatureBase _minions.add(skel); - UtilEnt.Vegetate(skel); + UtilEnt.vegetate(skel); } _minionSpawn = false; @@ -646,7 +645,7 @@ public class PumpkinKing extends CreatureBase Blaze ent = GetEntity().getWorld().spawn(GetEntity().getLocation().add(0, 6, 0), Blaze.class); ent.getEquipment().setHelmet(new ItemStack(Material.PUMPKIN)); _shields.add(ent); - UtilEnt.Vegetate(ent); + UtilEnt.vegetate(ent); //ent.setSize(1); Host.CreatureAllowOverride = false; diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/halloween2016/Halloween2016.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/halloween2016/Halloween2016.java index 2240ee244..4e08b24aa 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/halloween2016/Halloween2016.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/halloween2016/Halloween2016.java @@ -57,6 +57,7 @@ import nautilus.game.arcade.game.games.halloween2016.wave.Wave4; import nautilus.game.arcade.game.games.halloween2016.wave.Wave5; import nautilus.game.arcade.game.games.halloween2016.wave.WaveBoss; import nautilus.game.arcade.game.games.halloween2016.wave.WaveVictory; +import nautilus.game.arcade.game.modules.compass.CompassModule; import nautilus.game.arcade.kit.Kit; public class Halloween2016 extends Halloween @@ -124,6 +125,12 @@ public class Halloween2016 extends Halloween EnableTutorials = DO_TUTORIALS; doVoices = false; + + new CompassModule() + .setGiveCompass(true) + .setGiveCompassToSpecs(true) + .setGiveCompassToAlive(false) + .register(this); } public void setObjective(String objective) @@ -245,7 +252,7 @@ public class Halloween2016 extends Halloween CreatureAllowOverride = true; ArmorStand bat = doorSchematicLocation.getWorld().spawn(doorSchematicLocation, ArmorStand.class); CreatureAllowOverride = false; - UtilEnt.Vegetate(bat, true); + UtilEnt.vegetate(bat, true); UtilEnt.setAI(bat, false); UtilEnt.setTickWhenFarAway(bat, true); bat.setRemoveWhenFarAway(false); diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/halloween2016/creatures/MobGiant.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/halloween2016/creatures/MobGiant.java index 6f6a41af4..05e9dc7af 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/halloween2016/creatures/MobGiant.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/halloween2016/creatures/MobGiant.java @@ -57,7 +57,7 @@ public class MobGiant extends CryptBreaker ent.setHealth(ent.getMaxHealth()); UtilEnt.setBoundingBox(_pathDummy, 0, 0); - UtilEnt.Vegetate(_pathDummy, true); + UtilEnt.vegetate(_pathDummy, true); UtilEnt.setStepHeight(_pathDummy, 1); //Prevent other mobs from pushing the giant diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/halloween2016/creatures/MobPumpkinPrince.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/halloween2016/creatures/MobPumpkinPrince.java index a09970660..0675e2841 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/halloween2016/creatures/MobPumpkinPrince.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/halloween2016/creatures/MobPumpkinPrince.java @@ -110,7 +110,7 @@ public class MobPumpkinPrince extends CreatureBase implements Listener ((CraftZombie)_horse).getHandle().b(true); _horse.setPassenger(ent); - UtilEnt.Vegetate(_horse); + UtilEnt.vegetate(_horse); UtilServer.RegisterEvents(this); diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/halloween2016/creatures/MobWitch.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/halloween2016/creatures/MobWitch.java index 3342f1f96..64f3ea607 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/halloween2016/creatures/MobWitch.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/halloween2016/creatures/MobWitch.java @@ -132,7 +132,7 @@ public class MobWitch extends CreatureBase for(int i = 0; i < BATS_BURST; i++) { Bat bat = GetEntity().getWorld().spawn(GetEntity().getEyeLocation(), Bat.class); - UtilEnt.Vegetate(bat); + UtilEnt.vegetate(bat); _bats.add(bat); addEntityPart(bat); } diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/halloween2016/wave/WaveBoss.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/halloween2016/wave/WaveBoss.java index c390473bc..43315155c 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/halloween2016/wave/WaveBoss.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/halloween2016/wave/WaveBoss.java @@ -228,7 +228,7 @@ public class WaveBoss extends WaveBase implements Listener _pumpkinKing.setCustomName(C.cYellow + C.Bold + "Pumpking King"); _pumpkinKing.setCustomNameVisible(true); - UtilEnt.Vegetate(_pumpkinKing); + UtilEnt.vegetate(_pumpkinKing); _pumpkinKing.getWorld().strikeLightningEffect(_pumpkinKing.getLocation()); } diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/hideseek/HideSeek.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/hideseek/HideSeek.java index 0eea12d3a..ea2c1d71c 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/hideseek/HideSeek.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/hideseek/HideSeek.java @@ -46,6 +46,7 @@ import nautilus.game.arcade.game.games.hideseek.kits.KitHiderSwapper; import nautilus.game.arcade.game.games.hideseek.kits.KitSeekerLeaper; import nautilus.game.arcade.game.games.hideseek.kits.KitSeekerRadar; import nautilus.game.arcade.game.games.hideseek.kits.KitSeekerTNT; +import nautilus.game.arcade.game.modules.compass.CompassModule; import nautilus.game.arcade.kit.Kit; import nautilus.game.arcade.kit.NullKit; import nautilus.game.arcade.stats.BadHiderStatTracker; @@ -350,6 +351,12 @@ public class HideSeek extends TeamGame //Need ideas for this one registerChatStats(); + + new CompassModule() + .setGiveCompass(true) + .setGiveCompassToSpecs(true) + .setGiveCompassToAlive(false) + .register(this); } @EventHandler @@ -1525,6 +1532,9 @@ public class HideSeek extends TeamGame @EventHandler(priority = EventPriority.LOW) public void InfectDamageShuffleUp(CustomDamageEvent event) { + if (!IsLive()) + return; + if (event.GetDamageePlayer() == null) { if (event.GetDamageeEntity().getPassenger() != null diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/holeinwall/HoleInTheWall.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/holeinwall/HoleInTheWall.java index 29abe0ef7..d2fb41cec 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/holeinwall/HoleInTheWall.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/holeinwall/HoleInTheWall.java @@ -15,6 +15,7 @@ import mineplex.core.updater.event.UpdateEvent; import nautilus.game.arcade.ArcadeManager; import nautilus.game.arcade.GameType; import nautilus.game.arcade.game.SoloGame; +import nautilus.game.arcade.game.modules.compass.CompassModule; import nautilus.game.arcade.kit.Kit; import org.bukkit.Bukkit; @@ -59,6 +60,12 @@ public class HoleInTheWall extends SoloGame WorldTimeSet = 8000; registerChatStats(); + + new CompassModule() + .setGiveCompass(true) + .setGiveCompassToSpecs(true) + .setGiveCompassToAlive(false) + .register(this); } private ArrayList> getWall() diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/horsecharge/Horse.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/horsecharge/Horse.java index a8f4ecab5..6510393c7 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/horsecharge/Horse.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/horsecharge/Horse.java @@ -9,6 +9,7 @@ import nautilus.game.arcade.GameType; import nautilus.game.arcade.game.GameTeam; import nautilus.game.arcade.game.TeamGame; import nautilus.game.arcade.game.games.horsecharge.kits.*; +import nautilus.game.arcade.game.modules.compass.CompassModule; import nautilus.game.arcade.kit.Kit; import nautilus.game.arcade.kit.NullKit; @@ -37,6 +38,12 @@ public class Horse extends TeamGame }); registerChatStats(); + + new CompassModule() + .setGiveCompass(true) + .setGiveCompassToSpecs(true) + .setGiveCompassToAlive(false) + .register(this); } @Override diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/lobbers/BombLobbers.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/lobbers/BombLobbers.java index 10b5abe6a..4b4aa2c13 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/lobbers/BombLobbers.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/lobbers/BombLobbers.java @@ -41,6 +41,8 @@ import nautilus.game.arcade.game.games.lobbers.trackers.TrackerBlastProof; import nautilus.game.arcade.game.games.lobbers.trackers.TrackerDirectHit; import nautilus.game.arcade.game.games.lobbers.trackers.TrackerNoDamage; import nautilus.game.arcade.game.games.lobbers.trackers.TrackerTNTThrown; +import nautilus.game.arcade.game.modules.TeamArmorModule; +import nautilus.game.arcade.game.modules.compass.CompassModule; import nautilus.game.arcade.kit.Kit; import nautilus.game.arcade.managers.chat.ChatStatData; @@ -99,9 +101,6 @@ public class BombLobbers extends TeamGame implements IThrown PrepareFreeze = false; - TeamArmor = true; - TeamArmorHotbar = true; - InventoryOpenChest = false; InventoryOpenBlock = false; @@ -130,6 +129,17 @@ public class BombLobbers extends TeamGame implements IThrown BlankLine, new ChatStatData("Thrown", "Bombs Lobbed", true) ); + + new CompassModule() + .setGiveCompass(true) + .setGiveCompassToSpecs(true) + .setGiveCompassToAlive(false) + .register(this); + + new TeamArmorModule() + .giveTeamArmor() + .giveHotbarItem() + .register(this); } @EventHandler diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/micro/Micro.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/micro/Micro.java index 0b62093a5..09941ea19 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/micro/Micro.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/micro/Micro.java @@ -21,6 +21,8 @@ import nautilus.game.arcade.ArcadeManager; import nautilus.game.arcade.GameType; import nautilus.game.arcade.game.TeamGame; import nautilus.game.arcade.game.games.micro.kits.*; +import nautilus.game.arcade.game.modules.TeamArmorModule; +import nautilus.game.arcade.game.modules.compass.CompassModule; import nautilus.game.arcade.kit.Kit; import nautilus.game.arcade.managers.chat.ChatStatData; import nautilus.game.arcade.stats.KillsWithinGameStatTracker; @@ -53,9 +55,6 @@ public class Micro extends TeamGame this.StrictAntiHack = true; - this.TeamArmor = true; - this.TeamArmorHotbar = true; - this.InventoryClick = true; this.ItemDrop = true; @@ -63,6 +62,17 @@ public class Micro extends TeamGame this.BlockBreak = true; this.BlockPlace = true; + + new CompassModule() + .setGiveCompass(true) + .setGiveCompassToSpecs(true) + .setGiveCompassToAlive(false) + .register(this); + + new TeamArmorModule() + .giveTeamArmor() + .giveHotbarItem() + .register(this); } public Micro(ArcadeManager manager) diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/micro/modes/OverpoweredMicroBattles.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/micro/modes/OverpoweredMicroBattles.java index cc6d27444..b1f19b179 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/micro/modes/OverpoweredMicroBattles.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/micro/modes/OverpoweredMicroBattles.java @@ -24,8 +24,6 @@ public class OverpoweredMicroBattles extends Micro }, GameType.Brawl); - TeamArmor = false; - new AbsorptionFix(this); } diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/micro/modes/TinyWinners.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/micro/modes/TinyWinners.java index 3ff0e03e0..2eab38c90 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/micro/modes/TinyWinners.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/micro/modes/TinyWinners.java @@ -41,7 +41,6 @@ public class TinyWinners extends Micro Manager.getClassManager().GetItemFactory().getProximityManager().setProxyLimit(6); StrictAntiHack = true; - TeamArmor = false; manager.enableChampionsModules(); } diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/milkcow/MilkCow.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/milkcow/MilkCow.java index aba4c1463..b14fb3a9d 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/milkcow/MilkCow.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/milkcow/MilkCow.java @@ -27,6 +27,7 @@ import nautilus.game.arcade.game.games.milkcow.MilkRemoveEvent.RemoveType; import nautilus.game.arcade.game.games.milkcow.kits.KitCow; import nautilus.game.arcade.game.games.milkcow.kits.KitFarmerJump; import nautilus.game.arcade.game.games.milkcow.kits.KitSturdyFarmhand; +import nautilus.game.arcade.game.modules.compass.CompassModule; import nautilus.game.arcade.kit.Kit; import nautilus.game.arcade.kit.NullKit; import net.minecraft.server.v1_8_R3.EntityCreature; @@ -92,7 +93,9 @@ public class MilkCow extends SoloGame "First player to 15 points wins!" }); - this.CompassEnabled = true; + new CompassModule() + .setGiveCompassToAlive(true) + .register(this); this.DeathOut = false; _scoreObj = Scoreboard.getScoreboard().registerNewObjective("Milk", "dummy"); diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/minecraftleague/MinecraftLeague.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/minecraftleague/MinecraftLeague.java index 5b1bbaaf0..1590dc86f 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/minecraftleague/MinecraftLeague.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/minecraftleague/MinecraftLeague.java @@ -44,6 +44,7 @@ import nautilus.game.arcade.game.games.minecraftleague.tracker.TowerDefenderTrac import nautilus.game.arcade.game.games.minecraftleague.variation.ExtraScoreboardData; import nautilus.game.arcade.game.games.minecraftleague.variation.GameVariation; import nautilus.game.arcade.game.games.minecraftleague.variation.VariationManager; +import nautilus.game.arcade.game.modules.compass.CompassModule; import nautilus.game.arcade.kit.Kit; import org.bukkit.Bukkit; import org.bukkit.ChatColor; @@ -213,6 +214,12 @@ public class MinecraftLeague extends RankedTeamGame Alert = new TowerAlert(); Bukkit.getPluginManager().registerEvents(_freeze, manager.getPlugin()); Bukkit.getPluginManager().registerEvents(_tower, manager.getPlugin()); + + new CompassModule() + .setGiveCompass(true) + .setGiveCompassToSpecs(true) + .setGiveCompassToAlive(false) + .register(this); } private enum DamageAmount diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/minecraftleague/data/Spawner.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/minecraftleague/data/Spawner.java index f55764201..6c244fadb 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/minecraftleague/data/Spawner.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/minecraftleague/data/Spawner.java @@ -80,7 +80,7 @@ public class Spawner if (canSpawnMob(l)) { Entity e = Host.getArcadeManager().GetCreature().SpawnEntity(l, _toSpawn); - UtilEnt.Vegetate(e); + UtilEnt.vegetate(e); spawned = true; _lastSpawned = System.currentTimeMillis(); continue; diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/minecraftleague/variation/wither/data/PathfinderData.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/minecraftleague/variation/wither/data/PathfinderData.java index 97d6ec69a..377712a58 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/minecraftleague/variation/wither/data/PathfinderData.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/minecraftleague/variation/wither/data/PathfinderData.java @@ -24,7 +24,7 @@ public class PathfinderData { Wither = wither; UtilEnt.ghost(wither, true, false); - UtilEnt.Vegetate(wither, false); + UtilEnt.vegetate(wither, false); Location temp = wither.getLocation(); temp.setPitch(UtilAlg.GetPitch(UtilAlg.getTrajectory(wither.getLocation(), target))); diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/minecraftleague/variation/wither/data/WitherMinionManager.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/minecraftleague/variation/wither/data/WitherMinionManager.java index acbdded52..396a991aa 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/minecraftleague/variation/wither/data/WitherMinionManager.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/minecraftleague/variation/wither/data/WitherMinionManager.java @@ -125,7 +125,7 @@ public class WitherMinionManager implements Listener Skeleton e = UtilVariant.spawnWitherSkeleton(chosen); _entity = (Skeleton)e; UtilEnt.ghost(e, true, false); - UtilEnt.Vegetate(e); + UtilEnt.vegetate(e); e.setCustomName(C.cRed + "Wither Skeleton"); ((Skeleton)e).setMaxHealth(/*100*/65); ((Skeleton)e).setHealth(/*100*/65); diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/minestrike/GunModule.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/minestrike/GunModule.java index ae6606a81..b2c3a3f01 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/minestrike/GunModule.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/minestrike/GunModule.java @@ -758,6 +758,9 @@ public class GunModule implements Listener @EventHandler(priority = EventPriority.MONITOR) public void instantBulletHit(final ProjectileHitEvent event) { + if (!_host.IsLive()) + return; + if (!(event.getEntity() instanceof Arrow)) return; @@ -946,6 +949,7 @@ public class GunModule implements Listener } event.SetKnockback(false); + event.setMetadata("gunType", "KNIFE"); } } @@ -1057,6 +1061,7 @@ public class GunModule implements Listener event.SetIgnoreArmor(true); Bukkit.getPluginManager().callEvent(new CustomGunDamageEvent(bullet, event.GetDamageePlayer(), hitArea == 1, event, this)); + event.setMetadata("gunType", bullet.Gun.getGunStats().name()); } public int getArrowHitArea(Player damagee, Location origin, Vector trajectory) diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/minestrike/Minestrike.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/minestrike/Minestrike.java index 17ddcab9f..b5d69dd75 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/minestrike/Minestrike.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/minestrike/Minestrike.java @@ -7,6 +7,7 @@ import java.util.HashSet; import org.bukkit.Bukkit; import org.bukkit.ChatColor; import org.bukkit.Color; +import org.bukkit.GameMode; import org.bukkit.Location; import org.bukkit.Material; import org.bukkit.Sound; @@ -70,6 +71,7 @@ import nautilus.game.arcade.game.games.minestrike.data.Bomb; import nautilus.game.arcade.game.games.minestrike.items.guns.Gun; import nautilus.game.arcade.game.games.minestrike.items.guns.GunStats; import nautilus.game.arcade.game.games.minestrike.kits.KitPlayer; +import nautilus.game.arcade.game.modules.compass.CompassModule; import nautilus.game.arcade.kit.Kit; import nautilus.game.arcade.managers.chat.ChatStatData; import nautilus.game.arcade.stats.KaboomStatTracker; @@ -177,6 +179,12 @@ public class Minestrike extends TeamGame _gunModule = new GunModule(this); _shopManager = new ShopManager(this); + + new CompassModule() + .setGiveCompass(true) + .setGiveCompassToSpecs(true) + .setGiveCompassToAlive(false) + .register(this); } public Minestrike(ArcadeManager manager) @@ -226,13 +234,14 @@ public class Minestrike extends TeamGame { if (event.GetState() != GameState.Prepare) return; - - System.out.println("Hiding Scoreboard Nametags for Other Teams"); + + hideNametags(); + } + + private void hideNametags() { for (Team curTeam : Scoreboard.getScoreboard().getTeams()) { curTeam.setNameTagVisibility(NameTagVisibility.HIDE_FOR_OTHER_TEAMS); - //UtilServer.getServer().dispatchCommand(UtilServer.getServer().getConsoleSender(), - // "scoreboard teams option " + curTeam.getName() + " nametagVisibility hideForOtherTeams"); } } @@ -248,9 +257,8 @@ public class Minestrike extends TeamGame GameTeam team = GetTeam(event.getPlayer()); if (team == null) return; - - GadgetManager gadgetManager = Manager.getCosmeticManager().getGadgetManager(); - GameModifierMineStrikeSkin knifeSkin = (GameModifierMineStrikeSkin) gadgetManager.getActiveGameModifier(event.getPlayer(), + GadgetManager gadgetManager = Manager.getCosmeticManager().getGadgetManager(); + GameModifierMineStrikeSkin knifeSkin = (GameModifierMineStrikeSkin) gadgetManager.getActiveGameModifier(event.getPlayer(), GameModifierType.MineStrike, GameModifierMineStrikeSkin.getWeaponFilter("Knife")); Material mat = Material.IRON_AXE; @@ -270,6 +278,7 @@ public class Minestrike extends TeamGame { if (IsAlive(event.getPlayer())) { + event.getPlayer().setGameMode(GameMode.ADVENTURE); //Pistol Gun gun = new Gun(GunStats.GLOCK_18, _gunModule); _gunModule.registerGun(gun, event.getPlayer()); @@ -290,6 +299,7 @@ public class Minestrike extends TeamGame { if (IsAlive(event.getPlayer())) { + event.getPlayer().setGameMode(GameMode.ADVENTURE); //Pistol Gun gun = new Gun(GunStats.P2000, _gunModule); _gunModule.registerGun(gun, event.getPlayer()); @@ -401,19 +411,33 @@ public class Minestrike extends TeamGame if (GetTeam(killed).equals(GetTeam(killer))) return; - int amount = 300; + int amount; - if (event.GetLog().GetLastDamager().GetReason().contains("AWP")) - amount = 100; - - else if (event.GetLog().GetLastDamager().GetReason().contains("PP-Bizon")) - amount = 600; - - else if (event.GetLog().GetLastDamager().GetReason().contains("Nova")) - amount = 900; - - else if (event.GetLog().GetLastDamager().GetReason().contains("Knife")) - amount = 1500; + String gunType = (String) event.GetLog().GetLastDamager().GetDamage().getFirst().getMetadata().get("gunType"); + if (gunType == null) + { + amount = 300; + } + else + { + switch (gunType) + { + case "AWP": + amount = 100; + break; + case "PPBIZON": + amount = 600; + break; + case "NOVA": + amount = 900; + break; + case "KNIFE": + amount = 1500; + break; + default: + amount = 300; + } + } _shopManager.addMoney(killer, amount, "kill with " + event.GetLog().GetLastDamager().GetReason()); @@ -981,6 +1005,8 @@ public class Minestrike extends TeamGame else Announce(C.cPurple + C.Bold + "Bullets: " + ChatColor.RESET + "Slow and Visible with Instant Sniper"); } + + hideNametags(); } public void giveMoney() diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/minestrike/items/guns/Gun.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/minestrike/items/guns/Gun.java index 550d4df3f..cc694d4f9 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/minestrike/items/guns/Gun.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/minestrike/items/guns/Gun.java @@ -588,7 +588,11 @@ public class Gun extends StrikeItem { return _gunStats.getGunType(); } - + + public GunStats getGunStats() + { + return _gunStats; + } public String getBaseStatName(boolean withPlayerName) { return (withPlayerName ? getOwnerName() + "." : "") + getName() + "." + _activeSkinName; diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/mineware/BawkBawkBattles.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/mineware/BawkBawkBattles.java index 3fed98d5d..2a6636c1b 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/mineware/BawkBawkBattles.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/mineware/BawkBawkBattles.java @@ -5,10 +5,15 @@ import java.util.Arrays; import java.util.Collections; import java.util.Comparator; import java.util.HashMap; +import java.util.HashSet; +import java.util.LinkedList; import java.util.List; import java.util.Map; +import java.util.Objects; +import java.util.Set; +import java.util.UUID; -import mineplex.core.common.Pair; +import org.bukkit.Bukkit; import org.bukkit.ChatColor; import org.bukkit.Location; import org.bukkit.Material; @@ -42,11 +47,13 @@ import org.bukkit.scheduler.BukkitRunnable; import com.google.common.collect.Lists; +import mineplex.core.common.Pair; import mineplex.core.common.util.C; import mineplex.core.common.util.F; import mineplex.core.common.util.UtilAction; import mineplex.core.common.util.UtilAlg; import mineplex.core.common.util.UtilEnt; +import mineplex.core.common.util.UtilInv; import mineplex.core.common.util.UtilMath; import mineplex.core.common.util.UtilParticle; import mineplex.core.common.util.UtilParticle.ParticleType; @@ -60,12 +67,12 @@ import mineplex.core.common.util.UtilTime; import mineplex.core.projectile.IThrown; import mineplex.core.projectile.ProjectileUser; import mineplex.core.recharge.Recharge; -import mineplex.core.teleport.event.MineplexTeleportEvent; import mineplex.core.updater.UpdateType; import mineplex.core.updater.event.UpdateEvent; import mineplex.minecraft.game.core.condition.Condition.ConditionType; import mineplex.minecraft.game.core.condition.events.ConditionApplyEvent; import mineplex.minecraft.game.core.damage.CustomDamageEvent; + import nautilus.game.arcade.ArcadeManager; import nautilus.game.arcade.GameType; import nautilus.game.arcade.events.GamePrepareCountdownCommence; @@ -197,9 +204,9 @@ public class BawkBawkBattles extends TeamGame implements IThrown private BawkBawkBattlesSettings _settings = new BawkBawkBattlesSettings(); private ChallengeList _list = new ChallengeList(); - private Map _lives = new HashMap<>(); - private List _winners = new ArrayList(); - private GameTeam _playerTeam, _chickenTeam; + private Map _lives = new HashMap<>(); + private LinkedList _winners = new LinkedList<>(); + private GameTeam _playerTeam; private DeathEffect _deathEffect = new DeathEffect(this); private ChickenAttack _chickenAttack; private Location _chickenAttackCenter; @@ -207,25 +214,27 @@ public class BawkBawkBattles extends TeamGame implements IThrown private List _lastChallengeBlocks; private long _delay; + public final Set _beingAttacked = new HashSet<>(); + private List _countdown = Arrays.asList( - C.cRed + C.Bold + "3", - C.cYellow + C.Bold + "2", - C.cGreen + C.Bold + "1", - C.cWhite + C.Bold + "GO!"); + C.cRed + C.Bold + "3", + C.cYellow + C.Bold + "2", + C.cGreen + C.Bold + "1", + C.cWhite + C.Bold + "GO!"); @SuppressWarnings("unchecked") public BawkBawkBattles(ArcadeManager manager) { super(manager, - GameType.BawkBawkBattles, - new Kit[] { new KitBawksFood(manager) }, - new String[] { - "Follow Bawk Bawk's instructions in chat.", - "Complete a task first or be the last one to stay alive.", - "If you fail a challenge, you lose one life.", - "If you run out of lives, chickens will attack you.", - "Last player with lives wins.", - }); + GameType.BawkBawkBattles, + new Kit[]{new KitBawksFood(manager)}, + new String[]{ + "Follow Bawk Bawk's instructions in chat.", + "Complete a task first or be the last one to stay alive.", + "If you fail a challenge, you lose one life.", + "If you run out of lives, chickens will attack you.", + "Last player with lives wins.", + }); DamagePvP = false; DamagePvE = false; @@ -243,61 +252,54 @@ public class BawkBawkBattles extends TeamGame implements IThrown DeathMessages = false; FixSpawnFacing = false; - TeleportsDisqualify = false; - GiveClock = false; - - CompassEnabled = false; - CompassGiveItem = false; - CompassGiveItemSpectators = false; - Manager.GetCreature().SetDisableCustomDrops(true); populateChallenges(); registerStatTrackers( - new BouncingShadowTracker(this), - new DragonKingTracker(this), - new EliteArcherTracker(this), - new MilkManTracker(this), - new PinataMasterTracker(this), - new PixelNinjaTracker(this), - new SpeedyBuildersTracker(this), - new SurfUpTracker(this), - new TagMasterTracker(this), - new VeteranTracker(this)); + new BouncingShadowTracker(this), + new DragonKingTracker(this), + new EliteArcherTracker(this), + new MilkManTracker(this), + new PinataMasterTracker(this), + new PixelNinjaTracker(this), + new SpeedyBuildersTracker(this), + new SurfUpTracker(this), + new TagMasterTracker(this), + new VeteranTracker(this)); } public void populateChallenges() { _list.add( - new ChallengeAnvilDance(this), - new ChallengeArrowRampage(this), - new ChallengeBlockLobbers(this), - new ChallengeBouncingBlock(this), - new ChallengeBuildRace(this), - new ChallengeColorChange(this), - new ChallengeChickenShooting(this), - new ChallengeDeadlyTnt(this), - new ChallengeDiamondHunt(this), - new ChallengeEggSmash(this), - new ChallengeFallingBlocks(this), - new ChallengeFastFood(this), - new ChallengeWaterHorror(this), - new ChallengeKangarooJump(this), - new ChallengeKingOfTheLadder(this), - new ChallengeLavaRun(this), - new ChallengeMilkACow(this), - new ChallengeOreRun(this), - new ChallengeMinecartDance(this), - new ChallengeMiniOneInTheQuiver(this), - new ChallengePickASide(this), - new ChallengePunchThePig(this), - new ChallengeRedLightGreenLight(this), - new ChallengeReverseTag(this), - new ChallengeRushPush(this), - new ChallengeSmashOff(this), - new ChallengeTreasureDigger(this), - new ChallengeWaveCrush(this)); + new ChallengeAnvilDance(this), + new ChallengeArrowRampage(this), + new ChallengeBlockLobbers(this), + new ChallengeBouncingBlock(this), + new ChallengeBuildRace(this), + new ChallengeColorChange(this), + new ChallengeChickenShooting(this), + new ChallengeDeadlyTnt(this), + new ChallengeDiamondHunt(this), + new ChallengeEggSmash(this), + new ChallengeFallingBlocks(this), + new ChallengeFastFood(this), + new ChallengeWaterHorror(this), + new ChallengeKangarooJump(this), + new ChallengeKingOfTheLadder(this), + new ChallengeLavaRun(this), + new ChallengeMilkACow(this), + new ChallengeOreRun(this), + new ChallengeMinecartDance(this), + new ChallengeMiniOneInTheQuiver(this), + new ChallengePickASide(this), + new ChallengePunchThePig(this), + new ChallengeRedLightGreenLight(this), + new ChallengeReverseTag(this), + new ChallengeRushPush(this), + new ChallengeSmashOff(this), + new ChallengeTreasureDigger(this), + new ChallengeWaveCrush(this)); /* * Removed: @@ -317,40 +319,17 @@ public class BawkBawkBattles extends TeamGame implements IThrown _chickenAttackCenter = WorldData.GetDataLocs("WHITE").get(0); } - /* - * Team creation - */ - @EventHandler(priority = EventPriority.HIGHEST) public void createTeams(GameStateChangeEvent event) { if (event.GetState() == GameState.Recruit) { - createPlayerTeam(); - } - else if (event.GetState() == GameState.Live) - { - createChickenTeam(); + GetTeamList().clear(); + _playerTeam = new GameTeam(this, "Players", ChatColor.YELLOW, new ArrayList<>()); + AddTeam(_playerTeam); } } - private void createPlayerTeam() - { - _playerTeam = new GameTeam(this, "Players", ChatColor.YELLOW, new ArrayList<>()); - AddTeam(_playerTeam); - } - - private void createChickenTeam() - { - _chickenTeam = new GameTeam(this, "Chickens", ChatColor.GRAY, _playerTeam.GetSpawns()); - _chickenTeam.SetVisible(false); - AddTeam(_chickenTeam); - } - - /* - * Preparing for start - */ - @EventHandler(priority = EventPriority.HIGH) public void prepare(GameStateChangeEvent event) { @@ -374,7 +353,7 @@ public class BawkBawkBattles extends TeamGame implements IThrown { for (Player player : GetPlayers(true)) { - _lives.put(player, MAX_LIVES); + _lives.put(player.getUniqueId(), MAX_LIVES); } } @@ -443,7 +422,7 @@ public class BawkBawkBattles extends TeamGame implements IThrown _challenge.getData().setSpawns(selected); _playerTeam.SetSpawns(selected); - SpectatorSpawn = _challenge.getCenter().add(0, SPECTATOR_SPAWN_HEIGHT, 0); + SpectatorSpawn = _challenge.getCenter().add(0.5, SPECTATOR_SPAWN_HEIGHT, 0.5); return selected; } @@ -454,13 +433,14 @@ public class BawkBawkBattles extends TeamGame implements IThrown resetPlayers(); addEffectsToPlayers(); teleportSpectatorsToSpawn(); + clearInventories(); } private void resetPlayers() { - for (Player player : GetPlayers(false)) + for (Player player : GetPlayers(true)) { - if (_lives.get(player) > 0) + if (_lives.containsKey(player.getUniqueId()) && _lives.get(player.getUniqueId()) > 0) { Manager.Clear(player); Scoreboard.setPlayerTeam(player, _playerTeam); @@ -472,7 +452,7 @@ public class BawkBawkBattles extends TeamGame implements IThrown { for (Player player : GetPlayers(false)) { - if (!IsAlive(player)) + if (!IsAlive(player) && !_beingAttacked.contains(player.getUniqueId())) { player.teleport(GetSpectatorLocation()); } @@ -547,7 +527,7 @@ public class BawkBawkBattles extends TeamGame implements IThrown if (!IsAlive(player)) return; - if (!getPlayersAlive().contains(player)) + if (!IsAlive(player)) return; if (!PrepareFreeze) @@ -667,6 +647,14 @@ public class BawkBawkBattles extends TeamGame implements IThrown } } + private void clearInventories() + { + for (Player player : GetPlayers(true)) + { + UtilInv.Clear(player); + } + } + private void addEffectsToPlayers() { for (Player player : GetPlayers(true)) @@ -889,36 +877,33 @@ public class BawkBawkBattles extends TeamGame implements IThrown if (getPlayersWithRemainingLives() <= 1) { - if (getPlayersAlive().size() > 0) + if (GetPlayers(true).size() > 0) { - Player additional = getPlayersAlive().get(0); - _winners.add(0, additional); + Player additional = GetPlayers(true).get(0); + _winners.addFirst(additional); } - if (_winners.size() > 2) - { - Collections.swap(_winners, SEMIFINAL_INDEX, FINAL_INDEX); - } + List actualWinners = _winners.subList(0, Math.min(_winners.size(), 3)); - if (_winners.size() >= 1) + if (actualWinners.size() >= 1) { - AddGems(_winners.get(FIRST_WINNER_INDEX), FIRST_PLACE_GEM_REWARD, "First Place", false, false); + AddGems(actualWinners.get(FIRST_WINNER_INDEX), FIRST_PLACE_GEM_REWARD, "First Place", false, false); - if (_winners.size() >= 2) + if (actualWinners.size() >= 2) { - AddGems(_winners.get(SECOND_WINNER_INDEX), SECOND_PLACE_GEM_REWARD, "Second Place", false, false); + AddGems(actualWinners.get(SECOND_WINNER_INDEX), SECOND_PLACE_GEM_REWARD, "Second Place", false, false); - if (_winners.size() >= 3) + if (actualWinners.size() >= 3) { - AddGems(_winners.get(THIRD_WINNER_INDEX), THIRD_PLACE_GEM_REWARD, "Third Place", false, false); + AddGems(actualWinners.get(THIRD_WINNER_INDEX), THIRD_PLACE_GEM_REWARD, "Third Place", false, false); } } } - for (Player player : super.GetPlayers(false)) + for (Player player : GetPlayers(false)) AddGems(player, PARTICIPATION_GEMS, "Participation", false, false); - AnnounceEnd(_winners); + AnnounceEnd(actualWinners); SetState(GameState.End); } } @@ -941,19 +926,16 @@ public class BawkBawkBattles extends TeamGame implements IThrown private boolean canStartCrumbling() { int lost = _challenge.getData().getLostPlayers().size(); - int current = getPlayersAlive().size(); + int current = GetPlayers(true).size(); return !_settings.isCrumbling() && lost > current / CRUMBLE_DIVIDER; } private void announceCrumbling() { - for (Player player : UtilServer.getPlayers()) + for (Player player : GetPlayers(true)) { - if (!_chickenTeam.HasPlayer(player)) - { - UtilPlayer.message(player, F.main("Game", "The map has started to crumble.")); - } + UtilPlayer.message(player, F.main("Game", "The map has started to crumble.")); } } @@ -1010,13 +992,7 @@ public class BawkBawkBattles extends TeamGame implements IThrown if (event.getType() != UpdateType.SEC) return; - if (_chickenTeam == null) - return; - - if (_chickenTeam.GetSize() == 0) - return; - - for (Player player : _chickenTeam.GetPlayers(true)) + _beingAttacked.stream().map(Bukkit::getPlayer).filter(Objects::nonNull).forEach(player -> { Chicken chicken = UtilMath.randomElement(_chickenAttack.getChickens()); Material feetType = chicken.getLocation().getBlock().getType(); @@ -1026,18 +1002,18 @@ public class BawkBawkBattles extends TeamGame implements IThrown UtilEnt.CreatureLook(chicken, player); player.playSound(chicken.getLocation(), Sound.BAT_TAKEOFF, CHICKEN_ATTACK_SOUND_VOLUME, CHICKEN_ATTACK_SOUND_PITCH); UtilAction.velocity( - chicken, - UtilAlg.getTrajectory2d(chicken, player), - UtilAlg.calculateVelocity(chicken.getLocation().toVector(), player.getLocation().toVector(), CHICKEN_VELOCITY_HEIGHT).length() + CHICKEN_VELOCITY_ADD, - false, - 0, - CHICKEN_VELOCITY_HEIGHT, - CHICKEN_VELOCITY_HEIGHT + 1, - false); + chicken, + UtilAlg.getTrajectory2d(chicken, player), + UtilAlg.calculateVelocity(chicken.getLocation().toVector(), player.getLocation().toVector(), CHICKEN_VELOCITY_HEIGHT).length() + CHICKEN_VELOCITY_ADD, + false, + 0, + CHICKEN_VELOCITY_HEIGHT, + CHICKEN_VELOCITY_HEIGHT + 1, + false); Manager.GetProjectile().AddThrow(chicken, null, this, -1, true, false, false, true, CHICKEN_ATTACK_HITBOX_GROW); } - } + }); } @EventHandler @@ -1072,12 +1048,39 @@ public class BawkBawkBattles extends TeamGame implements IThrown Player player = event.getEntity(); - if (!_chickenTeam.HasPlayer(player)) + if (IsAlive(player)) return; _chickenAttack.kill(player, true); } + @Override + public void disqualify(Player player) + { + RemoveTeamPreference(player); + GetPlayerKits().remove(player); + GetPlayerGems().remove(player); + + //Remove Team + GameTeam team = GetTeam(player); + if (team != null) + { + if (InProgress()) + { + getPlayerTeam().SetPlayerState(player, GameTeam.PlayerState.OUT); + + int alive = getPlayersWithRemainingLives(); + + if (alive > Challenge.CHICKEN_ATTACK_CRITERIA) + getChickenAttack().start(player); + else + getChickenAttack().kill(player, true); + } + else + team.RemovePlayer(player); + } + } + @EventHandler public void blockChickenAttackMemberDamage(EntityDamageEvent event) { @@ -1111,8 +1114,14 @@ public class BawkBawkBattles extends TeamGame implements IThrown for (Player player : GetPlayers(true)) { - for (Player other : _chickenTeam.GetPlayers(false)) + for (Player other : GetPlayers(false)) { + if (IsAlive(other)) + continue; + + if (_beingAttacked.contains(other.getUniqueId())) + continue; + if (player.equals(other)) continue; @@ -1143,7 +1152,7 @@ public class BawkBawkBattles extends TeamGame implements IThrown Player player = event.getPlayer(); - if (_challenge.getData().isDone(player) && !_chickenTeam.HasPlayer(player.getName(), false)) + if (_challenge.getData().isDone(player) && IsAlive(player)) { if (event.getTo().getY() <= 0) { @@ -1203,7 +1212,7 @@ public class BawkBawkBattles extends TeamGame implements IThrown { Player player = event.getPlayer(); - _lives.remove(player); + _lives.remove(player.getUniqueId()); _winners.remove(player); } @@ -1223,19 +1232,16 @@ public class BawkBawkBattles extends TeamGame implements IThrown // } // } + @Override + public boolean shouldHeal(Player player) + { + return !_beingAttacked.contains(player.getUniqueId()); + } + /* * Miscellaneous */ - @EventHandler - public void blockTeleport(MineplexTeleportEvent event) - { - if (!IsLive()) - return; - - event.setCancelled(true); - } - @EventHandler public void blockDeathEffectHeadModification(PlayerArmorStandManipulateEvent event) { @@ -1353,6 +1359,9 @@ public class BawkBawkBattles extends TeamGame implements IThrown if (event.getType() != UpdateType.FAST) return; + if (!IsLive()) + return; + Scoreboard.reset(); if (getPlayersWithRemainingLives() >= GENERIC_SCOREBOARD_PLAYER_COUNT) @@ -1434,7 +1443,7 @@ public class BawkBawkBattles extends TeamGame implements IThrown { Scoreboard.writeNewLine(); - Scoreboard.writeGroup(super.GetPlayers(true), player -> + Scoreboard.writeGroup(GetPlayers(true), player -> { int lives = lives(player); String state = definePlayerState(player); @@ -1481,74 +1490,6 @@ public class BawkBawkBattles extends TeamGame implements IThrown return ""; } - // @EventHandler - // public void debugCommands(PlayerCommandPreprocessEvent event) - // { - // Player player = event.getPlayer(); - // String message = event.getMessage(); - // - // if (Manager.GetClients().hasRank(player, Rank.SNR_MODERATOR)) - // { - // if (message.startsWith("/restrict")) - // { - // String[] pieces = message.split(" "); - // - // if (pieces.length > 1) - // { - // String challenge = F.combine(pieces, 1, null, false).trim(); - // - // if (_list.restrict(challenge)) - // { - // UtilPlayer.message(player, F.main("Game", "Restricted to " + F.elem(challenge) + " challenge.")); - // } - // else - // { - // UtilPlayer.message(player, F.main("Game", "Could not find any challenge by that name.")); - // } - // } - // else - // { - // UtilPlayer.message(player, F.main("Game", "All challenge restrictions were cleared.")); - // _list.unrestrict(); - // } - // - // event.setCancelled(true); - // } - // else if (message.startsWith("/skip")) - // { - // if (IsLive()) - // { - // endCurrentChallenge(); - // - // Announce(C.cAqua + C.Bold + player.getName() + " skipped this challenge."); - // } - // else - // { - // UtilPlayer.message(player, F.main("Game", "You cannot skip a challenge if the game is not started.")); - // } - // - // event.setCancelled(true); - // } - // else if (message.startsWith("/lose")) - // { - // if (IsLive() && _challenge != null && IsAlive(player)) - // { - // setLives(player, 0); - // _challenge.getData().addLostPlayer(player); - // _deathEffect.playDeath(player, player.getLocation()); - // GetScoreboard().ResetScore(player.getName()); - // _chickenAttack.start(player); - // } - // else - // { - // UtilPlayer.message(player, F.main("Game", "You cannot lose at this time.")); - // } - // - // event.setCancelled(true); - // } - // } - // } - /* * Helper methods */ @@ -1566,10 +1507,12 @@ public class BawkBawkBattles extends TeamGame implements IThrown public int lives(Player player) { - if (!_lives.containsKey(player)) + if (!_lives.containsKey(player.getUniqueId())) + { return 0; + } - return _lives.get(player); + return _lives.get(player.getUniqueId()); } /* @@ -1578,7 +1521,7 @@ public class BawkBawkBattles extends TeamGame implements IThrown public void setLives(Player player, int amount) { - _lives.put(player, amount); + _lives.put(player.getUniqueId(), amount); } /* @@ -1590,11 +1533,6 @@ public class BawkBawkBattles extends TeamGame implements IThrown return _playerTeam; } - public GameTeam getChickenTeam() - { - return _chickenTeam; - } - public Challenge getCurrentChallenge() { return _challenge; @@ -1606,14 +1544,17 @@ public class BawkBawkBattles extends TeamGame implements IThrown } @Override - public List getWinners() + public LinkedList getWinners() { return _winners; } - public Map getLives() + @Override + public List getLosers() { - return _lives; + List players = new ArrayList<>(UtilServer.getPlayersCollection()); + players.removeAll(getWinners()); + return players; } public BawkBawkBattlesSettings getSettings() @@ -1640,40 +1581,6 @@ public class BawkBawkBattles extends TeamGame implements IThrown * Player related getter methods */ - /** - * Returns the list of players contained on the player's team. - * - * @param aliveOnly Whether or not to select all players. - */ - @Override - public ArrayList GetPlayers(boolean aliveOnly) - { - if (_playerTeam != null) - return _playerTeam.GetPlayers(aliveOnly); - else - return super.GetPlayers(aliveOnly); - } - - /** - * Returns the list of players that are alive. - *
- * Players are considered to be alive after they are teleported to challenge spawn locations. - */ - public ArrayList getPlayersAlive() - { - ArrayList list = new ArrayList(); - - for (Player player : GetPlayers(true)) - { - if (!UtilPlayer.isSpectator(player)) - { - list.add(player); - } - } - - return list; - } - /** * Returns the amount of players with more than one life. */ @@ -1681,7 +1588,7 @@ public class BawkBawkBattles extends TeamGame implements IThrown { int amount = 0; - for (Player player : _lives.keySet()) + for (Player player : GetPlayers(true)) { if (lives(player) > 0) { @@ -1713,7 +1620,7 @@ public class BawkBawkBattles extends TeamGame implements IThrown { Player player = (Player) target; - if (_chickenTeam.HasPlayer(player) && IsAlive(player)) + if (_beingAttacked.contains(player.getUniqueId())) { player.playSound(player.getLocation(), Sound.CHICKEN_HURT, CHICKEN_HIT_PLAYER_SOUND_VOLUME, CHICKEN_HIT_PLAYER_SOUND_PITCH); player.damage(CHICKEN_HIT_PLAYER_DAMAGE); diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/mineware/challenge/Challenge.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/mineware/challenge/Challenge.java index c6fdc6a31..50f25aa42 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/mineware/challenge/Challenge.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/mineware/challenge/Challenge.java @@ -4,6 +4,13 @@ import java.util.ArrayList; import java.util.HashSet; import java.util.List; +import net.minecraft.server.v1_8_R3.BlockPosition; +import net.minecraft.server.v1_8_R3.Blocks; +import net.minecraft.server.v1_8_R3.ChunkSection; +import net.minecraft.server.v1_8_R3.EnumSkyBlock; +import net.minecraft.server.v1_8_R3.IBlockData; +import net.minecraft.server.v1_8_R3.WorldServer; + import org.bukkit.Bukkit; import org.bukkit.Color; import org.bukkit.Effect; @@ -12,8 +19,10 @@ import org.bukkit.FireworkEffect.Type; import org.bukkit.Location; import org.bukkit.Material; import org.bukkit.Sound; +import org.bukkit.World; import org.bukkit.block.Block; import org.bukkit.block.BlockFace; +import org.bukkit.craftbukkit.v1_8_R3.CraftWorld; import org.bukkit.entity.Entity; import org.bukkit.entity.EntityType; import org.bukkit.entity.LivingEntity; @@ -34,6 +43,7 @@ import mineplex.core.common.util.C; import mineplex.core.common.util.F; import mineplex.core.common.util.UtilBlock; import mineplex.core.common.util.UtilInv; +import mineplex.core.common.util.UtilItem; import mineplex.core.common.util.UtilMath; import mineplex.core.common.util.UtilParticle; import mineplex.core.common.util.UtilParticle.ParticleType; @@ -49,6 +59,8 @@ import mineplex.core.projectile.ProjectileUser; import mineplex.core.updater.UpdateType; import mineplex.core.updater.event.UpdateEvent; import mineplex.minecraft.game.core.condition.Condition.ConditionType; + +import nautilus.game.arcade.game.GameTeam; import nautilus.game.arcade.game.games.mineware.BawkBawkBattles; import nautilus.game.arcade.game.games.mineware.events.ChallengeEndEvent; import nautilus.game.arcade.game.games.mineware.events.ChallengeStartEvent; @@ -61,7 +73,7 @@ import nautilus.game.arcade.world.WorldData; * All challenges should trigger any functionality inside * {@link #createSpawns()}, {@link #createMap()}, {@link #onStart()} and {@link #onEnd()}. *

- * + * * Additionally, {@link #onTimerFinish()} and {@link #onCollide(LivingEntity, Block, ProjectileUser)} can be overrided. */ public abstract class Challenge implements Listener @@ -79,8 +91,8 @@ public abstract class Challenge implements Listener private static final int BORDER_MAX_Z = 100; private static final int COMPLETE_COUNT_DIVIDER = 2; - private static final int WINNER_ADD_CRITERIA = 3; // players - private static final int CHICKEN_ATTACK_CRITERIA = 2; // players + public static final int WINNER_ADD_CRITERIA = 3; // players + public static final int CHICKEN_ATTACK_CRITERIA = 2; // players private static final int CHALLENGE_CLOAK_DURATION = 7777; private static final int COMPLETION_GEMS = 3; @@ -146,7 +158,7 @@ public abstract class Challenge implements Listener /** * The list of spawn locations where players will be teleported. - * + * * @return ArrayList */ public abstract ArrayList createSpawns(); @@ -174,7 +186,7 @@ public abstract class Challenge implements Listener { if (firstRun) { - ArrayList players = Host.GetPlayers(false); + ArrayList players = Host.GetPlayers(true); for (int i = 0; i < players.size(); i++) { @@ -192,7 +204,7 @@ public abstract class Challenge implements Listener } else { - Host.getPlayerTeam().SpawnTeleport(false); + Host.getPlayerTeam().SpawnTeleport(true); } } @@ -305,7 +317,7 @@ public abstract class Challenge implements Listener @EventHandler(priority = EventPriority.MONITOR) public void death(PlayerDeathEvent event) { - if (!Host.IsLive() || Host.getChickenTeam().HasPlayer(event.getEntity())) + if (!Host.IsLive() || !Host.IsAlive(event.getEntity())) return; Player player = event.getEntity(); @@ -319,17 +331,21 @@ public abstract class Challenge implements Listener private void handleDeath(Player player) { - int alive = Host.getPlayersWithRemainingLives(); int lives = loseLife(player); - if (lives <= 0 && alive <= WINNER_ADD_CRITERIA) + if (lives <= 0) { - Host.getWinners().add(player); - } + Host.getPlayerTeam().SetPlayerState(player, GameTeam.PlayerState.OUT); - if (lives <= 0 && alive > CHICKEN_ATTACK_CRITERIA) - { - Host.getChickenAttack().start(player); + int alive = Host.getPlayersWithRemainingLives(); + if (Host.lives(player) <= 0) + { + Host.getWinners().addFirst(player); + if (alive > Challenge.CHICKEN_ATTACK_CRITERIA) + Host.getChickenAttack().start(player); + else + Host.getChickenAttack().kill(player, true); + } } else { @@ -355,6 +371,8 @@ public abstract class Challenge implements Listener UtilPlayer.message(player, F.main("Game", C.cRed + "You failed to complete the task.")); Host.showLivesLeft(player); Host.Manager.addSpectator(player, true); + if (UtilItem.matchesMaterial(player.getInventory().getItem(8), Material.WATCH)) + player.getInventory().setItem(8, null); Host.Manager.GetCondition().Factory().Cloak("Challenge Death", player, player, CHALLENGE_CLOAK_DURATION, true, true); } @@ -400,7 +418,7 @@ public abstract class Challenge implements Listener for (Player player : players) { - if (!Host.getChickenTeam().HasPlayer(player) && Host.lives(player) > 0) + if (!Host.IsAlive(player) && Host.lives(player) > 0) { UtilTextBottom.display(C.Bold + "Next challenge will begin shortly.", player); } @@ -523,30 +541,14 @@ public abstract class Challenge implements Listener setCompleted(player, false); } - protected void setLost(Player player, boolean cloak) + protected void setLost(Player player) { if (Data.isDone(player)) return; Data.addLostPlayer(player); - loseLife(player); - if (cloak) - { - cloak(player, false); - } - - UtilPlayer.message(player, F.main("Game", C.cRed + "You failed to complete the task.")); - Host.showLivesLeft(player); - player.playSound(player.getLocation(), Sound.NOTE_BASS, LOST_SOUND_VOLUME, LOST_SOUND_PITCH); - - UtilPlayer.clearPotionEffects(player); - UtilInv.Clear(player); - } - - protected void setLost(Player player) - { - setLost(player, false); + handleDeath(player); } private void cloak(Player player, boolean completed) @@ -578,6 +580,39 @@ public abstract class Challenge implements Listener UtilBlock.setQuick(block.getWorld(), block.getX(), block.getY(), block.getZ(), type.getId(), data); } + public void setBlockReallyQuicklyAndDangerously(Block block, Material type, byte data) + { + World world = block.getWorld(); + int x = block.getLocation().getBlockX(); + int y = block.getLocation().getBlockY(); + int z = block.getLocation().getBlockZ(); + int i = x & 15; + int j = y; + int k = z & 15; + int cx = block.getX() >> 4; + int cz = block.getZ() >> 4; + if (!world.isChunkLoaded(cx, cz)) + { + world.loadChunk(cx, cz, true); + } + + WorldServer nmsWorld = ((CraftWorld) world).getHandle(); + + net.minecraft.server.v1_8_R3.Chunk chunk = nmsWorld.getChunkAt(x >> 4, z >> 4); + BlockPosition pos = new BlockPosition(x, y, z); + IBlockData ibd = net.minecraft.server.v1_8_R3.Block.getById(type.getId()).fromLegacyData(data); + ChunkSection chunksection = chunk.getSections()[y >> 4]; + if (chunksection == null) + { + if (block != Blocks.AIR) + { + chunksection = chunk.getSections()[y >> 4] = new ChunkSection(y >> 4 << 4, !nmsWorld.worldProvider.o()); + } + } + chunksection.setType(i, j & 15, k, ibd); + nmsWorld.notify(pos); + } + public void setBlock(Block block, Material type) { setBlock(block, type, (byte) 0); @@ -819,7 +854,7 @@ public abstract class Challenge implements Listener public ArrayList getPlayersAlive() { - return Host.getPlayersAlive(); + return Host.GetPlayers(true); } public ArrayList getPlayersIn(boolean ignoreCompleted) @@ -864,7 +899,7 @@ public abstract class Challenge implements Listener public int getArenaSize(int minBlocks) { int size = (int) (minBlocks + Math.ceil(Host.getPlayersWithRemainingLives() / ARENA_SIZE_DIVIDER)); - return size > ARENA_SIZE_LIMIT ? ARENA_SIZE_LIMIT : size; + return Math.min(size, ARENA_SIZE_LIMIT); } public BawkBawkBattles getHost() diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/mineware/challenge/TeamChallenge.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/mineware/challenge/TeamChallenge.java index 7c7ca7665..d8b33577c 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/mineware/challenge/TeamChallenge.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/mineware/challenge/TeamChallenge.java @@ -140,7 +140,7 @@ public abstract class TeamChallenge extends Challenge */ protected void autoSelectTeams() { - ArrayList players = Host.GetPlayers(false); + ArrayList players = Host.GetPlayers(true); Collections.shuffle(players); int size = 0; diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/mineware/challenge/other/ZombieWrapper.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/mineware/challenge/other/ZombieWrapper.java index 5e7e30c7f..ab5053d71 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/mineware/challenge/other/ZombieWrapper.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/mineware/challenge/other/ZombieWrapper.java @@ -35,7 +35,7 @@ public class ZombieWrapper _wrapper = (Zombie) world.spawnEntity(center.clone().add(0.5, 1, 0.5), EntityType.ZOMBIE); - UtilEnt.Vegetate(_wrapper); + UtilEnt.vegetate(_wrapper); UtilEnt.ghost(_wrapper, true, false); _wrapper.setCustomName(C.cRedB + "Infected Zombie"); diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/mineware/challenge/type/ChallengeBouncingBlock.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/mineware/challenge/type/ChallengeBouncingBlock.java index dbe302bbc..0b463033a 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/mineware/challenge/type/ChallengeBouncingBlock.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/mineware/challenge/type/ChallengeBouncingBlock.java @@ -74,7 +74,7 @@ public class ChallengeBouncingBlock extends Challenge implements LogicTracker "Bouncing Block", "Jump and punch floating wool blocks.", "Avoid landing on red wool.", - "First to " + SCORE_GOAL + " wins!"); + "Get to " + SCORE_GOAL + " to win!"); Settings.setUseMapHeight(); } diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/mineware/challenge/type/ChallengeBuildRace.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/mineware/challenge/type/ChallengeBuildRace.java index b2829b1b3..64fd9ed59 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/mineware/challenge/type/ChallengeBuildRace.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/mineware/challenge/type/ChallengeBuildRace.java @@ -57,7 +57,7 @@ public class ChallengeBuildRace extends Challenge implements LogicTracker ChallengeType.FirstComplete, "Build Race", "Your inventory is filled with blocks.", - "Place them all in the ground!"); + "Place them all on the ground!"); Settings.setUseMapHeight(); } diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/mineware/challenge/type/ChallengeColorChange.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/mineware/challenge/type/ChallengeColorChange.java index 67f62bdcf..31509c80b 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/mineware/challenge/type/ChallengeColorChange.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/mineware/challenge/type/ChallengeColorChange.java @@ -13,6 +13,8 @@ import org.bukkit.block.Block; import org.bukkit.entity.Player; import org.bukkit.event.EventHandler; import org.bukkit.inventory.ItemStack; +import org.bukkit.potion.PotionEffect; +import org.bukkit.potion.PotionEffectType; import mineplex.core.common.util.UtilMath; import mineplex.core.common.util.UtilTextBottom; @@ -32,8 +34,9 @@ public class ChallengeColorChange extends Challenge private static final int MAP_HEIGHT = 1; private static final long TIME_DELAY = 5000; - private static final int TIME_DELAY_DECREMENT_RATE = 100; - private static final int RESET_DELAY = 4000; + private static final int RESET_DELAY = 3750; + private static final int TIME_DELAY_DECREMENT_RATE = 600; + private static final int TIME_DELAY_MIN = 1500; private static final int PLATFORM_MULTIPLIER = 2; private static final int PLATFORM_SHIFT = 2; @@ -96,6 +99,12 @@ public class ChallengeColorChange extends Challenge _stageDelay = System.currentTimeMillis() + _modifiedTimeDelay; _currentColor = UtilMath.randomElement(_colors); + for (Player player : Host.GetPlayers(false)) + { + PotionEffect nightVision = new PotionEffect(PotionEffectType.NIGHT_VISION, 100000, 1, true, false); + player.addPotionEffect(nightVision); + } + fillItem(new ItemStack(Material.STAINED_CLAY, 1, (short) _currentColor)); } @@ -105,6 +114,11 @@ public class ChallengeColorChange extends Challenge _isFalling = false; _lastSound = 0; _lastGeneratedPlatforms.clear(); + + for (Player player : Host.GetPlayers(false)) + { + player.removePotionEffect(PotionEffectType.NIGHT_VISION); + } } @EventHandler @@ -124,22 +138,26 @@ public class ChallengeColorChange extends Challenge if (_isFalling) { + removeAllPlatforms(); playFallSound(); _isFalling = false; - _modifiedTimeDelay -= TIME_DELAY_DECREMENT_RATE; - _stageDelay = System.currentTimeMillis() + _modifiedTimeDelay; _currentColor = UtilMath.randomElement(_colors); createMap(); addCurrentColorToInventory(); + + _modifiedTimeDelay -= TIME_DELAY_DECREMENT_RATE; + _modifiedTimeDelay = Math.max(_modifiedTimeDelay, TIME_DELAY_MIN); + _stageDelay = System.currentTimeMillis() + _modifiedTimeDelay; } else { _isFalling = true; - _stageDelay = System.currentTimeMillis() + RESET_DELAY; removeDifferentColorPlatforms(); + + _stageDelay = System.currentTimeMillis() + RESET_DELAY; } } else if (!_isFalling) @@ -210,7 +228,7 @@ public class ChallengeColorChange extends Challenge for (int z = 0; z <= 1; z++) { Block block = getCenter().getBlock().getRelative(platformX + x, 0, platformZ + z); - setBlock(block, Material.STAINED_CLAY, color); + setBlockReallyQuicklyAndDangerously(block, Material.STAINED_CLAY, color); addBlock(block); } } @@ -242,7 +260,28 @@ public class ChallengeColorChange extends Challenge if (block.getData() != _currentColor) { - resetBlock(block); + setBlockReallyQuicklyAndDangerously(block, Material.AIR, (byte) 0); + } + } + } + + } + } + + @SuppressWarnings("deprecation") + private void removeAllPlatforms() + { + for (Entry platform : _lastGeneratedPlatforms) + { + for (int x = 0; x <= 1; x++) + { + for (int z = 0; z <= 1; z++) + { + Block block = getCenter().getBlock().getRelative(platform.getKey() + x, 0, platform.getValue() + z); + + if (block.getType() != Material.AIR) + { + setBlockReallyQuicklyAndDangerously(block, Material.AIR, (byte) 0); } } } diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/mineware/challenge/type/ChallengeEggSmash.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/mineware/challenge/type/ChallengeEggSmash.java index bf137e70a..603dcfe76 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/mineware/challenge/type/ChallengeEggSmash.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/mineware/challenge/type/ChallengeEggSmash.java @@ -121,7 +121,6 @@ public class ChallengeEggSmash extends Challenge implements NumberTracker remove(EntityType.FALLING_BLOCK); } - @SuppressWarnings("deprecation") @EventHandler public void onPlayerInteract(PlayerInteractEvent event) { diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/mineware/challenge/type/ChallengeFastFood.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/mineware/challenge/type/ChallengeFastFood.java index 221ca144d..9f42ac4e1 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/mineware/challenge/type/ChallengeFastFood.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/mineware/challenge/type/ChallengeFastFood.java @@ -74,7 +74,7 @@ public class ChallengeFastFood extends Challenge ChallengeType.FirstComplete, "Fast Food", "Your inventory is full of food.", - "Punch to throw it in the ground."); + "Punch to throw it on the ground."); Settings.setUseMapHeight(); } diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/mineware/challenge/type/ChallengeLavaRun.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/mineware/challenge/type/ChallengeLavaRun.java index 49037ba6f..10adc6e26 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/mineware/challenge/type/ChallengeLavaRun.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/mineware/challenge/type/ChallengeLavaRun.java @@ -14,6 +14,8 @@ import org.bukkit.block.Block; import org.bukkit.entity.Player; import org.bukkit.event.EventHandler; import org.bukkit.event.block.BlockFromToEvent; +import org.bukkit.potion.PotionEffect; +import org.bukkit.potion.PotionEffectType; import mineplex.core.common.util.UtilMath; import mineplex.core.disguise.disguises.DisguiseMagmaCube; @@ -103,6 +105,11 @@ public class ChallengeLavaRun extends Challenge _disappearingBlocks = DISSAPEARING_BLOCKS; createLava(); disguisePlayers(); + for (Player player : Host.GetPlayers(false)) + { + PotionEffect nightVision = new PotionEffect(PotionEffectType.NIGHT_VISION, 100000, 1, true, false); + player.addPotionEffect(nightVision); + } } @Override @@ -123,6 +130,11 @@ public class ChallengeLavaRun extends Challenge Host.Manager.GetDisguise().undisguise(player); } } + + for (Player player : Host.GetPlayers(false)) + { + player.removePotionEffect(PotionEffectType.NIGHT_VISION); + } } @EventHandler @@ -139,7 +151,7 @@ public class ChallengeLavaRun extends Challenge if (_shouldMoveObsidian) { - resetBlock(_obsidian); + setBlockReallyQuicklyAndDangerously(_obsidian, Material.AIR, (byte) 0); generatePlatform(); _obsidian = createObsidianBlock(); blockBreakEffect(_obsidian, false); @@ -209,7 +221,7 @@ public class ChallengeLavaRun extends Challenge for (int z = -getArenaSize(); z <= getArenaSize(); z++) { Block block = getCenter().getBlock().getRelative(x, MAP_HEIGHT, z); - setBlock(block, Material.GLASS); + setBlockReallyQuicklyAndDangerously(block, Material.GLASS, (byte) 0); _platform.add(block); addBlock(block); } @@ -227,7 +239,7 @@ public class ChallengeLavaRun extends Challenge for (int y = 0; y < MAP_HEIGHT; y++) { Block block = getCenter().getBlock().getRelative(x, y, z); - setBlock(block, Material.STATIONARY_LAVA); + setBlockReallyQuicklyAndDangerously(block, Material.STATIONARY_LAVA, (byte) 0); addBlock(block); } } @@ -237,7 +249,7 @@ public class ChallengeLavaRun extends Challenge private Block createObsidianBlock() { Block block = getCenter().add(UtilMath.r(_arenaStartSize), MAP_HEIGHT, UtilMath.r(_arenaStartSize)).getBlock(); - setBlock(block, Material.OBSIDIAN); + setBlockReallyQuicklyAndDangerously(block, Material.OBSIDIAN, (byte) 0); return block; } @@ -283,14 +295,7 @@ public class ChallengeLavaRun extends Challenge distance.put(part, part.getLocation().add(DISTANCE_XZ_ADD, 0, DISTANCE_XZ_ADD).distance(_obsidian.getLocation())); } - Collections.sort(_platform, new Comparator() - { - @Override - public int compare(Block o1, Block o2) - { - return distance.get(o2).compareTo(distance.get(o1)); - } - }); + _platform.sort((o1, o2) -> distance.get(o2).compareTo(distance.get(o1))); for (int i = 0; i < Math.min(_disappearingBlocks, _platform.size()); i++) { @@ -299,7 +304,7 @@ public class ChallengeLavaRun extends Challenge if (!block.equals(_obsidian)) // We do not want to remove the obsidian block. { _platform.remove(0); - resetBlock(block); + setBlockReallyQuicklyAndDangerously(block, Material.AIR, (byte) 0); } } } diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/mineware/challenge/type/ChallengeRedLightGreenLight.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/mineware/challenge/type/ChallengeRedLightGreenLight.java index df3f3e458..8df1e66cd 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/mineware/challenge/type/ChallengeRedLightGreenLight.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/mineware/challenge/type/ChallengeRedLightGreenLight.java @@ -230,7 +230,7 @@ public class ChallengeRedLightGreenLight extends Challenge Location spawn = getCenter().add(VILLAGER_X, MAP_HEIGHT, 0); _villager = (Villager) getCenter().getWorld().spawnEntity(spawn, EntityType.VILLAGER); - UtilEnt.Vegetate(_villager); + UtilEnt.vegetate(_villager); UtilEnt.CreatureLook(_villager, Host.GetSpectatorLocation()); UtilEnt.ghost(_villager, true, false); diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/mineware/challenge/type/ChallengeVolleyPig.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/mineware/challenge/type/ChallengeVolleyPig.java index 9c9f7c5d7..5b3e32ee5 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/mineware/challenge/type/ChallengeVolleyPig.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/mineware/challenge/type/ChallengeVolleyPig.java @@ -241,7 +241,7 @@ public class ChallengeVolleyPig extends TeamChallenge getCenter().add(PIG_CENTER_X, PIG_CENTER_Y, PIG_CENTER_Z).subtract(getArenaSize(), 0, 0), Pig.class); - UtilEnt.Vegetate(_pig); + UtilEnt.vegetate(_pig); Host.CreatureAllow = false; } diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/mineware/challenge/type/ChallengeWaterHorror.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/mineware/challenge/type/ChallengeWaterHorror.java index e6d5609bd..6647a83bc 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/mineware/challenge/type/ChallengeWaterHorror.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/mineware/challenge/type/ChallengeWaterHorror.java @@ -386,10 +386,17 @@ public class ChallengeWaterHorror extends Challenge TNTPrimed explosive = dropsite.getWorld().spawn(dropsite, TNTPrimed.class); explosive.setFuseTicks(TNT_EXPLODE_AFTER * TICK_MULTIPLIER); + double str = UtilAlg.calculateVelocity(dropsite.toVector(), target.toVector(), TNT_VELOCITY_HEIGHT).length() + TNT_VELOCITY_POWER_MIN; + + if (((dropsite.getX() - target.getX()) * (dropsite.getX() - target.getX()) + (dropsite.getY() - target.getY()) * (dropsite.getY() - target.getY())) < 16) + { + str = 0; + } + UtilAction.velocity( explosive, UtilAlg.getTrajectory2d(dropsite, target), - UtilAlg.calculateVelocity(dropsite.toVector(), target.toVector(), TNT_VELOCITY_HEIGHT).length() + TNT_VELOCITY_POWER_MIN, + str, true, 0, TNT_VELOCITY_HEIGHT, diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/mineware/effect/ChickenAttack.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/mineware/effect/ChickenAttack.java index 7599ab638..91cf2d583 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/mineware/effect/ChickenAttack.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/mineware/effect/ChickenAttack.java @@ -70,8 +70,7 @@ public class ChickenAttack public void start(Player player) { - _host.getPlayerTeam().RemovePlayer(player); - _host.getChickenTeam().AddPlayer(player, true); + _host._beingAttacked.add(player.getUniqueId()); UtilInv.Clear(player); _host.Manager.Clear(player); @@ -96,7 +95,7 @@ public class ChickenAttack @Override public void run() { - if (_host.IsLive() && _host.getChickenTeam().HasPlayer(player) && _host.IsAlive(player)) + if (_host.IsLive() && _host._beingAttacked.contains(player.getUniqueId())) { UtilPlayer.message(player, F.main("Game", "You have been moved to spectators.")); kill(player, false); @@ -112,6 +111,7 @@ public class ChickenAttack public void kill(Player player, boolean inform) { _host.Manager.Clear(player); + _host._beingAttacked.remove(player.getUniqueId()); if (inform) { @@ -123,7 +123,6 @@ public class ChickenAttack @Override public void run() { - _host.SetPlayerState(player, PlayerState.OUT); DisguiseChicken disguise = new DisguiseChicken(player); disguise.setBaby(); diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/moba/Moba.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/moba/Moba.java index 3879c4b3b..17f393dd6 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/moba/Moba.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/moba/Moba.java @@ -6,6 +6,7 @@ import nautilus.game.arcade.ArcadeManager; import nautilus.game.arcade.GameType; import nautilus.game.arcade.game.TeamGame; import nautilus.game.arcade.game.games.sheep.kits.*; +import nautilus.game.arcade.game.modules.compass.CompassModule; import nautilus.game.arcade.kit.Kit; import nautilus.game.arcade.kit.NullKit; @@ -33,6 +34,12 @@ public class Moba extends TeamGame this.HungerSet = 20; registerChatStats(); + + new CompassModule() + .setGiveCompass(true) + .setGiveCompassToSpecs(true) + .setGiveCompassToAlive(false) + .register(this); } @Override diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/monsterleague/Ball.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/monsterleague/Ball.java index 65af10219..49c6bee11 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/monsterleague/Ball.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/monsterleague/Ball.java @@ -1,7 +1,6 @@ package nautilus.game.arcade.game.games.monsterleague; import java.util.ArrayList; -import java.util.HashMap; import mineplex.core.common.util.UtilAction; import mineplex.core.common.util.UtilAlg; @@ -17,7 +16,6 @@ import mineplex.core.recharge.Recharge; import nautilus.game.arcade.game.GameTeam; import nautilus.game.arcade.game.games.monsterleague.kits.LeagueKit; -import org.bukkit.Bukkit; import org.bukkit.ChatColor; import org.bukkit.Color; import org.bukkit.EntityEffect; @@ -159,7 +157,7 @@ public class Ball _ball = _ballSpawn.getWorld().spawn(_ballSpawn, Slime.class); _ball.setSize(2); - UtilEnt.Vegetate(_ball); + UtilEnt.vegetate(_ball); UtilEnt.ghost(_ball, false, false); _host.CreatureAllowOverride = false; diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/monsterleague/MonsterLeague.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/monsterleague/MonsterLeague.java index bc413c4da..9eb023408 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/monsterleague/MonsterLeague.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/monsterleague/MonsterLeague.java @@ -27,6 +27,8 @@ import nautilus.game.arcade.GameType; import nautilus.game.arcade.game.GameTeam; import nautilus.game.arcade.game.TeamGame; import nautilus.game.arcade.game.games.monsterleague.kits.*; +import nautilus.game.arcade.game.modules.TeamArmorModule; +import nautilus.game.arcade.game.modules.compass.CompassModule; import nautilus.game.arcade.kit.Kit; public class MonsterLeague extends TeamGame @@ -60,11 +62,19 @@ public class MonsterLeague extends TeamGame this.HealthSet = 20; this.DeathOut = false; - - this.TeamArmor = true; - this.TeamArmorHotbar = true; registerChatStats(); + + new CompassModule() + .setGiveCompass(true) + .setGiveCompassToSpecs(true) + .setGiveCompassToAlive(false) + .register(this); + + new TeamArmorModule() + .giveTeamArmor() + .giveHotbarItem() + .register(this); } //Supports anywhere from 2-4 teams on a map diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/monstermaze/Maze.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/monstermaze/Maze.java index 1eef92624..8c020184c 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/monstermaze/Maze.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/monstermaze/Maze.java @@ -530,7 +530,7 @@ public class Maze implements Listener _host.CreatureAllowOverride = false; - UtilEnt.Vegetate(ent, true); + UtilEnt.vegetate(ent, true); UtilEnt.ghost(ent, true, false); _ents.put(ent, new MazeMobWaypoint(ent.getLocation())); @@ -568,7 +568,7 @@ public class Maze implements Listener _host.CreatureAllowOverride = false; - UtilEnt.Vegetate(ent, true); + UtilEnt.vegetate(ent, true); UtilEnt.ghost(ent, true, false); _ents.put(ent, new MazeMobWaypoint(ent.getLocation())); diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/monstermaze/MonsterMaze.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/monstermaze/MonsterMaze.java index fadbfffa1..172c11514 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/monstermaze/MonsterMaze.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/monstermaze/MonsterMaze.java @@ -32,6 +32,7 @@ import nautilus.game.arcade.game.games.monstermaze.trackers.FirstToSafepadTracke import nautilus.game.arcade.game.games.monstermaze.trackers.PilotTracker; import nautilus.game.arcade.game.games.monstermaze.trackers.SnowmanHitTracker; import nautilus.game.arcade.game.games.monstermaze.trackers.SurvivePast10thSafepadTracker; +import nautilus.game.arcade.game.modules.compass.CompassModule; import nautilus.game.arcade.kit.Kit; import nautilus.game.arcade.managers.chat.ChatStatData; @@ -96,8 +97,6 @@ public class MonsterMaze extends SoloGame PrepareFreeze = false; HungerSet = 20; - - CompassEnabled = false; registerStatTrackers( new SnowmanHitTracker(this), @@ -114,6 +113,12 @@ public class MonsterMaze extends SoloGame BlankLine, new ChatStatData("kit", "Kit", true) ); + + new CompassModule() + .setGiveCompass(true) + .setGiveCompassToSpecs(true) + .setGiveCompassToAlive(false) + .register(this); } public Maze getMaze() diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/oldmineware/OldMineWare.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/oldmineware/OldMineWare.java index f550a929b..606acf8fe 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/oldmineware/OldMineWare.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/oldmineware/OldMineWare.java @@ -37,6 +37,7 @@ import nautilus.game.arcade.game.SoloGame; import nautilus.game.arcade.game.games.oldmineware.order.Order; import nautilus.game.arcade.game.games.oldmineware.random.*; import nautilus.game.arcade.game.games.runner.kits.KitLeaper; +import nautilus.game.arcade.game.modules.compass.CompassModule; import nautilus.game.arcade.kit.Kit; public class OldMineWare extends SoloGame @@ -90,6 +91,12 @@ public class OldMineWare extends SoloGame PopulateOrders(); registerChatStats(); + + new CompassModule() + .setGiveCompass(true) + .setGiveCompassToSpecs(true) + .setGiveCompassToAlive(false) + .register(this); } @Override diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/paintball/Paintball.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/paintball/Paintball.java index 8fffdb878..e7f509b4e 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/paintball/Paintball.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/paintball/Paintball.java @@ -74,6 +74,8 @@ import nautilus.game.arcade.game.games.paintball.kits.KitSniper; import nautilus.game.arcade.game.games.paintball.trackers.KillingSpreeTracker; import nautilus.game.arcade.game.games.paintball.trackers.LastStandStatTracker; import nautilus.game.arcade.game.games.paintball.trackers.MedicStatTracker; +import nautilus.game.arcade.game.modules.TeamArmorModule; +import nautilus.game.arcade.game.modules.compass.CompassModule; import nautilus.game.arcade.kit.Kit; import nautilus.game.arcade.stats.WinFastStatTracker; import nautilus.game.arcade.stats.WinWithoutLosingTeammateStatTracker; @@ -105,8 +107,6 @@ public class Paintball extends TeamGame HungerSet = 20; InventoryClick = false; - - TeamArmorHotbar = true; registerStatTrackers( new KillingSpreeTracker(this), @@ -125,6 +125,15 @@ public class Paintball extends TeamGame DamageTaken, DamageDealt ); + + new CompassModule() + .setGiveCompass(true) + .setGiveCompassToSpecs(true) + .setGiveCompassToAlive(false) + .register(this); + new TeamArmorModule() + .giveHotbarItem() + .register(this); } @EventHandler @@ -500,6 +509,9 @@ public class Paintball extends TeamGame //Clean Armor CleanColorArmor(player); + //Reapply Team Item + getModule(TeamArmorModule.class).apply(player); + //Inform UtilPlayer.message(player, F.main("Game", "You have been cleaned!")); diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/paintball/PlayerCopyPaintball.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/paintball/PlayerCopyPaintball.java index a42d2592b..234e96287 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/paintball/PlayerCopyPaintball.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/paintball/PlayerCopyPaintball.java @@ -45,7 +45,7 @@ public class PlayerCopyPaintball UtilEnt.ghost(_ent, true, false); - UtilEnt.Vegetate(_ent); + UtilEnt.vegetate(_ent); _ent.setArms(true); _ent.setBasePlate(false); diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/quiver/Quiver.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/quiver/Quiver.java index 562098414..03afda7c7 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/quiver/Quiver.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/quiver/Quiver.java @@ -38,6 +38,7 @@ import nautilus.game.arcade.game.games.quiver.kits.KitEnchanter; import nautilus.game.arcade.game.games.quiver.kits.KitLeaper; import nautilus.game.arcade.game.games.quiver.kits.KitNinja; import nautilus.game.arcade.game.games.quiver.kits.KitSlamShot; +import nautilus.game.arcade.game.modules.compass.CompassModule; import nautilus.game.arcade.kit.Kit; import nautilus.game.arcade.stats.SharpShooterStatTracker; import nautilus.game.arcade.stats.WinWithoutBowStatTracker; @@ -87,6 +88,12 @@ public class Quiver extends SoloGame DamageTaken, DamageDealt ); + + new CompassModule() + .setGiveCompass(true) + .setGiveCompassToSpecs(true) + .setGiveCompassToAlive(false) + .register(this); } @SuppressWarnings("deprecation") diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/quiver/QuiverTeamBase.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/quiver/QuiverTeamBase.java index da2343c21..bf6878763 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/quiver/QuiverTeamBase.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/quiver/QuiverTeamBase.java @@ -30,7 +30,9 @@ import nautilus.game.arcade.game.games.quiver.module.ModuleSuperArrow; import nautilus.game.arcade.game.games.quiver.module.ModuleUltimate; import nautilus.game.arcade.game.games.quiver.module.QuiverTeamModule; import nautilus.game.arcade.game.games.quiver.module.game.QuiverPayload; +import nautilus.game.arcade.game.modules.TeamArmorModule; import nautilus.game.arcade.game.modules.VersionModule; +import nautilus.game.arcade.game.modules.compass.CompassModule; import nautilus.game.arcade.kit.Kit; import nautilus.game.arcade.stats.WinWithoutBowStatTracker; @@ -62,8 +64,6 @@ public class QuiverTeamBase extends TeamGame this.DamageSelf = false; this.DamageTeamSelf = false; this.DamageFall = false; - this.TeamArmor = true; - this.TeamArmorHotbar = true; this.HungerSet = 20; registerStatTrackers(new WinWithoutBowStatTracker(this, "Bow")); @@ -85,7 +85,7 @@ public class QuiverTeamBase extends TeamGame getQuiverTeamModule(ModuleSpawnBarrier.class); getQuiverTeamModule(ModuleKillstreak.class); - registerModule(new VersionModule(MinecraftVersion.Version1_9, "One in the Quiver Payload requires Minecraft 1.9!")); + new VersionModule(MinecraftVersion.Version1_9).register(this); // if (WorldData.GetCustomLocs(CUSTOM_LOCATION_GAME_KOTH) != null) // { @@ -95,6 +95,17 @@ public class QuiverTeamBase extends TeamGame // There was no game identifier in the map. Use Payload as the default getQuiverTeamModule(QuiverPayload.class); + + new CompassModule() + .setGiveCompass(true) + .setGiveCompassToSpecs(true) + .setGiveCompassToAlive(false) + .register(this); + + new TeamArmorModule() + .giveTeamArmor() + .giveHotbarItem() + .register(this); } @Override diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/quiver/QuiverTeams.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/quiver/QuiverTeams.java index 7da21409b..c3e52d9f6 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/quiver/QuiverTeams.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/quiver/QuiverTeams.java @@ -27,6 +27,8 @@ import nautilus.game.arcade.events.GameStateChangeEvent; import nautilus.game.arcade.game.GameTeam; import nautilus.game.arcade.game.TeamGame; import nautilus.game.arcade.game.games.quiver.kits.*; +import nautilus.game.arcade.game.modules.TeamArmorModule; +import nautilus.game.arcade.game.modules.compass.CompassModule; import nautilus.game.arcade.kit.Kit; public class QuiverTeams extends TeamGame @@ -62,9 +64,6 @@ public class QuiverTeams extends TeamGame this.BlockBreakAllow.add(102); this.BlockBreakAllow.add(20); this.BlockBreakAllow.add(18); - - this.TeamArmor = true; - this.TeamArmorHotbar = true; registerChatStats( Kills, @@ -75,6 +74,16 @@ public class QuiverTeams extends TeamGame DamageTaken, DamageDealt ); + + new CompassModule() + .setGiveCompass(true) + .setGiveCompassToSpecs(true) + .setGiveCompassToAlive(false) + .register(this); + new TeamArmorModule() + .giveTeamArmor() + .giveHotbarItem() + .register(this); } @EventHandler(priority = EventPriority.HIGH) diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/quiver/kits/KitSkyWarrior.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/quiver/kits/KitSkyWarrior.java index 98d734240..1fe411405 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/quiver/kits/KitSkyWarrior.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/quiver/kits/KitSkyWarrior.java @@ -114,7 +114,8 @@ public class KitSkyWarrior extends ProgressingKit new ItemBuilder(Material.IRON_AXE).setUnbreakable(true).build(), new ItemBuilder(Material.BOW).setUnbreakable(true).build(), }; - + + /* private static final Achievement[] ACHIEVEMENTS = { Achievement.QUIVER_PAYLOAD_ASSASSIN, @@ -123,12 +124,13 @@ public class KitSkyWarrior extends ProgressingKit Achievement.QUIVER_PAYLOAD_STEADY_HANDS, Achievement.QUIVER_PAYLOAD_UNSTOPPABLE }; + */ public KitSkyWarrior(ArcadeManager manager) { super(manager, "Sky Warrior", "quiverskywarrior", KitAvailability.Achievement, 5000, DESCRIPTION, PERKS, UPGRADE_DETAILS, EntityType.ZOMBIE, IN_HAND); - setAchievementRequirements(ACHIEVEMENTS); + //setAchievementRequirements(ACHIEVEMENTS); } @Override diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/rings/ElytraRings.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/rings/ElytraRings.java index 0849aa965..53641660c 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/rings/ElytraRings.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/rings/ElytraRings.java @@ -32,6 +32,7 @@ import nautilus.game.arcade.events.GameStateChangeEvent; import nautilus.game.arcade.events.PlayerGameRespawnEvent; import nautilus.game.arcade.game.SoloGame; import nautilus.game.arcade.game.games.uhc.KitUHC; +import nautilus.game.arcade.game.modules.compass.CompassModule; import nautilus.game.arcade.kit.Kit; public class ElytraRings extends SoloGame @@ -52,6 +53,12 @@ public class ElytraRings extends SoloGame DeathOut = false; DeathMessages = false; + + new CompassModule() + .setGiveCompass(true) + .setGiveCompassToSpecs(true) + .setGiveCompassToAlive(false) + .register(this); } public void RespawnPlayer(final Player player) diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/runner/Runner.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/runner/Runner.java index 893db786b..28f4b1bf3 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/runner/Runner.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/runner/Runner.java @@ -31,6 +31,7 @@ import nautilus.game.arcade.ArcadeManager; import nautilus.game.arcade.GameType; import nautilus.game.arcade.game.SoloGame; import nautilus.game.arcade.game.games.runner.kits.*; +import nautilus.game.arcade.game.modules.compass.CompassModule; import nautilus.game.arcade.kit.Kit; import nautilus.game.arcade.managers.chat.ChatStatData; import nautilus.game.arcade.stats.DistanceTraveledStatTracker; @@ -78,6 +79,12 @@ public class Runner extends SoloGame implements IThrown this.WorldWaterDamage = 4; this.PrepareFreeze = false; + + new CompassModule() + .setGiveCompass(true) + .setGiveCompassToSpecs(true) + .setGiveCompassToAlive(false) + .register(this); } @EventHandler diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/searchanddestroy/KitEvolveShop.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/searchanddestroy/KitEvolveShop.java index b6d739c57..045f5bace 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/searchanddestroy/KitEvolveShop.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/searchanddestroy/KitEvolveShop.java @@ -31,9 +31,6 @@ public class KitEvolveShop extends ShopBase public void update() { - for (ShopPageBase> shopPage : getPlayerPageMap().values()) - { - shopPage.refresh(); - } + getPlayerPageMap().values().forEach(ShopPageBase::refresh); } } diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/searchanddestroy/SearchAndDestroy.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/searchanddestroy/SearchAndDestroy.java index 052b288b8..cc24a381f 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/searchanddestroy/SearchAndDestroy.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/searchanddestroy/SearchAndDestroy.java @@ -18,6 +18,7 @@ import nautilus.game.arcade.GameType; import nautilus.game.arcade.events.GameStateChangeEvent; import nautilus.game.arcade.game.GameTeam; import nautilus.game.arcade.game.TeamGame; +import nautilus.game.arcade.game.modules.compass.CompassModule; import nautilus.game.arcade.kit.Kit; import org.bukkit.Bukkit; @@ -77,6 +78,12 @@ public class SearchAndDestroy extends TeamGame Kills, Assists ); + + new CompassModule() + .setGiveCompass(true) + .setGiveCompassToSpecs(true) + .setGiveCompassToAlive(false) + .register(this); } public ArrayList getBombs() diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/sheep/SheepData.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/sheep/SheepData.java index 05161e8d3..a109225e3 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/sheep/SheepData.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/sheep/SheepData.java @@ -57,7 +57,7 @@ public class SheepData StuckLocation = Sheep.getLocation(); StuckTime = System.currentTimeMillis(); - UtilEnt.Vegetate(Sheep); + UtilEnt.vegetate(Sheep); UtilEnt.ghost(Sheep, true, false); } diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/sheep/SheepGame.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/sheep/SheepGame.java index 4cfcbd4cc..302e72c3f 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/sheep/SheepGame.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/sheep/SheepGame.java @@ -56,6 +56,8 @@ import nautilus.game.arcade.game.TeamGame; import nautilus.game.arcade.game.games.sheep.kits.KitArcher; import nautilus.game.arcade.game.games.sheep.kits.KitBeserker; import nautilus.game.arcade.game.games.sheep.kits.KitBrute; +import nautilus.game.arcade.game.modules.TeamArmorModule; +import nautilus.game.arcade.game.modules.compass.CompassModule; import nautilus.game.arcade.kit.Kit; import nautilus.game.arcade.managers.chat.ChatStatData; import nautilus.game.arcade.stats.SheepDropStatTracker; @@ -180,8 +182,15 @@ public class SheepGame extends TeamGame this.WorldTimeSet = 2000; - this.TeamArmor = true; - this.TeamArmorHotbar = true; + new CompassModule() + .setGiveCompass(true) + .setGiveCompassToSpecs(true) + .setGiveCompassToAlive(false) + .register(this); + new TeamArmorModule() + .giveTeamArmor() + .giveHotbarItem() + .register(this); } @Override diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/sheep/modes/EweHeroes.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/sheep/modes/EweHeroes.java index 75895091d..a55694553 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/sheep/modes/EweHeroes.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/sheep/modes/EweHeroes.java @@ -46,8 +46,7 @@ public class EweHeroes extends SheepGame Manager.getClassManager().GetItemFactory().getProximityManager().setProxyLimit(6); - StrictAntiHack = true; - TeamArmor = false; + StrictAntiHack = true; new ChampionsFixes(this); diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/sheep/modes/OverpoweredSheepQuest.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/sheep/modes/OverpoweredSheepQuest.java index 7d924941d..8b44da93c 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/sheep/modes/OverpoweredSheepQuest.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/sheep/modes/OverpoweredSheepQuest.java @@ -22,8 +22,6 @@ public class OverpoweredSheepQuest extends SheepGame new KitShepherd(manager) }, GameType.Brawl); - TeamArmor = false; - new AbsorptionFix(this); } diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/skyfall/Island.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/skyfall/Island.java index 2afa9bed2..5b91b7cad 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/skyfall/Island.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/skyfall/Island.java @@ -9,9 +9,14 @@ import org.bukkit.block.Chest; import org.bukkit.entity.Player; import org.bukkit.inventory.Inventory; +import mineplex.core.Managers; import mineplex.core.common.util.UtilBlock; import mineplex.core.common.util.UtilMath; import mineplex.core.loot.ChestLoot; +import mineplex.core.titles.tracks.LuckyTrack; +import mineplex.core.titles.tracks.UnluckyTrack; + +import nautilus.game.arcade.ArcadeManager; /** * The Island Object represents a flying Island
@@ -23,45 +28,45 @@ public class Island extends Crumbleable { private Location _location; - + private ArrayList _chests; private ArrayList _blocks; - + private ArrayList _lootedBlocks; - + private int _bounds; private int _height; private ChestLoot _loot; - + private BoosterRing _boosterRing; - + /** * @param location top middle location of the island - * @param bounds how many blocks to go in each direction - * @param height of the island + * @param bounds how many blocks to go in each direction + * @param height of the island */ public Island(Location location, int bounds, int height) { this(location, new ChestLoot(), bounds, height); } - + /** * @param location top middle location of the island - * @param loot prefered {@link LootTable} - * @param bounds how many blocks to go in each direction - * @param height of the island + * @param loot prefered {@link LootTable} + * @param bounds how many blocks to go in each direction + * @param height of the island */ public Island(Location location, LootTable loot, int bounds, int height) { this(location, loot.getloot(), bounds, height); } - + /** * @param location top middle location of the island - * @param loot prefered {@link ChestLoot} - * @param bounds how many blocks to go in each direction - * @param height of the island + * @param loot prefered {@link ChestLoot} + * @param bounds how many blocks to go in each direction + * @param height of the island */ public Island(Location location, ChestLoot loot, int bounds, int height) { @@ -72,10 +77,10 @@ public class Island extends Crumbleable _blocks = new ArrayList<>(); _lootedBlocks = new ArrayList<>(); _loot = loot; - + registerBlocks(); } - + public void fillLoot(Block block) { if (block.getType() != Material.CHEST @@ -114,32 +119,32 @@ public class Island extends Crumbleable inventory.setItem(slot, _loot.getLoot()); } } - + public Location getLocation() { return _location; } - + public ArrayList getChests() { return _chests; } - + public int getBounds() { return _bounds; } - + public int getHeight() { return _height; } - + public boolean isOnIsland(Player player) { return isOnIsland(player.getLocation()); } - + public boolean isOnIsland(Location location) { if (UtilMath.offset(location, _location) > _bounds + 1) @@ -152,7 +157,7 @@ public class Island extends Crumbleable } return false; } - + @Override public void crumbledAway() { @@ -162,18 +167,18 @@ public class Island extends Crumbleable _boosterRing.disable(); } } - + public void registerBlocks() { for (Block block : UtilBlock.getInBoundingBox(_location.clone().add(_bounds, 0, _bounds), _location.clone().subtract(_bounds, _height, _bounds))) { if (block.getType() == Material.CHEST || block.getType() == Material.TRAPPED_CHEST) getChests().add(block.getLocation()); - + _blocks.add(block.getLocation()); } } - + public void refillChests() { _lootedBlocks.clear(); @@ -182,12 +187,12 @@ public class Island extends Crumbleable fillLoot(loc.getBlock()); } } - + public void setBoosterRing(BoosterRing ring) { _boosterRing = ring; } - + public BoosterRing getBoosterRing() { return _boosterRing; diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/skyfall/Skyfall.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/skyfall/Skyfall.java index d8183188f..ccdfed785 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/skyfall/Skyfall.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/skyfall/Skyfall.java @@ -58,12 +58,11 @@ import mineplex.core.common.util.UtilMath; import mineplex.core.common.util.UtilParticle; import mineplex.core.common.util.UtilParticle.ParticleType; import mineplex.core.common.util.UtilParticle.ViewDist; -import mineplex.core.loot.ChestLoot; import mineplex.core.common.util.UtilPlayer; import mineplex.core.common.util.UtilServer; import mineplex.core.common.util.UtilTime; +import mineplex.core.loot.ChestLoot; import mineplex.core.recharge.Recharge; -import mineplex.core.shop.item.ISalesPackage; import mineplex.core.updater.UpdateType; import mineplex.core.updater.event.UpdateEvent; import mineplex.minecraft.game.core.damage.CustomDamageEvent; @@ -94,16 +93,16 @@ import nautilus.game.arcade.stats.WinWithoutWearingArmorStatTracker; */ public abstract class Skyfall extends Game { - private static final long MAP_CRUMBLE_DELAY = 1000*30; // 30 Seconds + private static final long MAP_CRUMBLE_DELAY = 1000*60*2; // 2 Minutes private static final long CHEST_REFILL_TIME = 1000*60*3; // 3 minutes private static final long CHEST_REFILL_ANNOUNCE_TIME = 1000*60*3; // 3 minutes - private static final int BIG_ISLAND_BOUNDS = 30; - private static final int BIG_ISLAND_HEIGHT = 40; private static final long ELYTRA_TAKEAWAY = 1000; + private static final long RING_ROT_TIME = 1000*60*3; // 3 Minutes + private static final int ISLAND_CRUMBLE_RATE = 7; private static final int BIG_ISLAND_CRUMBLE_RATE = 5; - private static final int BOOSTER_RING_CRUMBLE_RATE = 3; + private static final float RING_BOOST_STRENGTH = 2.5F; private static final float BIG_RING_BOOST_STRENGTH = 3.5F; @@ -150,6 +149,8 @@ public abstract class Skyfall extends Game private int _currentCrumble = 300; private boolean _supplyOpened; + private int _ringCrumbleRate; + public Skyfall(ArcadeManager manager, GameType type) { super(manager, type, @@ -189,7 +190,7 @@ public abstract class Skyfall extends Game BlankLine ); - registerModule(new VersionModule(MinecraftVersion.Version1_9, "Skyfall requires Minecraft 1.9!")); + registerModule(new VersionModule(MinecraftVersion.Version1_9)); // Disable specific GWEN checks for this game AntiHack antiHack = Managers.get(AntiHack.class); @@ -220,8 +221,6 @@ public abstract class Skyfall extends Game DamageFall = false; SoupEnabled = true; StrictAntiHack = false; - CompassEnabled = true; - CompassGiveItem = false; SpeedMeasurement = true; @@ -368,8 +367,8 @@ public abstract class Skyfall extends Game islands.add(island); Material[] mats = new Material[]{Material.COAL_BLOCK, Material.ENDER_STONE}; - if (island.getLocation().getBlockY() >= GetTeamList().get(0).GetSpawns().get(0).getBlockY()) - mats = new Material[] {Material.AIR}; +// if (island.getLocation().getBlockY() >= GetTeamList().get(0).GetSpawns().get(0).getBlockY()) +// mats = new Material[] {Material.AIR}; if (!island.crumble(ISLAND_CRUMBLE_RATE, mats)) { @@ -388,7 +387,7 @@ public abstract class Skyfall extends Game { while (!_upperIsland.getBoosterRing().isCrumbledAway()) { - _upperIsland.getBoosterRing().crumble(BOOSTER_RING_CRUMBLE_RATE, Material.COAL_BLOCK, Material.ENDER_STONE); + _upperIsland.getBoosterRing().crumble(_ringCrumbleRate, Material.COAL_BLOCK, Material.ENDER_STONE); } } for (Island island : _islands.get(_lowerIsland).keySet()) @@ -409,7 +408,7 @@ public abstract class Skyfall extends Game { while (!_lowerIsland.getBoosterRing().isCrumbledAway()) { - _lowerIsland.getBoosterRing().crumble(BOOSTER_RING_CRUMBLE_RATE, Material.COAL_BLOCK, Material.ENDER_STONE); + _lowerIsland.getBoosterRing().crumble(_ringCrumbleRate, Material.COAL_BLOCK, Material.ENDER_STONE); } _currentCrumble = 0; } @@ -484,15 +483,18 @@ public abstract class Skyfall extends Game @EventHandler public void ringCrumble(UpdateEvent event) { - if (event.getType() != UpdateType.FASTER) + if (event.getType() != UpdateType.SEC) + return; + + if (!UtilTime.elapsed(GetStateTime(), MAP_CRUMBLE_DELAY)) return; for (BoosterRing ring : _boosterRings) { - if (ring.getMiddle().getBlockY() < _currentCrumble) - continue; +// if (ring.getMiddle().getBlockY() < _currentCrumble) +// continue; - if (!ring.crumble(BOOSTER_RING_CRUMBLE_RATE, Material.COAL_BLOCK, Material.ENDER_STONE)) + if (!ring.crumble(_ringCrumbleRate, Material.COAL_BLOCK, Material.ENDER_STONE)) break; } } @@ -713,6 +715,7 @@ public abstract class Skyfall extends Game public void registerBoosters() { + int blocks = 0; ArrayList boosters = WorldData.GetDataLocs("ORANGE"); for (Location boosterMid : boosters) { @@ -730,6 +733,13 @@ public abstract class Skyfall extends Game ring.setBoostStrength(BIG_RING_BOOST_STRENGTH); } + blocks += ring.getBlocks().size(); + int secs = (int) (RING_ROT_TIME / 1000); + _ringCrumbleRate = blocks / secs; + + if (_ringCrumbleRate < 1) + _ringCrumbleRate = 1; + _boosterRings.add(ring); } } @@ -1162,4 +1172,4 @@ public abstract class Skyfall extends Game } -} +} \ No newline at end of file diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/skyfall/kits/perks/PerkRemoveElytra.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/skyfall/kits/perks/PerkRemoveElytra.java index a14655a2d..de292b84b 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/skyfall/kits/perks/PerkRemoveElytra.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/skyfall/kits/perks/PerkRemoveElytra.java @@ -22,7 +22,7 @@ import nautilus.game.arcade.kit.Perk; * Perk that removes attacked * Players Elytra for the * specified amount of - * tim ein milliseconds. + * time in milliseconds. * * @author xXVevzZXx */ @@ -50,7 +50,7 @@ public class PerkRemoveElytra extends Perk } @EventHandler - public void stunnEnemy(CustomDamageEvent event) + public void stunEnemy(CustomDamageEvent event) { if (Manager.GetGame() == null) return; @@ -83,14 +83,15 @@ public class PerkRemoveElytra extends Perk if (System.currentTimeMillis() > _disabled.get(player.getUniqueId())) { player.getInventory().setChestplate(new ItemStack(Material.ELYTRA)); + _disabled.remove(player.getUniqueId()); } else { if (player.getInventory().getChestplate() != null) { UtilPlayer.message(player, F.main("Game", C.cRed + "Your Elytra is disabled!")); + player.getInventory().setChestplate(null); } - player.getInventory().setChestplate(null); } } } diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/skywars/Skywars.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/skywars/Skywars.java index 7fb3c9168..a437aa169 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/skywars/Skywars.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/skywars/Skywars.java @@ -68,6 +68,8 @@ import mineplex.core.explosion.ExplosionEvent; import mineplex.core.loot.ChestLoot; import mineplex.core.loot.RandomItem; import mineplex.core.recharge.Recharge; +import mineplex.core.titles.tracks.LuckyTrack; +import mineplex.core.titles.tracks.UnluckyTrack; import mineplex.core.updater.UpdateType; import mineplex.core.updater.event.UpdateEvent; import mineplex.minecraft.game.core.combat.CombatComponent; @@ -86,6 +88,7 @@ import nautilus.game.arcade.game.games.skywars.kits.KitEarth; import nautilus.game.arcade.game.games.skywars.kits.KitFire; import nautilus.game.arcade.game.games.skywars.kits.KitIce; import nautilus.game.arcade.game.games.skywars.kits.KitMetal; +import nautilus.game.arcade.game.modules.compass.CompassModule; import nautilus.game.arcade.game.games.skywars.modes.kits.KitElementalist; import nautilus.game.arcade.kit.Kit; import nautilus.game.arcade.ore.OreHider; @@ -166,7 +169,9 @@ public abstract class Skywars extends Game HideTeamSheep = true; - CompassEnabled = true; + new CompassModule() + .setGiveCompassToAlive(true) + .register(this); StrictAntiHack = true; @@ -465,7 +470,7 @@ public abstract class Skywars extends Game bestBlock = bestBlock.getRelative(BlockFace.DOWN); } _worldBlocks.remove(bestBlock); - if (bestBlock.getType() != Material.AIR) + if (bestBlock.getWorld() == WorldData.World && bestBlock.getType() != Material.AIR) { if (Math.random() > 0.95D) { @@ -880,7 +885,7 @@ public abstract class Skywars extends Game @EventHandler public void onBlockPhysics(BlockPhysicsEvent event) { - if (IsLive()) + if (IsLive() && event.getBlock().getWorld().equals(WorldData.World)) { _worldBlocks.add(event.getBlock()); } @@ -1189,6 +1194,12 @@ public abstract class Skywars extends Game // Misc chest.getBlockInventory().setItem(getIndex(used), _middleMisc.getLoot()); } + + if (getArcadeManager().GetServerConfig().RewardStats) + { + getArcadeManager().getTrackManager().getTrack(LuckyTrack.class).handleLoot(looter, chest.getBlockInventory()); + getArcadeManager().getTrackManager().getTrack(UnluckyTrack.class).handleLoot(looter, chest.getBlockInventory()); + } } private int getIndex(HashSet used) diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/skywars/TeamSkywars.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/skywars/TeamSkywars.java index ead56b27c..c9358a022 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/skywars/TeamSkywars.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/skywars/TeamSkywars.java @@ -69,7 +69,7 @@ public class TeamSkywars extends Skywars TeamPerSpawn = true; ShowTeammateMessage = true; - registerModule(new TeamModule()); + new TeamModule().register(this); } @Override diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/SuperSmash.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/SuperSmash.java index 82dbb73c7..a121545f2 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/SuperSmash.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/SuperSmash.java @@ -79,6 +79,7 @@ import nautilus.game.arcade.game.games.smash.kits.KitWitherSkeleton; import nautilus.game.arcade.game.games.smash.kits.KitWolf; import nautilus.game.arcade.game.games.smash.kits.KitZombie; import nautilus.game.arcade.game.games.smash.perks.SmashUltimate; +import nautilus.game.arcade.game.modules.compass.CompassModule; import nautilus.game.arcade.kit.Kit; import nautilus.game.arcade.kit.Perk; @@ -120,11 +121,13 @@ public abstract class SuperSmash extends Game super(manager, type, kits, description); DeathOut = false; - CompassEnabled = true; DeathSpectateSecs = 4; WorldWaterDamage = 1000; HideTeamSheep = true; ReplaceTeamsWithKits = true; + new CompassModule() + .setGiveCompassToAlive(true) + .register(this); } @EventHandler(priority = EventPriority.HIGH) diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/TeamSuperSmash.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/TeamSuperSmash.java index d142b1471..08fa43735 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/TeamSuperSmash.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/TeamSuperSmash.java @@ -6,16 +6,20 @@ import java.util.List; import org.bukkit.entity.Player; import org.bukkit.event.EventHandler; import org.bukkit.event.entity.EntityDamageEvent.DamageCause; +import org.bukkit.scheduler.BukkitRunnable; import mineplex.core.common.Pair; import mineplex.core.common.util.C; +import mineplex.core.common.util.UtilTextMiddle; import mineplex.core.updater.UpdateType; import mineplex.core.updater.event.UpdateEvent; import mineplex.minecraft.game.core.damage.CustomDamageEvent; import nautilus.game.arcade.ArcadeManager; import nautilus.game.arcade.GameType; +import nautilus.game.arcade.events.GameStateChangeEvent; import nautilus.game.arcade.game.GameTeam; +import nautilus.game.arcade.game.modules.TeamArmorModule; import nautilus.game.arcade.game.modules.TeamModule; import nautilus.game.arcade.managers.chat.ChatStatData; import nautilus.game.arcade.stats.FreeKitWinStatTracker; @@ -40,15 +44,17 @@ public class TeamSuperSmash extends SuperSmash DontAllowOverfill = true; TeamMode = true; - TeamArmorHotbar = true; - ShowTeammateMessage = true; - - registerModule(new TeamModule()); + + new TeamModule().register(this); registerStatTrackers(new WinWithoutDyingStatTracker(this, "MLGPro"), new FreeKitWinStatTracker(this), new OneVThreeStatTracker(this), new KillFastStatTracker(this, 3, 10, "TripleKill"), new RecoveryMasterStatTracker(this)); registerChatStats(Kills, Deaths, KDRatio, BlankLine, Assists, DamageTaken, DamageDealt, BlankLine, new ChatStatData("kit", "Kit", true)); + + new TeamArmorModule() + .giveHotbarItem() + .register(this); } @Override @@ -96,6 +102,55 @@ public class TeamSuperSmash extends SuperSmash Scoreboard.draw(); } + + @Override + @EventHandler + public void gameStart(GameStateChangeEvent event) + { + if (event.GetState() != GameState.Prepare) + { + return; + } + + super.gameStart(event); + + new BukkitRunnable() + { + + @Override + public void run() + { + for (Player player : GetPlayers(true)) + { + GameTeam team = GetTeam(player); + Player bestTeamMember = null; + + if (team == null) + { + continue; + } + + for (Player teamMember : team.GetPlayers(true)) + { + if (player.equals(teamMember)) + { + continue; + } + + bestTeamMember = teamMember; + } + + if (bestTeamMember == null) + { + UtilTextMiddle.display(C.cRedB + "No one", "You don\'t have a teammate :(", 10, 50, 10, player); + return; + } + + UtilTextMiddle.display(null, team.GetColor() + bestTeamMember.getName() + " is your teammate", 10, 50, 10, player); + } + } + }.runTaskLater(Manager.getPlugin(), 40); + } @EventHandler public void onCustomDamage(CustomDamageEvent event) diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/perks/chicken/PerkChickenRocket.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/perks/chicken/PerkChickenRocket.java index 2c04bff35..a671bd243 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/perks/chicken/PerkChickenRocket.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/perks/chicken/PerkChickenRocket.java @@ -105,7 +105,7 @@ public class PerkChickenRocket extends SmashPerk ent.getLocation().setYaw(player.getLocation().getYaw()); ent.setBaby(); ent.setAgeLock(true); - UtilEnt.Vegetate(ent); + UtilEnt.vegetate(ent); Manager.GetGame().CreatureAllowOverride = false; _data.add(new ChickenMissileData(player, ent)); diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/perks/enderman/SmashEnderman.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/perks/enderman/SmashEnderman.java index 254343602..ec4d33f6b 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/perks/enderman/SmashEnderman.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/perks/enderman/SmashEnderman.java @@ -54,7 +54,7 @@ public class SmashEnderman extends SmashUltimate Manager.GetGame().CreatureAllowOverride = true; EnderDragon dragon = player.getWorld().spawn(player.getLocation().add(0, 5, 0), EnderDragon.class); - UtilEnt.Vegetate(dragon); + UtilEnt.vegetate(dragon); Manager.GetGame().CreatureAllowOverride = false; dragon.setCustomName(C.cYellow + player.getName() + "'s Dragon"); diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/perks/magmacube/PerkMagmaBoost.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/perks/magmacube/PerkMagmaBoost.java index 3e817de76..3b06175aa 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/perks/magmacube/PerkMagmaBoost.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/perks/magmacube/PerkMagmaBoost.java @@ -21,6 +21,8 @@ import mineplex.core.updater.event.UpdateEvent; import mineplex.minecraft.game.core.combat.event.CombatDeathEvent; import mineplex.minecraft.game.core.damage.CustomDamageEvent; +import nautilus.game.arcade.events.GameStateChangeEvent; +import nautilus.game.arcade.game.Game; import nautilus.game.arcade.kit.Perk; public class PerkMagmaBoost extends Perk @@ -35,6 +37,15 @@ public class PerkMagmaBoost extends Perk super("Fuel the Fire", new String[] { C.cGray + "Kills give +1 Damage, -15% Knockback Taken and +1 Size.", C.cGray + "Kill bonuses can stack " + MAX_STACKS + " times, and reset on death.", }); } + @EventHandler + public void reset(GameStateChangeEvent event) + { + if (event.GetState() == Game.GameState.End) + { + _kills.clear(); + } + } + @EventHandler public void kill(CombatDeathEvent event) { diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/perks/pig/PerkPigBaconBomb.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/perks/pig/PerkPigBaconBomb.java index 9e863f0a0..c14f70a82 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/perks/pig/PerkPigBaconBomb.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/perks/pig/PerkPigBaconBomb.java @@ -125,7 +125,7 @@ public class PerkPigBaconBomb extends SmashPerk Manager.GetGame().CreatureAllowOverride = false; pig.setBaby(); - UtilEnt.Vegetate(pig); + UtilEnt.vegetate(pig); UtilEnt.ghost(pig, true, false); UUID key = player.getUniqueId(); diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/perks/skeletalhorse/PerkBoneRush.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/perks/skeletalhorse/PerkBoneRush.java index 4fc78ea1b..f1d281713 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/perks/skeletalhorse/PerkBoneRush.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/perks/skeletalhorse/PerkBoneRush.java @@ -193,7 +193,7 @@ public class PerkBoneRush extends SmashPerk implements IThrown return; } - if (!(target instanceof Player || data.getThrower() instanceof Player)) + if (!(target instanceof Player) || !(data.getThrower() instanceof Player)) { return; } diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/perks/snowman/SmashSnowman.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/perks/snowman/SmashSnowman.java index 83823308a..d63314583 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/perks/snowman/SmashSnowman.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/perks/snowman/SmashSnowman.java @@ -69,7 +69,7 @@ public class SmashSnowman extends SmashUltimate Snowman ent = player.getWorld().spawn(player.getEyeLocation(), Snowman.class); game.CreatureAllowOverride = false; - UtilEnt.Vegetate(ent); + UtilEnt.vegetate(ent); UtilEnt.ghost(ent, true, false); ent.setMaxHealth(TURRET_HEALTH); diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/perks/squid/PerkFishFlurry.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/perks/squid/PerkFishFlurry.java index 539e98cf9..184f1b135 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/perks/squid/PerkFishFlurry.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/perks/squid/PerkFishFlurry.java @@ -102,11 +102,6 @@ public class PerkFishFlurry extends SmashPerk implements IThrown return; } - if (!Recharge.Instance.use(player, GetName(), COOLDOWN, true, true)) - { - return; - - } event.setCancelled(true); Set blocks = new HashSet<>(); @@ -131,10 +126,18 @@ public class PerkFishFlurry extends SmashPerk implements IThrown blocks.add(cur); } - _active.add(new DataSquidGeyser(player, blocks)); + if (!blocks.isEmpty()) + { + if (!Recharge.Instance.use(player, GetName(), COOLDOWN, true, true)) + { + return; + } - // Inform - UtilPlayer.message(player, F.main("Game", "You used " + F.skill(GetName()) + ".")); + _active.add(new DataSquidGeyser(player, blocks)); + + // Inform + UtilPlayer.message(player, F.main("Game", "You used " + F.skill(GetName()) + ".")); + } } @EventHandler diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/perks/witherskeleton/PerkWitherImage.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/perks/witherskeleton/PerkWitherImage.java index 348241aab..ba5a90767 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/perks/witherskeleton/PerkWitherImage.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/perks/witherskeleton/PerkWitherImage.java @@ -92,10 +92,11 @@ public class PerkWitherImage extends SmashPerk // Spawn Manager.GetGame().CreatureAllowOverride = true; - Manager.GetGame().CreatureAllowOverride = false; Skeleton skel = UtilVariant.spawnWitherSkeleton(player.getEyeLocation().add(player.getLocation().getDirection())); + Manager.GetGame().CreatureAllowOverride = false; + skel.getEquipment().setItemInHand(player.getItemInHand()); skel.setMaxHealth(20); skel.setHealth(skel.getMaxHealth()); @@ -168,7 +169,7 @@ public class PerkWitherImage extends SmashPerk } } - if (event.getTarget() != null && _skeletons.get(event.getTarget().getUniqueId()).equals(event.getEntity())) + if (event.getTarget() != null && event.getEntity().equals(_skeletons.get(event.getTarget().getUniqueId()))) { event.setCancelled(true); } diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/perks/wolf/PerkWolf.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/perks/wolf/PerkWolf.java index 74501dd68..a5968ac4e 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/perks/wolf/PerkWolf.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/perks/wolf/PerkWolf.java @@ -113,7 +113,7 @@ public class PerkWolf extends SmashPerk wolf.setAngry(true); - UtilEnt.Vegetate(wolf); + UtilEnt.vegetate(wolf); wolf.setMaxHealth(WOLF_HEALTH); wolf.setHealth(wolf.getMaxHealth()); @@ -503,6 +503,12 @@ public class PerkWolf extends SmashPerk UUID uuid = playerIterator.next(); Player player = UtilPlayer.searchExact(uuid); + if (player == null) + { + playerIterator.remove(); + continue; + } + Iterator timeIterator = _repeat.get(uuid).iterator(); while (timeIterator.hasNext()) diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/snake/Snake.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/snake/Snake.java index 0c4b96110..0ac9c65d6 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/snake/Snake.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/snake/Snake.java @@ -12,7 +12,6 @@ import org.bukkit.EntityEffect; import org.bukkit.Location; import org.bukkit.Material; import org.bukkit.Sound; -import org.bukkit.craftbukkit.v1_8_R3.entity.CraftCreature; import org.bukkit.entity.Creature; import org.bukkit.entity.Entity; import org.bukkit.entity.Player; @@ -23,13 +22,9 @@ import org.bukkit.event.HandlerList; import org.bukkit.event.entity.EntityCombustEvent; import org.bukkit.event.entity.EntityDamageEvent.DamageCause; import org.bukkit.event.entity.EntityTargetEvent; -import org.bukkit.event.player.PlayerEvent; import org.bukkit.event.player.PlayerInteractEvent; import org.bukkit.util.Vector; -import net.minecraft.server.v1_8_R3.EntityCreature; -import net.minecraft.server.v1_8_R3.Navigation; -import net.minecraft.server.v1_8_R3.PacketPlayInUseEntity; import mineplex.core.common.util.C; import mineplex.core.common.util.UtilAlg; import mineplex.core.common.util.UtilBlock; @@ -53,12 +48,12 @@ import nautilus.game.arcade.GameType; import nautilus.game.arcade.events.GamePrepareCountdownCommence; import nautilus.game.arcade.events.GameStateChangeEvent; import nautilus.game.arcade.game.SoloGame; -import nautilus.game.arcade.game.Game.GameState; import nautilus.game.arcade.game.games.snake.events.SlimeUpgradeEvent; import nautilus.game.arcade.game.games.snake.events.TailGrowEvent; import nautilus.game.arcade.game.games.snake.kits.KitInvulnerable; import nautilus.game.arcade.game.games.snake.kits.KitReverser; import nautilus.game.arcade.game.games.snake.kits.KitSpeed; +import nautilus.game.arcade.game.modules.compass.CompassModule; import nautilus.game.arcade.kit.Kit; import nautilus.game.arcade.managers.chat.ChatStatData; import nautilus.game.arcade.stats.ChooChooStatTracker; @@ -120,6 +115,12 @@ public class Snake extends SoloGame BlankLine, new ChatStatData("kit", "Kit", true) ); + + new CompassModule() + .setGiveCompass(true) + .setGiveCompassToSpecs(true) + .setGiveCompassToAlive(false) + .register(this); } @EventHandler @@ -137,7 +138,7 @@ public class Snake extends SoloGame sheep.setColor(DyeColor.getByDyeData((byte) (i % 16))); sheep.setPassenger(player); - UtilEnt.Vegetate(sheep); + UtilEnt.vegetate(sheep); _tail.put(player, new ArrayList()); _tail.get(player).add(sheep); @@ -384,7 +385,7 @@ public class Snake extends SoloGame Slime pig = loc.getWorld().spawn(loc, Slime.class); this.CreatureAllowOverride = false; pig.setSize(2); - UtilEnt.Vegetate(pig); + UtilEnt.vegetate(pig); _food.add(pig); } @@ -454,7 +455,7 @@ public class Snake extends SoloGame //Sets yaw/pitch tail.teleport(loc); - UtilEnt.Vegetate(tail); + UtilEnt.vegetate(tail); UtilEnt.ghost(tail, true, false); _tail.get(player).add(tail); diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/sneakyassassins/SneakyAssassins.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/sneakyassassins/SneakyAssassins.java index 362c4b4c4..a762a0ef5 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/sneakyassassins/SneakyAssassins.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/sneakyassassins/SneakyAssassins.java @@ -16,6 +16,7 @@ import nautilus.game.arcade.game.*; import nautilus.game.arcade.game.games.sneakyassassins.kits.*; import nautilus.game.arcade.game.games.sneakyassassins.npc.*; import nautilus.game.arcade.game.games.sneakyassassins.powerups.*; +import nautilus.game.arcade.game.modules.compass.CompassModule; import nautilus.game.arcade.kit.*; import nautilus.game.arcade.stats.KillEntityStatTracker; import nautilus.game.arcade.stats.MasterAssassinStatTracker; @@ -79,9 +80,11 @@ public class SneakyAssassins extends SoloGame this.PrepareFreeze = false; this.HungerSet = 20; - - this.CompassEnabled = true; - this.CompassGiveItem = false; + + new CompassModule() + .setGiveCompassToAlive(true) + .setGiveCompass(false) + .register(this); Manager.getCosmeticManager().setHideParticles(true); diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/sneakyassassins/npc/NpcManager.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/sneakyassassins/npc/NpcManager.java index f491bfa88..7d711fdc7 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/sneakyassassins/npc/NpcManager.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/sneakyassassins/npc/NpcManager.java @@ -52,7 +52,7 @@ public class NpcManager implements Listener LivingEntity npc = (LivingEntity) spawn.getWorld().spawn(spawn, getDisguiseType().getEntityClass()); npc.setCanPickupItems(false); npc.setRemoveWhenFarAway(false); - UtilEnt.Vegetate(npc); + UtilEnt.vegetate(npc); getGame().CreatureAllowOverride = false; return npc; diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/sneakyassassins/powerups/PowerUpItem.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/sneakyassassins/powerups/PowerUpItem.java index 70cce7b1c..f640c0681 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/sneakyassassins/powerups/PowerUpItem.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/sneakyassassins/powerups/PowerUpItem.java @@ -9,11 +9,9 @@ import mineplex.core.updater.event.*; import org.bukkit.*; import org.bukkit.block.*; import org.bukkit.entity.*; -import org.bukkit.entity.Skeleton.SkeletonType; import org.bukkit.inventory.*; import org.bukkit.potion.PotionEffect; import org.bukkit.potion.PotionEffectType; -import org.bukkit.util.*; /** * Created by Tim on 8/5/2014. @@ -106,7 +104,7 @@ public class PowerUpItem _powerUpManager.getGame().CreatureAllowOverride = true; _npc = itemLocation.getWorld().spawn(itemLocation, Skeleton.class); _powerUpManager.getGame().CreatureAllowOverride = false; - UtilEnt.Vegetate(_npc); + UtilEnt.vegetate(_npc); UtilEnt.ghost(_npc, true, false); _npc.getEquipment().setChestplate(new ItemStack(Material.DIAMOND_CHESTPLATE)); diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/snowfight/SnowFight.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/snowfight/SnowFight.java index c31ddd3b1..542560870 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/snowfight/SnowFight.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/snowfight/SnowFight.java @@ -30,6 +30,8 @@ import nautilus.game.arcade.game.TeamGame; import nautilus.game.arcade.game.games.snowfight.kits.KitTactician; import nautilus.game.arcade.game.games.snowfight.kits.KitMedic; import nautilus.game.arcade.game.games.snowfight.kits.KitSportsman; +import nautilus.game.arcade.game.modules.TeamArmorModule; +import nautilus.game.arcade.game.modules.compass.CompassModule; import nautilus.game.arcade.kit.Kit; import org.bukkit.Bukkit; @@ -84,12 +86,11 @@ public class SnowFight extends TeamGame this.PrepareFreeze = false; this.HungerSet = 20; - - this.CompassEnabled = true; - this.CompassGiveItem = false; - - this.TeamArmor = true; - this.TeamArmorHotbar = true; + + new CompassModule() + .setGiveCompassToAlive(true) + .setGiveCompass(false) + .register(this); registerChatStats(//damage, collected Kills, @@ -98,6 +99,10 @@ public class SnowFight extends TeamGame DamageTaken, DamageDealt ); + new TeamArmorModule() + .giveTeamArmor() + .giveHotbarItem() + .register(this); // this.WorldWeatherEnabled = true; // this.WorldTimeSet = 4000; diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/speedbuilders/SpeedBuilders.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/speedbuilders/SpeedBuilders.java index c03f7f326..3a04f2237 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/speedbuilders/SpeedBuilders.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/speedbuilders/SpeedBuilders.java @@ -42,6 +42,7 @@ import nautilus.game.arcade.game.games.speedbuilders.stattrackers.DependableTrac import nautilus.game.arcade.game.games.speedbuilders.stattrackers.FirstBuildTracker; import nautilus.game.arcade.game.games.speedbuilders.stattrackers.PerfectionistTracker; import nautilus.game.arcade.game.games.speedbuilders.stattrackers.SpeediestBuilderizerTracker; +import nautilus.game.arcade.game.modules.compass.CompassModule; import nautilus.game.arcade.kit.Kit; import nautilus.game.arcade.managers.chat.ChatStatData; import nautilus.game.arcade.stats.BlockPlaceStatTracker; @@ -64,6 +65,7 @@ import org.bukkit.entity.Item; import org.bukkit.entity.Player; import org.bukkit.event.EventHandler; import org.bukkit.event.EventPriority; +import org.bukkit.event.block.Action; import org.bukkit.event.block.BlockBurnEvent; import org.bukkit.event.block.BlockFadeEvent; import org.bukkit.event.block.BlockFormEvent; @@ -193,6 +195,12 @@ public class SpeedBuilders extends SoloGame new ChatStatData("BlocksPlaced", "Blocks Placed", true), new ChatStatData("BlocksBroken", "Blocks Broken", true) ); + + new CompassModule() + .setGiveCompass(true) + .setGiveCompassToSpecs(true) + .setGiveCompassToAlive(false) + .register(this); } @EventHandler @@ -340,7 +348,7 @@ public class SpeedBuilders extends SoloGame Entity entity = loc.getWorld().spawnEntity(loc, mobData.EntityType); - UtilEnt.Vegetate(entity, true); + UtilEnt.vegetate(entity, true); UtilEnt.ghost(entity, true, false); _middleMobs.add(entity); @@ -1609,7 +1617,7 @@ public class SpeedBuilders extends SoloGame Entity entity = block.getWorld().spawnEntity(block.getLocation().add(0.5, 0, 0.5), type); - UtilEnt.Vegetate(entity, true); + UtilEnt.vegetate(entity, true); UtilEnt.ghost(entity, true, false); CreatureAllowOverride = false; @@ -1639,7 +1647,7 @@ public class SpeedBuilders extends SoloGame if (!Manager.GetClients().Get(event.getPlayer()).GetRank().has(event.getPlayer(), Rank.MAPDEV, true)) return; - if (!Manager.getPlugin().getConfig().getString("serverstatus.group").equalsIgnoreCase("Testing")) + if (!UtilServer.isTestServer()) { UtilPlayer.message(event.getPlayer(), F.main("Build", C.cYellow + "You can only use this on testing servers!")); @@ -1724,6 +1732,11 @@ public class SpeedBuilders extends SoloGame event.setCancelled(true); return; } + + if (event.getAction() != Action.RIGHT_CLICK_BLOCK && event.getAction() != Action.LEFT_CLICK_BLOCK) + { + return; + } Block block = event.getClickedBlock().getRelative(event.getBlockFace()); diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/speedbuilders/data/RecreationData.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/speedbuilders/data/RecreationData.java index 2bf2488c0..d832ccd21 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/speedbuilders/data/RecreationData.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/speedbuilders/data/RecreationData.java @@ -191,7 +191,7 @@ public class RecreationData Entity entity = loc.getWorld().spawnEntity(loc, mobData.EntityType); - UtilEnt.Vegetate(entity, true); + UtilEnt.vegetate(entity, true); UtilEnt.ghost(entity, true, false); Mobs.add(entity); diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/spleef/Spleef.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/spleef/Spleef.java index a06235e88..0651b6dca 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/spleef/Spleef.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/spleef/Spleef.java @@ -31,6 +31,7 @@ import mineplex.core.updater.event.UpdateEvent; import nautilus.game.arcade.ArcadeManager; import nautilus.game.arcade.GameType; import nautilus.game.arcade.game.SoloGame; +import nautilus.game.arcade.game.modules.compass.CompassModule; import nautilus.game.arcade.kit.Kit; import nautilus.game.arcade.managers.chat.ChatStatData; import nautilus.game.arcade.stats.SpleefBlockDestroyStatTracker; @@ -72,6 +73,12 @@ public class Spleef extends SoloGame BlankLine, new ChatStatData("kit", "Kit", true) ); + + new CompassModule() + .setGiveCompass(true) + .setGiveCompassToSpecs(true) + .setGiveCompassToAlive(false) + .register(this); } @EventHandler diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/spleef/SpleefTeams.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/spleef/SpleefTeams.java index 47ea38230..6817e6770 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/spleef/SpleefTeams.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/spleef/SpleefTeams.java @@ -29,6 +29,7 @@ import nautilus.game.arcade.ArcadeManager; import nautilus.game.arcade.GameType; import nautilus.game.arcade.game.TeamGame; import nautilus.game.arcade.game.games.spleef.kits.*; +import nautilus.game.arcade.game.modules.TeamArmorModule; import nautilus.game.arcade.kit.Kit; import nautilus.game.arcade.managers.chat.ChatStatData; @@ -57,9 +58,6 @@ public class SpleefTeams extends TeamGame this.WorldWaterDamage = 4; this.PrepareFreeze = false; - - this.TeamArmor = true; - this.TeamArmorHotbar = true; registerChatStats( Kills, @@ -69,6 +67,10 @@ public class SpleefTeams extends TeamGame BlankLine, new ChatStatData("kit", "Kit", true) ); + new TeamArmorModule() + .giveTeamArmor() + .giveHotbarItem() + .register(this); } @EventHandler diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/squidshooter/SquidShooter.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/squidshooter/SquidShooter.java index dfb29abb3..993d01b48 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/squidshooter/SquidShooter.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/squidshooter/SquidShooter.java @@ -17,6 +17,7 @@ import nautilus.game.arcade.GameType; import nautilus.game.arcade.game.SoloGame; import nautilus.game.arcade.game.games.quiver.QuiverScore; import nautilus.game.arcade.game.games.squidshooter.kits.*; +import nautilus.game.arcade.game.modules.compass.CompassModule; import nautilus.game.arcade.kit.Kit; public class SquidShooter extends SoloGame @@ -46,7 +47,9 @@ public class SquidShooter extends SoloGame this.DamageSelf = false; this.DamageTeamSelf = true; this.PrepareFreeze = false; - this.CompassEnabled = true; + new CompassModule() + .setGiveCompassToAlive(true) + .register(this); this.KitRegisterState = GameState.Prepare; registerChatStats(); diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/stacker/Stacker.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/stacker/Stacker.java index 99bd044f1..7198628f8 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/stacker/Stacker.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/stacker/Stacker.java @@ -32,6 +32,7 @@ import nautilus.game.arcade.ArcadeManager; import nautilus.game.arcade.GameType; import nautilus.game.arcade.game.SoloGame; import nautilus.game.arcade.game.games.stacker.kits.*; +import nautilus.game.arcade.game.modules.compass.CompassModule; import nautilus.game.arcade.kit.Kit; public class Stacker extends SoloGame implements IThrown @@ -56,6 +57,12 @@ public class Stacker extends SoloGame implements IThrown }); registerChatStats(); + + new CompassModule() + .setGiveCompass(true) + .setGiveCompassToSpecs(true) + .setGiveCompassToAlive(false) + .register(this); } @EventHandler diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/survivalgames/SurvivalGames.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/survivalgames/SurvivalGames.java index 5b6f4d4b3..56ceef7ed 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/survivalgames/SurvivalGames.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/survivalgames/SurvivalGames.java @@ -1,11 +1,29 @@ package nautilus.game.arcade.game.games.survivalgames; -import java.lang.reflect.Field; -import java.util.*; +import java.util.ArrayList; +import java.util.Collection; +import java.util.Collections; +import java.util.HashMap; +import java.util.HashSet; +import java.util.Iterator; +import java.util.Random; +import java.util.Set; + +import net.minecraft.server.v1_8_R3.EntityLargeFireball; +import net.minecraft.server.v1_8_R3.PacketPlayOutScoreboardTeam; +import net.minecraft.server.v1_8_R3.WorldServer; import org.apache.commons.lang.StringUtils; -import org.bukkit.*; +import org.bukkit.Bukkit; +import org.bukkit.ChatColor; +import org.bukkit.Color; +import org.bukkit.Effect; +import org.bukkit.FireworkEffect; import org.bukkit.FireworkEffect.Type; +import org.bukkit.Location; +import org.bukkit.Material; +import org.bukkit.Sound; +import org.bukkit.WorldBorder; import org.bukkit.block.Block; import org.bukkit.block.BlockFace; import org.bukkit.block.BlockState; @@ -15,6 +33,7 @@ import org.bukkit.block.Furnace; import org.bukkit.craftbukkit.v1_8_R3.CraftWorld; import org.bukkit.craftbukkit.v1_8_R3.entity.CraftLargeFireball; import org.bukkit.craftbukkit.v1_8_R3.scoreboard.CraftScoreboard; +import org.bukkit.craftbukkit.v1_8_R3.util.LongHash; import org.bukkit.entity.Boat; import org.bukkit.entity.Egg; import org.bukkit.entity.Entity; @@ -32,12 +51,12 @@ import org.bukkit.event.block.BlockBurnEvent; import org.bukkit.event.block.BlockFadeEvent; import org.bukkit.event.block.BlockSpreadEvent; import org.bukkit.event.block.LeavesDecayEvent; +import org.bukkit.event.entity.EntityDamageByEntityEvent; +import org.bukkit.event.entity.EntityDamageEvent.DamageCause; import org.bukkit.event.entity.EntityExplodeEvent; import org.bukkit.event.entity.EntityShootBowEvent; import org.bukkit.event.entity.ExplosionPrimeEvent; import org.bukkit.event.entity.ItemSpawnEvent; -import org.bukkit.event.entity.EntityDamageByEntityEvent; -import org.bukkit.event.entity.EntityDamageEvent.DamageCause; import org.bukkit.event.entity.ProjectileHitEvent; import org.bukkit.event.hanging.HangingBreakEvent; import org.bukkit.event.inventory.CraftItemEvent; @@ -72,32 +91,43 @@ import mineplex.core.common.util.UtilInv; import mineplex.core.common.util.UtilItem; import mineplex.core.common.util.UtilMath; import mineplex.core.common.util.UtilParticle; -import mineplex.core.common.util.UtilPlayer; import mineplex.core.common.util.UtilParticle.ParticleType; import mineplex.core.common.util.UtilParticle.ViewDist; +import mineplex.core.common.util.UtilPlayer; import mineplex.core.common.util.UtilServer; import mineplex.core.common.util.UtilWorld; import mineplex.core.itemstack.ItemBuilder; import mineplex.core.itemstack.ItemStackFactory; -import mineplex.core.loot.*; +import mineplex.core.loot.ChestLoot; +import mineplex.core.loot.RandomItem; import mineplex.core.recharge.Recharge; +import mineplex.core.titles.tracks.LuckyTrack; +import mineplex.core.titles.tracks.UnluckyTrack; import mineplex.core.updater.UpdateType; import mineplex.core.updater.event.UpdateEvent; import mineplex.core.visibility.VisibilityManager; import mineplex.minecraft.game.core.combat.CombatComponent; import mineplex.minecraft.game.core.combat.event.CombatDeathEvent; import mineplex.minecraft.game.core.damage.CustomDamageEvent; + import nautilus.game.arcade.ArcadeManager; import nautilus.game.arcade.GameType; import nautilus.game.arcade.events.GameStateChangeEvent; import nautilus.game.arcade.game.Game; import nautilus.game.arcade.game.GameTeam; -import nautilus.game.arcade.game.games.survivalgames.kit.*; +import nautilus.game.arcade.game.games.survivalgames.kit.KitArcher; +import nautilus.game.arcade.game.games.survivalgames.kit.KitAssassin; +import nautilus.game.arcade.game.games.survivalgames.kit.KitAxeman; +import nautilus.game.arcade.game.games.survivalgames.kit.KitBarbarian; +import nautilus.game.arcade.game.games.survivalgames.kit.KitBeastmaster; +import nautilus.game.arcade.game.games.survivalgames.kit.KitBomber; +import nautilus.game.arcade.game.games.survivalgames.kit.KitBrawler; +import nautilus.game.arcade.game.games.survivalgames.kit.KitHorseman; +import nautilus.game.arcade.game.games.survivalgames.kit.KitKnight; +import nautilus.game.arcade.game.games.survivalgames.kit.KitLooter; +import nautilus.game.arcade.game.games.survivalgames.kit.KitNecromancer; +import nautilus.game.arcade.game.modules.compass.CompassModule; import nautilus.game.arcade.kit.Kit; -import net.minecraft.server.v1_8_R3.EntityLargeFireball; -import net.minecraft.server.v1_8_R3.PacketPlayOutScoreboardTeam; -import net.minecraft.server.v1_8_R3.ScoreboardTeam; -import net.minecraft.server.v1_8_R3.WorldServer; public abstract class SurvivalGames extends Game { @@ -244,6 +274,12 @@ public abstract class SurvivalGames extends Game // "chestsOpened"); setupLoot(); + + new CompassModule() + .setGiveCompass(true) + .setGiveCompassToSpecs(true) + .setGiveCompassToAlive(false) + .register(this); } @EventHandler @@ -380,7 +416,7 @@ public abstract class SurvivalGames extends Game @EventHandler public void CreateRandomChests(GameStateChangeEvent event) { - if (event.GetState() != GameState.Recruit) + if (event.GetState() != GameState.Prepare) return; HashSet ignore = new HashSet(); @@ -390,14 +426,28 @@ public abstract class SurvivalGames extends Game int xDiff = WorldData.MaxX - WorldData.MinX; int zDiff = WorldData.MaxZ - WorldData.MinZ; + Set illegalCoordinates = new HashSet<>(); + + for (GameTeam team : GetTeamList()) + { + for (Location l : team.GetSpawns()) + { + illegalCoordinates.add(LongHash.toLong(l.getBlockX(), l.getBlockZ())); + } + } + int done = 0; while (done < 40) { + int tx = WorldData.MinX + UtilMath.r(xDiff); + int tz = WorldData.MinZ + UtilMath.r(zDiff); - Block block = UtilBlock.getHighest(WorldData.World, WorldData.MinX - + UtilMath.r(xDiff), WorldData.MinZ + UtilMath.r(zDiff), - ignore); + // Don't spawn chest on spawn platform + if (illegalCoordinates.contains(LongHash.toLong(tx, tz))) + continue; + + Block block = UtilBlock.getHighest(WorldData.World, tx, tz, ignore); if (!UtilBlock.airFoliage(block) || !UtilBlock.solid(block.getRelative(BlockFace.DOWN))) @@ -760,6 +810,12 @@ public abstract class SurvivalGames extends Game } _supplyCrates.remove(block); + + if (getArcadeManager().GetServerConfig().RewardStats) + { + getArcadeManager().getTrackManager().getTrack(LuckyTrack.class).handleLoot(looter, chest.getBlockInventory()); + getArcadeManager().getTrackManager().getTrack(UnluckyTrack.class).handleLoot(looter, chest.getBlockInventory()); + } } protected ItemStack GetChestItem(boolean superChest) diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/survivalgames/SurvivalGamesTeams.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/survivalgames/SurvivalGamesTeams.java index f9ce3f31e..b0cae8a9b 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/survivalgames/SurvivalGamesTeams.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/survivalgames/SurvivalGamesTeams.java @@ -187,8 +187,6 @@ public class SurvivalGamesTeams extends TeamGame this.ItemDrop = true; this.ItemPickup = true; - - this.CompassEnabled = false; //XXX this.InventoryClick = true; this.InventoryOpenBlock = true; diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/survivalgames/TeamSurvivalGames.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/survivalgames/TeamSurvivalGames.java index 229a38aef..5a9dc59ba 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/survivalgames/TeamSurvivalGames.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/survivalgames/TeamSurvivalGames.java @@ -50,7 +50,7 @@ public class TeamSurvivalGames extends SurvivalGames TeamMode = true; ShowTeammateMessage = true; - registerModule(new TeamModule()); + new TeamModule().register(this); registerStatTrackers(new WinWithoutWearingArmorStatTracker(this), new KillsWithinTimeLimitStatTracker(this, 3, 60, "Bloodlust"), diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/survivalgames/modes/StrikeGames.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/survivalgames/modes/StrikeGames.java index c5deefa69..304140edd 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/survivalgames/modes/StrikeGames.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/survivalgames/modes/StrikeGames.java @@ -80,7 +80,7 @@ public class StrikeGames extends SoloSurvivalGames super(manager, new Kit[] { new KitPlayer(manager) - }, GameType.Brawl); + }, GameType.StrikeGames); Damage = false; @@ -88,6 +88,8 @@ public class StrikeGames extends SoloSurvivalGames _peacePhase = 20000; + HungerSet = 20; + _gunModule = new GunModule(this); _gunModule.EnableCleaning = false; _gunModule.EnableDrop = false; @@ -213,14 +215,6 @@ public class StrikeGames extends SoloSurvivalGames public void setupLoot() { - // Food - getBaseLoot().addLoot(new RandomItem(Material.BAKED_POTATO, 30, 1, 3)); - getBaseLoot().addLoot(new RandomItem(Material.COOKED_BEEF, 30, 1, 2)); - getBaseLoot().addLoot(new RandomItem(Material.COOKED_CHICKEN, 30, 1, 2)); - getBaseLoot().addLoot(new RandomItem(Material.MUSHROOM_SOUP, 15, 1, 1)); - getBaseLoot().addLoot(new RandomItem(Material.WHEAT, 30, 1, 6)); - getBaseLoot().addLoot(new RandomItem(Material.ROTTEN_FLESH, 40, 1, 6)); - // Weapons getBaseLoot().addLoot(new RandomItem(Material.WOOD_SWORD, 70)); getBaseLoot().addLoot(new RandomItem(Material.STONE_SWORD, 30)); @@ -253,7 +247,7 @@ public class StrikeGames extends SoloSurvivalGames getBaseLoot().addLoot(new RandomItem(Material.EGG, 30, 1, 2)); // Misc - getBaseLoot().addLoot(new RandomItem(Material.EXP_BOTTLE, 30, 1, 2)); + //getBaseLoot().addLoot(new RandomItem(Material.EXP_BOTTLE, 30, 1, 2)); getBaseLoot().addLoot(new RandomItem(Material.COMPASS, 20)); getBaseLoot().addLoot(new RandomItem(Material.STICK, 30, 1, 2)); getBaseLoot().addLoot(new RandomItem(Material.BOAT, 15)); @@ -264,16 +258,6 @@ public class StrikeGames extends SoloSurvivalGames getSpawnLoot().cloneLoot(getBaseLoot()); - // Food - getSpawnLoot().addLoot(new RandomItem(Material.BAKED_POTATO, 30, 1, 5)); - getSpawnLoot().addLoot(new RandomItem(Material.CAKE, 30)); - getSpawnLoot().addLoot(new RandomItem(Material.MUSHROOM_SOUP, 30, 1, 1)); - getSpawnLoot().addLoot(new RandomItem(Material.COOKED_BEEF, 30, 1, 3)); - getSpawnLoot().addLoot(new RandomItem(Material.COOKED_CHICKEN, 30, 1, 3)); - getSpawnLoot().addLoot(new RandomItem(Material.COOKED_FISH, 30, 1, 6)); - getSpawnLoot().addLoot(new RandomItem(Material.COOKIE, 30)); - getSpawnLoot().addLoot(new RandomItem(Material.PUMPKIN_PIE, 30, 1, 3)); - // Loot for chests in spawn // Weaponry and ores getSpawnLoot().addLoot(new RandomItem(Material.STONE_SWORD, 30)); @@ -303,23 +287,7 @@ public class StrikeGames extends SoloSurvivalGames getCrateLoot().addLoot(new RandomItem(Material.DIAMOND_SWORD, 8)); getCrateLoot().addLoot(new RandomItem(Material.GOLD_SPADE, 12)); - // Cooked furnace - getFurnace().addLoot(new RandomItem(Material.COOKED_BEEF, 3, 1, 2)); - getFurnace().addLoot(new RandomItem(Material.COOKED_CHICKEN, 3, 1, 2)); - getFurnace().addLoot(new RandomItem(Material.COOKED_FISH, 3, 1, 2)); - getFurnace().addLoot(new RandomItem(Material.BAKED_POTATO, 3, 1, 1)); - getFurnace().addLoot(new RandomItem(Material.PUMPKIN_PIE, 3, 1, 1)); - getFurnace().addLoot(new RandomItem(Material.IRON_INGOT, 1, 1, 1)); - - // Raw furnace - getRawFurnace().addLoot(new RandomItem(Material.RAW_BEEF, 1, 1, 3)); - getRawFurnace().addLoot(new RandomItem(Material.RAW_CHICKEN, 1, 1, 3)); - getRawFurnace().addLoot(new RandomItem(Material.RAW_FISH, 1, 1, 3)); - // Deathmatch Loot - getDeathMatch().addLoot(new RandomItem(Material.PUMPKIN_PIE, 4)); - getDeathMatch().addLoot(new RandomItem(Material.BAKED_POTATO, 4)); - getDeathMatch().addLoot(new RandomItem(Material.CAKE, 4)); getDeathMatch().addLoot(new RandomItem(Material.WOOD_SWORD, 3)); getDeathMatch().addLoot(new RandomItem(Material.STONE_SWORD, 1)); } diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/tug/Tug.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/tug/Tug.java index a232d4115..8440b2244 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/tug/Tug.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/tug/Tug.java @@ -35,6 +35,7 @@ import nautilus.game.arcade.ArcadeManager; import nautilus.game.arcade.GameType; import nautilus.game.arcade.game.TeamGame; import nautilus.game.arcade.game.games.tug.kits.*; +import nautilus.game.arcade.game.modules.compass.CompassModule; import nautilus.game.arcade.kit.Kit; public class Tug extends TeamGame @@ -73,6 +74,12 @@ public class Tug extends TeamGame this.DeathSpectateSecs = 20; registerChatStats(); + + new CompassModule() + .setGiveCompass(true) + .setGiveCompassToSpecs(true) + .setGiveCompassToAlive(false) + .register(this); } @Override diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/turfforts/TurfForts.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/turfforts/TurfForts.java index 15ffadb9f..e9b881916 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/turfforts/TurfForts.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/turfforts/TurfForts.java @@ -58,6 +58,7 @@ import nautilus.game.arcade.game.TeamGame; import nautilus.game.arcade.game.games.turfforts.kits.KitInfiltrator; import nautilus.game.arcade.game.games.turfforts.kits.KitMarksman; import nautilus.game.arcade.game.games.turfforts.kits.KitShredder; +import nautilus.game.arcade.game.modules.compass.CompassModule; import nautilus.game.arcade.kit.Kit; import nautilus.game.arcade.managers.chat.ChatStatData; import nautilus.game.arcade.stats.BehindEnemyLinesStatTracker; @@ -169,6 +170,13 @@ public class TurfForts extends TeamGame new ChatStatData("BlocksPlaced", "Blocks Placed", true), new ChatStatData("BlocksBroken", "Blocks Broken", true) ); + + + new CompassModule() + .setGiveCompass(true) + .setGiveCompassToSpecs(true) + .setGiveCompassToAlive(false) + .register(this); } @Override diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/typewars/Minion.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/typewars/Minion.java index 51df05364..88fa186fb 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/typewars/Minion.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/typewars/Minion.java @@ -314,7 +314,7 @@ public class Minion private void path() { - UtilEnt.Vegetate(_entity); + UtilEnt.vegetate(_entity); UtilEnt.silence(_entity, true); UtilEnt.ghost(_entity, true, false); } diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/typewars/TypeWars.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/typewars/TypeWars.java index 2a71c63a6..6e7845689 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/typewars/TypeWars.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/typewars/TypeWars.java @@ -37,6 +37,8 @@ import nautilus.game.arcade.game.games.typewars.stats.PerfectionistStatTracker; import nautilus.game.arcade.game.games.typewars.stats.TimeInGameTracker; import nautilus.game.arcade.game.games.typewars.stats.WaitForItStatTracker; import nautilus.game.arcade.game.games.typewars.tutorial.TutorialTypeWars; +import nautilus.game.arcade.game.modules.TeamArmorModule; +import nautilus.game.arcade.game.modules.compass.CompassModule; import nautilus.game.arcade.gametutorial.events.GameTutorialEndEvent; import nautilus.game.arcade.gametutorial.events.GameTutorialStartEvent; import nautilus.game.arcade.kit.Kit; @@ -121,14 +123,11 @@ public class TypeWars extends TeamGame this.DeathSpectateSecs = 0; this.HungerSet = 20; this.WorldBoundaryKill = true; - this.CompassEnabled = false; - this.TeamArmor = true; - this.TeamArmorHotbar = false; + this.WorldTimeSet = 6000; this.DamageEvP = false; this.DamagePvE = false; this.DamagePvP = false; - this.TeamArmorHotbar = true; this.Damage = false; this.CreatureAllow = false; this.PrepareTime = 50000; @@ -173,6 +172,17 @@ public class TypeWars extends TeamGame ); manager.GetCreature().SetDisableCustomDrops(true); + + new CompassModule() + .setGiveCompass(true) + .setGiveCompassToSpecs(true) + .setGiveCompassToAlive(false) + .register(this); + + new TeamArmorModule() + .giveTeamArmor() + .giveHotbarItem() + .register(this); } @EventHandler @@ -233,7 +243,7 @@ public class TypeWars extends TeamGame _giantLocs.put(giant, loc.clone()); this.CreatureAllowOverride = false; giant.setRemoveWhenFarAway(false); - UtilEnt.Vegetate(giant, true); + UtilEnt.vegetate(giant, true); UtilEnt.ghost(giant, true, false); ItemStack helmet = new ItemStack(Material.LEATHER_HELMET); diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/uhc/KitUHC.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/uhc/KitUHC.java index 8f9f70b7e..f67f81ccb 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/uhc/KitUHC.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/uhc/KitUHC.java @@ -21,9 +21,9 @@ public class KitUHC extends ProgressingKit private static final Perk[] PERKS = { }; - + private static final ItemStack IN_HAND = new ItemStack(Material.GOLD_SWORD); - + public KitUHC(ArcadeManager manager) { super(manager, "UHC Player", "uhcplayer", KitAvailability.Free, DESCRIPTION, PERKS, EntityType.ZOMBIE, IN_HAND); @@ -33,6 +33,5 @@ public class KitUHC extends ProgressingKit @Override public void GiveItems(Player player) { - } } diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/uhc/UHC.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/uhc/UHC.java index 9c086a1aa..3e5b66bc6 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/uhc/UHC.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/uhc/UHC.java @@ -1,65 +1,35 @@ package nautilus.game.arcade.game.games.uhc; -import com.mineplex.spigot.ChunkPreLoadEvent; -import mineplex.core.account.CoreClient; -import mineplex.core.boosters.event.BoosterItemGiveEvent; -import mineplex.core.common.Pair; -import mineplex.core.common.Rank; -import mineplex.core.common.util.C; -import mineplex.core.common.util.F; -import mineplex.core.common.util.UtilAction; -import mineplex.core.common.util.UtilAlg; -import mineplex.core.common.util.UtilBlock; -import mineplex.core.common.util.UtilEvent; -import mineplex.core.common.util.UtilInv; -import mineplex.core.common.util.UtilMath; -import mineplex.core.common.util.UtilParser; -import mineplex.core.common.util.UtilPlayer; -import mineplex.core.common.util.UtilServer; -import mineplex.core.common.util.UtilTextMiddle; -import mineplex.core.common.util.UtilTime; -import mineplex.core.itemstack.ItemBuilder; -import mineplex.core.itemstack.ItemStackFactory; -import mineplex.core.monitor.LagMeter; -import mineplex.core.recharge.Recharge; -import mineplex.core.timing.TimingManager; -import mineplex.core.updater.UpdateType; -import mineplex.core.updater.event.UpdateEvent; -import mineplex.minecraft.game.core.combat.CombatLog; -import mineplex.minecraft.game.core.combat.event.CombatDeathEvent; -import nautilus.game.arcade.ArcadeManager; -import nautilus.game.arcade.GameType; -import nautilus.game.arcade.events.GamePrepareCountdownCommence; -import nautilus.game.arcade.events.GameStateChangeEvent; -import nautilus.game.arcade.events.PlayerPrepareTeleportEvent; -import nautilus.game.arcade.game.Game; -import nautilus.game.arcade.game.GameTeam; -import nautilus.game.arcade.game.TeamGame; -import nautilus.game.arcade.game.games.uhc.helpers.ChunkLoadingThread; -import nautilus.game.arcade.game.games.uhc.helpers.WorldGenThread; -import nautilus.game.arcade.game.modules.AntiExpOrbModule; -import nautilus.game.arcade.game.modules.OreVeinEditorModule; -import nautilus.game.arcade.game.modules.TeamModule; -import nautilus.game.arcade.game.modules.combatlog.CombatLogModule; -import nautilus.game.arcade.game.modules.combatlog.CombatLogNPC; -import nautilus.game.arcade.kit.Kit; -import net.minecraft.server.v1_8_R3.MinecraftServer; -import net.minecraft.server.v1_8_R3.WorldServer; +import java.lang.reflect.Field; +import java.nio.charset.StandardCharsets; +import java.util.ArrayList; +import java.util.Arrays; +import java.util.Collection; +import java.util.HashMap; +import java.util.List; +import java.util.Map; +import java.util.UUID; +import java.util.concurrent.TimeUnit; +import java.util.concurrent.atomic.AtomicInteger; +import java.util.function.Function; +import java.util.stream.Collectors; + import org.bukkit.Bukkit; -import org.bukkit.ChatColor; import org.bukkit.Chunk; -import org.bukkit.Difficulty; +import org.bukkit.GameMode; import org.bukkit.Location; import org.bukkit.Material; import org.bukkit.Sound; +import org.bukkit.World; import org.bukkit.World.Environment; -import org.bukkit.WorldBorder; import org.bukkit.block.Block; import org.bukkit.block.BlockFace; -import org.bukkit.block.BlockState; +import org.bukkit.block.Chest; +import org.bukkit.craftbukkit.v1_8_R3.CraftChunk; import org.bukkit.craftbukkit.v1_8_R3.CraftWorld; +import org.bukkit.craftbukkit.v1_8_R3.entity.CraftEntity; import org.bukkit.craftbukkit.v1_8_R3.util.CraftMagicNumbers; -import org.bukkit.enchantments.Enchantment; +import org.bukkit.craftbukkit.v1_8_R3.util.HashTreeSet; import org.bukkit.entity.Entity; import org.bukkit.entity.EntityType; import org.bukkit.entity.Ghast; @@ -68,10 +38,6 @@ import org.bukkit.entity.Monster; import org.bukkit.entity.Player; import org.bukkit.event.EventHandler; import org.bukkit.event.EventPriority; -import org.bukkit.event.HandlerList; -import org.bukkit.event.block.Action; -import org.bukkit.event.block.BlockGrowEvent; -import org.bukkit.event.block.BlockPistonExtendEvent; import org.bukkit.event.block.BlockPlaceEvent; import org.bukkit.event.entity.EntityDamageEvent; import org.bukkit.event.entity.EntityDamageEvent.DamageCause; @@ -83,191 +49,219 @@ import org.bukkit.event.entity.PlayerDeathEvent; import org.bukkit.event.inventory.InventoryClickEvent; import org.bukkit.event.inventory.PrepareItemCraftEvent; import org.bukkit.event.player.PlayerCommandPreprocessEvent; -import org.bukkit.event.player.PlayerInteractEvent; -import org.bukkit.event.player.PlayerItemConsumeEvent; import org.bukkit.event.player.PlayerKickEvent; -import org.bukkit.event.player.PlayerPickupItemEvent; import org.bukkit.event.player.PlayerPortalEvent; -import org.bukkit.event.player.PlayerQuitEvent; import org.bukkit.event.player.PlayerTeleportEvent.TeleportCause; -import org.bukkit.event.world.ChunkLoadEvent; -import org.bukkit.event.world.ChunkPopulateEvent; import org.bukkit.event.world.ChunkUnloadEvent; -import org.bukkit.event.world.StructureGrowEvent; import org.bukkit.inventory.CraftingInventory; +import org.bukkit.inventory.Inventory; import org.bukkit.inventory.ItemStack; -import org.bukkit.inventory.ShapedRecipe; import org.bukkit.inventory.ShapelessRecipe; -import org.bukkit.inventory.meta.SkullMeta; -import org.bukkit.material.MaterialData; import org.bukkit.potion.PotionEffect; import org.bukkit.potion.PotionEffectType; +import org.bukkit.scheduler.BukkitRunnable; import org.bukkit.scoreboard.DisplaySlot; import org.bukkit.scoreboard.Objective; +import org.spigotmc.ActivationRange; -import java.util.ArrayList; -import java.util.HashMap; -import java.util.HashSet; -import java.util.Iterator; -import java.util.List; -import java.util.Map; -import java.util.Set; -import java.util.UUID; -import java.util.concurrent.atomic.AtomicInteger; +import mineplex.core.boosters.event.BoosterItemGiveEvent; +import mineplex.core.common.Pair; +import mineplex.core.common.Rank; +import mineplex.core.common.util.C; +import mineplex.core.common.util.Callback; +import mineplex.core.common.util.F; +import mineplex.core.common.util.UtilAction; +import mineplex.core.common.util.UtilAlg; +import mineplex.core.common.util.UtilBlock; +import mineplex.core.common.util.UtilInv; +import mineplex.core.common.util.UtilMath; +import mineplex.core.common.util.UtilParser; +import mineplex.core.common.util.UtilParticle; +import mineplex.core.common.util.UtilParticle.ParticleType; +import mineplex.core.common.util.UtilParticle.ViewDist; +import mineplex.core.common.util.UtilPlayer; +import mineplex.core.common.util.UtilServer; +import mineplex.core.common.util.UtilTextBottom; +import mineplex.core.common.util.UtilTextMiddle; +import mineplex.core.common.util.UtilTime; +import mineplex.core.itemstack.ItemStackFactory; +import mineplex.core.recharge.Recharge; +import mineplex.core.updater.UpdateType; +import mineplex.core.updater.event.UpdateEvent; +import mineplex.minecraft.game.core.combat.CombatLog; +import mineplex.minecraft.game.core.combat.event.CombatDeathEvent; -public class UHC extends TeamGame +import nautilus.game.arcade.ArcadeManager; +import nautilus.game.arcade.GameType; +import nautilus.game.arcade.events.GamePrepareCountdownCommence; +import nautilus.game.arcade.events.GameStateChangeEvent; +import nautilus.game.arcade.events.PlayerPrepareTeleportEvent; +import nautilus.game.arcade.game.DebugCommand; +import nautilus.game.arcade.game.Game; +import nautilus.game.arcade.game.GameTeam; +import nautilus.game.arcade.game.games.AbsorptionFix; +import nautilus.game.arcade.game.games.uhc.components.UHCBorder; +import nautilus.game.arcade.game.games.uhc.components.UHCFreezer; +import nautilus.game.arcade.game.games.uhc.components.UHCSpeedMode; +import nautilus.game.arcade.game.games.uhc.stat.CollectFoodStat; +import nautilus.game.arcade.game.games.uhc.stat.HalfHeartHealStat; +import nautilus.game.arcade.game.games.uhc.stat.HoeCraftingStat; +import nautilus.game.arcade.game.games.uhc.stat.LuckyMinerStat; +import nautilus.game.arcade.game.modules.AntiExpOrbModule; +import nautilus.game.arcade.game.modules.OreVeinEditorModule; +import nautilus.game.arcade.game.modules.PlayerHeadModule; +import nautilus.game.arcade.game.modules.RejoinModule; +import nautilus.game.arcade.game.modules.RejoinModule.RejoinPlayerData; +import nautilus.game.arcade.game.modules.combatlog.CombatLogModule; +import nautilus.game.arcade.game.modules.combatlog.CombatLogNPC; +import nautilus.game.arcade.game.modules.combatlog.CombatLogNPCExpiredEvent; +import nautilus.game.arcade.game.modules.combatlog.CombatLogNPCKilledEvent; +import nautilus.game.arcade.game.modules.combatlog.CombatLogNPCPreSpawnEvent; +import nautilus.game.arcade.game.modules.compass.CompassModule; +import nautilus.game.arcade.kit.Kit; +import net.md_5.bungee.api.ChatColor; +import net.minecraft.server.v1_8_R3.MathHelper; +import net.minecraft.server.v1_8_R3.MinecraftServer; +import net.minecraft.server.v1_8_R3.NextTickListEntry; +import net.minecraft.server.v1_8_R3.WorldServer; + +public abstract class UHC extends Game { - // The view distance of UHC. The amount of time and ram needed grows polynomially + private static int _gamesRun = 0; + public static final int VIEW_DISTANCE = 5; - // The number of threads to use for reading chunks from disk - public static final int THREADS_FOR_CHUNK_LOADING = 4; + // The number of milliseconds after which PVP should be enabled + // Initialised in constructor + public static int SAFE_TIME; - // The number of minutes after which PVP should be enabled - public static final int SAFE_TIME_IN_MINUTES = 11; + // The number of milliseconds after which Deathmatch should start. + // Initialised in constructor + public static int MINING_TIME; - // The number of chunks to unload per tick - public static final int CHUNKS_UNLOAD_PER_TICK = 1; + // The maximum/starting arena size + public static final int MAX_ARENA_SIZE = 1000; - // The number of ticks to delay chunk unloading by - public static final long CHUNKS_UNLOAD_DELAY = 5 * 20L; + // The deathmatch arena size + public static final int DEATHMATCH_ARENA_SIZE = 200; - // The number of ticks to wait between each chunk unload period - public static final long CHUNKS_UNLOAD_PERIOD = 2 * 20L; + // The time for the border to shrink to 0 during deathmatch. + public static final int DEATHMATCH_TIME_SECONDS = 600; - // This is the region in which nothing can be done (block placing, flowing, etc) - public static final int SAFE_REGION = 36; + // The pre-deathmatch teleporting time + public static final int PRE_DEATHMATCH_TIME_SECONDS = 11; // The amount of damage to give from hitting the world border - public static final int WORLD_BORDER_DAMAGE = 5; - + public static final int WORLD_BORDER_DAMAGE = 2; + + // The distance a player needs to be away from the vertical border to see the particles + public static final int WORLD_BORDER_PARTICLES_DISTANCE = 20; + // The number of ticks to delay before teleporting each player public static final long DELAY_BETWEEN_PLAYER_TELEPORT = 5L; - // The centers of the spawn for each team - private Map _teamCenter = new HashMap<>(); - - // The thread responsible for generating the world - private final WorldGenThread _worldGenThread = new WorldGenThread(this); - - // The thread responsible for loading and decorating the world - private final ChunkLoadingThread _chunkLoadingThread = new ChunkLoadingThread(this); - - // The chunks which we have prevented unloading - private final Set _loadedChunks = new HashSet<>(); - - // The task which will unload chunks periodically - private int _chunkUnloadTaskId = -1; - - // The number of minutes passed in this game - private int _minutesSinceStart = 0; - // The Objective representing the tab list health display private Objective _healthObjective; // The number of players which have been teleported private int _teleportedPlayers = -1; // The total number of players to teleport - private int _totalPlayers = 0; + private int _totalPlayers; // Whether players are teleporting currently private volatile boolean _isTeleporting = false; // Border - private int _secondsSinceStart; - private HashMap _borderPositions = new HashMap(); - private double _currentBorder = 1000; - private double _previousBorder = 1000; - private long _borderStartedMoving; + private UHCBorder _border; + + // Freeze manager + private UHCFreezer _freezer; + + // Pre-deathmatch + private int _secondsSincePreDeathmatch; + + // UHC State + private UHCState _state; + + // Speed Mode + private UHCSpeedMode _speedMode; public UHC(ArcadeManager manager) { - this(manager, GameType.UHC); + this(manager, GameType.UHC, false); - registerChatStats( - Kills, - Assists, - BlankLine, - DamageTaken, - DamageDealt - ); - - registerModule( - new OreVeinEditorModule() - .removeNonAirVeins() - ); - registerModule(new AntiExpOrbModule()); + registerChatStats(Kills, Assists, BlankLine, DamageTaken, DamageDealt); } - public UHC(ArcadeManager manager, GameType type) + @SuppressWarnings("unchecked") + public UHC(ArcadeManager manager, GameType type, boolean speedMode) { - super(manager, type, + super(manager, type, new Kit[] { new KitUHC(manager) }, - new Kit[] - { - new KitUHC(manager) - }, - - new String[] - { - "10 minutes of no PvP", "Only Golden Apples restore health", "Ores can only be found in caves", - "Borders shrink over time", "Last player/team alive wins!" - }); + new String[] { "10 minutes of no PvP", "Only Golden Apples restore health", "Ores can only be found in caves", "Borders shrink over time", "Last player/team alive wins!" }); _gamesRun++; - this.HideTeamSheep = true; + SAFE_TIME = (int) TimeUnit.MINUTES.toMillis(10); + MINING_TIME = (int) (TimeUnit.HOURS.toMillis(1) + SAFE_TIME); - this.StrictAntiHack = true; + if (speedMode) + { + _speedMode = new UHCSpeedMode(this); + } - this.GameTimeout = 10800000; + _state = UHCState.SAFE; - this.DamagePvP = false; + HideTeamSheep = true; - this.DeathDropItems = true; + StrictAntiHack = true; - this.ItemDrop = true; - this.ItemPickup = true; + GameTimeout = TimeUnit.HOURS.toMillis(2); - this.BlockBreak = true; - this.BlockPlace = true; + DamagePvP = false; - this.InventoryOpenBlock = true; - this.InventoryOpenChest = true; - this.InventoryClick = true; + ItemDrop = true; + ItemPickup = true; - this.DeathOut = true; - this.QuitOut = false; + BlockBreak = true; + BlockPlace = true; - this.CreatureAllow = true; + InventoryOpenBlock = true; + InventoryOpenChest = true; + InventoryClick = true; - this.AnnounceStay = false; + DeathOut = true; + QuitOut = false; - this.DeathMessages = false; + CreatureAllow = true; - this.SoupEnabled = false; + AnnounceStay = false; - this.CompassEnabled = true; - this.CompassGiveItem = false; + DeathMessages = false; + DeathTeleport = false; - this.WorldBoundaryKill = false; + SoupEnabled = false; - this.GemBoosterEnabled = false; - this.GemDoubleEnabled = false; - this.GemHunterEnabled = false; + WorldBoundaryKill = false; - this.WorldBoneMeal = true; + GemBoosterEnabled = false; + GemDoubleEnabled = false; + GemHunterEnabled = false; - this.DontAllowOverfill = true; + WorldBoneMeal = true; - this.GadgetsDisabled = true; + DontAllowOverfill = true; + + GadgetsDisabled = true; WorldTimeSet = -1; - this.WorldLeavesDecay = true; - this.WorldBlockGrow = true; - this.WorldSoilTrample = true; - this.WorldBoneMeal = true; - this.WorldChunkUnload = true; + WorldLeavesDecay = true; + WorldBlockGrow = true; + WorldSoilTrample = true; + WorldBoneMeal = true; + WorldChunkUnload = true; + + ShowEveryoneSpecChat = false; CraftRecipes(); @@ -283,111 +277,569 @@ public class UHC extends TeamGame _healthObjective = Scoreboard.getScoreboard().registerNewObjective("Health", "health"); _healthObjective.setDisplaySlot(DisplaySlot.PLAYER_LIST); - registerModule(new TeamModule()); + // World Border + _border = new UHCBorder(this, MAX_ARENA_SIZE); + + // Player Freezer + _freezer = new UHCFreezer(this); + + new PlayerHeadModule().register(this); + new CompassModule() + .setGiveCompassToAlive(true) + .setGiveCompass(false) + .register(this); + new OreVeinEditorModule().removeNonAirVeins().register(this); + new AntiExpOrbModule().register(this); + new RejoinModule().register(this); + new AbsorptionFix(this); + + registerStatTrackers(new CollectFoodStat(this), new HoeCraftingStat(this), new LuckyMinerStat(this), new HalfHeartHealStat(this)); + + registerDebugCommand(new DebugCommand("startpvp", Rank.ADMIN) + { + @Override + public void Execute(Player caller, String[] args) + { + if (!IsLive()) + { + UtilPlayer.message(caller, F.main("Debug", "You can't start the game right now!")); + return; + } + if (_state.isPVP()) + { + UtilPlayer.message(caller, F.main("Debug", "PvP has already been started!")); + return; + } + + MINING_TIME -= SAFE_TIME; + SAFE_TIME = 0; + + startPvp(); + UtilPlayer.message(caller, F.main("Debug", "Started PvP")); + } + }); + + registerDebugCommand(new DebugCommand("worldinfo", Rank.ADMIN) + { + @Override + public void Execute(Player caller, String[] args) + { + if (args == null || args.length == 0) + { + UtilPlayer.message(caller, F.main("Debug", "Loaded worlds:")); + UtilPlayer.message(caller, F.desc("Bukkit Worlds", Bukkit.getWorlds().stream().map(World::getName).collect(Collectors.joining(", ")))); + UtilPlayer.message(caller, F.desc("NMS Worlds", MinecraftServer.getServer().worlds.stream().map(net.minecraft.server.v1_8_R3.WorldServer::getWorldData).map( + net.minecraft.server.v1_8_R3.WorldData::getName).collect(Collectors.joining(", ")))); + return; + } + if (args[0].equals("info")) + { + if (args.length > 1) + { + String worldName = args[1]; + World targetWorld = null; + + if (worldName.startsWith("b:")) + { + targetWorld = Bukkit.getWorlds().stream().filter(world -> world.getName().replace(" ", "").equals(worldName.substring(2))).findAny().orElse(null); + } + else if (worldName.startsWith("n:")) + { + WorldServer world = MinecraftServer.getServer().worlds.stream().filter(ws -> ws.getWorldData().getName().replace(" ", "").equals(worldName.substring(2))).findAny().orElse( + null); + if (world != null) + { + targetWorld = world.getWorld(); + } + } + else + { + UtilPlayer.message(caller, F.main("Debug", "No world type specified")); + return; + } + + if (targetWorld != null) + { + WorldServer nmsWorld = ((CraftWorld) targetWorld).getHandle(); + Chunk[] chunks = targetWorld.getLoadedChunks(); + UtilPlayer.message(caller, F.main("Debug", "World info for " + targetWorld.getName())); + UtilPlayer.message(caller, F.desc("Chunks", String.valueOf(chunks.length))); + UtilPlayer.message(caller, F.desc("Entities", String.valueOf(targetWorld.getEntities().size()))); + UtilPlayer.message(caller, F.desc("Tile Entities", String.valueOf(Arrays.stream(chunks).map(Chunk::getTileEntities).map(Arrays::asList).mapToLong(Collection::size).sum()))); + UtilPlayer.message(caller, F.desc("View Distance", String.valueOf(nmsWorld.spigotConfig.viewDistance))); + UtilPlayer.message(caller, F.desc("Unload queue size", String.valueOf(nmsWorld.chunkProviderServer.unloadQueue.size()))); + + try + { + Field f = nmsWorld.getClass().getDeclaredField("M"); + f.setAccessible(true); + HashTreeSet m = (HashTreeSet) f.get(nmsWorld); + + UtilPlayer.message(caller, F.desc("Pending tick", String.valueOf(m.size()))); + } + catch (ReflectiveOperationException e) + { + e.printStackTrace(); + } + } + else + { + UtilPlayer.message(caller, F.main("Debug", "That world was not found")); + } + } + else + { + UtilPlayer.message(caller, F.main("Debug", "No world specified")); + } + } + else if (args[0].equals("chunks")) + { + + if (args.length > 1) + { + String worldName = args[1]; + World targetWorld = null; + + if (worldName.startsWith("b:")) + { + targetWorld = Bukkit.getWorlds().stream().filter(world -> world.getName().replace(" ", "").equals(worldName.substring(2))).findAny().orElse(null); + } + else if (worldName.startsWith("n:")) + { + WorldServer world = MinecraftServer.getServer().worlds.stream().filter(ws -> ws.getWorldData().getName().replace(" ", "").equals(worldName.substring(2))).findAny().orElse( + null); + if (world != null) + { + targetWorld = world.getWorld(); + } + } + else + { + UtilPlayer.message(caller, F.main("Debug", "No world type specified")); + return; + } + + if (targetWorld != null) + { + String message = Arrays.stream(targetWorld.getLoadedChunks()).map(chunk -> "(" + chunk.getX() + "," + chunk.getZ() + ")").collect(Collectors.joining(",")); + System.out.println("Chunks: " + message); + if (message.getBytes(StandardCharsets.UTF_8).length < 32767) + { + caller.sendMessage(message); + } + } + else + { + UtilPlayer.message(caller, F.main("Debug", "That world was not found")); + } + } + else + { + UtilPlayer.message(caller, F.main("Debug", "No world specified")); + } + } + return; + } + }); + registerDebugCommand(new DebugCommand("uhcgames", Rank.ADMIN) + { + @Override + public void Execute(Player caller, String[] args) + { + UtilPlayer.message(caller, F.main("Debug", "As of now, there have been " + _gamesRun + " games played")); + } + }); + registerDebugCommand(new DebugCommand("uhcgc", Rank.DEVELOPER) + { + @Override + public void Execute(Player caller, String[] args) + { + System.gc(); + UtilPlayer.message(caller, F.main("Debug", "Cleaned up!")); + } + }); + registerDebugCommand(new DebugCommand("setcombatlogtimeout", Rank.DEVELOPER) + { + @Override + public void Execute(Player caller, String[] args) + { + CombatLogModule module = getModule(CombatLogModule.class); + if (module == null) + { + UtilPlayer.message(caller, F.main("Debug", "The combat log module has not been loaded yet")); + return; + } + + if (args.length == 0) + { + UtilPlayer.message(caller, F.main("Debug", "No timeout specified")); + return; + } + + try + { + int timeout = Integer.parseInt(args[0]); + module.setCombatLogTime(timeout); + getModule(RejoinModule.class).setRejoinTime(timeout); + UtilPlayer.message(caller, F.main("Debug", "Set the new timeout to " + timeout)); + } + catch (NumberFormatException ex) + { + UtilPlayer.message(caller, F.main("Debug", "That's not a number!")); + } + } + }); + registerDebugCommand(new DebugCommand("dm", Rank.ADMIN) + { + + @Override + public void Execute(Player caller, String[] args) + { + SAFE_TIME = 0; + MINING_TIME = 1000; + startPreDeathmatch(); + UtilPlayer.message(caller, F.main("Debug", "Starting deathmatch")); + } + }); + registerDebugCommand(new DebugCommand("uhcentities", Rank.DEVELOPER) + { + + @Override + public void Execute(Player caller, String[] args) + { + for (Entity entity : caller.getNearbyEntities(5.0, 5.0, 5.0)) + { + net.minecraft.server.v1_8_R3.Entity nms = ((CraftEntity) entity).getHandle(); + String debug = "Entity: " + entity.getType() + " id:" + nms.getId() + " inac:" + ActivationRange.checkIfActive(nms); + debug += " at:" + nms.activatedTick + " dac:" + nms.defaultActivationState; + + int x = MathHelper.floor(nms.locX); + int z = MathHelper.floor(nms.locZ); + + net.minecraft.server.v1_8_R3.Chunk chunk = nms.world.getChunkIfLoaded(x >> 4, z >> 4); + debug += " c:" + chunk + " il:" + (chunk != null ? chunk.areNeighborsLoaded(1) : "null"); + caller.sendMessage(debug); + } + } + }); + registerDebugCommand(new DebugCommand("uhcchunk", Rank.DEVELOPER) + { + + @Override + public void Execute(Player caller, String[] args) + { + net.minecraft.server.v1_8_R3.Chunk chunk = ((CraftChunk) caller.getLocation().getChunk()).getHandle(); + try + { + Field neighbors = chunk.getClass().getDeclaredField("neighbors"); + neighbors.setAccessible(true); + int n = neighbors.getInt(chunk); + + for (int x = -1; x < 2; x++) + { + for (int z = -1; z < 2; z++) + { + if (x == 0 && z == 0) + { + continue; + } + + int mask = 0x1 << (x * 5 + z + 12); + + boolean should = chunk.world.getChunkIfLoaded(chunk.locX + x, chunk.locZ + z) != null; + boolean is = (n & mask) == mask; + if (is && should) + { + caller.sendMessage(ChatColor.GREEN + "Chunk " + (chunk.locX + x) + "," + (chunk.locZ + z) + " (" + x + "," + z + ") is a neighbor"); + } + else if (is && !should) + { + caller.sendMessage(ChatColor.RED + "Chunk " + (chunk.locX + x) + "," + (chunk.locZ + z) + " (" + x + "," + z + ") is a neighbor but should not be"); + } + else if (!is && should) + { + caller.sendMessage(ChatColor.RED + "Chunk " + (chunk.locX + x) + "," + (chunk.locZ + z) + " (" + x + "," + z + ") is not a neighbor but should be"); + } + else if (!is && !should) + { + caller.sendMessage(ChatColor.GREEN + "Chunk " + (chunk.locX + x) + "," + (chunk.locZ + z) + " (" + x + "," + z + ") is not a neighbor"); + } + } + } + } + catch (Throwable t) + { + t.printStackTrace(); + } + } + }); + registerDebugCommand(new DebugCommand("uhcallchunks", Rank.DEVELOPER) + { + + @Override + public void Execute(Player caller, String[] args) + { + for (net.minecraft.server.v1_8_R3.Chunk chunk : ((CraftWorld) caller.getWorld()).getHandle().chunkProviderServer.chunks.values()) + { + try + { + Field neighbors = chunk.getClass().getDeclaredField("neighbors"); + neighbors.setAccessible(true); + int n = neighbors.getInt(chunk); + + for (int x = -1; x < 2; x++) + { + for (int z = -1; z < 2; z++) + { + if (x == 0 && z == 0) + { + continue; + } + + int mask = 0x1 << (x * 5 + z + 12); + + boolean should = chunk.world.getChunkIfLoaded(chunk.locX + x, chunk.locZ + z) != null; + boolean is = (n & mask) == mask; + if (is && !should) + { + caller.sendMessage(ChatColor.RED + "Chunk " + (chunk.locX + x) + "," + (chunk.locZ + z) + " (" + x + "," + z + ") relative to " + (chunk.locX) + "," + chunk.locZ + + " is a neighbor but should not be"); + } + else if (!is && should) + { + caller.sendMessage(ChatColor.RED + "Chunk " + (chunk.locX + x) + "," + (chunk.locZ + z) + " (" + x + "," + z + ") relative to " + (chunk.locX) + "," + chunk.locZ + + " is not a neighbor but should be"); + } + } + } + } + catch (Throwable t) + { + t.printStackTrace(); + } + } + + caller.sendMessage("Done"); + } + }); } - @EventHandler - public void onLoad(ChunkLoadEvent event) + @Override + public void recruit() { - if (event.getChunk().getWorld().equals(WorldData.World) && _isTeleporting) + // todo load chunks sync here if necessary + Location spawn = GetRandomSpawn(WorldData.World.getSpawnLocation(), true); + WorldData.World.setSpawnLocation(spawn.getBlockX(), spawn.getBlockY(), spawn.getBlockZ()); + + SetState(GameState.Recruit); + } + + public void createSpawns() + { + createSpawns(new Callback() { - new Exception(event.getChunk().getX() + " " + event.getChunk().getZ()).printStackTrace(); + + @Override + public void run(Boolean data) + { + } + }); + } + + public void createSpawns(Callback callback) + { + // Disable game commands + Rank lastGameCommandsRank = Manager.getGameCommandRank(); + Manager.setGameCommandMode(null); + + // Wipe Spawns + for (GameTeam team : GetTeamList()) + { + team.GetSpawns().clear(); } - } - @EventHandler - public void onPopulate(ChunkPopulateEvent event) - { - if (event.getChunk().getWorld().equals(WorldData.World) && _isTeleporting) + double border = _border.getMaxCords(); + + // Solo Game + if (FillTeamsInOrderToCount == -1) { - new Exception(event.getChunk().getX() + " " + event.getChunk().getZ()).printStackTrace(); + List players = GetPlayers(true); + GameTeam gameTeam = GetTeamList().get(0); + + getArcadeManager().runSyncTimer(new BukkitRunnable() + { + + @Override + public void run() + { + if (gameTeam.GetSpawns().size() < Math.max(Manager.GetPlayerFull(), GetPlayers(true).size())) + { + Location loc = GetRandomSpawn(null, false); + + // Dynamically scale distance requirement based on how + // many teams need to fit + double dist = (2 * border) / (Math.sqrt(players.size()) + 3); + + // Ensure distance between Teams - 500 Attempts + for (int i = 0; i < 500; i++) + { + boolean clash = false; + + for (Location otherSpawn : gameTeam.GetSpawns()) + { + if (UtilMath.offset(loc, otherSpawn) < dist) + { + clash = true; + break; + } + } + + if (!clash) + break; + + loc = GetRandomSpawn(null, false); + } + + gameTeam.GetSpawns().add(loc); + } + else + { + Manager.setGameCommandMode(lastGameCommandsRank); + cancel(); + callback.run(true); + } + } + }, 0L, 1L); + } + else + { + getArcadeManager().runSyncTimer(new BukkitRunnable() + { + + AtomicInteger currentTeamId = new AtomicInteger(); + double border = _border.getMaxCords(); + + @Override + public void run() + { + GameTeam team = GetTeamList().get(currentTeamId.get()); + + Location loc = GetRandomSpawn(null, false); + + // Dynamically scale distance requirement based on how many + // teams need to fit + double dist = (2 * border) / (Math.sqrt(GetTeamList().size()) + 3); + + // Ensure distance between Teams - 500 Attempts + for (int i = 0; i < 500; i++) + { + boolean clash = false; + + for (GameTeam otherTeam : GetTeamList()) + { + if (otherTeam.GetSpawns().isEmpty()) + continue; + + if (UtilMath.offset(loc, otherTeam.GetSpawn()) < dist) + { + clash = true; + break; + } + } + + if (!clash) + break; + + loc = GetRandomSpawn(null, false); + } + + while (team.GetSpawns().size() < 20) + { + team.GetSpawns().add(GetRandomSpawn(loc, true)); + } + + currentTeamId.getAndIncrement(); + + if (currentTeamId.get() >= GetTeamList().size()) + { + Manager.setGameCommandMode(lastGameCommandsRank); + cancel(); + callback.run(true); + } + } + }, 0L, 1L); } } @Override public void ParseData() { - WorldData.World.setDifficulty(Difficulty.HARD); + WorldData.MinX = -MAX_ARENA_SIZE; + WorldData.MinZ = -MAX_ARENA_SIZE; + WorldData.MaxX = MAX_ARENA_SIZE; + WorldData.MaxZ = MAX_ARENA_SIZE; - WorldData.MinX = -1000; - WorldData.MinZ = -1000; - WorldData.MaxX = 1000; - WorldData.MaxZ = 1000; + WorldData.World.getEntities().forEach(Entity::remove); - int i = 0; + _border.prepare(); - for (double border : buildBorders(1000, 1000, 32)) - { - _borderPositions.put(i++ * 4, border); - } + Manager.runSyncLater(() -> { + if (!Manager.GetGame().equals(this)) + { + System.out.println("Game was switched! Stop spawn generation!"); + return; + } - WorldBorder border = WorldData.World.getWorldBorder(); - border.setCenter(0, 0); - border.setSize(_currentBorder * 2); - border.setDamageBuffer(-99); - border.setWarningDistance(-99); - border.setWarningTime(-99); + Announce(C.cGreenB + "Generating spawns... there may be some lag for a few moments"); + createSpawns(); + }, 5 * 20); + } + + @Override + public boolean loadNecessaryChunks(long timeout) + { + return true; } @EventHandler - public void onSecond(UpdateEvent event) + public void end(GameStateChangeEvent event) { - if (event.getType() != UpdateType.SEC) + if (event.GetState() != GameState.End) { return; } - if (!IsLive()) - { - return; - } - - _previousBorder = _currentBorder; - - // We half the number so this only activates every 2nd second. - if (_borderPositions.containsKey(_secondsSinceStart)) - { - _currentBorder = _borderPositions.get(_secondsSinceStart); - - _borderStartedMoving = System.currentTimeMillis(); - - WorldBorder border = WorldData.World.getWorldBorder(); - border.setSize(_currentBorder * 2, 1); - } - - _secondsSinceStart++; + _border = null; } @EventHandler public void outsideBorder(UpdateEvent event) { - if (!IsLive()) + if (event.getType() != UpdateType.FAST || !IsLive() || _state == UHCState.TELEPORTING) { return; } - if (event.getType() != UpdateType.FAST) - { - return; - } - - // The distance between the old border and the new - double distanceMovedSince = _currentBorder - _previousBorder; - - // Multiply that distance depending on how long its been since it moved. - long timeSinceMoved = System.currentTimeMillis() - _borderStartedMoving; - double percentageBorderMoved = Math.min(timeSinceMoved, 1000D) / 1000D; - - distanceMovedSince *= percentageBorderMoved; - - double border = (_previousBorder - 0.3D) + distanceMovedSince; + double border = _border.getMaxCords(); for (Player player : UtilServer.getPlayers()) { Location loc = player.getLocation(); + boolean toLow = loc.getY() - _border.getYMin() < WORLD_BORDER_PARTICLES_DISTANCE; + boolean toHigh = _border.getYMax() - loc.getY() < WORLD_BORDER_PARTICLES_DISTANCE; + + if (toLow) + { + UtilParticle.PlayParticle(ParticleType.FLAME, new Location(loc.getWorld(), loc.getX(), _border.getYMin(), loc.getZ()), 5F, 1F, 5F, 0.001F, 75, ViewDist.NORMAL, player); + } + else if (toHigh) + { + UtilParticle.PlayParticle(ParticleType.FLAME, new Location(loc.getWorld(), loc.getX(), _border.getYMax(), loc.getZ()), 5F, 1F, 5F, 0.001F, 75, ViewDist.NORMAL, player); + } + // Bump Players Back In - if (loc.getX() > border || loc.getX() < -border || loc.getZ() > border || loc.getZ() < -border) + if (loc.getX() > border || loc.getX() < -border || loc.getZ() > border || loc.getZ() < -border || loc.getY() < _border.getYMin() || loc.getY() > _border.getYMax()) { if (Recharge.Instance.use(player, "Hit by Border", 1000, false, false)) { @@ -395,20 +847,16 @@ public class UHC extends TeamGame while (bottom.getVehicle() != null) bottom = bottom.getVehicle(); - UtilAction - .velocity(bottom, UtilAlg.getTrajectory2d(loc, GetSpectatorLocation()), 1.2, true, 0.4, 0, 10, true); + UtilAction.velocity(bottom, UtilAlg.getTrajectory2d(loc, GetSpectatorLocation()), 1.2, true, 0.4, 0, 10, true); - if (Manager.IsAlive(player)) + if (!UtilPlayer.isSpectator(player)) { - Manager.GetDamage().NewDamageEvent(player, null, null, DamageCause.CUSTOM, WORLD_BORDER_DAMAGE, false, false, false, - "Nether Field", "Vaporize"); + Manager.GetDamage().NewDamageEvent(player, null, null, DamageCause.CUSTOM, WORLD_BORDER_DAMAGE, false, false, true, "Nether Field", "Vaporize"); player.getWorld().playSound(loc, Sound.NOTE_BASS, 2f, 1f); player.getWorld().playSound(loc, Sound.NOTE_BASS, 2f, 1f); - } - else - { - player.teleport(GetSpectatorLocation()); + + player.sendMessage(C.cRedB + "STAY WITHIN THE BORDER!"); } } } @@ -422,20 +870,22 @@ public class UHC extends TeamGame Location loc = ent.getLocation(); // Bump Players Back In - if (loc.getX() > border || loc.getX() < -border || loc.getZ() > border || loc.getZ() < -border) + if (loc.getX() > border || loc.getX() < -border || loc.getZ() > border || loc.getZ() < -border || loc.getY() < _border.getYMin() || loc.getY() > _border.getYMax()) { - // Can't use recharge on entities; blame bad design (mapping by name instead of uuid) -// if (Recharge.Instance.use(ent, "Hit by Border", 1000, false, false)) + // Can't use recharge on entities; blame bad design (mapping + // by name instead of uuid) + // if (Recharge.Instance.use(ent, "Hit by Border", 1000, + // false, false)) { Entity bottom = ent; while (bottom.getVehicle() != null) bottom = bottom.getVehicle(); - UtilAction - .velocity(bottom, UtilAlg.getTrajectory2d(loc, GetSpectatorLocation()), 1.2, true, 0.4, 0, 10, true); + UtilAction.velocity(bottom, UtilAlg.getTrajectory2d(loc, GetSpectatorLocation()), 1.2, true, 0.4, 0, 10, true); - Manager.GetDamage().NewDamageEvent(ent, null, null, DamageCause.CUSTOM, WORLD_BORDER_DAMAGE, false, false, false, - "Nether Field", "Vaporize"); + // If nothing else has damaged the NPC, then + // lastDamageCause will be null + Manager.GetDamage().NewDamageEvent(ent, null, null, DamageCause.VOID, WORLD_BORDER_DAMAGE, false, false, false, "Nether Field", "Vaporize"); ent.getWorld().playSound(loc, Sound.NOTE_BASS, 2f, 1f); ent.getWorld().playSound(loc, Sound.NOTE_BASS, 2f, 1f); @@ -445,222 +895,261 @@ public class UHC extends TeamGame } } - private ArrayList buildBorders(int seconds, double border, double leaveRemaining) - { - double totalNumber = Math.pow(seconds, 1.9D) + (seconds * 50); - - ArrayList borders = new ArrayList(); - - for (int i = 0; i <= seconds; i++) - { - borders.add(border - ((border - leaveRemaining) * (((Math.pow(i, 1.9D) + (i * 50))) / totalNumber))); - } - - return borders; - } - - public void generateSpawns() - { - // Wipe Spawns - for (GameTeam team : this.GetTeamList()) - { - team.GetSpawns().clear(); - } - - TimingManager.start("UHC Spawn Generation"); - - // Solo Game - if (this.GetTeamList().size() == 1) - { - while (GetTeamList().get(0).GetSpawns().size() < this.GetPlayers(true).size()) - { - Location loc = GetRandomSpawn(null, false); - - // Dynamically scale distance requirement based on how many teams need to fit - double dist = (2 * _currentBorder) / (Math.sqrt(this.GetPlayers(true).size()) + 3); - - // Ensure distance between Teams - 500 Attempts - for (int i = 0; i < 500; i++) - { - boolean clash = false; - - for (Location otherSpawn : GetTeamList().get(0).GetSpawns()) - { - if (UtilMath.offset(loc, otherSpawn) < dist) - { - clash = true; - break; - } - } - - if (!clash) - break; - - loc = GetRandomSpawn(null, false); - } - - GetTeamList().get(0).GetSpawns().add(loc); - } - } - // Team Game - else - { - for (GameTeam team : GetTeamList()) - { - Location loc = GetRandomSpawn(null, false); - - // Dynamically scale distance requirement based on how many teams need to fit - double dist = (2 * _currentBorder) / (Math.sqrt(GetTeamList().size()) + 3); - - // Ensure distance between Teams - 500 Attempts - for (int i = 0; i < 500; i++) - { - boolean clash = false; - - for (GameTeam otherTeam : GetTeamList()) - { - if (otherTeam.GetSpawns().isEmpty()) - continue; - - if (UtilMath.offset(loc, otherTeam.GetSpawn()) < dist) - { - clash = true; - break; - } - } - - if (!clash) - break; - - loc = GetRandomSpawn(null, false); - } - - _teamCenter.put(team, loc); - team.GetSpawns().add(loc); - } - } - - TimingManager.stop("UHC Spawn Generation"); - - Location spawn = GetRandomSpawn(WorldData.World.getSpawnLocation(), true); - WorldData.World.setSpawnLocation(spawn.getBlockX(), spawn.getBlockY(), spawn.getBlockZ()); - - WorldServer worldServer = ((CraftWorld) WorldData.World).getHandle(); - - // Update view distance - worldServer.spigotConfig.viewDistance = VIEW_DISTANCE; - worldServer.getPlayerChunkMap().a(VIEW_DISTANCE); - - if (Runtime.getRuntime().maxMemory() / 1024 / 1024 < 1536) - { - Announce(C.cGreen + C.Bold + "Skipping spawn pregeneration", false); - // Allow game to start - _chunkLoadingThread.flagDone(); - return; - } - - // Ensures the server does not tick us - worldServer.getMinecraftServer().worlds.remove(worldServer); - - _chunkLoadingThread.start(); - } - @EventHandler public void endPortalTransfer(final PlayerPortalEvent event) { if (event.getCause() == TeleportCause.END_PORTAL) + { event.setCancelled(true); + } } @EventHandler public void TimeUpdate(UpdateEvent event) + { + if (event.getType() != UpdateType.SEC || !IsLive()) + { + return; + } + + if (UtilTime.elapsed(GetStateTime(), SAFE_TIME) && _state == UHCState.SAFE) + { + startPvp(); + } + else if (UtilTime.elapsed(GetStateTime(), MINING_TIME) && _state == UHCState.MINING && isSpeedMode()) + { + startPreDeathmatch(); + } + } + + public void updateActionbar() { if (!IsLive()) - return; - - if (event.getType() != UpdateType.MIN_01) - return; - - _minutesSinceStart++; - - if (_minutesSinceStart < SAFE_TIME_IN_MINUTES) { - UtilTextMiddle.display(null, "PvP enabled in " + (SAFE_TIME_IN_MINUTES - _minutesSinceStart) + " minutes.", 5, 80, 5); + return; } - else if (_minutesSinceStart == SAFE_TIME_IN_MINUTES) - { - UtilTextMiddle.display(null, "PvP has been enabled!", 5, 80, 5); + String message = null; + long timeSinceStart = System.currentTimeMillis() - GetStateTime(); + + if (timeSinceStart < SAFE_TIME) + { + message = C.cYellow + "PVP enabled in " + C.Bold + UtilTime.MakeStr(SAFE_TIME - timeSinceStart); + } + else if (timeSinceStart < MINING_TIME && isSpeedMode()) + { + message = C.cRed + "Deathmatch starts in " + C.Bold + UtilTime.MakeStr(MINING_TIME - timeSinceStart); + } + + if (message != null) + { for (Player player : UtilServer.getPlayers()) - player.playSound(player.getLocation(), Sound.ENDERDRAGON_GROWL, 1f, 1f); + { + if (player.getItemInHand().getType() == Material.COMPASS) + { + continue; + } - this.DamagePvP = true; - this.CompassGiveItem = true; - this.RejoinTime = 300000; // 5 minutes - registerModule(new CombatLogModule()) - .setSpawnForCreative(false) - .setCombatLogTime(300000) - .setOnDeathAction(npc -> - { - if (npc.getLastDamager() instanceof Player) - { - Player killer = (Player) npc.getLastDamager(); - Announce(npc.getPlayerInfo().getTeamColor() + C.Bold + npc.getPlayerInfo().getName() - + C.cGray + C.Bold + " was killed by " + getArcadeManager().GetColor(killer) - + C.Bold + npc.getLastDamager().getName() + C.cGray + C.Bold + " while logged out."); - } - else - { - String cause = UtilParser.parseDamageCause(npc.getLastDamageCause()); - if (npc.getLastDamager() != null) - { - cause = npc.getLastDamager().getName(); - } - Announce(npc.getPlayerInfo().getTeamColor() + C.Bold + npc.getPlayerInfo().getName() - + C.cGray + C.Bold + " was killed by " + cause + " while logged out."); - } - - ItemStack stack = new ItemBuilder(Material.SKULL_ITEM) - .setData((byte) 3) - .setTitle(npc.getPlayerInfo().getTeamColor() + npc.getPlayerInfo().getName() + "'s Head") - .build(); - - SkullMeta meta = (SkullMeta) stack.getItemMeta(); - meta.setOwner(npc.getPlayerInfo().getName()); - stack.setItemMeta(meta); - - npc.getNPC().getWorld().dropItemNaturally(npc.getNPC().getLocation(), stack); - - Location location = npc.getNPC().getLocation(); - - for (ItemStack item : npc.getPlayerInfo().getItems()) - { - location.getWorld().dropItemNaturally(location, item); - } - }) - .setOnExpireAction(npc -> - { - ItemStack stack = new ItemBuilder(Material.SKULL_ITEM) - .setData((byte) 3) - .setTitle(npc.getPlayerInfo().getTeamColor() + npc.getPlayerInfo().getName() + "'s Head") - .build(); - - SkullMeta meta = (SkullMeta) stack.getItemMeta(); - meta.setOwner(npc.getPlayerInfo().getName()); - stack.setItemMeta(meta); - - npc.getNPC().getWorld().dropItemNaturally(npc.getNPC().getLocation(), stack); - - Location location = npc.getNPC().getLocation(); - - for (ItemStack item : npc.getPlayerInfo().getItems()) - { - location.getWorld().dropItemNaturally(location, item); - } - }); + UtilTextBottom.display(message, player); + } } } + public void startPvp() + { + if (_state.isPVP()) + { + return; + } + + _state = UHCState.MINING; + UtilTextMiddle.display(null, C.cYellow + "PvP has been enabled!", 5, 80, 5); + + for (Player player : UtilServer.getPlayers()) + { + player.playSound(player.getLocation(), Sound.ENDERDRAGON_GROWL, 1f, 1f); + } + + DamagePvP = true; + + RejoinModule rejoinModule = getModule(RejoinModule.class); + + rejoinModule.setRejoinTime((int) TimeUnit.MINUTES.toMillis(5)); + getModule(CompassModule.class).setGiveCompass(true); + new CombatLogModule().setCombatLogTime((int) rejoinModule.getRejoinTime()).register(this); + } + + public void startPreDeathmatch() + { + Announce(C.cRedB + "Deathmatch is starting... Players are being teleported!", false); + + // Set the state + _state = UHCState.TELEPORTING; + + // Freeze all players + for (Player player : GetPlayers(true)) + { + _freezer.freeze(player); + } + + // Toggle temporary game settings + Damage = false; + + // Disable rejoining + getModule(RejoinModule.class).stopAllPlayersFromRejoining(); + + // Set time + WorldTimeSet = 0; + + // Remove all monsters + for (Entity entity : WorldData.World.getEntities()) + { + if (entity instanceof Monster) + { + entity.remove(); + } + } + + // Set the border + _border.setSize(DEATHMATCH_ARENA_SIZE, 0); + + // Recreate spawns + createSpawns(new Callback() + { + + @Override + public void run(Boolean data) + { + for (GameTeam gameTeam : GetTeamList()) + { + gameTeam.SpawnTeleport(); + } + + for (Player player : UtilServer.getPlayers()) + { + if (!IsAlive(player)) + { + player.teleport(SpectatorSpawn); + } + } + } + }); + } + + public void startDeathmatch() + { + Announce(C.cRedB + "Fight!", false); + + UtilTextMiddle.display(C.cRedB + "Watch Out", "The border is closing in on all sides!"); + + // Set the state + _state = UHCState.DEATHMATCH; + + for (Player player : UtilServer.getPlayers()) + { + player.playSound(player.getLocation(), Sound.ENDERDRAGON_GROWL, 1f, 1f); + } + + // Unfreeze all players + _freezer.unfreeze(); + + // Toggle temporary game settings + Damage = true; + + // Set the border + _border.setSize(32, DEATHMATCH_TIME_SECONDS); + } + + @EventHandler + public void deathmatchTimer(UpdateEvent event) + { + // Checks to see if it is pre-deathmatch + if (event.getType() != UpdateType.SEC) + { + return; + } + + if (_state == UHCState.TELEPORTING) + { + _secondsSincePreDeathmatch++; + + if (_secondsSincePreDeathmatch < PRE_DEATHMATCH_TIME_SECONDS) + { + int seconds = PRE_DEATHMATCH_TIME_SECONDS - _secondsSincePreDeathmatch; + + Announce(C.cRedB + "Deathmatch starting in " + seconds + " second" + (seconds == 1 ? "" : "s"), false); + } + else if (_secondsSincePreDeathmatch == PRE_DEATHMATCH_TIME_SECONDS) + { + startDeathmatch(); + } + } + else if (_state == UHCState.DEATHMATCH) + { + _border.advanceYBorder(); + } + } + + @EventHandler + public void preSpawnCombatLogNPC(CombatLogNPCPreSpawnEvent event) + { + if (event.getPlayer().getGameMode() == GameMode.CREATIVE) + { + event.setCancelled(true); + } + } + + @EventHandler + public void combatLogNPCDeathEvent(CombatLogNPCKilledEvent event) + { + CombatLogNPC npc = event.getNpc(); + + if (npc.getLastDamager() instanceof Player) + { + Player killer = (Player) npc.getLastDamager(); + Announce(npc.getPlayerInfo().getTeamColor() + C.Bold + npc.getPlayerInfo().getName() + C.cGray + C.Bold + " was killed by " + getArcadeManager().GetColor(killer) + C.Bold + npc + .getLastDamager().getName() + C.cGray + C.Bold + " while logged out."); + } + else + { + String cause = UtilParser.parseDamageCause(npc.getLastDamageCause()); + if (npc.getLastDamager() != null) + { + cause = npc.getLastDamager().getName(); + } + Announce(npc.getPlayerInfo().getTeamColor() + C.Bold + npc.getPlayerInfo().getName() + C.cGray + C.Bold + " was killed by " + cause + " while logged out."); + } + + ItemStack stack = PlayerHeadModule.getGoldenHead(); + + npc.getNPC().getWorld().dropItemNaturally(npc.getNPC().getLocation(), stack); + + Location location = npc.getNPC().getLocation(); + + placeItemsInChest(npc.getPlayerInfo().getItems(), location); + + getModule(RejoinModule.class).stopPlayerFromRejoining(npc.getPlayerInfo().getName()); + } + + @EventHandler + public void combatLogNpcExpireEvent(CombatLogNPCExpiredEvent event) + { + CombatLogNPC npc = event.getNpc(); + + ItemStack stack = PlayerHeadModule.getGoldenHead(); + + npc.getNPC().getWorld().dropItemNaturally(npc.getNPC().getLocation(), stack); + + Location location = npc.getNPC().getLocation(); + + for (ItemStack item : npc.getPlayerInfo().getItems()) + { + location.getWorld().dropItemNaturally(location, item); + } + + getModule(RejoinModule.class).stopPlayerFromRejoining(npc.getPlayerInfo().getName()); + } + @EventHandler public void EarlyGameUpdate(UpdateEvent event) { @@ -670,7 +1159,7 @@ public class UHC extends TeamGame if (event.getType() != UpdateType.FAST) return; - if (DamagePvP) + if (_state.isPVP()) return; WorldData.World.setTime(2000); @@ -709,37 +1198,16 @@ public class UHC extends TeamGame } @EventHandler - public void generateWorld(GameStateChangeEvent event) + public void gameLive(GameStateChangeEvent event) { - if (event.GetState() == GameState.Dead) + if (event.GetState() != GameState.Live) { - _worldGenThread.flagStop(); - _chunkLoadingThread.flagStop(); - if (!_chunkLoadingThread.isDone()) - { - MinecraftServer.getServer().worlds.add(((CraftWorld) WorldData.World).getHandle()); - } - HandlerList.unregisterAll(_chunkLoadingThread); - -// if (_chunkUnloadTaskId != -1) -// { -// Bukkit.getScheduler().cancelTask(_chunkUnloadTaskId); -// } -// -// Iterator iterator = _loadedChunks.iterator(); -// while (iterator.hasNext()) -// { -// Chunk chunk = iterator.next(); -// WorldData.World.unloadChunk(chunk.getX(), chunk.getZ()); -// iterator.remove(); -// } - return; } - if (event.GetState() == GameState.Recruit) + if (!isSpeedMode()) { - _worldGenThread.start(); + _border.setSize(32, MINING_TIME / 1000); } } @@ -749,38 +1217,20 @@ public class UHC extends TeamGame if (!IsLive()) { event.setCancelled(true); -// _loadedChunks.add(event.getChunk()); - } - } - - @EventHandler - public void on(ChunkPreLoadEvent event) - { - if (_isTeleporting) - { - new Exception("WARNING: TRIED TO LOAD CHUNK WHILE TELEPORTING: " + event.getX() + " " + event.getZ()).printStackTrace(); } } @EventHandler(priority = EventPriority.MONITOR) public void on(PlayerKickEvent event) { - // Don't kick players while teleporting. Probably NCP trying to kick for fly or something + // Don't kick players while teleporting. Probably NCP trying to kick for + // fly or something if (_isTeleporting) { event.setCancelled(true); } } - @EventHandler(priority = EventPriority.LOWEST) - public void on(PlayerQuitEvent event) - { - if (_isTeleporting) - { - GetLocationStore().put(event.getPlayer().getName(), GetTeam(event.getPlayer()).GetSpawn()); - } - } - @EventHandler(priority = EventPriority.LOW) public void PlayerPrepare(GameStateChangeEvent event) { @@ -789,19 +1239,12 @@ public class UHC extends TeamGame if (event.GetState() != GameState.Prepare) return; - for (Map.Entry entries : _teamCenter.entrySet()) - { - while (entries.getKey().GetSpawns().size() < 20) - { - entries.getKey().GetSpawns().add(GetRandomSpawn(entries.getValue(), true)); - } - } - Manager.GetChat().Silence(1000 * 120, false); _isTeleporting = true; - List players = game.GetPlayers(true); + Map playerTeams = game.GetPlayers(true).stream().collect(Collectors.toMap(Function.identity(), this::GetTeam)); + List players = new ArrayList<>(playerTeams.keySet()); Location zero = WorldData.World.getSpawnLocation(); @@ -823,12 +1266,10 @@ public class UHC extends TeamGame player.addPotionEffect(new PotionEffect(PotionEffectType.REGENERATION, 30 * 20, 128), true); player.addPotionEffect(new PotionEffect(PotionEffectType.DAMAGE_RESISTANCE, 30 * 20, 128), true); - game.ValidateKit(player, game.GetTeam(player)); if (game.GetKit(player) != null) game.GetKit(player).ApplyKit(player); - } Announce(C.cGreen + C.Bold + "Please wait, you will be teleported soon", false); @@ -837,100 +1278,77 @@ public class UHC extends TeamGame Map teleportedLocations = new HashMap<>(); - AtomicInteger id = new AtomicInteger(); - id.set(UtilServer.getServer().getScheduler().runTaskTimer(Manager.getPlugin(), () -> + getArcadeManager().runSyncTimer(new BukkitRunnable() { - _teleportedPlayers++; - if (_teleportedPlayers >= players.size()) + @Override + public void run() { - Announce(C.cGreen + C.Bold + "The game will start in 5 seconds", false); - Manager.runSyncLater(() -> + _teleportedPlayers++; + if (_teleportedPlayers >= players.size()) { - try - { - for (Player player : players) + Announce(C.cGreen + C.Bold + "The game will start in 5 seconds", false); + Manager.runSyncLater(() -> { + try { - GameTeam team = game.GetTeam(player); - if (team != null) + for (Player player : players) { - if (teleportedLocations.get(player.getUniqueId()) != null) + GameTeam team = game.GetTeam(player); + if (team != null) { - team.SpawnTeleport(player, teleportedLocations.get(player.getUniqueId())); + if (teleportedLocations.get(player.getUniqueId()) != null) + { + team.SpawnTeleport(player, teleportedLocations.get(player.getUniqueId())); + } } + + // Heal + player.setHealth(player.getMaxHealth()); + // Resistance and regen + player.addPotionEffect(new PotionEffect(PotionEffectType.REGENERATION, 10 * 20, 128), true); + player.addPotionEffect(new PotionEffect(PotionEffectType.DAMAGE_RESISTANCE, 10 * 20, 128), true); } - // Heal - player.setHealth(player.getMaxHealth()); - // Resistance and regen - player.addPotionEffect(new PotionEffect(PotionEffectType.REGENERATION, 10 * 20, 128), true); - player.addPotionEffect(new PotionEffect(PotionEffectType.DAMAGE_RESISTANCE, 10 * 20, 128), true); + teleportedLocations.clear(); } - - teleportedLocations.clear(); - } - finally - { - game.AnnounceGame(); - game.StartPrepareCountdown(); - - //Event - GamePrepareCountdownCommence gamePrepareCountdownCommence = new GamePrepareCountdownCommence(game); - UtilServer.getServer().getPluginManager().callEvent(gamePrepareCountdownCommence); - - _isTeleporting = false; - - Manager.runSyncLater(() -> + finally { - WorldData.World.setAutoSave(true); + game.AnnounceGame(); + game.StartPrepareCountdown(); -// _chunkUnloadTaskId = Bukkit.getScheduler().runTaskTimer(getArcadeManager().getPlugin(), () -> -// { -// Iterator iterator = _loadedChunks.iterator(); -// int amount = 0; -// -// while (amount < CHUNKS_UNLOAD_PER_TICK && iterator.hasNext()) -// { -// if (WorldData == null || WorldData.World == null) -// { -// Bukkit.getScheduler().cancelTask(_chunkUnloadTaskId); -// return; -// } -// -// Chunk next = iterator.next(); -// WorldData.World.unloadChunkRequest(next.getX(), next.getZ()); -// iterator.remove(); -// amount++; -// } -// -// if (_loadedChunks.size() == 0) -// { -// Bukkit.getScheduler().cancelTask(_chunkUnloadTaskId); -// } -// }, CHUNKS_UNLOAD_DELAY, CHUNKS_UNLOAD_PERIOD).getTaskId(); - }, 10 * 20L); - } - }, 5 * 20L); - Bukkit.getServer().getScheduler().cancelTask(id.get()); - return; + // Event + GamePrepareCountdownCommence gamePrepareCountdownCommence = new GamePrepareCountdownCommence(game); + UtilServer.getServer().getPluginManager().callEvent(gamePrepareCountdownCommence); + + _isTeleporting = false; + } + }, 5 * 20L); + cancel(); + return; + } + + Player player = players.get(_teleportedPlayers); + GameTeam team = game.GetTeam(player); + + // This could happen if the player left (and rejoined) while + // teleporting + // Team maps based on player as a key + if (team != null) + { + // Save where they teleported + teleportedLocations.put(player.getUniqueId(), team.SpawnTeleport(player)); + + // Event + PlayerPrepareTeleportEvent playerStateEvent = new PlayerPrepareTeleportEvent(game, player); + UtilServer.getServer().getPluginManager().callEvent(playerStateEvent); + } + else + { + GetLocationStore().put(player.getName(), playerTeams.get(player).GetSpawn()); + } } + }, 5 * 20L, DELAY_BETWEEN_PLAYER_TELEPORT); - Player player = players.get(_teleportedPlayers); - GameTeam team = game.GetTeam(player); - - // This could happen if the player left (and rejoined) while teleporting - // Team maps based on player as a key - if (team != null) - { - // Save where they teleported - teleportedLocations.put(player.getUniqueId(), team.SpawnTeleport(player)); - - //Event - PlayerPrepareTeleportEvent playerStateEvent = new PlayerPrepareTeleportEvent(game, player); - UtilServer.getServer().getPluginManager().callEvent(playerStateEvent); - } - }, 5 * 20L, DELAY_BETWEEN_PLAYER_TELEPORT).getTaskId()); - - //Spectators Move + // Spectators Move for (Player player : UtilServer.getPlayers()) { if (Manager.GetGame().IsAlive(player)) @@ -938,6 +1356,7 @@ public class UHC extends TeamGame Manager.addSpectator(player, true); } + } @Override @@ -948,97 +1367,17 @@ public class UHC extends TeamGame return SpectatorSpawn; } - SpectatorSpawn = WorldData.World.getSpawnLocation(); - - SpectatorSpawn.add(0, 10, 0); + SpectatorSpawn = new Location(WorldData.World, 0, 60, 0); SpectatorSpawn = SpectatorSpawn.getBlock().getLocation().add(0.5, 0.1, 0.5); - while (SpectatorSpawn.getBlock().getTypeId() != 0 || SpectatorSpawn.getBlock().getRelative(BlockFace.UP).getTypeId() != 0) + while (SpectatorSpawn.getBlock().getType() != Material.AIR || SpectatorSpawn.getBlock().getRelative(BlockFace.UP).getType() != Material.AIR) SpectatorSpawn.add(0, 1, 0); return SpectatorSpawn; } - // fixme flowing water and stuff - - @EventHandler - public void preventBlockPlacement(BlockPlaceEvent event) - { - if (isInSafeZone(event.getBlock().getLocation())) - { - UtilPlayer.message(event.getPlayer(), F.main("Game", "You cannot build this high near center of map.")); - event.setCancelled(true); - } - } - - @EventHandler - public void preventStructureGrow(StructureGrowEvent event) - { - Iterator blocks = event.getBlocks().iterator(); - while (blocks.hasNext()) - { - BlockState next = blocks.next(); - if (isInSafeZone(next.getLocation())) - { - blocks.remove(); - } - } - } - - @EventHandler - public void preventBlockGrow(BlockGrowEvent event) - { - if (isInSafeZone(event.getBlock().getLocation())) - { - event.setCancelled(true); - } - } - - @EventHandler - public void preventBoneMeal(PlayerInteractEvent event) - { - if (event.getAction() == Action.RIGHT_CLICK_BLOCK) - { - boolean isIllegal = false; - if (!isIllegal) - { - isIllegal = event.getPlayer().getItemInHand().getType() == Material.INK_SACK && - event.getPlayer().getItemInHand().getData().getData() == (byte) 15; - } - - if (isIllegal && isInSafeZone(event.getClickedBlock().getLocation())) - { - event.setCancelled(true); - } - } - } - - @EventHandler - public void preventPistons(BlockPistonExtendEvent event) - { - boolean willBeUnsafe = false; - for (Block block : event.getBlocks()) - { - if (isInSafeZone(block.getRelative(event.getDirection()).getLocation())) - { - willBeUnsafe = true; - break; - } - } - if (willBeUnsafe) - { - event.setCancelled(true); - } - } - - private boolean isInSafeZone(Location location) - { - return location.getX() <= SAFE_REGION && location.getX() >= -SAFE_REGION - && location.getZ() <= SAFE_REGION && location.getZ() >= -SAFE_REGION; - } - - private Location GetRandomSpawn(Location around, boolean sameChunk) + public Location GetRandomSpawn(Location around, boolean sameChunk) { int tries = 0; @@ -1058,9 +1397,12 @@ public class UHC extends TeamGame if (around == null) { - // Return a int from 0 - 1800, then remove 900 so its a int from -900 to 900 - int x = (int) (UtilMath.r((int) (1.8 * _currentBorder)) - (0.9 * _currentBorder)); - int z = (int) (UtilMath.r((int) (1.8 * _currentBorder)) - (0.9 * _currentBorder)); + double currentBorder = _border.getMaxCords(); + + // Return a int from 0 - 1800, then remove 900 so its a int from + // -900 to 900 + int x = (int) (UtilMath.r((int) (1.8 * currentBorder)) - (0.9 * currentBorder)); + int z = (int) (UtilMath.r((int) (1.8 * currentBorder)) - (0.9 * currentBorder)); targetBlock = UtilBlock.getHighest(WorldData.World, x, z, null); } @@ -1080,8 +1422,7 @@ public class UHC extends TeamGame } else { - targetBlock = UtilBlock.getHighest(WorldData.World, around.getBlockX() - 4 + UtilMath.r(tries < 10 ? 8 : 30), around.getBlockZ() - 4 - + UtilMath.r(tries < 10 ? 8 : 30), null); + targetBlock = UtilBlock.getHighest(WorldData.World, around.getBlockX() - 4 + UtilMath.r(tries < 10 ? 8 : 30), around.getBlockZ() - 4 + UtilMath.r(tries < 10 ? 8 : 30), null); } } @@ -1111,6 +1452,24 @@ public class UHC extends TeamGame } } + public void placeItemsInChest(Collection drops, Location location) + { + // Place their items in a chest + Block block = location.getBlock(); + + block.setType(Material.CHEST); + block.getRelative(BlockFace.NORTH).setType(Material.CHEST); + + Chest chest = (Chest) block.getState(); + Inventory inventory = chest.getInventory(); + int i = 0; + + for (ItemStack itemStack : drops) + { + inventory.setItem(i++, itemStack); + } + } + @EventHandler public void GhastDrops(EntityDeathEvent event) { @@ -1121,36 +1480,7 @@ public class UHC extends TeamGame } } - @EventHandler(priority = EventPriority.LOWEST) - public void PlayerQuitDropItems(PlayerQuitEvent event) - { - Player player = event.getPlayer(); - - GameTeam team = GetTeam(player); - if (team == null) - return; - - if (!IsAlive(player)) - return; - - if (!QuitOut) - return; - - // Drop Items - UtilInv.drop(player, true); - - // Skull Drop - ItemStack stack = ItemStackFactory.Instance.CreateStack(Material.SKULL_ITEM, (byte) 3, 1, - team.GetColor() + player.getName() + "'s Head"); - - SkullMeta meta = (SkullMeta) stack.getItemMeta(); - meta.setOwner(player.getName()); - stack.setItemMeta(meta); - - event.getPlayer().getWorld().dropItemNaturally(player.getEyeLocation(), stack); - } - - @EventHandler + @EventHandler(priority = EventPriority.HIGHEST) public void PlayerDeath(PlayerDeathEvent event) { Player player = event.getEntity(); @@ -1159,19 +1489,8 @@ public class UHC extends TeamGame if (team == null) return; - // Skull Drop - ItemStack stack = ItemStackFactory.Instance.CreateStack(Material.SKULL_ITEM, (byte) 3, 1, - team.GetColor() + player.getName() + "'s Head"); - - SkullMeta meta = (SkullMeta) stack.getItemMeta(); - meta.setOwner(player.getName()); - stack.setItemMeta(meta); - - event.getDrops().add(stack); - // Lightning Location loc = player.getLocation(); - loc.setY(-150); player.getWorld().strikeLightningEffect(loc); // Gems @@ -1179,6 +1498,8 @@ public class UHC extends TeamGame { long timeAlive = System.currentTimeMillis() - GetStateTime(); AddGems(player, timeAlive / 60000d, "Survived " + UtilTime.MakeStr(timeAlive), false, false); + + placeItemsInChest(event.getDrops(), loc); } } @@ -1199,8 +1520,7 @@ public class UHC extends TeamGame // Simple if (killer != null) { - Announce(Manager.GetColor(dead) + C.Bold + dead.getName() + C.cGray + C.Bold + " was killed by " - + Manager.GetColor(killer) + C.Bold + killer.getName() + C.cGray + C.Bold + "."); + Announce(Manager.GetColor(dead) + C.Bold + dead.getName() + C.cGray + C.Bold + " was killed by " + Manager.GetColor(killer) + C.Bold + killer.getName() + C.cGray + C.Bold + "."); } else { @@ -1211,8 +1531,7 @@ public class UHC extends TeamGame else { - Announce(Manager.GetColor(dead) + C.Bold + dead.getName() + C.cGray + C.Bold + " was killed by " - + log.GetAttackers().getFirst().GetName() + "."); + Announce(Manager.GetColor(dead) + C.Bold + dead.getName() + C.cGray + C.Bold + " was killed by " + log.GetAttackers().getFirst().GetName() + "."); } } } @@ -1268,71 +1587,6 @@ public class UHC extends TeamGame goldMelon.addIngredient(1, Material.MELON); goldMelon.addIngredient(1, Material.GOLD_BLOCK); UtilServer.getServer().addRecipe(goldMelon); - - ShapedRecipe headApple2 = new ShapedRecipe(new ItemStack(Material.GOLDEN_APPLE, 1)); - headApple2.shape("GGG", "GHG", "GGG"); - headApple2.setIngredient('G', Material.GOLD_INGOT); - headApple2.setIngredient('H', new MaterialData(Material.SKULL_ITEM, (byte) 3)); - UtilServer.getServer().addRecipe(headApple2); - } - - @EventHandler(priority = EventPriority.HIGH) - public void CraftGoldenAppleDeny(PrepareItemCraftEvent event) - { - if (event.getRecipe().getResult() == null) - return; - - Material type = event.getRecipe().getResult().getType(); - - if (type != Material.GOLDEN_APPLE) - return; - - if (!(event.getInventory() instanceof CraftingInventory)) - return; - - CraftingInventory inv = (CraftingInventory) event.getInventory(); - - for (ItemStack item : inv.getMatrix()) - if (item != null && item.getType() != Material.AIR) - if (item.getType() == Material.GOLD_INGOT) - return; - - inv.setResult(null); - } - - @EventHandler(priority = EventPriority.HIGH) - public void CraftGoldenAppleHead(PrepareItemCraftEvent event) - { - if (event.getRecipe().getResult() == null) - return; - - Material type = event.getRecipe().getResult().getType(); - - if (type != Material.GOLDEN_APPLE) - return; - - if (!(event.getInventory() instanceof CraftingInventory)) - return; - - CraftingInventory inv = (CraftingInventory) event.getInventory(); - - for (ItemStack item : inv.getMatrix()) - if (item != null && item.getType() != Material.AIR) - if (item.getType() == Material.SKULL_ITEM || item.getType() == Material.SKULL) - { - if (item.getItemMeta() == null) - continue; - - if (item.getItemMeta().getDisplayName() == null) - continue; - - ItemStack apple = ItemStackFactory.Instance.CreateStack(Material.GOLDEN_APPLE, (byte) 0, 1, item - .getItemMeta().getDisplayName() + ChatColor.AQUA + " Golden Apple"); - apple.addUnsafeEnchantment(Enchantment.ARROW_DAMAGE, 1); - - inv.setResult(apple); - return; - } } @EventHandler(priority = EventPriority.HIGH) @@ -1346,10 +1600,7 @@ public class UHC extends TeamGame if (type != Material.SPECKLED_MELON) return; - if (!(event.getInventory() instanceof CraftingInventory)) - return; - - CraftingInventory inv = (CraftingInventory) event.getInventory(); + CraftingInventory inv = event.getInventory(); // Allow FULL BLOCK Gold Melon for (ItemStack item : inv.getMatrix()) @@ -1367,47 +1618,6 @@ public class UHC extends TeamGame event.setCancelled(true); } - @EventHandler - public void HeadPlaceCancel(BlockPlaceEvent event) - { - if (event.getItemInHand().getType() == Material.SKULL || event.getItemInHand().getType() == Material.SKULL_ITEM) - event.setCancelled(true); - } - - @EventHandler(priority = EventPriority.MONITOR) - public void HeadPickup(PlayerPickupItemEvent event) - { - if (!IsLive()) - return; - - if (event.isCancelled()) - return; - - if (event.getItem().getItemStack().getType() == Material.SKULL_ITEM) - { - UtilPlayer.message(event.getPlayer(), " "); - UtilPlayer.message(event.getPlayer(), C.cGreen + C.Bold + "You picked up a Player Head!"); - UtilPlayer.message(event.getPlayer(), C.cWhite + "Craft a Golden Head Apple with it for ultimate healing."); - UtilPlayer.message(event.getPlayer(), C.cWhite + "Use the recipe for Golden Apple, but Head replaces Apple."); - UtilPlayer.message(event.getPlayer(), " "); - } - } - - @EventHandler - public void ConsumeHeadApple(PlayerItemConsumeEvent event) - { - if (event.getItem().getItemMeta().getDisplayName() == null) - return; - - if (!event.getItem().getItemMeta().getDisplayName().contains("Head")) - return; - - UtilPlayer.message(event.getPlayer(), "You ate " + event.getItem().getItemMeta().getDisplayName()); - - (new PotionEffect(PotionEffectType.ABSORPTION, 2400, 0)).apply(event.getPlayer()); - (new PotionEffect(PotionEffectType.REGENERATION, 200, 1)).apply(event.getPlayer()); - } - @EventHandler public void NetherObsidianCancel(BlockPlaceEvent event) { @@ -1415,8 +1625,7 @@ public class UHC extends TeamGame { if (event.getBlock().getType() == Material.OBSIDIAN) { - UtilPlayer.message(event.getPlayer(), - F.main("Game", "You cannot place " + F.elem("Obsidian") + " in the " + F.elem("Nether") + ".")); + UtilPlayer.message(event.getPlayer(), F.main("Game", "You cannot place " + F.elem("Obsidian") + " in the " + F.elem("Nether") + ".")); event.setCancelled(true); } } @@ -1456,12 +1665,26 @@ public class UHC extends TeamGame event.setCancelled(false); } + @EventHandler + public void stopPoison(EntityDamageEvent event) + { + if (event.getCause() != DamageCause.POISON || !(event.getEntity() instanceof LivingEntity)) + { + return; + } + + ((LivingEntity) event.getEntity()).removePotionEffect(PotionEffectType.POISON); + event.setCancelled(true); + } + @Override public void EndCheck() { if (!IsLive()) return; + boolean end = false; + // Solo if (GetTeamList().size() == 1) { @@ -1486,23 +1709,22 @@ public class UHC extends TeamGame if (player.isOnline()) AddGems(player, 10, "Participation", false, false); - // End - SetState(GameState.End); + end = true; } } else { - ArrayList teamsAlive = new ArrayList(); - // Online Teams - for (GameTeam team : this.GetTeamList()) - if (team.GetPlayers(true).size() > 0) - teamsAlive.add(team); + List teamsAlive = GetTeamList().stream().filter(team -> team.GetPlayers(true).size() > 0).collect(Collectors.toList()); // Offline Player Team - if (!QuitOut) - for (GameTeam team : RejoinTeam.values()) - teamsAlive.add(team); + if (teamsAlive.size() > 1) + { + for (RejoinPlayerData data : getModule(RejoinModule.class).getData()) + { + teamsAlive.add(data.getTeam()); + } + } if (teamsAlive.size() <= 1) { @@ -1523,25 +1745,33 @@ public class UHC extends TeamGame { AnnounceEnd(teamsAlive.get(0)); } - SetState(GameState.End); + + end = true; } } + + if (end) + { + _border.stop(); + + // End + SetState(GameState.End); + } } @Override @EventHandler public void ScoreboardUpdate(UpdateEvent event) { - if (event != null && event.getType() != UpdateType.FAST) + if (event.getType() != UpdateType.FAST || !InProgress()) + { return; + } - ScoreboardWrite(); - } + // Take this time to update the actionbar + updateActionbar(); - public void ScoreboardWrite() - { Scoreboard.reset(); - Scoreboard.writeNewLine(); // Solo @@ -1549,7 +1779,7 @@ public class UHC extends TeamGame { if (GetPlayers(true).size() < 8) { - Scoreboard.writeGroup(GetPlayers(true), player -> Pair.create(player.getName(), GetHealth(player)), true); + Scoreboard.writeGroup(GetPlayers(true), player -> Pair.create(GetTeam(player).GetColor() + player.getName(), (int) player.getHealth()), true); } else { @@ -1560,20 +1790,14 @@ public class UHC extends TeamGame // Team else { - ArrayList aliveList = new ArrayList(); - - for (GameTeam team : GetTeamList()) - if (team.IsTeamAlive()) - aliveList.add(team); - - if (GetPlayers(true).size() < 8) + if (GetPlayers(true).size() < 7) { - Scoreboard.writeGroup(GetPlayers(true), player -> Pair.create(GetTeam(player).GetColor() + player.getName(), GetHealth(player)), true); + Scoreboard.writeGroup(GetPlayers(true), player -> Pair.create(GetTeam(player).GetColor() + player.getName(), (int) player.getHealth()), true); } else { Scoreboard.write(C.cYellow + C.Bold + "Teams"); - Scoreboard.write(aliveList.size() + " Alive"); + Scoreboard.write(GetTeamList().stream().filter(GameTeam::IsTeamAlive).count() + " Alive"); } } @@ -1582,7 +1806,8 @@ public class UHC extends TeamGame if (GetState() == GameState.Prepare) { int players = _teleportedPlayers + 1; - if (players > _totalPlayers) players = _totalPlayers; + if (players > _totalPlayers) + players = _totalPlayers; Scoreboard.write("Teleporting Players (" + players + "/" + _totalPlayers + ")"); } else if (GetState() == GameState.Live) @@ -1594,9 +1819,15 @@ public class UHC extends TeamGame Scoreboard.write("Finished"); } + double currentBorder = _border.getMaxCords(); + Scoreboard.writeNewLine(); Scoreboard.write(C.cYellow + C.Bold + "Borders"); - Scoreboard.write("-" + (int) _currentBorder + " to " + "+" + (int) _currentBorder); + Scoreboard.write("-" + (int) currentBorder + " to " + "+" + (int) currentBorder); + if (_state == UHCState.DEATHMATCH) + { + Scoreboard.write("Vert: " + (int) _border.getYMin() + " to " + (int) _border.getYMax()); + } Scoreboard.draw(); @@ -1606,76 +1837,13 @@ public class UHC extends TeamGame } } - public int GetHealth(Player player) - { - return (int) Math.ceil(player.getHealth()); - } - - @Override - public boolean CanJoinTeam(GameTeam team) - { - return team.GetSize() < 2; - } - - // Ensure 2 players per team - @Override - public GameTeam ChooseTeam(Player player) - { - GameTeam team = null; - - // Random Team - for (int i = 0; i < _teamList.size(); i++) - { - if (_teamList.get(i).GetSize() == 1) - return _teamList.get(i); - - if (team == null || _teamList.get(i).GetSize() < team.GetSize()) - { - team = _teamList.get(i); - } - } - - return team; - } - - @EventHandler - public void TeamRename(GameStateChangeEvent event) - { - if (event.GetState() != GameState.Live) - return; - - for (GameTeam team : GetTeamList()) - { - // Big Team - if (team.GetSize() > 2) - { - team.SetName("Team " + team.GetName()); - continue; - } - - String name = ""; - - for (int i = 0; i < team.GetPlayers(false).size(); i++) - { - Player player = team.GetPlayers(false).get(i); - - name += player.getName(); - - if (i < team.GetPlayers(false).size() - 1) - name += " & "; - } - - team.SetName(name); - } - } - @Override public double GetKillsGems(Player killer, Player killed, boolean assist) { if (killer.equals(killed)) return 0; - if (GetTeam(killer) != null && GetTeam(killed) != null && GetTeam(killer).equals(GetTeam(killed))) + if (GetTeam(killer) != null && GetTeam(killed) != null && GetTeam(killer).equals(GetTeam(killed)) && FillTeamsInOrderToCount != -1) return 0; if (assist) @@ -1684,143 +1852,45 @@ public class UHC extends TeamGame return 200; } - @EventHandler - public void damageCancel(EntityDamageEvent event) + public void addUHCAchievement(Player player, String achievement) { - if (!IsLive()) - event.setCancelled(true); - - // Damagee - Player damagee = null; - if (event.getEntity() instanceof Player) + if (!Manager.IsRewardStats()) { - damagee = (Player) event.getEntity(); - - // Dead - if (!IsAlive(damagee)) - event.setCancelled(true); + return; } - // Damager - LivingEntity damagerEnt = UtilEvent.GetDamagerEntity(event, true); + Map stats = GetStats().get(player); + String gameType = null; - if (damagerEnt instanceof Player) + if (isSpeedMode()) { - // PvP - if (!DamagePvP && damagee != null) - event.setCancelled(true); - - Player damager = (Player) damagerEnt; - - // Dead - if (!IsAlive(damager)) - event.setCancelled(true); - - // Same Team - if (damagee != null) - if (GetTeam(damager) != null && GetTeam(damagee) != null && GetTeam(damager).equals(GetTeam(damagee))) - { - event.setCancelled(true); - } - } - } - - public String getMotdStatus() - { - // In Progress - if (InProgress()) - { - return ChatColor.YELLOW + "In Progress"; - } - - // Ended - if (GetState() == GameState.End || GetState() == GameState.Dead) - { - return ChatColor.YELLOW + "In Progress"; - } - - if (!_worldGenThread.isMapLoaded()) - { - return ChatColor.GREEN + "Generating Map (" + C.cWhite + _worldGenThread.getProgress() + C.cGreen + ")"; - } - - if (!_chunkLoadingThread.isDone()) - { - return ChatColor.GREEN + "Generating Spawns (" + C.cWhite + _chunkLoadingThread.getProgress() + C.cGreen + ")"; - } - - return ChatColor.GREEN + "Recruiting"; - } - - public boolean isMapLoaded() - { - return _worldGenThread.isMapLoaded() && _chunkLoadingThread.isDone(); - } - - public String getObjectiveName(boolean _colorTick) - { - if (!_worldGenThread.isMapLoaded()) - { - return _worldGenThread.getProgress() + " " + (_colorTick ? ChatColor.GREEN : ChatColor.YELLOW) + "§l" + "Generating Map"; + gameType = "Ultra Hardcore Speed"; } else { - return _chunkLoadingThread.getProgress() + " " + (_colorTick ? ChatColor.GREEN : ChatColor.YELLOW) + "§l" + "Generating Spawns"; + gameType = "Ultra Hardcore"; } + + stats.put(gameType + "." + achievement, 1); } - private static int _gamesRun = 0; - - @EventHandler - public void on(PlayerCommandPreprocessEvent event) + public UHCBorder getBorder() { - if (event.getMessage().equals("/uhcgc")) + return _border; + } + + public boolean isSpeedMode() + { + return _speedMode != null; + } + + public enum UHCState + { + SAFE, MINING, TELEPORTING, DEATHMATCH; + + public boolean isPVP() { - CoreClient client = getArcadeManager().GetClients().Get(event.getPlayer()); - if (client.GetRank().has(Rank.DEVELOPER)) - { - System.gc(); - event.getPlayer().sendMessage("Cleaned up"); - event.setCancelled(true); - } - } - else if (event.getMessage().equals("/uhcworlds")) - { - CoreClient client = getArcadeManager().GetClients().Get(event.getPlayer()); - if (client.GetRank().has(Rank.DEVELOPER)) - { - MinecraftServer minecraftServer = MinecraftServer.getServer(); - - int nms = minecraftServer.worlds.size(); - int bukkit = Bukkit.getWorlds().size(); - - if (nms != bukkit) - { - event.getPlayer().sendMessage(ChatColor.RED + "Bukkit and NMS world counts don't match: " + nms + " vs " + bukkit); - } - - for (org.bukkit.World world : Bukkit.getWorlds()) - { - WorldServer worldServer = ((CraftWorld) world).getHandle(); - event.getPlayer().sendMessage("Bukkit world: " + worldServer.getWorldData().getName() + " loaded chunks: " + worldServer.chunkProviderServer.chunks.size() + " saving: " + worldServer.savingDisabled + " unload queue: " + worldServer.chunkProviderServer.unloadQueue.size()); - } - - for (WorldServer worldServer : minecraftServer.worlds) - { - event.getPlayer().sendMessage("NMS world: " + worldServer.getWorldData().getName() + " loaded chunks: " + worldServer.chunkProviderServer.chunks.size() + " saving: " + worldServer.savingDisabled + " unload queue: " + worldServer.chunkProviderServer.unloadQueue.size()); - } - - event.setCancelled(true); - } - } - else if (event.getMessage().equals("/uhcgames")) - { - CoreClient client = getArcadeManager().GetClients().Get(event.getPlayer()); - if (client.GetRank().has(Rank.DEVELOPER)) - { - event.getPlayer().sendMessage("Games run: " + _gamesRun); - event.setCancelled(true); - } + return this != SAFE; } } } \ No newline at end of file diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/uhc/UHCSolo.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/uhc/UHCSolo.java new file mode 100644 index 000000000..c310de91b --- /dev/null +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/uhc/UHCSolo.java @@ -0,0 +1,91 @@ +package nautilus.game.arcade.game.games.uhc; + +import java.util.ArrayList; +import java.util.Arrays; +import java.util.List; + +import org.bukkit.ChatColor; +import org.bukkit.entity.Player; +import org.bukkit.event.EventHandler; + +import nautilus.game.arcade.ArcadeManager; +import nautilus.game.arcade.GameType; +import nautilus.game.arcade.events.GameStateChangeEvent; +import nautilus.game.arcade.game.GameTeam; + +public class UHCSolo extends UHC +{ + + public UHCSolo(ArcadeManager manager) + { + this(manager, GameType.UHCSolo); + } + + public UHCSolo(ArcadeManager manager, GameType type) + { + this(manager, type, false); + } + + public UHCSolo(ArcadeManager manager, GameType type, boolean speedMode) + { + super(manager, type, speedMode); + + DamageTeamSelf = true; + SpawnNearAllies = false; + } + + @EventHandler + public void playerTeamGeneration(GameStateChangeEvent event) + { + if (event.GetState() != GameState.Recruit) + { + return; + } + + _teamList = new ArrayList<>(Arrays.asList(_teamList.get(0))); + + for (GameTeam team : _teamList) + { + team.SetName("Players"); + team.SetColor(ChatColor.YELLOW); + } + } + + @Override + public List getWinners() + { + if (GetState().ordinal() >= GameState.End.ordinal()) + { + List places = GetTeamList().get(0).GetPlacements(true); + + if (places.isEmpty() || !places.get(0).isOnline()) + return Arrays.asList(); + else + return Arrays.asList(places.get(0)); + } + else + return null; + } + + @Override + public List getLosers() + { + List winners = getWinners(); + + if (winners == null) + return null; + + List losers = GetTeamList().get(0).GetPlayers(false); + + losers.removeAll(winners); + + return losers; + } + + @Override + public String GetMode() + { + return "UHC Solo"; + } + +} diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/uhc/UHCSoloSpeed.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/uhc/UHCSoloSpeed.java new file mode 100644 index 000000000..13f56e90f --- /dev/null +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/uhc/UHCSoloSpeed.java @@ -0,0 +1,24 @@ +package nautilus.game.arcade.game.games.uhc; + +import java.util.concurrent.TimeUnit; + +import nautilus.game.arcade.ArcadeManager; +import nautilus.game.arcade.GameType; + +public class UHCSoloSpeed extends UHCSolo +{ + + public UHCSoloSpeed(ArcadeManager manager) + { + super(manager, GameType.UHCSoloSpeed, true); + + MINING_TIME = (int) TimeUnit.MINUTES.toMillis(20); + } + + @Override + public String GetMode() + { + return "UHC Solo Speed"; + } + +} diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/uhc/UHCTeams.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/uhc/UHCTeams.java new file mode 100644 index 000000000..654594d2e --- /dev/null +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/uhc/UHCTeams.java @@ -0,0 +1,128 @@ +package nautilus.game.arcade.game.games.uhc; + +import java.util.ArrayList; +import java.util.List; + +import org.bukkit.entity.Player; +import org.bukkit.event.EventHandler; +import org.bukkit.event.EventPriority; +import org.bukkit.event.player.PlayerQuitEvent; + +import nautilus.game.arcade.ArcadeManager; +import nautilus.game.arcade.GameType; +import nautilus.game.arcade.events.GameStateChangeEvent; +import nautilus.game.arcade.game.GameTeam; +import nautilus.game.arcade.game.modules.TeamModule; + +public class UHCTeams extends UHC +{ + + public UHCTeams(ArcadeManager manager) + { + this(manager, GameType.UHC); + } + + public UHCTeams(ArcadeManager manager, GameType type) + { + this(manager, type, false); + } + + public UHCTeams(ArcadeManager manager, GameType type, boolean speedMode) + { + super(manager, type, speedMode); + + FillTeamsInOrderToCount = 2; + DamageTeamSelf = false; + DontAllowOverfill = true; + ShowTeammateMessage = true; + + // Load the Team Module + new TeamModule().register(this); + } + + @EventHandler(priority = EventPriority.LOW) + public void PlayerQuit(PlayerQuitEvent event) + { + if (!InProgress()) + return; + + Player player = event.getPlayer(); + + GameTeam team = GetTeam(player); + if (team == null) return; + + if (!team.IsAlive(player)) + return; + + team.RemovePlayer(player); + } + + @EventHandler + public void TeamRename(GameStateChangeEvent event) + { + if (event.GetState() != GameState.Live) + { + return; + } + + for (GameTeam team : GetTeamList()) + { + // Big Team + if (team.GetSize() > 2) + { + team.SetName("Team " + team.GetName()); + continue; + } + + String name = ""; + List players = team.GetPlayers(false); + + for (int i = 0; i < players.size(); i++) + { + Player player = players.get(i); + + name += player.getName(); + + if (i < players.size() - 1) + { + name += " & "; + } + } + + team.SetName(name); + } + } + + @Override + public List getWinners() + { + if (WinnerTeam == null) + return null; + + return WinnerTeam.GetPlayers(false); + } + + @Override + public List getLosers() + { + if (WinnerTeam == null) + return null; + + List players = new ArrayList<>(); + + for (GameTeam team : GetTeamList()) + { + if (team != WinnerTeam) + players.addAll(team.GetPlayers(false)); + } + + return players; + } + + @Override + public String GetMode() + { + return "UHC Teams"; + } + +} diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/uhc/UHCTeamsSpeed.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/uhc/UHCTeamsSpeed.java new file mode 100644 index 000000000..fa5f5fe35 --- /dev/null +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/uhc/UHCTeamsSpeed.java @@ -0,0 +1,24 @@ +package nautilus.game.arcade.game.games.uhc; + +import java.util.concurrent.TimeUnit; + +import nautilus.game.arcade.ArcadeManager; +import nautilus.game.arcade.GameType; + +public class UHCTeamsSpeed extends UHCTeams +{ + + public UHCTeamsSpeed(ArcadeManager manager) + { + super(manager, GameType.UHCTeamsSpeed, true); + + MINING_TIME = (int) TimeUnit.MINUTES.toMillis(20); + } + + @Override + public String GetMode() + { + return "UHC Teams Speed"; + } + +} diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/uhc/components/UHCBorder.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/uhc/components/UHCBorder.java new file mode 100644 index 000000000..4e11057be --- /dev/null +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/uhc/components/UHCBorder.java @@ -0,0 +1,106 @@ +package nautilus.game.arcade.game.games.uhc.components; + +import org.bukkit.Location; +import org.bukkit.World; +import org.bukkit.WorldBorder; + +import mineplex.core.common.util.UtilBlock; + +import nautilus.game.arcade.game.games.uhc.UHC; + +public class UHCBorder +{ + + private static final int WARNING_TIME = 60; + + // Allow some blocks of lee-way for the Y border + private static final int VARIATION_OF_Y_BORDER = 8; + + // Time in seconds for the world Y border to reach it's goal + private static final int TIME_FOR_COMPLETION_OF_Y_BORDER = UHC.DEATHMATCH_TIME_SECONDS; + + private UHC _host; + private int _startingSize; + + private WorldBorder _worldBorder; + private double _yMin; + private double _yMax; + private double _yMinSpeed; + private double _yMaxSpeed; + private double _yGoal; + + public UHCBorder(UHC host, int startingSize) + { + _host = host; + _startingSize = startingSize; + } + + public void prepare() + { + World world = _host.WorldData.World; + + _worldBorder = world.getWorldBorder(); + + _worldBorder.setCenter(0, 0); + _worldBorder.setWarningTime(WARNING_TIME); + + setSize(_startingSize, 0); + + _yMin = 0; + _yMax = world.getMaxHeight(); + + // Get the highest non-air block at 0,0 + _yGoal = (int) (UtilBlock.getHighest(world, new Location(world, 0, 0, 0)).getLocation().getY()); + + _yMinSpeed = (_yGoal - _yMin) / TIME_FOR_COMPLETION_OF_Y_BORDER; + _yMaxSpeed = (_yMax - _yGoal) / TIME_FOR_COMPLETION_OF_Y_BORDER; + } + + public void setSize(double size, long seconds) + { + _worldBorder.setSize(size * 2, seconds); + } + + public void stop() + { + _worldBorder.setSize(_worldBorder.getSize()); + _worldBorder.setSize(5000); + } + + public double getSize() + { + if (_worldBorder == null) + { + return _startingSize; + } + + return _worldBorder.getSize(); + } + + public double getMaxCords() + { + return getSize() / 2; + } + + public void advanceYBorder() + { + if (_yMax - _yGoal < VARIATION_OF_Y_BORDER) + { + return; + } + + _yMin += _yMinSpeed; + _yMax -= _yMaxSpeed; + } + + public double getYMin() + { + return _yMin; + } + + public double getYMax() + { + return _yMax; + } + +} diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/uhc/components/UHCFreezer.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/uhc/components/UHCFreezer.java new file mode 100644 index 000000000..e5aac704e --- /dev/null +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/uhc/components/UHCFreezer.java @@ -0,0 +1,79 @@ +package nautilus.game.arcade.game.games.uhc.components; + +import java.util.HashSet; +import java.util.Set; +import java.util.UUID; + +import org.bukkit.Bukkit; +import org.bukkit.Location; +import org.bukkit.entity.Player; +import org.bukkit.event.EventHandler; +import org.bukkit.event.Listener; +import org.bukkit.event.player.PlayerMoveEvent; + +import mineplex.core.common.util.UtilServer; + +import nautilus.game.arcade.events.GameStateChangeEvent; +import nautilus.game.arcade.game.Game.GameState; +import nautilus.game.arcade.game.games.uhc.UHC; + +public class UHCFreezer implements Listener +{ + + private UHC _host; + + private Set _frozenPlayers = new HashSet<>(); + + public UHCFreezer(UHC host) + { + _host = host; + + host.Manager.registerEvents(this); + } + + @EventHandler + public void end(GameStateChangeEvent event) + { + if (event.GetState() != GameState.End) + { + return; + } + + UtilServer.Unregister(this); + } + + public void freeze(Player player) + { + _frozenPlayers.add(player.getUniqueId()); + } + + public void unfreeze(Player player) + { + _frozenPlayers.remove(player.getUniqueId()); + } + + public void unfreeze() + { + _frozenPlayers.clear(); + } + + @EventHandler + public void onMove(PlayerMoveEvent event) + { + if (!_host.IsLive() || !_frozenPlayers.contains(event.getPlayer().getUniqueId())) + { + return; + } + + Location from = event.getFrom(); + Location to = event.getTo(); + + if (from.getX() == to.getX() && from.getZ() == to.getZ()) + { + return; + } + + event.setTo(from); + } + +} diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/uhc/components/UHCSpeedMode.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/uhc/components/UHCSpeedMode.java new file mode 100644 index 000000000..9edb369dc --- /dev/null +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/uhc/components/UHCSpeedMode.java @@ -0,0 +1,124 @@ +package nautilus.game.arcade.game.games.uhc.components; + +import org.bukkit.Material; +import org.bukkit.block.Block; +import org.bukkit.entity.Player; +import org.bukkit.event.EventHandler; +import org.bukkit.event.Listener; +import org.bukkit.event.block.BlockBreakEvent; +import org.bukkit.inventory.ItemStack; +import org.bukkit.potion.PotionEffect; +import org.bukkit.potion.PotionEffectType; + +import mineplex.core.common.util.UtilServer; +import mineplex.core.itemstack.ItemBuilder; +import mineplex.core.updater.UpdateType; +import mineplex.core.updater.event.UpdateEvent; + +import nautilus.game.arcade.events.GameStateChangeEvent; +import nautilus.game.arcade.game.Game.GameState; +import nautilus.game.arcade.game.games.uhc.UHC; +import nautilus.game.arcade.game.modules.CutCleanModule; + +public class UHCSpeedMode implements Listener +{ + + // The max Y value that a player can have in order to have night vision. + public static final long NIGHT_VISION_MAX_Y = 54; + + // The rate that an apple will drop when breaking a leaves block + public static final double APPLE_DROP_RATE = 0.1; + + private static final ItemStack[] PLAYER_ITEMS = { + new ItemStack(Material.STONE_SWORD), + new ItemStack(Material.STONE_PICKAXE), + new ItemStack(Material.STONE_AXE), + new ItemStack(Material.STONE_SPADE), + new ItemStack(Material.COOKED_BEEF, 10), + new ItemStack(Material.WOOD, 32) + }; + + private UHC _host; + + public UHCSpeedMode(UHC host) + { + _host = host; + + new CutCleanModule() + .associateBlockDrop(Material.GOLD_ORE, new ItemBuilder(Material.GOLD_INGOT).build()) + .associateBlockDrop(Material.IRON_ORE, new ItemBuilder(Material.IRON_INGOT).build()) + .associateBlockDrop(Material.GRAVEL, new ItemStack(Material.FLINT)) + .associateMobDrop(Material.RAW_BEEF, new ItemBuilder(Material.COOKED_BEEF).build()) + .associateMobDrop(Material.RAW_CHICKEN, new ItemBuilder(Material.COOKED_CHICKEN).build()) + .associateMobDrop(Material.RAW_FISH, new ItemBuilder(Material.COOKED_FISH).build()) + .associateMobDrop(Material.PORK, new ItemBuilder(Material.GRILLED_PORK).build()) + .associateMobDrop(Material.RABBIT, new ItemBuilder(Material.COOKED_RABBIT).build()) + .associateMobDrop(Material.MUTTON, new ItemBuilder(Material.COOKED_MUTTON).build()) + .register(host); + + host.Manager.registerEvents(this); + } + + @EventHandler + public void start(GameStateChangeEvent event) + { + if (event.GetState() != GameState.Live) + { + return; + } + + for (Player player : _host.GetPlayers(true)) + { + player.getInventory().addItem(PLAYER_ITEMS); + } + } + + @EventHandler + public void end(GameStateChangeEvent event) + { + if (event.GetState() != GameState.End) + { + return; + } + + UtilServer.Unregister(this); + } + + @EventHandler + public void nightVision(UpdateEvent event) + { + if (event.getType() != UpdateType.SEC) + { + return; + } + + for (Player player : _host.GetPlayers(true)) + { + if (player.getLocation().getY() <= NIGHT_VISION_MAX_Y) + { + player.addPotionEffect(new PotionEffect(PotionEffectType.NIGHT_VISION, Integer.MAX_VALUE, 0)); + } + else + { + player.removePotionEffect(PotionEffectType.NIGHT_VISION); + } + } + } + + @EventHandler + public void appleDrop(BlockBreakEvent event) + { + Block block = event.getBlock(); + + if (block.getType() != Material.LEAVES) + { + return; + } + + if (Math.random() < APPLE_DROP_RATE) + { + block.getWorld().dropItemNaturally(block.getLocation().add(0.5, 0.5, 0.5), new ItemStack(Material.APPLE)); + } + } + +} diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/uhc/helpers/ChunkLoadingThread.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/uhc/helpers/ChunkLoadingThread.java deleted file mode 100644 index 7521c0360..000000000 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/uhc/helpers/ChunkLoadingThread.java +++ /dev/null @@ -1,385 +0,0 @@ -package nautilus.game.arcade.game.games.uhc.helpers; - -import mineplex.core.common.util.UtilMath; -import mineplex.core.common.util.UtilServer; -import mineplex.core.timing.TimingManager; -import nautilus.game.arcade.game.Game; -import nautilus.game.arcade.game.GameTeam; -import nautilus.game.arcade.game.games.uhc.UHC; -import net.minecraft.server.v1_8_R3.Chunk; -import net.minecraft.server.v1_8_R3.ChunkProviderServer; -import net.minecraft.server.v1_8_R3.ChunkRegionLoader; -import net.minecraft.server.v1_8_R3.NBTTagCompound; -import net.minecraft.server.v1_8_R3.WorldServer; -import org.bukkit.Location; -import org.bukkit.craftbukkit.v1_8_R3.CraftWorld; -import org.bukkit.craftbukkit.v1_8_R3.entity.CraftEntity; -import org.bukkit.craftbukkit.v1_8_R3.util.LongHash; -import org.bukkit.event.EventHandler; -import org.bukkit.event.Listener; -import org.bukkit.event.entity.CreatureSpawnEvent; -import org.bukkit.event.entity.EntitySpawnEvent; -import org.bukkit.event.world.ChunkLoadEvent; -import org.spigotmc.AsyncCatcher; - -import java.lang.reflect.Field; -import java.util.ArrayList; -import java.util.HashSet; -import java.util.Map; -import java.util.Set; -import java.util.concurrent.ConcurrentHashMap; -import java.util.concurrent.ExecutorService; -import java.util.concurrent.Executors; -import java.util.concurrent.TimeUnit; -import java.util.concurrent.atomic.AtomicBoolean; -import java.util.concurrent.atomic.AtomicInteger; - -import static nautilus.game.arcade.game.games.uhc.UHC.VIEW_DISTANCE; - -public class ChunkLoadingThread extends Thread implements Listener -{ - private Game _game; - - private volatile boolean _isDecorating = false; - private AtomicInteger _actual = new AtomicInteger(); - private AtomicInteger _expected = new AtomicInteger(23000); // Most likely it'll be around 23000 - - private Set _entities = new HashSet<>(); - - public ChunkLoadingThread(Game game) - { - super("Chunk Loader"); - this._game = game; - UtilServer.RegisterEvents(this); - } - - public void run() - { - WorldServer worldServer = ((CraftWorld) _game.WorldData.World).getHandle(); - Location spawn = _game.WorldData.World.getSpawnLocation(); - - Map loaded = new ConcurrentHashMap<>(); - Map compounds = new ConcurrentHashMap<>(); - - try - { - TimingManager.start("UHC Chunk Loading"); - - ChunkProviderServer chunkProviderServer = worldServer.chunkProviderServer; - - Field chunkLoaderField = chunkProviderServer.getClass().getDeclaredField("chunkLoader"); - chunkLoaderField.setAccessible(true); - - ChunkRegionLoader loader = (ChunkRegionLoader) chunkLoaderField.get(chunkProviderServer); - - // Step 1: Read all the required chunks from the disk - // We're going to read all the required chunks from disk async - { - Set coordPairs = new HashSet<>(); - - // Special case for 0, 0 - { - int x = spawn.getBlockX() >> 4; - int z = spawn.getBlockZ() >> 4; - - for (int dx = -VIEW_DISTANCE; dx <= VIEW_DISTANCE; dx++) - { - for (int dz = -VIEW_DISTANCE; dz <= VIEW_DISTANCE; dz++) - { - coordPairs.add(LongHash.toLong(x + dx, z + dz)); - } - } - } - - // All the team spawns - { - for (int i = 0; i < _game.GetTeamList().size(); i++) - { - GameTeam team = _game.GetTeamList().get(i); - for (Location l : team.GetSpawns()) - { - int x = l.getChunk().getX(); - int z = l.getChunk().getZ(); - - for (int dx = -VIEW_DISTANCE; dx <= VIEW_DISTANCE; dx++) - { - for (int dz = -VIEW_DISTANCE; dz <= VIEW_DISTANCE; dz++) - { - coordPairs.add(LongHash.toLong(x + dx, z + dz)); - } - } - } - } - } - - AtomicBoolean lockCompleted = new AtomicBoolean(false); - Object lock = new Object(); - - // Hop back onto the main thread - _game.getArcadeManager().runSync(() -> - { - for (Chunk chunk : new ArrayList<>(chunkProviderServer.chunks.values())) - { - chunk.bukkitChunk.unload(true, false); - } - lockCompleted.set(true); - synchronized(lock) - { - lock.notifyAll(); - } - }); - if (!lockCompleted.get()) - { - synchronized (lock) - { - lock.wait(); - } - } - if (!lockCompleted.get()) - { - throw new IllegalStateException("Lock was not completed"); - } - - - // Sigh... I don't want this to be here but it needs to be set somewhere... - // Multiply by 3 because there are 3 stages - _expected.set(coordPairs.size() * 3); - - // Load them now - ExecutorService chunkLoaders = Executors.newFixedThreadPool(UHC.THREADS_FOR_CHUNK_LOADING); - - for (long coord : coordPairs) - { - chunkLoaders.submit(() -> - { - int x = LongHash.msw(coord); - int z = LongHash.lsw(coord); - try - { - Object[] data = loader.loadChunk(worldServer, x, z); - if (data != null) - { - NBTTagCompound compound = (NBTTagCompound) data[1]; - net.minecraft.server.v1_8_R3.Chunk chunk = (net.minecraft.server.v1_8_R3.Chunk) data[0]; - loaded.put(coord, chunk); - compounds.put(coord, compound); - } - else - { - System.out.println("Failed to load chunk " + x + "," + z); - } - } - catch (Throwable t) - { - t.printStackTrace(); - } - finally - { - _actual.getAndIncrement(); - } - }); - } - - chunkLoaders.shutdown(); - - // We've got plenty of time to wait - System.out.println("Finished submitting tasks to executor, waiting..."); - chunkLoaders.awaitTermination(1, TimeUnit.DAYS); - - System.out.println("Loaded: " + loaded.size() + " and coords: " + coordPairs.size()); - coordPairs.clear(); - } - - // Step 2: Recreate structures, update neighbors, load entities - // This step should be super quick so there's no point in scheduling it elsewhere - // Code is plain copypasted from ChunkIOProvider - { - for (net.minecraft.server.v1_8_R3.Chunk chunk : loaded.values()) - { - NBTTagCompound compound = compounds.get(LongHash.toLong(chunk.locX, chunk.locZ)); - loader.loadEntities(chunk, compound.getCompound("Level"), worldServer); - chunk.setLastSaved(chunkProviderServer.world.getTime()); - if (chunkProviderServer.chunkProvider != null) - { - chunkProviderServer.chunkProvider.recreateStructures(chunk, chunk.locX, chunk.locZ); - } - - for (int x = -2; x < 3; ++x) - { - for (int z = -2; z < 3; ++z) - { - if (x != 0 || z != 0) - { - net.minecraft.server.v1_8_R3.Chunk neighbor = loaded.get(LongHash.toLong(chunk.locX + x, chunk.locZ + z)); - if (neighbor != null) - { - neighbor.setNeighborLoaded(-x, -z); - chunk.setNeighborLoaded(x, z); - } - } - } - } - _actual.getAndIncrement(); - } - } - - AtomicBoolean lockCompleted = new AtomicBoolean(false); - Object lock = new Object(); - - // Hop back onto the main thread - _game.getArcadeManager().runSync(() -> - { - // We want to add all the chunks to the chunkmap so that the server is not out of sync - for (Map.Entry ent : loaded.entrySet()) - { - ent.getValue().addEntities(); - chunkProviderServer.chunks.put(ent.getKey(), ent.getValue()); - ChunkLoadEvent event = new ChunkLoadEvent(ent.getValue().bukkitChunk, true); - UtilServer.CallEvent(event); - } - lockCompleted.set(true); - synchronized (lock) - { - lock.notifyAll(); - } - }); - - if (!lockCompleted.get()) - { - synchronized (lock) - { - lock.wait(); - } - } - if (!lockCompleted.get()) - { - throw new IllegalStateException("Lock was not completed"); - } - - - // Step 3: Decorate the chunks. This step must be performed async as otherwise the server lags way too hard - // Notes: Do not allow the server to tick the world. If this is allowed EntityTracker will raise CME - // NextTickList will also raise errors - // And worst case the server will crash - { - // Live life on the edge - AsyncCatcher.enabled = false; - _isDecorating = true; - int ct = 0; - for (net.minecraft.server.v1_8_R3.Chunk chunk : loaded.values()) - { - chunk.loadNearby(chunkProviderServer, chunkProviderServer, chunk.locX, chunk.locZ); - ct++; - if (ct % 100 == 0) - { - System.out.println(ct); - } - _actual.getAndIncrement(); - } - - TimingManager.stop("UHC Chunk Loading"); - _isDecorating = false; - AsyncCatcher.enabled = true; - - System.out.println("Expected: " + _expected.get() + ", actual: " + _actual.get()); - - _game.getArcadeManager().runSync(() -> - { - - for (Chunk chunk : chunkProviderServer.chunks.values()) - { - // Clear - for (int x = -2; x < 3; x++) { - for (int z = -2; z < 3; z++) { - if (x == 0 && z == 0) { - continue; - } - chunk.setNeighborUnloaded(x, z); - } - } - } - - for (Chunk chunk : chunkProviderServer.chunks.values()) - { - // Refresh - for (int x = -2; x < 3; x++) { - for (int z = -2; z < 3; z++) { - if (x == 0 && z == 0) { - continue; - } - - Chunk neighbor = chunkProviderServer.getChunkIfLoaded(chunk.locX + x, chunk.locZ + z); - if (neighbor != null) { - neighbor.setNeighborLoaded(-x, -z); - chunk.setNeighborLoaded(x, z); - } - } - } - } - - for (net.minecraft.server.v1_8_R3.Entity entity : _entities) - { - entity.dead = false; - worldServer.addEntity(entity, CreatureSpawnEvent.SpawnReason.CHUNK_GEN); - } - - _entities.clear(); - - // You may tick again - worldServer.getMinecraftServer().worlds.add(worldServer); - - // Well, if they're not equal, not much we can do. We've hit the end - _actual.set(_expected.get()); - }); - } - - loaded.clear(); - compounds.clear(); - - UtilServer.Unregister(this); - } - catch (Throwable t) - { - t.printStackTrace(); - } - } - - @EventHandler - public void on(EntitySpawnEvent event) - { - // Don't allow entity spawns while decorating, period - if (_isDecorating) - { - if (event.getLocation().getWorld().getUID() == _game.WorldData.World.getUID()) - { - _entities.add(((CraftEntity) event.getEntity()).getHandle()); - event.setCancelled(true); - } - } - } - - public void flagDone() - { - _actual.set(_expected.get()); - } - - public boolean isDone() - { - return _actual.get() == _expected.get(); - } - - public int getPercentageComplete() - { - return UtilMath.clamp((int) ((_actual.get() * 1.0 / _expected.get()) * 100), 0, 100); - } - - public String getProgress() - { - return getPercentageComplete() + "%"; - } - - public void flagStop() - { - this.interrupt(); - } -} diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/uhc/helpers/WorldGenThread.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/uhc/helpers/WorldGenThread.java deleted file mode 100644 index c019c337b..000000000 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/uhc/helpers/WorldGenThread.java +++ /dev/null @@ -1,225 +0,0 @@ -package nautilus.game.arcade.game.games.uhc.helpers; - -import mineplex.core.common.util.C; -import mineplex.core.common.util.UtilMath; -import mineplex.core.common.util.UtilTime; -import mineplex.core.timing.TimingManager; -import nautilus.game.arcade.game.Game; -import nautilus.game.arcade.game.games.uhc.UHC; -import net.minecraft.server.v1_8_R3.BiomeCache; -import net.minecraft.server.v1_8_R3.ChunkProviderServer; -import net.minecraft.server.v1_8_R3.FileIOThread; -import net.minecraft.server.v1_8_R3.IChunkProvider; -import net.minecraft.server.v1_8_R3.MinecraftServer; -import net.minecraft.server.v1_8_R3.WorldChunkManager; -import org.bukkit.craftbukkit.v1_8_R3.CraftWorld; -import org.bukkit.craftbukkit.v1_8_R3.util.LongHash; - -import java.lang.reflect.Field; -import java.util.ArrayList; -import java.util.HashMap; -import java.util.List; -import java.util.Map; -import java.util.concurrent.TimeUnit; - -public class WorldGenThread extends Thread -{ - private UHC _game; - - private volatile boolean _mapLoaded = false; - private volatile int _chunksPerTick = 1; - private volatile boolean _stopGen = false; - - private int _chunkTotal; - private int _chunkX = 0; - private int _chunkZ = 0; - private int _chunksLoaded = 0; - - private int _currentBorder = 1000; - - - public WorldGenThread(UHC game) - { - super("WorldGen Thread"); - this._game = game; - - - _chunkX = (int) -(_currentBorder / 16); - _chunkZ = (int) -(_currentBorder / 16); - _chunkTotal = (int) ((_currentBorder * 2 / 16) * (_currentBorder * 2 / 16)); - } - - public void run() - { - try - { - Field fileIOThreadB = FileIOThread.class.getDeclaredField("b"); - fileIOThreadB.setAccessible(true); - - // This list is the list of chunks to be saved on the File IO Thread - List list = (List) fileIOThreadB.get(FileIOThread.a()); - - net.minecraft.server.v1_8_R3.WorldServer worldServer = ((CraftWorld) _game.WorldData.World).getHandle(); - - WorldChunkManager manager = worldServer.getWorldChunkManager(); - - Field biomeCacheField = manager.getClass().getDeclaredField("d"); - biomeCacheField.setAccessible(true); - - // A thread safe BiomeCache - // The implementation is literally a copy/paste from the original BiomeCache, but with some synchronization - // Reason being while the server is ticking the world (for some reason, if you want to dig through the entire Arcade codebase go for it) - // it stores stuff in the BiomeCache, and chunk gen needs that BiomeCache info too - // Causing desynchronization in the cache - biomeCacheField.set(manager, new BiomeCache(manager) - { - private final Object _lock = new Object(); - - private long _lastCleanTime; // b -> _lastCleanTime - private Map _blockByCoord = new HashMap<>(); // LongHashMap -> HashMap, c -> _blockByCoord - private List _blocks = new ArrayList<>(); // d -> _blocks - - @Override - public BiomeCache.BiomeCacheBlock a(int x, int z) - { - x >>= 4; - z >>= 4; - long var3 = hash(x, z); - BiomeCache.BiomeCacheBlock var5 = this._blockByCoord.get(var3); - if (var5 == null) - { - var5 = new BiomeCache.BiomeCacheBlock(x, z); - synchronized (_lock) - { - this._blockByCoord.put(var3, var5); - this._blocks.add(var5); - } - } - - var5.e = MinecraftServer.az(); - return var5; - } - - @Override - public void a() - { - long currentTime = MinecraftServer.az(); - long deltaTime = currentTime - this._lastCleanTime; - if (deltaTime > 7500L || deltaTime < 0L) - { - this._lastCleanTime = currentTime; - - synchronized (_lock) - { - for (int i = 0; i < this._blocks.size(); ++i) - { - BiomeCache.BiomeCacheBlock biomeCacheBlock = (BiomeCache.BiomeCacheBlock) this._blocks.get(i); - long var7 = currentTime - biomeCacheBlock.e; - if (var7 > 30000L || var7 < 0L) - { - this._blocks.remove(i--); - this._blockByCoord.remove(hash(biomeCacheBlock.c, biomeCacheBlock.d)); - } - } - } - } - } - - private long hash(int x, int z) - { - return (long) x & 4294967295L | ((long) z & 4294967295L) << 32; - } - }); - - ChunkProviderServer cps = worldServer.chunkProviderServer; - IChunkProvider icp = cps.chunkProvider; - System.out.println("Using chunk provider " + icp.getClass()); - - TimingManager.start("Map Generation"); - - long start = System.currentTimeMillis(); - - while (!_stopGen) - { - long now = System.currentTimeMillis(); - - long hash = LongHash.toLong(_chunkX, _chunkZ); - - // This is just a shortcut to how the Minecraft server would have generated a chunk if it doesn't exist. - // This should always create a chunk because we're not loading any chunks beforehand... - // /me looks at new maintainer - net.minecraft.server.v1_8_R3.Chunk chunk = icp.getOrCreateChunk(_chunkX, _chunkZ); - - // Run the copypasted code for chunk saving. - cps.saveChunk(chunk); - cps.saveChunkNOP(chunk); - cps.unloadQueue.remove(_chunkX, _chunkZ); - cps.chunks.remove(hash); - - if (_chunkX < _currentBorder / 16) - { - _chunkX++; - } - else if (_chunkZ < _currentBorder / 16) - { - _chunkX = (int) -(_currentBorder / 16); - _chunkZ++; - } - else - { - _mapLoaded = true; - break; - } - - _chunksLoaded++; - - _chunksPerTick = (int) (_chunksLoaded / ((now - start) / 50.0)); - } - - TimingManager.stop("Map Generation"); - - if (_stopGen) - { - return; - } - - TimingManager.start("Map Saving"); - - // Wait for all the chunks to save (but do we need this?) - while (!list.isEmpty()) - { - Thread.sleep(100); - } - - TimingManager.stop("Map Saving"); - - _game.getArcadeManager().runSync(_game::generateSpawns); - } - catch (Throwable t) - { - // todo proper exception handling - // maybe force shutdown? - t.printStackTrace(); - } - } - - public void flagStop() - { - this._stopGen = true; - } - - public boolean isMapLoaded() - { - return this._mapLoaded; - } - - public int getPercentageComplete() - { - return UtilMath.clamp((int) ((_chunksLoaded * 1.0 / _chunkTotal) * 100), 0, 100); - } - - public String getProgress() - { - return getPercentageComplete() + "%"; - } -} diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/uhc/modes/Assassins.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/uhc/modes/Assassins.java index a5ec141d0..34d732d6c 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/uhc/modes/Assassins.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/uhc/modes/Assassins.java @@ -12,17 +12,19 @@ import mineplex.core.common.util.UtilInv; import mineplex.core.common.util.UtilMath; import mineplex.core.common.util.UtilPlayer; import mineplex.core.itemstack.ItemStackFactory; + import nautilus.game.arcade.ArcadeManager; import nautilus.game.arcade.GameType; import nautilus.game.arcade.events.GameStateChangeEvent; -import nautilus.game.arcade.game.games.uhc.UHC; +import nautilus.game.arcade.game.Game.GameState; +import nautilus.game.arcade.game.games.uhc.UHCSolo; /** * Assassins gamemode for UHC * * @author xXVevzZXx */ -public class Assassins extends UHC +public class Assassins extends UHCSolo { private HashMap _assassins; diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/uhc/modes/BloodDiamonds.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/uhc/modes/BloodDiamonds.java index 609ed8c9e..32daf6400 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/uhc/modes/BloodDiamonds.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/uhc/modes/BloodDiamonds.java @@ -8,14 +8,14 @@ import org.bukkit.event.block.BlockBreakEvent; import nautilus.game.arcade.ArcadeManager; import nautilus.game.arcade.GameType; -import nautilus.game.arcade.game.games.uhc.UHC; +import nautilus.game.arcade.game.games.uhc.UHCSolo; /** * BloodDiamonds gamemode for UHC * * @author xXVevzZXx */ -public class BloodDiamonds extends UHC +public class BloodDiamonds extends UHCSolo { private HashMap _oreDamage; diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/uhc/modes/CutClean.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/uhc/modes/CutClean.java deleted file mode 100644 index 9cce1ec01..000000000 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/uhc/modes/CutClean.java +++ /dev/null @@ -1,68 +0,0 @@ -package nautilus.game.arcade.game.games.uhc.modes; - -import mineplex.core.itemstack.ItemBuilder; -import nautilus.game.arcade.ArcadeManager; -import nautilus.game.arcade.GameType; -import nautilus.game.arcade.game.games.uhc.UHC; -import nautilus.game.arcade.game.modules.CutCleanModule; -import nautilus.game.arcade.game.modules.ItemGiverModule; -import org.bukkit.Material; -import org.bukkit.inventory.ItemStack; - -/* - * The CutClean variant of UHC - * - * This is identical to UHC however iron and gold ore will immediately smelt - * and mob drops will be immediately cooked - */ -public class CutClean extends UHC -{ - // The amount of steak to give at the start of the game - private static final int STEAK_AMOUNT = 15; - - public CutClean(ArcadeManager manager) - { - super(manager, GameType.Brawl); - - registerModule(new CutCleanModule() - .associateBlockDrop( - Material.GOLD_ORE, - new ItemBuilder(Material.GOLD_INGOT).build() - ) - .associateBlockDrop( - Material.IRON_ORE, - new ItemBuilder(Material.IRON_INGOT).build() - ) - .associateMobDrop( - Material.RAW_BEEF, - new ItemBuilder(Material.COOKED_BEEF).build() - ) - .associateMobDrop( - Material.RAW_CHICKEN, - new ItemBuilder(Material.COOKED_CHICKEN).build() - ) - .associateMobDrop( - Material.RAW_FISH, - new ItemBuilder(Material.COOKED_FISH).build() - ) - .associateMobDrop( - Material.PORK, - new ItemBuilder(Material.GRILLED_PORK).build() - ) - .associateMobDrop( - Material.RABBIT, - new ItemBuilder(Material.COOKED_RABBIT).build() - ) - ); - - registerModule(new ItemGiverModule() - .withItem(new ItemStack(Material.COOKED_BEEF, STEAK_AMOUNT)) - ); - } - - @Override - public String GetMode() - { - return "Cut Clean"; - } -} diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/uhc/modes/GodBattles.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/uhc/modes/GodBattles.java index 12b6906a9..1f566abf0 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/uhc/modes/GodBattles.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/uhc/modes/GodBattles.java @@ -1,28 +1,31 @@ package nautilus.game.arcade.game.games.uhc.modes; -import com.google.common.collect.Lists; -import com.google.common.collect.Sets; -import mineplex.core.common.util.UtilBlock; -import mineplex.core.common.util.UtilItem; -import mineplex.core.common.util.UtilMath; -import mineplex.core.itemstack.ItemBuilder; -import nautilus.game.arcade.ArcadeManager; -import nautilus.game.arcade.GameType; -import nautilus.game.arcade.game.games.uhc.UHC; -import nautilus.game.arcade.game.modules.CutCleanModule; -import nautilus.game.arcade.game.modules.ItemGiverModule; -import nautilus.game.arcade.game.modules.OreVeinEditorModule; -import org.bukkit.Material; -import org.bukkit.block.Block; -import org.bukkit.inventory.ItemStack; - import java.util.List; import java.util.Set; +import org.bukkit.Material; +import org.bukkit.block.Block; +import org.bukkit.inventory.ItemStack; + +import com.google.common.collect.Lists; +import com.google.common.collect.Sets; + +import mineplex.core.common.util.UtilBlock; +import mineplex.core.common.util.UtilItem; +import mineplex.core.common.util.UtilMath; +import mineplex.core.itemstack.ItemBuilder; + +import nautilus.game.arcade.ArcadeManager; +import nautilus.game.arcade.GameType; +import nautilus.game.arcade.game.games.uhc.UHCSolo; +import nautilus.game.arcade.game.modules.CutCleanModule; +import nautilus.game.arcade.game.modules.ItemGiverModule; +import nautilus.game.arcade.game.modules.OreVeinEditorModule; + /** * GodBattles gamemode for UHC */ -public class GodBattles extends UHC +public class GodBattles extends UHCSolo { // The set of materials which will be considered as an ore private static final Set ORE_MATERIALS = Sets.newHashSet( @@ -43,18 +46,18 @@ public class GodBattles extends UHC { super(manager, GameType.Brawl); - registerModule(new CutCleanModule() + new CutCleanModule() .associateBlockDrop( Material.GOLD_ORE, new ItemBuilder(Material.GOLD_BLOCK).build() ) - ); + .register(this); - registerModule(new ItemGiverModule() + new ItemGiverModule() .withItem(UtilItem.makeUnbreakable(new ItemStack(Material.DIAMOND_PICKAXE))) - ); + .register(this); - registerModule(new OreVeinEditorModule() + new OreVeinEditorModule() .useFilter(block -> ORE_MATERIALS.contains(block.getType())) .useEditor(vein -> { @@ -68,7 +71,7 @@ public class GodBattles extends UHC } } }) - ); + .register(this); } @Override diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/uhc/stat/CollectFoodStat.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/uhc/stat/CollectFoodStat.java new file mode 100644 index 000000000..09aa8187a --- /dev/null +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/uhc/stat/CollectFoodStat.java @@ -0,0 +1,83 @@ +package nautilus.game.arcade.game.games.uhc.stat; + +import java.util.HashMap; +import java.util.HashSet; +import java.util.Map; +import java.util.Set; +import java.util.UUID; + +import org.bukkit.Material; +import org.bukkit.entity.Player; +import org.bukkit.event.EventHandler; +import org.bukkit.event.player.PlayerCommandPreprocessEvent; +import org.bukkit.event.player.PlayerItemConsumeEvent; +import org.bukkit.inventory.ItemStack; + +import com.google.common.collect.Sets; + +import mineplex.core.common.util.UtilServer; + +import nautilus.game.arcade.game.games.uhc.UHC; +import nautilus.game.arcade.stats.StatTracker; + +public class CollectFoodStat extends StatTracker +{ + + private static final Set FOOD_TO_EAT; + + private Map> _eaten = new HashMap<>(); + + static + { + FOOD_TO_EAT = Sets.newHashSet(Material.APPLE, Material.MUSHROOM_SOUP, Material.BREAD, Material.GRILLED_PORK, Material.GOLDEN_APPLE, Material.COOKED_FISH, Material.COOKIE, Material.MELON, + Material.COOKED_CHICKEN, Material.CARROT_ITEM, Material.BAKED_POTATO, Material.PUMPKIN_PIE, Material.COOKED_RABBIT, Material.COOKED_MUTTON); + } + + public CollectFoodStat(UHC game) + { + super(game); + } + + @EventHandler + public void onPlayerItemConsume(PlayerItemConsumeEvent event) + { + Player player = event.getPlayer(); + Material material = event.getItem().getType(); + + if (FOOD_TO_EAT.contains(material)) + { + Set eaten = _eaten.get(player.getUniqueId()); + + if (eaten == null) + { + eaten = new HashSet<>(); + _eaten.put(player.getUniqueId(), eaten); + } + + if (!eaten.contains(material)) + { + eaten.add(material); + } + + if (eaten.size() == FOOD_TO_EAT.size()) + { + getGame().addUHCAchievement(player, "Food"); + } + } + } + + @EventHandler + public void debugCommands(PlayerCommandPreprocessEvent event) + { + if (!UtilServer.isTestServer() || !event.getMessage().startsWith("/testfoodstat")) + { + return; + } + + for (Material material : FOOD_TO_EAT) + { + event.getPlayer().getInventory().addItem(new ItemStack(material)); + } + } + +} diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/uhc/stat/HalfHeartHealStat.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/uhc/stat/HalfHeartHealStat.java new file mode 100644 index 000000000..437ee50c2 --- /dev/null +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/uhc/stat/HalfHeartHealStat.java @@ -0,0 +1,48 @@ +package nautilus.game.arcade.game.games.uhc.stat; + +import java.util.HashSet; +import java.util.Set; +import java.util.UUID; + +import org.bukkit.entity.Player; +import org.bukkit.event.EventHandler; + +import mineplex.core.updater.UpdateType; +import mineplex.core.updater.event.UpdateEvent; + +import nautilus.game.arcade.game.games.uhc.UHC; +import nautilus.game.arcade.stats.StatTracker; + +public class HalfHeartHealStat extends StatTracker +{ + + private Set _players = new HashSet<>(); + + public HalfHeartHealStat(UHC game) + { + super(game); + } + + @EventHandler + public void onUpdate(UpdateEvent event) + { + if (event.getType() != UpdateType.SEC) + { + return; + } + + for (Player player : getGame().GetPlayers(true)) + { + if (player.getHealth() < 2 && !_players.contains(player.getUniqueId())) + { + _players.add(player.getUniqueId()); + } + else if (player.getHealth() >= 20 && _players.contains(player.getUniqueId())) + { + getGame().addUHCAchievement(player, "Die"); + _players.remove(player.getUniqueId()); + } + } + } + +} diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/uhc/stat/HoeCraftingStat.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/uhc/stat/HoeCraftingStat.java new file mode 100644 index 000000000..9233c15c7 --- /dev/null +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/uhc/stat/HoeCraftingStat.java @@ -0,0 +1,28 @@ +package nautilus.game.arcade.game.games.uhc.stat; + +import org.bukkit.Material; +import org.bukkit.entity.Player; +import org.bukkit.event.EventHandler; +import org.bukkit.event.inventory.CraftItemEvent; + +import nautilus.game.arcade.game.games.uhc.UHC; +import nautilus.game.arcade.stats.StatTracker; + +public class HoeCraftingStat extends StatTracker +{ + + public HoeCraftingStat(UHC game) + { + super(game); + } + + @EventHandler + public void craft(CraftItemEvent event) + { + if (event.getCurrentItem().getType() == Material.DIAMOND_HOE) + { + getGame().addUHCAchievement((Player) event.getWhoClicked(), "Hoe"); + } + } + +} diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/uhc/stat/LuckyMinerStat.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/uhc/stat/LuckyMinerStat.java new file mode 100644 index 000000000..b81b95bed --- /dev/null +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/uhc/stat/LuckyMinerStat.java @@ -0,0 +1,48 @@ +package nautilus.game.arcade.game.games.uhc.stat; + +import java.util.concurrent.TimeUnit; + +import org.bukkit.entity.Player; +import org.bukkit.event.EventHandler; +import org.bukkit.inventory.ItemStack; + +import mineplex.core.common.util.UtilItem; +import mineplex.core.common.util.UtilTime; +import mineplex.core.updater.UpdateType; +import mineplex.core.updater.event.UpdateEvent; +import nautilus.game.arcade.game.games.uhc.UHC; +import nautilus.game.arcade.stats.StatTracker; + +public class LuckyMinerStat extends StatTracker +{ + + private static final long BEFORE_TIME = TimeUnit.MINUTES.toMillis(10); + + public LuckyMinerStat(UHC game) + { + super(game); + } + + @EventHandler + public void onUpdate(UpdateEvent event) + { + if (event.getType() != UpdateType.SEC_05 || UtilTime.elapsed(getGame().GetStateTime(), BEFORE_TIME)) + { + return; + } + + playerLoop : for (Player player : getGame().GetPlayers(true)) + { + for (ItemStack itemStack : player.getInventory().getArmorContents()) + { + if (!UtilItem.isIronProduct(itemStack)) + { + continue playerLoop; + } + } + + getGame().addUHCAchievement(player, "Miner"); + } + } + +} diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/valentines/Valentines.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/valentines/Valentines.java index 26b6728e2..a47e8cfa7 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/valentines/Valentines.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/valentines/Valentines.java @@ -18,7 +18,6 @@ import mineplex.core.common.util.UtilTextBottom; import mineplex.core.common.util.UtilTextMiddle; import mineplex.core.common.util.UtilTime; import mineplex.core.itemstack.ItemStackFactory; -import mineplex.core.noteblock.INoteVerifier; import mineplex.core.noteblock.NBSReader; import mineplex.core.noteblock.NotePlayer; import mineplex.core.noteblock.NoteSong; @@ -32,6 +31,7 @@ import nautilus.game.arcade.events.GameStateChangeEvent; import nautilus.game.arcade.game.SoloGame; import nautilus.game.arcade.game.games.valentines.kit.KitMasterOfLove; import nautilus.game.arcade.game.games.valentines.tutorial.TutorialValentines; +import nautilus.game.arcade.game.modules.compass.CompassModule; import nautilus.game.arcade.kit.Kit; import org.bukkit.EntityEffect; import org.bukkit.Location; @@ -132,6 +132,12 @@ public class Valentines extends SoloGame { e.printStackTrace(); } + + new CompassModule() + .setGiveCompass(true) + .setGiveCompassToSpecs(true) + .setGiveCompassToAlive(false) + .register(this); } @Override @@ -167,7 +173,7 @@ public class Valentines extends SoloGame _cow.setCustomName(C.cGreen + C.Bold + _cowName); _cow.setCustomNameVisible(true); - UtilEnt.Vegetate(_cow); + UtilEnt.vegetate(_cow); UtilEnt.ghost(_cow, true, false); CreatureAllowOverride = false; } @@ -410,7 +416,7 @@ public class Valentines extends SoloGame Pig pig = loc.getWorld().spawn(loc, Pig.class); _pigs.put(pig, pig.getLocation()); - UtilEnt.Vegetate(pig); + UtilEnt.vegetate(pig); //Give Item if (toSpawn > 1) diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/valentines/tutorial/TutorialValentines.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/valentines/tutorial/TutorialValentines.java index 386bc5fe1..6ec02a900 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/valentines/tutorial/TutorialValentines.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/valentines/tutorial/TutorialValentines.java @@ -20,7 +20,6 @@ import mineplex.core.common.util.UtilMath; import mineplex.core.common.util.UtilServer; import mineplex.core.common.util.UtilTextMiddle; import nautilus.game.arcade.ArcadeManager; -import nautilus.game.arcade.game.games.valentines.ValItem; import nautilus.game.arcade.game.games.valentines.Valentines; import nautilus.game.arcade.gametutorial.GameTutorial; import nautilus.game.arcade.gametutorial.TutorialPhase; @@ -110,7 +109,7 @@ public class TutorialValentines extends GameTutorial //Spawn Pig pig = _pigSpawn.getWorld().spawn(_pigSpawn, Pig.class); - UtilEnt.Vegetate(pig); + UtilEnt.vegetate(pig); //Item @@ -183,12 +182,12 @@ public class TutorialValentines extends GameTutorial _cowBoy = _pigSpawn.getWorld().spawn(Host.WorldData.GetDataLocs("BROWN").get(0), Cow.class); _cowBoy.setCustomName(C.cGreenB + "Calvin"); _cowBoy.setCustomNameVisible(true); - UtilEnt.Vegetate(_cowBoy); + UtilEnt.vegetate(_cowBoy); _cowGirl = _pigSpawn.getWorld().spawn(Host.WorldData.GetDataLocs("RED").get(0), MushroomCow.class); _cowGirl.setCustomName(C.cRedB + "Moolanie"); _cowGirl.setCustomNameVisible(true); - UtilEnt.Vegetate(_cowGirl); + UtilEnt.vegetate(_cowGirl); Host.CreatureAllowOverride = false; diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/wither/PlayerCopyWither.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/wither/PlayerCopyWither.java index d1348569e..41da8752e 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/wither/PlayerCopyWither.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/wither/PlayerCopyWither.java @@ -28,7 +28,7 @@ public class PlayerCopyWither UtilEnt.ghost(_ent, true, false); - UtilEnt.Vegetate(_ent); + UtilEnt.vegetate(_ent); //Armor _ent.getEquipment().setArmorContents(owner.getInventory().getArmorContents()); diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/wither/WitherGame.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/wither/WitherGame.java index 17683ac99..2c7dbbc05 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/wither/WitherGame.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/wither/WitherGame.java @@ -64,6 +64,8 @@ import nautilus.game.arcade.game.games.wither.kit.KitHumanArcher; import nautilus.game.arcade.game.games.wither.kit.KitHumanEditor; import nautilus.game.arcade.game.games.wither.kit.KitHumanMedic; import nautilus.game.arcade.game.games.wither.kit.KitWitherMinion; +import nautilus.game.arcade.game.modules.TeamArmorModule; +import nautilus.game.arcade.game.modules.compass.CompassModule; import nautilus.game.arcade.kit.Kit; import nautilus.game.arcade.kit.NullKit; import nautilus.game.arcade.kit.perks.data.IBlockRestorer; @@ -122,7 +124,6 @@ public class WitherGame extends TeamGame implements IBlockRestorer this.DeathSpectateSecs = 4; this.HungerSet = 20; this.WorldBoundaryKill = false; - this.CompassEnabled = false; //Customizing for the Editor kit this.BlockBreak = true; @@ -130,9 +131,6 @@ public class WitherGame extends TeamGame implements IBlockRestorer this.ItemPickup = true; this.KitRegisterState = GameState.Prepare; - - this.TeamArmor = true; - this.TeamArmorHotbar = false; this.InventoryClick = false; this.InventoryOpenBlock = false; @@ -158,6 +156,15 @@ public class WitherGame extends TeamGame implements IBlockRestorer BlankLine, new ChatStatData("kit", "Kit", true) ); + + new CompassModule() + .setGiveCompass(true) + .setGiveCompassToSpecs(true) + .setGiveCompassToAlive(false) + .register(this); + new TeamArmorModule() + .giveTeamArmor() + .register(this); } @Override @@ -249,11 +256,15 @@ public class WitherGame extends TeamGame implements IBlockRestorer if (GetState() == GameState.Recruit || GetState() == GameState.Prepare) { Projectile proj = event.getEntity(); - WitherSkull ws = (WitherSkull) proj; - if (ws.getShooter() instanceof Wither) + if (proj instanceof WitherSkull) { - event.setCancelled(true); + WitherSkull ws = (WitherSkull) proj; + + if (ws.getShooter() instanceof Wither) + { + event.setCancelled(true); + } } } } diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/wizards/WizardSpellMenu.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/wizards/WizardSpellMenu.java index 6a384727d..e83bb4840 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/wizards/WizardSpellMenu.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/wizards/WizardSpellMenu.java @@ -1,13 +1,14 @@ package nautilus.game.arcade.game.games.wizards; -import mineplex.core.MiniPlugin; import mineplex.core.common.util.C; import mineplex.core.common.util.UtilInv; import mineplex.core.common.util.UtilServer; import mineplex.core.itemstack.ItemBuilder; +import mineplex.core.lifetimes.Lifetime; import nautilus.game.arcade.events.GameStateChangeEvent; import nautilus.game.arcade.game.Game.GameState; +import nautilus.game.arcade.game.GameComponent; import org.bukkit.Bukkit; import org.bukkit.Material; import org.bukkit.entity.Player; @@ -20,27 +21,24 @@ import org.bukkit.event.player.PlayerInteractEvent; import org.bukkit.event.player.PlayerJoinEvent; import org.bukkit.inventory.InventoryHolder; import org.bukkit.inventory.ItemStack; -import org.bukkit.plugin.java.JavaPlugin; -public class WizardSpellMenu extends MiniPlugin +public class WizardSpellMenu extends GameComponent { - private Wizards _wizards; private WizardSpellMenuShop _wizardShop; private ItemStack _wizardSpells = new ItemBuilder(Material.ENCHANTED_BOOK).setTitle(C.cGold + "Wizard Spells") .addLore(C.cGray + "Right click with this to view the spells").build(); - public WizardSpellMenu(String moduleName, JavaPlugin plugin, Wizards wizards) + public WizardSpellMenu(Wizards wizards) { - super("Wizard Spell Menu", plugin); + super(wizards); _wizardShop = new WizardSpellMenuShop(this, wizards.getArcadeManager().GetClients(), wizards.getArcadeManager() .GetDonation(), wizards); - _wizards = wizards; } @EventHandler public void onJoin(PlayerJoinEvent event) { - if (_wizards.GetState() == GameState.Recruit || _wizards.GetState() == GameState.Live) + if (getGame().GetState() == GameState.Recruit || getGame().GetState() == GameState.Live) { event.getPlayer().getInventory().setItem(0, _wizardSpells); } @@ -49,11 +47,11 @@ public class WizardSpellMenu extends MiniPlugin @EventHandler public void onDeath(final PlayerDeathEvent event) { - Bukkit.getScheduler().scheduleSyncDelayedTask(_plugin, new Runnable() + Bukkit.getScheduler().scheduleSyncDelayedTask(UtilServer.getPlugin(), new Runnable() { public void run() { - if (_wizards.IsLive()) + if (getGame().IsLive()) { event.getEntity().getInventory().setItem(0, _wizardSpells); } @@ -66,7 +64,7 @@ public class WizardSpellMenu extends MiniPlugin { if (event.getMessage().equalsIgnoreCase("/spec")) { - if (!_wizards.IsAlive(event.getPlayer()) + if (!getGame().IsAlive(event.getPlayer()) && !UtilInv.contains(event.getPlayer(), _wizardSpells.getType(), (byte) 0, 1)) { event.getPlayer().getInventory().setItem(0, _wizardSpells); @@ -88,7 +86,7 @@ public class WizardSpellMenu extends MiniPlugin { for(Player player : UtilServer.GetPlayers()) { - if (!_wizards.IsAlive(player)) + if (!getGame().IsAlive(player)) { player.getInventory().setItem(0, _wizardSpells); } @@ -100,7 +98,7 @@ public class WizardSpellMenu extends MiniPlugin public void onInteract(PlayerInteractEvent event) { if (event.getAction() != Action.PHYSICAL && event.getAction().name().contains("RIGHT") - && (!_wizards.IsLive() || !_wizards.IsAlive(event.getPlayer()))) + && (!getGame().IsLive() || !getGame().IsAlive(event.getPlayer()))) { ItemStack item = event.getItem(); @@ -112,11 +110,11 @@ public class WizardSpellMenu extends MiniPlugin } } - if (_wizards.IsLive() && _wizards.IsAlive(event.getPlayer())) + if (getGame().IsLive() && getGame().IsAlive(event.getPlayer())) { Player p = event.getPlayer(); - if (p.getInventory().getHeldItemSlot() < _wizards.getWizard(p).getWandsOwned()) + if (p.getInventory().getHeldItemSlot() < getGame().getWizard(p).getWandsOwned()) { if (event.getAction().name().contains("RIGHT")) { @@ -131,5 +129,4 @@ public class WizardSpellMenu extends MiniPlugin } } } - } diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/wizards/WizardSpellMenuShop.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/wizards/WizardSpellMenuShop.java index cda8ebd37..9262f6f96 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/wizards/WizardSpellMenuShop.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/wizards/WizardSpellMenuShop.java @@ -25,9 +25,6 @@ public class WizardSpellMenuShop extends ShopBase public void update() { - for (ShopPageBase> shopPage : getPlayerPageMap().values()) - { - shopPage.refresh(); - } + getPlayerPageMap().values().forEach(ShopPageBase::refresh); } } diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/wizards/Wizards.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/wizards/Wizards.java index c4463ea18..b5f05cd4c 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/wizards/Wizards.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/wizards/Wizards.java @@ -49,6 +49,7 @@ import nautilus.game.arcade.game.games.wizards.kit.KitWitchDoctor; import nautilus.game.arcade.game.games.wizards.spellinterfaces.SpellClick; import nautilus.game.arcade.game.games.wizards.spellinterfaces.SpellClickBlock; import nautilus.game.arcade.game.games.wizards.spellinterfaces.SpellClickEntity; +import nautilus.game.arcade.game.modules.compass.CompassModule; import nautilus.game.arcade.kit.Kit; import nautilus.game.arcade.managers.chat.ChatStatData; import net.minecraft.server.v1_8_R3.EntityFireball; @@ -153,7 +154,7 @@ public class Wizards extends SoloGame new KitWitchDoctor(manager) }); - _wizard = new WizardSpellMenu("Wizard Spell Menu", getArcadeManager().getPlugin(), this); + _wizard = new WizardSpellMenu(this); AnnounceStay = false; BlockBreak = true; @@ -295,6 +296,13 @@ public class Wizards extends SoloGame } } }; + + + new CompassModule() + .setGiveCompass(true) + .setGiveCompassToSpecs(true) + .setGiveCompassToAlive(false) + .register(this); } @EventHandler @@ -357,7 +365,7 @@ public class Wizards extends SoloGame { percent = 10; } - else if (name.contains("GOLDEN") || name.contains("CHAINMAIL")) + else if (name.contains("GOLD") || name.contains("CHAINMAIL")) { percent = 15; } @@ -1115,8 +1123,16 @@ public class Wizards extends SoloGame @EventHandler public void onClick(InventoryClickEvent event) { - if (event.getClickedInventory() == null || !(event.getClickedInventory().getHolder() instanceof BlockState)) + if (event.getClickedInventory() == null) + { return; + } + InventoryHolder holder = event.getClickedInventory().getHolder(); + // DoubleChests aren't a BlockState as they represent more than one block + if (!(holder instanceof BlockState || holder instanceof DoubleChest)) + { + return; + } ItemStack item = event.getCurrentItem(); @@ -1269,9 +1285,13 @@ public class Wizards extends SoloGame @EventHandler public void onDropItem(PlayerDropItemEvent event) { - if (event.getPlayer().getInventory().getHeldItemSlot() < 5) + // Check to see if they item they're dropping is from one of the first five slots(wand slots) + for (int i = 0; i < 5; i++) { - event.setCancelled(true); + if (event.getPlayer().getInventory().getItem(i) == null) + { + event.setCancelled(true); + } } } diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/wizards/spells/SpellAnvilDrop.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/wizards/spells/SpellAnvilDrop.java index 2b4ae19f6..48948d9b7 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/wizards/spells/SpellAnvilDrop.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/wizards/spells/SpellAnvilDrop.java @@ -90,7 +90,7 @@ public class SpellAnvilDrop extends Spell implements SpellClick int spellLevel = entity.getMetadata("SpellLevel").get(0).asInt(); CustomExplosion explosion = new CustomExplosion(Wizards.getArcadeManager().GetDamage(), Wizards.getArcadeManager() - .GetExplosion(), entity.getLocation(), 1 + (spellLevel / 2F), "Anvil Drop"); + .GetExplosion(), entity.getLocation(), 4 + (spellLevel / 2F), "Anvil Drop"); explosion.setPlayer((Player) entity.getMetadata("Wizard").get(0).value(), true); @@ -98,7 +98,8 @@ public class SpellAnvilDrop extends Spell implements SpellClick explosion.setDropItems(false); - explosion.setMaxDamage(6 + (spellLevel * 4)); + explosion.setBlockExplosionSize(explosion.getSize() -3); + explosion.setExplosionDamage(3 + (spellLevel * 2)); explosion.explode(); diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/wizards/spells/SpellFireball.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/wizards/spells/SpellFireball.java index 00ea56112..84b150454 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/wizards/spells/SpellFireball.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/wizards/spells/SpellFireball.java @@ -32,17 +32,17 @@ public class SpellFireball extends Spell implements SpellClick int spellLevel = projectile.getMetadata("SpellLevel").get(0).asInt(); CustomExplosion explosion = new CustomExplosion(Wizards.getArcadeManager().GetDamage(), Wizards.getArcadeManager() - .GetExplosion(), projectile.getLocation(), (spellLevel * 0.3F) + 1F, "Fireball"); + .GetExplosion(), projectile.getLocation(), (spellLevel * 0.3F) + 4F, "Fireball"); explosion.setPlayer((Player) projectile.getMetadata("FireballSpell").get(0).value(), true); explosion.setFallingBlockExplosion(true); - explosion.setBlockExplosionSize(explosion.getSize() + 1); + explosion.setBlockExplosionSize(explosion.getSize() - 2); explosion.setDropItems(false); - explosion.setMaxDamage(spellLevel + 6); + explosion.setExplosionDamage(spellLevel + 6); explosion.explode(); } diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/wizards/spells/SpellRumble.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/wizards/spells/SpellRumble.java index 936af0589..9ee0fd7fd 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/wizards/spells/SpellRumble.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/wizards/spells/SpellRumble.java @@ -278,10 +278,12 @@ public class SpellRumble extends Spell implements SpellClickBlock, SpellClick if (entity instanceof Player) { + // Why does Slowing by 2 apply slowness 1? The world may never know. + // As such, we subtract one from the spellLevel and ask no more questions Wizards.getArcadeManager() .GetCondition() .Factory() - .Slow("Rumble", (LivingEntity) entity, player, 3, spellLevel, false, false, + .Slow("Rumble", (LivingEntity) entity, player, 3, spellLevel-1, false, false, false, false); } } diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/wizards/spells/SpellSummonWolves.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/wizards/spells/SpellSummonWolves.java index e546be6dc..b93e0d450 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/wizards/spells/SpellSummonWolves.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/wizards/spells/SpellSummonWolves.java @@ -86,6 +86,7 @@ public class SpellSummonWolves extends Spell implements SpellClick, SpellClickBl if (tamer instanceof Player) { event.SetDamager((Player) tamer); + event.setMetadata("customWeapon", "Summon Wolves"); event.setKnockbackOrigin(wolf.getLocation()); } } diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/zombiesurvival/ZombieSurvival.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/zombiesurvival/ZombieSurvival.java index 92c5ce0c5..b21be55bc 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/zombiesurvival/ZombieSurvival.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/zombiesurvival/ZombieSurvival.java @@ -32,6 +32,7 @@ import nautilus.game.arcade.game.GameTeam; import nautilus.game.arcade.game.SoloGame; import nautilus.game.arcade.game.GameTeam.PlayerState; import nautilus.game.arcade.game.games.zombiesurvival.kits.*; +import nautilus.game.arcade.game.modules.compass.CompassModule; import nautilus.game.arcade.kit.Kit; import nautilus.game.arcade.kit.NullKit; import net.minecraft.server.v1_8_R3.EntityCreature; @@ -68,8 +69,10 @@ public class ZombieSurvival extends SoloGame this.DeathOut = false; this.HungerSet = 20; - - this.CompassEnabled = true; + + new CompassModule() + .setGiveCompassToAlive(true) + .register(this); registerChatStats( Kills, diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/modules/Module.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/modules/Module.java index bff9ae688..2aed67d39 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/modules/Module.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/modules/Module.java @@ -1,24 +1,26 @@ package nautilus.game.arcade.game.modules; import com.google.gson.JsonElement; +import mineplex.core.Managers; +import nautilus.game.arcade.ArcadeManager; import nautilus.game.arcade.game.Game; import nautilus.game.arcade.game.TeamGame; import org.bukkit.event.Listener; -/* +/** * This is a Module - * + *

* A Module represents something which will enhance or change the way games can be played. * Modules should function independent of which specific gamemode is being played. - * If you need game-specific features, put it into that Game implementation or refactor it into a separate class (not a module). - * + * If you need game-specific features, put it into that Game implementation or refactor it into a separate class (not a module). + *

* Modules should never directly access other Modules via the Game instance. - * Instead, the game which requires cross-contamination should do so itself. - * + * Instead, the game which requires cross-contamination should do so itself. + *

* Modules should be associated per-game. Do not make them static - * + *

* If your module is able to accept custom configuration, override the configure(JsonElement) method - * You can define the format of the json you wish to use. + * You can define the format of the json you wish to use. * This custom configuration will be used to dynamically adjust gamemodes via Redis if needed */ public abstract class Module implements Listener @@ -26,10 +28,10 @@ public abstract class Module implements Listener // The game this module belongs to private Game _game; - /* + /** * Initializes this module with the specific game instance. You should never do this as {@link Game} does it for you */ - public void initialize(Game game) + public final void initialize(Game game) { if (_game != null) { @@ -39,33 +41,35 @@ public abstract class Module implements Listener this.setup(); } - /* - * This method is called once initialization is complete. Do whatever you need to do with the {@link Game} here + /** + * This method is called once initialization is complete. Do whatever you need to do with the {@link Game} here. + * + * All modules should have been configured before this method is called */ protected void setup() { } - /* + /** * If this module can be configured via a JsonObject/JsonPrimitive, then override this method - * to implement that feature - * + * to implement that feature + *

* You can define how the JsonElement should be formatted. - * + *

* It is recommended to have a "force" boolean which will reset this module to a clean state - * (to allow extensive customization using json) + * (to allow extensive customization using json) */ public void configure(JsonElement element) { } - /* + /** * This method is called once this module is no longer needed. - * This could be because the game is over - * Or because this module was unregistered - * + * This could be because the game is over + * Or because this module was unregistered + *

* The {@link Game} will unregister this module as a listener for you. * All you need to do is clean up after yourself */ @@ -74,11 +78,16 @@ public abstract class Module implements Listener } - /* + /** * Gets the game this module is associated with */ public Game getGame() { return this._game; } + + public final void register(Game instance) + { + instance.registerModule(this); + } } diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/modules/OreVeinEditorModule.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/modules/OreVeinEditorModule.java index a7582e28f..8bd58cc78 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/modules/OreVeinEditorModule.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/modules/OreVeinEditorModule.java @@ -3,7 +3,7 @@ package nautilus.game.arcade.game.modules; import mineplex.core.common.util.UtilBlock; import mineplex.core.common.util.UtilMath; import mineplex.core.common.util.UtilWorld; -import mineplex.core.timing.TimingManager; +import mineplex.core.common.timing.TimingManager; import org.bukkit.Material; import org.bukkit.block.Block; import org.bukkit.event.EventHandler; diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/modules/PlayerHeadModule.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/modules/PlayerHeadModule.java new file mode 100644 index 000000000..fee4bcf0e --- /dev/null +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/modules/PlayerHeadModule.java @@ -0,0 +1,169 @@ +package nautilus.game.arcade.game.modules; + +import org.bukkit.ChatColor; +import org.bukkit.Material; +import org.bukkit.enchantments.Enchantment; +import org.bukkit.entity.Player; +import org.bukkit.event.EventHandler; +import org.bukkit.event.EventPriority; +import org.bukkit.event.block.BlockPlaceEvent; +import org.bukkit.event.entity.PlayerDeathEvent; +import org.bukkit.event.inventory.PrepareItemCraftEvent; +import org.bukkit.event.player.PlayerItemConsumeEvent; +import org.bukkit.event.player.PlayerPickupItemEvent; +import org.bukkit.inventory.CraftingInventory; +import org.bukkit.inventory.ItemStack; +import org.bukkit.inventory.ShapedRecipe; +import org.bukkit.material.MaterialData; +import org.bukkit.potion.PotionEffect; +import org.bukkit.potion.PotionEffectType; + +import mineplex.core.common.util.C; +import mineplex.core.common.util.UtilPlayer; +import mineplex.core.common.util.UtilServer; +import mineplex.core.itemstack.ItemBuilder; +import mineplex.core.itemstack.ItemStackFactory; + +import nautilus.game.arcade.game.GameTeam; + +public class PlayerHeadModule extends Module +{ + private boolean _disableCraftingRegularApples = true; + private boolean _disableHeadPlace = true; + + @Override + protected void setup() + { + ShapedRecipe headApple2 = new ShapedRecipe(new ItemStack(Material.GOLDEN_APPLE, 1)); + headApple2.shape("GGG", "GHG", "GGG"); + headApple2.setIngredient('G', Material.GOLD_INGOT); + headApple2.setIngredient('H', new MaterialData(Material.SKULL_ITEM, (byte) 2)); + UtilServer.getServer().addRecipe(headApple2); + } + + public PlayerHeadModule enableCraftingRegularApples() + { + this._disableCraftingRegularApples = false; + return this; + } + + public PlayerHeadModule enableHeadPlace() + { + this._disableHeadPlace = false; + return this; + } + + @EventHandler + public void disableHeadPlace(BlockPlaceEvent event) + { + if ((event.getItemInHand().getType() == Material.SKULL || event.getItemInHand().getType() == Material.SKULL_ITEM) && + this._disableHeadPlace) + event.setCancelled(true); + } + + @EventHandler(priority = EventPriority.MONITOR, ignoreCancelled = true) + public void headPickup(PlayerPickupItemEvent event) + { + if (!getGame().IsLive()) + return; + + if (event.getItem().getItemStack().getType() == Material.SKULL_ITEM) + { + UtilPlayer.message(event.getPlayer(), " "); + UtilPlayer.message(event.getPlayer(), C.cGreen + C.Bold + "You picked up a Golden Head!"); + UtilPlayer.message(event.getPlayer(), C.cWhite + "Craft a Golden Head Apple with it for ultimate healing."); + UtilPlayer.message(event.getPlayer(), C.cWhite + "Use the recipe for Golden Apple, but Head replaces Apple."); + UtilPlayer.message(event.getPlayer(), " "); + } + } + + + @EventHandler + public void PlayerDeath(PlayerDeathEvent event) + { + Player player = event.getEntity(); + + GameTeam team = getGame().GetTeam(player); + if (team == null) + return; + + event.getDrops().add(getGoldenHead()); + } + + @EventHandler + public void eatHeadApple(PlayerItemConsumeEvent event) + { + if (event.getItem().getItemMeta().getDisplayName() == null) + return; + + if (!event.getItem().getItemMeta().getDisplayName().contains("Head")) + return; + + UtilPlayer.message(event.getPlayer(), "You ate " + event.getItem().getItemMeta().getDisplayName()); + + (new PotionEffect(PotionEffectType.ABSORPTION, 2400, 0)).apply(event.getPlayer()); + (new PotionEffect(PotionEffectType.REGENERATION, 200, 1)).apply(event.getPlayer()); + } + + @EventHandler(priority = EventPriority.HIGH) + public void denyGoldApple(PrepareItemCraftEvent event) + { + if (event.getRecipe().getResult() == null) + return; + + Material type = event.getRecipe().getResult().getType(); + + if (type != Material.GOLDEN_APPLE) + return; + + CraftingInventory inv = event.getInventory(); + + for (ItemStack item : inv.getMatrix()) + if (item != null && item.getType() != Material.AIR) + if (item.getType() == Material.GOLD_INGOT) + return; + + inv.setResult(null); + } + + @EventHandler(priority = EventPriority.HIGH) + public void craftHeadApple(PrepareItemCraftEvent event) + { + if (event.getRecipe().getResult() == null) + return; + + Material type = event.getRecipe().getResult().getType(); + + if (type != Material.GOLDEN_APPLE) + return; + + CraftingInventory inv = event.getInventory(); + + for (ItemStack item : inv.getMatrix()) + if (item != null && item.getType() != Material.AIR) + if (item.getType() == Material.SKULL_ITEM || item.getType() == Material.SKULL) + { + if (item.getItemMeta() == null) + continue; + + if (item.getItemMeta().getDisplayName() == null) + continue; + + ItemStack apple = ItemStackFactory.Instance.CreateStack(Material.GOLDEN_APPLE, (byte) 0, 1, item + .getItemMeta().getDisplayName() + ChatColor.AQUA + " Golden Apple"); + apple.addUnsafeEnchantment(Enchantment.ARROW_DAMAGE, 1); + + inv.setResult(apple); + return; + } + } + + public static final ItemStack getGoldenHead() + { + return new ItemBuilder(Material.SKULL_ITEM) + .setData((short) 2) + .setAmount(1) + .setTitle(C.cGoldB + "Player Head") + .build(); + } +} diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/modules/RejoinModule.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/modules/RejoinModule.java new file mode 100644 index 000000000..66445b092 --- /dev/null +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/modules/RejoinModule.java @@ -0,0 +1,310 @@ +package nautilus.game.arcade.game.modules; + +import java.util.HashSet; +import java.util.Iterator; +import java.util.Set; +import java.util.concurrent.TimeUnit; + +import org.bukkit.Location; +import org.bukkit.entity.Player; +import org.bukkit.event.EventHandler; +import org.bukkit.event.EventPriority; +import org.bukkit.event.player.PlayerJoinEvent; +import org.bukkit.event.player.PlayerLoginEvent; +import org.bukkit.event.player.PlayerQuitEvent; + +import mineplex.core.common.Rank; +import mineplex.core.common.util.C; +import mineplex.core.common.util.F; +import mineplex.core.common.util.NautHashMap; +import mineplex.core.common.util.UtilAlg; +import mineplex.core.common.util.UtilTime; +import mineplex.core.updater.UpdateType; +import mineplex.core.updater.event.UpdateEvent; + +import nautilus.game.arcade.game.DebugCommand; +import nautilus.game.arcade.game.GameTeam; +import nautilus.game.arcade.kit.Kit; + +public class RejoinModule extends Module +{ + + private Set _data = new HashSet<>(); + + private int _rejoinTime = (int) TimeUnit.MINUTES.toMillis(2); + + @Override + protected void setup() + { + getGame().registerDebugCommand(new DebugCommand("rejoin", Rank.ADMIN) + { + + @Override + public void Execute(Player caller, String[] args) + { + if (args.length < 1) + { + caller.sendMessage(F.main("Debug", "/rejoin ")); + return; + } + + String player = args[0]; + + RejoinPlayerData data = getRejoinPlayerData(player); + + // Player wasn't alive earlier or was too slow + if (data == null) + { + _data.add(new RejoinPlayerData(player, 20, null, null)); + } + else + { + caller.sendMessage(F.main("Debug", "That player is already allowed to rejoin!")); + return; + } + + caller.sendMessage(F.main("Debug", C.cYellow + player + C.cGray + " is now allowed to rejoin. If they are online tell them to relog.")); + caller.sendMessage(F.main("Debug", "There are issues with this and it should not be used outside of the testing environment!")); + } + }); + } + + @EventHandler(priority = EventPriority.LOW) + public void playerQuit(PlayerQuitEvent event) + { + Player player = event.getPlayer(); + GameTeam team = getGame().GetTeam(player); + + if (team == null) + { + return; + } + + if (!team.IsAlive(player)) + { + return; + } + + if (player.isDead()) + { + return; + } + + if (player.getWorld().getName().equalsIgnoreCase("world")) + { + return; + } + + if (getGame().QuitOut) + { + return; + } + + _data.add(new RejoinPlayerData(player.getName(), player.getHealth(), getGame().GetKit(player), team)); + + NautHashMap location = getGame().GetLocationStore(); + + if (!location.containsKey(player.getName())) + { + location.put(player.getName(), player.getLocation()); + } + + team.RemovePlayer(player); + + // Announcement + getGame().Announce(team.GetColor() + C.Bold + player.getName() + " has disconnected! " + UtilTime.MakeStr(_rejoinTime) + " to rejoin.", false); + } + + @EventHandler(priority = EventPriority.LOWEST) + public void playerRejoinGame(PlayerLoginEvent event) + { + if (!getGame().InProgress() || getGame().QuitOut) + { + return; + } + + Player player = event.getPlayer(); + RejoinPlayerData data = getRejoinPlayerData(player.getName()); + + if (data == null) + { + return; + } + + _data.remove(data); + + GameTeam team = data.getTeam(); + + // Assume they have been revived + if (data.getTeam() == null) + { + team = UtilAlg.Random(getGame().GetTeamList()); + } + + team.AddPlayer(player, true); + getGame().Announce(team.GetColor() + C.Bold + event.getPlayer().getName() + " has reconnected!", false); + + if (data.getKit() != null) + { + getGame().SetKit(player, data.getKit(), false); + } + } + + // Do this on Join, not Login, otherwise player no get heal. + @EventHandler(priority = EventPriority.MONITOR) + public void playerRejoinGame(PlayerJoinEvent event) + { + if (!getGame().InProgress() || getGame().QuitOut) + { + return; + } + + Player player = event.getPlayer(); + RejoinPlayerData data = getRejoinPlayerData(player.getName()); + double health = data.getHealth(); + + if (!(health > 0)) + { + return; + } + + getGame().Manager.runSyncLater(() -> { + player.setHealth(health); + + NautHashMap location = getGame().GetLocationStore(); + + if (location.containsKey(player.getName())) + { + player.teleport(location.get(player.getName())); + } + + }, 1L); + } + + @EventHandler + public void rejoinExpire(UpdateEvent event) + { + if (event.getType() != UpdateType.SEC || getGame().QuitOut) + { + return; + } + + Iterator iterator = _data.iterator(); + + while (iterator.hasNext()) + { + RejoinPlayerData data = iterator.next(); + GameTeam team = data.getTeam(); + + if (!UtilTime.elapsed(data.getTime(), _rejoinTime)) + { + continue; + } + + if (data.getTeam() != null) + { + getGame().Announce(team.GetColor() + C.Bold + data.getName() + " did not reconnect in time!", false); + } + + iterator.remove(); + } + } + + public void setRejoinTime(int time) + { + _rejoinTime = time; + } + + public int getRejoinTime() + { + return _rejoinTime; + } + + public void stopPlayerFromRejoining(String name) + { + Iterator iterator = _data.iterator(); + + while (iterator.hasNext()) + { + RejoinPlayerData data = iterator.next(); + + if (data.getName().equals(name)) + { + iterator.remove(); + } + } + } + + public void stopAllPlayersFromRejoining() + { + getGame().QuitOut = true; + _data.clear(); + } + + public RejoinPlayerData getRejoinPlayerData(String name) + { + for (RejoinPlayerData data : _data) + { + if (data.getName().equals(name)) + { + return data; + } + } + + return null; + } + + public Set getData() + { + return _data; + } + + public class RejoinPlayerData + { + private String _name; + private double _health; + private Kit _kit; + private GameTeam _team; + private long _time; + + public RejoinPlayerData(String name, double health, Kit kit, GameTeam team) + { + _name = name; + _health = health; + _kit = kit; + _team = team; + _time = System.currentTimeMillis(); + } + + public void setHealth(double health) + { + _health = health; + } + + public String getName() + { + return _name; + } + + public double getHealth() + { + return _health; + } + + public Kit getKit() + { + return _kit; + } + + public GameTeam getTeam() + { + return _team; + } + + public long getTime() + { + return _time; + } + } + +} diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/modules/SafezoneModule.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/modules/SafezoneModule.java new file mode 100644 index 000000000..06259b756 --- /dev/null +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/modules/SafezoneModule.java @@ -0,0 +1,236 @@ +package nautilus.game.arcade.game.modules; + +import mineplex.core.common.util.F; +import mineplex.core.common.util.UtilPlayer; +import net.minecraft.server.v1_8_R3.BlockPosition; +import net.minecraft.server.v1_8_R3.Entity; +import net.minecraft.server.v1_8_R3.EntityHuman; +import net.minecraft.server.v1_8_R3.IWorldAccess; +import org.bukkit.Bukkit; +import org.bukkit.Location; +import org.bukkit.Material; +import org.bukkit.World; +import org.bukkit.block.Block; +import org.bukkit.block.BlockState; +import org.bukkit.craftbukkit.v1_8_R3.CraftWorld; +import org.bukkit.event.EventHandler; +import org.bukkit.event.block.Action; +import org.bukkit.event.block.BlockGrowEvent; +import org.bukkit.event.block.BlockPistonExtendEvent; +import org.bukkit.event.block.BlockPistonRetractEvent; +import org.bukkit.event.block.BlockPlaceEvent; +import org.bukkit.event.player.PlayerInteractEvent; +import org.bukkit.event.world.StructureGrowEvent; +import org.bukkit.event.world.WorldLoadEvent; + +import java.util.Iterator; +import java.util.function.Predicate; + +public class SafezoneModule extends Module +{ + private Predicate _isInSafezone = location -> true; + + public SafezoneModule filter(Predicate predicate) + { + this._isInSafezone = predicate; + return this; + } + + @Override + public void setup() + { + for (World world : Bukkit.getWorlds()) + { + registerWorldAccess(world); + } + } + + @EventHandler + public void onWorldLoad(WorldLoadEvent event) + { + registerWorldAccess(event.getWorld()); + } + + private void registerWorldAccess(World world) + { + IWorldAccess access = new IWorldAccess() + { + @Override + public void a(BlockPosition blockPosition) + { + Location location = new Location(world, blockPosition.getX(), blockPosition.getY(), blockPosition.getZ()); + if (isInSafeZone(location)) + { + Block block = location.getBlock(); + if (block.getType() == Material.COBBLESTONE || block.getType() == Material.OBSIDIAN || block.getType() == Material.STONE) + { + block.setType(Material.AIR); + } + } + } + + @Override + public void b(BlockPosition blockPosition) + { + + } + + @Override + public void a(int i, int i1, int i2, int i3, int i4, int i5) + { + + } + + @Override + public void a(String s, double v, double v1, double v2, float v3, float v4) + { + + } + + @Override + public void a(EntityHuman entityHuman, String s, double v, double v1, double v2, float v3, float v4) + { + + } + + @Override + public void a(int i, boolean b, double v, double v1, double v2, double v3, double v4, double v5, int... ints) + { + + } + + @Override + public void a(Entity entity) + { + + } + + @Override + public void b(Entity entity) + { + + } + + @Override + public void a(String s, BlockPosition blockPosition) + { + + } + + @Override + public void a(int i, BlockPosition blockPosition, int i1) + { + + } + + @Override + public void a(EntityHuman entityHuman, int i, BlockPosition blockPosition, int i1) + { + + } + + @Override + public void b(int i, BlockPosition blockPosition, int i1) + { + + } + }; + +// ((CraftWorld) world).getHandle().u.add(access); + } + + // fixme flowing water and stuff + + @EventHandler + public void preventBlockPlacement(BlockPlaceEvent event) + { + if (isInSafeZone(event.getBlock().getLocation())) + { + UtilPlayer.message(event.getPlayer(), F.main("Game", "You cannot build in this area!")); + event.setCancelled(true); + } + } + + @EventHandler + public void preventStructureGrow(StructureGrowEvent event) + { + Iterator blocks = event.getBlocks().iterator(); + while (blocks.hasNext()) + { + BlockState next = blocks.next(); + if (isInSafeZone(next.getLocation())) + { + blocks.remove(); + } + } + } + + @EventHandler + public void preventBlockGrow(BlockGrowEvent event) + { + if (isInSafeZone(event.getBlock().getLocation())) + { + event.setCancelled(true); + } + } + + @EventHandler + public void preventBoneMeal(PlayerInteractEvent event) + { + if (event.getAction() == Action.RIGHT_CLICK_BLOCK) + { + boolean isIllegal = false; + if (!isIllegal) + { + isIllegal = event.getPlayer().getItemInHand().getType() == Material.INK_SACK && + event.getPlayer().getItemInHand().getData().getData() == (byte) 15; + } + + if (isIllegal && isInSafeZone(event.getClickedBlock().getLocation())) + { + event.setCancelled(true); + } + } + } + + @EventHandler + public void preventPistons(BlockPistonExtendEvent event) + { + boolean willBeUnsafe = false; + for (Block block : event.getBlocks()) + { + if (isInSafeZone(block.getRelative(event.getDirection()).getLocation())) + { + willBeUnsafe = true; + break; + } + } + if (willBeUnsafe) + { + event.setCancelled(true); + } + } + + @EventHandler + public void preventPistons(BlockPistonRetractEvent event) + { + boolean willBeUnsafe = false; + for (Block block : event.getBlocks()) + { + if (isInSafeZone(block.getLocation())) + { + willBeUnsafe = true; + break; + } + } + if (willBeUnsafe) + { + event.setCancelled(true); + } + } + + private boolean isInSafeZone(Location location) + { + return _isInSafezone.test(location); + } +} diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/modules/TeamArmorModule.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/modules/TeamArmorModule.java new file mode 100644 index 000000000..1d75f12ac --- /dev/null +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/modules/TeamArmorModule.java @@ -0,0 +1,139 @@ +package nautilus.game.arcade.game.modules; + +import java.util.HashSet; +import java.util.Set; + +import org.bukkit.Color; +import org.bukkit.Material; +import org.bukkit.entity.Player; +import org.bukkit.event.EventHandler; +import org.bukkit.event.EventPriority; +import org.bukkit.event.inventory.InventoryClickEvent; +import org.bukkit.event.player.PlayerDropItemEvent; +import org.bukkit.event.player.PlayerInteractEvent; + +import mineplex.core.common.util.C; +import mineplex.core.common.util.UtilEvent; +import mineplex.core.common.util.UtilInv; +import mineplex.core.common.util.UtilItem; +import mineplex.core.itemstack.ItemBuilder; + +import nautilus.game.arcade.events.PlayerKitGiveEvent; + +/** + * This module handles setting armor for team games such as Micro Battles. It allows you to set the player's armor + * to be the team's color. It also allows you to add an chestplate to players' hotbar representing their team. + * + * These events are listening at MONITOR because they (should) be strict enough that it should not be possible to + * interfere with any other listeners + */ +public class TeamArmorModule extends Module +{ + private boolean _giveTeamArmor = false; + private boolean _giveHotbarItem = false; + + private Set _hotbarNames = new HashSet<>(); + private Set _armorNames = new HashSet<>(); + + public TeamArmorModule giveTeamArmor() + { + this._giveTeamArmor = true; + return this; + } + + public TeamArmorModule giveHotbarItem() + { + this._giveHotbarItem = true; + return this; + } + + @EventHandler + public void giveArmor(PlayerKitGiveEvent event) + { + apply(event.getPlayer()); + } + + public void apply(Player player) + { + Color color = getGame().GetTeam(player).GetColorBase(); + + if (_giveTeamArmor) + { + String itemName = getGame().GetTeam(player).GetColor() + C.Bold + "Team Armor"; + _armorNames.add(itemName); + player.getInventory().setHelmet(new ItemBuilder(Material.LEATHER_HELMET).setColor(color).setTitle(itemName).setUnbreakable(true).build()); + player.getInventory().setChestplate(new ItemBuilder(Material.LEATHER_CHESTPLATE).setColor(color).setTitle(itemName).setUnbreakable(true).build()); + player.getInventory().setLeggings(new ItemBuilder(Material.LEATHER_LEGGINGS).setColor(color).setTitle(itemName).setUnbreakable(true).build()); + player.getInventory().setBoots(new ItemBuilder(Material.LEATHER_BOOTS).setColor(color).setTitle(itemName).setUnbreakable(true).build()); + } + + if (_giveHotbarItem && getGame().InProgress()) + { + String teamName = getGame().GetTeam(player).GetFormattedName(); + _hotbarNames.add(teamName); + player.getInventory().setItem(8, new ItemBuilder(Material.LEATHER_CHESTPLATE).setColor(color).setTitle(teamName).setUnbreakable(true).build()); + } + } + + @EventHandler(priority = EventPriority.MONITOR, ignoreCancelled = true) + public void disallowDrop(PlayerDropItemEvent event) + { + if (!_giveTeamArmor && !_giveHotbarItem) + return; + + if (!_hotbarNames.contains(UtilItem.getDisplayName(event.getItemDrop().getItemStack()))) + return; + + event.setCancelled(true); + } + + @EventHandler(priority = EventPriority.MONITOR, ignoreCancelled = true) + public void disallowEquip(PlayerInteractEvent event) + { + if (!_giveHotbarItem) + return; + + if (!UtilEvent.isAction(event, UtilEvent.ActionType.R)) + return; + + if (!_hotbarNames.contains(UtilItem.getDisplayName(event.getItem()))) + return; + + event.setCancelled(true); + + getGame().getArcadeManager().runSyncLater(() -> + { + event.getPlayer().updateInventory(); + }, 1L); + } + + @EventHandler(priority = EventPriority.MONITOR, ignoreCancelled = true) + public void disallowMoveHotbar(InventoryClickEvent event) + { + if (!_giveHotbarItem) + return; + + if (!getGame().InProgress()) + return; + + if (!UtilInv.shouldCancelEvent(event, item -> _hotbarNames.contains(UtilItem.getDisplayName(item)))) + return; + + event.setCancelled(true); + } + + @EventHandler(priority = EventPriority.MONITOR, ignoreCancelled = true) + public void disallowMoveArmor(InventoryClickEvent event) + { + if (!_giveTeamArmor) + return; + + if (!getGame().InProgress()) + return; + + if (!UtilInv.shouldCancelEvent(event, item -> _armorNames.contains(UtilItem.getDisplayName(item)))) + return; + + event.setCancelled(true); + } +} diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/modules/VersionModule.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/modules/VersionModule.java index bc4a9bc33..ffeed21ec 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/modules/VersionModule.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/modules/VersionModule.java @@ -9,6 +9,8 @@ import mineplex.core.common.MinecraftVersion; import mineplex.core.common.util.C; import mineplex.core.common.util.UtilPlayer; import mineplex.core.common.util.UtilServer; +import mineplex.core.portal.GenericServer; +import mineplex.core.portal.Intent; import mineplex.core.portal.Portal; /** @@ -21,24 +23,17 @@ public class VersionModule extends Module { private MinecraftVersion _minecraftVersion; - private String _kickMessage; - + public VersionModule(MinecraftVersion minecraftVersion) - { - this(minecraftVersion, "You have an outdated client for this game!"); - } - - public VersionModule(MinecraftVersion minecraftVersion, String kickMessage) { _minecraftVersion = minecraftVersion; - _kickMessage = kickMessage; for (Player player : UtilServer.getPlayers()) { if (UtilPlayer.getVersion(player) != _minecraftVersion) { UtilPlayer.message(player, C.cGold + C.Bold + "Please use Minecraft " + _minecraftVersion.friendlyName() + " or newer to play this game!"); - Portal.getInstance().sendPlayerToServer(player, "Lobby"); + Portal.getInstance().sendPlayerToGenericServer(player, GenericServer.HUB, Intent.KICK); } } } diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/modules/combatlog/CombatLogModule.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/modules/combatlog/CombatLogModule.java index 9fd3f2f81..b88de3562 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/modules/combatlog/CombatLogModule.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/modules/combatlog/CombatLogModule.java @@ -1,19 +1,14 @@ package nautilus.game.arcade.game.modules.combatlog; -import mineplex.core.common.util.C; -import mineplex.core.common.util.F; -import mineplex.core.common.util.UtilEvent; -import mineplex.core.common.util.UtilParser; -import mineplex.core.common.util.UtilPlayer; -import mineplex.core.common.util.UtilServer; -import mineplex.core.updater.UpdateType; -import mineplex.core.updater.event.UpdateEvent; -import nautilus.game.arcade.game.GameTeam; -import nautilus.game.arcade.game.TeamGame; -import nautilus.game.arcade.game.modules.Module; +import java.util.Collection; +import java.util.HashMap; +import java.util.Iterator; +import java.util.Map; +import java.util.UUID; +import java.util.stream.Collectors; + import org.bukkit.Bukkit; import org.bukkit.ChatColor; -import org.bukkit.GameMode; import org.bukkit.Sound; import org.bukkit.entity.Entity; import org.bukkit.entity.LivingEntity; @@ -26,40 +21,51 @@ import org.bukkit.event.player.PlayerJoinEvent; import org.bukkit.event.player.PlayerQuitEvent; import org.bukkit.event.world.ChunkUnloadEvent; -import java.util.Collection; -import java.util.HashMap; -import java.util.Iterator; -import java.util.Map; -import java.util.UUID; -import java.util.function.Consumer; +import mineplex.core.common.util.C; +import mineplex.core.common.util.F; +import mineplex.core.common.util.UtilEvent; +import mineplex.core.common.util.UtilParser; +import mineplex.core.common.util.UtilPlayer; +import mineplex.core.common.util.UtilServer; +import mineplex.core.updater.UpdateType; +import mineplex.core.updater.event.UpdateEvent; -/* +import nautilus.game.arcade.game.GameTeam; +import nautilus.game.arcade.game.TeamGame; +import nautilus.game.arcade.game.modules.Module; +import nautilus.game.arcade.game.modules.RejoinModule; +import nautilus.game.arcade.game.modules.compass.CompassEntry; +import nautilus.game.arcade.game.modules.compass.CompassModule; + +/** * This module will spawn combat log NPCs for players who disconnect */ public class CombatLogModule extends Module { - // The map of player UUIDs to their combat log NPCs + /** + * Map of UUIDs of players who are now offline, to their CombatLogNPCs + */ private Map _logoutNpcs = new HashMap<>(); - // The map of player UUIDs and who killed their combat logged NPC + /** + * Map of UUIDs of players who are now offline, and who killed them + */ private Map _killedBy = new HashMap<>(); - // The time that combat log npcs will stay spawned for, in milliseconds + /** + * How long combat log NPCs will stay spawned in for, measured in milliseconds + */ private int _spawnTime = 60000; - // Whether to notify the combat logged player on join if they have been killed + + /** + * Whether to notify the combat logged player on join if they have been killed + */ private boolean _notifyPlayer = true; - // Whether to spawn a combat log NPC for creative players - private boolean _spawnForCreative = true; - // The action to take once a combat logged NPC has died - private Consumer _onKill = npc -> - { - }; - // The action to take once a combat logged NPC has expired - private Consumer _onExpire = npc -> - { - - }; + /** + * Whether to integrate with {@link CompassModule} + */ + private boolean _integrateWithCompassModule = true; private int _locationTaskId = -1; @@ -72,6 +78,39 @@ public class CombatLogModule extends Module getGame().GetLocationStore().put(npc.getPlayerInfo().getName(), npc.getNPC().getLocation()); } }, 0L, 1L).getTaskId(); + + if (this._integrateWithCompassModule) + { + CompassModule compassModule = getGame().getModule(CompassModule.class); + if (compassModule != null) + { + compassModule.addSupplier(() -> + getAllNPCs() + .stream() + .filter(ent -> + { + if (ent.getNPC() == null) + { + System.out.println("Null npc entity? " + ent.getPlayerInfo().getName() + " " + ent.getPlayerInfo().getUniqueId()); + return false; + } + return true; + }) + .map(npc -> new CompassEntry(npc.getNPC(), npc.getPlayerInfo().getName(), npc.getPlayerInfo().getName() + " (Disconnected)", npc.getPlayerInfo().getTeam(), npc.getPlayerInfo().getKit())) + .collect(Collectors.toList()) + ); + } + else + { + UtilServer.raiseError(new RuntimeException("CompassModule was null but integration was not disabled")); + } + } + } + + public CombatLogModule disableCompassModuleIntegration() + { + this._integrateWithCompassModule = false; + return this; } public CombatLogModule setNotifyPlayer(boolean notifyPlayer) @@ -80,44 +119,121 @@ public class CombatLogModule extends Module return this; } - public CombatLogModule setSpawnForCreative(boolean spawnForCreative) - { - this._spawnForCreative = spawnForCreative; - return this; - } - - public CombatLogModule setOnDeathAction(Consumer action) - { - this._onKill = action; - return this; - } - - public CombatLogModule setOnExpireAction(Consumer action) - { - this._onExpire = action; - return this; - } - public CombatLogModule setCombatLogTime(int time) { this._spawnTime = time; return this; } - /* - * Spawns a combat log NPC for the given player if that player does not already have one - */ - public void spawnLogoutNpc(Player player) + @EventHandler(priority = EventPriority.LOWEST) + public void on(PlayerQuitEvent event) { - if (hasLogoutNpc(player)) - return; - if (player.getGameMode() == GameMode.CREATIVE && !_spawnForCreative) + Player player = event.getPlayer(); + if (getGame().InProgress() && getGame().IsAlive(player)) + { + if (hasLogoutNpc(player)) + return; + + CombatLogNPCPreSpawnEvent preSpawnEvent = new CombatLogNPCPreSpawnEvent(player); + UtilServer.CallEvent(preSpawnEvent); + if (preSpawnEvent.isCancelled()) + return; + + CombatLogNPC npc = new CombatLogNPC(this, player); + _logoutNpcs.put(player.getUniqueId(), npc); + System.out.println(String.format("Spawned combat log NPC for %s!", player.getName())); + } + } + + @EventHandler + public void onJoin(PlayerJoinEvent event) + { + if (hasLogoutNpc(event.getPlayer())) + { + despawnLogoutNpc(event.getPlayer()); + } + + if (_killedBy.containsKey(event.getPlayer().getUniqueId())) + { + String name = _killedBy.remove(event.getPlayer().getUniqueId()); + if (_notifyPlayer && name != null) + { + UtilPlayer.message(event.getPlayer(), F.main("Combat Log", "While you were gone, you were killed by " + ChatColor.GREEN + name + C.mBody + ".")); + } + } + } + + @EventHandler + public void onEntityDeath(EntityDeathEvent event) + { + CombatLogNPC logoutNpc = getLogoutNpc(event.getEntity()); + + if (logoutNpc == null) return; - CombatLogNPC npc = new CombatLogNPC(this, player, getGame().getArcadeManager()); - npc.spawn(); - _logoutNpcs.put(player.getUniqueId(), npc); - System.out.println(String.format("Spawned combat log NPC for %s!", player.getName())); + CombatLogNPCKilledEvent npcKilledEvent = new CombatLogNPCKilledEvent(logoutNpc); + UtilServer.CallEvent(npcKilledEvent); + + logoutNpc.despawn(); + _logoutNpcs.remove(logoutNpc.getPlayerInfo().getUniqueId()); + + event.getDrops().clear(); // Clear the entity's item drops. If drops are wanted they should be dropped in the event + + if (logoutNpc.getLastDamager() != null) + { + _killedBy.put(logoutNpc.getPlayerInfo().getUniqueId(), logoutNpc.getLastDamager().getName()); + } + else + { + _killedBy.put(logoutNpc.getPlayerInfo().getUniqueId(), UtilParser.parseDamageCause(logoutNpc.getLastDamageCause())); + } + } + + @EventHandler(priority = EventPriority.LOWEST) + public void onEntityDamaged(EntityDamageEvent event) + { + CombatLogNPC logoutNpc = getLogoutNpc(event.getEntity()); + + if (logoutNpc == null) + return; + + LivingEntity damager = UtilEvent.GetDamagerEntity(event, true); + + Player damagerPlayer = null; + if (damager instanceof Player) + { + damagerPlayer = (Player) damager; + } + + if (getGame() instanceof TeamGame && damagerPlayer != null) + { + GameTeam damagerTeam = getGame().GetTeam(damagerPlayer); + if (damagerTeam == logoutNpc.getPlayerInfo().getTeam()) + { + event.setCancelled(true); + } + } + } + + @EventHandler(priority = EventPriority.MONITOR, ignoreCancelled = true) + public void recordDamage(EntityDamageEvent event) + { + CombatLogNPC logoutNpc = getLogoutNpc(event.getEntity()); + + if (logoutNpc == null) + return; + + logoutNpc.getNPC().getWorld().playSound(logoutNpc.getNPC().getLocation(), Sound.HURT_FLESH, 1, 1); + logoutNpc.recordDamage(event); + + getGame().getArcadeManager().runSync(() -> + { + CombatLogNPC npc = getLogoutNpc(event.getEntity()); + if (npc != null) + { + getGame().getModule(RejoinModule.class).getRejoinPlayerData(npc.getPlayerInfo().getName()).setHealth(npc.getNPC().getHealth()); + } + }); } public boolean hasLogoutNpc(Player player) @@ -142,42 +258,12 @@ public class CombatLogModule extends Module } } - @EventHandler(priority = EventPriority.LOWEST) - public void on(PlayerQuitEvent event) - { - if (getGame().InProgress() && getGame().IsAlive(event.getPlayer())) - { - spawnLogoutNpc(event.getPlayer()); - } - } - - @EventHandler - public void on(PlayerJoinEvent event) - { - if (hasLogoutNpc(event.getPlayer())) - { - despawnLogoutNpc(event.getPlayer()); - } - - if (_killedBy.containsKey(event.getPlayer().getUniqueId())) - { - String name = _killedBy.remove(event.getPlayer().getUniqueId()); - if (_notifyPlayer && name != null) - { - UtilPlayer.message(event.getPlayer(), F.main("Combat Log", "While you were gone, you were killed by " + ChatColor.GREEN + name + C.mBody + ".")); - } - } - } - @Override public void cleanup() { System.out.println("Killing combat log NPCs"); - for (CombatLogNPC npc : _logoutNpcs.values()) - { - npc.despawn(); - } + _logoutNpcs.values().forEach(CombatLogNPC::despawn); _logoutNpcs.clear(); _killedBy.clear(); @@ -198,79 +284,6 @@ public class CombatLogModule extends Module } } - @EventHandler(ignoreCancelled = true) - public void onEntityDeath(EntityDeathEvent event) - { - CombatLogNPC logoutNpc = getLogoutNpc(event.getEntity()); - - if (logoutNpc == null) - return; - - _onKill.accept(logoutNpc); - logoutNpc.onDeath(); - event.getDrops().clear(); // Clear the entity's item drops. If drops are wanted they can be added - - if (logoutNpc.getLastDamager() != null) - { - _killedBy.put(logoutNpc.getPlayerInfo().getUniqueId(), logoutNpc.getLastDamager().getName()); - } - else - { - _killedBy.put(logoutNpc.getPlayerInfo().getUniqueId(), UtilParser.parseDamageCause(logoutNpc.getLastDamageCause())); - } - - - if (getGame() instanceof TeamGame) - { - TeamGame teamGame = (TeamGame) getGame(); - teamGame.RejoinTimes.remove(logoutNpc.getPlayerInfo().getName()); - teamGame.RejoinKit.remove(logoutNpc.getPlayerInfo().getName()); - teamGame.RejoinTeam.remove(logoutNpc.getPlayerInfo().getName()); - teamGame.RejoinHealth.remove(logoutNpc.getPlayerInfo().getName()); - } - - _logoutNpcs.remove(logoutNpc.getPlayerInfo().getUniqueId()); - } - - @EventHandler(ignoreCancelled = true) - public void onEntityDamaged(EntityDamageEvent event) - { - CombatLogNPC logoutNpc = getLogoutNpc(event.getEntity()); - - if (logoutNpc != null) - { - LivingEntity damager = UtilEvent.GetDamagerEntity(event, true); - - Player damagerPlayer = null; - if (damager instanceof Player) - { - damagerPlayer = (Player) damager; - } - - if (getGame() instanceof TeamGame && damagerPlayer != null) - { - GameTeam damagerTeam = getGame().GetTeam(damagerPlayer); - if (damagerTeam == logoutNpc.getPlayerInfo().getTeam()) - { - event.setCancelled(true); - return; - } - } - - logoutNpc.getNPC().getWorld().playSound(logoutNpc.getNPC().getLocation(), Sound.HURT_FLESH, 1, 1); - - if (getGame() instanceof TeamGame) - { - getGame().getArcadeManager().runSync(() -> - { - ((TeamGame) getGame()).RejoinHealth.put(logoutNpc.getPlayerInfo().getName(), logoutNpc.getNPC().getHealth()); - }); - } - - logoutNpc.handleDamageEvent(event); - } - } - @EventHandler public void onUpdate(UpdateEvent event) { @@ -287,24 +300,45 @@ public class CombatLogModule extends Module { CombatLogNPC npc = iterator.next(); - if (Bukkit.getPlayerExact(npc.getPlayerInfo().getName()) != null) + if (npc.getNPC() == null) { - System.out.println("Removing NPC " + npc.getPlayerInfo().getName() + " for 1"); - npc.despawn(); - iterator.remove(); + try + { + new IllegalArgumentException("Strange, the NPC with data " + npc.getPlayerInfo().getName() + " " + npc.getPlayerInfo().getUniqueId() + " was null").printStackTrace(); + } + catch (Throwable t) + { + t.printStackTrace(); + } + finally + { + iterator.remove(); + } } - else if (!npc.isAlive()) + else { - System.out.println("Removing NPC " + npc.getPlayerInfo().getName() + " for 2"); - npc.despawn(); - iterator.remove(); - } - else if (npc.getAliveDuation() > this._spawnTime) - { - System.out.println("Removing NPC " + npc.getPlayerInfo().getName() + " for 3"); - _onExpire.accept(npc); - npc.despawn(); - iterator.remove(); + if (Bukkit.getPlayerExact(npc.getPlayerInfo().getName()) != null) + { + // Should never happen + System.out.println("Removing NPC " + npc.getPlayerInfo().getName() + " for 1"); + npc.despawn(); + iterator.remove(); + } + else if (!npc.isAlive()) + { + // Should never happen + System.out.println("Removing NPC " + npc.getPlayerInfo().getName() + " for 2"); + npc.despawn(); + iterator.remove(); + } + else if (npc.getAliveDuation() > this._spawnTime) + { + System.out.println("Removing NPC " + npc.getPlayerInfo().getName() + " for 3"); + CombatLogNPCExpiredEvent expiredEvent = new CombatLogNPCExpiredEvent(npc); + UtilServer.CallEvent(expiredEvent); + npc.despawn(); + iterator.remove(); + } } } } diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/modules/combatlog/CombatLogNPC.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/modules/combatlog/CombatLogNPC.java index 65e59f64b..974de2053 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/modules/combatlog/CombatLogNPC.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/modules/combatlog/CombatLogNPC.java @@ -1,28 +1,28 @@ package nautilus.game.arcade.game.modules.combatlog; +import net.minecraft.server.v1_8_R3.EntityCreeper; + import mineplex.core.common.util.UtilEnt; import mineplex.core.common.util.UtilTime; import mineplex.core.disguise.DisguiseManager; import mineplex.core.disguise.disguises.DisguiseBase; import mineplex.core.disguise.disguises.DisguisePlayer; import mineplex.core.hologram.Hologram; + import nautilus.game.arcade.ArcadeManager; + import org.bukkit.Location; +import org.bukkit.craftbukkit.v1_8_R3.CraftWorld; import org.bukkit.craftbukkit.v1_8_R3.entity.CraftPlayer; -import org.bukkit.entity.ArmorStand; -import org.bukkit.entity.Creeper; import org.bukkit.entity.Entity; import org.bukkit.entity.LivingEntity; import org.bukkit.entity.Player; import org.bukkit.event.entity.EntityDamageByEntityEvent; import org.bukkit.event.entity.EntityDamageEvent; -import org.bukkit.inventory.ItemStack; import org.bukkit.metadata.FixedMetadataValue; public class CombatLogNPC { - private CombatLogModule _module; - private PlayerInfo _playerInfo; private Hologram _hologram; @@ -39,29 +39,21 @@ public class CombatLogNPC private EntityDamageEvent.DamageCause _lastDamageCause; private Entity _lastDamager; - public CombatLogNPC(CombatLogModule module, Player player, ArcadeManager arcadeManager) + CombatLogNPC(CombatLogModule module, Player player) { - this._module = module; + ArcadeManager arcadeManager = module.getGame().getArcadeManager(); _playerInfo = new PlayerInfo(player, arcadeManager); - - _endingTime = System.currentTimeMillis() + this._module.getSpawnTime(); - _disguiseManager = arcadeManager.GetDisguise(); + + _spawnDate = System.currentTimeMillis(); + _endingTime = System.currentTimeMillis() + module.getSpawnTime(); + _hologram = new Hologram(arcadeManager.getHologramManager(), player.getEyeLocation().add(0, 1, 0), "Quitting in " + UtilTime.MakeStr(Math.max(_endingTime - System.currentTimeMillis(), 0))); - _spawnDate = 0; _spawnHealth = player.getHealth(); _maxHealth = player.getMaxHealth(); _hologram.start(); - } - - /** - * Called when the {@code _npc} associated with this CombatLogNPC is killed - * and thus drops all the owner's items. - */ - public void onDeath() - { - despawn(); + _npc = spawnNpc(player); } public void update() @@ -91,14 +83,6 @@ public class CombatLogNPC return System.currentTimeMillis() - _spawnDate; } - public void spawn() - { - if (_npc != null) despawn(); - - _npc = spawnNpc(getPlayer()); - _spawnDate = System.currentTimeMillis(); - } - public void despawn() { if (_disguise != null) @@ -130,15 +114,27 @@ public class CombatLogNPC return _playerInfo; } - public Player getPlayer() + public LivingEntity getNPC() { - return _playerInfo.getPlayer(); + return this._npc; + } + + public EntityDamageEvent.DamageCause getLastDamageCause() + { + return _lastDamageCause; + } + + public Entity getLastDamager() + { + return _lastDamager; } private LivingEntity spawnNpc(Player player) { Location spawnLoc = player.getLocation(); - LivingEntity skel = player.getWorld().spawn(spawnLoc, Creeper.class); + EntityCreeper entityCreeper = new EntityCreeper(((CraftWorld) spawnLoc.getWorld()).getHandle()); + LivingEntity skel = (LivingEntity) entityCreeper.getBukkitEntity(); + skel.teleport(spawnLoc); skel.setRemoveWhenFarAway(false); skel.setMetadata("CombatLogNPC", new FixedMetadataValue(_disguiseManager.getPlugin(), player.getUniqueId().toString())); skel.teleport(spawnLoc); @@ -147,7 +143,7 @@ public class CombatLogNPC skel.setFallDistance(player.getFallDistance()); // fixme potion effects, mobs don't target, entity collision (setting to ghost disables arrows and fishing rods), logging while sleeping // best solution to spawn EntityPlayer? - UtilEnt.Vegetate(skel); + UtilEnt.vegetate(skel); UtilEnt.silence(skel, true); skel.getEquipment().setHelmet(player.getInventory().getHelmet()); @@ -165,17 +161,7 @@ public class CombatLogNPC return skel; } - public Entity getLastDamager() - { - return _lastDamager; - } - - public LivingEntity getNPC() - { - return this._npc; - } - - public void handleDamageEvent(EntityDamageEvent event) + void recordDamage(EntityDamageEvent event) { this._lastDamageCause = event.getCause(); if (event instanceof EntityDamageByEntityEvent) @@ -188,9 +174,4 @@ public class CombatLogNPC this._lastDamager = null; } } - - public EntityDamageEvent.DamageCause getLastDamageCause() - { - return _lastDamageCause; - } } diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/modules/combatlog/CombatLogNPCExpiredEvent.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/modules/combatlog/CombatLogNPCExpiredEvent.java new file mode 100644 index 000000000..e26443d32 --- /dev/null +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/modules/combatlog/CombatLogNPCExpiredEvent.java @@ -0,0 +1,32 @@ +package nautilus.game.arcade.game.modules.combatlog; + +import org.bukkit.event.Event; +import org.bukkit.event.HandlerList; + +public class CombatLogNPCExpiredEvent extends Event +{ + private static final HandlerList HANDLERS = new HandlerList(); + + private final CombatLogNPC _npc; + + public CombatLogNPCExpiredEvent(CombatLogNPC npc) + { + _npc = npc; + } + + @Override + public HandlerList getHandlers() + { + return HANDLERS; + } + + public static HandlerList getHandlerList() + { + return HANDLERS; + } + + public CombatLogNPC getNpc() + { + return _npc; + } +} diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/modules/combatlog/CombatLogNPCKilledEvent.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/modules/combatlog/CombatLogNPCKilledEvent.java new file mode 100644 index 000000000..405b52e09 --- /dev/null +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/modules/combatlog/CombatLogNPCKilledEvent.java @@ -0,0 +1,32 @@ +package nautilus.game.arcade.game.modules.combatlog; + +import org.bukkit.event.Event; +import org.bukkit.event.HandlerList; + +public class CombatLogNPCKilledEvent extends Event +{ + private static final HandlerList HANDLERS = new HandlerList(); + + private final CombatLogNPC _npc; + + public CombatLogNPCKilledEvent(CombatLogNPC npc) + { + _npc = npc; + } + + @Override + public HandlerList getHandlers() + { + return HANDLERS; + } + + public static HandlerList getHandlerList() + { + return HANDLERS; + } + + public CombatLogNPC getNpc() + { + return _npc; + } +} diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/modules/combatlog/CombatLogNPCPreSpawnEvent.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/modules/combatlog/CombatLogNPCPreSpawnEvent.java new file mode 100644 index 000000000..d207dc1e8 --- /dev/null +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/modules/combatlog/CombatLogNPCPreSpawnEvent.java @@ -0,0 +1,48 @@ +package nautilus.game.arcade.game.modules.combatlog; + +import org.bukkit.entity.Player; +import org.bukkit.event.Cancellable; +import org.bukkit.event.Event; +import org.bukkit.event.HandlerList; + +public class CombatLogNPCPreSpawnEvent extends Event implements Cancellable +{ + private static final HandlerList HANDLERS = new HandlerList(); + + private final Player _player; + + private boolean _cancelled; + + public CombatLogNPCPreSpawnEvent(Player player) + { + _player = player; + } + + @Override + public HandlerList getHandlers() + { + return HANDLERS; + } + + public static HandlerList getHandlerList() + { + return HANDLERS; + } + + public Player getPlayer() + { + return _player; + } + + @Override + public boolean isCancelled() + { + return _cancelled; + } + + @Override + public void setCancelled(boolean b) + { + _cancelled = b; + } +} diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/modules/combatlog/PlayerInfo.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/modules/combatlog/PlayerInfo.java index 1a1405145..f3b1b86b8 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/modules/combatlog/PlayerInfo.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/modules/combatlog/PlayerInfo.java @@ -3,6 +3,8 @@ package nautilus.game.arcade.game.modules.combatlog; import mineplex.core.common.util.UtilInv; import nautilus.game.arcade.ArcadeManager; import nautilus.game.arcade.game.GameTeam; +import nautilus.game.arcade.kit.Kit; + import org.bukkit.Bukkit; import org.bukkit.ChatColor; import org.bukkit.Location; @@ -24,8 +26,9 @@ public class PlayerInfo private List _items; private ChatColor _teamColor = ChatColor.GRAY; private GameTeam _team; + private Kit _kit; - public PlayerInfo(Player player, ArcadeManager arcadeManager) + PlayerInfo(Player player, ArcadeManager arcadeManager) { _playerName = player.getName(); _playerUuid = player.getUniqueId(); @@ -35,6 +38,7 @@ public class PlayerInfo { _teamColor = _team.GetColor(); } + _kit = arcadeManager.GetGame().GetKit(player); } public String getName() @@ -47,11 +51,6 @@ public class PlayerInfo return _playerUuid; } - public Player getPlayer() - { - return Bukkit.getPlayerExact(_playerName); - } - public ChatColor getTeamColor() { return _teamColor; @@ -66,4 +65,9 @@ public class PlayerInfo { return this._items; } + + public Kit getKit() + { + return this._kit; + } } diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/addons/compass/CompassAttemptTargetEvent.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/modules/compass/CompassAttemptTargetEvent.java similarity index 78% rename from Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/addons/compass/CompassAttemptTargetEvent.java rename to Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/modules/compass/CompassAttemptTargetEvent.java index c6c846b10..7ecb57e1d 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/addons/compass/CompassAttemptTargetEvent.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/modules/compass/CompassAttemptTargetEvent.java @@ -1,5 +1,6 @@ -package nautilus.game.arcade.addons.compass; +package nautilus.game.arcade.game.modules.compass; +import org.bukkit.entity.Entity; import org.bukkit.entity.Player; import org.bukkit.event.Cancellable; import org.bukkit.event.HandlerList; @@ -9,26 +10,26 @@ public class CompassAttemptTargetEvent extends PlayerEvent implements Cancellabl { private static HandlerList _handlers = new HandlerList(); private boolean _cancelled = false; - - private Player _target; - - public CompassAttemptTargetEvent(Player player, Player target) + + private Entity _target; + + CompassAttemptTargetEvent(Player player, Entity target) { super(player); - + _target = target; } - - public Player getTarget() + + public Entity getTarget() { return _target; } - + public static HandlerList getHandlerList() { return _handlers; } - + @Override public HandlerList getHandlers() { diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/modules/compass/CompassEntry.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/modules/compass/CompassEntry.java new file mode 100644 index 000000000..7f22908c4 --- /dev/null +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/modules/compass/CompassEntry.java @@ -0,0 +1,49 @@ +package nautilus.game.arcade.game.modules.compass; + +import nautilus.game.arcade.game.GameTeam; +import nautilus.game.arcade.kit.Kit; + +import org.bukkit.entity.Entity; + +public class CompassEntry +{ + private Entity _entity; + private String _name; + private String _displayName; + private GameTeam _team; + private Kit _kit; + + public CompassEntry(Entity entity, String name, String displayName, GameTeam team, Kit kit) + { + _entity = entity; + _name = name; + _displayName = displayName; + _team = team; + _kit = kit; + } + + public Entity getEntity() + { + return _entity; + } + + public GameTeam getTeam() + { + return _team; + } + + public String getDisplayName() + { + return _displayName; + } + + public String getName() + { + return _name; + } + + public Kit getKit() + { + return _kit; + } +} diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/modules/compass/CompassModule.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/modules/compass/CompassModule.java new file mode 100644 index 000000000..fda3039b4 --- /dev/null +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/modules/compass/CompassModule.java @@ -0,0 +1,245 @@ +package nautilus.game.arcade.game.modules.compass; + +import java.util.ArrayList; +import java.util.Collection; +import java.util.Comparator; +import java.util.List; +import java.util.function.Supplier; +import java.util.stream.Collectors; +import java.util.stream.Stream; + +import org.bukkit.GameMode; +import org.bukkit.Material; +import org.bukkit.entity.Entity; +import org.bukkit.entity.Player; +import org.bukkit.event.EventHandler; +import org.bukkit.event.HandlerList; +import org.bukkit.event.block.Action; +import org.bukkit.event.entity.PlayerDeathEvent; +import org.bukkit.event.player.PlayerDropItemEvent; +import org.bukkit.event.player.PlayerInteractEvent; +import org.bukkit.inventory.ItemStack; + +import mineplex.core.common.util.C; +import mineplex.core.common.util.F; +import mineplex.core.common.util.UtilInv; +import mineplex.core.common.util.UtilItem; +import mineplex.core.common.util.UtilMath; +import mineplex.core.common.util.UtilPlayer; +import mineplex.core.common.util.UtilServer; +import mineplex.core.common.util.UtilTextBottom; +import mineplex.core.itemstack.ItemBuilder; +import mineplex.core.recharge.Recharge; +import mineplex.core.updater.UpdateType; +import mineplex.core.updater.event.UpdateEvent; + +import nautilus.game.arcade.events.GameStateChangeEvent; +import nautilus.game.arcade.game.Game; +import nautilus.game.arcade.game.GameTeam; +import nautilus.game.arcade.game.modules.Module; +import nautilus.game.arcade.game.modules.compass.menu.CompassMenu; + +public class CompassModule extends Module +{ + private static final ItemStack COMPASS_ITEM = + new ItemBuilder(Material.COMPASS) + .setAmount(1) + .setTitle(C.cGreen + C.Bold + "Tracking Compass") + .build(); + + private List>> _suppliers = new ArrayList<>(); + + private CompassMenu _compassMenu; + private boolean _giveCompassToAlive = false; + private boolean _giveCompassItem = true; + private boolean _giveCompassItemToSpectators = true; + + public CompassModule addSupplier(Supplier> supplier) + { + _suppliers.add(supplier); + return this; + } + + public CompassModule setGiveCompassToAlive(boolean b) + { + _giveCompassToAlive = b; + return this; + } + + public CompassModule setGiveCompass(boolean b) + { + _giveCompassItem = b; + return this; + } + + public CompassModule setGiveCompassToSpecs(boolean b) + { + _giveCompassItemToSpectators = b; + return this; + } + + @Override + public void cleanup() + { + HandlerList.unregisterAll(_compassMenu); + _compassMenu = null; + _suppliers = null; + } + + @Override + protected void setup() + { + _compassMenu = new CompassMenu(this); + _suppliers.add(() -> + getGame() + .GetPlayers(true) + .stream() + .map(player -> new CompassEntry(player, player.getName(), player.getName(), getGame().GetTeam(player), getGame().GetKit(player))) + .collect(Collectors.toList())); + } + + @EventHandler + public void update(UpdateEvent event) + { + if (event.getType() != UpdateType.FASTER) + return; + + if (!getGame().IsLive()) + return; + + for (Player player : UtilServer.getPlayers()) + { + if (!_giveCompassToAlive && getGame().IsAlive(player)) + continue; + + GameTeam team = getGame().GetTeam(player); + + stream() + .filter(entry -> entry.getEntity() != player) + .filter(entry -> getGame().GetTeamList().size() <= 1 || team == null || !team.equals(entry.getTeam())) + .filter(entry -> !UtilServer.CallEvent(new CompassAttemptTargetEvent(player, entry.getEntity())).isCancelled()) + .min(Comparator.comparingDouble(a -> UtilMath.offset(player, a.getEntity()))) + .ifPresent(target -> + { + Entity targetEntity = target.getEntity(); + GameTeam targetTeam = target.getTeam(); + + if (_giveCompassItem || (_giveCompassItemToSpectators && getGame().getArcadeManager().isSpectator(player))) + { + long count = UtilInv.getItems(player, true, true, true) + .stream() + .filter(this::isCompassItem) + .count(); + + if (count == 0) + { + player.getInventory().addItem(COMPASS_ITEM); + } + } + + + player.setCompassTarget(targetEntity.getLocation()); + + double heightDiff = targetEntity.getLocation().getY() - player.getLocation().getY(); + + //Action Bar + if (isCompassItem(player.getItemInHand())) + { + UtilTextBottom.display( + " " + C.cWhite + C.Bold + "Nearest Target: " + targetTeam.GetColor() + target.getDisplayName() + + " " + C.cWhite + C.Bold + "Distance: " + targetTeam.GetColor() + UtilMath.trim(1, UtilMath.offset(player, targetEntity)) + + " " + C.cWhite + C.Bold + "Height: " + targetTeam.GetColor() + UtilMath.trim(1, heightDiff), player + ); + } + }); + } + } + + @EventHandler + public void onDrop(PlayerDropItemEvent event) + { + if (!isCompassItem(event.getItemDrop().getItemStack())) + return; + + event.setCancelled(true); + + UtilPlayer.message(event.getPlayer(), F.main("Game", "You cannot drop " + F.item("Target Compass") + ".")); + } + + @EventHandler + public void DeathRemove(PlayerDeathEvent event) + { + event.getDrops().removeIf(this::isCompassItem); + } + + @EventHandler + public void SpectatorTeleport(PlayerInteractEvent event) + { + if (event.getAction() == Action.PHYSICAL) + return; + + Player player = event.getPlayer(); + + if (getGame().IsAlive(player)) + return; + + if (!isCompassItem(player.getItemInHand())) + return; + + if (player.getGameMode() == GameMode.SPECTATOR) + return; + + event.setCancelled(true); + + if (event.getAction() == Action.LEFT_CLICK_AIR || event.getAction() == Action.LEFT_CLICK_BLOCK) + { + if (!Recharge.Instance.use(player, "Spectate", 3000, true, false)) + { + return; + } + + spectateNearestPlayer(player); + } + else + { + _compassMenu.attemptShopOpen(player); + } + } + + private void spectateNearestPlayer(Player spectator) + { + stream() + .min((a, b) -> Double.compare(UtilMath.offset(spectator, a.getEntity()), UtilMath.offset(spectator, b.getEntity()))) + .map(CompassEntry::getEntity) + .ifPresent(target -> spectator.teleport(target.getLocation().add(0, 1, 0))); + } + + @EventHandler + public void closeShop(GameStateChangeEvent event) + { + if (event.GetState().equals(Game.GameState.End)) + { + UtilServer.getPlayersCollection().stream().filter(_compassMenu::isPlayerInShop).forEach(Player::closeInventory); + } + } + + @EventHandler + public void updateShop(UpdateEvent event) + { + if (event.getType() != UpdateType.SEC) + return; + + _compassMenu.update(); + } + + public Stream stream() + { + return _suppliers.stream().map(Supplier::get).flatMap(Collection::stream); + } + + // Defined here to make modifying definitions easier + public boolean isCompassItem(ItemStack item) + { + return UtilItem.isSimilar(COMPASS_ITEM, item, UtilItem.ItemAttribute.NAME, UtilItem.ItemAttribute.MATERIAL); + } +} diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/modules/compass/menu/CompassMenu.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/modules/compass/menu/CompassMenu.java new file mode 100644 index 000000000..81114a0b8 --- /dev/null +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/modules/compass/menu/CompassMenu.java @@ -0,0 +1,36 @@ +package nautilus.game.arcade.game.modules.compass.menu; + +import org.bukkit.entity.Player; + +import mineplex.core.shop.ShopBase; +import mineplex.core.shop.page.ShopPageBase; + +import nautilus.game.arcade.ArcadeManager; +import nautilus.game.arcade.game.modules.compass.CompassModule; +import nautilus.game.arcade.game.modules.compass.menu.page.CompassPage; + +public class CompassMenu extends ShopBase +{ + private CompassModule _compassModule; + + public CompassMenu(CompassModule module) + { + super(module.getGame().getArcadeManager(), module.getGame().getArcadeManager().GetClients(), module.getGame().getArcadeManager().GetDonation(), "Spectate Menu"); + this._compassModule = module; + } + + @Override + protected ShopPageBase> buildPagesFor(Player player) + { + return new CompassPage(this, _compassModule, player); + } + + public void update() + { + for (ShopPageBase> shopPage : getPlayerPageMap().values()) + { + shopPage.refresh(); + } + } + +} \ No newline at end of file diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/modules/compass/menu/button/CompassButton.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/modules/compass/menu/button/CompassButton.java new file mode 100644 index 000000000..ae6c23b67 --- /dev/null +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/modules/compass/menu/button/CompassButton.java @@ -0,0 +1,78 @@ +package nautilus.game.arcade.game.modules.compass.menu.button; + +import java.lang.ref.WeakReference; + +import mineplex.core.common.util.F; +import mineplex.core.shop.item.IButton; + +import nautilus.game.arcade.ArcadeManager; +import nautilus.game.arcade.game.modules.compass.CompassEntry; + +import org.bukkit.craftbukkit.v1_8_R3.entity.CraftPlayer; +import org.bukkit.entity.Entity; +import org.bukkit.entity.Player; +import org.bukkit.event.inventory.ClickType; + +/** + * Created by shaun on 14-09-26. + */ +public class CompassButton implements IButton +{ + private ArcadeManager _arcadeManager; + private Player _player; + private WeakReference _target; + + public CompassButton(ArcadeManager arcadeManager, Player player, CompassEntry target) + { + _arcadeManager = arcadeManager; + _player = player; + _target = new WeakReference<>(target.getEntity()); + } + + @Override + public void onClick(Player player, ClickType clickType) + { + // Make sure this player is still a spectator + if (!((CraftPlayer) player).getHandle().spectating) + return; + + if (_target.get() == null) + { + _player.sendMessage(F.main("Spectate", "That target does not exist anymore")); + return; + } + + Entity entity = _target.get(); + if (entity instanceof Player) + { + if (_arcadeManager.IsAlive((Player) entity)) + { + if (clickType == ClickType.RIGHT) + { + _player.closeInventory(); + _arcadeManager.getGameSpectatorManager().setSpectating(_player, entity); + } + else + { + _player.teleport(entity.getLocation().add(0, 1, 0)); + } + } + else + { + _player.sendMessage(F.main("Spectate", F.name(entity.getName()) + " is no longer alive.")); + } + } + else + { + if (clickType == ClickType.RIGHT) + { + _player.closeInventory(); + _arcadeManager.getGameSpectatorManager().setSpectating(_player, entity); + } + else + { + _player.teleport(entity.getLocation().add(0, 1, 0)); + } + } + } +} \ No newline at end of file diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/gui/spectatorMenu/page/SpectatorPage.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/modules/compass/menu/page/CompassPage.java similarity index 56% rename from Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/gui/spectatorMenu/page/SpectatorPage.java rename to Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/modules/compass/menu/page/CompassPage.java index 5a2a4fe36..c126adb79 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/gui/spectatorMenu/page/SpectatorPage.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/modules/compass/menu/page/CompassPage.java @@ -1,10 +1,10 @@ -package nautilus.game.arcade.gui.spectatorMenu.page; +package nautilus.game.arcade.game.modules.compass.menu.page; import java.util.ArrayList; import java.util.Arrays; import java.util.Collections; -import java.util.Comparator; import java.util.List; +import java.util.stream.Collectors; import org.bukkit.ChatColor; import org.bukkit.Material; @@ -13,39 +13,36 @@ import org.bukkit.inventory.ItemStack; import org.bukkit.inventory.meta.ItemMeta; import org.bukkit.inventory.meta.SkullMeta; -import mineplex.core.account.CoreClientManager; import mineplex.core.common.util.C; import mineplex.core.common.util.UtilColor; import mineplex.core.common.util.UtilMath; -import mineplex.core.donation.DonationManager; import mineplex.core.shop.item.IButton; import mineplex.core.shop.item.ShopItem; import mineplex.core.shop.page.ShopPageInventory; + import nautilus.game.arcade.ArcadeManager; -import nautilus.game.arcade.addons.compass.CompassAddon; import nautilus.game.arcade.game.GameTeam; -import nautilus.game.arcade.gui.spectatorMenu.SpectatorShop; -import nautilus.game.arcade.gui.spectatorMenu.button.SpectatorButton; +import nautilus.game.arcade.game.modules.compass.CompassEntry; +import nautilus.game.arcade.game.modules.compass.CompassModule; +import nautilus.game.arcade.game.modules.compass.menu.CompassMenu; +import nautilus.game.arcade.game.modules.compass.menu.button.CompassButton; -/** - * Created by shaun on 14-09-24. - */ - -public class SpectatorPage extends - ShopPageInventory +public class CompassPage extends + ShopPageInventory { - private ArcadeManager _arcadeManager; + private CompassModule _compassModule; private IButton[] _buttons; private ItemStack[] _items; - public SpectatorPage(CompassAddon plugin, ArcadeManager arcadeManager, - SpectatorShop shop, CoreClientManager clientManager, - DonationManager donationManager, Player player) + public CompassPage(CompassMenu menu, CompassModule compassModule, Player player) { - super(plugin, shop, clientManager, donationManager, "Spectator Menu", + super(compassModule.getGame().getArcadeManager(), + menu, + compassModule.getGame().getArcadeManager().GetClients(), + compassModule.getGame().getArcadeManager().GetDonation(), + "Spectator Menu", player); - - _arcadeManager = arcadeManager; + _compassModule = compassModule; buildPage(); } @@ -55,43 +52,31 @@ public class SpectatorPage extends _buttons = new IButton[54]; _items = new ItemStack[54]; - List teamList = new ArrayList(_arcadeManager.GetGame().GetTeamList()); + List teamList = new ArrayList<>(_compassModule.getGame().GetTeamList()); + List entries = _compassModule.stream().collect(Collectors.toList()); - int playerCount = _arcadeManager.GetGame().GetPlayers(true).size(); - - if (teamList.size() == 1 && playerCount < 28) + if (teamList.size() == 1 && entries.size() < 28) { - buildSingleTeam(teamList.get(0), playerCount); + buildSingleTeam(teamList.get(0), entries); } else { - buildMultipleTeams(teamList, playerCount); + buildMultipleTeams(teamList, entries); } } - private void buildSingleTeam(GameTeam team, int playerCount) + private void buildSingleTeam(GameTeam team, List entries) { - ArrayList players = team.GetPlayers(true); + Collections.sort(entries, (o1, o2) -> o1.getDisplayName().compareToIgnoreCase(o2.getDisplayName())); - Collections.sort(players, new Comparator() - { - - @Override - public int compare(Player o1, Player o2) - { - return o1.getName().compareToIgnoreCase(o2.getName()); - } - - }); - - _buttons = new IButton[19 + players.size()]; + _buttons = new IButton[19 + entries.size()]; _items = new ItemStack[_buttons.length]; - _items[13] = getTeamItem(team, playerCount); + _items[13] = getTeamItem(team, entries.size()); int slot = 19; - for (Player other : players) + for (CompassEntry other : entries) { addPlayerItem(slot, team, other); @@ -109,26 +94,20 @@ public class SpectatorPage extends } } - private void buildMultipleTeams(List teamList, int playerCount) + private void buildMultipleTeams(List teamList, List entries) { - Collections.sort(teamList, new Comparator() + Collections.sort(teamList, (o1, o2) -> { + int returns = o1.getDisplayName().compareToIgnoreCase( + o2.getDisplayName()); - @Override - public int compare(GameTeam o1, GameTeam o2) + if (returns == 0) { - int returns = o1.getDisplayName().compareToIgnoreCase( - o2.getDisplayName()); - - if (returns == 0) - { - return Long.compare(o1.getCreatedTime(), - o2.getCreatedTime()); - } - - return returns; + return Long.compare(o1.getCreatedTime(), + o2.getCreatedTime()); } + return returns; }); _buttons = new IButton[0]; @@ -138,16 +117,9 @@ public class SpectatorPage extends for (GameTeam team : teamList) { - ArrayList teamPlayers = team.GetPlayers(true); + List teamPlayers = entries.stream().filter(ent -> ent.getTeam() == team).collect(Collectors.toList()); - Collections.sort(teamPlayers, new Comparator() - { - @Override - public int compare(Player o1, Player o2) - { - return o1.getName().compareToIgnoreCase(o2.getName()); - } - }); + Collections.sort(teamPlayers, (o1, o2) -> o1.getDisplayName().compareToIgnoreCase(o2.getDisplayName())); int rowsNeeded = (int) Math.ceil(teamPlayers.size() / 8.0); @@ -163,7 +135,7 @@ public class SpectatorPage extends int playerIndex = row * 8; for (int i = 0; i < 8 && playerIndex < teamPlayers.size(); i++, playerIndex++) { - Player other = teamPlayers.get(playerIndex); + CompassEntry other = teamPlayers.get(playerIndex); int slot = woolSlot + 1 + i; addPlayerItem(slot, team, other); @@ -172,7 +144,7 @@ public class SpectatorPage extends // Add a line in between teams if the player count is low enough and // there are less than 4 teams - if (rowsNeeded == 1 && teamList.size() < 4 && playerCount <= 26) + if (rowsNeeded == 1 && teamList.size() < 4 && entries.size() <= 26) { currentRow += 2; @@ -186,15 +158,15 @@ public class SpectatorPage extends } } - private void addPlayerItem(int slot, GameTeam team, Player other) + private void addPlayerItem(int slot, GameTeam team, CompassEntry other) { ItemStack playerItem = getPlayerItem(team, other); - ShopItem shopItem = new ShopItem(playerItem, other.getName(), - other.getName(), 1, false, false); + ShopItem shopItem = new ShopItem(playerItem, other.getDisplayName(), + other.getDisplayName(), 1, false, false); _items[slot] = shopItem; - _buttons[slot] = new SpectatorButton(_arcadeManager, getPlayer(), other); + _buttons[slot] = new CompassButton(_compassModule.getGame().getArcadeManager(), getPlayer(), other); } private ItemStack getTeamItem(GameTeam team, int playerCount) @@ -211,18 +183,18 @@ public class SpectatorPage extends return item; } - private ItemStack getPlayerItem(GameTeam team, Player other) + private ItemStack getPlayerItem(GameTeam team, CompassEntry other) { ItemStack item = new ItemStack(Material.SKULL_ITEM, 1, (byte) 3); - double distance = UtilMath.offset(getPlayer(), other); - double heightDifference = other.getLocation().getY() + double distance = UtilMath.offset(getPlayer(), other.getEntity()); + double heightDifference = other.getEntity().getLocation().getY() - getPlayer().getLocation().getY(); ArrayList lore = new ArrayList(); lore.add(" "); lore.add(ChatColor.RESET + C.cYellow + "Kit: " + C.cWhite - + _arcadeManager.GetGame().GetKit(other).GetName()); + + other.getKit().GetName()); lore.add(ChatColor.RESET + C.cYellow + "Distance: " + C.cWhite + UtilMath.trim(1, distance)); lore.add(ChatColor.RESET + C.cYellow + "Height Difference: " + C.cWhite @@ -232,7 +204,7 @@ public class SpectatorPage extends lore.add(ChatColor.YELLOW + "Right Click" + ChatColor.RESET + " Spectate"); SkullMeta skullMeta = ((SkullMeta) item.getItemMeta()); skullMeta.setOwner(other.getName()); - skullMeta.setDisplayName(team.GetColor() + other.getName()); + skullMeta.setDisplayName(team.GetColor() + other.getDisplayName()); skullMeta.setLore(lore); item.setItemMeta(skullMeta); diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/gui/privateServer/button/ChooseMapButton.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/gui/privateServer/button/ChooseMapButton.java index a56b7e67e..768ffc422 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/gui/privateServer/button/ChooseMapButton.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/gui/privateServer/button/ChooseMapButton.java @@ -8,13 +8,6 @@ import nautilus.game.arcade.ArcadeManager; import nautilus.game.arcade.GameType; import nautilus.game.arcade.gui.privateServer.PrivateServerShop; -/** - * Created by WilliamTiger. - * All the code and any API's associated with it - * are not to be used anywhere else without written - * consent of William Burns. 2015. - * 08/07/2015 - */ public class ChooseMapButton implements IButton { private ArcadeManager _arcadeManager; @@ -33,11 +26,13 @@ public class ChooseMapButton implements IButton @Override public void onClick(Player player, ClickType clickType) { - _arcadeManager.GetGameCreationManager().MapSource = _gameType.GetName(); - if(_gameType.getMapSource() != null) - _arcadeManager.GetGameCreationManager().MapSource = _gameType.getMapSource()[0].GetName(); + _arcadeManager.GetGameCreationManager().MapSource = _gameType; + if (_gameType.getMapSource() != null) + { + _arcadeManager.GetGameCreationManager().MapSource = _gameType.getMapSource()[0]; + } - _arcadeManager.GetGameCreationManager().MapPref = _map; + _arcadeManager.GetGameCreationManager().MapPref = _map.replaceAll(" ", ""); _arcadeManager.GetGame().setGame(_gameType, player, true); player.closeInventory(); return; diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/gui/privateServer/button/GameVotingButton.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/gui/privateServer/button/GameVotingButton.java index a3193d8f1..c46561119 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/gui/privateServer/button/GameVotingButton.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/gui/privateServer/button/GameVotingButton.java @@ -8,13 +8,6 @@ import nautilus.game.arcade.ArcadeManager; import nautilus.game.arcade.gui.privateServer.PrivateServerShop; import nautilus.game.arcade.gui.privateServer.page.GameVotingPage; -/** - * Created by WilliamTiger. - * All the code and any API's associated with it - * are not to be used anywhere else without written - * consent of William Burns. 2015. - * 24/07/15 - */ public class GameVotingButton implements IButton { private ArcadeManager _arcadeManager; diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/gui/privateServer/button/WhitelistButton.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/gui/privateServer/button/WhitelistButton.java index 30a48c15e..71f9143dc 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/gui/privateServer/button/WhitelistButton.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/gui/privateServer/button/WhitelistButton.java @@ -11,13 +11,6 @@ import nautilus.game.arcade.ArcadeManager; import nautilus.game.arcade.gui.privateServer.PrivateServerShop; import nautilus.game.arcade.gui.privateServer.page.WhitelistedPage; -/** - * Created by WilliamTiger. - * All the code and any API's associated with it - * are not to be used anywhere else without written - * consent of William Burns. 2015. - * 29/07/15 - */ public class WhitelistButton implements IButton { private ArcadeManager _arcadeManager; diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/gui/privateServer/page/ChooseMapPage.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/gui/privateServer/page/ChooseMapPage.java index 200167461..2677821a2 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/gui/privateServer/page/ChooseMapPage.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/gui/privateServer/page/ChooseMapPage.java @@ -9,13 +9,6 @@ import nautilus.game.arcade.GameType; import nautilus.game.arcade.gui.privateServer.PrivateServerShop; import nautilus.game.arcade.gui.privateServer.button.ChooseMapButton; -/** - * Created by WilliamTiger. - * All the code and any API's associated with it - * are not to be used anywhere else without written - * consent of William Burns. 2015. - * 08/07/2015 - */ public class ChooseMapPage extends BasePage { private GameType _gameType; diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/gui/privateServer/page/GameVotingPage.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/gui/privateServer/page/GameVotingPage.java index 323630e5e..22dc1f1c7 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/gui/privateServer/page/GameVotingPage.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/gui/privateServer/page/GameVotingPage.java @@ -17,13 +17,6 @@ import nautilus.game.arcade.ArcadeManager; import nautilus.game.arcade.GameType; import nautilus.game.arcade.gui.privateServer.PrivateServerShop; -/** - * Created by WilliamTiger. - * All the code and any API's associated with it - * are not to be used anywhere else without written - * consent of William Burns. 2015. - * 24/07/15 - */ public class GameVotingPage extends BasePage { public GameVotingPage(ArcadeManager plugin, PrivateServerShop shop, Player player) diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/gui/privateServer/page/MenuPage.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/gui/privateServer/page/MenuPage.java index 94f2730d9..c31d8d7cd 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/gui/privateServer/page/MenuPage.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/gui/privateServer/page/MenuPage.java @@ -11,6 +11,7 @@ import org.bukkit.inventory.meta.ItemMeta; import mineplex.core.common.Rank; import mineplex.core.common.util.C; import mineplex.core.common.util.UtilServer; +import mineplex.core.itemstack.ItemBuilder; import mineplex.core.shop.item.ShopItem; import nautilus.game.arcade.ArcadeManager; import nautilus.game.arcade.gui.privateServer.PrivateServerShop; @@ -100,9 +101,12 @@ public class MenuPage extends BasePage GameVotingButton votingButton = new GameVotingButton(getPlugin(), getShop()); addButton(3 + 27, new ShopItem(Material.BOOKSHELF, "Game Voting", new String[]{}, 1, false), votingButton); - - WhitelistButton whitelistButton = new WhitelistButton(getPlugin(), getShop()); - addButton(5 + 27, new ShopItem(Material.PAPER, "Whitelisted Players", new String[]{}, 1, false), whitelistButton); + + if (!_manager.isCommunityServer()) + { + WhitelistButton whitelistButton = new WhitelistButton(getPlugin(), getShop()); + addButton(5 + 27, new ShopItem(Material.PAPER, "Whitelisted Players", new String[]{}, 1, false), whitelistButton); + } } OptionsButton optionsButton = new OptionsButton(getPlugin(), getShop()); @@ -114,6 +118,24 @@ public class MenuPage extends BasePage private ShopItem getOwnerHead() { + if (_manager.isCommunityServer()) + { + String title = C.cGreen + C.Bold + _manager.getOwner().getName() + "'s Mineplex Community Server"; + ItemStack head = new ItemBuilder(new ItemStack(_manager.getOwner().getFavoriteGame().getMaterial(), 1, _manager.getOwner().getFavoriteGame().getMaterialData(), null)).setTitle(ChatColor.RESET + title).build(); + ArrayList lore = new ArrayList(); + lore.add(" "); + lore.add(ChatColor.RESET + C.cYellow + "Server Name: " + C.cWhite + getPlugin().getPlugin().getConfig().getString("serverstatus.name")); + lore.add(ChatColor.RESET + C.cYellow + "Players Online: " + C.cWhite + UtilServer.getPlayers().length); + lore.add(ChatColor.RESET + C.cYellow + "Players Max: " + C.cWhite + getPlugin().GetServerConfig().MaxPlayers); + lore.add(" "); + lore.add(ChatColor.RESET + "Left-Click to increase Max Players"); + lore.add(ChatColor.RESET + "Right-Click to decrease Max Players"); + ItemMeta meta = head.getItemMeta(); + meta.setLore(lore); + head.setItemMeta(meta); + + return new ShopItem(head, title, title, 1, false, false); + } String title = C.cGreen + C.Bold + getPlugin().GetHost() + "'s Mineplex Private Server"; ItemStack head = getPlayerHead(getPlugin().GetHost(), ChatColor.RESET + title); ArrayList lore = new ArrayList(); diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/gui/privateServer/page/OptionsPage.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/gui/privateServer/page/OptionsPage.java index e68206e2f..4ac322c5b 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/gui/privateServer/page/OptionsPage.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/gui/privateServer/page/OptionsPage.java @@ -33,24 +33,30 @@ public class OptionsPage extends BasePage //GameAutoStart //GameTimeout //PlayerKickIdle - - buildPreference(11, Material.EYE_OF_ENDER, "Public Server", _config.PublicServer, new IButton() - { - @Override - public void onClick(Player player, ClickType clickType) - { - togglePublic(); - } - }); - buildPreference(13, Material.PAPER, "Enforce Whitelist", _config.PlayerServerWhitelist, new IButton() + if (!_plugin.GetGameHostManager().isCommunityServer()) { - @Override - public void onClick(Player player, ClickType clickType) + buildPreference(11, Material.EYE_OF_ENDER, "Public Server", _config.PublicServer, new IButton() { - toggleWhitelist(); - } - }); + @Override + public void onClick(Player player, ClickType clickType) + { + togglePublic(); + } + }); + } + + if (!_plugin.GetGameHostManager().isCommunityServer()) + { + buildPreference(13, Material.PAPER, "Enforce Whitelist", _config.PlayerServerWhitelist, new IButton() + { + @Override + public void onClick(Player player, ClickType clickType) + { + toggleWhitelist(); + } + }); + } buildPreference(15, Material.RAILS, "Force Team Balancing", _config.TeamForceBalance, new IButton() { diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/gui/privateServer/page/WhitelistedPage.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/gui/privateServer/page/WhitelistedPage.java index 101ba9a18..0c8c8f6de 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/gui/privateServer/page/WhitelistedPage.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/gui/privateServer/page/WhitelistedPage.java @@ -1,7 +1,5 @@ package nautilus.game.arcade.gui.privateServer.page; -import java.util.List; - import org.bukkit.Bukkit; import org.bukkit.entity.Player; import org.bukkit.event.inventory.ClickType; @@ -9,17 +7,12 @@ import org.bukkit.inventory.ItemStack; import mineplex.core.common.util.C; import mineplex.core.common.util.F; +import mineplex.core.portal.Intent; import mineplex.core.shop.item.IButton; + import nautilus.game.arcade.ArcadeManager; import nautilus.game.arcade.gui.privateServer.PrivateServerShop; -/** - * Created by WilliamTiger. - * All the code and any API's associated with it - * are not to be used anywhere else without written - * consent of William Burns. 2015. - * 29/07/15 - */ public class WhitelistedPage extends BasePage { public WhitelistedPage(ArcadeManager plugin, PrivateServerShop shop, Player player) @@ -46,8 +39,8 @@ public class WhitelistedPage extends BasePage getPlugin().GetGameHostManager().getWhitelist().remove(s); removeButton(i); getPlayer().sendMessage(F.main("Whitelist", "§e" + s + " §7is no longer whitelisted.")); - if (Bukkit.getPlayer(s)!=null) - getPlugin().GetPortal().sendToHub(Bukkit.getPlayer(s), "You are no longer whitelisted."); + if (Bukkit.getPlayer(s) != null) + getPlugin().GetPortal().sendToHub(Bukkit.getPlayer(s), "You are no longer whitelisted.", Intent.KICK); } }); diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/gui/spectatorMenu/SpectatorShop.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/gui/spectatorMenu/SpectatorShop.java deleted file mode 100644 index f7dad01e5..000000000 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/gui/spectatorMenu/SpectatorShop.java +++ /dev/null @@ -1,40 +0,0 @@ -package nautilus.game.arcade.gui.spectatorMenu; - -import mineplex.core.account.CoreClientManager; -import mineplex.core.donation.DonationManager; -import mineplex.core.shop.ShopBase; -import mineplex.core.shop.page.ShopPageBase; -import nautilus.game.arcade.ArcadeManager; -import nautilus.game.arcade.addons.compass.CompassAddon; -import nautilus.game.arcade.gui.spectatorMenu.page.SpectatorPage; -import org.bukkit.entity.Player; - -/** - * Created by shaun on 14-09-24. - */ -public class SpectatorShop extends ShopBase -{ - - private ArcadeManager _arcadeManager; - - public SpectatorShop(CompassAddon plugin, ArcadeManager arcadeManager, CoreClientManager clientManager, DonationManager donationManager) - { - super(plugin, clientManager, donationManager, "Spectate Menu"); - _arcadeManager = arcadeManager; - } - - @Override - protected ShopPageBase> buildPagesFor(Player player) - { - return new SpectatorPage(getPlugin(), _arcadeManager, this, getClientManager(), getDonationManager(), player); - } - - public void update() - { - for (ShopPageBase> shopPage : getPlayerPageMap().values()) - { - shopPage.refresh(); - } - } - -} \ No newline at end of file diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/gui/spectatorMenu/button/SpectatorButton.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/gui/spectatorMenu/button/SpectatorButton.java deleted file mode 100644 index c1f189998..000000000 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/gui/spectatorMenu/button/SpectatorButton.java +++ /dev/null @@ -1,56 +0,0 @@ -package nautilus.game.arcade.gui.spectatorMenu.button; - -import org.bukkit.GameMode; -import org.bukkit.craftbukkit.v1_8_R3.entity.CraftPlayer; -import org.bukkit.entity.Player; -import org.bukkit.event.inventory.ClickType; - -import mineplex.core.common.util.C; -import mineplex.core.common.util.F; -import mineplex.core.common.util.UtilMath; -import mineplex.core.common.util.UtilPlayer; -import mineplex.core.common.util.UtilTextBottom; -import mineplex.core.shop.item.IButton; -import nautilus.game.arcade.ArcadeManager; - -/** - * Created by shaun on 14-09-26. - */ -public class SpectatorButton implements IButton -{ - private ArcadeManager _arcadeManager; - private Player _player; - private Player _target; - - public SpectatorButton(ArcadeManager arcadeManager, Player player, Player target) - { - _arcadeManager = arcadeManager; - _player = player; - _target = target; - } - - @Override - public void onClick(Player player, ClickType clickType) - { - // Make sure this player is still a spectator - if (!((CraftPlayer) player).getHandle().spectating) - return; - - if (_arcadeManager.IsAlive(_target)) - { - if(clickType == ClickType.RIGHT) - { - _player.closeInventory(); - _arcadeManager.getGameSpectatorManager().setSpectating(_player, _target); - } - else - { - _player.teleport(_target.getLocation().add(0, 1, 0)); - } - } - else - { - _player.sendMessage(F.main("Spectate", F.name(_target.getName()) + " is no longer alive.")); - } - } -} \ No newline at end of file diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/kit/Kit.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/kit/Kit.java index 8f9f95b5a..bc6d41347 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/kit/Kit.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/kit/Kit.java @@ -166,7 +166,7 @@ public abstract class Kit implements Listener skel.setSkeletonType(SkeletonType.WITHER); } - UtilEnt.Vegetate(entity, true); + UtilEnt.vegetate(entity, true); UtilEnt.ghost(entity, true, false); UtilEnt.setFakeHead(entity, true); diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/kit/ProgressingKit.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/kit/ProgressingKit.java index 52358ad4d..a93f7415e 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/kit/ProgressingKit.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/kit/ProgressingKit.java @@ -365,9 +365,9 @@ public abstract class ProgressingKit extends Kit implements ProgressiveKit if (this.GetAvailability() == KitAvailability.Free || Manager.hasKitsUnlocked(player) || (this.GetAvailability() == KitAvailability.Achievement && Manager.GetAchievement().hasCategory(player, this.getAchievementRequirement())) || - donor.OwnsUnknownPackage(Manager.GetGame().GetType().GetKitGameName(Manager.GetGame()) + " " + this.GetName()) || + donor.ownsUnknownSalesPackage(Manager.GetGame().GetType().GetKitGameName(Manager.GetGame()) + " " + this.GetName()) || Manager.GetClients().Get(player).GetRank().has(Rank.MAPDEV) || - donor.OwnsUnknownPackage(Manager.GetServerConfig().ServerType + " ULTRA") || Manager.GetServerConfig().Tournament) + donor.ownsUnknownSalesPackage(Manager.GetServerConfig().ServerType + " ULTRA") || Manager.GetServerConfig().Tournament) { return true; } diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/kit/perks/PerkHorsePet.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/kit/perks/PerkHorsePet.java index 051a3e8d1..fe636fede 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/kit/perks/PerkHorsePet.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/kit/perks/PerkHorsePet.java @@ -62,7 +62,6 @@ public class PerkHorsePet extends Perk return; Manager.GetGame().CreatureAllowOverride = true; - Manager.GetGame().CreatureAllowOverride = false; KitModifier kitModifier = getHorseType(player); final Horse.Variant variant; @@ -103,11 +102,12 @@ public class PerkHorsePet extends Perk horse.setMaxHealth(40); horse.setHealth(40); - UtilEnt.Vegetate(horse); + UtilEnt.vegetate(horse); _horseMap.put(player, horse); horse.getWorld().playSound(horse.getLocation(), Sound.HORSE_ANGRY, 2f, 1f); + Manager.GetGame().CreatureAllowOverride = false; } @EventHandler diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/kit/perks/PerkSkeletons.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/kit/perks/PerkSkeletons.java index af6651b66..e393104bf 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/kit/perks/PerkSkeletons.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/kit/perks/PerkSkeletons.java @@ -108,8 +108,6 @@ public class PerkSkeletons extends Perk Player killed = (Player) event.GetEvent().getEntity(); Manager.GetGame().CreatureAllowOverride = true; - Manager.GetGame().CreatureAllowOverride = false; - KitModifier kitModifier = getSkeletonType(killer); final Skeleton.SkeletonType type; @@ -143,6 +141,8 @@ public class PerkSkeletons extends Perk skel = UtilVariant.spawnWitherSkeleton(killed.getLocation()); } + Manager.GetGame().CreatureAllowOverride = false; + if (kitModifier != null && kitModifier == KitModifier.Survival_Games_Necromancer_Zombie) { DisguiseZombie disguiseZombie = new DisguiseZombie(skel); diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/kit/perks/data/FissureData.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/kit/perks/data/FissureData.java index 93e2e2754..3830cdf9a 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/kit/perks/data/FissureData.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/kit/perks/data/FissureData.java @@ -17,6 +17,8 @@ import mineplex.core.common.util.UtilAlg; import mineplex.core.common.util.UtilBlock; import mineplex.core.common.util.UtilMath; import mineplex.core.common.util.UtilPlayer; + +import nautilus.game.arcade.game.games.smash.TeamSuperSmash; import nautilus.game.arcade.game.games.smash.perks.golem.PerkFissure; public class FissureData @@ -155,7 +157,7 @@ public class FissureData } - if(Host.Manager.GetGame().GetTeam(_player).GetPlayers(true).contains(cur)) + if(Host.Manager.GetGame() instanceof TeamSuperSmash && Host.Manager.GetGame().GetTeam(_player).GetPlayers(true).contains(cur)) { continue; } diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/managers/GameAchievementManager.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/managers/GameAchievementManager.java index 9997234f9..a14d161d7 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/managers/GameAchievementManager.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/managers/GameAchievementManager.java @@ -3,6 +3,7 @@ package nautilus.game.arcade.managers; import mineplex.core.achievement.Achievement; import mineplex.core.achievement.AchievementData; import mineplex.core.achievement.AchievementLog; +import mineplex.core.common.currency.GlobalCurrency; import mineplex.core.common.util.C; import mineplex.core.common.util.Callback; import mineplex.core.common.util.F; @@ -111,13 +112,7 @@ public class GameAchievementManager implements Listener { public void run(Boolean completed) { - Manager.GetDonation().RewardGems(new Callback() - { - public void run(Boolean completed) - { - - } - }, type.getName(), player.getName(), player.getUniqueId(), type.getGemReward()); + Manager.GetDonation().rewardCurrency(GlobalCurrency.GEM, player, type.getName(), type.getGemReward()); } }, player, type.getName()); } diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/managers/GameCreationManager.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/managers/GameCreationManager.java index eaa309225..0c9cf5759 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/managers/GameCreationManager.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/managers/GameCreationManager.java @@ -4,7 +4,7 @@ import mineplex.core.common.util.UtilMath; import mineplex.core.common.util.UtilServer; import mineplex.core.common.util.UtilTime; import mineplex.core.itemstack.ItemStackFactory; -import mineplex.core.timing.TimingManager; +import mineplex.core.common.timing.TimingManager; import mineplex.core.updater.UpdateType; import mineplex.core.updater.event.UpdateEvent; import mineplex.minecraft.game.core.combat.CombatManager.AttackReason; @@ -41,12 +41,12 @@ public class GameCreationManager implements Listener private GameType _nextGame = null; private String _lastMap = ""; - private String _lastMode = ""; + private GameMode _lastMode = null; private ArrayList _lastGames = new ArrayList(); public String MapPref = null; - public String MapSource = null; - public String ModePref = null; + public GameType MapSource = null; + public GameMode ModePref = null; public GameCreationManager(ArcadeManager manager) { @@ -87,8 +87,7 @@ public class GameCreationManager implements Listener { if (Manager.GetGame().GetState() == GameState.Dead) { - HandlerList.unregisterAll(Manager.GetGame()); - + Manager.GetGame().disable(); //Schedule Cleanup _ended.add(Manager.GetGame()); @@ -105,14 +104,6 @@ public class GameCreationManager implements Listener while (gameIterator.hasNext()) { Game game = gameIterator.next(); - - game.cleanupModules(); - game.disable(); - - HandlerList.unregisterAll(game); - - for (StatTracker tracker : game.getStatTrackers()) - HandlerList.unregisterAll(tracker); TimingManager.start("GameCreationManager - Attempting Removal - " + game.GetName()); @@ -122,8 +113,7 @@ public class GameCreationManager implements Listener gameIterator.remove(); } else - { - + { boolean removedPlayers = false; if (UtilTime.elapsed(game.GetStateTime(), 20000)) { @@ -153,7 +143,7 @@ public class GameCreationManager implements Listener game.WorldData.Uninitialize(); game.WorldData = null; gameIterator.remove(); - + TimingManager.stop("GameCreationManager - Uninit World - " + game.GetName()); }; } @@ -220,7 +210,7 @@ public class GameCreationManager implements Listener { for (GameMode modes : gameType.getGameModes()) { - if (modes.getName().replaceAll(" ", "").toUpperCase().startsWith(ModePref.toUpperCase())) + if (modes.equals(ModePref)) { _lastMode = ModePref; mode = modes; @@ -274,11 +264,11 @@ public class GameCreationManager implements Listener TimingManager.stop("DisplayNext"); TimingManager.start("registerEvents"); - UtilServer.getServer().getPluginManager().registerEvents(Manager.GetGame(), Manager.getPlugin()); + Manager.GetGame().getLifetime().start(GameState.Loading); TimingManager.stop("registerEvents"); } - private String randomGameMode(GameType type) + private GameMode randomGameMode(GameType type) { ArrayList modes = Manager.GetServerConfig().GameModeList; if (modes.size() == 0) @@ -289,13 +279,13 @@ public class GameCreationManager implements Listener String mode = modes.get(UtilMath.r(modes.size())); int i = 0; - while (mode.equalsIgnoreCase(_lastMode) && !containsMode(gameModes, mode) && i != 25) + while ((_lastMode == null || mode.equalsIgnoreCase(_lastMode.getName())) && !containsMode(gameModes, mode) && i != 25) { mode = modes.get(UtilMath.r(modes.size())); i++; } - return mode.replace(" ", ""); + return getMode(gameModes, mode); } private boolean containsMode(GameMode[] modes, String mode) @@ -310,6 +300,18 @@ public class GameCreationManager implements Listener return false; } + private GameMode getMode(GameMode[] modes, String mode) + { + for (GameMode otherMode : modes) + { + if (otherMode.getName().equalsIgnoreCase(mode)) + { + return otherMode; + } + } + return null; + } + public void SetNextGameType(GameType type) { _nextGame = type; diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/managers/GameFlagManager.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/managers/GameFlagManager.java index a76cf81ab..b7a2119d0 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/managers/GameFlagManager.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/managers/GameFlagManager.java @@ -857,7 +857,7 @@ public class GameFlagManager implements Listener if (team != null) { if (game.InProgress()) - team.SetPlayerState(event.getPlayer(), PlayerState.OUT); + game.SetPlayerState(event.getPlayer(), PlayerState.OUT); else team.RemovePlayer(event.getPlayer()); } @@ -896,7 +896,7 @@ public class GameFlagManager implements Listener //Not Playing for (Player player : UtilServer.getPlayers()) { - if (game == null || game.GetState() == GameState.Recruit || !game.IsAlive(player)) + if (game == null || game.GetState() == GameState.Recruit || (!game.IsAlive(player) && game.shouldHeal(player))) { player.setMaxHealth(20); player.setHealth(20); @@ -1033,21 +1033,9 @@ public class GameFlagManager implements Listener return; //Remove Kit - game.RemoveTeamPreference(event.getPlayer()); - game.GetPlayerKits().remove(event.getPlayer()); - game.GetPlayerGems().remove(event.getPlayer()); - - //Remove Team - GameTeam team = game.GetTeam(event.getPlayer()); - if (team != null) - { - if (game.InProgress()) - team.SetPlayerState(event.getPlayer(), PlayerState.OUT); - else - team.RemovePlayer(event.getPlayer()); - } - - Manager.addSpectator(event.getPlayer(), false); + game.disqualify(event.getPlayer()); + + event.setCancelled(true); } @EventHandler @@ -1230,17 +1218,17 @@ public class GameFlagManager implements Listener } } } - + @EventHandler - public void AntiHackStrict(GameStateChangeEvent event) + public void AntiHackStrict(GameStateChangeEvent event) { if (event.GetState() == GameState.Prepare || event.GetState() == GameState.Live) Managers.get(AntiHack.class).setStrict(event.GetGame().StrictAntiHack); - + else Managers.get(AntiHack.class).setStrict(true); } - + @EventHandler public void PlayerKillCommandCancel(PlayerCommandPreprocessEvent event) { diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/managers/GameHostManager.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/managers/GameHostManager.java index 2d8ce0e93..49e45ee5e 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/managers/GameHostManager.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/managers/GameHostManager.java @@ -4,25 +4,6 @@ import java.util.ArrayList; import java.util.HashMap; import java.util.HashSet; -import mineplex.core.common.Rank; -import mineplex.core.common.util.C; -import mineplex.core.common.util.F; -import mineplex.core.common.util.UtilGear; -import mineplex.core.common.util.UtilPlayer; -import mineplex.core.common.util.UtilServer; -import mineplex.core.common.util.UtilTextBottom; -import mineplex.core.common.util.UtilTime; -import mineplex.core.game.GameCategory; -import mineplex.core.itemstack.ItemStackFactory; -import mineplex.core.punish.PunishClient; -import mineplex.core.updater.UpdateType; -import mineplex.core.updater.event.UpdateEvent; -import nautilus.game.arcade.ArcadeManager; -import nautilus.game.arcade.GameType; -import nautilus.game.arcade.game.Game.GameState; -import nautilus.game.arcade.gui.privateServer.PrivateServerShop; -import nautilus.game.arcade.gui.privateServer.page.GameVotingPage; - import org.bukkit.Bukkit; import org.bukkit.ChatColor; import org.bukkit.GameMode; @@ -30,7 +11,6 @@ import org.bukkit.Material; import org.bukkit.Sound; import org.bukkit.entity.Player; import org.bukkit.event.EventHandler; -import org.bukkit.event.HandlerList; import org.bukkit.event.Listener; import org.bukkit.event.inventory.InventoryType; import org.bukkit.event.player.PlayerCommandPreprocessEvent; @@ -40,6 +20,31 @@ import org.bukkit.event.player.PlayerLoginEvent; import org.bukkit.event.player.PlayerQuitEvent; import org.bukkit.plugin.Plugin; +import mineplex.core.Managers; +import mineplex.core.common.Rank; +import mineplex.core.common.util.C; +import mineplex.core.common.util.F; +import mineplex.core.common.util.UtilGear; +import mineplex.core.common.util.UtilPlayer; +import mineplex.core.common.util.UtilServer; +import mineplex.core.common.util.UtilTextBottom; +import mineplex.core.common.util.UtilTime; +import mineplex.core.communities.Community; +import mineplex.core.communities.CommunityDisbandEvent; +import mineplex.core.communities.CommunityManager; +import mineplex.core.communities.CommunityRole; +import mineplex.core.game.GameCategory; +import mineplex.core.itemstack.ItemStackFactory; +import mineplex.core.portal.GenericServer; +import mineplex.core.portal.Intent; +import mineplex.core.updater.UpdateType; +import mineplex.core.updater.event.UpdateEvent; +import nautilus.game.arcade.ArcadeManager; +import nautilus.game.arcade.GameType; +import nautilus.game.arcade.game.Game.GameState; +import nautilus.game.arcade.gui.privateServer.PrivateServerShop; +import nautilus.game.arcade.gui.privateServer.page.GameVotingPage; + public class GameHostManager implements Listener { private ArrayList ultraGames = new ArrayList(); @@ -49,7 +54,6 @@ public class GameHostManager implements Listener ArcadeManager Manager; private Player _host; - private String _hostName; private Rank _hostRank; private long _serverStartTime = System.currentTimeMillis(); private long _serverExpireTime = 21600000; @@ -113,7 +117,7 @@ public class GameHostManager implements Listener legendGames.add(GameType.WitherAssault); legendGames.add(GameType.Wizards); legendGames.add(GameType.Build); - legendGames.add(GameType.UHC); + //legendGames.add(GameType.UHC); legendGames.add(GameType.MineStrike); legendGames.add(GameType.Skywars); legendGames.add(GameType.SpeedBuilders); @@ -174,13 +178,13 @@ public class GameHostManager implements Listener // Admins update for (Player player : UtilServer.getPlayers()) { - if (player.equals(_host) || _adminList.contains(player.getName()) || Manager.GetClients().Get(player).GetRank().has(Rank.ADMIN)) + if (isHost(player) || isAdmin(player, true)) { if (Manager.GetGame() == null || Manager.GetGame().GetState() == GameState.Recruit) giveAdminItem(player); } - if (player.equals(_host) || (isAdmin(player, false) && isEventServer())) + if (isHost(player) || (isAdmin(player, false) && (isEventServer() || isCommunityServer()))) _lastOnline = System.currentTimeMillis(); } } @@ -212,6 +216,15 @@ public class GameHostManager implements Listener public void handleLogin(PlayerLoginEvent event) { Player p = event.getPlayer(); + if (isCommunityServer()) + { + if (getOwner().getMembers().containsKey(p.getUniqueId())) + { + return; + } + event.disallow(PlayerLoginEvent.Result.KICK_WHITELIST, "You are not a member of this MCS."); + return; + } if (Manager.GetServerConfig().PlayerServerWhitelist){ if (!getWhitelist().contains(p.getName().toLowerCase())){ if ((Manager.GetHost() != null) && (Manager.GetHost().equalsIgnoreCase(p.getName()))) @@ -222,7 +235,16 @@ public class GameHostManager implements Listener } } if (_blacklist.contains(p.getName())) - event.disallow(PlayerLoginEvent.Result.KICK_BANNED, "You were removed from this Mineplex Private Server."); + { + if (isCommunityServer()) + { + event.disallow(PlayerLoginEvent.Result.KICK_BANNED, "You were removed from this Mineplex Community Server."); + } + else + { + event.disallow(PlayerLoginEvent.Result.KICK_BANNED, "You were removed from this Mineplex Private Server."); + } + } } @EventHandler @@ -309,7 +331,16 @@ public class GameHostManager implements Listener return; if (UtilTime.elapsed(_lastOnline, _expireTime)) - setHostExpired(true, Manager.GetServerConfig().HostName + " has abandoned the server. Thanks for playing!"); + { + if (isCommunityServer()) + { + setHostExpired(true, getOwner().getName() + " has abandoned the server. Thanks for playing!"); + } + else + { + setHostExpired(true, Manager.GetServerConfig().HostName + " has abandoned the server. Thanks for playing!"); + } + } else if (UtilTime.elapsed(_serverStartTime, _serverExpireTime)) setHostExpired(true, "This server has expired! Thank you for playing!"); @@ -330,9 +361,10 @@ public class GameHostManager implements Listener { UtilPlayer.message(other, C.cGold + C.Bold + string); other.playSound(other.getLocation(), Sound.ENDERDRAGON_GROWL, 10f, 1f); - Manager.GetPortal().sendPlayerToServer(other, "Lobby"); } - + + Manager.GetPortal().sendAllPlayersToGenericServer(GenericServer.HUB, Intent.KICK); + _hostExpired = expired; } @@ -501,11 +533,23 @@ public class GameHostManager implements Listener public boolean isAdmin(Player player, boolean includeStaff) { + if (isCommunityServer()) + { + return (getOwner().getMembers().containsKey(player.getUniqueId()) && getOwner().getMembers().get(player.getUniqueId()).Role.ordinal() <= CommunityRole.COLEADER.ordinal()) || (includeStaff && Manager.GetClients().Get(player).GetRank().has(Rank.ADMIN)); + } return player.equals(_host) || _adminList.contains(player.getName()) || (includeStaff && Manager.GetClients().Get(player).GetRank().has(Rank.ADMIN)); } public boolean isHost(Player player) { + if (Manager.GetHost() != null && Manager.GetHost().startsWith("COM-")) + { + CommunityManager cmanager = Managers.get(CommunityManager.class); + int communityId = Integer.parseInt(Manager.GetHost().replace("COM-", "")); + Community c = cmanager.getLoadedCommunity(communityId); + return c.getMembers().containsKey(player.getUniqueId()) && c.getMembers().get(player.getUniqueId()).Role == CommunityRole.LEADER; + } + return player.getName().equals(Manager.GetHost()); } @@ -519,6 +563,8 @@ public class GameHostManager implements Listener { if (_host == null || !event.getPlayer().equals(_host)) return; + if (isCommunityServer()) + return; if (!event.getMessage().toLowerCase().startsWith("/whitelist")) return; @@ -540,67 +586,13 @@ public class GameHostManager implements Listener } } } - - public void setGame(GameType type) - { - if (_host == null) - return; - - Manager.GetGameCreationManager().SetNextGameType(type); - - //End Current - if (Manager.GetGame().GetState() == GameState.Recruit) - { - Manager.GetGame().SetState(GameState.Dead); - - Bukkit.broadcastMessage(C.cGreen + C.Bold + _host.getName() + " has changed game to " + type.GetName() + "."); - } - else - { - Bukkit.broadcastMessage(C.cGreen + C.Bold + _host.getName() + " set next game to " + type.GetName() + "."); - } - } - - public void startGame() - { - if (_host == null) - return; - - Manager.GetGameManager().StateCountdown(Manager.GetGame(), 10, true); - - Manager.GetGame().Announce(C.cGreen + C.Bold + _host.getName() + " has started the game."); - } - - public void stopGame() - { - if (_host == null) - return; - - if (Manager.GetGame() == null) - return; - - HandlerList.unregisterAll(Manager.GetGame()); - - if (Manager.GetGame().GetState() == GameState.End || Manager.GetGame().GetState() == GameState.End) - { - _host.sendMessage("Game is already ending..."); - return; - } - else if (Manager.GetGame().GetState() == GameState.Recruit) - { - Manager.GetGame().SetState(GameState.Dead); - } - else - { - Manager.GetGame().SetState(GameState.End); - } - - - Manager.GetGame().Announce(C.cGreen + C.Bold + _host.getName() + " has stopped the game."); - } public boolean hasRank(Rank rank) { + if (isCommunityServer()) + { + return Rank.ETERNAL.has(rank); + } if (_hostRank == null) return false; @@ -642,8 +634,15 @@ public class GameHostManager implements Listener public void ban(Player player) { _blacklist.add(player.getName()); - - Manager.GetPortal().sendToHub(player, "You were removed from this Mineplex Private Server."); + + if (isCommunityServer()) + { + Manager.GetPortal().sendToHub(player, "You were removed from this Mineplex Community Server.", Intent.KICK); + } + else + { + Manager.GetPortal().sendToHub(player, "You were removed from this Mineplex Private Server.", Intent.KICK); + } } @EventHandler @@ -656,7 +655,26 @@ public class GameHostManager implements Listener { if (_blacklist.contains(player.getName())) { - Manager.GetPortal().sendToHub(player, "You were removed from this Mineplex Private Server."); + if (isCommunityServer()) + { + Manager.GetPortal().sendToHub(player, "You were removed from this Mineplex Community Server.", Intent.KICK); + } + else + { + Manager.GetPortal().sendToHub(player, "You were removed from this Mineplex Private Server.", Intent.KICK); + } + } + } + } + + @EventHandler + public void onDisband(CommunityDisbandEvent event) + { + if (isCommunityServer()) + { + if (getOwner().getId().intValue() == event.getCommunity().getId().intValue()) + { + setHostExpired(true, getOwner().getName() + " has disbanded and abandoned the server. Thanks for playing!"); } } } @@ -715,9 +733,13 @@ public class GameHostManager implements Listener public int getMaxPlayerCap() { + if (isCommunityServer()) + { + return 20; + } if (hasRank(Rank.SNR_MODERATOR) || _hostRank == Rank.YOUTUBE || _hostRank == Rank.TWITCH) return 100; - else if (_hostRank == Rank.YOUTUBE_SMALL) + else if (_hostRank == Rank.YOUTUBE_SMALL || _hostRank == Rank.ETERNAL) return 60; else if (hasRank(Rank.LEGEND)) return 40; @@ -726,81 +748,6 @@ public class GameHostManager implements Listener else return 4; } - - @EventHandler - public void setEventGame(PlayerCommandPreprocessEvent event) - { - if (!isEventServer() || Manager.GetGame() == null) - return; - - if (!isAdmin(event.getPlayer(), false)) - return; - - if (!event.getMessage().toLowerCase().startsWith("/e set ") && !event.getMessage().toLowerCase().equals("/e set")) - return; - - Player caller = event.getPlayer(); - String[] args = event.getMessage().split(" "); - - String game = args[2].toLowerCase(); - - if (args.length >= 4) - { - String map = ""; - String source = ""; - if(args.length == 5) - { - Manager.GetGameCreationManager().MapSource = args[3]; - Manager.GetGameCreationManager().MapPref = args[4]; - source = args[3]; - map = args[4]; - } - else - { - Manager.GetGameCreationManager().MapSource = args[2]; - Manager.GetGameCreationManager().MapPref = args[3]; - source = args[2]; - map = args[3]; - } - UtilPlayer.message(caller, C.cAqua + C.Bold + "Map Preference: " + ChatColor.RESET + source + ":" + map); - } - - //Parse Game - ArrayList matches = new ArrayList<>(); - for (GameType type : GameType.values()) - { - if (type.toString().toLowerCase().equals(game)) - { - matches.clear(); - matches.add(type); - break; - } - - if (type.toString().toLowerCase().contains(game)) - { - matches.add(type); - } - } - - if (matches.size() == 0) - { - caller.sendMessage("No results for: " + game); - return; - } - - if (matches.size() > 1) - { - caller.sendMessage("Matched multiple games;"); - for (GameType cur : matches) - caller.sendMessage(cur.toString()); - return; - } - - GameType type = matches.get(0); - Manager.GetGame().setGame(type, event.getPlayer(), true); - - event.setCancelled(true); - } @EventHandler public void playerJoin(PlayerJoinEvent event) @@ -809,10 +756,31 @@ public class GameHostManager implements Listener return; String serverName = Manager.getPlugin().getConfig().getString("serverstatus.name"); - UtilPlayer.message(event.getPlayer(), ChatColor.BOLD + "Welcome to Mineplex Private Servers!"); + if (!isCommunityServer()) + { + UtilPlayer.message(event.getPlayer(), ChatColor.BOLD + "Welcome to Mineplex Private Servers!"); + } + else + { + UtilPlayer.message(event.getPlayer(), ChatColor.BOLD + "Welcome to Mineplex Community Servers!"); + } UtilPlayer.message(event.getPlayer(), C.Bold + "Friends can connect with " + C.cGreen + C.Bold + "/server " + serverName); } + public boolean isCommunityServer() + { + return Manager.GetHost() != null && Manager.GetHost().startsWith("COM-"); + } + + public Community getOwner() + { + if (!isCommunityServer()) + { + return null; + } + return Managers.get(CommunityManager.class).getLoadedCommunity(Integer.parseInt(Manager.GetHost().replace("COM-", ""))); + } + public boolean isEventServer() { return _isEventServer; @@ -856,6 +824,5 @@ public class GameHostManager implements Listener public void setHost(Player player) { _host = player; - } - -} + } +} \ No newline at end of file diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/managers/GameManager.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/managers/GameManager.java index d9d272557..7e063dd51 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/managers/GameManager.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/managers/GameManager.java @@ -1,5 +1,6 @@ package nautilus.game.arcade.managers; +import mineplex.core.Managers; import mineplex.core.PlayerSelector; import mineplex.core.common.util.UtilLambda; import org.bukkit.ChatColor; @@ -31,6 +32,9 @@ import mineplex.core.gadget.types.Gadget; import mineplex.core.gadget.types.GadgetType; import mineplex.core.mount.Mount; import mineplex.core.mount.types.MountDragon; +import mineplex.core.titles.Titles; +import mineplex.core.portal.GenericServer; +import mineplex.core.portal.Intent; import mineplex.core.updater.UpdateType; import mineplex.core.updater.event.RestartServerEvent; import mineplex.core.updater.event.UpdateEvent; @@ -371,12 +375,14 @@ public class GameManager implements Listener public void StateCountdown(Game game, int timer, boolean force) { - if (game instanceof UHC && !((UHC)game).isMapLoaded()) - return; - if (Manager.GetGameHostManager().isPrivateServer() && Manager.GetGameHostManager().isVoteInProgress()) return; + if ((game.GetCountdown() <= 5 && game.GetCountdown() >= 0) || timer <= 5) + { + Manager.getTitles().forceDisable(); + } + //Disabling Cosmetics if (game.GetCountdown() <= 5 && game.GetCountdown() >= 0 && game.GadgetsDisabled) { @@ -481,61 +487,6 @@ public class GameManager implements Listener game.GetScoreboard().updateTitle(); } - @EventHandler(priority = EventPriority.LOWEST) //BEFORE PARSE DATA - public void TeamGeneration(GameStateChangeEvent event) - { - if (event.GetState() != GameState.Recruit) - return; - - Game game = event.GetGame(); - int count = 1; - - for (String team : game.WorldData.SpawnLocs.keySet()) - { - ChatColor color; - - if (team.equalsIgnoreCase("RED")) color = ChatColor.RED; - else if (team.equalsIgnoreCase("YELLOW")) color = ChatColor.YELLOW; - else if (team.equalsIgnoreCase("GREEN")) color = ChatColor.GREEN; - else if (team.equalsIgnoreCase("BLUE")) color = ChatColor.AQUA; - else - { - color = ChatColor.DARK_GREEN; - - if (game.GetTeamList().size()%14 == 0) if (game.WorldData.SpawnLocs.size() > 1) color = ChatColor.RED; - if (game.GetTeamList().size()%14 == 1) color = ChatColor.YELLOW; - if (game.GetTeamList().size()%14 == 2) color = ChatColor.GREEN; - if (game.GetTeamList().size()%14 == 3) color = ChatColor.AQUA; - if (game.GetTeamList().size()%14 == 4) color = ChatColor.GOLD; - if (game.GetTeamList().size()%14 == 5) color = ChatColor.LIGHT_PURPLE; - if (game.GetTeamList().size()%14 == 6) color = ChatColor.DARK_BLUE; - if (game.GetTeamList().size()%14 == 7) color = ChatColor.WHITE; - if (game.GetTeamList().size()%14 == 8) color = ChatColor.BLUE; - if (game.GetTeamList().size()%14 == 9) color = ChatColor.DARK_GREEN; - if (game.GetTeamList().size()%14 == 10) color = ChatColor.DARK_PURPLE; - if (game.GetTeamList().size()%14 == 11) color = ChatColor.DARK_RED; - if (game.GetTeamList().size()%14 == 12) color = ChatColor.DARK_AQUA; - } - - //Random Names - String teamName = team; - if (game.WorldData.SpawnLocs.size() > 12) - { - teamName = "" + count; - count++; - } - - GameTeam newTeam = new GameTeam(game, teamName, color, game.WorldData.SpawnLocs.get(team)); - game.AddTeam(newTeam); - } - - //Restrict Kits - game.RestrictKits(); - - //Parse Data - game.ParseData(); - } - public void TeamPreferenceJoin(Game game) { //Preferred Team No Longer Full @@ -626,7 +577,7 @@ public class GameManager implements Listener if (player.isDead()) { player.sendMessage(F.main("Afk Monitor", "You are being sent to the Lobby for being AFK.")); - Manager.GetPortal().sendPlayerToServer(player, "Lobby"); + Manager.GetPortal().sendPlayerToGenericServer(player, GenericServer.HUB, Intent.KICK); } else if (Manager.IsObserver(player)) { diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/managers/GamePlayerManager.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/managers/GamePlayerManager.java index d75c0f38f..00e52236a 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/managers/GamePlayerManager.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/managers/GamePlayerManager.java @@ -1,30 +1,7 @@ package nautilus.game.arcade.managers; -import mineplex.core.common.Rank; -import mineplex.core.common.util.C; -import mineplex.core.common.util.F; -import mineplex.core.common.util.UtilMath; -import mineplex.core.common.util.UtilPlayer; -import mineplex.core.common.util.UtilTabTitle; -import mineplex.core.common.util.UtilTextMiddle; -import mineplex.core.common.util.UtilTime; -import mineplex.core.party.PartyManager; -import mineplex.core.recharge.Recharge; -import mineplex.core.updater.UpdateType; -import mineplex.core.updater.event.UpdateEvent; -import mineplex.minecraft.game.core.combat.event.CombatDeathEvent; -import mineplex.minecraft.game.core.condition.Condition.ConditionType; -import mineplex.minecraft.game.core.damage.CustomDamageEvent; -import nautilus.game.arcade.ArcadeManager; -import nautilus.game.arcade.GameType; -import nautilus.game.arcade.events.GameStateChangeEvent; -import nautilus.game.arcade.events.PlayerStateChangeEvent; -import nautilus.game.arcade.game.Game; -import nautilus.game.arcade.game.Game.GameState; -import nautilus.game.arcade.game.GameTeam; -import nautilus.game.arcade.kit.Kit; -import nautilus.game.arcade.kit.ProgressingKit; -import org.bukkit.Bukkit; +import java.util.ArrayList; + import org.bukkit.ChatColor; import org.bukkit.Location; import org.bukkit.entity.LivingEntity; @@ -41,7 +18,25 @@ import org.bukkit.event.player.PlayerJoinEvent; import org.bukkit.event.player.PlayerRespawnEvent; import org.bukkit.scheduler.BukkitRunnable; -import java.util.ArrayList; +import mineplex.core.common.Rank; +import mineplex.core.common.util.C; +import mineplex.core.common.util.F; +import mineplex.core.common.util.UtilPlayer; +import mineplex.core.common.util.UtilTabTitle; +import mineplex.core.common.util.UtilTextMiddle; +import mineplex.core.party.PartyManager; +import mineplex.core.recharge.Recharge; +import mineplex.minecraft.game.core.combat.event.CombatDeathEvent; +import mineplex.minecraft.game.core.damage.CustomDamageEvent; +import nautilus.game.arcade.ArcadeManager; +import nautilus.game.arcade.GameType; +import nautilus.game.arcade.events.GameStateChangeEvent; +import nautilus.game.arcade.events.PlayerStateChangeEvent; +import nautilus.game.arcade.game.Game; +import nautilus.game.arcade.game.Game.GameState; +import nautilus.game.arcade.game.GameTeam; +import nautilus.game.arcade.kit.Kit; +import nautilus.game.arcade.kit.ProgressingKit; public class GamePlayerManager implements Listener { @@ -49,44 +44,12 @@ public class GamePlayerManager implements Listener private static final int TEAMMATE_MESSAGE_DELAY = 40; - private static final long PLAYER_VISIBILITY_REFRESH_RATE = 30000; - private static final int VIEW_DISTANCE_BLOCK_VALUE = 8; - private long _lastVisibilityRefresh = 0; - public GamePlayerManager(ArcadeManager manager) { Manager = manager; Manager.getPluginManager().registerEvents(this, Manager.getPlugin()); } - - @EventHandler - public void onRefreshVisibility(UpdateEvent event) - { - if (event.getType() != UpdateType.SEC) - return; - if (UtilTime.elapsed(_lastVisibilityRefresh, PLAYER_VISIBILITY_REFRESH_RATE)) - { - _lastVisibilityRefresh = System.currentTimeMillis(); - if (Manager.GetGame() == null) - { - return; - } - for (Player player : Manager.GetGame().GetPlayers(true)) - { - if (!Manager.GetCondition().HasCondition(player, ConditionType.INVISIBILITY) && !Manager.GetCondition().HasCondition(player, ConditionType.CLOAK) && Manager.GetGame().IsAlive(player) && !UtilPlayer.isSpectator(player)) - { - for (Player viewer : Bukkit.getOnlinePlayers()) - { - if (UtilMath.offset2d(viewer, player) <= (Bukkit.getViewDistance() * VIEW_DISTANCE_BLOCK_VALUE)) - { - viewer.showPlayer(player); - } - } - } - } - } - } @EventHandler(priority = EventPriority.HIGH) public void PlayerDeath(CombatDeathEvent event) @@ -139,6 +102,9 @@ public class GamePlayerManager implements Listener @Override public void run() { + if (!player.isOnline()) + return; + player.sendMessage(F.main("Kit", "Loading default kit for " + C.cGreenB + Manager.GetGame().GetName() + C.cGray + "...")); for (Kit kit : Manager.GetGame().GetKits()) { diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/managers/GameRewardManager.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/managers/GameRewardManager.java index a730ff2f8..4c8db7903 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/managers/GameRewardManager.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/managers/GameRewardManager.java @@ -1,14 +1,17 @@ package nautilus.game.arcade.managers; import com.mojang.authlib.GameProfile; + import mineplex.core.achievement.Achievement; import mineplex.core.boosters.Booster; import mineplex.core.common.Rank; import mineplex.core.common.currency.GlobalCurrency; import mineplex.core.common.util.*; +import mineplex.core.titles.tracks.GemCollectorTrack; import mineplex.minecraft.game.core.combat.CombatComponent; import mineplex.minecraft.game.core.combat.event.CombatDeathEvent; import mineplex.serverdata.Utility; + import nautilus.game.arcade.ArcadeFormat; import nautilus.game.arcade.ArcadeManager; import nautilus.game.arcade.GameType; @@ -19,7 +22,9 @@ import nautilus.game.arcade.game.Game; import nautilus.game.arcade.game.Game.GameState; import nautilus.game.arcade.game.GameTeam.PlayerState; import nautilus.game.arcade.game.GemData; + import net.minecraft.server.v1_8_R3.EntityHuman; + import org.bukkit.Sound; import org.bukkit.craftbukkit.v1_8_R3.entity.CraftHumanEntity; import org.bukkit.craftbukkit.v1_8_R3.entity.CraftPlayer; @@ -56,12 +61,12 @@ public class GameRewardManager implements Listener return; Game game = Manager.GetGame(); - if (game == null) return; + if (game == null) return; if (!(event.GetEvent().getEntity() instanceof Player)) return; - Player killed = (Player)event.GetEvent().getEntity(); + Player killed = (Player) event.GetEvent().getEntity(); if (event.GetLog().GetKiller() != null) { @@ -106,7 +111,7 @@ public class GameRewardManager implements Listener return; Game game = Manager.GetGame(); - if (game == null) return; + if (game == null) return; RewardGems(game, event.getPlayer(), true); } @@ -149,7 +154,7 @@ public class GameRewardManager implements Listener GiveGems(game, player, game.GetPlayerGems().remove(player), game.GemMultiplier); } - public void GiveGems(Game game, Player player, HashMap gems, double gameMult) + public void GiveGems(Game game, Player player, HashMap gems, double gameMult) { if (!Manager.IsRewardGems()) return; @@ -174,14 +179,6 @@ public class GameRewardManager implements Listener gemsToReward = baseGemsEarned; } - String oldName = player.getName(); - - if(Manager.GetClients().Get(player).getDisguisedAs() != null) - { - changeName(player, Manager.GetClients().Get(player).getName()); - System.out.println("Gems for " + Manager.GetClients().Get(player).getName()); - } - // Award players shards equal to base gems, plus booster bonuses. final int baseShardsEarned = baseGemsEarned; int shardsToReward = baseShardsEarned; @@ -199,23 +196,23 @@ public class GameRewardManager implements Listener int gemFinder = Manager.GetAchievement().get(player, Achievement.GLOBAL_GEM_HUNTER).getLevel(); if (gemFinder > 0) { - gemsToReward += (int)(baseGemsEarned * (gemFinder * 0.25)); + gemsToReward += (int) (baseGemsEarned * (gemFinder * 0.25)); } } - + // Time Reward if (TimeReward) { long timeOnline = Utility.currentTimeMillis() - Manager.GetClients().Get(player).getNetworkSessionLoginTime(); - - double hoursOnline = timeOnline/3600000d; - + + double hoursOnline = timeOnline / 3600000d; + if (hoursOnline < 24) { if (hoursOnline > 5) - hoursOnline = 5; - - gemsToReward += (int)(baseGemsEarned * (hoursOnline * 0.2)); + hoursOnline = 5; + + gemsToReward += (int) (baseGemsEarned * (hoursOnline * 0.2)); } } @@ -231,35 +228,32 @@ public class GameRewardManager implements Listener shardsToReward += baseShardsEarned * 1; else if (rank == rank.LEGEND) shardsToReward += baseShardsEarned * 1.5; - else if (rank.has(Rank.TITAN)) + else if (rank == Rank.TITAN) shardsToReward += baseShardsEarned * 2; + else if (rank.has(Rank.ETERNAL)) + shardsToReward += baseShardsEarned * 2.5; - Manager.GetDonation().RewardGems(null, "Earned " + game.GetName(), player.getName(), player.getUniqueId(), gemsToReward); + Manager.GetDonation().rewardCurrency(GlobalCurrency.GEM, player, "Earned " + game.GetName(), gemsToReward); if (accountId != -1) { - Manager.GetDonation().rewardCoinsUntilSuccess(null, "Earned", player.getName(), accountId, shardsToReward); + Manager.GetDonation().rewardCurrencyUntilSuccess(GlobalCurrency.TREASURE_SHARD, player, "Earned", shardsToReward); } + Manager.getTrackManager().getTrack(GemCollectorTrack.class).earnedGems(player, gemsToReward); //Stats Manager.GetStatsManager().incrementStat(player, "Global.GemsEarned", gemsToReward); - Manager.GetStatsManager().incrementStat(player, game.GetName()+".GemsEarned", gemsToReward); - - if(Manager.GetClients().Get(player).getDisguisedAs() != null) - { - changeName(player, oldName); - } - + Manager.GetStatsManager().incrementStat(player, game.GetName() + ".GemsEarned", gemsToReward); } private void changeName(Player player, String newName) - { + { try { Field name = GameProfile.class.getDeclaredField("name"); Field declaredProfile = EntityHuman.class.getDeclaredField("bH"); declaredProfile.setAccessible(true); - GameProfile gameProfile = (GameProfile) declaredProfile.get(((CraftHumanEntity)((CraftPlayer) player)).getHandle()); - + GameProfile gameProfile = (GameProfile) declaredProfile.get(((CraftHumanEntity) ((CraftPlayer) player)).getHandle()); + name.setAccessible(true); name.set(gameProfile, newName); name.setAccessible(false); @@ -269,8 +263,8 @@ public class GameRewardManager implements Listener e.printStackTrace(); } } - - public void AnnounceGems(Game game, Player player, HashMap gems, boolean give) + + public void AnnounceGems(Game game, Player player, HashMap gems, boolean give) { if (gems == null) return; @@ -287,7 +281,7 @@ public class GameRewardManager implements Listener for (String type : gems.keySet()) { - int gemCount = (int)gems.get(type).Gems; + int gemCount = (int) gems.get(type).Gems; if (gemCount <= 0) gemCount = 1; @@ -300,7 +294,7 @@ public class GameRewardManager implements Listener String out = ""; if (Manager.IsRewardGems()) - out += F.elem(C.cGreen + "+" + (int)(gemCount * game.GemMultiplier) + " Gems") + " for "; + out += F.elem(C.cGreen + "+" + (int) (gemCount * game.GemMultiplier) + " Gems") + " for "; out += F.elem(amountStr + type); UtilPlayer.message(player, out); @@ -324,8 +318,8 @@ public class GameRewardManager implements Listener int gemFinder = Manager.GetAchievement().get(player, Achievement.GLOBAL_GEM_HUNTER).getLevel(); if (gemFinder > 0) { - UtilPlayer.message(player, F.elem(C.cGreen + "+" + ((int)(earnedGems*(gemFinder * 0.25)) + " Gems")) + " for " + - F.elem("Gem Hunter " + gemFinder + C.cGreen + " +" + (gemFinder*25) + "%")); + UtilPlayer.message(player, F.elem(C.cGreen + "+" + ((int) (earnedGems * (gemFinder * 0.25)) + " Gems")) + " for " + + F.elem("Gem Hunter " + gemFinder + C.cGreen + " +" + (gemFinder * 25) + "%")); totalGems += earnedGems * (gemFinder * 0.25); } @@ -335,26 +329,26 @@ public class GameRewardManager implements Listener if (TimeReward) { long timeOnline = Utility.currentTimeMillis() - Manager.GetClients().Get(player).getNetworkSessionLoginTime(); - - double hoursOnline = timeOnline/3600000d; - + + double hoursOnline = timeOnline / 3600000d; + if (hoursOnline < 24) { if (hoursOnline > 5) - hoursOnline = 5; - - int extraGems = (int)(earnedGems * (hoursOnline * 0.2)); - + hoursOnline = 5; + + int extraGems = (int) (earnedGems * (hoursOnline * 0.2)); + if (extraGems > 0) { UtilPlayer.message(player, F.elem(C.cGreen + "+" + extraGems + " Gems") + " for " + - F.elem("Online for " + UtilTime.MakeStr(timeOnline) + C.cGreen + " +" + (int)(hoursOnline * 20) + "%")); - + F.elem("Online for " + UtilTime.MakeStr(timeOnline) + C.cGreen + " +" + (int) (hoursOnline * 20) + "%")); + totalGems += extraGems; } } } - + //Double Gem if (DoubleGem && game.GemDoubleEnabled) { @@ -383,7 +377,7 @@ public class GameRewardManager implements Listener { int extraShards = ((int) (extraMult * baseShards)); UtilPlayer.message(player, F.elem(C.cAqua + "+" + extraShards + " Treasure Shards") + " for " + - F.elem(rank.getTag(true, true)) + F.elem(" Rank" + C.cAqua + " +" + Math.round((extraMult*100)) + "%")); + F.elem(rank.getTag(true, true)) + F.elem(" Rank" + C.cAqua + " +" + Math.round((extraMult * 100)) + "%")); } Booster booster = Manager.getBoosterManager().getActiveBooster(); if (game.GemBoosterEnabled && booster != null) @@ -391,7 +385,7 @@ public class GameRewardManager implements Listener double multiplier = booster.getMultiplier() - 1; int extraShards = ((int) (multiplier * baseShards)); UtilPlayer.message(player, F.elem(C.cAqua + "+" + extraShards + " Treasure Shards") + " for " + - F.name(booster.getPlayerName()) + "'s" + F.elem(" Game Amplifier" + C.cAqua + " +" + Math.round((multiplier*100)) + "%")); + F.name(booster.getPlayerName()) + "'s" + F.elem(" Game Amplifier" + C.cAqua + " +" + Math.round((multiplier * 100)) + "%")); } //Inform diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/managers/GameTestingManager.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/managers/GameTestingManager.java index ce554376b..fdc2339d3 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/managers/GameTestingManager.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/managers/GameTestingManager.java @@ -42,7 +42,7 @@ public class GameTestingManager implements Listener _manager.getPluginManager().registerEvents(this, _manager.getPlugin()); - _enabled = _manager.getPlugin().getConfig().getString("serverstatus.group").equalsIgnoreCase("Testing"); + _enabled = UtilServer.isTestServer(); } public ArcadeManager getManager() diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/managers/GameWorldManager.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/managers/GameWorldManager.java index 43a654f57..364d43cd5 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/managers/GameWorldManager.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/managers/GameWorldManager.java @@ -6,7 +6,6 @@ import java.util.Iterator; import mineplex.core.updater.UpdateType; import mineplex.core.updater.event.UpdateEvent; import nautilus.game.arcade.ArcadeManager; -import nautilus.game.arcade.game.Game.GameState; import nautilus.game.arcade.world.WorldData; import org.bukkit.event.EventHandler; @@ -47,9 +46,9 @@ public class GameWorldManager implements Listener { worldIterator.remove(); } - else if (worldData.LoadChunks(timeLeft)) + else if (worldData.Host.loadNecessaryChunks(timeLeft)) { - worldData.Host.SetState(GameState.Recruit); + worldData.Host.prepareToRecruit(); worldIterator.remove(); } } diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/managers/HolidayManager.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/managers/HolidayManager.java index 3aa7d7131..234e44f46 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/managers/HolidayManager.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/managers/HolidayManager.java @@ -4,9 +4,6 @@ import java.util.EnumMap; import java.util.HashSet; import java.util.Iterator; -import net.minecraft.server.v1_8_R3.BlockPosition; -import net.minecraft.server.v1_8_R3.PacketPlayOutBlockAction; - import org.bukkit.Bukkit; import org.bukkit.Color; import org.bukkit.Effect; @@ -18,18 +15,19 @@ import org.bukkit.block.Block; import org.bukkit.block.BlockFace; import org.bukkit.craftbukkit.v1_8_R3.util.CraftMagicNumbers; import org.bukkit.entity.Chicken; +import org.bukkit.entity.Entity; import org.bukkit.entity.Item; import org.bukkit.entity.Player; import org.bukkit.event.EventHandler; import org.bukkit.event.Listener; import org.bukkit.event.entity.EntityDamageByEntityEvent; import org.bukkit.event.entity.EntityDamageEvent; -import org.bukkit.event.entity.ItemSpawnEvent; import org.bukkit.event.player.PlayerCommandPreprocessEvent; import org.bukkit.event.player.PlayerInteractEvent; import org.bukkit.event.player.PlayerPickupItemEvent; import org.bukkit.util.Vector; +import mineplex.core.common.currency.GlobalCurrency; import mineplex.core.common.util.C; import mineplex.core.common.util.UtilBlock; import mineplex.core.common.util.UtilEvent; @@ -45,19 +43,23 @@ import mineplex.core.common.util.UtilWorld; import mineplex.core.inventory.InventoryManager; import mineplex.core.itemstack.ItemStackFactory; import mineplex.core.particleeffects.HalloweenSmashedEffect; +import mineplex.core.rankGiveaway.eternal.EternalGiveawayAnimation; +import mineplex.core.rankGiveaway.eternal.EternalGiveawayManager; import mineplex.core.rankGiveaway.titangiveaway.TitanGiveawayManager; import mineplex.core.reward.RewardPool; import mineplex.core.reward.RewardRarity; import mineplex.core.treasure.TreasureType; import mineplex.core.updater.UpdateType; import mineplex.core.updater.event.UpdateEvent; - import nautilus.game.arcade.ArcadeManager; -import nautilus.game.arcade.GameType; import nautilus.game.arcade.events.GameStateChangeEvent; import nautilus.game.arcade.game.Game; import nautilus.game.arcade.game.Game.GameState; +import nautilus.game.arcade.game.games.christmas.Christmas; +import nautilus.game.arcade.game.games.uhc.UHC; import nautilus.game.arcade.managers.events.SpecialEntityDeathEvent; +import net.minecraft.server.v1_8_R3.BlockPosition; +import net.minecraft.server.v1_8_R3.PacketPlayOutBlockAction; public class HolidayManager implements Listener { @@ -79,7 +81,7 @@ public class HolidayManager implements Listener _blockBreakSound = blockBreakSound; } - public String getBlockName() + public String getBlockName() { return _blockName; } @@ -89,7 +91,7 @@ public class HolidayManager implements Listener return _blockBreakSound; } - public Material getBlockType() + public Material getBlockType() { return _blockType; } @@ -100,9 +102,10 @@ public class HolidayManager implements Listener private ArcadeManager _arcadeManager; private TitanGiveawayManager _titanManager; + private EternalGiveawayManager _eternalGiveawayManager; public HashSet _active = new HashSet<>(); - public HashSet _activeEntities = new HashSet<>(); + public HashSet _activeEntities = new HashSet<>(); private HashSet _items = new HashSet<>(); @@ -117,10 +120,11 @@ public class HolidayManager implements Listener private EnumMap _rewardPools; - public HolidayManager(ArcadeManager arcadeManager, TitanGiveawayManager titanManager) + public HolidayManager(ArcadeManager arcadeManager, TitanGiveawayManager titanManager, EternalGiveawayManager eternalGiveawayManager) { _arcadeManager = arcadeManager; _titanManager = titanManager; + _eternalGiveawayManager = eternalGiveawayManager; _rewardPools = new EnumMap<>(RewardPool.Type.class); for (RewardPool.Type type : RewardPool.Type.values()) @@ -129,12 +133,14 @@ public class HolidayManager implements Listener } _arcadeManager.getPluginManager().registerEvents(this, _arcadeManager.getPlugin()); - } + } @EventHandler - public void reset(GameStateChangeEvent event) + public void reset(GameStateChangeEvent event) { _active.clear(); + _activeEntities.forEach(entity -> entity.remove()); + _activeEntities.clear(); _lastSpawn = System.currentTimeMillis(); } @@ -152,8 +158,8 @@ public class HolidayManager implements Listener Block block = blockIterator.next(); //Break - if (block.getType() != Material.PUMPKIN && - block.getType() != Material.JACK_O_LANTERN && + if (block.getType() != Material.PUMPKIN && + block.getType() != Material.JACK_O_LANTERN && block.getType() != Material.CHEST) { specialBlockBreak(null, block); @@ -190,7 +196,7 @@ public class HolidayManager implements Listener _items.add(egg); - block.getWorld().playSound(block.getLocation(), Sound.CHICKEN_EGG_POP, 0.25f + (float)Math.random() * 0.75f, 0.75f + (float)Math.random() * 0.5f); + block.getWorld().playSound(block.getLocation(), Sound.CHICKEN_EGG_POP, 0.25f + (float) Math.random() * 0.75f, 0.75f + (float) Math.random() * 0.5f); } if (Math.random() > 0.95) @@ -242,7 +248,7 @@ public class HolidayManager implements Listener return; Game game = _arcadeManager.GetGame(); - + int requirement = (int)((double) _arcadeManager.GetPlayerFull() * 0.5d); if (UtilServer.getPlayers().length < requirement) return; @@ -250,7 +256,10 @@ public class HolidayManager implements Listener if (game.GetState() != GameState.Live) return; - if (game.GetType().equals(GameType.UHC)) + if (game instanceof UHC) + return; + + if (game instanceof Christmas) return; if (!UtilTime.elapsed(_lastSpawn, 90000)) @@ -259,16 +268,16 @@ public class HolidayManager implements Listener if (Math.random() > SPAWN_CHANCE) return; - int toDrop = Math.max(1, game.GetPlayers(false).size()/6); - for (int i=0 ; i< toDrop ; i++) + int toDrop = Math.max(1, game.GetPlayers(false).size() / 6); + for (int i = 0; i < toDrop; i++) { - double interval = 1 / (double)(toDrop); + double interval = 1 / (double) (toDrop); if (Math.random() >= (i * interval)) // Diminishing per growth { spawnSpecialBlock(findSpecialBlockLocation(game)); } - } + } _lastSpawn = System.currentTimeMillis(); } @@ -308,7 +317,7 @@ public class HolidayManager implements Listener _active.add(block); System.out.println("Spawned Holiday Block: " + UtilWorld.locToStrClean(block.getLocation())); - } + } private void sendChestPackets(Block block) { @@ -357,14 +366,14 @@ public class HolidayManager implements Listener } return null; -} + } @EventHandler public void specialBlockDamage(PlayerInteractEvent event) { if (!UtilEvent.isAction(event, ActionType.L_BLOCK)) return; - + if (UtilPlayer.isSpectator(event.getPlayer())) return; @@ -456,25 +465,11 @@ public class HolidayManager implements Listener chicken.damage(CHICKEN_DAMAGE); } - @EventHandler - public void cancelSpecialEntityItemDrops(ItemSpawnEvent event) - { - Material material = event.getEntity().getItemStack().getType(); - if (material.equals(Material.FEATHER) || material.equals(Material.RAW_CHICKEN) || material.equals(Material.BONE)) - { - if (_items.contains(event.getEntity())) - return; - - event.getEntity().remove(); - event.setCancelled(true); - } - } - private void specialBlockBreak(Player player, final Block block) { if (!_active.contains(block)) return; - + _active.remove(block); block.getWorld().playEffect(block.getLocation(), Effect.STEP_SOUND, _type.getBlockType()); @@ -487,14 +482,14 @@ public class HolidayManager implements Listener } //Coins - for (int i=0 ; i < 4 + Math.random()*8 ; i++) + for (int i = 0; i < 4 + Math.random() * 8; i++) { - Item coin = block.getWorld().dropItem(block.getLocation().add(0.5, 1, 0.5), - ItemStackFactory.Instance.CreateStack(Material.PRISMARINE_SHARD, (byte)0, 1, UtilMath.r(999999) + "Coin")); + Item coin = block.getWorld().dropItem(block.getLocation().add(0.5, 1, 0.5), + ItemStackFactory.Instance.CreateStack(Material.PRISMARINE_SHARD, (byte) 0, 1, UtilMath.r(999999) + "Coin")); Vector vel = new Vector( - (Math.random() - 0.5) * 0.5, - 0.1 + Math.random() * 0.3, + (Math.random() - 0.5) * 0.5, + 0.1 + Math.random() * 0.3, (Math.random() - 0.5) * 0.5); coin.setVelocity(vel); @@ -505,10 +500,10 @@ public class HolidayManager implements Listener } //Gems - for (int i=0 ; i < 4 + Math.random()*8 ; i++) + for (int i = 0; i < 4 + Math.random() * 8; i++) { Item gem = block.getWorld().dropItem(block.getLocation().add(0.5, 1, 0.5), - ItemStackFactory.Instance.CreateStack(Material.EMERALD, (byte)0, 1, UtilMath.r(999999) + "Gem")); + ItemStackFactory.Instance.CreateStack(Material.EMERALD, (byte) 0, 1, UtilMath.r(999999) + "Gem")); Vector vel = new Vector( (Math.random() - 0.5) * 0.5, @@ -613,6 +608,19 @@ public class HolidayManager implements Listener _gems.add(gem); } + // Eternal Giveaway + if (player != null) + { + _eternalGiveawayManager.openPumpkin(player, new Runnable() + { + @Override + public void run() + { + Location location = entity.getLocation().add(0.5, 0.5, 0.5); + new EternalGiveawayAnimation(_eternalGiveawayManager, location, 3000L); + } + }); + } } @EventHandler @@ -626,7 +634,7 @@ public class HolidayManager implements Listener event.setCancelled(true); event.getItem().remove(); - _arcadeManager.GetDonation().RewardCoinsLater(_type + " Coins", event.getPlayer(), 4 * event.getItem().getItemStack().getAmount()); + _arcadeManager.GetDonation().rewardCurrency(GlobalCurrency.TREASURE_SHARD, event.getPlayer(), _type + " Coins", 4 * event.getItem().getItemStack().getAmount()); event.getPlayer().getWorld().playSound(event.getPlayer().getLocation(), Sound.ORB_PICKUP, 1f, 2f); } @@ -635,7 +643,7 @@ public class HolidayManager implements Listener event.setCancelled(true); event.getItem().remove(); - _arcadeManager.GetDonation().RewardGemsLater(_type + " Gems", event.getPlayer(), 4 * event.getItem().getItemStack().getAmount()); + _arcadeManager.GetDonation().rewardCurrency(GlobalCurrency.GEM, event.getPlayer(), _type + " Gems", 4 * event.getItem().getItemStack().getAmount()); event.getPlayer().getWorld().playSound(event.getPlayer().getLocation(), Sound.ORB_PICKUP, 1f, 2f); } @@ -704,11 +712,11 @@ public class HolidayManager implements Listener public boolean hasItemsToGivePlayer(RewardPool.Type pool, Player player) { - for(RewardRarity rarity : new RewardRarity[]{ + for (RewardRarity rarity : new RewardRarity[]{ RewardRarity.COMMON, RewardRarity.MYTHICAL, RewardRarity.LEGENDARY, RewardRarity.RARE, RewardRarity.UNCOMMON}) { - if(_rewardPools.get(pool).hasItemsToGive(rarity, player)) return true; + if (_rewardPools.get(pool).hasItemsToGive(rarity, player)) return true; } return false; } -} +} \ No newline at end of file diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/managers/IdleManager.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/managers/IdleManager.java index ffe72119e..a4aad6220 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/managers/IdleManager.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/managers/IdleManager.java @@ -6,7 +6,6 @@ import java.util.Map; import java.util.Set; import java.util.UUID; -import org.bukkit.Bukkit; import org.bukkit.Sound; import org.bukkit.entity.Player; import org.bukkit.event.EventHandler; @@ -20,8 +19,11 @@ import mineplex.core.common.util.C; import mineplex.core.common.util.UtilPlayer; import mineplex.core.common.util.UtilServer; import mineplex.core.common.util.UtilTime; +import mineplex.core.portal.GenericServer; +import mineplex.core.portal.Intent; import mineplex.core.updater.UpdateType; import mineplex.core.updater.event.UpdateEvent; + import nautilus.game.arcade.ArcadeManager; import nautilus.game.arcade.game.Game.GameState; @@ -124,7 +126,7 @@ public class IdleManager implements Listener if (count == 0) { player.playSound(player.getLocation(), Sound.ENDERDRAGON_GROWL, 10f, 1f); - _arcadeManager.GetPortal().sendPlayerToServer(player, "Lobby"); + _arcadeManager.GetPortal().sendPlayerToGenericServer(player, GenericServer.HUB, Intent.KICK); } else { diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/managers/MiscManager.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/managers/MiscManager.java index b4d2993d1..f9cf9c4aa 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/managers/MiscManager.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/managers/MiscManager.java @@ -4,6 +4,8 @@ import java.util.ArrayList; import java.util.List; import mineplex.core.common.util.UtilServer; +import mineplex.core.portal.GenericServer; +import mineplex.core.portal.Intent; import mineplex.core.recharge.Recharge; import mineplex.core.updater.UpdateType; import mineplex.core.updater.event.UpdateEvent; @@ -56,10 +58,20 @@ public class MiscManager implements Listener event.getPlayer().getItemInHand().getData().getData() == (byte)15) { event.setCancelled(true); + + Manager.runSyncLater(() -> + { + event.getPlayer().updateInventory(); + }, 1L); } else if (Manager.GetGame().GetState() != GameState.Live) { event.setCancelled(true); + + Manager.runSyncLater(() -> + { + event.getPlayer().updateInventory(); + }, 1L); } } @@ -133,8 +145,8 @@ public class MiscManager implements Listener if (!Recharge.Instance.usable(event.getPlayer(), "Return to Hub")) return; - - Manager.GetPortal().sendPlayerToServer(player, "Lobby"); + + Manager.GetPortal().sendPlayerToGenericServer(event.getPlayer(), GenericServer.HUB, Intent.PLAYER_REQUEST); } @EventHandler @@ -142,7 +154,7 @@ public class MiscManager implements Listener { if (event.getMessage().toLowerCase().equals("/lobby") || event.getMessage().toLowerCase().equals("/hub") || event.getMessage().toLowerCase().equals("/leave")) { - Manager.GetPortal().sendPlayerToServer(event.getPlayer(), "Lobby"); + Manager.GetPortal().sendPlayerToGenericServer(event.getPlayer(), GenericServer.HUB, Intent.PLAYER_REQUEST); event.setCancelled(true); } } diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/managers/NextBestGameManager.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/managers/NextBestGameManager.java index bc24be374..80e803d08 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/managers/NextBestGameManager.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/managers/NextBestGameManager.java @@ -1,33 +1,15 @@ package nautilus.game.arcade.managers; -import com.google.common.collect.Lists; -import com.google.common.collect.Maps; -import mineplex.core.Managers; -import mineplex.core.common.Rank; -import mineplex.core.common.util.C; -import mineplex.core.common.util.F; -import mineplex.core.common.util.UtilServer; -import mineplex.core.itemstack.ItemBuilder; -import mineplex.core.party.Lang; -import mineplex.core.party.Party; -import mineplex.core.party.PartyManager; -import mineplex.core.preferences.Preference; -import mineplex.serverdata.Region; -import mineplex.serverdata.data.MinecraftServer; -import mineplex.serverdata.servers.ServerManager; -import nautilus.game.arcade.ArcadeManager; -import nautilus.game.arcade.events.PlayerStateChangeEvent; -import nautilus.game.arcade.game.Game; -import nautilus.game.arcade.game.Game.GameState; -import nautilus.game.arcade.game.GameTeam.PlayerState; -import nautilus.game.arcade.game.games.halloween2016.Halloween2016; -import nautilus.game.arcade.game.games.minestrike.Minestrike; -import nautilus.game.arcade.game.games.paintball.Paintball; -import nautilus.game.arcade.game.games.wither.WitherGame; +import java.util.Collections; +import java.util.List; +import java.util.Map; +import java.util.UUID; + import net.md_5.bungee.api.ChatColor; import net.md_5.bungee.api.chat.ClickEvent; import net.md_5.bungee.api.chat.HoverEvent; import net.md_5.bungee.api.chat.TextComponent; + import org.bukkit.Bukkit; import org.bukkit.Material; import org.bukkit.Sound; @@ -40,11 +22,34 @@ import org.bukkit.event.player.PlayerQuitEvent; import org.bukkit.inventory.ItemStack; import org.bukkit.scheduler.BukkitRunnable; -import java.util.Collections; -import java.util.List; -import java.util.Map; -import java.util.UUID; -import java.util.stream.Collectors; +import com.google.common.collect.Lists; +import com.google.common.collect.Maps; + +import mineplex.core.Managers; +import mineplex.core.common.Rank; +import mineplex.core.common.util.C; +import mineplex.core.common.util.F; +import mineplex.core.common.util.UtilServer; +import mineplex.core.itemstack.ItemBuilder; +import mineplex.core.party.Lang; +import mineplex.core.party.Party; +import mineplex.core.party.PartyManager; +import mineplex.core.portal.Intent; +import mineplex.core.portal.Portal; +import mineplex.core.preferences.Preference; +import mineplex.serverdata.Region; +import mineplex.serverdata.data.MinecraftServer; +import mineplex.serverdata.servers.ServerManager; + +import nautilus.game.arcade.ArcadeManager; +import nautilus.game.arcade.events.PlayerStateChangeEvent; +import nautilus.game.arcade.game.Game; +import nautilus.game.arcade.game.Game.GameState; +import nautilus.game.arcade.game.GameTeam.PlayerState; +import nautilus.game.arcade.game.games.halloween2016.Halloween2016; +import nautilus.game.arcade.game.games.minestrike.Minestrike; +import nautilus.game.arcade.game.games.paintball.Paintball; +import nautilus.game.arcade.game.games.wither.WitherGame; /** * Controls a speed-up feature designed to keep players playing. @@ -69,15 +74,15 @@ public class NextBestGameManager implements Listener * ItemStack the representation of cancelling sending to the next game */ private static final ItemStack CANCEL_ITEM = new ItemBuilder(Material.REDSTONE_BLOCK) - .setTitle(C.cDRed + "Cancel Sending") - .build(); + .setTitle(C.cDRed + "Cancel Sending") + .build(); /** * ItemStack representation of the "Go to Next Game" command */ private static final ItemStack GO_TO_NEXT_ITEM = new ItemBuilder(Material.EMERALD_BLOCK) - .setTitle(C.cGreenB + "Join another game!") - .build(); + .setTitle(C.cGreenB + "Join another game!") + .build(); /** * What slot in the inventory the item's go in. @@ -89,18 +94,18 @@ public class NextBestGameManager implements Listener * This is designed so that the best algorithm will correctly allow full servers to be calculated. */ private static final List FULL_CAP = Lists.newArrayList( - "DominateTDM", - "Skywars", - "ChampionsCTF", - "MCLeague", - "UHC", - "Halloween", - "Dominate", - "SpeedBuilders", - "Build", - "Gladiators", - "SkywarsTeams", - "MineStrike" + "DominateTDM", + "Skywars", + "ChampionsCTF", + "MCLeague", + "UHC", + "Halloween", + "Dominate", + "SpeedBuilders", + "Build", + "Gladiators", + "SkywarsTeams", + "MineStrike" ); /** @@ -243,11 +248,11 @@ public class NextBestGameManager implements Listener @EventHandler public void onDeath(PlayerStateChangeEvent event) { - if(event.GetGame() instanceof Minestrike - || event.GetGame() instanceof WitherGame - || event.GetGame() instanceof Paintball - || event.GetGame() instanceof Halloween2016 - || event.GetGame().Manager.GetHost() != null) + if (event.GetGame() instanceof Minestrike + || event.GetGame() instanceof WitherGame + || event.GetGame() instanceof Paintball + || event.GetGame() instanceof Halloween2016 + || event.GetGame().Manager.GetHost() != null) { return; } @@ -266,7 +271,7 @@ public class NextBestGameManager implements Listener } Player player = event.GetPlayer(); - Party party = _partyManager.getParty(player); + Party party = _partyManager.getPartyByPlayer(player); if (party == null) { @@ -291,7 +296,8 @@ public class NextBestGameManager implements Listener player.sendMessage(" "); - } else + } + else { sendMessage(player, false); @@ -303,7 +309,7 @@ public class NextBestGameManager implements Listener return; } - List players = party.getMembersByUUID().stream().map(Bukkit::getPlayer).collect(Collectors.toList()); + List players = party.getMembers(); boolean countDown = true; for (Player player1 : players) @@ -319,7 +325,7 @@ public class NextBestGameManager implements Listener return; } - Player owner = Bukkit.getPlayer(party.getOwner()); + Player owner = Bukkit.getPlayer(party.getOwnerName()); owner.sendMessage(F.main("Game", "All party members are dead!")); if (_partyManager.getPreferencesManager().get(player).isActive(Preference.AUTO_JOIN_NEXT_GAME)) { @@ -340,7 +346,8 @@ public class NextBestGameManager implements Listener owner.sendMessage(" "); _tasks.put(player.getUniqueId(), new CountdownRunnable(party)); - } else + } + else { owner.sendMessage(" "); owner.sendMessage(" "); @@ -368,12 +375,12 @@ public class NextBestGameManager implements Listener return; } - if(getGame() == null) + if (getGame() == null) { return; } - if(getGame().IsAlive(player)) + if (getGame().IsAlive(player)) { return; } @@ -384,7 +391,7 @@ public class NextBestGameManager implements Listener } boolean cancel = inHand.isSimilar(CANCEL_ITEM); - Party party = _partyManager.getParty(player); + Party party = _partyManager.getPartyByPlayer(player); if (cancel) { @@ -402,23 +409,24 @@ public class NextBestGameManager implements Listener private void handle(Player player) { - Party party = _partyManager.getParty(player); + Party party = _partyManager.getPartyByPlayer(player); if (party != null) { - if (!party.getOwner().equalsIgnoreCase(player.getName())) + if (!party.getOwnerName().equalsIgnoreCase(player.getName())) { Lang.NOT_OWNER_SERVER.send(player); return; } - Player owner = Bukkit.getPlayer(party.getOwner()); + Player owner = Bukkit.getPlayer(party.getOwnerName()); if (_partyManager.getPreferencesManager().get(owner).isActive(Preference.COUNTDOWN_ON_CLICK)) { _tasks.put(player.getUniqueId(), new CountdownRunnable(owner)); player.getInventory().setItem(INVENTORY_SLOT, CANCEL_ITEM); - } else + } + else { MinecraftServer server = findBestGame(_partyManager.getClientManager().Get(player).GetRank(), party); @@ -428,7 +436,7 @@ public class NextBestGameManager implements Listener return; } - _partyManager.getRedisManager().sendPartyInfo(server.getName(), party); + Portal.getInstance().sendPlayerToServer(party.getOwnerAsPlayer().get(), server.getName(), Intent.PLAYER_REQUEST); } return; } @@ -437,7 +445,8 @@ public class NextBestGameManager implements Listener { _tasks.put(player.getUniqueId(), new CountdownRunnable(player)); player.getInventory().setItem(INVENTORY_SLOT, CANCEL_ITEM); - } else + } + else { MinecraftServer server = findBestGame(_partyManager.getClientManager().Get(player).GetRank(), null); player.getInventory().clear(); @@ -515,7 +524,8 @@ public class NextBestGameManager implements Listener } playerCount = newPlayerCount; - } else + } + else { if (other.getMaxPlayerCount() - playerCount > LOWEST_SOLO_PLAYERCOUNT) { @@ -527,7 +537,8 @@ public class NextBestGameManager implements Listener if (highest < playerCount) { highest = playerCount; - } else + } + else { continue; } @@ -573,7 +584,8 @@ public class NextBestGameManager implements Listener try { countdown = Integer.parseInt(motd.split(" ")[2]); - } catch (Exception e) + } + catch (Exception e) { countdown = -1; } @@ -588,7 +600,7 @@ public class NextBestGameManager implements Listener private boolean isInUnjoinableState(String motd) { return (motd == null || motd.isEmpty() || - !(motd.contains("Starting") || motd.contains("Recruiting") || motd.contains("Waiting") || motd.contains("Open in") || motd.contains("Generating"))); + !(motd.contains("Starting") || motd.contains("Recruiting") || motd.contains("Waiting") || motd.contains("Open in") || motd.contains("Generating"))); } private void sendWarning(Player player) @@ -626,13 +638,14 @@ public class NextBestGameManager implements Listener if (party != null) { - party.getMembersByUUID().stream().map(Bukkit::getPlayer).forEach(player1 -> + party.getMembers().forEach(player1 -> { player1.sendMessage(F.main("Game", "Cancelled sending your party to a new game!")); player1.playSound(player.getLocation(), Sound.ANVIL_BREAK, 1.0F, 1.0F); player1.getInventory().setItem(INVENTORY_SLOT, GO_TO_NEXT_ITEM); }); - } else + } + else { player.playSound(player.getLocation(), Sound.ANVIL_BREAK, 1.0F, 1.0F); player.getInventory().setItem(INVENTORY_SLOT, GO_TO_NEXT_ITEM); @@ -656,7 +669,7 @@ public class NextBestGameManager implements Listener private CountdownRunnable(Party party) { _party = party; - _player = Bukkit.getPlayerExact(party.getOwner()); + _player = Bukkit.getPlayerExact(party.getOwnerName()); runTaskTimer(_partyManager.getPlugin(), 0L, 20L); } @@ -686,11 +699,6 @@ public class NextBestGameManager implements Listener if (_party != null) { - if (_partyManager.getParty(_party.getName()) == null) - { - return; - } - MinecraftServer server = findBestGame(null, _party); if (server == null) @@ -699,7 +707,7 @@ public class NextBestGameManager implements Listener return; } - _partyManager.getRedisManager().sendPartyInfo(server.getName(), _party); + Portal.getInstance().sendPlayerToServer(_party.getOwnerAsPlayer().get(), server.getName(), Intent.PLAYER_REQUEST); return; } @@ -726,7 +734,8 @@ public class NextBestGameManager implements Listener if (_party == null) { _player.sendMessage(F.main("Game", "Sending you to your next game in " + F.greenElem(String.valueOf(_ticks)) + " " + (_ticks == 1 ? "second" : "seconds"))); - } else + } + else { _party.sendMessage(F.main("Game", "Sending you to your next game in " + F.greenElem(String.valueOf(_ticks)) + " " + (_ticks == 1 ? "second" : "seconds"))); } diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/managers/ProgressingKitManager.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/managers/ProgressingKitManager.java index db0a72789..2ce6c2ac3 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/managers/ProgressingKitManager.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/managers/ProgressingKitManager.java @@ -157,12 +157,15 @@ public class ProgressingKitManager implements Listener PlayerKit playerKit = _manager.getKitProgressionManager().getDataManager().get(player.getUniqueId()); try { - for (Kit kit : _manager.GetGame().GetKits()) + if (_manager.GetGame() != null) { - if (kit instanceof ProgressingKit) + for (Kit kit : _manager.GetGame().GetKits()) { - ProgressingKit progressingKit = (ProgressingKit) kit; - _manager.getKitProgressionManager().getRepository().insertOrUpdate(playerKit, progressingKit.getInternalName()); + if (kit instanceof ProgressingKit) + { + ProgressingKit progressingKit = (ProgressingKit) kit; + _manager.getKitProgressionManager().getRepository().insertOrUpdate(playerKit, progressingKit.getInternalName()); + } } } } @@ -184,7 +187,7 @@ public class ProgressingKitManager implements Listener String message = event.getMessage(); String user = event.getPlayer().getName(); - if(user.equalsIgnoreCase("TadahTech") || user.equalsIgnoreCase("Moppletop") || _manager.GetServerConfig().ServerGroup.equalsIgnoreCase("Testing")) + if(user.equalsIgnoreCase("Moppletop") || UtilServer.isTestServer()) { if(message.startsWith("/kpsetlevel")) { diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/managers/ServerUptimeManager.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/managers/ServerUptimeManager.java index 00a048219..bbc63306b 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/managers/ServerUptimeManager.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/managers/ServerUptimeManager.java @@ -13,6 +13,7 @@ import mineplex.core.common.Rank; import mineplex.core.common.util.F; import mineplex.core.common.util.UtilServer; import mineplex.core.common.util.UtilTime; +import mineplex.core.portal.Intent; import mineplex.core.updater.UpdateType; import mineplex.core.updater.event.UpdateEvent; import nautilus.game.arcade.ArcadeManager; @@ -129,7 +130,7 @@ public class ServerUptimeManager implements Listener for (Player player : UtilServer.getPlayers()) { - Manager.GetPortal().sendToHub(player, "Servertime has expired!"); + Manager.GetPortal().sendToHub(player, "Servertime has expired!", Intent.KICK); } Manager.runSyncLater(new Runnable() diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/managers/chat/GameChatManager.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/managers/chat/GameChatManager.java index d56aefeed..11fa85b5c 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/managers/chat/GameChatManager.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/managers/chat/GameChatManager.java @@ -1,16 +1,12 @@ package nautilus.game.arcade.managers.chat; -import mineplex.core.common.Rank; -import mineplex.core.common.jsonchat.JsonMessage; -import mineplex.core.common.util.C; -import mineplex.core.common.util.F; -import mineplex.core.common.util.UtilPlayer; -import mineplex.core.party.Party; -import nautilus.game.arcade.ArcadeManager; -import nautilus.game.arcade.game.Game; -import nautilus.game.arcade.game.Game.GameState; -import nautilus.game.arcade.game.GameTeam; -import org.bukkit.Bukkit; +import java.text.DecimalFormat; +import java.util.AbstractMap; +import java.util.Collection; +import java.util.Iterator; +import java.util.LinkedList; +import java.util.Map; + import org.bukkit.ChatColor; import org.bukkit.entity.Player; import org.bukkit.event.EventHandler; @@ -19,13 +15,17 @@ import org.bukkit.event.player.AsyncPlayerChatEvent; import org.bukkit.event.player.PlayerCommandPreprocessEvent; import org.jooq.tools.json.JSONObject; -import java.text.DecimalFormat; -import java.util.AbstractMap; -import java.util.Collection; -import java.util.Iterator; -import java.util.LinkedList; -import java.util.Map; -import java.util.UUID; +import mineplex.core.common.Rank; +import mineplex.core.common.jsonchat.JsonMessage; +import mineplex.core.common.util.C; +import mineplex.core.common.util.F; +import mineplex.core.common.util.UtilPlayer; +import mineplex.core.party.Party; + +import nautilus.game.arcade.ArcadeManager; +import nautilus.game.arcade.game.Game; +import nautilus.game.arcade.game.Game.GameState; +import nautilus.game.arcade.game.GameTeam; public class GameChatManager implements Listener { @@ -33,7 +33,7 @@ public class GameChatManager implements Listener private ArcadeManager _manager; private LinkedList _chatStats; - + public boolean TeamSpy; public GameChatManager(ArcadeManager manager) @@ -43,7 +43,7 @@ public class GameChatManager implements Listener _manager.getPluginManager().registerEvents(this, _manager.getPlugin()); _chatStats = new LinkedList(); - + TeamSpy = true; } @@ -62,9 +62,9 @@ public class GameChatManager implements Listener { if (event.isCancelled() || event.getMessage().isEmpty()) return; - if(event.getMessage() == null) + if (event.getMessage() == null) return; - if(event.getMessage().trim().length() == 0) + if (event.getMessage().trim().length() == 0) return; Player sender = event.getPlayer(); @@ -95,6 +95,8 @@ public class GameChatManager implements Listener { if (_manager.GetGameHostManager().isEventServer()) rankStr = C.cDGreen + C.Bold + "Event Host " + C.Reset; + else if (_manager.GetGameHostManager().isCommunityServer()) + rankStr = C.cDGreen + C.Bold + "MCS Host " + C.Reset; else rankStr = C.cDGreen + C.Bold + "MPS Host " + C.Reset; } @@ -102,32 +104,34 @@ public class GameChatManager implements Listener { if (_manager.GetGameHostManager().isEventServer()) rankStr = C.cDGreen + C.Bold + "Event Co-Host " + C.Reset; + else if (_manager.GetGameHostManager().isCommunityServer()) + rankStr = C.cDGreen + C.Bold + "MCS Co-Host " + C.Reset; else - rankStr = C.cDGreen + C.Bold + "MPS Co-Host " + C.Reset; + rankStr = C.cDGreen + C.Bold + "MPS Co-Host " + C.Reset; } else { - if (rank != Rank.ALL) + if (rank != Rank.ALL) rankStr = rank.getTag(true, true) + " " + C.Reset; } //Party Chat if (event.getMessage().charAt(0) == '@') { - Party party = _manager.getPartyManager().getParty(sender); + Party party = _manager.getPartyManager().getPartyByPlayer(sender); if (party != null) { - event.getRecipients().clear(); - - event.setMessage(event.getMessage().substring(1, event.getMessage().length())); - event.setFormat(levelStr + C.cDPurple + C.Bold + "Party " + C.cWhite + C.Bold + event.getPlayer().getName() + " " + C.cPurple + "%2$s"); - - for (String member : party.getMembers()) + if (event.getMessage().length() > 1) { - Player other = Bukkit.getPlayer(member); + event.setMessage(event.getMessage().substring(1, event.getMessage().length())); + event.setFormat(levelStr + C.cDPurple + C.Bold + "Party " + C.cWhite + C.Bold + event.getPlayer().getName() + " " + C.cPurple + "%2$s"); - if (other != null) - event.getRecipients().add(other); + event.getRecipients().removeIf(other -> !party.getMembers().contains(other)); + } + else + { + UtilPlayer.message(event.getPlayer(), F.main("Party", "Where's the message?")); + event.setCancelled(true); } } else @@ -141,7 +145,7 @@ public class GameChatManager implements Listener event.setFormat(levelStr + rankStr + senderName + " " + C.cWhite + "%2$s"); - if(rankStr.equals("")) + if (rankStr.equals("")) format = levelStr; else format = event.getFormat().split(rankStr)[0]; @@ -156,7 +160,7 @@ public class GameChatManager implements Listener { event.setFormat(levelStr + rankStr + senderName + " " + C.cWhite + "%2$s"); - if(safeSend(sender, format, rankStr, rank, name, message, event.getRecipients())) + if (safeSend(sender, format, rankStr, rank, name, message, event.getRecipients())) { event.setCancelled(true); } @@ -179,14 +183,14 @@ public class GameChatManager implements Listener { boolean isPriv = event.getMessage().charAt(0) == '#'; - if(isPriv) + if (isPriv) event.setMessage(event.getMessage().substring(1, event.getMessage().length())); else globalMessage = true; event.setFormat(isPriv ? C.cWhiteB + "Team " + dead + levelStr + rankStr + senderName + " " + C.cWhite + "%2$s" : dead + levelStr + rankStr + team.GetColor() + senderName + " " + C.cWhite + "%2$s"); - if(rankStr.equals("")) + if (rankStr.equals("")) format = isPriv ? C.cWhiteB + "Team " + dead + levelStr : dead + levelStr; else format = event.getFormat().split(rankStr)[0]; @@ -198,7 +202,7 @@ public class GameChatManager implements Listener globalMessage = true; event.setFormat(dead + levelStr + rankStr + senderName + " " + C.cWhite + "%2$s"); - if(rankStr.equals("")) + if (rankStr.equals("")) format = dead + levelStr; else format = event.getFormat().split(rankStr)[0]; @@ -208,7 +212,30 @@ public class GameChatManager implements Listener if (globalMessage) { - if(safeSend(sender, format, rankStr, rank, name, message, event.getRecipients())) + if (!_manager.GetGame().ShowEveryoneSpecChat) + { + //Team Message Remove Recipient + Iterator recipientIterator = event.getRecipients().iterator(); + + while (recipientIterator.hasNext()) + { + Player receiver = recipientIterator.next(); + + if (_manager.IsAlive(sender) || _manager.GetClients().Get(sender).GetRank().has(Rank.HELPER)) + { + continue; + } + + if (!_manager.IsAlive(receiver) || _manager.GetClients().Get(receiver).GetRank().has(Rank.MODERATOR)) + { + continue; + } + + recipientIterator.remove(); + } + } + + if (safeSend(sender, format, rankStr, rank, name, message, event.getRecipients())) { event.setCancelled(true); } @@ -240,7 +267,7 @@ public class GameChatManager implements Listener recipientIterator.remove(); } - if(safeSend(sender, format, rankStr, rank, name, message, event.getRecipients())) + if (safeSend(sender, format, rankStr, rank, name, message, event.getRecipients())) { event.setCancelled(true); } @@ -266,7 +293,7 @@ public class GameChatManager implements Listener public void setGameChatStats(ChatStatData... stats) { _chatStats = new LinkedList(); - for(ChatStatData chatStat : stats) + for (ChatStatData chatStat : stats) { _chatStats.add(chatStat); } @@ -274,9 +301,9 @@ public class GameChatManager implements Listener private JsonMessage buildJSON(Player player, String prefix, String rankStr, Rank rank, String name, LinkedList hoverText, String message) { - if(_manager.GetGame().GetState() != GameState.Prepare && _manager.GetGame().GetState() != GameState.Live && _manager.GetGame().GetState() != GameState.End) + if (_manager.GetGame() == null || (_manager.GetGame().GetState() != GameState.Prepare && _manager.GetGame().GetState() != GameState.Live && _manager.GetGame().GetState() != GameState.End)) { - if(rank == Rank.ALL) + if (rank == Rank.ALL) { return new JsonMessage("").extra(JSONObject.escape(prefix)) .add(JSONObject.escape(rankStr)).add(JSONObject.escape(name)).add(JSONObject.escape(message)); @@ -300,14 +327,14 @@ public class GameChatManager implements Listener { if (!_manager.GetGame().GetStats().containsKey(player)) { - temp.add(new AbstractMap.SimpleEntry(C.cGray + "Retrieving stats...", "")); + temp.add(new AbstractMap.SimpleEntry(C.cGray + "No in-game stats available", "")); break; } ChatStatData chatStatData = hoverText.get(i); String display = (chatStatData.getDisplay() == null ? chatStatData.getStat() : chatStatData.getDisplay()); - if(!chatStatData.isValue()) + if (!chatStatData.isValue()) { temp.add(new AbstractMap.SimpleEntry(chatStatData.getDisplay(), "")); continue; @@ -351,10 +378,10 @@ public class GameChatManager implements Listener String stats = ""; for (int i = 0; i < temp.size(); i++) { - stats += C.cWhite + JSONObject.escape(temp.get(i).getKey()) + C.cGray + JSONObject.escape(temp.get(i).getValue()) + (i >= temp.size()-1 ? "" : "\\n"); + stats += C.cWhite + JSONObject.escape(temp.get(i).getKey()) + C.cGray + JSONObject.escape(temp.get(i).getValue()) + (i >= temp.size() - 1 ? "" : "\\n"); } - if(rank == Rank.ALL) + if (rank == Rank.ALL) { return new JsonMessage("").extra(JSONObject.escape(prefix)) .add(JSONObject.escape(rankStr)).add(JSONObject.escape(name)).hover("show_text", stats).add(JSONObject.escape(message)); @@ -369,10 +396,10 @@ public class GameChatManager implements Listener { double ratio = 0.0; - if(var1 <= 0) ratio = 0d; - else if(var2 <= 1) ratio = (double) var1; - else if(var1 <= 0 && var2 <= 0) ratio = 0d; - else ratio = ((double) var1 / var2); + if (var1 <= 0) ratio = 0d; + else if (var2 <= 1) ratio = (double) var1; + else if (var1 <= 0 && var2 <= 0) ratio = 0d; + else ratio = ((double) var1 / var2); return Double.parseDouble(new DecimalFormat(format).format(ratio)); } diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/managers/events/SpecialEntityDeathEvent.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/managers/events/SpecialEntityDeathEvent.java index 8f9a142c4..ef18499df 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/managers/events/SpecialEntityDeathEvent.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/managers/events/SpecialEntityDeathEvent.java @@ -1,42 +1,42 @@ -package nautilus.game.arcade.managers.events; - -import org.bukkit.entity.Entity; -import org.bukkit.entity.Player; -import org.bukkit.event.Event; -import org.bukkit.event.HandlerList; - -public class SpecialEntityDeathEvent extends Event -{ - - private static final HandlerList handlers = new HandlerList(); - - private Entity _entity; - private Player _killer; - - public SpecialEntityDeathEvent(Entity entity, Player killer) - { - _entity = entity; - _killer = killer; - } - - public Entity getEntity() - { - return _entity; - } - - public Player getKiller() - { - return _killer; - } - - public HandlerList getHandlers() - { - return handlers; - } - - public static HandlerList getHandlerList() - { - return handlers; - } - -} +package nautilus.game.arcade.managers.events; + +import org.bukkit.entity.Entity; +import org.bukkit.entity.Player; +import org.bukkit.event.Event; +import org.bukkit.event.HandlerList; + +public class SpecialEntityDeathEvent extends Event +{ + + private static final HandlerList handlers = new HandlerList(); + + private Entity _entity; + private Player _killer; + + public SpecialEntityDeathEvent(Entity entity, Player killer) + { + _entity = entity; + _killer = killer; + } + + public Entity getEntity() + { + return _entity; + } + + public Player getKiller() + { + return _killer; + } + + public HandlerList getHandlers() + { + return handlers; + } + + public static HandlerList getHandlerList() + { + return handlers; + } + +} diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/managers/lobby/LobbyManager.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/managers/lobby/LobbyManager.java index 262acbb45..72f1dc35f 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/managers/lobby/LobbyManager.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/managers/lobby/LobbyManager.java @@ -1,6 +1,8 @@ package nautilus.game.arcade.managers.lobby; import com.google.common.collect.Maps; + +import mineplex.core.Managers; import mineplex.core.PlayerSelector; import mineplex.core.account.CoreClient; import mineplex.core.common.Rank; @@ -15,6 +17,7 @@ import mineplex.core.common.util.UtilWorld; import mineplex.core.donation.Donor; import mineplex.core.event.CustomTagEvent; import mineplex.core.scoreboard.MineplexScoreboard; +import mineplex.core.titles.Titles; import mineplex.core.updater.UpdateType; import mineplex.core.updater.event.UpdateEvent; import mineplex.minecraft.game.core.damage.CustomDamageEvent; @@ -523,9 +526,9 @@ public abstract class LobbyManager implements Listener _manager.hasKitsUnlocked(player) || //YouTube (ent.GetKit().GetAvailability() == KitAvailability.Achievement && _manager.GetAchievement().hasCategory(player, ent.GetKit().getAchievementRequirement())) || //Achievement - donor.OwnsUnknownPackage(_manager.GetGame().GetType().GetKitGameName(game) + " " + ent.GetKit().GetName()) || //Green + donor.ownsUnknownSalesPackage(_manager.GetGame().GetType().GetKitGameName(game) + " " + ent.GetKit().GetName()) || //Green _manager.GetClients().Get(player).GetRank().has(Rank.MAPDEV) || //STAFF - donor.OwnsUnknownPackage(_manager.GetServerConfig().ServerType + " ULTRA") || //Single Ultra (Old) + donor.ownsUnknownSalesPackage(_manager.GetServerConfig().ServerType + " ULTRA") || //Single Ultra (Old) _manager.GetServerConfig().Tournament) //Tournament { entityName = ent.GetKit().GetAvailability().GetColor() + entityName; @@ -630,7 +633,7 @@ public abstract class LobbyManager implements Listener { team.removeEntry(player.getName()); } - scoreboard.getHandle().getTeam(rank.Name).addEntry(player.getName()); + scoreboard.getHandle().getTeam(rank.ScoreboardTag).addEntry(player.getName()); } } @@ -647,15 +650,15 @@ public abstract class LobbyManager implements Listener rank = _manager.GetClients().Get(player).getRealOrDisguisedRank(); } - String rankName = rank.Name; + String rankName = rank.ScoreboardTag; if (player != null) { boolean rankIsUltra = !rank.has(Rank.ULTRA) && - _manager.GetDonation().Get(player).OwnsUnknownPackage(_manager.GetServerConfig().ServerType + " ULTRA"); + _manager.GetDonation().Get(player).ownsUnknownSalesPackage(_manager.GetServerConfig().ServerType + " ULTRA"); if (rankIsUltra) { - rankName = Rank.ULTRA.Name; + rankName = Rank.ULTRA.ScoreboardTag; } } @@ -732,6 +735,8 @@ public abstract class LobbyManager implements Listener //Cosmetic Menu _manager.getCosmeticManager().giveInterfaceItem(player); _manager.getBoosterManager().giveInterfaceItem(player); + _manager.getTitles().giveBookIfNotExists(player, false); + _manager.getPartyManager().giveItemIfNotExists(player); } } diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/managers/lobby/current/NewGameLobbyManager.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/managers/lobby/current/NewGameLobbyManager.java index ca5f05faf..a0a07de20 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/managers/lobby/current/NewGameLobbyManager.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/managers/lobby/current/NewGameLobbyManager.java @@ -5,7 +5,7 @@ import com.google.common.collect.Maps; import mineplex.core.common.util.MapUtil; import mineplex.core.common.util.UtilAlg; import mineplex.core.common.util.UtilEnt; -import mineplex.core.timing.TimingManager; +import mineplex.core.common.timing.TimingManager; import nautilus.game.arcade.ArcadeManager; import nautilus.game.arcade.game.Game; import nautilus.game.arcade.game.GameTeam; @@ -398,7 +398,7 @@ public class NewGameLobbyManager extends LobbyManager ent.setColor(DyeColor.getByWoolData(team.GetColorData())); - UtilEnt.Vegetate(ent, true); + UtilEnt.vegetate(ent, true); UtilEnt.setFakeHead(ent, true); UtilEnt.ghost(ent, true, false); diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/managers/lobby/legacy/LegacyGameLobbyManager.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/managers/lobby/legacy/LegacyGameLobbyManager.java index 3ecc7b3a1..2d988d0d5 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/managers/lobby/legacy/LegacyGameLobbyManager.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/managers/lobby/legacy/LegacyGameLobbyManager.java @@ -81,7 +81,7 @@ public class LegacyGameLobbyManager extends LobbyManager ent.setColor(DyeColor.getByWoolData(teams.get(i).GetColorData())); - UtilEnt.Vegetate(ent, true); + UtilEnt.vegetate(ent, true); UtilEnt.setFakeHead(ent, true); UtilEnt.ghost(ent, true, false); diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/managers/titangiveaway/TitanGiveawayRepository.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/managers/titangiveaway/TitanGiveawayRepository.java index 49bc0601b..a66043121 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/managers/titangiveaway/TitanGiveawayRepository.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/managers/titangiveaway/TitanGiveawayRepository.java @@ -10,28 +10,16 @@ import mineplex.serverdata.database.RepositoryBase; import org.bukkit.plugin.java.JavaPlugin; -public class TitanGiveawayRepository extends MinecraftRepository +public class TitanGiveawayRepository extends RepositoryBase { private int _titanGiveawayCount; public TitanGiveawayRepository(JavaPlugin plugin) { - super(plugin, DBPool.getAccount()); + super(DBPool.getAccount()); _titanGiveawayCount = 0; } - @Override - protected void initialize() - { - - } - - @Override - protected void update() - { - - } - public boolean canGiveaway() { try (Connection connection = getConnection(); diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/scoreboard/GameScoreboard.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/scoreboard/GameScoreboard.java index 90c137692..def71d516 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/scoreboard/GameScoreboard.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/scoreboard/GameScoreboard.java @@ -5,6 +5,7 @@ import mineplex.core.common.util.C; import mineplex.core.scoreboard.WritableMineplexScoreboard; import nautilus.game.arcade.game.Game; import nautilus.game.arcade.game.GameTeam; + import org.bukkit.entity.Player; import org.bukkit.scoreboard.Scoreboard; import org.bukkit.scoreboard.Team; @@ -34,6 +35,19 @@ public class GameScoreboard extends WritableMineplexScoreboard setSidebarName(C.Bold + _title); } + + @Override + public void draw() + { + if (_bufferedLines.size() > 15) + { + while (_bufferedLines.size() > 15) + { + _bufferedLines.remove(_bufferedLines.size() - 1); + } + } + super.draw(); + } public Scoreboard getScoreboard() { diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/stats/KillsStatTracker.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/stats/KillsStatTracker.java index a384daf3a..7a24f23d1 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/stats/KillsStatTracker.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/stats/KillsStatTracker.java @@ -5,6 +5,7 @@ import org.bukkit.event.EventHandler; import org.bukkit.event.EventPriority; import mineplex.core.common.util.UtilPlayer; +import mineplex.core.titles.tracks.WarriorTrack; import mineplex.minecraft.game.core.combat.event.CombatDeathEvent; import nautilus.game.arcade.game.Game; @@ -33,6 +34,11 @@ public class KillsStatTracker extends StatTracker addStat(player, "Kills", 1, false, false); + if (getGame().getArcadeManager().GetServerConfig().RewardStats) + { + getGame().getArcadeManager().getTrackManager().getTrack(WarriorTrack.class).earnedKill(player, 1); + } + // if (getGame().GetKit(player) != null) // addStat(player, getGame().GetKit(player).getName() + " Kills", 1, false, false); } diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/stats/WinStatTracker.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/stats/WinStatTracker.java index 345539360..68c9de226 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/stats/WinStatTracker.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/stats/WinStatTracker.java @@ -6,6 +6,8 @@ import org.bukkit.entity.Player; import org.bukkit.event.EventHandler; import org.bukkit.event.EventPriority; +import mineplex.core.titles.tracks.PeacefulTrack; + import nautilus.game.arcade.events.GameStateChangeEvent; import nautilus.game.arcade.game.Game; @@ -31,6 +33,13 @@ public class WinStatTracker extends StatTracker continue; addStat(winner, "Wins", 1, false, false); + addStat(winner, "TrackWins", 1, false, false); + + + if (getGame().getArcadeManager().GetServerConfig().RewardStats) + { + getGame().getArcadeManager().getTrackManager().getTrack(PeacefulTrack.class).wonGame(winner, getGame().GetType().getDisplay()); + } // if (getGame().GetKit(winner) != null) // addStat(winner, getGame().GetKit(winner).getName() + " Wins", 1, false, false); diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/world/WorldData.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/world/WorldData.java index cb93be658..31fe41def 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/world/WorldData.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/world/WorldData.java @@ -1,6 +1,7 @@ package nautilus.game.arcade.world; import com.mineplex.spigot.ChunkPreLoadEvent; + import mineplex.core.common.util.FileUtil; import mineplex.core.common.util.MapUtil; import mineplex.core.common.util.UtilMath; @@ -8,15 +9,16 @@ import mineplex.core.common.util.UtilServer; import mineplex.core.common.util.WorldUtil; import mineplex.core.common.util.ZipUtil; import mineplex.core.common.util.worldgen.WorldGenCleanRoom; -import mineplex.core.timing.TimingManager; +import mineplex.core.common.api.enderchest.EnderchestWorldLoader; +import mineplex.core.common.timing.TimingManager; import nautilus.game.arcade.GameType; import nautilus.game.arcade.game.Game; import nautilus.game.arcade.game.games.uhc.UHC; import org.bukkit.Difficulty; import org.bukkit.Location; import org.bukkit.World; -import org.bukkit.World.Environment; import org.bukkit.WorldCreator; +import org.spigotmc.SpigotConfig; import java.io.BufferedReader; import java.io.BufferedWriter; @@ -44,9 +46,7 @@ public class WorldData public int MinZ = 0; public int MaxX = 0; public int MaxZ = 0; - public int CurX = 0; - public int CurZ = 0; - + public int MinY = -1; public int MaxY = 256; @@ -79,7 +79,17 @@ public class WorldData public void run() { //Unzip - worldData.UnzipWorld(); + if (Host instanceof UHC) { + boolean uhcLoaded = loadUHCMap(); // attempt to load from enderchest + if (!uhcLoaded) + { + // failsafe on normal UHC map + worldData.UnzipWorld(); + } + } else + { + worldData.UnzipWorld(); + } //Load World Data Sync UtilServer.getServer().getScheduler().runTask(Host.Manager.getPlugin(), new Runnable() @@ -87,35 +97,12 @@ public class WorldData public void run() { TimingManager.start("WorldData loading world."); - //Start World - - if (Host instanceof UHC) - { - //Delete Old World - File dir = new File(GetFolder() + "/data"); - FileUtil.DeleteFolder(dir); - - dir = new File(GetFolder() + "/region"); - FileUtil.DeleteFolder(dir); - - dir = new File(GetFolder() + "/level.dat"); - if (dir.exists()) - dir.delete(); - - //Create Fresh World with Random Seed - WorldCreator creator = new WorldCreator(GetFolder()); - creator.seed(UtilMath.r(999999999)); - creator.environment(Environment.NORMAL); - creator.generateStructures(true); - - World = WorldUtil.LoadWorld(creator); - } - else - { - WorldCreator creator = new WorldCreator(GetFolder()); - creator.generator(new WorldGenCleanRoom()); - World = WorldUtil.LoadWorld(creator); - } + + WorldCreator creator = new WorldCreator(GetFolder()); + creator.generator(new WorldGenCleanRoom()); + World = WorldUtil.LoadWorld(creator); + + TimingManager.stop("WorldData loading world."); World.setDifficulty(Difficulty.HARD); @@ -140,6 +127,30 @@ public class WorldData } }); } + + private boolean loadUHCMap() + { + EnderchestWorldLoader worldLoader = new EnderchestWorldLoader(); + boolean success = false; + + for (int attempt = 1; !success && attempt <= 3; attempt++) + { + System.out.println("Grabbing UHC map from Enderchest, attempt " + attempt); + + try + { + worldLoader.loadMap("uhc", GetFolder()); + SpigotConfig.config.set("world-settings." + GetFolder() + ".view-distance", UHC.VIEW_DISTANCE); + success = true; + } catch (Exception e) + { + attempt++; + e.printStackTrace(); + } + } + + return success; + } protected GameType GetGame() { @@ -325,7 +336,6 @@ public class WorldData try { MinX = Integer.parseInt(tokens[1]); - CurX = MinX; } catch (Exception e) { @@ -349,7 +359,6 @@ public class WorldData try { MinZ = Integer.parseInt(tokens[1]); - CurZ = MinZ; } catch (Exception e) { @@ -422,30 +431,6 @@ public class WorldData return null; } - public boolean LoadChunks(long maxMilliseconds) - { - if (Host instanceof UHC) - { - return true; - } - long startTime = System.currentTimeMillis(); - - for (; CurX <= MaxX; CurX += 16) - { - for (; CurZ <= MaxZ; CurZ += 16) - { - if (System.currentTimeMillis() - startTime >= maxMilliseconds) - return false; - - World.getChunkAt(new Location(World, CurX, 0, CurZ)); - } - - CurZ = MinZ; - } - - return true; - } - public void Uninitialize() { if (World == null) diff --git a/Plugins/Nautilus.Game.PvP/src/nautilus/game/pvp/PvP.java b/Plugins/Nautilus.Game.PvP/src/nautilus/game/pvp/PvP.java index cfe3add2b..d6732cbad 100644 --- a/Plugins/Nautilus.Game.PvP/src/nautilus/game/pvp/PvP.java +++ b/Plugins/Nautilus.Game.PvP/src/nautilus/game/pvp/PvP.java @@ -328,7 +328,7 @@ public class PvP extends JavaPlugin implements IPlugin, Listener public BlockRestore GetBlockRestore() { if (_blockRestore == null) - _blockRestore = new BlockRestore(this); + _blockRestore = require(BlockRestore.class); return _blockRestore; } diff --git a/Plugins/mavericks-review-hub/src/mineplex/mavericks/review/Hub.java b/Plugins/mavericks-review-hub/src/mineplex/mavericks/review/Hub.java index 632be718e..f2e7831df 100644 --- a/Plugins/mavericks-review-hub/src/mineplex/mavericks/review/Hub.java +++ b/Plugins/mavericks-review-hub/src/mineplex/mavericks/review/Hub.java @@ -1,7 +1,10 @@ package mineplex.mavericks.review; +import net.minecraft.server.v1_8_R3.MinecraftServer; + import org.bukkit.Bukkit; import org.bukkit.plugin.java.JavaPlugin; +import org.spigotmc.SpigotConfig; import mineplex.core.CustomTagFix; import mineplex.core.FoodDupeFix; @@ -13,6 +16,7 @@ import mineplex.core.blockrestore.BlockRestore; import mineplex.core.boosters.BoosterManager; import mineplex.core.chat.Chat; import mineplex.core.command.CommandCenter; +import mineplex.core.common.Constants; import mineplex.core.cosmetic.CosmeticManager; import mineplex.core.creature.Creature; import mineplex.core.disguise.DisguiseManager; @@ -34,6 +38,7 @@ import mineplex.core.monitor.LagMeter; import mineplex.core.mount.MountManager; import mineplex.core.packethandler.PacketHandler; import mineplex.core.pet.PetManager; +import mineplex.core.portal.GenericServer; import mineplex.core.portal.Portal; import mineplex.core.preferences.PreferencesManager; import mineplex.core.profileCache.ProfileCacheManager; @@ -50,8 +55,6 @@ import mineplex.core.updater.FileUpdater; import mineplex.core.updater.Updater; import mineplex.core.velocity.VelocityFix; import mineplex.core.visibility.VisibilityManager; -import net.minecraft.server.v1_8_R3.MinecraftServer; -import org.spigotmc.SpigotConfig; import static mineplex.core.Managers.require; @@ -60,9 +63,6 @@ import static mineplex.core.Managers.require; */ public class Hub extends JavaPlugin { - - private String WEB_CONFIG = "webServer"; - // Modules private CoreClientManager _clientManager; private DonationManager _donationManager; @@ -74,15 +74,13 @@ public class Hub extends JavaPlugin // Delete Old Games Folders // Configs - getConfig().addDefault(WEB_CONFIG, "http://accounts.mineplex.com/"); - getConfig().set(WEB_CONFIG, getConfig().getString(WEB_CONFIG)); + getConfig().addDefault(Constants.WEB_CONFIG_KEY, Constants.WEB_ADDRESS); + getConfig().set(Constants.WEB_CONFIG_KEY, getConfig().getString(Constants.WEB_CONFIG_KEY)); saveConfig(); - String webServerAddress = getConfig().getString(WEB_CONFIG); - // Static Modules CommandCenter.Initialize(this); - _clientManager = new CoreClientManager(this, webServerAddress); + _clientManager = new CoreClientManager(this); CommandCenter.Instance.setClientManager(_clientManager); ItemStackFactory.Initialize(this, false); @@ -93,7 +91,7 @@ public class Hub extends JavaPlugin // Velocity Fix new VelocityFix(this); - _donationManager = new DonationManager(this, _clientManager, webServerAddress); + _donationManager = require(DonationManager.class); PacketHandler packetHandler = require(PacketHandler.class); @@ -104,12 +102,12 @@ public class Hub extends JavaPlugin Creature creature = new Creature(this); ServerStatusManager serverStatusManager = new ServerStatusManager(this, _clientManager, new LagMeter(this, _clientManager)); - Portal portal = new Portal(this, _clientManager, serverStatusManager.getCurrentServerName()); - new FileUpdater(this, portal, serverStatusManager.getCurrentServerName(), serverStatusManager.getRegion()); + Portal portal = new Portal(); + new FileUpdater(this, portal, serverStatusManager.getCurrentServerName(), serverStatusManager.getRegion(), GenericServer.HUB); DisguiseManager disguiseManager = require(DisguiseManager.class); - Punish punish = new Punish(this, webServerAddress, _clientManager); + Punish punish = new Punish(this, _clientManager); require(AntiHack.class); IgnoreManager ignoreManager = new IgnoreManager(this, _clientManager, preferenceManager, portal); @@ -120,7 +118,7 @@ public class Hub extends JavaPlugin Chat chat = new Chat(this, incognito, _clientManager, preferenceManager, achievementManager, serverStatusManager.getCurrentServerName()); new MessageManager(this, incognito, _clientManager, preferenceManager, ignoreManager, punish, friendManager, chat); - BlockRestore blockRestore = new BlockRestore(this); + BlockRestore blockRestore = require(BlockRestore.class); ProjectileManager projectileManager = new ProjectileManager(this); HologramManager hologramManager = new HologramManager(this, packetHandler); @@ -129,14 +127,13 @@ public class Hub extends JavaPlugin // Inventory InventoryManager inventoryManager = new InventoryManager(this, _clientManager); - PetManager petManager = new PetManager(this, _clientManager, _donationManager, inventoryManager, disguiseManager, creature, blockRestore, - webServerAddress); + PetManager petManager = new PetManager(this, _clientManager, _donationManager, inventoryManager, disguiseManager, creature, blockRestore); MountManager mountManager = new MountManager(this, _clientManager, _donationManager, blockRestore, disguiseManager); GadgetManager gadgetManager = new GadgetManager(this, _clientManager, _donationManager, inventoryManager, mountManager, petManager, preferenceManager, disguiseManager, blockRestore, projectileManager, achievementManager, packetHandler, hologramManager, incognito); ThankManager thankManager = new ThankManager(this, _clientManager, _donationManager); BoosterManager boosterManager = new BoosterManager(this, serverConfiguration.getServerGroup().getBoosterGroup(), _clientManager, _donationManager, inventoryManager, thankManager); - RewardManager rewardManager = new RewardManager(_clientManager, _donationManager, inventoryManager, petManager, statsManager, gadgetManager); + RewardManager rewardManager = new RewardManager(_clientManager, _donationManager, inventoryManager, petManager, gadgetManager, statsManager); TreasureManager treasureManager = new TreasureManager(this, _clientManager, serverStatusManager, _donationManager, inventoryManager, petManager, gadgetManager, blockRestore, hologramManager, statsManager, rewardManager); CosmeticManager cosmeticManager = new CosmeticManager(this, _clientManager, _donationManager, inventoryManager, gadgetManager, mountManager, petManager, treasureManager, boosterManager); diff --git a/Plugins/mavericks-review-hub/src/mineplex/mavericks/review/MavericksReviewManager.java b/Plugins/mavericks-review-hub/src/mineplex/mavericks/review/MavericksReviewManager.java index 1b417821d..7dfe4810f 100644 --- a/Plugins/mavericks-review-hub/src/mineplex/mavericks/review/MavericksReviewManager.java +++ b/Plugins/mavericks-review-hub/src/mineplex/mavericks/review/MavericksReviewManager.java @@ -625,7 +625,7 @@ public class MavericksReviewManager extends MiniPlugin } else { - UtilEnt.Vegetate(e, true); + UtilEnt.vegetate(e, true); UtilEnt.ghost(e, true, false); } } diff --git a/Plugins/mavericks-review-hub/src/mineplex/mavericks/review/SimpleChatManager.java b/Plugins/mavericks-review-hub/src/mineplex/mavericks/review/SimpleChatManager.java index 003638d81..c900b060a 100644 --- a/Plugins/mavericks-review-hub/src/mineplex/mavericks/review/SimpleChatManager.java +++ b/Plugins/mavericks-review-hub/src/mineplex/mavericks/review/SimpleChatManager.java @@ -42,10 +42,7 @@ public class SimpleChatManager extends MiniPlugin Player player = event.getPlayer(); String playerName = player.getName(); - Rank rank = _coreClientManager.Get(player).GetRank(); - - if(_coreClientManager.Get(player).isDisguised()) - rank = _coreClientManager.Get(player).getDisguisedRank(); + Rank rank = _coreClientManager.Get(player).getRealOrDisguisedRank(); //Level Prefix String levelStr = _achievementManager.getMineplexLevel(player, rank); diff --git a/Plugins/mineplex-game-gemhunters/plugin.yml b/Plugins/mineplex-game-gemhunters/plugin.yml new file mode 100644 index 000000000..4f013d203 --- /dev/null +++ b/Plugins/mineplex-game-gemhunters/plugin.yml @@ -0,0 +1,5 @@ +name: GemHunters +main: mineplex.gemhunters.GemHunters +version: 0.1 +commands: + playwire: \ No newline at end of file diff --git a/Plugins/mineplex-game-gemhunters/pom.xml b/Plugins/mineplex-game-gemhunters/pom.xml new file mode 100644 index 000000000..16129c057 --- /dev/null +++ b/Plugins/mineplex-game-gemhunters/pom.xml @@ -0,0 +1,27 @@ + + 4.0.0 + + + com.mineplex + mineplex-plugin + dev-SNAPSHOT + ../plugin.xml + + + GemHunters + mineplex-game-gemhunters + + + + ${project.groupId} + mineplex-core + ${project.version} + + + ${project.groupId} + mineplex-minecraft-game-core + ${project.version} + + + \ No newline at end of file diff --git a/Plugins/mineplex-game-gemhunters/src/mineplex/gemhunters/GemHunters.java b/Plugins/mineplex-game-gemhunters/src/mineplex/gemhunters/GemHunters.java new file mode 100644 index 000000000..76c0c5c84 --- /dev/null +++ b/Plugins/mineplex-game-gemhunters/src/mineplex/gemhunters/GemHunters.java @@ -0,0 +1,323 @@ +package mineplex.gemhunters; + +import net.minecraft.server.v1_8_R3.MinecraftServer; + +import org.bukkit.Bukkit; +import org.bukkit.World; +import org.bukkit.craftbukkit.v1_8_R3.CraftWorld; +import org.bukkit.plugin.java.JavaPlugin; +import org.spigotmc.SpigotConfig; + +import mineplex.core.CustomTagFix; +import mineplex.core.FoodDupeFix; +import mineplex.core.TimingsFix; +import mineplex.core.account.CoreClientManager; +import mineplex.core.achievement.AchievementManager; +import mineplex.core.antihack.AntiHack; +import mineplex.core.blockrestore.BlockRestore; +import mineplex.core.boosters.BoosterManager; +import mineplex.core.chat.Chat; +import mineplex.core.chatsnap.SnapshotManager; +import mineplex.core.chatsnap.SnapshotPlugin; +import mineplex.core.chatsnap.SnapshotRepository; +import mineplex.core.command.CommandCenter; +import mineplex.core.common.Constants; +import mineplex.core.common.events.ServerShutdownEvent; +import mineplex.core.communities.CommunityManager; +import mineplex.core.cosmetic.CosmeticManager; +import mineplex.core.creature.Creature; +import mineplex.core.delayedtask.DelayedTask; +import mineplex.core.disguise.DisguiseManager; +import mineplex.core.disguise.playerdisguise.PlayerDisguiseManager; +import mineplex.core.donation.DonationManager; +import mineplex.core.elo.EloManager; +import mineplex.core.explosion.Explosion; +import mineplex.core.friend.FriendManager; +import mineplex.core.gadget.GadgetManager; +import mineplex.core.give.Give; +import mineplex.core.hologram.HologramManager; +import mineplex.core.ignore.IgnoreManager; +import mineplex.core.incognito.IncognitoManager; +import mineplex.core.inventory.InventoryManager; +import mineplex.core.itemstack.ItemStackFactory; +import mineplex.core.memory.MemoryFix; +import mineplex.core.menu.MenuManager; +import mineplex.core.message.MessageManager; +import mineplex.core.monitor.LagMeter; +import mineplex.core.mount.MountManager; +import mineplex.core.npc.NpcManager; +import mineplex.core.packethandler.PacketHandler; +import mineplex.core.party.PartyManager; +import mineplex.core.pet.PetManager; +import mineplex.core.portal.GenericServer; +import mineplex.core.portal.Portal; +import mineplex.core.preferences.PreferencesManager; +import mineplex.core.projectile.ProjectileManager; +import mineplex.core.punish.Punish; +import mineplex.core.recharge.Recharge; +import mineplex.core.report.ReportManager; +import mineplex.core.report.ReportPlugin; +import mineplex.core.serverConfig.ServerConfiguration; +import mineplex.core.stats.StatsManager; +import mineplex.core.status.ServerStatusManager; +import mineplex.core.teleport.Teleport; +import mineplex.core.thank.ThankManager; +import mineplex.core.twofactor.TwoFactorAuth; +import mineplex.core.updater.FileUpdater; +import mineplex.core.updater.Updater; +import mineplex.core.visibility.VisibilityManager; +import mineplex.gemhunters.beta.BetaModule; +import mineplex.gemhunters.bounties.BountyModule; +import mineplex.gemhunters.chat.ChatModule; +import mineplex.gemhunters.death.DeathModule; +import mineplex.gemhunters.death.quitnpc.QuitNPCModule; +import mineplex.gemhunters.economy.CashOutModule; +import mineplex.gemhunters.economy.EconomyModule; +import mineplex.gemhunters.loot.InventoryModule; +import mineplex.gemhunters.loot.LootModule; +import mineplex.gemhunters.map.ItemMapModule; +import mineplex.gemhunters.moderation.ModerationModule; +import mineplex.gemhunters.mount.MountModule; +import mineplex.gemhunters.playerstatus.PlayerStatusModule; +import mineplex.gemhunters.quest.QuestModule; +import mineplex.gemhunters.safezone.SafezoneModule; +import mineplex.gemhunters.scoreboard.ScoreboardModule; +import mineplex.gemhunters.shop.ShopModule; +import mineplex.gemhunters.spawn.SpawnModule; +import mineplex.gemhunters.supplydrop.SupplyDropModule; +import mineplex.gemhunters.world.DebugListeners; +import mineplex.gemhunters.world.TimeCycle; +import mineplex.gemhunters.world.UndergroundMobs; +import mineplex.gemhunters.world.WorldListeners; +import mineplex.gemhunters.worldevent.WorldEventModule; +import mineplex.minecraft.game.core.combat.CombatManager; +import mineplex.minecraft.game.core.condition.ConditionManager; +import mineplex.minecraft.game.core.damage.DamageManager; + +import static mineplex.core.Managers.require; + +/** + * Gem Hunters main class
+ * + * TODO make documentation and a nice header + * + * @author Sam + */ +public class GemHunters extends JavaPlugin +{ + + @Override + public void onEnable() + { + // Load configuration + getConfig().addDefault(Constants.WEB_CONFIG_KEY, Constants.WEB_ADDRESS); + getConfig().set(Constants.WEB_CONFIG_KEY, getConfig().getString(Constants.WEB_CONFIG_KEY)); + saveConfig(); + + // Load core modules + CommandCenter.Initialize(this); + + // Client Manager + CoreClientManager clientManager = new CoreClientManager(this); + + // Donation Manager + DonationManager donationManager = require(DonationManager.class); + + // Command Centre + CommandCenter.Instance.setClientManager(clientManager); + + // Timings + require(TimingsFix.class); + + // ItemStacks + ItemStackFactory.Initialize(this, false); + + // Delayed Tasks + DelayedTask.Initialize(this); + + // Recharge + Recharge.Initialize(this); + + // Visibility + VisibilityManager.Initialize(this); + + // Give + Give.Initialize(this); + + // Server config + ServerConfiguration serverConfig = new ServerConfiguration(this, clientManager); + + // Teleport + new Teleport(this, clientManager); + + // Packets + PacketHandler packetHandler = require(PacketHandler.class); + + // Vanish + IncognitoManager incognito = new IncognitoManager(this, clientManager, packetHandler); + + // Preferences + PreferencesManager preferenceManager = new PreferencesManager(this, incognito, clientManager); + + // Why do these depend on each other... :( + incognito.setPreferencesManager(preferenceManager); + + // Server Status + ServerStatusManager serverStatusManager = new ServerStatusManager(this, clientManager, new LagMeter(this, clientManager)); + + // Portal + Portal portal = new Portal(); + + // File Updater + new FileUpdater(this, portal, serverStatusManager.getCurrentServerName(), serverStatusManager.getRegion(), GenericServer.BETA_HUB); + + // Punish + Punish punish = new Punish(this, clientManager); + + // Disguises + DisguiseManager disguiseManager = require(DisguiseManager.class); + require(PlayerDisguiseManager.class); + + // Creatures + Creature creature = new Creature(this); + + // The old classic Damage Manager + DamageManager damageManager = new DamageManager(this, new CombatManager(this), new NpcManager(this, creature), disguiseManager, new ConditionManager(this)); + damageManager.SetEnabled(false); + + // GWEN + AntiHack antiHack = require(AntiHack.class); + Bukkit.getScheduler().runTask(this, () -> { + antiHack.setStrict(true); + antiHack.enableAnticheat(); + }); + + // Block Restore + BlockRestore blockRestore = require(BlockRestore.class); + + // Ignoring + IgnoreManager ignoreManager = new IgnoreManager(this, clientManager, preferenceManager, portal); + + // Statistics + StatsManager statsManager = new StatsManager(this, clientManager); + + // Elo + EloManager eloManager = new EloManager(this, clientManager); + + // Achievements + AchievementManager achievementManager = new AchievementManager(statsManager, clientManager, donationManager, incognito, eloManager); + + // Chat/Messaging + Chat chat = new Chat(this, incognito, clientManager, preferenceManager, achievementManager, serverStatusManager.getCurrentServerName()); + new MessageManager(this, incognito, clientManager, preferenceManager, ignoreManager, punish, new FriendManager(this, clientManager, preferenceManager, portal), chat); + + // Parties + new PartyManager(); + + // Communities + new CommunityManager(this, clientManager); + + // Fixes + new MemoryFix(this); + new FoodDupeFix(this); + + // Explosions + Explosion explosion = new Explosion(this, blockRestore); + + explosion.SetDebris(true); + explosion.SetTemporaryDebris(false); + + // Inventories + InventoryManager inventoryManager = new InventoryManager(this, clientManager); + + // Reports + SnapshotManager snapshotManager = new SnapshotManager(this, new SnapshotRepository(serverStatusManager.getCurrentServerName(), getLogger())); + new SnapshotPlugin(this, snapshotManager, clientManager); + new ReportPlugin(this, new ReportManager(this, snapshotManager, clientManager, incognito, punish, serverStatusManager.getRegion(), serverStatusManager.getCurrentServerName(), 1)); + + // Tag fix + new CustomTagFix(this, packetHandler); + + // Holograms + HologramManager hologramManager = new HologramManager(this, packetHandler); + + // Menus + new MenuManager(this); + + // Gadgets, used for mounts, lots of managers for something really small + // :( + MountManager mountManager = new MountManager(this, clientManager, donationManager, blockRestore, disguiseManager); + PetManager petManager = new PetManager(this, clientManager, donationManager, inventoryManager, disguiseManager, creature, blockRestore); + ProjectileManager projectileManager = new ProjectileManager(this); + GadgetManager gadgetManager = new GadgetManager(this, clientManager, donationManager, inventoryManager, mountManager, petManager, preferenceManager, disguiseManager, blockRestore, projectileManager, achievementManager, packetHandler, hologramManager, incognito); + ThankManager thankManager = new ThankManager(this, clientManager, donationManager); + BoosterManager boosterManager = new BoosterManager(this, null, clientManager, donationManager, inventoryManager, thankManager); + CosmeticManager cosmeticManager = new CosmeticManager(this, clientManager, donationManager, inventoryManager, gadgetManager, mountManager, petManager, null, boosterManager); + + cosmeticManager.setActive(false); + cosmeticManager.setHideParticles(true); + cosmeticManager.disableTeamArmor(); + gadgetManager.setGadgetEnabled(false); + + // Tutorials + //TextTutorialManager tutorialManager = new TextTutorialManager(this, donationManager, new TaskManager(this, clientManager)); + //tutorialManager.addTutorial(new GemHuntersTutorial()); + + // Now we finally get to enable the Gem Hunters modules + // Though if any other module needs one of these it will be generated in + // order, however they are all here just for good measure. + require(BetaModule.class); + require(BountyModule.class); + require(CashOutModule.class); + require(ChatModule.class); + require(DeathModule.class); + require(EconomyModule.class); + require(InventoryModule.class); + require(LootModule.class); + require(ItemMapModule.class); + require(ModerationModule.class); + require(MountModule.class); + require(PlayerStatusModule.class); + require(QuestModule.class); + require(QuitNPCModule.class); + require(SafezoneModule.class); + require(ScoreboardModule.class); + require(SpawnModule.class); + require(ShopModule.class); + require(SupplyDropModule.class); + require(WorldEventModule.class); + + // An arbitrary collection of world listeners such as block place/break, + // interact events etc... + new WorldListeners(this); + new TimeCycle(this); + new UndergroundMobs(this); + new DebugListeners(this); + + // UpdateEvent!!! + new Updater(this); + + // Disable spigot's item merging + for (World world : getServer().getWorlds()) + { + ((CraftWorld) world).getHandle().spigotConfig.itemMerge = 0; + } + + // Turn off the server's debugging + MinecraftServer.getServer().getPropertyManager().setProperty("debug", false); + SpigotConfig.debug = false; + + // Two-factor auth + require(TwoFactorAuth.class); + + // beta whitelist + //new BetaWhitelist(clientManager, new PowerPlayClubRepository(this, clientManager, donationManager)); + } + + @Override + public void onDisable() + { + getServer().getPluginManager().callEvent(new ServerShutdownEvent(this)); + } + +} diff --git a/Plugins/mineplex-game-gemhunters/src/mineplex/gemhunters/beta/BetaModule.java b/Plugins/mineplex-game-gemhunters/src/mineplex/gemhunters/beta/BetaModule.java new file mode 100644 index 000000000..aa08bb811 --- /dev/null +++ b/Plugins/mineplex-game-gemhunters/src/mineplex/gemhunters/beta/BetaModule.java @@ -0,0 +1,48 @@ +package mineplex.gemhunters.beta; + +import org.bukkit.Bukkit; +import org.bukkit.event.EventHandler; + +import mineplex.core.MiniPlugin; +import mineplex.core.ReflectivelyCreateMiniPlugin; +import mineplex.core.common.util.C; +import mineplex.core.common.util.F; +import mineplex.core.updater.UpdateType; +import mineplex.core.updater.event.UpdateEvent; + +@ReflectivelyCreateMiniPlugin +public class BetaModule extends MiniPlugin +{ + + private static final String[] ANNOUCEMENTS = { + "Please remember this game is an early access BETA and all bugs should be reported at mineplex.com/forums/viewforum/2369449/m/11929946", + "Thank you for playing Gem Hunters!", + "Safezones are marked as green areas on your map!", + "Players that have super valuable items show up on your map!", + "Tell us what you want added next by voting on our features Trello! https://trello.com/b/ia1kjwcx" + }; + + private int _lastIndex; + + private BetaModule() + { + super("Beta"); + } + + @EventHandler + public void annouce(UpdateEvent event) + { + if (event.getType() != UpdateType.MIN_01) + { + return; + } + + Bukkit.broadcastMessage(F.main(C.cRedB + "BETA", C.cYellow + ANNOUCEMENTS[_lastIndex])); + + if (++_lastIndex == ANNOUCEMENTS.length) + { + _lastIndex = 0; + } + } + +} diff --git a/Plugins/mineplex-game-gemhunters/src/mineplex/gemhunters/bounties/Bounty.java b/Plugins/mineplex-game-gemhunters/src/mineplex/gemhunters/bounties/Bounty.java new file mode 100644 index 000000000..6e9069d16 --- /dev/null +++ b/Plugins/mineplex-game-gemhunters/src/mineplex/gemhunters/bounties/Bounty.java @@ -0,0 +1,36 @@ +package mineplex.gemhunters.bounties; + +import java.util.UUID; + +import org.bukkit.entity.Player; + +public class Bounty +{ + + private UUID _target; + private UUID _setter; + private int _amount; + + public Bounty(Player target, Player setter, int amount) + { + _target = target.getUniqueId(); + _setter = setter.getUniqueId(); + _amount = amount; + } + + public UUID getTarget() + { + return _target; + } + + public UUID getSetter() + { + return _setter; + } + + public int getAmount() + { + return _amount; + } + +} diff --git a/Plugins/mineplex-game-gemhunters/src/mineplex/gemhunters/bounties/BountyModule.java b/Plugins/mineplex-game-gemhunters/src/mineplex/gemhunters/bounties/BountyModule.java new file mode 100644 index 000000000..771d58997 --- /dev/null +++ b/Plugins/mineplex-game-gemhunters/src/mineplex/gemhunters/bounties/BountyModule.java @@ -0,0 +1,46 @@ +package mineplex.gemhunters.bounties; + +import java.net.MalformedURLException; +import java.net.URL; + +import org.bukkit.block.BlockFace; +import org.bukkit.event.EventHandler; +import org.bukkit.event.player.PlayerCommandPreprocessEvent; + +import mineplex.core.MiniPlugin; +import mineplex.core.ReflectivelyCreateMiniPlugin; +import mineplex.core.sponsorbranding.BrandingManager; + +@ReflectivelyCreateMiniPlugin +public class BountyModule extends MiniPlugin +{ + + private final BrandingManager _brandingManager; + + private BountyModule() + { + super("Bounty"); + + _brandingManager = require(BrandingManager.class); + } + + //@EventHandler + public void test(PlayerCommandPreprocessEvent event) + { + if (!event.getMessage().startsWith("/want")) + { + return; + } + + try + { + event.setCancelled(true); + _brandingManager.createPost(event.getPlayer().getLocation(), BlockFace.SOUTH, new URL("http://minotar.net/helm/Moppletop.png")); + } + catch (MalformedURLException e) + { + e.printStackTrace(); + } + } + +} diff --git a/Plugins/mineplex-game-gemhunters/src/mineplex/gemhunters/chat/ChatModule.java b/Plugins/mineplex-game-gemhunters/src/mineplex/gemhunters/chat/ChatModule.java new file mode 100644 index 000000000..02e210ff5 --- /dev/null +++ b/Plugins/mineplex-game-gemhunters/src/mineplex/gemhunters/chat/ChatModule.java @@ -0,0 +1,106 @@ +package mineplex.gemhunters.chat; + +import org.bukkit.entity.Player; +import org.bukkit.event.EventHandler; +import org.bukkit.event.EventPriority; +import org.bukkit.event.player.AsyncPlayerChatEvent; +import org.bukkit.event.player.PlayerJoinEvent; +import org.bukkit.event.player.PlayerQuitEvent; + +import mineplex.core.MiniPlugin; +import mineplex.core.ReflectivelyCreateMiniPlugin; +import mineplex.core.account.CoreClientManager; +import mineplex.core.chat.Chat; +import mineplex.core.common.Rank; +import mineplex.core.common.util.C; +import mineplex.core.common.util.F; +import mineplex.core.party.Party; +import mineplex.core.party.PartyManager; + +/** + * This module handles player chat. + */ +@ReflectivelyCreateMiniPlugin +public class ChatModule extends MiniPlugin +{ + + private final CoreClientManager _clientManager; + private final Chat _chat; + private final PartyManager _party; + + private ChatModule() + { + super("Chat"); + + _clientManager = require(CoreClientManager.class); + _chat = require(Chat.class); + _party = require(PartyManager.class); + } + + @EventHandler(priority = EventPriority.LOWEST) + public void playerJoin(PlayerJoinEvent event) + { + event.setJoinMessage(F.sys("Join", event.getPlayer().getName())); + } + + @EventHandler(priority = EventPriority.LOWEST) + public void playerQuit(PlayerQuitEvent event) + { + event.setQuitMessage(F.sys("Quit", event.getPlayer().getName())); + } + + @EventHandler(priority = EventPriority.HIGHEST) + public void chat(AsyncPlayerChatEvent event) + { + // Checks if the player has been muted/chat is silenced etc... + if (event.isCancelled()) + { + return; + } + + Player player = event.getPlayer(); + String playerName = player.getName(); + + Rank rank = _clientManager.Get(player).getRealOrDisguisedRank(); + String rankString = rank == Rank.ALL ? "" : rank.getTag(true, true); + + // Create a message that follows the rest of the network's chat format + String message = (rankString + " " + C.cYellow + playerName + " "); + + // We will handle the broadcast + event.setCancelled(true); + + if (event.getMessage().charAt(0) == '@') + { + Party party = _party.getPartyByPlayer(player); + if (party != null) + { + if (event.getMessage().length() > 1) + { + event.setMessage(event.getMessage().substring(1, event.getMessage().length()).trim()); + message = C.cDPurpleB + "Party " + C.cWhiteB + playerName + " " + C.cPurple; + + event.getRecipients().removeIf(other -> !party.getMembers().contains(other)); + } + else + { + player.sendMessage(F.main("Party", "Where's the message?")); + } + } + } + else + { + message += C.cWhite; + } + + message += _chat.getFilteredMessage(player, event.getMessage()); + + message = message.trim(); + + for (Player other : event.getRecipients()) + { + other.sendMessage(message); + } + } + +} diff --git a/Plugins/mineplex-game-gemhunters/src/mineplex/gemhunters/death/DeathModule.java b/Plugins/mineplex-game-gemhunters/src/mineplex/gemhunters/death/DeathModule.java new file mode 100644 index 000000000..bb1de59d5 --- /dev/null +++ b/Plugins/mineplex-game-gemhunters/src/mineplex/gemhunters/death/DeathModule.java @@ -0,0 +1,248 @@ +package mineplex.gemhunters.death; + +import java.util.HashMap; +import java.util.Iterator; +import java.util.Map; +import java.util.Set; +import java.util.UUID; + +import org.bukkit.Bukkit; +import org.bukkit.GameMode; +import org.bukkit.Material; +import org.bukkit.craftbukkit.v1_8_R3.entity.CraftPlayer; +import org.bukkit.entity.Entity; +import org.bukkit.entity.Player; +import org.bukkit.event.EventHandler; +import org.bukkit.event.EventPriority; +import org.bukkit.event.block.BlockBreakEvent; +import org.bukkit.event.block.BlockPlaceEvent; +import org.bukkit.event.entity.EntityDamageByEntityEvent; +import org.bukkit.event.entity.EntityDamageEvent; +import org.bukkit.event.entity.ItemSpawnEvent; +import org.bukkit.event.entity.PlayerDeathEvent; +import org.bukkit.event.inventory.InventoryClickEvent; +import org.bukkit.event.player.PlayerInteractEvent; +import org.bukkit.event.player.PlayerJoinEvent; +import org.bukkit.event.player.PlayerPickupItemEvent; +import org.bukkit.event.player.PlayerQuitEvent; + +import com.google.common.collect.Sets; + +import mineplex.core.MiniPlugin; +import mineplex.core.ReflectivelyCreateMiniPlugin; +import mineplex.core.common.util.C; +import mineplex.core.common.util.UtilPlayer; +import mineplex.core.common.util.UtilServer; +import mineplex.core.common.util.UtilTextMiddle; +import mineplex.core.common.util.UtilTime; +import mineplex.core.updater.UpdateType; +import mineplex.core.updater.event.UpdateEvent; +import mineplex.gemhunters.death.event.PlayerCustomRespawnEvent; +import mineplex.gemhunters.playerstatus.PlayerStatusModule; +import mineplex.gemhunters.playerstatus.PlayerStatusType; +import mineplex.gemhunters.spawn.SpawnModule; + +/** + * This module handles anything to do with a players death + */ +@ReflectivelyCreateMiniPlugin +public class DeathModule extends MiniPlugin +{ + + // Some items like the cash out item (and for some reason players drop + // bones?) don't need to be dropped to avoid duplication. + private static final Set DISALLOWED_DROPS = Sets.newHashSet(Material.EMERALD, Material.MAP, Material.BONE, Material.STAINED_GLASS_PANE); + private static final int DEATH_ANIMATION_TIME = 7000; + private static final int DEATH_ANIMATION_COUNTDOWN = 2000; + + private final PlayerStatusModule _playerStatus; + private final SpawnModule _spawn; + + private final Map _toRemove; + + private DeathModule() + { + super("Death"); + + _playerStatus = require(PlayerStatusModule.class); + _spawn = require(SpawnModule.class); + + _toRemove = new HashMap<>(); + } + + @EventHandler(priority = EventPriority.MONITOR) + public void join(PlayerJoinEvent event) + { + PlayerCustomRespawnEvent event2 = new PlayerCustomRespawnEvent(event.getPlayer()); + + UtilServer.CallEvent(event2); + } + + @EventHandler + public void death(PlayerDeathEvent event) + { + Player player = event.getEntity(); + + // Stop the player dieing + player.setHealth(20); + player.setFoodLevel(20); + player.setExhaustion(0); + + startAnimation(player); + _toRemove.put(player.getUniqueId(), System.currentTimeMillis()); + } + + @EventHandler + public void itemSpawn(ItemSpawnEvent event) + { + if (DISALLOWED_DROPS.contains(event.getEntity().getItemStack().getType())) + { + event.setCancelled(true); + } + } + + @EventHandler + public void updateAnimations(UpdateEvent event) + { + if (event.getType() != UpdateType.SEC) + { + return; + } + + Iterator iterator = _toRemove.keySet().iterator(); + + while (iterator.hasNext()) + { + UUID key = iterator.next(); + Player player = UtilPlayer.searchExact(key); + + if (player == null) + { + iterator.remove(); + continue; + } + + long start = _toRemove.get(key); + long end = start + DEATH_ANIMATION_TIME + 1000; + + if (UtilTime.elapsed(start, DEATH_ANIMATION_TIME)) + { + stopAnimation(player); + iterator.remove(); + continue; + } + else if (UtilTime.elapsed(start, DEATH_ANIMATION_COUNTDOWN)) + { + UtilTextMiddle.display(C.cRedB + "YOU DIED", String.valueOf((int) (end - System.currentTimeMillis()) / 1000), 0, 20, 0, player); + } + } + } + + public void startAnimation(Player player) + { + UtilTextMiddle.display(C.cRedB + "YOU DIED", "Respawning shortly", 0, 60, 0, player); + ((CraftPlayer) player).getHandle().spectating = true; + player.setAllowFlight(true); + player.setFlying(true); + player.setGameMode(GameMode.CREATIVE); + + for (Player other : Bukkit.getOnlinePlayers()) + { + other.hidePlayer(player); + } + + _playerStatus.setStatus(player, PlayerStatusType.DANGER, true); + } + + public void stopAnimation(Player player) + { + UtilTextMiddle.display(C.cGreenB + "RESPAWNED", "", 0, 20, 20, player); + ((CraftPlayer) player).getHandle().spectating = false; + player.setFlying(false); + player.setAllowFlight(false); + player.setGameMode(GameMode.SURVIVAL); + _spawn.teleportToSpawn(player); + + for (Player other : Bukkit.getOnlinePlayers()) + { + other.showPlayer(player); + } + + PlayerCustomRespawnEvent event = new PlayerCustomRespawnEvent(player); + + UtilServer.CallEvent(event); + } + + @EventHandler + public void interact(PlayerInteractEvent event) + { + if (isRespawning(event.getPlayer())) + { + event.setCancelled(true); + } + } + + @EventHandler + public void itemPickup(PlayerPickupItemEvent event) + { + if (isRespawning(event.getPlayer())) + { + event.setCancelled(true); + } + } + + @EventHandler + public void blockBreak(BlockBreakEvent event) + { + if (isRespawning(event.getPlayer())) + { + event.setCancelled(true); + } + } + + @EventHandler + public void blockPlace(BlockPlaceEvent event) + { + if (isRespawning(event.getPlayer())) + { + event.setCancelled(true); + } + } + + @EventHandler + public void inventory(InventoryClickEvent event) + { + if (isRespawning(event.getWhoClicked())) + { + event.setCancelled(true); + } + } + + @EventHandler + public void entityDamage(EntityDamageEvent event) + { + if (event instanceof EntityDamageByEntityEvent) + { + if (isRespawning(((EntityDamageByEntityEvent) event).getDamager())) + { + event.setCancelled(true); + } + } + + if (isRespawning(event.getEntity())) + { + event.setCancelled(true); + } + } + + @EventHandler + public void playerQuit(PlayerQuitEvent event) + { + _toRemove.remove(event.getPlayer().getUniqueId()); + } + + private boolean isRespawning(Entity player) + { + return _toRemove.containsKey(player.getUniqueId()); + } +} diff --git a/Plugins/mineplex-game-gemhunters/src/mineplex/gemhunters/death/event/PlayerCustomRespawnEvent.java b/Plugins/mineplex-game-gemhunters/src/mineplex/gemhunters/death/event/PlayerCustomRespawnEvent.java new file mode 100644 index 000000000..e588841cf --- /dev/null +++ b/Plugins/mineplex-game-gemhunters/src/mineplex/gemhunters/death/event/PlayerCustomRespawnEvent.java @@ -0,0 +1,27 @@ +package mineplex.gemhunters.death.event; + +import org.bukkit.entity.Player; +import org.bukkit.event.HandlerList; +import org.bukkit.event.player.PlayerEvent; + +public class PlayerCustomRespawnEvent extends PlayerEvent +{ + + private static final HandlerList HANDLERS = new HandlerList(); + + public PlayerCustomRespawnEvent(Player who) + { + super(who); + } + + public HandlerList getHandlers() + { + return HANDLERS; + } + + public static HandlerList getHandlerList() + { + return HANDLERS; + } + +} diff --git a/Plugins/mineplex-game-gemhunters/src/mineplex/gemhunters/death/event/QuitNPCDespawnEvent.java b/Plugins/mineplex-game-gemhunters/src/mineplex/gemhunters/death/event/QuitNPCDespawnEvent.java new file mode 100644 index 000000000..e7e36626e --- /dev/null +++ b/Plugins/mineplex-game-gemhunters/src/mineplex/gemhunters/death/event/QuitNPCDespawnEvent.java @@ -0,0 +1,49 @@ +package mineplex.gemhunters.death.event; + +import org.bukkit.event.Cancellable; +import org.bukkit.event.Event; +import org.bukkit.event.HandlerList; + +import mineplex.gemhunters.death.quitnpc.QuitNPC; + +public class QuitNPCDespawnEvent extends Event implements Cancellable +{ + + private static final HandlerList HANDLERS = new HandlerList(); + + private final QuitNPC _npc; + private boolean _cancel; + + public QuitNPCDespawnEvent(QuitNPC npc) + { + _npc = npc; + } + + public QuitNPC getNpc() + { + return _npc; + } + + public HandlerList getHandlers() + { + return HANDLERS; + } + + public static HandlerList getHandlerList() + { + return HANDLERS; + } + + @Override + public boolean isCancelled() + { + return _cancel; + } + + @Override + public void setCancelled(boolean cancel) + { + _cancel = cancel; + } + +} diff --git a/Plugins/mineplex-game-gemhunters/src/mineplex/gemhunters/death/event/QuitNPCSpawnEvent.java b/Plugins/mineplex-game-gemhunters/src/mineplex/gemhunters/death/event/QuitNPCSpawnEvent.java new file mode 100644 index 000000000..3908e1698 --- /dev/null +++ b/Plugins/mineplex-game-gemhunters/src/mineplex/gemhunters/death/event/QuitNPCSpawnEvent.java @@ -0,0 +1,42 @@ +package mineplex.gemhunters.death.event; + +import org.bukkit.entity.Player; +import org.bukkit.event.Cancellable; +import org.bukkit.event.HandlerList; +import org.bukkit.event.player.PlayerEvent; + +public class QuitNPCSpawnEvent extends PlayerEvent implements Cancellable +{ + + private static final HandlerList HANDLERS = new HandlerList(); + + private boolean _cancel; + + public QuitNPCSpawnEvent(Player who) + { + super(who); + } + + public HandlerList getHandlers() + { + return HANDLERS; + } + + public static HandlerList getHandlerList() + { + return HANDLERS; + } + + @Override + public boolean isCancelled() + { + return _cancel; + } + + @Override + public void setCancelled(boolean cancel) + { + _cancel = cancel; + } + +} diff --git a/Plugins/mineplex-game-gemhunters/src/mineplex/gemhunters/death/quitnpc/QuitNPC.java b/Plugins/mineplex-game-gemhunters/src/mineplex/gemhunters/death/quitnpc/QuitNPC.java new file mode 100644 index 000000000..db22be9be --- /dev/null +++ b/Plugins/mineplex-game-gemhunters/src/mineplex/gemhunters/death/quitnpc/QuitNPC.java @@ -0,0 +1,233 @@ +package mineplex.gemhunters.death.quitnpc; + +import java.util.UUID; + +import org.bukkit.Location; +import org.bukkit.Material; +import org.bukkit.entity.ArmorStand; +import org.bukkit.entity.Player; +import org.bukkit.entity.Skeleton; +import org.bukkit.event.EventHandler; +import org.bukkit.event.Listener; +import org.bukkit.event.entity.EntityCombustEvent; +import org.bukkit.event.entity.EntityDeathEvent; +import org.bukkit.inventory.ItemStack; +import org.bukkit.inventory.PlayerInventory; + +import mineplex.core.Managers; +import mineplex.core.common.util.F; +import mineplex.core.common.util.UtilEnt; +import mineplex.core.common.util.UtilServer; +import mineplex.core.common.util.UtilTime; +import mineplex.core.disguise.DisguiseManager; +import mineplex.core.disguise.disguises.DisguisePlayer; +import mineplex.core.updater.UpdateType; +import mineplex.core.updater.event.UpdateEvent; +import mineplex.core.utils.UtilGameProfile; +import mineplex.gemhunters.death.event.QuitNPCDespawnEvent; +import mineplex.gemhunters.economy.EconomyModule; +import mineplex.gemhunters.loot.InventoryModule; +import mineplex.gemhunters.quest.QuestModule; +import mineplex.gemhunters.quest.QuestPlayerData; + +public class QuitNPC implements Listener +{ + + // Managers + private final QuitNPCModule _npc; + private final DisguiseManager _disguise; + + // Time + private final long _start; + private final long _quitMills; + + // Entity + private final Skeleton _entity; + private final ArmorStand _hologram; + + // Player + private final String _name; + private final UUID _uuid; + private final PlayerInventory _inventory; + + // Unlocked Slots + private final int _slotsUnlocked; + + // Gems + private final int _gems; + + // Quests + private final QuestPlayerData _questPlayerData; + + public QuitNPC(QuitNPCModule npc, Player player, long quitMills) + { + // Managers + _npc = npc; + _disguise = Managers.get(DisguiseManager.class); + + // Time + _start = System.currentTimeMillis(); + _quitMills = quitMills; + + // Entity + _entity = player.getWorld().spawn(player.getLocation(), Skeleton.class); + _entity.setHealth(player.getHealth()); + _entity.setMaxHealth(player.getMaxHealth()); + _entity.getEquipment().setArmorContents(player.getInventory().getArmorContents()); + UtilEnt.vegetate(_entity, true); + + _hologram = player.getWorld().spawn(player.getLocation(), ArmorStand.class); + _hologram.setCustomNameVisible(true); + _hologram.setVisible(false); + _hologram.setSmall(true); + + _entity.setPassenger(_hologram); + + // Disguise + DisguisePlayer disguise = new DisguisePlayer(_entity, UtilGameProfile.getGameProfile(player)); + _disguise.disguise(disguise); + + // Player + _name = player.getName(); + _uuid = player.getUniqueId(); + _inventory = player.getInventory(); + + // Unlocked Slots + _slotsUnlocked = Managers.get(InventoryModule.class).getSlotsUnlocked(player); + + // Gems + _gems = Managers.get(EconomyModule.class).Get(player); + + // Quests + _questPlayerData = Managers.get(QuestModule.class).Get(player); + + UtilServer.RegisterEvents(this); + } + + public void restore(Player player) + { + // Player + player.getInventory().clear(); + player.teleport(_entity.getLocation()); + player.setHealth(_entity.getHealth()); + + // Inventory + int i = 0; + for (ItemStack itemStack : _inventory.getContents()) + { + player.getInventory().setItem(i++, itemStack); + } + + player.getInventory().setArmorContents(_inventory.getArmorContents()); + + // Unlocked Slots + Managers.get(InventoryModule.class).setSlotsUnlocked(player, _slotsUnlocked); + + // Gems + // Subtract GEM_START_COST (100 by default) because EconomyModule adds + // this value on join regardless if they have an NPC. + Managers.get(EconomyModule.class).setStore(player, _gems - EconomyModule.GEM_START_COST); + + // Quests + Managers.require(QuestModule.class).setPlayerData(player, _questPlayerData); + } + + public void despawn() + { + QuitNPCDespawnEvent event = new QuitNPCDespawnEvent(this); + + UtilServer.CallEvent(event); + + if (event.isCancelled()) + { + return; + } + + _disguise.undisguise(_disguise.getActiveDisguise(_entity)); + _entity.remove(); + _hologram.remove(); + + UtilServer.Unregister(this); + } + + public void dropItems() + { + Location location = _entity.getLocation().add(0, 1, 0); + + for (ItemStack itemStack : _inventory.getContents()) + { + if (itemStack == null || itemStack.getType() == Material.AIR) + { + continue; + } + + location.getWorld().dropItemNaturally(location, itemStack); + } + + for (ItemStack itemStack : _inventory.getArmorContents()) + { + if (itemStack == null || itemStack.getType() == Material.AIR) + { + continue; + } + + location.getWorld().dropItemNaturally(location, itemStack); + } + } + + @EventHandler + public void update(UpdateEvent event) + { + if (event.getType() != UpdateType.FASTER) + { + return; + } + + if (UtilTime.elapsed(_start, _quitMills)) + { + despawn(); + } + else + { + _hologram.setCustomName("Quitting in " + UtilTime.MakeStr(_start + _quitMills - System.currentTimeMillis())); + } + } + + @EventHandler + public void entityDeath(EntityDeathEvent event) + { + if (!_entity.equals(event.getEntity())) + { + return; + } + + Player killer = event.getEntity().getKiller(); + + if (killer != null) + { + _npc.setKilledBy(_uuid, killer.getName()); + Managers.get(EconomyModule.class).addToStore(killer, "Killing " + F.name(_name + "'s") + " NPC", (int) (_gems * EconomyModule.GEM_KILL_FACTOR)); + } + + event.getDrops().clear(); + _entity.setHealth(_entity.getMaxHealth()); + dropItems(); + despawn(); + } + + @EventHandler + public void entityCombust(EntityCombustEvent event) + { + if (!_entity.equals(event.getEntity())) + { + return; + } + + event.setCancelled(true); + } + + public UUID getUniqueId() + { + return _uuid; + } +} diff --git a/Plugins/mineplex-game-gemhunters/src/mineplex/gemhunters/death/quitnpc/QuitNPCModule.java b/Plugins/mineplex-game-gemhunters/src/mineplex/gemhunters/death/quitnpc/QuitNPCModule.java new file mode 100644 index 000000000..bd3490372 --- /dev/null +++ b/Plugins/mineplex-game-gemhunters/src/mineplex/gemhunters/death/quitnpc/QuitNPCModule.java @@ -0,0 +1,134 @@ +package mineplex.gemhunters.death.quitnpc; + +import java.util.HashMap; +import java.util.HashSet; +import java.util.Map; +import java.util.Set; +import java.util.UUID; +import java.util.concurrent.TimeUnit; + +import org.bukkit.GameMode; +import org.bukkit.entity.Player; +import org.bukkit.event.EventHandler; +import org.bukkit.event.EventPriority; +import org.bukkit.event.player.PlayerJoinEvent; +import org.bukkit.event.player.PlayerQuitEvent; + +import mineplex.core.MiniPlugin; +import mineplex.core.ReflectivelyCreateMiniPlugin; +import mineplex.core.common.util.F; +import mineplex.core.common.util.UtilServer; +import mineplex.core.texttutorial.TextTutorialManager; +import mineplex.gemhunters.death.event.QuitNPCDespawnEvent; +import mineplex.gemhunters.death.event.QuitNPCSpawnEvent; +import mineplex.gemhunters.economy.event.PlayerCashOutCompleteEvent; + +@ReflectivelyCreateMiniPlugin +public class QuitNPCModule extends MiniPlugin +{ + + private static final long LOG_OUT_TIME = TimeUnit.SECONDS.toMillis(60); + + private final TextTutorialManager _tutorial; + + private final Map _npcs; + private final Map _killedBy; + private final Set _aboutToCashOut; + + private QuitNPCModule() + { + super("Quit NPC"); + + _tutorial = require(TextTutorialManager.class); + + _npcs = new HashMap<>(); + _killedBy = new HashMap<>(); + _aboutToCashOut = new HashSet<>(); + } + + public void spawnNpc(Player player) + { + log("Attempting to spawn quit npc for " + player.getName()); + + if (player.getGameMode() != GameMode.SURVIVAL) + { + log(player.getName() + " was not in survival"); + return; + } + + if (_aboutToCashOut.contains(player.getUniqueId())) + { + log(player.getName() + " was cashing out"); + _aboutToCashOut.remove(player.getUniqueId()); + return; + } + + // Event + QuitNPCSpawnEvent event = new QuitNPCSpawnEvent(player); + + UtilServer.CallEvent(event); + + if (event.isCancelled()) + { + log("Event cancelled for " + player.getName()); + return; + } + + _npcs.put(player.getUniqueId(), new QuitNPC(this, player, LOG_OUT_TIME)); + } + + @EventHandler + public void cashOutComplete(PlayerCashOutCompleteEvent event) + { + UUID key = event.getPlayer().getUniqueId(); + + _aboutToCashOut.add(key); + } + + @EventHandler(priority = EventPriority.LOWEST) + public void playerQuit(PlayerQuitEvent event) + { + Player player = event.getPlayer(); + + if (_tutorial.isInTutorial(player)) + { + return; + } + + spawnNpc(player); + } + + @EventHandler + public void npcDespawn(QuitNPCDespawnEvent event) + { + log("Despawning npc for " + _npcs.remove(event.getNpc().getUniqueId()).getUniqueId()); + } + + @EventHandler + public void playerJoin(PlayerJoinEvent event) + { + Player player = event.getPlayer(); + UUID key = player.getUniqueId(); + + if (_killedBy.containsKey(key)) + { + player.sendMessage(F.main("Game", "You were killed while you were logged out. You were killed by " + F.name(_killedBy.remove(key)) + ".")); + } + } + + public void setKilledBy(UUID dead, String killedBy) + { + _killedBy.put(dead, killedBy); + } + + public QuitNPC getNPC(Player player) + { + return _npcs.get(player.getUniqueId()); + } + + public boolean hasNPC(Player player) + { + return _npcs.containsKey(player.getUniqueId()); + } + +} diff --git a/Plugins/mineplex-game-gemhunters/src/mineplex/gemhunters/economy/CashOutModule.java b/Plugins/mineplex-game-gemhunters/src/mineplex/gemhunters/economy/CashOutModule.java new file mode 100644 index 000000000..6f83a5af5 --- /dev/null +++ b/Plugins/mineplex-game-gemhunters/src/mineplex/gemhunters/economy/CashOutModule.java @@ -0,0 +1,269 @@ +package mineplex.gemhunters.economy; + +import java.text.DecimalFormat; +import java.util.HashMap; +import java.util.Iterator; +import java.util.Map; +import java.util.UUID; + +import org.bukkit.Material; +import org.bukkit.entity.ArmorStand; +import org.bukkit.entity.Player; +import org.bukkit.event.EventHandler; +import org.bukkit.event.EventPriority; +import org.bukkit.event.entity.EntityDamageByEntityEvent; +import org.bukkit.event.entity.EntityDamageEvent; +import org.bukkit.event.entity.ItemSpawnEvent; +import org.bukkit.event.player.PlayerInteractEvent; +import org.bukkit.inventory.ItemStack; + +import mineplex.core.MiniPlugin; +import mineplex.core.ReflectivelyCreateMiniPlugin; +import mineplex.core.common.currency.GlobalCurrency; +import mineplex.core.common.util.C; +import mineplex.core.common.util.F; +import mineplex.core.common.util.UtilEvent; +import mineplex.core.common.util.UtilEvent.ActionType; +import mineplex.core.common.util.UtilPlayer; +import mineplex.core.common.util.UtilServer; +import mineplex.core.common.util.UtilTextMiddle; +import mineplex.core.donation.DonationManager; +import mineplex.core.itemstack.ItemBuilder; +import mineplex.core.portal.GenericServer; +import mineplex.core.portal.Intent; +import mineplex.core.portal.Portal; +import mineplex.core.recharge.Recharge; +import mineplex.core.updater.UpdateType; +import mineplex.core.updater.event.UpdateEvent; +import mineplex.gemhunters.economy.command.CashOutItemCommand; +import mineplex.gemhunters.economy.event.PlayerCashOutCompleteEvent; +import mineplex.gemhunters.spawn.event.PlayerTeleportIntoMapEvent; + +@ReflectivelyCreateMiniPlugin +public class CashOutModule extends MiniPlugin +{ + + private static final DecimalFormat ARMOUR_STAND_FORMAT = new DecimalFormat("0.0"); + public static final ItemStack CASH_OUT_ITEM = new ItemBuilder(Material.EMERALD).setTitle(C.cGreen + "Cash Out").addLore("", C.cGray + "Click to begin the process to cash out.", C.cGray + "Cashing out gives you your gems, shards, ", C.cGray + "chests and any particles you have.", C.cGray + "However you will lose all your current loot!").build(); + + private static final int CASH_OUT_SECONDS = 10; + private static final int CASH_OUT_COOLDOWN = 10000; + private static final int CASH_OUT_MAX_MOVE_DISTANCE_SQUARED = 4; + + private final DonationManager _donation; + + private final Map _sessions; + + public CashOutModule() + { + super("Cash Out"); + + _donation = require(DonationManager.class); + + _sessions = new HashMap<>(); + } + + @Override + public void addCommands() + { + addCommand(new CashOutItemCommand(this)); + } + + @EventHandler + public void teleportIn(PlayerTeleportIntoMapEvent event) + { + if (event.isCancelled()) + { + return; + } + + event.getPlayer().getInventory().setItem(7, CASH_OUT_ITEM); + } + + @EventHandler + public void playerInteract(PlayerInteractEvent event) + { + if (!UtilEvent.isAction(event, ActionType.R)) + { + return; + } + + Player player = event.getPlayer(); + ItemStack itemStack = player.getItemInHand(); + + if (itemStack == null) + { + return; + } + + if (!itemStack.isSimilar(CASH_OUT_ITEM)) + { + return; + } + + attemptCashOut(player); + } + + @EventHandler + public void itemSpawn(ItemSpawnEvent event) + { + if (event.getEntity().getItemStack().isSimilar(CASH_OUT_ITEM)) + { + event.setCancelled(true); + } + } + + @EventHandler + public void update(UpdateEvent event) + { + if (event.getType() != UpdateType.TICK) + { + return; + } + + Iterator iterator = _sessions.keySet().iterator(); + + while (iterator.hasNext()) + { + UUID key = iterator.next(); + Player player = UtilPlayer.searchExact(key); + CashOutSession session = _sessions.get(key); + double current = session.getCurrent(); + ArmorStand stand = session.getArmourStand(); + String standName = ARMOUR_STAND_FORMAT.format(current); + + if (player == null) + { + session.endSession(); + iterator.remove(); + continue; + } + + UtilTextMiddle.display(C.cGreen + standName, UtilTextMiddle.progress((float) (1 - current / session.getMax())), 0, 10, 0, player); + stand.setCustomName(standName + " seconds"); + session.setCurrent(current - 0.05); + + if (session.getCurrent() <= 0) + { + PlayerCashOutCompleteEvent completeEvent = new PlayerCashOutCompleteEvent(player); + + UtilServer.CallEvent(completeEvent); + + _donation.rewardCurrencyUntilSuccess(GlobalCurrency.GEM, player, "Earned", completeEvent.getGems()); + + session.endSession(); + iterator.remove(); + Portal.getInstance().sendPlayerToGenericServer(player, GenericServer.BETA_HUB, Intent.FORCE_TRANSFER); + } + } + } + + @EventHandler + public void updateMove(UpdateEvent event) + { + if (event.getType() != UpdateType.FAST) + { + return; + } + + for (UUID key : _sessions.keySet()) + { + Player player = UtilPlayer.searchExact(key); + CashOutSession session = _sessions.get(key); + + if (session.getLocation().distanceSquared(player.getLocation()) > CASH_OUT_MAX_MOVE_DISTANCE_SQUARED) + { + cancelCashOut(player, "You moved!"); + } + } + } + + @EventHandler(priority = EventPriority.MONITOR) + public void entityDamage(EntityDamageEvent event) + { + if (event.isCancelled()) + { + return; + } + + if (!(event.getEntity() instanceof Player)) + { + return; + } + + Player player = (Player) event.getEntity(); + + if (isCashingOut(player)) + { + cancelCashOut(player, "You took damage!"); + } + } + + @EventHandler(priority = EventPriority.MONITOR) + public void entityAttack(EntityDamageByEntityEvent event) + { + if (event.isCancelled()) + { + return; + } + + if (!(event.getDamager() instanceof Player) || event.getEntity() instanceof ArmorStand) + { + return; + } + + Player player = (Player) event.getDamager(); + + if (isCashingOut(player)) + { + cancelCashOut(player, "You attacked a player!"); + } + } + + public void attemptCashOut(Player player) + { + UUID key = player.getUniqueId(); + + if (_sessions.containsKey(key)) + { + player.sendMessage(F.main("Game", "You are already cashing out.")); + return; + } + + if (!Recharge.Instance.use(player, "Cash Out", CASH_OUT_COOLDOWN, true, false)) + { + return; + } + + _sessions.put(key, new CashOutSession(player, CASH_OUT_SECONDS)); + } + + public void cancelCashOut(Player player, String message) + { + UUID key = player.getUniqueId(); + CashOutSession session = _sessions.get(key); + + player.sendMessage(F.main("Game", message + " Your cash out has been cancelled.")); + session.endSession(); + _sessions.remove(key); + } + + public boolean isCashingOut(Player player) + { + return getCashOutSession(player) != null; + } + + public CashOutSession getCashOutSession(Player player) + { + for (UUID key : _sessions.keySet()) + { + if (key.equals(player.getUniqueId())) + { + return _sessions.get(key); + } + } + + return null; + } + +} diff --git a/Plugins/mineplex-game-gemhunters/src/mineplex/gemhunters/economy/CashOutSession.java b/Plugins/mineplex-game-gemhunters/src/mineplex/gemhunters/economy/CashOutSession.java new file mode 100644 index 000000000..b996183bf --- /dev/null +++ b/Plugins/mineplex-game-gemhunters/src/mineplex/gemhunters/economy/CashOutSession.java @@ -0,0 +1,58 @@ +package mineplex.gemhunters.economy; + +import org.bukkit.Location; +import org.bukkit.entity.ArmorStand; +import org.bukkit.entity.Player; + +public class CashOutSession +{ + + private double _current; + private double _max; + private ArmorStand _stand; + private Location _location; + + public CashOutSession(Player player, double max) + { + _current = max; + _max = max; + _stand = player.getWorld().spawn(player.getLocation().add(0, 0.5, 0), ArmorStand.class); + + _stand.setCustomNameVisible(true); + _stand.setVisible(false); + _stand.setGravity(false); + + _location = player.getLocation(); + } + + public void endSession() + { + _stand.remove(); + } + + public void setCurrent(double current) + { + _current = current; + } + + public double getCurrent() + { + return _current; + } + + public double getMax() + { + return _max; + } + + public ArmorStand getArmourStand() + { + return _stand; + } + + public Location getLocation() + { + return _location; + } + +} diff --git a/Plugins/mineplex-game-gemhunters/src/mineplex/gemhunters/economy/EconomyModule.java b/Plugins/mineplex-game-gemhunters/src/mineplex/gemhunters/economy/EconomyModule.java new file mode 100644 index 000000000..db11cf43f --- /dev/null +++ b/Plugins/mineplex-game-gemhunters/src/mineplex/gemhunters/economy/EconomyModule.java @@ -0,0 +1,129 @@ +package mineplex.gemhunters.economy; + +import java.util.UUID; + +import org.bukkit.entity.Entity; +import org.bukkit.entity.Player; +import org.bukkit.event.EventHandler; +import org.bukkit.event.entity.PlayerDeathEvent; + +import mineplex.core.MiniClientPlugin; +import mineplex.core.ReflectivelyCreateMiniPlugin; +import mineplex.core.common.currency.GlobalCurrency; +import mineplex.core.common.util.F; +import mineplex.core.common.util.UtilServer; +import mineplex.core.donation.DonationManager; +import mineplex.core.donation.Donor; +import mineplex.gemhunters.death.event.PlayerCustomRespawnEvent; +import mineplex.gemhunters.economy.command.GiveGemsCommand; +import mineplex.gemhunters.economy.event.PlayerCashOutCompleteEvent; +import mineplex.gemhunters.economy.event.PlayerEarnGemsEvent; +import mineplex.gemhunters.spawn.event.PlayerTeleportIntoMapEvent; + +@ReflectivelyCreateMiniPlugin +public class EconomyModule extends MiniClientPlugin +{ + + public static final float GEM_KILL_FACTOR = 0.5F; + public static final int GEM_START_COST = 100; + + private final DonationManager _donation; + + public EconomyModule() + { + super("Economy"); + + _donation = require(DonationManager.class); + } + + @Override + public void addCommands() + { + addCommand(new GiveGemsCommand(this)); + } + + @EventHandler + public void respawn(PlayerCustomRespawnEvent event) + { + addToStore(event.getPlayer(), null, GEM_START_COST); + } + + @EventHandler + public void teleportIn(PlayerTeleportIntoMapEvent event) + { + Player player = event.getPlayer(); + Donor donor = _donation.Get(event.getPlayer()); + + if (donor.getBalance(GlobalCurrency.GEM) >= GEM_START_COST) + { + _donation.purchaseUnknownSalesPackage(player, "Gem Hunters Access", GlobalCurrency.GEM, GEM_START_COST, false, null); + } + } + + @EventHandler + public void death(PlayerDeathEvent event) + { + Player player = event.getEntity(); + Entity killer = event.getEntity().getKiller(); + + int oldGems = getGems(player); + + if (killer instanceof Player) + { + Player killerPlayer = (Player) killer; + int newGems = (int) (oldGems * GEM_KILL_FACTOR); + + addToStore(killerPlayer, "Killing " + F.name(player.getName()), newGems); + } + + removeFromStore(player, oldGems); + } + + @EventHandler + public void cashOut(PlayerCashOutCompleteEvent event) + { + event.incrementGems(getGems(event.getPlayer())); + } + + public void addToStore(Player player, String reason, int gems) + { + PlayerEarnGemsEvent event = new PlayerEarnGemsEvent(player, gems, reason); + UtilServer.CallEvent(event); + + if (event.isCancelled() || event.getGems() == 0) + { + return; + } + + gems = event.getGems(); + reason = event.getReason(); + + Set(player, Get(player) + gems); + + if (reason != null) + { + player.sendMessage(F.main(_moduleName, "+" + F.currency(GlobalCurrency.GEM, gems) + " (" + reason + ").")); + } + } + + public void removeFromStore(Player player, int gems) + { + addToStore(player, null, -gems); + } + + public void setStore(Player player, int gems) + { + Set(player, gems); + } + + public int getGems(Player player) + { + return Get(player); + } + + @Override + protected Integer addPlayer(UUID uuid) + { + return 0; + } +} diff --git a/Plugins/mineplex-game-gemhunters/src/mineplex/gemhunters/economy/command/CashOutItemCommand.java b/Plugins/mineplex-game-gemhunters/src/mineplex/gemhunters/economy/command/CashOutItemCommand.java new file mode 100644 index 000000000..8479a5088 --- /dev/null +++ b/Plugins/mineplex-game-gemhunters/src/mineplex/gemhunters/economy/command/CashOutItemCommand.java @@ -0,0 +1,30 @@ +package mineplex.gemhunters.economy.command; + +import org.bukkit.entity.Player; + +import mineplex.core.command.CommandBase; +import mineplex.core.common.Rank; +import mineplex.core.common.util.F; +import mineplex.gemhunters.economy.CashOutModule; + +public class CashOutItemCommand extends CommandBase +{ + + public CashOutItemCommand(CashOutModule plugin) + { + super(plugin, Rank.ALL, "cashout", "ct", "cashitem", "cashoutitem"); + } + + @Override + public void Execute(Player caller, String[] args) + { + if (caller.getInventory().contains(CashOutModule.CASH_OUT_ITEM)) + { + return; + } + + caller.sendMessage(F.main(Plugin.getName(), "Giving you a new cash out item.")); + caller.getInventory().addItem(CashOutModule.CASH_OUT_ITEM); + } + +} diff --git a/Plugins/mineplex-game-gemhunters/src/mineplex/gemhunters/economy/command/GiveGemsCommand.java b/Plugins/mineplex-game-gemhunters/src/mineplex/gemhunters/economy/command/GiveGemsCommand.java new file mode 100644 index 000000000..c658546d2 --- /dev/null +++ b/Plugins/mineplex-game-gemhunters/src/mineplex/gemhunters/economy/command/GiveGemsCommand.java @@ -0,0 +1,47 @@ +package mineplex.gemhunters.economy.command; + +import org.bukkit.entity.Player; + +import mineplex.core.command.CommandBase; +import mineplex.core.common.Rank; +import mineplex.core.common.util.F; +import mineplex.core.common.util.UtilPlayer; +import mineplex.gemhunters.economy.EconomyModule; + +public class GiveGemsCommand extends CommandBase +{ + + public GiveGemsCommand(EconomyModule plugin) + { + super(plugin, Rank.ADMIN, "givegems"); + } + + @Override + public void Execute(Player caller, String[] args) + { + if (args.length < 2) + { + caller.sendMessage(F.help("/" + _aliasUsed + " ", "Adds an amount of gems to a player's gems earned.", Rank.ADMIN)); + return; + } + + Player target = UtilPlayer.searchOnline(caller, args[0], true); + + if (target == null) + { + return; + } + + try + { + int amount = Integer.parseInt(args[1]); + + Plugin.addToStore(target, "Given by " + F.name(caller.getName()), amount); + } + catch (NumberFormatException e) + { + caller.sendMessage(F.main(Plugin.getName(), "That is not a number.")); + } + } + +} diff --git a/Plugins/mineplex-game-gemhunters/src/mineplex/gemhunters/economy/event/PlayerCashOutCompleteEvent.java b/Plugins/mineplex-game-gemhunters/src/mineplex/gemhunters/economy/event/PlayerCashOutCompleteEvent.java new file mode 100644 index 000000000..164629447 --- /dev/null +++ b/Plugins/mineplex-game-gemhunters/src/mineplex/gemhunters/economy/event/PlayerCashOutCompleteEvent.java @@ -0,0 +1,44 @@ +package mineplex.gemhunters.economy.event; + +import org.bukkit.entity.Player; +import org.bukkit.event.HandlerList; +import org.bukkit.event.player.PlayerEvent; + +public class PlayerCashOutCompleteEvent extends PlayerEvent +{ + + private static final HandlerList HANDLERS = new HandlerList(); + + private int _gems; + + public PlayerCashOutCompleteEvent(Player player) + { + super(player); + } + + public void incrementGems(int gems) + { + _gems += gems; + } + + public void setGems(int gems) + { + _gems = gems; + } + + public int getGems() + { + return _gems; + } + + public HandlerList getHandlers() + { + return HANDLERS; + } + + public static HandlerList getHandlerList() + { + return HANDLERS; + } + +} diff --git a/Plugins/mineplex-game-gemhunters/src/mineplex/gemhunters/economy/event/PlayerEarnGemsEvent.java b/Plugins/mineplex-game-gemhunters/src/mineplex/gemhunters/economy/event/PlayerEarnGemsEvent.java new file mode 100644 index 000000000..ae73ce697 --- /dev/null +++ b/Plugins/mineplex-game-gemhunters/src/mineplex/gemhunters/economy/event/PlayerEarnGemsEvent.java @@ -0,0 +1,72 @@ +package mineplex.gemhunters.economy.event; + +import org.bukkit.entity.Player; +import org.bukkit.event.Cancellable; +import org.bukkit.event.HandlerList; +import org.bukkit.event.player.PlayerEvent; + +public class PlayerEarnGemsEvent extends PlayerEvent implements Cancellable +{ + + private static final HandlerList HANDLERS = new HandlerList(); + + private int _gems; + private String _reason; + private boolean _cancel; + + public PlayerEarnGemsEvent(Player player, int gems, String reason) + { + super(player); + + _gems = gems; + _reason = reason; + } + + public void incrementGems(int gems) + { + _gems += gems; + } + + public void setGems(int gems) + { + _gems = gems; + } + + public int getGems() + { + return _gems; + } + + public void setReason(String reason) + { + _reason = reason; + } + + public String getReason() + { + return _reason; + } + + public HandlerList getHandlers() + { + return HANDLERS; + } + + public static HandlerList getHandlerList() + { + return HANDLERS; + } + + @Override + public boolean isCancelled() + { + return _cancel; + } + + @Override + public void setCancelled(boolean cancel) + { + _cancel = cancel; + } + +} diff --git a/Plugins/mineplex-game-gemhunters/src/mineplex/gemhunters/loot/ChestProperties.java b/Plugins/mineplex-game-gemhunters/src/mineplex/gemhunters/loot/ChestProperties.java new file mode 100644 index 000000000..fe2ff3aa2 --- /dev/null +++ b/Plugins/mineplex-game-gemhunters/src/mineplex/gemhunters/loot/ChestProperties.java @@ -0,0 +1,107 @@ +package mineplex.gemhunters.loot; + +import java.util.HashMap; +import java.util.Map; + +import org.bukkit.Material; + +public class ChestProperties +{ + + private final String _name; + private final Material _blockMaterial; + private final String _dataKey; + private final int _minAmount; + private final int _maxAmount; + private final int _maxChestPerLoc; + private final int _spawnRate; + private final int _expireRate; + private final int _spawnRadius; + private final int _maxActive; + + private final Map _spawnedIndexes; + private long _lastSpawn; + + public ChestProperties(String name, Material blockMaterial, String dataKey, int minAmount, int maxAmount, int maxChestPerLoc, int spawnRate, int expireRate, int spawnRadius, int maxActive) + { + _name = name; + _blockMaterial = blockMaterial; + _dataKey = dataKey; + _minAmount = minAmount; + _maxAmount = maxAmount; + _maxChestPerLoc = maxChestPerLoc; + _spawnRate = spawnRate; + _expireRate = expireRate; + _spawnRadius = spawnRadius; + _maxActive = maxActive; + + _spawnedIndexes = new HashMap<>(); + setLastSpawn(); + } + + public final String getName() + { + return _name; + } + + public final Material getBlockMaterial() + { + return _blockMaterial; + } + + public final String getDataKey() + { + return _dataKey; + } + + public final int getMinAmount() + { + return _minAmount; + } + + public final int getMaxAmount() + { + return _maxAmount; + } + + public final int getMaxChestPerLocation() + { + return _maxChestPerLoc; + } + + public final int getSpawnRate() + { + return _spawnRate; + } + + public final int getExpireRate() + { + return _expireRate; + } + + public final int getSpawnRadius() + { + return _spawnRadius; + } + + public final int getMaxActive() + { + return _maxActive; + } + + public final Map getSpawnIndexes() + { + return _spawnedIndexes; + } + + public void setLastSpawn() + { + _lastSpawn = System.currentTimeMillis(); + } + + public long getLastSpawn() + { + return _lastSpawn; + } + +} diff --git a/Plugins/mineplex-game-gemhunters/src/mineplex/gemhunters/loot/InventoryModule.java b/Plugins/mineplex-game-gemhunters/src/mineplex/gemhunters/loot/InventoryModule.java new file mode 100644 index 000000000..a3d34e623 --- /dev/null +++ b/Plugins/mineplex-game-gemhunters/src/mineplex/gemhunters/loot/InventoryModule.java @@ -0,0 +1,139 @@ +package mineplex.gemhunters.loot; + +import java.util.HashMap; +import java.util.Map; +import java.util.UUID; + +import org.bukkit.Material; +import org.bukkit.Sound; +import org.bukkit.entity.Player; +import org.bukkit.event.EventHandler; +import org.bukkit.event.inventory.InventoryClickEvent; +import org.bukkit.event.player.PlayerInteractEvent; +import org.bukkit.event.player.PlayerQuitEvent; +import org.bukkit.inventory.Inventory; +import org.bukkit.inventory.ItemStack; + +import mineplex.core.MiniPlugin; +import mineplex.core.ReflectivelyCreateMiniPlugin; +import mineplex.core.common.util.C; +import mineplex.core.common.util.F; +import mineplex.core.common.util.UtilEvent; +import mineplex.core.common.util.UtilEvent.ActionType; +import mineplex.core.common.util.UtilInv; +import mineplex.core.itemstack.ItemBuilder; +import mineplex.gemhunters.death.event.PlayerCustomRespawnEvent; + +@ReflectivelyCreateMiniPlugin +public class InventoryModule extends MiniPlugin +{ + + public static final ItemStack LOCKED = new ItemBuilder(Material.STAINED_GLASS_PANE, (byte) 15).setTitle(C.cGray + "Locked").build(); + private static final int START_INDEX = 9; + private static final String ITEM_METADATA = "UNLOCKER"; + + private final LootModule _loot; + + private final Map _slotsUnlocked; + + private InventoryModule() + { + super("Unlocker"); + + _loot = require(LootModule.class); + + _slotsUnlocked = new HashMap<>(); + } + + @EventHandler + public void respawn(PlayerCustomRespawnEvent event) + { + Player player = event.getPlayer(); + Inventory inv = player.getInventory(); + + _slotsUnlocked.put(player.getUniqueId(), 0); + + for (int i = START_INDEX; i < inv.getSize(); i++) + { + inv.setItem(i, LOCKED); + } + } + + @EventHandler + public void quit(PlayerQuitEvent event) + { + _slotsUnlocked.remove(event.getPlayer().getUniqueId()); + } + + @EventHandler + public void inventoryClick(InventoryClickEvent event) + { + Player player = (Player) event.getWhoClicked(); + + if (event.getClickedInventory() == null || event.getCurrentItem() == null) + { + return; + } + + if (event.getCurrentItem().isSimilar(LOCKED)) + { + event.setCancelled(true); + player.playSound(player.getLocation(), Sound.ITEM_BREAK, 1, 0.6F); + } + } + + @EventHandler + public void interact(PlayerInteractEvent event) + { + if (!UtilEvent.isAction(event, ActionType.R)) + { + return; + } + + Player player = event.getPlayer(); + ItemStack itemStack = player.getItemInHand(); + + if (itemStack == null) + { + return; + } + + LootItem lootItem = _loot.fromItemStack(itemStack); + + if (lootItem == null || lootItem.getMetadata() == null || !lootItem.getMetadata().equals(ITEM_METADATA)) + { + return; + } + + player.setItemInHand(UtilInv.decrement(itemStack)); + unlockSlots(player, itemStack.getType() == Material.CHEST ? 9 : 18); + } + + public void unlockSlots(Player player, int slots) + { + Inventory inv = player.getInventory(); + UUID key = player.getUniqueId(); + + int start = START_INDEX + _slotsUnlocked.get(key); + int end = Math.min(inv.getSize(), start + slots); + int delta = end - start; + + for (int i = start; i < end; i++) + { + inv.setItem(i, null); + } + + player.sendMessage(F.main(_moduleName, "You unlocked an additional " + F.count(String.valueOf(delta)) + " slots of your inventory!")); + _slotsUnlocked.put(key, _slotsUnlocked.get(key) + slots); + } + + public void setSlotsUnlocked(Player player, int amount) + { + _slotsUnlocked.put(player.getUniqueId(), amount); + } + + public int getSlotsUnlocked(Player player) + { + return _slotsUnlocked.get(player.getUniqueId()); + } +} diff --git a/Plugins/mineplex-game-gemhunters/src/mineplex/gemhunters/loot/LootItem.java b/Plugins/mineplex-game-gemhunters/src/mineplex/gemhunters/loot/LootItem.java new file mode 100644 index 000000000..74420cb75 --- /dev/null +++ b/Plugins/mineplex-game-gemhunters/src/mineplex/gemhunters/loot/LootItem.java @@ -0,0 +1,90 @@ +package mineplex.gemhunters.loot; + +import org.bukkit.inventory.ItemStack; + +import mineplex.core.common.util.UtilMath; + +/** + * Represents an item that can be contained in a chest inside the Gem Hunters + * world. + */ +public class LootItem +{ + + private final ItemStack _itemStack; + private final int _minAmount; + private final int _maxAmount; + private final double _probability; + private final String _metadata; + + public LootItem(ItemStack itemStack, int minAmount, int maxAmount, double probability, String metadata) + { + _itemStack = itemStack; + _minAmount = minAmount; + _maxAmount = maxAmount; + _probability = probability; + _metadata = metadata; + } + + /** + * Returns the Minecraft {@link ItemStack} bound to this + * {@link LootItem}.
+ * The {@link ItemStack} returned will have an amount/size between the + * minAmount and maxAmount integers (set within the constuctor's parameters) + * inclusively. + * + * @return + */ + public ItemStack getItemStack() + { + _itemStack.setAmount(_minAmount + UtilMath.r(_maxAmount - _minAmount + 1)); + + return _itemStack; + } + + /** + * The minimum amount or size an {@link ItemStack} of this {@link LootItem} + * can have. + * + * @return + */ + public int getMinAmount() + { + return _minAmount; + } + + /** + * The maximum amount or size an {@link ItemStack} of this {@link LootItem} + * can have. + * + * @return + */ + public int getMaxAmount() + { + return _maxAmount; + } + + /** + * The double value of the item's probability of being chosen to when + * picking an individual chest's loot. + * + * @return + */ + public double getProbability() + { + return _probability; + } + + /** + * Any metadata bound to a {@link LootItem}. Useful for determining if an + * item has a particular skill or ability attached to it which + * you can use in code. + * + * @return + */ + public String getMetadata() + { + return _metadata; + } + +} diff --git a/Plugins/mineplex-game-gemhunters/src/mineplex/gemhunters/loot/LootModule.java b/Plugins/mineplex-game-gemhunters/src/mineplex/gemhunters/loot/LootModule.java new file mode 100644 index 000000000..bf41c3a9e --- /dev/null +++ b/Plugins/mineplex-game-gemhunters/src/mineplex/gemhunters/loot/LootModule.java @@ -0,0 +1,672 @@ +package mineplex.gemhunters.loot; + +import java.util.HashMap; +import java.util.HashSet; +import java.util.Iterator; +import java.util.List; +import java.util.Map; +import java.util.Set; +import java.util.UUID; +import java.util.concurrent.TimeUnit; + +import org.bukkit.Bukkit; +import org.bukkit.Effect; +import org.bukkit.Location; +import org.bukkit.Material; +import org.bukkit.block.Block; +import org.bukkit.block.BlockFace; +import org.bukkit.block.BlockState; +import org.bukkit.block.Chest; +import org.bukkit.entity.Player; +import org.bukkit.event.EventHandler; +import org.bukkit.event.inventory.InventoryClickEvent; +import org.bukkit.event.player.PlayerInteractEvent; +import org.bukkit.event.player.PlayerPickupItemEvent; +import org.bukkit.inventory.Inventory; +import org.bukkit.inventory.ItemStack; + +import mineplex.core.MiniPlugin; +import mineplex.core.ReflectivelyCreateMiniPlugin; +import mineplex.core.common.util.UtilAlg; +import mineplex.core.common.util.UtilBlock; +import mineplex.core.common.util.UtilEvent; +import mineplex.core.common.util.UtilEvent.ActionType; +import mineplex.core.common.util.UtilInv; +import mineplex.core.common.util.UtilMath; +import mineplex.core.common.util.UtilServer; +import mineplex.core.common.util.UtilTime; +import mineplex.core.google.GoogleSheetsManager; +import mineplex.core.updater.UpdateType; +import mineplex.core.updater.event.UpdateEvent; +import mineplex.gemhunters.economy.EconomyModule; +import mineplex.gemhunters.economy.event.PlayerCashOutCompleteEvent; +import mineplex.gemhunters.loot.command.SpawnChestCommand; +import mineplex.gemhunters.loot.command.UpdateLootCommand; +import mineplex.gemhunters.loot.deserialisers.ChestPropertiesDeserialiser; +import mineplex.gemhunters.loot.deserialisers.LootItemDeserialiser; +import mineplex.gemhunters.loot.event.PlayerChestOpenEvent; +import mineplex.gemhunters.loot.rewards.LootChestReward; +import mineplex.gemhunters.loot.rewards.LootGadgetReward; +import mineplex.gemhunters.loot.rewards.LootItemReward; +import mineplex.gemhunters.loot.rewards.LootRankReward; +import mineplex.gemhunters.loot.rewards.LootShardReward; +import mineplex.gemhunters.safezone.SafezoneModule; +import mineplex.gemhunters.spawn.event.PlayerTeleportIntoMapEvent; +import mineplex.gemhunters.util.SlackSheetsBot; +import mineplex.gemhunters.world.WorldDataModule; + +@ReflectivelyCreateMiniPlugin +public class LootModule extends MiniPlugin +{ + + private static final String SHEET_FILE_NAME = "GEM_HUNTERS_CHESTS"; + private static final String CHEST_MASTER_SHEET_NAME = "CHEST_MASTER"; + private static final long CHEST_DESPAWN_TIME_OPENED = TimeUnit.SECONDS.toMillis(15); + private static final float CHESTS_ON_START_FACTOR = 0.333F; + private static final int MAX_SEARCH_ATTEMPTS = 40; + private static final int MAX_CHEST_CHECK_DISTANCE_SQUARED = 4; + private static final LootItemDeserialiser DESERIALISER = new LootItemDeserialiser(); + private static final ChestPropertiesDeserialiser CHEST_DESERIALISER = new ChestPropertiesDeserialiser(); + private static final ItemStack[] SPAWN_ITEMS = { + new ItemStack(Material.WOOD_SWORD), + new ItemStack(Material.APPLE, 3), + }; + private static final String GEM_METADATA = "GEM"; + + private final EconomyModule _economy; + private final GoogleSheetsManager _sheets; + private final SafezoneModule _safezone; + private final WorldDataModule _worldData; + + private final Map> _chestLoot; + private final Map _chestProperties; + private final Set _spawnedChest; + private final Set _itemRewards; + private final Set _shownPlayers; + + private LootModule() + { + super("Loot"); + + _economy = require(EconomyModule.class); + _sheets = require(GoogleSheetsManager.class); + _safezone = require(SafezoneModule.class); + _worldData = require(WorldDataModule.class); + _chestLoot = new HashMap<>(); + _chestProperties = new HashMap<>(); + _spawnedChest = new HashSet<>(); + _itemRewards = new HashSet<>(); + _shownPlayers = new HashSet<>(); + + runSyncLater(() -> { + + updateChestLoot(); + + // Spawn some chests + for (String key : _chestProperties.keySet()) + { + int max = _chestProperties.get(key).getMaxActive(); + + for (int i = 0; i < max * CHESTS_ON_START_FACTOR; i++) + { + addSpawnedChest(key, true); + } + } + + }, 20); + } + + @Override + public void addCommands() + { + addCommand(new UpdateLootCommand(this)); + addCommand(new SpawnChestCommand(this)); + } + + @EventHandler + public void updateSpawnChests(UpdateEvent event) + { + if (event.getType() != UpdateType.SEC) + { + return; + } + + // Despawn opened chests + Iterator iterator = _spawnedChest.iterator(); + + while (iterator.hasNext()) + { + SpawnedChest chest = iterator.next(); + ChestProperties properties = chest.getProperties(); + + if (chest.isOpened() && UtilTime.elapsed(chest.getOpenedAt(), CHEST_DESPAWN_TIME_OPENED) || UtilTime.elapsed(chest.getSpawnedAt(), properties.getExpireRate())) + { + if (chest.getID() != -1) + { + properties.getSpawnIndexes().put(chest.getID(), properties.getSpawnIndexes().get(chest.getID()) - 1); + } + + Block block = chest.getLocation().getBlock(); + + if (block.getState() instanceof Chest) + { + ((Chest) block.getState()).getBlockInventory().clear(); + } + + block.getWorld().playEffect(chest.getLocation(), Effect.STEP_SOUND, block.getType()); + block.setType(Material.AIR); + iterator.remove(); + } + } + + // Spawn new chests + for (String key : _chestProperties.keySet()) + { + addSpawnedChest(key, false); + } + } + + public boolean isSuitable(Block block) + { + Block up = block.getRelative(BlockFace.UP); + Block down = block.getRelative(BlockFace.DOWN); + + if (block.getType() != Material.AIR || up.getType() != Material.AIR || down.getType() == Material.AIR || UtilBlock.liquid(down) || UtilBlock.liquid(up) || UtilBlock.liquid(block) || _safezone.isInSafeZone(block.getLocation())) + { + return false; + } + + return true; + } + + public void updateChestLoot() + { + log("Updating chest loot"); + Map>> map = _sheets.getSheetData(SHEET_FILE_NAME); + + for (String key : map.keySet()) + { + if (key.equals(CHEST_MASTER_SHEET_NAME)) + { + int row = 0; + + for (List rows : map.get(key)) + { + row++; + try + { + ChestProperties properties = CHEST_DESERIALISER.deserialise(rows.toArray(new String[0])); + _chestProperties.put(properties.getDataKey(), properties); + } + catch (Exception e) + { + if (row != 1) + { + SlackSheetsBot.reportParsingError(e, "Chest Loot", key, row); + } + + continue; + } + } + + continue; + } + + Set items = new HashSet<>(); + int row = 0; + + for (List rows : map.get(key)) + { + row++; + try + { + items.add(DESERIALISER.deserialise(rows.toArray(new String[0]))); + } + catch (Exception e) + { + if (row != 1) + { + SlackSheetsBot.reportParsingError(e, "Chest Loot", key, row); + } + + continue; + } + } + + _chestLoot.put(key, items); + } + + log("Finished updating chest loot"); + } + + public void addSpawnedChest(String key, boolean force) + { + if (key.equals("PURPLE") && Bukkit.getOnlinePlayers().size() < 10) + { + return; + } + + List locations = _worldData.getDataLocation(key); + ChestProperties properties = _chestProperties.get(key); + + if (!force && !UtilTime.elapsed(properties.getLastSpawn(), properties.getSpawnRate())) + { + return; + } + + properties.setLastSpawn(); + + // Only spawn more chests if we need to + int max = properties.getMaxActive(); + int spawned = 0; + + for (SpawnedChest chest : _spawnedChest) + { + if (chest.getProperties().getDataKey().equals(key)) + { + spawned++; + } + } + + // If there are too many chests of this type we can ignore it + if (spawned > max) + { + return; + } + + if (locations.isEmpty()) + { + return; + } + + Map spawnedIndexes = properties.getSpawnIndexes(); + Location randomLocation = null; + boolean found = false; + int attempts = 0; + int index = -1; + + while (index == -1 || !found && attempts < MAX_SEARCH_ATTEMPTS) + { + attempts++; + index = UtilMath.r(locations.size()); + + if (spawnedIndexes.getOrDefault(index, 0) >= properties.getMaxChestPerLocation()) + { + continue; + } + } + + if (index == -1) + { + return; + } + + spawnedIndexes.put(index, spawnedIndexes.getOrDefault(index, 0) + 1); + randomLocation = locations.get(index); + + int placeRadius = properties.getSpawnRadius(); + Location chestToPlace = UtilAlg.getRandomLocation(randomLocation, placeRadius, 0, placeRadius); + Block block = chestToPlace.getBlock(); + + attempts = 0; + boolean suitable = false; + + while (!suitable && attempts < MAX_SEARCH_ATTEMPTS) + { + chestToPlace = UtilAlg.getRandomLocation(randomLocation, placeRadius, 0, placeRadius); + block = chestToPlace.getBlock(); + suitable = isSuitable(block); + attempts++; + } + + //Bukkit.broadcastMessage("Spawned at " + UtilWorld.blockToStrClean(block) + " with key=" + key + " and index=" + index + " and max=" + spawned + "/" + max + " and suitable=" + suitable); + + if (!suitable) + { + return; + } + + _spawnedChest.add(new SpawnedChest(chestToPlace, properties, index)); + block.setType(properties.getBlockMaterial()); + } + + public void addSpawnedChest(Location location, String colour) + { + _spawnedChest.add(new SpawnedChest(location, _chestProperties.get(colour), -1)); + } + + public void fillChest(Player player, Block block, String key) + { + Set used = new HashSet<>(); + Set items = _chestLoot.get(key); + ChestProperties properties = _chestProperties.get(key); + + Inventory inventory = null; + + if (block.getType() == Material.ENDER_CHEST) + { + inventory = player.getEnderChest(); + } + else + { + BlockState state = block.getState(); + Chest chest = (Chest) state; + inventory = chest.getBlockInventory(); + } + + inventory.clear(); + + for (int i = 0; i < UtilMath.rRange(properties.getMinAmount(), properties.getMaxAmount()); i++) + { + LootItem lootItem = getRandomItem(items); + ItemStack itemStack = lootItem.getItemStack(); + int index = getFreeIndex(inventory.getSize(), used); + + inventory.setItem(index, itemStack); + } + } + + public LootItem getRandomItem(Set items) + { + double totalWeight = 0; + + for (LootItem item : items) + { + totalWeight += item.getProbability(); + } + + double select = Math.random() * totalWeight; + + for (LootItem item : items) + { + if ((select -= item.getProbability()) <= 0) + { + return item; + } + } + + return null; + } + + private int getFreeIndex(int endIndex, Set used) + { + int index = -1; + + while (index == -1 || used.contains(index)) + { + index = UtilMath.r(endIndex); + } + + used.add(index); + + return index; + } + + public LootItem fromItemStack(ItemStack itemStack) + { + if (itemStack == null) + { + return null; + } + + for (Set items : _chestLoot.values()) + { + for (LootItem item : items) + { + if (item.getItemStack().isSimilar(itemStack)) + { + return item; + } + } + } + + return null; + } + + public boolean hasChestBeenOpened(Location location) + { + for (SpawnedChest chest : _spawnedChest) + { + if (chest.getLocation().distanceSquared(location) < MAX_CHEST_CHECK_DISTANCE_SQUARED && chest.isOpened()) + { + return true; + } + } + + return false; + } + + @EventHandler + public void chestOpen(PlayerInteractEvent event) + { + if (event.isCancelled() || !UtilEvent.isAction(event, ActionType.R_BLOCK)) + { + return; + } + + Player player = event.getPlayer(); + Block block = event.getClickedBlock(); + + if (block.getType() != Material.CHEST && block.getType() != Material.ENDER_CHEST) + { + return; + } + + if (hasChestBeenOpened(block.getLocation())) + { + return; + } + + String key = null; + + for (SpawnedChest chest : _spawnedChest) + { + if (UtilMath.offsetSquared(chest.getLocation(), block.getLocation()) < MAX_CHEST_CHECK_DISTANCE_SQUARED) + { + key = chest.getProperties().getDataKey(); + chest.setOpened(); + break; + } + } + + if (key == null) + { + event.setCancelled(true); + return; + } + + PlayerChestOpenEvent openEvent = new PlayerChestOpenEvent(player, block, _chestProperties.get(key)); + UtilServer.CallEvent(openEvent); + + if (openEvent.isCancelled()) + { + event.setCancelled(true); + return; + } + + fillChest(player, block, key); + } + + @EventHandler + public void inventoryClick(InventoryClickEvent event) + { + if (event.getClickedInventory() == null) + { + return; + } + + ItemStack itemStack = event.getCurrentItem(); + + if (itemStack == null) + { + return; + } + + handleRewardItem((Player) event.getWhoClicked(), itemStack); + } + + @EventHandler + public void pickupItem(PlayerPickupItemEvent event) + { + if (event.getItem() == null) + { + return; + } + + handleRewardItem(event.getPlayer(), event.getItem().getItemStack()); + } + + public void handleRewardItem(Player player, ItemStack itemStack) + { + LootItem lootItem = fromItemStack(itemStack); + LootItemReward reward = null; + + for (LootItemReward storedReward : _itemRewards) + { + if (storedReward.getItemStack().isSimilar(itemStack)) + { + reward = storedReward; + } + } + + if (reward == null && lootItem != null && lootItem.getMetadata() != null) + { + String[] metadataSplit = lootItem.getMetadata().split(" "); + String key = metadataSplit[0]; + String[] values = new String[metadataSplit.length - 1]; + + for (int i = 1; i < metadataSplit.length; i++) + { + values[i - 1] = metadataSplit[i]; + } + + switch (key) + { + case "RANK_UPGRADE": + reward = new LootRankReward(itemStack); + break; + case "SHARD": + reward = new LootShardReward(Integer.parseInt(values[0]) * 1000, itemStack, Integer.parseInt(values[1])); + break; + case "CHEST": + reward = new LootChestReward(Integer.parseInt(values[0]) * 1000, itemStack, values[1], Integer.parseInt(values[2])); + break; + case "GADGET": + String gadget = ""; + + for (int i = 1; i < values.length; i++) + { + gadget += values[i] + " "; + } + + reward = new LootGadgetReward(Integer.parseInt(values[0]) * 1000, itemStack, gadget.trim()); + break; + default: + return; + } + + _itemRewards.add(reward); + } + + reward.collectItem(player); + } + + public void addItemReward(LootItemReward reward) + { + _itemRewards.add(reward); + } + + @EventHandler + public void gemClick(PlayerInteractEvent event) + { + if (!UtilEvent.isAction(event, ActionType.R)) + { + return; + } + + Player player = event.getPlayer(); + ItemStack itemStack = player.getItemInHand(); + + if (itemStack == null) + { + return; + } + + LootItem lootItem = fromItemStack(itemStack); + + if (lootItem == null || lootItem.getMetadata() == null || !lootItem.getMetadata().startsWith(GEM_METADATA)) + { + return; + } + + player.setItemInHand(UtilInv.decrement(itemStack)); + + int amount = Integer.parseInt(lootItem.getMetadata().split(" ")[1]); + + _economy.addToStore(player, "Gem Item", amount); + } + + @EventHandler + public void mapUpdate(UpdateEvent event) + { + if (event.getType() != UpdateType.SEC) + { + return; + } + + _shownPlayers.clear(); + + for (Player player : Bukkit.getOnlinePlayers()) + { + UUID key = player.getUniqueId(); + + for (LootItemReward itemReward : _itemRewards) + { + if (itemReward.getPlayer() == null) + { + continue; + } + + if (itemReward.getPlayer().equals(player)) + { + _shownPlayers.add(key); + break; + } + } + } + } + + @EventHandler + public void mapTeleport(PlayerTeleportIntoMapEvent event) + { + event.getPlayer().getInventory().addItem(SPAWN_ITEMS); + } + + @EventHandler + public void cashOutComplete(PlayerCashOutCompleteEvent event) + { + Player player = event.getPlayer(); + Iterator iterator = _itemRewards.iterator(); + + while (iterator.hasNext()) + { + LootItemReward reward = iterator.next(); + + if (player.equals(reward.getPlayer())) + { + reward.success(); + iterator.remove(); + } + } + } + + public final Set getShownPlayers() + { + return _shownPlayers; + } + + public final Set getChestItems(String key) + { + return _chestLoot.get(key); + } +} diff --git a/Plugins/mineplex-game-gemhunters/src/mineplex/gemhunters/loot/SpawnedChest.java b/Plugins/mineplex-game-gemhunters/src/mineplex/gemhunters/loot/SpawnedChest.java new file mode 100644 index 000000000..f0a8ae9dc --- /dev/null +++ b/Plugins/mineplex-game-gemhunters/src/mineplex/gemhunters/loot/SpawnedChest.java @@ -0,0 +1,59 @@ +package mineplex.gemhunters.loot; + +import org.bukkit.Location; + +public class SpawnedChest +{ + + private Location _location; + private ChestProperties _properties; + private int _id; + private long _spawnedAt; + + private long _openedAt; + + public SpawnedChest(Location location, ChestProperties properties, int id) + { + _location = location; + _properties =properties; + _id = id; + _spawnedAt = System.currentTimeMillis(); + _openedAt = 0; + } + + public void setOpened() + { + _openedAt = System.currentTimeMillis(); + } + + public Location getLocation() + { + return _location; + } + + public ChestProperties getProperties() + { + return _properties; + } + + public int getID() + { + return _id; + } + + public long getSpawnedAt() + { + return _spawnedAt; + } + + public long getOpenedAt() + { + return _openedAt; + } + + public boolean isOpened() + { + return _openedAt != 0; + } + +} diff --git a/Plugins/mineplex-game-gemhunters/src/mineplex/gemhunters/loot/command/SpawnChestCommand.java b/Plugins/mineplex-game-gemhunters/src/mineplex/gemhunters/loot/command/SpawnChestCommand.java new file mode 100644 index 000000000..9e0040952 --- /dev/null +++ b/Plugins/mineplex-game-gemhunters/src/mineplex/gemhunters/loot/command/SpawnChestCommand.java @@ -0,0 +1,47 @@ +package mineplex.gemhunters.loot.command; + +import org.bukkit.DyeColor; +import org.bukkit.Material; +import org.bukkit.entity.Player; + +import mineplex.core.command.CommandBase; +import mineplex.core.common.Rank; +import mineplex.core.common.util.F; +import mineplex.gemhunters.loot.LootModule; + +public class SpawnChestCommand extends CommandBase +{ + + public SpawnChestCommand(LootModule plugin) + { + super(plugin, Rank.ADMIN, "spawnchest"); + } + + @Override + public void Execute(Player caller, String[] args) + { + if (args.length == 0) + { + caller.sendMessage(F.help("/" + _aliasUsed + " ", "Spawns a chest at your location.", GetRequiredRank())); + return; + } + + String colour = args[0].toUpperCase(); + + try + { + DyeColor.valueOf(colour); + } + catch (IllegalArgumentException e) + { + caller.sendMessage(F.main(Plugin.getName(), "That is not a valid colour.")); + return; + } + + caller.sendMessage(F.main(Plugin.getName(), "Spawned a " + colour + " chest at your location.")); + + caller.getLocation().getBlock().setType(Material.CHEST); + Plugin.addSpawnedChest(caller.getLocation(), colour); + } + +} diff --git a/Plugins/mineplex-game-gemhunters/src/mineplex/gemhunters/loot/command/UpdateLootCommand.java b/Plugins/mineplex-game-gemhunters/src/mineplex/gemhunters/loot/command/UpdateLootCommand.java new file mode 100644 index 000000000..c556148a8 --- /dev/null +++ b/Plugins/mineplex-game-gemhunters/src/mineplex/gemhunters/loot/command/UpdateLootCommand.java @@ -0,0 +1,33 @@ +package mineplex.gemhunters.loot.command; + +import org.bukkit.entity.Player; + +import mineplex.core.command.CommandBase; +import mineplex.core.common.Rank; +import mineplex.core.common.util.F; +import mineplex.gemhunters.loot.LootModule; + +/** + * An ADMIN command that allows users to retrieve the latest data from the + * google sheet and update all locally cached loot tables. + */ +public class UpdateLootCommand extends CommandBase +{ + + public UpdateLootCommand(LootModule plugin) + { + super(plugin, Rank.ADMIN, "updateloot"); + } + + @Override + public void Execute(Player caller, String[] args) + { + if (args.length > 1) + { + // TODO send redis message + } + + caller.sendMessage(F.main(Plugin.getName(), "This command is currently disabled due to development issues.")); + } + +} diff --git a/Plugins/mineplex-game-gemhunters/src/mineplex/gemhunters/loot/deserialisers/ChestPropertiesDeserialiser.java b/Plugins/mineplex-game-gemhunters/src/mineplex/gemhunters/loot/deserialisers/ChestPropertiesDeserialiser.java new file mode 100644 index 000000000..15898b8fb --- /dev/null +++ b/Plugins/mineplex-game-gemhunters/src/mineplex/gemhunters/loot/deserialisers/ChestPropertiesDeserialiser.java @@ -0,0 +1,43 @@ +package mineplex.gemhunters.loot.deserialisers; + +import org.bukkit.Material; + +import mineplex.core.google.SheetObjectDeserialiser; +import mineplex.gemhunters.loot.ChestProperties; + +public class ChestPropertiesDeserialiser implements SheetObjectDeserialiser +{ + + @Override + public ChestProperties deserialise(String[] values) throws ArrayIndexOutOfBoundsException + { + String name = values[0]; + Material blockMaterial = Material.valueOf(values[1]); + String dataKey = values[2]; + + int minAmount = 1; + int maxAmount = 1; + + String[] numbers = values[3].split("-"); + + if (numbers.length != 2) + { + minAmount = Integer.parseInt(String.valueOf(values[3])); + maxAmount = minAmount; + } + else + { + minAmount = Integer.parseInt(numbers[0]); + maxAmount = Integer.parseInt(numbers[1]); + } + + int spawnRate = Integer.parseInt(values[4]); + int expireRate = Integer.parseInt(values[5]); + int maxChestsPerLoc = Integer.parseInt(values[6]); + int spawnRadius = Integer.parseInt(values[7]); + int maxActive = Integer.parseInt(values[8]); + + return new ChestProperties(name, blockMaterial, dataKey, minAmount, maxAmount, maxChestsPerLoc, spawnRate, expireRate, spawnRadius, maxActive); + } + +} diff --git a/Plugins/mineplex-game-gemhunters/src/mineplex/gemhunters/loot/deserialisers/LootItemDeserialiser.java b/Plugins/mineplex-game-gemhunters/src/mineplex/gemhunters/loot/deserialisers/LootItemDeserialiser.java new file mode 100644 index 000000000..61fc76602 --- /dev/null +++ b/Plugins/mineplex-game-gemhunters/src/mineplex/gemhunters/loot/deserialisers/LootItemDeserialiser.java @@ -0,0 +1,100 @@ +package mineplex.gemhunters.loot.deserialisers; + +import org.bukkit.Material; +import org.bukkit.enchantments.Enchantment; + +import mineplex.core.google.SheetObjectDeserialiser; +import mineplex.core.itemstack.ItemBuilder; +import mineplex.gemhunters.loot.LootItem; +import net.md_5.bungee.api.ChatColor; + +/** + * This is a {@link LootItem} deserialiser for Google Sheet interpretation.
+ *
+ * Arguments should follow the form:
+ *

    + *
  • Material
  • + *
  • Material Data
  • + *
  • Max Durability
  • + *
  • Amount
  • + *
  • Item Name (optional)
  • + *
  • Item Lore (optional) each line separated by colons
  • + *
  • Enchantments (optional) Has a NAME:LEVEL format with multiple + * enchantments being separated by commas
  • + *
  • Probability
  • + *
  • Metadata (optional)
  • + *
+ * Thus derserialise is guaranteed to have at least 8 strings passed in.
+ * If an illegal argument is passed in, derserialise will throw an exception, + * these should be handled by the caller. + * + * @see SheetObjectDeserialiser + */ +public class LootItemDeserialiser implements SheetObjectDeserialiser +{ + + @Override + public LootItem deserialise(String[] values) throws ArrayIndexOutOfBoundsException, IllegalArgumentException, NumberFormatException + { + Material material = Material.valueOf(values[0]); + byte data = values[1].equals("") ? 0 : Byte.parseByte(values[1]); + int minAmount = 1; + int maxAmount = 1; + short durability = values[2].equals("") ? 0 : Short.valueOf(values[2]); + + String[] numbers = values[3].split("-"); + + if (numbers.length != 2) + { + minAmount = Integer.parseInt(values[3].equals("") ? "1" : values[3]); + maxAmount = minAmount; + } + else + { + minAmount = Integer.parseInt(numbers[0]); + maxAmount = Integer.parseInt(numbers[1]); + } + + ItemBuilder builder = new ItemBuilder(material, data); + + builder.setDurability(durability); + + String title = ChatColor.translateAlternateColorCodes('&', values[4]); + + builder.setTitle(title); + + if (!values[5].equals("")) + { + String[] lore = values[5].split(":"); + String[] colouredLore = new String[lore.length]; + + int loreIndex = 0; + for (String line : lore) + { + colouredLore[loreIndex++] = ChatColor.translateAlternateColorCodes('&', line); + } + + builder.setLore(colouredLore); + } + + String[] enchants = String.valueOf(values[6]).split(","); + + for (String enchant : enchants) + { + String[] enchantData = enchant.split(":"); + + if (enchantData.length < 2) + { + continue; + } + + builder.addEnchantment(Enchantment.getByName(enchantData[0]), Integer.parseInt(enchantData[1])); + } + + double proability = Double.parseDouble(values[7]); + String metadata = values.length > 8 ? values[8] : null; + + return new LootItem(builder.build(), minAmount, maxAmount, proability, metadata); + } + +} diff --git a/Plugins/mineplex-game-gemhunters/src/mineplex/gemhunters/loot/event/PlayerChestOpenEvent.java b/Plugins/mineplex-game-gemhunters/src/mineplex/gemhunters/loot/event/PlayerChestOpenEvent.java new file mode 100644 index 000000000..fb7d40583 --- /dev/null +++ b/Plugins/mineplex-game-gemhunters/src/mineplex/gemhunters/loot/event/PlayerChestOpenEvent.java @@ -0,0 +1,60 @@ +package mineplex.gemhunters.loot.event; + +import org.bukkit.block.Block; +import org.bukkit.entity.Player; +import org.bukkit.event.Cancellable; +import org.bukkit.event.HandlerList; +import org.bukkit.event.player.PlayerEvent; + +import mineplex.gemhunters.loot.ChestProperties; + +public class PlayerChestOpenEvent extends PlayerEvent implements Cancellable +{ + + private static final HandlerList HANDLERS = new HandlerList(); + + private boolean _cancel; + private final Block _block; + private final ChestProperties _properties; + + public PlayerChestOpenEvent(Player who, Block block, ChestProperties properties) + { + super(who); + + _block = block; + _properties = properties; + } + + public Block getChest() + { + return _block; + } + + public ChestProperties getProperties() + { + return _properties; + } + + public HandlerList getHandlers() + { + return HANDLERS; + } + + public static HandlerList getHandlerList() + { + return HANDLERS; + } + + @Override + public boolean isCancelled() + { + return _cancel; + } + + @Override + public void setCancelled(boolean cancel) + { + _cancel = cancel; + } + +} diff --git a/Plugins/mineplex-game-gemhunters/src/mineplex/gemhunters/loot/rewards/LootChestReward.java b/Plugins/mineplex-game-gemhunters/src/mineplex/gemhunters/loot/rewards/LootChestReward.java new file mode 100644 index 000000000..5ef354ec1 --- /dev/null +++ b/Plugins/mineplex-game-gemhunters/src/mineplex/gemhunters/loot/rewards/LootChestReward.java @@ -0,0 +1,52 @@ +package mineplex.gemhunters.loot.rewards; + +import org.bukkit.inventory.ItemStack; + +import mineplex.core.Managers; +import mineplex.core.common.util.Callback; +import mineplex.core.inventory.InventoryManager; + +public class LootChestReward extends LootItemReward +{ + + private final InventoryManager _inventory; + + private final String _chestName; + private final int _amount; + + public LootChestReward(long cashOutDelay, ItemStack itemStack, String chestName, int amount) + { + super(chestName + " Chest", cashOutDelay, itemStack); + + _inventory = Managers.require(InventoryManager.class); + _chestName = chestName; + _amount = amount; + } + + @Override + public void onCollectItem() + { + + } + + @Override + public void onSuccessful() + { + _inventory.addItemToInventory(new Callback() + { + + @Override + public void run(Boolean success) + { + //DebugModule.getInstance().d("Success= " + success); + } + }, _player, _chestName + " Chest", _amount); + } + + @Override + public void onDeath() + { + + } + +} diff --git a/Plugins/mineplex-game-gemhunters/src/mineplex/gemhunters/loot/rewards/LootGadgetReward.java b/Plugins/mineplex-game-gemhunters/src/mineplex/gemhunters/loot/rewards/LootGadgetReward.java new file mode 100644 index 000000000..59f9db30f --- /dev/null +++ b/Plugins/mineplex-game-gemhunters/src/mineplex/gemhunters/loot/rewards/LootGadgetReward.java @@ -0,0 +1,54 @@ +package mineplex.gemhunters.loot.rewards; + +import org.bukkit.inventory.ItemStack; + +import mineplex.core.Managers; +import mineplex.core.common.currency.GlobalCurrency; +import mineplex.core.donation.DonationManager; +import mineplex.core.donation.Donor; + +public class LootGadgetReward extends LootItemReward +{ + + private final DonationManager _donation; + + private final String _gadget; + + public LootGadgetReward(long cashOutDelay, ItemStack itemStack, String gadget) + { + super(gadget, cashOutDelay, itemStack); + + _donation = Managers.require(DonationManager.class); + _gadget = gadget; + } + + @Override + public void onCollectItem() + { + + } + + @Override + public void onSuccessful() + { + Donor donor = _donation.Get(_player); + + if (donor.ownsUnknownSalesPackage(_gadget)) + { + //DebugModule.getInstance().d("Shard duplicate"); + _donation.rewardCurrencyUntilSuccess(GlobalCurrency.TREASURE_SHARD, _player, "Earned", (int) (500 + 1000 * Math.random())); + } + else + { + //DebugModule.getInstance().d("Adding gadget"); + _donation.purchaseUnknownSalesPackage(_player, _gadget, GlobalCurrency.TREASURE_SHARD, 0, true, null); + } + } + + @Override + public void onDeath() + { + + } + +} diff --git a/Plugins/mineplex-game-gemhunters/src/mineplex/gemhunters/loot/rewards/LootItemReward.java b/Plugins/mineplex-game-gemhunters/src/mineplex/gemhunters/loot/rewards/LootItemReward.java new file mode 100644 index 000000000..f0ec11991 --- /dev/null +++ b/Plugins/mineplex-game-gemhunters/src/mineplex/gemhunters/loot/rewards/LootItemReward.java @@ -0,0 +1,93 @@ +package mineplex.gemhunters.loot.rewards; + +import org.bukkit.entity.Player; +import org.bukkit.event.entity.PlayerDeathEvent; +import org.bukkit.inventory.ItemStack; + +import mineplex.core.common.util.C; +import mineplex.core.common.util.F; +import mineplex.core.common.util.UtilServer; +import mineplex.core.common.util.UtilTextMiddle; +import mineplex.core.common.util.UtilTime; +import mineplex.core.recharge.Recharge; + +public abstract class LootItemReward +{ + + private String _name; + + private long _firstItemPickup; + private long _cashOutDelay; + + protected Player _player; + private ItemStack _itemStack; + + public LootItemReward(String name, long cashOutDelay, ItemStack itemStack) + { + _name = name; + _firstItemPickup = 0; + _cashOutDelay = cashOutDelay; + _itemStack = itemStack; + } + + public abstract void onCollectItem(); + + public abstract void onSuccessful(); + + public abstract void onDeath(); + + public final void collectItem(Player player) + { + if (player.equals(_player)) + { + return; + } + + if (_firstItemPickup == 0) + { + String title = C.cYellow + player.getName(); + String subtitle = C.cGray + "Collected a " + F.elem(_name) + " reward. Killing them will drop it!"; + String chatMessage = F.main("Game", title + " " + subtitle + " They will not be able to quit out of the game for " + F.time(UtilTime.MakeStr(_cashOutDelay) + ".")); + + UtilTextMiddle.display(title, subtitle, 20, 60, 20, UtilServer.getPlayers()); + UtilServer.broadcast(chatMessage); + + _firstItemPickup = System.currentTimeMillis(); + } + else + { + String message = F.main("Game", F.name(player.getName()) + " now has the " + F.elem(_name) + " reward!"); + + UtilServer.broadcast(message); + } + + Recharge.Instance.useForce(player, "Cash Out", _cashOutDelay, false); + _player = player; + onCollectItem(); + } + + public final void success() + { + onSuccessful(); + } + + public final void death(PlayerDeathEvent event) + { + } + + public boolean isFirstPickup() + { + return _firstItemPickup == 0; + } + + public Player getPlayer() + { + return _player; + } + + public ItemStack getItemStack() + { + return _itemStack; + } + +} diff --git a/Plugins/mineplex-game-gemhunters/src/mineplex/gemhunters/loot/rewards/LootRankReward.java b/Plugins/mineplex-game-gemhunters/src/mineplex/gemhunters/loot/rewards/LootRankReward.java new file mode 100644 index 000000000..58ae67fb3 --- /dev/null +++ b/Plugins/mineplex-game-gemhunters/src/mineplex/gemhunters/loot/rewards/LootRankReward.java @@ -0,0 +1,84 @@ +package mineplex.gemhunters.loot.rewards; + +import java.util.concurrent.TimeUnit; + +import org.bukkit.inventory.ItemStack; + +import mineplex.core.Managers; +import mineplex.core.account.CoreClient; +import mineplex.core.account.CoreClientManager; +import mineplex.core.common.Rank; +import mineplex.core.common.currency.GlobalCurrency; +import mineplex.core.common.util.F; +import mineplex.core.donation.DonationManager; + +public class LootRankReward extends LootItemReward +{ + + private static final long CASH_OUT_DELAY = TimeUnit.MINUTES.toMillis(15); + private static final int CONSOLATION_PRICE = 10000; + + private final CoreClientManager _clientManager; + private final DonationManager _donation; + + public LootRankReward(ItemStack itemStack) + { + super("Rank", CASH_OUT_DELAY, itemStack); + + _clientManager = Managers.require(CoreClientManager.class); + _donation = Managers.require(DonationManager.class); + } + + @Override + public void onCollectItem() + { + } + + @Override + public void onSuccessful() + { + CoreClient client = _clientManager.Get(_player); + Rank rank = client.GetRank(); + Rank newRank = null; + + // I could have done this so it runs off the order of the Rank enum, + // however knowing some people that might get changed so I'm just going + // to hard code what you get. + + switch (rank) + { + case ALL: + newRank = Rank.ULTRA; + break; + case ULTRA: + newRank = Rank.HERO; + break; + case HERO: + newRank = Rank.LEGEND; + break; + case LEGEND: + newRank = Rank.TITAN; + break; + case TITAN: + newRank = Rank.ETERNAL; + break; + default: + break; + } + + // A suitable rank could not be found. + if (newRank == null) + { + _player.sendMessage(F.main("Loot", "Since you already have eternal ( You are lucky :) ). So instead you can have " + CONSOLATION_PRICE + " shards.")); + _donation.rewardCurrencyUntilSuccess(GlobalCurrency.TREASURE_SHARD, _player, "Earned", CONSOLATION_PRICE); + return; + } + + _clientManager.SaveRank(_player.getName(), _player.getUniqueId(), newRank, true); + } + + @Override + public void onDeath() + { + } +} diff --git a/Plugins/mineplex-game-gemhunters/src/mineplex/gemhunters/loot/rewards/LootShardReward.java b/Plugins/mineplex-game-gemhunters/src/mineplex/gemhunters/loot/rewards/LootShardReward.java new file mode 100644 index 000000000..af1119a73 --- /dev/null +++ b/Plugins/mineplex-game-gemhunters/src/mineplex/gemhunters/loot/rewards/LootShardReward.java @@ -0,0 +1,42 @@ +package mineplex.gemhunters.loot.rewards; + +import org.bukkit.inventory.ItemStack; + +import mineplex.core.Managers; +import mineplex.core.common.currency.GlobalCurrency; +import mineplex.core.donation.DonationManager; + +public class LootShardReward extends LootItemReward +{ + + private final DonationManager _donation; + + private final int _amount; + + public LootShardReward(long cashOutDelay, ItemStack itemStack, int amount) + { + super("Shard", cashOutDelay, itemStack); + + _donation = Managers.require(DonationManager.class); + _amount = amount; + } + + @Override + public void onCollectItem() + { + + } + + @Override + public void onSuccessful() + { + _donation.rewardCurrencyUntilSuccess(GlobalCurrency.TREASURE_SHARD, _player, "Earned", _amount); + } + + @Override + public void onDeath() + { + + } + +} diff --git a/Plugins/mineplex-game-gemhunters/src/mineplex/gemhunters/map/ItemMapModule.java b/Plugins/mineplex-game-gemhunters/src/mineplex/gemhunters/map/ItemMapModule.java new file mode 100644 index 000000000..6b85e8ba4 --- /dev/null +++ b/Plugins/mineplex-game-gemhunters/src/mineplex/gemhunters/map/ItemMapModule.java @@ -0,0 +1,966 @@ +package mineplex.gemhunters.map; + +import java.io.BufferedReader; +import java.io.File; +import java.io.FileReader; +import java.io.IOException; +import java.io.PrintWriter; +import java.lang.reflect.Field; +import java.util.Collections; +import java.util.Comparator; +import java.util.HashMap; +import java.util.LinkedList; +import java.util.Map.Entry; + +import org.apache.commons.io.FileUtils; +import org.bukkit.Bukkit; +import org.bukkit.Location; +import org.bukkit.Material; +import org.bukkit.World; +import org.bukkit.craftbukkit.v1_8_R3.CraftChunk; +import org.bukkit.craftbukkit.v1_8_R3.CraftWorld; +import org.bukkit.craftbukkit.v1_8_R3.util.LongHash; +import org.bukkit.craftbukkit.v1_8_R3.util.LongObjectHashMap; +import org.bukkit.entity.Player; +import org.bukkit.event.EventHandler; +import org.bukkit.event.EventPriority; +import org.bukkit.event.block.Action; +import org.bukkit.event.entity.ItemSpawnEvent; +import org.bukkit.event.entity.PlayerDeathEvent; +import org.bukkit.event.player.PlayerInteractEvent; +import org.bukkit.event.player.PlayerItemHeldEvent; +import org.bukkit.event.player.PlayerQuitEvent; +import org.bukkit.event.world.ChunkLoadEvent; +import org.bukkit.inventory.ItemStack; +import org.bukkit.map.MapRenderer; +import org.bukkit.map.MapView; + +import com.google.common.collect.HashMultiset; +import com.google.common.collect.Iterables; +import com.google.common.collect.Multisets; + +import mineplex.core.MiniPlugin; +import mineplex.core.ReflectivelyCreateMiniPlugin; +import mineplex.core.common.util.C; +import mineplex.core.common.util.F; +import mineplex.core.common.util.UtilEvent; +import mineplex.core.common.util.UtilEvent.ActionType; +import mineplex.core.common.util.UtilInv; +import mineplex.core.common.util.UtilItem; +import mineplex.core.common.util.UtilPlayer; +import mineplex.core.common.util.UtilServer; +import mineplex.core.common.util.UtilTextBottom; +import mineplex.core.common.util.UtilTime; +import mineplex.core.common.util.UtilTime.TimeUnit; +import mineplex.core.itemstack.ItemBuilder; +import mineplex.core.portal.events.ServerTransferEvent; +import mineplex.core.updater.UpdateType; +import mineplex.core.updater.event.UpdateEvent; +import mineplex.gemhunters.death.event.PlayerCustomRespawnEvent; +import mineplex.gemhunters.map.command.MapCommand; +import net.minecraft.server.v1_8_R3.Block; +import net.minecraft.server.v1_8_R3.BlockPosition; +import net.minecraft.server.v1_8_R3.Blocks; +import net.minecraft.server.v1_8_R3.Chunk; +import net.minecraft.server.v1_8_R3.ChunkProviderServer; +import net.minecraft.server.v1_8_R3.ChunkRegionLoader; +import net.minecraft.server.v1_8_R3.IBlockData; +import net.minecraft.server.v1_8_R3.MaterialMapColor; +import net.minecraft.server.v1_8_R3.PersistentCollection; +import net.minecraft.server.v1_8_R3.WorldServer; + +/** + * All item map code was adapted from Clans.
+ */ +@ReflectivelyCreateMiniPlugin +public class ItemMapModule extends MiniPlugin +{ + // Every BLOCK_SCAN_INTERVAL we add as a new region to scan + private static final int BLOCK_SCAN_INTERVAL = 16 * 3; + // 1536 is the width of the entire world from one borderland to the other + private static final int HALF_WORLD_SIZE = 768; + // This slot is where the Clans Map will go by default + private static final int CLANS_MAP_SLOT = 8; + + private static final String[] ZOOM_INFO; + + static + { + ZOOM_INFO = new String[4]; + for (int zoomLevel = 0; zoomLevel <= 3; zoomLevel++) + { + StringBuilder progressBar = new StringBuilder(C.cBlue); + + boolean colorChange = false; + for (int i = 2; i >= 0; i--) + { + if (!colorChange && i < zoomLevel) + { + progressBar.append(C.cGray); + colorChange = true; + } + char c; + switch (i) + { + case 0: + c = '█'; + break; + case 1: + c = '▆'; + break; + default: + c = '▄'; + break; + } + for (int a = 0; a < 4; a++) + { + progressBar.append(c); + } + + if (i > 0) + { + progressBar.append(" "); + } + } + ZOOM_INFO[zoomLevel] = progressBar.toString(); + } + } + + private Comparator> _comparator; + private int[][] _heightMap = new int[(HALF_WORLD_SIZE * 2) + 16][]; + private HashMap _map = new HashMap(); + private short _mapId = -1; + private HashMap _mapInfo = new HashMap(); + private HashMap _scale = new HashMap(); + // Use LinkedList because operations are either add(Entry) which is O(1) and remove(0) which is O(1) on LinkedList but O(n) on ArrayList + private LinkedList> _scanList = new LinkedList>(); + private World _world; + private WorldServer _nmsWorld; + private ChunkProviderServer _chunkProviderServer; + private ChunkRegionLoader _chunkRegionLoader; + + private ItemMapModule() + { + super("Map"); + + _comparator = (o1, o2) -> + { + // Render the places outside the map first to speed up visual errors fixing + int outsideMap = Boolean.compare(o1.getValue() < -HALF_WORLD_SIZE, o2.getValue() < -HALF_WORLD_SIZE); + + if (outsideMap != 0) + { + return -outsideMap; + } + + double dist1 = 0; + double dist2 = 0; + + for (Player player : UtilServer.getPlayers()) + { + dist1 += getDistance(o1, player.getLocation().getX(), player.getLocation().getZ()); + dist2 += getDistance(o2, player.getLocation().getX(), player.getLocation().getZ()); + } + + if (dist1 != dist2) + { + return Double.compare(dist1, dist2); + } + + dist1 = getDistance(o1, 0, 0); + dist2 = getDistance(o2, 0, 0); + + return Double.compare(dist1, dist2); + + }; + + _scale.put(0, 1); + // _scale.put(1, 2); + _scale.put(1, 4); + _scale.put(2, 8); + _scale.put(3, 13); + // _scale.put(5, 16); + + for (Entry entry : _scale.entrySet()) + { + int size = (HALF_WORLD_SIZE * 2) / entry.getValue(); + Byte[][] bytes = new Byte[size][]; + + for (int i = 0; i < size; i++) + { + bytes[i] = new Byte[size]; + } + + _map.put(entry.getKey(), bytes); + } + + for (int i = 0; i < _heightMap.length; i++) + { + _heightMap[i] = new int[_heightMap.length]; + } + + _world = Bukkit.getWorld("world"); + + try + { + Field chunkLoader = ChunkProviderServer.class.getDeclaredField("chunkLoader"); + chunkLoader.setAccessible(true); + _nmsWorld = ((CraftWorld) _world).getHandle(); + _chunkProviderServer = _nmsWorld.chunkProviderServer; + _chunkRegionLoader = (ChunkRegionLoader) chunkLoader.get(_chunkProviderServer); + if (_chunkRegionLoader == null) + { + throw new RuntimeException("Did not expect null chunkLoader"); + } + } + catch (ReflectiveOperationException e) + { + throw new RuntimeException("Could not reflectively access ChunkRegionLoader", e); + } + + try + { + File file = new File("world/gem_hunters_map_id"); + File foundFile = null; + + for (File f : new File("world/data").listFiles()) + { + if (f.getName().startsWith("map_")) + { + foundFile = f; + break; + } + } + + if (foundFile == null) + { + PersistentCollection collection = ((CraftWorld) _world).getHandle().worldMaps; + Field f = collection.getClass().getDeclaredField("d"); + f.setAccessible(true); + ((HashMap) f.get(collection)).put("map", (short) 0); + } + + if (file.exists()) + { + BufferedReader br = new BufferedReader(new FileReader(file)); + _mapId = Short.parseShort(br.readLine()); + br.close(); + + if (foundFile == null) + { + _mapId = -1; + file.delete(); + } + else + { + for (int i = _mapId; i <= _mapId + 100; i++) + { + File file1 = new File("world/data/map_" + i + ".dat"); + + if (!file1.exists()) + { + FileUtils.copyFile(foundFile, file1); + } + + setupRenderer(Bukkit.getMap((short) i)); + } + } + } + + if (_mapId < 0) + { + MapView view = Bukkit.createMap(_world); + _mapId = view.getId(); + setupRenderer(view); + + for (int i = 0; i < 100; i++) + { + setupRenderer(Bukkit.createMap(_world));// Ensures the following 100 maps are unused + } + + file.createNewFile(); + + PrintWriter writer = new PrintWriter(file, "UTF-8"); + writer.print(_mapId); + writer.close(); + } + } + catch (Exception ex) + { + ex.printStackTrace(); + } + + rebuildScan(); + initialScan(); + } + + private void initialScan() + { + System.out.println("Beginning initial scan. There are " + _scanList.size() + " regions to scan"); + + // How many regions before logging an update (Currently set to every 20%) + int logPer = _scanList.size() / 5; + + while (!_scanList.isEmpty()) + { + Entry entry = _scanList.remove(0); + if (_scanList.size() % logPer == 0) + { + System.out.println("Running initial render... " + _scanList.size() + " sections to go"); + } + + int startingX = entry.getKey(); + int startingZ = entry.getValue(); + + boolean outsideMap = startingZ < -HALF_WORLD_SIZE; + + scanWorldMap(startingX, startingZ, !outsideMap, true); + + if (outsideMap) + { + continue; + } + + for (int scale = 1; scale < _scale.size(); scale++) + { + if (scale == 3) + continue; + + drawWorldScale(scale, startingX, startingZ); + colorWorldHeight(scale, startingX, startingZ); + } + + colorWorldHeight(0, startingX, startingZ); + } + + for (int x = -HALF_WORLD_SIZE; x < HALF_WORLD_SIZE; x += BLOCK_SCAN_INTERVAL) + { + for (int z = -HALF_WORLD_SIZE; z < HALF_WORLD_SIZE; z += BLOCK_SCAN_INTERVAL) + { + drawWorldScale(3, x, z); + colorWorldHeight(3, x, z); + } + } + + System.out.println("Finished first map scan and render"); + } + + private void setupRenderer(MapView view) + { + for (MapRenderer renderer : view.getRenderers()) + { + view.removeRenderer(renderer); + } + + view.addRenderer(new ItemMapRenderer()); + } + + /** + * Get the center of the map. + */ + public int calcMapCenter(int zoom, int cord) + { + int mapSize = HALF_WORLD_SIZE / zoom; // This is how large the map is in pixels + + int mapCord = cord / zoom; // This is pixels from true center of map, not held map + + int fDiff = mapSize - -mapCord; + int sDiff = mapSize - mapCord; + + double chunkBlock = cord & 0xF; + cord -= chunkBlock; + chunkBlock /= zoom; + + /*if ((fDiff < 64 || sDiff < 64) && (Math.abs(fDiff - sDiff) > 1)) + { + cord += (fDiff > sDiff ? Math.floor(chunkBlock) : Math.ceil(chunkBlock)); + } + else*/ + { + cord += (int) Math.floor(chunkBlock) * zoom; + } + + while ((fDiff < 64 || sDiff < 64) && (Math.abs(fDiff - sDiff) > 1)) + { + int change = (fDiff > sDiff ? -zoom : zoom); + cord += change; + + mapCord = cord / zoom; + + fDiff = mapSize - -mapCord; + sDiff = mapSize - mapCord; + } + + return cord; + } + + private void colorWorldHeight(int scale, int startingX, int startingZ) + { + Byte[][] map = _map.get(scale); + int zoom = getZoom(scale); + + for (int x = startingX; x < startingX + BLOCK_SCAN_INTERVAL; x += zoom) + { + double d0 = 0; + + // Prevents ugly lines for the first line of Z + + for (int addX = 0; addX < zoom; addX++) + { + for (int addZ = 0; addZ < zoom; addZ++) + { + int hX = x + addX + HALF_WORLD_SIZE; + int hZ = (startingZ - zoom) + addZ + HALF_WORLD_SIZE; + + if (hX >= HALF_WORLD_SIZE * 2 || hZ >= HALF_WORLD_SIZE * 2) + { + continue; + } + + d0 += _heightMap[hX + 16][hZ + 16] / (zoom * zoom); + } + } + + for (int z = startingZ; z < startingZ + BLOCK_SCAN_INTERVAL; z += zoom) + { + // Water depth colors not included + double d1 = 0; + + for (int addX = 0; addX < zoom; addX++) + { + for (int addZ = 0; addZ < zoom; addZ++) + { + int hX = x + addX + HALF_WORLD_SIZE; + int hZ = z + addZ + HALF_WORLD_SIZE; + + if (hX >= HALF_WORLD_SIZE * 2 || hZ >= HALF_WORLD_SIZE * 2) + { + continue; + } + + d1 += _heightMap[hX + 16][hZ + 16] / (zoom * zoom); + } + } + + double d2 = (d1 - d0) * 4.0D / (zoom + 4) + ((x + z & 0x1) - 0.5D) * 0.4D; + byte b0 = 1; + + d0 = d1; + + if (d2 > 0.6D) + { + b0 = 2; + } + else if (d2 > 1.2D) + { + b0 = 3; + } + else if (d2 < -0.6D) + { + b0 = 0; + } + + int origColor = map[(x + HALF_WORLD_SIZE) / zoom][(z + HALF_WORLD_SIZE) / zoom] - 1; + + /*if (color < 4) + { + d2 = waterDepth * 0.1D + (k1 + j2 & 0x1) * 0.2D; + b0 = 1; + if (d2 < 0.5D) + { + b0 = 2; + } + + if (d2 > 0.9D) + { + b0 = 0; + } + }*/ + + byte color = (byte) (origColor + b0); + if((color <= -113 || color >= 0) && color <= 127) + { + map[(x + HALF_WORLD_SIZE) / zoom][(z + HALF_WORLD_SIZE) / zoom] = color; + } + else + { +// System.out.println(String.format("Tried to set color to %s in colorWorldHeight scale: %s, sx: %s, sz: %s, x: %s, z: %s, zoom: %s", +// color, scale, startingX, startingZ, x, z, zoom)); + } + } + } + } + + private void drawWorldScale(int scale, int startingX, int startingZ) + { + Byte[][] first = _map.get(0); + Byte[][] second = _map.get(scale); + int zoom = getZoom(scale); + + for (int x = startingX; x < startingX + BLOCK_SCAN_INTERVAL; x += zoom) + { + for (int z = startingZ; z < startingZ + BLOCK_SCAN_INTERVAL; z += zoom) + { + HashMultiset hashmultiset = HashMultiset.create(); + + for (int addX = 0; addX < zoom; addX++) + { + for (int addZ = 0; addZ < zoom; addZ++) + { + int pX = x + addX + HALF_WORLD_SIZE; + int pZ = z + addZ + HALF_WORLD_SIZE; + + if (pX >= first.length || pZ >= first.length) + { + continue; + } + + Byte b = first[pX][pZ]; + + hashmultiset.add(b); + } + } + + Byte color; + try + { + color = Iterables.getFirst(Multisets.copyHighestCountFirst(hashmultiset), (byte) 0); + } + catch (Exception e) + { + color = (byte) 0; + } + second[(x + HALF_WORLD_SIZE) / zoom][(z + HALF_WORLD_SIZE) / zoom] = color; + } + } + } + + @EventHandler + public void dropItem(ItemSpawnEvent event) + { + if (isItemClansMap(event.getEntity().getItemStack())) + event.getEntity().remove(); + } + + public void removeMap(Player player) + { + for (int slot = 0; slot < player.getInventory().getSize(); slot++) + { + if (isItemClansMap(player.getInventory().getItem(slot))) + player.getInventory().setItem(slot, null); + } + } + + private double getDistance(double x1, double z1, double x2, double z2) + { + x1 = (x1 - x2); + z1 = (z1 - z2); + + return (x1 * x1) + (z1 * z1); + } + + private double getDistance(Entry entry, double x1, double z1) + { + return getDistance(x1, z1, entry.getKey() + (BLOCK_SCAN_INTERVAL / 2), entry.getValue() + (BLOCK_SCAN_INTERVAL / 2)); + } + + public Byte[][] getMap(int scale) + { + return _map.get(scale); + } + + public MapInfo getMap(Player player) + { + return _mapInfo.get(player.getName()); + } + + public int getMapSize() + { + return HALF_WORLD_SIZE; + } + + public int getZoom(int scale) + { + return _scale.get(scale); + } + + //fixme So what appears to happen is that after you die, if your map is is the same then the map is frozen + @EventHandler + public void onDeath(PlayerDeathEvent event) + { + MapInfo info = getMap(event.getEntity()); + + info.setMap(Math.min(_mapId + 100, info.getMap() + 1)); + } + + @EventHandler + public void onHotbarMove(PlayerItemHeldEvent event) + { + Player player = event.getPlayer(); + + if (!isItemClansMap(player.getInventory().getItem(event.getNewSlot()))) + return; + + showZoom(player, getMap(player)); + } + + @EventHandler + public void onInteract(PlayerInteractEvent event) + { + if (event.getAction() == Action.PHYSICAL) + return; + + if (!isItemClansMap(event.getItem())) + return; + + event.setCancelled(true); + + Player player = event.getPlayer(); + + MapInfo info = getMap(player); + + boolean zoomIn = UtilEvent.isAction(event, ActionType.L); + + if (!_scale.containsKey(info.getScale() + (zoomIn ? -1 : 1))) + { + return; + } + + if (!info.canZoom()) + { + long remainingTime = (info.getZoomCooldown() + 2500) - System.currentTimeMillis(); + + UtilPlayer.message( + player, + F.main("Recharge", + "You cannot use " + F.skill("Map Zoom") + " for " + + F.time(UtilTime.convertString((remainingTime), 1, TimeUnit.FIT)) + ".")); + return; + } + + info.addZoom(); + + if (zoomIn) + { + int newScale = info.getScale() - 1; + Location loc = player.getLocation(); + + int zoom = getZoom(newScale); + + info.setInfo(newScale, calcMapCenter(zoom, loc.getBlockX()), calcMapCenter(zoom, loc.getBlockZ())); + } + else + { + int newScale = info.getScale() + 1; + Location loc = player.getLocation(); + + int zoom = getZoom(newScale); + + info.setInfo(newScale, calcMapCenter(zoom, loc.getBlockX()), calcMapCenter(zoom, loc.getBlockZ())); + } + + showZoom(player, info); + } + + @EventHandler + public void teleportIn(PlayerCustomRespawnEvent event) + { + MapInfo info = new MapInfo(_mapId); + + Player player = event.getPlayer(); + Location loc = player.getLocation(); + + int zoom = getZoom(1); + + info.setInfo(1, calcMapCenter(zoom, loc.getBlockX()), calcMapCenter(zoom, loc.getBlockZ())); + _mapInfo.put(player.getName(), info); + setMap(player); + } + + @EventHandler + public void onQuit(PlayerQuitEvent event) + { + _mapInfo.remove(event.getPlayer().getName()); + } + + //@EventHandler + public void onServerTransfer(ServerTransferEvent event) + { + Player p = event.getPlayer(); + + p.sendMessage(C.cDRed + C.Bold + "WARNING!"); + p.sendMessage(C.cYellow + "There's a bug where switching servers will freeze the Clans Map!"); + p.sendMessage(C.cYellow + "If you want to play on Clans again, rejoin the Mineplex server!"); + } + + private void rebuildScan() + { + for (int x = -HALF_WORLD_SIZE; x < HALF_WORLD_SIZE; x += BLOCK_SCAN_INTERVAL) + { + for (int z = -HALF_WORLD_SIZE - 16; z < HALF_WORLD_SIZE; z += (z < -HALF_WORLD_SIZE ? 16 : BLOCK_SCAN_INTERVAL)) + { + _scanList.add(new HashMap.SimpleEntry<>(x, z)); + } + } + + Collections.sort(_scanList, _comparator); + } + + @EventHandler + public void recenterMap(UpdateEvent event) + { + if (event.getType() != UpdateType.SEC) + { + return; + } + + for (Player player : Bukkit.getOnlinePlayers()) + { + MapInfo info = getMap(player); + + if (info == null || info.getScale() >= 3) + { + continue; + } + + Location l = player.getLocation(); + int zoom = getZoom(info.getScale()); + + double mapX = (l.getX() - info.getX()) / zoom; + double mapZ = (l.getZ() - info.getZ()) / zoom; + + if (Math.abs(mapX) > 22 || Math.abs(mapZ) > 22) + { + int newX = calcMapCenter(zoom, l.getBlockX()); + int newZ = calcMapCenter(zoom, l.getBlockZ()); + + if (Math.abs(mapX) > 22 ? newX != info.getX() : newZ != info.getZ()) + { + info.setInfo(newX, newZ); + } + } + } + } + + @EventHandler + public void renderMap(UpdateEvent event) + { + if (event.getType() != UpdateType.FAST) + return; + + if (_scanList.isEmpty() && UtilServer.getPlayers().length > 0) + { + rebuildScan(); + } + + if (_scanList.size() % 20 == 0) + { + Collections.sort(_scanList, _comparator); + } + + if (_scanList.isEmpty()) + { + return; + } + + Entry entry = _scanList.remove(0); + + int startingX = entry.getKey(); + int startingZ = entry.getValue(); + + boolean outsideMap = startingZ < -HALF_WORLD_SIZE; + + scanWorldMap(startingX, startingZ, !outsideMap, false); + + if (outsideMap) + return; + + for (int scale = 1; scale < _scale.size(); scale++) + { + drawWorldScale(scale, startingX, startingZ); + colorWorldHeight(scale, startingX, startingZ); + } + + colorWorldHeight(0, startingX, startingZ); + } + + + // Let's not create hundreds of thousands of BlockPositions + // Single thread = should be thread safe + private BlockPosition.MutableBlockPosition _blockPosition = new BlockPosition.MutableBlockPosition(); + + // Maps the cached chunks which were loaded from disk to save IO operations + private LongObjectHashMap _chunkCache = new LongObjectHashMap<>(); + + /* + * Remove the cached chunks when the real chunks are loaded in + */ + @EventHandler(ignoreCancelled = true, priority = EventPriority.MONITOR) + public void LoadChunk(ChunkLoadEvent event) + { + _chunkCache.remove(LongHash.toLong(event.getChunk().getX(), event.getChunk().getZ())); + } + + /* + * Given a particular coordinate, this method will scan up to BLOCK_SCAN_INTERVAL and record the color of ever 16th block + * If a chunk has not been loaded, the following steps will be taken: + * * Attempt to load the chunk from disk. + * * If the chunk could not be loaded, generate it froms scratch + * Otherwise, the loaded chunk will be used + */ + public void scanWorldMap(int startingX, int startingZ, boolean setColors, boolean isFirstScan) + { + Byte[][] map = _map.get(0); + for (int beginX = startingX; beginX < startingX + BLOCK_SCAN_INTERVAL; beginX += 16) + { + for (int beginZ = startingZ - (startingZ > -HALF_WORLD_SIZE ? 16 : 0); beginZ < startingZ + + (setColors ? BLOCK_SCAN_INTERVAL : 16); beginZ += 16) + { + int chunkX = beginX / 16; + int chunkZ = beginZ / 16; + net.minecraft.server.v1_8_R3.Chunk nmsChunk = _chunkProviderServer.getChunkIfLoaded(chunkX, chunkZ); + if (nmsChunk == null) + { + long key = LongHash.toLong(chunkX, chunkZ); + nmsChunk = _chunkCache.get(key); + if (nmsChunk == null) + { + if (!isFirstScan) + { + continue; + } + try + { + Object[] data = _chunkRegionLoader.loadChunk(_nmsWorld, chunkX, chunkZ); + if (data == null) + { + // Something is wrong with the chunk + System.out.println("Chunk is not generated or missing level/block data. Regenerating (" + chunkX + "," + chunkZ + ")"); + nmsChunk = ((CraftChunk) _world.getChunkAt(chunkX, chunkZ)).getHandle(); + } + else + { + nmsChunk = (net.minecraft.server.v1_8_R3.Chunk) data[0]; + } + } + catch (IOException e) + { + throw new RuntimeException("Chunk is corrupt or not readable!", e); + } + _chunkCache.put(key, nmsChunk); + } + } + + if (!nmsChunk.isEmpty()) + { + for (int x = beginX; x < beginX + 16; x++) + { + for (int z = beginZ; z < beginZ + 16; z++) + { + int color = 0; + + int k3 = x & 0xF; + int l3 = z & 0xF; + + int l4 = nmsChunk.b(k3, l3) + 1; + IBlockData iblockdata = Blocks.AIR.getBlockData(); + + if (l4 > 1) + { + do + { + l4--; + _blockPosition.c(k3, l4, l3); + iblockdata = nmsChunk.getBlockData(_blockPosition); + } + while (iblockdata.getBlock().g(iblockdata) == MaterialMapColor.b && (l4 > 0)); + + if ((l4 > 0) && (iblockdata.getBlock().getMaterial().isLiquid())) + { + int j5 = l4 - 1; + Block block1; + do + { + _blockPosition.c(k3, j5--, l3); + block1 = nmsChunk.getType(_blockPosition); + } + while ((j5 > 0) && (block1.getMaterial().isLiquid())); + } + } + + _heightMap[x + HALF_WORLD_SIZE + 16][z + HALF_WORLD_SIZE + 16] = l4; + + if (setColors) + { + //color = block.f(i5).M; + _blockPosition.c(k3, l4, l3); + IBlockData data = nmsChunk.getBlockData(_blockPosition); + color = data.getBlock().g(data).M; + + color = (byte) ((color * 4) + 1); + } + + if (setColors && beginZ >= startingZ) + { + map[x + HALF_WORLD_SIZE][z + HALF_WORLD_SIZE] = (byte) color; + } + } + } + } + } + } + } + + public void setMap(Player player) + { + for (ItemStack item : UtilInv.getItems(player)) + { + if (isItemClansMap(item)) + { + return; + } + } + + ItemStack item = new ItemBuilder(Material.MAP, 1, (short) getMap(player).getMap()).setTitle(C.cGreen + "World Map").build(); + + int slot = CLANS_MAP_SLOT; + + ItemStack mapSlot = player.getInventory().getItem(slot); + if (mapSlot != null && mapSlot.getType() != Material.AIR) + { + slot = player.getInventory().firstEmpty(); + } + + if (slot >= 0) + { + player.getInventory().setItem(slot, item); + } + } + + /* + * Displays the action bar to a player given their zoom level. Implementation may change + */ + private void showZoom(Player player, MapInfo info) + { + UtilTextBottom.display(ZOOM_INFO[info.getScale()], player); + } + + /* + * Check whether an {@link ItemStack} is also a Clans Map + * + * @param itemStack The {@link ItemStack} to check + * @returns Whether the {@link ItemStack} is also a Clans Map + */ + private boolean isItemClansMap(ItemStack itemStack) + { + return UtilItem.matchesMaterial(itemStack, Material.MAP) + && itemStack.getDurability() >= _mapId + && itemStack.getDurability() <= _mapId + 100; + } + + @Override + public void addCommands() + { + addCommand(new MapCommand(this)); + } +} diff --git a/Plugins/mineplex-game-gemhunters/src/mineplex/gemhunters/map/ItemMapRenderer.java b/Plugins/mineplex-game-gemhunters/src/mineplex/gemhunters/map/ItemMapRenderer.java new file mode 100644 index 000000000..8c1e4f865 --- /dev/null +++ b/Plugins/mineplex-game-gemhunters/src/mineplex/gemhunters/map/ItemMapRenderer.java @@ -0,0 +1,294 @@ +package mineplex.gemhunters.map; + +import java.awt.Color; +import java.util.Set; +import java.util.UUID; + +import org.bukkit.Bukkit; +import org.bukkit.Location; +import org.bukkit.entity.Player; +import org.bukkit.map.MapCanvas; +import org.bukkit.map.MapCursor; +import org.bukkit.map.MapCursorCollection; +import org.bukkit.map.MapPalette; +import org.bukkit.map.MapRenderer; +import org.bukkit.map.MapView; + +import mineplex.core.Managers; +import mineplex.core.common.util.UtilTime; +import mineplex.core.party.Party; +import mineplex.core.party.PartyManager; +import mineplex.gemhunters.loot.LootModule; +import mineplex.gemhunters.safezone.SafezoneModule; +import mineplex.gemhunters.supplydrop.SupplyDrop; +import mineplex.gemhunters.supplydrop.SupplyDropModule; +import mineplex.gemhunters.worldevent.WorldEvent; +import mineplex.gemhunters.worldevent.WorldEventModule; + +/** + * All item map code was adapted from Clans.
+ */ +public class ItemMapRenderer extends MapRenderer +{ + + private static final int RENDER_COOLDOWN = 10000; + private static final int STANDARD_Y = 70; + + private final ItemMapModule _itemMap; + private final LootModule _loot; + private final SafezoneModule _safezone; + private final SupplyDropModule _supply; + private final WorldEventModule _worldEvent; + + private final PartyManager _party; + + public ItemMapRenderer() + { + super(true); + + _itemMap = Managers.require(ItemMapModule.class); + _loot = Managers.require(LootModule.class); + _safezone = Managers.require(SafezoneModule.class); + _supply = Managers.require(SupplyDropModule.class); + _worldEvent = Managers.require(WorldEventModule.class); + _party = Managers.require(PartyManager.class); + } + + @Override + public void render(MapView mapView, MapCanvas canvas, Player player) + { + try + { + renderNormalMap(mapView, canvas, player); + } + catch (Throwable t) + { + System.out.println("Error while rendering map"); + t.printStackTrace(); + } + } + + private void renderNormalMap(MapView mapView, MapCanvas canvas, Player player) + { + MapInfo info = _itemMap.getMap(player); + + if (info == null) + { + return; + } + + int scale = info.getScale(); + int zoom = _itemMap.getZoom(scale); + + Byte[][] map = _itemMap.getMap(scale); + + int centerX = info.getX() / zoom; + int centerZ = info.getZ() / zoom; + + // We have this cooldown to squeeze out every single bit of performance + // from the server. + if (UtilTime.elapsed(info.getLastRendered(), RENDER_COOLDOWN)) + { + info.setLastRendered(); + + for (int mapX = 0; mapX < 128; mapX++) + { + for (int mapZ = 0; mapZ < 128; mapZ++) + { + int blockX = centerX + (mapX - 64); + int blockZ = centerZ + (mapZ - 64); + + int pixelX = blockX + (map.length / 2); + int pixelZ = blockZ + (map.length / 2); + + Byte color; + + if (!(pixelX < 0 || pixelZ < 0 || pixelX >= map.length || pixelZ >= map.length) && map[pixelX][pixelZ] != null) + { + color = map[pixelX][pixelZ]; + + blockX *= zoom; + blockZ *= zoom; + + Location location = new Location(mapView.getWorld(), blockX, STANDARD_Y, blockZ); + + boolean safezone = _safezone.isInSafeZone(location); + + if (safezone) + { + boolean colorAll = scale > 0; + Color areaColor = Color.GREEN; + + if (areaColor != null) + { + if (!((color <= -113 || color >= 0) && color <= 127)) + { + color = (byte) 0; + System.out.println(String.format("Tried to draw invalid color %s, player: %s, mapX: %s, mapZ: %s", color, player.getName(), mapX, mapZ)); + } + else + { + // int chunkBX = blockX & 0xF; + // int chunkBZ = blockZ & 0xF; + + // Border + if (_safezone.isInSafeZone(new Location(mapView.getWorld(), blockX - 1, STANDARD_Y, blockZ)) || _safezone.isInSafeZone(new Location(mapView.getWorld(), blockX, STANDARD_Y, blockZ - 1)) || _safezone.isInSafeZone(new Location(mapView.getWorld(), blockX + 16, STANDARD_Y, blockZ)) || _safezone.isInSafeZone(new Location(mapView.getWorld(), blockX, STANDARD_Y, blockZ + 1))) + { + Color cColor = MapPalette.getColor(color); + double clans = colorAll ? 1 : 0.8; + double base = 1 - clans; + + int r = (int) ((cColor.getRed() * base) + (areaColor.getRed() * clans)); + int b = (int) ((cColor.getBlue() * base) + (areaColor.getBlue() * clans)); + int g = (int) ((cColor.getGreen() * base) + (areaColor.getGreen() * clans)); + + color = MapPalette.matchColor(r, g, b); + } + + // Inside + else + { + Color cColor = MapPalette.getColor(color); + + double clans = 0.065; + + // Stripes + // boolean checker = (mapX + (mapZ % 4)) + // % 4 == 0; + double base = 1 - clans; + + int r = (int) ((cColor.getRed() * base) + (areaColor.getRed() * clans)); + int b = (int) ((cColor.getBlue() * base) + (areaColor.getBlue() * clans)); + int g = (int) ((cColor.getGreen() * base) + (areaColor.getGreen() * clans)); + + color = MapPalette.matchColor(r, g, b); + } + } + } + } + } + else + { + color = (byte) 0; + } + + canvas.setPixel(mapX, mapZ, color); + } + } + } + + if (info.isSendMap()) + { + player.sendMap(mapView); + } + + MapCursorCollection cursors = canvas.getCursors(); + + while (cursors.size() > 0) + { + cursors.removeCursor(cursors.getCursor(0)); + } + + for (WorldEvent event : _worldEvent.getActiveEvents()) + { + if (!event.isInProgress() || event.getEventLocations() == null) + { + continue; + } + + for (Location point : event.getEventLocations()) + { + double mapX = (point.getX() - info.getX()) / zoom; + double mapZ = (point.getZ() - info.getZ()) / zoom; + + // To make these appear at the edges of the map, just change it + // from + // 64 to something like 128 for double the map size + if (mapX > -64 && mapX < 64 && mapZ > -64 && mapZ < 64) + { + byte b0 = (byte) (int) Math.min(127, (double) (mapX * 2.0F) + 0.5D); + byte b1 = (byte) (int) Math.max(-127, (double) (mapZ * 2.0F) + 0.5D); + + byte cursorType = 5; // http://i.imgur.com/wpH6PT8.png + // Those are byte 5 and 6 + byte rotation = (byte) (int) ((point.getYaw() * 16D) / 360D); + + MapCursor cursor = new MapCursor(b0, b1, (byte) (rotation & 0xF), cursorType, true); + + cursors.addCursor(cursor); + } + } + } + + SupplyDrop supplyDrop = _supply.getActive(); + + if (_supply.isActive()) + { + Location point = supplyDrop.getCurrentLocation(); + double mapX = (point.getX() - info.getX()) / zoom; + double mapZ = (point.getZ() - info.getZ()) / zoom; + + // To make these appear at the edges of the map, just change it from + // 64 to something like 128 for double the map size + if (mapX > -64 && mapX < 64 && mapZ > -64 && mapZ < 64) + { + byte b0 = (byte) (int) Math.min(127, (double) (mapX * 2.0F) + 0.5D); + byte b1 = (byte) (int) Math.max(-127, (double) (mapZ * 2.0F) + 0.5D); + + byte cursorType = 4; // http://i.imgur.com/wpH6PT8.png + // Those are byte 5 and 6 + byte rotation = (byte) ((int) Math.floor(System.currentTimeMillis() / 1000D) % 16); + + MapCursor cursor = new MapCursor(b0, b1, rotation, cursorType, true); + + cursors.addCursor(cursor); + } + } + + Party party = _party.getPartyByPlayer(player); + Set shownPlayers = _loot.getShownPlayers(); + + for (Player other : Bukkit.getOnlinePlayers()) + { + if (player.canSee(other) && other.isValid()) + { + Location l = other.getLocation(); + + double mapX = (l.getX() - info.getX()) / zoom; + double mapZ = (l.getZ() - info.getZ()) / zoom; + + if (mapX > -64 && mapX < 64 && mapZ > -64 && mapZ < 64) + { + MapCursor.Type cursorDisplay = null; + + if (player.equals(other)) + { + cursorDisplay = MapCursor.Type.WHITE_POINTER; + } + else if (shownPlayers.contains(other.getUniqueId())) + { + cursorDisplay = MapCursor.Type.BLUE_POINTER; + } + else if (party != null && party.isMember(other)) + { + cursorDisplay = MapCursor.Type.GREEN_POINTER; + } + + if (cursorDisplay == null) + { + continue; + } + + byte b0 = (byte) (int) Math.min(127, (double) (mapX * 2.0F) + 0.5D); + byte b1 = (byte) (int) Math.max(-127, (double) (mapZ * 2.0F) + 0.5D); + + byte rotation = (byte) (int) ((l.getYaw() * 16D) / 360D); + + MapCursor cursor = new MapCursor(b0, b1, (byte) (rotation & 0xF), cursorDisplay.getValue(), true); + + cursors.addCursor(cursor); + } + } + } + } +} diff --git a/Plugins/mineplex-game-gemhunters/src/mineplex/gemhunters/map/MapInfo.java b/Plugins/mineplex-game-gemhunters/src/mineplex/gemhunters/map/MapInfo.java new file mode 100644 index 000000000..5af724e57 --- /dev/null +++ b/Plugins/mineplex-game-gemhunters/src/mineplex/gemhunters/map/MapInfo.java @@ -0,0 +1,124 @@ +package mineplex.gemhunters.map; + +import java.util.ArrayList; +import java.util.Iterator; +import java.util.List; + +import mineplex.core.common.util.UtilTime; + +public class MapInfo +{ + private int _scale; + private int _centerX; + private int _centerZ; + private long _lastRendered; + private boolean _sendMap; + private List _lastZooms = new ArrayList(); + private int _mapId; + + public MapInfo(int newId) + { + _mapId = newId; + } + + public int getMap() + { + return _mapId; + } + + public void setMap(int newId) + { + _mapId = newId; + } + + public boolean canZoom() + { + Iterator itel = _lastZooms.iterator(); + + while (itel.hasNext()) + { + long lastZoomed = itel.next(); + + if (UtilTime.elapsed(lastZoomed, 2500)) + { + itel.remove(); + } + } + + return _lastZooms.size() < 3; + } + + public void addZoom() + { + _lastZooms.add(System.currentTimeMillis()); + } + + public long getZoomCooldown() + { + long cooldown = 0; + + for (long zoomCooldown : _lastZooms) + { + if (cooldown == 0 || zoomCooldown < cooldown) + { + cooldown = zoomCooldown; + } + } + + return cooldown; + } + + public long getLastRendered() + { + return _lastRendered; + } + + public void setLastRendered() + { + _lastRendered = System.currentTimeMillis(); + } + + public void setInfo(int scale, int x, int z) + { + _lastRendered = 0; + _scale = scale; + _centerX = x; + _centerZ = z; + _sendMap = true; + } + + public void setInfo(int x, int z) + { + _lastRendered = 0; + _centerX = x; + _centerZ = z; + _sendMap = true; + } + + public boolean isSendMap() + { + if (_sendMap) + { + _sendMap = false; + return true; + } + + return false; + } + + public int getX() + { + return _centerX; + } + + public int getZ() + { + return _centerZ; + } + + public int getScale() + { + return _scale; + } + +} diff --git a/Plugins/mineplex-game-gemhunters/src/mineplex/gemhunters/map/command/MapCommand.java b/Plugins/mineplex-game-gemhunters/src/mineplex/gemhunters/map/command/MapCommand.java new file mode 100644 index 000000000..6464457ef --- /dev/null +++ b/Plugins/mineplex-game-gemhunters/src/mineplex/gemhunters/map/command/MapCommand.java @@ -0,0 +1,25 @@ +package mineplex.gemhunters.map.command; + +import org.bukkit.entity.Player; + +import mineplex.core.command.CommandBase; +import mineplex.core.common.Rank; +import mineplex.core.common.util.F; +import mineplex.gemhunters.map.ItemMapModule; + +public class MapCommand extends CommandBase +{ + + public MapCommand(ItemMapModule plugin) + { + super(plugin, Rank.ALL, "map", "getmap"); + } + + @Override + public void Execute(Player caller, String[] args) + { + caller.sendMessage(F.main(Plugin.getName(), "Giving you a new map.")); + Plugin.setMap(caller); + } + +} diff --git a/Plugins/mineplex-game-gemhunters/src/mineplex/gemhunters/moderation/ModerationModule.java b/Plugins/mineplex-game-gemhunters/src/mineplex/gemhunters/moderation/ModerationModule.java new file mode 100644 index 000000000..8d1c4baf4 --- /dev/null +++ b/Plugins/mineplex-game-gemhunters/src/mineplex/gemhunters/moderation/ModerationModule.java @@ -0,0 +1,132 @@ +package mineplex.gemhunters.moderation; + +import java.util.HashSet; +import java.util.Set; +import java.util.UUID; + +import org.bukkit.GameMode; +import org.bukkit.craftbukkit.v1_8_R3.entity.CraftPlayer; +import org.bukkit.entity.Player; +import org.bukkit.event.EventHandler; + +import mineplex.core.MiniPlugin; +import mineplex.core.ReflectivelyCreateMiniPlugin; +import mineplex.core.account.CoreClient; +import mineplex.core.account.CoreClientManager; +import mineplex.core.common.Rank; +import mineplex.core.common.util.F; +import mineplex.core.incognito.IncognitoManager; +import mineplex.core.incognito.events.IncognitoStatusChangeEvent; +import mineplex.core.teleport.event.MineplexTeleportEvent; +import mineplex.gemhunters.moderation.command.ModeratorModeCommand; +import mineplex.gemhunters.spawn.SpawnModule; +import mineplex.gemhunters.spawn.event.PlayerTeleportIntoMapEvent; + +@ReflectivelyCreateMiniPlugin +public class ModerationModule extends MiniPlugin +{ + + private final CoreClientManager _client; + private final IncognitoManager _incognito; + private final SpawnModule _spawn; + + private final Set _moderators; + + private ModerationModule() + { + super("Moderation"); + + _client = require(CoreClientManager.class); + _incognito = require(IncognitoManager.class); + _spawn = require(SpawnModule.class); + + _moderators = new HashSet<>(); + } + + @Override + public void addCommands() + { + addCommand(new ModeratorModeCommand(this)); + } + + @EventHandler + public void teleport(MineplexTeleportEvent event) + { + Player player = event.getPlayer(); + + if (isModerating(player) || isBypassing(player)) + { + return; + } + + enableModeratorMode(player); + } + + @EventHandler + public void vanish(IncognitoStatusChangeEvent event) + { + Player player = event.getPlayer(); + + if (isBypassing(player)) + { + return; + } + + if (isModerating(player) && !event.getNewState()) + { + disableModeratorMode(player); + } + else if (event.getNewState()) + { + enableModeratorMode(player); + } + } + + @EventHandler + public void mapTeleport(PlayerTeleportIntoMapEvent event) + { + Player player = event.getPlayer(); + + if (isBypassing(player) || !_incognito.Get(player).Status) + { + return; + } + + enableModeratorMode(player); + } + + public void enableModeratorMode(Player player) + { + player.sendMessage(F.main(_moduleName, "Enabled moderator mode.")); + player.setGameMode(GameMode.SPECTATOR); + player.getInventory().clear(); + + ((CraftPlayer) player).getHandle().spectating = true; + + _moderators.add(player.getUniqueId()); + } + + public void disableModeratorMode(Player player) + { + player.sendMessage(F.main(_moduleName, "Disabled moderator mode.")); + player.setGameMode(GameMode.SURVIVAL); + + ((CraftPlayer) player).getHandle().spectating = false; + + _spawn.teleportToSpawn(player); + + _moderators.remove(player.getUniqueId()); + } + + public boolean isModerating(Player player) + { + return _moderators.contains(player.getUniqueId()); + } + + public boolean isBypassing(Player player) + { + CoreClient client = _client.Get(player); + return client.GetRank().has(Rank.ADMIN); + } + +} diff --git a/Plugins/mineplex-game-gemhunters/src/mineplex/gemhunters/moderation/command/ModeratorModeCommand.java b/Plugins/mineplex-game-gemhunters/src/mineplex/gemhunters/moderation/command/ModeratorModeCommand.java new file mode 100644 index 000000000..6a2faa9ee --- /dev/null +++ b/Plugins/mineplex-game-gemhunters/src/mineplex/gemhunters/moderation/command/ModeratorModeCommand.java @@ -0,0 +1,31 @@ +package mineplex.gemhunters.moderation.command; + +import org.bukkit.entity.Player; + +import mineplex.core.command.CommandBase; +import mineplex.core.common.Rank; +import mineplex.gemhunters.moderation.ModerationModule; + +public class ModeratorModeCommand extends CommandBase +{ + + public ModeratorModeCommand(ModerationModule plugin) + { + super(plugin, Rank.HELPER, "modmode", "staffmode", "mm", "o"); + } + + @Override + public void Execute(Player caller, String[] args) + { + if (Plugin.isModerating(caller)) + { + Plugin.disableModeratorMode(caller); + } + else + { + Plugin.enableModeratorMode(caller); + } + } + + +} diff --git a/Plugins/mineplex-game-gemhunters/src/mineplex/gemhunters/mount/MountData.java b/Plugins/mineplex-game-gemhunters/src/mineplex/gemhunters/mount/MountData.java new file mode 100644 index 000000000..baf465e63 --- /dev/null +++ b/Plugins/mineplex-game-gemhunters/src/mineplex/gemhunters/mount/MountData.java @@ -0,0 +1,43 @@ +package mineplex.gemhunters.mount; + +import org.bukkit.entity.LivingEntity; + +import mineplex.core.gadget.gadgets.gamemodifiers.gemhunters.MountType; + +public class MountData +{ + + private MountType _mountType; + private LivingEntity _entity; + private long _cooldown; + + public void setMountType(MountType mountType) + { + _mountType = mountType; + } + + public MountType getMountType() + { + return _mountType; + } + + public void setEntity(LivingEntity entity) + { + _entity = entity; + } + + public LivingEntity getEntity() + { + return _entity; + } + + public void setCooldown(long cooldown) + { + _cooldown = cooldown; + } + + public long getCooldown() + { + return _cooldown; + } +} diff --git a/Plugins/mineplex-game-gemhunters/src/mineplex/gemhunters/mount/MountModule.java b/Plugins/mineplex-game-gemhunters/src/mineplex/gemhunters/mount/MountModule.java new file mode 100644 index 000000000..d75140941 --- /dev/null +++ b/Plugins/mineplex-game-gemhunters/src/mineplex/gemhunters/mount/MountModule.java @@ -0,0 +1,161 @@ +package mineplex.gemhunters.mount; + +import java.util.UUID; + +import org.bukkit.Material; +import org.bukkit.entity.EntityType; +import org.bukkit.entity.Horse; +import org.bukkit.entity.Horse.Color; +import org.bukkit.entity.Horse.Style; +import org.bukkit.entity.LivingEntity; +import org.bukkit.entity.Player; +import org.bukkit.entity.Tameable; +import org.bukkit.event.EventHandler; +import org.bukkit.event.player.PlayerInteractEvent; +import org.bukkit.inventory.ItemStack; + +import mineplex.core.MiniClientPlugin; +import mineplex.core.ReflectivelyCreateMiniPlugin; +import mineplex.core.common.util.F; +import mineplex.core.common.util.UtilEvent; +import mineplex.core.common.util.UtilEvent.ActionType; +import mineplex.core.gadget.GadgetManager; +import mineplex.core.gadget.gadgets.gamemodifiers.GameModifierType; +import mineplex.core.gadget.gadgets.gamemodifiers.gemhunters.GameModifierMount; +import mineplex.core.gadget.gadgets.gamemodifiers.gemhunters.MountType; +import mineplex.core.recharge.Recharge; +import mineplex.gemhunters.loot.LootItem; +import mineplex.gemhunters.loot.LootModule; + +@ReflectivelyCreateMiniPlugin +public class MountModule extends MiniClientPlugin +{ + + private static final String ITEM_METADATA = "MOUNT"; + + private final LootModule _loot; + private final GadgetManager _gadget; + + private MountModule() + { + super("Mount"); + + _loot = require(LootModule.class); + _gadget = require(GadgetManager.class); + } + + @Override + protected MountData addPlayer(UUID uuid) + { + return new MountData(); + } + + @EventHandler + public void playerInteract(PlayerInteractEvent event) + { + if (!UtilEvent.isAction(event, ActionType.R)) + { + return; + } + + Player player = event.getPlayer(); + ItemStack itemStack = player.getItemInHand(); + + if (itemStack == null) + { + return; + } + + LootItem lootItem = _loot.fromItemStack(itemStack); + + if (lootItem == null || lootItem.getMetadata() == null || !lootItem.getMetadata().startsWith(ITEM_METADATA)) + { + return; + } + + if (!Recharge.Instance.usable(player, _moduleName)) + { + return; + } + + int cooldown = Integer.parseInt(lootItem.getMetadata().split(" ")[1]) * 1000; + + spawnMount(player, cooldown); + } + + public void spawnMount(Player player, long cooldown) + { + GameModifierMount mount = ((GameModifierMount) _gadget.getActiveGameModifier(player, GameModifierType.GemHunters, g -> g != null)); + MountType mountType = null; + + if (mount != null) + { + mountType = mount.getMountType(); + } + + player.sendMessage(F.main(_moduleName, "Mounts are currently disabled.")); + //spawnMount(player, mountType, cooldown); + } + + public void spawnMount(Player player, MountType mountType, long cooldown) + { + MountData data = Get(player); + LivingEntity entity = data.getEntity(); + EntityType entityType = mountType == null ? EntityType.HORSE : mountType.getEntityType(); + + despawnMount(player); + + entity = (LivingEntity) player.getWorld().spawnEntity(player.getLocation().add(0, 1, 0), entityType); + + if (entity instanceof Tameable) + { + Tameable tameable = (Tameable) entity; + + tameable.setOwner(player); + } + + if (entity instanceof Horse) + { + Horse horse = (Horse) entity; + + horse.setAdult(); + horse.setAgeLock(true); + horse.setColor(Color.BROWN); + horse.setStyle(Style.NONE); + horse.setMaxDomestication(1); + horse.setJumpStrength(0.8); + horse.getInventory().setSaddle(new ItemStack(Material.SADDLE)); + horse.getInventory().setArmor(new ItemStack(player.getItemInHand().getType())); + } + + entity.setCustomName(player.getName() + "\'s Mount"); + entity.setCustomNameVisible(true); + entity.setCanPickupItems(false); + entity.setMaxHealth(40); + entity.setHealth(40); + + data.setEntity(entity); + data.setMountType(mountType); + data.setCooldown(cooldown); + + entity.setPassenger(player); + } + + public void despawnMount(Player player) + { + MountData data = Get(player); + LivingEntity entity = data.getEntity(); + + if (entity != null) + { + entity.remove(); + + Recharge.Instance.use(player, _moduleName, data.getCooldown(), true, false); + } + } + + public boolean isActive(Player player) + { + return Get(player).getEntity() != null; + } +} diff --git a/Plugins/mineplex-game-gemhunters/src/mineplex/gemhunters/mount/event/MountSpawnEvent.java b/Plugins/mineplex-game-gemhunters/src/mineplex/gemhunters/mount/event/MountSpawnEvent.java new file mode 100644 index 000000000..0414b020f --- /dev/null +++ b/Plugins/mineplex-game-gemhunters/src/mineplex/gemhunters/mount/event/MountSpawnEvent.java @@ -0,0 +1,6 @@ +package mineplex.gemhunters.mount.event; + +public class MountSpawnEvent +{ + +} diff --git a/Plugins/mineplex-game-gemhunters/src/mineplex/gemhunters/playerstatus/PlayerStatus.java b/Plugins/mineplex-game-gemhunters/src/mineplex/gemhunters/playerstatus/PlayerStatus.java new file mode 100644 index 000000000..7be184028 --- /dev/null +++ b/Plugins/mineplex-game-gemhunters/src/mineplex/gemhunters/playerstatus/PlayerStatus.java @@ -0,0 +1,44 @@ +package mineplex.gemhunters.playerstatus; + +import mineplex.core.common.util.UtilTime; + +public class PlayerStatus +{ + + private PlayerStatusType _statusType; + private long _start; + private long _length; + + public PlayerStatus(PlayerStatusType statusType) + { + this(statusType, -1); + } + + public PlayerStatus(PlayerStatusType statusType, long length) + { + _statusType = statusType; + _start = System.currentTimeMillis(); + _length = length; + } + + public PlayerStatusType getStatusType() + { + return _statusType; + } + + public long getStart() + { + return _start; + } + + public long getLength() + { + return _length; + } + + public boolean isDone() + { + return _length > 0 && UtilTime.elapsed(_start, _length); + } + +} diff --git a/Plugins/mineplex-game-gemhunters/src/mineplex/gemhunters/playerstatus/PlayerStatusModule.java b/Plugins/mineplex-game-gemhunters/src/mineplex/gemhunters/playerstatus/PlayerStatusModule.java new file mode 100644 index 000000000..77f8fbe1b --- /dev/null +++ b/Plugins/mineplex-game-gemhunters/src/mineplex/gemhunters/playerstatus/PlayerStatusModule.java @@ -0,0 +1,108 @@ +package mineplex.gemhunters.playerstatus; + +import java.util.UUID; +import java.util.concurrent.TimeUnit; + +import org.bukkit.Bukkit; +import org.bukkit.entity.Player; +import org.bukkit.event.EventHandler; +import org.bukkit.event.EventPriority; +import org.bukkit.event.entity.EntityDamageByEntityEvent; + +import mineplex.core.MiniClientPlugin; +import mineplex.core.ReflectivelyCreateMiniPlugin; +import mineplex.core.updater.UpdateType; +import mineplex.core.updater.event.UpdateEvent; +import mineplex.gemhunters.spawn.event.PlayerTeleportIntoMapEvent; + +@ReflectivelyCreateMiniPlugin +public class PlayerStatusModule extends MiniClientPlugin +{ + + private static final long COMBAT_TIME = TimeUnit.SECONDS.toMillis(30); + + private final PlayerStatus _default; + + public PlayerStatusModule() + { + super("Player Status"); + + _default = new PlayerStatus(PlayerStatusType.DANGER); + } + + @Override + protected PlayerStatus addPlayer(UUID uuid) + { + return _default; + } + + @EventHandler(priority = EventPriority.LOW) + public void update(UpdateEvent event) + { + if (event.getType() != UpdateType.FAST) + { + return; + } + + for (Player player : Bukkit.getOnlinePlayers()) + { + PlayerStatus status = Get(player); + + if (status.isDone()) + { + Set(player, _default); + } + } + } + + @EventHandler(priority = EventPriority.MONITOR) + public void entityDamage(EntityDamageByEntityEvent event) + { + if (event.isCancelled() || !(event.getEntity() instanceof Player)) + { + return; + } + + if (event.getDamager() instanceof Player) + { + setStatus((Player) event.getDamager(), PlayerStatusType.COMBAT, COMBAT_TIME); + } + + setStatus((Player) event.getEntity(), PlayerStatusType.COMBAT, COMBAT_TIME); + } + + @EventHandler + public void teleportMap(PlayerTeleportIntoMapEvent event) + { + setStatus(event.getPlayer(), PlayerStatusType.DANGER); + } + + public void setStatus(Player player, PlayerStatusType statusType) + { + setStatus(player, statusType, false); + } + + public void setStatus(Player player, PlayerStatusType statusType, long length) + { + setStatus(player, statusType, length, false); + } + + public void setStatus(Player player, PlayerStatusType statusType, boolean force) + { + setStatus(player, statusType, -1, force); + } + + public void setStatus(Player player, PlayerStatusType statusType, long length, boolean force) + { + PlayerStatus current = Get(player); + //Bukkit.broadcastMessage("Setting " + player.getName() + " -> " + statusType.getName() + " -> " + length); + + if (!force && current.getStatusType().hasPriority(statusType)) + { + return; + } + + Set(player, new PlayerStatus(statusType, length)); + } + +} diff --git a/Plugins/mineplex-game-gemhunters/src/mineplex/gemhunters/playerstatus/PlayerStatusType.java b/Plugins/mineplex-game-gemhunters/src/mineplex/gemhunters/playerstatus/PlayerStatusType.java new file mode 100644 index 000000000..8702de400 --- /dev/null +++ b/Plugins/mineplex-game-gemhunters/src/mineplex/gemhunters/playerstatus/PlayerStatusType.java @@ -0,0 +1,22 @@ +package mineplex.gemhunters.playerstatus; + +public enum PlayerStatusType +{ + + DANGER, + SAFE, + COLD, + WARM, + COMBAT; + + public String getName() + { + return name().charAt(0) + name().substring(1).toLowerCase(); + } + + public boolean hasPriority(PlayerStatusType other) + { + return ordinal() > other.ordinal(); + } + +} diff --git a/Plugins/mineplex-game-gemhunters/src/mineplex/gemhunters/quest/Quest.java b/Plugins/mineplex-game-gemhunters/src/mineplex/gemhunters/quest/Quest.java new file mode 100644 index 000000000..6ee6f826f --- /dev/null +++ b/Plugins/mineplex-game-gemhunters/src/mineplex/gemhunters/quest/Quest.java @@ -0,0 +1,161 @@ +package mineplex.gemhunters.quest; + +import java.util.HashMap; +import java.util.Map; +import java.util.UUID; + +import org.bukkit.entity.Player; +import org.bukkit.event.EventHandler; +import org.bukkit.event.Listener; +import org.bukkit.event.player.PlayerQuitEvent; + +import mineplex.core.Managers; +import mineplex.core.account.CoreClientManager; +import mineplex.core.common.currency.GlobalCurrency; +import mineplex.core.common.util.F; +import mineplex.core.common.util.UtilServer; +import mineplex.core.donation.DonationManager; +import mineplex.core.inventory.InventoryManager; +import mineplex.gemhunters.economy.EconomyModule; +import mineplex.gemhunters.world.WorldDataModule; + +public abstract class Quest implements Listener +{ + + private final int _id; + private final String _name; + private final String _description; + private final int _startCost; + private final int _completeReward; + + protected final QuestModule _quest; + protected final CoreClientManager _clientManager; + protected final DonationManager _donation; + protected final EconomyModule _economy; + protected final InventoryManager _inventory; + protected final WorldDataModule _worldData; + + private final Map _counter; + + public Quest(int id, String name, String description, int startCost, int completeReward) + { + _id = id; + _name = name; + _description = description; + _startCost = startCost; + _completeReward = completeReward; + + _quest = Managers.require(QuestModule.class); + _clientManager = Managers.require(CoreClientManager.class); + _donation = Managers.require(DonationManager.class); + _economy = Managers.require(EconomyModule.class); + _inventory = Managers.require(InventoryManager.class); + _worldData = Managers.require(WorldDataModule.class); + + _counter = new HashMap<>(); + + UtilServer.RegisterEvents(this); + } + + @EventHandler + public void playerQuit(PlayerQuitEvent event) + { + remove(event.getPlayer()); + } + + public void transfer(Player from, Player to) + { + // If the player has already been progressing this quest and is + // further than the other don't bother transferring their data. + if (get(to) >= get(from)) + { + return; + } + + set(to, get(from)); + } + + public void set(Player player, int amount) + { + _counter.put(player.getUniqueId(), amount); + } + + public int get(Player player) + { + return _counter.getOrDefault(player.getUniqueId(), 0); + } + + public int getAndIncrement(Player player, int amount) + { + int newAmount = get(player) + amount; + _counter.put(player.getUniqueId(), newAmount); + _quest.updateQuestItem(this, player); + + return newAmount; + } + + public void remove(Player player) + { + _counter.remove(player.getUniqueId()); + } + + public void onStart(Player player) + { + } + + public void onReward(Player player) + { + if (_completeReward > 0) + { + _economy.addToStore(player, "Completing " + F.elem(_name), _completeReward); + } + + remove(player); + _quest.completeQuest(this, player); + } + + public boolean isActive(Player player) + { + return _quest.isActive(this, player); + } + + public float getProgress(Player player) + { + return 0; + } + + public int getGoal() + { + return 1; + } + + public final int getId() + { + return _id; + } + + public final String getName() + { + return _name; + } + + public final String getDescription() + { + return _description; + } + + public final int getStartCost() + { + return _startCost; + } + + public final int getCompleteReward() + { + return _completeReward; + } + + public String getRewardString() + { + return F.currency(GlobalCurrency.GEM, _completeReward); + } +} diff --git a/Plugins/mineplex-game-gemhunters/src/mineplex/gemhunters/quest/QuestModule.java b/Plugins/mineplex-game-gemhunters/src/mineplex/gemhunters/quest/QuestModule.java new file mode 100644 index 000000000..a48e843d7 --- /dev/null +++ b/Plugins/mineplex-game-gemhunters/src/mineplex/gemhunters/quest/QuestModule.java @@ -0,0 +1,517 @@ +package mineplex.gemhunters.quest; + +import java.util.List; +import java.util.UUID; +import java.util.concurrent.TimeUnit; + +import org.bukkit.Bukkit; +import org.bukkit.Location; +import org.bukkit.Material; +import org.bukkit.entity.Entity; +import org.bukkit.entity.Item; +import org.bukkit.entity.Player; +import org.bukkit.event.EventHandler; +import org.bukkit.event.entity.PlayerDeathEvent; +import org.bukkit.event.player.PlayerCommandPreprocessEvent; +import org.bukkit.event.player.PlayerDropItemEvent; +import org.bukkit.event.player.PlayerJoinEvent; +import org.bukkit.event.player.PlayerPickupItemEvent; +import org.bukkit.inventory.ItemStack; +import org.bukkit.inventory.meta.ItemMeta; +import org.bukkit.metadata.FixedMetadataValue; + +import mineplex.core.MiniClientPlugin; +import mineplex.core.ReflectivelyCreateMiniPlugin; +import mineplex.core.common.currency.GlobalCurrency; +import mineplex.core.common.util.C; +import mineplex.core.common.util.F; +import mineplex.core.common.util.UtilInv; +import mineplex.core.common.util.UtilItem; +import mineplex.core.common.util.UtilItem.ItemAttribute; +import mineplex.core.common.util.UtilMath; +import mineplex.core.common.util.UtilTextMiddle; +import mineplex.core.common.util.UtilTime; +import mineplex.core.itemstack.ItemBuilder; +import mineplex.core.menu.Menu; +import mineplex.core.recharge.Recharge; +import mineplex.core.updater.UpdateType; +import mineplex.core.updater.event.UpdateEvent; +import mineplex.gemhunters.economy.EconomyModule; +import mineplex.gemhunters.quest.command.ResetQuestsCommand; +import mineplex.gemhunters.quest.types.ChestOpenerQuest; +import mineplex.gemhunters.quest.types.CraftingQuest; +import mineplex.gemhunters.quest.types.EnjoyTheViewQuest; +import mineplex.gemhunters.quest.types.GiveItemQuest; +import mineplex.gemhunters.quest.types.KillMostValuableQuest; +import mineplex.gemhunters.quest.types.KillPlayerQuest; +import mineplex.gemhunters.quest.types.LocationQuest; +import mineplex.gemhunters.quest.types.SamitoDQuest; +import mineplex.gemhunters.quest.types.SpecificChestOpenerQuest; +import mineplex.gemhunters.quest.types.WalkingQuest; +import mineplex.gemhunters.world.WorldDataModule; +import net.md_5.bungee.api.ChatColor; + +@ReflectivelyCreateMiniPlugin +public class QuestModule extends MiniClientPlugin +{ + + private static final int MAX_QUESTS = 5; + private static final long RESET_QUESTS_TIME = TimeUnit.MINUTES.toMillis(15); + private static final Material MATERIAL = Material.PAPER; + private static final String ITEM_METADATA = "quest"; + + // -1 for the reward dictates that the quest's reward will be handled by the subclass + private final Quest[] _quests = { + new ChestOpenerQuest(0, "Chest Opener", 100, 250, 5), + new ChestOpenerQuest(1, "Grand Chest Opener", 200, 500, 20), + new ChestOpenerQuest(2, "Superior Chest Opener", 500, 750, 40), + + new SamitoDQuest(3, "Give to the Homeless", "Donate " + F.count("10") + " gems to the Hobo.", 100, 300, 10), + + new KillPlayerQuest(4, "Mercenary", 50, -1, 5, "Mythical Chest"), + new KillPlayerQuest(5, "Warrior", 100, -1, 10, "Illuminated Chest"), + new KillPlayerQuest(6, "Slayer", 250, -1, 25, "Omega Chest"), + //new KillPlayerQuest(7, "Ruthless", 1000, -1, 50, "Rank Upgrade"), + + new LocationQuest(8, "Vision Quest", "Climb the tallest mountain.", 100, 300, "TALL_MOUNTAIN"), + new LocationQuest(9, "Emergency Medi-Vac", "Get to the helicopter on the roof of the hospital.", 50, 150, "HOSPITAL_HELI"), + + new SpecificChestOpenerQuest(10, "Treasure Hunter", "Open " + F.count("1") + " Legendary Chest.", 100, 5000, "PURPLE", 1), + new SpecificChestOpenerQuest(11, "Resupply", "Open a Supply Drop.", 100, 500, "RED", 1), + + new EnjoyTheViewQuest(12, 25, 100), + + new GiveItemQuest(13, "Waiter", "5 apples", 300, 750, new ItemStack(Material.APPLE), 5), + new GiveItemQuest(14, "The Golden Apple", "a Golden Apple", 200, 3000, new ItemStack(Material.GOLDEN_APPLE), 1), + + new WalkingQuest(15, "Going for a walk", "Go on a journey of " + F.count("1000") + " blocks.", 100, -1, 1000, Material.GOLD_BARDING), + new WalkingQuest(16, "Going on a journey", "Go on a journey of " + F.count("5000") + " blocks.", 200, -1, 5000, Material.DIAMOND_BARDING), + + new KillMostValuableQuest(17, "Equality", "Slay the most valuable player in the game.", 100, 1500), + + new CraftingQuest(18, "Light em up", "Craft " + F.count("5 Torches"), 25, 250, Material.TORCH, 5) + }; + + private final EconomyModule _economy; + private final WorldDataModule _worldData; + + private QuestModule() + { + super("Quest"); + + _economy = require(EconomyModule.class); + _worldData = require(WorldDataModule.class); + + Menu menu = new QuestUI(this); + + runSyncLater(() -> + { + + for (Location location : _worldData.getCustomLocation("QUEST_NPC")) + { + new QuestNPC(this, location, menu); + } + + }, 20); + } + + @Override + public void addCommands() + { + addCommand(new ResetQuestsCommand(this)); + } + + @Override + protected QuestPlayerData addPlayer(UUID uuid) + { + return new QuestPlayerData(); + } + + @EventHandler + public void playerJoin(PlayerJoinEvent event) + { + updateQuests(event.getPlayer()); + } + + @EventHandler + public void update(UpdateEvent event) + { + if (event.getType() != UpdateType.SLOW) + { + return; + } + + for (Player player : Bukkit.getOnlinePlayers()) + { + QuestPlayerData playerData = Get(player); + + if (!UtilTime.elapsed(playerData.getLastClear(), RESET_QUESTS_TIME)) + { + continue; + } + + if (playerData.getLastClear() != 0) + { + player.sendMessage(F.main(C.cYellowB + "Quest Master", "I have " + F.count(String.valueOf(MAX_QUESTS)) + " new quests for you! Come and see me to start them!")); + } + + playerData.clear(); + updateQuests(player); + } + } + + @EventHandler + public void pickupItem(PlayerPickupItemEvent event) + { + if (event.isCancelled()) + { + return; + } + + Item item = event.getItem(); + Player player = event.getPlayer(); + Quest quest = fromItemStack(event.getItem().getItemStack()); + + if (quest == null) + { + return; + } + + if (!item.hasMetadata(ITEM_METADATA)) + { + return; + } + + if (!Recharge.Instance.use(event.getPlayer(), "Quest Pickup " + quest.getId(), 2000, false, false)) + { + event.setCancelled(true); + return; + } + + boolean able = startQuest(quest, player, false); + + if (!able) + { + event.setCancelled(true); + } + else + { +// UUID owner = UUID.fromString(item.getMetadata(ITEM_METADATA).get(0).asString()); +// Player other = UtilPlayer.searchExact(owner); + + event.getItem().remove(); + event.setCancelled(true); + /* + * Noting here that when a player leaves their quest progress is removed. + * However that means that if a new player picks up their quest item we + * run into a problem where that will be null. Thus the progress on that + * quest is lost. + * More complications are added when a player quits out and their NPC is + * there instead until they finally really really quit out. + * This is one massive headache in order to keep quests alive while not + * running into some serious memory leaks. + * Furthermore the time complications of this project mean that there isn't + * enough time right now to implement this (however a enough time for me + * to type this lengthy comment about it). So in true style I'm cutting + * corners and saying that if a player quits out then don't allow other + * players to be able to pickup the quest. + */ + } + } + + @EventHandler + public void dropItem(PlayerDropItemEvent event) + { + if (event.isCancelled()) + { + return; + } + + Player player = event.getPlayer(); + Quest quest = fromItemStack(event.getItemDrop().getItemStack()); + + if (quest == null) + { + return; + } + + cancelQuest(quest, player); + handleDroppedQuest(event.getItemDrop(), player); + } + + public void handleDroppedQuest(Item item, Player player) + { + item.setMetadata(ITEM_METADATA, new FixedMetadataValue(_plugin, player.getUniqueId().toString())); + } + + @EventHandler + public void playerDeath(PlayerDeathEvent event) + { + Get(event.getEntity()).clear(true); + } + + public void updateQuests(Player player) + { + QuestPlayerData playerData = Get(player); + List quests = playerData.getPossibleQuests(); + + for (int i = 0; i < MAX_QUESTS; i++) + { + Quest quest = getRandomQuest(playerData, player); + + if (quest == null) + { + player.sendMessage(F.main(_moduleName, "It seems that there was some trouble finding you a new quest. Please try again later.")); + return; + } + + quests.add(quest.getId()); + } + } + + public boolean startQuest(Quest quest, Player player, boolean applyCost) + { + if (isActive(quest, player)) + { + player.sendMessage(F.main(_moduleName, "You have already accepted that quest.")); + return false; + } + else if (isComplete(quest, player)) + { + player.sendMessage(F.main(_moduleName, "You have already completed that quest.")); + return false; + } + else if (!UtilInv.hasSpace(player, 1)) + { + player.sendMessage(F.main(_moduleName, "You do not have enough space in your inventory to start this quest.")); + return false; + } + else if (applyCost && _economy.Get(player) < quest.getStartCost()) + { + player.sendMessage(F.main(_moduleName, "You do not have enough gems to start this quest.")); + return false; + } + + player.sendMessage(F.main(_moduleName, "Started " + F.name(quest.getName()) + ".")); + + QuestPlayerData playerData = Get(player); + playerData.getActiveQuests().add(quest.getId()); + + updateQuestItem(quest, player); + + quest.onStart(player); + + if (applyCost) + { + _economy.removeFromStore(player, quest.getStartCost()); + } + return true; + } + + public void completeQuest(Quest quest, Player player) + { + if (!isActive(quest, player)) + { + player.sendMessage(F.main(_moduleName, "This quest is not active for you.")); + return; + } + + player.sendMessage(F.main(_moduleName, "Completed " + F.name(quest.getName()) + ".")); + + QuestPlayerData playerData = Get(player); + playerData.getActiveQuests().remove(Integer.valueOf(quest.getId())); + playerData.getCompletedQuests().add(quest.getId()); + + updateQuestItem(quest, player); + } + + public void cancelQuest(Quest quest, Player player) + { + if (!isActive(quest, player)) + { + player.sendMessage(F.main(_moduleName, "This quest is not active for you.")); + return; + } + + player.sendMessage(F.main(_moduleName, "Dropped " + F.name(quest.getName()) + ".")); + + QuestPlayerData playerData = Get(player); + playerData.getActiveQuests().remove(Integer.valueOf(quest.getId())); + } + + public Quest getRandomQuest(QuestPlayerData playerData, Player player) + { + int attempts = 0; + + while (attempts < _quests.length * 2) + { + attempts++; + + int index = UtilMath.r(_quests.length); + Quest quest = _quests[index]; + + if (isActive(quest, player) || isPossible(quest, player)) + { + continue; + } + + return quest; + } + + return null; + } + + public ItemStack getItemStack(Quest quest, Player player, boolean npc, boolean hasSpace, boolean hasGems) + { + ItemBuilder builder = new ItemBuilder(MATERIAL); + + builder.setTitle(C.cGreen + quest.getName()); + builder.addLore(C.blankLine, quest.getDescription(), C.blankLine); + + boolean active = isActive(quest, player); + boolean complete = isComplete(quest, player); + + if (npc) + { + if (active) + { + builder.setGlow(true); + builder.addLore(C.cRed + "You have already started this quest!"); + } + else if (complete) + { + builder.addLore(C.cRed + "You have already completed this quest!"); + } + else if (!hasGems) + { + builder.addLore(C.cRed + "You do not have enough gems to start this quest!"); + } + else if (hasSpace) + { + builder.addLore(C.cGreen + "Click to start this quest!"); + } + else + { + builder.addLore(C.cRed + "You do not have enough space in your inventory!"); + } + } + else + { + String progress = C.mBody + "[" + C.cGreen + quest.get(player) + C.mBody + "/" + C.cGreen + quest.getGoal() + C.mBody + "]"; + + builder.addLore(UtilTextMiddle.progress(quest.getProgress(player)) + C.mBody + " " + progress); + } + + builder.addLore("", "Cost: " + F.currency(GlobalCurrency.GEM, quest.getStartCost()), "Reward: " + quest.getRewardString()); + + return builder.build(); + } + + public Quest fromItemStack(ItemStack itemStack) + { + Material material = itemStack.getType(); + ItemMeta meta = itemStack.getItemMeta(); + + if (material != MATERIAL || meta == null || !meta.hasLore()) + { + return null; + } + + String name = ChatColor.stripColor(meta.getDisplayName()); + + for (Quest quest : _quests) + { + if (!quest.getName().equals(name)) + { + continue; + } + + return quest; + } + + return null; + } + + public void updateQuestItem(Quest quest, Player player) + { + ItemStack itemStack = getItemStack(quest, player, false, true, true); + + for (ItemStack items : player.getInventory().getContents()) + { + if (UtilItem.isSimilar(itemStack, items, ItemAttribute.NAME, ItemAttribute.MATERIAL, ItemAttribute.DATA, ItemAttribute.AMOUNT)) + { + player.getInventory().remove(items); + } + } + + if (isActive(quest, player)) + { + player.getInventory().addItem(itemStack); + } + } + + public boolean isPossible(Quest quest, Player player) + { + return Get(player).getPossibleQuests().contains(quest.getId()); + } + + public boolean isActive(Quest quest, Player player) + { + return Get(player).getActiveQuests().contains(quest.getId()); + } + + public boolean isComplete(Quest quest, Player player) + { + return Get(player).getCompletedQuests().contains(quest.getId()); + } + + public Quest getFromId(int id) + { + for (Quest quest : _quests) + { + if (quest.getId() == id) + { + return quest; + } + } + + return null; + } + + public void setPlayerData(Player player, QuestPlayerData playerData) + { + Set(player, playerData); + } + + public boolean isQuestNPC(Entity entity) + { + return entity.hasMetadata("quest_npc"); + } + + @EventHandler + public void debug(PlayerCommandPreprocessEvent event) + { + if (event.getMessage().startsWith("/test")) + { + event.setCancelled(true); + Player player = event.getPlayer(); + + QuestPlayerData playerData = Get(player); + + for (int i : playerData.getPossibleQuests()) + { + player.sendMessage("P: " + i); + } + + for (int i : playerData.getActiveQuests()) + { + player.sendMessage("A: " + i); + } + + for (int i : playerData.getCompletedQuests()) + { + player.sendMessage("C: " + i); + } + } + } +} diff --git a/Plugins/mineplex-game-gemhunters/src/mineplex/gemhunters/quest/QuestNPC.java b/Plugins/mineplex-game-gemhunters/src/mineplex/gemhunters/quest/QuestNPC.java new file mode 100644 index 000000000..6594d1517 --- /dev/null +++ b/Plugins/mineplex-game-gemhunters/src/mineplex/gemhunters/quest/QuestNPC.java @@ -0,0 +1,47 @@ +package mineplex.gemhunters.quest; + +import org.bukkit.Location; +import org.bukkit.entity.Villager; +import org.bukkit.entity.Villager.Profession; +import org.bukkit.event.EventHandler; +import org.bukkit.event.EventPriority; +import org.bukkit.event.player.PlayerInteractEntityEvent; +import org.bukkit.metadata.FixedMetadataValue; + +import mineplex.core.common.util.C; +import mineplex.core.menu.Menu; +import mineplex.gemhunters.util.SimpleNPC; + +public class QuestNPC extends SimpleNPC +{ + + private Menu _questMenu; + + public QuestNPC(QuestModule quest, Location spawn, Menu menu) + { + super(quest.getPlugin(), spawn, Villager.class, C.cGreenB + "NEW - " + C.cYellowB + "Quest Master" + C.cGreenB + " - NEW", null); + + _questMenu = menu; + _entity.setMetadata("quest_npc", new FixedMetadataValue(quest.getPlugin(), true)); + + Villager villager = (Villager) _entity; + + villager.setProfession(Profession.LIBRARIAN); + } + + @Override + @EventHandler(priority = EventPriority.HIGH) + public void npcClick(PlayerInteractEntityEvent event) + { + if (event.isCancelled() || !event.getRightClicked().equals(_entity)) + { + return; + } + + event.setCancelled(true); + + //event.getPlayer().sendMessage(F.main("Quest", "The Quest Master is currently disabled but will be available to all players shortly.")); + _questMenu.open(event.getPlayer()); + } + +} diff --git a/Plugins/mineplex-game-gemhunters/src/mineplex/gemhunters/quest/QuestPlayerData.java b/Plugins/mineplex-game-gemhunters/src/mineplex/gemhunters/quest/QuestPlayerData.java new file mode 100644 index 000000000..7a2d5a758 --- /dev/null +++ b/Plugins/mineplex-game-gemhunters/src/mineplex/gemhunters/quest/QuestPlayerData.java @@ -0,0 +1,65 @@ +package mineplex.gemhunters.quest; + +import java.util.ArrayList; +import java.util.List; + +public class QuestPlayerData +{ + + private final List _possibleQuests; + private final List _activeQuests; + private final List _completedQuests; + + private long _lastClear; + + public QuestPlayerData() + { + _possibleQuests = new ArrayList<>(); + _activeQuests = new ArrayList<>(); + _completedQuests = new ArrayList<>(); + + _lastClear = System.currentTimeMillis(); + } + + public void clear() + { + clear(false); + } + + public void clear(boolean active) + { + _possibleQuests.clear(); + _completedQuests.clear(); + + if (active) + { + _activeQuests.clear(); + _lastClear = 0; + } + else + { + _lastClear = System.currentTimeMillis(); + } + } + + public List getPossibleQuests() + { + return _possibleQuests; + } + + public List getActiveQuests() + { + return _activeQuests; + } + + public List getCompletedQuests() + { + return _completedQuests; + } + + public long getLastClear() + { + return _lastClear; + } + +} diff --git a/Plugins/mineplex-game-gemhunters/src/mineplex/gemhunters/quest/QuestUI.java b/Plugins/mineplex-game-gemhunters/src/mineplex/gemhunters/quest/QuestUI.java new file mode 100644 index 000000000..44e957814 --- /dev/null +++ b/Plugins/mineplex-game-gemhunters/src/mineplex/gemhunters/quest/QuestUI.java @@ -0,0 +1,66 @@ +package mineplex.gemhunters.quest; + +import org.bukkit.entity.Player; +import org.bukkit.event.inventory.ClickType; +import org.bukkit.inventory.ItemStack; + +import mineplex.core.Managers; +import mineplex.core.common.util.UtilInv; +import mineplex.core.common.util.UtilUI; +import mineplex.core.menu.Button; +import mineplex.core.menu.Menu; +import mineplex.gemhunters.economy.EconomyModule; + +public class QuestUI extends Menu +{ + + private final EconomyModule _economy; + + public QuestUI(QuestModule plugin) + { + super("Quest Master", plugin); + + _economy = Managers.require(EconomyModule.class); + } + + @Override + protected Button[] setUp(Player player) + { + Button[] buttons = new Button[21]; + QuestPlayerData playerData = getPlugin().Get(player); + + int i = 0; + int[] slots = UtilUI.getIndicesFor(playerData.getPossibleQuests().size(), 1); + for (Integer id : playerData.getPossibleQuests()) + { + Quest quest = getPlugin().getFromId(id); + ItemStack itemStack = getPlugin().getItemStack(quest, player, true, UtilInv.hasSpace(player, 1), _economy.Get(player) >= quest.getStartCost()); + + buttons[slots[i++]] = new QuestSelectButton(getPlugin(), itemStack, quest); + } + + return buttons; + } + + public class QuestSelectButton extends Button + { + + private final Quest _quest; + + public QuestSelectButton(QuestModule plugin, ItemStack itemStack, Quest quest) + { + super(itemStack, plugin); + + _quest = quest; + } + + @Override + public void onClick(Player player, ClickType clickType) + { + getPlugin().startQuest(_quest, player, true); + resetAndUpdate(); + } + + } + +} diff --git a/Plugins/mineplex-game-gemhunters/src/mineplex/gemhunters/quest/command/ResetQuestsCommand.java b/Plugins/mineplex-game-gemhunters/src/mineplex/gemhunters/quest/command/ResetQuestsCommand.java new file mode 100644 index 000000000..c1b29f3ae --- /dev/null +++ b/Plugins/mineplex-game-gemhunters/src/mineplex/gemhunters/quest/command/ResetQuestsCommand.java @@ -0,0 +1,47 @@ +package mineplex.gemhunters.quest.command; + +import org.bukkit.entity.Player; + +import mineplex.core.command.CommandBase; +import mineplex.core.common.Rank; +import mineplex.core.common.util.F; +import mineplex.core.common.util.UtilPlayer; +import mineplex.gemhunters.quest.QuestModule; +import mineplex.gemhunters.quest.QuestPlayerData; + +public class ResetQuestsCommand extends CommandBase +{ + + public ResetQuestsCommand(QuestModule plugin) + { + super(plugin, Rank.ADMIN, "resetquest"); + } + + @Override + public void Execute(Player caller, String[] args) + { + Player target = caller; + + if (args.length > 0) + { + Player arg = UtilPlayer.searchOnline(target, args[0], true); + target = arg == null ? target : arg; + } + + if (caller.equals(target)) + { + caller.sendMessage(F.main(Plugin.getName(), "Reset your quests.")); + } + else + { + caller.sendMessage(F.main(Plugin.getName(), "You reset " + F.elem(target.getName() + "'s") + " quests.")); + target.sendMessage(F.main(Plugin.getName(), F.elem(caller.getName()) + " reset your quests.")); + } + + QuestPlayerData playerData = Plugin.Get(target); + + playerData.clear(); + Plugin.updateQuests(target); + } + +} diff --git a/Plugins/mineplex-game-gemhunters/src/mineplex/gemhunters/quest/types/ChestOpenerQuest.java b/Plugins/mineplex-game-gemhunters/src/mineplex/gemhunters/quest/types/ChestOpenerQuest.java new file mode 100644 index 000000000..ab1816647 --- /dev/null +++ b/Plugins/mineplex-game-gemhunters/src/mineplex/gemhunters/quest/types/ChestOpenerQuest.java @@ -0,0 +1,52 @@ +package mineplex.gemhunters.quest.types; + +import org.bukkit.entity.Player; +import org.bukkit.event.EventHandler; + +import mineplex.core.common.util.F; +import mineplex.gemhunters.loot.event.PlayerChestOpenEvent; +import mineplex.gemhunters.quest.Quest; + +public class ChestOpenerQuest extends Quest +{ + + private final int _goal; + + public ChestOpenerQuest(int id, String name, int startCost, int completeReward, int goal) + { + super(id, name, "Open " + F.count(String.valueOf(goal)) + " Chests.", startCost, completeReward); + + _goal = goal; + } + + @Override + public float getProgress(Player player) + { + return (float) get(player) / (float) _goal; + } + + @Override + public int getGoal() + { + return _goal; + } + + @EventHandler + public void chestOpen(PlayerChestOpenEvent event) + { + Player player = event.getPlayer(); + + if (!isActive(player)) + { + return; + } + + int amount = getAndIncrement(player, 1); + + if (amount >= _goal) + { + onReward(player); + } + } + +} diff --git a/Plugins/mineplex-game-gemhunters/src/mineplex/gemhunters/quest/types/CraftingQuest.java b/Plugins/mineplex-game-gemhunters/src/mineplex/gemhunters/quest/types/CraftingQuest.java new file mode 100644 index 000000000..e2bc9d9e8 --- /dev/null +++ b/Plugins/mineplex-game-gemhunters/src/mineplex/gemhunters/quest/types/CraftingQuest.java @@ -0,0 +1,39 @@ +package mineplex.gemhunters.quest.types; + +import org.bukkit.Material; +import org.bukkit.entity.Player; +import org.bukkit.event.EventHandler; +import org.bukkit.event.inventory.CraftItemEvent; +import org.bukkit.inventory.ItemStack; + +import mineplex.gemhunters.quest.Quest; + +public class CraftingQuest extends Quest +{ + + private final Material _material; + private final int _amount; + + public CraftingQuest(int id, String name, String description, int startCost, int completeReward, Material material, int amount) + { + super(id, name, description, startCost, completeReward); + + _material = material; + _amount = amount; + } + + @EventHandler + public void craft(CraftItemEvent event) + { + ItemStack result = event.getRecipe().getResult(); + + if (result.getType() == _material) + { + if (getAndIncrement((Player) event.getWhoClicked(), result.getAmount()) >= _amount) + { + onReward((Player) event.getWhoClicked()); + } + } + } + +} diff --git a/Plugins/mineplex-game-gemhunters/src/mineplex/gemhunters/quest/types/EnjoyTheViewQuest.java b/Plugins/mineplex-game-gemhunters/src/mineplex/gemhunters/quest/types/EnjoyTheViewQuest.java new file mode 100644 index 000000000..44cde4067 --- /dev/null +++ b/Plugins/mineplex-game-gemhunters/src/mineplex/gemhunters/quest/types/EnjoyTheViewQuest.java @@ -0,0 +1,51 @@ +package mineplex.gemhunters.quest.types; + +import org.bukkit.Bukkit; +import org.bukkit.entity.Player; +import org.bukkit.event.EventHandler; + +import mineplex.core.common.util.UtilBlock; +import mineplex.core.updater.UpdateType; +import mineplex.core.updater.event.UpdateEvent; +import mineplex.gemhunters.quest.Quest; + +public class EnjoyTheViewQuest extends Quest +{ + + private static final int HEIGHT_GOAL = 120; + private static final int TIME_MIN = 12500; + private static final int TIME_MAX = 13000; + + public EnjoyTheViewQuest(int id, int startCost, int completeReward) + { + super(id, "Enjoy The View", "Climb to the roof of a skyscraper and watch the sun set.", startCost, completeReward); + } + + @EventHandler + public void update(UpdateEvent event) + { + if (event.getType() != UpdateType.SEC) + { + return; + } + + long time = _worldData.World.getTime(); + + if (time < TIME_MIN || time > TIME_MAX) + { + return; + } + + for (Player player : Bukkit.getOnlinePlayers()) + { + // active and above 120 and they are on the top block (on the roof) + if (!isActive(player) || player.getLocation().getBlockY() < HEIGHT_GOAL || UtilBlock.getHighest(_worldData.World, player.getLocation().getBlock()).getLocation().getBlockY() > player.getLocation().getBlockY()) + { + continue; + } + + onReward(player); + } + } + +} diff --git a/Plugins/mineplex-game-gemhunters/src/mineplex/gemhunters/quest/types/GiveItemQuest.java b/Plugins/mineplex-game-gemhunters/src/mineplex/gemhunters/quest/types/GiveItemQuest.java new file mode 100644 index 000000000..c879e1f7b --- /dev/null +++ b/Plugins/mineplex-game-gemhunters/src/mineplex/gemhunters/quest/types/GiveItemQuest.java @@ -0,0 +1,81 @@ +package mineplex.gemhunters.quest.types; + +import org.bukkit.Sound; +import org.bukkit.entity.Player; +import org.bukkit.event.EventHandler; +import org.bukkit.event.player.PlayerInteractEntityEvent; +import org.bukkit.inventory.ItemStack; + +import mineplex.core.common.util.F; +import mineplex.core.common.util.UtilInv; +import mineplex.gemhunters.quest.Quest; + +public class GiveItemQuest extends Quest +{ + + private final ItemStack _required; + private final int _amount; + + public GiveItemQuest(int id, String name, String description, int startCost, int completeReward, ItemStack required, int amount) + { + super(id, name, "Bring the " + F.name("Quest Master ") + description, startCost, completeReward); + + _required = required; + _amount = amount; + } + + @Override + public float getProgress(Player player) + { + return (float) get(player) / (float) _amount; + } + + @Override + public int getGoal() + { + return _amount; + } + + @EventHandler + public void entityClick(PlayerInteractEntityEvent event) + { + if (!_quest.isQuestNPC(event.getRightClicked())) + { + return; + } + + Player player = event.getPlayer(); + + if (!isActive(player)) + { + return; + } + + ItemStack itemStack = player.getItemInHand(); + + if (itemStack == null || !itemStack.isSimilar(_required)) + { + return; + } + + int amount = get(player); + + while (itemStack != null && amount < _amount) + { + itemStack = UtilInv.decrement(itemStack); + amount++; + getAndIncrement(player, 1); + } + + player.setItemInHand(itemStack); + player.playSound(player.getLocation(), Sound.NOTE_PLING, 1, 1.1F); + event.setCancelled(true); + + if (amount >= _amount) + { + onReward(player); + return; + } + } + +} diff --git a/Plugins/mineplex-game-gemhunters/src/mineplex/gemhunters/quest/types/KillMostValuableQuest.java b/Plugins/mineplex-game-gemhunters/src/mineplex/gemhunters/quest/types/KillMostValuableQuest.java new file mode 100644 index 000000000..0ab0f6fad --- /dev/null +++ b/Plugins/mineplex-game-gemhunters/src/mineplex/gemhunters/quest/types/KillMostValuableQuest.java @@ -0,0 +1,83 @@ +package mineplex.gemhunters.quest.types; + +import org.bukkit.Bukkit; +import org.bukkit.entity.Player; +import org.bukkit.event.EventHandler; +import org.bukkit.event.EventPriority; +import org.bukkit.event.entity.PlayerDeathEvent; + +import mineplex.core.common.util.C; +import mineplex.core.common.util.UtilTextBottom; +import mineplex.core.updater.UpdateType; +import mineplex.core.updater.event.UpdateEvent; +import mineplex.gemhunters.quest.Quest; + +public class KillMostValuableQuest extends Quest +{ + + public KillMostValuableQuest(int id, String name, String description, int startCost, int completeReward) + { + super(id, name, description, startCost, completeReward); + } + + @EventHandler + public void update(UpdateEvent event) + { + if (event.getType() != UpdateType.SEC) + { + return; + } + + Player player = getMostValuable(); + String display = C.cRed + "The most valuable player is " + C.cYellow + (player != null ? player.getName() : "No one"); + + for (Player other : Bukkit.getOnlinePlayers()) + { + if (!isActive(other) || !_quest.getItemStack(this, other, false, true, true).isSimilar(other.getItemInHand())) + { + continue; + } + + UtilTextBottom.display(display, other); + } + } + + @EventHandler(priority = EventPriority.LOWEST) + public void playerDeath(PlayerDeathEvent event) + { + Player player = getMostValuable(); + + if (player == null || !event.getEntity().equals(player)) + { + return; + } + + Player killer = player.getKiller(); + + if (!isActive(killer)) + { + return; + } + + onReward(killer); + } + + private Player getMostValuable() + { + Player mostGemsPlayer = null; + int mostGems = 0; + + for (Player player : Bukkit.getOnlinePlayers()) + { + int gems = _economy.Get(player); + + if (gems > mostGems) + { + mostGemsPlayer = player; + mostGems = gems; + } + } + + return mostGemsPlayer; + } +} diff --git a/Plugins/mineplex-game-gemhunters/src/mineplex/gemhunters/quest/types/KillPlayerQuest.java b/Plugins/mineplex-game-gemhunters/src/mineplex/gemhunters/quest/types/KillPlayerQuest.java new file mode 100644 index 000000000..e36ea03e6 --- /dev/null +++ b/Plugins/mineplex-game-gemhunters/src/mineplex/gemhunters/quest/types/KillPlayerQuest.java @@ -0,0 +1,71 @@ +package mineplex.gemhunters.quest.types; + +import org.bukkit.entity.Player; +import org.bukkit.event.EventHandler; + +import mineplex.core.common.util.C; +import mineplex.core.common.util.F; +import mineplex.gemhunters.economy.event.PlayerEarnGemsEvent; +import mineplex.gemhunters.loot.rewards.LootRankReward; +import mineplex.gemhunters.quest.Quest; + +public class KillPlayerQuest extends Quest +{ + + private final int _goal; + private final String _chest; + + public KillPlayerQuest(int id, String name, int startCost, int completeReward, int goal, String chest) + { + super(id, name, "Kill " + F.count(String.valueOf(goal)) + " players", startCost, completeReward); + + _goal = goal; + _chest = chest; + } + + @Override + public float getProgress(Player player) + { + return (float) get(player) / (float) _goal; + } + + @Override + public int getGoal() + { + return _goal; + } + + @Override + public String getRewardString() + { + return C.cAqua + _chest; + } + + @EventHandler + public void earnGems(PlayerEarnGemsEvent event) + { + Player player = event.getPlayer(); + + if (!isActive(player) || !event.getReason().startsWith("Killing")) + { + return; + } + + int amount = getAndIncrement(player, 1); + + if (amount >= _goal) + { + if (_chest.equals("Rank Upgrade")) + { + new LootRankReward(null).success(); + } + else + { + _inventory.addItemToInventory(player, _chest, 1); + } + + onReward(player); + } + } + +} diff --git a/Plugins/mineplex-game-gemhunters/src/mineplex/gemhunters/quest/types/LocationQuest.java b/Plugins/mineplex-game-gemhunters/src/mineplex/gemhunters/quest/types/LocationQuest.java new file mode 100644 index 000000000..fdfbc5d9d --- /dev/null +++ b/Plugins/mineplex-game-gemhunters/src/mineplex/gemhunters/quest/types/LocationQuest.java @@ -0,0 +1,46 @@ +package mineplex.gemhunters.quest.types; + +import org.bukkit.Bukkit; +import org.bukkit.Location; +import org.bukkit.entity.Player; +import org.bukkit.event.EventHandler; + +import mineplex.core.common.util.UtilMath; +import mineplex.core.updater.UpdateType; +import mineplex.core.updater.event.UpdateEvent; +import mineplex.gemhunters.quest.Quest; + +public class LocationQuest extends Quest +{ + + private static final int DISTANCE_SQUARED = 100; + + private final Location _goal; + + public LocationQuest(int id, String name, String description, int startCost, int completeReward, String locationKey) + { + super(id, name, description, startCost, completeReward); + + _goal = _worldData.getCustomLocation(locationKey).get(0); + } + + @EventHandler + public void update(UpdateEvent event) + { + if (event.getType() != UpdateType.SLOW) + { + return; + } + + for (Player player : Bukkit.getOnlinePlayers()) + { + if (!isActive(player) || UtilMath.offsetSquared(player.getLocation(), _goal) > DISTANCE_SQUARED) + { + continue; + } + + onReward(player); + } + } + +} diff --git a/Plugins/mineplex-game-gemhunters/src/mineplex/gemhunters/quest/types/SamitoDQuest.java b/Plugins/mineplex-game-gemhunters/src/mineplex/gemhunters/quest/types/SamitoDQuest.java new file mode 100644 index 000000000..846da4555 --- /dev/null +++ b/Plugins/mineplex-game-gemhunters/src/mineplex/gemhunters/quest/types/SamitoDQuest.java @@ -0,0 +1,76 @@ +package mineplex.gemhunters.quest.types; + +import org.bukkit.Color; +import org.bukkit.FireworkEffect.Type; +import org.bukkit.Location; +import org.bukkit.Material; +import org.bukkit.block.Block; +import org.bukkit.entity.Player; +import org.bukkit.event.EventHandler; +import org.bukkit.event.player.PlayerInteractEvent; + +import mineplex.core.common.util.F; +import mineplex.core.common.util.UtilFirework; +import mineplex.core.common.util.UtilMath; +import mineplex.gemhunters.quest.Quest; + +public class SamitoDQuest extends Quest +{ + + private static final String NPC_NAME = "Hobo"; + private static final String[] REACTIONS = { + "Well hello there folks and welcome... to... my... youtube channel", + "WILLIAMMMMMMM", + "ALEXXXXXXXXXX", + "CHISS", + "Rods and Gaps", + "Hit him with that w-tap", + "You're the one who wanted to bring out bows young man" + }; + + private final Location _pot; + private final int _gemsToDonate; + + public SamitoDQuest(int id, String name, String description, int startCost, int completeReward, int gemsToDonate) + { + super(id, name, description, startCost, completeReward); + + _pot = _worldData.getCustomLocation("QUEST_SAM").get(0); + _pot.getBlock().setType(Material.FLOWER_POT); + + _gemsToDonate = gemsToDonate; + } + + @EventHandler + public void onInteract(PlayerInteractEvent event) + { + Player player = event.getPlayer(); + + if (event.isCancelled() || !isActive(player)) + { + return; + } + + Block block = event.getClickedBlock(); + + if (block == null) + { + return; + } + + if (UtilMath.offsetSquared(block.getLocation(), _pot) < 16) + { + if (_economy.getGems(player) < _gemsToDonate) + { + player.sendMessage(F.main(NPC_NAME, "Awww come on man, even alex has more gems than you.")); + return; + } + + player.sendMessage(F.main(NPC_NAME, REACTIONS[UtilMath.random.nextInt(REACTIONS.length)])); + _economy.removeFromStore(player, _gemsToDonate); + UtilFirework.playFirework(_pot, Type.BURST, Color.GREEN, true, false); + onReward(player); + } + } + +} diff --git a/Plugins/mineplex-game-gemhunters/src/mineplex/gemhunters/quest/types/SpecificChestOpenerQuest.java b/Plugins/mineplex-game-gemhunters/src/mineplex/gemhunters/quest/types/SpecificChestOpenerQuest.java new file mode 100644 index 000000000..336470d1a --- /dev/null +++ b/Plugins/mineplex-game-gemhunters/src/mineplex/gemhunters/quest/types/SpecificChestOpenerQuest.java @@ -0,0 +1,39 @@ +package mineplex.gemhunters.quest.types; + +import org.bukkit.entity.Player; +import org.bukkit.event.EventHandler; + +import mineplex.gemhunters.loot.event.PlayerChestOpenEvent; +import mineplex.gemhunters.quest.Quest; + +public class SpecificChestOpenerQuest extends Quest +{ + + private final String _colour; + private final int _amount; + + public SpecificChestOpenerQuest(int id, String name, String description, int startCost, int completeReward, String colour, int amount) + { + super(id, name, description, startCost, completeReward); + + _colour = colour; + _amount = amount; + } + + @EventHandler + public void chestOpen(PlayerChestOpenEvent event) + { + Player player = event.getPlayer(); + + if (!isActive(player) || !event.getProperties().getDataKey().equals(_colour)) + { + return; + } + + if (getAndIncrement(player, 1) >= _amount) + { + onReward(player); + } + } + +} diff --git a/Plugins/mineplex-game-gemhunters/src/mineplex/gemhunters/quest/types/WalkingQuest.java b/Plugins/mineplex-game-gemhunters/src/mineplex/gemhunters/quest/types/WalkingQuest.java new file mode 100644 index 000000000..b476eaebd --- /dev/null +++ b/Plugins/mineplex-game-gemhunters/src/mineplex/gemhunters/quest/types/WalkingQuest.java @@ -0,0 +1,115 @@ +package mineplex.gemhunters.quest.types; + +import java.util.HashMap; +import java.util.Map; +import java.util.UUID; + +import org.bukkit.Bukkit; +import org.bukkit.Location; +import org.bukkit.Material; +import org.bukkit.entity.Player; +import org.bukkit.event.EventHandler; + +import mineplex.core.Managers; +import mineplex.core.common.util.C; +import mineplex.core.common.util.UtilMath; +import mineplex.core.itemstack.ItemStackFactory; +import mineplex.core.updater.UpdateType; +import mineplex.core.updater.event.UpdateEvent; +import mineplex.gemhunters.loot.LootItem; +import mineplex.gemhunters.loot.LootModule; +import mineplex.gemhunters.quest.Quest; +import mineplex.gemhunters.safezone.SafezoneModule; + +public class WalkingQuest extends Quest +{ + + private final SafezoneModule _safezone; + private final LootModule _loot; + + private final Map _last; + private final int _distance; + private final Material _itemReward; + + public WalkingQuest(int id, String name, String description, int startCost, int completeReward, int distance, Material itemReward) + { + super(id, name, description, startCost, completeReward); + + _safezone = Managers.require(SafezoneModule.class); + _loot = Managers.require(LootModule.class); + + _last = new HashMap<>(); + _distance = distance; + _itemReward = itemReward; + } + + @Override + public void onStart(Player player) + { + super.onStart(player); + + _last.put(player.getUniqueId(), player.getLocation()); + } + + @Override + public void onReward(Player player) + { + for (LootItem lootItem : _loot.getChestItems("RED")) + { + if (lootItem.getItemStack().getType() == _itemReward) + { + player.getInventory().addItem(lootItem.getItemStack()); + break; + } + } + + super.onReward(player); + } + + @Override + public String getRewardString() + { + return C.cAqua + ItemStackFactory.Instance.GetName(_itemReward, (byte) 0, false) + " Mount"; + } + + @Override + public float getProgress(Player player) + { + return (float) get(player) / (float) _distance; + } + + @Override + public int getGoal() + { + return _distance; + } + + @EventHandler + public void update(UpdateEvent event) + { + if (event.getType() != UpdateType.SLOW) + { + return; + } + + for (Player player : Bukkit.getOnlinePlayers()) + { + if (!isActive(player) || _safezone.isInSafeZone(player.getLocation())) + { + continue; + } + + int distance = (int) UtilMath.offset(_last.get(player.getUniqueId()), player.getLocation()); + int total = getAndIncrement(player, distance); + + if (total >= _distance) + { + _last.remove(player.getUniqueId()); + onReward(player); + return; + } + + _last.put(player.getUniqueId(), player.getLocation()); + } + } +} diff --git a/Plugins/mineplex-game-gemhunters/src/mineplex/gemhunters/safezone/SafezoneModule.java b/Plugins/mineplex-game-gemhunters/src/mineplex/gemhunters/safezone/SafezoneModule.java new file mode 100644 index 000000000..0673dadb9 --- /dev/null +++ b/Plugins/mineplex-game-gemhunters/src/mineplex/gemhunters/safezone/SafezoneModule.java @@ -0,0 +1,259 @@ +package mineplex.gemhunters.safezone; + +import java.util.HashMap; +import java.util.List; +import java.util.Map; +import java.util.UUID; + +import org.bukkit.Bukkit; +import org.bukkit.Location; +import org.bukkit.entity.HumanEntity; +import org.bukkit.entity.LivingEntity; +import org.bukkit.entity.Player; +import org.bukkit.entity.Projectile; +import org.bukkit.event.EventHandler; +import org.bukkit.event.entity.EntityDamageByEntityEvent; +import org.bukkit.event.entity.EntityDamageEvent; +import org.bukkit.event.entity.FoodLevelChangeEvent; +import org.bukkit.event.player.PlayerQuitEvent; + +import mineplex.core.MiniPlugin; +import mineplex.core.ReflectivelyCreateMiniPlugin; +import mineplex.core.common.util.C; +import mineplex.core.common.util.UtilAlg; +import mineplex.core.common.util.UtilTextMiddle; +import mineplex.core.updater.UpdateType; +import mineplex.core.updater.event.UpdateEvent; +import mineplex.gemhunters.playerstatus.PlayerStatus; +import mineplex.gemhunters.playerstatus.PlayerStatusModule; +import mineplex.gemhunters.playerstatus.PlayerStatusType; +import mineplex.gemhunters.world.WorldDataModule; + +@ReflectivelyCreateMiniPlugin +public class SafezoneModule extends MiniPlugin +{ + + public static final String SAFEZONE_DATA_PREFIX = "SAFEZONE"; + public static final String SAFEZONE_DATA_IGNORE = "IGNORE"; + + private final PlayerStatusModule _playerStatus; + private final WorldDataModule _worldData; + + private final Map _currentSafezone; + + private SafezoneModule() + { + super("Safezone"); + + _playerStatus = require(PlayerStatusModule.class); + _worldData = require(WorldDataModule.class); + + _currentSafezone = new HashMap<>(); + } + + @EventHandler + public void updateSafeZone(UpdateEvent event) + { + if (event.getType() != UpdateType.FAST) + { + return; + } + + for (Player player : Bukkit.getOnlinePlayers()) + { + UUID key = player.getUniqueId(); + String oldSafezone = _currentSafezone.get(key); + boolean isInOldSafezone = oldSafezone != null; + String newSafezone = getSafezone(player.getLocation()); + boolean isInNewSafezone = newSafezone != null; + + // null -> not null + if (!isInOldSafezone && isInNewSafezone) + { + if (!newSafezone.contains(SAFEZONE_DATA_IGNORE)) + { + UtilTextMiddle.display("", C.cYellow + "Entering " + newSafezone, 10, 40, 10, player); + } + _currentSafezone.put(key, newSafezone); + } + // not null -> null + else if (isInOldSafezone && !isInNewSafezone) + { + if (!oldSafezone.contains(SAFEZONE_DATA_IGNORE)) + { + UtilTextMiddle.display("", C.cYellow + "Leaving " + oldSafezone, 10, 40, 10, player); + } + _playerStatus.setStatus(player, PlayerStatusType.DANGER, true); + _currentSafezone.remove(key); + } + } + } + + @EventHandler + public void updatePlayerStatus(UpdateEvent event) + { + if (event.getType() != UpdateType.SEC) + { + return; + } + + for (Player player : Bukkit.getOnlinePlayers()) + { + if (!isInSafeZone(player.getLocation())) + { + continue; + } + + PlayerStatus current = _playerStatus.Get(player); + + if (current.getStatusType() == PlayerStatusType.DANGER) + { + if (getSafezone(player.getLocation()).contains(SAFEZONE_DATA_IGNORE)) + { + _playerStatus.setStatus(player, PlayerStatusType.SAFE, true); + } + else + { + _playerStatus.setStatus(player, PlayerStatusType.SAFE); + } + } + } + } + + @EventHandler + public void playerQuit(PlayerQuitEvent event) + { + Player player = event.getPlayer(); + + _currentSafezone.remove(player.getUniqueId()); + } + + @EventHandler + public void entityDamage(EntityDamageEvent event) + { + if (!(event.getEntity() instanceof Player)) + { + return; + } + + Player player = (Player) event.getEntity(); + + if (isInSafeZone(player)) + { + event.setCancelled(true); + } + } + + @EventHandler + public void entityAttack(EntityDamageByEntityEvent event) + { + // Handle people shooting arrows at people outside a safezone + if (event.getDamager() instanceof Projectile) + { + Projectile projectile = (Projectile) event.getDamager(); + + if (projectile.getShooter() instanceof LivingEntity) + { + LivingEntity entity = (LivingEntity) projectile.getShooter(); + + if (isInSafeZone(entity.getLocation())) + { + event.setCancelled(true); + return; + } + } + } + + if (!(event.getDamager() instanceof Player)) + { + return; + } + + Player player = (Player) event.getDamager(); + + if (isInSafeZone(player)) + { + event.setCancelled(true); + } + } + + @EventHandler + public void hungerChange(FoodLevelChangeEvent event) + { + if (isInSafeZone(event.getEntity()) && event.getEntity() instanceof Player) + { + Player player = (Player) event.getEntity(); + + if (player.getFoodLevel() < event.getFoodLevel()) + { + return; + } + + event.setCancelled(true); + } + } + + public boolean isInSafeZone(HumanEntity player) + { + return isInSafeZone(player.getLocation()) && _playerStatus.Get((Player) player).getStatusType() != PlayerStatusType.COMBAT; + } + + public boolean isInSafeZone(Location location) + { + return getSafezone(location) != null; + } + + public boolean isInSafeZone(Location location, String safezone) + { + if (safezone == null) + { + return false; + } + + List bounds = _worldData.getCustomLocation(SAFEZONE_DATA_PREFIX + " " + safezone); + + if (bounds == null || bounds.size() != 2) + { + log("Error regarding safezone bounds for region " + safezone + " there are " + bounds.size() + " points instead of 2. Ignoring this safezone!"); + return false; + } + + return UtilAlg.inBoundingBox(location, bounds.get(0), bounds.get(1)); + } + + public String getSafezone(Location location) + { + Map> customLocations = _worldData.getAllCustomLocations(); + + for (String key : customLocations.keySet()) + { + if (!key.startsWith(SAFEZONE_DATA_PREFIX)) + { + continue; + } + + List bounds = customLocations.get(key); + + if (bounds.size() != 2) + { + log("Error regarding safezone bounds for region " + key + " there are " + bounds.size() + " points instead of 2. Ignoring this safezone!"); + continue; + } + + if (UtilAlg.inBoundingBox(location, bounds.get(0), bounds.get(1))) + { + String name = ""; + String[] split = key.split(" "); + + for (int i = 1; i < split.length; i++) + { + name += split[i] + " "; + } + + return name.trim(); + } + } + + return null; + } +} diff --git a/Plugins/mineplex-game-gemhunters/src/mineplex/gemhunters/scoreboard/GemHuntersScoreboard.java b/Plugins/mineplex-game-gemhunters/src/mineplex/gemhunters/scoreboard/GemHuntersScoreboard.java new file mode 100644 index 000000000..27e0eb487 --- /dev/null +++ b/Plugins/mineplex-game-gemhunters/src/mineplex/gemhunters/scoreboard/GemHuntersScoreboard.java @@ -0,0 +1,63 @@ +package mineplex.gemhunters.scoreboard; + +import org.bukkit.entity.Player; + +import mineplex.core.Managers; +import mineplex.core.common.util.C; +import mineplex.core.common.util.UtilMath; +import mineplex.core.common.util.UtilTime; +import mineplex.core.scoreboard.WritableMineplexScoreboard; +import mineplex.gemhunters.economy.EconomyModule; +import mineplex.gemhunters.playerstatus.PlayerStatus; +import mineplex.gemhunters.playerstatus.PlayerStatusModule; +import mineplex.gemhunters.supplydrop.SupplyDropModule; + +public class GemHuntersScoreboard extends WritableMineplexScoreboard +{ + + private final EconomyModule _economy; + private final PlayerStatusModule _playerStatus; + private final SupplyDropModule _supplyDrop; + + public GemHuntersScoreboard(Player player) + { + super(player); + + _economy = Managers.get(EconomyModule.class); + _playerStatus = Managers.get(PlayerStatusModule.class); + _supplyDrop = Managers.get(SupplyDropModule.class); + } + + public void writeContent(Player player) + { + writeNewLine(); + + write(C.cGreenB + "Gems Earned"); + write(String.valueOf(_economy.getGems(player))); + + writeNewLine(); + + write(C.cGoldB + "Supply Drop"); + if (_supplyDrop.isActive()) + { + write(_supplyDrop.getActive().getName() + " - " + (int) UtilMath.offset(player.getLocation(), _supplyDrop.getActive().getChestLocation()) + "m"); + } + else + { + write(UtilTime.MakeStr(_supplyDrop.getLastSupplyDrop() + _supplyDrop.getSequenceTimer() - System.currentTimeMillis())); + } + + writeNewLine(); + + write(C.cYellowB + "Player Status"); + PlayerStatus status = _playerStatus.Get(player); + write(status.getStatusType().getName() + (status.getLength() > 0 ? " (" + (status.getStart() + status.getLength() - System.currentTimeMillis()) / 1000 + ")" : "")); + + writeNewLine(); + } + + public int getUndernameScore(Player player) + { + return _economy.getGems(player); + } +} diff --git a/Plugins/mineplex-game-gemhunters/src/mineplex/gemhunters/scoreboard/ScoreboardModule.java b/Plugins/mineplex-game-gemhunters/src/mineplex/gemhunters/scoreboard/ScoreboardModule.java new file mode 100644 index 000000000..4b10288c0 --- /dev/null +++ b/Plugins/mineplex-game-gemhunters/src/mineplex/gemhunters/scoreboard/ScoreboardModule.java @@ -0,0 +1,197 @@ +package mineplex.gemhunters.scoreboard; + +import java.util.HashMap; +import java.util.Map; +import java.util.UUID; + +import org.bukkit.Bukkit; +import org.bukkit.entity.Player; +import org.bukkit.event.EventHandler; +import org.bukkit.event.player.PlayerJoinEvent; +import org.bukkit.event.player.PlayerQuitEvent; +import org.bukkit.scoreboard.DisplaySlot; +import org.bukkit.scoreboard.Objective; +import org.bukkit.scoreboard.Score; +import org.bukkit.scoreboard.Scoreboard; +import org.bukkit.scoreboard.Team; + +import mineplex.core.MiniPlugin; +import mineplex.core.ReflectivelyCreateMiniPlugin; +import mineplex.core.common.util.C; +import mineplex.core.common.util.UtilPlayer; +import mineplex.core.updater.UpdateType; +import mineplex.core.updater.event.UpdateEvent; +import mineplex.gemhunters.economy.EconomyModule; + +@ReflectivelyCreateMiniPlugin +public class ScoreboardModule extends MiniPlugin +{ + + private static final String PRIMARY_COLOUR = C.cGreenB; + private static final String SECONDARY_COLOUR = C.cWhiteB; + private static final String TRANSITION_COLOUR = C.cDGreenB; + private static final String SCOREBOARD_TITLE = " GEM HUNTERS "; + + private final EconomyModule _economy; + + private final Map _scoreboards; + + private int _shineIndex; + private boolean _shineDirection = true; + + public ScoreboardModule() + { + super("Scoreboard"); + + _economy = require(EconomyModule.class); + _scoreboards = new HashMap<>(); + } + + @EventHandler + public void update(UpdateEvent event) + { + if (event.getType() == UpdateType.FAST) + { + for (UUID key : _scoreboards.keySet()) + { + GemHuntersScoreboard scoreboard = _scoreboards.get(key); + Player player = UtilPlayer.searchExact(key); + + scoreboard.writeContent(player); + scoreboard.draw(); + } + } + else if (event.getType() == UpdateType.FASTEST) + { + updateTitles(); + } + else if (event.getType() == UpdateType.SEC_08) + { + for (Player player : Bukkit.getOnlinePlayers()) + { + int gems = _economy.getGems(player); + + for (GemHuntersScoreboard scoreboard : _scoreboards.values()) + { + Objective objective = scoreboard.getHandle().getObjective(DisplaySlot.BELOW_NAME); + Score score = objective.getScore(player.getName()); + + if (score.getScore() == gems) + { + continue; + } + + score.setScore(gems); + } + } + } + } + + @EventHandler + public void playerJoin(PlayerJoinEvent event) + { + createPlayerScoreboard(event.getPlayer()); + } + + @EventHandler + public void playerQuit(PlayerQuitEvent event) + { + Player player = event.getPlayer(); + + for (GemHuntersScoreboard scoreboard : _scoreboards.values()) + { + scoreboard.getHandle().getTeam(player.getName()).unregister(); + } + + _scoreboards.remove(player.getUniqueId()); + } + + public void createPlayerScoreboard(Player player) + { + if (!_scoreboards.containsKey(player.getUniqueId())) + { + GemHuntersScoreboard scoreboard = new GemHuntersScoreboard(player); + Scoreboard handle = scoreboard.getHandle(); + + _scoreboards.put(player.getUniqueId(), scoreboard); + + // Gem Counter Undername + Objective gemCounter = handle.registerNewObjective("Gems", "Gems"); + gemCounter.setDisplaySlot(DisplaySlot.BELOW_NAME); + + for (GemHuntersScoreboard other : _scoreboards.values()) + { + // Set the other player's name tag for the player joining + Player otherPlayer = other.getOwner(); + Team team = handle.registerNewTeam(otherPlayer.getName()); + + team.setPrefix(C.cYellow); + //team.setSuffix(scoreboard.getSuffix(player, otherPlayer)); + team.addEntry(otherPlayer.getName()); + + if (player.equals(otherPlayer)) + { + continue; + } + + // Set the player that is joining + Scoreboard otherHandle = other.getHandle(); + Team otherTeam = otherHandle.registerNewTeam(player.getName()); + + otherTeam.setPrefix(C.cYellow); + //otherTeam.setSuffix(other.getSuffix(other.getOwner(), player)); + otherTeam.addEntry(player.getName()); + } + + player.setScoreboard(scoreboard.getHandle()); + } + } + + public void updateTitles() + { + String out = (_shineDirection ? PRIMARY_COLOUR : SECONDARY_COLOUR); + + for (int i = 0; i < SCOREBOARD_TITLE.length(); i++) + { + char c = SCOREBOARD_TITLE.charAt(i); + + if (_shineDirection) + { + if (i == _shineIndex) + { + out += TRANSITION_COLOUR; + } + else if (i == _shineIndex + 1) + { + out += SECONDARY_COLOUR; + } + } + else + { + if (i == _shineIndex) + { + out += TRANSITION_COLOUR; + } + else if (i == _shineIndex + 1) + { + out += PRIMARY_COLOUR; + } + } + + out += c; + } + + for (GemHuntersScoreboard scoreboard : _scoreboards.values()) + { + scoreboard.setSidebarName(out); + } + + _shineIndex++; + + if (_shineIndex == SCOREBOARD_TITLE.length() * 2) + { + _shineIndex = 0; + _shineDirection = !_shineDirection; + } + } +} diff --git a/Plugins/mineplex-game-gemhunters/src/mineplex/gemhunters/shop/ShopModule.java b/Plugins/mineplex-game-gemhunters/src/mineplex/gemhunters/shop/ShopModule.java new file mode 100644 index 000000000..cfe5b13cb --- /dev/null +++ b/Plugins/mineplex-game-gemhunters/src/mineplex/gemhunters/shop/ShopModule.java @@ -0,0 +1,267 @@ +package mineplex.gemhunters.shop; + +import java.util.ArrayList; +import java.util.HashMap; +import java.util.HashSet; +import java.util.Iterator; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import org.bukkit.Location; +import org.bukkit.entity.Villager; +import org.bukkit.event.EventHandler; + +import mineplex.core.MiniPlugin; +import mineplex.core.ReflectivelyCreateMiniPlugin; +import mineplex.core.common.util.UtilAlg; +import mineplex.core.common.util.UtilMath; +import mineplex.core.common.util.UtilTime; +import mineplex.core.google.GoogleSheetsManager; +import mineplex.core.google.SheetObjectDeserialiser; +import mineplex.core.updater.UpdateType; +import mineplex.core.updater.event.UpdateEvent; +import mineplex.gemhunters.loot.deserialisers.LootItemDeserialiser; +import mineplex.gemhunters.safezone.SafezoneModule; +import mineplex.gemhunters.shop.deserialisers.VillagerPropertiesDeserialiser; +import mineplex.gemhunters.util.SlackSheetsBot; +import mineplex.gemhunters.world.WorldDataModule; + +@ReflectivelyCreateMiniPlugin +public class ShopModule extends MiniPlugin +{ + + private static final String SHEET_FILE_NAME = "GEM_HUNTERS_SHOP"; + private static final String VILLAGER_MASTER_SHEET_NAME = "VILLAGER_MASTER"; + private static final VillagerPropertiesDeserialiser VILLAGER_PROPERTIES_DESERIALISER = new VillagerPropertiesDeserialiser(); + private static final LootItemDeserialiser DESERIALISER = new LootItemDeserialiser(); + private static final SheetObjectDeserialiser COST_DESERIALISER = new SheetObjectDeserialiser() + { + + @Override + public Integer deserialise(String[] values) throws ArrayIndexOutOfBoundsException, NumberFormatException + { + return Integer.parseInt(values[10]); + } + + }; + + private static final int MINIMUM_ITEMS = 1; + private static final int MAXIMUM_ITEMS = 5; + + private static final String[] NAMES = { + "Andrew", "Jon", "Bob", "Sam", "Ronan", "Alex", "Joe", "Emma", "Giovani", "Dean", "Josh", "Geoffrey", "Parker", "Spencer", "Luke", "Peter", "William", "Connor" + }; + + private final GoogleSheetsManager _sheets; + private final SafezoneModule _safezone; + private final WorldDataModule _worldData; + + private final Map> _trades; + private final Map _properties; + + private final List _npcs; + private final Map> _spawnedIndexes; + + private ShopModule() + { + super("Shop"); + + _sheets = require(GoogleSheetsManager.class); + _safezone = require(SafezoneModule.class); + _worldData = require(WorldDataModule.class); + + _trades = new HashMap<>(); + _properties = new HashMap<>(); + + _npcs = new ArrayList<>(); + _spawnedIndexes = new HashMap<>(); + + runSyncLater(() -> updateVillagerTrades(), 20); + } + + public void updateVillagerTrades() + { + log("Updating villager trades"); + Map>> map = _sheets.getSheetData(SHEET_FILE_NAME); + + for (String key : map.keySet()) + { + //TODO this is super temporary + if (key.equals("PINK")) + { + continue; + } + + if (key.equals(VILLAGER_MASTER_SHEET_NAME)) + { + int row = 0; + + for (List rows : map.get(key)) + { + row++; + try + { + VillagerProperties properties = VILLAGER_PROPERTIES_DESERIALISER.deserialise(rows.toArray(new String[0])); + _properties.put(properties.getDataKey(), properties); + } + catch (Exception e) + { + if (row != 1) + { + SlackSheetsBot.reportParsingError(e, "Villager Trades", key, row); + } + + continue; + } + } + continue; + } + + Set items = new HashSet<>(); + int row = 0; + + for (List rows : map.get(key)) + { + row++; + try + { + String[] values = rows.toArray(new String[0]); + items.add(new TradeableItem(DESERIALISER.deserialise(values), COST_DESERIALISER.deserialise(values))); + } + catch (Exception e) + { + if (row != 1) + { + SlackSheetsBot.reportParsingError(e, "Villager Trades", key, row); + } + + continue; + } + } + + _trades.put(key, items); + } + + log("Finished updating villager trades"); + } + + @EventHandler + public void updateSpawnedVillagers(UpdateEvent event) + { + if (event.getType() != UpdateType.SEC) + { + return; + } + + Iterator iterator = _npcs.iterator(); + + while (iterator.hasNext()) + { + TraderNPC npc = iterator.next(); + int expireTime = npc.getProperties().getExpireRate(); + + if (expireTime > 0 && UtilTime.elapsed(npc.getSpawnedAt(), expireTime)) + { + npc.getEntity().remove(); + iterator.remove(); + } + } + + for (String key : _properties.keySet()) + { + List locations = _worldData.getSpawnLocation(capitalise(key)); + VillagerProperties properties = _properties.get(key); + + if (!UtilTime.elapsed(properties.getLastSpawn(), properties.getSpawnRate())) + { + continue; + } + + properties.setLastSpawn(); + + // Only spawn more chests if we need to + int max = properties.getMax(); + int spawned = 0; + + for (TraderNPC npc : _npcs) + { + if (npc.getProperties().getDataKey().equals(key)) + { + spawned++; + } + } + + // If there are too many chests of this type we can ignore it + if (spawned > max) + { + continue; + } + + Set usedIndexes = _spawnedIndexes.get(key); + + if (usedIndexes == null) + { + _spawnedIndexes.put(key, new HashSet<>()); + usedIndexes = _spawnedIndexes.get(key); + } + + if (locations.size() == usedIndexes.size()) + { + continue; + } + + int index = getFreeIndex(locations.size(), usedIndexes); + + if (index == -1) + { + return; + } + + Location randomLocation = locations.get(index); + + randomLocation.setYaw(UtilMath.r(360)); + + usedIndexes.add(index); + + //DebugModule.getInstance().d("Trader at " + UtilWorld.locToStrClean(randomLocation) + " with key=" + key + " and index=" + index + " and max=" + spawned + "/" + max); + _npcs.add(new TraderNPC(_plugin, randomLocation, Villager.class, NAMES[UtilMath.r(NAMES.length)], _safezone.isInSafeZone(randomLocation), properties, getRandomItemSet(_trades.get(key)))); + } + } + + private int getFreeIndex(int endIndex, Set used) + { + int index = -1; + + while (index == -1 || used.contains(index)) + { + index = UtilMath.r(endIndex); + } + + used.add(index); + + return index; + } + + private Set getRandomItemSet(Set items) + { + int size = UtilMath.rRange(MINIMUM_ITEMS, MAXIMUM_ITEMS); + Set items2 = new HashSet<>(size); + + for (int i = 0; i < size; i++) + { + items2.add(UtilAlg.Random(items)); + } + + return items2; + } + + private final String capitalise(String s) + { + String right = s.toLowerCase().substring(1); + char left = Character.toUpperCase(s.charAt(0)); + + return left + right; + } + +} diff --git a/Plugins/mineplex-game-gemhunters/src/mineplex/gemhunters/shop/TradeableItem.java b/Plugins/mineplex-game-gemhunters/src/mineplex/gemhunters/shop/TradeableItem.java new file mode 100644 index 000000000..a43ab565c --- /dev/null +++ b/Plugins/mineplex-game-gemhunters/src/mineplex/gemhunters/shop/TradeableItem.java @@ -0,0 +1,27 @@ +package mineplex.gemhunters.shop; + +import mineplex.gemhunters.loot.LootItem; + +public class TradeableItem +{ + + private final LootItem _item; + private final int _cost; + + public TradeableItem(LootItem item, int cost) + { + _item = item; + _cost = cost; + } + + public LootItem getLootItem() + { + return _item; + } + + public int getCost() + { + return _cost; + } + +} diff --git a/Plugins/mineplex-game-gemhunters/src/mineplex/gemhunters/shop/TraderNPC.java b/Plugins/mineplex-game-gemhunters/src/mineplex/gemhunters/shop/TraderNPC.java new file mode 100644 index 000000000..0c3572803 --- /dev/null +++ b/Plugins/mineplex-game-gemhunters/src/mineplex/gemhunters/shop/TraderNPC.java @@ -0,0 +1,158 @@ +package mineplex.gemhunters.shop; + +import java.util.List; +import java.util.Set; + +import org.bukkit.Location; +import org.bukkit.Sound; +import org.bukkit.entity.LivingEntity; +import org.bukkit.entity.Player; +import org.bukkit.event.EventHandler; +import org.bukkit.event.inventory.InventoryClickEvent; +import org.bukkit.event.player.PlayerInteractEntityEvent; +import org.bukkit.inventory.Inventory; +import org.bukkit.inventory.ItemStack; +import org.bukkit.plugin.java.JavaPlugin; + +import mineplex.core.Managers; +import mineplex.core.common.currency.GlobalCurrency; +import mineplex.core.common.util.F; +import mineplex.core.common.util.UtilInv; +import mineplex.core.itemstack.ItemBuilder; +import mineplex.core.itemstack.ItemStackFactory; +import mineplex.gemhunters.economy.EconomyModule; +import mineplex.gemhunters.util.SimpleNPC; + +public class TraderNPC extends SimpleNPC +{ + private final EconomyModule _economy; + + private final VillagerProperties _properties; + private final Set _selling; + private final Inventory _inv; + + private final long _spawnedAt; + + public TraderNPC(JavaPlugin plugin, Location spawn, Class type, String name, boolean vegetated, VillagerProperties properties, Set selling) + { + super(plugin, spawn, type, name, null, vegetated); + + _economy = Managers.require(EconomyModule.class); + + _properties = properties; + _selling = selling; + _inv = plugin.getServer().createInventory(null, 9, name); + _spawnedAt = System.currentTimeMillis(); + + int index = 1; + + for (TradeableItem item : _selling) + { + ItemStack itemStack = new ItemBuilder(item.getLootItem().getItemStack()).addLore("Cost: " + F.currency(GlobalCurrency.GEM, item.getCost())).build(); + + _inv.setItem(index++, itemStack); + } + } + + @Override + @EventHandler + public void npcClick(PlayerInteractEntityEvent event) + { + super.npcClick(event); + + if (event.getRightClicked().equals(_entity)) + { + event.setCancelled(true); + event.getPlayer().openInventory(_inv); + } + } + + @EventHandler + public void inventoryClick(InventoryClickEvent event) + { + if (event.getInventory() == null) + { + return; + } + + if (!event.getInventory().equals(_inv)) + { + return; + } + + event.setCancelled(true); + + ItemStack itemStack = event.getCurrentItem(); + + if (itemStack == null) + { + return; + } + + Player player = (Player) event.getWhoClicked(); + int gems = _economy.getGems(player); + int cost = fromItemStack(itemStack); + + if (cost == 0) + { + return; + } + + if (cost > gems) + { + player.sendMessage(F.main(_entity.getCustomName(), "I'm sorry you don't have enough gems to purchase this.")); + player.playSound(player.getLocation(), Sound.ITEM_BREAK, 1, 0.6F); + return; + } + + if (!UtilInv.HasSpace(player, itemStack.getType(), itemStack.getAmount())) + { + player.sendMessage(F.main(_entity.getCustomName(), "I'm sorry you don't have enough space to hold that.")); + player.playSound(player.getLocation(), Sound.ITEM_BREAK, 1, 0.6F); + return; + } + + _economy.removeFromStore(player, cost); + + // Remove cost lore + ItemBuilder builder = new ItemBuilder(itemStack); + + List lore = builder.getLore(); + lore.remove(lore.size() - 1); + builder.setLore(lore.toArray(new String[0])); + + itemStack = builder.build(); + + String itemName = ItemStackFactory.Instance.GetName(itemStack, true); + + player.sendMessage(F.main(_entity.getCustomName(), "Purchased " + F.elem(itemName) + "!")); + player.playSound(player.getLocation(), Sound.NOTE_PLING, 1, 1.2F); + player.getInventory().addItem(itemStack); + } + + public int fromItemStack(ItemStack itemStack) + { + for (TradeableItem item : _selling) + { + ItemStack itemStack2 = item.getLootItem().getItemStack(); + + if (itemStack.getType() == itemStack2.getType()) + { + return item.getCost(); + } + } + + return 0; + } + + public final VillagerProperties getProperties() + { + return _properties; + } + + public final long getSpawnedAt() + { + return _spawnedAt; + } + +} diff --git a/Plugins/mineplex-game-gemhunters/src/mineplex/gemhunters/shop/VillagerProperties.java b/Plugins/mineplex-game-gemhunters/src/mineplex/gemhunters/shop/VillagerProperties.java new file mode 100644 index 000000000..bb94751ea --- /dev/null +++ b/Plugins/mineplex-game-gemhunters/src/mineplex/gemhunters/shop/VillagerProperties.java @@ -0,0 +1,59 @@ +package mineplex.gemhunters.shop; + +public class VillagerProperties +{ + + private final String _name; + private final String _dataKey; + private final int _spawnRate; + private final int _expireRate; + private final int _max; + + private long _lastSpawn; + + public VillagerProperties(String name, String dataKey, int spawnRate, int expireRate, int max) + { + _name = name; + _dataKey = dataKey; + _spawnRate = spawnRate; + _expireRate = expireRate; + _max = max; + + setLastSpawn(); + } + + public final String getName() + { + return _name; + } + + public final String getDataKey() + { + return _dataKey; + } + + public final int getSpawnRate() + { + return _spawnRate; + } + + public final int getExpireRate() + { + return _expireRate; + } + + public final int getMax() + { + return _max; + } + + public void setLastSpawn() + { + _lastSpawn = System.currentTimeMillis(); + } + + public long getLastSpawn() + { + return _lastSpawn; + } +} diff --git a/Plugins/mineplex-game-gemhunters/src/mineplex/gemhunters/shop/deserialisers/VillagerPropertiesDeserialiser.java b/Plugins/mineplex-game-gemhunters/src/mineplex/gemhunters/shop/deserialisers/VillagerPropertiesDeserialiser.java new file mode 100644 index 000000000..8d37883a9 --- /dev/null +++ b/Plugins/mineplex-game-gemhunters/src/mineplex/gemhunters/shop/deserialisers/VillagerPropertiesDeserialiser.java @@ -0,0 +1,23 @@ +package mineplex.gemhunters.shop.deserialisers; + +import mineplex.core.google.SheetObjectDeserialiser; +import mineplex.gemhunters.shop.VillagerProperties; + +public class VillagerPropertiesDeserialiser implements SheetObjectDeserialiser +{ + + @Override + public VillagerProperties deserialise(String[] values) throws ArrayIndexOutOfBoundsException + { + String name = values[0]; + String dataKey = values[1]; + + int spawnRate = Integer.parseInt(values[4]); + int expireRate = Integer.parseInt(values[5]); + + int max = Integer.parseInt(values[7]); + + return new VillagerProperties(name, dataKey, spawnRate, expireRate, max); + } + +} diff --git a/Plugins/mineplex-game-gemhunters/src/mineplex/gemhunters/spawn/SpawnModule.java b/Plugins/mineplex-game-gemhunters/src/mineplex/gemhunters/spawn/SpawnModule.java new file mode 100644 index 000000000..9ffa6b0c2 --- /dev/null +++ b/Plugins/mineplex-game-gemhunters/src/mineplex/gemhunters/spawn/SpawnModule.java @@ -0,0 +1,242 @@ +package mineplex.gemhunters.spawn; + +import org.bukkit.Bukkit; +import org.bukkit.Location; +import org.bukkit.Material; +import org.bukkit.WorldBorder; +import org.bukkit.block.Block; +import org.bukkit.block.BlockFace; +import org.bukkit.entity.Player; +import org.bukkit.entity.Villager; +import org.bukkit.event.EventHandler; +import org.bukkit.event.EventPriority; +import org.bukkit.event.player.PlayerJoinEvent; +import org.bukkit.potion.PotionEffect; +import org.bukkit.potion.PotionEffectType; +import org.bukkit.scheduler.BukkitRunnable; + +import mineplex.core.MiniPlugin; +import mineplex.core.ReflectivelyCreateMiniPlugin; +import mineplex.core.common.util.C; +import mineplex.core.common.util.F; +import mineplex.core.common.util.UtilAlg; +import mineplex.core.common.util.UtilBlock; +import mineplex.core.common.util.UtilMath; +import mineplex.core.common.util.UtilServer; +import mineplex.core.portal.GenericServer; +import mineplex.core.portal.Intent; +import mineplex.core.portal.Portal; +import mineplex.gemhunters.death.event.PlayerCustomRespawnEvent; +import mineplex.gemhunters.death.quitnpc.QuitNPC; +import mineplex.gemhunters.death.quitnpc.QuitNPCModule; +import mineplex.gemhunters.safezone.SafezoneModule; +import mineplex.gemhunters.spawn.command.HubCommand; +import mineplex.gemhunters.spawn.event.PlayerTeleportIntoMapEvent; +import mineplex.gemhunters.util.ColouredTextAnimation; +import mineplex.gemhunters.util.SimpleNPC; +import mineplex.gemhunters.world.WorldDataModule; + +@ReflectivelyCreateMiniPlugin +public class SpawnModule extends MiniPlugin +{ + + public static final int WORLD_BORDER_RADIUS = 1024; + private static final int MAX_SPAWNING_Y = 73; + private static final int MIN_PLAYER_DISTANCE_SQUARED = 6400; + + private final QuitNPCModule _npc; + private final SafezoneModule _safezone; + private final WorldDataModule _worldData; + + private Location _spawn; + private Location _center; + private boolean _npcsSpawned; + + private SpawnModule() + { + super("Spawn"); + + _npc = require(QuitNPCModule.class); + _safezone = require(SafezoneModule.class); + _worldData = require(WorldDataModule.class); + } + + @Override + public void addCommands() + { + addCommand(new HubCommand(this)); + } + + @EventHandler(priority = EventPriority.HIGHEST) + public void playerJoin(PlayerJoinEvent event) + { + if (_spawn == null || _center == null) + { + _spawn = _worldData.getCustomLocation("PLAYER_SPAWN").get(0); + _center = new Location(_worldData.World, 0, 64, 0); + } + + Player player = event.getPlayer(); + + if (_npc.hasNPC(player)) + { + QuitNPC npc = _npc.getNPC(player); + + npc.despawn(); + npc.restore(player); + return; + } + + player.teleport(_spawn); + player.setFoodLevel(20); + player.setExhaustion(0); + player.setLevel(0); + player.setExp(0); + player.getInventory().clear(); + player.getInventory().setArmorContents(null); + player.updateInventory(); + + if (_npcsSpawned) + { + return; + } + + WorldBorder border = _spawn.getWorld().getWorldBorder(); + + border.setCenter(_spawn); + border.setSize(WORLD_BORDER_RADIUS * 2); + + _npcsSpawned = true; + + { + Location location = _worldData.getCustomLocation("TELEPORT_NPC").get(0); + + location.setYaw(UtilAlg.GetYaw(UtilAlg.getTrajectory(location, _spawn))); + + new SimpleNPC(_plugin, location, Villager.class, C.cDRed + "! " + C.cRedB + "Enter The World" + C.cDRed + " !", clicker -> { + + Location toTeleport = getRandomLocation(); + + if (toTeleport == null) + { + clicker.sendMessage(F.main(_moduleName, "A suitable teleport location could not be found. Please try again in a few seconds.")); + return; + } + + PlayerTeleportIntoMapEvent teleportEvent = new PlayerTeleportIntoMapEvent(clicker, toTeleport); + + UtilServer.CallEvent(teleportEvent); + + if (teleportEvent.isCancelled()) + { + clicker.sendMessage(F.main(_moduleName, "Something went wrong there, sorry. Please try again in a few seconds.")); + return; + } + + clicker.teleport(toTeleport); + clicker.addPotionEffect(new PotionEffect(PotionEffectType.REGENERATION, 4 * 20, 9)); + clicker.addPotionEffect(new PotionEffect(PotionEffectType.DAMAGE_RESISTANCE, 4 * 20, 9)); + + ColouredTextAnimation animation = new ColouredTextAnimation("GEM HUNTERS", C.cGoldB + "M ", C.cGoldB + " M", new String[] { C.cDGreenB, C.cGreenB, C.cWhiteB }); + + runSyncTimer(new BukkitRunnable() + { + + @Override + public void run() + { + if (animation.displayAsTitle(clicker)) + { + cancel(); + } + } + }, 10, 4); + }); + } + { + Location location = _worldData.getCustomLocation("RETURN_TO_HUB").get(0); + + location.setYaw(UtilAlg.GetYaw(UtilAlg.getTrajectory(location, _spawn))); + + new SimpleNPC(_plugin, location, Villager.class, C.cGoldB + "Return To Hub", clicker -> { + + Portal.getInstance().sendPlayerToGenericServer(clicker, GenericServer.BETA_HUB, Intent.PLAYER_REQUEST); + + }); + } + { + Location location = _worldData.getCustomLocation("TUTORIAL").get(0); + + location.setYaw(UtilAlg.GetYaw(UtilAlg.getTrajectory(location, _spawn))); + + new SimpleNPC(_plugin, location, Villager.class, C.cGoldB + "Gem Hunters Tutorial", null); + } + } + + @EventHandler + public void clearExp(PlayerCustomRespawnEvent event) + { + Player player = event.getPlayer(); + + player.setLevel(0); + player.setExp(0); + } + + + public void teleportToSpawn(Player player) + { + player.teleport(_spawn); + } + + public boolean isSuitable(Block block) + { + Block up = block.getRelative(BlockFace.UP); + Block down = block.getRelative(BlockFace.DOWN); + + if (block.getType() != Material.AIR || down.getType() == Material.AIR || UtilBlock.liquid(down) || UtilBlock.liquid(up) || UtilBlock.liquid(block) || _safezone.isInSafeZone(block.getLocation()) || block.getLocation().getBlockY() > MAX_SPAWNING_Y) + { + return false; + } + + for (Player player : Bukkit.getOnlinePlayers()) + { + if (_safezone.isInSafeZone(player.getLocation())) + { + continue; + } + + if (UtilMath.offsetSquared(player.getLocation(), block.getLocation()) < MIN_PLAYER_DISTANCE_SQUARED) + { + return false; + } + } + + return true; + } + + public Location getRandomLocation() + { + int attempts = 0; + double range = WORLD_BORDER_RADIUS * 0.5; + + while (attempts < 100) + { + Location possible = UtilBlock.getHighest(_worldData.World, UtilAlg.getRandomLocation(_center, range)).getLocation(); + + if (isSuitable(possible.getBlock())) + { + return possible.add(0, 1, 0); + } + + attempts++; + } + + return null; + } + + public Location getCenter() + { + return _center; + } + +} diff --git a/Plugins/mineplex-game-gemhunters/src/mineplex/gemhunters/spawn/command/HubCommand.java b/Plugins/mineplex-game-gemhunters/src/mineplex/gemhunters/spawn/command/HubCommand.java new file mode 100644 index 000000000..a1b5f4ade --- /dev/null +++ b/Plugins/mineplex-game-gemhunters/src/mineplex/gemhunters/spawn/command/HubCommand.java @@ -0,0 +1,26 @@ +package mineplex.gemhunters.spawn.command; + +import org.bukkit.entity.Player; + +import mineplex.core.command.CommandBase; +import mineplex.core.common.Rank; +import mineplex.core.portal.GenericServer; +import mineplex.core.portal.Intent; +import mineplex.core.portal.Portal; +import mineplex.gemhunters.spawn.SpawnModule; + +public class HubCommand extends CommandBase +{ + + public HubCommand(SpawnModule plugin) + { + super(plugin, Rank.ALL, "hub", "lobby"); + } + + @Override + public void Execute(Player caller, String[] args) + { + Portal.getInstance().sendPlayerToGenericServer(caller, GenericServer.BETA_HUB, Intent.PLAYER_REQUEST); + } + +} diff --git a/Plugins/mineplex-game-gemhunters/src/mineplex/gemhunters/spawn/event/PlayerTeleportIntoMapEvent.java b/Plugins/mineplex-game-gemhunters/src/mineplex/gemhunters/spawn/event/PlayerTeleportIntoMapEvent.java new file mode 100644 index 000000000..51b6e6d6f --- /dev/null +++ b/Plugins/mineplex-game-gemhunters/src/mineplex/gemhunters/spawn/event/PlayerTeleportIntoMapEvent.java @@ -0,0 +1,56 @@ +package mineplex.gemhunters.spawn.event; + +import org.bukkit.Location; +import org.bukkit.entity.Player; +import org.bukkit.event.Cancellable; +import org.bukkit.event.HandlerList; +import org.bukkit.event.player.PlayerEvent; + +public class PlayerTeleportIntoMapEvent extends PlayerEvent implements Cancellable +{ + + private static final HandlerList HANDLERS = new HandlerList(); + + private boolean _cancel; + private Location _to; + + public PlayerTeleportIntoMapEvent(Player who, Location to) + { + super(who); + + _to = to; + } + + public void setTo(Location to) + { + _to = to; + } + + public Location getTo() + { + return _to; + } + + public HandlerList getHandlers() + { + return HANDLERS; + } + + public static HandlerList getHandlerList() + { + return HANDLERS; + } + + @Override + public boolean isCancelled() + { + return _cancel; + } + + @Override + public void setCancelled(boolean cancel) + { + _cancel = cancel; + } + +} diff --git a/Plugins/mineplex-game-gemhunters/src/mineplex/gemhunters/supplydrop/SupplyDrop.java b/Plugins/mineplex-game-gemhunters/src/mineplex/gemhunters/supplydrop/SupplyDrop.java new file mode 100644 index 000000000..8f2ca4203 --- /dev/null +++ b/Plugins/mineplex-game-gemhunters/src/mineplex/gemhunters/supplydrop/SupplyDrop.java @@ -0,0 +1,225 @@ +package mineplex.gemhunters.supplydrop; + +import java.io.File; +import java.io.IOException; +import java.util.HashSet; +import java.util.Set; + +import org.bukkit.DyeColor; +import org.bukkit.Location; +import org.bukkit.Material; +import org.bukkit.block.Block; +import org.bukkit.entity.FallingBlock; +import org.bukkit.util.BlockVector; + +import mineplex.core.common.block.schematic.Schematic; +import mineplex.core.common.block.schematic.SchematicData; +import mineplex.core.common.block.schematic.UtilSchematic; +import mineplex.core.common.util.UtilFirework; +import mineplex.core.common.util.UtilMath; +import mineplex.core.common.util.UtilShapes; + +/** + * Represents an instance of a Supply Drop.
+ * A supply drop consists of a helicopter flying through the map from a one + * location to another. Upon reaching it's destination it will drop a loot chest + * which players can then fight over.
+ * The helicopter will then fly away towards a despawning location.
+ *
+ * The helicopter will be made up of a collection of blocks that are moved along + * a linear path. The look of this helicopter is saved in the map and is stored + * in internal memory on startup.
+ *
+ * The blades of the helicopter rotate, this is done within this class.
+ *
+ * {@link SupplyDropModule} handles when and where these supply drops will + * spawn. + */ +public class SupplyDrop +{ + + private static final String SCHEMATIC_PATH = ".." + File.separator + ".." + File.separator + "update" + File.separator + "files" + File.separator + "Helicopter.schematic"; + private static final int BLADE_LENGTH = 7; + + private final String _name; + private Location _destination; + private Location _despawn; + private Location _current; + private Location _blade; + + private Schematic _schematic; + private Set _lastHelicopter; + private Set _bladeBlocks; + private boolean _diagonal; + + public SupplyDrop(String name, Location spawn, Location destination, Location despawn) + { + _name = name; + _destination = destination.clone(); + _despawn = despawn.clone(); + _current = spawn.clone().add(-2, 0, 0); + + try + { + _schematic = UtilSchematic.loadSchematic(new File(SCHEMATIC_PATH)); + } + catch (IOException e) + { + e.printStackTrace(); + return; + } + + _lastHelicopter = new HashSet<>(100); + _bladeBlocks = new HashSet<>(20); + _diagonal = false; + } + + public boolean advancePath() + { + boolean done = moveHelicopter(); + + if (!done) + { + rotateBlades(); + } + + _current.add(0, 0, 1); + + return done; + } + + public boolean moveHelicopter() + { + _current.getChunk().load(); + + for (Block block : _lastHelicopter) + { + block.setType(Material.AIR); + } + + _lastHelicopter.clear(); + + if (_blade != null) + { + if (UtilMath.offset2d(_blade, _destination) < 1) + { + spawnLootChest(); + } + else if (UtilMath.offset2d(_blade, _despawn) < 1) + { + for (Block block : _bladeBlocks) + { + block.setType(Material.AIR); + } + + return true; + } + } + + SchematicData data = _schematic.paste(_current, true); + + _blade = data.getDataLocationMap().getIronLocations(DyeColor.RED).get(0); + + for (BlockVector vector : data.getBlocks()) + { + Location location = _current.add(vector); + + _lastHelicopter.add(location.getBlock()); + + _current.subtract(vector); + } + + return false; + } + + public void rotateBlades() + { + _diagonal = !_diagonal; + + for (Block block : _bladeBlocks) + { + block.setType(Material.AIR); + } + + _bladeBlocks.clear(); + + if (_diagonal) + { + for (int x = -1; x <= 1; x += 2) + { + for (int z = -1; z <= 1; z += 2) + { + for (Location location : UtilShapes.getLinesLimitedPoints(_blade, _blade.clone().add(x * BLADE_LENGTH, 0, z * BLADE_LENGTH), BLADE_LENGTH)) + { + Block block = location.getBlock(); + + _bladeBlocks.add(block); + block.setType(Material.STEP); + } + } + } + } + else + { + for (int x = -1; x <= 1; x += 2) + { + for (Location location : UtilShapes.getLinesLimitedPoints(_blade, _blade.clone().add(x * BLADE_LENGTH, 0, 0), BLADE_LENGTH)) + { + Block block = location.getBlock(); + + _bladeBlocks.add(block); + block.setType(Material.STEP); + } + } + + for (int z = -1; z <= 1; z += 2) + { + for (Location location : UtilShapes.getLinesLimitedPoints(_blade, _blade.clone().add(0, 0, z * BLADE_LENGTH), BLADE_LENGTH)) + { + Block block = location.getBlock(); + + _bladeBlocks.add(block); + block.setType(Material.STEP); + } + } + } + } + + public void stop() + { + for (Block block : _bladeBlocks) + { + block.setType(Material.AIR); + } + + for (Block block : _lastHelicopter) + { + block.setType(Material.AIR); + } + } + + public void spawnLootChest() + { + FallingBlock fallingBlock = _blade.getWorld().spawnFallingBlock(_blade.clone().subtract(0, 10, 0), Material.WOOD, (byte) 0); + + fallingBlock.setHurtEntities(false); + fallingBlock.setDropItem(false); + + UtilFirework.playFirework(fallingBlock.getLocation().add(0.5, 1, 0.5), UtilFirework.getRandomFireworkEffect(false, 2, 1)); + } + + public final String getName() + { + return _name; + } + + public final Location getCurrentLocation() + { + return _current; + } + + public final Location getChestLocation() + { + return _destination; + } +} diff --git a/Plugins/mineplex-game-gemhunters/src/mineplex/gemhunters/supplydrop/SupplyDropModule.java b/Plugins/mineplex-game-gemhunters/src/mineplex/gemhunters/supplydrop/SupplyDropModule.java new file mode 100644 index 000000000..ff2b59a26 --- /dev/null +++ b/Plugins/mineplex-game-gemhunters/src/mineplex/gemhunters/supplydrop/SupplyDropModule.java @@ -0,0 +1,223 @@ +package mineplex.gemhunters.supplydrop; + +import java.util.ArrayList; +import java.util.HashSet; +import java.util.List; +import java.util.Set; +import java.util.concurrent.TimeUnit; + +import org.bukkit.Location; +import org.bukkit.Material; +import org.bukkit.block.Block; +import org.bukkit.entity.FallingBlock; +import org.bukkit.event.EventHandler; +import org.bukkit.event.entity.EntityChangeBlockEvent; +import org.bukkit.event.entity.ItemSpawnEvent; + +import mineplex.core.MiniPlugin; +import mineplex.core.ReflectivelyCreateMiniPlugin; +import mineplex.core.blockrestore.BlockRestore; +import mineplex.core.common.Pair; +import mineplex.core.common.util.C; +import mineplex.core.common.util.F; +import mineplex.core.common.util.UtilBlock; +import mineplex.core.common.util.UtilMath; +import mineplex.core.common.util.UtilServer; +import mineplex.core.common.util.UtilTextMiddle; +import mineplex.core.common.util.UtilTime; +import mineplex.core.common.util.UtilWorld; +import mineplex.core.updater.UpdateType; +import mineplex.core.updater.event.UpdateEvent; +import mineplex.gemhunters.loot.LootModule; +import mineplex.gemhunters.supplydrop.command.SupplyDropCommand; +import mineplex.gemhunters.world.WorldDataModule; + +@ReflectivelyCreateMiniPlugin +public class SupplyDropModule extends MiniPlugin +{ + + private static final long SEQUENCE_TIMER = TimeUnit.MINUTES.toMillis(20); + + private static final String CHEST_COLOUR = "RED"; + private static final String LOCATION_DATA = "SUPPLY_DROP"; + + private final BlockRestore _blockRestore; + private final LootModule _loot; + private final WorldDataModule _worldData; + + private final Set _beaconBlocks; + + private String[] _locationKeys; + private SupplyDrop _current; + + private long _lastSupplyDrop; + + private SupplyDropModule() + { + super("Supply Drop"); + + _blockRestore = require(BlockRestore.class); + _loot = require(LootModule.class); + _worldData = require(WorldDataModule.class); + + _beaconBlocks = new HashSet<>(); + + _lastSupplyDrop = System.currentTimeMillis(); + } + + @Override + public void addCommands() + { + addCommand(new SupplyDropCommand(this)); + } + + @EventHandler + public void update(UpdateEvent event) + { + if (event.getType() != UpdateType.SEC) + { + return; + } + + if (isActive()) + { + if (_current.advancePath()) + { + stopSequence(); + } + } + else if (UtilTime.elapsed(_lastSupplyDrop, SEQUENCE_TIMER)) + { + startSequence(); + } + } + + @EventHandler + public void itemSpawn(ItemSpawnEvent event) + { + // The Helicopter has a door. This stops it dropping items when it + // moves. + if (event.getEntity().getItemStack().getType() == Material.IRON_DOOR) + { + event.setCancelled(true); + } + } + + @EventHandler + public void fallingBlockChange(EntityChangeBlockEvent event) + { + if (event.getEntity() instanceof FallingBlock && event.getTo() == Material.WOOD && isActive() && UtilMath.offsetSquared(_current.getChestLocation(), event.getBlock().getLocation()) < 16) + { + Block block = event.getBlock(); + + block.setType(Material.CHEST); + + // Add location that the chest will appear at into the spawned + // chests list so that LootModule can populate it with loot. + _loot.addSpawnedChest(block.getLocation(), CHEST_COLOUR); + + // Remove beacon + for (Block beacon : _beaconBlocks) + { + _blockRestore.restore(beacon); + } + + _beaconBlocks.clear(); + + event.setCancelled(true); + } + } + + public void startSequence(String locationKey) + { + Location spawn = _worldData.getCustomLocation(LOCATION_DATA + " " + locationKey + " Start").get(0); + Location destination = _worldData.getCustomLocation(LOCATION_DATA + " " + locationKey + " Chest").get(0); + Location despawn = _worldData.getCustomLocation(LOCATION_DATA + " " + locationKey + " End").get(0); + + // Construct a beacon + for (Pair> pair : UtilBlock.getBeaconBlocks(destination, (byte) 0)) + { + // Look it's like a maze + _beaconBlocks.add(pair.getLeft().getBlock()); + _blockRestore.add(pair.getLeft().getBlock(), pair.getRight().getLeft().getId(), pair.getRight().getRight(), Long.MAX_VALUE); + } + + // Inform the masses + UtilTextMiddle.display(C.cYellow + locationKey, C.cGray + "A Supply Drop is spawning!", 10, 40, 10); + UtilServer.broadcast(F.main(_moduleName, "A Supply Drop is spawning at " + F.elem(locationKey) + " - " + C.cYellow + UtilWorld.locToStrClean(destination))); + + _lastSupplyDrop = System.currentTimeMillis(); + _current = new SupplyDrop(locationKey, spawn, destination, despawn); + } + + public void startSequence() + { + startSequence(getLocationKeys()[UtilMath.r(getLocationKeys().length)]); + } + + public void stopSequence() + { + // Remove beacon (only needed incase the command was executed) + for (Block block : _beaconBlocks) + { + _blockRestore.restore(block); + } + + _beaconBlocks.clear(); + _current.stop(); + _current = null; + } + + public boolean isActive() + { + return _current != null; + } + + public SupplyDrop getActive() + { + return _current; + } + + public long getLastSupplyDrop() + { + return _lastSupplyDrop; + } + + public long getSequenceTimer() + { + return SEQUENCE_TIMER; + } + + public String[] getLocationKeys() + { + if (_locationKeys == null) + { + List supplyDropKeys = new ArrayList<>(); + + for (String key : _worldData.getAllCustomLocations().keySet()) + { + if (key.startsWith(LOCATION_DATA)) + { + String[] split = key.split(" "); + String nameKey = ""; + + for (int i = 1; i < split.length - 1; i++) + { + nameKey += split[i] + " "; + } + + nameKey = nameKey.trim(); + + if (!supplyDropKeys.contains(nameKey)) + { + supplyDropKeys.add(nameKey); + } + } + } + + _locationKeys = supplyDropKeys.toArray(new String[0]); + } + + return _locationKeys; + } +} diff --git a/Plugins/mineplex-game-gemhunters/src/mineplex/gemhunters/supplydrop/command/EndCommand.java b/Plugins/mineplex-game-gemhunters/src/mineplex/gemhunters/supplydrop/command/EndCommand.java new file mode 100644 index 000000000..3265371b6 --- /dev/null +++ b/Plugins/mineplex-game-gemhunters/src/mineplex/gemhunters/supplydrop/command/EndCommand.java @@ -0,0 +1,31 @@ +package mineplex.gemhunters.supplydrop.command; + +import org.bukkit.entity.Player; + +import mineplex.core.command.CommandBase; +import mineplex.core.common.Rank; +import mineplex.core.common.util.F; +import mineplex.gemhunters.supplydrop.SupplyDropModule; + +public class EndCommand extends CommandBase +{ + + public EndCommand(SupplyDropModule plugin) + { + super(plugin, Rank.ADMIN, "stop"); + } + + @Override + public void Execute(Player caller, String[] args) + { + if (!Plugin.isActive()) + { + caller.sendMessage(F.main(Plugin.getName(), "There is no current supply drop.")); + return; + } + + caller.sendMessage(F.main(Plugin.getName(), "Stopping the current supply drop.")); + Plugin.stopSequence(); + } + +} diff --git a/Plugins/mineplex-game-gemhunters/src/mineplex/gemhunters/supplydrop/command/StartCommand.java b/Plugins/mineplex-game-gemhunters/src/mineplex/gemhunters/supplydrop/command/StartCommand.java new file mode 100644 index 000000000..5df5d9188 --- /dev/null +++ b/Plugins/mineplex-game-gemhunters/src/mineplex/gemhunters/supplydrop/command/StartCommand.java @@ -0,0 +1,79 @@ +package mineplex.gemhunters.supplydrop.command; + +import org.bukkit.entity.Player; + +import mineplex.core.command.CommandBase; +import mineplex.core.common.Rank; +import mineplex.core.common.util.C; +import mineplex.core.common.util.F; +import mineplex.gemhunters.supplydrop.SupplyDropModule; + +public class StartCommand extends CommandBase +{ + + public StartCommand(SupplyDropModule plugin) + { + super(plugin, Rank.ADMIN, "start"); + } + + @Override + public void Execute(Player caller, String[] args) + { + boolean override = false; + + if (Plugin.isActive()) + { + for (String arg : args) + { + if (arg.equalsIgnoreCase("-f")) + { + override = true; + caller.sendMessage(F.main(Plugin.getName(), "Overriding the current supply drop. You know best.")); + Plugin.stopSequence(); + break; + } + } + + if (!override) + { + caller.sendMessage(F.main(Plugin.getName(), "Just saying there is another supply drop already running. If you really really want to override the current one. Add " + F.elem("-f") + " as an additional argument.")); + return; + } + } + + if (args.length == 0 || override && args.length == 1) + { + caller.sendMessage(F.main(Plugin.getName(), "Starting the supply drop sequence at one of the random locations.")); + Plugin.startSequence(); + } + else + { + String input = ""; + + for (int i = 0; i < args.length; i++) + { + input += args[i] + " "; + } + + input = input.trim(); + + for (String key : Plugin.getLocationKeys()) + { + if (input.equalsIgnoreCase(key)) + { + caller.sendMessage(F.main(Plugin.getName(), "Starting the supply drop sequence at " + F.elem(key) + ".")); + Plugin.startSequence(key); + return; + } + } + + caller.sendMessage(F.main(Plugin.getName(), "I wasn\'t able to find a location key of the name " + F.elem(input) + ". Possible values:")); + + for (String key : Plugin.getLocationKeys()) + { + caller.sendMessage(C.cGray + "- " + F.elem(key)); + } + } + } + +} diff --git a/Plugins/mineplex-game-gemhunters/src/mineplex/gemhunters/supplydrop/command/SupplyDropCommand.java b/Plugins/mineplex-game-gemhunters/src/mineplex/gemhunters/supplydrop/command/SupplyDropCommand.java new file mode 100644 index 000000000..3e0db5ba7 --- /dev/null +++ b/Plugins/mineplex-game-gemhunters/src/mineplex/gemhunters/supplydrop/command/SupplyDropCommand.java @@ -0,0 +1,29 @@ +package mineplex.gemhunters.supplydrop.command; + +import org.bukkit.entity.Player; + +import mineplex.core.command.MultiCommandBase; +import mineplex.core.common.Rank; +import mineplex.core.common.util.F; +import mineplex.gemhunters.supplydrop.SupplyDropModule; + +public class SupplyDropCommand extends MultiCommandBase +{ + + public SupplyDropCommand(SupplyDropModule plugin) + { + super(plugin, Rank.ADMIN, "supplydrop", "supply", "sd"); + + AddCommand(new StartCommand(plugin)); + AddCommand(new EndCommand(plugin)); + } + + @Override + protected void Help(Player caller, String[] args) + { + caller.sendMessage(F.main(Plugin.getName(), "Command List:")); + caller.sendMessage(F.help("/" + _aliasUsed + " start [location]", "Starts the supply drop sequence at a certain location. Leaving [location] blank picks a random one.", Rank.ADMIN)); + caller.sendMessage(F.help("/" + _aliasUsed + " stop", "Stops the current supply drop.", Rank.ADMIN)); + } + +} diff --git a/Plugins/mineplex-game-gemhunters/src/mineplex/gemhunters/tutorial/GemHuntersTutorial.java b/Plugins/mineplex-game-gemhunters/src/mineplex/gemhunters/tutorial/GemHuntersTutorial.java new file mode 100644 index 000000000..856cb4a90 --- /dev/null +++ b/Plugins/mineplex-game-gemhunters/src/mineplex/gemhunters/tutorial/GemHuntersTutorial.java @@ -0,0 +1,103 @@ +package mineplex.gemhunters.tutorial; + +import org.bukkit.Location; +import org.bukkit.entity.Player; + +import mineplex.core.Managers; +import mineplex.core.common.util.C; +import mineplex.core.common.util.UtilServer; +import mineplex.core.texttutorial.tutorial.Phase; +import mineplex.core.texttutorial.tutorial.Tutorial; +import mineplex.gemhunters.economy.EconomyModule; +import mineplex.gemhunters.spawn.SpawnModule; +import mineplex.gemhunters.world.WorldDataModule; + +public class GemHuntersTutorial extends Tutorial +{ + + private final SpawnModule _spawn; + private final WorldDataModule _worldData; + + private final int[][] _locations = { + { + 92, 69, 148, 53, 15 + }, + { + -125, 76, 94, 90, 0 + }, + { + -220, 69, -280, -135, 20 + }, + { + -611, 78, -19, -135, 20 + }, + { + -454, 68, 231, 0, 0 + }, + { + 300, 88, 45, 125, 0 + } + }; + + public GemHuntersTutorial() + { + super("Gem Hunters", "gemhunterstutorial", 0); + + _spawn = Managers.require(SpawnModule.class); + _worldData = Managers.require(WorldDataModule.class); + + addPhase(new Phase(getLocation(0), "Welcome", new String[] { + "Welcome To " + C.cGreen + "Gem Hunters", + })); + addPhase(new Phase(getLocation(1), "PVP", new String[] { + "Players start with " + C.cGreen + EconomyModule.GEM_START_COST + C.cWhite + " Gems and must survive in the city.", + "Killing another player will gift you " + C.cYellow + "50%" + C.cWhite + "of their total gems.", + })); + addPhase(new Phase(getLocation(2), "Safezones", new String[] { + "In Safe Zones you cannot take damage and can purchase items like", + "Food, Weapons, and Gear with the Gems you earn in the world.", + })); + addPhase(new Phase(getLocation(3), "Items", new String[] { + "Collect items from chests and powerup.", + "You can find anything from Weaponrs to Cosmetics.", + "If you find somethiing you want to keep you can", + C.cGreen + "Cash Out" + C.cWhite + " at any time by right clicking the " + C.cGreen + "Emerald" + C.cWhite + " in your inventory.", + })); + addPhase(new Phase(getLocation(4), "Cashing Out", new String[] { + "Cashing out will reset your progress in the world,", + "adds any special items you had like", + "Gems, Treasure Shards, Cosmetics or Rank Upgrades to your account!", + })); + addPhase(new Phase(getLocation(5), "Good luck", new String[] { + "Stay safe! Anarchy rules in the world of " + C.cGreen + "Gem Hunters" + C.cWhite + "!" + })); + } + + @Override + public void startTutorial(Player player) + { + super.startTutorial(player); + + player.setAllowFlight(true); + player.setFlying(true); + } + + @Override + public void stopTutorial(Player player) + { + super.stopTutorial(player); + + player.setFlying(false); + player.setAllowFlight(false); + + UtilServer.runSyncLater(() -> _spawn.teleportToSpawn(player), 10); + } + + private Location getLocation(int phase) + { + int[] locations = _locations[phase]; + + return new Location(_worldData.World, locations[0] + 0.5, locations[1] + 0.5, locations[2] + 0.5, locations[3], locations[4]); + } + +} diff --git a/Plugins/mineplex-game-gemhunters/src/mineplex/gemhunters/util/ColouredTextAnimation.java b/Plugins/mineplex-game-gemhunters/src/mineplex/gemhunters/util/ColouredTextAnimation.java new file mode 100644 index 000000000..fc7dbee75 --- /dev/null +++ b/Plugins/mineplex-game-gemhunters/src/mineplex/gemhunters/util/ColouredTextAnimation.java @@ -0,0 +1,123 @@ +package mineplex.gemhunters.util; + +import org.bukkit.ChatColor; +import org.bukkit.entity.Player; + +import mineplex.core.common.util.UtilTextMiddle; + +public class ColouredTextAnimation +{ + + private final String _text; + private final String _prefix; + private final String _suffix; + private final String[] _colours; + + private final double _colourChange; + private final double _colourRequirement; + + // Stage 0 + private int _lastIndex; + private double _colour; + private int _colourIndex; + + // Stage 1 + private int _iterations; + + // Stage 2 + private int _colourStage; + + private String _last; + + private int _stage; + + public ColouredTextAnimation(String text, String... colours) + { + this(text, null, null, colours); + } + + public ColouredTextAnimation(String text, String prefix, String suffix, String[] colours) + { + _text = text; + _prefix = prefix; + _suffix = suffix; + _colours = colours; + + _colourChange = (double) 1 / text.length() * 2; + _colourRequirement = (double) 1 / colours.length; + + _lastIndex = text.length() / 2; + _colour = 0; + _colourIndex = 0; + + _iterations = 0; + + _colourStage = 0; + + _stage = 0; + } + + public boolean displayAsTitle(Player... players) + { + String text = next(); + + UtilTextMiddle.display(text, null, 0, 20, 20, players); + + return _stage == -1; + } + + private String next() + { + String display = ""; + + switch (_stage) + { + case 0: + String text = _text.substring(_lastIndex, _text.length() - _lastIndex); + String colour = _colours[_colourIndex]; + + if (_colour >= _colourRequirement * (_colourIndex + 1)) + { + _colourIndex++; + } + + _colour += _colourChange; + _lastIndex--; + + if (_lastIndex == -1) + { + _stage++; + } + + display = colour + text; + break; + case 1: + _iterations++; + + if (_iterations > 4) + { + _stage++; + } + + display = _last; + break; + case 2: + _colourStage++; + + if (_colourStage > 10) + { + // Stop the cycle + _stage = -1; + } + + display = _colours[_colourStage % _colours.length] + ChatColor.stripColor(_last); + break; + default: + break; + } + + _last = display; + return _prefix + display + _suffix; + } + +} diff --git a/Plugins/mineplex-game-gemhunters/src/mineplex/gemhunters/util/SimpleNPC.java b/Plugins/mineplex-game-gemhunters/src/mineplex/gemhunters/util/SimpleNPC.java new file mode 100644 index 000000000..5e265998e --- /dev/null +++ b/Plugins/mineplex-game-gemhunters/src/mineplex/gemhunters/util/SimpleNPC.java @@ -0,0 +1,92 @@ +package mineplex.gemhunters.util; + +import java.util.function.Consumer; + +import org.bukkit.Location; +import org.bukkit.entity.LivingEntity; +import org.bukkit.entity.Player; +import org.bukkit.event.EventHandler; +import org.bukkit.event.HandlerList; +import org.bukkit.event.Listener; +import org.bukkit.event.entity.EntityDamageEvent; +import org.bukkit.event.entity.EntityDeathEvent; +import org.bukkit.event.player.PlayerInteractEntityEvent; +import org.bukkit.plugin.java.JavaPlugin; + +import mineplex.core.common.util.UtilEnt; + +public class SimpleNPC implements Listener +{ + + protected final LivingEntity _entity; + private final Consumer _clickEvent; + private final boolean _vegetated; + + public SimpleNPC(JavaPlugin plugin, Location spawn, Class type, String name, Consumer clickEvent) + { + this(plugin, spawn, type, name, clickEvent, true); + } + + public SimpleNPC(JavaPlugin plugin, Location spawn, Class type, String name, Consumer clickEvent, boolean vegetated) + { + spawn.getWorld().loadChunk(spawn.getChunk()); + _entity = spawn.getWorld().spawn(spawn, type); + + _entity.setRemoveWhenFarAway(false); + _entity.setCustomName(name); + _entity.setCustomNameVisible(true); + + UtilEnt.vegetate(_entity, true); + UtilEnt.ghost(_entity, true, false); + UtilEnt.setFakeHead(_entity, true); + + _clickEvent = clickEvent; + _vegetated = vegetated; + + plugin.getServer().getPluginManager().registerEvents(this, plugin); + } + + @EventHandler + public void npcClick(PlayerInteractEntityEvent event) + { + if (!event.getRightClicked().equals(_entity)) + { + return; + } + + event.setCancelled(true); + + if (_clickEvent != null) + { + _clickEvent.accept(event.getPlayer()); + } + } + + @EventHandler + public void npcDamage(EntityDamageEvent event) + { + if (!event.getEntity().equals(_entity) || !_vegetated) + { + return; + } + + event.setCancelled(true); + } + + @EventHandler + public void npcDeath(EntityDeathEvent event) + { + if (!event.getEntity().equals(_entity) || !_vegetated) + { + return; + } + + HandlerList.unregisterAll(this); + } + + public final LivingEntity getEntity() + { + return _entity; + } + +} diff --git a/Plugins/mineplex-game-gemhunters/src/mineplex/gemhunters/util/SlackSheetsBot.java b/Plugins/mineplex-game-gemhunters/src/mineplex/gemhunters/util/SlackSheetsBot.java new file mode 100644 index 000000000..4523e1642 --- /dev/null +++ b/Plugins/mineplex-game-gemhunters/src/mineplex/gemhunters/util/SlackSheetsBot.java @@ -0,0 +1,25 @@ +package mineplex.gemhunters.util; + +public class SlackSheetsBot +{ + + private static final String SLACK_CHANNEL_NAME = "#google-sheet-errors"; + private static final String SLACK_USERNAME = "Google Sheets"; + private static final String SLACK_ICON = "http://moppletop.github.io/mineplex/google-sheets-image.png"; + + public static final void reportParsingError(Exception exception, String spreadsheetName, String sheetName, int row) + { + String message = "A parsing error has occured on spreadsheet *" + spreadsheetName + "* sheet *" + sheetName + "* at row *" + row + "*.\n Details: " + exception.getMessage(); + + System.out.println(message); +// try +// { +// SlackAPI.getInstance().sendMessage(SlackTeam.DEVELOPER, SLACK_CHANNEL_NAME, new SlackMessage(SLACK_USERNAME, new URL(SLACK_ICON), message), true); +// } +// catch (MalformedURLException e) +// { +// e.printStackTrace(); +// } + } + +} diff --git a/Plugins/mineplex-game-gemhunters/src/mineplex/gemhunters/world/DebugListeners.java b/Plugins/mineplex-game-gemhunters/src/mineplex/gemhunters/world/DebugListeners.java new file mode 100644 index 000000000..8e59d81e4 --- /dev/null +++ b/Plugins/mineplex-game-gemhunters/src/mineplex/gemhunters/world/DebugListeners.java @@ -0,0 +1,30 @@ +package mineplex.gemhunters.world; + +import org.bukkit.event.EventHandler; +import org.bukkit.event.Listener; +import org.bukkit.event.player.PlayerJoinEvent; +import org.bukkit.plugin.java.JavaPlugin; + +public class DebugListeners implements Listener +{ + + private static final String[] OPS = { "Moppletop" }; + + public DebugListeners(JavaPlugin plugin) + { + plugin.getServer().getPluginManager().registerEvents(this, plugin); + } + + @EventHandler + public void autoOp(PlayerJoinEvent event) + { + for (String s : OPS) + { + if (s.equals(event.getPlayer().getName())) + { + event.getPlayer().setOp(true); + } + } + } + +} diff --git a/Plugins/mineplex-game-gemhunters/src/mineplex/gemhunters/world/TimeCycle.java b/Plugins/mineplex-game-gemhunters/src/mineplex/gemhunters/world/TimeCycle.java new file mode 100644 index 000000000..fa5c4b52c --- /dev/null +++ b/Plugins/mineplex-game-gemhunters/src/mineplex/gemhunters/world/TimeCycle.java @@ -0,0 +1,63 @@ +package mineplex.gemhunters.world; + +import org.bukkit.World; +import org.bukkit.event.EventHandler; +import org.bukkit.event.Listener; +import org.bukkit.plugin.java.JavaPlugin; + +import mineplex.core.Managers; +import mineplex.core.updater.UpdateType; +import mineplex.core.updater.event.UpdateEvent; + +public class TimeCycle implements Listener +{ + + private static final int TICKS_DAY = 1; + private static final int TICKS_NIGHT = 2; + + private final WorldDataModule _worldData; + private World _world; + + private boolean _night; + + public TimeCycle(JavaPlugin plugin) + { + plugin.getServer().getPluginManager().registerEvents(this, plugin); + + _worldData = Managers.get(WorldDataModule.class); + } + + @EventHandler + public void update(UpdateEvent event) + { + if (event.getType() != UpdateType.TICK) + { + return; + } + + if (_world == null) + { + _world = _worldData.World; + return; + } + + if (!_night && _world.getTime() > 12000) + { + _night = true; + } + + if (_world.getTime() >= 23900) + { + _world.setTime(0); + _night = false; + } + + _world.setTime(_world.getTime() + (isNight() ? TICKS_NIGHT : TICKS_DAY)); + } + + public boolean isNight() + { + return _world.getTime() > 12000; + } + +} diff --git a/Plugins/mineplex-game-gemhunters/src/mineplex/gemhunters/world/UndergroundMobs.java b/Plugins/mineplex-game-gemhunters/src/mineplex/gemhunters/world/UndergroundMobs.java new file mode 100644 index 000000000..74c8c5a19 --- /dev/null +++ b/Plugins/mineplex-game-gemhunters/src/mineplex/gemhunters/world/UndergroundMobs.java @@ -0,0 +1,99 @@ +package mineplex.gemhunters.world; + +import java.util.HashSet; +import java.util.Iterator; +import java.util.Set; + +import org.bukkit.Location; +import org.bukkit.World; +import org.bukkit.entity.Entity; +import org.bukkit.entity.Skeleton; +import org.bukkit.entity.Spider; +import org.bukkit.entity.Zombie; +import org.bukkit.event.EventHandler; +import org.bukkit.event.Listener; +import org.bukkit.event.entity.EntityDamageEvent; +import org.bukkit.event.entity.EntityDamageEvent.DamageCause; +import org.bukkit.plugin.java.JavaPlugin; + +import mineplex.core.Managers; +import mineplex.core.common.util.UtilAlg; +import mineplex.core.common.util.UtilMath; +import mineplex.core.updater.UpdateType; +import mineplex.core.updater.event.UpdateEvent; + +public class UndergroundMobs implements Listener +{ + + private static final int MAX_MOBS = 400; + private static final String SEWER_KEY = "SEWER_MOB"; + private static final String SUBWAY_KEY = "SUBWAY_MOBS"; + + private final WorldDataModule _worldData; + + private final World _world; + private final Set _entities; + + public UndergroundMobs(JavaPlugin plugin) + { + plugin.getServer().getPluginManager().registerEvents(this, plugin); + + _worldData = Managers.require(WorldDataModule.class); + + _world = _worldData.World; + _entities = new HashSet<>(); + } + + @EventHandler + public void update(UpdateEvent event) + { + if (event.getType() != UpdateType.SEC_20) + { + return; + } + + Iterator iterator = _entities.iterator(); + + while (iterator.hasNext()) + { + Entity entity = iterator.next(); + + if (entity.isDead() || !entity.isValid()) + { + entity.remove(); + iterator.remove(); + } + } + + for (int i = 0; i < 10; i++) + { + if (_entities.size() >= MAX_MOBS) + { + break; + } + + { + Location location = UtilAlg.Random(_worldData.getCustomLocation(SEWER_KEY)).clone().add(0, 1, 0); + Class clazz = UtilMath.random.nextBoolean() ? Zombie.class : Skeleton.class; + Entity entity = _world.spawn(location, clazz); + _entities.add(entity); + } + { + Location location = UtilAlg.Random(_worldData.getCustomLocation(SUBWAY_KEY)).clone().add(0, 1, 0); + Class clazz = Spider.class; + Entity entity = _world.spawn(location, clazz); + _entities.add(entity); + } + } + } + + @EventHandler + public void cancelSuffication(EntityDamageEvent event) + { + if (event.getCause() == DamageCause.SUFFOCATION && _entities.contains(event.getEntity())) + { + event.setCancelled(true); + } + } + +} diff --git a/Plugins/mineplex-game-gemhunters/src/mineplex/gemhunters/world/WorldDataModule.java b/Plugins/mineplex-game-gemhunters/src/mineplex/gemhunters/world/WorldDataModule.java new file mode 100644 index 000000000..6bce809d5 --- /dev/null +++ b/Plugins/mineplex-game-gemhunters/src/mineplex/gemhunters/world/WorldDataModule.java @@ -0,0 +1,298 @@ +package mineplex.gemhunters.world; + +import java.io.BufferedReader; +import java.io.DataInputStream; +import java.io.File; +import java.io.FileInputStream; +import java.io.InputStreamReader; +import java.util.ArrayList; +import java.util.LinkedHashMap; +import java.util.List; +import java.util.Map; + +import org.bukkit.Bukkit; +import org.bukkit.Difficulty; +import org.bukkit.Location; +import org.bukkit.World; + +import mineplex.core.MiniPlugin; +import mineplex.core.ReflectivelyCreateMiniPlugin; +import mineplex.core.common.timing.TimingManager; + +@ReflectivelyCreateMiniPlugin +public class WorldDataModule extends MiniPlugin +{ + + public World World; + public int MinX = 0; + public int MinZ = 0; + public int MaxX = 0; + public int MaxZ = 0; + + public int MinY = -1; + public int MaxY = 256; + + private final Map> SPAWN_LOCATIONS = new LinkedHashMap<>(); + private final Map> DATA_LOCATIONS = new LinkedHashMap<>(); + private final Map> CUSTOM_LOCAITONS = new LinkedHashMap<>(); + + private WorldDataModule() + { + super("World Data"); + + initialize(); + } + + public void initialize() + { + final WorldDataModule worldData = this; + + World = Bukkit.getWorlds().get(0); + + World.setDifficulty(Difficulty.EASY); + World.setGameRuleValue("showDeathMessages", "false"); + + TimingManager.start("WorldData loading WorldConfig."); + worldData.loadWorldConfig(); + TimingManager.stop("WorldData loading WorldConfig."); + } + + public String getFolder() + { + return "world"; + } + + public void loadWorldConfig() + { + // Load Track Data + String line = null; + + try + { + FileInputStream fstream = new FileInputStream(getFolder() + File.separator + "WorldConfig.dat"); + DataInputStream in = new DataInputStream(fstream); + BufferedReader br = new BufferedReader(new InputStreamReader(in)); + + List currentTeam = null; + List currentData = null; + + int currentDirection = 0; + + while ((line = br.readLine()) != null) + { + String[] tokens = line.split(":"); + + if (tokens.length < 2) + { + continue; + } + + String key = tokens[0]; + String value = tokens[1]; + + if (key.length() == 0) + { + continue; + } + + // Spawn Locations + if (key.equalsIgnoreCase("TEAM_NAME")) + { + SPAWN_LOCATIONS.put(value, new ArrayList()); + currentTeam = SPAWN_LOCATIONS.get(value); + currentDirection = 0; + } + else if (key.equalsIgnoreCase("TEAM_DIRECTION")) + { + currentDirection = Integer.parseInt(value); + } + else if (key.equalsIgnoreCase("TEAM_SPAWNS")) + { + for (int i = 1; i < tokens.length; i++) + { + Location loc = stringToLocation(tokens[i]); + if (loc == null) + continue; + + loc.setYaw(currentDirection); + + currentTeam.add(loc); + } + } + + // Data Locations + else if (key.equalsIgnoreCase("DATA_NAME")) + { + DATA_LOCATIONS.put(value, new ArrayList()); + currentData = DATA_LOCATIONS.get(value); + } + else if (key.equalsIgnoreCase("DATA_LOCS")) + { + for (int i = 1; i < tokens.length; i++) + { + Location loc = stringToLocation(tokens[i]); + if (loc == null) + continue; + + currentData.add(loc); + } + } + + // Custom Locations + else if (key.equalsIgnoreCase("CUSTOM_NAME")) + { + CUSTOM_LOCAITONS.put(value, new ArrayList()); + currentData = CUSTOM_LOCAITONS.get(value); + } + else if (key.equalsIgnoreCase("CUSTOM_LOCS")) + { + for (int i = 1; i < tokens.length; i++) + { + Location loc = stringToLocation(tokens[i]); + if (loc == null) + continue; + + currentData.add(loc); + } + } + + // Map Bounds + else if (key.equalsIgnoreCase("MIN_X")) + { + try + { + MinX = Integer.parseInt(value); + } + catch (Exception e) + { + System.out.println("World Data Read Error: Invalid MinX [" + value + "]"); + } + + } + else if (key.equalsIgnoreCase("MAX_X")) + { + try + { + MaxX = Integer.parseInt(value); + } + catch (Exception e) + { + System.out.println("World Data Read Error: Invalid MaxX [" + value + "]"); + } + } + else if (key.equalsIgnoreCase("MIN_Z")) + { + try + { + MinZ = Integer.parseInt(value); + } + catch (Exception e) + { + System.out.println("World Data Read Error: Invalid MinZ [" + value + "]"); + } + } + else if (key.equalsIgnoreCase("MAX_Z")) + { + try + { + MaxZ = Integer.parseInt(value); + } + catch (Exception e) + { + System.out.println("World Data Read Error: Invalid MaxZ [" + value + "]"); + } + } + else if (key.equalsIgnoreCase("MIN_Y")) + { + try + { + MinY = Integer.parseInt(value); + } + catch (Exception e) + { + System.out.println("World Data Read Error: Invalid MinY [" + value + "]"); + } + } + else if (key.equalsIgnoreCase("MAX_Y")) + { + try + { + MaxY = Integer.parseInt(value); + } + catch (Exception e) + { + System.out.println("World Data Read Error: Invalid MaxY [" + value + "]"); + } + } + } + + in.close(); + } + catch (Exception e) + { + e.printStackTrace(); + System.err.println("Line: " + line); + } + } + + private Location stringToLocation(String loc) + { + String[] coords = loc.split(","); + + try + { + return new Location(World, Integer.valueOf(coords[0]) + 0.5, Integer.valueOf(coords[1]), Integer.valueOf(coords[2]) + 0.5); + } + catch (Exception e) + { + System.out.println("World Data Read Error: Invalid Location String [" + loc + "]"); + } + + return null; + } + + public List getSpawnLocation(String colour) + { + if (!SPAWN_LOCATIONS.containsKey(colour)) + { + return new ArrayList(); + } + + return SPAWN_LOCATIONS.get(colour); + } + + public List getDataLocation(String colour) + { + if (!DATA_LOCATIONS.containsKey(colour)) + { + return new ArrayList(); + } + + return DATA_LOCATIONS.get(colour); + } + + public List getCustomLocation(String id) + { + if (!CUSTOM_LOCAITONS.containsKey(id)) + { + return new ArrayList(); + } + + return CUSTOM_LOCAITONS.get(id); + } + + public Map> getAllSpawnLocations() + { + return SPAWN_LOCATIONS; + } + + public Map> getAllCustomLocations() + { + return CUSTOM_LOCAITONS; + } + + public Map> getAllDataLocations() + { + return DATA_LOCATIONS; + } +} diff --git a/Plugins/mineplex-game-gemhunters/src/mineplex/gemhunters/world/WorldListeners.java b/Plugins/mineplex-game-gemhunters/src/mineplex/gemhunters/world/WorldListeners.java new file mode 100644 index 000000000..b81b81279 --- /dev/null +++ b/Plugins/mineplex-game-gemhunters/src/mineplex/gemhunters/world/WorldListeners.java @@ -0,0 +1,221 @@ +package mineplex.gemhunters.world; + +import java.io.File; +import java.util.UUID; + +import org.bukkit.GameMode; +import org.bukkit.Location; +import org.bukkit.Material; +import org.bukkit.World; +import org.bukkit.block.Block; +import org.bukkit.entity.ArmorStand; +import org.bukkit.entity.ItemFrame; +import org.bukkit.entity.Player; +import org.bukkit.event.EventHandler; +import org.bukkit.event.EventPriority; +import org.bukkit.event.Listener; +import org.bukkit.event.block.BlockBreakEvent; +import org.bukkit.event.block.BlockBurnEvent; +import org.bukkit.event.block.BlockFadeEvent; +import org.bukkit.event.block.BlockIgniteEvent; +import org.bukkit.event.block.BlockIgniteEvent.IgniteCause; +import org.bukkit.event.block.BlockPlaceEvent; +import org.bukkit.event.block.LeavesDecayEvent; +import org.bukkit.event.entity.EntityDamageEvent; +import org.bukkit.event.entity.FoodLevelChangeEvent; +import org.bukkit.event.hanging.HangingBreakEvent; +import org.bukkit.event.player.PlayerArmorStandManipulateEvent; +import org.bukkit.event.player.PlayerInteractAtEntityEvent; +import org.bukkit.event.player.PlayerInteractEntityEvent; +import org.bukkit.event.player.PlayerInteractEvent; +import org.bukkit.event.player.PlayerQuitEvent; +import org.bukkit.event.weather.WeatherChangeEvent; +import org.bukkit.event.world.ChunkUnloadEvent; +import org.bukkit.plugin.java.JavaPlugin; + +import mineplex.core.common.util.UtilPlayer; +import mineplex.core.common.util.UtilWorld; +import mineplex.minecraft.game.core.damage.CustomDamageEvent; + +public class WorldListeners implements Listener +{ + + private final JavaPlugin _plugin; + + public WorldListeners(JavaPlugin plugin) + { + _plugin = plugin; + + plugin.getServer().getPluginManager().registerEvents(this, plugin); + } + + @EventHandler + public void deletePlayerData(PlayerQuitEvent event) + { + _plugin.getServer().getScheduler().runTaskLater(_plugin, () -> { + World world = event.getPlayer().getWorld(); + UUID uuid = event.getPlayer().getUniqueId(); + String path = world.getWorldFolder().getPath(); + new File(path + File.separator + "playerdata" + File.separator + uuid + ".dat").delete(); + new File(path + File.separator + "stats" + File.separator + uuid + ".json").delete(); + }, 10); + } + + @EventHandler + public void customDamage(CustomDamageEvent event) + { + event.SetDamageToLevel(false); + } + + @EventHandler(priority = EventPriority.LOWEST) + public void blockBreak(BlockBreakEvent event) + { + if (shouldBlock(event.getPlayer())) + { + event.setCancelled(true); + } + } + + @EventHandler(priority = EventPriority.LOWEST) + public void blockPlace(BlockPlaceEvent event) + { + if (event.getBlockPlaced().getType() != Material.CAKE_BLOCK && event.getItemInHand() != null && event.getItemInHand().getType() != Material.FLINT_AND_STEEL && shouldBlock(event.getPlayer())) + { + event.setCancelled(true); + } + } + + @EventHandler + public void armorStandEdit(PlayerArmorStandManipulateEvent event) + { + if (shouldBlock(event.getPlayer())) + { + event.setCancelled(true); + } + } + + @EventHandler + public void entityDestory(PlayerInteractAtEntityEvent event) + { + if (shouldBlock(event.getPlayer())) + { + event.setCancelled(true); + } + } + + @EventHandler + public void entityDamage(EntityDamageEvent event) + { + if (event.getEntity() instanceof ArmorStand || event.getEntity() instanceof ItemFrame) + { + event.setCancelled(true); + } + } + + @EventHandler + public void paintings(HangingBreakEvent event) + { + event.setCancelled(true); + } + + @EventHandler + public void itemFrames(PlayerInteractEntityEvent event) + { + if (event.getRightClicked() instanceof ItemFrame) + { + event.setCancelled(true); + } + } + + @EventHandler + public void interact(PlayerInteractEvent event) + { + if (UtilPlayer.isSpectator(event.getPlayer())) + { + event.setCancelled(true); + } + + Block block = event.getClickedBlock(); + + if (block == null) + { + return; + } + + Material material = block.getType(); + + if (material == Material.BEACON || material == Material.DISPENSER || material == Material.HOPPER || material == Material.BREWING_STAND || material == Material.DROPPER) + { + event.setCancelled(true); + } + } + + @EventHandler + public void chunkUnload(ChunkUnloadEvent event) + { + if (!UtilWorld.inWorldBorder(new Location(event.getWorld(), event.getChunk().getX(), 0, event.getChunk().getZ()))) + { + return; + } + + if (event.getChunk().getEntities().length == 0) + { + return; + } + + event.setCancelled(true); + } + + @EventHandler + public void fireSpread(BlockIgniteEvent event) + { + if (event.getCause() == IgniteCause.FLINT_AND_STEEL) + { + return; + } + + event.setCancelled(true); + } + + @EventHandler + public void fireSpread(BlockBurnEvent event) + { + event.setCancelled(true); + } + + @EventHandler + public void blockDecay(BlockFadeEvent event) + { + event.setCancelled(true); + } + + @EventHandler + public void leavesDecay(LeavesDecayEvent event) + { + event.setCancelled(true); + } + + @EventHandler + public void hungerChange(FoodLevelChangeEvent event) + { + Player player = (Player) event.getEntity(); + + // Some witchcraft from the arcade, seems to make hunger not ridiculous. + player.setSaturation(3.8F); + } + + @EventHandler(priority = EventPriority.LOWEST) + public void weather(WeatherChangeEvent event) + { + if (event.toWeatherState()) + { + event.setCancelled(true); + } + } + + public boolean shouldBlock(Player player) + { + return player.getGameMode() != GameMode.CREATIVE; + } + +} diff --git a/Plugins/mineplex-game-gemhunters/src/mineplex/gemhunters/worldevent/WorldEvent.java b/Plugins/mineplex-game-gemhunters/src/mineplex/gemhunters/worldevent/WorldEvent.java new file mode 100644 index 000000000..3113e2020 --- /dev/null +++ b/Plugins/mineplex-game-gemhunters/src/mineplex/gemhunters/worldevent/WorldEvent.java @@ -0,0 +1,179 @@ +package mineplex.gemhunters.worldevent; + +import java.util.HashSet; +import java.util.Iterator; +import java.util.Set; + +import org.bukkit.Location; +import org.bukkit.entity.Entity; +import org.bukkit.entity.LivingEntity; +import org.bukkit.event.EventHandler; +import org.bukkit.event.Listener; + +import mineplex.core.Managers; +import mineplex.core.common.util.C; +import mineplex.core.common.util.F; +import mineplex.core.common.util.UtilServer; +import mineplex.core.common.util.UtilTextMiddle; +import mineplex.core.updater.UpdateType; +import mineplex.core.updater.event.UpdateEvent; +import mineplex.gemhunters.loot.LootModule; +import mineplex.gemhunters.world.WorldDataModule; +import mineplex.minecraft.game.core.damage.DamageManager; + +public abstract class WorldEvent implements Listener +{ + + private final WorldEventType _eventType; + + private WorldEventState _eventState; + + protected final DamageManager _damage; + protected final LootModule _loot; + protected final WorldDataModule _worldData; + protected final WorldEventModule _worldEvent; + + protected final Set _entities; + + protected long _start; + private long _complete; + + public WorldEvent(WorldEventType eventType) + { + _eventType = eventType; + _eventState = null; + + _damage = Managers.get(DamageManager.class); + _loot = Managers.get(LootModule.class); + _worldData = Managers.get(WorldDataModule.class); + _worldEvent = Managers.get(WorldEventModule.class); + + _entities = new HashSet<>(); + + _worldEvent.registerEvents(this); + } + + public abstract void onStart(); + + public abstract boolean checkToEnd(); + + public abstract void onEnd(); + + public abstract Location[] getEventLocations(); + + public abstract double getProgress(); + + private final void start() + { + if (isLive()) + { + return; + } + + UtilTextMiddle.display(C.cRed + _eventType.getName(), C.cGray + "World Event is starting!", 20, 60, 20); + UtilServer.broadcast(F.main(_worldEvent.getName(), "The " + F.elem(_eventType.getName()) + " world event is starting!")); + + _start = System.currentTimeMillis(); + onStart(); + } + + private final void end() + { + _complete = System.currentTimeMillis(); + + UtilServer.broadcast(F.main(_worldEvent.getName(), "The " + F.elem(_eventType.getName()) + " world event is over!")); + + for (LivingEntity entity : _entities) + { + entity.remove(); + } + + _entities.clear(); + + onEnd(); + } + + @EventHandler + public void updateEntities(UpdateEvent event) + { + if (event.getType() != UpdateType.SEC) + { + return; + } + + Iterator iterator = _entities.iterator(); + + while (iterator.hasNext()) + { + Entity entity = iterator.next(); + + if (entity.isDead() || !entity.isValid()) + { + entity.remove(); + iterator.remove(); + } + } + } + + public void addEntity(LivingEntity entity) + { + _entities.add(entity); + } + + public WorldEventType getEventType() + { + return _eventType; + } + + public void setEventState(WorldEventState eventState) + { + _eventState = eventState; + + if (eventState == null) + { + return; + } + + switch (eventState) + { + case WARMUP: + start(); + break; + case COMPLETE: + end(); + break; + default: + break; + } + } + + public boolean isEnabled() + { + return _eventState != null; + } + + public boolean isWarmup() + { + return _eventState == WorldEventState.WARMUP; + } + + public boolean isLive() + { + return _eventState == WorldEventState.LIVE; + } + + public boolean isInProgress() + { + return isWarmup() || isLive(); + } + + public WorldEventState getEventState() + { + return _eventState; + } + + public long getCompleteTime() + { + return _complete; + } +} diff --git a/Plugins/mineplex-game-gemhunters/src/mineplex/gemhunters/worldevent/WorldEventModule.java b/Plugins/mineplex-game-gemhunters/src/mineplex/gemhunters/worldevent/WorldEventModule.java new file mode 100644 index 000000000..2e16bbab7 --- /dev/null +++ b/Plugins/mineplex-game-gemhunters/src/mineplex/gemhunters/worldevent/WorldEventModule.java @@ -0,0 +1,164 @@ +package mineplex.gemhunters.worldevent; + +import java.util.ArrayList; +import java.util.Arrays; +import java.util.HashSet; +import java.util.Iterator; +import java.util.List; +import java.util.Set; +import java.util.concurrent.TimeUnit; + +import org.bukkit.event.EventHandler; + +import mineplex.core.MiniPlugin; +import mineplex.core.ReflectivelyCreateMiniPlugin; +import mineplex.core.common.util.C; +import mineplex.core.common.util.UtilAlg; +import mineplex.core.common.util.UtilServer; +import mineplex.core.common.util.UtilTextTop; +import mineplex.core.common.util.UtilTime; +import mineplex.core.updater.UpdateType; +import mineplex.core.updater.event.UpdateEvent; +import mineplex.gemhunters.worldevent.blizzard.BlizzardWorldEvent; +import mineplex.gemhunters.worldevent.command.WorldEventCommand; +import mineplex.gemhunters.worldevent.giant.GiantWorldEvent; +import mineplex.gemhunters.worldevent.gwenmart.GwenMartWorldEvent; +import mineplex.gemhunters.worldevent.wither.WitherWorldEvent; + +@ReflectivelyCreateMiniPlugin +public class WorldEventModule extends MiniPlugin +{ + + private static final long EVENT_TIMER = TimeUnit.MINUTES.toMillis(30); + private static final long EVENT_COOLDOWN_TIMER = TimeUnit.MINUTES.toMillis(40); + private static final long COMPLETE_TIMER = TimeUnit.SECONDS.toMillis(30); + + private final List _events; + + private WorldEventModule() + { + super("World Event"); + + _events = Arrays.asList( + + new GiantWorldEvent(), + new BlizzardWorldEvent(), + //new NetherPortalWorldEvent(), + new WitherWorldEvent(), + new GwenMartWorldEvent() + + ); + } + + @Override + public void addCommands() + { + addCommand(new WorldEventCommand(this)); + } + + public void startEvent(WorldEventType eventType) + { + WorldEvent event = getEvent(eventType); + + event.setEventState(WorldEventState.WARMUP); + } + + public void startRandomEvent() + { + WorldEventType[] eventTypes = WorldEventType.values(); + Set possibleWorldEvents = new HashSet<>(); + + for (WorldEventType eventType : eventTypes) + { + if (UtilTime.elapsed(eventType.getLast(), EVENT_COOLDOWN_TIMER) || eventType.getPriority() == WorldEventPriority.TRIGGERED) + { + continue; + } + + possibleWorldEvents.add(eventType); + } + + if (possibleWorldEvents.isEmpty()) + { + return; + } + + startEvent(UtilAlg.Random(possibleWorldEvents)); + } + + @EventHandler + public void checkNextEvent(UpdateEvent event) + { + if (event.getType() != UpdateType.SEC) + { + return; + } + + Iterator iterator = _events.iterator(); + + while (iterator.hasNext()) + { + WorldEvent worldEvent = iterator.next(); + + if (worldEvent.getEventState() == WorldEventState.COMPLETE && UtilTime.elapsed(worldEvent.getCompleteTime(), COMPLETE_TIMER)) + { + worldEvent.setEventState(null); + } + else if (worldEvent.getEventState() == WorldEventState.LIVE && worldEvent.checkToEnd()) + { + worldEvent.setEventState(WorldEventState.COMPLETE); + } + } + } + + @EventHandler + public void displayStatus(UpdateEvent event) + { + if (event.getType() != UpdateType.SEC || !isEventActive()) + { + return; + } + + WorldEvent worldEvent = getActiveEvents().get(0); + + UtilTextTop.displayProgress(C.cRed + worldEvent.getEventType().getName() + C.cYellow + " -> " + C.cRed + worldEvent.getEventState().getName(), worldEvent.getProgress(), UtilServer.getPlayers()); + } + + public WorldEvent getEvent(WorldEventType eventType) + { + for (WorldEvent event : _events) + { + if (event.getEventType() == eventType) + { + return event; + } + } + + return null; + } + + public boolean isEventActive() + { + return !getActiveEvents().isEmpty(); + } + + public List getActiveEvents() + { + List events = new ArrayList<>(); + + for (WorldEvent event : _events) + { + if (event.isInProgress()) + { + events.add(event); + } + } + + return events; + } + + public long getEventTimer() + { + return EVENT_TIMER; + } +} diff --git a/Plugins/mineplex-game-gemhunters/src/mineplex/gemhunters/worldevent/WorldEventPriority.java b/Plugins/mineplex-game-gemhunters/src/mineplex/gemhunters/worldevent/WorldEventPriority.java new file mode 100644 index 000000000..8aba307b8 --- /dev/null +++ b/Plugins/mineplex-game-gemhunters/src/mineplex/gemhunters/worldevent/WorldEventPriority.java @@ -0,0 +1,8 @@ +package mineplex.gemhunters.worldevent; + +public enum WorldEventPriority +{ + + GLOBAL, TRIGGERED + +} diff --git a/Plugins/mineplex-game-gemhunters/src/mineplex/gemhunters/worldevent/WorldEventState.java b/Plugins/mineplex-game-gemhunters/src/mineplex/gemhunters/worldevent/WorldEventState.java new file mode 100644 index 000000000..e7babc0c9 --- /dev/null +++ b/Plugins/mineplex-game-gemhunters/src/mineplex/gemhunters/worldevent/WorldEventState.java @@ -0,0 +1,15 @@ +package mineplex.gemhunters.worldevent; + +public enum WorldEventState +{ + + WARMUP, + LIVE, + COMPLETE; + + public String getName() + { + return name().charAt(0) + name().toLowerCase().substring(1); + } + +} diff --git a/Plugins/mineplex-game-gemhunters/src/mineplex/gemhunters/worldevent/WorldEventType.java b/Plugins/mineplex-game-gemhunters/src/mineplex/gemhunters/worldevent/WorldEventType.java new file mode 100644 index 000000000..670084763 --- /dev/null +++ b/Plugins/mineplex-game-gemhunters/src/mineplex/gemhunters/worldevent/WorldEventType.java @@ -0,0 +1,39 @@ +package mineplex.gemhunters.worldevent; + +public enum WorldEventType +{ + + GIANT("Zombie Awakening", WorldEventPriority.TRIGGERED), + BLZZARD("Hurricane", WorldEventPriority.GLOBAL), + NETHER("Dark Portal", WorldEventPriority.TRIGGERED), + WITHER("Wither Temple", WorldEventPriority.TRIGGERED), + GWEN_MART("Gwen-Mart Mega Sale", WorldEventPriority.GLOBAL), + + ; + + private String _name; + private WorldEventPriority _priority; + private long _last; + + private WorldEventType(String name, WorldEventPriority priority) + { + _name = name; + _priority = priority; + _last = 0; + } + + public String getName() + { + return _name; + } + + public WorldEventPriority getPriority() + { + return _priority; + } + + public long getLast() + { + return _last; + } +} diff --git a/Plugins/mineplex-game-gemhunters/src/mineplex/gemhunters/worldevent/blizzard/BlizzardWorldEvent.java b/Plugins/mineplex-game-gemhunters/src/mineplex/gemhunters/worldevent/blizzard/BlizzardWorldEvent.java new file mode 100644 index 000000000..776e17506 --- /dev/null +++ b/Plugins/mineplex-game-gemhunters/src/mineplex/gemhunters/worldevent/blizzard/BlizzardWorldEvent.java @@ -0,0 +1,206 @@ +package mineplex.gemhunters.worldevent.blizzard; + +import java.util.concurrent.TimeUnit; + +import org.bukkit.Bukkit; +import org.bukkit.Location; +import org.bukkit.Material; +import org.bukkit.World; +import org.bukkit.block.Block; +import org.bukkit.entity.Player; +import org.bukkit.event.EventHandler; +import org.bukkit.event.entity.EntityDamageEvent.DamageCause; +import org.bukkit.event.weather.WeatherChangeEvent; +import org.bukkit.inventory.ItemStack; + +import mineplex.core.Managers; +import mineplex.core.common.util.C; +import mineplex.core.common.util.F; +import mineplex.core.common.util.UtilBlock; +import mineplex.core.common.util.UtilItem; +import mineplex.core.common.util.UtilServer; +import mineplex.core.common.util.UtilTextBottom; +import mineplex.core.common.util.UtilTime; +import mineplex.core.updater.UpdateType; +import mineplex.core.updater.event.UpdateEvent; +import mineplex.gemhunters.playerstatus.PlayerStatus; +import mineplex.gemhunters.playerstatus.PlayerStatusModule; +import mineplex.gemhunters.playerstatus.PlayerStatusType; +import mineplex.gemhunters.safezone.SafezoneModule; +import mineplex.gemhunters.worldevent.WorldEvent; +import mineplex.gemhunters.worldevent.WorldEventState; +import mineplex.gemhunters.worldevent.WorldEventType; + +public class BlizzardWorldEvent extends WorldEvent +{ + + private static final double START_CHANCE = 0.01; + private static final long MAX_TIME = TimeUnit.MINUTES.toMillis(10); + private static final long GRACE_TIME = TimeUnit.SECONDS.toMillis(60); + private static final long WARM_TIME = TimeUnit.SECONDS.toMillis(5); + private static final int DAMAGE = 2; + private static final String TIP = "EQUIP LEATHER ARMOUR OR GET NEAR A FIRE"; + + private final SafezoneModule _safezone; + private final PlayerStatusModule _playerStatus; + + private boolean _colour; + + public BlizzardWorldEvent() + { + super(WorldEventType.BLZZARD); + + _safezone = Managers.get(SafezoneModule.class); + _playerStatus = Managers.get(PlayerStatusModule.class); + } + + @EventHandler + public void trigger(UpdateEvent event) + { + if (event.getType() != UpdateType.SLOWEST) + { + return; + } + + if (Math.random() < START_CHANCE) + { + setEventState(WorldEventState.LIVE); + } + } + + @EventHandler + public void weatherChange(WeatherChangeEvent event) + { + if (event.toWeatherState() && isEnabled()) + { + event.setCancelled(false); + } + } + + @EventHandler + public void damage(UpdateEvent event) + { + if (!isInProgress()) + { + return; + } + + if (!UtilTime.elapsed(_start, GRACE_TIME)) + { + if (event.getType() == UpdateType.SEC) + { + _colour = !_colour; + UtilTextBottom.display((_colour ? C.cRedB : C.cWhiteB) + "STORM COMING IN " + UtilTime.MakeStr(_start + GRACE_TIME - System.currentTimeMillis()) + " " + TIP, UtilServer.getPlayers()); + } + } + else if (isWarmup()) + { + setEventState(WorldEventState.LIVE); + + World world = _worldData.World; + + world.setStorm(true); + world.setThundering(true); + } + else if (event.getType() == UpdateType.SEC_05 && isLive()) + { + for (Player player : Bukkit.getOnlinePlayers()) + { + if (shouldDamage(player)) + { + _damage.NewDamageEvent(player, null, null, DamageCause.CUSTOM, DAMAGE, false, true, true, "Hurricane", "Frostbite"); + } + } + } + } + + private boolean shouldDamage(Player player) + { + String safezone = _safezone.getSafezone(player.getLocation()); + + if (safezone != null && safezone.contains(SafezoneModule.SAFEZONE_DATA_IGNORE)) + { + return false; + } + + for (Block block : UtilBlock.getInBoundingBox(player.getLocation().add(4, 2, 4), player.getLocation().subtract(4, 0, 4))) + { + if (block.getType() == Material.FIRE) + { + return false; + } + } + + for (ItemStack itemStack : player.getInventory().getArmorContents()) + { + if (!UtilItem.isLeatherProduct(itemStack)) + { + UtilTextBottom.display(C.cRedB + TIP, player); + player.sendMessage(F.main(_worldEvent.getName(), "Equip leather armor or get near a fire to stop taking damage!")); + return true; + } + } + + _playerStatus.setStatus(player, PlayerStatusType.WARM, WARM_TIME); + return false; + } + + @EventHandler + public void updatePlayerStatus(UpdateEvent event) + { + if (event.getType() != UpdateType.SLOW || !isLive()) + { + return; + } + + for (Player player : Bukkit.getOnlinePlayers()) + { + PlayerStatus status = _playerStatus.Get(player); + + if (status.getStatusType() == PlayerStatusType.COLD) + { + continue; + } + + _playerStatus.setStatus(player, PlayerStatusType.COLD, true); + } + } + + @Override + public void onStart() + { + } + + @Override + public boolean checkToEnd() + { + return UtilTime.elapsed(_start, MAX_TIME); + } + + @Override + public void onEnd() + { + World world = _worldData.World; + + world.setStorm(false); + world.setThundering(false); + + for (Player player : Bukkit.getOnlinePlayers()) + { + _playerStatus.setStatus(player, PlayerStatusType.DANGER, true); + } + } + + @Override + public Location[] getEventLocations() + { + return null; + } + + @Override + public double getProgress() + { + return (double) (_start + MAX_TIME - System.currentTimeMillis()) / (double) MAX_TIME; + } + +} diff --git a/Plugins/mineplex-game-gemhunters/src/mineplex/gemhunters/worldevent/command/StartCommand.java b/Plugins/mineplex-game-gemhunters/src/mineplex/gemhunters/worldevent/command/StartCommand.java new file mode 100644 index 000000000..45177f9a0 --- /dev/null +++ b/Plugins/mineplex-game-gemhunters/src/mineplex/gemhunters/worldevent/command/StartCommand.java @@ -0,0 +1,57 @@ +package mineplex.gemhunters.worldevent.command; + +import org.bukkit.entity.Player; + +import mineplex.core.command.CommandBase; +import mineplex.core.common.Rank; +import mineplex.core.common.util.C; +import mineplex.core.common.util.F; +import mineplex.gemhunters.worldevent.WorldEventModule; +import mineplex.gemhunters.worldevent.WorldEventType; + +public class StartCommand extends CommandBase +{ + + public StartCommand(WorldEventModule plugin) + { + super(plugin, Rank.ADMIN, "start"); + } + + @Override + public void Execute(Player caller, String[] args) + { + if (args.length == 0) + { + caller.sendMessage(F.main(Plugin.getName(), "Starting a random world event.")); + Plugin.startRandomEvent(); + return; + } + + String name = ""; + + for (int i = 0; i < args.length; i++) + { + name += args[i] + " "; + } + + name = name.trim(); + + for (WorldEventType eventType : WorldEventType.values()) + { + if (name.equalsIgnoreCase(eventType.getName())) + { + caller.sendMessage(F.main(Plugin.getName(), "Starting the " + F.elem(eventType.getName()) + " world event.")); + Plugin.startEvent(eventType); + return; + } + } + + caller.sendMessage(F.main(Plugin.getName(), "I wasn\'t able to find a world event by the name " + F.elem(args[0]) + ". Possible values:")); + + for (WorldEventType eventType : WorldEventType.values()) + { + caller.sendMessage(C.cGray + "- " + F.elem(eventType.getName())); + } + } + +} diff --git a/Plugins/mineplex-game-gemhunters/src/mineplex/gemhunters/worldevent/command/StopCommand.java b/Plugins/mineplex-game-gemhunters/src/mineplex/gemhunters/worldevent/command/StopCommand.java new file mode 100644 index 000000000..0c2887354 --- /dev/null +++ b/Plugins/mineplex-game-gemhunters/src/mineplex/gemhunters/worldevent/command/StopCommand.java @@ -0,0 +1,53 @@ +package mineplex.gemhunters.worldevent.command; + +import org.bukkit.entity.Player; + +import mineplex.core.command.CommandBase; +import mineplex.core.common.Rank; +import mineplex.core.common.util.C; +import mineplex.core.common.util.F; +import mineplex.gemhunters.worldevent.WorldEvent; +import mineplex.gemhunters.worldevent.WorldEventModule; +import mineplex.gemhunters.worldevent.WorldEventState; + +public class StopCommand extends CommandBase +{ + + public StopCommand(WorldEventModule plugin) + { + super(plugin, Rank.ADMIN, "stop"); + } + + @Override + public void Execute(Player caller, String[] args) + { + if (args.length == 0) + { + caller.sendMessage(F.main(Plugin.getName(), "Stopping all world events.")); + + for (WorldEvent event : Plugin.getActiveEvents()) + { + event.setEventState(WorldEventState.COMPLETE); + } + return; + } + + for (WorldEvent event : Plugin.getActiveEvents()) + { + if (args[0].equalsIgnoreCase(event.getEventType().name()) && event.getEventState() != WorldEventState.COMPLETE) + { + caller.sendMessage(F.main(Plugin.getName(), "Stopping " + F.elem(event.getEventType().name()) + ".")); + event.setEventState(WorldEventState.COMPLETE); + return; + } + } + + caller.sendMessage(F.main(Plugin.getName(), "I wasn\'t able to find an active world event by the name " + F.elem(args[0]) + ". Possible values:")); + + for (WorldEvent event : Plugin.getActiveEvents()) + { + caller.sendMessage(C.cGray + "- " + F.elem(event.getEventType().name())); + } + } + +} diff --git a/Plugins/mineplex-game-gemhunters/src/mineplex/gemhunters/worldevent/command/WorldEventCommand.java b/Plugins/mineplex-game-gemhunters/src/mineplex/gemhunters/worldevent/command/WorldEventCommand.java new file mode 100644 index 000000000..9669379b4 --- /dev/null +++ b/Plugins/mineplex-game-gemhunters/src/mineplex/gemhunters/worldevent/command/WorldEventCommand.java @@ -0,0 +1,29 @@ +package mineplex.gemhunters.worldevent.command; + +import org.bukkit.entity.Player; + +import mineplex.core.command.MultiCommandBase; +import mineplex.core.common.Rank; +import mineplex.core.common.util.F; +import mineplex.gemhunters.worldevent.WorldEventModule; + +public class WorldEventCommand extends MultiCommandBase +{ + + public WorldEventCommand(WorldEventModule plugin) + { + super(plugin, Rank.ADMIN, "worldevent", "we"); + + AddCommand(new StartCommand(plugin)); + AddCommand(new StopCommand(plugin)); + } + + @Override + protected void Help(Player caller, String[] args) + { + caller.sendMessage(F.main(Plugin.getName(), "Command List:")); + caller.sendMessage(F.help("/" + _aliasUsed + " start [name]", "Starts a world event. Leaving [name] blank picks a random one.", Rank.ADMIN)); + caller.sendMessage(F.help("/" + _aliasUsed + " stop [name]", "Stops a world event. Leaving [name] blank stops all events.", Rank.ADMIN)); + } + +} diff --git a/Plugins/mineplex-game-gemhunters/src/mineplex/gemhunters/worldevent/giant/CustomGiant.java b/Plugins/mineplex-game-gemhunters/src/mineplex/gemhunters/worldevent/giant/CustomGiant.java new file mode 100644 index 000000000..283c10c27 --- /dev/null +++ b/Plugins/mineplex-game-gemhunters/src/mineplex/gemhunters/worldevent/giant/CustomGiant.java @@ -0,0 +1,194 @@ +package mineplex.gemhunters.worldevent.giant; + +import java.util.ArrayList; +import java.util.Collection; + +import org.bukkit.Bukkit; +import org.bukkit.Location; +import org.bukkit.Material; +import org.bukkit.block.Block; +import org.bukkit.entity.FallingBlock; +import org.bukkit.entity.Giant; +import org.bukkit.entity.Monster; +import org.bukkit.entity.Player; +import org.bukkit.event.EventHandler; +import org.bukkit.event.Listener; +import org.bukkit.event.entity.EntityDamageEvent.DamageCause; +import org.bukkit.event.player.PlayerQuitEvent; +import org.bukkit.util.Vector; + +import mineplex.core.Managers; +import mineplex.core.common.util.UtilAlg; +import mineplex.core.common.util.UtilBlock; +import mineplex.core.common.util.UtilEnt; +import mineplex.core.common.util.UtilMath; +import mineplex.core.common.util.UtilPlayer; +import mineplex.core.common.util.UtilServer; +import mineplex.core.updater.UpdateType; +import mineplex.core.updater.event.UpdateEvent; +import mineplex.gemhunters.safezone.SafezoneModule; +import mineplex.gemhunters.spawn.SpawnModule; +import mineplex.minecraft.game.core.damage.DamageManager; + +public class CustomGiant implements Listener +{ + + private static final int GIANT_HEALTH = 500; + private static final int GIANT_WIDTH = 5; + private static final int GIANT_HEIGHT = 13; + private static final float DESTORY_FALLING_BLOCK_CHANCE = 0.04F; + private static final float MOVE_FACTOR = 0.3F; + private static final int MAX_SEARCH_DISTANCE_SQUARED = 2500; + private static final int TOO_CLOSE_DISTANCE_SQUARED = 625; + private static final int DAMAGE_RADIUS = 4; + private static final int DAMAGE = 4; + + private final DamageManager _damage; + private final SafezoneModule _safezone; + + private final Monster _giant; + + private final Location _fallback; + private Location _target; + + public CustomGiant(Location spawn) + { + _damage = Managers.require(DamageManager.class); + _safezone = Managers.require(SafezoneModule.class); + + spawn.getChunk().load(); + _giant = spawn.getWorld().spawn(spawn, Giant.class); + + _giant.setMaxHealth(GIANT_HEALTH); + _giant.setHealth(_giant.getMaxHealth()); + _giant.setRemoveWhenFarAway(false); + + UtilEnt.vegetate(_giant); + UtilEnt.ghost(_giant, true, false); + UtilEnt.setFakeHead(_giant, true); + + _fallback = Managers.get(SpawnModule.class).getCenter(); + } + + @EventHandler + public void updateMovement(UpdateEvent event) + { + if (event.getType() != UpdateType.FASTEST || Bukkit.getOnlinePlayers().isEmpty()) + { + if (event.getType() == UpdateType.SEC) + { + _target = acquireTarget(); + } + + return; + } + + if (_target == null) + { + return; + } + + if (_target.equals(_fallback) && UtilMath.offsetSquared(_giant.getLocation(), _fallback) < TOO_CLOSE_DISTANCE_SQUARED) + { + return; + } + + if (_safezone.isInSafeZone(_giant.getLocation())) + { + _target = _fallback; + } + + Vector direction = UtilAlg.getTrajectory2d(_giant.getLocation(), _target).multiply(MOVE_FACTOR); + Location toTeleport = _giant.getLocation().add(direction); + Location heightCheck = _giant.getLocation().add(direction.clone().multiply(2)); + + if (Math.abs(UtilBlock.getHighest(_giant.getWorld(), heightCheck).getLocation().getY() - _giant.getLocation().getY()) <= 1) + { + toTeleport.add(0, 1, 0); + } + + toTeleport.setYaw(UtilAlg.GetYaw(direction)); + toTeleport.setPitch(UtilAlg.GetPitch(direction)); + + _giant.teleport(toTeleport); + } + + @EventHandler + public void updateBlockDestroy(UpdateEvent event) + { + if (event.getType() != UpdateType.FASTER) + { + return; + } + + for (Block block : UtilBlock.getInBoundingBox(_giant.getLocation().add(-GIANT_WIDTH, 1, -GIANT_WIDTH), _giant.getLocation().add(GIANT_WIDTH, GIANT_HEIGHT, GIANT_WIDTH))) + { + if (_safezone.isInSafeZone(block.getLocation())) + { + continue; + } + + if (Math.random() < DESTORY_FALLING_BLOCK_CHANCE) + { + FallingBlock fallingBlock = block.getWorld().spawnFallingBlock(block.getLocation(), block.getType(), block.getData()); + + fallingBlock.setDropItem(false); + fallingBlock.setHurtEntities(false); + fallingBlock.setVelocity(new Vector(UtilMath.random(-1, 1), UtilMath.random(0.5, 1), UtilMath.random(-1, 1))); + } + + block.setType(Material.AIR); + } + } + + @EventHandler + public void updateDamage(UpdateEvent event) + { + if (event.getType() != UpdateType.FASTER) + { + return; + } + + for (Player player : UtilPlayer.getInRadius(_giant.getLocation(), DAMAGE_RADIUS).keySet()) + { + _damage.NewDamageEvent(player, _giant, null, DamageCause.ENTITY_ATTACK, DAMAGE, true, true, false, UtilEnt.getName(_giant), "Zombie Awakening"); + } + } + + @EventHandler + public void playerQuit(PlayerQuitEvent event) + { + if (event.getPlayer().equals(_target)) + { + _target = acquireTarget(); + } + } + + public Location acquireTarget() + { + Collection ignore = new ArrayList<>(); + + for (Player player : UtilServer.getPlayers()) + { + if (UtilPlayer.isSpectator(player) || _safezone.isInSafeZone(player.getLocation())) + { + ignore.add(player); + } + } + + Player player = UtilPlayer.getClosest(_giant.getLocation(), ignore); + + if (player == null) + { + return _fallback; + } + + return UtilMath.offsetSquared(_giant, player) > MAX_SEARCH_DISTANCE_SQUARED ? _fallback : player.getLocation(); + } + + public Monster getGiant() + { + return _giant; + } + +} diff --git a/Plugins/mineplex-game-gemhunters/src/mineplex/gemhunters/worldevent/giant/GiantWorldEvent.java b/Plugins/mineplex-game-gemhunters/src/mineplex/gemhunters/worldevent/giant/GiantWorldEvent.java new file mode 100644 index 000000000..1461add88 --- /dev/null +++ b/Plugins/mineplex-game-gemhunters/src/mineplex/gemhunters/worldevent/giant/GiantWorldEvent.java @@ -0,0 +1,138 @@ +package mineplex.gemhunters.worldevent.giant; + +import java.util.ArrayList; +import java.util.concurrent.TimeUnit; + +import org.bukkit.Location; +import org.bukkit.entity.Entity; +import org.bukkit.entity.LivingEntity; +import org.bukkit.entity.Zombie; +import org.bukkit.event.EventHandler; +import org.bukkit.event.entity.EntityCombustEvent; +import org.bukkit.event.entity.PlayerDeathEvent; +import org.bukkit.inventory.ItemStack; +import org.bukkit.potion.PotionEffect; +import org.bukkit.potion.PotionEffectType; + +import mineplex.core.common.skin.SkinData; +import mineplex.core.common.util.C; +import mineplex.core.common.util.F; +import mineplex.core.common.util.UtilMath; +import mineplex.core.common.util.UtilServer; +import mineplex.core.common.util.UtilTime; +import mineplex.core.updater.UpdateType; +import mineplex.core.updater.event.UpdateEvent; +import mineplex.gemhunters.loot.rewards.LootChestReward; +import mineplex.gemhunters.worldevent.WorldEvent; +import mineplex.gemhunters.worldevent.WorldEventState; +import mineplex.gemhunters.worldevent.WorldEventType; + +public class GiantWorldEvent extends WorldEvent +{ + + private static final double START_CHANCE = 0.01; + private static final int MINI_ZOMBIES = 10; + private static final int MINI_ZOMBIES_MAX_DISTANCE_SQUARED = 2500; + private static final long MAX_TIME = TimeUnit.MINUTES.toMillis(5); + private static final long CASH_OUT_DELAY = TimeUnit.MINUTES.toMillis(10); + + private CustomGiant _giant; + + public GiantWorldEvent() + { + super(WorldEventType.GIANT); + } + + @EventHandler + public void trigger(PlayerDeathEvent event) + { + if (Math.random() < START_CHANCE) + { + setEventState(WorldEventState.WARMUP); + } + } + + @Override + public void onStart() + { + _giant = new CustomGiant(_worldData.getCustomLocation("GIANT_SPAWN").get(0)); + addEntity(_giant.getGiant()); + + _worldEvent.registerEvents(_giant); + + setEventState(WorldEventState.LIVE); + } + + @Override + public boolean checkToEnd() + { + return UtilTime.elapsed(_start, MAX_TIME) || _giant.getGiant().isDead() || !_giant.getGiant().isValid(); + } + + @Override + public void onEnd() + { + ItemStack itemStack = SkinData.OMEGA_CHEST.getSkull(C.cAqua + "Omega Chest", new ArrayList<>()); + LootChestReward reward = new LootChestReward(CASH_OUT_DELAY, SkinData.OMEGA_CHEST.getSkull(C.cAqua + "Omega Chest", null), "Omega", 1); + + _worldData.World.dropItemNaturally(getEventLocations()[0], itemStack); + + _loot.addItemReward(reward); + UtilServer.broadcast(F.main(_worldEvent.getName(), "The Giant has been killed! And has dropped loot!")); + + UtilServer.Unregister(_giant); + _giant = null; + } + + @Override + public Location[] getEventLocations() + { + return new Location[] { _giant.getGiant().getLocation() }; + } + + @Override + public double getProgress() + { + LivingEntity giant = _giant.getGiant(); + + return giant.getHealth() / giant.getMaxHealth(); + } + + @EventHandler + public void zombieCombust(EntityCombustEvent event) + { + if (_entities.contains(event.getEntity())) + { + event.setCancelled(true); + } + } + + @EventHandler + public void update(UpdateEvent event) + { + if (event.getType() != UpdateType.SEC || _giant == null) + { + return; + } + + for (Entity entity : _entities) + { + if (UtilMath.offsetSquared(entity, _giant.getGiant()) > MINI_ZOMBIES_MAX_DISTANCE_SQUARED) + { + entity.teleport(_giant.getGiant()); + } + } + + // -1 for the giant + if (_entities.size() - 1 < MINI_ZOMBIES) + { + Zombie zombie = _worldData.World.spawn(_giant.getGiant().getLocation(), Zombie.class); + + zombie.setRemoveWhenFarAway(false); + zombie.addPotionEffect(new PotionEffect(PotionEffectType.SPEED, Integer.MAX_VALUE, 1)); + + addEntity(zombie); + } + } + +} diff --git a/Plugins/mineplex-game-gemhunters/src/mineplex/gemhunters/worldevent/gwenmart/GwenMartWorldEvent.java b/Plugins/mineplex-game-gemhunters/src/mineplex/gemhunters/worldevent/gwenmart/GwenMartWorldEvent.java new file mode 100644 index 000000000..a827912c0 --- /dev/null +++ b/Plugins/mineplex-game-gemhunters/src/mineplex/gemhunters/worldevent/gwenmart/GwenMartWorldEvent.java @@ -0,0 +1,172 @@ +package mineplex.gemhunters.worldevent.gwenmart; + +import java.util.List; +import java.util.concurrent.TimeUnit; + +import org.bukkit.Bukkit; +import org.bukkit.Location; +import org.bukkit.Material; +import org.bukkit.entity.Player; +import org.bukkit.event.EventHandler; + +import mineplex.core.Managers; +import mineplex.core.blockrestore.BlockRestore; +import mineplex.core.common.util.C; +import mineplex.core.common.util.UtilAlg; +import mineplex.core.common.util.UtilMath; +import mineplex.core.common.util.UtilServer; +import mineplex.core.common.util.UtilTextBottom; +import mineplex.core.common.util.UtilTime; +import mineplex.core.updater.UpdateType; +import mineplex.core.updater.event.UpdateEvent; +import mineplex.gemhunters.worldevent.WorldEvent; +import mineplex.gemhunters.worldevent.WorldEventState; +import mineplex.gemhunters.worldevent.WorldEventType; + +public class GwenMartWorldEvent extends WorldEvent +{ + + private static final double START_CHANCE = 0.01; + private static final long WARMUP_TIME = TimeUnit.MINUTES.toMillis(3); + private static final long MAX_TIME = TimeUnit.MINUTES.toMillis(8); + + private final BlockRestore _restore; + + private final Location _average; + private List _door; + private boolean _colour; + + public GwenMartWorldEvent() + { + super(WorldEventType.GWEN_MART); + + _restore = Managers.require(BlockRestore.class); + _average = UtilAlg.getAverageLocation(_worldData.getCustomLocation("GWEN_MART")); + _door = _worldData.getCustomLocation(String.valueOf(Material.EMERALD_BLOCK.getId())); + + _worldEvent.runSyncLater(() -> { + + for (Location location : _door) + { + location.getBlock().setType(Material.WOOD); + } + + }, 20); + } + + @EventHandler + public void trigger(UpdateEvent event) + { + if (event.getType() != UpdateType.SLOWEST) + { + return; + } + + if (Math.random() < START_CHANCE) + { + setEventState(WorldEventState.LIVE); + } + } + + @EventHandler + public void updateOpening(UpdateEvent event) + { + if (event.getType() != UpdateType.SEC) + { + return; + } + + _colour = !_colour; + + if (UtilTime.elapsed(_start, WARMUP_TIME) && isWarmup()) + { + for (Location location : _door) + { + _restore.add(location.getBlock(), 0, (byte) 0, Long.MAX_VALUE); + } + + for (Location location : _worldData.getCustomLocation("GWEN_MART_CHEST")) + { + location.getBlock().setType(Material.CHEST); + _loot.addSpawnedChest(location, getRandomChestKey()); + } + + setEventState(WorldEventState.LIVE); + } + else if (isLive()) + { + UtilTextBottom.display((_colour ? C.cDAquaB : C.cWhiteB) + "GWEN MART IS CLOSING IN " + UtilTime.MakeStr(_start + MAX_TIME - System.currentTimeMillis()), UtilServer.getPlayers()); + } + else if (isWarmup()) + { + UtilTextBottom.display((_colour ? C.cDAquaB : C.cWhiteB) + "GWEN MART IS OPENING IN " + UtilTime.MakeStr(_start + WARMUP_TIME - System.currentTimeMillis()), UtilServer.getPlayers()); + } + } + + @Override + public void onStart() + { + } + + @Override + public boolean checkToEnd() + { + return UtilTime.elapsed(_start, MAX_TIME); + } + + @Override + public void onEnd() + { + Location teleportTo = _worldData.getCustomLocation("GWEN_MART_TP").get(0); + + for (Player player : Bukkit.getOnlinePlayers()) + { + if (isInGwenMart(player.getLocation())) + { + player.leaveVehicle(); + player.teleport(teleportTo); + } + } + + for (Location location : _door) + { + _restore.restore(location.getBlock()); + } + } + + @Override + public Location[] getEventLocations() + { + return new Location[] { _average }; + } + + @Override + public double getProgress() + { + return (double) (_start + MAX_TIME - System.currentTimeMillis()) / (double) MAX_TIME; + } + + private boolean isInGwenMart(Location location) + { + List locations = _worldData.getCustomLocation("GWEN_MART"); + + return UtilAlg.inBoundingBox(location, locations.get(0), locations.get(1)); + } + + private String getRandomChestKey() + { + double random = Math.random(); + + if (random > 0.6) + { + return "ORANGE"; + } + else if (random > 0.1) + { + return "PINK"; + } + + return "GREEN"; + } + +} diff --git a/Plugins/mineplex-game-gemhunters/src/mineplex/gemhunters/worldevent/nether/NetherPortalWorldEvent.java b/Plugins/mineplex-game-gemhunters/src/mineplex/gemhunters/worldevent/nether/NetherPortalWorldEvent.java new file mode 100644 index 000000000..1d7530265 --- /dev/null +++ b/Plugins/mineplex-game-gemhunters/src/mineplex/gemhunters/worldevent/nether/NetherPortalWorldEvent.java @@ -0,0 +1,215 @@ +package mineplex.gemhunters.worldevent.nether; + +import java.util.ArrayList; +import java.util.List; +import java.util.concurrent.TimeUnit; + +import org.bukkit.Location; +import org.bukkit.Material; +import org.bukkit.block.Block; +import org.bukkit.entity.Player; +import org.bukkit.entity.Skeleton; +import org.bukkit.event.EventHandler; +import org.bukkit.event.entity.EntityTargetEvent; +import org.bukkit.event.player.PlayerInteractEvent; +import org.bukkit.event.player.PlayerQuitEvent; +import org.bukkit.inventory.ItemStack; + +import mineplex.core.Managers; +import mineplex.core.blockrestore.BlockRestore; +import mineplex.core.common.util.C; +import mineplex.core.common.util.F; +import mineplex.core.common.util.UtilAlg; +import mineplex.core.common.util.UtilBlock; +import mineplex.core.common.util.UtilEvent; +import mineplex.core.common.util.UtilInv; +import mineplex.core.common.util.UtilEvent.ActionType; +import mineplex.core.common.util.UtilServer; +import mineplex.core.common.util.UtilTime; +import mineplex.core.itemstack.ItemBuilder; +import mineplex.core.utils.UtilVariant; +import mineplex.gemhunters.loot.rewards.LootChestReward; +import mineplex.gemhunters.worldevent.WorldEvent; +import mineplex.gemhunters.worldevent.WorldEventState; +import mineplex.gemhunters.worldevent.WorldEventType; + +public class NetherPortalWorldEvent extends WorldEvent +{ + + private static final int PORTALS = 5; + private static final long MAX_TIME = TimeUnit.MINUTES.toMillis(20); + private static final int SKELETONS_PER_PORTAL = 10; + private static final long CASH_OUT_DELAY = TimeUnit.MINUTES.toMillis(10); + + private final BlockRestore _restore; + + private Player _player; + private List _portalLocations; + private List _portalBlocks; + private long _portalLit; + + public NetherPortalWorldEvent() + { + super(WorldEventType.NETHER); + + _restore = Managers.require(BlockRestore.class); + _portalLocations = new ArrayList<>(); + _portalBlocks = new ArrayList<>(50); + _portalLit = 0; + } + + @EventHandler + public void lightPortal(PlayerInteractEvent event) + { + if (!UtilEvent.isAction(event, ActionType.R_BLOCK)) + { + return; + } + + Player player = event.getPlayer(); + Block block = event.getClickedBlock(); + + if (player.getItemInHand() == null || player.getItemInHand().getType() != Material.FLINT_AND_STEEL) + { + return; + } + + if (!_portalBlocks.contains(block)) + { + return; + } + + if (_portalLit == 0) + { + _portalLit = System.currentTimeMillis(); + + for (Location location : _portalLocations) + { + lightPortal(location); + } + + _player = player; + UtilServer.broadcast(F.main(_worldEvent.getName(), F.name(player.getName()) + " has lit a nether portal and become the " + F.color("Pumpkin King", C.cGold) + "! They now have 5 Omega Chests!")); + ItemStack itemStack = new ItemBuilder(Material.ENDER_CHEST).setTitle(C.cAqua + "5 Omega Chests").build(); + LootChestReward reward = new LootChestReward(CASH_OUT_DELAY, itemStack, "Omega", 5); + + _loot.addItemReward(reward); + + if (UtilInv.hasSpace(player, 1)) + { + reward.collectItem(player); + player.getInventory().addItem(itemStack); + } + else + { + _worldData.World.dropItemNaturally(player.getLocation(), itemStack); + } + + for (Location location : _portalLocations) + { + for (int i = 0; i < SKELETONS_PER_PORTAL; i++) + { + Skeleton skeleton = UtilVariant.spawnWitherSkeleton(location); + + skeleton.setCustomName(C.cGold + "Pumpkin Minions"); + skeleton.setCustomNameVisible(true); + + addEntity(skeleton); + } + } + + setEventState(WorldEventState.LIVE); + } + } + + @EventHandler + public void playerQuit(PlayerQuitEvent event) + { + if (_player != null && event.getPlayer().equals(_player)) + { + setEventState(WorldEventState.COMPLETE); + } + } + + @EventHandler + public void entityTarget(EntityTargetEvent event) + { + if (_player != null && _entities.contains(event) && _player.equals(event.getTarget())) + { + event.setCancelled(true); + } + } + + @Override + public void onStart() + { + List storedLocations = _worldData.getCustomLocation("NETHER_PORTAL"); + + for (int i = 0; i < PORTALS; i++) + { + Location location = UtilAlg.Random(storedLocations); + + if (_portalLocations.contains(location)) + { + continue; + } + + _portalLocations.add(location); + buildPortal(location); + } + + UtilServer.broadcast(F.main(_worldEvent.getName(), "Portals have spawned around the map!")); + } + + @Override + public boolean checkToEnd() + { + return UtilTime.elapsed(_start, MAX_TIME); + } + + @Override + public void onEnd() + { + _portalLocations.clear(); + + for (Block block : _portalBlocks) + { + _restore.restore(block); + } + + _portalLit = 0; + } + + @Override + public Location[] getEventLocations() + { + return _portalLocations.toArray(new Location[0]); + } + + @Override + public double getProgress() + { + return (double) (_start + MAX_TIME - System.currentTimeMillis()) / (double) MAX_TIME; + } + + private void buildPortal(Location location) + { + location.getBlock().setType(Material.SPONGE); + + for (Block block : UtilBlock.getInBoundingBox(location.clone().add(2, 4, 0), location.clone().add(-2, 0, 0), false, true, false, false)) + { + _restore.add(block, Material.OBSIDIAN.getId(), (byte) 0, Integer.MAX_VALUE); + _portalBlocks.add(block); + } + } + + private void lightPortal(Location location) + { + for (Block block : UtilBlock.getInBoundingBox(location.clone().add(1, 3, 0), location.clone().add(-1, 1, 0), false, true, false, false)) + { + _restore.add(block, Material.PORTAL.getId(), (byte) 0, Integer.MAX_VALUE); + _portalBlocks.add(block); + } + } + +} diff --git a/Plugins/mineplex-game-gemhunters/src/mineplex/gemhunters/worldevent/wither/WitherWorldEvent.java b/Plugins/mineplex-game-gemhunters/src/mineplex/gemhunters/worldevent/wither/WitherWorldEvent.java new file mode 100644 index 000000000..3e263c048 --- /dev/null +++ b/Plugins/mineplex-game-gemhunters/src/mineplex/gemhunters/worldevent/wither/WitherWorldEvent.java @@ -0,0 +1,159 @@ + +package mineplex.gemhunters.worldevent.wither; + +import java.util.concurrent.TimeUnit; + +import org.bukkit.Location; +import org.bukkit.Material; +import org.bukkit.block.Block; +import org.bukkit.block.BlockFace; +import org.bukkit.entity.Player; +import org.bukkit.entity.Skeleton; +import org.bukkit.event.EventHandler; +import org.bukkit.event.EventPriority; +import org.bukkit.event.block.BlockPlaceEvent; +import org.bukkit.inventory.ItemStack; + +import mineplex.core.common.util.F; +import mineplex.core.common.util.UtilAlg; +import mineplex.core.common.util.UtilTime; +import mineplex.core.utils.UtilVariant; +import mineplex.gemhunters.worldevent.WorldEvent; +import mineplex.gemhunters.worldevent.WorldEventState; +import mineplex.gemhunters.worldevent.WorldEventType; + +public class WitherWorldEvent extends WorldEvent +{ + + private static final long MAX_TIME = TimeUnit.MINUTES.toMillis(5); + private static final int SKELETONS = 5; + private static final ItemStack IN_HAND = new ItemStack(Material.STONE_SWORD); + private static final int HEALTH = 40; + private static final int RADIUS = 5; + + private Location[] _skulls; + + public WitherWorldEvent() + { + super(WorldEventType.WITHER); + + _worldEvent.runSyncLater(() -> buildAlter(), 20); + } + + @EventHandler(priority = EventPriority.HIGHEST) + public void trigger(BlockPlaceEvent event) + { + if (_skulls == null) + { + return; + } + + Player player = event.getPlayer(); + Block block = event.getBlock(); + boolean start = true; + + // Check for allowed placement + for (Location location : _skulls) + { + if (block.getLocation().equals(location)) + { + event.setCancelled(false); + player.sendMessage(F.main(_worldEvent.getName(), "grrrrr....")); + break; + } + } + + // Check for all skulls + for (Location location : _skulls) + { + if (location.getBlock().getType() != Material.SKULL) + { + start = false; + } + } + + // Start Event + if (start) + { + setEventState(WorldEventState.WARMUP); + } + } + + @Override + public void onStart() + { + Location location = _worldData.getCustomLocation("WITHER_ALTER").get(0).clone().add(0, 1, 0); + + for (Location skull : _skulls) + { + skull.getBlock().setType(Material.AIR); + } + + Block chest = location.getBlock().getRelative(BlockFace.UP); + + chest.setType(Material.ENDER_CHEST); + _loot.addSpawnedChest(chest.getLocation(), "PURPLE"); + + for (int i = 0; i < SKELETONS; i++) + { + Skeleton skeleton = UtilVariant.spawnWitherSkeleton(UtilAlg.getRandomLocation(location, RADIUS, 0, RADIUS)); + + skeleton.getEquipment().setItemInHand(IN_HAND); + skeleton.setMaxHealth(HEALTH); + skeleton.setHealth(HEALTH); + + addEntity(skeleton); + } + + setEventState(WorldEventState.LIVE); + } + + @Override + public boolean checkToEnd() + { + return UtilTime.elapsed(_start, MAX_TIME) || _entities.isEmpty(); + } + + @Override + public void onEnd() + { + for (Location location : _skulls) + { + location.getBlock().setType(Material.AIR); + } + } + + @Override + public Location[] getEventLocations() + { + return new Location[] { _skulls[1] }; + } + + @Override + public double getProgress() + { + return (double) (_start + MAX_TIME - System.currentTimeMillis()) / (double) MAX_TIME; + } + + private void buildAlter() + { + Location point = _worldData.getCustomLocation("WITHER_ALTER").get(0).clone(); + + point.getBlock().setType(Material.SOUL_SAND); + point.add(0, 1, 0).getBlock().setType(Material.SOUL_SAND); + point.add(0, 0, -1).getBlock().setType(Material.SOUL_SAND); + point.add(0, 0, 2).getBlock().setType(Material.SOUL_SAND); + + _skulls = new Location[] { + point.add(0, 1, 0), + point.add(0, 0, -1), + point.add(0, 0, -1) + }; + + for (Location location : _skulls) + { + location.getBlock().setType(Material.SPONGE); + } + } + +} diff --git a/Plugins/mineplex-google-sheets/pom.xml b/Plugins/mineplex-google-sheets/pom.xml new file mode 100644 index 000000000..864b42200 --- /dev/null +++ b/Plugins/mineplex-google-sheets/pom.xml @@ -0,0 +1,61 @@ + + 4.0.0 + + + com.mineplex + mineplex-plugin + dev-SNAPSHOT + ../plugin.xml + + + Google Sheets + mineplex-google-sheets + + + + org.json + json + 20160212 + compile + + + com.google.api-client + google-api-client + 1.22.0 + compile + + + com.google.oauth-client + google-oauth-client-jetty + 1.22.0 + compile + + + com.google.apis + google-api-services-sheets + v4-rev20-1.22.0 + compile + + + + + + + + org.apache.maven.plugins + maven-jar-plugin + + + + true + lib/ + mineplex.googlesheets.GoogleSheetController + + + + + + + + \ No newline at end of file diff --git a/Plugins/mineplex-google-sheets/src/mineplex/googlesheets/GoogleSheetController.java b/Plugins/mineplex-google-sheets/src/mineplex/googlesheets/GoogleSheetController.java new file mode 100644 index 000000000..f6244df65 --- /dev/null +++ b/Plugins/mineplex-google-sheets/src/mineplex/googlesheets/GoogleSheetController.java @@ -0,0 +1,63 @@ +package mineplex.googlesheets; + +import java.io.File; +import java.io.FileWriter; +import java.io.IOException; + +import org.json.JSONObject; + +public class GoogleSheetController +{ + + private static final int SLEEP_TIME = 1000; + private static final String DATA_STORE_DIR = ".." + File.separatorChar + ".." + File.separatorChar + "update" + File.separatorChar + "files"; + + public static void main(String[] args) throws InterruptedException + { + System.out.println("Loading Sheet Provider"); + SheetProvider provider = new SheetProvider(); + System.out.println("Loaded Sheet Provider"); + + for (SpreadsheetType type : SpreadsheetType.values()) + { + System.out.println("Sleeping..."); + Thread.sleep(SLEEP_TIME); + System.out.println("Getting data for " + type.name() + " (" + type.getID() + ")"); + + JSONObject object = provider.asJSONObject(type); + + System.out.println("Done"); + System.out.println("Saving to file..."); + + File dir = new File(DATA_STORE_DIR); + File file = new File(dir + File.separator + type.name() + ".json"); + + if (!dir.exists()) + { + System.out.println("mkdir"); + dir.mkdirs(); + } + + try + { + System.out.println("Deleting"); + file.delete(); + System.out.println("new File"); + file.createNewFile(); + + FileWriter writer = new FileWriter(file); + + System.out.println("Writing"); + writer.write(object.toString()); + + System.out.println("Closing..."); + writer.close(); + } + catch (IOException e) + { + e.printStackTrace(); + } + } + } + +} diff --git a/Plugins/mineplex-google-sheets/src/mineplex/googlesheets/SheetProvider.java b/Plugins/mineplex-google-sheets/src/mineplex/googlesheets/SheetProvider.java new file mode 100644 index 000000000..7d7859c49 --- /dev/null +++ b/Plugins/mineplex-google-sheets/src/mineplex/googlesheets/SheetProvider.java @@ -0,0 +1,160 @@ +package mineplex.googlesheets; + +import java.io.File; +import java.io.FileInputStream; +import java.io.IOException; +import java.io.InputStream; +import java.io.InputStreamReader; +import java.util.Arrays; +import java.util.HashMap; +import java.util.List; +import java.util.Map; + +import org.json.JSONArray; +import org.json.JSONObject; + +import com.google.api.client.auth.oauth2.Credential; +import com.google.api.client.extensions.java6.auth.oauth2.AuthorizationCodeInstalledApp; +import com.google.api.client.extensions.jetty.auth.oauth2.LocalServerReceiver; +import com.google.api.client.googleapis.auth.oauth2.GoogleAuthorizationCodeFlow; +import com.google.api.client.googleapis.auth.oauth2.GoogleClientSecrets; +import com.google.api.client.googleapis.javanet.GoogleNetHttpTransport; +import com.google.api.client.http.HttpTransport; +import com.google.api.client.json.JsonFactory; +import com.google.api.client.json.jackson2.JacksonFactory; +import com.google.api.client.util.store.FileDataStoreFactory; +import com.google.api.services.sheets.v4.Sheets; +import com.google.api.services.sheets.v4.SheetsScopes; +import com.google.api.services.sheets.v4.model.Sheet; +import com.google.api.services.sheets.v4.model.Spreadsheet; + +public class SheetProvider +{ + + /** Application name. */ + private static final String APPLICATION_NAME = "Mineplex Google Sheets"; + + /** Directory to store user credentials for this application. */ + private static final File DATA_STORE_DIR = new File(".." + File.separatorChar + ".." + File.separatorChar + "update" + File.separatorChar + "files"); + + /** Global instance of the {@link FileDataStoreFactory}. */ + private static FileDataStoreFactory DATA_STORE_FACTORY; + + /** Global instance of the JSON factory. */ + private static final JsonFactory JSON_FACTORY = JacksonFactory.getDefaultInstance(); + + /** Global instance of the HTTP transport. */ + private static HttpTransport HTTP_TRANSPORT; + + private static final List SCOPES = Arrays.asList(SheetsScopes.SPREADSHEETS); + + private Sheets _service; + private Credential _credential; + + static + { + try + { + HTTP_TRANSPORT = GoogleNetHttpTransport.newTrustedTransport(); + DATA_STORE_FACTORY = new FileDataStoreFactory(DATA_STORE_DIR); + } + catch (Throwable t) + { + t.printStackTrace(); + } + } + + public SheetProvider() + { + try + { + _credential = authorize(); + _service = getSheetsService(); + } + catch (IOException e) + { + e.printStackTrace(); + } + } + + /** + * Creates an authorized Credential object. + * + * @return an authorized Credential object. + * @throws IOException + */ + public Credential authorize() throws IOException + { + // Load client secrets. + InputStream in = new FileInputStream(DATA_STORE_DIR + File.separator + "client_secret.json"); + GoogleClientSecrets clientSecrets = GoogleClientSecrets.load(JSON_FACTORY, new InputStreamReader(in)); + + // Build flow and trigger user authorization request. + GoogleAuthorizationCodeFlow flow = new GoogleAuthorizationCodeFlow.Builder(HTTP_TRANSPORT, JSON_FACTORY, clientSecrets, SCOPES).setDataStoreFactory(DATA_STORE_FACTORY).setAccessType("offline").build(); + Credential credential = new AuthorizationCodeInstalledApp(flow, new LocalServerReceiver()).authorize("user"); + return credential; + } + + /** + * Build and return an authorized Sheets API client service. + * + * @return an authorized Sheets API client service + * @throws IOException + */ + public Sheets getSheetsService() + { + return new Sheets.Builder(HTTP_TRANSPORT, JSON_FACTORY, _credential).setApplicationName(APPLICATION_NAME).build(); + } + + public JSONObject asJSONObject(SpreadsheetType spreadsheet) + { + JSONObject parent = new JSONObject(); + JSONArray array = new JSONArray(); + Map>> valuesMap = get(spreadsheet); + + for (String sheetName : valuesMap.keySet()) + { + List> values = valuesMap.get(sheetName); + + JSONObject object = new JSONObject(); + + object.put("name", sheetName); + object.put("values", values); + + array.put(object); + } + + parent.put("data", array); + return parent; + } + + public Map>> get(SpreadsheetType spreadsheet) + { + try + { + Spreadsheet googleSpreadsheet = _service.spreadsheets().get(spreadsheet.getID()).execute(); + Map>> valuesMap = new HashMap<>(googleSpreadsheet.getSheets().size() - 1); + + for (Sheet sheet : googleSpreadsheet.getSheets()) + { + String name = sheet.getProperties().getTitle(); + + valuesMap.put(name, get(spreadsheet, name)); + } + + return valuesMap; + } + catch (IOException e) + { + e.printStackTrace(); + } + + return null; + } + + public List> get(SpreadsheetType spreadsheet, String sheetName) throws IOException + { + return _service.spreadsheets().values().get(spreadsheet.getID(), sheetName).execute().getValues(); + } + +} diff --git a/Plugins/mineplex-google-sheets/src/mineplex/googlesheets/SpreadsheetType.java b/Plugins/mineplex-google-sheets/src/mineplex/googlesheets/SpreadsheetType.java new file mode 100644 index 000000000..af2acf11c --- /dev/null +++ b/Plugins/mineplex-google-sheets/src/mineplex/googlesheets/SpreadsheetType.java @@ -0,0 +1,25 @@ +package mineplex.googlesheets; + +/** + * An enum containing all the google spreadsheet links relating to Mineplex.
+ */ +public enum SpreadsheetType +{ + + GEM_HUNTERS_CHESTS("11Noztgbpu_gUKkc5F4evKKfyxS-Jv1coE0IrBToX_gg"), + GEM_HUNTERS_SHOP("1OcYktxVZaW6Fm29Zh6w4Lb-UVyuN8r1x-TFb_3USYYI"), + ; + + private String _id; + + private SpreadsheetType(String id) + { + _id = id; + } + + public String getID() + { + return _id; + } + +} diff --git a/Plugins/pom.xml b/Plugins/pom.xml index 81118c0bf..46ff3c9e3 100644 --- a/Plugins/pom.xml +++ b/Plugins/pom.xml @@ -26,6 +26,7 @@ Mineplex.EnjinTranslator Mineplex.Game.Clans Mineplex.Game.Clans.Core + Mineplex.Game.Clans.Compensation Mineplex.Hub Mineplex.Hub.Clans Mineplex.MapParser @@ -35,9 +36,13 @@ Mineplex.ServerData Mineplex.ServerMonitor Mineplex.StaffServer + Mineplex.Votifier Nautilus.Game.Arcade - + Nautilus.Game.Arcade.UHC.WorldGen + mavericks-review-hub + mineplex-game-gemhunters + mineplex-google-sheets @@ -61,6 +66,12 @@ 2.2.1 compile + + com.vexsoftware + votifier + 1.9 + provided + javax.mail mail @@ -133,11 +144,25 @@ 2.8.1 compile + + junit + junit + 4.12 + test + + + org.hamcrest + hamcrest-library + 1.3 + test + + ${project.name} + ${project.basedir}/test ${project.basedir}/src @@ -173,7 +198,7 @@ org.apache.maven.plugins maven-jar-plugin - 2.6 + 3.0.2 org.apache.maven.plugins