commit
2b3d34debf
@ -35,7 +35,7 @@ public class Arcade extends MGZPlugin {
|
|||||||
@Startup
|
@Startup
|
||||||
public void loadArcade() {
|
public void loadArcade() {
|
||||||
new PlayerDataManager(this);
|
new PlayerDataManager(this);
|
||||||
arcadeManager = new ArcadeManager(this, traveller);
|
arcadeManager = new ArcadeManager(this, traveler);
|
||||||
|
|
||||||
new ScoreboardHandler(this, ArcadeScoreboard.class, 3L);
|
new ScoreboardHandler(this, ArcadeScoreboard.class, 3L);
|
||||||
|
|
||||||
|
@ -32,7 +32,7 @@ import zone.themcgamer.core.common.scheduler.ScheduleType;
|
|||||||
import zone.themcgamer.core.common.scheduler.event.SchedulerEvent;
|
import zone.themcgamer.core.common.scheduler.event.SchedulerEvent;
|
||||||
import zone.themcgamer.core.module.Module;
|
import zone.themcgamer.core.module.Module;
|
||||||
import zone.themcgamer.core.module.ModuleInfo;
|
import zone.themcgamer.core.module.ModuleInfo;
|
||||||
import zone.themcgamer.core.traveller.ServerTraveller;
|
import zone.themcgamer.core.traveler.ServerTraveler;
|
||||||
import zone.themcgamer.core.world.MGZWorld;
|
import zone.themcgamer.core.world.MGZWorld;
|
||||||
|
|
||||||
import java.io.File;
|
import java.io.File;
|
||||||
@ -57,9 +57,9 @@ public class ArcadeManager extends Module {
|
|||||||
private boolean mapsLoaded;
|
private boolean mapsLoaded;
|
||||||
private MapVotingManager mapVotingManager;
|
private MapVotingManager mapVotingManager;
|
||||||
|
|
||||||
public ArcadeManager(JavaPlugin plugin, ServerTraveller traveller) {
|
public ArcadeManager(JavaPlugin plugin, ServerTraveler traveler) {
|
||||||
super(plugin);
|
super(plugin);
|
||||||
new LobbyManager(plugin, this, traveller);
|
new LobbyManager(plugin, this, traveler);
|
||||||
gameManager = new GameManager(plugin);
|
gameManager = new GameManager(plugin);
|
||||||
game = gameManager.getGames().get(0);
|
game = gameManager.getGames().get(0);
|
||||||
MapManager mapManager = new MapManager(plugin);
|
MapManager mapManager = new MapManager(plugin);
|
||||||
|
@ -34,7 +34,7 @@ import zone.themcgamer.core.common.SkullTexture;
|
|||||||
import zone.themcgamer.core.common.Style;
|
import zone.themcgamer.core.common.Style;
|
||||||
import zone.themcgamer.core.module.Module;
|
import zone.themcgamer.core.module.Module;
|
||||||
import zone.themcgamer.core.module.ModuleInfo;
|
import zone.themcgamer.core.module.ModuleInfo;
|
||||||
import zone.themcgamer.core.traveller.ServerTraveller;
|
import zone.themcgamer.core.traveler.ServerTraveler;
|
||||||
import zone.themcgamer.data.Rank;
|
import zone.themcgamer.data.Rank;
|
||||||
|
|
||||||
import java.util.Optional;
|
import java.util.Optional;
|
||||||
@ -67,12 +67,12 @@ public class LobbyManager extends Module {
|
|||||||
.addLoreLine("&7Click to go back to a lobby server").toItemStack();
|
.addLoreLine("&7Click to go back to a lobby server").toItemStack();
|
||||||
|
|
||||||
private final ArcadeManager arcadeManager;
|
private final ArcadeManager arcadeManager;
|
||||||
private final ServerTraveller traveller;
|
private final ServerTraveler traveler;
|
||||||
|
|
||||||
public LobbyManager(JavaPlugin plugin, ArcadeManager arcadeManager, ServerTraveller traveller) {
|
public LobbyManager(JavaPlugin plugin, ArcadeManager arcadeManager, ServerTraveler traveler) {
|
||||||
super(plugin);
|
super(plugin);
|
||||||
this.arcadeManager = arcadeManager;
|
this.arcadeManager = arcadeManager;
|
||||||
this.traveller = traveller;
|
this.traveler = traveler;
|
||||||
}
|
}
|
||||||
|
|
||||||
@EventHandler
|
@EventHandler
|
||||||
@ -127,7 +127,7 @@ public class LobbyManager extends Module {
|
|||||||
}
|
}
|
||||||
new TimeVoteMenu(player).open();
|
new TimeVoteMenu(player).open();
|
||||||
} else if (item.isSimilar(GO_BACK_LOBBY))
|
} else if (item.isSimilar(GO_BACK_LOBBY))
|
||||||
traveller.sendPlayer(player,"Hub");
|
traveler.sendPlayer(player,"Hub");
|
||||||
}
|
}
|
||||||
|
|
||||||
@EventHandler
|
@EventHandler
|
||||||
|
@ -10,7 +10,7 @@ import zone.themcgamer.core.kingdom.command.KingdomCommand;
|
|||||||
import zone.themcgamer.core.module.Module;
|
import zone.themcgamer.core.module.Module;
|
||||||
import zone.themcgamer.core.module.ModuleInfo;
|
import zone.themcgamer.core.module.ModuleInfo;
|
||||||
import zone.themcgamer.core.plugin.MGZPlugin;
|
import zone.themcgamer.core.plugin.MGZPlugin;
|
||||||
import zone.themcgamer.core.traveller.ServerTraveller;
|
import zone.themcgamer.core.traveler.ServerTraveler;
|
||||||
import zone.themcgamer.data.Rank;
|
import zone.themcgamer.data.Rank;
|
||||||
import zone.themcgamer.data.jedis.data.ServerGroup;
|
import zone.themcgamer.data.jedis.data.ServerGroup;
|
||||||
import zone.themcgamer.data.jedis.repository.RedisRepository;
|
import zone.themcgamer.data.jedis.repository.RedisRepository;
|
||||||
@ -28,7 +28,7 @@ public class KingdomManager extends Module {
|
|||||||
|
|
||||||
private final ServerGroupRepository serverGroupRepository;
|
private final ServerGroupRepository serverGroupRepository;
|
||||||
|
|
||||||
public KingdomManager(JavaPlugin plugin, ServerTraveller traveller) {
|
public KingdomManager(JavaPlugin plugin, ServerTraveler traveler) {
|
||||||
super(plugin);
|
super(plugin);
|
||||||
serverGroupRepository = RedisRepository.getRepository(ServerGroupRepository.class).orElse(null);
|
serverGroupRepository = RedisRepository.getRepository(ServerGroupRepository.class).orElse(null);
|
||||||
// JedisCommandHandler.getInstance().addListener(jedisCommand -> {
|
// JedisCommandHandler.getInstance().addListener(jedisCommand -> {
|
||||||
@ -40,7 +40,7 @@ public class KingdomManager extends Module {
|
|||||||
// for (Player player : Bukkit.getOnlinePlayers()) {
|
// for (Player player : Bukkit.getOnlinePlayers()) {
|
||||||
// if (!server.getName().equals(player.getName() + "-1"))
|
// if (!server.getName().equals(player.getName() + "-1"))
|
||||||
// continue;
|
// continue;
|
||||||
// traveller.sendPlayer(player, server);
|
// traveler.sendPlayer(player, server);
|
||||||
// }
|
// }
|
||||||
// }
|
// }
|
||||||
// });
|
// });
|
||||||
|
@ -19,7 +19,7 @@ import zone.themcgamer.core.plugin.command.BuildDataCommand;
|
|||||||
import zone.themcgamer.core.plugin.command.PluginsCommand;
|
import zone.themcgamer.core.plugin.command.PluginsCommand;
|
||||||
import zone.themcgamer.core.server.ServerManager;
|
import zone.themcgamer.core.server.ServerManager;
|
||||||
import zone.themcgamer.core.task.TaskManager;
|
import zone.themcgamer.core.task.TaskManager;
|
||||||
import zone.themcgamer.core.traveller.ServerTraveller;
|
import zone.themcgamer.core.traveler.ServerTraveler;
|
||||||
import zone.themcgamer.core.update.ServerUpdater;
|
import zone.themcgamer.core.update.ServerUpdater;
|
||||||
import zone.themcgamer.data.jedis.JedisController;
|
import zone.themcgamer.data.jedis.JedisController;
|
||||||
import zone.themcgamer.data.jedis.data.server.MinecraftServer;
|
import zone.themcgamer.data.jedis.data.server.MinecraftServer;
|
||||||
@ -49,7 +49,7 @@ public abstract class MGZPlugin extends JavaPlugin {
|
|||||||
protected JedisController jedisController;
|
protected JedisController jedisController;
|
||||||
protected MySQLController mySQLController;
|
protected MySQLController mySQLController;
|
||||||
protected CommandManager commandManager;
|
protected CommandManager commandManager;
|
||||||
protected ServerTraveller traveller;
|
protected ServerTraveler traveler;
|
||||||
protected BadSportSystem badSportSystem;
|
protected BadSportSystem badSportSystem;
|
||||||
protected NametagManager nametagManager;
|
protected NametagManager nametagManager;
|
||||||
|
|
||||||
@ -170,9 +170,9 @@ public abstract class MGZPlugin extends JavaPlugin {
|
|||||||
nametagManager = new NametagManager(this);
|
nametagManager = new NametagManager(this);
|
||||||
|
|
||||||
AccountManager accountManager = new AccountManager(this, mySQLController, nametagManager);
|
AccountManager accountManager = new AccountManager(this, mySQLController, nametagManager);
|
||||||
traveller = new ServerTraveller(this);
|
traveler = new ServerTraveler(this);
|
||||||
new ServerUpdater(this, traveller);
|
new ServerUpdater(this, traveler);
|
||||||
new ServerManager(this, traveller);
|
new ServerManager(this, traveler);
|
||||||
|
|
||||||
badSportSystem = new BadSportSystem(this, mySQLController, accountManager);
|
badSportSystem = new BadSportSystem(this, mySQLController, accountManager);
|
||||||
AccountManager.addMiniAccount(new TaskManager(this));
|
AccountManager.addMiniAccount(new TaskManager(this));
|
||||||
|
@ -10,7 +10,7 @@ import zone.themcgamer.core.module.Module;
|
|||||||
import zone.themcgamer.core.module.ModuleInfo;
|
import zone.themcgamer.core.module.ModuleInfo;
|
||||||
import zone.themcgamer.core.plugin.MGZPlugin;
|
import zone.themcgamer.core.plugin.MGZPlugin;
|
||||||
import zone.themcgamer.core.server.command.*;
|
import zone.themcgamer.core.server.command.*;
|
||||||
import zone.themcgamer.core.traveller.ServerTraveller;
|
import zone.themcgamer.core.traveler.ServerTraveler;
|
||||||
import zone.themcgamer.data.jedis.command.JedisCommandHandler;
|
import zone.themcgamer.data.jedis.command.JedisCommandHandler;
|
||||||
import zone.themcgamer.data.jedis.command.impl.ServerRestartCommand;
|
import zone.themcgamer.data.jedis.command.impl.ServerRestartCommand;
|
||||||
import zone.themcgamer.data.jedis.data.server.MinecraftServer;
|
import zone.themcgamer.data.jedis.data.server.MinecraftServer;
|
||||||
@ -24,13 +24,13 @@ import zone.themcgamer.data.jedis.repository.impl.ServerGroupRepository;
|
|||||||
*/
|
*/
|
||||||
@ModuleInfo(name = "Server Manager")
|
@ModuleInfo(name = "Server Manager")
|
||||||
public class ServerManager extends Module {
|
public class ServerManager extends Module {
|
||||||
public ServerManager(JavaPlugin plugin, ServerTraveller traveller) {
|
public ServerManager(JavaPlugin plugin, ServerTraveler traveler) {
|
||||||
super(plugin);
|
super(plugin);
|
||||||
ServerGroupRepository serverGroupRepository = RedisRepository.getRepository(ServerGroupRepository.class).orElse(null);
|
ServerGroupRepository serverGroupRepository = RedisRepository.getRepository(ServerGroupRepository.class).orElse(null);
|
||||||
MinecraftServerRepository minecraftServerRepository = RedisRepository.getRepository(MinecraftServerRepository.class).orElse(null);
|
MinecraftServerRepository minecraftServerRepository = RedisRepository.getRepository(MinecraftServerRepository.class).orElse(null);
|
||||||
registerCommand(new MonitorCommand());
|
registerCommand(new MonitorCommand());
|
||||||
registerCommand(new ServerCommand(traveller, minecraftServerRepository));
|
registerCommand(new ServerCommand(traveler, minecraftServerRepository));
|
||||||
registerCommand(new HubCommand(traveller));
|
registerCommand(new HubCommand(traveler));
|
||||||
registerCommand(new RestartCommand(this, serverGroupRepository, minecraftServerRepository));
|
registerCommand(new RestartCommand(this, serverGroupRepository, minecraftServerRepository));
|
||||||
registerCommand(new StopCommand(this));
|
registerCommand(new StopCommand(this));
|
||||||
|
|
||||||
@ -41,7 +41,7 @@ public class ServerManager extends Module {
|
|||||||
if (!((ServerRestartCommand) jedisCommand).getServerId().equals(minecraftServer.getId()))
|
if (!((ServerRestartCommand) jedisCommand).getServerId().equals(minecraftServer.getId()))
|
||||||
return;
|
return;
|
||||||
try {
|
try {
|
||||||
traveller.sendAll("Hub", "&6" + minecraftServer.getName() + " &7is restarting");
|
traveler.sendAll("Hub", "&6" + minecraftServer.getName() + " &7is restarting");
|
||||||
} catch (IllegalArgumentException ignored) {}
|
} catch (IllegalArgumentException ignored) {}
|
||||||
Bukkit.getScheduler().scheduleSyncDelayedTask(getPlugin(), () ->
|
Bukkit.getScheduler().scheduleSyncDelayedTask(getPlugin(), () ->
|
||||||
minecraftServer.setState(ServerState.RESTARTING), 10L);
|
minecraftServer.setState(ServerState.RESTARTING), 10L);
|
||||||
|
@ -5,20 +5,20 @@ import org.bukkit.entity.Player;
|
|||||||
import zone.themcgamer.core.command.Command;
|
import zone.themcgamer.core.command.Command;
|
||||||
import zone.themcgamer.core.command.CommandProvider;
|
import zone.themcgamer.core.command.CommandProvider;
|
||||||
import zone.themcgamer.core.common.Style;
|
import zone.themcgamer.core.common.Style;
|
||||||
import zone.themcgamer.core.traveller.ServerTraveller;
|
import zone.themcgamer.core.traveler.ServerTraveler;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @author Braydon
|
* @author Braydon
|
||||||
*/
|
*/
|
||||||
@AllArgsConstructor
|
@AllArgsConstructor
|
||||||
public class HubCommand {
|
public class HubCommand {
|
||||||
private final ServerTraveller traveller;
|
private final ServerTraveler traveler;
|
||||||
|
|
||||||
@Command(name = "hub", aliases = { "lobby" }, description = "Join a random hub", playersOnly = true)
|
@Command(name = "hub", aliases = { "lobby" }, description = "Join a random hub", playersOnly = true)
|
||||||
public void onCommand(CommandProvider command) {
|
public void onCommand(CommandProvider command) {
|
||||||
Player player = command.getPlayer();
|
Player player = command.getPlayer();
|
||||||
try {
|
try {
|
||||||
traveller.sendPlayer(player, "Hub");
|
traveler.sendPlayer(player, "Hub");
|
||||||
} catch (Exception ex) {
|
} catch (Exception ex) {
|
||||||
player.sendMessage(Style.error("Server", "&7Could not find an available hub to send you to!"));
|
player.sendMessage(Style.error("Server", "&7Could not find an available hub to send you to!"));
|
||||||
}
|
}
|
||||||
|
@ -9,7 +9,7 @@ import zone.themcgamer.core.command.Command;
|
|||||||
import zone.themcgamer.core.command.CommandProvider;
|
import zone.themcgamer.core.command.CommandProvider;
|
||||||
import zone.themcgamer.core.common.Style;
|
import zone.themcgamer.core.common.Style;
|
||||||
import zone.themcgamer.core.plugin.MGZPlugin;
|
import zone.themcgamer.core.plugin.MGZPlugin;
|
||||||
import zone.themcgamer.core.traveller.ServerTraveller;
|
import zone.themcgamer.core.traveler.ServerTraveler;
|
||||||
import zone.themcgamer.data.jedis.data.server.MinecraftServer;
|
import zone.themcgamer.data.jedis.data.server.MinecraftServer;
|
||||||
import zone.themcgamer.data.jedis.repository.impl.MinecraftServerRepository;
|
import zone.themcgamer.data.jedis.repository.impl.MinecraftServerRepository;
|
||||||
|
|
||||||
@ -21,7 +21,7 @@ import java.util.Optional;
|
|||||||
*/
|
*/
|
||||||
@AllArgsConstructor
|
@AllArgsConstructor
|
||||||
public class ServerCommand {
|
public class ServerCommand {
|
||||||
private final ServerTraveller traveller;
|
private final ServerTraveler traveler;
|
||||||
private final MinecraftServerRepository minecraftServerRepository;
|
private final MinecraftServerRepository minecraftServerRepository;
|
||||||
|
|
||||||
@Command(name = "server", aliases = { "join", "play" }, description = "Join a server", playersOnly = true)
|
@Command(name = "server", aliases = { "join", "play" }, description = "Join a server", playersOnly = true)
|
||||||
@ -53,7 +53,7 @@ public class ServerCommand {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
try {
|
try {
|
||||||
traveller.sendPlayer(player, minecraftServer);
|
traveler.sendPlayer(player, minecraftServer);
|
||||||
} catch (Exception ex) {
|
} catch (Exception ex) {
|
||||||
player.sendMessage(Style.error("Server", "&7Cannot join &6" + minecraftServer.getName() + " &7at this time: &b" + ex.getLocalizedMessage()));
|
player.sendMessage(Style.error("Server", "&7Cannot join &6" + minecraftServer.getName() + " &7at this time: &b" + ex.getLocalizedMessage()));
|
||||||
}
|
}
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
package zone.themcgamer.core.traveller;
|
package zone.themcgamer.core.traveler;
|
||||||
|
|
||||||
import com.cryptomorin.xseries.XSound;
|
import com.cryptomorin.xseries.XSound;
|
||||||
import net.md_5.bungee.api.chat.ComponentBuilder;
|
import net.md_5.bungee.api.chat.ComponentBuilder;
|
||||||
@ -27,12 +27,12 @@ import java.util.stream.Collectors;
|
|||||||
/**
|
/**
|
||||||
* @author Braydon
|
* @author Braydon
|
||||||
*/
|
*/
|
||||||
@ModuleInfo(name = "Server Traveller")
|
@ModuleInfo(name = "Server Traveler")
|
||||||
public class ServerTraveller extends Module {
|
public class ServerTraveler extends Module {
|
||||||
private final ServerGroupRepository serverGroupRepository;
|
private final ServerGroupRepository serverGroupRepository;
|
||||||
private final MinecraftServerRepository minecraftServerRepository;
|
private final MinecraftServerRepository minecraftServerRepository;
|
||||||
|
|
||||||
public ServerTraveller(JavaPlugin plugin) {
|
public ServerTraveler(JavaPlugin plugin) {
|
||||||
super(plugin);
|
super(plugin);
|
||||||
serverGroupRepository = RedisRepository.getRepository(ServerGroupRepository.class).orElse(null);
|
serverGroupRepository = RedisRepository.getRepository(ServerGroupRepository.class).orElse(null);
|
||||||
minecraftServerRepository = RedisRepository.getRepository(MinecraftServerRepository.class).orElse(null);
|
minecraftServerRepository = RedisRepository.getRepository(MinecraftServerRepository.class).orElse(null);
|
||||||
@ -130,7 +130,7 @@ public class ServerTraveller extends Module {
|
|||||||
if (MGZPlugin.getMinecraftServer().equals(server))
|
if (MGZPlugin.getMinecraftServer().equals(server))
|
||||||
throw new IllegalArgumentException("Player is already connected");
|
throw new IllegalArgumentException("Player is already connected");
|
||||||
if (inform) {
|
if (inform) {
|
||||||
player.sendMessage(new ComponentBuilder(Style.main("Traveller", "Connecting to &6" + server.getName()))
|
player.sendMessage(new ComponentBuilder(Style.main("Traveler", "Connecting to &6" + server.getName()))
|
||||||
.event(new HoverEvent(HoverEvent.Action.SHOW_TEXT, new ComponentBuilder(MiscUtils.arrayToString(
|
.event(new HoverEvent(HoverEvent.Action.SHOW_TEXT, new ComponentBuilder(MiscUtils.arrayToString(
|
||||||
Style.color("&7Server Id: &6" + server.getId()),
|
Style.color("&7Server Id: &6" + server.getId()),
|
||||||
Style.color("&7Type: &6" + server.getGroup().getName())
|
Style.color("&7Type: &6" + server.getGroup().getName())
|
@ -6,7 +6,7 @@ import org.bukkit.plugin.java.JavaPlugin;
|
|||||||
import zone.themcgamer.core.module.Module;
|
import zone.themcgamer.core.module.Module;
|
||||||
import zone.themcgamer.core.module.ModuleInfo;
|
import zone.themcgamer.core.module.ModuleInfo;
|
||||||
import zone.themcgamer.core.plugin.MGZPlugin;
|
import zone.themcgamer.core.plugin.MGZPlugin;
|
||||||
import zone.themcgamer.core.traveller.ServerTraveller;
|
import zone.themcgamer.core.traveler.ServerTraveler;
|
||||||
import zone.themcgamer.data.jedis.data.server.MinecraftServer;
|
import zone.themcgamer.data.jedis.data.server.MinecraftServer;
|
||||||
import zone.themcgamer.data.jedis.data.server.ServerState;
|
import zone.themcgamer.data.jedis.data.server.ServerState;
|
||||||
|
|
||||||
@ -27,15 +27,15 @@ import java.util.concurrent.ThreadLocalRandom;
|
|||||||
public class ServerUpdater extends Module {
|
public class ServerUpdater extends Module {
|
||||||
private static final long CHECK_DELAY = 60L * 20L; // 1 Minute
|
private static final long CHECK_DELAY = 60L * 20L; // 1 Minute
|
||||||
|
|
||||||
private final ServerTraveller traveller;
|
private final ServerTraveler traveler;
|
||||||
|
|
||||||
private boolean updatePendingRestart;
|
private boolean updatePendingRestart;
|
||||||
private long updateFoundTime;
|
private long updateFoundTime;
|
||||||
private int restartDelay;
|
private int restartDelay;
|
||||||
|
|
||||||
public ServerUpdater(JavaPlugin plugin, ServerTraveller traveller) {
|
public ServerUpdater(JavaPlugin plugin, ServerTraveler traveler) {
|
||||||
super(plugin);
|
super(plugin);
|
||||||
this.traveller = traveller;
|
this.traveler = traveler;
|
||||||
|
|
||||||
// Creating the jars directory
|
// Creating the jars directory
|
||||||
File jarsDirectory = new File(File.separator + "home" + File.separator + "minecraft" + File.separator + "upload" + File.separator + "jars");
|
File jarsDirectory = new File(File.separator + "home" + File.separator + "minecraft" + File.separator + "upload" + File.separator + "jars");
|
||||||
@ -92,7 +92,7 @@ public class ServerUpdater extends Module {
|
|||||||
private void update() {
|
private void update() {
|
||||||
MinecraftServer minecraftServer = MGZPlugin.getMinecraftServer();
|
MinecraftServer minecraftServer = MGZPlugin.getMinecraftServer();
|
||||||
try {
|
try {
|
||||||
traveller.sendAll("Hub", "&6" + minecraftServer.getName() + " &7is being updated");
|
traveler.sendAll("Hub", "&6" + minecraftServer.getName() + " &7is being updated");
|
||||||
} catch (IllegalArgumentException ignored) {}
|
} catch (IllegalArgumentException ignored) {}
|
||||||
Bukkit.getScheduler().scheduleSyncDelayedTask(getPlugin(), () -> minecraftServer.setState(ServerState.UPDATING), 10L);
|
Bukkit.getScheduler().scheduleSyncDelayedTask(getPlugin(), () -> minecraftServer.setState(ServerState.UPDATING), 10L);
|
||||||
Bukkit.getScheduler().scheduleSyncDelayedTask(getPlugin(), Bukkit::shutdown, 40L);
|
Bukkit.getScheduler().scheduleSyncDelayedTask(getPlugin(), Bukkit::shutdown, 40L);
|
||||||
|
@ -54,7 +54,7 @@ public class Hub extends MGZPlugin {
|
|||||||
new BasicRankComponent(),
|
new BasicRankComponent(),
|
||||||
new BasicNameComponent()
|
new BasicNameComponent()
|
||||||
});
|
});
|
||||||
new KingdomManager(this, traveller);
|
new KingdomManager(this, traveler);
|
||||||
|
|
||||||
AccountManager.addMiniAccount(new DeliveryManManager(this, mySQLController, true));
|
AccountManager.addMiniAccount(new DeliveryManManager(this, mySQLController, true));
|
||||||
|
|
||||||
|
@ -30,13 +30,14 @@ import zone.themcgamer.core.account.Account;
|
|||||||
import zone.themcgamer.core.account.AccountManager;
|
import zone.themcgamer.core.account.AccountManager;
|
||||||
import zone.themcgamer.core.account.menu.ProfileMenu;
|
import zone.themcgamer.core.account.menu.ProfileMenu;
|
||||||
import zone.themcgamer.core.common.*;
|
import zone.themcgamer.core.common.*;
|
||||||
|
import zone.themcgamer.core.cooldown.CooldownHandler;
|
||||||
import zone.themcgamer.core.world.MGZWorld;
|
import zone.themcgamer.core.world.MGZWorld;
|
||||||
import zone.themcgamer.data.jedis.cache.CacheRepository;
|
import zone.themcgamer.data.jedis.cache.CacheRepository;
|
||||||
import zone.themcgamer.data.jedis.cache.impl.PlayerStatusCache;
|
import zone.themcgamer.data.jedis.cache.impl.PlayerStatusCache;
|
||||||
import zone.themcgamer.data.jedis.repository.RedisRepository;
|
import zone.themcgamer.data.jedis.repository.RedisRepository;
|
||||||
import zone.themcgamer.hub.Hub;
|
import zone.themcgamer.hub.Hub;
|
||||||
import zone.themcgamer.hub.menu.HubsMenu;
|
import zone.themcgamer.hub.menu.HubsMenu;
|
||||||
import zone.themcgamer.hub.menu.TravellerMenu;
|
import zone.themcgamer.hub.menu.TravelerMenu;
|
||||||
import zone.themcgamer.hub.menu.cosmetics.VanityMainMenu;
|
import zone.themcgamer.hub.menu.cosmetics.VanityMainMenu;
|
||||||
|
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
@ -48,8 +49,8 @@ import java.util.Optional;
|
|||||||
* @author Braydon
|
* @author Braydon
|
||||||
*/
|
*/
|
||||||
public class PlayerListener implements Listener {
|
public class PlayerListener implements Listener {
|
||||||
private static final ItemStack TRAVELLER = new ItemBuilder(XMaterial.COMPASS)
|
private static final ItemStack TRAVELER = new ItemBuilder(XMaterial.COMPASS)
|
||||||
.setName("§a§lTraveller §8» §7Select game")
|
.setName("§a§lTraveler §8» §7Select game")
|
||||||
.setLore("§7Click to teleport to a game!")
|
.setLore("§7Click to teleport to a game!")
|
||||||
.toItemStack();
|
.toItemStack();
|
||||||
private static final ItemStack HUB_SELECTOR = new ItemBuilder(XMaterial.BEACON)
|
private static final ItemStack HUB_SELECTOR = new ItemBuilder(XMaterial.BEACON)
|
||||||
@ -80,7 +81,7 @@ public class PlayerListener implements Listener {
|
|||||||
Player player = event.getPlayer();
|
Player player = event.getPlayer();
|
||||||
PlayerUtils.reset(player, true, true, GameMode.ADVENTURE);
|
PlayerUtils.reset(player, true, true, GameMode.ADVENTURE);
|
||||||
|
|
||||||
player.getInventory().setItem(0, TRAVELLER);
|
player.getInventory().setItem(0, TRAVELER);
|
||||||
player.getInventory().setItem(1, HUB_SELECTOR);
|
player.getInventory().setItem(1, HUB_SELECTOR);
|
||||||
player.getInventory().setItem(4, COSMETICS);
|
player.getInventory().setItem(4, COSMETICS);
|
||||||
player.getInventory().setItem(7, SETTINGS);
|
player.getInventory().setItem(7, SETTINGS);
|
||||||
@ -93,7 +94,7 @@ public class PlayerListener implements Listener {
|
|||||||
int online = 0;
|
int online = 0;
|
||||||
Optional<CacheRepository> cacheRepository = RedisRepository.getRepository(CacheRepository.class);
|
Optional<CacheRepository> cacheRepository = RedisRepository.getRepository(CacheRepository.class);
|
||||||
if (cacheRepository.isPresent())
|
if (cacheRepository.isPresent())
|
||||||
online+= cacheRepository.get().getCached().stream().filter(cacheItem -> cacheItem instanceof PlayerStatusCache).count();
|
online += cacheRepository.get().getCached().stream().filter(cacheItem -> cacheItem instanceof PlayerStatusCache).count();
|
||||||
|
|
||||||
for (int i = 0; i < 5; i++)
|
for (int i = 0; i < 5; i++)
|
||||||
player.sendMessage("");
|
player.sendMessage("");
|
||||||
@ -104,22 +105,22 @@ public class PlayerListener implements Listener {
|
|||||||
List<BaseComponent> components = new ArrayList<>();
|
List<BaseComponent> components = new ArrayList<>();
|
||||||
components.addAll(Arrays.asList(new ComponentBuilder(Style.color(" ")).create()));
|
components.addAll(Arrays.asList(new ComponentBuilder(Style.color(" ")).create()));
|
||||||
components.addAll(Arrays.asList(new ComponentBuilder(Style.color("§d§lSTORE"))
|
components.addAll(Arrays.asList(new ComponentBuilder(Style.color("§d§lSTORE"))
|
||||||
.event(new ClickEvent(ClickEvent.Action.OPEN_URL,"https://store.mcgamerzone.net"))
|
.event(new ClickEvent(ClickEvent.Action.OPEN_URL, "https://store.mcgamerzone.net"))
|
||||||
.event(new HoverEvent(HoverEvent.Action.SHOW_TEXT, new ComponentBuilder(Style.color("§dClick to visit our webstore.")).create()))
|
.event(new HoverEvent(HoverEvent.Action.SHOW_TEXT, new ComponentBuilder(Style.color("§dClick to visit our webstore.")).create()))
|
||||||
.create()));
|
.create()));
|
||||||
components.addAll(Arrays.asList(new ComponentBuilder(Style.color(" §8\u25AA ")).create()));
|
components.addAll(Arrays.asList(new ComponentBuilder(Style.color(" §8\u25AA ")).create()));
|
||||||
components.addAll(Arrays.asList(new ComponentBuilder(Style.color("&e&lSITE"))
|
components.addAll(Arrays.asList(new ComponentBuilder(Style.color("&e&lSITE"))
|
||||||
.event(new ClickEvent(ClickEvent.Action.OPEN_URL,"https://mcgamerzone.net"))
|
.event(new ClickEvent(ClickEvent.Action.OPEN_URL, "https://mcgamerzone.net"))
|
||||||
.event(new HoverEvent(HoverEvent.Action.SHOW_TEXT, new ComponentBuilder(Style.color("&eClick to visit our website!")).create()))
|
.event(new HoverEvent(HoverEvent.Action.SHOW_TEXT, new ComponentBuilder(Style.color("&eClick to visit our website!")).create()))
|
||||||
.create()));
|
.create()));
|
||||||
components.addAll(Arrays.asList(new ComponentBuilder(Style.color(" §8\u25AA ")).create()));
|
components.addAll(Arrays.asList(new ComponentBuilder(Style.color(" §8\u25AA ")).create()));
|
||||||
components.addAll(Arrays.asList(new ComponentBuilder(Style.color("&a&lVOTE"))
|
components.addAll(Arrays.asList(new ComponentBuilder(Style.color("&a&lVOTE"))
|
||||||
.event(new ClickEvent(ClickEvent.Action.OPEN_URL,"https://vote.mcgamerzone.net"))
|
.event(new ClickEvent(ClickEvent.Action.OPEN_URL, "https://vote.mcgamerzone.net"))
|
||||||
.event(new HoverEvent(HoverEvent.Action.SHOW_TEXT, new ComponentBuilder(Style.color("&aClick to vote for us!")).create()))
|
.event(new HoverEvent(HoverEvent.Action.SHOW_TEXT, new ComponentBuilder(Style.color("&aClick to vote for us!")).create()))
|
||||||
.create()));
|
.create()));
|
||||||
components.addAll(Arrays.asList(new ComponentBuilder(Style.color(" §8\u25AA ")).create()));
|
components.addAll(Arrays.asList(new ComponentBuilder(Style.color(" §8\u25AA ")).create()));
|
||||||
components.addAll(Arrays.asList(new ComponentBuilder(Style.color("&9&lDISCORD"))
|
components.addAll(Arrays.asList(new ComponentBuilder(Style.color("&9&lDISCORD"))
|
||||||
.event(new ClickEvent(ClickEvent.Action.OPEN_URL,"https://discord.mcgamerzone.net"))
|
.event(new ClickEvent(ClickEvent.Action.OPEN_URL, "https://discord.mcgamerzone.net"))
|
||||||
.event(new HoverEvent(HoverEvent.Action.SHOW_TEXT, new ComponentBuilder(Style.color("&9Click to join our community!")).create()))
|
.event(new HoverEvent(HoverEvent.Action.SHOW_TEXT, new ComponentBuilder(Style.color("&9Click to join our community!")).create()))
|
||||||
.create()));
|
.create()));
|
||||||
player.sendMessage(components.toArray(new BaseComponent[0]));
|
player.sendMessage(components.toArray(new BaseComponent[0]));
|
||||||
@ -142,8 +143,8 @@ public class PlayerListener implements Listener {
|
|||||||
ItemStack item = event.getItem();
|
ItemStack item = event.getItem();
|
||||||
if (item == null)
|
if (item == null)
|
||||||
return;
|
return;
|
||||||
if (item.isSimilar(TRAVELLER))
|
if (item.isSimilar(TRAVELER))
|
||||||
new TravellerMenu(player).open();
|
new TravelerMenu(player).open();
|
||||||
else if (item.isSimilar(HUB_SELECTOR))
|
else if (item.isSimilar(HUB_SELECTOR))
|
||||||
new HubsMenu(player).open();
|
new HubsMenu(player).open();
|
||||||
else if (item.isSimilar(COSMETICS))
|
else if (item.isSimilar(COSMETICS))
|
||||||
@ -189,20 +190,20 @@ public class PlayerListener implements Listener {
|
|||||||
@EventHandler
|
@EventHandler
|
||||||
private void onPortal(EntityPortalEnterEvent event) {
|
private void onPortal(EntityPortalEnterEvent event) {
|
||||||
Entity entity = event.getEntity();
|
Entity entity = event.getEntity();
|
||||||
if (entity instanceof Player) {
|
if (!(entity instanceof Player))
|
||||||
|
return;
|
||||||
|
if (!CooldownHandler.canUse(((Player) entity), "Hub Portal", 500, false))
|
||||||
|
return;
|
||||||
Player player = (Player) entity;
|
Player player = (Player) entity;
|
||||||
|
|
||||||
MGZWorld world = MGZWorld.get(Bukkit.getWorlds().get(0));
|
MGZWorld world = MGZWorld.get(Bukkit.getWorlds().get(0));
|
||||||
Location spawn = world.getDataPoint("PORTAL_SPAWN");
|
Location spawn = world.getDataPoint("PORTAL_SPAWN");
|
||||||
if (spawn != null)
|
if (spawn != null)
|
||||||
spawn.setYaw(MathUtils.getFacingYaw(spawn, world.getDataPoints("LOOK_AT")));
|
spawn.setYaw(MathUtils.getFacingYaw(spawn, world.getDataPoints("LOOK_AT")));
|
||||||
else spawn = hub.getSpawn();
|
else spawn = hub.getSpawn();
|
||||||
player.teleport(spawn);
|
player.teleport(spawn);
|
||||||
|
new TravelerMenu(player).open();
|
||||||
new TravellerMenu(player).open();
|
|
||||||
player.playSound(player.getEyeLocation(), XSound.ENTITY_PLAYER_LEVELUP.parseSound(), 0.9f, 1f);
|
player.playSound(player.getEyeLocation(), XSound.ENTITY_PLAYER_LEVELUP.parseSound(), 0.9f, 1f);
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
@EventHandler
|
@EventHandler
|
||||||
private void onDamage(EntityDamageEvent event) {
|
private void onDamage(EntityDamageEvent event) {
|
||||||
|
@ -38,7 +38,7 @@ public class GameKitsMenu extends Menu {
|
|||||||
set(0, 1, new Button(new ItemBuilder(game.getIcon(), 1)
|
set(0, 1, new Button(new ItemBuilder(game.getIcon(), 1)
|
||||||
.setName("§6§l" + game.getName())
|
.setName("§6§l" + game.getName())
|
||||||
.setLore(lore)
|
.setLore(lore)
|
||||||
.toItemStack(), event -> new TravellerMenu(player).open()));
|
.toItemStack(), event -> new TravelerMenu(player).open()));
|
||||||
|
|
||||||
KitManager kitManager = Module.getModule(KitManager.class);
|
KitManager kitManager = Module.getModule(KitManager.class);
|
||||||
if (kitManager == null)
|
if (kitManager == null)
|
||||||
|
@ -14,7 +14,7 @@ import zone.themcgamer.core.common.menu.MenuType;
|
|||||||
import zone.themcgamer.core.common.menu.UpdatableMenu;
|
import zone.themcgamer.core.common.menu.UpdatableMenu;
|
||||||
import zone.themcgamer.core.module.Module;
|
import zone.themcgamer.core.module.Module;
|
||||||
import zone.themcgamer.core.plugin.MGZPlugin;
|
import zone.themcgamer.core.plugin.MGZPlugin;
|
||||||
import zone.themcgamer.core.traveller.ServerTraveller;
|
import zone.themcgamer.core.traveler.ServerTraveler;
|
||||||
import zone.themcgamer.data.Rank;
|
import zone.themcgamer.data.Rank;
|
||||||
import zone.themcgamer.data.jedis.data.server.MinecraftServer;
|
import zone.themcgamer.data.jedis.data.server.MinecraftServer;
|
||||||
|
|
||||||
@ -80,9 +80,9 @@ public class HubsMenu extends UpdatableMenu {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
close();
|
close();
|
||||||
ServerTraveller traveller = Module.getModule(ServerTraveller.class);
|
ServerTraveler traveler = Module.getModule(ServerTraveler.class);
|
||||||
if (traveller != null)
|
if (traveler != null)
|
||||||
traveller.sendPlayer(player, server.getName());
|
traveler.sendPlayer(player, server.getName());
|
||||||
}));
|
}));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -11,7 +11,7 @@ import zone.themcgamer.core.common.menu.MenuType;
|
|||||||
import zone.themcgamer.core.common.menu.UpdatableMenu;
|
import zone.themcgamer.core.common.menu.UpdatableMenu;
|
||||||
import zone.themcgamer.core.game.MGZGame;
|
import zone.themcgamer.core.game.MGZGame;
|
||||||
import zone.themcgamer.core.module.Module;
|
import zone.themcgamer.core.module.Module;
|
||||||
import zone.themcgamer.core.traveller.ServerTraveller;
|
import zone.themcgamer.core.traveler.ServerTraveler;
|
||||||
import zone.themcgamer.data.jedis.data.server.MinecraftServer;
|
import zone.themcgamer.data.jedis.data.server.MinecraftServer;
|
||||||
|
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
@ -21,13 +21,13 @@ import java.util.Optional;
|
|||||||
/**
|
/**
|
||||||
* @author Braydon
|
* @author Braydon
|
||||||
*/
|
*/
|
||||||
public class TravellerMenu extends UpdatableMenu {
|
public class TravelerMenu extends UpdatableMenu {
|
||||||
private static final String[] ARROW_COLORS = new String[] { "§2", "§6", "§c" };
|
private static final String[] ARROW_COLORS = new String[] { "§2", "§6", "§c" };
|
||||||
|
|
||||||
private int arrowIndex, randomGameIndex;
|
private int arrowIndex, randomGameIndex;
|
||||||
|
|
||||||
public TravellerMenu(Player player) {
|
public TravelerMenu(Player player) {
|
||||||
super(player, "Traveller", 6, MenuType.CHEST, 700L);
|
super(player, "Traveler", 6, MenuType.CHEST, 700L);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@ -150,11 +150,11 @@ public class TravellerMenu extends UpdatableMenu {
|
|||||||
private void sendToGame(MGZGame game) {
|
private void sendToGame(MGZGame game) {
|
||||||
Optional<MinecraftServer> optionalMinecraftServer = game.getBestServer().filter(MinecraftServer::isRunning);
|
Optional<MinecraftServer> optionalMinecraftServer = game.getBestServer().filter(MinecraftServer::isRunning);
|
||||||
if (optionalMinecraftServer.isEmpty()) {
|
if (optionalMinecraftServer.isEmpty()) {
|
||||||
player.sendMessage(Style.error("Traveller", "§7There is no available game server found, please try again in a moment."));
|
player.sendMessage(Style.error("Traveler", "§7There is no available game server found, please try again in a moment."));
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
ServerTraveller traveller = Module.getModule(ServerTraveller.class);
|
ServerTraveler traveler = Module.getModule(ServerTraveler.class);
|
||||||
if (traveller != null)
|
if (traveler != null)
|
||||||
traveller.sendPlayer(player, optionalMinecraftServer.get());
|
traveler.sendPlayer(player, optionalMinecraftServer.get());
|
||||||
}
|
}
|
||||||
}
|
}
|
Reference in New Issue
Block a user