Code cleanup

This commit is contained in:
Daniel Saukel 2016-05-05 14:13:28 +02:00
parent 62afb6bcf0
commit 147588967a
72 changed files with 254 additions and 265 deletions

View File

@ -33,23 +33,24 @@ import io.github.dre2n.dungeonsxl.game.GameTypes;
import io.github.dre2n.dungeonsxl.global.GlobalProtections; import io.github.dre2n.dungeonsxl.global.GlobalProtections;
import io.github.dre2n.dungeonsxl.listener.*; import io.github.dre2n.dungeonsxl.listener.*;
import io.github.dre2n.dungeonsxl.mob.ExternalMobProviders; import io.github.dre2n.dungeonsxl.mob.ExternalMobProviders;
import io.github.dre2n.dungeonsxl.player.DGamePlayer;
import io.github.dre2n.dungeonsxl.player.DGroup; import io.github.dre2n.dungeonsxl.player.DGroup;
import io.github.dre2n.dungeonsxl.player.DPermissions; import io.github.dre2n.dungeonsxl.player.DPermissions;
import io.github.dre2n.dungeonsxl.player.DPlayer;
import io.github.dre2n.dungeonsxl.player.DPlayers; import io.github.dre2n.dungeonsxl.player.DPlayers;
import io.github.dre2n.dungeonsxl.player.DSavePlayer; import io.github.dre2n.dungeonsxl.player.DSavePlayer;
import io.github.dre2n.dungeonsxl.requirement.RequirementTypes; import io.github.dre2n.dungeonsxl.requirement.RequirementTypes;
import io.github.dre2n.dungeonsxl.reward.DLootInventory; import io.github.dre2n.dungeonsxl.reward.DLootInventory;
import io.github.dre2n.dungeonsxl.reward.RewardTypes; import io.github.dre2n.dungeonsxl.reward.RewardTypes;
import io.github.dre2n.dungeonsxl.sign.DSigns; import io.github.dre2n.dungeonsxl.sign.DSignTypes;
import io.github.dre2n.dungeonsxl.task.LazyUpdateTask; import io.github.dre2n.dungeonsxl.task.LazyUpdateTask;
import io.github.dre2n.dungeonsxl.task.SecureModeTask; import io.github.dre2n.dungeonsxl.task.SecureModeTask;
import io.github.dre2n.dungeonsxl.task.UpdateTask; import io.github.dre2n.dungeonsxl.task.UpdateTask;
import io.github.dre2n.dungeonsxl.task.WorldUnloadTask; import io.github.dre2n.dungeonsxl.task.WorldUnloadTask;
import io.github.dre2n.dungeonsxl.trigger.Triggers; import io.github.dre2n.dungeonsxl.trigger.TriggerTypes;
import io.github.dre2n.dungeonsxl.world.EditWorld; import io.github.dre2n.dungeonsxl.world.EditWorld;
import io.github.dre2n.dungeonsxl.world.GameWorld; import io.github.dre2n.dungeonsxl.world.GameWorld;
import java.io.File; import java.io.File;
import java.util.List;
import java.util.concurrent.CopyOnWriteArrayList; import java.util.concurrent.CopyOnWriteArrayList;
import org.bukkit.event.HandlerList; import org.bukkit.event.HandlerList;
import org.bukkit.scheduler.BukkitTask; import org.bukkit.scheduler.BukkitTask;
@ -68,11 +69,11 @@ public class DungeonsXL extends BRPlugin {
private MessageConfig messageConfig; private MessageConfig messageConfig;
private BRCommands dCommands; private BRCommands dCommands;
private DSigns dSigns; private DSignTypes dSigns;
private GameTypes gameTypes; private GameTypes gameTypes;
private RequirementTypes requirementTypes; private RequirementTypes requirementTypes;
private RewardTypes rewardTypes; private RewardTypes rewardTypes;
private Triggers triggers; private TriggerTypes triggers;
private Dungeons dungeons; private Dungeons dungeons;
private GlobalProtections protections; private GlobalProtections protections;
private ExternalMobProviders dMobProviders; private ExternalMobProviders dMobProviders;
@ -161,8 +162,8 @@ public class DungeonsXL extends BRPlugin {
saveData(); saveData();
messageConfig.save(); messageConfig.save();
// DPlayer leaves World // DGamePlayer leaves World
for (DPlayer dPlayer : dPlayers.getDPlayers()) { for (DGamePlayer dPlayer : dPlayers.getDGamePlayers()) {
dPlayer.leave(); dPlayer.leave();
} }
@ -338,15 +339,15 @@ public class DungeonsXL extends BRPlugin {
/** /**
* @return the dSigns * @return the dSigns
*/ */
public DSigns getDSigns() { public DSignTypes getDSigns() {
return dSigns; return dSigns;
} }
/** /**
* load / reload a new instance of DSigns * load / reload a new instance of DSignTypes
*/ */
public void loadDSigns() { public void loadDSigns() {
dSigns = new DSigns(); dSigns = new DSignTypes();
} }
/** /**
@ -394,15 +395,15 @@ public class DungeonsXL extends BRPlugin {
/** /**
* @return the triggers * @return the triggers
*/ */
public Triggers getTriggers() { public TriggerTypes getTriggers() {
return triggers; return triggers;
} }
/** /**
* load / reload a new instance of Triggers * load / reload a new instance of TriggerTypes
*/ */
public void loadTriggers() { public void loadTriggers() {
triggers = new Triggers(); triggers = new TriggerTypes();
} }
/** /**
@ -520,14 +521,14 @@ public class DungeonsXL extends BRPlugin {
/** /**
* @return the dLootInventories * @return the dLootInventories
*/ */
public CopyOnWriteArrayList<DLootInventory> getDLootInventories() { public List<DLootInventory> getDLootInventories() {
return dLootInventories; return dLootInventories;
} }
/** /**
* @return the editWorlds * @return the editWorlds
*/ */
public CopyOnWriteArrayList<EditWorld> getEditWorlds() { public List<EditWorld> getEditWorlds() {
return editWorlds; return editWorlds;
} }
@ -541,21 +542,21 @@ public class DungeonsXL extends BRPlugin {
/** /**
* @return the gameWorlds * @return the gameWorlds
*/ */
public CopyOnWriteArrayList<GameWorld> getGameWorlds() { public List<GameWorld> getGameWorlds() {
return gameWorlds; return gameWorlds;
} }
/** /**
* @return the games * @return the games
*/ */
public CopyOnWriteArrayList<Game> getGames() { public List<Game> getGames() {
return games; return games;
} }
/** /**
* @return the dGroups * @return the dGroups
*/ */
public CopyOnWriteArrayList<DGroup> getDGroups() { public List<DGroup> getDGroups() {
return dGroups; return dGroups;
} }

View File

@ -30,7 +30,7 @@ import org.bukkit.entity.Player;
*/ */
public class BreakCommand extends BRCommand { public class BreakCommand extends BRCommand {
protected static DungeonsXL plugin = DungeonsXL.getInstance(); DungeonsXL plugin = DungeonsXL.getInstance();
public BreakCommand() { public BreakCommand() {
setCommand("break"); setCommand("break");

View File

@ -21,7 +21,7 @@ import io.github.dre2n.commons.util.messageutil.MessageUtil;
import io.github.dre2n.dungeonsxl.DungeonsXL; import io.github.dre2n.dungeonsxl.DungeonsXL;
import io.github.dre2n.dungeonsxl.config.DMessages; import io.github.dre2n.dungeonsxl.config.DMessages;
import io.github.dre2n.dungeonsxl.player.DPermissions; import io.github.dre2n.dungeonsxl.player.DPermissions;
import io.github.dre2n.dungeonsxl.player.DPlayer; import io.github.dre2n.dungeonsxl.player.DGamePlayer;
import org.bukkit.command.CommandSender; import org.bukkit.command.CommandSender;
import org.bukkit.entity.Player; import org.bukkit.entity.Player;
@ -30,7 +30,7 @@ import org.bukkit.entity.Player;
*/ */
public class ChatCommand extends BRCommand { public class ChatCommand extends BRCommand {
protected static DungeonsXL plugin = DungeonsXL.getInstance(); DungeonsXL plugin = DungeonsXL.getInstance();
public ChatCommand() { public ChatCommand() {
setCommand("chat"); setCommand("chat");
@ -44,7 +44,7 @@ public class ChatCommand extends BRCommand {
@Override @Override
public void onExecute(String[] args, CommandSender sender) { public void onExecute(String[] args, CommandSender sender) {
Player player = (Player) sender; Player player = (Player) sender;
DPlayer dPlayer = DPlayer.getByPlayer(player); DGamePlayer dPlayer = DGamePlayer.getByPlayer(player);
if (dPlayer == null) { if (dPlayer == null) {
MessageUtil.sendMessage(player, DMessages.ERROR_JOIN_GROUP.getMessage()); MessageUtil.sendMessage(player, DMessages.ERROR_JOIN_GROUP.getMessage());

View File

@ -30,7 +30,7 @@ import org.bukkit.entity.Player;
*/ */
public class ChatSpyCommand extends BRCommand { public class ChatSpyCommand extends BRCommand {
protected static DungeonsXL plugin = DungeonsXL.getInstance(); DungeonsXL plugin = DungeonsXL.getInstance();
public ChatSpyCommand() { public ChatSpyCommand() {
setCommand("chatspy"); setCommand("chatspy");

View File

@ -21,7 +21,7 @@ import io.github.dre2n.commons.util.messageutil.MessageUtil;
import io.github.dre2n.dungeonsxl.DungeonsXL; import io.github.dre2n.dungeonsxl.DungeonsXL;
import io.github.dre2n.dungeonsxl.config.DMessages; import io.github.dre2n.dungeonsxl.config.DMessages;
import io.github.dre2n.dungeonsxl.player.DPermissions; import io.github.dre2n.dungeonsxl.player.DPermissions;
import io.github.dre2n.dungeonsxl.player.DPlayer; import io.github.dre2n.dungeonsxl.player.DGamePlayer;
import io.github.dre2n.dungeonsxl.world.EditWorld; import io.github.dre2n.dungeonsxl.world.EditWorld;
import org.bukkit.command.CommandSender; import org.bukkit.command.CommandSender;
import org.bukkit.command.ConsoleCommandSender; import org.bukkit.command.ConsoleCommandSender;
@ -32,7 +32,7 @@ import org.bukkit.entity.Player;
*/ */
public class CreateCommand extends BRCommand { public class CreateCommand extends BRCommand {
protected static DungeonsXL plugin = DungeonsXL.getInstance(); DungeonsXL plugin = DungeonsXL.getInstance();
public CreateCommand() { public CreateCommand() {
setMinArgs(1); setMinArgs(1);
@ -71,7 +71,7 @@ public class CreateCommand extends BRCommand {
} else if (sender instanceof Player) { } else if (sender instanceof Player) {
Player player = (Player) sender; Player player = (Player) sender;
if (DPlayer.getByPlayer(player) != null) { if (DGamePlayer.getByPlayer(player) != null) {
MessageUtil.sendMessage(player, DMessages.ERROR_LEAVE_DUNGEON.getMessage()); MessageUtil.sendMessage(player, DMessages.ERROR_LEAVE_DUNGEON.getMessage());
return; return;
} }
@ -90,7 +90,7 @@ public class CreateCommand extends BRCommand {
MessageUtil.log(plugin, DMessages.LOG_WORLD_GENERATION_FINISHED.getMessage()); MessageUtil.log(plugin, DMessages.LOG_WORLD_GENERATION_FINISHED.getMessage());
// Tp Player // Tp Player
new DPlayer(player, editWorld.getWorld(), true); new DGamePlayer(player, editWorld.getWorld(), true);
} else { } else {
MessageUtil.sendMessage(player, DMessages.ERROR_NAME_TO_LONG.getMessage()); MessageUtil.sendMessage(player, DMessages.ERROR_NAME_TO_LONG.getMessage());

View File

@ -32,7 +32,7 @@ import org.bukkit.entity.Player;
*/ */
public class DeletePortalCommand extends BRCommand { public class DeletePortalCommand extends BRCommand {
protected static DungeonsXL plugin = DungeonsXL.getInstance(); DungeonsXL plugin = DungeonsXL.getInstance();
public DeletePortalCommand() { public DeletePortalCommand() {
setCommand("deleteportal"); setCommand("deleteportal");

View File

@ -22,7 +22,7 @@ import io.github.dre2n.dungeonsxl.DungeonsXL;
import io.github.dre2n.dungeonsxl.config.DMessages; import io.github.dre2n.dungeonsxl.config.DMessages;
import io.github.dre2n.dungeonsxl.player.DGroup; import io.github.dre2n.dungeonsxl.player.DGroup;
import io.github.dre2n.dungeonsxl.player.DPermissions; import io.github.dre2n.dungeonsxl.player.DPermissions;
import io.github.dre2n.dungeonsxl.player.DPlayer; import io.github.dre2n.dungeonsxl.player.DGamePlayer;
import io.github.dre2n.dungeonsxl.world.EditWorld; import io.github.dre2n.dungeonsxl.world.EditWorld;
import org.bukkit.command.CommandSender; import org.bukkit.command.CommandSender;
import org.bukkit.entity.Player; import org.bukkit.entity.Player;
@ -32,7 +32,7 @@ import org.bukkit.entity.Player;
*/ */
public class EditCommand extends BRCommand { public class EditCommand extends BRCommand {
protected static DungeonsXL plugin = DungeonsXL.getInstance(); DungeonsXL plugin = DungeonsXL.getInstance();
public EditCommand() { public EditCommand() {
setCommand("edit"); setCommand("edit");
@ -49,7 +49,7 @@ public class EditCommand extends BRCommand {
String mapName = args[1]; String mapName = args[1];
EditWorld editWorld = EditWorld.load(mapName); EditWorld editWorld = EditWorld.load(mapName);
DGroup dGroup = DGroup.getByPlayer(player); DGroup dGroup = DGroup.getByPlayer(player);
DPlayer dPlayer = DPlayer.getByPlayer(player); DGamePlayer dPlayer = DGamePlayer.getByPlayer(player);
if (!(EditWorld.isInvitedPlayer(mapName, player.getUniqueId(), player.getName()) || DPermissions.hasPermission(player, DPermissions.EDIT))) { if (!(EditWorld.isInvitedPlayer(mapName, player.getUniqueId(), player.getName()) || DPermissions.hasPermission(player, DPermissions.EDIT))) {
MessageUtil.sendMessage(player, DMessages.ERROR_NO_PERMISSIONS.getMessage()); MessageUtil.sendMessage(player, DMessages.ERROR_NO_PERMISSIONS.getMessage());
@ -71,7 +71,7 @@ public class EditCommand extends BRCommand {
return; return;
} }
new DPlayer(player, editWorld.getWorld(), true); new DGamePlayer(player, editWorld.getWorld(), true);
} }

View File

@ -23,7 +23,7 @@ import io.github.dre2n.dungeonsxl.config.DMessages;
import io.github.dre2n.dungeonsxl.game.Game; import io.github.dre2n.dungeonsxl.game.Game;
import io.github.dre2n.dungeonsxl.player.DGroup; import io.github.dre2n.dungeonsxl.player.DGroup;
import io.github.dre2n.dungeonsxl.player.DPermissions; import io.github.dre2n.dungeonsxl.player.DPermissions;
import io.github.dre2n.dungeonsxl.player.DPlayer; import io.github.dre2n.dungeonsxl.player.DGamePlayer;
import org.bukkit.command.CommandSender; import org.bukkit.command.CommandSender;
import org.bukkit.entity.Player; import org.bukkit.entity.Player;
@ -32,7 +32,7 @@ import org.bukkit.entity.Player;
*/ */
public class EnterCommand extends BRCommand { public class EnterCommand extends BRCommand {
protected static DungeonsXL plugin = DungeonsXL.getInstance(); DungeonsXL plugin = DungeonsXL.getInstance();
public EnterCommand() { public EnterCommand() {
setMinArgs(1); setMinArgs(1);
@ -81,7 +81,7 @@ public class EnterCommand extends BRCommand {
joining.sendMessage(DMessages.CMD_ENTER_SUCCESS.getMessage(joining.getName(), targetName)); joining.sendMessage(DMessages.CMD_ENTER_SUCCESS.getMessage(joining.getName(), targetName));
for (Player player : joining.getPlayers()) { for (Player player : joining.getPlayers()) {
new DPlayer(player, game.getWorld()).ready(); new DGamePlayer(player, game.getWorld()).ready();
} }
} }

View File

@ -22,7 +22,7 @@ import io.github.dre2n.dungeonsxl.DungeonsXL;
import io.github.dre2n.dungeonsxl.config.DMessages; import io.github.dre2n.dungeonsxl.config.DMessages;
import io.github.dre2n.dungeonsxl.player.DGroup; import io.github.dre2n.dungeonsxl.player.DGroup;
import io.github.dre2n.dungeonsxl.player.DPermissions; import io.github.dre2n.dungeonsxl.player.DPermissions;
import io.github.dre2n.dungeonsxl.player.DPlayer; import io.github.dre2n.dungeonsxl.player.DGamePlayer;
import io.github.dre2n.dungeonsxl.world.EditWorld; import io.github.dre2n.dungeonsxl.world.EditWorld;
import org.bukkit.command.CommandSender; import org.bukkit.command.CommandSender;
import org.bukkit.entity.Player; import org.bukkit.entity.Player;
@ -32,7 +32,7 @@ import org.bukkit.entity.Player;
*/ */
public class EscapeCommand extends BRCommand { public class EscapeCommand extends BRCommand {
protected static DungeonsXL plugin = DungeonsXL.getInstance(); DungeonsXL plugin = DungeonsXL.getInstance();
public EscapeCommand() { public EscapeCommand() {
setCommand("escape"); setCommand("escape");
@ -46,7 +46,7 @@ public class EscapeCommand extends BRCommand {
@Override @Override
public void onExecute(String[] args, CommandSender sender) { public void onExecute(String[] args, CommandSender sender) {
Player player = (Player) sender; Player player = (Player) sender;
DPlayer dPlayer = DPlayer.getByPlayer(player); DGamePlayer dPlayer = DGamePlayer.getByPlayer(player);
if (dPlayer != null) { if (dPlayer != null) {
if (!dPlayer.isEditing()) { if (!dPlayer.isEditing()) {

View File

@ -32,7 +32,7 @@ import org.bukkit.entity.Player;
*/ */
public class GameCommand extends BRCommand { public class GameCommand extends BRCommand {
protected static DungeonsXL plugin = DungeonsXL.getInstance(); DungeonsXL plugin = DungeonsXL.getInstance();
public GameCommand() { public GameCommand() {
setCommand("game"); setCommand("game");

View File

@ -25,7 +25,7 @@ import io.github.dre2n.dungeonsxl.event.dgroup.DGroupDisbandEvent;
import io.github.dre2n.dungeonsxl.event.dplayer.DPlayerKickEvent; import io.github.dre2n.dungeonsxl.event.dplayer.DPlayerKickEvent;
import io.github.dre2n.dungeonsxl.player.DGroup; import io.github.dre2n.dungeonsxl.player.DGroup;
import io.github.dre2n.dungeonsxl.player.DPermissions; import io.github.dre2n.dungeonsxl.player.DPermissions;
import io.github.dre2n.dungeonsxl.player.DPlayer; import io.github.dre2n.dungeonsxl.player.DGamePlayer;
import org.bukkit.command.CommandSender; import org.bukkit.command.CommandSender;
import org.bukkit.entity.Player; import org.bukkit.entity.Player;
@ -34,7 +34,7 @@ import org.bukkit.entity.Player;
*/ */
public class GroupCommand extends BRCommand { public class GroupCommand extends BRCommand {
protected static DungeonsXL plugin = DungeonsXL.getInstance(); DungeonsXL plugin = DungeonsXL.getInstance();
public GroupCommand() { public GroupCommand() {
setCommand("group"); setCommand("group");
@ -206,7 +206,7 @@ public class GroupCommand extends BRCommand {
Player toKick = plugin.getServer().getPlayer(args[2]); Player toKick = plugin.getServer().getPlayer(args[2]);
if (toKick != null) { if (toKick != null) {
DPlayerKickEvent event = new DPlayerKickEvent(DPlayer.getByPlayer(toKick.getPlayer()), DPlayerKickEvent.Cause.COMMAND); DPlayerKickEvent event = new DPlayerKickEvent(DGamePlayer.getByPlayer(toKick.getPlayer()), DPlayerKickEvent.Cause.COMMAND);
if (!event.isCancelled()) { if (!event.isCancelled()) {
if (dGroup.getPlayers().contains(toKick)) { if (dGroup.getPlayers().contains(toKick)) {

View File

@ -31,7 +31,7 @@ import org.bukkit.command.CommandSender;
*/ */
public class HelpCommand extends BRCommand { public class HelpCommand extends BRCommand {
protected static DungeonsXL plugin = DungeonsXL.getInstance(); DungeonsXL plugin = DungeonsXL.getInstance();
public HelpCommand() { public HelpCommand() {
setCommand("help"); setCommand("help");

View File

@ -30,7 +30,7 @@ import org.bukkit.command.CommandSender;
*/ */
public class InviteCommand extends BRCommand { public class InviteCommand extends BRCommand {
protected static DungeonsXL plugin = DungeonsXL.getInstance(); DungeonsXL plugin = DungeonsXL.getInstance();
public InviteCommand() { public InviteCommand() {
setMinArgs(2); setMinArgs(2);

View File

@ -24,7 +24,7 @@ import io.github.dre2n.dungeonsxl.event.dplayer.DPlayerEscapeEvent;
import io.github.dre2n.dungeonsxl.event.dplayer.DPlayerLeaveDGroupEvent; import io.github.dre2n.dungeonsxl.event.dplayer.DPlayerLeaveDGroupEvent;
import io.github.dre2n.dungeonsxl.player.DGroup; import io.github.dre2n.dungeonsxl.player.DGroup;
import io.github.dre2n.dungeonsxl.player.DPermissions; import io.github.dre2n.dungeonsxl.player.DPermissions;
import io.github.dre2n.dungeonsxl.player.DPlayer; import io.github.dre2n.dungeonsxl.player.DGamePlayer;
import io.github.dre2n.dungeonsxl.world.GameWorld; import io.github.dre2n.dungeonsxl.world.GameWorld;
import org.bukkit.command.CommandSender; import org.bukkit.command.CommandSender;
import org.bukkit.entity.Player; import org.bukkit.entity.Player;
@ -34,7 +34,7 @@ import org.bukkit.entity.Player;
*/ */
public class LeaveCommand extends BRCommand { public class LeaveCommand extends BRCommand {
protected static DungeonsXL plugin = DungeonsXL.getInstance(); DungeonsXL plugin = DungeonsXL.getInstance();
public LeaveCommand() { public LeaveCommand() {
setCommand("leave"); setCommand("leave");
@ -48,7 +48,7 @@ public class LeaveCommand extends BRCommand {
@Override @Override
public void onExecute(String[] args, CommandSender sender) { public void onExecute(String[] args, CommandSender sender) {
Player player = (Player) sender; Player player = (Player) sender;
DPlayer dPlayer = DPlayer.getByPlayer(player); DGamePlayer dPlayer = DGamePlayer.getByPlayer(player);
if (GameWorld.getByWorld(player.getWorld()) != null) { if (GameWorld.getByWorld(player.getWorld()) != null) {
if (GameWorld.getByWorld(player.getWorld()).isTutorial()) { if (GameWorld.getByWorld(player.getWorld()).isTutorial()) {

View File

@ -36,7 +36,7 @@ import org.bukkit.entity.Player;
*/ */
public class ListCommand extends BRCommand { public class ListCommand extends BRCommand {
protected static DungeonsXL plugin = DungeonsXL.getInstance(); DungeonsXL plugin = DungeonsXL.getInstance();
public ListCommand() { public ListCommand() {
setCommand("list"); setCommand("list");

View File

@ -21,7 +21,7 @@ import io.github.dre2n.commons.util.messageutil.MessageUtil;
import io.github.dre2n.dungeonsxl.DungeonsXL; import io.github.dre2n.dungeonsxl.DungeonsXL;
import io.github.dre2n.dungeonsxl.config.DMessages; import io.github.dre2n.dungeonsxl.config.DMessages;
import io.github.dre2n.dungeonsxl.player.DPermissions; import io.github.dre2n.dungeonsxl.player.DPermissions;
import io.github.dre2n.dungeonsxl.player.DPlayer; import io.github.dre2n.dungeonsxl.player.DGamePlayer;
import org.bukkit.Bukkit; import org.bukkit.Bukkit;
import org.bukkit.command.CommandSender; import org.bukkit.command.CommandSender;
import org.bukkit.entity.Player; import org.bukkit.entity.Player;
@ -31,7 +31,7 @@ import org.bukkit.entity.Player;
*/ */
public class LivesCommand extends BRCommand { public class LivesCommand extends BRCommand {
protected static DungeonsXL plugin = DungeonsXL.getInstance(); DungeonsXL plugin = DungeonsXL.getInstance();
public LivesCommand() { public LivesCommand() {
setCommand("lives"); setCommand("lives");
@ -60,7 +60,7 @@ public class LivesCommand extends BRCommand {
return; return;
} }
DPlayer dPlayer = DPlayer.getByPlayer(player); DGamePlayer dPlayer = DGamePlayer.getByPlayer(player);
if (dPlayer != null) { if (dPlayer != null) {
MessageUtil.sendMessage(player, DMessages.CMD_LIVES.getMessage(player.getName(), String.valueOf(dPlayer.getLives()))); MessageUtil.sendMessage(player, DMessages.CMD_LIVES.getMessage(player.getName(), String.valueOf(dPlayer.getLives())));

View File

@ -34,7 +34,7 @@ import org.bukkit.plugin.PluginManager;
*/ */
public class MainCommand extends BRCommand { public class MainCommand extends BRCommand {
protected static DungeonsXL plugin = DungeonsXL.getInstance(); DungeonsXL plugin = DungeonsXL.getInstance();
public MainCommand() { public MainCommand() {
setCommand("main"); setCommand("main");
@ -51,7 +51,7 @@ public class MainCommand extends BRCommand {
int maps = new File(plugin.getDataFolder() + "/maps").listFiles().length; int maps = new File(plugin.getDataFolder() + "/maps").listFiles().length;
int dungeons = new File(plugin.getDataFolder() + "/dungeons").listFiles().length; int dungeons = new File(plugin.getDataFolder() + "/dungeons").listFiles().length;
int loaded = plugin.getEditWorlds().size() + plugin.getGameWorlds().size(); int loaded = plugin.getEditWorlds().size() + plugin.getGameWorlds().size();
int players = plugin.getDPlayers().getDPlayers().size(); int players = plugin.getDPlayers().getDGamePlayers().size();
Internals internals = CompatibilityHandler.getInstance().getInternals(); Internals internals = CompatibilityHandler.getInstance().getInternals();
String vault = ""; String vault = "";
if (plugins.getPlugin("Vault") != null) { if (plugins.getPlugin("Vault") != null) {

View File

@ -34,7 +34,7 @@ import org.bukkit.entity.Player;
*/ */
public class MsgCommand extends BRCommand { public class MsgCommand extends BRCommand {
protected static DungeonsXL plugin = DungeonsXL.getInstance(); DungeonsXL plugin = DungeonsXL.getInstance();
public MsgCommand() { public MsgCommand() {
setMinArgs(-1); setMinArgs(-1);

View File

@ -26,7 +26,7 @@ import io.github.dre2n.dungeonsxl.dungeon.Dungeon;
import io.github.dre2n.dungeonsxl.event.dgroup.DGroupCreateEvent; import io.github.dre2n.dungeonsxl.event.dgroup.DGroupCreateEvent;
import io.github.dre2n.dungeonsxl.player.DGroup; import io.github.dre2n.dungeonsxl.player.DGroup;
import io.github.dre2n.dungeonsxl.player.DPermissions; import io.github.dre2n.dungeonsxl.player.DPermissions;
import io.github.dre2n.dungeonsxl.player.DPlayer; import io.github.dre2n.dungeonsxl.player.DGamePlayer;
import io.github.dre2n.dungeonsxl.world.EditWorld; import io.github.dre2n.dungeonsxl.world.EditWorld;
import io.github.dre2n.dungeonsxl.world.GameWorld; import io.github.dre2n.dungeonsxl.world.GameWorld;
import java.io.File; import java.io.File;
@ -38,7 +38,7 @@ import org.bukkit.entity.Player;
*/ */
public class PlayCommand extends BRCommand { public class PlayCommand extends BRCommand {
protected static DungeonsXL plugin = DungeonsXL.getInstance(); DungeonsXL plugin = DungeonsXL.getInstance();
public PlayCommand() { public PlayCommand() {
setCommand("play"); setCommand("play");
@ -52,7 +52,7 @@ public class PlayCommand extends BRCommand {
@Override @Override
public void onExecute(String[] args, CommandSender sender) { public void onExecute(String[] args, CommandSender sender) {
Player player = (Player) sender; Player player = (Player) sender;
DPlayer dPlayer = DPlayer.getByPlayer(player); DGamePlayer dPlayer = DGamePlayer.getByPlayer(player);
if (dPlayer != null) { if (dPlayer != null) {
MessageUtil.sendMessage(player, DMessages.ERROR_LEAVE_DUNGEON.getMessage()); MessageUtil.sendMessage(player, DMessages.ERROR_LEAVE_DUNGEON.getMessage());
@ -165,12 +165,12 @@ public class PlayCommand extends BRCommand {
if (dGroup.getGameWorld().getLocLobby() == null) { if (dGroup.getGameWorld().getLocLobby() == null) {
for (Player groupPlayer : dGroup.getPlayers()) { for (Player groupPlayer : dGroup.getPlayers()) {
new DPlayer(groupPlayer, dGroup.getGameWorld()); new DGamePlayer(groupPlayer, dGroup.getGameWorld());
} }
} else { } else {
for (Player groupPlayer : dGroup.getPlayers()) { for (Player groupPlayer : dGroup.getPlayers()) {
new DPlayer(groupPlayer, dGroup.getGameWorld()); new DGamePlayer(groupPlayer, dGroup.getGameWorld());
} }
} }
} }

View File

@ -23,7 +23,7 @@ import io.github.dre2n.dungeonsxl.config.DMessages;
import io.github.dre2n.dungeonsxl.global.DPortal; import io.github.dre2n.dungeonsxl.global.DPortal;
import io.github.dre2n.dungeonsxl.player.DGlobalPlayer; import io.github.dre2n.dungeonsxl.player.DGlobalPlayer;
import io.github.dre2n.dungeonsxl.player.DPermissions; import io.github.dre2n.dungeonsxl.player.DPermissions;
import io.github.dre2n.dungeonsxl.player.DPlayer; import io.github.dre2n.dungeonsxl.player.DGamePlayer;
import org.bukkit.Material; import org.bukkit.Material;
import org.bukkit.command.CommandSender; import org.bukkit.command.CommandSender;
import org.bukkit.entity.Player; import org.bukkit.entity.Player;
@ -34,7 +34,7 @@ import org.bukkit.inventory.ItemStack;
*/ */
public class PortalCommand extends BRCommand { public class PortalCommand extends BRCommand {
protected static DungeonsXL plugin = DungeonsXL.getInstance(); DungeonsXL plugin = DungeonsXL.getInstance();
public PortalCommand() { public PortalCommand() {
setCommand("portal"); setCommand("portal");
@ -50,7 +50,7 @@ public class PortalCommand extends BRCommand {
Player player = (Player) sender; Player player = (Player) sender;
DGlobalPlayer dGlobalPlayer = plugin.getDPlayers().getByPlayer(player); DGlobalPlayer dGlobalPlayer = plugin.getDPlayers().getByPlayer(player);
if (dGlobalPlayer instanceof DPlayer) { if (dGlobalPlayer instanceof DGamePlayer) {
MessageUtil.sendMessage(player, DMessages.ERROR_LEAVE_DUNGEON.getMessage()); MessageUtil.sendMessage(player, DMessages.ERROR_LEAVE_DUNGEON.getMessage());
return; return;
} }

View File

@ -33,7 +33,7 @@ import org.bukkit.plugin.PluginManager;
*/ */
public class ReloadCommand extends BRCommand { public class ReloadCommand extends BRCommand {
protected static DungeonsXL plugin = DungeonsXL.getInstance(); DungeonsXL plugin = DungeonsXL.getInstance();
public ReloadCommand() { public ReloadCommand() {
setCommand("reload"); setCommand("reload");
@ -52,7 +52,7 @@ public class ReloadCommand extends BRCommand {
int maps = new File(plugin.getDataFolder() + "/maps").listFiles().length; int maps = new File(plugin.getDataFolder() + "/maps").listFiles().length;
int dungeons = new File(plugin.getDataFolder() + "/dungeons").listFiles().length; int dungeons = new File(plugin.getDataFolder() + "/dungeons").listFiles().length;
int loaded = plugin.getEditWorlds().size() + plugin.getGameWorlds().size(); int loaded = plugin.getEditWorlds().size() + plugin.getGameWorlds().size();
int players = plugin.getDPlayers().getDPlayers().size(); int players = plugin.getDPlayers().getDGamePlayers().size();
Internals internals = CompatibilityHandler.getInstance().getInternals(); Internals internals = CompatibilityHandler.getInstance().getInternals();
String vault = ""; String vault = "";
if (plugins.getPlugin("Vault") != null) { if (plugins.getPlugin("Vault") != null) {

View File

@ -30,7 +30,7 @@ import org.bukkit.entity.Player;
*/ */
public class SaveCommand extends BRCommand { public class SaveCommand extends BRCommand {
protected static DungeonsXL plugin = DungeonsXL.getInstance(); DungeonsXL plugin = DungeonsXL.getInstance();
public SaveCommand() { public SaveCommand() {
setCommand("save"); setCommand("save");

View File

@ -24,7 +24,7 @@ import io.github.dre2n.dungeonsxl.game.Game;
import io.github.dre2n.dungeonsxl.game.GameTypeDefault; import io.github.dre2n.dungeonsxl.game.GameTypeDefault;
import io.github.dre2n.dungeonsxl.player.DGroup; import io.github.dre2n.dungeonsxl.player.DGroup;
import io.github.dre2n.dungeonsxl.player.DPermissions; import io.github.dre2n.dungeonsxl.player.DPermissions;
import io.github.dre2n.dungeonsxl.player.DPlayer; import io.github.dre2n.dungeonsxl.player.DGamePlayer;
import io.github.dre2n.dungeonsxl.world.GameWorld; import io.github.dre2n.dungeonsxl.world.GameWorld;
import org.bukkit.command.CommandSender; import org.bukkit.command.CommandSender;
import org.bukkit.entity.Player; import org.bukkit.entity.Player;
@ -34,7 +34,7 @@ import org.bukkit.entity.Player;
*/ */
public class TestCommand extends BRCommand { public class TestCommand extends BRCommand {
protected static DungeonsXL plugin = DungeonsXL.getInstance(); DungeonsXL plugin = DungeonsXL.getInstance();
public TestCommand() { public TestCommand() {
setCommand("test"); setCommand("test");
@ -73,7 +73,7 @@ public class TestCommand extends BRCommand {
} }
for (Player groupPlayer : dGroup.getPlayers()) { for (Player groupPlayer : dGroup.getPlayers()) {
DPlayer.getByPlayer(groupPlayer).ready(GameTypeDefault.TEST); DGamePlayer.getByPlayer(groupPlayer).ready(GameTypeDefault.TEST);
} }
} }

View File

@ -30,7 +30,7 @@ import org.bukkit.command.CommandSender;
*/ */
public class UninviteCommand extends BRCommand { public class UninviteCommand extends BRCommand {
protected static DungeonsXL plugin = DungeonsXL.getInstance(); DungeonsXL plugin = DungeonsXL.getInstance();
public UninviteCommand() { public UninviteCommand() {
setCommand("uninvite"); setCommand("uninvite");

View File

@ -48,7 +48,7 @@ import org.bukkit.inventory.ItemStack;
*/ */
public class WorldConfig { public class WorldConfig {
protected static DungeonsXL plugin = DungeonsXL.getInstance(); DungeonsXL plugin = DungeonsXL.getInstance();
@Deprecated @Deprecated
public static WorldConfig defaultConfig = new WorldConfig(); public static WorldConfig defaultConfig = new WorldConfig();

View File

@ -16,7 +16,7 @@
*/ */
package io.github.dre2n.dungeonsxl.event.dplayer; package io.github.dre2n.dungeonsxl.event.dplayer;
import io.github.dre2n.dungeonsxl.player.DPlayer; import io.github.dre2n.dungeonsxl.player.DGamePlayer;
import org.bukkit.event.Cancellable; import org.bukkit.event.Cancellable;
import org.bukkit.event.HandlerList; import org.bukkit.event.HandlerList;
import org.bukkit.event.entity.PlayerDeathEvent; import org.bukkit.event.entity.PlayerDeathEvent;
@ -32,7 +32,7 @@ public class DPlayerDeathEvent extends DPlayerEvent implements Cancellable {
private PlayerDeathEvent bukkitEvent; private PlayerDeathEvent bukkitEvent;
private int lostLives; private int lostLives;
public DPlayerDeathEvent(DPlayer dPlayer, PlayerDeathEvent bukkitEvent, int lostLives) { public DPlayerDeathEvent(DGamePlayer dPlayer, PlayerDeathEvent bukkitEvent, int lostLives) {
super(dPlayer); super(dPlayer);
this.bukkitEvent = bukkitEvent; this.bukkitEvent = bukkitEvent;
this.lostLives = lostLives; this.lostLives = lostLives;

View File

@ -16,7 +16,7 @@
*/ */
package io.github.dre2n.dungeonsxl.event.dplayer; package io.github.dre2n.dungeonsxl.event.dplayer;
import io.github.dre2n.dungeonsxl.player.DPlayer; import io.github.dre2n.dungeonsxl.player.DGamePlayer;
import org.bukkit.event.Cancellable; import org.bukkit.event.Cancellable;
import org.bukkit.event.HandlerList; import org.bukkit.event.HandlerList;
@ -28,7 +28,7 @@ public class DPlayerEscapeEvent extends DPlayerEvent implements Cancellable {
private static final HandlerList handlers = new HandlerList(); private static final HandlerList handlers = new HandlerList();
private boolean cancelled; private boolean cancelled;
public DPlayerEscapeEvent(DPlayer dPlayer) { public DPlayerEscapeEvent(DGamePlayer dPlayer) {
super(dPlayer); super(dPlayer);
} }

View File

@ -16,7 +16,7 @@
*/ */
package io.github.dre2n.dungeonsxl.event.dplayer; package io.github.dre2n.dungeonsxl.event.dplayer;
import io.github.dre2n.dungeonsxl.player.DPlayer; import io.github.dre2n.dungeonsxl.player.DGamePlayer;
import org.bukkit.event.Event; import org.bukkit.event.Event;
/** /**
@ -24,16 +24,16 @@ import org.bukkit.event.Event;
*/ */
public abstract class DPlayerEvent extends Event { public abstract class DPlayerEvent extends Event {
protected DPlayer dPlayer; protected DGamePlayer dPlayer;
public DPlayerEvent(DPlayer dPlayer) { public DPlayerEvent(DGamePlayer dPlayer) {
this.dPlayer = dPlayer; this.dPlayer = dPlayer;
} }
/** /**
* @return the dPlayer * @return the dPlayer
*/ */
public DPlayer getDPlayer() { public DGamePlayer getDPlayer() {
return dPlayer; return dPlayer;
} }
@ -41,7 +41,7 @@ public abstract class DPlayerEvent extends Event {
* @param dPlayer * @param dPlayer
* the dPlayer to set * the dPlayer to set
*/ */
public void setDPlayer(DPlayer dPlayer) { public void setDPlayer(DGamePlayer dPlayer) {
this.dPlayer = dPlayer; this.dPlayer = dPlayer;
} }

View File

@ -16,7 +16,7 @@
*/ */
package io.github.dre2n.dungeonsxl.event.dplayer; package io.github.dre2n.dungeonsxl.event.dplayer;
import io.github.dre2n.dungeonsxl.player.DPlayer; import io.github.dre2n.dungeonsxl.player.DGamePlayer;
import org.bukkit.event.Cancellable; import org.bukkit.event.Cancellable;
import org.bukkit.event.HandlerList; import org.bukkit.event.HandlerList;
@ -31,7 +31,7 @@ public class DPlayerFinishEvent extends DPlayerEvent implements Cancellable {
private boolean first; private boolean first;
private boolean hasToWait; private boolean hasToWait;
public DPlayerFinishEvent(DPlayer dPlayer, boolean first, boolean hasToWait) { public DPlayerFinishEvent(DGamePlayer dPlayer, boolean first, boolean hasToWait) {
super(dPlayer); super(dPlayer);
this.first = first; this.first = first;
this.hasToWait = hasToWait; this.hasToWait = hasToWait;

View File

@ -17,7 +17,7 @@
package io.github.dre2n.dungeonsxl.event.dplayer; package io.github.dre2n.dungeonsxl.event.dplayer;
import io.github.dre2n.dungeonsxl.player.DGroup; import io.github.dre2n.dungeonsxl.player.DGroup;
import io.github.dre2n.dungeonsxl.player.DPlayer; import io.github.dre2n.dungeonsxl.player.DGamePlayer;
import org.bukkit.event.Cancellable; import org.bukkit.event.Cancellable;
import org.bukkit.event.HandlerList; import org.bukkit.event.HandlerList;
@ -32,7 +32,7 @@ public class DPlayerJoinDGroupEvent extends DPlayerEvent implements Cancellable
private boolean creator; private boolean creator;
private DGroup dGroup; private DGroup dGroup;
public DPlayerJoinDGroupEvent(DPlayer dPlayer, boolean creator, DGroup dGroup) { public DPlayerJoinDGroupEvent(DGamePlayer dPlayer, boolean creator, DGroup dGroup) {
super(dPlayer); super(dPlayer);
this.creator = creator; this.creator = creator;
this.dGroup = dGroup; this.dGroup = dGroup;

View File

@ -16,7 +16,7 @@
*/ */
package io.github.dre2n.dungeonsxl.event.dplayer; package io.github.dre2n.dungeonsxl.event.dplayer;
import io.github.dre2n.dungeonsxl.player.DPlayer; import io.github.dre2n.dungeonsxl.player.DGamePlayer;
import org.bukkit.event.Cancellable; import org.bukkit.event.Cancellable;
import org.bukkit.event.HandlerList; import org.bukkit.event.HandlerList;
@ -40,7 +40,7 @@ public class DPlayerKickEvent extends DPlayerEvent implements Cancellable {
private Cause cause; private Cause cause;
public DPlayerKickEvent(DPlayer dPlayer, Cause cause) { public DPlayerKickEvent(DGamePlayer dPlayer, Cause cause) {
super(dPlayer); super(dPlayer);
this.cause = cause; this.cause = cause;
} }

View File

@ -17,7 +17,7 @@
package io.github.dre2n.dungeonsxl.event.dplayer; package io.github.dre2n.dungeonsxl.event.dplayer;
import io.github.dre2n.dungeonsxl.player.DGroup; import io.github.dre2n.dungeonsxl.player.DGroup;
import io.github.dre2n.dungeonsxl.player.DPlayer; import io.github.dre2n.dungeonsxl.player.DGamePlayer;
import org.bukkit.event.Cancellable; import org.bukkit.event.Cancellable;
import org.bukkit.event.HandlerList; import org.bukkit.event.HandlerList;
@ -31,7 +31,7 @@ public class DPlayerLeaveDGroupEvent extends DPlayerEvent implements Cancellable
private DGroup dGroup; private DGroup dGroup;
public DPlayerLeaveDGroupEvent(DPlayer dPlayer, DGroup dGroup) { public DPlayerLeaveDGroupEvent(DGamePlayer dPlayer, DGroup dGroup) {
super(dPlayer); super(dPlayer);
this.dGroup = dGroup; this.dGroup = dGroup;
} }

View File

@ -16,7 +16,7 @@
*/ */
package io.github.dre2n.dungeonsxl.event.dplayer; package io.github.dre2n.dungeonsxl.event.dplayer;
import io.github.dre2n.dungeonsxl.player.DPlayer; import io.github.dre2n.dungeonsxl.player.DGamePlayer;
import org.bukkit.event.Cancellable; import org.bukkit.event.Cancellable;
import org.bukkit.event.HandlerList; import org.bukkit.event.HandlerList;
@ -35,7 +35,7 @@ public class DPlayerUpdateEvent extends DPlayerEvent implements Cancellable {
private boolean kick; private boolean kick;
private boolean triggerAllInDistance; private boolean triggerAllInDistance;
public DPlayerUpdateEvent(DPlayer dPlayer, boolean locationValid, boolean teleportWolf, boolean respawnInventory, boolean offline, boolean kick, boolean triggerAllInDistance) { public DPlayerUpdateEvent(DGamePlayer dPlayer, boolean locationValid, boolean teleportWolf, boolean respawnInventory, boolean offline, boolean kick, boolean triggerAllInDistance) {
super(dPlayer); super(dPlayer);
this.locationValid = locationValid; this.locationValid = locationValid;
this.teleportWolf = teleportWolf; this.teleportWolf = teleportWolf;

View File

@ -41,7 +41,7 @@ import org.bukkit.scheduler.BukkitRunnable;
*/ */
public class Game { public class Game {
protected static DungeonsXL plugin = DungeonsXL.getInstance(); static DungeonsXL plugin = DungeonsXL.getInstance();
private List<DGroup> dGroups = new ArrayList<>(); private List<DGroup> dGroups = new ArrayList<>();
private boolean started; private boolean started;

View File

@ -18,11 +18,10 @@ package io.github.dre2n.dungeonsxl.global;
import io.github.dre2n.commons.util.BlockUtil; import io.github.dre2n.commons.util.BlockUtil;
import io.github.dre2n.commons.util.messageutil.MessageUtil; import io.github.dre2n.commons.util.messageutil.MessageUtil;
import io.github.dre2n.dungeonsxl.DungeonsXL;
import io.github.dre2n.dungeonsxl.config.DMessages; import io.github.dre2n.dungeonsxl.config.DMessages;
import io.github.dre2n.dungeonsxl.game.Game; import io.github.dre2n.dungeonsxl.game.Game;
import io.github.dre2n.dungeonsxl.player.DGamePlayer;
import io.github.dre2n.dungeonsxl.player.DGroup; import io.github.dre2n.dungeonsxl.player.DGroup;
import io.github.dre2n.dungeonsxl.player.DPlayer;
import io.github.dre2n.dungeonsxl.world.GameWorld; import io.github.dre2n.dungeonsxl.world.GameWorld;
import java.util.HashSet; import java.util.HashSet;
import java.util.Set; import java.util.Set;
@ -38,9 +37,6 @@ import org.bukkit.entity.Player;
*/ */
public class DPortal extends GlobalProtection { public class DPortal extends GlobalProtection {
protected static DungeonsXL plugin = DungeonsXL.getInstance();
protected static GlobalProtections protections = plugin.getGlobalProtections();
private Block block1; private Block block1;
private Block block2; private Block block2;
private boolean active; private boolean active;
@ -205,7 +201,7 @@ public class DPortal extends GlobalProtection {
dGroup.setGameWorld(target); dGroup.setGameWorld(target);
new DPlayer(player, target); new DGamePlayer(player, target);
} }
@Override @Override

View File

@ -18,7 +18,6 @@ package io.github.dre2n.dungeonsxl.global;
import io.github.dre2n.commons.util.BlockUtil; import io.github.dre2n.commons.util.BlockUtil;
import io.github.dre2n.commons.util.messageutil.MessageUtil; import io.github.dre2n.commons.util.messageutil.MessageUtil;
import io.github.dre2n.dungeonsxl.DungeonsXL;
import io.github.dre2n.dungeonsxl.config.DMessages; import io.github.dre2n.dungeonsxl.config.DMessages;
import io.github.dre2n.dungeonsxl.config.WorldConfig; import io.github.dre2n.dungeonsxl.config.WorldConfig;
import io.github.dre2n.dungeonsxl.dungeon.Dungeon; import io.github.dre2n.dungeonsxl.dungeon.Dungeon;
@ -42,9 +41,6 @@ import org.bukkit.entity.Player;
*/ */
public class GameSign extends GlobalProtection { public class GameSign extends GlobalProtection {
protected static DungeonsXL plugin = DungeonsXL.getInstance();
protected static GlobalProtections protections = plugin.getGlobalProtections();
// Sign Labels // Sign Labels
public static final String IS_PLAYING = ChatColor.DARK_RED + "Is Playing"; public static final String IS_PLAYING = ChatColor.DARK_RED + "Is Playing";
public static final String FULL = ChatColor.DARK_RED + "Full"; public static final String FULL = ChatColor.DARK_RED + "Full";

View File

@ -18,9 +18,9 @@ import org.bukkit.configuration.file.YamlConfiguration;
*/ */
public abstract class GlobalProtection { public abstract class GlobalProtection {
protected static DungeonsXL plugin = DungeonsXL.getInstance(); static DungeonsXL plugin = DungeonsXL.getInstance();
protected static FileConfiguration config = plugin.getDataConfig().getConfig(); static FileConfiguration config = plugin.getDataConfig().getConfig();
protected static GlobalProtections protections = plugin.getGlobalProtections(); static GlobalProtections protections = plugin.getGlobalProtections();
private World world; private World world;
private int id; private int id;

View File

@ -21,7 +21,7 @@ import org.bukkit.configuration.file.YamlConfiguration;
*/ */
public class GlobalProtections { public class GlobalProtections {
protected static DungeonsXL plugin = DungeonsXL.getInstance(); DungeonsXL plugin = DungeonsXL.getInstance();
private Set<GlobalProtection> protections = new HashSet<>(); private Set<GlobalProtection> protections = new HashSet<>();

View File

@ -18,7 +18,6 @@ package io.github.dre2n.dungeonsxl.global;
import io.github.dre2n.commons.util.BlockUtil; import io.github.dre2n.commons.util.BlockUtil;
import io.github.dre2n.commons.util.messageutil.MessageUtil; import io.github.dre2n.commons.util.messageutil.MessageUtil;
import io.github.dre2n.dungeonsxl.DungeonsXL;
import io.github.dre2n.dungeonsxl.config.DMessages; import io.github.dre2n.dungeonsxl.config.DMessages;
import io.github.dre2n.dungeonsxl.config.WorldConfig; import io.github.dre2n.dungeonsxl.config.WorldConfig;
import io.github.dre2n.dungeonsxl.dungeon.Dungeon; import io.github.dre2n.dungeonsxl.dungeon.Dungeon;
@ -41,9 +40,6 @@ import org.bukkit.entity.Player;
*/ */
public class GroupSign extends GlobalProtection { public class GroupSign extends GlobalProtection {
protected static DungeonsXL plugin = DungeonsXL.getInstance();
protected static GlobalProtections protections = plugin.getGlobalProtections();
// Sign Labels // Sign Labels
public static final String IS_PLAYING = ChatColor.DARK_RED + "Is Playing"; public static final String IS_PLAYING = ChatColor.DARK_RED + "Is Playing";
public static final String FULL = ChatColor.DARK_RED + "Full"; public static final String FULL = ChatColor.DARK_RED + "Full";

View File

@ -18,10 +18,9 @@ package io.github.dre2n.dungeonsxl.global;
import io.github.dre2n.commons.util.BlockUtil; import io.github.dre2n.commons.util.BlockUtil;
import io.github.dre2n.commons.util.messageutil.MessageUtil; import io.github.dre2n.commons.util.messageutil.MessageUtil;
import io.github.dre2n.dungeonsxl.DungeonsXL;
import io.github.dre2n.dungeonsxl.config.DMessages; import io.github.dre2n.dungeonsxl.config.DMessages;
import io.github.dre2n.dungeonsxl.player.DGroup; import io.github.dre2n.dungeonsxl.player.DGroup;
import io.github.dre2n.dungeonsxl.player.DPlayer; import io.github.dre2n.dungeonsxl.player.DGamePlayer;
import java.util.HashSet; import java.util.HashSet;
import java.util.Set; import java.util.Set;
import org.bukkit.ChatColor; import org.bukkit.ChatColor;
@ -35,8 +34,6 @@ import org.bukkit.entity.Player;
*/ */
public class LeaveSign extends GlobalProtection { public class LeaveSign extends GlobalProtection {
protected static DungeonsXL plugin = DungeonsXL.getInstance();
private Sign sign; private Sign sign;
private Set<Block> blocks; private Set<Block> blocks;
@ -102,7 +99,7 @@ public class LeaveSign extends GlobalProtection {
return false; return false;
} }
DPlayer dplayer = DPlayer.getByPlayer(player); DGamePlayer dplayer = DGamePlayer.getByPlayer(player);
if (dplayer != null) { if (dplayer != null) {
dplayer.leave(); dplayer.leave();

View File

@ -55,8 +55,8 @@ import org.bukkit.event.block.SignChangeEvent;
*/ */
public class BlockListener implements Listener { public class BlockListener implements Listener {
protected static DungeonsXL plugin = DungeonsXL.getInstance(); DungeonsXL plugin = DungeonsXL.getInstance();
protected static DPlayers dPlayers = plugin.getDPlayers(); DPlayers dPlayers = plugin.getDPlayers();
@EventHandler(priority = EventPriority.HIGH) @EventHandler(priority = EventPriority.HIGH)
public void onPhysics(BlockPhysicsEvent event) { public void onPhysics(BlockPhysicsEvent event) {

View File

@ -23,7 +23,7 @@ import io.github.dre2n.dungeonsxl.game.GameType;
import io.github.dre2n.dungeonsxl.game.GameTypeDefault; import io.github.dre2n.dungeonsxl.game.GameTypeDefault;
import io.github.dre2n.dungeonsxl.mob.DMob; import io.github.dre2n.dungeonsxl.mob.DMob;
import io.github.dre2n.dungeonsxl.player.DGroup; import io.github.dre2n.dungeonsxl.player.DGroup;
import io.github.dre2n.dungeonsxl.player.DPlayer; import io.github.dre2n.dungeonsxl.player.DGamePlayer;
import io.github.dre2n.dungeonsxl.world.EditWorld; import io.github.dre2n.dungeonsxl.world.EditWorld;
import io.github.dre2n.dungeonsxl.world.GameWorld; import io.github.dre2n.dungeonsxl.world.GameWorld;
import java.util.List; import java.util.List;
@ -201,7 +201,7 @@ public class EntityListener implements Listener {
// Check Dogs // Check Dogs
if (attackerEntity instanceof Player || attackedEntity instanceof Player) { if (attackerEntity instanceof Player || attackedEntity instanceof Player) {
for (DPlayer dPlayer : DPlayer.getByWorld(gameWorld.getWorld())) { for (DGamePlayer dPlayer : DGamePlayer.getByWorld(gameWorld.getWorld())) {
if (dPlayer.getWolf() != null) { if (dPlayer.getWolf() != null) {
if (attackerEntity == dPlayer.getWolf() || attackedEntity == dPlayer.getWolf()) { if (attackerEntity == dPlayer.getWolf() || attackedEntity == dPlayer.getWolf()) {
event.setCancelled(true); event.setCancelled(true);
@ -211,7 +211,7 @@ public class EntityListener implements Listener {
} }
} }
for (DPlayer dPlayer : DPlayer.getByWorld(gameWorld.getWorld())) { for (DGamePlayer dPlayer : DGamePlayer.getByWorld(gameWorld.getWorld())) {
if (dPlayer.getWolf() != null) { if (dPlayer.getWolf() != null) {
if (attackerEntity instanceof Player || attackedEntity instanceof Player) { if (attackerEntity instanceof Player || attackedEntity instanceof Player) {
if (attackerEntity == dPlayer.getWolf() || attackedEntity == dPlayer.getWolf()) { if (attackerEntity == dPlayer.getWolf() || attackedEntity == dPlayer.getWolf()) {

View File

@ -31,7 +31,7 @@ import io.github.dre2n.dungeonsxl.global.LeaveSign;
import io.github.dre2n.dungeonsxl.player.DGlobalPlayer; import io.github.dre2n.dungeonsxl.player.DGlobalPlayer;
import io.github.dre2n.dungeonsxl.player.DGroup; import io.github.dre2n.dungeonsxl.player.DGroup;
import io.github.dre2n.dungeonsxl.player.DPermissions; import io.github.dre2n.dungeonsxl.player.DPermissions;
import io.github.dre2n.dungeonsxl.player.DPlayer; import io.github.dre2n.dungeonsxl.player.DGamePlayer;
import io.github.dre2n.dungeonsxl.player.DPlayers; import io.github.dre2n.dungeonsxl.player.DPlayers;
import io.github.dre2n.dungeonsxl.player.DSavePlayer; import io.github.dre2n.dungeonsxl.player.DSavePlayer;
import io.github.dre2n.dungeonsxl.reward.DLootInventory; import io.github.dre2n.dungeonsxl.reward.DLootInventory;
@ -76,14 +76,13 @@ import org.bukkit.inventory.meta.BookMeta;
*/ */
public class PlayerListener implements Listener { public class PlayerListener implements Listener {
protected static DungeonsXL plugin = DungeonsXL.getInstance(); DungeonsXL plugin = DungeonsXL.getInstance();
DPlayers dPlayers = plugin.getDPlayers();
protected static DPlayers dPlayers = plugin.getDPlayers();
@EventHandler(priority = EventPriority.HIGH) @EventHandler(priority = EventPriority.HIGH)
public void onDeath(PlayerDeathEvent event) { public void onDeath(PlayerDeathEvent event) {
Player player = event.getEntity(); Player player = event.getEntity();
DPlayer dPlayer = DPlayer.getByPlayer(player); DGamePlayer dPlayer = DGamePlayer.getByPlayer(player);
GameWorld gameWorld = GameWorld.getByWorld(player.getLocation().getWorld()); GameWorld gameWorld = GameWorld.getByWorld(player.getLocation().getWorld());
if (gameWorld == null) { if (gameWorld == null) {
@ -215,7 +214,7 @@ public class PlayerListener implements Listener {
if (EditWorld.getByWorld(player.getWorld()) != null) { if (EditWorld.getByWorld(player.getWorld()) != null) {
if (event.getAction() == Action.RIGHT_CLICK_BLOCK) { if (event.getAction() == Action.RIGHT_CLICK_BLOCK) {
if (item.getType() == Material.STICK) { if (item.getType() == Material.STICK) {
DPlayer dPlayer = DPlayer.getByPlayer(player); DGamePlayer dPlayer = DGamePlayer.getByPlayer(player);
if (dPlayer != null) { if (dPlayer != null) {
dPlayer.poke(clickedBlock); dPlayer.poke(clickedBlock);
event.setCancelled(true); event.setCancelled(true);
@ -274,7 +273,7 @@ public class PlayerListener implements Listener {
event.setCancelled(true); event.setCancelled(true);
} }
DPlayer dPlayer = DPlayer.getByPlayer(player); DGamePlayer dPlayer = DGamePlayer.getByPlayer(player);
if (dPlayer != null) { if (dPlayer != null) {
// Check GameWorld Signs // Check GameWorld Signs
@ -314,7 +313,7 @@ public class PlayerListener implements Listener {
public void onDropItem(PlayerDropItemEvent event) { public void onDropItem(PlayerDropItemEvent event) {
Player player = event.getPlayer(); Player player = event.getPlayer();
DPlayer dPlayer = DPlayer.getByPlayer(player); DGamePlayer dPlayer = DGamePlayer.getByPlayer(player);
if (dPlayer == null) { if (dPlayer == null) {
return; return;
} }
@ -354,7 +353,7 @@ public class PlayerListener implements Listener {
Player player = event.getPlayer(); Player player = event.getPlayer();
plugin.getDPlayers().getByPlayer(player).applyRespawnInventory(); plugin.getDPlayers().getByPlayer(player).applyRespawnInventory();
DPlayer dPlayer = DPlayer.getByPlayer(player); DGamePlayer dPlayer = DGamePlayer.getByPlayer(player);
if (dPlayer == null) { if (dPlayer == null) {
return; return;
} }
@ -415,7 +414,7 @@ public class PlayerListener implements Listener {
@EventHandler(priority = EventPriority.HIGH) @EventHandler(priority = EventPriority.HIGH)
public void onTeleport(PlayerTeleportEvent event) { public void onTeleport(PlayerTeleportEvent event) {
Player player = event.getPlayer(); Player player = event.getPlayer();
DPlayer dPlayer = DPlayer.getByPlayer(player); DGamePlayer dPlayer = DGamePlayer.getByPlayer(player);
if (dPlayer == null) { if (dPlayer == null) {
return; return;
@ -433,7 +432,7 @@ public class PlayerListener implements Listener {
@EventHandler(priority = EventPriority.HIGH) @EventHandler(priority = EventPriority.HIGH)
public void onChat(AsyncPlayerChatEvent event) { public void onChat(AsyncPlayerChatEvent event) {
Player player = event.getPlayer(); Player player = event.getPlayer();
DPlayer dPlayer = DPlayer.getByPlayer(player); DGamePlayer dPlayer = DGamePlayer.getByPlayer(player);
if (dPlayer == null) { if (dPlayer == null) {
return; return;
} }
@ -447,7 +446,7 @@ public class PlayerListener implements Listener {
@EventHandler(priority = EventPriority.HIGH) @EventHandler(priority = EventPriority.HIGH)
public void onQuit(PlayerQuitEvent event) { public void onQuit(PlayerQuitEvent event) {
Player player = event.getPlayer(); Player player = event.getPlayer();
DPlayer dPlayer = DPlayer.getByPlayer(player); DGamePlayer dPlayer = DGamePlayer.getByPlayer(player);
if (dPlayer == null) { if (dPlayer == null) {
dPlayers.removePlayer(dPlayer); dPlayers.removePlayer(dPlayer);
@ -484,7 +483,7 @@ public class PlayerListener implements Listener {
new DGlobalPlayer(player); new DGlobalPlayer(player);
// Check dPlayers // Check dPlayers
DPlayer dPlayer = DPlayer.getByName(player.getName()); DGamePlayer dPlayer = DGamePlayer.getByName(player.getName());
if (dPlayer != null) { if (dPlayer != null) {
DGroup dGroup = DGroup.getByPlayer(dPlayer.getPlayer()); DGroup dGroup = DGroup.getByPlayer(dPlayer.getPlayer());
if (dGroup != null) { if (dGroup != null) {
@ -514,7 +513,7 @@ public class PlayerListener implements Listener {
return; return;
} }
if (DPlayer.getByPlayer(player) != null) { if (DGamePlayer.getByPlayer(player) != null) {
return; return;
} }
@ -553,7 +552,7 @@ public class PlayerListener implements Listener {
continue; continue;
} }
new DPlayer(player, dGroup.getGameWorld()); new DGamePlayer(player, dGroup.getGameWorld());
} }
} }
@ -564,7 +563,7 @@ public class PlayerListener implements Listener {
return; return;
} }
DPlayer dPlayer = DPlayer.getByPlayer(event.getPlayer()); DGamePlayer dPlayer = DGamePlayer.getByPlayer(event.getPlayer());
if (dPlayer == null) { if (dPlayer == null) {
return; return;
} }

View File

@ -18,6 +18,7 @@ package io.github.dre2n.dungeonsxl.mob;
import io.github.dre2n.commons.util.EnumUtil; import io.github.dre2n.commons.util.EnumUtil;
import io.github.dre2n.commons.util.NumberUtil; import io.github.dre2n.commons.util.NumberUtil;
import io.github.dre2n.commons.util.messageutil.MessageUtil;
import io.github.dre2n.dungeonsxl.DungeonsXL; import io.github.dre2n.dungeonsxl.DungeonsXL;
import io.github.dre2n.dungeonsxl.config.DMessages; import io.github.dre2n.dungeonsxl.config.DMessages;
import io.github.dre2n.dungeonsxl.world.GameWorld; import io.github.dre2n.dungeonsxl.world.GameWorld;
@ -43,7 +44,7 @@ import org.bukkit.inventory.meta.ItemMeta;
*/ */
public class DMobType { public class DMobType {
protected static DungeonsXL plugin = DungeonsXL.getInstance(); static DungeonsXL plugin = DungeonsXL.getInstance();
private String name; private String name;
private EntityType type; private EntityType type;
@ -128,7 +129,7 @@ public class DMobType {
EntityType type = EntityType.fromName(configFile.getString(mobName + ".Type")); EntityType type = EntityType.fromName(configFile.getString(mobName + ".Type"));
if (type == null) { if (type == null) {
plugin.getLogger().info(plugin.getMessageConfig().getMessage(DMessages.LOG_ERROR_MOBTYPE, configFile.getString(mobName + ".Type"))); MessageUtil.log(DMessages.LOG_ERROR_MOBTYPE.getMessage(configFile.getString(mobName + ".Type")));
continue; continue;
} }
@ -210,7 +211,7 @@ public class DMobType {
itemMeta.addEnchant(Enchantment.getByName(splittedEnchantment[0].toUpperCase()), 1, true); itemMeta.addEnchant(Enchantment.getByName(splittedEnchantment[0].toUpperCase()), 1, true);
} }
} else { } else {
plugin.getLogger().info(plugin.getMessageConfig().getMessage(DMessages.LOG_ERROR_MOB_ENCHANTMENT, splittedEnchantment[0])); MessageUtil.log(DMessages.LOG_ERROR_MOB_ENCHANTMENT.getMessage(splittedEnchantment[0]));
} }
} }
} }

View File

@ -64,7 +64,7 @@ import org.bukkit.potion.PotionEffect;
* *
* @author Frank Baumann, Tobias Schmitz, Milan Albrecht, Daniel Saukel * @author Frank Baumann, Tobias Schmitz, Milan Albrecht, Daniel Saukel
*/ */
public class DPlayer extends DGlobalPlayer { public class DGamePlayer extends DGlobalPlayer {
// Variables // Variables
private World world; private World world;
@ -88,12 +88,12 @@ public class DPlayer extends DGlobalPlayer {
private int initialLives = -1; private int initialLives = -1;
private int lives; private int lives;
public DPlayer(Player player, GameWorld gameWorld) { public DGamePlayer(Player player, GameWorld gameWorld) {
this(player, gameWorld.getWorld(), false); this(player, gameWorld.getWorld(), false);
} }
@Deprecated @Deprecated
public DPlayer(Player player, World world, boolean editing) { public DGamePlayer(Player player, World world, boolean editing) {
super(player); super(player);
this.world = world; this.world = world;
@ -659,7 +659,7 @@ public class DPlayer extends DGlobalPlayer {
} }
for (Player player : dGroup.getPlayers()) { for (Player player : dGroup.getPlayers()) {
DPlayer dPlayer = getByPlayer(player); DGamePlayer dPlayer = getByPlayer(player);
if (!dPlayer.finished) { if (!dPlayer.finished) {
MessageUtil.sendMessage(this.getPlayer(), DMessages.PLAYER_WAIT_FOR_OTHER_PLAYERS.getMessage()); MessageUtil.sendMessage(this.getPlayer(), DMessages.PLAYER_WAIT_FOR_OTHER_PLAYERS.getMessage());
return; return;
@ -673,7 +673,7 @@ public class DPlayer extends DGlobalPlayer {
} }
for (Player player : dGroup.getPlayers()) { for (Player player : dGroup.getPlayers()) {
DPlayer dPlayer = getByPlayer(player); DGamePlayer dPlayer = getByPlayer(player);
if (invalid) { if (invalid) {
dPlayer.finish(false); dPlayer.finish(false);
@ -710,7 +710,7 @@ public class DPlayer extends DGlobalPlayer {
GameWorld gameWorld = GameWorld.load(newFloor); GameWorld gameWorld = GameWorld.load(newFloor);
dGroup.setGameWorld(gameWorld); dGroup.setGameWorld(gameWorld);
for (Player player : dGroup.getPlayers()) { for (Player player : dGroup.getPlayers()) {
DPlayer dPlayer = getByPlayer(player); DGamePlayer dPlayer = getByPlayer(player);
dPlayer.setWorld(gameWorld.getWorld()); dPlayer.setWorld(gameWorld.getWorld());
dPlayer.setCheckpoint(dGroup.getGameWorld().getLocStart()); dPlayer.setCheckpoint(dGroup.getGameWorld().getLocStart());
if (dPlayer.getWolf() != null) { if (dPlayer.getWolf() != null) {
@ -743,7 +743,7 @@ public class DPlayer extends DGlobalPlayer {
boolean hasToWait = false; boolean hasToWait = false;
for (Player player : dGroup.getPlayers()) { for (Player player : dGroup.getPlayers()) {
DPlayer dPlayer = getByPlayer(player); DGamePlayer dPlayer = getByPlayer(player);
if (!dPlayer.finished) { if (!dPlayer.finished) {
if (message) { if (message) {
MessageUtil.sendMessage(this.getPlayer(), DMessages.PLAYER_WAIT_FOR_OTHER_PLAYERS.getMessage()); MessageUtil.sendMessage(this.getPlayer(), DMessages.PLAYER_WAIT_FOR_OTHER_PLAYERS.getMessage());
@ -775,7 +775,7 @@ public class DPlayer extends DGlobalPlayer {
Game.getByDGroup(dGroup).resetWaveKills(); Game.getByDGroup(dGroup).resetWaveKills();
for (Player player : dGroup.getPlayers()) { for (Player player : dGroup.getPlayers()) {
DPlayer dPlayer = getByPlayer(player); DGamePlayer dPlayer = getByPlayer(player);
dPlayer.leave(); dPlayer.leave();
for (Reward reward : dGroup.getRewards()) { for (Reward reward : dGroup.getRewards()) {
@ -788,7 +788,7 @@ public class DPlayer extends DGlobalPlayer {
if (editing) { if (editing) {
EditWorld editWorld = EditWorld.getByWorld(world); EditWorld editWorld = EditWorld.getByWorld(world);
editWorld.sendMessage(message); editWorld.sendMessage(message);
for (DGlobalPlayer player : plugin.getDPlayers().getPlayers()) { for (DGlobalPlayer player : plugin.getDPlayers().getDGlobalPlayers()) {
if (player.isInChatSpyMode()) { if (player.isInChatSpyMode()) {
if (!editWorld.getWorld().getPlayers().contains(player.getPlayer())) { if (!editWorld.getWorld().getPlayers().contains(player.getPlayer())) {
MessageUtil.sendMessage(player.getPlayer(), ChatColor.GREEN + "[Chatspy] " + ChatColor.WHITE + message); MessageUtil.sendMessage(player.getPlayer(), ChatColor.GREEN + "[Chatspy] " + ChatColor.WHITE + message);
@ -799,7 +799,7 @@ public class DPlayer extends DGlobalPlayer {
} else { } else {
GameWorld gameWorld = GameWorld.getByWorld(world); GameWorld gameWorld = GameWorld.getByWorld(world);
gameWorld.sendMessage(message); gameWorld.sendMessage(message);
for (DGlobalPlayer player : plugin.getDPlayers().getPlayers()) { for (DGlobalPlayer player : plugin.getDPlayers().getDGlobalPlayers()) {
if (player.isInChatSpyMode()) { if (player.isInChatSpyMode()) {
if (!gameWorld.getWorld().getPlayers().contains(player.getPlayer())) { if (!gameWorld.getWorld().getPlayers().contains(player.getPlayer())) {
MessageUtil.sendMessage(player.getPlayer(), ChatColor.GREEN + "[Chatspy] " + ChatColor.WHITE + message); MessageUtil.sendMessage(player.getPlayer(), ChatColor.GREEN + "[Chatspy] " + ChatColor.WHITE + message);
@ -959,7 +959,7 @@ public class DPlayer extends DGlobalPlayer {
} }
/** /**
* Delete this DPlayer. Creates a DGlobalPlayer to replace it! * Delete this DGamePlayer. Creates a DGlobalPlayer to replace it!
*/ */
public void delete() { public void delete() {
if (player.isOnline()) { if (player.isOnline()) {
@ -972,8 +972,8 @@ public class DPlayer extends DGlobalPlayer {
} }
/* Statics */ /* Statics */
public static DPlayer getByPlayer(Player player) { public static DGamePlayer getByPlayer(Player player) {
for (DPlayer dPlayer : plugin.getDPlayers().getDPlayers()) { for (DGamePlayer dPlayer : plugin.getDPlayers().getDGamePlayers()) {
if (dPlayer.getPlayer().equals(player)) { if (dPlayer.getPlayer().equals(player)) {
return dPlayer; return dPlayer;
} }
@ -981,8 +981,8 @@ public class DPlayer extends DGlobalPlayer {
return null; return null;
} }
public static DPlayer getByName(String name) { public static DGamePlayer getByName(String name) {
for (DPlayer dPlayer : plugin.getDPlayers().getDPlayers()) { for (DGamePlayer dPlayer : plugin.getDPlayers().getDGamePlayers()) {
if (dPlayer.getPlayer().getName().equalsIgnoreCase(name)) { if (dPlayer.getPlayer().getName().equalsIgnoreCase(name)) {
return dPlayer; return dPlayer;
} }
@ -990,10 +990,10 @@ public class DPlayer extends DGlobalPlayer {
return null; return null;
} }
public static CopyOnWriteArrayList<DPlayer> getByWorld(World world) { public static CopyOnWriteArrayList<DGamePlayer> getByWorld(World world) {
CopyOnWriteArrayList<DPlayer> dPlayers = new CopyOnWriteArrayList<>(); CopyOnWriteArrayList<DGamePlayer> dPlayers = new CopyOnWriteArrayList<>();
for (DPlayer dPlayer : plugin.getDPlayers().getDPlayers()) { for (DGamePlayer dPlayer : plugin.getDPlayers().getDGamePlayers()) {
if (dPlayer.world == world) { if (dPlayer.world == world) {
dPlayers.add(dPlayer); dPlayers.add(dPlayer);
} }

View File

@ -28,7 +28,7 @@ import org.bukkit.inventory.ItemStack;
*/ */
public class DGlobalPlayer { public class DGlobalPlayer {
protected static DungeonsXL plugin = DungeonsXL.getInstance(); static DungeonsXL plugin = DungeonsXL.getInstance();
protected Player player; protected Player player;

View File

@ -47,11 +47,11 @@ import org.bukkit.scheduler.BukkitTask;
*/ */
public class DGroup { public class DGroup {
protected static DungeonsXL plugin = DungeonsXL.getInstance(); static DungeonsXL plugin = DungeonsXL.getInstance();
private String name; private String name;
private Player captain; private Player captain;
private List<Player> players = new CopyOnWriteArrayList<>(); private CopyOnWriteArrayList<Player> players = new CopyOnWriteArrayList<>();
private List<UUID> invitedPlayers = new ArrayList<>(); private List<UUID> invitedPlayers = new ArrayList<>();
private String dungeonName; private String dungeonName;
private String mapName; private String mapName;
@ -81,7 +81,7 @@ public class DGroup {
this(name, player, new CopyOnWriteArrayList<>(Arrays.asList(player)), identifier, multiFloor); this(name, player, new CopyOnWriteArrayList<>(Arrays.asList(player)), identifier, multiFloor);
} }
public DGroup(String name, Player captain, List<Player> players, String identifier, boolean multiFloor) { public DGroup(String name, Player captain, CopyOnWriteArrayList<Player> players, String identifier, boolean multiFloor) {
plugin.getDGroups().add(this); plugin.getDGroups().add(this);
this.name = name; this.name = name;
@ -454,9 +454,9 @@ public class DGroup {
} }
for (Player player : dGroup.getPlayers()) { for (Player player : dGroup.getPlayers()) {
DPlayer dPlayer = DPlayer.getByPlayer(player); DGamePlayer dPlayer = DGamePlayer.getByPlayer(player);
if (dPlayer == null) { if (dPlayer == null) {
new DPlayer(player, gameWorld); new DGamePlayer(player, gameWorld);
} }
if (!dPlayer.isReady()) { if (!dPlayer.isReady()) {
@ -482,7 +482,7 @@ public class DGroup {
floorCount++; floorCount++;
for (Player player : getPlayers()) { for (Player player : getPlayers()) {
DPlayer dPlayer = DPlayer.getByPlayer(player); DGamePlayer dPlayer = DGamePlayer.getByPlayer(player);
if (dPlayer == null) { if (dPlayer == null) {
continue; continue;
} }

View File

@ -26,8 +26,8 @@ import org.bukkit.entity.Player;
*/ */
public class DPlayers { public class DPlayers {
private List<DGlobalPlayer> dGlobalPlayers = new CopyOnWriteArrayList<>(); private CopyOnWriteArrayList<DGlobalPlayer> dGlobalPlayers = new CopyOnWriteArrayList<>();
private List<DSavePlayer> dSavePlayers = new CopyOnWriteArrayList<>(); private CopyOnWriteArrayList<DSavePlayer> dSavePlayers = new CopyOnWriteArrayList<>();
/** /**
* @return the DGlobalPlayer which represents the player * @return the DGlobalPlayer which represents the player
@ -45,18 +45,18 @@ public class DPlayers {
/** /**
* @return the dGlobalPlayers * @return the dGlobalPlayers
*/ */
public List<DGlobalPlayer> getPlayers() { public List<DGlobalPlayer> getDGlobalPlayers() {
return dGlobalPlayers; return dGlobalPlayers;
} }
/** /**
* @return the dGlobalPlayers that are an instance of DPlayer * @return the dGlobalPlayers that are an instance of DGamePlayer
*/ */
public List<DPlayer> getDPlayers() { public List<DGamePlayer> getDGamePlayers() {
List<DPlayer> dPlayers = new CopyOnWriteArrayList<>(); List<DGamePlayer> dPlayers = new CopyOnWriteArrayList<>();
for (DGlobalPlayer player : dGlobalPlayers) { for (DGlobalPlayer player : dGlobalPlayers) {
if (player instanceof DPlayer) { if (player instanceof DGamePlayer) {
dPlayers.add((DPlayer) player); dPlayers.add((DGamePlayer) player);
} }
} }
return dPlayers; return dPlayers;

View File

@ -45,8 +45,8 @@ import org.bukkit.potion.PotionEffect;
*/ */
public class DSavePlayer { public class DSavePlayer {
protected static DungeonsXL plugin = DungeonsXL.getInstance(); static DungeonsXL plugin = DungeonsXL.getInstance();
protected static DPlayers dPlayers = plugin.getDPlayers(); static DPlayers dPlayers = plugin.getDPlayers();
// Variables // Variables
private String name; private String name;

View File

@ -18,7 +18,7 @@ package io.github.dre2n.dungeonsxl.requirement;
import io.github.dre2n.commons.util.messageutil.MessageUtil; import io.github.dre2n.commons.util.messageutil.MessageUtil;
import io.github.dre2n.dungeonsxl.config.DMessages; import io.github.dre2n.dungeonsxl.config.DMessages;
import io.github.dre2n.dungeonsxl.player.DPlayer; import io.github.dre2n.dungeonsxl.player.DGamePlayer;
import io.github.dre2n.dungeonsxl.player.DSavePlayer; import io.github.dre2n.dungeonsxl.player.DSavePlayer;
import org.bukkit.entity.Player; import org.bukkit.entity.Player;
@ -53,7 +53,7 @@ public class FeeLevelRequirement extends Requirement {
@Override @Override
public void demand(Player player) { public void demand(Player player) {
DPlayer dPlayer = DPlayer.getByPlayer(player); DGamePlayer dPlayer = DGamePlayer.getByPlayer(player);
if (dPlayer == null) { if (dPlayer == null) {
return; return;
} }

View File

@ -16,6 +16,7 @@
*/ */
package io.github.dre2n.dungeonsxl.requirement; package io.github.dre2n.dungeonsxl.requirement;
import io.github.dre2n.commons.util.messageutil.MessageUtil;
import io.github.dre2n.dungeonsxl.DungeonsXL; import io.github.dre2n.dungeonsxl.DungeonsXL;
import io.github.dre2n.dungeonsxl.event.requirement.RequirementRegistrationEvent; import io.github.dre2n.dungeonsxl.event.requirement.RequirementRegistrationEvent;
import java.lang.reflect.Constructor; import java.lang.reflect.Constructor;
@ -27,7 +28,7 @@ import org.bukkit.entity.Player;
*/ */
public abstract class Requirement { public abstract class Requirement {
protected static DungeonsXL plugin = DungeonsXL.getInstance(); DungeonsXL plugin = DungeonsXL.getInstance();
public static Requirement create(RequirementType type) { public static Requirement create(RequirementType type) {
Requirement requirement = null; Requirement requirement = null;
@ -37,9 +38,9 @@ public abstract class Requirement {
requirement = constructor.newInstance(); requirement = constructor.newInstance();
} catch (NoSuchMethodException | SecurityException | InstantiationException | IllegalAccessException | IllegalArgumentException | InvocationTargetException exception) { } catch (NoSuchMethodException | SecurityException | InstantiationException | IllegalAccessException | IllegalArgumentException | InvocationTargetException exception) {
plugin.getLogger().info("An error occurred while accessing the handler class of the requirement " + type.getIdentifier() + ": " + exception.getClass().getSimpleName()); MessageUtil.log("An error occurred while accessing the handler class of the requirement " + type.getIdentifier() + ": " + exception.getClass().getSimpleName());
if (!(type instanceof RequirementTypeDefault)) { if (!(type instanceof RequirementTypeDefault)) {
plugin.getLogger().info("Please note that this requirement is an unsupported feature added by an addon!"); MessageUtil.log("Please note that this requirement is an unsupported feature added by an addon!");
} }
} }

View File

@ -30,7 +30,7 @@ import org.bukkit.inventory.ItemStack;
*/ */
public class DLootInventory { public class DLootInventory {
protected static DungeonsXL plugin = DungeonsXL.getInstance(); static DungeonsXL plugin = DungeonsXL.getInstance();
private Inventory inventory; private Inventory inventory;
private InventoryView inventoryView; private InventoryView inventoryView;

View File

@ -16,6 +16,7 @@
*/ */
package io.github.dre2n.dungeonsxl.reward; package io.github.dre2n.dungeonsxl.reward;
import io.github.dre2n.commons.util.messageutil.MessageUtil;
import io.github.dre2n.dungeonsxl.DungeonsXL; import io.github.dre2n.dungeonsxl.DungeonsXL;
import io.github.dre2n.dungeonsxl.event.reward.RewardRegistrationEvent; import io.github.dre2n.dungeonsxl.event.reward.RewardRegistrationEvent;
import java.lang.reflect.Constructor; import java.lang.reflect.Constructor;
@ -27,7 +28,7 @@ import org.bukkit.entity.Player;
*/ */
public abstract class Reward { public abstract class Reward {
protected static DungeonsXL plugin = DungeonsXL.getInstance(); DungeonsXL plugin = DungeonsXL.getInstance();
public static Reward create(RewardType type) { public static Reward create(RewardType type) {
Reward reward = null; Reward reward = null;
@ -37,9 +38,9 @@ public abstract class Reward {
reward = constructor.newInstance(); reward = constructor.newInstance();
} catch (NoSuchMethodException | SecurityException | InstantiationException | IllegalAccessException | IllegalArgumentException | InvocationTargetException exception) { } catch (NoSuchMethodException | SecurityException | InstantiationException | IllegalAccessException | IllegalArgumentException | InvocationTargetException exception) {
plugin.getLogger().info("An error occurred while accessing the handler class of the reward " + type.getIdentifier() + ": " + exception.getClass().getSimpleName()); MessageUtil.log("An error occurred while accessing the handler class of the reward " + type.getIdentifier() + ": " + exception.getClass().getSimpleName());
if (!(type instanceof RewardTypeDefault)) { if (!(type instanceof RewardTypeDefault)) {
plugin.getLogger().info("Please note that this reward is an unsupported feature added by an addon!"); MessageUtil.log("Please note that this reward is an unsupported feature added by an addon!");
} }
} }

View File

@ -20,7 +20,7 @@ import io.github.dre2n.commons.util.messageutil.MessageUtil;
import io.github.dre2n.dungeonsxl.DungeonsXL; import io.github.dre2n.dungeonsxl.DungeonsXL;
import io.github.dre2n.dungeonsxl.config.DMessages; import io.github.dre2n.dungeonsxl.config.DMessages;
import io.github.dre2n.dungeonsxl.player.DGroup; import io.github.dre2n.dungeonsxl.player.DGroup;
import io.github.dre2n.dungeonsxl.player.DPlayer; import io.github.dre2n.dungeonsxl.player.DGamePlayer;
import io.github.dre2n.dungeonsxl.world.GameWorld; import io.github.dre2n.dungeonsxl.world.GameWorld;
import net.milkbowl.vault.item.ItemInfo; import net.milkbowl.vault.item.ItemInfo;
import net.milkbowl.vault.item.Items; import net.milkbowl.vault.item.Items;
@ -38,7 +38,7 @@ import org.bukkit.inventory.ItemStack;
*/ */
public class RewardChest { public class RewardChest {
protected static DungeonsXL plugin = DungeonsXL.getInstance(); static DungeonsXL plugin = DungeonsXL.getInstance();
// Variables // Variables
private boolean used = false; private boolean used = false;
@ -166,7 +166,7 @@ public class RewardChest {
} }
for (Player player : dGroup.getPlayers()) { for (Player player : dGroup.getPlayers()) {
DPlayer dPlayer = DPlayer.getByPlayer(player); DGamePlayer dPlayer = DGamePlayer.getByPlayer(player);
if (dPlayer == null) { if (dPlayer == null) {
continue; continue;
} }
@ -245,7 +245,7 @@ public class RewardChest {
} }
if (rewardChest.used) { if (rewardChest.used) {
MessageUtil.sendMessage(plugin.getServer().getPlayer(event.getPlayer().getUniqueId()), plugin.getMessageConfig().getMessage(DMessages.ERROR_CHEST_IS_OPENED)); MessageUtil.sendMessage(plugin.getServer().getPlayer(event.getPlayer().getUniqueId()), DMessages.ERROR_CHEST_IS_OPENED.getMessage());
event.setCancelled(true); event.setCancelled(true);
continue; continue;
} }

View File

@ -18,7 +18,7 @@ package io.github.dre2n.dungeonsxl.sign;
import io.github.dre2n.commons.util.messageutil.MessageUtil; import io.github.dre2n.commons.util.messageutil.MessageUtil;
import io.github.dre2n.dungeonsxl.config.DMessages; import io.github.dre2n.dungeonsxl.config.DMessages;
import io.github.dre2n.dungeonsxl.player.DPlayer; import io.github.dre2n.dungeonsxl.player.DGamePlayer;
import io.github.dre2n.dungeonsxl.world.GameWorld; import io.github.dre2n.dungeonsxl.world.GameWorld;
import java.util.concurrent.CopyOnWriteArrayList; import java.util.concurrent.CopyOnWriteArrayList;
import org.bukkit.Material; import org.bukkit.Material;
@ -34,7 +34,7 @@ public class CheckpointSign extends DSign {
// Variables // Variables
private boolean initialized; private boolean initialized;
private CopyOnWriteArrayList<DPlayer> done = new CopyOnWriteArrayList<>(); private CopyOnWriteArrayList<DGamePlayer> done = new CopyOnWriteArrayList<>();
public CheckpointSign(Sign sign, GameWorld gameWorld) { public CheckpointSign(Sign sign, GameWorld gameWorld) {
super(sign, gameWorld); super(sign, gameWorld);
@ -58,7 +58,7 @@ public class CheckpointSign extends DSign {
return; return;
} }
for (DPlayer dplayer : DPlayer.getByWorld(getGameWorld().getWorld())) { for (DGamePlayer dplayer : DGamePlayer.getByWorld(getGameWorld().getWorld())) {
dplayer.setCheckpoint(getSign().getLocation()); dplayer.setCheckpoint(getSign().getLocation());
MessageUtil.sendMessage(dplayer.getPlayer(), plugin.getMessageConfig().getMessage(DMessages.PLAYER_CHECKPOINT_REACHED)); MessageUtil.sendMessage(dplayer.getPlayer(), plugin.getMessageConfig().getMessage(DMessages.PLAYER_CHECKPOINT_REACHED));
} }
@ -72,7 +72,7 @@ public class CheckpointSign extends DSign {
return true; return true;
} }
DPlayer dplayer = DPlayer.getByPlayer(player); DGamePlayer dplayer = DGamePlayer.getByPlayer(player);
if (dplayer != null) { if (dplayer != null) {
if (!done.contains(dplayer)) { if (!done.contains(dplayer)) {
done.add(dplayer); done.add(dplayer);
@ -81,7 +81,7 @@ public class CheckpointSign extends DSign {
} }
} }
if (done.size() >= DPlayer.getByWorld(getGameWorld().getWorld()).size()) { if (done.size() >= DGamePlayer.getByWorld(getGameWorld().getWorld()).size()) {
remove(); remove();
} }

View File

@ -16,6 +16,7 @@
*/ */
package io.github.dre2n.dungeonsxl.sign; package io.github.dre2n.dungeonsxl.sign;
import io.github.dre2n.commons.util.messageutil.MessageUtil;
import io.github.dre2n.dungeonsxl.DungeonsXL; import io.github.dre2n.dungeonsxl.DungeonsXL;
import io.github.dre2n.dungeonsxl.event.dsign.DSignRegistrationEvent; import io.github.dre2n.dungeonsxl.event.dsign.DSignRegistrationEvent;
import io.github.dre2n.dungeonsxl.game.Game; import io.github.dre2n.dungeonsxl.game.Game;
@ -33,7 +34,7 @@ import org.bukkit.entity.Player;
*/ */
public abstract class DSign { public abstract class DSign {
protected static DungeonsXL plugin = DungeonsXL.getInstance(); static DungeonsXL plugin = DungeonsXL.getInstance();
private Sign sign; private Sign sign;
private GameWorld gameWorld; private GameWorld gameWorld;
@ -181,9 +182,9 @@ public abstract class DSign {
dSign = constructor.newInstance(sign, gameWorld); dSign = constructor.newInstance(sign, gameWorld);
} catch (NoSuchMethodException | SecurityException | InstantiationException | IllegalAccessException | IllegalArgumentException | InvocationTargetException exception) { } catch (NoSuchMethodException | SecurityException | InstantiationException | IllegalAccessException | IllegalArgumentException | InvocationTargetException exception) {
plugin.getLogger().info("An error occurred while accessing the handler class of the sign " + type.getName() + ": " + exception.getClass().getSimpleName()); MessageUtil.log("An error occurred while accessing the handler class of the sign " + type.getName() + ": " + exception.getClass().getSimpleName());
if (!(type instanceof DSignTypeDefault)) { if (!(type instanceof DSignTypeDefault)) {
plugin.getLogger().info("Please note that this sign is an unsupported feature added by an addon!"); MessageUtil.log("Please note that this sign is an unsupported feature added by an addon!");
} }
} }
} }

View File

@ -23,35 +23,35 @@ import java.util.List;
/** /**
* @author Daniel Saukel * @author Daniel Saukel
*/ */
public class DSigns { public class DSignTypes {
private List<DSignType> dSigns = new ArrayList<>(); private List<DSignType> types = new ArrayList<>();
public DSigns() { public DSignTypes() {
dSigns.addAll(Arrays.asList(DSignTypeDefault.values())); types.addAll(Arrays.asList(DSignTypeDefault.values()));
} }
/** /**
* @return the dSigns * @return the DSign types
*/ */
public List<DSignType> getDSigns() { public List<DSignType> getDSigns() {
return dSigns; return types;
} }
/** /**
* @param dSign * @param type
* the dSigns to add * the type to add
*/ */
public void addDSign(DSignType dSign) { public void addDSign(DSignType type) {
dSigns.add(dSign); types.add(type);
} }
/** /**
* @param dSign * @param type
* the dSigns to remove * the type to remove
*/ */
public void removeDSign(DSignType dSign) { public void removeDSign(DSignType type) {
dSigns.remove(dSign); types.remove(type);
} }
} }

View File

@ -16,7 +16,7 @@
*/ */
package io.github.dre2n.dungeonsxl.sign; package io.github.dre2n.dungeonsxl.sign;
import io.github.dre2n.dungeonsxl.player.DPlayer; import io.github.dre2n.dungeonsxl.player.DGamePlayer;
import io.github.dre2n.dungeonsxl.trigger.InteractTrigger; import io.github.dre2n.dungeonsxl.trigger.InteractTrigger;
import io.github.dre2n.dungeonsxl.world.GameWorld; import io.github.dre2n.dungeonsxl.world.GameWorld;
import org.bukkit.ChatColor; import org.bukkit.ChatColor;
@ -62,7 +62,7 @@ public class EndSign extends DSign {
@Override @Override
public boolean onPlayerTrigger(Player player) { public boolean onPlayerTrigger(Player player) {
DPlayer dPlayer = DPlayer.getByPlayer(player); DGamePlayer dPlayer = DGamePlayer.getByPlayer(player);
if (dPlayer == null) { if (dPlayer == null) {
return true; return true;
} }
@ -77,7 +77,7 @@ public class EndSign extends DSign {
@Override @Override
public void onTrigger() { public void onTrigger() {
for (DPlayer dPlayer : plugin.getDPlayers().getDPlayers()) { for (DGamePlayer dPlayer : plugin.getDPlayers().getDGamePlayers()) {
dPlayer.finish(); dPlayer.finish();
} }
} }

View File

@ -16,7 +16,7 @@
*/ */
package io.github.dre2n.dungeonsxl.sign; package io.github.dre2n.dungeonsxl.sign;
import io.github.dre2n.dungeonsxl.player.DPlayer; import io.github.dre2n.dungeonsxl.player.DGamePlayer;
import io.github.dre2n.dungeonsxl.trigger.InteractTrigger; import io.github.dre2n.dungeonsxl.trigger.InteractTrigger;
import io.github.dre2n.dungeonsxl.world.GameWorld; import io.github.dre2n.dungeonsxl.world.GameWorld;
import org.bukkit.ChatColor; import org.bukkit.ChatColor;
@ -73,7 +73,7 @@ public class FloorSign extends DSign {
@Override @Override
public boolean onPlayerTrigger(Player player) { public boolean onPlayerTrigger(Player player) {
DPlayer dPlayer = DPlayer.getByPlayer(player); DGamePlayer dPlayer = DGamePlayer.getByPlayer(player);
if (dPlayer == null) { if (dPlayer == null) {
return true; return true;
} }
@ -88,7 +88,7 @@ public class FloorSign extends DSign {
@Override @Override
public void onTrigger() { public void onTrigger() {
for (DPlayer dPlayer : plugin.getDPlayers().getDPlayers()) { for (DGamePlayer dPlayer : plugin.getDPlayers().getDGamePlayers()) {
dPlayer.finishFloor(floor); dPlayer.finishFloor(floor);
} }
} }

View File

@ -17,7 +17,7 @@
package io.github.dre2n.dungeonsxl.sign; package io.github.dre2n.dungeonsxl.sign;
import io.github.dre2n.dungeonsxl.event.dplayer.DPlayerEscapeEvent; import io.github.dre2n.dungeonsxl.event.dplayer.DPlayerEscapeEvent;
import io.github.dre2n.dungeonsxl.player.DPlayer; import io.github.dre2n.dungeonsxl.player.DGamePlayer;
import io.github.dre2n.dungeonsxl.trigger.InteractTrigger; import io.github.dre2n.dungeonsxl.trigger.InteractTrigger;
import io.github.dre2n.dungeonsxl.world.GameWorld; import io.github.dre2n.dungeonsxl.world.GameWorld;
import org.bukkit.ChatColor; import org.bukkit.ChatColor;
@ -62,7 +62,7 @@ public class LeaveSign extends DSign {
@Override @Override
public boolean onPlayerTrigger(Player player) { public boolean onPlayerTrigger(Player player) {
DPlayer dPlayer = DPlayer.getByPlayer(player); DGamePlayer dPlayer = DGamePlayer.getByPlayer(player);
if (dPlayer != null) { if (dPlayer != null) {
DPlayerEscapeEvent event = new DPlayerEscapeEvent(dPlayer); DPlayerEscapeEvent event = new DPlayerEscapeEvent(dPlayer);
@ -78,7 +78,7 @@ public class LeaveSign extends DSign {
@Override @Override
public void onTrigger() { public void onTrigger() {
for (DPlayer dPlayer : plugin.getDPlayers().getDPlayers()) { for (DGamePlayer dPlayer : plugin.getDPlayers().getDGamePlayers()) {
DPlayerEscapeEvent event = new DPlayerEscapeEvent(dPlayer); DPlayerEscapeEvent event = new DPlayerEscapeEvent(dPlayer);
if (event.isCancelled()) { if (event.isCancelled()) {

View File

@ -22,7 +22,7 @@ import io.github.dre2n.dungeonsxl.game.Game;
import io.github.dre2n.dungeonsxl.game.GameType; import io.github.dre2n.dungeonsxl.game.GameType;
import io.github.dre2n.dungeonsxl.game.GameTypeDefault; import io.github.dre2n.dungeonsxl.game.GameTypeDefault;
import io.github.dre2n.dungeonsxl.player.DGroup; import io.github.dre2n.dungeonsxl.player.DGroup;
import io.github.dre2n.dungeonsxl.player.DPlayer; import io.github.dre2n.dungeonsxl.player.DGamePlayer;
import io.github.dre2n.dungeonsxl.trigger.InteractTrigger; import io.github.dre2n.dungeonsxl.trigger.InteractTrigger;
import io.github.dre2n.dungeonsxl.world.GameWorld; import io.github.dre2n.dungeonsxl.world.GameWorld;
import org.bukkit.ChatColor; import org.bukkit.ChatColor;
@ -92,7 +92,7 @@ public class ReadySign extends DSign {
@Override @Override
public boolean onPlayerTrigger(Player player) { public boolean onPlayerTrigger(Player player) {
ready(DPlayer.getByPlayer(player)); ready(DGamePlayer.getByPlayer(player));
return true; return true;
} }
@ -100,12 +100,12 @@ public class ReadySign extends DSign {
public void onTrigger() { public void onTrigger() {
for (DGroup dGroup : Game.getByGameWorld(getGameWorld()).getDGroups()) { for (DGroup dGroup : Game.getByGameWorld(getGameWorld()).getDGroups()) {
for (Player player : dGroup.getPlayers()) { for (Player player : dGroup.getPlayers()) {
ready(DPlayer.getByPlayer(player)); ready(DGamePlayer.getByPlayer(player));
} }
} }
} }
private void ready(DPlayer dPlayer) { private void ready(DGamePlayer dPlayer) {
if (dPlayer == null) { if (dPlayer == null) {
return; return;
} }

View File

@ -17,7 +17,7 @@
package io.github.dre2n.dungeonsxl.task; package io.github.dre2n.dungeonsxl.task;
import io.github.dre2n.dungeonsxl.DungeonsXL; import io.github.dre2n.dungeonsxl.DungeonsXL;
import io.github.dre2n.dungeonsxl.player.DPlayer; import io.github.dre2n.dungeonsxl.player.DGamePlayer;
import io.github.dre2n.dungeonsxl.world.GameWorld; import io.github.dre2n.dungeonsxl.world.GameWorld;
import org.bukkit.scheduler.BukkitRunnable; import org.bukkit.scheduler.BukkitRunnable;
@ -26,7 +26,7 @@ import org.bukkit.scheduler.BukkitRunnable;
*/ */
public class LazyUpdateTask extends BukkitRunnable { public class LazyUpdateTask extends BukkitRunnable {
protected static DungeonsXL plugin = DungeonsXL.getInstance(); DungeonsXL plugin = DungeonsXL.getInstance();
@Override @Override
public void run() { public void run() {
@ -34,7 +34,7 @@ public class LazyUpdateTask extends BukkitRunnable {
gameWorld.update(); gameWorld.update();
} }
for (DPlayer dPlayer : plugin.getDPlayers().getDPlayers()) { for (DGamePlayer dPlayer : plugin.getDPlayers().getDGamePlayers()) {
dPlayer.update(true); dPlayer.update(true);
} }
} }

View File

@ -20,7 +20,7 @@ import io.github.dre2n.dungeonsxl.DungeonsXL;
import io.github.dre2n.dungeonsxl.player.DEditPlayer; import io.github.dre2n.dungeonsxl.player.DEditPlayer;
import io.github.dre2n.dungeonsxl.player.DGlobalPlayer; import io.github.dre2n.dungeonsxl.player.DGlobalPlayer;
import io.github.dre2n.dungeonsxl.player.DPermissions; import io.github.dre2n.dungeonsxl.player.DPermissions;
import io.github.dre2n.dungeonsxl.player.DPlayer; import io.github.dre2n.dungeonsxl.player.DGamePlayer;
import org.bukkit.Bukkit; import org.bukkit.Bukkit;
import org.bukkit.entity.Player; import org.bukkit.entity.Player;
import org.bukkit.scheduler.BukkitRunnable; import org.bukkit.scheduler.BukkitRunnable;
@ -38,7 +38,7 @@ public class SecureModeTask extends BukkitRunnable {
dGlobalPlayer = new DGlobalPlayer(player); dGlobalPlayer = new DGlobalPlayer(player);
} }
if (!(dGlobalPlayer instanceof DPlayer || dGlobalPlayer instanceof DEditPlayer)) { if (!(dGlobalPlayer instanceof DGamePlayer || dGlobalPlayer instanceof DEditPlayer)) {
if (player.getWorld().getName().startsWith("DXL_Game_") | player.getWorld().getName().startsWith("DXL_Edit_") && !DPermissions.hasPermission(player, DPermissions.INSECURE)) { if (player.getWorld().getName().startsWith("DXL_Game_") | player.getWorld().getName().startsWith("DXL_Edit_") && !DPermissions.hasPermission(player, DPermissions.INSECURE)) {
player.teleport(Bukkit.getWorlds().get(0).getSpawnLocation()); player.teleport(Bukkit.getWorlds().get(0).getSpawnLocation());
} }

View File

@ -22,7 +22,7 @@ import io.github.dre2n.dungeonsxl.DungeonsXL;
import io.github.dre2n.dungeonsxl.config.DMessages; import io.github.dre2n.dungeonsxl.config.DMessages;
import io.github.dre2n.dungeonsxl.event.dplayer.DPlayerKickEvent; import io.github.dre2n.dungeonsxl.event.dplayer.DPlayerKickEvent;
import io.github.dre2n.dungeonsxl.player.DGroup; import io.github.dre2n.dungeonsxl.player.DGroup;
import io.github.dre2n.dungeonsxl.player.DPlayer; import io.github.dre2n.dungeonsxl.player.DGamePlayer;
import org.bukkit.ChatColor; import org.bukkit.ChatColor;
import org.bukkit.entity.Player; import org.bukkit.entity.Player;
import org.bukkit.scheduler.BukkitRunnable; import org.bukkit.scheduler.BukkitRunnable;
@ -32,7 +32,7 @@ import org.bukkit.scheduler.BukkitRunnable;
*/ */
public class TimeIsRunningTask extends BukkitRunnable { public class TimeIsRunningTask extends BukkitRunnable {
protected static MessageConfig messageConfig = DungeonsXL.getInstance().getMessageConfig(); MessageConfig messageConfig = DungeonsXL.getInstance().getMessageConfig();
private DGroup dGroup; private DGroup dGroup;
private int time; private int time;
@ -60,7 +60,7 @@ public class TimeIsRunningTask extends BukkitRunnable {
for (Player player : dGroup.getPlayers()) { for (Player player : dGroup.getPlayers()) {
MessageUtil.sendActionBarMessage(player, DMessages.PLAYER_TIME_LEFT.getMessage(color, String.valueOf(timeLeft))); MessageUtil.sendActionBarMessage(player, DMessages.PLAYER_TIME_LEFT.getMessage(color, String.valueOf(timeLeft)));
DPlayer dPlayer = DPlayer.getByPlayer(player); DGamePlayer dPlayer = DGamePlayer.getByPlayer(player);
if (timeLeft > 0) { if (timeLeft > 0) {
continue; continue;
} }

View File

@ -17,7 +17,7 @@
package io.github.dre2n.dungeonsxl.task; package io.github.dre2n.dungeonsxl.task;
import io.github.dre2n.dungeonsxl.DungeonsXL; import io.github.dre2n.dungeonsxl.DungeonsXL;
import io.github.dre2n.dungeonsxl.player.DPlayer; import io.github.dre2n.dungeonsxl.player.DGamePlayer;
import org.bukkit.scheduler.BukkitRunnable; import org.bukkit.scheduler.BukkitRunnable;
/** /**
@ -27,7 +27,7 @@ public class UpdateTask extends BukkitRunnable {
@Override @Override
public void run() { public void run() {
for (DPlayer dPlayer : DungeonsXL.getInstance().getDPlayers().getDPlayers()) { for (DGamePlayer dPlayer : DungeonsXL.getInstance().getDPlayers().getDGamePlayers()) {
dPlayer.update(false); dPlayer.update(false);
} }
} }

View File

@ -17,7 +17,7 @@
package io.github.dre2n.dungeonsxl.task; package io.github.dre2n.dungeonsxl.task;
import io.github.dre2n.dungeonsxl.DungeonsXL; import io.github.dre2n.dungeonsxl.DungeonsXL;
import io.github.dre2n.dungeonsxl.player.DPlayer; import io.github.dre2n.dungeonsxl.player.DGamePlayer;
import io.github.dre2n.dungeonsxl.world.EditWorld; import io.github.dre2n.dungeonsxl.world.EditWorld;
import io.github.dre2n.dungeonsxl.world.GameWorld; import io.github.dre2n.dungeonsxl.world.GameWorld;
import org.bukkit.scheduler.BukkitRunnable; import org.bukkit.scheduler.BukkitRunnable;
@ -27,13 +27,13 @@ import org.bukkit.scheduler.BukkitRunnable;
*/ */
public class WorldUnloadTask extends BukkitRunnable { public class WorldUnloadTask extends BukkitRunnable {
protected static DungeonsXL plugin = DungeonsXL.getInstance(); DungeonsXL plugin = DungeonsXL.getInstance();
@Override @Override
public void run() { public void run() {
for (GameWorld gameWorld : plugin.getGameWorlds()) { for (GameWorld gameWorld : plugin.getGameWorlds()) {
if (gameWorld.getWorld().getPlayers().isEmpty()) { if (gameWorld.getWorld().getPlayers().isEmpty()) {
if (DPlayer.getByWorld(gameWorld.getWorld()).isEmpty()) { if (DGamePlayer.getByWorld(gameWorld.getWorld()).isEmpty()) {
gameWorld.delete(); gameWorld.delete();
} }
} }

View File

@ -17,6 +17,7 @@
package io.github.dre2n.dungeonsxl.trigger; package io.github.dre2n.dungeonsxl.trigger;
import io.github.dre2n.commons.util.NumberUtil; import io.github.dre2n.commons.util.NumberUtil;
import io.github.dre2n.commons.util.messageutil.MessageUtil;
import io.github.dre2n.dungeonsxl.DungeonsXL; import io.github.dre2n.dungeonsxl.DungeonsXL;
import io.github.dre2n.dungeonsxl.event.trigger.TriggerRegistrationEvent; import io.github.dre2n.dungeonsxl.event.trigger.TriggerRegistrationEvent;
import io.github.dre2n.dungeonsxl.sign.DSign; import io.github.dre2n.dungeonsxl.sign.DSign;
@ -32,10 +33,10 @@ import org.bukkit.entity.Player;
*/ */
public abstract class Trigger { public abstract class Trigger {
protected static DungeonsXL plugin = DungeonsXL.getInstance(); static DungeonsXL plugin = DungeonsXL.getInstance();
private boolean triggered; private boolean triggered;
private Player player; // Holds Player for Player specific Triggers private Player player; // Holds Player for Player specific TriggerTypes
private Set<DSign> dSigns = new HashSet<>(); private Set<DSign> dSigns = new HashSet<>();
@ -180,9 +181,9 @@ public abstract class Trigger {
trigger = (Trigger) method.invoke(value, dSign.getGameWorld()); trigger = (Trigger) method.invoke(value, dSign.getGameWorld());
} catch (NoSuchMethodException | SecurityException | IllegalAccessException | IllegalArgumentException | InvocationTargetException exception) { } catch (NoSuchMethodException | SecurityException | IllegalAccessException | IllegalArgumentException | InvocationTargetException exception) {
plugin.getLogger().info("An error occurred while accessing the handler class of the sign " + type.getIdentifier() + ": " + exception.getClass().getSimpleName()); MessageUtil.log("An error occurred while accessing the handler class of the sign " + type.getIdentifier() + ": " + exception.getClass().getSimpleName());
if (!(type instanceof TriggerTypeDefault)) { if (!(type instanceof TriggerTypeDefault)) {
plugin.getLogger().info("Please note that this trigger is an unsupported feature added by an addon!"); MessageUtil.log("Please note that this trigger is an unsupported feature added by an addon!");
} }
} }

View File

@ -23,21 +23,21 @@ import java.util.List;
/** /**
* @author Daniel Saukel * @author Daniel Saukel
*/ */
public class Triggers { public class TriggerTypes {
private List<TriggerType> triggers = new ArrayList<>(); private List<TriggerType> types = new ArrayList<>();
public Triggers() { public TriggerTypes() {
triggers.addAll(Arrays.asList(TriggerTypeDefault.values())); types.addAll(Arrays.asList(TriggerTypeDefault.values()));
} }
/** /**
* @return the trigger which has the identifier * @return the trigger which has the identifier
*/ */
public TriggerType getByIdentifier(String identifier) { public TriggerType getByIdentifier(String identifier) {
for (TriggerType trigger : triggers) { for (TriggerType type : types) {
if (trigger.getIdentifier().equalsIgnoreCase(identifier)) { if (type.getIdentifier().equalsIgnoreCase(identifier)) {
return trigger; return type;
} }
} }
@ -45,26 +45,26 @@ public class Triggers {
} }
/** /**
* @return the triggers * @return the trigger types
*/ */
public List<TriggerType> getTriggers() { public List<TriggerType> getTriggers() {
return triggers; return types;
} }
/** /**
* @param trigger * @param type
* the triggers to add * the type to add
*/ */
public void addTrigger(TriggerType trigger) { public void addTrigger(TriggerType type) {
triggers.add(trigger); types.add(type);
} }
/** /**
* @param trigger * @param type
* the trigger to remove * the type to remove
*/ */
public void removeTrigger(TriggerType trigger) { public void removeTrigger(TriggerType type) {
triggers.remove(trigger); types.remove(type);
} }
} }

View File

@ -24,7 +24,7 @@ import io.github.dre2n.dungeonsxl.event.editworld.EditWorldGenerateEvent;
import io.github.dre2n.dungeonsxl.event.editworld.EditWorldLoadEvent; import io.github.dre2n.dungeonsxl.event.editworld.EditWorldLoadEvent;
import io.github.dre2n.dungeonsxl.event.editworld.EditWorldSaveEvent; import io.github.dre2n.dungeonsxl.event.editworld.EditWorldSaveEvent;
import io.github.dre2n.dungeonsxl.event.editworld.EditWorldUnloadEvent; import io.github.dre2n.dungeonsxl.event.editworld.EditWorldUnloadEvent;
import io.github.dre2n.dungeonsxl.player.DPlayer; import io.github.dre2n.dungeonsxl.player.DGamePlayer;
import java.io.File; import java.io.File;
import java.io.FileInputStream; import java.io.FileInputStream;
import java.io.FileNotFoundException; import java.io.FileNotFoundException;
@ -47,7 +47,7 @@ import org.bukkit.entity.Player;
*/ */
public class EditWorld { public class EditWorld {
protected static DungeonsXL plugin = DungeonsXL.getInstance(); static DungeonsXL plugin = DungeonsXL.getInstance();
// Variables // Variables
private World world; private World world;
@ -263,7 +263,7 @@ public class EditWorld {
plugin.getEditWorlds().remove(this); plugin.getEditWorlds().remove(this);
for (Player player : world.getPlayers()) { for (Player player : world.getPlayers()) {
DPlayer dPlayer = DPlayer.getByPlayer(player); DGamePlayer dPlayer = DGamePlayer.getByPlayer(player);
dPlayer.leave(); dPlayer.leave();
} }
@ -283,7 +283,7 @@ public class EditWorld {
plugin.getEditWorlds().remove(this); plugin.getEditWorlds().remove(this);
for (Player player : world.getPlayers()) { for (Player player : world.getPlayers()) {
DPlayer dPlayer = DPlayer.getByPlayer(player); DGamePlayer dPlayer = DGamePlayer.getByPlayer(player);
dPlayer.leave(); dPlayer.leave();
} }
@ -295,7 +295,7 @@ public class EditWorld {
} }
public void sendMessage(String message) { public void sendMessage(String message) {
for (DPlayer dPlayer : DPlayer.getByWorld(world)) { for (DGamePlayer dPlayer : DGamePlayer.getByWorld(world)) {
MessageUtil.sendMessage(dPlayer.getPlayer(), message); MessageUtil.sendMessage(dPlayer.getPlayer(), message);
} }
} }
@ -441,7 +441,7 @@ public class EditWorld {
// Kick Player // Kick Player
EditWorld editWorld = EditWorld.getByName(editWorldName); EditWorld editWorld = EditWorld.getByName(editWorldName);
if (editWorld != null) { if (editWorld != null) {
DPlayer player = DPlayer.getByName(name); DGamePlayer player = DGamePlayer.getByName(name);
if (player != null) { if (player != null) {
if (editWorld.world.getPlayers().contains(player.getPlayer())) { if (editWorld.world.getPlayers().contains(player.getPlayer())) {

View File

@ -31,7 +31,7 @@ import io.github.dre2n.dungeonsxl.game.GamePlaceableBlock;
import io.github.dre2n.dungeonsxl.mob.DMob; import io.github.dre2n.dungeonsxl.mob.DMob;
import io.github.dre2n.dungeonsxl.player.DGroup; import io.github.dre2n.dungeonsxl.player.DGroup;
import io.github.dre2n.dungeonsxl.player.DPermissions; import io.github.dre2n.dungeonsxl.player.DPermissions;
import io.github.dre2n.dungeonsxl.player.DPlayer; import io.github.dre2n.dungeonsxl.player.DGamePlayer;
import io.github.dre2n.dungeonsxl.requirement.Requirement; import io.github.dre2n.dungeonsxl.requirement.Requirement;
import io.github.dre2n.dungeonsxl.reward.RewardChest; import io.github.dre2n.dungeonsxl.reward.RewardChest;
import io.github.dre2n.dungeonsxl.sign.DSign; import io.github.dre2n.dungeonsxl.sign.DSign;
@ -64,7 +64,7 @@ import org.bukkit.entity.Spider;
*/ */
public class GameWorld { public class GameWorld {
protected static DungeonsXL plugin = DungeonsXL.getInstance(); static DungeonsXL plugin = DungeonsXL.getInstance();
// Variables // Variables
private boolean tutorial; private boolean tutorial;
@ -427,7 +427,7 @@ public class GameWorld {
} }
public void sendMessage(String message) { public void sendMessage(String message) {
for (DPlayer dPlayer : DPlayer.getByWorld(world)) { for (DGamePlayer dPlayer : DGamePlayer.getByWorld(world)) {
MessageUtil.sendMessage(dPlayer.getPlayer(), message); MessageUtil.sendMessage(dPlayer.getPlayer(), message);
} }
} }

View File

@ -16,7 +16,6 @@
*/ */
package io.github.dre2n.dungeonsxl.global; package io.github.dre2n.dungeonsxl.global;
import io.github.dre2n.dungeonsxl.global.GlobalProtection;
import java.util.Arrays; import java.util.Arrays;
import java.util.Collection; import java.util.Collection;
import org.bukkit.block.Block; import org.bukkit.block.Block;

View File

@ -73,6 +73,6 @@ public class DPlayerListener implements Listener {
@EventHandler @EventHandler
public void onUpdate(DPlayerUpdateEvent event) { public void onUpdate(DPlayerUpdateEvent event) {
MessageUtil.log(plugin, "&b== " + event.getEventName() + "=="); MessageUtil.log(plugin, "&b== " + event.getEventName() + "==");
MessageUtil.log(plugin, "DPlayer: " + event.getDPlayer().getPlayer().getName()); MessageUtil.log(plugin, "DGamePlayer: " + event.getDPlayer().getPlayer().getName());
}*/ }*/
} }