mirror of
https://github.com/DRE2N/DungeonsXL.git
synced 2025-02-09 17:01:48 +01:00
New structure
This commit is contained in:
parent
e013d5fd3a
commit
2fc7e841e1
@ -1,13 +1,13 @@
|
|||||||
package io.github.dre2n.dungeonsxl;
|
package io.github.dre2n.dungeonsxl;
|
||||||
|
|
||||||
import io.github.dre2n.dungeonsxl.command.DCommands;
|
import io.github.dre2n.dungeonsxl.command.DCommands;
|
||||||
|
import io.github.dre2n.dungeonsxl.config.MainConfig;
|
||||||
|
import io.github.dre2n.dungeonsxl.config.MessageConfig;
|
||||||
|
import io.github.dre2n.dungeonsxl.config.WorldConfig;
|
||||||
import io.github.dre2n.dungeonsxl.dungeon.DLootInventory;
|
import io.github.dre2n.dungeonsxl.dungeon.DLootInventory;
|
||||||
import io.github.dre2n.dungeonsxl.dungeon.Dungeons;
|
import io.github.dre2n.dungeonsxl.dungeon.Dungeons;
|
||||||
import io.github.dre2n.dungeonsxl.dungeon.EditWorld;
|
import io.github.dre2n.dungeonsxl.dungeon.EditWorld;
|
||||||
import io.github.dre2n.dungeonsxl.dungeon.WorldConfig;
|
|
||||||
import io.github.dre2n.dungeonsxl.dungeon.game.GameWorld;
|
import io.github.dre2n.dungeonsxl.dungeon.game.GameWorld;
|
||||||
import io.github.dre2n.dungeonsxl.file.DMessages;
|
|
||||||
import io.github.dre2n.dungeonsxl.file.MainConfig;
|
|
||||||
import io.github.dre2n.dungeonsxl.global.DPortal;
|
import io.github.dre2n.dungeonsxl.global.DPortal;
|
||||||
import io.github.dre2n.dungeonsxl.global.GroupSign;
|
import io.github.dre2n.dungeonsxl.global.GroupSign;
|
||||||
import io.github.dre2n.dungeonsxl.global.LeaveSign;
|
import io.github.dre2n.dungeonsxl.global.LeaveSign;
|
||||||
@ -23,6 +23,9 @@ import io.github.dre2n.dungeonsxl.player.DSavePlayer;
|
|||||||
import io.github.dre2n.dungeonsxl.requirement.Requirements;
|
import io.github.dre2n.dungeonsxl.requirement.Requirements;
|
||||||
import io.github.dre2n.dungeonsxl.reward.Rewards;
|
import io.github.dre2n.dungeonsxl.reward.Rewards;
|
||||||
import io.github.dre2n.dungeonsxl.sign.DSigns;
|
import io.github.dre2n.dungeonsxl.sign.DSigns;
|
||||||
|
import io.github.dre2n.dungeonsxl.task.LazyUpdateTask;
|
||||||
|
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.Triggers;
|
||||||
import io.github.dre2n.dungeonsxl.util.FileUtil;
|
import io.github.dre2n.dungeonsxl.util.FileUtil;
|
||||||
import io.github.dre2n.dungeonsxl.util.VersionUtil;
|
import io.github.dre2n.dungeonsxl.util.VersionUtil;
|
||||||
@ -49,8 +52,10 @@ public class DungeonsXL extends JavaPlugin {
|
|||||||
private Permission permissionProvider;
|
private Permission permissionProvider;
|
||||||
|
|
||||||
private MainConfig mainConfig;
|
private MainConfig mainConfig;
|
||||||
private DMessages dMessages;
|
private MessageConfig messageConfig;
|
||||||
|
|
||||||
private VersionUtil versionUtil;
|
private VersionUtil versionUtil;
|
||||||
|
|
||||||
private DCommands dCommands;
|
private DCommands dCommands;
|
||||||
private DSigns dSigns;
|
private DSigns dSigns;
|
||||||
private Requirements requirements;
|
private Requirements requirements;
|
||||||
@ -58,6 +63,10 @@ public class DungeonsXL extends JavaPlugin {
|
|||||||
private Triggers triggers;
|
private Triggers triggers;
|
||||||
private Dungeons dungeons;
|
private Dungeons dungeons;
|
||||||
|
|
||||||
|
private WorldUnloadTask worldUnloadTask;
|
||||||
|
private LazyUpdateTask lazyUpdateTask;
|
||||||
|
private UpdateTask updateTask;
|
||||||
|
|
||||||
private CopyOnWriteArrayList<Player> inBreakMode = new CopyOnWriteArrayList<Player>();
|
private CopyOnWriteArrayList<Player> inBreakMode = new CopyOnWriteArrayList<Player>();
|
||||||
private CopyOnWriteArrayList<Player> chatSpyers = new CopyOnWriteArrayList<Player>();
|
private CopyOnWriteArrayList<Player> chatSpyers = new CopyOnWriteArrayList<Player>();
|
||||||
private CopyOnWriteArrayList<DLootInventory> dLootInventories = new CopyOnWriteArrayList<DLootInventory>();
|
private CopyOnWriteArrayList<DLootInventory> dLootInventories = new CopyOnWriteArrayList<DLootInventory>();
|
||||||
@ -72,17 +81,16 @@ public class DungeonsXL extends JavaPlugin {
|
|||||||
@Override
|
@Override
|
||||||
public void onEnable() {
|
public void onEnable() {
|
||||||
plugin = this;
|
plugin = this;
|
||||||
getDataFolder().mkdir();
|
|
||||||
|
|
||||||
// InitFolders
|
// InitFolders
|
||||||
initFolders();
|
initFolders();
|
||||||
|
|
||||||
// Load Language
|
// Load Language
|
||||||
loadDMessages(new File(plugin.getDataFolder(), "languages/en.yml"));
|
loadMessageConfig(new File(plugin.getDataFolder(), "languages/en.yml"));
|
||||||
// Load Config
|
// Load Config
|
||||||
loadMainConfig(new File(plugin.getDataFolder(), "config.yml"));
|
loadMainConfig(new File(plugin.getDataFolder(), "config.yml"));
|
||||||
// Load Language 2
|
// Load Language 2
|
||||||
loadDMessages(new File(plugin.getDataFolder(), "languages/" + mainConfig.getLanguage() + ".yml"));
|
loadMessageConfig(new File(plugin.getDataFolder(), "languages/" + mainConfig.getLanguage() + ".yml"));
|
||||||
loadVersionUtil();
|
loadVersionUtil();
|
||||||
loadDCommands();
|
loadDCommands();
|
||||||
loadRequirements();
|
loadRequirements();
|
||||||
@ -107,8 +115,10 @@ public class DungeonsXL extends JavaPlugin {
|
|||||||
// Load All
|
// Load All
|
||||||
loadAll();
|
loadAll();
|
||||||
|
|
||||||
// Scheduler
|
// Tasks
|
||||||
initSchedulers();
|
startWorldUnloadTask(1200L);
|
||||||
|
startLazyUpdateTask(20L);
|
||||||
|
startUpdateTask(20L);
|
||||||
|
|
||||||
// MSG
|
// MSG
|
||||||
getLogger().info("DungeonsXL " + getDescription().getVersion() + " for Spigot 1.8.8 loaded succesfully!");
|
getLogger().info("DungeonsXL " + getDescription().getVersion() + " for Spigot 1.8.8 loaded succesfully!");
|
||||||
@ -121,7 +131,7 @@ public class DungeonsXL extends JavaPlugin {
|
|||||||
public void onDisable() {
|
public void onDisable() {
|
||||||
// Save
|
// Save
|
||||||
saveData();
|
saveData();
|
||||||
dMessages.save();
|
messageConfig.save();
|
||||||
|
|
||||||
// DPlayer leaves World
|
// DPlayer leaves World
|
||||||
for (DPlayer dplayer : dPlayers) {
|
for (DPlayer dplayer : dPlayers) {
|
||||||
@ -172,41 +182,6 @@ public class DungeonsXL extends JavaPlugin {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public void initSchedulers() {
|
|
||||||
plugin.getServer().getScheduler().scheduleSyncRepeatingTask(plugin, new Runnable() {
|
|
||||||
@Override
|
|
||||||
public void run() {
|
|
||||||
for (GameWorld gameWorld : gameWorlds) {
|
|
||||||
if (gameWorld.getWorld().getPlayers().isEmpty()) {
|
|
||||||
if (DPlayer.getByWorld(gameWorld.getWorld()).isEmpty()) {
|
|
||||||
gameWorld.delete();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
for (EditWorld editWorld : editWorlds) {
|
|
||||||
if (editWorld.getWorld().getPlayers().isEmpty()) {
|
|
||||||
editWorld.delete();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}, 0L, 1200L);
|
|
||||||
|
|
||||||
plugin.getServer().getScheduler().scheduleSyncRepeatingTask(plugin, new Runnable() {
|
|
||||||
@Override
|
|
||||||
public void run() {
|
|
||||||
GameWorld.update();
|
|
||||||
DPlayer.update(true);
|
|
||||||
}
|
|
||||||
}, 0L, 20L);
|
|
||||||
|
|
||||||
plugin.getServer().getScheduler().scheduleSyncRepeatingTask(plugin, new Runnable() {
|
|
||||||
@Override
|
|
||||||
public void run() {
|
|
||||||
DPlayer.update(false);
|
|
||||||
}
|
|
||||||
}, 0L, 2L);
|
|
||||||
}
|
|
||||||
|
|
||||||
// Save and Load
|
// Save and Load
|
||||||
public void saveData() {
|
public void saveData() {
|
||||||
File file = new File(getDataFolder(), "data.yml");
|
File file = new File(getDataFolder(), "data.yml");
|
||||||
@ -359,17 +334,17 @@ public class DungeonsXL extends JavaPlugin {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @return the loaded instance of DMessages
|
* @return the loaded instance of MessageConfig
|
||||||
*/
|
*/
|
||||||
public DMessages getDMessages() {
|
public MessageConfig getMessageConfig() {
|
||||||
return dMessages;
|
return messageConfig;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* load / reload a new instance of DMessages
|
* load / reload a new instance of MessageConfig
|
||||||
*/
|
*/
|
||||||
public void loadDMessages(File file) {
|
public void loadMessageConfig(File file) {
|
||||||
dMessages = new DMessages(file);
|
messageConfig = new MessageConfig(file);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -456,6 +431,48 @@ public class DungeonsXL extends JavaPlugin {
|
|||||||
dungeons = new Dungeons();
|
dungeons = new Dungeons();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @return the worldUnloadTask
|
||||||
|
*/
|
||||||
|
public WorldUnloadTask getWorldUnloadTask() {
|
||||||
|
return worldUnloadTask;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* start a new WorldUnloadTask
|
||||||
|
*/
|
||||||
|
public void startWorldUnloadTask(long period) {
|
||||||
|
worldUnloadTask = (WorldUnloadTask) new WorldUnloadTask().runTaskTimerAsynchronously(this, 0L, period);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @return the lazyUpdateTask
|
||||||
|
*/
|
||||||
|
public LazyUpdateTask getLazyUpdateTask() {
|
||||||
|
return lazyUpdateTask;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* start a new LazyUpdateTask
|
||||||
|
*/
|
||||||
|
public void startLazyUpdateTask(long period) {
|
||||||
|
lazyUpdateTask = (LazyUpdateTask) new LazyUpdateTask().runTaskTimerAsynchronously(this, 0L, period);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @return the updateTask
|
||||||
|
*/
|
||||||
|
public UpdateTask getUpdateTask() {
|
||||||
|
return updateTask;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* start a new LazyUpdateTask
|
||||||
|
*/
|
||||||
|
public void startUpdateTask(long period) {
|
||||||
|
updateTask = (UpdateTask) new UpdateTask().runTaskTimerAsynchronously(this, 0L, period);
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @return the inBreakMode
|
* @return the inBreakMode
|
||||||
*/
|
*/
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
package io.github.dre2n.dungeonsxl.command;
|
package io.github.dre2n.dungeonsxl.command;
|
||||||
|
|
||||||
import io.github.dre2n.dungeonsxl.file.DMessages.Messages;
|
import io.github.dre2n.dungeonsxl.config.MessageConfig.Messages;
|
||||||
import io.github.dre2n.dungeonsxl.util.messageutil.MessageUtil;
|
import io.github.dre2n.dungeonsxl.util.messageutil.MessageUtil;
|
||||||
|
|
||||||
import org.bukkit.command.CommandSender;
|
import org.bukkit.command.CommandSender;
|
||||||
@ -12,7 +12,7 @@ public class BreakCommand extends DCommand {
|
|||||||
setCommand("break");
|
setCommand("break");
|
||||||
setMinArgs(0);
|
setMinArgs(0);
|
||||||
setMaxArgs(0);
|
setMaxArgs(0);
|
||||||
setHelp(dMessages.getMessage(Messages.HELP_CMD_BREAK));
|
setHelp(messageConfig.getMessage(Messages.HELP_CMD_BREAK));
|
||||||
setPermission("dxl.break");
|
setPermission("dxl.break");
|
||||||
setPlayerCommand(true);
|
setPlayerCommand(true);
|
||||||
}
|
}
|
||||||
@ -22,11 +22,11 @@ public class BreakCommand extends DCommand {
|
|||||||
Player player = (Player) sender;
|
Player player = (Player) sender;
|
||||||
if ( !plugin.getInBreakMode().contains(player)) {
|
if ( !plugin.getInBreakMode().contains(player)) {
|
||||||
plugin.getInBreakMode().add(player);
|
plugin.getInBreakMode().add(player);
|
||||||
MessageUtil.sendMessage(sender, dMessages.getMessage(Messages.CMD_BREAK_BREAK_MODE));
|
MessageUtil.sendMessage(sender, messageConfig.getMessage(Messages.CMD_BREAK_BREAK_MODE));
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
plugin.getInBreakMode().remove(player);
|
plugin.getInBreakMode().remove(player);
|
||||||
MessageUtil.sendMessage(sender, dMessages.getMessage(Messages.CMD_BREAK_PROTECTED_MODE));
|
MessageUtil.sendMessage(sender, messageConfig.getMessage(Messages.CMD_BREAK_PROTECTED_MODE));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
package io.github.dre2n.dungeonsxl.command;
|
package io.github.dre2n.dungeonsxl.command;
|
||||||
|
|
||||||
import io.github.dre2n.dungeonsxl.file.DMessages.Messages;
|
import io.github.dre2n.dungeonsxl.config.MessageConfig.Messages;
|
||||||
import io.github.dre2n.dungeonsxl.player.DPlayer;
|
import io.github.dre2n.dungeonsxl.player.DPlayer;
|
||||||
import io.github.dre2n.dungeonsxl.util.messageutil.MessageUtil;
|
import io.github.dre2n.dungeonsxl.util.messageutil.MessageUtil;
|
||||||
|
|
||||||
@ -13,7 +13,7 @@ public class ChatCommand extends DCommand {
|
|||||||
setCommand("chat");
|
setCommand("chat");
|
||||||
setMinArgs(0);
|
setMinArgs(0);
|
||||||
setMaxArgs(0);
|
setMaxArgs(0);
|
||||||
setHelp(dMessages.getMessage(Messages.HELP_CMD_CHAT));
|
setHelp(messageConfig.getMessage(Messages.HELP_CMD_CHAT));
|
||||||
setPermission("dxl.chat");
|
setPermission("dxl.chat");
|
||||||
setPlayerCommand(true);
|
setPlayerCommand(true);
|
||||||
}
|
}
|
||||||
@ -24,17 +24,17 @@ public class ChatCommand extends DCommand {
|
|||||||
DPlayer dplayer = DPlayer.getByPlayer(player);
|
DPlayer dplayer = DPlayer.getByPlayer(player);
|
||||||
|
|
||||||
if (dplayer == null) {
|
if (dplayer == null) {
|
||||||
MessageUtil.sendMessage(player, dMessages.getMessage(Messages.ERROR_NOT_IN_GROUP));
|
MessageUtil.sendMessage(player, messageConfig.getMessage(Messages.ERROR_NOT_IN_GROUP));
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (dplayer.isInDungeonChat()) {
|
if (dplayer.isInDungeonChat()) {
|
||||||
dplayer.setInDungeonChat(false);
|
dplayer.setInDungeonChat(false);
|
||||||
MessageUtil.sendMessage(player, dMessages.getMessage(Messages.CMD_CHAT_NORMAL_CHAT));
|
MessageUtil.sendMessage(player, messageConfig.getMessage(Messages.CMD_CHAT_NORMAL_CHAT));
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
dplayer.setInDungeonChat(true);
|
dplayer.setInDungeonChat(true);
|
||||||
MessageUtil.sendMessage(player, dMessages.getMessage(Messages.CMD_CHAT_DUNGEON_CHAT));
|
MessageUtil.sendMessage(player, messageConfig.getMessage(Messages.CMD_CHAT_DUNGEON_CHAT));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
package io.github.dre2n.dungeonsxl.command;
|
package io.github.dre2n.dungeonsxl.command;
|
||||||
|
|
||||||
import io.github.dre2n.dungeonsxl.file.DMessages.Messages;
|
import io.github.dre2n.dungeonsxl.config.MessageConfig.Messages;
|
||||||
import io.github.dre2n.dungeonsxl.util.messageutil.MessageUtil;
|
import io.github.dre2n.dungeonsxl.util.messageutil.MessageUtil;
|
||||||
|
|
||||||
import org.bukkit.command.CommandSender;
|
import org.bukkit.command.CommandSender;
|
||||||
@ -12,7 +12,7 @@ public class ChatSpyCommand extends DCommand {
|
|||||||
setCommand("chatspy");
|
setCommand("chatspy");
|
||||||
setMinArgs(0);
|
setMinArgs(0);
|
||||||
setMaxArgs(0);
|
setMaxArgs(0);
|
||||||
setHelp(dMessages.getMessage(Messages.HELP_CMD_CHATSPY));
|
setHelp(messageConfig.getMessage(Messages.HELP_CMD_CHATSPY));
|
||||||
setPermission("dxl.chatspy");
|
setPermission("dxl.chatspy");
|
||||||
setPlayerCommand(true);
|
setPlayerCommand(true);
|
||||||
}
|
}
|
||||||
@ -23,11 +23,11 @@ public class ChatSpyCommand extends DCommand {
|
|||||||
|
|
||||||
if (plugin.getChatSpyers().contains(player)) {
|
if (plugin.getChatSpyers().contains(player)) {
|
||||||
plugin.getChatSpyers().remove(player);
|
plugin.getChatSpyers().remove(player);
|
||||||
MessageUtil.sendMessage(player, dMessages.getMessage(Messages.CMD_CHATSPY_STOPPED));
|
MessageUtil.sendMessage(player, messageConfig.getMessage(Messages.CMD_CHATSPY_STOPPED));
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
plugin.getChatSpyers().add(player);
|
plugin.getChatSpyers().add(player);
|
||||||
MessageUtil.sendMessage(player, dMessages.getMessage(Messages.CMD_CHATSPY_START));
|
MessageUtil.sendMessage(player, messageConfig.getMessage(Messages.CMD_CHATSPY_START));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
package io.github.dre2n.dungeonsxl.command;
|
package io.github.dre2n.dungeonsxl.command;
|
||||||
|
|
||||||
|
import io.github.dre2n.dungeonsxl.config.MessageConfig.Messages;
|
||||||
import io.github.dre2n.dungeonsxl.dungeon.EditWorld;
|
import io.github.dre2n.dungeonsxl.dungeon.EditWorld;
|
||||||
import io.github.dre2n.dungeonsxl.file.DMessages.Messages;
|
|
||||||
import io.github.dre2n.dungeonsxl.player.DPlayer;
|
import io.github.dre2n.dungeonsxl.player.DPlayer;
|
||||||
import io.github.dre2n.dungeonsxl.util.messageutil.MessageUtil;
|
import io.github.dre2n.dungeonsxl.util.messageutil.MessageUtil;
|
||||||
|
|
||||||
@ -15,7 +15,7 @@ public class CreateCommand extends DCommand {
|
|||||||
setMinArgs(1);
|
setMinArgs(1);
|
||||||
setMaxArgs(1);
|
setMaxArgs(1);
|
||||||
setCommand("create");
|
setCommand("create");
|
||||||
setHelp(dMessages.getMessage(Messages.HELP_CMD_CREATE));
|
setHelp(messageConfig.getMessage(Messages.HELP_CMD_CREATE));
|
||||||
setPermission("dxl.create");
|
setPermission("dxl.create");
|
||||||
setPlayerCommand(true);
|
setPlayerCommand(true);
|
||||||
setConsoleCommand(true);
|
setConsoleCommand(true);
|
||||||
@ -28,8 +28,8 @@ public class CreateCommand extends DCommand {
|
|||||||
if (sender instanceof ConsoleCommandSender) {
|
if (sender instanceof ConsoleCommandSender) {
|
||||||
if (name.length() <= 15) {
|
if (name.length() <= 15) {
|
||||||
// Msg create
|
// Msg create
|
||||||
plugin.getLogger().info(dMessages.getMessage(Messages.LOG_NEW_DUNGEON));
|
plugin.getLogger().info(messageConfig.getMessage(Messages.LOG_NEW_DUNGEON));
|
||||||
plugin.getLogger().info(dMessages.getMessage(Messages.LOG_GENERATE_NEW_WORLD));
|
plugin.getLogger().info(messageConfig.getMessage(Messages.LOG_GENERATE_NEW_WORLD));
|
||||||
|
|
||||||
// Create World
|
// Create World
|
||||||
EditWorld editWorld = new EditWorld();
|
EditWorld editWorld = new EditWorld();
|
||||||
@ -39,24 +39,24 @@ public class CreateCommand extends DCommand {
|
|||||||
editWorld.delete();
|
editWorld.delete();
|
||||||
|
|
||||||
// MSG Done
|
// MSG Done
|
||||||
plugin.getLogger().info(dMessages.getMessage(Messages.LOG_WORLD_GENERATION_FINISHED));
|
plugin.getLogger().info(messageConfig.getMessage(Messages.LOG_WORLD_GENERATION_FINISHED));
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
MessageUtil.sendMessage(sender, dMessages.getMessage(Messages.ERROR_NAME_TO_LONG));
|
MessageUtil.sendMessage(sender, messageConfig.getMessage(Messages.ERROR_NAME_TO_LONG));
|
||||||
}
|
}
|
||||||
|
|
||||||
} else if (sender instanceof Player) {
|
} else if (sender instanceof Player) {
|
||||||
Player player = (Player) sender;
|
Player player = (Player) sender;
|
||||||
|
|
||||||
if (DPlayer.getByPlayer(player) != null) {
|
if (DPlayer.getByPlayer(player) != null) {
|
||||||
MessageUtil.sendMessage(player, dMessages.getMessage(Messages.ERROR_LEAVE_DUNGEON));
|
MessageUtil.sendMessage(player, messageConfig.getMessage(Messages.ERROR_LEAVE_DUNGEON));
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (name.length() <= 15) {
|
if (name.length() <= 15) {
|
||||||
// Msg create
|
// Msg create
|
||||||
plugin.getLogger().info(dMessages.getMessage(Messages.LOG_NEW_DUNGEON));
|
plugin.getLogger().info(messageConfig.getMessage(Messages.LOG_NEW_DUNGEON));
|
||||||
plugin.getLogger().info(dMessages.getMessage(Messages.LOG_GENERATE_NEW_WORLD));
|
plugin.getLogger().info(messageConfig.getMessage(Messages.LOG_GENERATE_NEW_WORLD));
|
||||||
|
|
||||||
// Create World
|
// Create World
|
||||||
EditWorld editWorld = new EditWorld();
|
EditWorld editWorld = new EditWorld();
|
||||||
@ -64,7 +64,7 @@ public class CreateCommand extends DCommand {
|
|||||||
editWorld.setMapName(name);
|
editWorld.setMapName(name);
|
||||||
|
|
||||||
// MSG Done
|
// MSG Done
|
||||||
plugin.getLogger().info(dMessages.getMessage(Messages.LOG_WORLD_GENERATION_FINISHED));
|
plugin.getLogger().info(messageConfig.getMessage(Messages.LOG_WORLD_GENERATION_FINISHED));
|
||||||
|
|
||||||
// Tp Player
|
// Tp Player
|
||||||
if (editWorld.getLobby() == null) {
|
if (editWorld.getLobby() == null) {
|
||||||
@ -75,7 +75,7 @@ public class CreateCommand extends DCommand {
|
|||||||
}
|
}
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
MessageUtil.sendMessage(player, dMessages.getMessage(Messages.ERROR_NAME_TO_LONG));
|
MessageUtil.sendMessage(player, messageConfig.getMessage(Messages.ERROR_NAME_TO_LONG));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
package io.github.dre2n.dungeonsxl.command;
|
package io.github.dre2n.dungeonsxl.command;
|
||||||
|
|
||||||
import io.github.dre2n.dungeonsxl.DungeonsXL;
|
import io.github.dre2n.dungeonsxl.DungeonsXL;
|
||||||
import io.github.dre2n.dungeonsxl.file.DMessages;
|
import io.github.dre2n.dungeonsxl.config.MessageConfig;
|
||||||
import io.github.dre2n.dungeonsxl.util.messageutil.MessageUtil;
|
import io.github.dre2n.dungeonsxl.util.messageutil.MessageUtil;
|
||||||
|
|
||||||
import org.bukkit.ChatColor;
|
import org.bukkit.ChatColor;
|
||||||
@ -11,7 +11,7 @@ import org.bukkit.entity.Player;
|
|||||||
public abstract class DCommand {
|
public abstract class DCommand {
|
||||||
|
|
||||||
static DungeonsXL plugin = DungeonsXL.getPlugin();
|
static DungeonsXL plugin = DungeonsXL.getPlugin();
|
||||||
DMessages dMessages = plugin.getDMessages();
|
MessageConfig messageConfig = plugin.getMessageConfig();
|
||||||
|
|
||||||
public boolean costsMoney;
|
public boolean costsMoney;
|
||||||
private String command;
|
private String command;
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
package io.github.dre2n.dungeonsxl.command;
|
package io.github.dre2n.dungeonsxl.command;
|
||||||
|
|
||||||
import io.github.dre2n.dungeonsxl.file.DMessages.Messages;
|
import io.github.dre2n.dungeonsxl.config.MessageConfig.Messages;
|
||||||
import io.github.dre2n.dungeonsxl.global.DPortal;
|
import io.github.dre2n.dungeonsxl.global.DPortal;
|
||||||
import io.github.dre2n.dungeonsxl.util.messageutil.MessageUtil;
|
import io.github.dre2n.dungeonsxl.util.messageutil.MessageUtil;
|
||||||
|
|
||||||
@ -29,10 +29,10 @@ public class DeletePortalCommand extends DCommand {
|
|||||||
|
|
||||||
if (dPortal != null) {
|
if (dPortal != null) {
|
||||||
dPortal.delete();
|
dPortal.delete();
|
||||||
MessageUtil.sendMessage(player, dMessages.getMessage(Messages.PLAYER_PROTECTED_BLOCK_DELETED));
|
MessageUtil.sendMessage(player, messageConfig.getMessage(Messages.PLAYER_PROTECTED_BLOCK_DELETED));
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
MessageUtil.sendMessage(player, dMessages.getMessage(Messages.ERROR_NO_PROTECTED_BLOCK));
|
MessageUtil.sendMessage(player, messageConfig.getMessage(Messages.ERROR_NO_PROTECTED_BLOCK));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
package io.github.dre2n.dungeonsxl.command;
|
package io.github.dre2n.dungeonsxl.command;
|
||||||
|
|
||||||
|
import io.github.dre2n.dungeonsxl.config.MessageConfig.Messages;
|
||||||
import io.github.dre2n.dungeonsxl.dungeon.EditWorld;
|
import io.github.dre2n.dungeonsxl.dungeon.EditWorld;
|
||||||
import io.github.dre2n.dungeonsxl.file.DMessages.Messages;
|
|
||||||
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.DPlayer;
|
||||||
import io.github.dre2n.dungeonsxl.util.messageutil.MessageUtil;
|
import io.github.dre2n.dungeonsxl.util.messageutil.MessageUtil;
|
||||||
@ -15,7 +15,7 @@ public class EditCommand extends DCommand {
|
|||||||
setCommand("edit");
|
setCommand("edit");
|
||||||
setMinArgs(1);
|
setMinArgs(1);
|
||||||
setMaxArgs(1);
|
setMaxArgs(1);
|
||||||
setHelp(dMessages.getMessage(Messages.HELP_CMD_EDIT));
|
setHelp(messageConfig.getMessage(Messages.HELP_CMD_EDIT));
|
||||||
setPlayerCommand(true);
|
setPlayerCommand(true);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -29,22 +29,22 @@ public class EditCommand extends DCommand {
|
|||||||
DPlayer dPlayer = DPlayer.getByPlayer(player);
|
DPlayer dPlayer = DPlayer.getByPlayer(player);
|
||||||
|
|
||||||
if ( !(EditWorld.isInvitedPlayer(mapName, player.getUniqueId(), player.getName()) || player.hasPermission("dxl.edit"))) {
|
if ( !(EditWorld.isInvitedPlayer(mapName, player.getUniqueId(), player.getName()) || player.hasPermission("dxl.edit"))) {
|
||||||
MessageUtil.sendMessage(player, dMessages.getMessage(Messages.ERROR_NO_PERMISSIONS));
|
MessageUtil.sendMessage(player, messageConfig.getMessage(Messages.ERROR_NO_PERMISSIONS));
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (dPlayer != null) {
|
if (dPlayer != null) {
|
||||||
MessageUtil.sendMessage(player, dMessages.getMessage(Messages.ERROR_LEAVE_DUNGEON));
|
MessageUtil.sendMessage(player, messageConfig.getMessage(Messages.ERROR_LEAVE_DUNGEON));
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (dGroup != null) {
|
if (dGroup != null) {
|
||||||
MessageUtil.sendMessage(player, dMessages.getMessage(Messages.ERROR_LEAVE_GROUP));
|
MessageUtil.sendMessage(player, messageConfig.getMessage(Messages.ERROR_LEAVE_GROUP));
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (editWorld == null) {
|
if (editWorld == null) {
|
||||||
MessageUtil.sendMessage(player, dMessages.getMessage(Messages.ERROR_DUNGEON_NOT_EXIST, mapName));
|
MessageUtil.sendMessage(player, messageConfig.getMessage(Messages.ERROR_DUNGEON_NOT_EXIST, mapName));
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
package io.github.dre2n.dungeonsxl.command;
|
package io.github.dre2n.dungeonsxl.command;
|
||||||
|
|
||||||
|
import io.github.dre2n.dungeonsxl.config.MessageConfig.Messages;
|
||||||
import io.github.dre2n.dungeonsxl.dungeon.EditWorld;
|
import io.github.dre2n.dungeonsxl.dungeon.EditWorld;
|
||||||
import io.github.dre2n.dungeonsxl.file.DMessages.Messages;
|
|
||||||
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.DPlayer;
|
||||||
import io.github.dre2n.dungeonsxl.util.messageutil.MessageUtil;
|
import io.github.dre2n.dungeonsxl.util.messageutil.MessageUtil;
|
||||||
@ -15,7 +15,7 @@ public class EscapeCommand extends DCommand {
|
|||||||
setCommand("escape");
|
setCommand("escape");
|
||||||
setMinArgs(0);
|
setMinArgs(0);
|
||||||
setMaxArgs(0);
|
setMaxArgs(0);
|
||||||
setHelp(dMessages.getMessage(Messages.HELP_CMD_ESCAPE));
|
setHelp(messageConfig.getMessage(Messages.HELP_CMD_ESCAPE));
|
||||||
setPermission("dxl.escape");
|
setPermission("dxl.escape");
|
||||||
setPlayerCommand(true);
|
setPlayerCommand(true);
|
||||||
}
|
}
|
||||||
@ -27,7 +27,7 @@ public class EscapeCommand extends DCommand {
|
|||||||
if (dPlayer != null) {
|
if (dPlayer != null) {
|
||||||
|
|
||||||
if ( !dPlayer.isEditing()) {
|
if ( !dPlayer.isEditing()) {
|
||||||
MessageUtil.sendMessage(player, dMessages.getMessage(Messages.ERROR_LEAVE_DUNGEON));
|
MessageUtil.sendMessage(player, messageConfig.getMessage(Messages.ERROR_LEAVE_DUNGEON));
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -46,10 +46,10 @@ public class EscapeCommand extends DCommand {
|
|||||||
DGroup dGroup = DGroup.getByPlayer(player);
|
DGroup dGroup = DGroup.getByPlayer(player);
|
||||||
if (dGroup != null) {
|
if (dGroup != null) {
|
||||||
dGroup.removePlayer(player);
|
dGroup.removePlayer(player);
|
||||||
MessageUtil.sendMessage(player, dMessages.getMessage(Messages.CMD_LEAVE_SUCCESS));
|
MessageUtil.sendMessage(player, messageConfig.getMessage(Messages.CMD_LEAVE_SUCCESS));
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
MessageUtil.sendMessage(player, dMessages.getMessage(Messages.ERROR_NOT_IN_DUNGEON));
|
MessageUtil.sendMessage(player, messageConfig.getMessage(Messages.ERROR_NOT_IN_DUNGEON));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -3,7 +3,7 @@ package io.github.dre2n.dungeonsxl.command;
|
|||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
import io.github.dre2n.dungeonsxl.file.DMessages.Messages;
|
import io.github.dre2n.dungeonsxl.config.MessageConfig.Messages;
|
||||||
import io.github.dre2n.dungeonsxl.util.NumberUtil;
|
import io.github.dre2n.dungeonsxl.util.NumberUtil;
|
||||||
import io.github.dre2n.dungeonsxl.util.messageutil.MessageUtil;
|
import io.github.dre2n.dungeonsxl.util.messageutil.MessageUtil;
|
||||||
|
|
||||||
@ -15,7 +15,7 @@ public class HelpCommand extends DCommand {
|
|||||||
setCommand("help");
|
setCommand("help");
|
||||||
setMinArgs(0);
|
setMinArgs(0);
|
||||||
setMaxArgs(1);
|
setMaxArgs(1);
|
||||||
setHelp(dMessages.getMessage(Messages.HELP_CMD_HELP));
|
setHelp(messageConfig.getMessage(Messages.HELP_CMD_HELP));
|
||||||
setPermission("dxl.help");
|
setPermission("dxl.help");
|
||||||
setPlayerCommand(true);
|
setPlayerCommand(true);
|
||||||
setConsoleCommand(true);
|
setConsoleCommand(true);
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
package io.github.dre2n.dungeonsxl.command;
|
package io.github.dre2n.dungeonsxl.command;
|
||||||
|
|
||||||
|
import io.github.dre2n.dungeonsxl.config.MessageConfig.Messages;
|
||||||
import io.github.dre2n.dungeonsxl.dungeon.EditWorld;
|
import io.github.dre2n.dungeonsxl.dungeon.EditWorld;
|
||||||
import io.github.dre2n.dungeonsxl.file.DMessages.Messages;
|
|
||||||
import io.github.dre2n.dungeonsxl.util.UUIDUtil;
|
import io.github.dre2n.dungeonsxl.util.UUIDUtil;
|
||||||
import io.github.dre2n.dungeonsxl.util.messageutil.MessageUtil;
|
import io.github.dre2n.dungeonsxl.util.messageutil.MessageUtil;
|
||||||
|
|
||||||
@ -13,7 +13,7 @@ public class InviteCommand extends DCommand {
|
|||||||
setMinArgs(2);
|
setMinArgs(2);
|
||||||
setMaxArgs(2);
|
setMaxArgs(2);
|
||||||
setCommand("invite");
|
setCommand("invite");
|
||||||
setHelp(dMessages.getMessage(Messages.HELP_CMD_INVITE));
|
setHelp(messageConfig.getMessage(Messages.HELP_CMD_INVITE));
|
||||||
setPermission("dxl.invite");
|
setPermission("dxl.invite");
|
||||||
setPlayerCommand(true);
|
setPlayerCommand(true);
|
||||||
setConsoleCommand(true);
|
setConsoleCommand(true);
|
||||||
@ -22,10 +22,10 @@ public class InviteCommand extends DCommand {
|
|||||||
@Override
|
@Override
|
||||||
public void onExecute(String[] args, CommandSender sender) {
|
public void onExecute(String[] args, CommandSender sender) {
|
||||||
if (EditWorld.addInvitedPlayer(args[2], UUIDUtil.getUniqueIdFromName(args[1]))) {
|
if (EditWorld.addInvitedPlayer(args[2], UUIDUtil.getUniqueIdFromName(args[1]))) {
|
||||||
MessageUtil.sendMessage(sender, dMessages.getMessage(Messages.CMD_INVITE_SUCCESS, args[1], args[2]));
|
MessageUtil.sendMessage(sender, messageConfig.getMessage(Messages.CMD_INVITE_SUCCESS, args[1], args[2]));
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
MessageUtil.sendMessage(sender, dMessages.getMessage(Messages.ERROR_DUNGEON_NOT_EXIST, args[2]));
|
MessageUtil.sendMessage(sender, messageConfig.getMessage(Messages.ERROR_DUNGEON_NOT_EXIST, args[2]));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1,8 +1,8 @@
|
|||||||
package io.github.dre2n.dungeonsxl.command;
|
package io.github.dre2n.dungeonsxl.command;
|
||||||
|
|
||||||
|
import io.github.dre2n.dungeonsxl.config.MessageConfig.Messages;
|
||||||
import io.github.dre2n.dungeonsxl.dungeon.game.GameWorld;
|
import io.github.dre2n.dungeonsxl.dungeon.game.GameWorld;
|
||||||
import io.github.dre2n.dungeonsxl.event.dplayer.DPlayerEscapeEvent;
|
import io.github.dre2n.dungeonsxl.event.dplayer.DPlayerEscapeEvent;
|
||||||
import io.github.dre2n.dungeonsxl.file.DMessages.Messages;
|
|
||||||
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.DPlayer;
|
||||||
import io.github.dre2n.dungeonsxl.util.messageutil.MessageUtil;
|
import io.github.dre2n.dungeonsxl.util.messageutil.MessageUtil;
|
||||||
@ -16,7 +16,7 @@ public class LeaveCommand extends DCommand {
|
|||||||
setCommand("leave");
|
setCommand("leave");
|
||||||
setMinArgs(0);
|
setMinArgs(0);
|
||||||
setMaxArgs(0);
|
setMaxArgs(0);
|
||||||
setHelp(dMessages.getMessage(Messages.HELP_CMD_LEAVE));
|
setHelp(messageConfig.getMessage(Messages.HELP_CMD_LEAVE));
|
||||||
setPermission("dxl.leave");
|
setPermission("dxl.leave");
|
||||||
setPlayerCommand(true);
|
setPlayerCommand(true);
|
||||||
}
|
}
|
||||||
@ -28,7 +28,7 @@ public class LeaveCommand extends DCommand {
|
|||||||
|
|
||||||
if (GameWorld.getByWorld(player.getWorld()) != null) {
|
if (GameWorld.getByWorld(player.getWorld()) != null) {
|
||||||
if (GameWorld.getByWorld(player.getWorld()).isTutorial()) {
|
if (GameWorld.getByWorld(player.getWorld()).isTutorial()) {
|
||||||
MessageUtil.sendMessage(player, dMessages.getMessage(Messages.ERROR_NO_LEAVE_IN_TUTORIAL));
|
MessageUtil.sendMessage(player, messageConfig.getMessage(Messages.ERROR_NO_LEAVE_IN_TUTORIAL));
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -41,17 +41,17 @@ public class LeaveCommand extends DCommand {
|
|||||||
}
|
}
|
||||||
|
|
||||||
dPlayer.leave();
|
dPlayer.leave();
|
||||||
MessageUtil.sendMessage(player, dMessages.getMessage(Messages.CMD_LEAVE_SUCCESS));
|
MessageUtil.sendMessage(player, messageConfig.getMessage(Messages.CMD_LEAVE_SUCCESS));
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
DGroup dGroup = DGroup.getByPlayer(player);
|
DGroup dGroup = DGroup.getByPlayer(player);
|
||||||
if (dGroup != null) {
|
if (dGroup != null) {
|
||||||
dGroup.removePlayer(player);
|
dGroup.removePlayer(player);
|
||||||
MessageUtil.sendMessage(player, dMessages.getMessage(Messages.CMD_LEAVE_SUCCESS));
|
MessageUtil.sendMessage(player, messageConfig.getMessage(Messages.CMD_LEAVE_SUCCESS));
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
MessageUtil.sendMessage(player, dMessages.getMessage(Messages.ERROR_NOT_IN_DUNGEON));
|
MessageUtil.sendMessage(player, messageConfig.getMessage(Messages.ERROR_NOT_IN_DUNGEON));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1,11 +1,11 @@
|
|||||||
package io.github.dre2n.dungeonsxl.command;
|
package io.github.dre2n.dungeonsxl.command;
|
||||||
|
|
||||||
|
import io.github.dre2n.dungeonsxl.config.DungeonConfig;
|
||||||
|
import io.github.dre2n.dungeonsxl.config.WorldConfig;
|
||||||
|
import io.github.dre2n.dungeonsxl.config.MessageConfig.Messages;
|
||||||
import io.github.dre2n.dungeonsxl.dungeon.Dungeon;
|
import io.github.dre2n.dungeonsxl.dungeon.Dungeon;
|
||||||
import io.github.dre2n.dungeonsxl.dungeon.DungeonConfig;
|
|
||||||
import io.github.dre2n.dungeonsxl.dungeon.EditWorld;
|
import io.github.dre2n.dungeonsxl.dungeon.EditWorld;
|
||||||
import io.github.dre2n.dungeonsxl.dungeon.WorldConfig;
|
|
||||||
import io.github.dre2n.dungeonsxl.dungeon.game.GameWorld;
|
import io.github.dre2n.dungeonsxl.dungeon.game.GameWorld;
|
||||||
import io.github.dre2n.dungeonsxl.file.DMessages.Messages;
|
|
||||||
import io.github.dre2n.dungeonsxl.util.NumberUtil;
|
import io.github.dre2n.dungeonsxl.util.NumberUtil;
|
||||||
import io.github.dre2n.dungeonsxl.util.messageutil.MessageUtil;
|
import io.github.dre2n.dungeonsxl.util.messageutil.MessageUtil;
|
||||||
|
|
||||||
@ -20,7 +20,7 @@ public class ListCommand extends DCommand {
|
|||||||
setCommand("list");
|
setCommand("list");
|
||||||
setMinArgs(0);
|
setMinArgs(0);
|
||||||
setMaxArgs(3);
|
setMaxArgs(3);
|
||||||
setHelp(dMessages.getMessage(Messages.HELP_CMD_LIST));
|
setHelp(messageConfig.getMessage(Messages.HELP_CMD_LIST));
|
||||||
setPermission("dxl.list");
|
setPermission("dxl.list");
|
||||||
setPlayerCommand(true);
|
setPlayerCommand(true);
|
||||||
setConsoleCommand(true);
|
setConsoleCommand(true);
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
package io.github.dre2n.dungeonsxl.command;
|
package io.github.dre2n.dungeonsxl.command;
|
||||||
|
|
||||||
import io.github.dre2n.dungeonsxl.file.DMessages.Messages;
|
import io.github.dre2n.dungeonsxl.config.MessageConfig.Messages;
|
||||||
import io.github.dre2n.dungeonsxl.player.DPlayer;
|
import io.github.dre2n.dungeonsxl.player.DPlayer;
|
||||||
import io.github.dre2n.dungeonsxl.util.messageutil.MessageUtil;
|
import io.github.dre2n.dungeonsxl.util.messageutil.MessageUtil;
|
||||||
|
|
||||||
@ -14,7 +14,7 @@ public class LivesCommand extends DCommand {
|
|||||||
setCommand("lives");
|
setCommand("lives");
|
||||||
setMinArgs(0);
|
setMinArgs(0);
|
||||||
setMaxArgs(1);
|
setMaxArgs(1);
|
||||||
setHelp(dMessages.getMessage(Messages.HELP_CMD_LIVES));
|
setHelp(messageConfig.getMessage(Messages.HELP_CMD_LIVES));
|
||||||
setPermission("dxl.lives");
|
setPermission("dxl.lives");
|
||||||
setPlayerCommand(true);
|
setPlayerCommand(true);
|
||||||
setConsoleCommand(true);
|
setConsoleCommand(true);
|
||||||
@ -33,16 +33,16 @@ public class LivesCommand extends DCommand {
|
|||||||
player = (Player) sender;
|
player = (Player) sender;
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
MessageUtil.sendMessage(sender, dMessages.getMessage(Messages.ERROR_NO_CONSOLE_COMMAND, getCommand()));
|
MessageUtil.sendMessage(sender, messageConfig.getMessage(Messages.ERROR_NO_CONSOLE_COMMAND, getCommand()));
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
DPlayer dPlayer = DPlayer.getByPlayer(player);
|
DPlayer dPlayer = DPlayer.getByPlayer(player);
|
||||||
if (dPlayer != null) {
|
if (dPlayer != null) {
|
||||||
MessageUtil.sendMessage(player, dMessages.getMessage(Messages.CMD_LIVES, player.getName(), String.valueOf(dPlayer.getLives())));
|
MessageUtil.sendMessage(player, messageConfig.getMessage(Messages.CMD_LIVES, player.getName(), String.valueOf(dPlayer.getLives())));
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
MessageUtil.sendMessage(player, dMessages.getMessage(Messages.ERROR_NOT_IN_DUNGEON));
|
MessageUtil.sendMessage(player, messageConfig.getMessage(Messages.ERROR_NOT_IN_DUNGEON));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -3,7 +3,7 @@ package io.github.dre2n.dungeonsxl.command;
|
|||||||
import java.io.File;
|
import java.io.File;
|
||||||
|
|
||||||
import io.github.dre2n.dungeonsxl.DungeonsXL;
|
import io.github.dre2n.dungeonsxl.DungeonsXL;
|
||||||
import io.github.dre2n.dungeonsxl.file.DMessages.Messages;
|
import io.github.dre2n.dungeonsxl.config.MessageConfig.Messages;
|
||||||
import io.github.dre2n.dungeonsxl.util.VersionUtil.Internals;
|
import io.github.dre2n.dungeonsxl.util.VersionUtil.Internals;
|
||||||
import io.github.dre2n.dungeonsxl.util.messageutil.MessageUtil;
|
import io.github.dre2n.dungeonsxl.util.messageutil.MessageUtil;
|
||||||
|
|
||||||
@ -15,7 +15,7 @@ public class MainCommand extends DCommand {
|
|||||||
|
|
||||||
public MainCommand() {
|
public MainCommand() {
|
||||||
setCommand("main");
|
setCommand("main");
|
||||||
setHelp(dMessages.getMessage(Messages.HELP_CMD_MAIN));
|
setHelp(messageConfig.getMessage(Messages.HELP_CMD_MAIN));
|
||||||
setPermission("dxl.main");
|
setPermission("dxl.main");
|
||||||
setPlayerCommand(true);
|
setPlayerCommand(true);
|
||||||
setConsoleCommand(true);
|
setConsoleCommand(true);
|
||||||
@ -44,10 +44,10 @@ public class MainCommand extends DCommand {
|
|||||||
MessageUtil.sendCenteredMessage(sender, "&4" + MessageUtil.BIG_D[2] + "&f" + MessageUtil.BIG_X[2] + MessageUtil.BIG_L[2]);
|
MessageUtil.sendCenteredMessage(sender, "&4" + MessageUtil.BIG_D[2] + "&f" + MessageUtil.BIG_X[2] + MessageUtil.BIG_L[2]);
|
||||||
MessageUtil.sendCenteredMessage(sender, "&4" + MessageUtil.BIG_D[3] + "&f" + MessageUtil.BIG_X[3] + MessageUtil.BIG_L[3]);
|
MessageUtil.sendCenteredMessage(sender, "&4" + MessageUtil.BIG_D[3] + "&f" + MessageUtil.BIG_X[3] + MessageUtil.BIG_L[3]);
|
||||||
MessageUtil.sendCenteredMessage(sender, "&4" + MessageUtil.BIG_D[4] + "&f" + MessageUtil.BIG_X[4] + MessageUtil.BIG_L[4]);
|
MessageUtil.sendCenteredMessage(sender, "&4" + MessageUtil.BIG_D[4] + "&f" + MessageUtil.BIG_X[4] + MessageUtil.BIG_L[4]);
|
||||||
MessageUtil.sendCenteredMessage(sender, "&b&l####### " + dMessages.getMessage(Messages.CMD_MAIN_WELCOME) + "&7 v" + plugin.getDescription().getVersion() + " &b&l#######");
|
MessageUtil.sendCenteredMessage(sender, "&b&l####### " + messageConfig.getMessage(Messages.CMD_MAIN_WELCOME) + "&7 v" + plugin.getDescription().getVersion() + " &b&l#######");
|
||||||
MessageUtil.sendCenteredMessage(sender, dMessages.getMessage(Messages.CMD_MAIN_LOADED, String.valueOf(maps), String.valueOf(dungeons), String.valueOf(loaded), String.valueOf(players)));
|
MessageUtil.sendCenteredMessage(sender, messageConfig.getMessage(Messages.CMD_MAIN_LOADED, String.valueOf(maps), String.valueOf(dungeons), String.valueOf(loaded), String.valueOf(players)));
|
||||||
MessageUtil.sendCenteredMessage(sender, dMessages.getMessage(Messages.CMD_MAIN_COMPATIBILITY, String.valueOf(internals), vault, mythicMobs));
|
MessageUtil.sendCenteredMessage(sender, messageConfig.getMessage(Messages.CMD_MAIN_COMPATIBILITY, String.valueOf(internals), vault, mythicMobs));
|
||||||
MessageUtil.sendCenteredMessage(sender, dMessages.getMessage(Messages.CMD_MAIN_HELP));
|
MessageUtil.sendCenteredMessage(sender, messageConfig.getMessage(Messages.CMD_MAIN_HELP));
|
||||||
MessageUtil.sendCenteredMessage(sender, "&7\u00a92012-2016 Frank Baumann & contributors; lcsd. under GPLv3.");
|
MessageUtil.sendCenteredMessage(sender, "&7\u00a92012-2016 Frank Baumann & contributors; lcsd. under GPLv3.");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1,8 +1,8 @@
|
|||||||
package io.github.dre2n.dungeonsxl.command;
|
package io.github.dre2n.dungeonsxl.command;
|
||||||
|
|
||||||
import io.github.dre2n.dungeonsxl.dungeon.WorldConfig;
|
import io.github.dre2n.dungeonsxl.config.WorldConfig;
|
||||||
|
import io.github.dre2n.dungeonsxl.config.MessageConfig.Messages;
|
||||||
import io.github.dre2n.dungeonsxl.dungeon.EditWorld;
|
import io.github.dre2n.dungeonsxl.dungeon.EditWorld;
|
||||||
import io.github.dre2n.dungeonsxl.file.DMessages.Messages;
|
|
||||||
import io.github.dre2n.dungeonsxl.util.NumberUtil;
|
import io.github.dre2n.dungeonsxl.util.NumberUtil;
|
||||||
import io.github.dre2n.dungeonsxl.util.messageutil.MessageUtil;
|
import io.github.dre2n.dungeonsxl.util.messageutil.MessageUtil;
|
||||||
|
|
||||||
@ -18,7 +18,7 @@ public class MsgCommand extends DCommand {
|
|||||||
setMinArgs( -1);
|
setMinArgs( -1);
|
||||||
setMaxArgs( -1);
|
setMaxArgs( -1);
|
||||||
setCommand("msg");
|
setCommand("msg");
|
||||||
setHelp(dMessages.getMessage(Messages.HELP_CMD_MSG));
|
setHelp(messageConfig.getMessage(Messages.HELP_CMD_MSG));
|
||||||
setPermission("dxl.msg");
|
setPermission("dxl.msg");
|
||||||
setPlayerCommand(true);
|
setPlayerCommand(true);
|
||||||
}
|
}
|
||||||
@ -29,7 +29,7 @@ public class MsgCommand extends DCommand {
|
|||||||
EditWorld editWorld = EditWorld.getByWorld(player.getWorld());
|
EditWorld editWorld = EditWorld.getByWorld(player.getWorld());
|
||||||
|
|
||||||
if (editWorld == null) {
|
if (editWorld == null) {
|
||||||
MessageUtil.sendMessage(player, dMessages.getMessage(Messages.ERROR_NOT_IN_DUNGEON));
|
MessageUtil.sendMessage(player, messageConfig.getMessage(Messages.ERROR_NOT_IN_DUNGEON));
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -50,7 +50,7 @@ public class MsgCommand extends DCommand {
|
|||||||
MessageUtil.sendMessage(player, ChatColor.WHITE + msg);
|
MessageUtil.sendMessage(player, ChatColor.WHITE + msg);
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
MessageUtil.sendMessage(player, dMessages.getMessage(Messages.ERROR_MSG_ID_NOT_EXIST, "" + id));
|
MessageUtil.sendMessage(player, messageConfig.getMessage(Messages.ERROR_MSG_ID_NOT_EXIST, "" + id));
|
||||||
}
|
}
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
@ -69,22 +69,22 @@ public class MsgCommand extends DCommand {
|
|||||||
msg = splitMsg[1];
|
msg = splitMsg[1];
|
||||||
String old = confreader.getMsg(id, false);
|
String old = confreader.getMsg(id, false);
|
||||||
if (old == null) {
|
if (old == null) {
|
||||||
MessageUtil.sendMessage(player, dMessages.getMessage(Messages.CMD_MSG_ADDED, "" + id));
|
MessageUtil.sendMessage(player, messageConfig.getMessage(Messages.CMD_MSG_ADDED, "" + id));
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
MessageUtil.sendMessage(player, dMessages.getMessage(Messages.CMD_MSG_UPDATED, "" + id));
|
MessageUtil.sendMessage(player, messageConfig.getMessage(Messages.CMD_MSG_UPDATED, "" + id));
|
||||||
}
|
}
|
||||||
|
|
||||||
confreader.setMsg(msg, id);
|
confreader.setMsg(msg, id);
|
||||||
confreader.save();
|
confreader.save();
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
MessageUtil.sendMessage(player, dMessages.getMessage(Messages.ERROR_MSG_FORMAT));
|
MessageUtil.sendMessage(player, messageConfig.getMessage(Messages.ERROR_MSG_FORMAT));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
} catch (NumberFormatException e) {
|
} catch (NumberFormatException e) {
|
||||||
MessageUtil.sendMessage(player, dMessages.getMessage(Messages.ERROR_MSG_NO_INT));
|
MessageUtil.sendMessage(player, messageConfig.getMessage(Messages.ERROR_MSG_NO_INT));
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -1,11 +1,11 @@
|
|||||||
package io.github.dre2n.dungeonsxl.command;
|
package io.github.dre2n.dungeonsxl.command;
|
||||||
|
|
||||||
|
import io.github.dre2n.dungeonsxl.config.WorldConfig;
|
||||||
|
import io.github.dre2n.dungeonsxl.config.MessageConfig.Messages;
|
||||||
import io.github.dre2n.dungeonsxl.dungeon.Dungeon;
|
import io.github.dre2n.dungeonsxl.dungeon.Dungeon;
|
||||||
import io.github.dre2n.dungeonsxl.dungeon.WorldConfig;
|
|
||||||
import io.github.dre2n.dungeonsxl.dungeon.EditWorld;
|
import io.github.dre2n.dungeonsxl.dungeon.EditWorld;
|
||||||
import io.github.dre2n.dungeonsxl.dungeon.game.GameWorld;
|
import io.github.dre2n.dungeonsxl.dungeon.game.GameWorld;
|
||||||
import io.github.dre2n.dungeonsxl.event.dgroup.DGroupCreateEvent;
|
import io.github.dre2n.dungeonsxl.event.dgroup.DGroupCreateEvent;
|
||||||
import io.github.dre2n.dungeonsxl.file.DMessages.Messages;
|
|
||||||
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.DPlayer;
|
||||||
import io.github.dre2n.dungeonsxl.util.messageutil.MessageUtil;
|
import io.github.dre2n.dungeonsxl.util.messageutil.MessageUtil;
|
||||||
@ -21,7 +21,7 @@ public class PlayCommand extends DCommand {
|
|||||||
setCommand("play");
|
setCommand("play");
|
||||||
setMinArgs(1);
|
setMinArgs(1);
|
||||||
setMaxArgs(2);
|
setMaxArgs(2);
|
||||||
setHelp(dMessages.getMessage(Messages.HELP_CMD_PLAY));
|
setHelp(messageConfig.getMessage(Messages.HELP_CMD_PLAY));
|
||||||
setPermission("dxl.play");
|
setPermission("dxl.play");
|
||||||
setPlayerCommand(true);
|
setPlayerCommand(true);
|
||||||
}
|
}
|
||||||
@ -32,7 +32,7 @@ public class PlayCommand extends DCommand {
|
|||||||
DPlayer dplayer = DPlayer.getByPlayer(player);
|
DPlayer dplayer = DPlayer.getByPlayer(player);
|
||||||
|
|
||||||
if (dplayer != null) {
|
if (dplayer != null) {
|
||||||
MessageUtil.sendMessage(player, dMessages.getMessage(Messages.ERROR_LEAVE_DUNGEON));
|
MessageUtil.sendMessage(player, messageConfig.getMessage(Messages.ERROR_LEAVE_DUNGEON));
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -63,8 +63,8 @@ public class PlayCommand extends DCommand {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if ( !multiFloor && !EditWorld.exist(identifier)) {
|
if ( !multiFloor && !EditWorld.exists(identifier)) {
|
||||||
MessageUtil.sendMessage(player, dMessages.getMessage(Messages.ERROR_DUNGEON_NOT_EXIST, identifier));
|
MessageUtil.sendMessage(player, messageConfig.getMessage(Messages.ERROR_DUNGEON_NOT_EXIST, identifier));
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -75,19 +75,19 @@ public class PlayCommand extends DCommand {
|
|||||||
WorldConfig confReader = new WorldConfig(file);
|
WorldConfig confReader = new WorldConfig(file);
|
||||||
|
|
||||||
if (confReader != null) {
|
if (confReader != null) {
|
||||||
MessageUtil.sendMessage(player, dMessages.getMessage(Messages.ERROR_COOLDOWN, "" + confReader.getTimeToNextPlay()));
|
MessageUtil.sendMessage(player, messageConfig.getMessage(Messages.ERROR_COOLDOWN, "" + confReader.getTimeToNextPlay()));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if ( !GameWorld.checkRequirements(mapName, player)) {
|
if ( !GameWorld.checkRequirements(mapName, player)) {
|
||||||
MessageUtil.sendMessage(player, dMessages.getMessage(Messages.ERROR_REQUIREMENTS));
|
MessageUtil.sendMessage(player, messageConfig.getMessage(Messages.ERROR_REQUIREMENTS));
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (DGroup.getByPlayer(player) != null) {
|
if (DGroup.getByPlayer(player) != null) {
|
||||||
MessageUtil.sendMessage(player, dMessages.getMessage(Messages.ERROR_LEAVE_GROUP));
|
MessageUtil.sendMessage(player, messageConfig.getMessage(Messages.ERROR_LEAVE_GROUP));
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -108,7 +108,7 @@ public class PlayCommand extends DCommand {
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (dGroup.getGameWorld() == null) {
|
if (dGroup.getGameWorld() == null) {
|
||||||
MessageUtil.sendMessage(player, dMessages.getMessage(Messages.ERROR_NOT_SAVED, DGroup.getByPlayer(player).getMapName()));
|
MessageUtil.sendMessage(player, messageConfig.getMessage(Messages.ERROR_NOT_SAVED, DGroup.getByPlayer(player).getMapName()));
|
||||||
dGroup.remove();
|
dGroup.remove();
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
package io.github.dre2n.dungeonsxl.command;
|
package io.github.dre2n.dungeonsxl.command;
|
||||||
|
|
||||||
import io.github.dre2n.dungeonsxl.file.DMessages.Messages;
|
import io.github.dre2n.dungeonsxl.config.MessageConfig.Messages;
|
||||||
import io.github.dre2n.dungeonsxl.global.DPortal;
|
import io.github.dre2n.dungeonsxl.global.DPortal;
|
||||||
import io.github.dre2n.dungeonsxl.player.DPlayer;
|
import io.github.dre2n.dungeonsxl.player.DPlayer;
|
||||||
import io.github.dre2n.dungeonsxl.util.messageutil.MessageUtil;
|
import io.github.dre2n.dungeonsxl.util.messageutil.MessageUtil;
|
||||||
@ -16,7 +16,7 @@ public class PortalCommand extends DCommand {
|
|||||||
setCommand("portal");
|
setCommand("portal");
|
||||||
setMinArgs(0);
|
setMinArgs(0);
|
||||||
setMaxArgs(0);
|
setMaxArgs(0);
|
||||||
setHelp(dMessages.getMessage(Messages.HELP_CMD_PORTAL));
|
setHelp(messageConfig.getMessage(Messages.HELP_CMD_PORTAL));
|
||||||
setPermission("dxl.portal");
|
setPermission("dxl.portal");
|
||||||
setPlayerCommand(true);
|
setPlayerCommand(true);
|
||||||
}
|
}
|
||||||
@ -27,7 +27,7 @@ public class PortalCommand extends DCommand {
|
|||||||
DPlayer dPlayer = DPlayer.getByPlayer(player);
|
DPlayer dPlayer = DPlayer.getByPlayer(player);
|
||||||
|
|
||||||
if (dPlayer != null) {
|
if (dPlayer != null) {
|
||||||
MessageUtil.sendMessage(player, dMessages.getMessage(Messages.ERROR_LEAVE_DUNGEON));
|
MessageUtil.sendMessage(player, messageConfig.getMessage(Messages.ERROR_LEAVE_DUNGEON));
|
||||||
}
|
}
|
||||||
|
|
||||||
DPortal dPortal = DPortal.getByPlayer(player);
|
DPortal dPortal = DPortal.getByPlayer(player);
|
||||||
@ -37,11 +37,11 @@ public class PortalCommand extends DCommand {
|
|||||||
dPortal.setPlayer(player);
|
dPortal.setPlayer(player);
|
||||||
dPortal.setWorld(player.getWorld());
|
dPortal.setWorld(player.getWorld());
|
||||||
player.getInventory().setItemInHand(new ItemStack(Material.WOOD_SWORD));
|
player.getInventory().setItemInHand(new ItemStack(Material.WOOD_SWORD));
|
||||||
MessageUtil.sendMessage(player, dMessages.getMessage(Messages.PLAYER_PORTAL_INTRODUCTION));
|
MessageUtil.sendMessage(player, messageConfig.getMessage(Messages.PLAYER_PORTAL_INTRODUCTION));
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
plugin.getDPortals().remove(dPortal);
|
plugin.getDPortals().remove(dPortal);
|
||||||
MessageUtil.sendMessage(player, dMessages.getMessage(Messages.PLAYER_PORTAL_ABORT));
|
MessageUtil.sendMessage(player, messageConfig.getMessage(Messages.PLAYER_PORTAL_ABORT));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
package io.github.dre2n.dungeonsxl.command;
|
package io.github.dre2n.dungeonsxl.command;
|
||||||
|
|
||||||
import io.github.dre2n.dungeonsxl.DungeonsXL;
|
import io.github.dre2n.dungeonsxl.DungeonsXL;
|
||||||
import io.github.dre2n.dungeonsxl.file.DMessages.Messages;
|
import io.github.dre2n.dungeonsxl.config.MessageConfig.Messages;
|
||||||
import io.github.dre2n.dungeonsxl.util.VersionUtil.Internals;
|
import io.github.dre2n.dungeonsxl.util.VersionUtil.Internals;
|
||||||
import io.github.dre2n.dungeonsxl.util.messageutil.MessageUtil;
|
import io.github.dre2n.dungeonsxl.util.messageutil.MessageUtil;
|
||||||
|
|
||||||
@ -17,7 +17,7 @@ public class ReloadCommand extends DCommand {
|
|||||||
setCommand("reload");
|
setCommand("reload");
|
||||||
setMinArgs(0);
|
setMinArgs(0);
|
||||||
setMaxArgs(0);
|
setMaxArgs(0);
|
||||||
setHelp(dMessages.getMessage(Messages.HELP_CMD_RELOAD));
|
setHelp(messageConfig.getMessage(Messages.HELP_CMD_RELOAD));
|
||||||
setPermission("dxl.reload");
|
setPermission("dxl.reload");
|
||||||
setPlayerCommand(true);
|
setPlayerCommand(true);
|
||||||
setConsoleCommand(true);
|
setConsoleCommand(true);
|
||||||
@ -43,19 +43,19 @@ public class ReloadCommand extends DCommand {
|
|||||||
|
|
||||||
// Save
|
// Save
|
||||||
plugin.saveData();
|
plugin.saveData();
|
||||||
plugin.getDMessages().save();
|
plugin.getMessageConfig().save();
|
||||||
|
|
||||||
// Load Config
|
// Load Config
|
||||||
plugin.loadMainConfig(new File(plugin.getDataFolder(), "config.yml"));
|
plugin.loadMainConfig(new File(plugin.getDataFolder(), "config.yml"));
|
||||||
plugin.loadDMessages(new File(plugin.getDataFolder(), "languages/" + plugin.getMainConfig().getLanguage() + ".yml"));
|
plugin.loadMessageConfig(new File(plugin.getDataFolder(), "languages/" + plugin.getMainConfig().getLanguage() + ".yml"));
|
||||||
plugin.loadVersionUtil();
|
plugin.loadVersionUtil();
|
||||||
plugin.loadDCommands();
|
plugin.loadDCommands();
|
||||||
plugin.loadDungeons();
|
plugin.loadDungeons();
|
||||||
|
|
||||||
MessageUtil.sendPluginTag(sender, plugin);
|
MessageUtil.sendPluginTag(sender, plugin);
|
||||||
MessageUtil.sendCenteredMessage(sender, dMessages.getMessage(Messages.CMD_RELOAD_DONE));
|
MessageUtil.sendCenteredMessage(sender, messageConfig.getMessage(Messages.CMD_RELOAD_DONE));
|
||||||
MessageUtil.sendCenteredMessage(sender, dMessages.getMessage(Messages.CMD_MAIN_LOADED, String.valueOf(maps), String.valueOf(dungeons), String.valueOf(loaded), String.valueOf(players)));
|
MessageUtil.sendCenteredMessage(sender, messageConfig.getMessage(Messages.CMD_MAIN_LOADED, String.valueOf(maps), String.valueOf(dungeons), String.valueOf(loaded), String.valueOf(players)));
|
||||||
MessageUtil.sendCenteredMessage(sender, dMessages.getMessage(Messages.CMD_MAIN_COMPATIBILITY, String.valueOf(internals), vault, mythicMobs));
|
MessageUtil.sendCenteredMessage(sender, messageConfig.getMessage(Messages.CMD_MAIN_COMPATIBILITY, String.valueOf(internals), vault, mythicMobs));
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
package io.github.dre2n.dungeonsxl.command;
|
package io.github.dre2n.dungeonsxl.command;
|
||||||
|
|
||||||
|
import io.github.dre2n.dungeonsxl.config.MessageConfig.Messages;
|
||||||
import io.github.dre2n.dungeonsxl.dungeon.EditWorld;
|
import io.github.dre2n.dungeonsxl.dungeon.EditWorld;
|
||||||
import io.github.dre2n.dungeonsxl.file.DMessages.Messages;
|
|
||||||
import io.github.dre2n.dungeonsxl.util.messageutil.MessageUtil;
|
import io.github.dre2n.dungeonsxl.util.messageutil.MessageUtil;
|
||||||
|
|
||||||
import org.bukkit.command.CommandSender;
|
import org.bukkit.command.CommandSender;
|
||||||
@ -13,7 +13,7 @@ public class SaveCommand extends DCommand {
|
|||||||
setCommand("save");
|
setCommand("save");
|
||||||
setMinArgs(0);
|
setMinArgs(0);
|
||||||
setMaxArgs(0);
|
setMaxArgs(0);
|
||||||
setHelp(dMessages.getMessage(Messages.HELP_CMD_SAVE));
|
setHelp(messageConfig.getMessage(Messages.HELP_CMD_SAVE));
|
||||||
setPermission("dxl.save");
|
setPermission("dxl.save");
|
||||||
setPlayerCommand(true);
|
setPlayerCommand(true);
|
||||||
}
|
}
|
||||||
@ -24,10 +24,10 @@ public class SaveCommand extends DCommand {
|
|||||||
EditWorld editWorld = EditWorld.getByWorld(player.getWorld());
|
EditWorld editWorld = EditWorld.getByWorld(player.getWorld());
|
||||||
if (editWorld != null) {
|
if (editWorld != null) {
|
||||||
editWorld.save();
|
editWorld.save();
|
||||||
MessageUtil.sendMessage(player, dMessages.getMessage(Messages.CMD_SAVE_SUCCESS));
|
MessageUtil.sendMessage(player, messageConfig.getMessage(Messages.CMD_SAVE_SUCCESS));
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
MessageUtil.sendMessage(player, dMessages.getMessage(Messages.ERROR_NOT_IN_DUNGEON));
|
MessageUtil.sendMessage(player, messageConfig.getMessage(Messages.ERROR_NOT_IN_DUNGEON));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1,10 +1,10 @@
|
|||||||
package io.github.dre2n.dungeonsxl.command;
|
package io.github.dre2n.dungeonsxl.command;
|
||||||
|
|
||||||
|
import io.github.dre2n.dungeonsxl.config.MessageConfig.Messages;
|
||||||
import io.github.dre2n.dungeonsxl.dungeon.Dungeon;
|
import io.github.dre2n.dungeonsxl.dungeon.Dungeon;
|
||||||
import io.github.dre2n.dungeonsxl.dungeon.EditWorld;
|
import io.github.dre2n.dungeonsxl.dungeon.EditWorld;
|
||||||
import io.github.dre2n.dungeonsxl.dungeon.game.GameWorld;
|
import io.github.dre2n.dungeonsxl.dungeon.game.GameWorld;
|
||||||
import io.github.dre2n.dungeonsxl.event.dgroup.DGroupCreateEvent;
|
import io.github.dre2n.dungeonsxl.event.dgroup.DGroupCreateEvent;
|
||||||
import io.github.dre2n.dungeonsxl.file.DMessages.Messages;
|
|
||||||
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.DPlayer;
|
||||||
import io.github.dre2n.dungeonsxl.util.messageutil.MessageUtil;
|
import io.github.dre2n.dungeonsxl.util.messageutil.MessageUtil;
|
||||||
@ -18,7 +18,7 @@ public class TestCommand extends DCommand {
|
|||||||
setCommand("test");
|
setCommand("test");
|
||||||
setMinArgs(1);
|
setMinArgs(1);
|
||||||
setMaxArgs(2);
|
setMaxArgs(2);
|
||||||
setHelp(dMessages.getMessage(Messages.HELP_CMD_TEST));
|
setHelp(messageConfig.getMessage(Messages.HELP_CMD_TEST));
|
||||||
setPermission("dxl.test");
|
setPermission("dxl.test");
|
||||||
setPlayerCommand(true);
|
setPlayerCommand(true);
|
||||||
}
|
}
|
||||||
@ -29,7 +29,7 @@ public class TestCommand extends DCommand {
|
|||||||
DPlayer dplayer = DPlayer.getByPlayer(player);
|
DPlayer dplayer = DPlayer.getByPlayer(player);
|
||||||
|
|
||||||
if (dplayer != null) {
|
if (dplayer != null) {
|
||||||
MessageUtil.sendMessage(player, dMessages.getMessage(Messages.ERROR_LEAVE_DUNGEON));
|
MessageUtil.sendMessage(player, messageConfig.getMessage(Messages.ERROR_LEAVE_DUNGEON));
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -57,13 +57,13 @@ public class TestCommand extends DCommand {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if ( !multiFloor && !EditWorld.exist(identifier)) {
|
if ( !multiFloor && !EditWorld.exists(identifier)) {
|
||||||
MessageUtil.sendMessage(player, dMessages.getMessage(Messages.ERROR_DUNGEON_NOT_EXIST, identifier));
|
MessageUtil.sendMessage(player, messageConfig.getMessage(Messages.ERROR_DUNGEON_NOT_EXIST, identifier));
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (DGroup.getByPlayer(player) != null) {
|
if (DGroup.getByPlayer(player) != null) {
|
||||||
MessageUtil.sendMessage(player, dMessages.getMessage(Messages.ERROR_LEAVE_GROUP));
|
MessageUtil.sendMessage(player, messageConfig.getMessage(Messages.ERROR_LEAVE_GROUP));
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -84,7 +84,7 @@ public class TestCommand extends DCommand {
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (dGroup.getGameWorld() == null) {
|
if (dGroup.getGameWorld() == null) {
|
||||||
MessageUtil.sendMessage(player, dMessages.getMessage(Messages.ERROR_NOT_SAVED, DGroup.getByPlayer(player).getMapName()));
|
MessageUtil.sendMessage(player, messageConfig.getMessage(Messages.ERROR_NOT_SAVED, DGroup.getByPlayer(player).getMapName()));
|
||||||
dGroup.remove();
|
dGroup.remove();
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
package io.github.dre2n.dungeonsxl.command;
|
package io.github.dre2n.dungeonsxl.command;
|
||||||
|
|
||||||
|
import io.github.dre2n.dungeonsxl.config.MessageConfig.Messages;
|
||||||
import io.github.dre2n.dungeonsxl.dungeon.EditWorld;
|
import io.github.dre2n.dungeonsxl.dungeon.EditWorld;
|
||||||
import io.github.dre2n.dungeonsxl.file.DMessages.Messages;
|
|
||||||
import io.github.dre2n.dungeonsxl.util.UUIDUtil;
|
import io.github.dre2n.dungeonsxl.util.UUIDUtil;
|
||||||
import io.github.dre2n.dungeonsxl.util.messageutil.MessageUtil;
|
import io.github.dre2n.dungeonsxl.util.messageutil.MessageUtil;
|
||||||
|
|
||||||
@ -13,7 +13,7 @@ public class UninviteCommand extends DCommand {
|
|||||||
setCommand("uninvite");
|
setCommand("uninvite");
|
||||||
setMinArgs(2);
|
setMinArgs(2);
|
||||||
setMaxArgs(2);
|
setMaxArgs(2);
|
||||||
setHelp(dMessages.getMessage(Messages.HELP_CMD_UNINVITE));
|
setHelp(messageConfig.getMessage(Messages.HELP_CMD_UNINVITE));
|
||||||
setPermission("dxl.uninvite");
|
setPermission("dxl.uninvite");
|
||||||
setPlayerCommand(true);
|
setPlayerCommand(true);
|
||||||
setConsoleCommand(true);
|
setConsoleCommand(true);
|
||||||
@ -22,10 +22,10 @@ public class UninviteCommand extends DCommand {
|
|||||||
@Override
|
@Override
|
||||||
public void onExecute(String[] args, CommandSender sender) {
|
public void onExecute(String[] args, CommandSender sender) {
|
||||||
if (EditWorld.removeInvitedPlayer(args[2], UUIDUtil.getUniqueIdFromName(args[1]), args[1])) {
|
if (EditWorld.removeInvitedPlayer(args[2], UUIDUtil.getUniqueIdFromName(args[1]), args[1])) {
|
||||||
MessageUtil.sendMessage(sender, dMessages.getMessage(Messages.CMD_UNINVITE_SUCCESS, args[1], args[2]));
|
MessageUtil.sendMessage(sender, messageConfig.getMessage(Messages.CMD_UNINVITE_SUCCESS, args[1], args[2]));
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
MessageUtil.sendMessage(sender, dMessages.getMessage(Messages.ERROR_DUNGEON_NOT_EXIST, args[2]));
|
MessageUtil.sendMessage(sender, messageConfig.getMessage(Messages.ERROR_DUNGEON_NOT_EXIST, args[2]));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
package io.github.dre2n.dungeonsxl.dungeon;
|
package io.github.dre2n.dungeonsxl.config;
|
||||||
|
|
||||||
import java.io.File;
|
import java.io.File;
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
@ -1,6 +1,4 @@
|
|||||||
package io.github.dre2n.dungeonsxl.file;
|
package io.github.dre2n.dungeonsxl.config;
|
||||||
|
|
||||||
import io.github.dre2n.dungeonsxl.dungeon.WorldConfig;
|
|
||||||
|
|
||||||
import java.io.File;
|
import java.io.File;
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
@ -23,7 +21,7 @@ public class MainConfig {
|
|||||||
private String tutorialEndGroup = "player";
|
private String tutorialEndGroup = "player";
|
||||||
|
|
||||||
/* Default Dungeon Settings */
|
/* Default Dungeon Settings */
|
||||||
public WorldConfig defaultDungeon;
|
private WorldConfig defaultWorldConfig;
|
||||||
|
|
||||||
private List<String> editCommandWhitelist = new ArrayList<String>();
|
private List<String> editCommandWhitelist = new ArrayList<String>();
|
||||||
|
|
||||||
@ -92,8 +90,8 @@ public class MainConfig {
|
|||||||
/* Default Dungeon Config */
|
/* Default Dungeon Config */
|
||||||
ConfigurationSection configSection = configFile.getConfigurationSection("default");
|
ConfigurationSection configSection = configFile.getConfigurationSection("default");
|
||||||
if (configSection != null) {
|
if (configSection != null) {
|
||||||
defaultDungeon = new WorldConfig(configSection);
|
setDefaultWorldConfig(new WorldConfig(configSection));
|
||||||
WorldConfig.defaultConfig = defaultDungeon;
|
WorldConfig.defaultConfig = defaultWorldConfig;// TODO
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -155,4 +153,19 @@ public class MainConfig {
|
|||||||
return editCommandWhitelist;
|
return editCommandWhitelist;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @return the defaultWorldConfig
|
||||||
|
*/
|
||||||
|
public WorldConfig getDefaultWorldConfig() {
|
||||||
|
return defaultWorldConfig;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param defaultWorldConfig
|
||||||
|
* the defaultWorldConfig to set
|
||||||
|
*/
|
||||||
|
public void setDefaultWorldConfig(WorldConfig defaultWorldConfig) {
|
||||||
|
this.defaultWorldConfig = defaultWorldConfig;
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
@ -1,4 +1,4 @@
|
|||||||
package io.github.dre2n.dungeonsxl.file;
|
package io.github.dre2n.dungeonsxl.config;
|
||||||
|
|
||||||
import java.io.File;
|
import java.io.File;
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
@ -7,7 +7,7 @@ import java.util.Set;
|
|||||||
import org.bukkit.configuration.file.FileConfiguration;
|
import org.bukkit.configuration.file.FileConfiguration;
|
||||||
import org.bukkit.configuration.file.YamlConfiguration;
|
import org.bukkit.configuration.file.YamlConfiguration;
|
||||||
|
|
||||||
public class DMessages {
|
public class MessageConfig {
|
||||||
|
|
||||||
public enum Messages {
|
public enum Messages {
|
||||||
|
|
||||||
@ -175,7 +175,7 @@ public class DMessages {
|
|||||||
private File file;
|
private File file;
|
||||||
private FileConfiguration config;
|
private FileConfiguration config;
|
||||||
|
|
||||||
public DMessages(File file) {
|
public MessageConfig(File file) {
|
||||||
this.file = file;
|
this.file = file;
|
||||||
|
|
||||||
if ( !file.exists()) {
|
if ( !file.exists()) {
|
@ -1,4 +1,4 @@
|
|||||||
package io.github.dre2n.dungeonsxl.dungeon;
|
package io.github.dre2n.dungeonsxl.config;
|
||||||
|
|
||||||
import io.github.dre2n.dungeonsxl.DungeonsXL;
|
import io.github.dre2n.dungeonsxl.DungeonsXL;
|
||||||
import io.github.dre2n.dungeonsxl.mob.DMobType;
|
import io.github.dre2n.dungeonsxl.mob.DMobType;
|
||||||
@ -31,6 +31,7 @@ public class WorldConfig {
|
|||||||
|
|
||||||
static DungeonsXL plugin = DungeonsXL.getPlugin();
|
static DungeonsXL plugin = DungeonsXL.getPlugin();
|
||||||
|
|
||||||
|
@Deprecated
|
||||||
public static WorldConfig defaultConfig = new WorldConfig();
|
public static WorldConfig defaultConfig = new WorldConfig();
|
||||||
|
|
||||||
private File file;
|
private File file;
|
@ -1,7 +1,7 @@
|
|||||||
package io.github.dre2n.dungeonsxl.dungeon;
|
package io.github.dre2n.dungeonsxl.dungeon;
|
||||||
|
|
||||||
import io.github.dre2n.dungeonsxl.DungeonsXL;
|
import io.github.dre2n.dungeonsxl.DungeonsXL;
|
||||||
import io.github.dre2n.dungeonsxl.file.DMessages.Messages;
|
import io.github.dre2n.dungeonsxl.config.MessageConfig.Messages;
|
||||||
|
|
||||||
import org.bukkit.Bukkit;
|
import org.bukkit.Bukkit;
|
||||||
import org.bukkit.ChatColor;
|
import org.bukkit.ChatColor;
|
||||||
@ -23,7 +23,7 @@ public class DLootInventory {
|
|||||||
public DLootInventory(Player player, ItemStack[] itemStacks) {
|
public DLootInventory(Player player, ItemStack[] itemStacks) {
|
||||||
plugin.getDLootInventories().add(this);
|
plugin.getDLootInventories().add(this);
|
||||||
|
|
||||||
inventory = Bukkit.createInventory(player, 54, ChatColor.translateAlternateColorCodes('&', plugin.getDMessages().getMessage(Messages.PLAYER_TREASURES)));
|
inventory = Bukkit.createInventory(player, 54, ChatColor.translateAlternateColorCodes('&', plugin.getMessageConfig().getMessage(Messages.PLAYER_TREASURES)));
|
||||||
for (ItemStack itemStack : itemStacks) {
|
for (ItemStack itemStack : itemStacks) {
|
||||||
if (itemStack != null) {
|
if (itemStack != null) {
|
||||||
inventory.addItem(itemStack);
|
inventory.addItem(itemStack);
|
||||||
@ -32,20 +32,6 @@ public class DLootInventory {
|
|||||||
this.player = player;
|
this.player = player;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* @param player
|
|
||||||
* the player whose DLootIntentory will be returned
|
|
||||||
*/
|
|
||||||
public static DLootInventory getByPlayer(Player player) {
|
|
||||||
for (DLootInventory inventory : plugin.getDLootInventories()) {
|
|
||||||
if (inventory.player == player) {
|
|
||||||
return inventory;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @return the inventory
|
* @return the inventory
|
||||||
*/
|
*/
|
||||||
@ -106,4 +92,20 @@ public class DLootInventory {
|
|||||||
this.time = time;
|
this.time = time;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Static
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param player
|
||||||
|
* the player whose DLootIntentory will be returned
|
||||||
|
*/
|
||||||
|
public static DLootInventory getByPlayer(Player player) {
|
||||||
|
for (DLootInventory inventory : plugin.getDLootInventories()) {
|
||||||
|
if (inventory.player == player) {
|
||||||
|
return inventory;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -1,6 +1,7 @@
|
|||||||
package io.github.dre2n.dungeonsxl.dungeon;
|
package io.github.dre2n.dungeonsxl.dungeon;
|
||||||
|
|
||||||
import io.github.dre2n.dungeonsxl.DungeonsXL;
|
import io.github.dre2n.dungeonsxl.DungeonsXL;
|
||||||
|
import io.github.dre2n.dungeonsxl.config.DungeonConfig;
|
||||||
|
|
||||||
import java.io.File;
|
import java.io.File;
|
||||||
|
|
||||||
|
@ -1,6 +1,7 @@
|
|||||||
package io.github.dre2n.dungeonsxl.dungeon;
|
package io.github.dre2n.dungeonsxl.dungeon;
|
||||||
|
|
||||||
import io.github.dre2n.dungeonsxl.DungeonsXL;
|
import io.github.dre2n.dungeonsxl.DungeonsXL;
|
||||||
|
import io.github.dre2n.dungeonsxl.config.WorldConfig;
|
||||||
import io.github.dre2n.dungeonsxl.event.editworld.EditWorldGenerateEvent;
|
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;
|
||||||
@ -64,277 +65,6 @@ public class EditWorld {
|
|||||||
name = "DXL_Edit_" + id;
|
name = "DXL_Edit_" + id;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void generate() {
|
|
||||||
WorldCreator creator = WorldCreator.name(name);
|
|
||||||
creator.type(WorldType.FLAT);
|
|
||||||
creator.generateStructures(false);
|
|
||||||
|
|
||||||
EditWorldGenerateEvent event = new EditWorldGenerateEvent(this);
|
|
||||||
|
|
||||||
if (event.isCancelled()) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
world = plugin.getServer().createWorld(creator);
|
|
||||||
}
|
|
||||||
|
|
||||||
public void save() {
|
|
||||||
EditWorldSaveEvent event = new EditWorldSaveEvent(this);
|
|
||||||
|
|
||||||
if (event.isCancelled()) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
world.save();
|
|
||||||
|
|
||||||
File dir = new File("DXL_Edit_" + id);
|
|
||||||
FileUtil.copyDirectory(dir, new File(plugin.getDataFolder(), "/maps/" + mapName));
|
|
||||||
FileUtil.deleteUnusedFiles(new File(plugin.getDataFolder(), "/maps/" + mapName));
|
|
||||||
|
|
||||||
try {
|
|
||||||
ObjectOutputStream out = new ObjectOutputStream(new FileOutputStream(new File(plugin.getDataFolder(), "/maps/" + mapName + "/DXLData.data")));
|
|
||||||
out.writeInt(sign.size());
|
|
||||||
for (Block sign : this.sign) {
|
|
||||||
out.writeInt(sign.getX());
|
|
||||||
out.writeInt(sign.getY());
|
|
||||||
out.writeInt(sign.getZ());
|
|
||||||
}
|
|
||||||
out.close();
|
|
||||||
|
|
||||||
} catch (IOException exception) {
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
public void checkSign(Block block) {
|
|
||||||
if (block.getState() instanceof Sign) {
|
|
||||||
Sign sign = (Sign) block.getState();
|
|
||||||
String[] lines = sign.getLines();
|
|
||||||
|
|
||||||
if (lines[0].equalsIgnoreCase("[lobby]")) {
|
|
||||||
lobby = block.getLocation();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
public void delete() {
|
|
||||||
EditWorldUnloadEvent event = new EditWorldUnloadEvent(this, true);
|
|
||||||
|
|
||||||
if (event.isCancelled()) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
plugin.getEditWorlds().remove(this);
|
|
||||||
for (Player player : world.getPlayers()) {
|
|
||||||
DPlayer dPlayer = DPlayer.getByPlayer(player);
|
|
||||||
dPlayer.leave();
|
|
||||||
}
|
|
||||||
|
|
||||||
plugin.getServer().unloadWorld(world, true);
|
|
||||||
File dir = new File("DXL_Edit_" + id);
|
|
||||||
FileUtil.copyDirectory(dir, new File(plugin.getDataFolder(), "/maps/" + mapName));
|
|
||||||
FileUtil.deleteUnusedFiles(new File(plugin.getDataFolder(), "/maps/" + mapName));
|
|
||||||
FileUtil.removeDirectory(dir);
|
|
||||||
}
|
|
||||||
|
|
||||||
public void deleteNoSave() {
|
|
||||||
EditWorldUnloadEvent event = new EditWorldUnloadEvent(this, false);
|
|
||||||
|
|
||||||
if (event.isCancelled()) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
plugin.getEditWorlds().remove(this);
|
|
||||||
for (Player player : world.getPlayers()) {
|
|
||||||
DPlayer dPlayer = DPlayer.getByPlayer(player);
|
|
||||||
dPlayer.leave();
|
|
||||||
}
|
|
||||||
|
|
||||||
File dir = new File("DXL_Edit_" + id);
|
|
||||||
FileUtil.copyDirectory(dir, new File(plugin.getDataFolder(), "/maps/" + mapName));
|
|
||||||
FileUtil.deleteUnusedFiles(new File(plugin.getDataFolder(), "/maps/" + mapName));
|
|
||||||
plugin.getServer().unloadWorld(world, true);
|
|
||||||
FileUtil.removeDirectory(dir);
|
|
||||||
}
|
|
||||||
|
|
||||||
// Static
|
|
||||||
public static EditWorld getByWorld(World world) {
|
|
||||||
for (EditWorld editWorld : plugin.getEditWorlds()) {
|
|
||||||
if (editWorld.world.equals(world)) {
|
|
||||||
return editWorld;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
|
|
||||||
public static EditWorld getByName(String name) {
|
|
||||||
for (EditWorld editWorld : plugin.getEditWorlds()) {
|
|
||||||
if (editWorld.mapName.equalsIgnoreCase(name)) {
|
|
||||||
return editWorld;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
|
|
||||||
public static void deleteAll() {
|
|
||||||
for (EditWorld editWorld : plugin.getEditWorlds()) {
|
|
||||||
editWorld.delete();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
public static EditWorld load(String name) {
|
|
||||||
EditWorldLoadEvent event = new EditWorldLoadEvent(name);
|
|
||||||
|
|
||||||
if (event.isCancelled()) {
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
|
|
||||||
for (EditWorld editWorld : plugin.getEditWorlds()) {
|
|
||||||
|
|
||||||
if (editWorld.mapName.equalsIgnoreCase(name)) {
|
|
||||||
return editWorld;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
File file = new File(plugin.getDataFolder(), "/maps/" + name);
|
|
||||||
|
|
||||||
if (file.exists()) {
|
|
||||||
EditWorld editWorld = new EditWorld();
|
|
||||||
editWorld.mapName = name;
|
|
||||||
// World
|
|
||||||
FileUtil.copyDirectory(file, new File("DXL_Edit_" + editWorld.id));
|
|
||||||
|
|
||||||
// Id File
|
|
||||||
File idFile = new File("DXL_Edit_" + editWorld.id + "/.id_" + name);
|
|
||||||
try {
|
|
||||||
idFile.createNewFile();
|
|
||||||
} catch (IOException e) {
|
|
||||||
e.printStackTrace();
|
|
||||||
}
|
|
||||||
|
|
||||||
editWorld.world = plugin.getServer().createWorld(WorldCreator.name("DXL_Edit_" + editWorld.id));
|
|
||||||
|
|
||||||
try {
|
|
||||||
ObjectInputStream os = new ObjectInputStream(new FileInputStream(new File(plugin.getDataFolder(), "/maps/" + editWorld.mapName + "/DXLData.data")));
|
|
||||||
int length = os.readInt();
|
|
||||||
for (int i = 0; i < length; i++) {
|
|
||||||
int x = os.readInt();
|
|
||||||
int y = os.readInt();
|
|
||||||
int z = os.readInt();
|
|
||||||
Block block = editWorld.world.getBlockAt(x, y, z);
|
|
||||||
editWorld.checkSign(block);
|
|
||||||
editWorld.sign.add(block);
|
|
||||||
}
|
|
||||||
os.close();
|
|
||||||
|
|
||||||
} catch (FileNotFoundException e) {
|
|
||||||
e.printStackTrace();
|
|
||||||
} catch (IOException e) {
|
|
||||||
e.printStackTrace();
|
|
||||||
}
|
|
||||||
|
|
||||||
return editWorld;
|
|
||||||
}
|
|
||||||
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
|
|
||||||
public static boolean exist(String name) {
|
|
||||||
// Cheack Loaded EditWorlds
|
|
||||||
for (EditWorld editWorld : plugin.getEditWorlds()) {
|
|
||||||
if (editWorld.mapName.equalsIgnoreCase(name)) {
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// Cheack Unloaded Worlds
|
|
||||||
File file = new File(plugin.getDataFolder(), "/maps/" + name);
|
|
||||||
|
|
||||||
if (file.exists()) {
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void msg(String msg) {
|
|
||||||
for (DPlayer dPlayer : DPlayer.getByWorld(world)) {
|
|
||||||
MessageUtil.sendMessage(dPlayer.getPlayer(), msg);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// Invite
|
|
||||||
public static boolean addInvitedPlayer(String editWorldName, UUID uuid) {
|
|
||||||
if ( !exist(editWorldName)) {
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
File file = new File(plugin.getDataFolder() + "/maps/" + editWorldName, "config.yml");
|
|
||||||
if ( !file.exists()) {
|
|
||||||
try {
|
|
||||||
file.createNewFile();
|
|
||||||
|
|
||||||
} catch (IOException exception) {
|
|
||||||
exception.printStackTrace();
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
WorldConfig config = new WorldConfig(file);
|
|
||||||
config.addInvitedPlayer(uuid.toString());
|
|
||||||
config.save();
|
|
||||||
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
public static boolean removeInvitedPlayer(String editWorldName, UUID uuid, String name) {
|
|
||||||
if ( !exist(editWorldName)) {
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
File file = new File(plugin.getDataFolder() + "/maps/" + editWorldName, "config.yml");
|
|
||||||
if ( !file.exists()) {
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
WorldConfig config = new WorldConfig(file);
|
|
||||||
config.removeInvitedPlayers(uuid.toString(), name.toLowerCase());
|
|
||||||
config.save();
|
|
||||||
|
|
||||||
// Kick Player
|
|
||||||
EditWorld editWorld = EditWorld.getByName(editWorldName);
|
|
||||||
if (editWorld != null) {
|
|
||||||
DPlayer player = DPlayer.getByName(name);
|
|
||||||
|
|
||||||
if (player != null) {
|
|
||||||
if (editWorld.world.getPlayers().contains(player.getPlayer())) {
|
|
||||||
player.leave();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
public static boolean isInvitedPlayer(String editWorldName, UUID uuid, String name) {
|
|
||||||
if ( !exist(editWorldName)) {
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
File file = new File(plugin.getDataFolder() + "/maps/" + editWorldName, "config.yml");
|
|
||||||
if ( !file.exists()) {
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
WorldConfig config = new WorldConfig(file);
|
|
||||||
// get player from both a 0.9.1 and lower and 0.9.2 and higher file
|
|
||||||
if (config.getInvitedPlayers().contains(name.toLowerCase()) || config.getInvitedPlayers().contains(uuid.toString())) {
|
|
||||||
return true;
|
|
||||||
|
|
||||||
} else {
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @return the world
|
* @return the world
|
||||||
*/
|
*/
|
||||||
@ -455,4 +185,276 @@ public class EditWorld {
|
|||||||
this.sign = sign;
|
this.sign = sign;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void generate() {
|
||||||
|
WorldCreator creator = WorldCreator.name(name);
|
||||||
|
creator.type(WorldType.FLAT);
|
||||||
|
creator.generateStructures(false);
|
||||||
|
|
||||||
|
EditWorldGenerateEvent event = new EditWorldGenerateEvent(this);
|
||||||
|
|
||||||
|
if (event.isCancelled()) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
world = plugin.getServer().createWorld(creator);
|
||||||
|
}
|
||||||
|
|
||||||
|
public void save() {
|
||||||
|
EditWorldSaveEvent event = new EditWorldSaveEvent(this);
|
||||||
|
|
||||||
|
if (event.isCancelled()) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
world.save();
|
||||||
|
|
||||||
|
File dir = new File("DXL_Edit_" + id);
|
||||||
|
FileUtil.copyDirectory(dir, new File(plugin.getDataFolder(), "/maps/" + mapName));
|
||||||
|
FileUtil.deleteUnusedFiles(new File(plugin.getDataFolder(), "/maps/" + mapName));
|
||||||
|
|
||||||
|
try {
|
||||||
|
ObjectOutputStream out = new ObjectOutputStream(new FileOutputStream(new File(plugin.getDataFolder(), "/maps/" + mapName + "/DXLData.data")));
|
||||||
|
out.writeInt(sign.size());
|
||||||
|
for (Block sign : this.sign) {
|
||||||
|
out.writeInt(sign.getX());
|
||||||
|
out.writeInt(sign.getY());
|
||||||
|
out.writeInt(sign.getZ());
|
||||||
|
}
|
||||||
|
out.close();
|
||||||
|
|
||||||
|
} catch (IOException exception) {
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public void checkSign(Block block) {
|
||||||
|
if (block.getState() instanceof Sign) {
|
||||||
|
Sign sign = (Sign) block.getState();
|
||||||
|
String[] lines = sign.getLines();
|
||||||
|
|
||||||
|
if (lines[0].equalsIgnoreCase("[lobby]")) {
|
||||||
|
lobby = block.getLocation();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public void delete() {
|
||||||
|
EditWorldUnloadEvent event = new EditWorldUnloadEvent(this, true);
|
||||||
|
|
||||||
|
if (event.isCancelled()) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
plugin.getEditWorlds().remove(this);
|
||||||
|
for (Player player : world.getPlayers()) {
|
||||||
|
DPlayer dPlayer = DPlayer.getByPlayer(player);
|
||||||
|
dPlayer.leave();
|
||||||
|
}
|
||||||
|
|
||||||
|
plugin.getServer().unloadWorld(world, true);
|
||||||
|
File dir = new File("DXL_Edit_" + id);
|
||||||
|
FileUtil.copyDirectory(dir, new File(plugin.getDataFolder(), "/maps/" + mapName));
|
||||||
|
FileUtil.deleteUnusedFiles(new File(plugin.getDataFolder(), "/maps/" + mapName));
|
||||||
|
FileUtil.removeDirectory(dir);
|
||||||
|
}
|
||||||
|
|
||||||
|
public void deleteNoSave() {
|
||||||
|
EditWorldUnloadEvent event = new EditWorldUnloadEvent(this, false);
|
||||||
|
|
||||||
|
if (event.isCancelled()) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
plugin.getEditWorlds().remove(this);
|
||||||
|
for (Player player : world.getPlayers()) {
|
||||||
|
DPlayer dPlayer = DPlayer.getByPlayer(player);
|
||||||
|
dPlayer.leave();
|
||||||
|
}
|
||||||
|
|
||||||
|
File dir = new File("DXL_Edit_" + id);
|
||||||
|
FileUtil.copyDirectory(dir, new File(plugin.getDataFolder(), "/maps/" + mapName));
|
||||||
|
FileUtil.deleteUnusedFiles(new File(plugin.getDataFolder(), "/maps/" + mapName));
|
||||||
|
plugin.getServer().unloadWorld(world, true);
|
||||||
|
FileUtil.removeDirectory(dir);
|
||||||
|
}
|
||||||
|
|
||||||
|
public void sendMessage(String message) {
|
||||||
|
for (DPlayer dPlayer : DPlayer.getByWorld(world)) {
|
||||||
|
MessageUtil.sendMessage(dPlayer.getPlayer(), message);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// Static
|
||||||
|
|
||||||
|
public static EditWorld getByWorld(World world) {
|
||||||
|
for (EditWorld editWorld : plugin.getEditWorlds()) {
|
||||||
|
if (editWorld.world.equals(world)) {
|
||||||
|
return editWorld;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
public static EditWorld getByName(String name) {
|
||||||
|
for (EditWorld editWorld : plugin.getEditWorlds()) {
|
||||||
|
if (editWorld.mapName.equalsIgnoreCase(name)) {
|
||||||
|
return editWorld;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
public static void deleteAll() {
|
||||||
|
for (EditWorld editWorld : plugin.getEditWorlds()) {
|
||||||
|
editWorld.delete();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public static EditWorld load(String name) {
|
||||||
|
EditWorldLoadEvent event = new EditWorldLoadEvent(name);
|
||||||
|
|
||||||
|
if (event.isCancelled()) {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
for (EditWorld editWorld : plugin.getEditWorlds()) {
|
||||||
|
|
||||||
|
if (editWorld.mapName.equalsIgnoreCase(name)) {
|
||||||
|
return editWorld;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
File file = new File(plugin.getDataFolder(), "/maps/" + name);
|
||||||
|
|
||||||
|
if (file.exists()) {
|
||||||
|
EditWorld editWorld = new EditWorld();
|
||||||
|
editWorld.mapName = name;
|
||||||
|
// World
|
||||||
|
FileUtil.copyDirectory(file, new File("DXL_Edit_" + editWorld.id));
|
||||||
|
|
||||||
|
// Id File
|
||||||
|
File idFile = new File("DXL_Edit_" + editWorld.id + "/.id_" + name);
|
||||||
|
try {
|
||||||
|
idFile.createNewFile();
|
||||||
|
} catch (IOException e) {
|
||||||
|
e.printStackTrace();
|
||||||
|
}
|
||||||
|
|
||||||
|
editWorld.world = plugin.getServer().createWorld(WorldCreator.name("DXL_Edit_" + editWorld.id));
|
||||||
|
|
||||||
|
try {
|
||||||
|
ObjectInputStream os = new ObjectInputStream(new FileInputStream(new File(plugin.getDataFolder(), "/maps/" + editWorld.mapName + "/DXLData.data")));
|
||||||
|
int length = os.readInt();
|
||||||
|
for (int i = 0; i < length; i++) {
|
||||||
|
int x = os.readInt();
|
||||||
|
int y = os.readInt();
|
||||||
|
int z = os.readInt();
|
||||||
|
Block block = editWorld.world.getBlockAt(x, y, z);
|
||||||
|
editWorld.checkSign(block);
|
||||||
|
editWorld.sign.add(block);
|
||||||
|
}
|
||||||
|
os.close();
|
||||||
|
|
||||||
|
} catch (FileNotFoundException e) {
|
||||||
|
e.printStackTrace();
|
||||||
|
} catch (IOException e) {
|
||||||
|
e.printStackTrace();
|
||||||
|
}
|
||||||
|
|
||||||
|
return editWorld;
|
||||||
|
}
|
||||||
|
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
public static boolean exists(String name) {
|
||||||
|
// Cheack Loaded EditWorlds
|
||||||
|
for (EditWorld editWorld : plugin.getEditWorlds()) {
|
||||||
|
if (editWorld.mapName.equalsIgnoreCase(name)) {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// Cheack Unloaded Worlds
|
||||||
|
File file = new File(plugin.getDataFolder(), "/maps/" + name);
|
||||||
|
|
||||||
|
if (file.exists()) {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Invite
|
||||||
|
public static boolean addInvitedPlayer(String editWorldName, UUID uuid) {
|
||||||
|
if ( !exists(editWorldName)) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
File file = new File(plugin.getDataFolder() + "/maps/" + editWorldName, "config.yml");
|
||||||
|
if ( !file.exists()) {
|
||||||
|
try {
|
||||||
|
file.createNewFile();
|
||||||
|
|
||||||
|
} catch (IOException exception) {
|
||||||
|
exception.printStackTrace();
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
WorldConfig config = new WorldConfig(file);
|
||||||
|
config.addInvitedPlayer(uuid.toString());
|
||||||
|
config.save();
|
||||||
|
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
public static boolean removeInvitedPlayer(String editWorldName, UUID uuid, String name) {
|
||||||
|
if ( !exists(editWorldName)) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
File file = new File(plugin.getDataFolder() + "/maps/" + editWorldName, "config.yml");
|
||||||
|
if ( !file.exists()) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
WorldConfig config = new WorldConfig(file);
|
||||||
|
config.removeInvitedPlayers(uuid.toString(), name.toLowerCase());
|
||||||
|
config.save();
|
||||||
|
|
||||||
|
// Kick Player
|
||||||
|
EditWorld editWorld = EditWorld.getByName(editWorldName);
|
||||||
|
if (editWorld != null) {
|
||||||
|
DPlayer player = DPlayer.getByName(name);
|
||||||
|
|
||||||
|
if (player != null) {
|
||||||
|
if (editWorld.world.getPlayers().contains(player.getPlayer())) {
|
||||||
|
player.leave();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
public static boolean isInvitedPlayer(String editWorldName, UUID uuid, String name) {
|
||||||
|
if ( !exists(editWorldName)) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
File file = new File(plugin.getDataFolder() + "/maps/" + editWorldName, "config.yml");
|
||||||
|
if ( !file.exists()) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
WorldConfig config = new WorldConfig(file);
|
||||||
|
// get player from both a 0.9.1 and lower and 0.9.2 and higher file
|
||||||
|
if (config.getInvitedPlayers().contains(name.toLowerCase()) || config.getInvitedPlayers().contains(uuid.toString())) {
|
||||||
|
return true;
|
||||||
|
|
||||||
|
} else {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
package io.github.dre2n.dungeonsxl.dungeon.game;
|
package io.github.dre2n.dungeonsxl.dungeon.game;
|
||||||
|
|
||||||
import io.github.dre2n.dungeonsxl.DungeonsXL;
|
import io.github.dre2n.dungeonsxl.DungeonsXL;
|
||||||
import io.github.dre2n.dungeonsxl.file.DMessages.Messages;
|
import io.github.dre2n.dungeonsxl.config.MessageConfig.Messages;
|
||||||
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.DPlayer;
|
||||||
import io.github.dre2n.dungeonsxl.reward.Reward;
|
import io.github.dre2n.dungeonsxl.reward.Reward;
|
||||||
@ -44,105 +44,6 @@ public class GameChest {
|
|||||||
gameWorld.getGameChests().add(this);
|
gameWorld.getGameChests().add(this);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void addTreasure(DGroup dGroup) {
|
|
||||||
if (dGroup == null) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
boolean hasMoneyReward = false;
|
|
||||||
|
|
||||||
for (Reward reward : dGroup.getRewards()) {
|
|
||||||
if (reward instanceof MoneyReward) {
|
|
||||||
hasMoneyReward = true;
|
|
||||||
((MoneyReward) reward).addMoney(moneyReward);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if ( !hasMoneyReward) {
|
|
||||||
Reward reward = Reward.create(RewardTypeDefault.MONEY);
|
|
||||||
((MoneyReward) reward).addMoney(moneyReward);
|
|
||||||
dGroup.addReward(reward);
|
|
||||||
}
|
|
||||||
|
|
||||||
for (Player player : dGroup.getPlayers()) {
|
|
||||||
DPlayer dPlayer = DPlayer.getByPlayer(player);
|
|
||||||
if (dPlayer == null) {
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
|
|
||||||
String msg = "";
|
|
||||||
for (ItemStack itemStack : chest.getInventory().getContents()) {
|
|
||||||
|
|
||||||
if (itemStack == null) {
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
|
|
||||||
dPlayer.getTreasureInv().addItem(itemStack);
|
|
||||||
String name = null;
|
|
||||||
|
|
||||||
if (itemStack.hasItemMeta()) {
|
|
||||||
if (itemStack.getItemMeta().hasDisplayName()) {
|
|
||||||
name = itemStack.getItemMeta().getDisplayName();
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
if (name == null && Bukkit.getPluginManager().getPlugin("Vault") != null) {
|
|
||||||
ItemInfo itemInfo = Items.itemByStack(itemStack);
|
|
||||||
if (itemInfo != null) {
|
|
||||||
name = itemInfo.getName();
|
|
||||||
} else {
|
|
||||||
name = itemStack.getType().name();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
msg += ChatColor.RED + " " + itemStack.getAmount() + " " + name + ChatColor.GOLD + ",";
|
|
||||||
}
|
|
||||||
|
|
||||||
msg = msg.substring(0, msg.length() - 1);
|
|
||||||
|
|
||||||
MessageUtil.sendMessage(player, plugin.getDMessages().getMessage(Messages.PLAYER_LOOT_ADDED, msg));
|
|
||||||
if (moneyReward != 0) {
|
|
||||||
MessageUtil.sendMessage(player, plugin.getDMessages().getMessage(Messages.PLAYER_LOOT_ADDED, plugin.getEconomyProvider().format(moneyReward)));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// Statics
|
|
||||||
public static void onOpenInventory(InventoryOpenEvent event) {
|
|
||||||
InventoryView inventory = event.getView();
|
|
||||||
|
|
||||||
GameWorld gameWorld = GameWorld.getByWorld(event.getPlayer().getWorld());
|
|
||||||
|
|
||||||
if (gameWorld == null) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
if ( !(inventory.getTopInventory().getHolder() instanceof Chest)) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
Chest chest = (Chest) inventory.getTopInventory().getHolder();
|
|
||||||
|
|
||||||
for (GameChest gameChest : gameWorld.getGameChests()) {
|
|
||||||
if ( !gameChest.chest.equals(chest)) {
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (gameChest.used) {
|
|
||||||
MessageUtil.sendMessage(plugin.getServer().getPlayer(event.getPlayer().getUniqueId()), plugin.getDMessages().getMessage(Messages.ERROR_CHEST_IS_OPENED));
|
|
||||||
event.setCancelled(true);
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (gameChest.chest.getLocation().distance(chest.getLocation()) < 1) {
|
|
||||||
gameChest.addTreasure(DGroup.getByGameWorld(gameWorld));
|
|
||||||
gameChest.used = true;
|
|
||||||
event.setCancelled(true);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @return if the GameChest is used
|
* @return if the GameChest is used
|
||||||
*/
|
*/
|
||||||
@ -203,4 +104,103 @@ public class GameChest {
|
|||||||
this.moneyReward = moneyReward;
|
this.moneyReward = moneyReward;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void addTreasure(DGroup dGroup) {
|
||||||
|
if (dGroup == null) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
boolean hasMoneyReward = false;
|
||||||
|
|
||||||
|
for (Reward reward : dGroup.getRewards()) {
|
||||||
|
if (reward instanceof MoneyReward) {
|
||||||
|
hasMoneyReward = true;
|
||||||
|
((MoneyReward) reward).addMoney(moneyReward);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if ( !hasMoneyReward) {
|
||||||
|
Reward reward = Reward.create(RewardTypeDefault.MONEY);
|
||||||
|
((MoneyReward) reward).addMoney(moneyReward);
|
||||||
|
dGroup.addReward(reward);
|
||||||
|
}
|
||||||
|
|
||||||
|
for (Player player : dGroup.getPlayers()) {
|
||||||
|
DPlayer dPlayer = DPlayer.getByPlayer(player);
|
||||||
|
if (dPlayer == null) {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
|
String msg = "";
|
||||||
|
for (ItemStack itemStack : chest.getInventory().getContents()) {
|
||||||
|
|
||||||
|
if (itemStack == null) {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
|
dPlayer.getTreasureInv().addItem(itemStack);
|
||||||
|
String name = null;
|
||||||
|
|
||||||
|
if (itemStack.hasItemMeta()) {
|
||||||
|
if (itemStack.getItemMeta().hasDisplayName()) {
|
||||||
|
name = itemStack.getItemMeta().getDisplayName();
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
if (name == null && Bukkit.getPluginManager().getPlugin("Vault") != null) {
|
||||||
|
ItemInfo itemInfo = Items.itemByStack(itemStack);
|
||||||
|
if (itemInfo != null) {
|
||||||
|
name = itemInfo.getName();
|
||||||
|
} else {
|
||||||
|
name = itemStack.getType().name();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
msg += ChatColor.RED + " " + itemStack.getAmount() + " " + name + ChatColor.GOLD + ",";
|
||||||
|
}
|
||||||
|
|
||||||
|
msg = msg.substring(0, msg.length() - 1);
|
||||||
|
|
||||||
|
MessageUtil.sendMessage(player, plugin.getMessageConfig().getMessage(Messages.PLAYER_LOOT_ADDED, msg));
|
||||||
|
if (moneyReward != 0) {
|
||||||
|
MessageUtil.sendMessage(player, plugin.getMessageConfig().getMessage(Messages.PLAYER_LOOT_ADDED, plugin.getEconomyProvider().format(moneyReward)));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// Statics
|
||||||
|
public static void onOpenInventory(InventoryOpenEvent event) {
|
||||||
|
InventoryView inventory = event.getView();
|
||||||
|
|
||||||
|
GameWorld gameWorld = GameWorld.getByWorld(event.getPlayer().getWorld());
|
||||||
|
|
||||||
|
if (gameWorld == null) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
if ( !(inventory.getTopInventory().getHolder() instanceof Chest)) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
Chest chest = (Chest) inventory.getTopInventory().getHolder();
|
||||||
|
|
||||||
|
for (GameChest gameChest : gameWorld.getGameChests()) {
|
||||||
|
if ( !gameChest.chest.equals(chest)) {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (gameChest.used) {
|
||||||
|
MessageUtil.sendMessage(plugin.getServer().getPlayer(event.getPlayer().getUniqueId()), plugin.getMessageConfig().getMessage(Messages.ERROR_CHEST_IS_OPENED));
|
||||||
|
event.setCancelled(true);
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (gameChest.chest.getLocation().distance(chest.getLocation()) < 1) {
|
||||||
|
gameChest.addTreasure(DGroup.getByGameWorld(gameWorld));
|
||||||
|
gameChest.used = true;
|
||||||
|
event.setCancelled(true);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -238,7 +238,7 @@ public class GamePlaceableBlock {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Canbuild
|
// Can build
|
||||||
public static boolean canBuildHere(Block block, BlockFace blockFace, Material mat, GameWorld gameWorld) {
|
public static boolean canBuildHere(Block block, BlockFace blockFace, Material mat, GameWorld gameWorld) {
|
||||||
for (GamePlaceableBlock gamePlacableBlock : gameWorld.getPlaceableBlocks()) {
|
for (GamePlaceableBlock gamePlacableBlock : gameWorld.getPlaceableBlocks()) {
|
||||||
if (gamePlacableBlock.block.getFace(block) != BlockFace.SELF) {
|
if (gamePlacableBlock.block.getFace(block) != BlockFace.SELF) {
|
||||||
|
@ -1,9 +1,9 @@
|
|||||||
package io.github.dre2n.dungeonsxl.dungeon.game;
|
package io.github.dre2n.dungeonsxl.dungeon.game;
|
||||||
|
|
||||||
import io.github.dre2n.dungeonsxl.DungeonsXL;
|
import io.github.dre2n.dungeonsxl.DungeonsXL;
|
||||||
|
import io.github.dre2n.dungeonsxl.config.DungeonConfig;
|
||||||
|
import io.github.dre2n.dungeonsxl.config.WorldConfig;
|
||||||
import io.github.dre2n.dungeonsxl.dungeon.Dungeon;
|
import io.github.dre2n.dungeonsxl.dungeon.Dungeon;
|
||||||
import io.github.dre2n.dungeonsxl.dungeon.DungeonConfig;
|
|
||||||
import io.github.dre2n.dungeonsxl.dungeon.WorldConfig;
|
|
||||||
import io.github.dre2n.dungeonsxl.dungeon.EditWorld;
|
import io.github.dre2n.dungeonsxl.dungeon.EditWorld;
|
||||||
import io.github.dre2n.dungeonsxl.event.gameworld.GameWorldLoadEvent;
|
import io.github.dre2n.dungeonsxl.event.gameworld.GameWorldLoadEvent;
|
||||||
import io.github.dre2n.dungeonsxl.event.gameworld.GameWorldStartGameEvent;
|
import io.github.dre2n.dungeonsxl.event.gameworld.GameWorldStartGameEvent;
|
||||||
@ -83,49 +83,6 @@ public class GameWorld {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public void checkSign(Block block) {
|
|
||||||
if (block.getState() instanceof Sign) {
|
|
||||||
Sign sign = (Sign) block.getState();
|
|
||||||
dSigns.add(DSign.create(sign, this));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
public void startGame() {
|
|
||||||
GameWorldStartGameEvent event = new GameWorldStartGameEvent(this);
|
|
||||||
|
|
||||||
if (event.isCancelled()) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
isPlaying = true;
|
|
||||||
|
|
||||||
for (DSign dSign : dSigns) {
|
|
||||||
if (dSign != null) {
|
|
||||||
if ( !dSign.getType().isOnDungeonInit()) {
|
|
||||||
dSign.onInit();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
if (RedstoneTrigger.hasTriggers(this)) {
|
|
||||||
for (RedstoneTrigger trigger : RedstoneTrigger.getTriggersArray(this)) {
|
|
||||||
trigger.onTrigger();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
for (DSign dSign : dSigns) {
|
|
||||||
if (dSign != null) {
|
|
||||||
if ( !dSign.hasTriggers()) {
|
|
||||||
dSign.onTrigger();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
public void msg(String msg) {
|
|
||||||
for (DPlayer dPlayer : DPlayer.getByWorld(world)) {
|
|
||||||
MessageUtil.sendMessage(dPlayer.getPlayer(), msg);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @return the tutorial
|
* @return the tutorial
|
||||||
*/
|
*/
|
||||||
@ -365,8 +322,154 @@ public class GameWorld {
|
|||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void checkSign(Block block) {
|
||||||
|
if (block.getState() instanceof Sign) {
|
||||||
|
Sign sign = (Sign) block.getState();
|
||||||
|
dSigns.add(DSign.create(sign, this));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public void startGame() {
|
||||||
|
GameWorldStartGameEvent event = new GameWorldStartGameEvent(this);
|
||||||
|
|
||||||
|
if (event.isCancelled()) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
isPlaying = true;
|
||||||
|
|
||||||
|
for (DSign dSign : dSigns) {
|
||||||
|
if (dSign != null) {
|
||||||
|
if ( !dSign.getType().isOnDungeonInit()) {
|
||||||
|
dSign.onInit();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (RedstoneTrigger.hasTriggers(this)) {
|
||||||
|
for (RedstoneTrigger trigger : RedstoneTrigger.getTriggersArray(this)) {
|
||||||
|
trigger.onTrigger();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
for (DSign dSign : dSigns) {
|
||||||
|
if (dSign != null) {
|
||||||
|
if ( !dSign.hasTriggers()) {
|
||||||
|
dSign.onTrigger();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public void sendMessage(String message) {
|
||||||
|
for (DPlayer dPlayer : DPlayer.getByWorld(world)) {
|
||||||
|
MessageUtil.sendMessage(dPlayer.getPlayer(), message);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public void delete() {
|
||||||
|
GameWorldUnloadEvent event = new GameWorldUnloadEvent(this);
|
||||||
|
|
||||||
|
if (event.isCancelled()) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
plugin.getGameWorlds().remove(this);
|
||||||
|
plugin.getServer().unloadWorld(world, true);
|
||||||
|
File dir = new File("DXL_Game_" + id);
|
||||||
|
FileUtil.removeDirectory(dir);
|
||||||
|
}
|
||||||
|
|
||||||
|
public void update() {
|
||||||
|
if (getWorld() == null) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Update Spiders
|
||||||
|
for (LivingEntity mob : getWorld().getLivingEntities()) {
|
||||||
|
if (mob.getType() == EntityType.SPIDER || mob.getType() == EntityType.CAVE_SPIDER) {
|
||||||
|
Spider spider = (Spider) mob;
|
||||||
|
if (spider.getTarget() != null) {
|
||||||
|
if (spider.getTarget().getType() == EntityType.PLAYER) {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
for (Entity player : spider.getNearbyEntities(10, 10, 10)) {
|
||||||
|
if (player.getType() == EntityType.PLAYER) {
|
||||||
|
spider.setTarget((LivingEntity) player);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
// Statics
|
// Statics
|
||||||
|
|
||||||
|
public static GameWorld load(String name) {
|
||||||
|
GameWorldLoadEvent event = new GameWorldLoadEvent(name);
|
||||||
|
|
||||||
|
if (event.isCancelled()) {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
File file = new File(plugin.getDataFolder(), "/maps/" + name);
|
||||||
|
|
||||||
|
if (file.exists()) {
|
||||||
|
GameWorld gameWorld = new GameWorld();
|
||||||
|
gameWorld.mapName = name;
|
||||||
|
|
||||||
|
// Unload empty editWorlds
|
||||||
|
for (EditWorld editWorld : plugin.getEditWorlds()) {
|
||||||
|
if (editWorld.getWorld().getPlayers().isEmpty()) {
|
||||||
|
editWorld.delete();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// Config einlesen
|
||||||
|
gameWorld.worldConfig = new WorldConfig(new File(plugin.getDataFolder() + "/maps/" + gameWorld.mapName, "config.yml"));
|
||||||
|
|
||||||
|
// Secure Objects
|
||||||
|
gameWorld.secureObjects = gameWorld.worldConfig.getSecureObjects();
|
||||||
|
|
||||||
|
// World
|
||||||
|
FileUtil.copyDirectory(file, new File("DXL_Game_" + gameWorld.id));
|
||||||
|
|
||||||
|
// Id File
|
||||||
|
File idFile = new File("DXL_Game_" + gameWorld.id + "/.id_" + name);
|
||||||
|
try {
|
||||||
|
idFile.createNewFile();
|
||||||
|
} catch (IOException e) {
|
||||||
|
e.printStackTrace();
|
||||||
|
}
|
||||||
|
|
||||||
|
gameWorld.world = plugin.getServer().createWorld(WorldCreator.name("DXL_Game_" + gameWorld.id));
|
||||||
|
|
||||||
|
ObjectInputStream os;
|
||||||
|
try {
|
||||||
|
os = new ObjectInputStream(new FileInputStream(new File(plugin.getDataFolder() + "/maps/" + gameWorld.mapName + "/DXLData.data")));
|
||||||
|
|
||||||
|
int length = os.readInt();
|
||||||
|
for (int i = 0; i < length; i++) {
|
||||||
|
int x = os.readInt();
|
||||||
|
int y = os.readInt();
|
||||||
|
int z = os.readInt();
|
||||||
|
Block block = gameWorld.world.getBlockAt(x, y, z);
|
||||||
|
gameWorld.checkSign(block);
|
||||||
|
}
|
||||||
|
|
||||||
|
os.close();
|
||||||
|
|
||||||
|
} catch (FileNotFoundException exception) {
|
||||||
|
plugin.getLogger().info("Could not find any sign data for the world \"" + name + "\"!");
|
||||||
|
|
||||||
|
} catch (IOException exception) {
|
||||||
|
exception.printStackTrace();
|
||||||
|
}
|
||||||
|
|
||||||
|
return gameWorld;
|
||||||
|
}
|
||||||
|
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
public static GameWorld getByWorld(World world) {
|
public static GameWorld getByWorld(World world) {
|
||||||
for (GameWorld gameWorld : plugin.getGameWorlds()) {
|
for (GameWorld gameWorld : plugin.getGameWorlds()) {
|
||||||
if (gameWorld.world.equals(world)) {
|
if (gameWorld.world.equals(world)) {
|
||||||
@ -408,6 +511,28 @@ public class GameWorld {
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static long getPlayerTime(String dungeon, Player player) {
|
||||||
|
File file = new File(plugin.getDataFolder() + "/maps/" + dungeon, "players.yml");
|
||||||
|
|
||||||
|
if ( !file.exists()) {
|
||||||
|
try {
|
||||||
|
file.createNewFile();
|
||||||
|
|
||||||
|
} catch (IOException exception) {
|
||||||
|
exception.printStackTrace();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
FileConfiguration playerConfig = YamlConfiguration.loadConfiguration(file);
|
||||||
|
if (playerConfig.contains(player.getUniqueId().toString())) {
|
||||||
|
return playerConfig.getLong(player.getUniqueId().toString());
|
||||||
|
}
|
||||||
|
if (playerConfig.contains(player.getName())) {
|
||||||
|
return playerConfig.getLong(player.getName());
|
||||||
|
}
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
|
|
||||||
public static boolean checkRequirements(String dungeon, Player player) {
|
public static boolean checkRequirements(String dungeon, Player player) {
|
||||||
if (player.hasPermission("dxl.ignorerequirements")) {
|
if (player.hasPermission("dxl.ignorerequirements")) {
|
||||||
return true;
|
return true;
|
||||||
@ -483,131 +608,4 @@ public class GameWorld {
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
public static long getPlayerTime(String dungeon, Player player) {
|
|
||||||
File file = new File(plugin.getDataFolder() + "/maps/" + dungeon, "players.yml");
|
|
||||||
|
|
||||||
if ( !file.exists()) {
|
|
||||||
try {
|
|
||||||
file.createNewFile();
|
|
||||||
|
|
||||||
} catch (IOException exception) {
|
|
||||||
exception.printStackTrace();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
FileConfiguration playerConfig = YamlConfiguration.loadConfiguration(file);
|
|
||||||
if (playerConfig.contains(player.getUniqueId().toString())) {
|
|
||||||
return playerConfig.getLong(player.getUniqueId().toString());
|
|
||||||
}
|
|
||||||
if (playerConfig.contains(player.getName())) {
|
|
||||||
return playerConfig.getLong(player.getName());
|
|
||||||
}
|
|
||||||
return -1;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void delete() {
|
|
||||||
GameWorldUnloadEvent event = new GameWorldUnloadEvent(this);
|
|
||||||
|
|
||||||
if (event.isCancelled()) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
plugin.getGameWorlds().remove(this);
|
|
||||||
plugin.getServer().unloadWorld(world, true);
|
|
||||||
File dir = new File("DXL_Game_" + id);
|
|
||||||
FileUtil.removeDirectory(dir);
|
|
||||||
}
|
|
||||||
|
|
||||||
public static GameWorld load(String name) {
|
|
||||||
GameWorldLoadEvent event = new GameWorldLoadEvent(name);
|
|
||||||
|
|
||||||
if (event.isCancelled()) {
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
|
|
||||||
File file = new File(plugin.getDataFolder(), "/maps/" + name);
|
|
||||||
|
|
||||||
if (file.exists()) {
|
|
||||||
GameWorld gameWorld = new GameWorld();
|
|
||||||
gameWorld.mapName = name;
|
|
||||||
|
|
||||||
// Unload empty editWorlds
|
|
||||||
for (EditWorld editWorld : plugin.getEditWorlds()) {
|
|
||||||
if (editWorld.getWorld().getPlayers().isEmpty()) {
|
|
||||||
editWorld.delete();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// Config einlesen
|
|
||||||
gameWorld.worldConfig = new WorldConfig(new File(plugin.getDataFolder() + "/maps/" + gameWorld.mapName, "config.yml"));
|
|
||||||
|
|
||||||
// Secure Objects
|
|
||||||
gameWorld.secureObjects = gameWorld.worldConfig.getSecureObjects();
|
|
||||||
|
|
||||||
// World
|
|
||||||
FileUtil.copyDirectory(file, new File("DXL_Game_" + gameWorld.id));
|
|
||||||
|
|
||||||
// Id File
|
|
||||||
File idFile = new File("DXL_Game_" + gameWorld.id + "/.id_" + name);
|
|
||||||
try {
|
|
||||||
idFile.createNewFile();
|
|
||||||
} catch (IOException e) {
|
|
||||||
e.printStackTrace();
|
|
||||||
}
|
|
||||||
|
|
||||||
gameWorld.world = plugin.getServer().createWorld(WorldCreator.name("DXL_Game_" + gameWorld.id));
|
|
||||||
|
|
||||||
ObjectInputStream os;
|
|
||||||
try {
|
|
||||||
os = new ObjectInputStream(new FileInputStream(new File(plugin.getDataFolder() + "/maps/" + gameWorld.mapName + "/DXLData.data")));
|
|
||||||
|
|
||||||
int length = os.readInt();
|
|
||||||
for (int i = 0; i < length; i++) {
|
|
||||||
int x = os.readInt();
|
|
||||||
int y = os.readInt();
|
|
||||||
int z = os.readInt();
|
|
||||||
Block block = gameWorld.world.getBlockAt(x, y, z);
|
|
||||||
gameWorld.checkSign(block);
|
|
||||||
}
|
|
||||||
|
|
||||||
os.close();
|
|
||||||
|
|
||||||
} catch (FileNotFoundException exception) {
|
|
||||||
plugin.getLogger().info("Could not find any sign data for the world \"" + name + "\"!");
|
|
||||||
|
|
||||||
} catch (IOException exception) {
|
|
||||||
exception.printStackTrace();
|
|
||||||
}
|
|
||||||
|
|
||||||
return gameWorld;
|
|
||||||
}
|
|
||||||
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
|
|
||||||
public static void update() {
|
|
||||||
for (GameWorld gameWorld : plugin.getGameWorlds()) {
|
|
||||||
if (gameWorld.getWorld() == null) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
// Update Spiders
|
|
||||||
for (LivingEntity mob : gameWorld.getWorld().getLivingEntities()) {
|
|
||||||
if (mob.getType() == EntityType.SPIDER || mob.getType() == EntityType.CAVE_SPIDER) {
|
|
||||||
Spider spider = (Spider) mob;
|
|
||||||
if (spider.getTarget() != null) {
|
|
||||||
if (spider.getTarget().getType() == EntityType.PLAYER) {
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
for (Entity player : spider.getNearbyEntities(10, 10, 10)) {
|
|
||||||
if (player.getType() == EntityType.PLAYER) {
|
|
||||||
spider.setTarget((LivingEntity) player);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -1,8 +1,8 @@
|
|||||||
package io.github.dre2n.dungeonsxl.global;
|
package io.github.dre2n.dungeonsxl.global;
|
||||||
|
|
||||||
import io.github.dre2n.dungeonsxl.DungeonsXL;
|
import io.github.dre2n.dungeonsxl.DungeonsXL;
|
||||||
|
import io.github.dre2n.dungeonsxl.config.MessageConfig.Messages;
|
||||||
import io.github.dre2n.dungeonsxl.dungeon.game.GameWorld;
|
import io.github.dre2n.dungeonsxl.dungeon.game.GameWorld;
|
||||||
import io.github.dre2n.dungeonsxl.file.DMessages.Messages;
|
|
||||||
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.DPlayer;
|
||||||
import io.github.dre2n.dungeonsxl.util.messageutil.MessageUtil;
|
import io.github.dre2n.dungeonsxl.util.messageutil.MessageUtil;
|
||||||
@ -29,6 +29,81 @@ public class DPortal {
|
|||||||
this.active = active;
|
this.active = active;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @return the world
|
||||||
|
*/
|
||||||
|
public World getWorld() {
|
||||||
|
return world;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param world
|
||||||
|
* the world to set
|
||||||
|
*/
|
||||||
|
public void setWorld(World world) {
|
||||||
|
this.world = world;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @return the block1
|
||||||
|
*/
|
||||||
|
public Block getBlock1() {
|
||||||
|
return block1;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param block1
|
||||||
|
* the block1 to set
|
||||||
|
*/
|
||||||
|
public void setBlock1(Block block1) {
|
||||||
|
this.block1 = block1;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @return the block2
|
||||||
|
*/
|
||||||
|
public Block getBlock2() {
|
||||||
|
return block2;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param block2
|
||||||
|
* the block2 to set
|
||||||
|
*/
|
||||||
|
public void setBlock2(Block block2) {
|
||||||
|
this.block2 = block2;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @return if the portal is active
|
||||||
|
*/
|
||||||
|
public boolean isActive() {
|
||||||
|
return active;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param active
|
||||||
|
* set the DPortal active
|
||||||
|
*/
|
||||||
|
public void setActive(boolean active) {
|
||||||
|
this.active = active;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @return the player
|
||||||
|
*/
|
||||||
|
public Player getPlayer() {
|
||||||
|
return player;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param player
|
||||||
|
* the player to set
|
||||||
|
*/
|
||||||
|
public void setPlayer(Player player) {
|
||||||
|
this.player = player;
|
||||||
|
}
|
||||||
|
|
||||||
public void create() {
|
public void create() {
|
||||||
player = null;
|
player = null;
|
||||||
|
|
||||||
@ -87,7 +162,7 @@ public class DPortal {
|
|||||||
DGroup dgroup = DGroup.getByPlayer(player);
|
DGroup dgroup = DGroup.getByPlayer(player);
|
||||||
|
|
||||||
if (dgroup == null) {
|
if (dgroup == null) {
|
||||||
MessageUtil.sendMessage(player, plugin.getDMessages().getMessage(Messages.ERROR_NOT_IN_GROUP));
|
MessageUtil.sendMessage(player, plugin.getMessageConfig().getMessage(Messages.ERROR_NOT_IN_GROUP));
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -96,7 +171,7 @@ public class DPortal {
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (dgroup.getGameWorld() == null) {
|
if (dgroup.getGameWorld() == null) {
|
||||||
MessageUtil.sendMessage(player, plugin.getDMessages().getMessage(Messages.ERROR_DUNGEON_NOT_EXIST, DGroup.getByPlayer(player).getMapName()));
|
MessageUtil.sendMessage(player, plugin.getMessageConfig().getMessage(Messages.ERROR_DUNGEON_NOT_EXIST, DGroup.getByPlayer(player).getMapName()));
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -260,79 +335,4 @@ public class DPortal {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* @return the world
|
|
||||||
*/
|
|
||||||
public World getWorld() {
|
|
||||||
return world;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @param world
|
|
||||||
* the world to set
|
|
||||||
*/
|
|
||||||
public void setWorld(World world) {
|
|
||||||
this.world = world;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @return the block1
|
|
||||||
*/
|
|
||||||
public Block getBlock1() {
|
|
||||||
return block1;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @param block1
|
|
||||||
* the block1 to set
|
|
||||||
*/
|
|
||||||
public void setBlock1(Block block1) {
|
|
||||||
this.block1 = block1;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @return the block2
|
|
||||||
*/
|
|
||||||
public Block getBlock2() {
|
|
||||||
return block2;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @param block2
|
|
||||||
* the block2 to set
|
|
||||||
*/
|
|
||||||
public void setBlock2(Block block2) {
|
|
||||||
this.block2 = block2;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @return if the portal is active
|
|
||||||
*/
|
|
||||||
public boolean isActive() {
|
|
||||||
return active;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @param active
|
|
||||||
* set the DPortal active
|
|
||||||
*/
|
|
||||||
public void setActive(boolean active) {
|
|
||||||
this.active = active;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @return the player
|
|
||||||
*/
|
|
||||||
public Player getPlayer() {
|
|
||||||
return player;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @param player
|
|
||||||
* the player to set
|
|
||||||
*/
|
|
||||||
public void setPlayer(Player player) {
|
|
||||||
this.player = player;
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -1,10 +1,10 @@
|
|||||||
package io.github.dre2n.dungeonsxl.global;
|
package io.github.dre2n.dungeonsxl.global;
|
||||||
|
|
||||||
import io.github.dre2n.dungeonsxl.DungeonsXL;
|
import io.github.dre2n.dungeonsxl.DungeonsXL;
|
||||||
|
import io.github.dre2n.dungeonsxl.config.WorldConfig;
|
||||||
|
import io.github.dre2n.dungeonsxl.config.MessageConfig.Messages;
|
||||||
import io.github.dre2n.dungeonsxl.dungeon.Dungeon;
|
import io.github.dre2n.dungeonsxl.dungeon.Dungeon;
|
||||||
import io.github.dre2n.dungeonsxl.dungeon.WorldConfig;
|
|
||||||
import io.github.dre2n.dungeonsxl.dungeon.game.GameWorld;
|
import io.github.dre2n.dungeonsxl.dungeon.game.GameWorld;
|
||||||
import io.github.dre2n.dungeonsxl.file.DMessages.Messages;
|
|
||||||
import io.github.dre2n.dungeonsxl.player.DGroup;
|
import io.github.dre2n.dungeonsxl.player.DGroup;
|
||||||
import io.github.dre2n.dungeonsxl.util.messageutil.MessageUtil;
|
import io.github.dre2n.dungeonsxl.util.messageutil.MessageUtil;
|
||||||
|
|
||||||
@ -382,7 +382,7 @@ public class GroupSign {
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (DGroup.getByPlayer(player) != null) {
|
if (DGroup.getByPlayer(player) != null) {
|
||||||
MessageUtil.sendMessage(player, plugin.getDMessages().getMessage(Messages.ERROR_LEAVE_GROUP));
|
MessageUtil.sendMessage(player, plugin.getMessageConfig().getMessage(Messages.ERROR_LEAVE_GROUP));
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -391,7 +391,7 @@ public class GroupSign {
|
|||||||
if (file != null) {
|
if (file != null) {
|
||||||
WorldConfig confReader = new WorldConfig(file);
|
WorldConfig confReader = new WorldConfig(file);
|
||||||
if (confReader != null) {
|
if (confReader != null) {
|
||||||
MessageUtil.sendMessage(player, plugin.getDMessages().getMessage(Messages.ERROR_COOLDOWN, String.valueOf(confReader.getTimeToNextPlay())));
|
MessageUtil.sendMessage(player, plugin.getMessageConfig().getMessage(Messages.ERROR_COOLDOWN, String.valueOf(confReader.getTimeToNextPlay())));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -399,7 +399,7 @@ public class GroupSign {
|
|||||||
}
|
}
|
||||||
|
|
||||||
if ( !GameWorld.checkRequirements(groupSign.mapName, player)) {
|
if ( !GameWorld.checkRequirements(groupSign.mapName, player)) {
|
||||||
MessageUtil.sendMessage(player, plugin.getDMessages().getMessage(Messages.ERROR_REQUIREMENTS));
|
MessageUtil.sendMessage(player, plugin.getMessageConfig().getMessage(Messages.ERROR_REQUIREMENTS));
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
package io.github.dre2n.dungeonsxl.global;
|
package io.github.dre2n.dungeonsxl.global;
|
||||||
|
|
||||||
import io.github.dre2n.dungeonsxl.DungeonsXL;
|
import io.github.dre2n.dungeonsxl.DungeonsXL;
|
||||||
import io.github.dre2n.dungeonsxl.file.DMessages.Messages;
|
import io.github.dre2n.dungeonsxl.config.MessageConfig.Messages;
|
||||||
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.DPlayer;
|
||||||
import io.github.dre2n.dungeonsxl.util.messageutil.MessageUtil;
|
import io.github.dre2n.dungeonsxl.util.messageutil.MessageUtil;
|
||||||
@ -57,7 +57,7 @@ public class LeaveSign {
|
|||||||
DGroup dgroup = DGroup.getByPlayer(player);
|
DGroup dgroup = DGroup.getByPlayer(player);
|
||||||
if (dgroup != null) {
|
if (dgroup != null) {
|
||||||
dgroup.removePlayer(player);
|
dgroup.removePlayer(player);
|
||||||
MessageUtil.sendMessage(player, DungeonsXL.getPlugin().getDMessages().getMessage(Messages.PLAYER_LEAVE_GROUP));// ChatColor.YELLOW+"Du hast deine Gruppe erfolgreich verlassen!");
|
MessageUtil.sendMessage(player, plugin.getMessageConfig().getMessage(Messages.PLAYER_LEAVE_GROUP));// ChatColor.YELLOW+"Du hast deine Gruppe erfolgreich verlassen!");
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1,15 +1,15 @@
|
|||||||
package io.github.dre2n.dungeonsxl.listener;
|
package io.github.dre2n.dungeonsxl.listener;
|
||||||
|
|
||||||
import io.github.dre2n.dungeonsxl.DungeonsXL;
|
import io.github.dre2n.dungeonsxl.DungeonsXL;
|
||||||
|
import io.github.dre2n.dungeonsxl.config.MessageConfig.Messages;
|
||||||
import io.github.dre2n.dungeonsxl.dungeon.EditWorld;
|
import io.github.dre2n.dungeonsxl.dungeon.EditWorld;
|
||||||
import io.github.dre2n.dungeonsxl.dungeon.game.GamePlaceableBlock;
|
import io.github.dre2n.dungeonsxl.dungeon.game.GamePlaceableBlock;
|
||||||
import io.github.dre2n.dungeonsxl.dungeon.game.GameWorld;
|
import io.github.dre2n.dungeonsxl.dungeon.game.GameWorld;
|
||||||
import io.github.dre2n.dungeonsxl.file.DMessages.Messages;
|
|
||||||
import io.github.dre2n.dungeonsxl.global.DPortal;
|
import io.github.dre2n.dungeonsxl.global.DPortal;
|
||||||
import io.github.dre2n.dungeonsxl.global.GroupSign;
|
import io.github.dre2n.dungeonsxl.global.GroupSign;
|
||||||
import io.github.dre2n.dungeonsxl.global.LeaveSign;
|
import io.github.dre2n.dungeonsxl.global.LeaveSign;
|
||||||
import io.github.dre2n.dungeonsxl.sign.DSign;
|
import io.github.dre2n.dungeonsxl.sign.DSign;
|
||||||
import io.github.dre2n.dungeonsxl.trigger.RedstoneTrigger;
|
import io.github.dre2n.dungeonsxl.task.RedstoneEventTask;
|
||||||
import io.github.dre2n.dungeonsxl.util.NumberUtil;
|
import io.github.dre2n.dungeonsxl.util.NumberUtil;
|
||||||
import io.github.dre2n.dungeonsxl.util.messageutil.MessageUtil;
|
import io.github.dre2n.dungeonsxl.util.messageutil.MessageUtil;
|
||||||
|
|
||||||
@ -27,7 +27,6 @@ import org.bukkit.event.block.BlockPlaceEvent;
|
|||||||
import org.bukkit.event.block.BlockRedstoneEvent;
|
import org.bukkit.event.block.BlockRedstoneEvent;
|
||||||
import org.bukkit.event.block.BlockSpreadEvent;
|
import org.bukkit.event.block.BlockSpreadEvent;
|
||||||
import org.bukkit.event.block.SignChangeEvent;
|
import org.bukkit.event.block.SignChangeEvent;
|
||||||
import org.bukkit.scheduler.BukkitRunnable;
|
|
||||||
|
|
||||||
public class BlockListener implements Listener {
|
public class BlockListener implements Listener {
|
||||||
|
|
||||||
@ -55,8 +54,8 @@ public class BlockListener implements Listener {
|
|||||||
if (dPortal != null) {
|
if (dPortal != null) {
|
||||||
if (plugin.getInBreakMode().contains(player)) {
|
if (plugin.getInBreakMode().contains(player)) {
|
||||||
dPortal.delete();
|
dPortal.delete();
|
||||||
MessageUtil.sendMessage(player, plugin.getDMessages().getMessage(Messages.PLAYER_PROTECTED_BLOCK_DELETED));
|
MessageUtil.sendMessage(player, plugin.getMessageConfig().getMessage(Messages.PLAYER_PROTECTED_BLOCK_DELETED));
|
||||||
MessageUtil.sendMessage(player, plugin.getDMessages().getMessage(Messages.CMD_BREAK_PROTECTED_MODE));
|
MessageUtil.sendMessage(player, plugin.getMessageConfig().getMessage(Messages.CMD_BREAK_PROTECTED_MODE));
|
||||||
plugin.getInBreakMode().remove(player);
|
plugin.getInBreakMode().remove(player);
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
@ -72,8 +71,8 @@ public class BlockListener implements Listener {
|
|||||||
if (groupSign != null) {
|
if (groupSign != null) {
|
||||||
if (plugin.getInBreakMode().contains(player)) {
|
if (plugin.getInBreakMode().contains(player)) {
|
||||||
groupSign.delete();
|
groupSign.delete();
|
||||||
MessageUtil.sendMessage(player, plugin.getDMessages().getMessage(Messages.PLAYER_PROTECTED_BLOCK_DELETED));
|
MessageUtil.sendMessage(player, plugin.getMessageConfig().getMessage(Messages.PLAYER_PROTECTED_BLOCK_DELETED));
|
||||||
MessageUtil.sendMessage(player, plugin.getDMessages().getMessage(Messages.CMD_BREAK_PROTECTED_MODE));
|
MessageUtil.sendMessage(player, plugin.getMessageConfig().getMessage(Messages.CMD_BREAK_PROTECTED_MODE));
|
||||||
plugin.getInBreakMode().remove(player);
|
plugin.getInBreakMode().remove(player);
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
@ -94,8 +93,8 @@ public class BlockListener implements Listener {
|
|||||||
if (leaveSign != null) {
|
if (leaveSign != null) {
|
||||||
if (plugin.getInBreakMode().contains(player)) {
|
if (plugin.getInBreakMode().contains(player)) {
|
||||||
leaveSign.delete();
|
leaveSign.delete();
|
||||||
MessageUtil.sendMessage(player, plugin.getDMessages().getMessage(Messages.PLAYER_PROTECTED_BLOCK_DELETED));
|
MessageUtil.sendMessage(player, plugin.getMessageConfig().getMessage(Messages.PLAYER_PROTECTED_BLOCK_DELETED));
|
||||||
MessageUtil.sendMessage(player, plugin.getDMessages().getMessage(Messages.CMD_BREAK_PROTECTED_MODE));
|
MessageUtil.sendMessage(player, plugin.getMessageConfig().getMessage(Messages.CMD_BREAK_PROTECTED_MODE));
|
||||||
plugin.getInBreakMode().remove(player);
|
plugin.getInBreakMode().remove(player);
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
@ -217,16 +216,16 @@ public class BlockListener implements Listener {
|
|||||||
}
|
}
|
||||||
|
|
||||||
if ( !player.hasPermission(dsign.getType().getBuildPermission())) {
|
if ( !player.hasPermission(dsign.getType().getBuildPermission())) {
|
||||||
MessageUtil.sendMessage(player, plugin.getDMessages().getMessage(Messages.ERROR_NO_PERMISSIONS));
|
MessageUtil.sendMessage(player, plugin.getMessageConfig().getMessage(Messages.ERROR_NO_PERMISSIONS));
|
||||||
}
|
}
|
||||||
|
|
||||||
if (dsign.check()) {
|
if (dsign.check()) {
|
||||||
editWorld.checkSign(block);
|
editWorld.checkSign(block);
|
||||||
editWorld.getSign().add(block);
|
editWorld.getSign().add(block);
|
||||||
MessageUtil.sendMessage(player, plugin.getDMessages().getMessage(Messages.PLAYER_SIGN_CREATED));
|
MessageUtil.sendMessage(player, plugin.getMessageConfig().getMessage(Messages.PLAYER_SIGN_CREATED));
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
MessageUtil.sendMessage(player, plugin.getDMessages().getMessage(Messages.ERROR_SIGN_WRONG_FORMAT));
|
MessageUtil.sendMessage(player, plugin.getMessageConfig().getMessage(Messages.ERROR_SIGN_WRONG_FORMAT));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -259,22 +258,4 @@ public class BlockListener implements Listener {
|
|||||||
new RedstoneEventTask(event.getBlock()).runTaskLater(plugin, 1);
|
new RedstoneEventTask(event.getBlock()).runTaskLater(plugin, 1);
|
||||||
}
|
}
|
||||||
|
|
||||||
public class RedstoneEventTask extends BukkitRunnable {
|
|
||||||
private final Block block;
|
|
||||||
|
|
||||||
public RedstoneEventTask(final Block block) {
|
|
||||||
this.block = block;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void run() {
|
|
||||||
for (GameWorld gameWorld : plugin.getGameWorlds()) {
|
|
||||||
if (block.getWorld() == gameWorld.getWorld()) {
|
|
||||||
RedstoneTrigger.updateAll(gameWorld);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -3,8 +3,8 @@ package io.github.dre2n.dungeonsxl.listener;
|
|||||||
import io.github.dre2n.dungeonsxl.DungeonsXL;
|
import io.github.dre2n.dungeonsxl.DungeonsXL;
|
||||||
import io.github.dre2n.dungeonsxl.util.messageutil.MessageUtil;
|
import io.github.dre2n.dungeonsxl.util.messageutil.MessageUtil;
|
||||||
import io.github.dre2n.dungeonsxl.command.DCommand;
|
import io.github.dre2n.dungeonsxl.command.DCommand;
|
||||||
import io.github.dre2n.dungeonsxl.file.DMessages;
|
import io.github.dre2n.dungeonsxl.config.MessageConfig;
|
||||||
import io.github.dre2n.dungeonsxl.file.DMessages.Messages;
|
import io.github.dre2n.dungeonsxl.config.MessageConfig.Messages;
|
||||||
|
|
||||||
import org.bukkit.command.Command;
|
import org.bukkit.command.Command;
|
||||||
import org.bukkit.command.CommandExecutor;
|
import org.bukkit.command.CommandExecutor;
|
||||||
@ -19,13 +19,13 @@ public class CommandListener implements CommandExecutor {
|
|||||||
DungeonsXL plugin = DungeonsXL.getPlugin();
|
DungeonsXL plugin = DungeonsXL.getPlugin();
|
||||||
|
|
||||||
if (args.length > 0) {
|
if (args.length > 0) {
|
||||||
DMessages dMessages = plugin.getDMessages();
|
MessageConfig MessageConfig = plugin.getMessageConfig();
|
||||||
DCommand dCommand = plugin.getDCommands().getDCommand(args[0]);
|
DCommand dCommand = plugin.getDCommands().getDCommand(args[0]);
|
||||||
|
|
||||||
if (dCommand != null) {
|
if (dCommand != null) {
|
||||||
if (sender instanceof ConsoleCommandSender) {
|
if (sender instanceof ConsoleCommandSender) {
|
||||||
if ( !dCommand.isConsoleCommand()) {
|
if ( !dCommand.isConsoleCommand()) {
|
||||||
MessageUtil.sendMessage(sender, dMessages.getMessage(Messages.LOG_ERROR_NO_CONSOLE_COMMAND, dCommand.getCommand()));
|
MessageUtil.sendMessage(sender, MessageConfig.getMessage(Messages.LOG_ERROR_NO_CONSOLE_COMMAND, dCommand.getCommand()));
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -34,13 +34,13 @@ public class CommandListener implements CommandExecutor {
|
|||||||
Player player = (Player) sender;
|
Player player = (Player) sender;
|
||||||
|
|
||||||
if ( !dCommand.isPlayerCommand()) {
|
if ( !dCommand.isPlayerCommand()) {
|
||||||
MessageUtil.sendMessage(player, dMessages.getMessage(Messages.ERROR_NO_PLAYER_COMMAND, dCommand.getCommand()));
|
MessageUtil.sendMessage(player, MessageConfig.getMessage(Messages.ERROR_NO_PLAYER_COMMAND, dCommand.getCommand()));
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
if (dCommand.getPermission() != null) {
|
if (dCommand.getPermission() != null) {
|
||||||
if ( !dCommand.playerHasPermissions(player)) {
|
if ( !dCommand.playerHasPermissions(player)) {
|
||||||
MessageUtil.sendMessage(player, dMessages.getMessage(Messages.ERROR_NO_PERMISSIONS));
|
MessageUtil.sendMessage(player, MessageConfig.getMessage(Messages.ERROR_NO_PERMISSIONS));
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
package io.github.dre2n.dungeonsxl.listener;
|
package io.github.dre2n.dungeonsxl.listener;
|
||||||
|
|
||||||
|
import io.github.dre2n.dungeonsxl.config.WorldConfig;
|
||||||
import io.github.dre2n.dungeonsxl.dungeon.EditWorld;
|
import io.github.dre2n.dungeonsxl.dungeon.EditWorld;
|
||||||
import io.github.dre2n.dungeonsxl.dungeon.WorldConfig;
|
|
||||||
import io.github.dre2n.dungeonsxl.dungeon.game.GameWorld;
|
import io.github.dre2n.dungeonsxl.dungeon.game.GameWorld;
|
||||||
import io.github.dre2n.dungeonsxl.global.DPortal;
|
import io.github.dre2n.dungeonsxl.global.DPortal;
|
||||||
import io.github.dre2n.dungeonsxl.global.GroupSign;
|
import io.github.dre2n.dungeonsxl.global.GroupSign;
|
||||||
|
@ -3,23 +3,23 @@ package io.github.dre2n.dungeonsxl.listener;
|
|||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
|
|
||||||
import io.github.dre2n.dungeonsxl.DungeonsXL;
|
import io.github.dre2n.dungeonsxl.DungeonsXL;
|
||||||
import io.github.dre2n.dungeonsxl.dungeon.WorldConfig;
|
import io.github.dre2n.dungeonsxl.config.MessageConfig;
|
||||||
|
import io.github.dre2n.dungeonsxl.config.WorldConfig;
|
||||||
|
import io.github.dre2n.dungeonsxl.config.MessageConfig.Messages;
|
||||||
import io.github.dre2n.dungeonsxl.dungeon.DLootInventory;
|
import io.github.dre2n.dungeonsxl.dungeon.DLootInventory;
|
||||||
import io.github.dre2n.dungeonsxl.dungeon.EditWorld;
|
import io.github.dre2n.dungeonsxl.dungeon.EditWorld;
|
||||||
import io.github.dre2n.dungeonsxl.dungeon.game.GameChest;
|
import io.github.dre2n.dungeonsxl.dungeon.game.GameChest;
|
||||||
import io.github.dre2n.dungeonsxl.dungeon.game.GameWorld;
|
import io.github.dre2n.dungeonsxl.dungeon.game.GameWorld;
|
||||||
import io.github.dre2n.dungeonsxl.event.dgroup.DGroupCreateEvent;
|
import io.github.dre2n.dungeonsxl.event.dgroup.DGroupCreateEvent;
|
||||||
import io.github.dre2n.dungeonsxl.event.dplayer.DPlayerDeathEvent;
|
import io.github.dre2n.dungeonsxl.event.dplayer.DPlayerDeathEvent;
|
||||||
import io.github.dre2n.dungeonsxl.file.DMessages;
|
|
||||||
import io.github.dre2n.dungeonsxl.file.DMessages.Messages;
|
|
||||||
import io.github.dre2n.dungeonsxl.global.DPortal;
|
import io.github.dre2n.dungeonsxl.global.DPortal;
|
||||||
import io.github.dre2n.dungeonsxl.global.GroupSign;
|
import io.github.dre2n.dungeonsxl.global.GroupSign;
|
||||||
import io.github.dre2n.dungeonsxl.global.LeaveSign;
|
import io.github.dre2n.dungeonsxl.global.LeaveSign;
|
||||||
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.DPlayer;
|
||||||
|
import io.github.dre2n.dungeonsxl.task.RespawnTask;
|
||||||
import io.github.dre2n.dungeonsxl.trigger.InteractTrigger;
|
import io.github.dre2n.dungeonsxl.trigger.InteractTrigger;
|
||||||
import io.github.dre2n.dungeonsxl.trigger.UseItemTrigger;
|
import io.github.dre2n.dungeonsxl.trigger.UseItemTrigger;
|
||||||
import io.github.dre2n.dungeonsxl.util.MiscUtil;
|
|
||||||
import io.github.dre2n.dungeonsxl.util.messageutil.MessageUtil;
|
import io.github.dre2n.dungeonsxl.util.messageutil.MessageUtil;
|
||||||
|
|
||||||
import org.bukkit.ChatColor;
|
import org.bukkit.ChatColor;
|
||||||
@ -47,12 +47,11 @@ import org.bukkit.event.player.PlayerRespawnEvent;
|
|||||||
import org.bukkit.event.player.PlayerTeleportEvent;
|
import org.bukkit.event.player.PlayerTeleportEvent;
|
||||||
import org.bukkit.inventory.ItemStack;
|
import org.bukkit.inventory.ItemStack;
|
||||||
import org.bukkit.inventory.meta.BookMeta;
|
import org.bukkit.inventory.meta.BookMeta;
|
||||||
import org.bukkit.scheduler.BukkitRunnable;
|
|
||||||
|
|
||||||
public class PlayerListener implements Listener {
|
public class PlayerListener implements Listener {
|
||||||
|
|
||||||
static DungeonsXL plugin = DungeonsXL.getPlugin();
|
static DungeonsXL plugin = DungeonsXL.getPlugin();
|
||||||
DMessages dMessages = plugin.getDMessages();
|
MessageConfig messageConfig = plugin.getMessageConfig();
|
||||||
|
|
||||||
@EventHandler(priority = EventPriority.HIGH)
|
@EventHandler(priority = EventPriority.HIGH)
|
||||||
public void onDeath(PlayerDeathEvent event) {
|
public void onDeath(PlayerDeathEvent event) {
|
||||||
@ -79,17 +78,17 @@ public class PlayerListener implements Listener {
|
|||||||
dPlayer.setLives(dPlayer.getLives() - dPlayerDeathEvent.getLostLives());
|
dPlayer.setLives(dPlayer.getLives() - dPlayerDeathEvent.getLostLives());
|
||||||
|
|
||||||
if (dPlayer.getLives() == 0 && dPlayer.isReady()) {
|
if (dPlayer.getLives() == 0 && dPlayer.isReady()) {
|
||||||
MessageUtil.broadcastMessage(dMessages.getMessage(Messages.PLAYER_DEATH_KICK, player.getName()));
|
MessageUtil.broadcastMessage(messageConfig.getMessage(Messages.PLAYER_DEATH_KICK, player.getName()));
|
||||||
|
|
||||||
// TODO: This Runnable is a workaround for a bug I couldn't find, yet...
|
// TODO: This Runnable is a workaround for a bug I couldn't find, yet...
|
||||||
new BukkitRunnable() {
|
new org.bukkit.scheduler.BukkitRunnable() {
|
||||||
public void run() {
|
public void run() {
|
||||||
dPlayer.leave();
|
dPlayer.leave();
|
||||||
}
|
}
|
||||||
}.runTaskLater(plugin, 1L);
|
}.runTaskLater(plugin, 1L);
|
||||||
|
|
||||||
} else if ( !(dPlayer.getLives() == -1)) {
|
} else if ( !(dPlayer.getLives() == -1)) {
|
||||||
MessageUtil.sendMessage(player, dMessages.getMessage(Messages.PLAYER_DEATH, String.valueOf(dPlayer.getLives())));
|
MessageUtil.sendMessage(player, messageConfig.getMessage(Messages.PLAYER_DEATH, String.valueOf(dPlayer.getLives())));
|
||||||
|
|
||||||
} else if (dConfig != null) {
|
} else if (dConfig != null) {
|
||||||
if (dConfig.getKeepInventoryOnDeath()) {
|
if (dConfig.getKeepInventoryOnDeath()) {
|
||||||
@ -118,13 +117,13 @@ public class PlayerListener implements Listener {
|
|||||||
if (event.getAction() != Action.LEFT_CLICK_BLOCK) {
|
if (event.getAction() != Action.LEFT_CLICK_BLOCK) {
|
||||||
if (clickedBlock.getType() == Material.ENDER_CHEST) {
|
if (clickedBlock.getType() == Material.ENDER_CHEST) {
|
||||||
if ( !player.hasPermission("dxl.bypass")) {
|
if ( !player.hasPermission("dxl.bypass")) {
|
||||||
MessageUtil.sendMessage(player, dMessages.getMessage(Messages.ERROR_ENDERCHEST));
|
MessageUtil.sendMessage(player, messageConfig.getMessage(Messages.ERROR_ENDERCHEST));
|
||||||
event.setCancelled(true);
|
event.setCancelled(true);
|
||||||
}
|
}
|
||||||
|
|
||||||
} else if (clickedBlock.getType() == Material.BED_BLOCK) {
|
} else if (clickedBlock.getType() == Material.BED_BLOCK) {
|
||||||
if ( !player.hasPermission("dxl.bypass")) {
|
if ( !player.hasPermission("dxl.bypass")) {
|
||||||
MessageUtil.sendMessage(player, dMessages.getMessage(Messages.ERROR_BED));
|
MessageUtil.sendMessage(player, messageConfig.getMessage(Messages.ERROR_BED));
|
||||||
event.setCancelled(true);
|
event.setCancelled(true);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -136,7 +135,7 @@ public class PlayerListener implements Listener {
|
|||||||
if (event.getAction() != Action.LEFT_CLICK_BLOCK) {
|
if (event.getAction() != Action.LEFT_CLICK_BLOCK) {
|
||||||
if (clickedBlock.getType() == Material.DISPENSER) {
|
if (clickedBlock.getType() == Material.DISPENSER) {
|
||||||
if ( !player.hasPermission("dxl.bypass")) {
|
if ( !player.hasPermission("dxl.bypass")) {
|
||||||
MessageUtil.sendMessage(player, dMessages.getMessage(Messages.ERROR_DISPENSER));
|
MessageUtil.sendMessage(player, messageConfig.getMessage(Messages.ERROR_DISPENSER));
|
||||||
event.setCancelled(true);
|
event.setCancelled(true);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -154,13 +153,13 @@ public class PlayerListener implements Listener {
|
|||||||
if (dportal.getPlayer() == player) {
|
if (dportal.getPlayer() == player) {
|
||||||
if (dportal.getBlock1() == null) {
|
if (dportal.getBlock1() == null) {
|
||||||
dportal.setBlock1(event.getClickedBlock());
|
dportal.setBlock1(event.getClickedBlock());
|
||||||
MessageUtil.sendMessage(player, dMessages.getMessage(Messages.PLAYER_PORTAL_PROGRESS));
|
MessageUtil.sendMessage(player, messageConfig.getMessage(Messages.PLAYER_PORTAL_PROGRESS));
|
||||||
|
|
||||||
} else if (dportal.getBlock2() == null) {
|
} else if (dportal.getBlock2() == null) {
|
||||||
dportal.setBlock2(event.getClickedBlock());
|
dportal.setBlock2(event.getClickedBlock());
|
||||||
dportal.setActive(true);
|
dportal.setActive(true);
|
||||||
dportal.create();
|
dportal.create();
|
||||||
MessageUtil.sendMessage(player, dMessages.getMessage(Messages.PLAYER_PORTAL_CREATED));
|
MessageUtil.sendMessage(player, messageConfig.getMessage(Messages.PLAYER_PORTAL_CREATED));
|
||||||
}
|
}
|
||||||
event.setCancelled(true);
|
event.setCancelled(true);
|
||||||
}
|
}
|
||||||
@ -240,7 +239,7 @@ public class PlayerListener implements Listener {
|
|||||||
if (event.getAction() == Action.LEFT_CLICK_BLOCK) {
|
if (event.getAction() == Action.LEFT_CLICK_BLOCK) {
|
||||||
trigger.onTrigger(player);
|
trigger.onTrigger(player);
|
||||||
} else {
|
} else {
|
||||||
MessageUtil.sendMessage(player, dMessages.getMessage(Messages.ERROR_LEFT_CLICK));
|
MessageUtil.sendMessage(player, messageConfig.getMessage(Messages.ERROR_LEFT_CLICK));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -251,7 +250,7 @@ public class PlayerListener implements Listener {
|
|||||||
if (event.getAction() == Action.LEFT_CLICK_BLOCK) {
|
if (event.getAction() == Action.LEFT_CLICK_BLOCK) {
|
||||||
dPlayer.setDClass(ChatColor.stripColor(classSign.getLine(1)));
|
dPlayer.setDClass(ChatColor.stripColor(classSign.getLine(1)));
|
||||||
} else {
|
} else {
|
||||||
MessageUtil.sendMessage(player, dMessages.getMessage(Messages.ERROR_LEFT_CLICK));
|
MessageUtil.sendMessage(player, messageConfig.getMessage(Messages.ERROR_LEFT_CLICK));
|
||||||
}
|
}
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@ -291,7 +290,7 @@ public class PlayerListener implements Listener {
|
|||||||
for (Material material : gameWorld.getConfig().getSecureObjects()) {
|
for (Material material : gameWorld.getConfig().getSecureObjects()) {
|
||||||
if (material == event.getItemDrop().getItemStack().getType()) {
|
if (material == event.getItemDrop().getItemStack().getType()) {
|
||||||
event.setCancelled(true);
|
event.setCancelled(true);
|
||||||
MessageUtil.sendMessage(player, dMessages.getMessage(Messages.ERROR_DROP));
|
MessageUtil.sendMessage(player, messageConfig.getMessage(Messages.ERROR_DROP));
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -335,7 +334,7 @@ public class PlayerListener implements Listener {
|
|||||||
// Da einige Plugins einen anderen Respawn setzen wird
|
// Da einige Plugins einen anderen Respawn setzen wird
|
||||||
// ein Scheduler gestartet der den Player nach einer
|
// ein Scheduler gestartet der den Player nach einer
|
||||||
// Sekunde teleportiert.
|
// Sekunde teleportiert.
|
||||||
plugin.getServer().getScheduler().scheduleSyncDelayedTask(plugin, new RespawnRunnable(player, dGroup.getGameWorld().getLocStart()), 10);
|
new RespawnTask(player, dGroup.getGameWorld().getLocStart()).runTaskLater(plugin, 10L);
|
||||||
|
|
||||||
if (dPlayer.getWolf() != null) {
|
if (dPlayer.getWolf() != null) {
|
||||||
dPlayer.getWolf().teleport(dGroup.getGameWorld().getLocStart());
|
dPlayer.getWolf().teleport(dGroup.getGameWorld().getLocStart());
|
||||||
@ -347,7 +346,7 @@ public class PlayerListener implements Listener {
|
|||||||
// Da einige Plugins einen anderen Respawn setzen wird
|
// Da einige Plugins einen anderen Respawn setzen wird
|
||||||
// ein Scheduler gestartet der den Player nach einer
|
// ein Scheduler gestartet der den Player nach einer
|
||||||
// Sekunde teleportiert.
|
// Sekunde teleportiert.
|
||||||
plugin.getServer().getScheduler().scheduleSyncDelayedTask(plugin, new RespawnRunnable(player, dPlayer.getCheckpoint()), 10);
|
new RespawnTask(player, dPlayer.getCheckpoint()).runTaskLater(plugin, 10L);
|
||||||
|
|
||||||
if (dPlayer.getWolf() != null) {
|
if (dPlayer.getWolf() != null) {
|
||||||
dPlayer.getWolf().teleport(dPlayer.getCheckpoint());
|
dPlayer.getWolf().teleport(dPlayer.getCheckpoint());
|
||||||
@ -420,11 +419,11 @@ public class PlayerListener implements Listener {
|
|||||||
dPlayer.leave();
|
dPlayer.leave();
|
||||||
|
|
||||||
} else if (timeUntilKickOfflinePlayer > 0) {
|
} else if (timeUntilKickOfflinePlayer > 0) {
|
||||||
dGroup.sendMessage(dMessages.getMessage(Messages.PLAYER_OFFLINE, dPlayer.getPlayer().getName(), "" + timeUntilKickOfflinePlayer), player);
|
dGroup.sendMessage(messageConfig.getMessage(Messages.PLAYER_OFFLINE, dPlayer.getPlayer().getName(), "" + timeUntilKickOfflinePlayer), player);
|
||||||
dPlayer.setOfflineTime(System.currentTimeMillis() + timeUntilKickOfflinePlayer * 1000);
|
dPlayer.setOfflineTime(System.currentTimeMillis() + timeUntilKickOfflinePlayer * 1000);
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
dGroup.sendMessage(dMessages.getMessage(Messages.PLAYER_OFFLINE_NEVER, dPlayer.getPlayer().getName()), player);
|
dGroup.sendMessage(messageConfig.getMessage(Messages.PLAYER_OFFLINE_NEVER, dPlayer.getPlayer().getName()), player);
|
||||||
}
|
}
|
||||||
|
|
||||||
} else if (dPlayer.isEditing()) {
|
} else if (dPlayer.isEditing()) {
|
||||||
@ -490,7 +489,7 @@ public class PlayerListener implements Listener {
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (dGroup.getGameWorld() == null) {
|
if (dGroup.getGameWorld() == null) {
|
||||||
MessageUtil.sendMessage(player, dMessages.getMessage(Messages.ERROR_TUTORIAL_NOT_EXIST));
|
MessageUtil.sendMessage(player, messageConfig.getMessage(Messages.ERROR_TUTORIAL_NOT_EXIST));
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -544,7 +543,7 @@ public class PlayerListener implements Listener {
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (event.isCancelled()) {
|
if (event.isCancelled()) {
|
||||||
MessageUtil.sendMessage(event.getPlayer(), dMessages.getMessage(Messages.ERROR_CMD));
|
MessageUtil.sendMessage(event.getPlayer(), messageConfig.getMessage(Messages.ERROR_CMD));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -599,37 +598,4 @@ public class PlayerListener implements Listener {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Etc. ---------------------------------
|
|
||||||
|
|
||||||
public class RespawnRunnable implements Runnable {
|
|
||||||
private Player player;
|
|
||||||
private Location location;
|
|
||||||
|
|
||||||
public RespawnRunnable(Player player, Location location) {
|
|
||||||
this.location = location;
|
|
||||||
this.player = player;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void run() {
|
|
||||||
if (player.getLocation().distance(location) > 2) {
|
|
||||||
MiscUtil.secureTeleport(player, location);
|
|
||||||
}
|
|
||||||
|
|
||||||
DPlayer dPlayer = DPlayer.getByPlayer(player);
|
|
||||||
|
|
||||||
if (dPlayer == null) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
// Respawn Items
|
|
||||||
if (dPlayer.getRespawnInventory() != null || dPlayer.getRespawnArmor() != null) {
|
|
||||||
player.getInventory().setContents(dPlayer.getRespawnInventory());
|
|
||||||
player.getInventory().setArmorContents(dPlayer.getRespawnArmor());
|
|
||||||
dPlayer.setRespawnInventory(null);
|
|
||||||
dPlayer.setRespawnArmor(null);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -1,8 +1,8 @@
|
|||||||
package io.github.dre2n.dungeonsxl.mob;
|
package io.github.dre2n.dungeonsxl.mob;
|
||||||
|
|
||||||
import io.github.dre2n.dungeonsxl.DungeonsXL;
|
import io.github.dre2n.dungeonsxl.DungeonsXL;
|
||||||
|
import io.github.dre2n.dungeonsxl.config.MessageConfig.Messages;
|
||||||
import io.github.dre2n.dungeonsxl.dungeon.game.GameWorld;
|
import io.github.dre2n.dungeonsxl.dungeon.game.GameWorld;
|
||||||
import io.github.dre2n.dungeonsxl.file.DMessages.Messages;
|
|
||||||
import io.github.dre2n.dungeonsxl.util.NumberUtil;
|
import io.github.dre2n.dungeonsxl.util.NumberUtil;
|
||||||
|
|
||||||
import java.util.Arrays;
|
import java.util.Arrays;
|
||||||
@ -112,7 +112,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.getDMessages().getMessage(Messages.LOG_ERROR_MOBTYPE, configFile.getString(mobName + ".Type")));
|
plugin.getLogger().info(plugin.getMessageConfig().getMessage(Messages.LOG_ERROR_MOBTYPE, configFile.getString(mobName + ".Type")));
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -194,7 +194,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.getDMessages().getMessage(Messages.LOG_ERROR_MOB_ENCHANTMENT, splittedEnchantment[0]));
|
plugin.getLogger().info(plugin.getMessageConfig().getMessage(Messages.LOG_ERROR_MOB_ENCHANTMENT, splittedEnchantment[0]));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -233,8 +233,8 @@ public class DMobType {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (plugin.getMainConfig().defaultDungeon != null) {
|
if (plugin.getMainConfig().getDefaultWorldConfig() != null) {
|
||||||
for (DMobType mobType : plugin.getMainConfig().defaultDungeon.getMobTypes()) {
|
for (DMobType mobType : plugin.getMainConfig().getDefaultWorldConfig().getMobTypes()) {
|
||||||
if (mobType.name.equalsIgnoreCase(name)) {
|
if (mobType.name.equalsIgnoreCase(name)) {
|
||||||
return mobType;
|
return mobType;
|
||||||
}
|
}
|
||||||
|
@ -1,12 +1,12 @@
|
|||||||
package io.github.dre2n.dungeonsxl.player;
|
package io.github.dre2n.dungeonsxl.player;
|
||||||
|
|
||||||
import io.github.dre2n.dungeonsxl.DungeonsXL;
|
import io.github.dre2n.dungeonsxl.DungeonsXL;
|
||||||
|
import io.github.dre2n.dungeonsxl.config.MessageConfig.Messages;
|
||||||
import io.github.dre2n.dungeonsxl.dungeon.Dungeon;
|
import io.github.dre2n.dungeonsxl.dungeon.Dungeon;
|
||||||
import io.github.dre2n.dungeonsxl.dungeon.game.GameWorld;
|
import io.github.dre2n.dungeonsxl.dungeon.game.GameWorld;
|
||||||
import io.github.dre2n.dungeonsxl.event.dgroup.DGroupStartFloorEvent;
|
import io.github.dre2n.dungeonsxl.event.dgroup.DGroupStartFloorEvent;
|
||||||
import io.github.dre2n.dungeonsxl.event.requirement.RequirementDemandEvent;
|
import io.github.dre2n.dungeonsxl.event.requirement.RequirementDemandEvent;
|
||||||
import io.github.dre2n.dungeonsxl.event.reward.RewardAdditionEvent;
|
import io.github.dre2n.dungeonsxl.event.reward.RewardAdditionEvent;
|
||||||
import io.github.dre2n.dungeonsxl.file.DMessages.Messages;
|
|
||||||
import io.github.dre2n.dungeonsxl.global.GroupSign;
|
import io.github.dre2n.dungeonsxl.global.GroupSign;
|
||||||
import io.github.dre2n.dungeonsxl.requirement.Requirement;
|
import io.github.dre2n.dungeonsxl.requirement.Requirement;
|
||||||
import io.github.dre2n.dungeonsxl.reward.Reward;
|
import io.github.dre2n.dungeonsxl.reward.Reward;
|
||||||
@ -101,7 +101,7 @@ public class DGroup {
|
|||||||
public void addPlayer(Player player) {
|
public void addPlayer(Player player) {
|
||||||
// Send message
|
// Send message
|
||||||
for (Player groupPlayer : getPlayers()) {
|
for (Player groupPlayer : getPlayers()) {
|
||||||
MessageUtil.sendMessage(groupPlayer, plugin.getDMessages().getMessage(Messages.PLAYER_JOIN_GROUP, player.getName()));
|
MessageUtil.sendMessage(groupPlayer, plugin.getMessageConfig().getMessage(Messages.PLAYER_JOIN_GROUP, player.getName()));
|
||||||
}
|
}
|
||||||
|
|
||||||
// Add player
|
// Add player
|
||||||
@ -118,7 +118,7 @@ public class DGroup {
|
|||||||
|
|
||||||
// Send message
|
// Send message
|
||||||
for (Player groupPlayer : getPlayers()) {
|
for (Player groupPlayer : getPlayers()) {
|
||||||
MessageUtil.sendMessage(groupPlayer, plugin.getDMessages().getMessage(Messages.PLAYER_LEFT_GROUP, player.getName()));
|
MessageUtil.sendMessage(groupPlayer, plugin.getMessageConfig().getMessage(Messages.PLAYER_LEFT_GROUP, player.getName()));
|
||||||
}
|
}
|
||||||
|
|
||||||
// Check group
|
// Check group
|
||||||
@ -325,7 +325,7 @@ public class DGroup {
|
|||||||
public void sendMessage(String message) {
|
public void sendMessage(String message) {
|
||||||
for (Player player : players) {
|
for (Player player : players) {
|
||||||
if (player.isOnline()) {
|
if (player.isOnline()) {
|
||||||
MessageUtil.sendCenteredMessage(player, message);
|
MessageUtil.sendMessage(player, message);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -339,7 +339,7 @@ public class DGroup {
|
|||||||
public void sendMessage(String message, Player... except) {
|
public void sendMessage(String message, Player... except) {
|
||||||
for (Player player : players) {
|
for (Player player : players) {
|
||||||
if (player.isOnline() && !player.equals(except)) {
|
if (player.isOnline() && !player.equals(except)) {
|
||||||
MessageUtil.sendCenteredMessage(player, message);
|
MessageUtil.sendMessage(player, message);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1,8 +1,10 @@
|
|||||||
package io.github.dre2n.dungeonsxl.player;
|
package io.github.dre2n.dungeonsxl.player;
|
||||||
|
|
||||||
import io.github.dre2n.dungeonsxl.DungeonsXL;
|
import io.github.dre2n.dungeonsxl.DungeonsXL;
|
||||||
import io.github.dre2n.dungeonsxl.dungeon.DungeonConfig;
|
import io.github.dre2n.dungeonsxl.config.DungeonConfig;
|
||||||
import io.github.dre2n.dungeonsxl.dungeon.WorldConfig;
|
import io.github.dre2n.dungeonsxl.config.MessageConfig;
|
||||||
|
import io.github.dre2n.dungeonsxl.config.WorldConfig;
|
||||||
|
import io.github.dre2n.dungeonsxl.config.MessageConfig.Messages;
|
||||||
import io.github.dre2n.dungeonsxl.dungeon.DLootInventory;
|
import io.github.dre2n.dungeonsxl.dungeon.DLootInventory;
|
||||||
import io.github.dre2n.dungeonsxl.dungeon.EditWorld;
|
import io.github.dre2n.dungeonsxl.dungeon.EditWorld;
|
||||||
import io.github.dre2n.dungeonsxl.dungeon.game.GameWorld;
|
import io.github.dre2n.dungeonsxl.dungeon.game.GameWorld;
|
||||||
@ -11,12 +13,10 @@ import io.github.dre2n.dungeonsxl.event.dgroup.DGroupFinishFloorEvent;
|
|||||||
import io.github.dre2n.dungeonsxl.event.dplayer.DPlayerFinishEvent;
|
import io.github.dre2n.dungeonsxl.event.dplayer.DPlayerFinishEvent;
|
||||||
import io.github.dre2n.dungeonsxl.event.dplayer.DPlayerKickEvent;
|
import io.github.dre2n.dungeonsxl.event.dplayer.DPlayerKickEvent;
|
||||||
import io.github.dre2n.dungeonsxl.event.dplayer.DPlayerUpdateEvent;
|
import io.github.dre2n.dungeonsxl.event.dplayer.DPlayerUpdateEvent;
|
||||||
import io.github.dre2n.dungeonsxl.file.DMessages;
|
|
||||||
import io.github.dre2n.dungeonsxl.file.DMessages.Messages;
|
|
||||||
import io.github.dre2n.dungeonsxl.reward.Reward;
|
import io.github.dre2n.dungeonsxl.reward.Reward;
|
||||||
import io.github.dre2n.dungeonsxl.trigger.DistanceTrigger;
|
import io.github.dre2n.dungeonsxl.trigger.DistanceTrigger;
|
||||||
import io.github.dre2n.dungeonsxl.util.NumberUtil;
|
import io.github.dre2n.dungeonsxl.util.NumberUtil;
|
||||||
import io.github.dre2n.dungeonsxl.util.MiscUtil;
|
import io.github.dre2n.dungeonsxl.util.playerutil.PlayerUtil;
|
||||||
import io.github.dre2n.dungeonsxl.util.messageutil.MessageUtil;
|
import io.github.dre2n.dungeonsxl.util.messageutil.MessageUtil;
|
||||||
|
|
||||||
import java.io.File;
|
import java.io.File;
|
||||||
@ -44,7 +44,7 @@ import org.bukkit.potion.PotionEffect;
|
|||||||
public class DPlayer {
|
public class DPlayer {
|
||||||
|
|
||||||
static DungeonsXL plugin = DungeonsXL.getPlugin();
|
static DungeonsXL plugin = DungeonsXL.getPlugin();
|
||||||
DMessages dMessages = plugin.getDMessages();
|
MessageConfig MessageConfig = plugin.getMessageConfig();
|
||||||
|
|
||||||
// Variables
|
// Variables
|
||||||
private Player player;
|
private Player player;
|
||||||
@ -67,7 +67,7 @@ public class DPlayer {
|
|||||||
private ItemStack[] respawnArmor;
|
private ItemStack[] respawnArmor;
|
||||||
private String[] linesCopy;
|
private String[] linesCopy;
|
||||||
|
|
||||||
private Inventory treasureInv = plugin.getServer().createInventory(getPlayer(), 45, dMessages.getMessage(Messages.PLAYER_TREASURES));
|
private Inventory treasureInv = plugin.getServer().createInventory(getPlayer(), 45, MessageConfig.getMessage(Messages.PLAYER_TREASURES));
|
||||||
|
|
||||||
private int initialLives = -1;
|
private int initialLives = -1;
|
||||||
private int lives;
|
private int lives;
|
||||||
@ -102,7 +102,7 @@ public class DPlayer {
|
|||||||
lives = initialLives;
|
lives = initialLives;
|
||||||
}
|
}
|
||||||
|
|
||||||
MiscUtil.secureTeleport(this.getPlayer(), teleport);
|
PlayerUtil.secureTeleport(this.getPlayer(), teleport);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void clearPlayerData() {
|
public void clearPlayerData() {
|
||||||
@ -117,330 +117,7 @@ public class DPlayer {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public void escape() {
|
// Getters and setters
|
||||||
remove(this);
|
|
||||||
savePlayer.reset(false);
|
|
||||||
}
|
|
||||||
|
|
||||||
public void leave() {
|
|
||||||
remove(this);
|
|
||||||
if ( !editing) {
|
|
||||||
WorldConfig dConfig = GameWorld.getByWorld(world).getConfig();
|
|
||||||
if (finished) {
|
|
||||||
savePlayer.reset(dConfig.getKeepInventoryOnFinish());
|
|
||||||
} else {
|
|
||||||
savePlayer.reset(dConfig.getKeepInventoryOnEscape());
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
savePlayer.reset(false);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (editing) {
|
|
||||||
EditWorld editWorld = EditWorld.getByWorld(world);
|
|
||||||
if (editWorld != null) {
|
|
||||||
editWorld.save();
|
|
||||||
}
|
|
||||||
|
|
||||||
} else {
|
|
||||||
GameWorld gameWorld = GameWorld.getByWorld(world);
|
|
||||||
DGroup dGroup = DGroup.getByPlayer(getPlayer());
|
|
||||||
if (dGroup != null) {
|
|
||||||
dGroup.removePlayer(getPlayer());
|
|
||||||
}
|
|
||||||
|
|
||||||
// Belohnung
|
|
||||||
if ( !inTestMode) {// Nur wenn man nicht am Testen ist
|
|
||||||
if (finished) {
|
|
||||||
for (Reward reward : gameWorld.getConfig().getRewards()) {
|
|
||||||
reward.giveTo(player);
|
|
||||||
}
|
|
||||||
|
|
||||||
addTreasure();
|
|
||||||
|
|
||||||
// Set Time
|
|
||||||
File file = new File(plugin.getDataFolder() + "/maps/" + gameWorld.getMapName(), "players.yml");
|
|
||||||
|
|
||||||
if ( !file.exists()) {
|
|
||||||
try {
|
|
||||||
file.createNewFile();
|
|
||||||
} catch (IOException e) {
|
|
||||||
e.printStackTrace();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
FileConfiguration playerConfig = YamlConfiguration.loadConfiguration(file);
|
|
||||||
|
|
||||||
playerConfig.set(getPlayer().getUniqueId().toString(), System.currentTimeMillis());
|
|
||||||
|
|
||||||
try {
|
|
||||||
playerConfig.save(file);
|
|
||||||
|
|
||||||
} catch (IOException exception) {
|
|
||||||
exception.printStackTrace();
|
|
||||||
}
|
|
||||||
|
|
||||||
// Tutorial Permissions
|
|
||||||
if (gameWorld.isTutorial()) {
|
|
||||||
String endGroup = plugin.getMainConfig().getTutorialEndGroup();
|
|
||||||
if (plugin.isGroupEnabled(endGroup)) {
|
|
||||||
plugin.getPermissionProvider().playerAddGroup(getPlayer(), endGroup);
|
|
||||||
}
|
|
||||||
|
|
||||||
String startGroup = plugin.getMainConfig().getTutorialStartGroup();
|
|
||||||
if (plugin.isGroupEnabled(startGroup)) {
|
|
||||||
plugin.getPermissionProvider().playerRemoveGroup(getPlayer(), startGroup);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// Give Secure Objects other Players
|
|
||||||
if (dGroup != null) {
|
|
||||||
if ( !dGroup.isEmpty()) {
|
|
||||||
int i = 0;
|
|
||||||
Player groupPlayer;
|
|
||||||
do {
|
|
||||||
groupPlayer = dGroup.getPlayers().get(i);
|
|
||||||
if (groupPlayer != null) {
|
|
||||||
for (ItemStack istack : getPlayer().getInventory()) {
|
|
||||||
if (istack != null) {
|
|
||||||
if (gameWorld.getSecureObjects().contains(istack.getType())) {
|
|
||||||
groupPlayer.getInventory().addItem(istack);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
i++;
|
|
||||||
} while (groupPlayer == null);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
public void ready() {
|
|
||||||
ready = true;
|
|
||||||
|
|
||||||
DGroup dGroup = DGroup.getByPlayer(getPlayer());
|
|
||||||
if ( !dGroup.isPlaying()) {
|
|
||||||
if (dGroup != null) {
|
|
||||||
for (Player player : dGroup.getPlayers()) {
|
|
||||||
DPlayer dPlayer = getByPlayer(player);
|
|
||||||
if ( !dPlayer.ready) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
dGroup.startGame();
|
|
||||||
} else {
|
|
||||||
respawn();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
public void respawn() {
|
|
||||||
DGroup dGroup = DGroup.getByPlayer(getPlayer());
|
|
||||||
if (checkpoint == null) {
|
|
||||||
MiscUtil.secureTeleport(getPlayer(), dGroup.getGameWorld().getLocStart());
|
|
||||||
} else {
|
|
||||||
MiscUtil.secureTeleport(getPlayer(), checkpoint);
|
|
||||||
}
|
|
||||||
if (wolf != null) {
|
|
||||||
wolf.teleport(getPlayer());
|
|
||||||
}
|
|
||||||
|
|
||||||
// Respawn Items
|
|
||||||
if (GameWorld.getByWorld(world).getConfig().getKeepInventoryOnDeath()) {
|
|
||||||
if (respawnInventory != null || respawnArmor != null) {
|
|
||||||
getPlayer().getInventory().setContents(respawnInventory);
|
|
||||||
getPlayer().getInventory().setArmorContents(respawnArmor);
|
|
||||||
respawnInventory = null;
|
|
||||||
respawnArmor = null;
|
|
||||||
}
|
|
||||||
// P.plugin.updateInventory(this.player);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
public void finishFloor(String specifiedFloor) {
|
|
||||||
MessageUtil.sendMessage(getPlayer(), dMessages.getMessage(Messages.PLAYER_FINISHED_DUNGEON));
|
|
||||||
finished = true;
|
|
||||||
|
|
||||||
DGroup dGroup = DGroup.getByPlayer(getPlayer());
|
|
||||||
if (dGroup == null) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
if ( !dGroup.isPlaying()) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
for (Player player : dGroup.getPlayers()) {
|
|
||||||
DPlayer dPlayer = getByPlayer(player);
|
|
||||||
if ( !dPlayer.finished) {
|
|
||||||
MessageUtil.sendMessage(this.getPlayer(), dMessages.getMessage(Messages.PLAYER_WAIT_FOR_OTHER_PLAYERS));
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
boolean invalid = false;
|
|
||||||
|
|
||||||
if (dGroup.getDungeon() == null) {
|
|
||||||
invalid = true;
|
|
||||||
}
|
|
||||||
|
|
||||||
for (Player player : dGroup.getPlayers()) {
|
|
||||||
DPlayer dPlayer = getByPlayer(player);
|
|
||||||
|
|
||||||
if (invalid) {
|
|
||||||
dPlayer.leave();
|
|
||||||
|
|
||||||
} else {
|
|
||||||
dPlayer.finished = false;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if (invalid) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
DungeonConfig dConfig = dGroup.getDungeon().getConfig();
|
|
||||||
int random = NumberUtil.generateRandomInt(0, dConfig.getFloors().size());
|
|
||||||
String newFloor = dGroup.getUnplayedFloors().get(random);
|
|
||||||
if (dConfig.getFloorCount() == dGroup.getFloorCount() - 1) {
|
|
||||||
newFloor = dConfig.getEndFloor();
|
|
||||||
|
|
||||||
} else if (specifiedFloor != null) {
|
|
||||||
newFloor = specifiedFloor;
|
|
||||||
}
|
|
||||||
|
|
||||||
DGroupFinishFloorEvent event = new DGroupFinishFloorEvent(dGroup, dGroup.getGameWorld(), newFloor);
|
|
||||||
|
|
||||||
if (event.isCancelled()) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
dGroup.removeUnplayedFloor(dGroup.getMapName());
|
|
||||||
dGroup.setMapName(newFloor);
|
|
||||||
GameWorld gameWorld = GameWorld.load(newFloor);
|
|
||||||
dGroup.setGameWorld(gameWorld);
|
|
||||||
for (Player player : dGroup.getPlayers()) {
|
|
||||||
DPlayer dPlayer = getByPlayer(player);
|
|
||||||
dPlayer.setWorld(gameWorld.getWorld());
|
|
||||||
dPlayer.setCheckpoint(dGroup.getGameWorld().getLocStart());
|
|
||||||
if (dPlayer.getWolf() != null) {
|
|
||||||
dPlayer.getWolf().teleport(dPlayer.getCheckpoint());
|
|
||||||
}
|
|
||||||
}
|
|
||||||
dGroup.startGame();
|
|
||||||
}
|
|
||||||
|
|
||||||
public void finish() {
|
|
||||||
MessageUtil.sendMessage(getPlayer(), dMessages.getMessage(Messages.PLAYER_FINISHED_DUNGEON));
|
|
||||||
finished = true;
|
|
||||||
|
|
||||||
DGroup dGroup = DGroup.getByPlayer(getPlayer());
|
|
||||||
if (dGroup == null) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
if ( !dGroup.isPlaying()) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
boolean first = true;
|
|
||||||
boolean hasToWait = false;
|
|
||||||
|
|
||||||
for (Player player : dGroup.getPlayers()) {
|
|
||||||
DPlayer dPlayer = getByPlayer(player);
|
|
||||||
if ( !dPlayer.finished) {
|
|
||||||
MessageUtil.sendMessage(this.getPlayer(), dMessages.getMessage(Messages.PLAYER_WAIT_FOR_OTHER_PLAYERS));
|
|
||||||
hasToWait = true;
|
|
||||||
|
|
||||||
} else if (dPlayer != this) {
|
|
||||||
first = false;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
DPlayerFinishEvent dPlayerFinishEvent = new DPlayerFinishEvent(this, first, hasToWait);
|
|
||||||
|
|
||||||
if (dPlayerFinishEvent.isCancelled()) {
|
|
||||||
finished = false;
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (hasToWait) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
DGroupFinishDungeonEvent dGroupFinishDungeonEvent = new DGroupFinishDungeonEvent(dGroup);
|
|
||||||
|
|
||||||
if (dGroupFinishDungeonEvent.isCancelled()) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
for (Player player : dGroup.getPlayers()) {
|
|
||||||
DPlayer dPlayer = getByPlayer(player);
|
|
||||||
dPlayer.leave();
|
|
||||||
|
|
||||||
for (Reward reward : dGroup.getRewards()) {
|
|
||||||
reward.giveTo(player);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
public void sendMessage(String message) {
|
|
||||||
if (editing) {
|
|
||||||
EditWorld editWorld = EditWorld.getByWorld(world);
|
|
||||||
editWorld.msg(message);
|
|
||||||
for (Player player : plugin.getChatSpyers()) {
|
|
||||||
if ( !editWorld.getWorld().getPlayers().contains(player)) {
|
|
||||||
MessageUtil.sendMessage(player, ChatColor.GREEN + "[Chatspy] " + ChatColor.WHITE + message);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
} else {
|
|
||||||
GameWorld gameWorld = GameWorld.getByWorld(world);
|
|
||||||
gameWorld.msg(message);
|
|
||||||
for (Player player : plugin.getChatSpyers()) {
|
|
||||||
if ( !gameWorld.getWorld().getPlayers().contains(player)) {
|
|
||||||
MessageUtil.sendMessage(player, ChatColor.GREEN + "[Chatspy] " + ChatColor.WHITE + message);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
@SuppressWarnings("deprecation")
|
|
||||||
public void poke(Block block) {
|
|
||||||
if (block.getState() instanceof Sign) {
|
|
||||||
Sign sign = (Sign) block.getState();
|
|
||||||
String[] lines = sign.getLines();
|
|
||||||
if (lines[0].equals("") && lines[1].equals("") && lines[2].equals("") && lines[3].equals("")) {
|
|
||||||
if (linesCopy != null) {
|
|
||||||
SignChangeEvent event = new SignChangeEvent(block, getPlayer(), linesCopy);
|
|
||||||
plugin.getServer().getPluginManager().callEvent(event);
|
|
||||||
if ( !event.isCancelled()) {
|
|
||||||
sign.setLine(0, event.getLine(0));
|
|
||||||
sign.setLine(1, event.getLine(1));
|
|
||||||
sign.setLine(2, event.getLine(2));
|
|
||||||
sign.setLine(3, event.getLine(3));
|
|
||||||
sign.update();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
linesCopy = lines;
|
|
||||||
MessageUtil.sendMessage(getPlayer(), dMessages.getMessage(Messages.PLAYER_SIGN_COPIED));
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
String info = "" + block.getType();
|
|
||||||
if (block.getData() != 0) {
|
|
||||||
info = info + "," + block.getData();
|
|
||||||
}
|
|
||||||
MessageUtil.sendMessage(getPlayer(), dMessages.getMessage(Messages.PLAYER_BLOCK_INFO, info));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
public void addTreasure() {
|
|
||||||
new DLootInventory(getPlayer(), treasureInv.getContents());
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @return the player
|
* @return the player
|
||||||
@ -795,6 +472,442 @@ public class DPlayer {
|
|||||||
this.lives = lives;
|
this.lives = lives;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// ...
|
||||||
|
|
||||||
|
public void escape() {
|
||||||
|
remove(this);
|
||||||
|
savePlayer.reset(false);
|
||||||
|
}
|
||||||
|
|
||||||
|
public void leave() {
|
||||||
|
remove(this);
|
||||||
|
if ( !editing) {
|
||||||
|
WorldConfig dConfig = GameWorld.getByWorld(world).getConfig();
|
||||||
|
if (finished) {
|
||||||
|
savePlayer.reset(dConfig.getKeepInventoryOnFinish());
|
||||||
|
} else {
|
||||||
|
savePlayer.reset(dConfig.getKeepInventoryOnEscape());
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
savePlayer.reset(false);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (editing) {
|
||||||
|
EditWorld editWorld = EditWorld.getByWorld(world);
|
||||||
|
if (editWorld != null) {
|
||||||
|
editWorld.save();
|
||||||
|
}
|
||||||
|
|
||||||
|
} else {
|
||||||
|
GameWorld gameWorld = GameWorld.getByWorld(world);
|
||||||
|
DGroup dGroup = DGroup.getByPlayer(getPlayer());
|
||||||
|
if (dGroup != null) {
|
||||||
|
dGroup.removePlayer(getPlayer());
|
||||||
|
}
|
||||||
|
|
||||||
|
// Belohnung
|
||||||
|
if ( !inTestMode) {// Nur wenn man nicht am Testen ist
|
||||||
|
if (finished) {
|
||||||
|
for (Reward reward : gameWorld.getConfig().getRewards()) {
|
||||||
|
reward.giveTo(player);
|
||||||
|
}
|
||||||
|
|
||||||
|
addTreasure();
|
||||||
|
|
||||||
|
// Set Time
|
||||||
|
File file = new File(plugin.getDataFolder() + "/maps/" + gameWorld.getMapName(), "players.yml");
|
||||||
|
|
||||||
|
if ( !file.exists()) {
|
||||||
|
try {
|
||||||
|
file.createNewFile();
|
||||||
|
} catch (IOException e) {
|
||||||
|
e.printStackTrace();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
FileConfiguration playerConfig = YamlConfiguration.loadConfiguration(file);
|
||||||
|
|
||||||
|
playerConfig.set(getPlayer().getUniqueId().toString(), System.currentTimeMillis());
|
||||||
|
|
||||||
|
try {
|
||||||
|
playerConfig.save(file);
|
||||||
|
|
||||||
|
} catch (IOException exception) {
|
||||||
|
exception.printStackTrace();
|
||||||
|
}
|
||||||
|
|
||||||
|
// Tutorial Permissions
|
||||||
|
if (gameWorld.isTutorial()) {
|
||||||
|
String endGroup = plugin.getMainConfig().getTutorialEndGroup();
|
||||||
|
if (plugin.isGroupEnabled(endGroup)) {
|
||||||
|
plugin.getPermissionProvider().playerAddGroup(getPlayer(), endGroup);
|
||||||
|
}
|
||||||
|
|
||||||
|
String startGroup = plugin.getMainConfig().getTutorialStartGroup();
|
||||||
|
if (plugin.isGroupEnabled(startGroup)) {
|
||||||
|
plugin.getPermissionProvider().playerRemoveGroup(getPlayer(), startGroup);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// Give Secure Objects other Players
|
||||||
|
if (dGroup != null) {
|
||||||
|
if ( !dGroup.isEmpty()) {
|
||||||
|
int i = 0;
|
||||||
|
Player groupPlayer;
|
||||||
|
do {
|
||||||
|
groupPlayer = dGroup.getPlayers().get(i);
|
||||||
|
if (groupPlayer != null) {
|
||||||
|
for (ItemStack istack : getPlayer().getInventory()) {
|
||||||
|
if (istack != null) {
|
||||||
|
if (gameWorld.getSecureObjects().contains(istack.getType())) {
|
||||||
|
groupPlayer.getInventory().addItem(istack);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
i++;
|
||||||
|
} while (groupPlayer == null);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public void ready() {
|
||||||
|
ready = true;
|
||||||
|
|
||||||
|
DGroup dGroup = DGroup.getByPlayer(getPlayer());
|
||||||
|
if ( !dGroup.isPlaying()) {
|
||||||
|
if (dGroup != null) {
|
||||||
|
for (Player player : dGroup.getPlayers()) {
|
||||||
|
DPlayer dPlayer = getByPlayer(player);
|
||||||
|
if ( !dPlayer.ready) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
dGroup.startGame();
|
||||||
|
} else {
|
||||||
|
respawn();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public void respawn() {
|
||||||
|
DGroup dGroup = DGroup.getByPlayer(getPlayer());
|
||||||
|
if (checkpoint == null) {
|
||||||
|
PlayerUtil.secureTeleport(getPlayer(), dGroup.getGameWorld().getLocStart());
|
||||||
|
} else {
|
||||||
|
PlayerUtil.secureTeleport(getPlayer(), checkpoint);
|
||||||
|
}
|
||||||
|
if (wolf != null) {
|
||||||
|
wolf.teleport(getPlayer());
|
||||||
|
}
|
||||||
|
|
||||||
|
// Respawn Items
|
||||||
|
if (GameWorld.getByWorld(world).getConfig().getKeepInventoryOnDeath()) {
|
||||||
|
if (respawnInventory != null || respawnArmor != null) {
|
||||||
|
getPlayer().getInventory().setContents(respawnInventory);
|
||||||
|
getPlayer().getInventory().setArmorContents(respawnArmor);
|
||||||
|
respawnInventory = null;
|
||||||
|
respawnArmor = null;
|
||||||
|
}
|
||||||
|
// P.plugin.updateInventory(this.player);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public void finishFloor(String specifiedFloor) {
|
||||||
|
MessageUtil.sendMessage(getPlayer(), MessageConfig.getMessage(Messages.PLAYER_FINISHED_DUNGEON));
|
||||||
|
finished = true;
|
||||||
|
|
||||||
|
DGroup dGroup = DGroup.getByPlayer(getPlayer());
|
||||||
|
if (dGroup == null) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
if ( !dGroup.isPlaying()) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
for (Player player : dGroup.getPlayers()) {
|
||||||
|
DPlayer dPlayer = getByPlayer(player);
|
||||||
|
if ( !dPlayer.finished) {
|
||||||
|
MessageUtil.sendMessage(this.getPlayer(), MessageConfig.getMessage(Messages.PLAYER_WAIT_FOR_OTHER_PLAYERS));
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
boolean invalid = false;
|
||||||
|
|
||||||
|
if (dGroup.getDungeon() == null) {
|
||||||
|
invalid = true;
|
||||||
|
}
|
||||||
|
|
||||||
|
for (Player player : dGroup.getPlayers()) {
|
||||||
|
DPlayer dPlayer = getByPlayer(player);
|
||||||
|
|
||||||
|
if (invalid) {
|
||||||
|
dPlayer.leave();
|
||||||
|
|
||||||
|
} else {
|
||||||
|
dPlayer.finished = false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (invalid) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
DungeonConfig dConfig = dGroup.getDungeon().getConfig();
|
||||||
|
int random = NumberUtil.generateRandomInt(0, dConfig.getFloors().size());
|
||||||
|
String newFloor = dGroup.getUnplayedFloors().get(random);
|
||||||
|
if (dConfig.getFloorCount() == dGroup.getFloorCount() - 1) {
|
||||||
|
newFloor = dConfig.getEndFloor();
|
||||||
|
|
||||||
|
} else if (specifiedFloor != null) {
|
||||||
|
newFloor = specifiedFloor;
|
||||||
|
}
|
||||||
|
|
||||||
|
DGroupFinishFloorEvent event = new DGroupFinishFloorEvent(dGroup, dGroup.getGameWorld(), newFloor);
|
||||||
|
|
||||||
|
if (event.isCancelled()) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
dGroup.removeUnplayedFloor(dGroup.getMapName());
|
||||||
|
dGroup.setMapName(newFloor);
|
||||||
|
GameWorld gameWorld = GameWorld.load(newFloor);
|
||||||
|
dGroup.setGameWorld(gameWorld);
|
||||||
|
for (Player player : dGroup.getPlayers()) {
|
||||||
|
DPlayer dPlayer = getByPlayer(player);
|
||||||
|
dPlayer.setWorld(gameWorld.getWorld());
|
||||||
|
dPlayer.setCheckpoint(dGroup.getGameWorld().getLocStart());
|
||||||
|
if (dPlayer.getWolf() != null) {
|
||||||
|
dPlayer.getWolf().teleport(dPlayer.getCheckpoint());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
dGroup.startGame();
|
||||||
|
}
|
||||||
|
|
||||||
|
public void finish() {
|
||||||
|
MessageUtil.sendMessage(getPlayer(), MessageConfig.getMessage(Messages.PLAYER_FINISHED_DUNGEON));
|
||||||
|
finished = true;
|
||||||
|
|
||||||
|
DGroup dGroup = DGroup.getByPlayer(getPlayer());
|
||||||
|
if (dGroup == null) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
if ( !dGroup.isPlaying()) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
boolean first = true;
|
||||||
|
boolean hasToWait = false;
|
||||||
|
|
||||||
|
for (Player player : dGroup.getPlayers()) {
|
||||||
|
DPlayer dPlayer = getByPlayer(player);
|
||||||
|
if ( !dPlayer.finished) {
|
||||||
|
MessageUtil.sendMessage(this.getPlayer(), MessageConfig.getMessage(Messages.PLAYER_WAIT_FOR_OTHER_PLAYERS));
|
||||||
|
hasToWait = true;
|
||||||
|
|
||||||
|
} else if (dPlayer != this) {
|
||||||
|
first = false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
DPlayerFinishEvent dPlayerFinishEvent = new DPlayerFinishEvent(this, first, hasToWait);
|
||||||
|
|
||||||
|
if (dPlayerFinishEvent.isCancelled()) {
|
||||||
|
finished = false;
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (hasToWait) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
DGroupFinishDungeonEvent dGroupFinishDungeonEvent = new DGroupFinishDungeonEvent(dGroup);
|
||||||
|
|
||||||
|
if (dGroupFinishDungeonEvent.isCancelled()) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
for (Player player : dGroup.getPlayers()) {
|
||||||
|
DPlayer dPlayer = getByPlayer(player);
|
||||||
|
dPlayer.leave();
|
||||||
|
|
||||||
|
for (Reward reward : dGroup.getRewards()) {
|
||||||
|
reward.giveTo(player);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public void sendMessage(String message) {
|
||||||
|
if (editing) {
|
||||||
|
EditWorld editWorld = EditWorld.getByWorld(world);
|
||||||
|
editWorld.sendMessage(message);
|
||||||
|
for (Player player : plugin.getChatSpyers()) {
|
||||||
|
if ( !editWorld.getWorld().getPlayers().contains(player)) {
|
||||||
|
MessageUtil.sendMessage(player, ChatColor.GREEN + "[Chatspy] " + ChatColor.WHITE + message);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
} else {
|
||||||
|
GameWorld gameWorld = GameWorld.getByWorld(world);
|
||||||
|
gameWorld.sendMessage(message);
|
||||||
|
for (Player player : plugin.getChatSpyers()) {
|
||||||
|
if ( !gameWorld.getWorld().getPlayers().contains(player)) {
|
||||||
|
MessageUtil.sendMessage(player, ChatColor.GREEN + "[Chatspy] " + ChatColor.WHITE + message);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@SuppressWarnings("deprecation")
|
||||||
|
public void poke(Block block) {
|
||||||
|
if (block.getState() instanceof Sign) {
|
||||||
|
Sign sign = (Sign) block.getState();
|
||||||
|
String[] lines = sign.getLines();
|
||||||
|
if (lines[0].equals("") && lines[1].equals("") && lines[2].equals("") && lines[3].equals("")) {
|
||||||
|
if (linesCopy != null) {
|
||||||
|
SignChangeEvent event = new SignChangeEvent(block, getPlayer(), linesCopy);
|
||||||
|
plugin.getServer().getPluginManager().callEvent(event);
|
||||||
|
if ( !event.isCancelled()) {
|
||||||
|
sign.setLine(0, event.getLine(0));
|
||||||
|
sign.setLine(1, event.getLine(1));
|
||||||
|
sign.setLine(2, event.getLine(2));
|
||||||
|
sign.setLine(3, event.getLine(3));
|
||||||
|
sign.update();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
linesCopy = lines;
|
||||||
|
MessageUtil.sendMessage(getPlayer(), MessageConfig.getMessage(Messages.PLAYER_SIGN_COPIED));
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
String info = "" + block.getType();
|
||||||
|
if (block.getData() != 0) {
|
||||||
|
info = info + "," + block.getData();
|
||||||
|
}
|
||||||
|
MessageUtil.sendMessage(getPlayer(), MessageConfig.getMessage(Messages.PLAYER_BLOCK_INFO, info));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public void addTreasure() {
|
||||||
|
new DLootInventory(getPlayer(), treasureInv.getContents());
|
||||||
|
}
|
||||||
|
|
||||||
|
public void update(boolean updateSecond) {
|
||||||
|
boolean locationValid = true;
|
||||||
|
Location teleportLocation = getPlayer().getLocation();
|
||||||
|
boolean teleportWolf = false;
|
||||||
|
boolean respawnInventory = false;
|
||||||
|
boolean offline = false;
|
||||||
|
boolean kick = false;
|
||||||
|
boolean triggerAllInDistance = false;
|
||||||
|
|
||||||
|
GameWorld gameWorld = GameWorld.getByWorld(getWorld());
|
||||||
|
EditWorld editWorld = EditWorld.getByWorld(getWorld());
|
||||||
|
|
||||||
|
if ( !updateSecond) {
|
||||||
|
if ( !getPlayer().getWorld().equals(getWorld())) {
|
||||||
|
locationValid = false;
|
||||||
|
|
||||||
|
if (isEditing()) {
|
||||||
|
if (editWorld != null) {
|
||||||
|
if (editWorld.getLobby() == null) {
|
||||||
|
teleportLocation = editWorld.getWorld().getSpawnLocation();
|
||||||
|
} else {
|
||||||
|
teleportLocation = editWorld.getLobby();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
if (gameWorld != null) {
|
||||||
|
DGroup dGroup = DGroup.getByPlayer(getPlayer());
|
||||||
|
if (getCheckpoint() == null) {
|
||||||
|
teleportLocation = dGroup.getGameWorld().getLocStart();
|
||||||
|
if (getWolf() != null) {
|
||||||
|
getWolf().teleport(dGroup.getGameWorld().getLocStart());
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
teleportLocation = getCheckpoint();
|
||||||
|
if (getWolf() != null) {
|
||||||
|
teleportWolf = true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// Respawn Items
|
||||||
|
if (getRespawnInventory() != null || getRespawnArmor() != null) {
|
||||||
|
respawnInventory = true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
} else {
|
||||||
|
if (gameWorld != null) {
|
||||||
|
// Update Wolf
|
||||||
|
if (getWolf() != null) {
|
||||||
|
if (getWolf().isDead()) {
|
||||||
|
if (getWolfRespawnTime() <= 0) {
|
||||||
|
setWolf((Wolf) getWorld().spawnEntity(getPlayer().getLocation(), EntityType.WOLF));
|
||||||
|
getWolf().setTamed(true);
|
||||||
|
getWolf().setOwner(getPlayer());
|
||||||
|
setWolfRespawnTime(30);
|
||||||
|
}
|
||||||
|
wolfRespawnTime--;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// Kick offline plugin.getDPlayers()
|
||||||
|
if (getOfflineTime() > 0) {
|
||||||
|
offline = true;
|
||||||
|
|
||||||
|
if (getOfflineTime() < System.currentTimeMillis()) {
|
||||||
|
kick = true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
triggerAllInDistance = true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
DPlayerUpdateEvent event = new DPlayerUpdateEvent(this, locationValid, teleportWolf, respawnInventory, offline, kick, triggerAllInDistance);
|
||||||
|
|
||||||
|
if (event.isCancelled()) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
if ( !locationValid) {
|
||||||
|
PlayerUtil.secureTeleport(getPlayer(), teleportLocation);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (teleportWolf) {
|
||||||
|
getWolf().teleport(getCheckpoint());
|
||||||
|
}
|
||||||
|
|
||||||
|
if (respawnInventory) {
|
||||||
|
getPlayer().getInventory().setContents(getRespawnInventory());
|
||||||
|
getPlayer().getInventory().setArmorContents(getRespawnArmor());
|
||||||
|
setRespawnInventory(null);
|
||||||
|
setRespawnArmor(null);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (kick) {
|
||||||
|
DPlayerKickEvent dPlayerKickEvent = new DPlayerKickEvent(this);
|
||||||
|
|
||||||
|
if ( !dPlayerKickEvent.isCancelled()) {
|
||||||
|
leave();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (triggerAllInDistance) {
|
||||||
|
DistanceTrigger.triggerAllInDistance(getPlayer(), gameWorld);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
// Static
|
// Static
|
||||||
|
|
||||||
public static void remove(DPlayer player) {
|
public static void remove(DPlayer player) {
|
||||||
@ -831,115 +944,4 @@ public class DPlayer {
|
|||||||
return dPlayers;
|
return dPlayers;
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void update(boolean updateSecond) {
|
|
||||||
for (DPlayer dPlayer : plugin.getDPlayers()) {
|
|
||||||
boolean locationValid = true;
|
|
||||||
Location teleportLocation = dPlayer.getPlayer().getLocation();
|
|
||||||
boolean teleportWolf = false;
|
|
||||||
boolean respawnInventory = false;
|
|
||||||
boolean offline = false;
|
|
||||||
boolean kick = false;
|
|
||||||
boolean triggerAllInDistance = false;
|
|
||||||
|
|
||||||
GameWorld gameWorld = GameWorld.getByWorld(dPlayer.world);
|
|
||||||
EditWorld editWorld = EditWorld.getByWorld(dPlayer.world);
|
|
||||||
|
|
||||||
if ( !updateSecond) {
|
|
||||||
if ( !dPlayer.getPlayer().getWorld().equals(dPlayer.world)) {
|
|
||||||
locationValid = false;
|
|
||||||
|
|
||||||
if (dPlayer.editing) {
|
|
||||||
if (editWorld != null) {
|
|
||||||
if (editWorld.getLobby() == null) {
|
|
||||||
teleportLocation = editWorld.getWorld().getSpawnLocation();
|
|
||||||
} else {
|
|
||||||
teleportLocation = editWorld.getLobby();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
if (gameWorld != null) {
|
|
||||||
DGroup dGroup = DGroup.getByPlayer(dPlayer.getPlayer());
|
|
||||||
if (dPlayer.checkpoint == null) {
|
|
||||||
teleportLocation = dGroup.getGameWorld().getLocStart();
|
|
||||||
if (dPlayer.wolf != null) {
|
|
||||||
dPlayer.wolf.teleport(dGroup.getGameWorld().getLocStart());
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
teleportLocation = dPlayer.getCheckpoint();
|
|
||||||
if (dPlayer.wolf != null) {
|
|
||||||
teleportWolf = true;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// Respawn Items
|
|
||||||
if (dPlayer.respawnInventory != null || dPlayer.respawnArmor != null) {
|
|
||||||
respawnInventory = true;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
} else {
|
|
||||||
if (gameWorld != null) {
|
|
||||||
// Update Wolf
|
|
||||||
if (dPlayer.wolf != null) {
|
|
||||||
if (dPlayer.wolf.isDead()) {
|
|
||||||
if (dPlayer.wolfRespawnTime <= 0) {
|
|
||||||
dPlayer.wolf = (Wolf) dPlayer.world.spawnEntity(dPlayer.getPlayer().getLocation(), EntityType.WOLF);
|
|
||||||
dPlayer.wolf.setTamed(true);
|
|
||||||
dPlayer.wolf.setOwner(dPlayer.getPlayer());
|
|
||||||
dPlayer.wolfRespawnTime = 30;
|
|
||||||
}
|
|
||||||
dPlayer.wolfRespawnTime--;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// Kick offline plugin.getDPlayers()
|
|
||||||
if (dPlayer.offlineTime > 0) {
|
|
||||||
offline = true;
|
|
||||||
|
|
||||||
if (dPlayer.offlineTime < System.currentTimeMillis()) {
|
|
||||||
kick = true;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
triggerAllInDistance = true;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
DPlayerUpdateEvent event = new DPlayerUpdateEvent(dPlayer, locationValid, teleportWolf, respawnInventory, offline, kick, triggerAllInDistance);
|
|
||||||
|
|
||||||
if (event.isCancelled()) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
if ( !locationValid) {
|
|
||||||
MiscUtil.secureTeleport(dPlayer.getPlayer(), teleportLocation);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (teleportWolf) {
|
|
||||||
dPlayer.wolf.teleport(dPlayer.checkpoint);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (respawnInventory) {
|
|
||||||
dPlayer.getPlayer().getInventory().setContents(dPlayer.respawnInventory);
|
|
||||||
dPlayer.getPlayer().getInventory().setArmorContents(dPlayer.respawnArmor);
|
|
||||||
dPlayer.respawnInventory = null;
|
|
||||||
dPlayer.respawnArmor = null;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (kick) {
|
|
||||||
DPlayerKickEvent dPlayerKickEvent = new DPlayerKickEvent(dPlayer);
|
|
||||||
|
|
||||||
if ( !dPlayerKickEvent.isCancelled()) {
|
|
||||||
dPlayer.leave();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if (triggerAllInDistance) {
|
|
||||||
DistanceTrigger.triggerAllInDistance(dPlayer.getPlayer(), gameWorld);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -1,8 +1,7 @@
|
|||||||
package io.github.dre2n.dungeonsxl.player;
|
package io.github.dre2n.dungeonsxl.player;
|
||||||
|
|
||||||
import io.github.dre2n.dungeonsxl.DungeonsXL;
|
import io.github.dre2n.dungeonsxl.DungeonsXL;
|
||||||
import io.github.dre2n.dungeonsxl.util.MiscUtil;
|
import io.github.dre2n.dungeonsxl.util.playerutil.PlayerUtil;
|
||||||
import io.github.dre2n.dungeonsxl.util.offlineplayerutil.OfflinePlayerUtil;
|
|
||||||
|
|
||||||
import java.io.File;
|
import java.io.File;
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
@ -66,7 +65,7 @@ public class DSavePlayer {
|
|||||||
Player player = plugin.getServer().getPlayer(playerName);
|
Player player = plugin.getServer().getPlayer(playerName);
|
||||||
boolean offline = false;
|
boolean offline = false;
|
||||||
if (player == null) {
|
if (player == null) {
|
||||||
player = OfflinePlayerUtil.getOfflinePlayer(playerName, UUID.fromString(uuid), oldLocation);
|
player = PlayerUtil.getOfflinePlayer(playerName, UUID.fromString(uuid), oldLocation);
|
||||||
offline = true;
|
offline = true;
|
||||||
}
|
}
|
||||||
if (player == null) {
|
if (player == null) {
|
||||||
@ -96,7 +95,7 @@ public class DSavePlayer {
|
|||||||
}
|
}
|
||||||
|
|
||||||
if ( !offline && oldLocation.getWorld() != null) {
|
if ( !offline && oldLocation.getWorld() != null) {
|
||||||
MiscUtil.secureTeleport(player, oldLocation);
|
PlayerUtil.secureTeleport(player, oldLocation);
|
||||||
}
|
}
|
||||||
|
|
||||||
} catch (NullPointerException exception) {
|
} catch (NullPointerException exception) {
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
package io.github.dre2n.dungeonsxl.requirement;
|
package io.github.dre2n.dungeonsxl.requirement;
|
||||||
|
|
||||||
import io.github.dre2n.dungeonsxl.file.DMessages.Messages;
|
import io.github.dre2n.dungeonsxl.config.MessageConfig.Messages;
|
||||||
import io.github.dre2n.dungeonsxl.util.messageutil.MessageUtil;
|
import io.github.dre2n.dungeonsxl.util.messageutil.MessageUtil;
|
||||||
|
|
||||||
import org.bukkit.entity.Player;
|
import org.bukkit.entity.Player;
|
||||||
@ -47,7 +47,7 @@ public class FeeRequirement extends Requirement {
|
|||||||
}
|
}
|
||||||
|
|
||||||
plugin.getEconomyProvider().withdrawPlayer(player, fee);
|
plugin.getEconomyProvider().withdrawPlayer(player, fee);
|
||||||
MessageUtil.sendMessage(player, plugin.getDMessages().getMessage(Messages.REQUIREMENT_FEE, plugin.getEconomyProvider().format(fee)));
|
MessageUtil.sendMessage(player, plugin.getMessageConfig().getMessage(Messages.REQUIREMENT_FEE, plugin.getEconomyProvider().format(fee)));
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
package io.github.dre2n.dungeonsxl.reward;
|
package io.github.dre2n.dungeonsxl.reward;
|
||||||
|
|
||||||
import io.github.dre2n.dungeonsxl.file.DMessages.Messages;
|
import io.github.dre2n.dungeonsxl.config.MessageConfig.Messages;
|
||||||
import io.github.dre2n.dungeonsxl.util.messageutil.MessageUtil;
|
import io.github.dre2n.dungeonsxl.util.messageutil.MessageUtil;
|
||||||
|
|
||||||
import org.bukkit.entity.Player;
|
import org.bukkit.entity.Player;
|
||||||
@ -41,7 +41,7 @@ public class MoneyReward extends Reward {
|
|||||||
}
|
}
|
||||||
|
|
||||||
plugin.getEconomyProvider().depositPlayer(player, money);
|
plugin.getEconomyProvider().depositPlayer(player, money);
|
||||||
MessageUtil.sendMessage(player, plugin.getDMessages().getMessage(Messages.REWARD_MONEY, plugin.getEconomyProvider().format(money)));
|
MessageUtil.sendMessage(player, plugin.getMessageConfig().getMessage(Messages.REWARD_MONEY, plugin.getEconomyProvider().format(money)));
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
package io.github.dre2n.dungeonsxl.sign;
|
package io.github.dre2n.dungeonsxl.sign;
|
||||||
|
|
||||||
|
import io.github.dre2n.dungeonsxl.config.MessageConfig.Messages;
|
||||||
import io.github.dre2n.dungeonsxl.dungeon.game.GameWorld;
|
import io.github.dre2n.dungeonsxl.dungeon.game.GameWorld;
|
||||||
import io.github.dre2n.dungeonsxl.file.DMessages.Messages;
|
|
||||||
import io.github.dre2n.dungeonsxl.player.DPlayer;
|
import io.github.dre2n.dungeonsxl.player.DPlayer;
|
||||||
import io.github.dre2n.dungeonsxl.util.messageutil.MessageUtil;
|
import io.github.dre2n.dungeonsxl.util.messageutil.MessageUtil;
|
||||||
|
|
||||||
@ -43,7 +43,7 @@ public class CheckpointSign extends DSign {
|
|||||||
|
|
||||||
for (DPlayer dplayer : DPlayer.getByWorld(getGameWorld().getWorld())) {
|
for (DPlayer dplayer : DPlayer.getByWorld(getGameWorld().getWorld())) {
|
||||||
dplayer.setCheckpoint(getSign().getLocation());
|
dplayer.setCheckpoint(getSign().getLocation());
|
||||||
MessageUtil.sendMessage(dplayer.getPlayer(), plugin.getDMessages().getMessage(Messages.PLAYER_CHECKPOINT_REACHED));
|
MessageUtil.sendMessage(dplayer.getPlayer(), plugin.getMessageConfig().getMessage(Messages.PLAYER_CHECKPOINT_REACHED));
|
||||||
}
|
}
|
||||||
|
|
||||||
remove();
|
remove();
|
||||||
@ -60,7 +60,7 @@ public class CheckpointSign extends DSign {
|
|||||||
if ( !done.contains(dplayer)) {
|
if ( !done.contains(dplayer)) {
|
||||||
done.add(dplayer);
|
done.add(dplayer);
|
||||||
dplayer.setCheckpoint(getSign().getLocation());
|
dplayer.setCheckpoint(getSign().getLocation());
|
||||||
MessageUtil.sendMessage(player, plugin.getDMessages().getMessage(Messages.PLAYER_CHECKPOINT_REACHED));
|
MessageUtil.sendMessage(player, plugin.getMessageConfig().getMessage(Messages.PLAYER_CHECKPOINT_REACHED));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -2,6 +2,7 @@ package io.github.dre2n.dungeonsxl.sign;
|
|||||||
|
|
||||||
import io.github.dre2n.dungeonsxl.dungeon.EditWorld;
|
import io.github.dre2n.dungeonsxl.dungeon.EditWorld;
|
||||||
import io.github.dre2n.dungeonsxl.dungeon.game.GameWorld;
|
import io.github.dre2n.dungeonsxl.dungeon.game.GameWorld;
|
||||||
|
import io.github.dre2n.dungeonsxl.task.SignUpdateTask;
|
||||||
import io.github.dre2n.dungeonsxl.trigger.InteractTrigger;
|
import io.github.dre2n.dungeonsxl.trigger.InteractTrigger;
|
||||||
import io.github.dre2n.dungeonsxl.util.NumberUtil;
|
import io.github.dre2n.dungeonsxl.util.NumberUtil;
|
||||||
|
|
||||||
@ -60,7 +61,9 @@ public class InteractSign extends DSign {
|
|||||||
}
|
}
|
||||||
|
|
||||||
getSign().setLine(1, id + "");
|
getSign().setLine(1, id + "");
|
||||||
plugin.getServer().getScheduler().scheduleSyncDelayedTask(plugin, new UpdateTask(), 2);
|
|
||||||
|
new SignUpdateTask(getSign()).runTaskLater(plugin, 2L);
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -89,15 +92,4 @@ public class InteractSign extends DSign {
|
|||||||
return type;
|
return type;
|
||||||
}
|
}
|
||||||
|
|
||||||
public class UpdateTask implements Runnable {
|
|
||||||
|
|
||||||
public UpdateTask() {
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void run() {
|
|
||||||
getSign().update();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -1,19 +1,11 @@
|
|||||||
package io.github.dre2n.dungeonsxl.sign;
|
package io.github.dre2n.dungeonsxl.sign;
|
||||||
|
|
||||||
import io.github.dre2n.dungeonsxl.dungeon.game.GameWorld;
|
import io.github.dre2n.dungeonsxl.dungeon.game.GameWorld;
|
||||||
import io.github.dre2n.dungeonsxl.mob.DMob;
|
import io.github.dre2n.dungeonsxl.task.MobSpawnTask;
|
||||||
import io.github.dre2n.dungeonsxl.mob.DMobType;
|
|
||||||
import io.github.dre2n.dungeonsxl.util.NumberUtil;
|
import io.github.dre2n.dungeonsxl.util.NumberUtil;
|
||||||
|
|
||||||
import org.bukkit.Location;
|
|
||||||
import org.bukkit.Material;
|
import org.bukkit.Material;
|
||||||
import org.bukkit.World;
|
|
||||||
import org.bukkit.block.Sign;
|
import org.bukkit.block.Sign;
|
||||||
import org.bukkit.entity.EntityType;
|
|
||||||
import org.bukkit.entity.LivingEntity;
|
|
||||||
import org.bukkit.entity.Skeleton;
|
|
||||||
import org.bukkit.entity.Skeleton.SkeletonType;
|
|
||||||
import org.bukkit.inventory.ItemStack;
|
|
||||||
|
|
||||||
public class MobSign extends DSign {
|
public class MobSign extends DSign {
|
||||||
|
|
||||||
@ -26,12 +18,117 @@ public class MobSign extends DSign {
|
|||||||
private int amount = 1;
|
private int amount = 1;
|
||||||
private boolean initialized;
|
private boolean initialized;
|
||||||
private boolean active;
|
private boolean active;
|
||||||
private int taskId = -1;
|
private MobSpawnTask task;
|
||||||
|
|
||||||
public MobSign(Sign sign, GameWorld gameWorld) {
|
public MobSign(Sign sign, GameWorld gameWorld) {
|
||||||
super(sign, gameWorld);
|
super(sign, gameWorld);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @return the mob
|
||||||
|
*/
|
||||||
|
public String getMob() {
|
||||||
|
return mob;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param mob
|
||||||
|
* the mob to set
|
||||||
|
*/
|
||||||
|
public void setMob(String mob) {
|
||||||
|
this.mob = mob;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @return the maxinterval
|
||||||
|
*/
|
||||||
|
public int getMaxinterval() {
|
||||||
|
return maxinterval;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param maxinterval
|
||||||
|
* the maxinterval to set
|
||||||
|
*/
|
||||||
|
public void setMaxinterval(int maxinterval) {
|
||||||
|
this.maxinterval = maxinterval;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @return the interval
|
||||||
|
*/
|
||||||
|
public int getInterval() {
|
||||||
|
return interval;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param interval
|
||||||
|
* the interval to set
|
||||||
|
*/
|
||||||
|
public void setInterval(int interval) {
|
||||||
|
this.interval = interval;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @return the amount
|
||||||
|
*/
|
||||||
|
public int getAmount() {
|
||||||
|
return amount;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param amount
|
||||||
|
* the amount to set
|
||||||
|
*/
|
||||||
|
public void setAmount(int amount) {
|
||||||
|
this.amount = amount;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @return the initialized
|
||||||
|
*/
|
||||||
|
public boolean isInitialized() {
|
||||||
|
return initialized;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param initialized
|
||||||
|
* the initialized to set
|
||||||
|
*/
|
||||||
|
public void setInitialized(boolean initialized) {
|
||||||
|
this.initialized = initialized;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @return the active
|
||||||
|
*/
|
||||||
|
public boolean isActive() {
|
||||||
|
return active;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param active
|
||||||
|
* the active to set
|
||||||
|
*/
|
||||||
|
public void setActive(boolean active) {
|
||||||
|
this.active = active;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @return the task
|
||||||
|
*/
|
||||||
|
public MobSpawnTask getTask() {
|
||||||
|
return task;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param task
|
||||||
|
* the task to set
|
||||||
|
*/
|
||||||
|
public void setTask(MobSpawnTask task) {
|
||||||
|
this.task = task;
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean check() {
|
public boolean check() {
|
||||||
String lines[] = getSign().getLines();
|
String lines[] = getSign().getLines();
|
||||||
@ -77,9 +174,7 @@ public class MobSign extends DSign {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
MobSpawnScheduler scheduler = new MobSpawnScheduler(this);
|
task = (MobSpawnTask) new MobSpawnTask(this).runTaskTimer(plugin, 0L, 20L);
|
||||||
|
|
||||||
taskId = plugin.getServer().getScheduler().scheduleSyncRepeatingTask(plugin, scheduler, 0L, 20L);
|
|
||||||
|
|
||||||
active = true;
|
active = true;
|
||||||
}
|
}
|
||||||
@ -100,72 +195,9 @@ public class MobSign extends DSign {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (taskId != -1) {
|
if (task != null) {
|
||||||
plugin.getServer().getScheduler().cancelTask(taskId);
|
task.cancel();
|
||||||
taskId = -1;
|
task = null;
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
public class MobSpawnScheduler implements Runnable {
|
|
||||||
private MobSign sign;
|
|
||||||
|
|
||||||
public MobSpawnScheduler(MobSign sign) {
|
|
||||||
this.sign = sign;
|
|
||||||
}
|
|
||||||
|
|
||||||
@SuppressWarnings("deprecation")
|
|
||||||
@Override
|
|
||||||
public void run() {
|
|
||||||
if (sign.interval <= 0) {
|
|
||||||
World world = sign.getSign().getWorld();
|
|
||||||
GameWorld gameWorld = GameWorld.getByWorld(world);
|
|
||||||
|
|
||||||
if (gameWorld != null) {
|
|
||||||
Location spawnLoc = sign.getSign().getLocation().add(0.5, 0, 0.5);
|
|
||||||
|
|
||||||
// Check normal mobs
|
|
||||||
if (EntityType.fromName(sign.mob) != null) {
|
|
||||||
if (EntityType.fromName(sign.mob).isAlive()) {
|
|
||||||
LivingEntity entity = (LivingEntity) world.spawnEntity(spawnLoc, EntityType.fromName(sign.mob));
|
|
||||||
|
|
||||||
// Add Bow to normal Skeletons
|
|
||||||
if (entity.getType() == EntityType.SKELETON) {
|
|
||||||
Skeleton skeleton = (Skeleton) entity;
|
|
||||||
if (skeleton.getSkeletonType() == SkeletonType.NORMAL) {
|
|
||||||
skeleton.getEquipment().setItemInHand(new ItemStack(Material.BOW));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// Disable Despawning
|
|
||||||
entity.setRemoveWhenFarAway(false);
|
|
||||||
|
|
||||||
new DMob(entity, sign.getGameWorld(), null);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// Check custom mobs
|
|
||||||
DMobType mobType = DMobType.getByName(sign.mob, gameWorld.getConfig().getMobTypes());
|
|
||||||
|
|
||||||
if (mobType != null) {
|
|
||||||
mobType.spawn(GameWorld.getByWorld(world), spawnLoc);
|
|
||||||
}
|
|
||||||
|
|
||||||
// Set the amount
|
|
||||||
if (amount != -1) {
|
|
||||||
if (amount > 1) {
|
|
||||||
amount--;
|
|
||||||
} else {
|
|
||||||
killTask();
|
|
||||||
sign.remove();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
sign.interval = sign.maxinterval;
|
|
||||||
} else {
|
|
||||||
sign.killTask();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
sign.interval--;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1,15 +1,13 @@
|
|||||||
package io.github.dre2n.dungeonsxl.sign;
|
package io.github.dre2n.dungeonsxl.sign;
|
||||||
|
|
||||||
import io.github.dre2n.dungeonsxl.dungeon.game.GameWorld;
|
import io.github.dre2n.dungeonsxl.dungeon.game.GameWorld;
|
||||||
import io.github.dre2n.dungeonsxl.mob.DMob;
|
import io.github.dre2n.dungeonsxl.task.MythicMobSpawnTask;
|
||||||
import io.github.dre2n.dungeonsxl.util.NumberUtil;
|
import io.github.dre2n.dungeonsxl.util.NumberUtil;
|
||||||
|
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
|
|
||||||
import org.bukkit.Bukkit;
|
|
||||||
import org.bukkit.Location;
|
import org.bukkit.Location;
|
||||||
import org.bukkit.Material;
|
import org.bukkit.Material;
|
||||||
import org.bukkit.World;
|
|
||||||
import org.bukkit.block.Sign;
|
import org.bukkit.block.Sign;
|
||||||
import org.bukkit.entity.Entity;
|
import org.bukkit.entity.Entity;
|
||||||
import org.bukkit.entity.LivingEntity;
|
import org.bukkit.entity.LivingEntity;
|
||||||
@ -26,8 +24,8 @@ public class MythicMobsSign extends DSign {
|
|||||||
private int amount = 1;
|
private int amount = 1;
|
||||||
private boolean initialized;
|
private boolean initialized;
|
||||||
private boolean active;
|
private boolean active;
|
||||||
private int taskId = -1;
|
private MythicMobSpawnTask task;
|
||||||
private Location spawnLoc;
|
private Location spawnLocation;
|
||||||
private LivingEntity mythicMob;
|
private LivingEntity mythicMob;
|
||||||
private ArrayList<Entity> mythicMobs = new ArrayList<Entity>();
|
private ArrayList<Entity> mythicMobs = new ArrayList<Entity>();
|
||||||
|
|
||||||
@ -35,6 +33,156 @@ public class MythicMobsSign extends DSign {
|
|||||||
super(sign, gameWorld);
|
super(sign, gameWorld);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @return the mob
|
||||||
|
*/
|
||||||
|
public String getMob() {
|
||||||
|
return mob;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param mob
|
||||||
|
* the mob to set
|
||||||
|
*/
|
||||||
|
public void setMob(String mob) {
|
||||||
|
this.mob = mob;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @return the maxinterval
|
||||||
|
*/
|
||||||
|
public int getMaxinterval() {
|
||||||
|
return maxinterval;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param maxinterval
|
||||||
|
* the maxinterval to set
|
||||||
|
*/
|
||||||
|
public void setMaxinterval(int maxinterval) {
|
||||||
|
this.maxinterval = maxinterval;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @return the interval
|
||||||
|
*/
|
||||||
|
public int getInterval() {
|
||||||
|
return interval;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param interval
|
||||||
|
* the interval to set
|
||||||
|
*/
|
||||||
|
public void setInterval(int interval) {
|
||||||
|
this.interval = interval;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @return the amount
|
||||||
|
*/
|
||||||
|
public int getAmount() {
|
||||||
|
return amount;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param amount
|
||||||
|
* the amount to set
|
||||||
|
*/
|
||||||
|
public void setAmount(int amount) {
|
||||||
|
this.amount = amount;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @return the initialized
|
||||||
|
*/
|
||||||
|
public boolean isInitialized() {
|
||||||
|
return initialized;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param initialized
|
||||||
|
* the initialized to set
|
||||||
|
*/
|
||||||
|
public void setInitialized(boolean initialized) {
|
||||||
|
this.initialized = initialized;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @return the active
|
||||||
|
*/
|
||||||
|
public boolean isActive() {
|
||||||
|
return active;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param active
|
||||||
|
* the active to set
|
||||||
|
*/
|
||||||
|
public void setActive(boolean active) {
|
||||||
|
this.active = active;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @return the spawnLocation
|
||||||
|
*/
|
||||||
|
public Location getSpawnLocation() {
|
||||||
|
return spawnLocation;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param spawnLocation
|
||||||
|
* the spawnLocation to set
|
||||||
|
*/
|
||||||
|
public void setSpawnLocation(Location spawnLocation) {
|
||||||
|
this.spawnLocation = spawnLocation;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @return the mythicMob
|
||||||
|
*/
|
||||||
|
public LivingEntity getMythicMob() {
|
||||||
|
return mythicMob;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param mythicMob
|
||||||
|
* the mythicMob to set
|
||||||
|
*/
|
||||||
|
public void setMythicMob(LivingEntity mythicMob) {
|
||||||
|
this.mythicMob = mythicMob;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @return the mythicMobs
|
||||||
|
*/
|
||||||
|
public ArrayList<Entity> getMythicMobs() {
|
||||||
|
return mythicMobs;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param mythicMobs
|
||||||
|
* the mythicMobs to set
|
||||||
|
*/
|
||||||
|
public void setMythicMobs(ArrayList<Entity> mythicMobs) {
|
||||||
|
this.mythicMobs = mythicMobs;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @return the task
|
||||||
|
*/
|
||||||
|
public MythicMobSpawnTask getTask() {
|
||||||
|
return task;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param task
|
||||||
|
* the task to set
|
||||||
|
*/
|
||||||
|
public void setTask(MythicMobSpawnTask task) {
|
||||||
|
this.task = task;
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean check() {
|
public boolean check() {
|
||||||
String lines[] = getSign().getLines();
|
String lines[] = getSign().getLines();
|
||||||
@ -63,9 +211,9 @@ public class MythicMobsSign extends DSign {
|
|||||||
if (mob != null) {
|
if (mob != null) {
|
||||||
String[] attributes = lines[2].split(",");
|
String[] attributes = lines[2].split(",");
|
||||||
if (attributes.length == 2) {
|
if (attributes.length == 2) {
|
||||||
this.mob = mob;
|
this.setMob(mob);
|
||||||
maxinterval = NumberUtil.parseInt(attributes[0]);
|
setMaxinterval(NumberUtil.parseInt(attributes[0]));
|
||||||
amount = NumberUtil.parseInt(attributes[1]);
|
setAmount(NumberUtil.parseInt(attributes[1]));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -80,9 +228,7 @@ public class MythicMobsSign extends DSign {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
MobSpawnScheduler scheduler = new MobSpawnScheduler(this);
|
task = (MythicMobSpawnTask) new MythicMobSpawnTask(this).runTaskTimer(plugin, 0L, 20L);
|
||||||
|
|
||||||
taskId = plugin.getServer().getScheduler().scheduleSyncRepeatingTask(plugin, scheduler, 0L, 20L);
|
|
||||||
|
|
||||||
active = true;
|
active = true;
|
||||||
}
|
}
|
||||||
@ -94,7 +240,7 @@ public class MythicMobsSign extends DSign {
|
|||||||
}
|
}
|
||||||
|
|
||||||
killTask();
|
killTask();
|
||||||
interval = 0;
|
setInterval(0);
|
||||||
active = false;
|
active = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -103,64 +249,18 @@ public class MythicMobsSign extends DSign {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (taskId != -1) {
|
if (task != null) {
|
||||||
plugin.getServer().getScheduler().cancelTask(taskId);
|
task.cancel();
|
||||||
taskId = -1;
|
task = null;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public class MobSpawnScheduler implements Runnable {
|
public void setMythicMobs() {
|
||||||
private MythicMobsSign sign;
|
for (Entity entity : spawnLocation.getChunk().getEntities()) {
|
||||||
|
if (entity.getLocation().getX() >= spawnLocation.getX() - 1 && entity.getLocation().getX() <= spawnLocation.getX() + 1 && entity.getLocation().getY() >= spawnLocation.getY() - 1
|
||||||
public MobSpawnScheduler(MythicMobsSign sign) {
|
&& entity.getLocation().getY() <= spawnLocation.getY() + 1 && entity.getLocation().getZ() >= spawnLocation.getZ() - 1 && entity.getLocation().getZ() <= spawnLocation.getZ() + 1
|
||||||
this.sign = sign;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void run() {
|
|
||||||
if (sign.interval <= 0) {
|
|
||||||
World world = sign.getSign().getWorld();
|
|
||||||
GameWorld gameWorld = GameWorld.getByWorld(world);
|
|
||||||
|
|
||||||
if (gameWorld != null) {
|
|
||||||
spawnLoc = sign.getSign().getLocation().add(0.5, 0, 0.5);
|
|
||||||
double x = spawnLoc.getX();
|
|
||||||
double y = spawnLoc.getY();
|
|
||||||
double z = spawnLoc.getZ();
|
|
||||||
|
|
||||||
String command = "mm mobs spawn " + mob + " " + amount + " DXL_Game_" + gameWorld.getId() + "," + x + "," + y + "," + z;
|
|
||||||
Bukkit.getServer().dispatchCommand(Bukkit.getServer().getConsoleSender(), command);
|
|
||||||
|
|
||||||
setMythicMobs();
|
|
||||||
if (mythicMob != null) {
|
|
||||||
new DMob(mythicMob, sign.getGameWorld(), null, mob);
|
|
||||||
}
|
|
||||||
|
|
||||||
// Set the amount
|
|
||||||
if (amount != -1) {
|
|
||||||
if (amount > 1) {
|
|
||||||
amount--;
|
|
||||||
} else {
|
|
||||||
killTask();
|
|
||||||
sign.remove();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
sign.interval = sign.maxinterval;
|
|
||||||
} else {
|
|
||||||
sign.killTask();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
sign.interval--;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
private void setMythicMobs() {
|
|
||||||
for (Entity entity : spawnLoc.getChunk().getEntities()) {
|
|
||||||
if (entity.getLocation().getX() >= spawnLoc.getX() - 1 && entity.getLocation().getX() <= spawnLoc.getX() + 1 && entity.getLocation().getY() >= spawnLoc.getY() - 1
|
|
||||||
&& entity.getLocation().getY() <= spawnLoc.getY() + 1 && entity.getLocation().getZ() >= spawnLoc.getZ() - 1 && entity.getLocation().getZ() <= spawnLoc.getZ() + 1
|
|
||||||
&& !mythicMobs.contains(entity) && entity.isCustomNameVisible() && !(entity instanceof Player)) {
|
&& !mythicMobs.contains(entity) && entity.isCustomNameVisible() && !(entity instanceof Player)) {
|
||||||
mythicMob = (LivingEntity) entity;
|
setMythicMob((LivingEntity) entity);
|
||||||
mythicMobs.add(entity);
|
mythicMobs.add(entity);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
package io.github.dre2n.dungeonsxl.sign;
|
package io.github.dre2n.dungeonsxl.sign;
|
||||||
|
|
||||||
|
import io.github.dre2n.dungeonsxl.config.MessageConfig.Messages;
|
||||||
import io.github.dre2n.dungeonsxl.dungeon.game.GameWorld;
|
import io.github.dre2n.dungeonsxl.dungeon.game.GameWorld;
|
||||||
import io.github.dre2n.dungeonsxl.file.DMessages.Messages;
|
|
||||||
import io.github.dre2n.dungeonsxl.player.DPlayer;
|
import io.github.dre2n.dungeonsxl.player.DPlayer;
|
||||||
import io.github.dre2n.dungeonsxl.trigger.InteractTrigger;
|
import io.github.dre2n.dungeonsxl.trigger.InteractTrigger;
|
||||||
import io.github.dre2n.dungeonsxl.util.messageutil.MessageUtil;
|
import io.github.dre2n.dungeonsxl.util.messageutil.MessageUtil;
|
||||||
@ -68,11 +68,11 @@ public class ReadySign extends DSign {
|
|||||||
|
|
||||||
if (getGameWorld().getSignClass().isEmpty() || dPlayer.getDClass() != null) {
|
if (getGameWorld().getSignClass().isEmpty() || dPlayer.getDClass() != null) {
|
||||||
dPlayer.ready();
|
dPlayer.ready();
|
||||||
MessageUtil.sendMessage(dPlayer.getPlayer(), plugin.getDMessages().getMessage(Messages.PLAYER_READY));
|
MessageUtil.sendMessage(dPlayer.getPlayer(), plugin.getMessageConfig().getMessage(Messages.PLAYER_READY));
|
||||||
return;
|
return;
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
MessageUtil.sendMessage(dPlayer.getPlayer(), plugin.getDMessages().getMessage(Messages.ERROR_READY));
|
MessageUtil.sendMessage(dPlayer.getPlayer(), plugin.getMessageConfig().getMessage(Messages.ERROR_READY));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
package io.github.dre2n.dungeonsxl.sign;
|
package io.github.dre2n.dungeonsxl.sign;
|
||||||
|
|
||||||
import io.github.dre2n.dungeonsxl.DungeonsXL;
|
|
||||||
import io.github.dre2n.dungeonsxl.dungeon.game.GameWorld;
|
import io.github.dre2n.dungeonsxl.dungeon.game.GameWorld;
|
||||||
|
import io.github.dre2n.dungeonsxl.task.DelayedPowerTask;
|
||||||
import io.github.dre2n.dungeonsxl.util.NumberUtil;
|
import io.github.dre2n.dungeonsxl.util.NumberUtil;
|
||||||
|
|
||||||
import org.bukkit.Material;
|
import org.bukkit.Material;
|
||||||
@ -15,16 +15,151 @@ public class RedstoneSign extends DSign {
|
|||||||
// Variables
|
// Variables
|
||||||
private boolean initialized;
|
private boolean initialized;
|
||||||
private boolean active;
|
private boolean active;
|
||||||
private int enableTaskId = -1;
|
private DelayedPowerTask enableTask;
|
||||||
private int disableTaskId = -1;
|
private DelayedPowerTask disableTask;
|
||||||
private Block block;
|
private Block block;
|
||||||
private long delay = 0;
|
private long delay = 0;
|
||||||
private long offDelay = 0;
|
private long offDelay = 0;
|
||||||
private int repeat = 1;
|
private int repeat = 1;
|
||||||
private int repeatsToDo = 1;
|
private int repeatsToDo = 1;
|
||||||
|
|
||||||
public RedstoneSign(Sign sign, GameWorld gworld) {
|
public RedstoneSign(Sign sign, GameWorld gameWorld) {
|
||||||
super(sign, gworld);
|
super(sign, gameWorld);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @return the initialized
|
||||||
|
*/
|
||||||
|
public boolean isInitialized() {
|
||||||
|
return initialized;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param initialized
|
||||||
|
* the initialized to set
|
||||||
|
*/
|
||||||
|
public void setInitialized(boolean initialized) {
|
||||||
|
this.initialized = initialized;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @return the active
|
||||||
|
*/
|
||||||
|
public boolean isActive() {
|
||||||
|
return active;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param active
|
||||||
|
* the active to set
|
||||||
|
*/
|
||||||
|
public void setActive(boolean active) {
|
||||||
|
this.active = active;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @return the enableTask
|
||||||
|
*/
|
||||||
|
public DelayedPowerTask getEnableTask() {
|
||||||
|
return enableTask;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param enableTask
|
||||||
|
* the enableTask to set
|
||||||
|
*/
|
||||||
|
public void setEnableTask(DelayedPowerTask enableTask) {
|
||||||
|
this.enableTask = enableTask;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @return the disableTask
|
||||||
|
*/
|
||||||
|
public DelayedPowerTask getDisableTask() {
|
||||||
|
return disableTask;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param disableTask
|
||||||
|
* the disableTask to set
|
||||||
|
*/
|
||||||
|
public void setDisableTask(DelayedPowerTask disableTask) {
|
||||||
|
this.disableTask = disableTask;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @return the block
|
||||||
|
*/
|
||||||
|
public Block getBlock() {
|
||||||
|
return block;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param block
|
||||||
|
* the block to set
|
||||||
|
*/
|
||||||
|
public void setBlock(Block block) {
|
||||||
|
this.block = block;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @return the delay
|
||||||
|
*/
|
||||||
|
public long getDelay() {
|
||||||
|
return delay;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param delay
|
||||||
|
* the delay to set
|
||||||
|
*/
|
||||||
|
public void setDelay(long delay) {
|
||||||
|
this.delay = delay;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @return the offDelay
|
||||||
|
*/
|
||||||
|
public long getOffDelay() {
|
||||||
|
return offDelay;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param offDelay
|
||||||
|
* the offDelay to set
|
||||||
|
*/
|
||||||
|
public void setOffDelay(long offDelay) {
|
||||||
|
this.offDelay = offDelay;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @return the repeat
|
||||||
|
*/
|
||||||
|
public int getRepeat() {
|
||||||
|
return repeat;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param repeat
|
||||||
|
* the repeat to set
|
||||||
|
*/
|
||||||
|
public void setRepeat(int repeat) {
|
||||||
|
this.repeat = repeat;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @return the repeatsToDo
|
||||||
|
*/
|
||||||
|
public int getRepeatsToDo() {
|
||||||
|
return repeatsToDo;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param repeatsToDo
|
||||||
|
* the repeatsToDo to set
|
||||||
|
*/
|
||||||
|
public void setRepeatsToDo(int repeatsToDo) {
|
||||||
|
this.repeatsToDo = repeatsToDo;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@ -74,11 +209,11 @@ public class RedstoneSign extends DSign {
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (delay > 0) {
|
if (delay > 0) {
|
||||||
enableTaskId = DungeonsXL.getPlugin().getServer().getScheduler().scheduleSyncRepeatingTask(DungeonsXL.getPlugin(), new DelayedPower(true), delay, delay + offDelay);
|
enableTask = (DelayedPowerTask) new DelayedPowerTask(this, true).runTaskTimer(plugin, delay, delay + offDelay);
|
||||||
|
|
||||||
if (repeat != 1) {
|
if (repeat != 1) {
|
||||||
repeatsToDo = repeat;
|
repeatsToDo = repeat;
|
||||||
disableTaskId = DungeonsXL.getPlugin().getServer().getScheduler().scheduleSyncRepeatingTask(DungeonsXL.getPlugin(), new DelayedPower(false), delay + offDelay, delay + offDelay);
|
disableTask = (DelayedPowerTask) new DelayedPowerTask(this, false).runTaskTimer(plugin, delay + offDelay, delay + offDelay);
|
||||||
}
|
}
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
@ -96,10 +231,8 @@ public class RedstoneSign extends DSign {
|
|||||||
|
|
||||||
unpower();
|
unpower();
|
||||||
|
|
||||||
disableTask(enableTaskId);
|
enableTask.cancel();
|
||||||
disableTask(disableTaskId);
|
disableTask.cancel();
|
||||||
enableTaskId = -1;
|
|
||||||
disableTaskId = -1;
|
|
||||||
|
|
||||||
active = false;
|
active = false;
|
||||||
}
|
}
|
||||||
@ -112,50 +245,9 @@ public class RedstoneSign extends DSign {
|
|||||||
block.setType(Material.AIR);
|
block.setType(Material.AIR);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void disableTask(int taskId) {
|
|
||||||
if (taskId == -1) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (DungeonsXL.getPlugin().getServer().getScheduler().isCurrentlyRunning(taskId) || DungeonsXL.getPlugin().getServer().getScheduler().isQueued(taskId)) {
|
|
||||||
DungeonsXL.getPlugin().getServer().getScheduler().cancelTask(taskId);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public DSignType getType() {
|
public DSignType getType() {
|
||||||
return type;
|
return type;
|
||||||
}
|
}
|
||||||
|
|
||||||
public class DelayedPower implements Runnable {
|
|
||||||
private final boolean enable;
|
|
||||||
|
|
||||||
public DelayedPower(boolean enable) {
|
|
||||||
this.enable = enable;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void run() {
|
|
||||||
if (GameWorld.getByWorld(block.getWorld()) == null) {
|
|
||||||
disableTask(enableTaskId);
|
|
||||||
disableTask(disableTaskId);
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
if (enable) {
|
|
||||||
power();
|
|
||||||
if (repeatsToDo == 1) {
|
|
||||||
disableTask(enableTaskId);
|
|
||||||
enableTaskId = -1;
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
unpower();
|
|
||||||
if (repeatsToDo == 1) {
|
|
||||||
disableTask(disableTaskId);
|
|
||||||
disableTaskId = -1;
|
|
||||||
}
|
|
||||||
repeatsToDo--;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -2,6 +2,7 @@ package io.github.dre2n.dungeonsxl.sign;
|
|||||||
|
|
||||||
import io.github.dre2n.dungeonsxl.dungeon.EditWorld;
|
import io.github.dre2n.dungeonsxl.dungeon.EditWorld;
|
||||||
import io.github.dre2n.dungeonsxl.dungeon.game.GameWorld;
|
import io.github.dre2n.dungeonsxl.dungeon.game.GameWorld;
|
||||||
|
import io.github.dre2n.dungeonsxl.task.SignUpdateTask;
|
||||||
import io.github.dre2n.dungeonsxl.trigger.SignTrigger;
|
import io.github.dre2n.dungeonsxl.trigger.SignTrigger;
|
||||||
import io.github.dre2n.dungeonsxl.util.NumberUtil;
|
import io.github.dre2n.dungeonsxl.util.NumberUtil;
|
||||||
|
|
||||||
@ -62,7 +63,9 @@ public class TriggerSign extends DSign {
|
|||||||
}
|
}
|
||||||
|
|
||||||
getSign().setLine(1, id + "");
|
getSign().setLine(1, id + "");
|
||||||
plugin.getServer().getScheduler().scheduleSyncDelayedTask(plugin, new UpdateTask(), 2);
|
|
||||||
|
new SignUpdateTask(getSign()).runTaskLater(plugin, 2L);
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -103,15 +106,4 @@ public class TriggerSign extends DSign {
|
|||||||
return type;
|
return type;
|
||||||
}
|
}
|
||||||
|
|
||||||
public class UpdateTask implements Runnable {
|
|
||||||
|
|
||||||
public UpdateTask() {
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void run() {
|
|
||||||
getSign().update();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
38
src/io/github/dre2n/dungeonsxl/task/DelayedPowerTask.java
Normal file
38
src/io/github/dre2n/dungeonsxl/task/DelayedPowerTask.java
Normal file
@ -0,0 +1,38 @@
|
|||||||
|
package io.github.dre2n.dungeonsxl.task;
|
||||||
|
|
||||||
|
import io.github.dre2n.dungeonsxl.dungeon.game.GameWorld;
|
||||||
|
import io.github.dre2n.dungeonsxl.sign.RedstoneSign;
|
||||||
|
|
||||||
|
import org.bukkit.scheduler.BukkitRunnable;
|
||||||
|
|
||||||
|
public class DelayedPowerTask extends BukkitRunnable {
|
||||||
|
|
||||||
|
private RedstoneSign sign;
|
||||||
|
private boolean enable;
|
||||||
|
|
||||||
|
public DelayedPowerTask(RedstoneSign sign, boolean enable) {
|
||||||
|
this.sign = sign;
|
||||||
|
this.enable = enable;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void run() {
|
||||||
|
if (GameWorld.getByWorld(sign.getBlock().getWorld()) == null) {
|
||||||
|
sign.getEnableTask().cancel();
|
||||||
|
sign.getDisableTask().cancel();
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
if (enable) {
|
||||||
|
sign.power();
|
||||||
|
if (sign.getRepeatsToDo() == 1) {
|
||||||
|
sign.getEnableTask().cancel();
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
sign.unpower();
|
||||||
|
if (sign.getRepeatsToDo() == 1) {
|
||||||
|
sign.getDisableTask().cancel();
|
||||||
|
}
|
||||||
|
sign.setRepeatsToDo(sign.getRepeatsToDo() - 1);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
24
src/io/github/dre2n/dungeonsxl/task/LazyUpdateTask.java
Normal file
24
src/io/github/dre2n/dungeonsxl/task/LazyUpdateTask.java
Normal file
@ -0,0 +1,24 @@
|
|||||||
|
package io.github.dre2n.dungeonsxl.task;
|
||||||
|
|
||||||
|
import io.github.dre2n.dungeonsxl.DungeonsXL;
|
||||||
|
import io.github.dre2n.dungeonsxl.dungeon.game.GameWorld;
|
||||||
|
import io.github.dre2n.dungeonsxl.player.DPlayer;
|
||||||
|
|
||||||
|
import org.bukkit.scheduler.BukkitRunnable;
|
||||||
|
|
||||||
|
public class LazyUpdateTask extends BukkitRunnable {
|
||||||
|
|
||||||
|
static DungeonsXL plugin = DungeonsXL.getPlugin();
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void run() {
|
||||||
|
for (GameWorld gameWorld : plugin.getGameWorlds()) {
|
||||||
|
gameWorld.update();
|
||||||
|
}
|
||||||
|
|
||||||
|
for (DPlayer dPlayer : plugin.getDPlayers()) {
|
||||||
|
dPlayer.update(true);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
81
src/io/github/dre2n/dungeonsxl/task/MobSpawnTask.java
Normal file
81
src/io/github/dre2n/dungeonsxl/task/MobSpawnTask.java
Normal file
@ -0,0 +1,81 @@
|
|||||||
|
package io.github.dre2n.dungeonsxl.task;
|
||||||
|
|
||||||
|
import io.github.dre2n.dungeonsxl.dungeon.game.GameWorld;
|
||||||
|
import io.github.dre2n.dungeonsxl.mob.DMob;
|
||||||
|
import io.github.dre2n.dungeonsxl.mob.DMobType;
|
||||||
|
import io.github.dre2n.dungeonsxl.sign.MobSign;
|
||||||
|
|
||||||
|
import org.bukkit.Location;
|
||||||
|
import org.bukkit.Material;
|
||||||
|
import org.bukkit.World;
|
||||||
|
import org.bukkit.entity.EntityType;
|
||||||
|
import org.bukkit.entity.LivingEntity;
|
||||||
|
import org.bukkit.entity.Skeleton;
|
||||||
|
import org.bukkit.entity.Skeleton.SkeletonType;
|
||||||
|
import org.bukkit.inventory.ItemStack;
|
||||||
|
import org.bukkit.scheduler.BukkitRunnable;
|
||||||
|
|
||||||
|
public class MobSpawnTask extends BukkitRunnable {
|
||||||
|
|
||||||
|
private MobSign sign;
|
||||||
|
|
||||||
|
public MobSpawnTask(MobSign sign) {
|
||||||
|
this.sign = sign;
|
||||||
|
}
|
||||||
|
|
||||||
|
@SuppressWarnings("deprecation")
|
||||||
|
@Override
|
||||||
|
public void run() {
|
||||||
|
if (sign.getInterval() <= 0) {
|
||||||
|
World world = sign.getSign().getWorld();
|
||||||
|
GameWorld gameWorld = GameWorld.getByWorld(world);
|
||||||
|
|
||||||
|
if (gameWorld != null) {
|
||||||
|
Location spawnLoc = sign.getSign().getLocation().add(0.5, 0, 0.5);
|
||||||
|
|
||||||
|
// Check normal mobs
|
||||||
|
if (EntityType.fromName(sign.getMob()) != null) {
|
||||||
|
if (EntityType.fromName(sign.getMob()).isAlive()) {
|
||||||
|
LivingEntity entity = (LivingEntity) world.spawnEntity(spawnLoc, EntityType.fromName(sign.getMob()));
|
||||||
|
|
||||||
|
// Add Bow to normal Skeletons
|
||||||
|
if (entity.getType() == EntityType.SKELETON) {
|
||||||
|
Skeleton skeleton = (Skeleton) entity;
|
||||||
|
if (skeleton.getSkeletonType() == SkeletonType.NORMAL) {
|
||||||
|
skeleton.getEquipment().setItemInHand(new ItemStack(Material.BOW));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// Disable Despawning
|
||||||
|
entity.setRemoveWhenFarAway(false);
|
||||||
|
|
||||||
|
new DMob(entity, sign.getGameWorld(), null);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// Check custom mobs
|
||||||
|
DMobType mobType = DMobType.getByName(sign.getMob(), gameWorld.getConfig().getMobTypes());
|
||||||
|
|
||||||
|
if (mobType != null) {
|
||||||
|
mobType.spawn(GameWorld.getByWorld(world), spawnLoc);
|
||||||
|
}
|
||||||
|
|
||||||
|
// Set the amount
|
||||||
|
if (sign.getAmount() != -1) {
|
||||||
|
if (sign.getAmount() > 1) {
|
||||||
|
sign.setAmount(sign.getAmount() - 1);
|
||||||
|
} else {
|
||||||
|
sign.killTask();
|
||||||
|
sign.remove();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
sign.setInterval(sign.getMaxinterval());
|
||||||
|
} else {
|
||||||
|
sign.killTask();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
sign.setInterval(sign.getInterval() - 1);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
57
src/io/github/dre2n/dungeonsxl/task/MythicMobSpawnTask.java
Normal file
57
src/io/github/dre2n/dungeonsxl/task/MythicMobSpawnTask.java
Normal file
@ -0,0 +1,57 @@
|
|||||||
|
package io.github.dre2n.dungeonsxl.task;
|
||||||
|
|
||||||
|
import io.github.dre2n.dungeonsxl.dungeon.game.GameWorld;
|
||||||
|
import io.github.dre2n.dungeonsxl.mob.DMob;
|
||||||
|
import io.github.dre2n.dungeonsxl.sign.MythicMobsSign;
|
||||||
|
|
||||||
|
import org.bukkit.Bukkit;
|
||||||
|
import org.bukkit.World;
|
||||||
|
import org.bukkit.scheduler.BukkitRunnable;
|
||||||
|
|
||||||
|
public class MythicMobSpawnTask extends BukkitRunnable {
|
||||||
|
|
||||||
|
private MythicMobsSign sign;
|
||||||
|
|
||||||
|
public MythicMobSpawnTask(MythicMobsSign sign) {
|
||||||
|
this.sign = sign;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void run() {
|
||||||
|
if (sign.getInterval() <= 0) {
|
||||||
|
World world = sign.getSign().getWorld();
|
||||||
|
GameWorld gameWorld = GameWorld.getByWorld(world);
|
||||||
|
|
||||||
|
if (gameWorld != null) {
|
||||||
|
sign.setSpawnLocation(sign.getSign().getLocation().add(0.5, 0, 0.5));
|
||||||
|
double x = sign.getSpawnLocation().getX();
|
||||||
|
double y = sign.getSpawnLocation().getY();
|
||||||
|
double z = sign.getSpawnLocation().getZ();
|
||||||
|
|
||||||
|
String command = "mm mobs spawn " + sign.getMob() + " " + sign.getAmount() + " DXL_Game_" + gameWorld.getId() + "," + x + "," + y + "," + z;
|
||||||
|
Bukkit.getServer().dispatchCommand(Bukkit.getServer().getConsoleSender(), command);
|
||||||
|
|
||||||
|
sign.setMythicMobs();
|
||||||
|
if (sign.getMythicMob() != null) {
|
||||||
|
new DMob(sign.getMythicMob(), sign.getGameWorld(), null, sign.getMob());
|
||||||
|
}
|
||||||
|
|
||||||
|
// Set the amount
|
||||||
|
if (sign.getAmount() != -1) {
|
||||||
|
if (sign.getAmount() > 1) {
|
||||||
|
sign.setAmount(sign.getAmount() - 1);
|
||||||
|
} else {
|
||||||
|
sign.killTask();
|
||||||
|
sign.remove();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
sign.setInterval(sign.getMaxinterval());
|
||||||
|
} else {
|
||||||
|
sign.killTask();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
sign.setInterval(sign.getInterval() - 1);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
27
src/io/github/dre2n/dungeonsxl/task/RedstoneEventTask.java
Normal file
27
src/io/github/dre2n/dungeonsxl/task/RedstoneEventTask.java
Normal file
@ -0,0 +1,27 @@
|
|||||||
|
package io.github.dre2n.dungeonsxl.task;
|
||||||
|
|
||||||
|
import io.github.dre2n.dungeonsxl.DungeonsXL;
|
||||||
|
import io.github.dre2n.dungeonsxl.dungeon.game.GameWorld;
|
||||||
|
import io.github.dre2n.dungeonsxl.trigger.RedstoneTrigger;
|
||||||
|
|
||||||
|
import org.bukkit.block.Block;
|
||||||
|
import org.bukkit.scheduler.BukkitRunnable;
|
||||||
|
|
||||||
|
public class RedstoneEventTask extends BukkitRunnable {
|
||||||
|
|
||||||
|
private final Block block;
|
||||||
|
|
||||||
|
public RedstoneEventTask(final Block block) {
|
||||||
|
this.block = block;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void run() {
|
||||||
|
for (GameWorld gameWorld : DungeonsXL.getPlugin().getGameWorlds()) {
|
||||||
|
if (block.getWorld() == gameWorld.getWorld()) {
|
||||||
|
RedstoneTrigger.updateAll(gameWorld);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
41
src/io/github/dre2n/dungeonsxl/task/RespawnTask.java
Normal file
41
src/io/github/dre2n/dungeonsxl/task/RespawnTask.java
Normal file
@ -0,0 +1,41 @@
|
|||||||
|
package io.github.dre2n.dungeonsxl.task;
|
||||||
|
|
||||||
|
import io.github.dre2n.dungeonsxl.player.DPlayer;
|
||||||
|
import io.github.dre2n.dungeonsxl.util.playerutil.PlayerUtil;
|
||||||
|
|
||||||
|
import org.bukkit.Location;
|
||||||
|
import org.bukkit.entity.Player;
|
||||||
|
import org.bukkit.scheduler.BukkitRunnable;
|
||||||
|
|
||||||
|
public class RespawnTask extends BukkitRunnable {
|
||||||
|
|
||||||
|
private Player player;
|
||||||
|
private Location location;
|
||||||
|
|
||||||
|
public RespawnTask(Player player, Location location) {
|
||||||
|
this.location = location;
|
||||||
|
this.player = player;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void run() {
|
||||||
|
if (player.getLocation().distance(location) > 2) {
|
||||||
|
PlayerUtil.secureTeleport(player, location);
|
||||||
|
}
|
||||||
|
|
||||||
|
DPlayer dPlayer = DPlayer.getByPlayer(player);
|
||||||
|
|
||||||
|
if (dPlayer == null) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Respawn Items
|
||||||
|
if (dPlayer.getRespawnInventory() != null || dPlayer.getRespawnArmor() != null) {
|
||||||
|
player.getInventory().setContents(dPlayer.getRespawnInventory());
|
||||||
|
player.getInventory().setArmorContents(dPlayer.getRespawnArmor());
|
||||||
|
dPlayer.setRespawnInventory(null);
|
||||||
|
dPlayer.setRespawnArmor(null);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
19
src/io/github/dre2n/dungeonsxl/task/SignUpdateTask.java
Normal file
19
src/io/github/dre2n/dungeonsxl/task/SignUpdateTask.java
Normal file
@ -0,0 +1,19 @@
|
|||||||
|
package io.github.dre2n.dungeonsxl.task;
|
||||||
|
|
||||||
|
import org.bukkit.block.Sign;
|
||||||
|
import org.bukkit.scheduler.BukkitRunnable;
|
||||||
|
|
||||||
|
public class SignUpdateTask extends BukkitRunnable {
|
||||||
|
|
||||||
|
private Sign sign;
|
||||||
|
|
||||||
|
public SignUpdateTask(Sign sign) {
|
||||||
|
this.sign = sign;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void run() {
|
||||||
|
sign.update();
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
17
src/io/github/dre2n/dungeonsxl/task/UpdateTask.java
Normal file
17
src/io/github/dre2n/dungeonsxl/task/UpdateTask.java
Normal file
@ -0,0 +1,17 @@
|
|||||||
|
package io.github.dre2n.dungeonsxl.task;
|
||||||
|
|
||||||
|
import org.bukkit.scheduler.BukkitRunnable;
|
||||||
|
|
||||||
|
import io.github.dre2n.dungeonsxl.DungeonsXL;
|
||||||
|
import io.github.dre2n.dungeonsxl.player.DPlayer;
|
||||||
|
|
||||||
|
public class UpdateTask extends BukkitRunnable {
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void run() {
|
||||||
|
for (DPlayer dPlayer : DungeonsXL.getPlugin().getDPlayers()) {
|
||||||
|
dPlayer.update(false);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
31
src/io/github/dre2n/dungeonsxl/task/WorldUnloadTask.java
Normal file
31
src/io/github/dre2n/dungeonsxl/task/WorldUnloadTask.java
Normal file
@ -0,0 +1,31 @@
|
|||||||
|
package io.github.dre2n.dungeonsxl.task;
|
||||||
|
|
||||||
|
import io.github.dre2n.dungeonsxl.DungeonsXL;
|
||||||
|
import io.github.dre2n.dungeonsxl.dungeon.EditWorld;
|
||||||
|
import io.github.dre2n.dungeonsxl.dungeon.game.GameWorld;
|
||||||
|
import io.github.dre2n.dungeonsxl.player.DPlayer;
|
||||||
|
|
||||||
|
import org.bukkit.scheduler.BukkitRunnable;
|
||||||
|
|
||||||
|
public class WorldUnloadTask extends BukkitRunnable {
|
||||||
|
|
||||||
|
static DungeonsXL plugin = DungeonsXL.getPlugin();
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void run() {
|
||||||
|
for (GameWorld gameWorld : plugin.getGameWorlds()) {
|
||||||
|
if (gameWorld.getWorld().getPlayers().isEmpty()) {
|
||||||
|
if (DPlayer.getByWorld(gameWorld.getWorld()).isEmpty()) {
|
||||||
|
gameWorld.delete();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
for (EditWorld editWorld : plugin.getEditWorlds()) {
|
||||||
|
if (editWorld.getWorld().getPlayers().isEmpty()) {
|
||||||
|
editWorld.delete();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
@ -1,95 +0,0 @@
|
|||||||
package io.github.dre2n.dungeonsxl.util;
|
|
||||||
|
|
||||||
import io.github.dre2n.dungeonsxl.DungeonsXL;
|
|
||||||
|
|
||||||
import java.io.File;
|
|
||||||
import java.io.FileInputStream;
|
|
||||||
import java.io.FileNotFoundException;
|
|
||||||
import java.io.IOException;
|
|
||||||
import java.io.ObjectInputStream;
|
|
||||||
|
|
||||||
import org.bukkit.Location;
|
|
||||||
import org.bukkit.World;
|
|
||||||
import org.bukkit.WorldCreator;
|
|
||||||
import org.bukkit.block.Block;
|
|
||||||
import org.bukkit.block.Sign;
|
|
||||||
import org.bukkit.entity.Player;
|
|
||||||
|
|
||||||
public class MiscUtil {
|
|
||||||
public static DungeonsXL p = DungeonsXL.getPlugin();
|
|
||||||
|
|
||||||
public static void convertOldSigns() {
|
|
||||||
File file = new File(p.getDataFolder(), "/dungeons/");
|
|
||||||
|
|
||||||
if (file.exists()) {
|
|
||||||
for (File dungeonFolder : file.listFiles()) {
|
|
||||||
if (dungeonFolder.isDirectory()) {
|
|
||||||
FileUtil.copyDirectory(dungeonFolder, new File("DXL_TMP"));
|
|
||||||
|
|
||||||
World world = p.getServer().createWorld(WorldCreator.name("DXL_TMP"));
|
|
||||||
|
|
||||||
// World
|
|
||||||
try {
|
|
||||||
ObjectInputStream os = new ObjectInputStream(new FileInputStream(new File(p.getDataFolder(), "/dungeons/" + dungeonFolder.getName() + "/DXLData.data")));
|
|
||||||
int length = os.readInt();
|
|
||||||
for (int i = 0; i < length; i++) {
|
|
||||||
int x = os.readInt();
|
|
||||||
int y = os.readInt();
|
|
||||||
int z = os.readInt();
|
|
||||||
Block block = world.getBlockAt(x, y, z);
|
|
||||||
|
|
||||||
if (block.getState() instanceof Sign) {
|
|
||||||
Sign sign = (Sign) block.getState();
|
|
||||||
|
|
||||||
if (sign.getLine(0).equalsIgnoreCase("[dxl]")) {
|
|
||||||
sign.setLine(0, "[" + sign.getLine(1) + "]");
|
|
||||||
sign.setLine(1, sign.getLine(2));
|
|
||||||
sign.setLine(2, sign.getLine(3));
|
|
||||||
sign.update();
|
|
||||||
|
|
||||||
if (sign.getLine(0).equalsIgnoreCase("[mob]")) {
|
|
||||||
String[] splitted = sign.getLine(2).split(",");
|
|
||||||
if (splitted.length >= 3) {
|
|
||||||
sign.setLine(2, splitted[0] + "," + splitted[1]);
|
|
||||||
sign.setLine(3, "D " + splitted[2]);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if (sign.getLine(0).equalsIgnoreCase("[msg]") || sign.getLine(0).equalsIgnoreCase("[soundmsg]")) {
|
|
||||||
sign.setLine(3, "D " + sign.getLine(2));
|
|
||||||
sign.setLine(2, "");
|
|
||||||
}
|
|
||||||
|
|
||||||
if (sign.getLine(0).equalsIgnoreCase("[checkpoint]")) {
|
|
||||||
sign.setLine(3, "D " + sign.getLine(1));
|
|
||||||
sign.setLine(1, "");
|
|
||||||
}
|
|
||||||
|
|
||||||
sign.update();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
os.close();
|
|
||||||
p.getServer().unloadWorld(world, true);
|
|
||||||
FileUtil.copyDirectory(new File("DXL_TMP"), dungeonFolder);
|
|
||||||
FileUtil.removeDirectory(new File("DXL_TMP"));
|
|
||||||
} catch (FileNotFoundException e) {
|
|
||||||
e.printStackTrace();
|
|
||||||
} catch (IOException e) {
|
|
||||||
e.printStackTrace();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
public static void secureTeleport(Player player, Location location) {
|
|
||||||
if (player.isInsideVehicle()) {
|
|
||||||
player.leaveVehicle();
|
|
||||||
}
|
|
||||||
|
|
||||||
player.teleport(location);
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
@ -1,4 +1,4 @@
|
|||||||
package io.github.dre2n.dungeonsxl.util.offlineplayerutil;
|
package io.github.dre2n.dungeonsxl.util.playerutil;
|
||||||
|
|
||||||
import io.github.dre2n.dungeonsxl.DungeonsXL;
|
import io.github.dre2n.dungeonsxl.DungeonsXL;
|
||||||
import io.github.dre2n.dungeonsxl.util.VersionUtil;
|
import io.github.dre2n.dungeonsxl.util.VersionUtil;
|
||||||
@ -9,7 +9,7 @@ import java.util.UUID;
|
|||||||
import org.bukkit.Location;
|
import org.bukkit.Location;
|
||||||
import org.bukkit.entity.Player;
|
import org.bukkit.entity.Player;
|
||||||
|
|
||||||
public class OfflinePlayerUtil {
|
public class PlayerUtil {
|
||||||
|
|
||||||
public static Player getOfflinePlayer(String player, UUID uuid) {
|
public static Player getOfflinePlayer(String player, UUID uuid) {
|
||||||
VersionUtil versions = DungeonsXL.getPlugin().getVersion();
|
VersionUtil versions = DungeonsXL.getPlugin().getVersion();
|
||||||
@ -63,4 +63,12 @@ public class OfflinePlayerUtil {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static void secureTeleport(Player player, Location location) {
|
||||||
|
if (player.isInsideVehicle()) {
|
||||||
|
player.leaveVehicle();
|
||||||
|
}
|
||||||
|
|
||||||
|
player.teleport(location);
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
@ -1,4 +1,4 @@
|
|||||||
package io.github.dre2n.dungeonsxl.util.offlineplayerutil;
|
package io.github.dre2n.dungeonsxl.util.playerutil;
|
||||||
|
|
||||||
import java.io.File;
|
import java.io.File;
|
||||||
import java.util.UUID;
|
import java.util.UUID;
|
@ -1,4 +1,4 @@
|
|||||||
package io.github.dre2n.dungeonsxl.util.offlineplayerutil;
|
package io.github.dre2n.dungeonsxl.util.playerutil;
|
||||||
|
|
||||||
import java.io.File;
|
import java.io.File;
|
||||||
import java.util.UUID;
|
import java.util.UUID;
|
@ -1,4 +1,4 @@
|
|||||||
package io.github.dre2n.dungeonsxl.util.offlineplayerutil;
|
package io.github.dre2n.dungeonsxl.util.playerutil;
|
||||||
|
|
||||||
import java.io.File;
|
import java.io.File;
|
||||||
import java.util.UUID;
|
import java.util.UUID;
|
@ -1,4 +1,4 @@
|
|||||||
package io.github.dre2n.dungeonsxl.util.offlineplayerutil;
|
package io.github.dre2n.dungeonsxl.util.playerutil;
|
||||||
|
|
||||||
import java.io.File;
|
import java.io.File;
|
||||||
import java.util.UUID;
|
import java.util.UUID;
|
@ -1,4 +1,4 @@
|
|||||||
package io.github.dre2n.dungeonsxl.util.offlineplayerutil;
|
package io.github.dre2n.dungeonsxl.util.playerutil;
|
||||||
|
|
||||||
import java.io.File;
|
import java.io.File;
|
||||||
import java.util.UUID;
|
import java.util.UUID;
|
@ -1,4 +1,4 @@
|
|||||||
package io.github.dre2n.dungeonsxl.util.offlineplayerutil;
|
package io.github.dre2n.dungeonsxl.util.playerutil;
|
||||||
|
|
||||||
import java.io.File;
|
import java.io.File;
|
||||||
import java.util.UUID;
|
import java.util.UUID;
|
Loading…
Reference in New Issue
Block a user