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

View File

@ -30,7 +30,7 @@ import org.bukkit.entity.Player;
*/
public class BreakCommand extends BRCommand {
protected static DungeonsXL plugin = DungeonsXL.getInstance();
DungeonsXL plugin = DungeonsXL.getInstance();
public BreakCommand() {
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.config.DMessages;
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.entity.Player;
@ -30,7 +30,7 @@ import org.bukkit.entity.Player;
*/
public class ChatCommand extends BRCommand {
protected static DungeonsXL plugin = DungeonsXL.getInstance();
DungeonsXL plugin = DungeonsXL.getInstance();
public ChatCommand() {
setCommand("chat");
@ -44,7 +44,7 @@ public class ChatCommand extends BRCommand {
@Override
public void onExecute(String[] args, CommandSender sender) {
Player player = (Player) sender;
DPlayer dPlayer = DPlayer.getByPlayer(player);
DGamePlayer dPlayer = DGamePlayer.getByPlayer(player);
if (dPlayer == null) {
MessageUtil.sendMessage(player, DMessages.ERROR_JOIN_GROUP.getMessage());

View File

@ -30,7 +30,7 @@ import org.bukkit.entity.Player;
*/
public class ChatSpyCommand extends BRCommand {
protected static DungeonsXL plugin = DungeonsXL.getInstance();
DungeonsXL plugin = DungeonsXL.getInstance();
public ChatSpyCommand() {
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.config.DMessages;
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 org.bukkit.command.CommandSender;
import org.bukkit.command.ConsoleCommandSender;
@ -32,7 +32,7 @@ import org.bukkit.entity.Player;
*/
public class CreateCommand extends BRCommand {
protected static DungeonsXL plugin = DungeonsXL.getInstance();
DungeonsXL plugin = DungeonsXL.getInstance();
public CreateCommand() {
setMinArgs(1);
@ -71,7 +71,7 @@ public class CreateCommand extends BRCommand {
} else if (sender instanceof Player) {
Player player = (Player) sender;
if (DPlayer.getByPlayer(player) != null) {
if (DGamePlayer.getByPlayer(player) != null) {
MessageUtil.sendMessage(player, DMessages.ERROR_LEAVE_DUNGEON.getMessage());
return;
}
@ -90,7 +90,7 @@ public class CreateCommand extends BRCommand {
MessageUtil.log(plugin, DMessages.LOG_WORLD_GENERATION_FINISHED.getMessage());
// Tp Player
new DPlayer(player, editWorld.getWorld(), true);
new DGamePlayer(player, editWorld.getWorld(), true);
} else {
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 {
protected static DungeonsXL plugin = DungeonsXL.getInstance();
DungeonsXL plugin = DungeonsXL.getInstance();
public DeletePortalCommand() {
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.player.DGroup;
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 org.bukkit.command.CommandSender;
import org.bukkit.entity.Player;
@ -32,7 +32,7 @@ import org.bukkit.entity.Player;
*/
public class EditCommand extends BRCommand {
protected static DungeonsXL plugin = DungeonsXL.getInstance();
DungeonsXL plugin = DungeonsXL.getInstance();
public EditCommand() {
setCommand("edit");
@ -49,7 +49,7 @@ public class EditCommand extends BRCommand {
String mapName = args[1];
EditWorld editWorld = EditWorld.load(mapName);
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))) {
MessageUtil.sendMessage(player, DMessages.ERROR_NO_PERMISSIONS.getMessage());
@ -71,7 +71,7 @@ public class EditCommand extends BRCommand {
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.player.DGroup;
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.entity.Player;
@ -32,7 +32,7 @@ import org.bukkit.entity.Player;
*/
public class EnterCommand extends BRCommand {
protected static DungeonsXL plugin = DungeonsXL.getInstance();
DungeonsXL plugin = DungeonsXL.getInstance();
public EnterCommand() {
setMinArgs(1);
@ -81,7 +81,7 @@ public class EnterCommand extends BRCommand {
joining.sendMessage(DMessages.CMD_ENTER_SUCCESS.getMessage(joining.getName(), targetName));
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.player.DGroup;
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 org.bukkit.command.CommandSender;
import org.bukkit.entity.Player;
@ -32,7 +32,7 @@ import org.bukkit.entity.Player;
*/
public class EscapeCommand extends BRCommand {
protected static DungeonsXL plugin = DungeonsXL.getInstance();
DungeonsXL plugin = DungeonsXL.getInstance();
public EscapeCommand() {
setCommand("escape");
@ -46,7 +46,7 @@ public class EscapeCommand extends BRCommand {
@Override
public void onExecute(String[] args, CommandSender sender) {
Player player = (Player) sender;
DPlayer dPlayer = DPlayer.getByPlayer(player);
DGamePlayer dPlayer = DGamePlayer.getByPlayer(player);
if (dPlayer != null) {
if (!dPlayer.isEditing()) {

View File

@ -32,7 +32,7 @@ import org.bukkit.entity.Player;
*/
public class GameCommand extends BRCommand {
protected static DungeonsXL plugin = DungeonsXL.getInstance();
DungeonsXL plugin = DungeonsXL.getInstance();
public GameCommand() {
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.player.DGroup;
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.entity.Player;
@ -34,7 +34,7 @@ import org.bukkit.entity.Player;
*/
public class GroupCommand extends BRCommand {
protected static DungeonsXL plugin = DungeonsXL.getInstance();
DungeonsXL plugin = DungeonsXL.getInstance();
public GroupCommand() {
setCommand("group");
@ -206,7 +206,7 @@ public class GroupCommand extends BRCommand {
Player toKick = plugin.getServer().getPlayer(args[2]);
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 (dGroup.getPlayers().contains(toKick)) {

View File

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

View File

@ -30,7 +30,7 @@ import org.bukkit.command.CommandSender;
*/
public class InviteCommand extends BRCommand {
protected static DungeonsXL plugin = DungeonsXL.getInstance();
DungeonsXL plugin = DungeonsXL.getInstance();
public InviteCommand() {
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.player.DGroup;
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 org.bukkit.command.CommandSender;
import org.bukkit.entity.Player;
@ -34,7 +34,7 @@ import org.bukkit.entity.Player;
*/
public class LeaveCommand extends BRCommand {
protected static DungeonsXL plugin = DungeonsXL.getInstance();
DungeonsXL plugin = DungeonsXL.getInstance();
public LeaveCommand() {
setCommand("leave");
@ -48,7 +48,7 @@ public class LeaveCommand extends BRCommand {
@Override
public void onExecute(String[] args, CommandSender 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()).isTutorial()) {

View File

@ -36,7 +36,7 @@ import org.bukkit.entity.Player;
*/
public class ListCommand extends BRCommand {
protected static DungeonsXL plugin = DungeonsXL.getInstance();
DungeonsXL plugin = DungeonsXL.getInstance();
public ListCommand() {
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.config.DMessages;
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.command.CommandSender;
import org.bukkit.entity.Player;
@ -31,7 +31,7 @@ import org.bukkit.entity.Player;
*/
public class LivesCommand extends BRCommand {
protected static DungeonsXL plugin = DungeonsXL.getInstance();
DungeonsXL plugin = DungeonsXL.getInstance();
public LivesCommand() {
setCommand("lives");
@ -60,7 +60,7 @@ public class LivesCommand extends BRCommand {
return;
}
DPlayer dPlayer = DPlayer.getByPlayer(player);
DGamePlayer dPlayer = DGamePlayer.getByPlayer(player);
if (dPlayer != null) {
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 {
protected static DungeonsXL plugin = DungeonsXL.getInstance();
DungeonsXL plugin = DungeonsXL.getInstance();
public MainCommand() {
setCommand("main");
@ -51,7 +51,7 @@ public class MainCommand extends BRCommand {
int maps = new File(plugin.getDataFolder() + "/maps").listFiles().length;
int dungeons = new File(plugin.getDataFolder() + "/dungeons").listFiles().length;
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();
String vault = "";
if (plugins.getPlugin("Vault") != null) {

View File

@ -34,7 +34,7 @@ import org.bukkit.entity.Player;
*/
public class MsgCommand extends BRCommand {
protected static DungeonsXL plugin = DungeonsXL.getInstance();
DungeonsXL plugin = DungeonsXL.getInstance();
public MsgCommand() {
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.player.DGroup;
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.GameWorld;
import java.io.File;
@ -38,7 +38,7 @@ import org.bukkit.entity.Player;
*/
public class PlayCommand extends BRCommand {
protected static DungeonsXL plugin = DungeonsXL.getInstance();
DungeonsXL plugin = DungeonsXL.getInstance();
public PlayCommand() {
setCommand("play");
@ -52,7 +52,7 @@ public class PlayCommand extends BRCommand {
@Override
public void onExecute(String[] args, CommandSender sender) {
Player player = (Player) sender;
DPlayer dPlayer = DPlayer.getByPlayer(player);
DGamePlayer dPlayer = DGamePlayer.getByPlayer(player);
if (dPlayer != null) {
MessageUtil.sendMessage(player, DMessages.ERROR_LEAVE_DUNGEON.getMessage());
@ -165,12 +165,12 @@ public class PlayCommand extends BRCommand {
if (dGroup.getGameWorld().getLocLobby() == null) {
for (Player groupPlayer : dGroup.getPlayers()) {
new DPlayer(groupPlayer, dGroup.getGameWorld());
new DGamePlayer(groupPlayer, dGroup.getGameWorld());
}
} else {
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.player.DGlobalPlayer;
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.command.CommandSender;
import org.bukkit.entity.Player;
@ -34,7 +34,7 @@ import org.bukkit.inventory.ItemStack;
*/
public class PortalCommand extends BRCommand {
protected static DungeonsXL plugin = DungeonsXL.getInstance();
DungeonsXL plugin = DungeonsXL.getInstance();
public PortalCommand() {
setCommand("portal");
@ -50,7 +50,7 @@ public class PortalCommand extends BRCommand {
Player player = (Player) sender;
DGlobalPlayer dGlobalPlayer = plugin.getDPlayers().getByPlayer(player);
if (dGlobalPlayer instanceof DPlayer) {
if (dGlobalPlayer instanceof DGamePlayer) {
MessageUtil.sendMessage(player, DMessages.ERROR_LEAVE_DUNGEON.getMessage());
return;
}

View File

@ -33,7 +33,7 @@ import org.bukkit.plugin.PluginManager;
*/
public class ReloadCommand extends BRCommand {
protected static DungeonsXL plugin = DungeonsXL.getInstance();
DungeonsXL plugin = DungeonsXL.getInstance();
public ReloadCommand() {
setCommand("reload");
@ -52,7 +52,7 @@ public class ReloadCommand extends BRCommand {
int maps = new File(plugin.getDataFolder() + "/maps").listFiles().length;
int dungeons = new File(plugin.getDataFolder() + "/dungeons").listFiles().length;
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();
String vault = "";
if (plugins.getPlugin("Vault") != null) {

View File

@ -30,7 +30,7 @@ import org.bukkit.entity.Player;
*/
public class SaveCommand extends BRCommand {
protected static DungeonsXL plugin = DungeonsXL.getInstance();
DungeonsXL plugin = DungeonsXL.getInstance();
public SaveCommand() {
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.player.DGroup;
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 org.bukkit.command.CommandSender;
import org.bukkit.entity.Player;
@ -34,7 +34,7 @@ import org.bukkit.entity.Player;
*/
public class TestCommand extends BRCommand {
protected static DungeonsXL plugin = DungeonsXL.getInstance();
DungeonsXL plugin = DungeonsXL.getInstance();
public TestCommand() {
setCommand("test");
@ -73,7 +73,7 @@ public class TestCommand extends BRCommand {
}
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 {
protected static DungeonsXL plugin = DungeonsXL.getInstance();
DungeonsXL plugin = DungeonsXL.getInstance();
public UninviteCommand() {
setCommand("uninvite");

View File

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

View File

@ -16,7 +16,7 @@
*/
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.HandlerList;
import org.bukkit.event.entity.PlayerDeathEvent;
@ -32,7 +32,7 @@ public class DPlayerDeathEvent extends DPlayerEvent implements Cancellable {
private PlayerDeathEvent bukkitEvent;
private int lostLives;
public DPlayerDeathEvent(DPlayer dPlayer, PlayerDeathEvent bukkitEvent, int lostLives) {
public DPlayerDeathEvent(DGamePlayer dPlayer, PlayerDeathEvent bukkitEvent, int lostLives) {
super(dPlayer);
this.bukkitEvent = bukkitEvent;
this.lostLives = lostLives;

View File

@ -16,7 +16,7 @@
*/
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.HandlerList;
@ -28,7 +28,7 @@ public class DPlayerEscapeEvent extends DPlayerEvent implements Cancellable {
private static final HandlerList handlers = new HandlerList();
private boolean cancelled;
public DPlayerEscapeEvent(DPlayer dPlayer) {
public DPlayerEscapeEvent(DGamePlayer dPlayer) {
super(dPlayer);
}

View File

@ -16,7 +16,7 @@
*/
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;
/**
@ -24,16 +24,16 @@ import org.bukkit.event.Event;
*/
public abstract class DPlayerEvent extends Event {
protected DPlayer dPlayer;
protected DGamePlayer dPlayer;
public DPlayerEvent(DPlayer dPlayer) {
public DPlayerEvent(DGamePlayer dPlayer) {
this.dPlayer = dPlayer;
}
/**
* @return the dPlayer
*/
public DPlayer getDPlayer() {
public DGamePlayer getDPlayer() {
return dPlayer;
}
@ -41,7 +41,7 @@ public abstract class DPlayerEvent extends Event {
* @param dPlayer
* the dPlayer to set
*/
public void setDPlayer(DPlayer dPlayer) {
public void setDPlayer(DGamePlayer dPlayer) {
this.dPlayer = dPlayer;
}

View File

@ -16,7 +16,7 @@
*/
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.HandlerList;
@ -31,7 +31,7 @@ public class DPlayerFinishEvent extends DPlayerEvent implements Cancellable {
private boolean first;
private boolean hasToWait;
public DPlayerFinishEvent(DPlayer dPlayer, boolean first, boolean hasToWait) {
public DPlayerFinishEvent(DGamePlayer dPlayer, boolean first, boolean hasToWait) {
super(dPlayer);
this.first = first;
this.hasToWait = hasToWait;

View File

@ -17,7 +17,7 @@
package io.github.dre2n.dungeonsxl.event.dplayer;
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.HandlerList;
@ -32,7 +32,7 @@ public class DPlayerJoinDGroupEvent extends DPlayerEvent implements Cancellable
private boolean creator;
private DGroup dGroup;
public DPlayerJoinDGroupEvent(DPlayer dPlayer, boolean creator, DGroup dGroup) {
public DPlayerJoinDGroupEvent(DGamePlayer dPlayer, boolean creator, DGroup dGroup) {
super(dPlayer);
this.creator = creator;
this.dGroup = dGroup;

View File

@ -16,7 +16,7 @@
*/
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.HandlerList;
@ -40,7 +40,7 @@ public class DPlayerKickEvent extends DPlayerEvent implements Cancellable {
private Cause cause;
public DPlayerKickEvent(DPlayer dPlayer, Cause cause) {
public DPlayerKickEvent(DGamePlayer dPlayer, Cause cause) {
super(dPlayer);
this.cause = cause;
}

View File

@ -17,7 +17,7 @@
package io.github.dre2n.dungeonsxl.event.dplayer;
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.HandlerList;
@ -31,7 +31,7 @@ public class DPlayerLeaveDGroupEvent extends DPlayerEvent implements Cancellable
private DGroup dGroup;
public DPlayerLeaveDGroupEvent(DPlayer dPlayer, DGroup dGroup) {
public DPlayerLeaveDGroupEvent(DGamePlayer dPlayer, DGroup dGroup) {
super(dPlayer);
this.dGroup = dGroup;
}

View File

@ -16,7 +16,7 @@
*/
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.HandlerList;
@ -35,7 +35,7 @@ public class DPlayerUpdateEvent extends DPlayerEvent implements Cancellable {
private boolean kick;
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);
this.locationValid = locationValid;
this.teleportWolf = teleportWolf;

View File

@ -41,7 +41,7 @@ import org.bukkit.scheduler.BukkitRunnable;
*/
public class Game {
protected static DungeonsXL plugin = DungeonsXL.getInstance();
static DungeonsXL plugin = DungeonsXL.getInstance();
private List<DGroup> dGroups = new ArrayList<>();
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.messageutil.MessageUtil;
import io.github.dre2n.dungeonsxl.DungeonsXL;
import io.github.dre2n.dungeonsxl.config.DMessages;
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.DPlayer;
import io.github.dre2n.dungeonsxl.world.GameWorld;
import java.util.HashSet;
import java.util.Set;
@ -38,9 +37,6 @@ import org.bukkit.entity.Player;
*/
public class DPortal extends GlobalProtection {
protected static DungeonsXL plugin = DungeonsXL.getInstance();
protected static GlobalProtections protections = plugin.getGlobalProtections();
private Block block1;
private Block block2;
private boolean active;
@ -205,7 +201,7 @@ public class DPortal extends GlobalProtection {
dGroup.setGameWorld(target);
new DPlayer(player, target);
new DGamePlayer(player, target);
}
@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.messageutil.MessageUtil;
import io.github.dre2n.dungeonsxl.DungeonsXL;
import io.github.dre2n.dungeonsxl.config.DMessages;
import io.github.dre2n.dungeonsxl.config.WorldConfig;
import io.github.dre2n.dungeonsxl.dungeon.Dungeon;
@ -42,9 +41,6 @@ import org.bukkit.entity.Player;
*/
public class GameSign extends GlobalProtection {
protected static DungeonsXL plugin = DungeonsXL.getInstance();
protected static GlobalProtections protections = plugin.getGlobalProtections();
// Sign Labels
public static final String IS_PLAYING = ChatColor.DARK_RED + "Is Playing";
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 {
protected static DungeonsXL plugin = DungeonsXL.getInstance();
protected static FileConfiguration config = plugin.getDataConfig().getConfig();
protected static GlobalProtections protections = plugin.getGlobalProtections();
static DungeonsXL plugin = DungeonsXL.getInstance();
static FileConfiguration config = plugin.getDataConfig().getConfig();
static GlobalProtections protections = plugin.getGlobalProtections();
private World world;
private int id;

View File

@ -21,7 +21,7 @@ import org.bukkit.configuration.file.YamlConfiguration;
*/
public class GlobalProtections {
protected static DungeonsXL plugin = DungeonsXL.getInstance();
DungeonsXL plugin = DungeonsXL.getInstance();
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.messageutil.MessageUtil;
import io.github.dre2n.dungeonsxl.DungeonsXL;
import io.github.dre2n.dungeonsxl.config.DMessages;
import io.github.dre2n.dungeonsxl.config.WorldConfig;
import io.github.dre2n.dungeonsxl.dungeon.Dungeon;
@ -41,9 +40,6 @@ import org.bukkit.entity.Player;
*/
public class GroupSign extends GlobalProtection {
protected static DungeonsXL plugin = DungeonsXL.getInstance();
protected static GlobalProtections protections = plugin.getGlobalProtections();
// Sign Labels
public static final String IS_PLAYING = ChatColor.DARK_RED + "Is Playing";
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.messageutil.MessageUtil;
import io.github.dre2n.dungeonsxl.DungeonsXL;
import io.github.dre2n.dungeonsxl.config.DMessages;
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.Set;
import org.bukkit.ChatColor;
@ -35,8 +34,6 @@ import org.bukkit.entity.Player;
*/
public class LeaveSign extends GlobalProtection {
protected static DungeonsXL plugin = DungeonsXL.getInstance();
private Sign sign;
private Set<Block> blocks;
@ -102,7 +99,7 @@ public class LeaveSign extends GlobalProtection {
return false;
}
DPlayer dplayer = DPlayer.getByPlayer(player);
DGamePlayer dplayer = DGamePlayer.getByPlayer(player);
if (dplayer != null) {
dplayer.leave();

View File

@ -55,8 +55,8 @@ import org.bukkit.event.block.SignChangeEvent;
*/
public class BlockListener implements Listener {
protected static DungeonsXL plugin = DungeonsXL.getInstance();
protected static DPlayers dPlayers = plugin.getDPlayers();
DungeonsXL plugin = DungeonsXL.getInstance();
DPlayers dPlayers = plugin.getDPlayers();
@EventHandler(priority = EventPriority.HIGH)
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.mob.DMob;
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.GameWorld;
import java.util.List;
@ -201,7 +201,7 @@ public class EntityListener implements Listener {
// Check Dogs
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 (attackerEntity == dPlayer.getWolf() || attackedEntity == dPlayer.getWolf()) {
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 (attackerEntity instanceof Player || attackedEntity instanceof Player) {
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.DGroup;
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.DSavePlayer;
import io.github.dre2n.dungeonsxl.reward.DLootInventory;
@ -76,14 +76,13 @@ import org.bukkit.inventory.meta.BookMeta;
*/
public class PlayerListener implements Listener {
protected static DungeonsXL plugin = DungeonsXL.getInstance();
protected static DPlayers dPlayers = plugin.getDPlayers();
DungeonsXL plugin = DungeonsXL.getInstance();
DPlayers dPlayers = plugin.getDPlayers();
@EventHandler(priority = EventPriority.HIGH)
public void onDeath(PlayerDeathEvent event) {
Player player = event.getEntity();
DPlayer dPlayer = DPlayer.getByPlayer(player);
DGamePlayer dPlayer = DGamePlayer.getByPlayer(player);
GameWorld gameWorld = GameWorld.getByWorld(player.getLocation().getWorld());
if (gameWorld == null) {
@ -215,7 +214,7 @@ public class PlayerListener implements Listener {
if (EditWorld.getByWorld(player.getWorld()) != null) {
if (event.getAction() == Action.RIGHT_CLICK_BLOCK) {
if (item.getType() == Material.STICK) {
DPlayer dPlayer = DPlayer.getByPlayer(player);
DGamePlayer dPlayer = DGamePlayer.getByPlayer(player);
if (dPlayer != null) {
dPlayer.poke(clickedBlock);
event.setCancelled(true);
@ -274,7 +273,7 @@ public class PlayerListener implements Listener {
event.setCancelled(true);
}
DPlayer dPlayer = DPlayer.getByPlayer(player);
DGamePlayer dPlayer = DGamePlayer.getByPlayer(player);
if (dPlayer != null) {
// Check GameWorld Signs
@ -314,7 +313,7 @@ public class PlayerListener implements Listener {
public void onDropItem(PlayerDropItemEvent event) {
Player player = event.getPlayer();
DPlayer dPlayer = DPlayer.getByPlayer(player);
DGamePlayer dPlayer = DGamePlayer.getByPlayer(player);
if (dPlayer == null) {
return;
}
@ -354,7 +353,7 @@ public class PlayerListener implements Listener {
Player player = event.getPlayer();
plugin.getDPlayers().getByPlayer(player).applyRespawnInventory();
DPlayer dPlayer = DPlayer.getByPlayer(player);
DGamePlayer dPlayer = DGamePlayer.getByPlayer(player);
if (dPlayer == null) {
return;
}
@ -415,7 +414,7 @@ public class PlayerListener implements Listener {
@EventHandler(priority = EventPriority.HIGH)
public void onTeleport(PlayerTeleportEvent event) {
Player player = event.getPlayer();
DPlayer dPlayer = DPlayer.getByPlayer(player);
DGamePlayer dPlayer = DGamePlayer.getByPlayer(player);
if (dPlayer == null) {
return;
@ -433,7 +432,7 @@ public class PlayerListener implements Listener {
@EventHandler(priority = EventPriority.HIGH)
public void onChat(AsyncPlayerChatEvent event) {
Player player = event.getPlayer();
DPlayer dPlayer = DPlayer.getByPlayer(player);
DGamePlayer dPlayer = DGamePlayer.getByPlayer(player);
if (dPlayer == null) {
return;
}
@ -447,7 +446,7 @@ public class PlayerListener implements Listener {
@EventHandler(priority = EventPriority.HIGH)
public void onQuit(PlayerQuitEvent event) {
Player player = event.getPlayer();
DPlayer dPlayer = DPlayer.getByPlayer(player);
DGamePlayer dPlayer = DGamePlayer.getByPlayer(player);
if (dPlayer == null) {
dPlayers.removePlayer(dPlayer);
@ -484,7 +483,7 @@ public class PlayerListener implements Listener {
new DGlobalPlayer(player);
// Check dPlayers
DPlayer dPlayer = DPlayer.getByName(player.getName());
DGamePlayer dPlayer = DGamePlayer.getByName(player.getName());
if (dPlayer != null) {
DGroup dGroup = DGroup.getByPlayer(dPlayer.getPlayer());
if (dGroup != null) {
@ -514,7 +513,7 @@ public class PlayerListener implements Listener {
return;
}
if (DPlayer.getByPlayer(player) != null) {
if (DGamePlayer.getByPlayer(player) != null) {
return;
}
@ -553,7 +552,7 @@ public class PlayerListener implements Listener {
continue;
}
new DPlayer(player, dGroup.getGameWorld());
new DGamePlayer(player, dGroup.getGameWorld());
}
}
@ -564,7 +563,7 @@ public class PlayerListener implements Listener {
return;
}
DPlayer dPlayer = DPlayer.getByPlayer(event.getPlayer());
DGamePlayer dPlayer = DGamePlayer.getByPlayer(event.getPlayer());
if (dPlayer == null) {
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.NumberUtil;
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.world.GameWorld;
@ -43,7 +44,7 @@ import org.bukkit.inventory.meta.ItemMeta;
*/
public class DMobType {
protected static DungeonsXL plugin = DungeonsXL.getInstance();
static DungeonsXL plugin = DungeonsXL.getInstance();
private String name;
private EntityType type;
@ -128,7 +129,7 @@ public class DMobType {
EntityType type = EntityType.fromName(configFile.getString(mobName + ".Type"));
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;
}
@ -210,7 +211,7 @@ public class DMobType {
itemMeta.addEnchant(Enchantment.getByName(splittedEnchantment[0].toUpperCase()), 1, true);
}
} 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
*/
public class DPlayer extends DGlobalPlayer {
public class DGamePlayer extends DGlobalPlayer {
// Variables
private World world;
@ -88,12 +88,12 @@ public class DPlayer extends DGlobalPlayer {
private int initialLives = -1;
private int lives;
public DPlayer(Player player, GameWorld gameWorld) {
public DGamePlayer(Player player, GameWorld gameWorld) {
this(player, gameWorld.getWorld(), false);
}
@Deprecated
public DPlayer(Player player, World world, boolean editing) {
public DGamePlayer(Player player, World world, boolean editing) {
super(player);
this.world = world;
@ -659,7 +659,7 @@ public class DPlayer extends DGlobalPlayer {
}
for (Player player : dGroup.getPlayers()) {
DPlayer dPlayer = getByPlayer(player);
DGamePlayer dPlayer = getByPlayer(player);
if (!dPlayer.finished) {
MessageUtil.sendMessage(this.getPlayer(), DMessages.PLAYER_WAIT_FOR_OTHER_PLAYERS.getMessage());
return;
@ -673,7 +673,7 @@ public class DPlayer extends DGlobalPlayer {
}
for (Player player : dGroup.getPlayers()) {
DPlayer dPlayer = getByPlayer(player);
DGamePlayer dPlayer = getByPlayer(player);
if (invalid) {
dPlayer.finish(false);
@ -710,7 +710,7 @@ public class DPlayer extends DGlobalPlayer {
GameWorld gameWorld = GameWorld.load(newFloor);
dGroup.setGameWorld(gameWorld);
for (Player player : dGroup.getPlayers()) {
DPlayer dPlayer = getByPlayer(player);
DGamePlayer dPlayer = getByPlayer(player);
dPlayer.setWorld(gameWorld.getWorld());
dPlayer.setCheckpoint(dGroup.getGameWorld().getLocStart());
if (dPlayer.getWolf() != null) {
@ -743,7 +743,7 @@ public class DPlayer extends DGlobalPlayer {
boolean hasToWait = false;
for (Player player : dGroup.getPlayers()) {
DPlayer dPlayer = getByPlayer(player);
DGamePlayer dPlayer = getByPlayer(player);
if (!dPlayer.finished) {
if (message) {
MessageUtil.sendMessage(this.getPlayer(), DMessages.PLAYER_WAIT_FOR_OTHER_PLAYERS.getMessage());
@ -775,7 +775,7 @@ public class DPlayer extends DGlobalPlayer {
Game.getByDGroup(dGroup).resetWaveKills();
for (Player player : dGroup.getPlayers()) {
DPlayer dPlayer = getByPlayer(player);
DGamePlayer dPlayer = getByPlayer(player);
dPlayer.leave();
for (Reward reward : dGroup.getRewards()) {
@ -788,7 +788,7 @@ public class DPlayer extends DGlobalPlayer {
if (editing) {
EditWorld editWorld = EditWorld.getByWorld(world);
editWorld.sendMessage(message);
for (DGlobalPlayer player : plugin.getDPlayers().getPlayers()) {
for (DGlobalPlayer player : plugin.getDPlayers().getDGlobalPlayers()) {
if (player.isInChatSpyMode()) {
if (!editWorld.getWorld().getPlayers().contains(player.getPlayer())) {
MessageUtil.sendMessage(player.getPlayer(), ChatColor.GREEN + "[Chatspy] " + ChatColor.WHITE + message);
@ -799,7 +799,7 @@ public class DPlayer extends DGlobalPlayer {
} else {
GameWorld gameWorld = GameWorld.getByWorld(world);
gameWorld.sendMessage(message);
for (DGlobalPlayer player : plugin.getDPlayers().getPlayers()) {
for (DGlobalPlayer player : plugin.getDPlayers().getDGlobalPlayers()) {
if (player.isInChatSpyMode()) {
if (!gameWorld.getWorld().getPlayers().contains(player.getPlayer())) {
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() {
if (player.isOnline()) {
@ -972,8 +972,8 @@ public class DPlayer extends DGlobalPlayer {
}
/* Statics */
public static DPlayer getByPlayer(Player player) {
for (DPlayer dPlayer : plugin.getDPlayers().getDPlayers()) {
public static DGamePlayer getByPlayer(Player player) {
for (DGamePlayer dPlayer : plugin.getDPlayers().getDGamePlayers()) {
if (dPlayer.getPlayer().equals(player)) {
return dPlayer;
}
@ -981,8 +981,8 @@ public class DPlayer extends DGlobalPlayer {
return null;
}
public static DPlayer getByName(String name) {
for (DPlayer dPlayer : plugin.getDPlayers().getDPlayers()) {
public static DGamePlayer getByName(String name) {
for (DGamePlayer dPlayer : plugin.getDPlayers().getDGamePlayers()) {
if (dPlayer.getPlayer().getName().equalsIgnoreCase(name)) {
return dPlayer;
}
@ -990,10 +990,10 @@ public class DPlayer extends DGlobalPlayer {
return null;
}
public static CopyOnWriteArrayList<DPlayer> getByWorld(World world) {
CopyOnWriteArrayList<DPlayer> dPlayers = new CopyOnWriteArrayList<>();
public static CopyOnWriteArrayList<DGamePlayer> getByWorld(World world) {
CopyOnWriteArrayList<DGamePlayer> dPlayers = new CopyOnWriteArrayList<>();
for (DPlayer dPlayer : plugin.getDPlayers().getDPlayers()) {
for (DGamePlayer dPlayer : plugin.getDPlayers().getDGamePlayers()) {
if (dPlayer.world == world) {
dPlayers.add(dPlayer);
}

View File

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

View File

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

View File

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

View File

@ -45,8 +45,8 @@ import org.bukkit.potion.PotionEffect;
*/
public class DSavePlayer {
protected static DungeonsXL plugin = DungeonsXL.getInstance();
protected static DPlayers dPlayers = plugin.getDPlayers();
static DungeonsXL plugin = DungeonsXL.getInstance();
static DPlayers dPlayers = plugin.getDPlayers();
// Variables
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.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 org.bukkit.entity.Player;
@ -53,7 +53,7 @@ public class FeeLevelRequirement extends Requirement {
@Override
public void demand(Player player) {
DPlayer dPlayer = DPlayer.getByPlayer(player);
DGamePlayer dPlayer = DGamePlayer.getByPlayer(player);
if (dPlayer == null) {
return;
}

View File

@ -16,6 +16,7 @@
*/
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.event.requirement.RequirementRegistrationEvent;
import java.lang.reflect.Constructor;
@ -27,7 +28,7 @@ import org.bukkit.entity.Player;
*/
public abstract class Requirement {
protected static DungeonsXL plugin = DungeonsXL.getInstance();
DungeonsXL plugin = DungeonsXL.getInstance();
public static Requirement create(RequirementType type) {
Requirement requirement = null;
@ -37,9 +38,9 @@ public abstract class Requirement {
requirement = constructor.newInstance();
} 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)) {
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 {
protected static DungeonsXL plugin = DungeonsXL.getInstance();
static DungeonsXL plugin = DungeonsXL.getInstance();
private Inventory inventory;
private InventoryView inventoryView;

View File

@ -16,6 +16,7 @@
*/
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.event.reward.RewardRegistrationEvent;
import java.lang.reflect.Constructor;
@ -27,7 +28,7 @@ import org.bukkit.entity.Player;
*/
public abstract class Reward {
protected static DungeonsXL plugin = DungeonsXL.getInstance();
DungeonsXL plugin = DungeonsXL.getInstance();
public static Reward create(RewardType type) {
Reward reward = null;
@ -37,9 +38,9 @@ public abstract class Reward {
reward = constructor.newInstance();
} 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)) {
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.config.DMessages;
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 net.milkbowl.vault.item.ItemInfo;
import net.milkbowl.vault.item.Items;
@ -38,7 +38,7 @@ import org.bukkit.inventory.ItemStack;
*/
public class RewardChest {
protected static DungeonsXL plugin = DungeonsXL.getInstance();
static DungeonsXL plugin = DungeonsXL.getInstance();
// Variables
private boolean used = false;
@ -166,7 +166,7 @@ public class RewardChest {
}
for (Player player : dGroup.getPlayers()) {
DPlayer dPlayer = DPlayer.getByPlayer(player);
DGamePlayer dPlayer = DGamePlayer.getByPlayer(player);
if (dPlayer == null) {
continue;
}
@ -245,7 +245,7 @@ public class RewardChest {
}
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);
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.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 java.util.concurrent.CopyOnWriteArrayList;
import org.bukkit.Material;
@ -34,7 +34,7 @@ public class CheckpointSign extends DSign {
// Variables
private boolean initialized;
private CopyOnWriteArrayList<DPlayer> done = new CopyOnWriteArrayList<>();
private CopyOnWriteArrayList<DGamePlayer> done = new CopyOnWriteArrayList<>();
public CheckpointSign(Sign sign, GameWorld gameWorld) {
super(sign, gameWorld);
@ -58,7 +58,7 @@ public class CheckpointSign extends DSign {
return;
}
for (DPlayer dplayer : DPlayer.getByWorld(getGameWorld().getWorld())) {
for (DGamePlayer dplayer : DGamePlayer.getByWorld(getGameWorld().getWorld())) {
dplayer.setCheckpoint(getSign().getLocation());
MessageUtil.sendMessage(dplayer.getPlayer(), plugin.getMessageConfig().getMessage(DMessages.PLAYER_CHECKPOINT_REACHED));
}
@ -72,7 +72,7 @@ public class CheckpointSign extends DSign {
return true;
}
DPlayer dplayer = DPlayer.getByPlayer(player);
DGamePlayer dplayer = DGamePlayer.getByPlayer(player);
if (dplayer != null) {
if (!done.contains(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();
}

View File

@ -16,6 +16,7 @@
*/
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.event.dsign.DSignRegistrationEvent;
import io.github.dre2n.dungeonsxl.game.Game;
@ -33,7 +34,7 @@ import org.bukkit.entity.Player;
*/
public abstract class DSign {
protected static DungeonsXL plugin = DungeonsXL.getInstance();
static DungeonsXL plugin = DungeonsXL.getInstance();
private Sign sign;
private GameWorld gameWorld;
@ -181,9 +182,9 @@ public abstract class DSign {
dSign = constructor.newInstance(sign, gameWorld);
} 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)) {
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
*/
public class DSigns {
public class DSignTypes {
private List<DSignType> dSigns = new ArrayList<>();
private List<DSignType> types = new ArrayList<>();
public DSigns() {
dSigns.addAll(Arrays.asList(DSignTypeDefault.values()));
public DSignTypes() {
types.addAll(Arrays.asList(DSignTypeDefault.values()));
}
/**
* @return the dSigns
* @return the DSign types
*/
public List<DSignType> getDSigns() {
return dSigns;
return types;
}
/**
* @param dSign
* the dSigns to add
* @param type
* the type to add
*/
public void addDSign(DSignType dSign) {
dSigns.add(dSign);
public void addDSign(DSignType type) {
types.add(type);
}
/**
* @param dSign
* the dSigns to remove
* @param type
* the type to remove
*/
public void removeDSign(DSignType dSign) {
dSigns.remove(dSign);
public void removeDSign(DSignType type) {
types.remove(type);
}
}

View File

@ -16,7 +16,7 @@
*/
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.world.GameWorld;
import org.bukkit.ChatColor;
@ -62,7 +62,7 @@ public class EndSign extends DSign {
@Override
public boolean onPlayerTrigger(Player player) {
DPlayer dPlayer = DPlayer.getByPlayer(player);
DGamePlayer dPlayer = DGamePlayer.getByPlayer(player);
if (dPlayer == null) {
return true;
}
@ -77,7 +77,7 @@ public class EndSign extends DSign {
@Override
public void onTrigger() {
for (DPlayer dPlayer : plugin.getDPlayers().getDPlayers()) {
for (DGamePlayer dPlayer : plugin.getDPlayers().getDGamePlayers()) {
dPlayer.finish();
}
}

View File

@ -16,7 +16,7 @@
*/
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.world.GameWorld;
import org.bukkit.ChatColor;
@ -73,7 +73,7 @@ public class FloorSign extends DSign {
@Override
public boolean onPlayerTrigger(Player player) {
DPlayer dPlayer = DPlayer.getByPlayer(player);
DGamePlayer dPlayer = DGamePlayer.getByPlayer(player);
if (dPlayer == null) {
return true;
}
@ -88,7 +88,7 @@ public class FloorSign extends DSign {
@Override
public void onTrigger() {
for (DPlayer dPlayer : plugin.getDPlayers().getDPlayers()) {
for (DGamePlayer dPlayer : plugin.getDPlayers().getDGamePlayers()) {
dPlayer.finishFloor(floor);
}
}

View File

@ -17,7 +17,7 @@
package io.github.dre2n.dungeonsxl.sign;
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.world.GameWorld;
import org.bukkit.ChatColor;
@ -62,7 +62,7 @@ public class LeaveSign extends DSign {
@Override
public boolean onPlayerTrigger(Player player) {
DPlayer dPlayer = DPlayer.getByPlayer(player);
DGamePlayer dPlayer = DGamePlayer.getByPlayer(player);
if (dPlayer != null) {
DPlayerEscapeEvent event = new DPlayerEscapeEvent(dPlayer);
@ -78,7 +78,7 @@ public class LeaveSign extends DSign {
@Override
public void onTrigger() {
for (DPlayer dPlayer : plugin.getDPlayers().getDPlayers()) {
for (DGamePlayer dPlayer : plugin.getDPlayers().getDGamePlayers()) {
DPlayerEscapeEvent event = new DPlayerEscapeEvent(dPlayer);
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.GameTypeDefault;
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.world.GameWorld;
import org.bukkit.ChatColor;
@ -92,7 +92,7 @@ public class ReadySign extends DSign {
@Override
public boolean onPlayerTrigger(Player player) {
ready(DPlayer.getByPlayer(player));
ready(DGamePlayer.getByPlayer(player));
return true;
}
@ -100,12 +100,12 @@ public class ReadySign extends DSign {
public void onTrigger() {
for (DGroup dGroup : Game.getByGameWorld(getGameWorld()).getDGroups()) {
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) {
return;
}

View File

@ -17,7 +17,7 @@
package io.github.dre2n.dungeonsxl.task;
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 org.bukkit.scheduler.BukkitRunnable;
@ -26,7 +26,7 @@ import org.bukkit.scheduler.BukkitRunnable;
*/
public class LazyUpdateTask extends BukkitRunnable {
protected static DungeonsXL plugin = DungeonsXL.getInstance();
DungeonsXL plugin = DungeonsXL.getInstance();
@Override
public void run() {
@ -34,7 +34,7 @@ public class LazyUpdateTask extends BukkitRunnable {
gameWorld.update();
}
for (DPlayer dPlayer : plugin.getDPlayers().getDPlayers()) {
for (DGamePlayer dPlayer : plugin.getDPlayers().getDGamePlayers()) {
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.DGlobalPlayer;
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.entity.Player;
import org.bukkit.scheduler.BukkitRunnable;
@ -38,7 +38,7 @@ public class SecureModeTask extends BukkitRunnable {
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)) {
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.event.dplayer.DPlayerKickEvent;
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.entity.Player;
import org.bukkit.scheduler.BukkitRunnable;
@ -32,7 +32,7 @@ import org.bukkit.scheduler.BukkitRunnable;
*/
public class TimeIsRunningTask extends BukkitRunnable {
protected static MessageConfig messageConfig = DungeonsXL.getInstance().getMessageConfig();
MessageConfig messageConfig = DungeonsXL.getInstance().getMessageConfig();
private DGroup dGroup;
private int time;
@ -60,7 +60,7 @@ public class TimeIsRunningTask extends BukkitRunnable {
for (Player player : dGroup.getPlayers()) {
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) {
continue;
}

View File

@ -17,7 +17,7 @@
package io.github.dre2n.dungeonsxl.task;
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;
/**
@ -27,7 +27,7 @@ public class UpdateTask extends BukkitRunnable {
@Override
public void run() {
for (DPlayer dPlayer : DungeonsXL.getInstance().getDPlayers().getDPlayers()) {
for (DGamePlayer dPlayer : DungeonsXL.getInstance().getDPlayers().getDGamePlayers()) {
dPlayer.update(false);
}
}

View File

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

View File

@ -17,6 +17,7 @@
package io.github.dre2n.dungeonsxl.trigger;
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.event.trigger.TriggerRegistrationEvent;
import io.github.dre2n.dungeonsxl.sign.DSign;
@ -32,10 +33,10 @@ import org.bukkit.entity.Player;
*/
public abstract class Trigger {
protected static DungeonsXL plugin = DungeonsXL.getInstance();
static DungeonsXL plugin = DungeonsXL.getInstance();
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<>();
@ -180,9 +181,9 @@ public abstract class Trigger {
trigger = (Trigger) method.invoke(value, dSign.getGameWorld());
} 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)) {
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
*/
public class Triggers {
public class TriggerTypes {
private List<TriggerType> triggers = new ArrayList<>();
private List<TriggerType> types = new ArrayList<>();
public Triggers() {
triggers.addAll(Arrays.asList(TriggerTypeDefault.values()));
public TriggerTypes() {
types.addAll(Arrays.asList(TriggerTypeDefault.values()));
}
/**
* @return the trigger which has the identifier
*/
public TriggerType getByIdentifier(String identifier) {
for (TriggerType trigger : triggers) {
if (trigger.getIdentifier().equalsIgnoreCase(identifier)) {
return trigger;
for (TriggerType type : types) {
if (type.getIdentifier().equalsIgnoreCase(identifier)) {
return type;
}
}
@ -45,26 +45,26 @@ public class Triggers {
}
/**
* @return the triggers
* @return the trigger types
*/
public List<TriggerType> getTriggers() {
return triggers;
return types;
}
/**
* @param trigger
* the triggers to add
* @param type
* the type to add
*/
public void addTrigger(TriggerType trigger) {
triggers.add(trigger);
public void addTrigger(TriggerType type) {
types.add(type);
}
/**
* @param trigger
* the trigger to remove
* @param type
* the type to remove
*/
public void removeTrigger(TriggerType trigger) {
triggers.remove(trigger);
public void removeTrigger(TriggerType type) {
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.EditWorldSaveEvent;
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.FileInputStream;
import java.io.FileNotFoundException;
@ -47,7 +47,7 @@ import org.bukkit.entity.Player;
*/
public class EditWorld {
protected static DungeonsXL plugin = DungeonsXL.getInstance();
static DungeonsXL plugin = DungeonsXL.getInstance();
// Variables
private World world;
@ -263,7 +263,7 @@ public class EditWorld {
plugin.getEditWorlds().remove(this);
for (Player player : world.getPlayers()) {
DPlayer dPlayer = DPlayer.getByPlayer(player);
DGamePlayer dPlayer = DGamePlayer.getByPlayer(player);
dPlayer.leave();
}
@ -283,7 +283,7 @@ public class EditWorld {
plugin.getEditWorlds().remove(this);
for (Player player : world.getPlayers()) {
DPlayer dPlayer = DPlayer.getByPlayer(player);
DGamePlayer dPlayer = DGamePlayer.getByPlayer(player);
dPlayer.leave();
}
@ -295,7 +295,7 @@ public class EditWorld {
}
public void sendMessage(String message) {
for (DPlayer dPlayer : DPlayer.getByWorld(world)) {
for (DGamePlayer dPlayer : DGamePlayer.getByWorld(world)) {
MessageUtil.sendMessage(dPlayer.getPlayer(), message);
}
}
@ -441,7 +441,7 @@ public class EditWorld {
// Kick Player
EditWorld editWorld = EditWorld.getByName(editWorldName);
if (editWorld != null) {
DPlayer player = DPlayer.getByName(name);
DGamePlayer player = DGamePlayer.getByName(name);
if (player != null) {
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.player.DGroup;
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.reward.RewardChest;
import io.github.dre2n.dungeonsxl.sign.DSign;
@ -64,7 +64,7 @@ import org.bukkit.entity.Spider;
*/
public class GameWorld {
protected static DungeonsXL plugin = DungeonsXL.getInstance();
static DungeonsXL plugin = DungeonsXL.getInstance();
// Variables
private boolean tutorial;
@ -427,7 +427,7 @@ public class GameWorld {
}
public void sendMessage(String message) {
for (DPlayer dPlayer : DPlayer.getByWorld(world)) {
for (DGamePlayer dPlayer : DGamePlayer.getByWorld(world)) {
MessageUtil.sendMessage(dPlayer.getPlayer(), message);
}
}

View File

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

View File

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