mirror of
https://github.com/DRE2N/DungeonsXL.git
synced 2024-11-25 03:55:22 +01:00
Equalize world class naming
This commit is contained in:
parent
e2f4a8fe84
commit
9ae44d6cd5
@ -52,7 +52,7 @@ import io.github.dre2n.dungeonsxl.task.SecureModeTask;
|
|||||||
import io.github.dre2n.dungeonsxl.task.UpdateTask;
|
import io.github.dre2n.dungeonsxl.task.UpdateTask;
|
||||||
import io.github.dre2n.dungeonsxl.task.WorldUnloadTask;
|
import io.github.dre2n.dungeonsxl.task.WorldUnloadTask;
|
||||||
import io.github.dre2n.dungeonsxl.trigger.TriggerTypes;
|
import io.github.dre2n.dungeonsxl.trigger.TriggerTypes;
|
||||||
import io.github.dre2n.dungeonsxl.world.Worlds;
|
import io.github.dre2n.dungeonsxl.world.DWorlds;
|
||||||
import io.github.dre2n.itemsxl.ItemsXL;
|
import io.github.dre2n.itemsxl.ItemsXL;
|
||||||
import java.io.File;
|
import java.io.File;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
@ -98,7 +98,7 @@ public class DungeonsXL extends BRPlugin {
|
|||||||
private DClasses dClasses;
|
private DClasses dClasses;
|
||||||
private DMobTypes dMobTypes;
|
private DMobTypes dMobTypes;
|
||||||
private SignScripts signScripts;
|
private SignScripts signScripts;
|
||||||
private Worlds worlds;
|
private DWorlds dWorlds;
|
||||||
|
|
||||||
private BukkitTask announcerTask;
|
private BukkitTask announcerTask;
|
||||||
private BukkitTask worldUnloadTask;
|
private BukkitTask worldUnloadTask;
|
||||||
@ -200,8 +200,8 @@ public class DungeonsXL extends BRPlugin {
|
|||||||
dLootInventories.clear();
|
dLootInventories.clear();
|
||||||
dGroups.clear();
|
dGroups.clear();
|
||||||
|
|
||||||
// Delete Worlds
|
// Delete DWorlds
|
||||||
worlds.deleteAllInstances();
|
dWorlds.deleteAllInstances();
|
||||||
|
|
||||||
// Disable listeners
|
// Disable listeners
|
||||||
HandlerList.unregisterAll(this);
|
HandlerList.unregisterAll(this);
|
||||||
@ -266,18 +266,16 @@ public class DungeonsXL extends BRPlugin {
|
|||||||
public void saveData() {
|
public void saveData() {
|
||||||
protections.saveAll();
|
protections.saveAll();
|
||||||
DSavePlayer.save();
|
DSavePlayer.save();
|
||||||
worlds.saveAll();
|
dWorlds.saveAll();
|
||||||
}
|
}
|
||||||
|
|
||||||
public void loadAll() {
|
public void loadAll() {
|
||||||
protections.loadAll();
|
protections.loadAll();
|
||||||
dPlayers.loadAll();
|
dPlayers.loadAll();
|
||||||
DSavePlayer.load();
|
DSavePlayer.load();
|
||||||
worlds.check();
|
dWorlds.check();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/* Getters and loaders */
|
/* Getters and loaders */
|
||||||
/**
|
/**
|
||||||
* @return the plugin instance
|
* @return the plugin instance
|
||||||
@ -575,17 +573,17 @@ public class DungeonsXL extends BRPlugin {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @return the loaded instance of Worlds
|
* @return the loaded instance of DWorlds
|
||||||
*/
|
*/
|
||||||
public Worlds getWorlds() {
|
public DWorlds getDWorlds() {
|
||||||
return worlds;
|
return dWorlds;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* load / reload a new instance of Worlds
|
* load / reload a new instance of DWorlds
|
||||||
*/
|
*/
|
||||||
public void loadWorlds(File folder) {
|
public void loadWorlds(File folder) {
|
||||||
worlds = new Worlds(MAPS);
|
dWorlds = new DWorlds(MAPS);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -23,8 +23,8 @@ import io.github.dre2n.dungeonsxl.config.DMessages;
|
|||||||
import io.github.dre2n.dungeonsxl.player.DEditPlayer;
|
import io.github.dre2n.dungeonsxl.player.DEditPlayer;
|
||||||
import io.github.dre2n.dungeonsxl.player.DGamePlayer;
|
import io.github.dre2n.dungeonsxl.player.DGamePlayer;
|
||||||
import io.github.dre2n.dungeonsxl.player.DPermissions;
|
import io.github.dre2n.dungeonsxl.player.DPermissions;
|
||||||
import io.github.dre2n.dungeonsxl.world.EditWorld;
|
import io.github.dre2n.dungeonsxl.world.DEditWorld;
|
||||||
import io.github.dre2n.dungeonsxl.world.ResourceWorld;
|
import io.github.dre2n.dungeonsxl.world.DResourceWorld;
|
||||||
import java.io.File;
|
import java.io.File;
|
||||||
import org.bukkit.command.CommandSender;
|
import org.bukkit.command.CommandSender;
|
||||||
import org.bukkit.command.ConsoleCommandSender;
|
import org.bukkit.command.ConsoleCommandSender;
|
||||||
@ -67,8 +67,8 @@ public class CreateCommand extends BRCommand {
|
|||||||
MessageUtil.log(plugin, DMessages.LOG_GENERATE_NEW_WORLD.getMessage());
|
MessageUtil.log(plugin, DMessages.LOG_GENERATE_NEW_WORLD.getMessage());
|
||||||
|
|
||||||
// Create World
|
// Create World
|
||||||
ResourceWorld resource = new ResourceWorld(name);
|
DResourceWorld resource = new DResourceWorld(name);
|
||||||
EditWorld editWorld = resource.generate();
|
DEditWorld editWorld = resource.generate();
|
||||||
editWorld.save();
|
editWorld.save();
|
||||||
editWorld.delete();
|
editWorld.delete();
|
||||||
|
|
||||||
@ -88,8 +88,8 @@ public class CreateCommand extends BRCommand {
|
|||||||
MessageUtil.log(plugin, DMessages.LOG_GENERATE_NEW_WORLD.getMessage());
|
MessageUtil.log(plugin, DMessages.LOG_GENERATE_NEW_WORLD.getMessage());
|
||||||
|
|
||||||
// Create World
|
// Create World
|
||||||
ResourceWorld resource = new ResourceWorld(name);
|
DResourceWorld resource = new DResourceWorld(name);
|
||||||
EditWorld editWorld = resource.generate();
|
DEditWorld editWorld = resource.generate();
|
||||||
|
|
||||||
// MSG Done
|
// MSG Done
|
||||||
MessageUtil.log(plugin, DMessages.LOG_WORLD_GENERATION_FINISHED.getMessage());
|
MessageUtil.log(plugin, DMessages.LOG_WORLD_GENERATION_FINISHED.getMessage());
|
||||||
|
@ -25,9 +25,9 @@ import io.github.dre2n.dungeonsxl.player.DGlobalPlayer;
|
|||||||
import io.github.dre2n.dungeonsxl.player.DGroup;
|
import io.github.dre2n.dungeonsxl.player.DGroup;
|
||||||
import io.github.dre2n.dungeonsxl.player.DInstancePlayer;
|
import io.github.dre2n.dungeonsxl.player.DInstancePlayer;
|
||||||
import io.github.dre2n.dungeonsxl.player.DPermissions;
|
import io.github.dre2n.dungeonsxl.player.DPermissions;
|
||||||
import io.github.dre2n.dungeonsxl.world.EditWorld;
|
import io.github.dre2n.dungeonsxl.world.DEditWorld;
|
||||||
import io.github.dre2n.dungeonsxl.world.ResourceWorld;
|
import io.github.dre2n.dungeonsxl.world.DResourceWorld;
|
||||||
import io.github.dre2n.dungeonsxl.world.Worlds;
|
import io.github.dre2n.dungeonsxl.world.DWorlds;
|
||||||
import org.bukkit.command.CommandSender;
|
import org.bukkit.command.CommandSender;
|
||||||
import org.bukkit.entity.Player;
|
import org.bukkit.entity.Player;
|
||||||
|
|
||||||
@ -37,7 +37,7 @@ import org.bukkit.entity.Player;
|
|||||||
public class EditCommand extends BRCommand {
|
public class EditCommand extends BRCommand {
|
||||||
|
|
||||||
DungeonsXL plugin = DungeonsXL.getInstance();
|
DungeonsXL plugin = DungeonsXL.getInstance();
|
||||||
Worlds worlds = plugin.getWorlds();
|
DWorlds worlds = plugin.getDWorlds();
|
||||||
|
|
||||||
public EditCommand() {
|
public EditCommand() {
|
||||||
setCommand("edit");
|
setCommand("edit");
|
||||||
@ -57,8 +57,8 @@ public class EditCommand extends BRCommand {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
ResourceWorld resource = worlds.getResourceByName(mapName);
|
DResourceWorld resource = worlds.getResourceByName(mapName);
|
||||||
EditWorld editWorld = resource.instantiateAsEditWorld();
|
DEditWorld editWorld = resource.instantiateAsEditWorld();
|
||||||
DGroup dGroup = DGroup.getByPlayer(player);
|
DGroup dGroup = DGroup.getByPlayer(player);
|
||||||
DGlobalPlayer dPlayer = plugin.getDPlayers().getByPlayer(player);
|
DGlobalPlayer dPlayer = plugin.getDPlayers().getByPlayer(player);
|
||||||
|
|
||||||
|
@ -23,7 +23,7 @@ import io.github.dre2n.dungeonsxl.player.DEditPlayer;
|
|||||||
import io.github.dre2n.dungeonsxl.player.DGamePlayer;
|
import io.github.dre2n.dungeonsxl.player.DGamePlayer;
|
||||||
import io.github.dre2n.dungeonsxl.player.DGroup;
|
import io.github.dre2n.dungeonsxl.player.DGroup;
|
||||||
import io.github.dre2n.dungeonsxl.player.DPermissions;
|
import io.github.dre2n.dungeonsxl.player.DPermissions;
|
||||||
import io.github.dre2n.dungeonsxl.world.EditWorld;
|
import io.github.dre2n.dungeonsxl.world.DEditWorld;
|
||||||
import org.bukkit.command.CommandSender;
|
import org.bukkit.command.CommandSender;
|
||||||
import org.bukkit.entity.Player;
|
import org.bukkit.entity.Player;
|
||||||
|
|
||||||
@ -52,7 +52,7 @@ public class EscapeCommand extends BRCommand {
|
|||||||
} else if (dPlayer != null) {
|
} else if (dPlayer != null) {
|
||||||
dPlayer.escape();
|
dPlayer.escape();
|
||||||
|
|
||||||
EditWorld editWorld = EditWorld.getByWorld(dPlayer.getWorld());
|
DEditWorld editWorld = DEditWorld.getByWorld(dPlayer.getWorld());
|
||||||
if (editWorld == null) {
|
if (editWorld == null) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
@ -23,7 +23,7 @@ import io.github.dre2n.dungeonsxl.config.DMessages;
|
|||||||
import io.github.dre2n.dungeonsxl.game.Game;
|
import io.github.dre2n.dungeonsxl.game.Game;
|
||||||
import io.github.dre2n.dungeonsxl.player.DGroup;
|
import io.github.dre2n.dungeonsxl.player.DGroup;
|
||||||
import io.github.dre2n.dungeonsxl.player.DPermissions;
|
import io.github.dre2n.dungeonsxl.player.DPermissions;
|
||||||
import io.github.dre2n.dungeonsxl.world.GameWorld;
|
import io.github.dre2n.dungeonsxl.world.DGameWorld;
|
||||||
import org.bukkit.command.CommandSender;
|
import org.bukkit.command.CommandSender;
|
||||||
import org.bukkit.entity.Player;
|
import org.bukkit.entity.Player;
|
||||||
|
|
||||||
@ -52,7 +52,7 @@ public class GameCommand extends BRCommand {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
GameWorld gameWorld = dGroup.getGameWorld();
|
DGameWorld gameWorld = dGroup.getGameWorld();
|
||||||
if (gameWorld == null) {
|
if (gameWorld == null) {
|
||||||
MessageUtil.sendMessage(sender, DMessages.ERROR_NO_GAME.getMessage());
|
MessageUtil.sendMessage(sender, DMessages.ERROR_NO_GAME.getMessage());
|
||||||
return;
|
return;
|
||||||
|
@ -21,7 +21,7 @@ import io.github.dre2n.commons.util.messageutil.MessageUtil;
|
|||||||
import io.github.dre2n.dungeonsxl.DungeonsXL;
|
import io.github.dre2n.dungeonsxl.DungeonsXL;
|
||||||
import io.github.dre2n.dungeonsxl.config.DMessages;
|
import io.github.dre2n.dungeonsxl.config.DMessages;
|
||||||
import io.github.dre2n.dungeonsxl.player.DPermissions;
|
import io.github.dre2n.dungeonsxl.player.DPermissions;
|
||||||
import io.github.dre2n.dungeonsxl.world.ResourceWorld;
|
import io.github.dre2n.dungeonsxl.world.DResourceWorld;
|
||||||
import org.bukkit.Bukkit;
|
import org.bukkit.Bukkit;
|
||||||
import org.bukkit.OfflinePlayer;
|
import org.bukkit.OfflinePlayer;
|
||||||
import org.bukkit.command.CommandSender;
|
import org.bukkit.command.CommandSender;
|
||||||
@ -45,7 +45,7 @@ public class InviteCommand extends BRCommand {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onExecute(String[] args, CommandSender sender) {
|
public void onExecute(String[] args, CommandSender sender) {
|
||||||
ResourceWorld resource = plugin.getWorlds().getResourceByName(args[2]);
|
DResourceWorld resource = plugin.getDWorlds().getResourceByName(args[2]);
|
||||||
OfflinePlayer player = Bukkit.getOfflinePlayer(args[2]);
|
OfflinePlayer player = Bukkit.getOfflinePlayer(args[2]);
|
||||||
|
|
||||||
if (resource != null) {
|
if (resource != null) {
|
||||||
|
@ -27,7 +27,7 @@ import io.github.dre2n.dungeonsxl.player.DGlobalPlayer;
|
|||||||
import io.github.dre2n.dungeonsxl.player.DGroup;
|
import io.github.dre2n.dungeonsxl.player.DGroup;
|
||||||
import io.github.dre2n.dungeonsxl.player.DInstancePlayer;
|
import io.github.dre2n.dungeonsxl.player.DInstancePlayer;
|
||||||
import io.github.dre2n.dungeonsxl.player.DPermissions;
|
import io.github.dre2n.dungeonsxl.player.DPermissions;
|
||||||
import io.github.dre2n.dungeonsxl.world.GameWorld;
|
import io.github.dre2n.dungeonsxl.world.DGameWorld;
|
||||||
import org.bukkit.command.CommandSender;
|
import org.bukkit.command.CommandSender;
|
||||||
import org.bukkit.entity.Player;
|
import org.bukkit.entity.Player;
|
||||||
|
|
||||||
@ -53,8 +53,8 @@ public class LeaveCommand extends BRCommand {
|
|||||||
|
|
||||||
DGlobalPlayer dPlayer = plugin.getDPlayers().getByPlayer(player);
|
DGlobalPlayer dPlayer = plugin.getDPlayers().getByPlayer(player);
|
||||||
|
|
||||||
if (GameWorld.getByWorld(player.getWorld()) != null) {
|
if (DGameWorld.getByWorld(player.getWorld()) != null) {
|
||||||
if (GameWorld.getByWorld(player.getWorld()).isTutorial()) {
|
if (DGameWorld.getByWorld(player.getWorld()).isTutorial()) {
|
||||||
MessageUtil.sendMessage(player, DMessages.ERROR_NO_LEAVE_IN_TUTORIAL.getMessage());
|
MessageUtil.sendMessage(player, DMessages.ERROR_NO_LEAVE_IN_TUTORIAL.getMessage());
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
@ -24,9 +24,9 @@ import io.github.dre2n.dungeonsxl.config.DMessages;
|
|||||||
import io.github.dre2n.dungeonsxl.config.DungeonConfig;
|
import io.github.dre2n.dungeonsxl.config.DungeonConfig;
|
||||||
import io.github.dre2n.dungeonsxl.dungeon.Dungeon;
|
import io.github.dre2n.dungeonsxl.dungeon.Dungeon;
|
||||||
import io.github.dre2n.dungeonsxl.player.DPermissions;
|
import io.github.dre2n.dungeonsxl.player.DPermissions;
|
||||||
import io.github.dre2n.dungeonsxl.world.EditWorld;
|
import io.github.dre2n.dungeonsxl.world.DEditWorld;
|
||||||
import io.github.dre2n.dungeonsxl.world.GameWorld;
|
import io.github.dre2n.dungeonsxl.world.DGameWorld;
|
||||||
import io.github.dre2n.dungeonsxl.world.Worlds;
|
import io.github.dre2n.dungeonsxl.world.DWorlds;
|
||||||
import java.io.File;
|
import java.io.File;
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import org.bukkit.command.CommandSender;
|
import org.bukkit.command.CommandSender;
|
||||||
@ -38,7 +38,7 @@ import org.bukkit.entity.Player;
|
|||||||
public class ListCommand extends BRCommand {
|
public class ListCommand extends BRCommand {
|
||||||
|
|
||||||
DungeonsXL plugin = DungeonsXL.getInstance();
|
DungeonsXL plugin = DungeonsXL.getInstance();
|
||||||
Worlds worlds = plugin.getWorlds();
|
DWorlds worlds = plugin.getDWorlds();
|
||||||
|
|
||||||
public ListCommand() {
|
public ListCommand() {
|
||||||
setCommand("list");
|
setCommand("list");
|
||||||
@ -63,10 +63,10 @@ public class ListCommand extends BRCommand {
|
|||||||
mapList.add(file.getName());
|
mapList.add(file.getName());
|
||||||
}
|
}
|
||||||
ArrayList<String> loadedList = new ArrayList<>();
|
ArrayList<String> loadedList = new ArrayList<>();
|
||||||
for (EditWorld editWorld : worlds.getEditWorlds()) {
|
for (DEditWorld editWorld : worlds.getEditWorlds()) {
|
||||||
loadedList.add(editWorld.getWorld().getWorldFolder().getName());
|
loadedList.add(editWorld.getWorld().getWorldFolder().getName());
|
||||||
}
|
}
|
||||||
for (GameWorld gameWorld : worlds.getGameWorlds()) {
|
for (DGameWorld gameWorld : worlds.getGameWorlds()) {
|
||||||
loadedList.add(gameWorld.getWorld().getWorldFolder().getName());
|
loadedList.add(gameWorld.getWorld().getWorldFolder().getName());
|
||||||
}
|
}
|
||||||
ArrayList<String> toSend = new ArrayList<>();
|
ArrayList<String> toSend = new ArrayList<>();
|
||||||
|
@ -50,7 +50,7 @@ public class MainCommand extends BRCommand {
|
|||||||
|
|
||||||
int maps = new File(plugin.getDataFolder() + "/maps").listFiles().length;
|
int maps = new File(plugin.getDataFolder() + "/maps").listFiles().length;
|
||||||
int dungeons = new File(plugin.getDataFolder() + "/dungeons").listFiles().length;
|
int dungeons = new File(plugin.getDataFolder() + "/dungeons").listFiles().length;
|
||||||
int loaded = plugin.getWorlds().getEditWorlds().size() + plugin.getWorlds().getGameWorlds().size();
|
int loaded = plugin.getDWorlds().getEditWorlds().size() + plugin.getDWorlds().getGameWorlds().size();
|
||||||
int players = plugin.getDPlayers().getDGamePlayers().size();
|
int players = plugin.getDPlayers().getDGamePlayers().size();
|
||||||
Internals internals = CompatibilityHandler.getInstance().getInternals();
|
Internals internals = CompatibilityHandler.getInstance().getInternals();
|
||||||
String vault = "";
|
String vault = "";
|
||||||
|
@ -23,7 +23,7 @@ import io.github.dre2n.dungeonsxl.DungeonsXL;
|
|||||||
import io.github.dre2n.dungeonsxl.config.DMessages;
|
import io.github.dre2n.dungeonsxl.config.DMessages;
|
||||||
import io.github.dre2n.dungeonsxl.config.WorldConfig;
|
import io.github.dre2n.dungeonsxl.config.WorldConfig;
|
||||||
import io.github.dre2n.dungeonsxl.player.DPermissions;
|
import io.github.dre2n.dungeonsxl.player.DPermissions;
|
||||||
import io.github.dre2n.dungeonsxl.world.EditWorld;
|
import io.github.dre2n.dungeonsxl.world.DEditWorld;
|
||||||
import org.bukkit.ChatColor;
|
import org.bukkit.ChatColor;
|
||||||
import org.bukkit.command.CommandSender;
|
import org.bukkit.command.CommandSender;
|
||||||
import org.bukkit.entity.Player;
|
import org.bukkit.entity.Player;
|
||||||
@ -47,7 +47,7 @@ public class MsgCommand extends BRCommand {
|
|||||||
@Override
|
@Override
|
||||||
public void onExecute(String[] args, CommandSender sender) {
|
public void onExecute(String[] args, CommandSender sender) {
|
||||||
Player player = (Player) sender;
|
Player player = (Player) sender;
|
||||||
EditWorld editWorld = EditWorld.getByWorld(player.getWorld());
|
DEditWorld editWorld = DEditWorld.getByWorld(player.getWorld());
|
||||||
|
|
||||||
if (editWorld == null) {
|
if (editWorld == null) {
|
||||||
MessageUtil.sendMessage(player, DMessages.ERROR_NOT_IN_DUNGEON.getMessage());
|
MessageUtil.sendMessage(player, DMessages.ERROR_NOT_IN_DUNGEON.getMessage());
|
||||||
|
@ -83,7 +83,7 @@ public class PlayCommand extends BRCommand {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!multiFloor && !plugin.getWorlds().exists(identifier)) {
|
if (!multiFloor && !plugin.getDWorlds().exists(identifier)) {
|
||||||
MessageUtil.sendMessage(player, DMessages.ERROR_DUNGEON_NOT_EXIST.getMessage(identifier));
|
MessageUtil.sendMessage(player, DMessages.ERROR_DUNGEON_NOT_EXIST.getMessage(identifier));
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
@ -51,7 +51,7 @@ public class ReloadCommand extends BRCommand {
|
|||||||
|
|
||||||
int maps = new File(plugin.getDataFolder() + "/maps").listFiles().length;
|
int maps = new File(plugin.getDataFolder() + "/maps").listFiles().length;
|
||||||
int dungeons = new File(plugin.getDataFolder() + "/dungeons").listFiles().length;
|
int dungeons = new File(plugin.getDataFolder() + "/dungeons").listFiles().length;
|
||||||
int loaded = plugin.getWorlds().getEditWorlds().size() + plugin.getWorlds().getGameWorlds().size();
|
int loaded = plugin.getDWorlds().getEditWorlds().size() + plugin.getDWorlds().getGameWorlds().size();
|
||||||
int players = plugin.getDPlayers().getDGamePlayers().size();
|
int players = plugin.getDPlayers().getDGamePlayers().size();
|
||||||
Internals internals = CompatibilityHandler.getInstance().getInternals();
|
Internals internals = CompatibilityHandler.getInstance().getInternals();
|
||||||
String vault = "";
|
String vault = "";
|
||||||
|
@ -21,7 +21,7 @@ import io.github.dre2n.commons.util.messageutil.MessageUtil;
|
|||||||
import io.github.dre2n.dungeonsxl.DungeonsXL;
|
import io.github.dre2n.dungeonsxl.DungeonsXL;
|
||||||
import io.github.dre2n.dungeonsxl.config.DMessages;
|
import io.github.dre2n.dungeonsxl.config.DMessages;
|
||||||
import io.github.dre2n.dungeonsxl.player.DPermissions;
|
import io.github.dre2n.dungeonsxl.player.DPermissions;
|
||||||
import io.github.dre2n.dungeonsxl.world.EditWorld;
|
import io.github.dre2n.dungeonsxl.world.DEditWorld;
|
||||||
import org.bukkit.command.CommandSender;
|
import org.bukkit.command.CommandSender;
|
||||||
import org.bukkit.entity.Player;
|
import org.bukkit.entity.Player;
|
||||||
|
|
||||||
@ -44,7 +44,7 @@ public class SaveCommand extends BRCommand {
|
|||||||
@Override
|
@Override
|
||||||
public void onExecute(String[] args, CommandSender sender) {
|
public void onExecute(String[] args, CommandSender sender) {
|
||||||
Player player = (Player) sender;
|
Player player = (Player) sender;
|
||||||
EditWorld editWorld = EditWorld.getByWorld(player.getWorld());
|
DEditWorld editWorld = DEditWorld.getByWorld(player.getWorld());
|
||||||
if (editWorld != null) {
|
if (editWorld != null) {
|
||||||
editWorld.save();
|
editWorld.save();
|
||||||
MessageUtil.sendMessage(player, DMessages.CMD_SAVE_SUCCESS.getMessage());
|
MessageUtil.sendMessage(player, DMessages.CMD_SAVE_SUCCESS.getMessage());
|
||||||
|
@ -25,7 +25,7 @@ import io.github.dre2n.dungeonsxl.game.GameTypeDefault;
|
|||||||
import io.github.dre2n.dungeonsxl.player.DGamePlayer;
|
import io.github.dre2n.dungeonsxl.player.DGamePlayer;
|
||||||
import io.github.dre2n.dungeonsxl.player.DGroup;
|
import io.github.dre2n.dungeonsxl.player.DGroup;
|
||||||
import io.github.dre2n.dungeonsxl.player.DPermissions;
|
import io.github.dre2n.dungeonsxl.player.DPermissions;
|
||||||
import io.github.dre2n.dungeonsxl.world.GameWorld;
|
import io.github.dre2n.dungeonsxl.world.DGameWorld;
|
||||||
import org.bukkit.command.CommandSender;
|
import org.bukkit.command.CommandSender;
|
||||||
import org.bukkit.entity.Player;
|
import org.bukkit.entity.Player;
|
||||||
|
|
||||||
@ -60,7 +60,7 @@ public class TestCommand extends BRCommand {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
GameWorld gameWorld = dGroup.getGameWorld();
|
DGameWorld gameWorld = dGroup.getGameWorld();
|
||||||
if (gameWorld == null) {
|
if (gameWorld == null) {
|
||||||
MessageUtil.sendMessage(sender, DMessages.ERROR_NOT_IN_DUNGEON.getMessage());
|
MessageUtil.sendMessage(sender, DMessages.ERROR_NOT_IN_DUNGEON.getMessage());
|
||||||
return;
|
return;
|
||||||
|
@ -21,7 +21,7 @@ import io.github.dre2n.commons.util.messageutil.MessageUtil;
|
|||||||
import io.github.dre2n.dungeonsxl.DungeonsXL;
|
import io.github.dre2n.dungeonsxl.DungeonsXL;
|
||||||
import io.github.dre2n.dungeonsxl.config.DMessages;
|
import io.github.dre2n.dungeonsxl.config.DMessages;
|
||||||
import io.github.dre2n.dungeonsxl.player.DPermissions;
|
import io.github.dre2n.dungeonsxl.player.DPermissions;
|
||||||
import io.github.dre2n.dungeonsxl.world.ResourceWorld;
|
import io.github.dre2n.dungeonsxl.world.DResourceWorld;
|
||||||
import org.bukkit.Bukkit;
|
import org.bukkit.Bukkit;
|
||||||
import org.bukkit.OfflinePlayer;
|
import org.bukkit.OfflinePlayer;
|
||||||
import org.bukkit.command.CommandSender;
|
import org.bukkit.command.CommandSender;
|
||||||
@ -45,7 +45,7 @@ public class UninviteCommand extends BRCommand {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onExecute(String[] args, CommandSender sender) {
|
public void onExecute(String[] args, CommandSender sender) {
|
||||||
ResourceWorld resource = plugin.getWorlds().getResourceByName(args[2]);
|
DResourceWorld resource = plugin.getDWorlds().getResourceByName(args[2]);
|
||||||
if (resource == null) {
|
if (resource == null) {
|
||||||
MessageUtil.sendMessage(sender, DMessages.ERROR_DUNGEON_NOT_EXIST.getMessage(args[2]));
|
MessageUtil.sendMessage(sender, DMessages.ERROR_DUNGEON_NOT_EXIST.getMessage(args[2]));
|
||||||
}
|
}
|
||||||
|
@ -18,8 +18,8 @@ package io.github.dre2n.dungeonsxl.config;
|
|||||||
|
|
||||||
import io.github.dre2n.commons.config.BRConfig;
|
import io.github.dre2n.commons.config.BRConfig;
|
||||||
import io.github.dre2n.dungeonsxl.DungeonsXL;
|
import io.github.dre2n.dungeonsxl.DungeonsXL;
|
||||||
import io.github.dre2n.dungeonsxl.world.ResourceWorld;
|
import io.github.dre2n.dungeonsxl.world.DResourceWorld;
|
||||||
import io.github.dre2n.dungeonsxl.world.Worlds;
|
import io.github.dre2n.dungeonsxl.world.DWorlds;
|
||||||
import java.io.File;
|
import java.io.File;
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
@ -29,13 +29,13 @@ import java.util.List;
|
|||||||
*/
|
*/
|
||||||
public class DungeonConfig extends BRConfig {
|
public class DungeonConfig extends BRConfig {
|
||||||
|
|
||||||
Worlds worlds = DungeonsXL.getInstance().getWorlds();
|
DWorlds worlds = DungeonsXL.getInstance().getDWorlds();
|
||||||
|
|
||||||
public static final int CONFIG_VERSION = 1;
|
public static final int CONFIG_VERSION = 1;
|
||||||
|
|
||||||
private ResourceWorld startFloor;
|
private DResourceWorld startFloor;
|
||||||
private ResourceWorld endFloor;
|
private DResourceWorld endFloor;
|
||||||
private List<ResourceWorld> floors = new ArrayList<>();
|
private List<DResourceWorld> floors = new ArrayList<>();
|
||||||
private int floorCount;
|
private int floorCount;
|
||||||
private boolean removeWhenPlayed;
|
private boolean removeWhenPlayed;
|
||||||
private WorldConfig overrideValues;
|
private WorldConfig overrideValues;
|
||||||
@ -53,7 +53,7 @@ public class DungeonConfig extends BRConfig {
|
|||||||
/**
|
/**
|
||||||
* @return the startFloor
|
* @return the startFloor
|
||||||
*/
|
*/
|
||||||
public ResourceWorld getStartFloor() {
|
public DResourceWorld getStartFloor() {
|
||||||
return startFloor;
|
return startFloor;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -61,14 +61,14 @@ public class DungeonConfig extends BRConfig {
|
|||||||
* @param startFloor
|
* @param startFloor
|
||||||
* the startFloor to set
|
* the startFloor to set
|
||||||
*/
|
*/
|
||||||
public void setStartFloor(ResourceWorld startFloor) {
|
public void setStartFloor(DResourceWorld startFloor) {
|
||||||
this.startFloor = startFloor;
|
this.startFloor = startFloor;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @return the endFloor
|
* @return the endFloor
|
||||||
*/
|
*/
|
||||||
public ResourceWorld getEndFloor() {
|
public DResourceWorld getEndFloor() {
|
||||||
return endFloor;
|
return endFloor;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -76,14 +76,14 @@ public class DungeonConfig extends BRConfig {
|
|||||||
* @param endFloor
|
* @param endFloor
|
||||||
* the endFloor to set
|
* the endFloor to set
|
||||||
*/
|
*/
|
||||||
public void setEndFloor(ResourceWorld endFloor) {
|
public void setEndFloor(DResourceWorld endFloor) {
|
||||||
this.endFloor = endFloor;
|
this.endFloor = endFloor;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @return the floors
|
* @return the floors
|
||||||
*/
|
*/
|
||||||
public List<ResourceWorld> getFloors() {
|
public List<DResourceWorld> getFloors() {
|
||||||
return floors;
|
return floors;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -91,7 +91,7 @@ public class DungeonConfig extends BRConfig {
|
|||||||
* @param resource
|
* @param resource
|
||||||
* the resource to add
|
* the resource to add
|
||||||
*/
|
*/
|
||||||
public void addFloor(ResourceWorld resource) {
|
public void addFloor(DResourceWorld resource) {
|
||||||
floors.add(resource);
|
floors.add(resource);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -99,7 +99,7 @@ public class DungeonConfig extends BRConfig {
|
|||||||
* @param resource
|
* @param resource
|
||||||
* the resource to remove
|
* the resource to remove
|
||||||
*/
|
*/
|
||||||
public void removeFloor(ResourceWorld resource) {
|
public void removeFloor(DResourceWorld resource) {
|
||||||
floors.remove(resource);
|
floors.remove(resource);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -172,10 +172,10 @@ public class DungeonConfig extends BRConfig {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* @param resource
|
* @param resource
|
||||||
* the ResourceWorld to check
|
* the DResourceWorld to check
|
||||||
* @return true if the floor is either in the list or the start / end floor.
|
* @return true if the floor is either in the list or the start / end floor.
|
||||||
*/
|
*/
|
||||||
public boolean containsFloor(ResourceWorld resource) {
|
public boolean containsFloor(DResourceWorld resource) {
|
||||||
return floors.contains(resource) || startFloor.equals(resource) || endFloor.equals(resource);
|
return floors.contains(resource) || startFloor.equals(resource) || endFloor.equals(resource);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -225,7 +225,7 @@ public class DungeonConfig extends BRConfig {
|
|||||||
public void load() {
|
public void load() {
|
||||||
if (config.contains("floors")) {
|
if (config.contains("floors")) {
|
||||||
for (String floor : config.getStringList("floors")) {
|
for (String floor : config.getStringList("floors")) {
|
||||||
ResourceWorld resource = worlds.getResourceByName(floor);
|
DResourceWorld resource = worlds.getResourceByName(floor);
|
||||||
if (resource != null) {
|
if (resource != null) {
|
||||||
floors.add(resource);
|
floors.add(resource);
|
||||||
}
|
}
|
||||||
|
@ -17,8 +17,8 @@
|
|||||||
package io.github.dre2n.dungeonsxl.config;
|
package io.github.dre2n.dungeonsxl.config;
|
||||||
|
|
||||||
import io.github.dre2n.dungeonsxl.sign.DSign;
|
import io.github.dre2n.dungeonsxl.sign.DSign;
|
||||||
import io.github.dre2n.dungeonsxl.world.EditWorld;
|
import io.github.dre2n.dungeonsxl.world.DEditWorld;
|
||||||
import io.github.dre2n.dungeonsxl.world.GameWorld;
|
import io.github.dre2n.dungeonsxl.world.DGameWorld;
|
||||||
import java.io.File;
|
import java.io.File;
|
||||||
import java.io.FileInputStream;
|
import java.io.FileInputStream;
|
||||||
import java.io.FileOutputStream;
|
import java.io.FileOutputStream;
|
||||||
@ -50,14 +50,14 @@ public class SignData {
|
|||||||
|
|
||||||
/* Actions */
|
/* Actions */
|
||||||
/**
|
/**
|
||||||
* Applies all signs from the file to the EditWorld.
|
* Applies all signs from the file to the DEditWorld.
|
||||||
* Also sets the lobby location of the EditWorld to the location of the lobby sign if one exists.
|
* Also sets the lobby location of the DEditWorld to the location of the lobby sign if one exists.
|
||||||
*
|
*
|
||||||
* @param editWorld
|
* @param editWorld
|
||||||
* the EditWorld where the signs are
|
* the DEditWorld where the signs are
|
||||||
* @throws IOException
|
* @throws IOException
|
||||||
*/
|
*/
|
||||||
public void deserializeSigns(EditWorld editWorld) throws IOException {
|
public void deserializeSigns(DEditWorld editWorld) throws IOException {
|
||||||
ObjectInputStream os = new ObjectInputStream(new FileInputStream(file));
|
ObjectInputStream os = new ObjectInputStream(new FileInputStream(file));
|
||||||
int length = os.readInt();
|
int length = os.readInt();
|
||||||
|
|
||||||
@ -81,14 +81,14 @@ public class SignData {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Applies all signs from the file to the GameWorld.
|
* Applies all signs from the file to the DGameWorld.
|
||||||
*
|
*
|
||||||
* @param gameWorld
|
* @param gameWorld
|
||||||
* the GameWorld where the signs are
|
* the DGameWorld where the signs are
|
||||||
* @return a Set of all DSign blocks
|
* @return a Set of all DSign blocks
|
||||||
* @throws IOException
|
* @throws IOException
|
||||||
*/
|
*/
|
||||||
public void deserializeSigns(GameWorld gameWorld) throws IOException {
|
public void deserializeSigns(DGameWorld gameWorld) throws IOException {
|
||||||
ObjectInputStream os = new ObjectInputStream(new FileInputStream(file));
|
ObjectInputStream os = new ObjectInputStream(new FileInputStream(file));
|
||||||
|
|
||||||
int length = os.readInt();
|
int length = os.readInt();
|
||||||
@ -108,13 +108,13 @@ public class SignData {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Applies all signs from the EditWorld to the file.
|
* Applies all signs from the DEditWorld to the file.
|
||||||
*
|
*
|
||||||
* @param editWorld
|
* @param editWorld
|
||||||
* the EditWorld that contains the signs to serialize
|
* the DEditWorld that contains the signs to serialize
|
||||||
* @throws IOException
|
* @throws IOException
|
||||||
*/
|
*/
|
||||||
public void serializeSigns(EditWorld editWorld) throws IOException {
|
public void serializeSigns(DEditWorld editWorld) throws IOException {
|
||||||
serializeSigns(editWorld.getSigns());
|
serializeSigns(editWorld.getSigns());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -17,7 +17,7 @@
|
|||||||
package io.github.dre2n.dungeonsxl.event.dgroup;
|
package io.github.dre2n.dungeonsxl.event.dgroup;
|
||||||
|
|
||||||
import io.github.dre2n.dungeonsxl.player.DGroup;
|
import io.github.dre2n.dungeonsxl.player.DGroup;
|
||||||
import io.github.dre2n.dungeonsxl.world.GameWorld;
|
import io.github.dre2n.dungeonsxl.world.DGameWorld;
|
||||||
import org.bukkit.event.Cancellable;
|
import org.bukkit.event.Cancellable;
|
||||||
import org.bukkit.event.HandlerList;
|
import org.bukkit.event.HandlerList;
|
||||||
|
|
||||||
@ -29,10 +29,10 @@ public class DGroupFinishFloorEvent extends DGroupEvent implements Cancellable {
|
|||||||
private static final HandlerList handlers = new HandlerList();
|
private static final HandlerList handlers = new HandlerList();
|
||||||
private boolean cancelled;
|
private boolean cancelled;
|
||||||
|
|
||||||
private GameWorld finished;
|
private DGameWorld finished;
|
||||||
private String next;
|
private String next;
|
||||||
|
|
||||||
public DGroupFinishFloorEvent(DGroup dGroup, GameWorld finished, String next) {
|
public DGroupFinishFloorEvent(DGroup dGroup, DGameWorld finished, String next) {
|
||||||
super(dGroup);
|
super(dGroup);
|
||||||
this.finished = finished;
|
this.finished = finished;
|
||||||
this.next = next;
|
this.next = next;
|
||||||
@ -41,15 +41,15 @@ public class DGroupFinishFloorEvent extends DGroupEvent implements Cancellable {
|
|||||||
/**
|
/**
|
||||||
* @return the finished
|
* @return the finished
|
||||||
*/
|
*/
|
||||||
public GameWorld getFinished() {
|
public DGameWorld getFinished() {
|
||||||
return finished;
|
return finished;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param finished
|
* @param finished
|
||||||
* the name of the GameWorld to set
|
* the name of the DGameWorld to set
|
||||||
*/
|
*/
|
||||||
public void setFinished(GameWorld finished) {
|
public void setFinished(DGameWorld finished) {
|
||||||
this.finished = finished;
|
this.finished = finished;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -62,7 +62,7 @@ public class DGroupFinishFloorEvent extends DGroupEvent implements Cancellable {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* @param next
|
* @param next
|
||||||
* the name of the GameWorld to set
|
* the name of the DGameWorld to set
|
||||||
*/
|
*/
|
||||||
public void setNext(String next) {
|
public void setNext(String next) {
|
||||||
this.next = next;
|
this.next = next;
|
||||||
|
@ -17,7 +17,7 @@
|
|||||||
package io.github.dre2n.dungeonsxl.event.dgroup;
|
package io.github.dre2n.dungeonsxl.event.dgroup;
|
||||||
|
|
||||||
import io.github.dre2n.dungeonsxl.player.DGroup;
|
import io.github.dre2n.dungeonsxl.player.DGroup;
|
||||||
import io.github.dre2n.dungeonsxl.world.GameWorld;
|
import io.github.dre2n.dungeonsxl.world.DGameWorld;
|
||||||
import org.bukkit.event.Cancellable;
|
import org.bukkit.event.Cancellable;
|
||||||
import org.bukkit.event.HandlerList;
|
import org.bukkit.event.HandlerList;
|
||||||
|
|
||||||
@ -29,9 +29,9 @@ public class DGroupStartFloorEvent extends DGroupEvent implements Cancellable {
|
|||||||
private static final HandlerList handlers = new HandlerList();
|
private static final HandlerList handlers = new HandlerList();
|
||||||
private boolean cancelled;
|
private boolean cancelled;
|
||||||
|
|
||||||
private GameWorld gameWorld;
|
private DGameWorld gameWorld;
|
||||||
|
|
||||||
public DGroupStartFloorEvent(DGroup dGroup, GameWorld gameWorld) {
|
public DGroupStartFloorEvent(DGroup dGroup, DGameWorld gameWorld) {
|
||||||
super(dGroup);
|
super(dGroup);
|
||||||
this.gameWorld = gameWorld;
|
this.gameWorld = gameWorld;
|
||||||
}
|
}
|
||||||
@ -39,7 +39,7 @@ public class DGroupStartFloorEvent extends DGroupEvent implements Cancellable {
|
|||||||
/**
|
/**
|
||||||
* @return the gameWorld
|
* @return the gameWorld
|
||||||
*/
|
*/
|
||||||
public GameWorld getGameWorld() {
|
public DGameWorld getGameWorld() {
|
||||||
return gameWorld;
|
return gameWorld;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -47,7 +47,7 @@ public class DGroupStartFloorEvent extends DGroupEvent implements Cancellable {
|
|||||||
* @param gameWorld
|
* @param gameWorld
|
||||||
* the gameWorld to set
|
* the gameWorld to set
|
||||||
*/
|
*/
|
||||||
public void setGameWorld(GameWorld gameWorld) {
|
public void setGameWorld(DGameWorld gameWorld) {
|
||||||
this.gameWorld = gameWorld;
|
this.gameWorld = gameWorld;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -17,7 +17,7 @@
|
|||||||
package io.github.dre2n.dungeonsxl.event.dsign;
|
package io.github.dre2n.dungeonsxl.event.dsign;
|
||||||
|
|
||||||
import io.github.dre2n.dungeonsxl.sign.DSign;
|
import io.github.dre2n.dungeonsxl.sign.DSign;
|
||||||
import io.github.dre2n.dungeonsxl.world.GameWorld;
|
import io.github.dre2n.dungeonsxl.world.DGameWorld;
|
||||||
import org.bukkit.block.Sign;
|
import org.bukkit.block.Sign;
|
||||||
import org.bukkit.event.Cancellable;
|
import org.bukkit.event.Cancellable;
|
||||||
import org.bukkit.event.HandlerList;
|
import org.bukkit.event.HandlerList;
|
||||||
@ -31,9 +31,9 @@ public class DSignRegistrationEvent extends DSignEvent implements Cancellable {
|
|||||||
private boolean cancelled;
|
private boolean cancelled;
|
||||||
|
|
||||||
private Sign sign;
|
private Sign sign;
|
||||||
private GameWorld gameWorld;
|
private DGameWorld gameWorld;
|
||||||
|
|
||||||
public DSignRegistrationEvent(Sign sign, GameWorld gameWorld, DSign dSign) {
|
public DSignRegistrationEvent(Sign sign, DGameWorld gameWorld, DSign dSign) {
|
||||||
super(dSign);
|
super(dSign);
|
||||||
this.sign = sign;
|
this.sign = sign;
|
||||||
this.gameWorld = gameWorld;
|
this.gameWorld = gameWorld;
|
||||||
@ -57,7 +57,7 @@ public class DSignRegistrationEvent extends DSignEvent implements Cancellable {
|
|||||||
/**
|
/**
|
||||||
* @return the gameWorld
|
* @return the gameWorld
|
||||||
*/
|
*/
|
||||||
public GameWorld getGameWorld() {
|
public DGameWorld getGameWorld() {
|
||||||
return gameWorld;
|
return gameWorld;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -65,7 +65,7 @@ public class DSignRegistrationEvent extends DSignEvent implements Cancellable {
|
|||||||
* @param gameWorld
|
* @param gameWorld
|
||||||
* the gameWorld to set
|
* the gameWorld to set
|
||||||
*/
|
*/
|
||||||
public void setGameWorld(GameWorld gameWorld) {
|
public void setGameWorld(DGameWorld gameWorld) {
|
||||||
this.gameWorld = gameWorld;
|
this.gameWorld = gameWorld;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -16,7 +16,7 @@
|
|||||||
*/
|
*/
|
||||||
package io.github.dre2n.dungeonsxl.event.editworld;
|
package io.github.dre2n.dungeonsxl.event.editworld;
|
||||||
|
|
||||||
import io.github.dre2n.dungeonsxl.world.EditWorld;
|
import io.github.dre2n.dungeonsxl.world.DEditWorld;
|
||||||
import org.bukkit.event.Event;
|
import org.bukkit.event.Event;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -24,16 +24,16 @@ import org.bukkit.event.Event;
|
|||||||
*/
|
*/
|
||||||
public abstract class EditWorldEvent extends Event {
|
public abstract class EditWorldEvent extends Event {
|
||||||
|
|
||||||
protected EditWorld editWorld;
|
protected DEditWorld editWorld;
|
||||||
|
|
||||||
public EditWorldEvent(EditWorld editWorld) {
|
public EditWorldEvent(DEditWorld editWorld) {
|
||||||
this.editWorld = editWorld;
|
this.editWorld = editWorld;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @return the editWorld
|
* @return the editWorld
|
||||||
*/
|
*/
|
||||||
public EditWorld getEditWorld() {
|
public DEditWorld getEditWorld() {
|
||||||
return editWorld;
|
return editWorld;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -41,7 +41,7 @@ public abstract class EditWorldEvent extends Event {
|
|||||||
* @param editWorld
|
* @param editWorld
|
||||||
* the editWorld to set
|
* the editWorld to set
|
||||||
*/
|
*/
|
||||||
public void setEditWorld(EditWorld editWorld) {
|
public void setEditWorld(DEditWorld editWorld) {
|
||||||
this.editWorld = editWorld;
|
this.editWorld = editWorld;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -16,7 +16,7 @@
|
|||||||
*/
|
*/
|
||||||
package io.github.dre2n.dungeonsxl.event.editworld;
|
package io.github.dre2n.dungeonsxl.event.editworld;
|
||||||
|
|
||||||
import io.github.dre2n.dungeonsxl.world.EditWorld;
|
import io.github.dre2n.dungeonsxl.world.DEditWorld;
|
||||||
import org.bukkit.event.Cancellable;
|
import org.bukkit.event.Cancellable;
|
||||||
import org.bukkit.event.HandlerList;
|
import org.bukkit.event.HandlerList;
|
||||||
|
|
||||||
@ -28,7 +28,7 @@ public class EditWorldGenerateEvent extends EditWorldEvent implements Cancellabl
|
|||||||
private static final HandlerList handlers = new HandlerList();
|
private static final HandlerList handlers = new HandlerList();
|
||||||
private boolean cancelled;
|
private boolean cancelled;
|
||||||
|
|
||||||
public EditWorldGenerateEvent(EditWorld editWorld) {
|
public EditWorldGenerateEvent(DEditWorld editWorld) {
|
||||||
super(editWorld);
|
super(editWorld);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -16,7 +16,7 @@
|
|||||||
*/
|
*/
|
||||||
package io.github.dre2n.dungeonsxl.event.editworld;
|
package io.github.dre2n.dungeonsxl.event.editworld;
|
||||||
|
|
||||||
import io.github.dre2n.dungeonsxl.world.EditWorld;
|
import io.github.dre2n.dungeonsxl.world.DEditWorld;
|
||||||
import org.bukkit.event.Cancellable;
|
import org.bukkit.event.Cancellable;
|
||||||
import org.bukkit.event.HandlerList;
|
import org.bukkit.event.HandlerList;
|
||||||
|
|
||||||
@ -28,7 +28,7 @@ public class EditWorldSaveEvent extends EditWorldEvent implements Cancellable {
|
|||||||
private static final HandlerList handlers = new HandlerList();
|
private static final HandlerList handlers = new HandlerList();
|
||||||
private boolean cancelled;
|
private boolean cancelled;
|
||||||
|
|
||||||
public EditWorldSaveEvent(EditWorld editWorld) {
|
public EditWorldSaveEvent(DEditWorld editWorld) {
|
||||||
super(editWorld);
|
super(editWorld);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -16,7 +16,7 @@
|
|||||||
*/
|
*/
|
||||||
package io.github.dre2n.dungeonsxl.event.editworld;
|
package io.github.dre2n.dungeonsxl.event.editworld;
|
||||||
|
|
||||||
import io.github.dre2n.dungeonsxl.world.EditWorld;
|
import io.github.dre2n.dungeonsxl.world.DEditWorld;
|
||||||
import org.bukkit.event.Cancellable;
|
import org.bukkit.event.Cancellable;
|
||||||
import org.bukkit.event.HandlerList;
|
import org.bukkit.event.HandlerList;
|
||||||
|
|
||||||
@ -30,7 +30,7 @@ public class EditWorldUnloadEvent extends EditWorldEvent implements Cancellable
|
|||||||
|
|
||||||
private boolean save;
|
private boolean save;
|
||||||
|
|
||||||
public EditWorldUnloadEvent(EditWorld editWorld, boolean save) {
|
public EditWorldUnloadEvent(DEditWorld editWorld, boolean save) {
|
||||||
super(editWorld);
|
super(editWorld);
|
||||||
this.save = save;
|
this.save = save;
|
||||||
}
|
}
|
||||||
|
@ -16,7 +16,7 @@
|
|||||||
*/
|
*/
|
||||||
package io.github.dre2n.dungeonsxl.event.gameworld;
|
package io.github.dre2n.dungeonsxl.event.gameworld;
|
||||||
|
|
||||||
import io.github.dre2n.dungeonsxl.world.GameWorld;
|
import io.github.dre2n.dungeonsxl.world.DGameWorld;
|
||||||
import org.bukkit.event.Event;
|
import org.bukkit.event.Event;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -24,16 +24,16 @@ import org.bukkit.event.Event;
|
|||||||
*/
|
*/
|
||||||
public abstract class GameWorldEvent extends Event {
|
public abstract class GameWorldEvent extends Event {
|
||||||
|
|
||||||
protected GameWorld gameWorld;
|
protected DGameWorld gameWorld;
|
||||||
|
|
||||||
public GameWorldEvent(GameWorld gameWorld) {
|
public GameWorldEvent(DGameWorld gameWorld) {
|
||||||
this.gameWorld = gameWorld;
|
this.gameWorld = gameWorld;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @return the gameWorld
|
* @return the gameWorld
|
||||||
*/
|
*/
|
||||||
public GameWorld getGameWorld() {
|
public DGameWorld getGameWorld() {
|
||||||
return gameWorld;
|
return gameWorld;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -41,7 +41,7 @@ public abstract class GameWorldEvent extends Event {
|
|||||||
* @param gameWorld
|
* @param gameWorld
|
||||||
* the gameWorld to set
|
* the gameWorld to set
|
||||||
*/
|
*/
|
||||||
public void setGameWorld(GameWorld gameWorld) {
|
public void setGameWorld(DGameWorld gameWorld) {
|
||||||
this.gameWorld = gameWorld;
|
this.gameWorld = gameWorld;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -17,7 +17,7 @@
|
|||||||
package io.github.dre2n.dungeonsxl.event.gameworld;
|
package io.github.dre2n.dungeonsxl.event.gameworld;
|
||||||
|
|
||||||
import io.github.dre2n.dungeonsxl.game.Game;
|
import io.github.dre2n.dungeonsxl.game.Game;
|
||||||
import io.github.dre2n.dungeonsxl.world.GameWorld;
|
import io.github.dre2n.dungeonsxl.world.DGameWorld;
|
||||||
import org.bukkit.event.Cancellable;
|
import org.bukkit.event.Cancellable;
|
||||||
import org.bukkit.event.HandlerList;
|
import org.bukkit.event.HandlerList;
|
||||||
|
|
||||||
@ -31,7 +31,7 @@ public class GameWorldStartGameEvent extends GameWorldEvent implements Cancellab
|
|||||||
|
|
||||||
private Game game;
|
private Game game;
|
||||||
|
|
||||||
public GameWorldStartGameEvent(GameWorld gameWorld, Game game) {
|
public GameWorldStartGameEvent(DGameWorld gameWorld, Game game) {
|
||||||
super(gameWorld);
|
super(gameWorld);
|
||||||
this.game = game;
|
this.game = game;
|
||||||
}
|
}
|
||||||
|
@ -16,7 +16,7 @@
|
|||||||
*/
|
*/
|
||||||
package io.github.dre2n.dungeonsxl.event.gameworld;
|
package io.github.dre2n.dungeonsxl.event.gameworld;
|
||||||
|
|
||||||
import io.github.dre2n.dungeonsxl.world.GameWorld;
|
import io.github.dre2n.dungeonsxl.world.DGameWorld;
|
||||||
import org.bukkit.event.Cancellable;
|
import org.bukkit.event.Cancellable;
|
||||||
import org.bukkit.event.HandlerList;
|
import org.bukkit.event.HandlerList;
|
||||||
|
|
||||||
@ -29,7 +29,7 @@ public class GameWorldUnloadEvent extends GameWorldEvent implements Cancellable
|
|||||||
|
|
||||||
private boolean cancelled;
|
private boolean cancelled;
|
||||||
|
|
||||||
public GameWorldUnloadEvent(GameWorld gameWorld) {
|
public GameWorldUnloadEvent(DGameWorld gameWorld) {
|
||||||
super(gameWorld);
|
super(gameWorld);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -27,8 +27,8 @@ import io.github.dre2n.dungeonsxl.player.DGroup;
|
|||||||
import io.github.dre2n.dungeonsxl.sign.DSign;
|
import io.github.dre2n.dungeonsxl.sign.DSign;
|
||||||
import io.github.dre2n.dungeonsxl.sign.MobSign;
|
import io.github.dre2n.dungeonsxl.sign.MobSign;
|
||||||
import io.github.dre2n.dungeonsxl.trigger.ProgressTrigger;
|
import io.github.dre2n.dungeonsxl.trigger.ProgressTrigger;
|
||||||
import io.github.dre2n.dungeonsxl.world.GameWorld;
|
import io.github.dre2n.dungeonsxl.world.DGameWorld;
|
||||||
import io.github.dre2n.dungeonsxl.world.ResourceWorld;
|
import io.github.dre2n.dungeonsxl.world.DResourceWorld;
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.Arrays;
|
import java.util.Arrays;
|
||||||
import java.util.HashMap;
|
import java.util.HashMap;
|
||||||
@ -50,7 +50,7 @@ public class Game {
|
|||||||
private List<DGroup> dGroups = new ArrayList<>();
|
private List<DGroup> dGroups = new ArrayList<>();
|
||||||
private boolean started;
|
private boolean started;
|
||||||
private GameType type = GameTypeDefault.DEFAULT;
|
private GameType type = GameTypeDefault.DEFAULT;
|
||||||
private GameWorld world;
|
private DGameWorld world;
|
||||||
private GameRules rules;
|
private GameRules rules;
|
||||||
private int waveCount;
|
private int waveCount;
|
||||||
private Map<String, Integer> gameKills = new HashMap<>();
|
private Map<String, Integer> gameKills = new HashMap<>();
|
||||||
@ -64,7 +64,7 @@ public class Game {
|
|||||||
plugin.getGames().add(this);
|
plugin.getGames().add(this);
|
||||||
}
|
}
|
||||||
|
|
||||||
public Game(DGroup dGroup, GameWorld world) {
|
public Game(DGroup dGroup, DGameWorld world) {
|
||||||
dGroups.add(dGroup);
|
dGroups.add(dGroup);
|
||||||
started = false;
|
started = false;
|
||||||
this.world = world;
|
this.world = world;
|
||||||
@ -78,18 +78,18 @@ public class Game {
|
|||||||
|
|
||||||
dGroups.add(dGroup);
|
dGroups.add(dGroup);
|
||||||
started = false;
|
started = false;
|
||||||
// TO DO world = new GameWorld();
|
// TO DO world = new DGameWorld();
|
||||||
ResourceWorld resource = plugin.getWorlds().getResourceByName(worldName);
|
DResourceWorld resource = plugin.getDWorlds().getResourceByName(worldName);
|
||||||
dGroup.setGameWorld(world);
|
dGroup.setGameWorld(world);
|
||||||
resource.instantiateAsGameWorld();
|
resource.instantiateAsGameWorld();
|
||||||
fetchRules();
|
fetchRules();
|
||||||
}
|
}
|
||||||
|
|
||||||
public Game(DGroup dGroup, GameType type, GameWorld world) {
|
public Game(DGroup dGroup, GameType type, DGameWorld world) {
|
||||||
this(new ArrayList<>(Arrays.asList(dGroup)), type, world);
|
this(new ArrayList<>(Arrays.asList(dGroup)), type, world);
|
||||||
}
|
}
|
||||||
|
|
||||||
public Game(List<DGroup> dGroups, GameType type, GameWorld world) {
|
public Game(List<DGroup> dGroups, GameType type, DGameWorld world) {
|
||||||
this.dGroups = dGroups;
|
this.dGroups = dGroups;
|
||||||
this.type = type;
|
this.type = type;
|
||||||
this.world = world;
|
this.world = world;
|
||||||
@ -157,17 +157,17 @@ public class Game {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @return the GameWorld connected to the Game
|
* @return the DGameWorld connected to the Game
|
||||||
*/
|
*/
|
||||||
public GameWorld getWorld() {
|
public DGameWorld getWorld() {
|
||||||
return world;
|
return world;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param world
|
* @param world
|
||||||
* the GameWorld to connect to the Game
|
* the DGameWorld to connect to the Game
|
||||||
*/
|
*/
|
||||||
public void setWorld(GameWorld world) {
|
public void setWorld(DGameWorld world) {
|
||||||
this.world = world;
|
this.world = world;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -236,8 +236,8 @@ public class Game {
|
|||||||
*
|
*
|
||||||
* @return the unplayed floors
|
* @return the unplayed floors
|
||||||
*/
|
*/
|
||||||
public List<ResourceWorld> getUnplayedFloors() {
|
public List<DResourceWorld> getUnplayedFloors() {
|
||||||
List<ResourceWorld> unplayedFloors = new ArrayList<>();
|
List<DResourceWorld> unplayedFloors = new ArrayList<>();
|
||||||
for (DGroup dGroup : dGroups) {
|
for (DGroup dGroup : dGroups) {
|
||||||
if (dGroup.getUnplayedFloors().size() < unplayedFloors.size()) {
|
if (dGroup.getUnplayedFloors().size() < unplayedFloors.size()) {
|
||||||
unplayedFloors = dGroup.getUnplayedFloors();
|
unplayedFloors = dGroup.getUnplayedFloors();
|
||||||
@ -427,7 +427,7 @@ public class Game {
|
|||||||
return getByDGroup(DGroup.getByPlayer(player));
|
return getByDGroup(DGroup.getByPlayer(player));
|
||||||
}
|
}
|
||||||
|
|
||||||
public static Game getByGameWorld(GameWorld gameWorld) {
|
public static Game getByGameWorld(DGameWorld gameWorld) {
|
||||||
for (Game game : plugin.getGames()) {
|
for (Game game : plugin.getGames()) {
|
||||||
if (game.getWorld().equals(gameWorld)) {
|
if (game.getWorld().equals(gameWorld)) {
|
||||||
return game;
|
return game;
|
||||||
@ -438,7 +438,7 @@ public class Game {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public static Game getByWorld(World world) {
|
public static Game getByWorld(World world) {
|
||||||
GameWorld gameWorld = GameWorld.getByWorld(world);
|
DGameWorld gameWorld = DGameWorld.getByWorld(world);
|
||||||
if (gameWorld != null) {
|
if (gameWorld != null) {
|
||||||
return getByGameWorld(gameWorld);
|
return getByGameWorld(gameWorld);
|
||||||
} else {
|
} else {
|
||||||
|
@ -17,7 +17,7 @@
|
|||||||
package io.github.dre2n.dungeonsxl.game;
|
package io.github.dre2n.dungeonsxl.game;
|
||||||
|
|
||||||
import io.github.dre2n.commons.util.NumberUtil;
|
import io.github.dre2n.commons.util.NumberUtil;
|
||||||
import io.github.dre2n.dungeonsxl.world.GameWorld;
|
import io.github.dre2n.dungeonsxl.world.DGameWorld;
|
||||||
import java.util.HashSet;
|
import java.util.HashSet;
|
||||||
import java.util.Set;
|
import java.util.Set;
|
||||||
import org.bukkit.Material;
|
import org.bukkit.Material;
|
||||||
@ -254,7 +254,7 @@ public class GamePlaceableBlock {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Can build
|
// Can build
|
||||||
public static boolean canBuildHere(Block block, BlockFace blockFace, Material mat, GameWorld gameWorld) {
|
public static boolean canBuildHere(Block block, BlockFace blockFace, Material mat, DGameWorld 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) {
|
||||||
continue;
|
continue;
|
||||||
|
@ -22,7 +22,7 @@ import io.github.dre2n.dungeonsxl.config.DMessages;
|
|||||||
import io.github.dre2n.dungeonsxl.game.Game;
|
import io.github.dre2n.dungeonsxl.game.Game;
|
||||||
import io.github.dre2n.dungeonsxl.player.DGamePlayer;
|
import io.github.dre2n.dungeonsxl.player.DGamePlayer;
|
||||||
import io.github.dre2n.dungeonsxl.player.DGroup;
|
import io.github.dre2n.dungeonsxl.player.DGroup;
|
||||||
import io.github.dre2n.dungeonsxl.world.GameWorld;
|
import io.github.dre2n.dungeonsxl.world.DGameWorld;
|
||||||
import java.util.HashSet;
|
import java.util.HashSet;
|
||||||
import java.util.Set;
|
import java.util.Set;
|
||||||
import org.bukkit.Location;
|
import org.bukkit.Location;
|
||||||
@ -167,7 +167,7 @@ public class DPortal extends GlobalProtection {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
GameWorld target = dGroup.getGameWorld();
|
DGameWorld target = dGroup.getGameWorld();
|
||||||
Game game = Game.getByDGroup(dGroup);
|
Game game = Game.getByDGroup(dGroup);
|
||||||
|
|
||||||
if (target == null && game != null) {
|
if (target == null && game != null) {
|
||||||
@ -186,7 +186,7 @@ public class DPortal extends GlobalProtection {
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (target == null && dGroup.getMapName() != null) {
|
if (target == null && dGroup.getMapName() != null) {
|
||||||
target = plugin.getWorlds().getResourceByName(dGroup.getMapName()).instantiateAsGameWorld();//TO DO
|
target = plugin.getDWorlds().getResourceByName(dGroup.getMapName()).instantiateAsGameWorld();//TO DO
|
||||||
dGroup.setGameWorld(target);
|
dGroup.setGameWorld(target);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -469,7 +469,7 @@ public class GameSign extends GlobalProtection {
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (plugin.getWorlds().getGameWorlds().size() >= plugin.getMainConfig().getMaxInstances()) {
|
if (plugin.getDWorlds().getGameWorlds().size() >= plugin.getMainConfig().getMaxInstances()) {
|
||||||
MessageUtil.sendMessage(player, DMessages.ERROR_TOO_MANY_INSTANCES.getMessage());
|
MessageUtil.sendMessage(player, DMessages.ERROR_TOO_MANY_INSTANCES.getMessage());
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
@ -34,8 +34,8 @@ import io.github.dre2n.dungeonsxl.player.DPermissions;
|
|||||||
import io.github.dre2n.dungeonsxl.player.DPlayers;
|
import io.github.dre2n.dungeonsxl.player.DPlayers;
|
||||||
import io.github.dre2n.dungeonsxl.sign.DSign;
|
import io.github.dre2n.dungeonsxl.sign.DSign;
|
||||||
import io.github.dre2n.dungeonsxl.task.RedstoneEventTask;
|
import io.github.dre2n.dungeonsxl.task.RedstoneEventTask;
|
||||||
import io.github.dre2n.dungeonsxl.world.EditWorld;
|
import io.github.dre2n.dungeonsxl.world.DEditWorld;
|
||||||
import io.github.dre2n.dungeonsxl.world.GameWorld;
|
import io.github.dre2n.dungeonsxl.world.DGameWorld;
|
||||||
import org.bukkit.Location;
|
import org.bukkit.Location;
|
||||||
import org.bukkit.Material;
|
import org.bukkit.Material;
|
||||||
import org.bukkit.block.Block;
|
import org.bukkit.block.Block;
|
||||||
@ -91,15 +91,15 @@ public class BlockListener implements Listener {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
// EditWorld Signs
|
// DEditWorld Signs
|
||||||
EditWorld editWorld = EditWorld.getByWorld(block.getWorld());
|
DEditWorld editWorld = DEditWorld.getByWorld(block.getWorld());
|
||||||
if (editWorld != null) {
|
if (editWorld != null) {
|
||||||
editWorld.getSigns().remove(event.getBlock());
|
editWorld.getSigns().remove(event.getBlock());
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Deny GameWorld block breaking
|
// Deny DGameWorld block breaking
|
||||||
GameWorld gameWorld = GameWorld.getByWorld(block.getWorld());
|
DGameWorld gameWorld = DGameWorld.getByWorld(block.getWorld());
|
||||||
if (gameWorld != null) {
|
if (gameWorld != null) {
|
||||||
for (DSign dSign : gameWorld.getDSigns()) {
|
for (DSign dSign : gameWorld.getDSigns()) {
|
||||||
if (dSign.getSign().equals(block)) {
|
if (dSign.getSign().equals(block)) {
|
||||||
@ -128,8 +128,8 @@ public class BlockListener implements Listener {
|
|||||||
public void onPlace(BlockPlaceEvent event) {
|
public void onPlace(BlockPlaceEvent event) {
|
||||||
Block block = event.getBlock();
|
Block block = event.getBlock();
|
||||||
|
|
||||||
// Deny GameWorld Blocks
|
// Deny DGameWorld Blocks
|
||||||
GameWorld gameWorld = GameWorld.getByWorld(block.getWorld());
|
DGameWorld gameWorld = DGameWorld.getByWorld(block.getWorld());
|
||||||
if (gameWorld == null) {
|
if (gameWorld == null) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@ -162,7 +162,7 @@ public class BlockListener implements Listener {
|
|||||||
Player player = event.getPlayer();
|
Player player = event.getPlayer();
|
||||||
Block block = event.getBlock();
|
Block block = event.getBlock();
|
||||||
String[] lines = event.getLines();
|
String[] lines = event.getLines();
|
||||||
EditWorld editWorld = EditWorld.getByWorld(player.getWorld());
|
DEditWorld editWorld = DEditWorld.getByWorld(player.getWorld());
|
||||||
|
|
||||||
// Group Signs
|
// Group Signs
|
||||||
if (editWorld == null) {
|
if (editWorld == null) {
|
||||||
@ -251,13 +251,13 @@ public class BlockListener implements Listener {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Check GameWorlds
|
// Check GameWorlds
|
||||||
GameWorld gameWorld = GameWorld.getByWorld(event.getBlock().getWorld());
|
DGameWorld gameWorld = DGameWorld.getByWorld(event.getBlock().getWorld());
|
||||||
if (gameWorld != null) {
|
if (gameWorld != null) {
|
||||||
event.setCancelled(true);
|
event.setCancelled(true);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Check EditWorlds
|
// Check EditWorlds
|
||||||
EditWorld editWorld = EditWorld.getByWorld(event.getBlock().getWorld());
|
DEditWorld editWorld = DEditWorld.getByWorld(event.getBlock().getWorld());
|
||||||
if (editWorld != null) {
|
if (editWorld != null) {
|
||||||
event.setCancelled(true);
|
event.setCancelled(true);
|
||||||
}
|
}
|
||||||
|
@ -21,8 +21,8 @@ import io.github.dre2n.dungeonsxl.game.Game;
|
|||||||
import io.github.dre2n.dungeonsxl.mob.DMob;
|
import io.github.dre2n.dungeonsxl.mob.DMob;
|
||||||
import io.github.dre2n.dungeonsxl.player.DGamePlayer;
|
import io.github.dre2n.dungeonsxl.player.DGamePlayer;
|
||||||
import io.github.dre2n.dungeonsxl.player.DGroup;
|
import io.github.dre2n.dungeonsxl.player.DGroup;
|
||||||
import io.github.dre2n.dungeonsxl.world.EditWorld;
|
import io.github.dre2n.dungeonsxl.world.DEditWorld;
|
||||||
import io.github.dre2n.dungeonsxl.world.GameWorld;
|
import io.github.dre2n.dungeonsxl.world.DGameWorld;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import org.bukkit.Material;
|
import org.bukkit.Material;
|
||||||
import org.bukkit.World;
|
import org.bukkit.World;
|
||||||
@ -52,7 +52,7 @@ public class EntityListener implements Listener {
|
|||||||
// Remove drops from breaking Signs
|
// Remove drops from breaking Signs
|
||||||
@EventHandler(priority = EventPriority.HIGH)
|
@EventHandler(priority = EventPriority.HIGH)
|
||||||
public void onItemSpawn(ItemSpawnEvent event) {
|
public void onItemSpawn(ItemSpawnEvent event) {
|
||||||
if (GameWorld.getByWorld(event.getLocation().getWorld()) != null) {
|
if (DGameWorld.getByWorld(event.getLocation().getWorld()) != null) {
|
||||||
if (event.getEntity().getItemStack().getType() == Material.SIGN) {
|
if (event.getEntity().getItemStack().getType() == Material.SIGN) {
|
||||||
event.setCancelled(true);
|
event.setCancelled(true);
|
||||||
}
|
}
|
||||||
@ -63,8 +63,8 @@ public class EntityListener implements Listener {
|
|||||||
public void onCreatureSpawn(CreatureSpawnEvent event) {
|
public void onCreatureSpawn(CreatureSpawnEvent event) {
|
||||||
World world = event.getLocation().getWorld();
|
World world = event.getLocation().getWorld();
|
||||||
|
|
||||||
EditWorld editWorld = EditWorld.getByWorld(world);
|
DEditWorld editWorld = DEditWorld.getByWorld(world);
|
||||||
GameWorld gameWorld = GameWorld.getByWorld(world);
|
DGameWorld gameWorld = DGameWorld.getByWorld(world);
|
||||||
|
|
||||||
if (editWorld != null || gameWorld != null) {
|
if (editWorld != null || gameWorld != null) {
|
||||||
switch (event.getSpawnReason()) {
|
switch (event.getSpawnReason()) {
|
||||||
@ -83,7 +83,7 @@ public class EntityListener implements Listener {
|
|||||||
|
|
||||||
if (event.getEntity() instanceof LivingEntity) {
|
if (event.getEntity() instanceof LivingEntity) {
|
||||||
LivingEntity entity = event.getEntity();
|
LivingEntity entity = event.getEntity();
|
||||||
GameWorld gameWorld = GameWorld.getByWorld(world);
|
DGameWorld gameWorld = DGameWorld.getByWorld(world);
|
||||||
if (gameWorld != null) {
|
if (gameWorld != null) {
|
||||||
if (gameWorld.isPlaying()) {
|
if (gameWorld.isPlaying()) {
|
||||||
DMob dMob = DMob.getByEntity(entity);
|
DMob dMob = DMob.getByEntity(entity);
|
||||||
@ -98,7 +98,7 @@ public class EntityListener implements Listener {
|
|||||||
@EventHandler(priority = EventPriority.HIGH)
|
@EventHandler(priority = EventPriority.HIGH)
|
||||||
public void onDamage(EntityDamageEvent event) {
|
public void onDamage(EntityDamageEvent event) {
|
||||||
World world = event.getEntity().getWorld();
|
World world = event.getEntity().getWorld();
|
||||||
GameWorld gameWorld = GameWorld.getByWorld(world);
|
DGameWorld gameWorld = DGameWorld.getByWorld(world);
|
||||||
|
|
||||||
if (gameWorld == null) {
|
if (gameWorld == null) {
|
||||||
return;
|
return;
|
||||||
@ -138,7 +138,7 @@ public class EntityListener implements Listener {
|
|||||||
@EventHandler(priority = EventPriority.HIGH)
|
@EventHandler(priority = EventPriority.HIGH)
|
||||||
public void onDamageByEntity(EntityDamageByEntityEvent event) {
|
public void onDamageByEntity(EntityDamageByEntityEvent event) {
|
||||||
World world = event.getEntity().getWorld();
|
World world = event.getEntity().getWorld();
|
||||||
GameWorld gameWorld = GameWorld.getByWorld(world);
|
DGameWorld gameWorld = DGameWorld.getByWorld(world);
|
||||||
|
|
||||||
if (gameWorld == null) {
|
if (gameWorld == null) {
|
||||||
return;
|
return;
|
||||||
@ -223,7 +223,7 @@ public class EntityListener implements Listener {
|
|||||||
public void onFoodLevelChange(FoodLevelChangeEvent event) {
|
public void onFoodLevelChange(FoodLevelChangeEvent event) {
|
||||||
World world = event.getEntity().getWorld();
|
World world = event.getEntity().getWorld();
|
||||||
|
|
||||||
GameWorld gameWorld = GameWorld.getByWorld(world);
|
DGameWorld gameWorld = DGameWorld.getByWorld(world);
|
||||||
if (gameWorld != null) {
|
if (gameWorld != null) {
|
||||||
if (!gameWorld.isPlaying()) {
|
if (!gameWorld.isPlaying()) {
|
||||||
event.setCancelled(true);
|
event.setCancelled(true);
|
||||||
@ -234,7 +234,7 @@ public class EntityListener implements Listener {
|
|||||||
// Zombie/skeleton combustion from the sun.
|
// Zombie/skeleton combustion from the sun.
|
||||||
@EventHandler(priority = EventPriority.NORMAL)
|
@EventHandler(priority = EventPriority.NORMAL)
|
||||||
public void onCombust(EntityCombustEvent event) {
|
public void onCombust(EntityCombustEvent event) {
|
||||||
GameWorld gameWorld = GameWorld.getByWorld(event.getEntity().getWorld());
|
DGameWorld gameWorld = DGameWorld.getByWorld(event.getEntity().getWorld());
|
||||||
if (gameWorld != null) {
|
if (gameWorld != null) {
|
||||||
event.setCancelled(true);
|
event.setCancelled(true);
|
||||||
}
|
}
|
||||||
@ -243,7 +243,7 @@ public class EntityListener implements Listener {
|
|||||||
// Allow Other combustion
|
// Allow Other combustion
|
||||||
@EventHandler(priority = EventPriority.HIGH)
|
@EventHandler(priority = EventPriority.HIGH)
|
||||||
public void onCombustByEntity(EntityCombustByEntityEvent event) {
|
public void onCombustByEntity(EntityCombustByEntityEvent event) {
|
||||||
GameWorld gameWorld = GameWorld.getByWorld(event.getEntity().getWorld());
|
DGameWorld gameWorld = DGameWorld.getByWorld(event.getEntity().getWorld());
|
||||||
if (gameWorld != null) {
|
if (gameWorld != null) {
|
||||||
if (event.isCancelled()) {
|
if (event.isCancelled()) {
|
||||||
event.setCancelled(false);
|
event.setCancelled(false);
|
||||||
@ -254,7 +254,7 @@ public class EntityListener implements Listener {
|
|||||||
// Explosions
|
// Explosions
|
||||||
@EventHandler
|
@EventHandler
|
||||||
public void onExplode(EntityExplodeEvent event) {
|
public void onExplode(EntityExplodeEvent event) {
|
||||||
GameWorld gameWorld = GameWorld.getByWorld(event.getEntity().getWorld());
|
DGameWorld gameWorld = DGameWorld.getByWorld(event.getEntity().getWorld());
|
||||||
|
|
||||||
if (gameWorld != null) {
|
if (gameWorld != null) {
|
||||||
if (event.getEntity() instanceof LivingEntity) {
|
if (event.getEntity() instanceof LivingEntity) {
|
||||||
|
@ -16,7 +16,7 @@
|
|||||||
*/
|
*/
|
||||||
package io.github.dre2n.dungeonsxl.listener;
|
package io.github.dre2n.dungeonsxl.listener;
|
||||||
|
|
||||||
import io.github.dre2n.dungeonsxl.world.GameWorld;
|
import io.github.dre2n.dungeonsxl.world.DGameWorld;
|
||||||
import org.bukkit.event.EventHandler;
|
import org.bukkit.event.EventHandler;
|
||||||
import org.bukkit.event.Listener;
|
import org.bukkit.event.Listener;
|
||||||
import org.bukkit.event.hanging.HangingBreakByEntityEvent;
|
import org.bukkit.event.hanging.HangingBreakByEntityEvent;
|
||||||
@ -28,7 +28,7 @@ public class HangingListener implements Listener {
|
|||||||
|
|
||||||
@EventHandler
|
@EventHandler
|
||||||
public void onHangingBreakByEntity(HangingBreakByEntityEvent event) {
|
public void onHangingBreakByEntity(HangingBreakByEntityEvent event) {
|
||||||
GameWorld gameWorld = GameWorld.getByWorld(event.getEntity().getWorld());
|
DGameWorld gameWorld = DGameWorld.getByWorld(event.getEntity().getWorld());
|
||||||
if (gameWorld != null) {
|
if (gameWorld != null) {
|
||||||
event.setCancelled(true);
|
event.setCancelled(true);
|
||||||
}
|
}
|
||||||
|
@ -42,8 +42,8 @@ import io.github.dre2n.dungeonsxl.sign.OpenDoorSign;
|
|||||||
import io.github.dre2n.dungeonsxl.task.RespawnTask;
|
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.world.EditWorld;
|
import io.github.dre2n.dungeonsxl.world.DEditWorld;
|
||||||
import io.github.dre2n.dungeonsxl.world.GameWorld;
|
import io.github.dre2n.dungeonsxl.world.DGameWorld;
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import org.bukkit.Bukkit;
|
import org.bukkit.Bukkit;
|
||||||
import org.bukkit.ChatColor;
|
import org.bukkit.ChatColor;
|
||||||
@ -87,7 +87,7 @@ public class PlayerListener implements Listener {
|
|||||||
public void onDeath(PlayerDeathEvent event) {
|
public void onDeath(PlayerDeathEvent event) {
|
||||||
Player player = event.getEntity();
|
Player player = event.getEntity();
|
||||||
|
|
||||||
GameWorld gameWorld = GameWorld.getByWorld(player.getLocation().getWorld());
|
DGameWorld gameWorld = DGameWorld.getByWorld(player.getLocation().getWorld());
|
||||||
if (gameWorld == null) {
|
if (gameWorld == null) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@ -149,7 +149,7 @@ public class PlayerListener implements Listener {
|
|||||||
|
|
||||||
if (clickedBlock != null) {
|
if (clickedBlock != null) {
|
||||||
// Block Enderchests
|
// Block Enderchests
|
||||||
if (GameWorld.getByWorld(player.getWorld()) != null || EditWorld.getByWorld(player.getWorld()) != null) {
|
if (DGameWorld.getByWorld(player.getWorld()) != null || DEditWorld.getByWorld(player.getWorld()) != null) {
|
||||||
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 (!DPermissions.hasPermission(player, DPermissions.BYPASS)) {
|
if (!DPermissions.hasPermission(player, DPermissions.BYPASS)) {
|
||||||
@ -167,7 +167,7 @@ public class PlayerListener implements Listener {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Block Dispensers
|
// Block Dispensers
|
||||||
if (GameWorld.getByWorld(player.getWorld()) != null) {
|
if (DGameWorld.getByWorld(player.getWorld()) != null) {
|
||||||
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 (!DPermissions.hasPermission(player, DPermissions.BYPASS)) {
|
if (!DPermissions.hasPermission(player, DPermissions.BYPASS)) {
|
||||||
@ -209,7 +209,7 @@ public class PlayerListener implements Listener {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Copy/Paste a Sign and Block-info
|
// Copy/Paste a Sign and Block-info
|
||||||
if (EditWorld.getByWorld(player.getWorld()) != null) {
|
if (DEditWorld.getByWorld(player.getWorld()) != null) {
|
||||||
if (event.getAction() == Action.RIGHT_CLICK_BLOCK) {
|
if (event.getAction() == Action.RIGHT_CLICK_BLOCK) {
|
||||||
if (item.getType() == Material.STICK) {
|
if (item.getType() == Material.STICK) {
|
||||||
DEditPlayer dPlayer = DEditPlayer.getByPlayer(player);
|
DEditPlayer dPlayer = DEditPlayer.getByPlayer(player);
|
||||||
@ -222,7 +222,7 @@ public class PlayerListener implements Listener {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Trigger UseItem Signs
|
// Trigger UseItem Signs
|
||||||
GameWorld gameWorld = GameWorld.getByWorld(player.getWorld());
|
DGameWorld gameWorld = DGameWorld.getByWorld(player.getWorld());
|
||||||
if (gameWorld != null) {
|
if (gameWorld != null) {
|
||||||
if (event.getAction() == Action.RIGHT_CLICK_BLOCK || event.getAction() == Action.RIGHT_CLICK_AIR) {
|
if (event.getAction() == Action.RIGHT_CLICK_BLOCK || event.getAction() == Action.RIGHT_CLICK_AIR) {
|
||||||
String name = null;
|
String name = null;
|
||||||
@ -272,8 +272,8 @@ public class PlayerListener implements Listener {
|
|||||||
DGamePlayer dPlayer = DGamePlayer.getByPlayer(player);
|
DGamePlayer dPlayer = DGamePlayer.getByPlayer(player);
|
||||||
if (dPlayer != null) {
|
if (dPlayer != null) {
|
||||||
|
|
||||||
// Check GameWorld Signs
|
// Check DGameWorld Signs
|
||||||
GameWorld gameWorld = GameWorld.getByWorld(player.getWorld());
|
DGameWorld gameWorld = DGameWorld.getByWorld(player.getWorld());
|
||||||
if (gameWorld != null) {
|
if (gameWorld != null) {
|
||||||
|
|
||||||
// Trigger InteractTrigger
|
// Trigger InteractTrigger
|
||||||
@ -360,7 +360,7 @@ public class PlayerListener implements Listener {
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (dPlayer instanceof DEditPlayer) {
|
if (dPlayer instanceof DEditPlayer) {
|
||||||
EditWorld editWorld = EditWorld.getByWorld(((DEditPlayer) dPlayer).getWorld());
|
DEditWorld editWorld = DEditWorld.getByWorld(((DEditPlayer) dPlayer).getWorld());
|
||||||
if (editWorld == null) {
|
if (editWorld == null) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@ -375,7 +375,7 @@ public class PlayerListener implements Listener {
|
|||||||
} else if (dPlayer instanceof DGamePlayer) {
|
} else if (dPlayer instanceof DGamePlayer) {
|
||||||
DGamePlayer gamePlayer = (DGamePlayer) dPlayer;
|
DGamePlayer gamePlayer = (DGamePlayer) dPlayer;
|
||||||
|
|
||||||
GameWorld gameWorld = GameWorld.getByWorld(gamePlayer.getWorld());
|
DGameWorld gameWorld = DGameWorld.getByWorld(gamePlayer.getWorld());
|
||||||
|
|
||||||
if (gameWorld == null) {
|
if (gameWorld == null) {
|
||||||
return;
|
return;
|
||||||
@ -497,7 +497,7 @@ public class PlayerListener implements Listener {
|
|||||||
target = dSavePlayer.getOldLocation();
|
target = dSavePlayer.getOldLocation();
|
||||||
}
|
}
|
||||||
|
|
||||||
if (EditWorld.getByWorld(player.getWorld()) != null || GameWorld.getByWorld(player.getWorld()) != null) {
|
if (DEditWorld.getByWorld(player.getWorld()) != null || DGameWorld.getByWorld(player.getWorld()) != null) {
|
||||||
player.teleport(target);
|
player.teleport(target);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -538,7 +538,7 @@ public class PlayerListener implements Listener {
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (dGroup.getGameWorld() == null) {
|
if (dGroup.getGameWorld() == null) {
|
||||||
dGroup.setGameWorld(plugin.getWorlds().getResourceByName(DGroup.getByPlayer(player).getMapName()).instantiateAsGameWorld());// TO DO
|
dGroup.setGameWorld(plugin.getDWorlds().getResourceByName(DGroup.getByPlayer(player).getMapName()).instantiateAsGameWorld());// TO DO
|
||||||
dGroup.getGameWorld().setTutorial(true);
|
dGroup.getGameWorld().setTutorial(true);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -578,7 +578,7 @@ public class PlayerListener implements Listener {
|
|||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (plugin.getWorlds().getGameWorlds().size() >= config.getMaxInstances()) {
|
if (plugin.getDWorlds().getGameWorlds().size() >= config.getMaxInstances()) {
|
||||||
event.setResult(PlayerLoginEvent.Result.KICK_FULL);
|
event.setResult(PlayerLoginEvent.Result.KICK_FULL);
|
||||||
event.setKickMessage(DMessages.ERROR_TOO_MANY_TUTORIALS.getMessage());
|
event.setKickMessage(DMessages.ERROR_TOO_MANY_TUTORIALS.getMessage());
|
||||||
}
|
}
|
||||||
@ -646,7 +646,7 @@ public class PlayerListener implements Listener {
|
|||||||
|
|
||||||
if (!plugin.getMainConfig().getOpenInventories() && !DPermissions.hasPermission(event.getPlayer(), DPermissions.INSECURE)) {
|
if (!plugin.getMainConfig().getOpenInventories() && !DPermissions.hasPermission(event.getPlayer(), DPermissions.INSECURE)) {
|
||||||
World world = event.getPlayer().getWorld();
|
World world = event.getPlayer().getWorld();
|
||||||
if (event.getInventory().getType() != InventoryType.CREATIVE && EditWorld.getByWorld(world) != null) {
|
if (event.getInventory().getType() != InventoryType.CREATIVE && DEditWorld.getByWorld(world) != null) {
|
||||||
event.setCancelled(true);
|
event.setCancelled(true);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -16,8 +16,8 @@
|
|||||||
*/
|
*/
|
||||||
package io.github.dre2n.dungeonsxl.listener;
|
package io.github.dre2n.dungeonsxl.listener;
|
||||||
|
|
||||||
import io.github.dre2n.dungeonsxl.world.EditWorld;
|
import io.github.dre2n.dungeonsxl.world.DEditWorld;
|
||||||
import io.github.dre2n.dungeonsxl.world.GameWorld;
|
import io.github.dre2n.dungeonsxl.world.DGameWorld;
|
||||||
import org.bukkit.event.EventHandler;
|
import org.bukkit.event.EventHandler;
|
||||||
import org.bukkit.event.EventPriority;
|
import org.bukkit.event.EventPriority;
|
||||||
import org.bukkit.event.Listener;
|
import org.bukkit.event.Listener;
|
||||||
@ -31,7 +31,7 @@ public class WorldListener implements Listener {
|
|||||||
|
|
||||||
@EventHandler(priority = EventPriority.HIGH)
|
@EventHandler(priority = EventPriority.HIGH)
|
||||||
public void onChunkUnload(ChunkUnloadEvent event) {
|
public void onChunkUnload(ChunkUnloadEvent event) {
|
||||||
GameWorld gameWorld = GameWorld.getByWorld(event.getWorld());
|
DGameWorld gameWorld = DGameWorld.getByWorld(event.getWorld());
|
||||||
if (gameWorld != null) {
|
if (gameWorld != null) {
|
||||||
if (gameWorld.getLoadedChunks().contains(event.getChunk())) {
|
if (gameWorld.getLoadedChunks().contains(event.getChunk())) {
|
||||||
event.setCancelled(true);
|
event.setCancelled(true);
|
||||||
@ -41,7 +41,7 @@ public class WorldListener implements Listener {
|
|||||||
|
|
||||||
@EventHandler(priority = EventPriority.HIGHEST)
|
@EventHandler(priority = EventPriority.HIGHEST)
|
||||||
public void onWeatherChange(WeatherChangeEvent event) {
|
public void onWeatherChange(WeatherChangeEvent event) {
|
||||||
if (EditWorld.getByWorld(event.getWorld()) != null) {
|
if (DEditWorld.getByWorld(event.getWorld()) != null) {
|
||||||
if (event.toWeatherState()) {
|
if (event.toWeatherState()) {
|
||||||
event.setCancelled(true);
|
event.setCancelled(true);
|
||||||
}
|
}
|
||||||
|
@ -17,7 +17,7 @@
|
|||||||
package io.github.dre2n.dungeonsxl.mob;
|
package io.github.dre2n.dungeonsxl.mob;
|
||||||
|
|
||||||
import io.github.dre2n.commons.util.NumberUtil;
|
import io.github.dre2n.commons.util.NumberUtil;
|
||||||
import io.github.dre2n.dungeonsxl.world.GameWorld;
|
import io.github.dre2n.dungeonsxl.world.DGameWorld;
|
||||||
import java.util.HashSet;
|
import java.util.HashSet;
|
||||||
import java.util.Set;
|
import java.util.Set;
|
||||||
import net.citizensnpcs.api.CitizensAPI;
|
import net.citizensnpcs.api.CitizensAPI;
|
||||||
@ -84,7 +84,7 @@ public class CitizensMobProvider implements ExternalMobProvider {
|
|||||||
npc.spawn(location);
|
npc.spawn(location);
|
||||||
spawnedNPCs.add(npc);
|
spawnedNPCs.add(npc);
|
||||||
|
|
||||||
GameWorld gameWorld = GameWorld.getByWorld(location.getWorld());
|
DGameWorld gameWorld = DGameWorld.getByWorld(location.getWorld());
|
||||||
new DMob((LivingEntity) npc.getEntity(), gameWorld, null, mob);
|
new DMob((LivingEntity) npc.getEntity(), gameWorld, null, mob);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -21,7 +21,7 @@ import io.github.dre2n.dungeonsxl.event.dmob.DMobSpawnEvent;
|
|||||||
import io.github.dre2n.dungeonsxl.game.Game;
|
import io.github.dre2n.dungeonsxl.game.Game;
|
||||||
import io.github.dre2n.dungeonsxl.trigger.MobTrigger;
|
import io.github.dre2n.dungeonsxl.trigger.MobTrigger;
|
||||||
import io.github.dre2n.dungeonsxl.trigger.WaveTrigger;
|
import io.github.dre2n.dungeonsxl.trigger.WaveTrigger;
|
||||||
import io.github.dre2n.dungeonsxl.world.GameWorld;
|
import io.github.dre2n.dungeonsxl.world.DGameWorld;
|
||||||
import java.util.Random;
|
import java.util.Random;
|
||||||
import java.util.Set;
|
import java.util.Set;
|
||||||
import org.bukkit.Bukkit;
|
import org.bukkit.Bukkit;
|
||||||
@ -41,7 +41,7 @@ public class DMob {
|
|||||||
|
|
||||||
private String trigger;
|
private String trigger;
|
||||||
|
|
||||||
public DMob(LivingEntity entity, GameWorld gameWorld, DMobType type) {
|
public DMob(LivingEntity entity, DGameWorld gameWorld, DMobType type) {
|
||||||
gameWorld.addDMob(this);
|
gameWorld.addDMob(this);
|
||||||
|
|
||||||
this.entity = entity;
|
this.entity = entity;
|
||||||
@ -64,7 +64,7 @@ public class DMob {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public DMob(LivingEntity entity, GameWorld gameWorld, DMobType type, String trigger) {
|
public DMob(LivingEntity entity, DGameWorld gameWorld, DMobType type, String trigger) {
|
||||||
this(entity, gameWorld, type);
|
this(entity, gameWorld, type);
|
||||||
this.trigger = trigger;
|
this.trigger = trigger;
|
||||||
}
|
}
|
||||||
@ -101,7 +101,7 @@ public class DMob {
|
|||||||
/* Actions */
|
/* Actions */
|
||||||
public void onDeath(EntityDeathEvent event) {
|
public void onDeath(EntityDeathEvent event) {
|
||||||
LivingEntity victim = event.getEntity();
|
LivingEntity victim = event.getEntity();
|
||||||
GameWorld gameWorld = GameWorld.getByWorld(victim.getWorld());
|
DGameWorld gameWorld = DGameWorld.getByWorld(victim.getWorld());
|
||||||
String name = null;
|
String name = null;
|
||||||
|
|
||||||
if (gameWorld == null) {
|
if (gameWorld == null) {
|
||||||
@ -153,7 +153,7 @@ public class DMob {
|
|||||||
|
|
||||||
/* Statics */
|
/* Statics */
|
||||||
public static DMob getByEntity(Entity entity) {
|
public static DMob getByEntity(Entity entity) {
|
||||||
GameWorld gameWorld = GameWorld.getByWorld(entity.getWorld());
|
DGameWorld gameWorld = DGameWorld.getByWorld(entity.getWorld());
|
||||||
|
|
||||||
for (DMob dMob : gameWorld.getDMobs()) {
|
for (DMob dMob : gameWorld.getDMobs()) {
|
||||||
if (dMob.entity == entity) {
|
if (dMob.entity == entity) {
|
||||||
|
@ -20,7 +20,7 @@ import io.github.dre2n.commons.util.EnumUtil;
|
|||||||
import io.github.dre2n.commons.util.NumberUtil;
|
import io.github.dre2n.commons.util.NumberUtil;
|
||||||
import io.github.dre2n.commons.util.messageutil.MessageUtil;
|
import io.github.dre2n.commons.util.messageutil.MessageUtil;
|
||||||
import io.github.dre2n.dungeonsxl.config.DMessages;
|
import io.github.dre2n.dungeonsxl.config.DMessages;
|
||||||
import io.github.dre2n.dungeonsxl.world.GameWorld;
|
import io.github.dre2n.dungeonsxl.world.DGameWorld;
|
||||||
import java.io.File;
|
import java.io.File;
|
||||||
import java.util.Arrays;
|
import java.util.Arrays;
|
||||||
import java.util.HashMap;
|
import java.util.HashMap;
|
||||||
@ -358,7 +358,7 @@ public class DMobType {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/* Actions */
|
/* Actions */
|
||||||
public void spawn(GameWorld gameWorld, Location loc) {
|
public void spawn(DGameWorld gameWorld, Location loc) {
|
||||||
if (type == null) {
|
if (type == null) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
@ -20,7 +20,7 @@ import io.github.dre2n.commons.util.messageutil.MessageUtil;
|
|||||||
import io.github.dre2n.commons.util.playerutil.PlayerUtil;
|
import io.github.dre2n.commons.util.playerutil.PlayerUtil;
|
||||||
import io.github.dre2n.dungeonsxl.config.DMessages;
|
import io.github.dre2n.dungeonsxl.config.DMessages;
|
||||||
import io.github.dre2n.dungeonsxl.event.dplayer.DPlayerUpdateEvent;
|
import io.github.dre2n.dungeonsxl.event.dplayer.DPlayerUpdateEvent;
|
||||||
import io.github.dre2n.dungeonsxl.world.EditWorld;
|
import io.github.dre2n.dungeonsxl.world.DEditWorld;
|
||||||
import java.util.concurrent.CopyOnWriteArrayList;
|
import java.util.concurrent.CopyOnWriteArrayList;
|
||||||
import org.bukkit.ChatColor;
|
import org.bukkit.ChatColor;
|
||||||
import org.bukkit.GameMode;
|
import org.bukkit.GameMode;
|
||||||
@ -32,7 +32,7 @@ import org.bukkit.entity.Player;
|
|||||||
import org.bukkit.event.block.SignChangeEvent;
|
import org.bukkit.event.block.SignChangeEvent;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Represents a player in an EditWorld.
|
* Represents a player in an DEditWorld.
|
||||||
*
|
*
|
||||||
* @author Daniel Saukel
|
* @author Daniel Saukel
|
||||||
*/
|
*/
|
||||||
@ -40,7 +40,7 @@ public class DEditPlayer extends DInstancePlayer {
|
|||||||
|
|
||||||
private String[] linesCopy;
|
private String[] linesCopy;
|
||||||
|
|
||||||
public DEditPlayer(DGlobalPlayer player, EditWorld world) {
|
public DEditPlayer(DGlobalPlayer player, DEditWorld world) {
|
||||||
this(player.getPlayer(), world.getWorld());
|
this(player.getPlayer(), world.getWorld());
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -50,7 +50,7 @@ public class DEditPlayer extends DInstancePlayer {
|
|||||||
player.setGameMode(GameMode.CREATIVE);
|
player.setGameMode(GameMode.CREATIVE);
|
||||||
clearPlayerData();
|
clearPlayerData();
|
||||||
|
|
||||||
Location teleport = EditWorld.getByWorld(world).getLobbyLocation();
|
Location teleport = DEditWorld.getByWorld(world).getLobbyLocation();
|
||||||
if (teleport == null) {
|
if (teleport == null) {
|
||||||
PlayerUtil.secureTeleport(player, world.getSpawnLocation());
|
PlayerUtil.secureTeleport(player, world.getSpawnLocation());
|
||||||
} else {
|
} else {
|
||||||
@ -95,7 +95,7 @@ public class DEditPlayer extends DInstancePlayer {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Escape the EditWorld without saving.
|
* Escape the DEditWorld without saving.
|
||||||
*/
|
*/
|
||||||
public void escape() {
|
public void escape() {
|
||||||
delete();
|
delete();
|
||||||
@ -137,7 +137,7 @@ public class DEditPlayer extends DInstancePlayer {
|
|||||||
|
|
||||||
getSavePlayer().reset(false);
|
getSavePlayer().reset(false);
|
||||||
|
|
||||||
EditWorld editWorld = EditWorld.getByWorld(getWorld());
|
DEditWorld editWorld = DEditWorld.getByWorld(getWorld());
|
||||||
if (editWorld != null) {
|
if (editWorld != null) {
|
||||||
editWorld.save();
|
editWorld.save();
|
||||||
}
|
}
|
||||||
@ -145,7 +145,7 @@ public class DEditPlayer extends DInstancePlayer {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void sendMessage(String message) {
|
public void sendMessage(String message) {
|
||||||
EditWorld editWorld = EditWorld.getByWorld(getWorld());
|
DEditWorld editWorld = DEditWorld.getByWorld(getWorld());
|
||||||
editWorld.sendMessage(message);
|
editWorld.sendMessage(message);
|
||||||
|
|
||||||
for (DGlobalPlayer player : plugin.getDPlayers().getDGlobalPlayers()) {
|
for (DGlobalPlayer player : plugin.getDPlayers().getDGlobalPlayers()) {
|
||||||
@ -162,7 +162,7 @@ public class DEditPlayer extends DInstancePlayer {
|
|||||||
boolean locationValid = true;
|
boolean locationValid = true;
|
||||||
Location teleportLocation = player.getLocation();
|
Location teleportLocation = player.getLocation();
|
||||||
|
|
||||||
EditWorld editWorld = EditWorld.getByWorld(getWorld());
|
DEditWorld editWorld = DEditWorld.getByWorld(getWorld());
|
||||||
|
|
||||||
if (!getPlayer().getWorld().equals(getWorld())) {
|
if (!getPlayer().getWorld().equals(getWorld())) {
|
||||||
locationValid = false;
|
locationValid = false;
|
||||||
|
@ -38,8 +38,8 @@ import io.github.dre2n.dungeonsxl.requirement.Requirement;
|
|||||||
import io.github.dre2n.dungeonsxl.reward.DLootInventory;
|
import io.github.dre2n.dungeonsxl.reward.DLootInventory;
|
||||||
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.world.GameWorld;
|
import io.github.dre2n.dungeonsxl.world.DGameWorld;
|
||||||
import io.github.dre2n.dungeonsxl.world.ResourceWorld;
|
import io.github.dre2n.dungeonsxl.world.DResourceWorld;
|
||||||
import java.io.File;
|
import java.io.File;
|
||||||
import java.util.concurrent.CopyOnWriteArrayList;
|
import java.util.concurrent.CopyOnWriteArrayList;
|
||||||
import org.bukkit.ChatColor;
|
import org.bukkit.ChatColor;
|
||||||
@ -56,7 +56,7 @@ import org.bukkit.inventory.ItemStack;
|
|||||||
import org.bukkit.potion.PotionEffect;
|
import org.bukkit.potion.PotionEffect;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Represents a player in a GameWorld.
|
* Represents a player in a DGameWorld.
|
||||||
*
|
*
|
||||||
* @author Frank Baumann, Tobias Schmitz, Milan Albrecht, Daniel Saukel
|
* @author Frank Baumann, Tobias Schmitz, Milan Albrecht, Daniel Saukel
|
||||||
*/
|
*/
|
||||||
@ -77,7 +77,7 @@ public class DGamePlayer extends DInstancePlayer {
|
|||||||
private int initialLives = -1;
|
private int initialLives = -1;
|
||||||
private int lives;
|
private int lives;
|
||||||
|
|
||||||
public DGamePlayer(Player player, GameWorld gameWorld) {
|
public DGamePlayer(Player player, DGameWorld gameWorld) {
|
||||||
this(player, gameWorld.getWorld());
|
this(player, gameWorld.getWorld());
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -103,7 +103,7 @@ public class DGamePlayer extends DInstancePlayer {
|
|||||||
initialLives = rules.getInitialLives();
|
initialLives = rules.getInitialLives();
|
||||||
lives = initialLives;
|
lives = initialLives;
|
||||||
|
|
||||||
Location teleport = GameWorld.getByWorld(world).getLobbyLocation();
|
Location teleport = DGameWorld.getByWorld(world).getLobbyLocation();
|
||||||
if (teleport == null) {
|
if (teleport == null) {
|
||||||
PlayerUtil.secureTeleport(player, world.getSpawnLocation());
|
PlayerUtil.secureTeleport(player, world.getSpawnLocation());
|
||||||
} else {
|
} else {
|
||||||
@ -129,7 +129,7 @@ public class DGamePlayer extends DInstancePlayer {
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
GameWorld gameWorld = dGroup.getGameWorld();
|
DGameWorld gameWorld = dGroup.getGameWorld();
|
||||||
if (gameWorld == null) {
|
if (gameWorld == null) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
@ -392,7 +392,7 @@ public class DGamePlayer extends DInstancePlayer {
|
|||||||
dGroup.removePlayer(getPlayer(), message);
|
dGroup.removePlayer(getPlayer(), message);
|
||||||
}
|
}
|
||||||
|
|
||||||
GameWorld gameWorld = GameWorld.getByWorld(getWorld());
|
DGameWorld gameWorld = DGameWorld.getByWorld(getWorld());
|
||||||
Game game = Game.getByGameWorld(gameWorld);
|
Game game = Game.getByGameWorld(gameWorld);
|
||||||
if (game != null) {
|
if (game != null) {
|
||||||
if (finished) {
|
if (finished) {
|
||||||
@ -639,7 +639,7 @@ public class DGamePlayer extends DInstancePlayer {
|
|||||||
* @param specifiedFloor
|
* @param specifiedFloor
|
||||||
* the name of the next floor
|
* the name of the next floor
|
||||||
*/
|
*/
|
||||||
public void finishFloor(ResourceWorld specifiedFloor) {
|
public void finishFloor(DResourceWorld specifiedFloor) {
|
||||||
MessageUtil.sendMessage(getPlayer(), DMessages.PLAYER_FINISHED_DUNGEON.getMessage());
|
MessageUtil.sendMessage(getPlayer(), DMessages.PLAYER_FINISHED_DUNGEON.getMessage());
|
||||||
finished = true;
|
finished = true;
|
||||||
|
|
||||||
@ -681,7 +681,7 @@ public class DGamePlayer extends DInstancePlayer {
|
|||||||
|
|
||||||
DungeonConfig dConfig = dGroup.getDungeon().getConfig();
|
DungeonConfig dConfig = dGroup.getDungeon().getConfig();
|
||||||
int random = NumberUtil.generateRandomInt(0, dConfig.getFloors().size());
|
int random = NumberUtil.generateRandomInt(0, dConfig.getFloors().size());
|
||||||
ResourceWorld newFloor = dGroup.getUnplayedFloors().get(random);
|
DResourceWorld newFloor = dGroup.getUnplayedFloors().get(random);
|
||||||
if (dConfig.getFloorCount() == dGroup.getFloorCount() - 1) {
|
if (dConfig.getFloorCount() == dGroup.getFloorCount() - 1) {
|
||||||
newFloor = dConfig.getEndFloor();
|
newFloor = dConfig.getEndFloor();
|
||||||
|
|
||||||
@ -700,7 +700,7 @@ public class DGamePlayer extends DInstancePlayer {
|
|||||||
dGroup.removeUnplayedFloor(dGroup.getGameWorld().getResource(), false);
|
dGroup.removeUnplayedFloor(dGroup.getGameWorld().getResource(), false);
|
||||||
dGroup.setMapName(newFloor.getName());
|
dGroup.setMapName(newFloor.getName());
|
||||||
|
|
||||||
GameWorld gameWorld = null;
|
DGameWorld gameWorld = null;
|
||||||
if (newFloor != null) {
|
if (newFloor != null) {
|
||||||
gameWorld = newFloor.instantiateAsGameWorld();
|
gameWorld = newFloor.instantiateAsGameWorld();
|
||||||
}
|
}
|
||||||
@ -794,7 +794,7 @@ public class DGamePlayer extends DInstancePlayer {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void sendMessage(String message) {
|
public void sendMessage(String message) {
|
||||||
GameWorld gameWorld = GameWorld.getByWorld(getWorld());
|
DGameWorld gameWorld = DGameWorld.getByWorld(getWorld());
|
||||||
gameWorld.sendMessage(message);
|
gameWorld.sendMessage(message);
|
||||||
|
|
||||||
for (DGlobalPlayer player : plugin.getDPlayers().getDGlobalPlayers()) {
|
for (DGlobalPlayer player : plugin.getDPlayers().getDGlobalPlayers()) {
|
||||||
@ -820,7 +820,7 @@ public class DGamePlayer extends DInstancePlayer {
|
|||||||
boolean kick = false;
|
boolean kick = false;
|
||||||
boolean triggerAllInDistance = false;
|
boolean triggerAllInDistance = false;
|
||||||
|
|
||||||
GameWorld gameWorld = GameWorld.getByWorld(getWorld());
|
DGameWorld gameWorld = DGameWorld.getByWorld(getWorld());
|
||||||
|
|
||||||
if (!updateSecond) {
|
if (!updateSecond) {
|
||||||
if (!getPlayer().getWorld().equals(getWorld())) {
|
if (!getPlayer().getWorld().equals(getWorld())) {
|
||||||
|
@ -33,8 +33,8 @@ 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;
|
||||||
import io.github.dre2n.dungeonsxl.task.TimeIsRunningTask;
|
import io.github.dre2n.dungeonsxl.task.TimeIsRunningTask;
|
||||||
import io.github.dre2n.dungeonsxl.world.GameWorld;
|
import io.github.dre2n.dungeonsxl.world.DGameWorld;
|
||||||
import io.github.dre2n.dungeonsxl.world.ResourceWorld;
|
import io.github.dre2n.dungeonsxl.world.DResourceWorld;
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.Arrays;
|
import java.util.Arrays;
|
||||||
import java.util.HashSet;
|
import java.util.HashSet;
|
||||||
@ -59,13 +59,13 @@ public class DGroup {
|
|||||||
private Dungeon dungeon;
|
private Dungeon dungeon;
|
||||||
private String dungeonName;
|
private String dungeonName;
|
||||||
private String mapName;
|
private String mapName;
|
||||||
private List<ResourceWorld> unplayedFloors = new ArrayList<>();
|
private List<DResourceWorld> unplayedFloors = new ArrayList<>();
|
||||||
private GameWorld gameWorld;
|
private DGameWorld gameWorld;
|
||||||
private boolean playing;
|
private boolean playing;
|
||||||
private int floorCount;
|
private int floorCount;
|
||||||
private List<Reward> rewards = new ArrayList<>();
|
private List<Reward> rewards = new ArrayList<>();
|
||||||
private BukkitTask timeIsRunningTask;
|
private BukkitTask timeIsRunningTask;
|
||||||
private ResourceWorld nextFloor;
|
private DResourceWorld nextFloor;
|
||||||
|
|
||||||
public DGroup(Player player) {
|
public DGroup(Player player) {
|
||||||
this("Group_" + plugin.getDGroups().size(), player);
|
this("Group_" + plugin.getDGroups().size(), player);
|
||||||
@ -343,7 +343,7 @@ public class DGroup {
|
|||||||
/**
|
/**
|
||||||
* @return the gameWorld
|
* @return the gameWorld
|
||||||
*/
|
*/
|
||||||
public GameWorld getGameWorld() {
|
public DGameWorld getGameWorld() {
|
||||||
return gameWorld;
|
return gameWorld;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -351,7 +351,7 @@ public class DGroup {
|
|||||||
* @param gameWorld
|
* @param gameWorld
|
||||||
* the gameWorld to set
|
* the gameWorld to set
|
||||||
*/
|
*/
|
||||||
public void setGameWorld(GameWorld gameWorld) {
|
public void setGameWorld(DGameWorld gameWorld) {
|
||||||
this.gameWorld = gameWorld;
|
this.gameWorld = gameWorld;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -422,7 +422,7 @@ public class DGroup {
|
|||||||
* the name to set
|
* the name to set
|
||||||
*/
|
*/
|
||||||
public void setMapName(String name) {
|
public void setMapName(String name) {
|
||||||
if (plugin.getWorlds().exists(name)) {
|
if (plugin.getDWorlds().exists(name)) {
|
||||||
mapName = name;
|
mapName = name;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -430,7 +430,7 @@ public class DGroup {
|
|||||||
/**
|
/**
|
||||||
* @return the unplayed floors
|
* @return the unplayed floors
|
||||||
*/
|
*/
|
||||||
public List<ResourceWorld> getUnplayedFloors() {
|
public List<DResourceWorld> getUnplayedFloors() {
|
||||||
return unplayedFloors;
|
return unplayedFloors;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -438,7 +438,7 @@ public class DGroup {
|
|||||||
* @param unplayedFloor
|
* @param unplayedFloor
|
||||||
* the unplayed floor to add
|
* the unplayed floor to add
|
||||||
*/
|
*/
|
||||||
public void addUnplayedFloor(ResourceWorld unplayedFloor) {
|
public void addUnplayedFloor(DResourceWorld unplayedFloor) {
|
||||||
unplayedFloors.add(unplayedFloor);
|
unplayedFloors.add(unplayedFloor);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -448,7 +448,7 @@ public class DGroup {
|
|||||||
* @param force
|
* @param force
|
||||||
* remove the floor even if removeWhenPlayed is disabled
|
* remove the floor even if removeWhenPlayed is disabled
|
||||||
*/
|
*/
|
||||||
public void removeUnplayedFloor(ResourceWorld unplayedFloor, boolean force) {
|
public void removeUnplayedFloor(DResourceWorld unplayedFloor, boolean force) {
|
||||||
if (getDungeon().getConfig().getRemoveWhenPlayed() || force) {
|
if (getDungeon().getConfig().getRemoveWhenPlayed() || force) {
|
||||||
unplayedFloors.remove(unplayedFloor);
|
unplayedFloors.remove(unplayedFloor);
|
||||||
}
|
}
|
||||||
@ -546,7 +546,7 @@ public class DGroup {
|
|||||||
/**
|
/**
|
||||||
* @return the next floor the group will enter
|
* @return the next floor the group will enter
|
||||||
*/
|
*/
|
||||||
public ResourceWorld getNextFloor() {
|
public DResourceWorld getNextFloor() {
|
||||||
return nextFloor;
|
return nextFloor;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -554,7 +554,7 @@ public class DGroup {
|
|||||||
* @param floor
|
* @param floor
|
||||||
* the next floor to set
|
* the next floor to set
|
||||||
*/
|
*/
|
||||||
public void setNextFloor(ResourceWorld floor) {
|
public void setNextFloor(DResourceWorld floor) {
|
||||||
nextFloor = floor;
|
nextFloor = floor;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -781,10 +781,10 @@ public class DGroup {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* @param gameWorld
|
* @param gameWorld
|
||||||
* the GameWorld to check
|
* the DGameWorld to check
|
||||||
* @return a List of DGroups in this GameWorld
|
* @return a List of DGroups in this DGameWorld
|
||||||
*/
|
*/
|
||||||
public static List<DGroup> getByGameWorld(GameWorld gameWorld) {
|
public static List<DGroup> getByGameWorld(DGameWorld gameWorld) {
|
||||||
List<DGroup> dGroups = new ArrayList<>();
|
List<DGroup> dGroups = new ArrayList<>();
|
||||||
for (DGroup dGroup : plugin.getDGroups()) {
|
for (DGroup dGroup : plugin.getDGroups()) {
|
||||||
if (dGroup.getGameWorld().equals(gameWorld)) {
|
if (dGroup.getGameWorld().equals(gameWorld)) {
|
||||||
|
@ -21,7 +21,7 @@ import io.github.dre2n.dungeonsxl.DungeonsXL;
|
|||||||
import io.github.dre2n.dungeonsxl.config.DMessages;
|
import io.github.dre2n.dungeonsxl.config.DMessages;
|
||||||
import io.github.dre2n.dungeonsxl.player.DGamePlayer;
|
import io.github.dre2n.dungeonsxl.player.DGamePlayer;
|
||||||
import io.github.dre2n.dungeonsxl.player.DGroup;
|
import io.github.dre2n.dungeonsxl.player.DGroup;
|
||||||
import io.github.dre2n.dungeonsxl.world.GameWorld;
|
import io.github.dre2n.dungeonsxl.world.DGameWorld;
|
||||||
import net.milkbowl.vault.item.ItemInfo;
|
import net.milkbowl.vault.item.ItemInfo;
|
||||||
import net.milkbowl.vault.item.Items;
|
import net.milkbowl.vault.item.Items;
|
||||||
import org.bukkit.Bukkit;
|
import org.bukkit.Bukkit;
|
||||||
@ -43,11 +43,11 @@ public class RewardChest {
|
|||||||
// Variables
|
// Variables
|
||||||
private boolean used = false;
|
private boolean used = false;
|
||||||
private Chest chest;
|
private Chest chest;
|
||||||
private GameWorld gameWorld;
|
private DGameWorld gameWorld;
|
||||||
private double moneyReward;
|
private double moneyReward;
|
||||||
private int levelReward;
|
private int levelReward;
|
||||||
|
|
||||||
public RewardChest(Block chest, GameWorld gameWorld, double moneyReward, int levelReward) {
|
public RewardChest(Block chest, DGameWorld gameWorld, double moneyReward, int levelReward) {
|
||||||
if (!(chest.getState() instanceof Chest)) {
|
if (!(chest.getState() instanceof Chest)) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@ -93,7 +93,7 @@ public class RewardChest {
|
|||||||
/**
|
/**
|
||||||
* @return the gameWorld
|
* @return the gameWorld
|
||||||
*/
|
*/
|
||||||
public GameWorld getGameWorld() {
|
public DGameWorld getGameWorld() {
|
||||||
return gameWorld;
|
return gameWorld;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -101,7 +101,7 @@ public class RewardChest {
|
|||||||
* @param gameWorld
|
* @param gameWorld
|
||||||
* the gameWorld to set
|
* the gameWorld to set
|
||||||
*/
|
*/
|
||||||
public void setGameWorld(GameWorld gameWorld) {
|
public void setGameWorld(DGameWorld gameWorld) {
|
||||||
this.gameWorld = gameWorld;
|
this.gameWorld = gameWorld;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -227,7 +227,7 @@ public class RewardChest {
|
|||||||
public static void onOpenInventory(InventoryOpenEvent event) {
|
public static void onOpenInventory(InventoryOpenEvent event) {
|
||||||
InventoryView inventory = event.getView();
|
InventoryView inventory = event.getView();
|
||||||
|
|
||||||
GameWorld gameWorld = GameWorld.getByWorld(event.getPlayer().getWorld());
|
DGameWorld gameWorld = DGameWorld.getByWorld(event.getPlayer().getWorld());
|
||||||
|
|
||||||
if (gameWorld == null) {
|
if (gameWorld == null) {
|
||||||
return;
|
return;
|
||||||
|
@ -17,7 +17,7 @@
|
|||||||
package io.github.dre2n.dungeonsxl.sign;
|
package io.github.dre2n.dungeonsxl.sign;
|
||||||
|
|
||||||
import io.github.dre2n.commons.util.NumberUtil;
|
import io.github.dre2n.commons.util.NumberUtil;
|
||||||
import io.github.dre2n.dungeonsxl.world.GameWorld;
|
import io.github.dre2n.dungeonsxl.world.DGameWorld;
|
||||||
import org.bukkit.Material;
|
import org.bukkit.Material;
|
||||||
import org.bukkit.block.Sign;
|
import org.bukkit.block.Sign;
|
||||||
|
|
||||||
@ -36,7 +36,7 @@ public class BlockSign extends DSign {
|
|||||||
private byte offBlockData = 0x0;
|
private byte offBlockData = 0x0;
|
||||||
private byte onBlockData = 0x0;
|
private byte onBlockData = 0x0;
|
||||||
|
|
||||||
public BlockSign(Sign sign, String[] lines, GameWorld gameWorld) {
|
public BlockSign(Sign sign, String[] lines, DGameWorld gameWorld) {
|
||||||
super(sign, lines, gameWorld);
|
super(sign, lines, gameWorld);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -19,7 +19,7 @@ package io.github.dre2n.dungeonsxl.sign;
|
|||||||
import io.github.dre2n.commons.util.messageutil.MessageUtil;
|
import io.github.dre2n.commons.util.messageutil.MessageUtil;
|
||||||
import io.github.dre2n.dungeonsxl.config.DMessages;
|
import io.github.dre2n.dungeonsxl.config.DMessages;
|
||||||
import io.github.dre2n.dungeonsxl.player.DGamePlayer;
|
import io.github.dre2n.dungeonsxl.player.DGamePlayer;
|
||||||
import io.github.dre2n.dungeonsxl.world.GameWorld;
|
import io.github.dre2n.dungeonsxl.world.DGameWorld;
|
||||||
import java.util.concurrent.CopyOnWriteArrayList;
|
import java.util.concurrent.CopyOnWriteArrayList;
|
||||||
import org.bukkit.Material;
|
import org.bukkit.Material;
|
||||||
import org.bukkit.block.Sign;
|
import org.bukkit.block.Sign;
|
||||||
@ -36,7 +36,7 @@ public class CheckpointSign extends DSign {
|
|||||||
private boolean initialized;
|
private boolean initialized;
|
||||||
private CopyOnWriteArrayList<DGamePlayer> done = new CopyOnWriteArrayList<>();
|
private CopyOnWriteArrayList<DGamePlayer> done = new CopyOnWriteArrayList<>();
|
||||||
|
|
||||||
public CheckpointSign(Sign sign, String[] lines, GameWorld gameWorld) {
|
public CheckpointSign(Sign sign, String[] lines, DGameWorld gameWorld) {
|
||||||
super(sign, lines, gameWorld);
|
super(sign, lines, gameWorld);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -18,7 +18,7 @@ package io.github.dre2n.dungeonsxl.sign;
|
|||||||
|
|
||||||
import io.github.dre2n.commons.util.NumberUtil;
|
import io.github.dre2n.commons.util.NumberUtil;
|
||||||
import io.github.dre2n.dungeonsxl.reward.RewardChest;
|
import io.github.dre2n.dungeonsxl.reward.RewardChest;
|
||||||
import io.github.dre2n.dungeonsxl.world.GameWorld;
|
import io.github.dre2n.dungeonsxl.world.DGameWorld;
|
||||||
import org.bukkit.Material;
|
import org.bukkit.Material;
|
||||||
import org.bukkit.block.Sign;
|
import org.bukkit.block.Sign;
|
||||||
|
|
||||||
@ -33,7 +33,7 @@ public class ChestSign extends DSign {
|
|||||||
private double moneyReward;
|
private double moneyReward;
|
||||||
private int levelReward;
|
private int levelReward;
|
||||||
|
|
||||||
public ChestSign(Sign sign, String[] lines, GameWorld gameWorld) {
|
public ChestSign(Sign sign, String[] lines, DGameWorld gameWorld) {
|
||||||
super(sign, lines, gameWorld);
|
super(sign, lines, gameWorld);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -17,7 +17,7 @@
|
|||||||
package io.github.dre2n.dungeonsxl.sign;
|
package io.github.dre2n.dungeonsxl.sign;
|
||||||
|
|
||||||
import io.github.dre2n.commons.util.NumberUtil;
|
import io.github.dre2n.commons.util.NumberUtil;
|
||||||
import io.github.dre2n.dungeonsxl.world.GameWorld;
|
import io.github.dre2n.dungeonsxl.world.DGameWorld;
|
||||||
import org.bukkit.Chunk;
|
import org.bukkit.Chunk;
|
||||||
import org.bukkit.Material;
|
import org.bukkit.Material;
|
||||||
import org.bukkit.block.Sign;
|
import org.bukkit.block.Sign;
|
||||||
@ -29,7 +29,7 @@ public class ChunkUpdaterSign extends DSign {
|
|||||||
|
|
||||||
private DSignType type = DSignTypeDefault.CHUNK_UPDATER;
|
private DSignType type = DSignTypeDefault.CHUNK_UPDATER;
|
||||||
|
|
||||||
public ChunkUpdaterSign(Sign sign, String[] lines, GameWorld gameWorld) {
|
public ChunkUpdaterSign(Sign sign, String[] lines, DGameWorld gameWorld) {
|
||||||
super(sign, lines, gameWorld);
|
super(sign, lines, gameWorld);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -17,7 +17,7 @@
|
|||||||
package io.github.dre2n.dungeonsxl.sign;
|
package io.github.dre2n.dungeonsxl.sign;
|
||||||
|
|
||||||
import io.github.dre2n.dungeonsxl.player.DClass;
|
import io.github.dre2n.dungeonsxl.player.DClass;
|
||||||
import io.github.dre2n.dungeonsxl.world.GameWorld;
|
import io.github.dre2n.dungeonsxl.world.DGameWorld;
|
||||||
import org.bukkit.ChatColor;
|
import org.bukkit.ChatColor;
|
||||||
import org.bukkit.block.Sign;
|
import org.bukkit.block.Sign;
|
||||||
|
|
||||||
@ -30,7 +30,7 @@ public class ClassesSign extends DSign {
|
|||||||
|
|
||||||
private DClass dClass;
|
private DClass dClass;
|
||||||
|
|
||||||
public ClassesSign(Sign sign, String[] lines, GameWorld gameWorld) {
|
public ClassesSign(Sign sign, String[] lines, DGameWorld gameWorld) {
|
||||||
super(sign, lines, gameWorld);
|
super(sign, lines, gameWorld);
|
||||||
dClass = plugin.getDClasses().getByName(sign.getLine(1));
|
dClass = plugin.getDClasses().getByName(sign.getLine(1));
|
||||||
}
|
}
|
||||||
|
@ -21,7 +21,7 @@ import io.github.dre2n.commandsxl.command.CCommand;
|
|||||||
import io.github.dre2n.commandsxl.command.CCommandExecutorTask;
|
import io.github.dre2n.commandsxl.command.CCommandExecutorTask;
|
||||||
import io.github.dre2n.commons.util.NumberUtil;
|
import io.github.dre2n.commons.util.NumberUtil;
|
||||||
import io.github.dre2n.dungeonsxl.trigger.InteractTrigger;
|
import io.github.dre2n.dungeonsxl.trigger.InteractTrigger;
|
||||||
import io.github.dre2n.dungeonsxl.world.GameWorld;
|
import io.github.dre2n.dungeonsxl.world.DGameWorld;
|
||||||
import org.bukkit.Bukkit;
|
import org.bukkit.Bukkit;
|
||||||
import org.bukkit.ChatColor;
|
import org.bukkit.ChatColor;
|
||||||
import org.bukkit.Material;
|
import org.bukkit.Material;
|
||||||
@ -44,7 +44,7 @@ public class CommandSign extends DSign {
|
|||||||
private String executor;
|
private String executor;
|
||||||
private boolean initialized;
|
private boolean initialized;
|
||||||
|
|
||||||
public CommandSign(Sign sign, String[] lines, GameWorld gameWorld) {
|
public CommandSign(Sign sign, String[] lines, DGameWorld gameWorld) {
|
||||||
super(sign, lines, gameWorld);
|
super(sign, lines, gameWorld);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -18,7 +18,7 @@ package io.github.dre2n.dungeonsxl.sign;
|
|||||||
|
|
||||||
import io.github.dre2n.commons.util.NumberUtil;
|
import io.github.dre2n.commons.util.NumberUtil;
|
||||||
import io.github.dre2n.dungeonsxl.task.MobSpawnTask;
|
import io.github.dre2n.dungeonsxl.task.MobSpawnTask;
|
||||||
import io.github.dre2n.dungeonsxl.world.GameWorld;
|
import io.github.dre2n.dungeonsxl.world.DGameWorld;
|
||||||
import org.bukkit.Material;
|
import org.bukkit.Material;
|
||||||
import org.bukkit.block.Sign;
|
import org.bukkit.block.Sign;
|
||||||
import org.bukkit.scheduler.BukkitTask;
|
import org.bukkit.scheduler.BukkitTask;
|
||||||
@ -40,7 +40,7 @@ public class DMobSign extends DSign implements MobSign {
|
|||||||
private boolean active;
|
private boolean active;
|
||||||
private BukkitTask task;
|
private BukkitTask task;
|
||||||
|
|
||||||
public DMobSign(Sign sign, String[] lines, GameWorld gameWorld) {
|
public DMobSign(Sign sign, String[] lines, DGameWorld gameWorld) {
|
||||||
super(sign, lines, gameWorld);
|
super(sign, lines, gameWorld);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -21,7 +21,7 @@ import io.github.dre2n.dungeonsxl.DungeonsXL;
|
|||||||
import io.github.dre2n.dungeonsxl.event.dsign.DSignRegistrationEvent;
|
import io.github.dre2n.dungeonsxl.event.dsign.DSignRegistrationEvent;
|
||||||
import io.github.dre2n.dungeonsxl.game.Game;
|
import io.github.dre2n.dungeonsxl.game.Game;
|
||||||
import io.github.dre2n.dungeonsxl.trigger.Trigger;
|
import io.github.dre2n.dungeonsxl.trigger.Trigger;
|
||||||
import io.github.dre2n.dungeonsxl.world.GameWorld;
|
import io.github.dre2n.dungeonsxl.world.DGameWorld;
|
||||||
import java.lang.reflect.Constructor;
|
import java.lang.reflect.Constructor;
|
||||||
import java.lang.reflect.InvocationTargetException;
|
import java.lang.reflect.InvocationTargetException;
|
||||||
import java.util.HashSet;
|
import java.util.HashSet;
|
||||||
@ -38,12 +38,12 @@ public abstract class DSign {
|
|||||||
|
|
||||||
private Sign sign;
|
private Sign sign;
|
||||||
protected String[] lines;
|
protected String[] lines;
|
||||||
private GameWorld gameWorld;
|
private DGameWorld gameWorld;
|
||||||
|
|
||||||
// List of Triggers
|
// List of Triggers
|
||||||
private Set<Trigger> triggers = new HashSet<>();
|
private Set<Trigger> triggers = new HashSet<>();
|
||||||
|
|
||||||
public DSign(Sign sign, String[] lines, GameWorld gameWorld) {
|
public DSign(Sign sign, String[] lines, DGameWorld gameWorld) {
|
||||||
this.sign = sign;
|
this.sign = sign;
|
||||||
this.lines = lines;
|
this.lines = lines;
|
||||||
this.gameWorld = gameWorld;
|
this.gameWorld = gameWorld;
|
||||||
@ -108,7 +108,7 @@ public abstract class DSign {
|
|||||||
/**
|
/**
|
||||||
* @return the gameWorld
|
* @return the gameWorld
|
||||||
*/
|
*/
|
||||||
public GameWorld getGameWorld() {
|
public DGameWorld getGameWorld() {
|
||||||
return gameWorld;
|
return gameWorld;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -185,11 +185,11 @@ public abstract class DSign {
|
|||||||
return !triggers.isEmpty();
|
return !triggers.isEmpty();
|
||||||
}
|
}
|
||||||
|
|
||||||
public static DSign create(Sign sign, GameWorld gameWorld) {
|
public static DSign create(Sign sign, DGameWorld gameWorld) {
|
||||||
return create(sign, sign.getLines(), gameWorld);
|
return create(sign, sign.getLines(), gameWorld);
|
||||||
}
|
}
|
||||||
|
|
||||||
public static DSign create(Sign sign, String[] lines, GameWorld gameWorld) {
|
public static DSign create(Sign sign, String[] lines, DGameWorld gameWorld) {
|
||||||
DSign dSign = null;
|
DSign dSign = null;
|
||||||
|
|
||||||
for (DSignType type : plugin.getDSigns().getDSigns()) {
|
for (DSignType type : plugin.getDSigns().getDSigns()) {
|
||||||
@ -198,7 +198,7 @@ public abstract class DSign {
|
|||||||
}
|
}
|
||||||
|
|
||||||
try {
|
try {
|
||||||
Constructor<? extends DSign> constructor = type.getHandler().getConstructor(Sign.class, String[].class, GameWorld.class);
|
Constructor<? extends DSign> constructor = type.getHandler().getConstructor(Sign.class, String[].class, DGameWorld.class);
|
||||||
dSign = constructor.newInstance(sign, lines, gameWorld);
|
dSign = constructor.newInstance(sign, lines, gameWorld);
|
||||||
|
|
||||||
} catch (NoSuchMethodException | SecurityException | InstantiationException | IllegalAccessException | IllegalArgumentException | InvocationTargetException exception) {
|
} catch (NoSuchMethodException | SecurityException | InstantiationException | IllegalAccessException | IllegalArgumentException | InvocationTargetException exception) {
|
||||||
|
@ -19,7 +19,7 @@ package io.github.dre2n.dungeonsxl.sign;
|
|||||||
import io.github.dre2n.caliburn.item.UniversalItem;
|
import io.github.dre2n.caliburn.item.UniversalItem;
|
||||||
import io.github.dre2n.commons.util.NumberUtil;
|
import io.github.dre2n.commons.util.NumberUtil;
|
||||||
import io.github.dre2n.dungeonsxl.task.DropItemTask;
|
import io.github.dre2n.dungeonsxl.task.DropItemTask;
|
||||||
import io.github.dre2n.dungeonsxl.world.GameWorld;
|
import io.github.dre2n.dungeonsxl.world.DGameWorld;
|
||||||
import org.bukkit.Location;
|
import org.bukkit.Location;
|
||||||
import org.bukkit.Material;
|
import org.bukkit.Material;
|
||||||
import org.bukkit.block.Sign;
|
import org.bukkit.block.Sign;
|
||||||
@ -35,7 +35,7 @@ public class DropSign extends DSign {
|
|||||||
private ItemStack item;
|
private ItemStack item;
|
||||||
private double interval = -1;
|
private double interval = -1;
|
||||||
|
|
||||||
public DropSign(Sign sign, String[] lines, GameWorld gameWorld) {
|
public DropSign(Sign sign, String[] lines, DGameWorld gameWorld) {
|
||||||
super(sign, lines, gameWorld);
|
super(sign, lines, gameWorld);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -18,7 +18,7 @@ package io.github.dre2n.dungeonsxl.sign;
|
|||||||
|
|
||||||
import io.github.dre2n.dungeonsxl.player.DGamePlayer;
|
import io.github.dre2n.dungeonsxl.player.DGamePlayer;
|
||||||
import io.github.dre2n.dungeonsxl.trigger.InteractTrigger;
|
import io.github.dre2n.dungeonsxl.trigger.InteractTrigger;
|
||||||
import io.github.dre2n.dungeonsxl.world.GameWorld;
|
import io.github.dre2n.dungeonsxl.world.DGameWorld;
|
||||||
import org.bukkit.ChatColor;
|
import org.bukkit.ChatColor;
|
||||||
import org.bukkit.Material;
|
import org.bukkit.Material;
|
||||||
import org.bukkit.block.Sign;
|
import org.bukkit.block.Sign;
|
||||||
@ -31,7 +31,7 @@ public class EndSign extends DSign {
|
|||||||
|
|
||||||
private DSignType type = DSignTypeDefault.END;
|
private DSignType type = DSignTypeDefault.END;
|
||||||
|
|
||||||
public EndSign(Sign sign, String[] lines, GameWorld gameWorld) {
|
public EndSign(Sign sign, String[] lines, DGameWorld gameWorld) {
|
||||||
super(sign, lines, gameWorld);
|
super(sign, lines, gameWorld);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -20,7 +20,7 @@ import io.github.dre2n.commons.util.NumberUtil;
|
|||||||
import io.github.dre2n.dungeonsxl.mob.ExternalMobPlugin;
|
import io.github.dre2n.dungeonsxl.mob.ExternalMobPlugin;
|
||||||
import io.github.dre2n.dungeonsxl.mob.ExternalMobProvider;
|
import io.github.dre2n.dungeonsxl.mob.ExternalMobProvider;
|
||||||
import io.github.dre2n.dungeonsxl.task.ExternalMobSpawnTask;
|
import io.github.dre2n.dungeonsxl.task.ExternalMobSpawnTask;
|
||||||
import io.github.dre2n.dungeonsxl.world.GameWorld;
|
import io.github.dre2n.dungeonsxl.world.DGameWorld;
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import org.bukkit.Location;
|
import org.bukkit.Location;
|
||||||
@ -52,7 +52,7 @@ public class ExternalMobSign extends DSign implements MobSign {
|
|||||||
private LivingEntity externalMob;
|
private LivingEntity externalMob;
|
||||||
private List<Entity> externalMobs = new ArrayList<>();
|
private List<Entity> externalMobs = new ArrayList<>();
|
||||||
|
|
||||||
public ExternalMobSign(Sign sign, String[] lines, GameWorld gameWorld) {
|
public ExternalMobSign(Sign sign, String[] lines, DGameWorld gameWorld) {
|
||||||
super(sign, lines, gameWorld);
|
super(sign, lines, gameWorld);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -18,8 +18,8 @@ package io.github.dre2n.dungeonsxl.sign;
|
|||||||
|
|
||||||
import io.github.dre2n.dungeonsxl.player.DGamePlayer;
|
import io.github.dre2n.dungeonsxl.player.DGamePlayer;
|
||||||
import io.github.dre2n.dungeonsxl.trigger.InteractTrigger;
|
import io.github.dre2n.dungeonsxl.trigger.InteractTrigger;
|
||||||
import io.github.dre2n.dungeonsxl.world.GameWorld;
|
import io.github.dre2n.dungeonsxl.world.DGameWorld;
|
||||||
import io.github.dre2n.dungeonsxl.world.ResourceWorld;
|
import io.github.dre2n.dungeonsxl.world.DResourceWorld;
|
||||||
import org.bukkit.ChatColor;
|
import org.bukkit.ChatColor;
|
||||||
import org.bukkit.Material;
|
import org.bukkit.Material;
|
||||||
import org.bukkit.block.Sign;
|
import org.bukkit.block.Sign;
|
||||||
@ -32,16 +32,16 @@ public class FloorSign extends DSign {
|
|||||||
|
|
||||||
private DSignType type = DSignTypeDefault.FLOOR;
|
private DSignType type = DSignTypeDefault.FLOOR;
|
||||||
|
|
||||||
private ResourceWorld floor;
|
private DResourceWorld floor;
|
||||||
|
|
||||||
public FloorSign(Sign sign, String[] lines, GameWorld gameWorld) {
|
public FloorSign(Sign sign, String[] lines, DGameWorld gameWorld) {
|
||||||
super(sign, lines, gameWorld);
|
super(sign, lines, gameWorld);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @return the next floor
|
* @return the next floor
|
||||||
*/
|
*/
|
||||||
public ResourceWorld getFloor() {
|
public DResourceWorld getFloor() {
|
||||||
return floor;
|
return floor;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -49,7 +49,7 @@ public class FloorSign extends DSign {
|
|||||||
* @param floor
|
* @param floor
|
||||||
* the floor to set
|
* the floor to set
|
||||||
*/
|
*/
|
||||||
public void setFloor(ResourceWorld floor) {
|
public void setFloor(DResourceWorld floor) {
|
||||||
this.floor = floor;
|
this.floor = floor;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -61,7 +61,7 @@ public class FloorSign extends DSign {
|
|||||||
@Override
|
@Override
|
||||||
public void onInit() {
|
public void onInit() {
|
||||||
if (!lines[1].isEmpty()) {
|
if (!lines[1].isEmpty()) {
|
||||||
floor = plugin.getWorlds().getResourceByName(lines[1]);
|
floor = plugin.getDWorlds().getResourceByName(lines[1]);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!getTriggers().isEmpty()) {
|
if (!getTriggers().isEmpty()) {
|
||||||
|
@ -23,7 +23,7 @@ import io.github.dre2n.commons.compatibility.CompatibilityHandler;
|
|||||||
import io.github.dre2n.commons.compatibility.Version;
|
import io.github.dre2n.commons.compatibility.Version;
|
||||||
import io.github.dre2n.commons.util.EnumUtil;
|
import io.github.dre2n.commons.util.EnumUtil;
|
||||||
import io.github.dre2n.commons.util.NumberUtil;
|
import io.github.dre2n.commons.util.NumberUtil;
|
||||||
import io.github.dre2n.dungeonsxl.world.GameWorld;
|
import io.github.dre2n.dungeonsxl.world.DGameWorld;
|
||||||
import org.bukkit.ChatColor;
|
import org.bukkit.ChatColor;
|
||||||
import org.bukkit.Location;
|
import org.bukkit.Location;
|
||||||
import org.bukkit.Material;
|
import org.bukkit.Material;
|
||||||
@ -39,7 +39,7 @@ public class HologramSign extends DSign {
|
|||||||
|
|
||||||
private Hologram hologram;
|
private Hologram hologram;
|
||||||
|
|
||||||
public HologramSign(Sign sign, String[] lines, GameWorld gameWorld) {
|
public HologramSign(Sign sign, String[] lines, DGameWorld gameWorld) {
|
||||||
super(sign, lines, gameWorld);
|
super(sign, lines, gameWorld);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -19,8 +19,8 @@ package io.github.dre2n.dungeonsxl.sign;
|
|||||||
import io.github.dre2n.commons.util.NumberUtil;
|
import io.github.dre2n.commons.util.NumberUtil;
|
||||||
import io.github.dre2n.dungeonsxl.task.SignUpdateTask;
|
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.world.EditWorld;
|
import io.github.dre2n.dungeonsxl.world.DEditWorld;
|
||||||
import io.github.dre2n.dungeonsxl.world.GameWorld;
|
import io.github.dre2n.dungeonsxl.world.DGameWorld;
|
||||||
import java.util.HashSet;
|
import java.util.HashSet;
|
||||||
import java.util.Set;
|
import java.util.Set;
|
||||||
import org.bukkit.ChatColor;
|
import org.bukkit.ChatColor;
|
||||||
@ -35,14 +35,14 @@ public class InteractSign extends DSign {
|
|||||||
|
|
||||||
private DSignType type = DSignTypeDefault.INTERACT;
|
private DSignType type = DSignTypeDefault.INTERACT;
|
||||||
|
|
||||||
public InteractSign(Sign sign, String[] lines, GameWorld gameWorld) {
|
public InteractSign(Sign sign, String[] lines, DGameWorld gameWorld) {
|
||||||
super(sign, lines, gameWorld);
|
super(sign, lines, gameWorld);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean check() {
|
public boolean check() {
|
||||||
Set<Integer> used = new HashSet<>();
|
Set<Integer> used = new HashSet<>();
|
||||||
for (Block block : EditWorld.getByWorld(getSign().getLocation().getWorld()).getSigns()) {
|
for (Block block : DEditWorld.getByWorld(getSign().getLocation().getWorld()).getSigns()) {
|
||||||
if (block == null) {
|
if (block == null) {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
@ -19,7 +19,7 @@ package io.github.dre2n.dungeonsxl.sign;
|
|||||||
import io.github.dre2n.dungeonsxl.event.dplayer.DPlayerEscapeEvent;
|
import io.github.dre2n.dungeonsxl.event.dplayer.DPlayerEscapeEvent;
|
||||||
import io.github.dre2n.dungeonsxl.player.DGamePlayer;
|
import io.github.dre2n.dungeonsxl.player.DGamePlayer;
|
||||||
import io.github.dre2n.dungeonsxl.trigger.InteractTrigger;
|
import io.github.dre2n.dungeonsxl.trigger.InteractTrigger;
|
||||||
import io.github.dre2n.dungeonsxl.world.GameWorld;
|
import io.github.dre2n.dungeonsxl.world.DGameWorld;
|
||||||
import org.bukkit.ChatColor;
|
import org.bukkit.ChatColor;
|
||||||
import org.bukkit.Material;
|
import org.bukkit.Material;
|
||||||
import org.bukkit.block.Sign;
|
import org.bukkit.block.Sign;
|
||||||
@ -32,7 +32,7 @@ public class LeaveSign extends DSign {
|
|||||||
|
|
||||||
private DSignType type = DSignTypeDefault.LEAVE;
|
private DSignType type = DSignTypeDefault.LEAVE;
|
||||||
|
|
||||||
public LeaveSign(Sign sign, String[] lines, GameWorld gameWorld) {
|
public LeaveSign(Sign sign, String[] lines, DGameWorld gameWorld) {
|
||||||
super(sign, lines, gameWorld);
|
super(sign, lines, gameWorld);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -23,7 +23,7 @@ import io.github.dre2n.dungeonsxl.config.DMessages;
|
|||||||
import io.github.dre2n.dungeonsxl.game.Game;
|
import io.github.dre2n.dungeonsxl.game.Game;
|
||||||
import io.github.dre2n.dungeonsxl.player.DGamePlayer;
|
import io.github.dre2n.dungeonsxl.player.DGamePlayer;
|
||||||
import io.github.dre2n.dungeonsxl.player.DGroup;
|
import io.github.dre2n.dungeonsxl.player.DGroup;
|
||||||
import io.github.dre2n.dungeonsxl.world.GameWorld;
|
import io.github.dre2n.dungeonsxl.world.DGameWorld;
|
||||||
import org.bukkit.Material;
|
import org.bukkit.Material;
|
||||||
import org.bukkit.block.Sign;
|
import org.bukkit.block.Sign;
|
||||||
import org.bukkit.entity.Player;
|
import org.bukkit.entity.Player;
|
||||||
@ -44,7 +44,7 @@ public class LivesModifierSign extends DSign {
|
|||||||
private int lives;
|
private int lives;
|
||||||
private Target target;
|
private Target target;
|
||||||
|
|
||||||
public LivesModifierSign(Sign sign, String[] lines, GameWorld gameWorld) {
|
public LivesModifierSign(Sign sign, String[] lines, DGameWorld gameWorld) {
|
||||||
super(sign, lines, gameWorld);
|
super(sign, lines, gameWorld);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -16,7 +16,7 @@
|
|||||||
*/
|
*/
|
||||||
package io.github.dre2n.dungeonsxl.sign;
|
package io.github.dre2n.dungeonsxl.sign;
|
||||||
|
|
||||||
import io.github.dre2n.dungeonsxl.world.GameWorld;
|
import io.github.dre2n.dungeonsxl.world.DGameWorld;
|
||||||
import org.bukkit.Material;
|
import org.bukkit.Material;
|
||||||
import org.bukkit.block.Sign;
|
import org.bukkit.block.Sign;
|
||||||
|
|
||||||
@ -27,7 +27,7 @@ public class LobbySign extends DSign {
|
|||||||
|
|
||||||
private DSignType type = DSignTypeDefault.LOBBY;
|
private DSignType type = DSignTypeDefault.LOBBY;
|
||||||
|
|
||||||
public LobbySign(Sign sign, String[] lines, GameWorld gameWorld) {
|
public LobbySign(Sign sign, String[] lines, DGameWorld gameWorld) {
|
||||||
super(sign, lines, gameWorld);
|
super(sign, lines, gameWorld);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -18,7 +18,7 @@ package io.github.dre2n.dungeonsxl.sign;
|
|||||||
|
|
||||||
import io.github.dre2n.commons.util.NumberUtil;
|
import io.github.dre2n.commons.util.NumberUtil;
|
||||||
import io.github.dre2n.commons.util.messageutil.MessageUtil;
|
import io.github.dre2n.commons.util.messageutil.MessageUtil;
|
||||||
import io.github.dre2n.dungeonsxl.world.GameWorld;
|
import io.github.dre2n.dungeonsxl.world.DGameWorld;
|
||||||
import java.util.concurrent.CopyOnWriteArrayList;
|
import java.util.concurrent.CopyOnWriteArrayList;
|
||||||
import org.bukkit.Material;
|
import org.bukkit.Material;
|
||||||
import org.bukkit.block.Sign;
|
import org.bukkit.block.Sign;
|
||||||
@ -36,7 +36,7 @@ public class MessageSign extends DSign {
|
|||||||
private boolean initialized;
|
private boolean initialized;
|
||||||
private CopyOnWriteArrayList<Player> done = new CopyOnWriteArrayList<>();
|
private CopyOnWriteArrayList<Player> done = new CopyOnWriteArrayList<>();
|
||||||
|
|
||||||
public MessageSign(Sign sign, String[] lines, GameWorld gameWorld) {
|
public MessageSign(Sign sign, String[] lines, DGameWorld gameWorld) {
|
||||||
super(sign, lines, gameWorld);
|
super(sign, lines, gameWorld);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -17,7 +17,7 @@
|
|||||||
package io.github.dre2n.dungeonsxl.sign;
|
package io.github.dre2n.dungeonsxl.sign;
|
||||||
|
|
||||||
import io.github.dre2n.commons.util.BlockUtil;
|
import io.github.dre2n.commons.util.BlockUtil;
|
||||||
import io.github.dre2n.dungeonsxl.world.GameWorld;
|
import io.github.dre2n.dungeonsxl.world.DGameWorld;
|
||||||
import org.bukkit.Material;
|
import org.bukkit.Material;
|
||||||
import org.bukkit.block.Block;
|
import org.bukkit.block.Block;
|
||||||
import org.bukkit.block.BlockFace;
|
import org.bukkit.block.BlockFace;
|
||||||
@ -33,7 +33,7 @@ public class OpenDoorSign extends DSign {
|
|||||||
|
|
||||||
private Block block;
|
private Block block;
|
||||||
|
|
||||||
public OpenDoorSign(Sign sign, String[] lines, GameWorld gameWorld) {
|
public OpenDoorSign(Sign sign, String[] lines, DGameWorld gameWorld) {
|
||||||
super(sign, lines, gameWorld);
|
super(sign, lines, gameWorld);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -95,7 +95,7 @@ public class OpenDoorSign extends DSign {
|
|||||||
* true if the block is openable only with a sign
|
* true if the block is openable only with a sign
|
||||||
*/
|
*/
|
||||||
public static boolean isProtected(Block block) {
|
public static boolean isProtected(Block block) {
|
||||||
GameWorld gameWorld = GameWorld.getByWorld(block.getWorld());
|
DGameWorld gameWorld = DGameWorld.getByWorld(block.getWorld());
|
||||||
if (gameWorld != null) {
|
if (gameWorld != null) {
|
||||||
for (DSign dSign : gameWorld.getDSigns(DSignTypeDefault.OPEN_DOOR)) {
|
for (DSign dSign : gameWorld.getDSigns(DSignTypeDefault.OPEN_DOOR)) {
|
||||||
Block signBlock1 = ((OpenDoorSign) dSign).getBlock();
|
Block signBlock1 = ((OpenDoorSign) dSign).getBlock();
|
||||||
|
@ -17,7 +17,7 @@
|
|||||||
package io.github.dre2n.dungeonsxl.sign;
|
package io.github.dre2n.dungeonsxl.sign;
|
||||||
|
|
||||||
import io.github.dre2n.dungeonsxl.game.GamePlaceableBlock;
|
import io.github.dre2n.dungeonsxl.game.GamePlaceableBlock;
|
||||||
import io.github.dre2n.dungeonsxl.world.GameWorld;
|
import io.github.dre2n.dungeonsxl.world.DGameWorld;
|
||||||
import org.bukkit.Material;
|
import org.bukkit.Material;
|
||||||
import org.bukkit.block.Sign;
|
import org.bukkit.block.Sign;
|
||||||
|
|
||||||
@ -28,7 +28,7 @@ public class PlaceSign extends DSign {
|
|||||||
|
|
||||||
private DSignType type = DSignTypeDefault.PLACE;
|
private DSignType type = DSignTypeDefault.PLACE;
|
||||||
|
|
||||||
public PlaceSign(Sign sign, String[] lines, GameWorld gameWorld) {
|
public PlaceSign(Sign sign, String[] lines, DGameWorld gameWorld) {
|
||||||
super(sign, lines, gameWorld);
|
super(sign, lines, gameWorld);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -25,7 +25,7 @@ import io.github.dre2n.dungeonsxl.player.DGamePlayer;
|
|||||||
import io.github.dre2n.dungeonsxl.player.DGroup;
|
import io.github.dre2n.dungeonsxl.player.DGroup;
|
||||||
import io.github.dre2n.dungeonsxl.trigger.InteractTrigger;
|
import io.github.dre2n.dungeonsxl.trigger.InteractTrigger;
|
||||||
import io.github.dre2n.dungeonsxl.util.ProgressBar;
|
import io.github.dre2n.dungeonsxl.util.ProgressBar;
|
||||||
import io.github.dre2n.dungeonsxl.world.GameWorld;
|
import io.github.dre2n.dungeonsxl.world.DGameWorld;
|
||||||
import org.bukkit.ChatColor;
|
import org.bukkit.ChatColor;
|
||||||
import org.bukkit.Material;
|
import org.bukkit.Material;
|
||||||
import org.bukkit.block.Sign;
|
import org.bukkit.block.Sign;
|
||||||
@ -43,7 +43,7 @@ public class ReadySign extends DSign {
|
|||||||
private double autoStart = -1;
|
private double autoStart = -1;
|
||||||
private boolean triggered = false;
|
private boolean triggered = false;
|
||||||
|
|
||||||
public ReadySign(Sign sign, String[] lines, GameWorld gameWorld) {
|
public ReadySign(Sign sign, String[] lines, DGameWorld gameWorld) {
|
||||||
super(sign, lines, gameWorld);
|
super(sign, lines, gameWorld);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -18,7 +18,7 @@ package io.github.dre2n.dungeonsxl.sign;
|
|||||||
|
|
||||||
import io.github.dre2n.commons.util.NumberUtil;
|
import io.github.dre2n.commons.util.NumberUtil;
|
||||||
import io.github.dre2n.dungeonsxl.task.DelayedPowerTask;
|
import io.github.dre2n.dungeonsxl.task.DelayedPowerTask;
|
||||||
import io.github.dre2n.dungeonsxl.world.GameWorld;
|
import io.github.dre2n.dungeonsxl.world.DGameWorld;
|
||||||
import org.bukkit.Material;
|
import org.bukkit.Material;
|
||||||
import org.bukkit.block.Block;
|
import org.bukkit.block.Block;
|
||||||
import org.bukkit.block.Sign;
|
import org.bukkit.block.Sign;
|
||||||
@ -42,7 +42,7 @@ public class RedstoneSign extends DSign {
|
|||||||
private int repeat = 1;
|
private int repeat = 1;
|
||||||
private int repeatsToDo = 1;
|
private int repeatsToDo = 1;
|
||||||
|
|
||||||
public RedstoneSign(Sign sign, String[] lines, GameWorld gameWorld) {
|
public RedstoneSign(Sign sign, String[] lines, DGameWorld gameWorld) {
|
||||||
super(sign, lines, gameWorld);
|
super(sign, lines, gameWorld);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -16,7 +16,7 @@
|
|||||||
*/
|
*/
|
||||||
package io.github.dre2n.dungeonsxl.sign;
|
package io.github.dre2n.dungeonsxl.sign;
|
||||||
|
|
||||||
import io.github.dre2n.dungeonsxl.world.GameWorld;
|
import io.github.dre2n.dungeonsxl.world.DGameWorld;
|
||||||
import org.bukkit.Material;
|
import org.bukkit.Material;
|
||||||
import org.bukkit.block.Sign;
|
import org.bukkit.block.Sign;
|
||||||
|
|
||||||
@ -29,7 +29,7 @@ public class ScriptSign extends DSign {
|
|||||||
|
|
||||||
private String name;
|
private String name;
|
||||||
|
|
||||||
public ScriptSign(Sign sign, String[] lines, GameWorld gameWorld) {
|
public ScriptSign(Sign sign, String[] lines, DGameWorld gameWorld) {
|
||||||
super(sign, lines, gameWorld);
|
super(sign, lines, gameWorld);
|
||||||
name = lines[1];
|
name = lines[1];
|
||||||
}
|
}
|
||||||
|
@ -17,7 +17,7 @@
|
|||||||
package io.github.dre2n.dungeonsxl.sign;
|
package io.github.dre2n.dungeonsxl.sign;
|
||||||
|
|
||||||
import io.github.dre2n.commons.util.NumberUtil;
|
import io.github.dre2n.commons.util.NumberUtil;
|
||||||
import io.github.dre2n.dungeonsxl.world.GameWorld;
|
import io.github.dre2n.dungeonsxl.world.DGameWorld;
|
||||||
import java.util.concurrent.CopyOnWriteArrayList;
|
import java.util.concurrent.CopyOnWriteArrayList;
|
||||||
import org.bukkit.Material;
|
import org.bukkit.Material;
|
||||||
import org.bukkit.block.Sign;
|
import org.bukkit.block.Sign;
|
||||||
@ -35,7 +35,7 @@ public class SoundMessageSign extends DSign {
|
|||||||
private String msg;
|
private String msg;
|
||||||
private CopyOnWriteArrayList<Player> done = new CopyOnWriteArrayList<>();
|
private CopyOnWriteArrayList<Player> done = new CopyOnWriteArrayList<>();
|
||||||
|
|
||||||
public SoundMessageSign(Sign sign, String[] lines, GameWorld gameWorld) {
|
public SoundMessageSign(Sign sign, String[] lines, DGameWorld gameWorld) {
|
||||||
super(sign, lines, gameWorld);
|
super(sign, lines, gameWorld);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -17,7 +17,7 @@
|
|||||||
package io.github.dre2n.dungeonsxl.sign;
|
package io.github.dre2n.dungeonsxl.sign;
|
||||||
|
|
||||||
import io.github.dre2n.commons.util.NumberUtil;
|
import io.github.dre2n.commons.util.NumberUtil;
|
||||||
import io.github.dre2n.dungeonsxl.world.GameWorld;
|
import io.github.dre2n.dungeonsxl.world.DGameWorld;
|
||||||
import org.bukkit.Material;
|
import org.bukkit.Material;
|
||||||
import org.bukkit.block.Sign;
|
import org.bukkit.block.Sign;
|
||||||
|
|
||||||
@ -30,7 +30,7 @@ public class StartSign extends DSign {
|
|||||||
|
|
||||||
private int id;
|
private int id;
|
||||||
|
|
||||||
public StartSign(Sign sign, String[] lines, GameWorld gameWorld) {
|
public StartSign(Sign sign, String[] lines, DGameWorld gameWorld) {
|
||||||
super(sign, lines, gameWorld);
|
super(sign, lines, gameWorld);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -17,7 +17,7 @@
|
|||||||
package io.github.dre2n.dungeonsxl.sign;
|
package io.github.dre2n.dungeonsxl.sign;
|
||||||
|
|
||||||
import io.github.dre2n.commons.util.NumberUtil;
|
import io.github.dre2n.commons.util.NumberUtil;
|
||||||
import io.github.dre2n.dungeonsxl.world.GameWorld;
|
import io.github.dre2n.dungeonsxl.world.DGameWorld;
|
||||||
import org.bukkit.Location;
|
import org.bukkit.Location;
|
||||||
import org.bukkit.Material;
|
import org.bukkit.Material;
|
||||||
import org.bukkit.block.Sign;
|
import org.bukkit.block.Sign;
|
||||||
@ -32,7 +32,7 @@ public class TeleportSign extends DSign {
|
|||||||
|
|
||||||
private Location location;
|
private Location location;
|
||||||
|
|
||||||
public TeleportSign(Sign sign, String[] lines, GameWorld gameWorld) {
|
public TeleportSign(Sign sign, String[] lines, DGameWorld gameWorld) {
|
||||||
super(sign, lines, gameWorld);
|
super(sign, lines, gameWorld);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -19,8 +19,8 @@ package io.github.dre2n.dungeonsxl.sign;
|
|||||||
import io.github.dre2n.commons.util.NumberUtil;
|
import io.github.dre2n.commons.util.NumberUtil;
|
||||||
import io.github.dre2n.dungeonsxl.task.SignUpdateTask;
|
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.world.EditWorld;
|
import io.github.dre2n.dungeonsxl.world.DEditWorld;
|
||||||
import io.github.dre2n.dungeonsxl.world.GameWorld;
|
import io.github.dre2n.dungeonsxl.world.DGameWorld;
|
||||||
import java.util.HashSet;
|
import java.util.HashSet;
|
||||||
import java.util.Set;
|
import java.util.Set;
|
||||||
import org.bukkit.Material;
|
import org.bukkit.Material;
|
||||||
@ -38,14 +38,14 @@ public class TriggerSign extends DSign {
|
|||||||
private int triggerId;
|
private int triggerId;
|
||||||
private boolean initialized;
|
private boolean initialized;
|
||||||
|
|
||||||
public TriggerSign(Sign sign, String[] lines, GameWorld gameWorld) {
|
public TriggerSign(Sign sign, String[] lines, DGameWorld gameWorld) {
|
||||||
super(sign, lines, gameWorld);
|
super(sign, lines, gameWorld);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean check() {
|
public boolean check() {
|
||||||
Set<Integer> used = new HashSet<>();
|
Set<Integer> used = new HashSet<>();
|
||||||
for (Block block : EditWorld.getByWorld(getSign().getLocation().getWorld()).getSigns()) {
|
for (Block block : DEditWorld.getByWorld(getSign().getLocation().getWorld()).getSigns()) {
|
||||||
if (block == null) {
|
if (block == null) {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
@ -18,7 +18,7 @@ package io.github.dre2n.dungeonsxl.sign;
|
|||||||
|
|
||||||
import io.github.dre2n.commons.util.NumberUtil;
|
import io.github.dre2n.commons.util.NumberUtil;
|
||||||
import io.github.dre2n.dungeonsxl.trigger.InteractTrigger;
|
import io.github.dre2n.dungeonsxl.trigger.InteractTrigger;
|
||||||
import io.github.dre2n.dungeonsxl.world.GameWorld;
|
import io.github.dre2n.dungeonsxl.world.DGameWorld;
|
||||||
import org.bukkit.ChatColor;
|
import org.bukkit.ChatColor;
|
||||||
import org.bukkit.Material;
|
import org.bukkit.Material;
|
||||||
import org.bukkit.block.Sign;
|
import org.bukkit.block.Sign;
|
||||||
@ -34,7 +34,7 @@ public class WaveSign extends DSign {
|
|||||||
private double mobCountIncreaseRate;
|
private double mobCountIncreaseRate;
|
||||||
private boolean teleport;
|
private boolean teleport;
|
||||||
|
|
||||||
public WaveSign(Sign sign, String[] lines, GameWorld gameWorld) {
|
public WaveSign(Sign sign, String[] lines, DGameWorld gameWorld) {
|
||||||
super(sign, lines, gameWorld);
|
super(sign, lines, gameWorld);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -17,7 +17,7 @@
|
|||||||
package io.github.dre2n.dungeonsxl.task;
|
package io.github.dre2n.dungeonsxl.task;
|
||||||
|
|
||||||
import io.github.dre2n.dungeonsxl.sign.RedstoneSign;
|
import io.github.dre2n.dungeonsxl.sign.RedstoneSign;
|
||||||
import io.github.dre2n.dungeonsxl.world.GameWorld;
|
import io.github.dre2n.dungeonsxl.world.DGameWorld;
|
||||||
import org.bukkit.scheduler.BukkitRunnable;
|
import org.bukkit.scheduler.BukkitRunnable;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -35,7 +35,7 @@ public class DelayedPowerTask extends BukkitRunnable {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void run() {
|
public void run() {
|
||||||
if (GameWorld.getByWorld(sign.getBlock().getWorld()) == null) {
|
if (DGameWorld.getByWorld(sign.getBlock().getWorld()) == null) {
|
||||||
sign.getEnableTask().cancel();
|
sign.getEnableTask().cancel();
|
||||||
sign.getDisableTask().cancel();
|
sign.getDisableTask().cancel();
|
||||||
return;
|
return;
|
||||||
|
@ -19,7 +19,7 @@ package io.github.dre2n.dungeonsxl.task;
|
|||||||
import io.github.dre2n.dungeonsxl.mob.DMob;
|
import io.github.dre2n.dungeonsxl.mob.DMob;
|
||||||
import io.github.dre2n.dungeonsxl.mob.ExternalMobProvider;
|
import io.github.dre2n.dungeonsxl.mob.ExternalMobProvider;
|
||||||
import io.github.dre2n.dungeonsxl.sign.ExternalMobSign;
|
import io.github.dre2n.dungeonsxl.sign.ExternalMobSign;
|
||||||
import io.github.dre2n.dungeonsxl.world.GameWorld;
|
import io.github.dre2n.dungeonsxl.world.DGameWorld;
|
||||||
import org.bukkit.World;
|
import org.bukkit.World;
|
||||||
import org.bukkit.scheduler.BukkitRunnable;
|
import org.bukkit.scheduler.BukkitRunnable;
|
||||||
|
|
||||||
@ -40,7 +40,7 @@ public class ExternalMobSpawnTask extends BukkitRunnable {
|
|||||||
public void run() {
|
public void run() {
|
||||||
if (sign.getInterval() <= 0) {
|
if (sign.getInterval() <= 0) {
|
||||||
World world = sign.getSign().getWorld();
|
World world = sign.getSign().getWorld();
|
||||||
GameWorld gameWorld = GameWorld.getByWorld(world);
|
DGameWorld gameWorld = DGameWorld.getByWorld(world);
|
||||||
|
|
||||||
if (gameWorld != null) {
|
if (gameWorld != null) {
|
||||||
sign.setSpawnLocation(sign.getSign().getLocation().add(0.5, 0, 0.5));
|
sign.setSpawnLocation(sign.getSign().getLocation().add(0.5, 0, 0.5));
|
||||||
|
@ -18,7 +18,7 @@ package io.github.dre2n.dungeonsxl.task;
|
|||||||
|
|
||||||
import io.github.dre2n.dungeonsxl.DungeonsXL;
|
import io.github.dre2n.dungeonsxl.DungeonsXL;
|
||||||
import io.github.dre2n.dungeonsxl.player.DGamePlayer;
|
import io.github.dre2n.dungeonsxl.player.DGamePlayer;
|
||||||
import io.github.dre2n.dungeonsxl.world.GameWorld;
|
import io.github.dre2n.dungeonsxl.world.DGameWorld;
|
||||||
import org.bukkit.scheduler.BukkitRunnable;
|
import org.bukkit.scheduler.BukkitRunnable;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -30,7 +30,7 @@ public class LazyUpdateTask extends BukkitRunnable {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void run() {
|
public void run() {
|
||||||
for (GameWorld gameWorld : plugin.getWorlds().getGameWorlds()) {
|
for (DGameWorld gameWorld : plugin.getDWorlds().getGameWorlds()) {
|
||||||
gameWorld.update();
|
gameWorld.update();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -20,7 +20,7 @@ import io.github.dre2n.dungeonsxl.DungeonsXL;
|
|||||||
import io.github.dre2n.dungeonsxl.mob.DMob;
|
import io.github.dre2n.dungeonsxl.mob.DMob;
|
||||||
import io.github.dre2n.dungeonsxl.mob.DMobType;
|
import io.github.dre2n.dungeonsxl.mob.DMobType;
|
||||||
import io.github.dre2n.dungeonsxl.sign.DMobSign;
|
import io.github.dre2n.dungeonsxl.sign.DMobSign;
|
||||||
import io.github.dre2n.dungeonsxl.world.GameWorld;
|
import io.github.dre2n.dungeonsxl.world.DGameWorld;
|
||||||
import org.bukkit.Location;
|
import org.bukkit.Location;
|
||||||
import org.bukkit.Material;
|
import org.bukkit.Material;
|
||||||
import org.bukkit.World;
|
import org.bukkit.World;
|
||||||
@ -46,7 +46,7 @@ public class MobSpawnTask extends BukkitRunnable {
|
|||||||
public void run() {
|
public void run() {
|
||||||
if (sign.getInterval() <= 0) {
|
if (sign.getInterval() <= 0) {
|
||||||
World world = sign.getSign().getWorld();
|
World world = sign.getSign().getWorld();
|
||||||
GameWorld gameWorld = GameWorld.getByWorld(world);
|
DGameWorld gameWorld = DGameWorld.getByWorld(world);
|
||||||
|
|
||||||
if (gameWorld != null) {
|
if (gameWorld != null) {
|
||||||
Location spawnLoc = sign.getSign().getLocation().add(0.5, 0, 0.5);
|
Location spawnLoc = sign.getSign().getLocation().add(0.5, 0, 0.5);
|
||||||
|
@ -18,7 +18,7 @@ package io.github.dre2n.dungeonsxl.task;
|
|||||||
|
|
||||||
import io.github.dre2n.dungeonsxl.DungeonsXL;
|
import io.github.dre2n.dungeonsxl.DungeonsXL;
|
||||||
import io.github.dre2n.dungeonsxl.trigger.RedstoneTrigger;
|
import io.github.dre2n.dungeonsxl.trigger.RedstoneTrigger;
|
||||||
import io.github.dre2n.dungeonsxl.world.GameWorld;
|
import io.github.dre2n.dungeonsxl.world.DGameWorld;
|
||||||
import org.bukkit.block.Block;
|
import org.bukkit.block.Block;
|
||||||
import org.bukkit.scheduler.BukkitRunnable;
|
import org.bukkit.scheduler.BukkitRunnable;
|
||||||
|
|
||||||
@ -35,7 +35,7 @@ public class RedstoneEventTask extends BukkitRunnable {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void run() {
|
public void run() {
|
||||||
for (GameWorld gameWorld : DungeonsXL.getInstance().getWorlds().getGameWorlds()) {
|
for (DGameWorld gameWorld : DungeonsXL.getInstance().getDWorlds().getGameWorlds()) {
|
||||||
if (block.getWorld() == gameWorld.getWorld()) {
|
if (block.getWorld() == gameWorld.getWorld()) {
|
||||||
RedstoneTrigger.updateAll(gameWorld);
|
RedstoneTrigger.updateAll(gameWorld);
|
||||||
}
|
}
|
||||||
|
@ -18,8 +18,8 @@ package io.github.dre2n.dungeonsxl.task;
|
|||||||
|
|
||||||
import io.github.dre2n.dungeonsxl.DungeonsXL;
|
import io.github.dre2n.dungeonsxl.DungeonsXL;
|
||||||
import io.github.dre2n.dungeonsxl.player.DGamePlayer;
|
import io.github.dre2n.dungeonsxl.player.DGamePlayer;
|
||||||
import io.github.dre2n.dungeonsxl.world.EditWorld;
|
import io.github.dre2n.dungeonsxl.world.DEditWorld;
|
||||||
import io.github.dre2n.dungeonsxl.world.GameWorld;
|
import io.github.dre2n.dungeonsxl.world.DGameWorld;
|
||||||
import org.bukkit.scheduler.BukkitRunnable;
|
import org.bukkit.scheduler.BukkitRunnable;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -31,7 +31,7 @@ public class WorldUnloadTask extends BukkitRunnable {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void run() {
|
public void run() {
|
||||||
for (GameWorld gameWorld : plugin.getWorlds().getGameWorlds()) {
|
for (DGameWorld gameWorld : plugin.getDWorlds().getGameWorlds()) {
|
||||||
if (gameWorld.getWorld().getPlayers().isEmpty()) {
|
if (gameWorld.getWorld().getPlayers().isEmpty()) {
|
||||||
if (DGamePlayer.getByWorld(gameWorld.getWorld()).isEmpty()) {
|
if (DGamePlayer.getByWorld(gameWorld.getWorld()).isEmpty()) {
|
||||||
gameWorld.delete();
|
gameWorld.delete();
|
||||||
@ -39,7 +39,7 @@ public class WorldUnloadTask extends BukkitRunnable {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
for (EditWorld editWorld : plugin.getWorlds().getEditWorlds()) {
|
for (DEditWorld editWorld : plugin.getDWorlds().getEditWorlds()) {
|
||||||
if (editWorld.getWorld().getPlayers().isEmpty()) {
|
if (editWorld.getWorld().getPlayers().isEmpty()) {
|
||||||
editWorld.delete(true);
|
editWorld.delete(true);
|
||||||
}
|
}
|
||||||
|
@ -17,7 +17,7 @@
|
|||||||
package io.github.dre2n.dungeonsxl.trigger;
|
package io.github.dre2n.dungeonsxl.trigger;
|
||||||
|
|
||||||
import io.github.dre2n.dungeonsxl.event.trigger.TriggerActionEvent;
|
import io.github.dre2n.dungeonsxl.event.trigger.TriggerActionEvent;
|
||||||
import io.github.dre2n.dungeonsxl.world.GameWorld;
|
import io.github.dre2n.dungeonsxl.world.DGameWorld;
|
||||||
import org.bukkit.Location;
|
import org.bukkit.Location;
|
||||||
import org.bukkit.entity.Player;
|
import org.bukkit.entity.Player;
|
||||||
|
|
||||||
@ -61,7 +61,7 @@ public class DistanceTrigger extends Trigger {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/* Statics */
|
/* Statics */
|
||||||
public static void triggerAllInDistance(Player player, GameWorld gameWorld) {
|
public static void triggerAllInDistance(Player player, DGameWorld gameWorld) {
|
||||||
if (!player.getLocation().getWorld().equals(gameWorld.getWorld())) {
|
if (!player.getLocation().getWorld().equals(gameWorld.getWorld())) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
@ -17,7 +17,7 @@
|
|||||||
package io.github.dre2n.dungeonsxl.trigger;
|
package io.github.dre2n.dungeonsxl.trigger;
|
||||||
|
|
||||||
import io.github.dre2n.dungeonsxl.event.trigger.TriggerActionEvent;
|
import io.github.dre2n.dungeonsxl.event.trigger.TriggerActionEvent;
|
||||||
import io.github.dre2n.dungeonsxl.world.GameWorld;
|
import io.github.dre2n.dungeonsxl.world.DGameWorld;
|
||||||
import org.bukkit.block.Block;
|
import org.bukkit.block.Block;
|
||||||
import org.bukkit.entity.Player;
|
import org.bukkit.entity.Player;
|
||||||
|
|
||||||
@ -55,7 +55,7 @@ public class InteractTrigger extends Trigger {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/* Statics */
|
/* Statics */
|
||||||
public static InteractTrigger getOrCreate(int id, GameWorld gameWorld) {
|
public static InteractTrigger getOrCreate(int id, DGameWorld gameWorld) {
|
||||||
if (id == 0) {
|
if (id == 0) {
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
@ -66,7 +66,7 @@ public class InteractTrigger extends Trigger {
|
|||||||
return new InteractTrigger(id, null);
|
return new InteractTrigger(id, null);
|
||||||
}
|
}
|
||||||
|
|
||||||
public static InteractTrigger getOrCreate(int id, Block block, GameWorld gameWorld) {
|
public static InteractTrigger getOrCreate(int id, Block block, DGameWorld gameWorld) {
|
||||||
InteractTrigger trigger = getById(id, gameWorld);
|
InteractTrigger trigger = getById(id, gameWorld);
|
||||||
if (trigger != null) {
|
if (trigger != null) {
|
||||||
trigger.interactBlock = block;
|
trigger.interactBlock = block;
|
||||||
@ -75,7 +75,7 @@ public class InteractTrigger extends Trigger {
|
|||||||
return new InteractTrigger(id, block);
|
return new InteractTrigger(id, block);
|
||||||
}
|
}
|
||||||
|
|
||||||
public static InteractTrigger getByBlock(Block block, GameWorld gameWorld) {
|
public static InteractTrigger getByBlock(Block block, DGameWorld gameWorld) {
|
||||||
for (Trigger uncasted : gameWorld.getTriggers(TriggerTypeDefault.INTERACT)) {
|
for (Trigger uncasted : gameWorld.getTriggers(TriggerTypeDefault.INTERACT)) {
|
||||||
InteractTrigger trigger = (InteractTrigger) uncasted;
|
InteractTrigger trigger = (InteractTrigger) uncasted;
|
||||||
if (trigger.interactBlock != null) {
|
if (trigger.interactBlock != null) {
|
||||||
@ -87,7 +87,7 @@ public class InteractTrigger extends Trigger {
|
|||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
public static InteractTrigger getById(int id, GameWorld gameWorld) {
|
public static InteractTrigger getById(int id, DGameWorld gameWorld) {
|
||||||
if (id != 0) {
|
if (id != 0) {
|
||||||
for (Trigger uncasted : gameWorld.getTriggers(TriggerTypeDefault.INTERACT)) {
|
for (Trigger uncasted : gameWorld.getTriggers(TriggerTypeDefault.INTERACT)) {
|
||||||
InteractTrigger trigger = (InteractTrigger) uncasted;
|
InteractTrigger trigger = (InteractTrigger) uncasted;
|
||||||
|
@ -17,7 +17,7 @@
|
|||||||
package io.github.dre2n.dungeonsxl.trigger;
|
package io.github.dre2n.dungeonsxl.trigger;
|
||||||
|
|
||||||
import io.github.dre2n.dungeonsxl.event.trigger.TriggerActionEvent;
|
import io.github.dre2n.dungeonsxl.event.trigger.TriggerActionEvent;
|
||||||
import io.github.dre2n.dungeonsxl.world.GameWorld;
|
import io.github.dre2n.dungeonsxl.world.DGameWorld;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @author Frank Baumann, Daniel Saukel
|
* @author Frank Baumann, Daniel Saukel
|
||||||
@ -50,7 +50,7 @@ public class MobTrigger extends Trigger {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/* Statics */
|
/* Statics */
|
||||||
public static MobTrigger getOrCreate(String name, GameWorld gameWorld) {
|
public static MobTrigger getOrCreate(String name, DGameWorld gameWorld) {
|
||||||
MobTrigger trigger = getByName(name, gameWorld);
|
MobTrigger trigger = getByName(name, gameWorld);
|
||||||
if (trigger != null) {
|
if (trigger != null) {
|
||||||
return trigger;
|
return trigger;
|
||||||
@ -58,7 +58,7 @@ public class MobTrigger extends Trigger {
|
|||||||
return new MobTrigger(name);
|
return new MobTrigger(name);
|
||||||
}
|
}
|
||||||
|
|
||||||
public static MobTrigger getByName(String name, GameWorld gameWorld) {
|
public static MobTrigger getByName(String name, DGameWorld gameWorld) {
|
||||||
for (Trigger uncasted : gameWorld.getTriggers(TriggerTypeDefault.MOB)) {
|
for (Trigger uncasted : gameWorld.getTriggers(TriggerTypeDefault.MOB)) {
|
||||||
MobTrigger trigger = (MobTrigger) uncasted;
|
MobTrigger trigger = (MobTrigger) uncasted;
|
||||||
if (trigger.name.equalsIgnoreCase(name)) {
|
if (trigger.name.equalsIgnoreCase(name)) {
|
||||||
|
@ -17,8 +17,8 @@
|
|||||||
package io.github.dre2n.dungeonsxl.trigger;
|
package io.github.dre2n.dungeonsxl.trigger;
|
||||||
|
|
||||||
import io.github.dre2n.dungeonsxl.event.trigger.TriggerActionEvent;
|
import io.github.dre2n.dungeonsxl.event.trigger.TriggerActionEvent;
|
||||||
import io.github.dre2n.dungeonsxl.world.GameWorld;
|
import io.github.dre2n.dungeonsxl.world.DGameWorld;
|
||||||
import io.github.dre2n.dungeonsxl.world.ResourceWorld;
|
import io.github.dre2n.dungeonsxl.world.DResourceWorld;
|
||||||
import java.util.HashSet;
|
import java.util.HashSet;
|
||||||
import java.util.Set;
|
import java.util.Set;
|
||||||
|
|
||||||
@ -29,7 +29,7 @@ public class ProgressTrigger extends Trigger {
|
|||||||
|
|
||||||
private TriggerType type = TriggerTypeDefault.PROGRESS;
|
private TriggerType type = TriggerTypeDefault.PROGRESS;
|
||||||
|
|
||||||
private ResourceWorld floor;
|
private DResourceWorld floor;
|
||||||
private int floorCount;
|
private int floorCount;
|
||||||
private int waveCount;
|
private int waveCount;
|
||||||
|
|
||||||
@ -38,7 +38,7 @@ public class ProgressTrigger extends Trigger {
|
|||||||
this.waveCount = waveCount;
|
this.waveCount = waveCount;
|
||||||
}
|
}
|
||||||
|
|
||||||
public ProgressTrigger(ResourceWorld floor) {
|
public ProgressTrigger(DResourceWorld floor) {
|
||||||
this.floor = floor;
|
this.floor = floor;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -46,7 +46,7 @@ public class ProgressTrigger extends Trigger {
|
|||||||
/**
|
/**
|
||||||
* @return the specific floor that must be finished
|
* @return the specific floor that must be finished
|
||||||
*/
|
*/
|
||||||
public ResourceWorld getFloor() {
|
public DResourceWorld getFloor() {
|
||||||
return floor;
|
return floor;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -54,7 +54,7 @@ public class ProgressTrigger extends Trigger {
|
|||||||
* @param floor
|
* @param floor
|
||||||
* the specific floor to set
|
* the specific floor to set
|
||||||
*/
|
*/
|
||||||
public void setFloor(ResourceWorld floor) {
|
public void setFloor(DResourceWorld floor) {
|
||||||
this.floor = floor;
|
this.floor = floor;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -107,15 +107,15 @@ public class ProgressTrigger extends Trigger {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/* Statics */
|
/* Statics */
|
||||||
public static ProgressTrigger getOrCreate(int floorCount, int waveCount, GameWorld gameWorld) {
|
public static ProgressTrigger getOrCreate(int floorCount, int waveCount, DGameWorld gameWorld) {
|
||||||
if (floorCount == 0 & waveCount == 0 || floorCount < 0 || waveCount < 0) {
|
if (floorCount == 0 & waveCount == 0 || floorCount < 0 || waveCount < 0) {
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
return new ProgressTrigger(floorCount, waveCount);
|
return new ProgressTrigger(floorCount, waveCount);
|
||||||
}
|
}
|
||||||
|
|
||||||
public static ProgressTrigger getOrCreate(String floor, GameWorld gameWorld) {
|
public static ProgressTrigger getOrCreate(String floor, DGameWorld gameWorld) {
|
||||||
ResourceWorld resource = plugin.getWorlds().getResourceByName(floor);
|
DResourceWorld resource = plugin.getDWorlds().getResourceByName(floor);
|
||||||
|
|
||||||
if (resource != null) {
|
if (resource != null) {
|
||||||
return new ProgressTrigger(resource);
|
return new ProgressTrigger(resource);
|
||||||
@ -125,7 +125,7 @@ public class ProgressTrigger extends Trigger {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public static Set<ProgressTrigger> getByGameWorld(GameWorld gameWorld) {
|
public static Set<ProgressTrigger> getByGameWorld(DGameWorld gameWorld) {
|
||||||
Set<ProgressTrigger> toReturn = new HashSet<>();
|
Set<ProgressTrigger> toReturn = new HashSet<>();
|
||||||
for (Trigger trigger : gameWorld.getTriggers(TriggerTypeDefault.PROGRESS)) {
|
for (Trigger trigger : gameWorld.getTriggers(TriggerTypeDefault.PROGRESS)) {
|
||||||
toReturn.add((ProgressTrigger) trigger);
|
toReturn.add((ProgressTrigger) trigger);
|
||||||
|
@ -17,7 +17,7 @@
|
|||||||
package io.github.dre2n.dungeonsxl.trigger;
|
package io.github.dre2n.dungeonsxl.trigger;
|
||||||
|
|
||||||
import io.github.dre2n.dungeonsxl.event.trigger.TriggerActionEvent;
|
import io.github.dre2n.dungeonsxl.event.trigger.TriggerActionEvent;
|
||||||
import io.github.dre2n.dungeonsxl.world.GameWorld;
|
import io.github.dre2n.dungeonsxl.world.DGameWorld;
|
||||||
import org.bukkit.Material;
|
import org.bukkit.Material;
|
||||||
import org.bukkit.block.Block;
|
import org.bukkit.block.Block;
|
||||||
import org.bukkit.block.BlockFace;
|
import org.bukkit.block.BlockFace;
|
||||||
@ -62,7 +62,7 @@ public class RedstoneTrigger extends Trigger {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/* Statics */
|
/* Statics */
|
||||||
public static RedstoneTrigger getOrCreate(Sign sign, GameWorld gameWorld) {
|
public static RedstoneTrigger getOrCreate(Sign sign, DGameWorld gameWorld) {
|
||||||
Block rtBlock = null;
|
Block rtBlock = null;
|
||||||
if (sign.getBlock().getType() == Material.WALL_SIGN) {
|
if (sign.getBlock().getType() == Material.WALL_SIGN) {
|
||||||
switch (sign.getData().getData()) {
|
switch (sign.getData().getData()) {
|
||||||
@ -96,7 +96,7 @@ public class RedstoneTrigger extends Trigger {
|
|||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void updateAll(GameWorld gameWorld) {
|
public static void updateAll(DGameWorld gameWorld) {
|
||||||
for (Trigger trigger : gameWorld.getTriggers(TriggerTypeDefault.REDSTONE)) {
|
for (Trigger trigger : gameWorld.getTriggers(TriggerTypeDefault.REDSTONE)) {
|
||||||
((RedstoneTrigger) trigger).onTrigger();
|
((RedstoneTrigger) trigger).onTrigger();
|
||||||
}
|
}
|
||||||
|
@ -17,7 +17,7 @@
|
|||||||
package io.github.dre2n.dungeonsxl.trigger;
|
package io.github.dre2n.dungeonsxl.trigger;
|
||||||
|
|
||||||
import io.github.dre2n.dungeonsxl.event.trigger.TriggerActionEvent;
|
import io.github.dre2n.dungeonsxl.event.trigger.TriggerActionEvent;
|
||||||
import io.github.dre2n.dungeonsxl.world.GameWorld;
|
import io.github.dre2n.dungeonsxl.world.DGameWorld;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @author Frank Baumann, Daniel Saukel
|
* @author Frank Baumann, Daniel Saukel
|
||||||
@ -52,7 +52,7 @@ public class SignTrigger extends Trigger {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/* Statics */
|
/* Statics */
|
||||||
public static SignTrigger getOrCreate(int id, GameWorld gameWorld) {
|
public static SignTrigger getOrCreate(int id, DGameWorld gameWorld) {
|
||||||
SignTrigger trigger = getById(id, gameWorld);
|
SignTrigger trigger = getById(id, gameWorld);
|
||||||
if (trigger != null) {
|
if (trigger != null) {
|
||||||
return trigger;
|
return trigger;
|
||||||
@ -60,7 +60,7 @@ public class SignTrigger extends Trigger {
|
|||||||
return new SignTrigger(id);
|
return new SignTrigger(id);
|
||||||
}
|
}
|
||||||
|
|
||||||
public static SignTrigger getById(int id, GameWorld gameWorld) {
|
public static SignTrigger getById(int id, DGameWorld gameWorld) {
|
||||||
for (Trigger uncasted : gameWorld.getTriggers(TriggerTypeDefault.SIGN)) {
|
for (Trigger uncasted : gameWorld.getTriggers(TriggerTypeDefault.SIGN)) {
|
||||||
SignTrigger trigger = (SignTrigger) uncasted;
|
SignTrigger trigger = (SignTrigger) uncasted;
|
||||||
if (trigger.stId == id) {
|
if (trigger.stId == id) {
|
||||||
|
@ -21,7 +21,7 @@ import io.github.dre2n.commons.util.messageutil.MessageUtil;
|
|||||||
import io.github.dre2n.dungeonsxl.DungeonsXL;
|
import io.github.dre2n.dungeonsxl.DungeonsXL;
|
||||||
import io.github.dre2n.dungeonsxl.event.trigger.TriggerRegistrationEvent;
|
import io.github.dre2n.dungeonsxl.event.trigger.TriggerRegistrationEvent;
|
||||||
import io.github.dre2n.dungeonsxl.sign.DSign;
|
import io.github.dre2n.dungeonsxl.sign.DSign;
|
||||||
import io.github.dre2n.dungeonsxl.world.GameWorld;
|
import io.github.dre2n.dungeonsxl.world.DGameWorld;
|
||||||
import java.lang.reflect.InvocationTargetException;
|
import java.lang.reflect.InvocationTargetException;
|
||||||
import java.lang.reflect.Method;
|
import java.lang.reflect.Method;
|
||||||
import java.util.HashSet;
|
import java.util.HashSet;
|
||||||
@ -113,11 +113,11 @@ public abstract class Trigger {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public void register(GameWorld gameWorld) {
|
public void register(DGameWorld gameWorld) {
|
||||||
gameWorld.addTrigger(this);
|
gameWorld.addTrigger(this);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void unregister(GameWorld gameWorld) {
|
public void unregister(DGameWorld gameWorld) {
|
||||||
gameWorld.removeTrigger(this);
|
gameWorld.removeTrigger(this);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -185,7 +185,7 @@ public abstract class Trigger {
|
|||||||
|
|
||||||
Method method;
|
Method method;
|
||||||
try {
|
try {
|
||||||
method = type.getHandler().getDeclaredMethod("getOrCreate", String.class, GameWorld.class);
|
method = type.getHandler().getDeclaredMethod("getOrCreate", String.class, DGameWorld.class);
|
||||||
trigger = (Trigger) method.invoke(value, dSign.getGameWorld());
|
trigger = (Trigger) method.invoke(value, dSign.getGameWorld());
|
||||||
|
|
||||||
} catch (NoSuchMethodException | SecurityException | IllegalAccessException | IllegalArgumentException | InvocationTargetException exception) {
|
} catch (NoSuchMethodException | SecurityException | IllegalAccessException | IllegalArgumentException | InvocationTargetException exception) {
|
||||||
|
@ -17,7 +17,7 @@
|
|||||||
package io.github.dre2n.dungeonsxl.trigger;
|
package io.github.dre2n.dungeonsxl.trigger;
|
||||||
|
|
||||||
import io.github.dre2n.dungeonsxl.event.trigger.TriggerActionEvent;
|
import io.github.dre2n.dungeonsxl.event.trigger.TriggerActionEvent;
|
||||||
import io.github.dre2n.dungeonsxl.world.GameWorld;
|
import io.github.dre2n.dungeonsxl.world.DGameWorld;
|
||||||
import org.bukkit.Material;
|
import org.bukkit.Material;
|
||||||
import org.bukkit.entity.Player;
|
import org.bukkit.entity.Player;
|
||||||
|
|
||||||
@ -58,7 +58,7 @@ public class UseItemTrigger extends Trigger {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/* Statics */
|
/* Statics */
|
||||||
public static UseItemTrigger getOrCreate(String name, GameWorld gameWorld) {
|
public static UseItemTrigger getOrCreate(String name, DGameWorld gameWorld) {
|
||||||
UseItemTrigger trigger = getByName(name, gameWorld);
|
UseItemTrigger trigger = getByName(name, gameWorld);
|
||||||
if (trigger != null) {
|
if (trigger != null) {
|
||||||
return trigger;
|
return trigger;
|
||||||
@ -66,7 +66,7 @@ public class UseItemTrigger extends Trigger {
|
|||||||
return new UseItemTrigger(name);
|
return new UseItemTrigger(name);
|
||||||
}
|
}
|
||||||
|
|
||||||
public static UseItemTrigger getByName(String name, GameWorld gameWorld) {
|
public static UseItemTrigger getByName(String name, DGameWorld gameWorld) {
|
||||||
for (Trigger uncasted : gameWorld.getTriggers(TriggerTypeDefault.USE_ITEM)) {
|
for (Trigger uncasted : gameWorld.getTriggers(TriggerTypeDefault.USE_ITEM)) {
|
||||||
UseItemTrigger trigger = (UseItemTrigger) uncasted;
|
UseItemTrigger trigger = (UseItemTrigger) uncasted;
|
||||||
if (trigger.name.equalsIgnoreCase(name)) {
|
if (trigger.name.equalsIgnoreCase(name)) {
|
||||||
|
@ -17,7 +17,7 @@
|
|||||||
package io.github.dre2n.dungeonsxl.trigger;
|
package io.github.dre2n.dungeonsxl.trigger;
|
||||||
|
|
||||||
import io.github.dre2n.dungeonsxl.event.trigger.TriggerActionEvent;
|
import io.github.dre2n.dungeonsxl.event.trigger.TriggerActionEvent;
|
||||||
import io.github.dre2n.dungeonsxl.world.GameWorld;
|
import io.github.dre2n.dungeonsxl.world.DGameWorld;
|
||||||
import java.util.HashSet;
|
import java.util.HashSet;
|
||||||
import java.util.Set;
|
import java.util.Set;
|
||||||
|
|
||||||
@ -68,14 +68,14 @@ public class WaveTrigger extends Trigger {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/* Statics */
|
/* Statics */
|
||||||
public static WaveTrigger getOrCreate(double mustKillRate, GameWorld gameWorld) {
|
public static WaveTrigger getOrCreate(double mustKillRate, DGameWorld gameWorld) {
|
||||||
return new WaveTrigger(mustKillRate);
|
return new WaveTrigger(mustKillRate);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @return the WaveTriggers in the GameWorld
|
* @return the WaveTriggers in the DGameWorld
|
||||||
*/
|
*/
|
||||||
public static Set<WaveTrigger> getByGameWorld(GameWorld gameWorld) {
|
public static Set<WaveTrigger> getByGameWorld(DGameWorld gameWorld) {
|
||||||
Set<WaveTrigger> toReturn = new HashSet<>();
|
Set<WaveTrigger> toReturn = new HashSet<>();
|
||||||
for (Trigger trigger : gameWorld.getTriggers()) {
|
for (Trigger trigger : gameWorld.getTriggers()) {
|
||||||
toReturn.add((WaveTrigger) trigger);
|
toReturn.add((WaveTrigger) trigger);
|
||||||
|
@ -32,13 +32,13 @@ import org.bukkit.entity.Player;
|
|||||||
/**
|
/**
|
||||||
* @author Frank Baumann, Daniel Saukel
|
* @author Frank Baumann, Daniel Saukel
|
||||||
*/
|
*/
|
||||||
public class EditWorld extends InstanceWorld {
|
public class DEditWorld extends DInstanceWorld {
|
||||||
|
|
||||||
static Worlds worlds = plugin.getWorlds();
|
static DWorlds worlds = plugin.getDWorlds();
|
||||||
|
|
||||||
private CopyOnWriteArrayList<Block> signs = new CopyOnWriteArrayList<>();
|
private CopyOnWriteArrayList<Block> signs = new CopyOnWriteArrayList<>();
|
||||||
|
|
||||||
EditWorld(ResourceWorld resourceWorld, File folder, World world, int id) {
|
DEditWorld(DResourceWorld resourceWorld, File folder, World world, int id) {
|
||||||
super(resourceWorld, folder, world, id);
|
super(resourceWorld, folder, world, id);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -144,9 +144,9 @@ public class EditWorld extends InstanceWorld {
|
|||||||
* @param world
|
* @param world
|
||||||
* the instance
|
* the instance
|
||||||
* @return
|
* @return
|
||||||
* the EditWorld that represents the world
|
* the DEditWorld that represents the world
|
||||||
*/
|
*/
|
||||||
public static EditWorld getByWorld(World world) {
|
public static DEditWorld getByWorld(World world) {
|
||||||
return getByName(world.getName());
|
return getByName(world.getName());
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -154,13 +154,13 @@ public class EditWorld extends InstanceWorld {
|
|||||||
* @param world
|
* @param world
|
||||||
* the instance name
|
* the instance name
|
||||||
* @return
|
* @return
|
||||||
* the EditWorld that represents the world
|
* the DEditWorld that represents the world
|
||||||
*/
|
*/
|
||||||
public static EditWorld getByName(String name) {
|
public static DEditWorld getByName(String name) {
|
||||||
InstanceWorld instance = worlds.getInstanceByName(name);
|
DInstanceWorld instance = worlds.getInstanceByName(name);
|
||||||
|
|
||||||
if (instance instanceof EditWorld) {
|
if (instance instanceof DEditWorld) {
|
||||||
return (EditWorld) instance;
|
return (DEditWorld) instance;
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
return null;
|
return null;
|
@ -52,7 +52,7 @@ import org.bukkit.inventory.ItemStack;
|
|||||||
/**
|
/**
|
||||||
* @author Frank Baumann, Milan Albrecht, Daniel Saukel
|
* @author Frank Baumann, Milan Albrecht, Daniel Saukel
|
||||||
*/
|
*/
|
||||||
public class GameWorld extends InstanceWorld {
|
public class DGameWorld extends DInstanceWorld {
|
||||||
|
|
||||||
// Variables
|
// Variables
|
||||||
private boolean tutorial;
|
private boolean tutorial;
|
||||||
@ -68,13 +68,13 @@ public class GameWorld extends InstanceWorld {
|
|||||||
private CopyOnWriteArrayList<DSign> dSigns = new CopyOnWriteArrayList<>();
|
private CopyOnWriteArrayList<DSign> dSigns = new CopyOnWriteArrayList<>();
|
||||||
private CopyOnWriteArrayList<Trigger> triggers = new CopyOnWriteArrayList<>();
|
private CopyOnWriteArrayList<Trigger> triggers = new CopyOnWriteArrayList<>();
|
||||||
|
|
||||||
GameWorld(ResourceWorld resourceWorld, File folder, World world, int id) {
|
DGameWorld(DResourceWorld resourceWorld, File folder, World world, int id) {
|
||||||
super(resourceWorld, folder, world, id);
|
super(resourceWorld, folder, world, id);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @return
|
* @return
|
||||||
* the Game connected to the GameWorld
|
* the Game connected to the DGameWorld
|
||||||
*/
|
*/
|
||||||
public Game getGame() {
|
public Game getGame() {
|
||||||
for (Game game : plugin.getGames()) {
|
for (Game game : plugin.getGames()) {
|
||||||
@ -95,7 +95,7 @@ public class GameWorld extends InstanceWorld {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* @param tutorial
|
* @param tutorial
|
||||||
* if the GameWorld is the tutorial
|
* if the DGameWorld is the tutorial
|
||||||
*/
|
*/
|
||||||
public void setTutorial(boolean tutorial) {
|
public void setTutorial(boolean tutorial) {
|
||||||
this.tutorial = tutorial;
|
this.tutorial = tutorial;
|
||||||
@ -335,7 +335,7 @@ public class GameWorld extends InstanceWorld {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @return the Dungeon that contains the GameWorld
|
* @return the Dungeon that contains the DGameWorld
|
||||||
*/
|
*/
|
||||||
public Dungeon getDungeon() {
|
public Dungeon getDungeon() {
|
||||||
for (Dungeon dungeon : plugin.getDungeons().getDungeons()) {
|
for (Dungeon dungeon : plugin.getDungeons().getDungeons()) {
|
||||||
@ -393,7 +393,7 @@ public class GameWorld extends InstanceWorld {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
plugin.getWorlds().getInstances().remove(this);
|
plugin.getDWorlds().getInstances().remove(this);
|
||||||
plugin.getServer().unloadWorld(getWorld(), true);
|
plugin.getServer().unloadWorld(getWorld(), true);
|
||||||
FileUtil.removeDirectory(getFolder());
|
FileUtil.removeDirectory(getFolder());
|
||||||
|
|
||||||
@ -434,11 +434,11 @@ public class GameWorld extends InstanceWorld {
|
|||||||
* @return
|
* @return
|
||||||
* the EditWorld that represents the world
|
* the EditWorld that represents the world
|
||||||
*/
|
*/
|
||||||
public static GameWorld getByWorld(World world) {
|
public static DGameWorld getByWorld(World world) {
|
||||||
InstanceWorld instance = plugin.getWorlds().getInstanceByName(world.getName());
|
DInstanceWorld instance = plugin.getDWorlds().getInstanceByName(world.getName());
|
||||||
|
|
||||||
if (instance instanceof GameWorld) {
|
if (instance instanceof DGameWorld) {
|
||||||
return (GameWorld) instance;
|
return (DGameWorld) instance;
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
return null;
|
return null;
|
@ -28,21 +28,21 @@ import org.bukkit.World;
|
|||||||
/**
|
/**
|
||||||
* @author Daniel Saukel
|
* @author Daniel Saukel
|
||||||
*/
|
*/
|
||||||
public abstract class InstanceWorld {
|
public abstract class DInstanceWorld {
|
||||||
|
|
||||||
protected static DungeonsXL plugin = DungeonsXL.getInstance();
|
protected static DungeonsXL plugin = DungeonsXL.getInstance();
|
||||||
protected static Worlds worlds = plugin.getWorlds();
|
protected static DWorlds worlds = plugin.getDWorlds();
|
||||||
|
|
||||||
public static String ID_FILE_PREFIX = ".id_";
|
public static String ID_FILE_PREFIX = ".id_";
|
||||||
|
|
||||||
private ResourceWorld resourceWorld;
|
private DResourceWorld resourceWorld;
|
||||||
private File folder;
|
private File folder;
|
||||||
private World world;
|
private World world;
|
||||||
private File idFile;
|
private File idFile;
|
||||||
private int id;
|
private int id;
|
||||||
private Location lobby;
|
private Location lobby;
|
||||||
|
|
||||||
InstanceWorld(ResourceWorld resourceWorld, File folder, World world, int id) {
|
DInstanceWorld(DResourceWorld resourceWorld, File folder, World world, int id) {
|
||||||
this.resourceWorld = resourceWorld;
|
this.resourceWorld = resourceWorld;
|
||||||
this.folder = folder;
|
this.folder = folder;
|
||||||
this.world = world;
|
this.world = world;
|
||||||
@ -53,7 +53,7 @@ public abstract class InstanceWorld {
|
|||||||
|
|
||||||
/* Getters and setters */
|
/* Getters and setters */
|
||||||
/**
|
/**
|
||||||
* @return the name of the ResourceWorld
|
* @return the name of the DResourceWorld
|
||||||
*/
|
*/
|
||||||
public String getName() {
|
public String getName() {
|
||||||
return resourceWorld.getName();
|
return resourceWorld.getName();
|
||||||
@ -67,9 +67,9 @@ public abstract class InstanceWorld {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @return the ResourceWorld of that this world is an instance
|
* @return the DResourceWorld of that this world is an instance
|
||||||
*/
|
*/
|
||||||
public ResourceWorld getResource() {
|
public DResourceWorld getResource() {
|
||||||
return resourceWorld;
|
return resourceWorld;
|
||||||
}
|
}
|
||||||
|
|
@ -34,16 +34,16 @@ import org.bukkit.WorldType;
|
|||||||
*
|
*
|
||||||
* @author Daniel Saukel
|
* @author Daniel Saukel
|
||||||
*/
|
*/
|
||||||
public class ResourceWorld {
|
public class DResourceWorld {
|
||||||
|
|
||||||
DungeonsXL plugin = DungeonsXL.getInstance();
|
DungeonsXL plugin = DungeonsXL.getInstance();
|
||||||
Worlds worlds = plugin.getWorlds();
|
DWorlds worlds = plugin.getDWorlds();
|
||||||
|
|
||||||
private File folder;
|
private File folder;
|
||||||
private WorldConfig config;
|
private WorldConfig config;
|
||||||
private SignData signData;
|
private SignData signData;
|
||||||
|
|
||||||
public ResourceWorld(String name) {
|
public DResourceWorld(String name) {
|
||||||
folder = new File(DungeonsXL.MAPS, name);
|
folder = new File(DungeonsXL.MAPS, name);
|
||||||
if (!folder.exists()) {
|
if (!folder.exists()) {
|
||||||
folder.mkdir();
|
folder.mkdir();
|
||||||
@ -64,7 +64,7 @@ public class ResourceWorld {
|
|||||||
worlds.addResource(this);
|
worlds.addResource(this);
|
||||||
}
|
}
|
||||||
|
|
||||||
public ResourceWorld(File folder) {
|
public DResourceWorld(File folder) {
|
||||||
this.folder = folder;
|
this.folder = folder;
|
||||||
|
|
||||||
File configFile = new File(folder, "config.yml");
|
File configFile = new File(folder, "config.yml");
|
||||||
@ -144,7 +144,7 @@ public class ResourceWorld {
|
|||||||
|
|
||||||
DEditPlayer editPlayer = DEditPlayer.getByName(player.getName());
|
DEditPlayer editPlayer = DEditPlayer.getByName(player.getName());
|
||||||
if (editPlayer != null) {
|
if (editPlayer != null) {
|
||||||
if (EditWorld.getByWorld(editPlayer.getWorld()).getResource() == this) {
|
if (DEditWorld.getByWorld(editPlayer.getWorld()).getResource() == this) {
|
||||||
editPlayer.leave();
|
editPlayer.leave();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -167,10 +167,10 @@ public class ResourceWorld {
|
|||||||
/* Actions */
|
/* Actions */
|
||||||
/**
|
/**
|
||||||
* @param game
|
* @param game
|
||||||
* whether the instance is a GameWorld
|
* whether the instance is a DGameWorld
|
||||||
* @return an instance of this world
|
* @return an instance of this world
|
||||||
*/
|
*/
|
||||||
public InstanceWorld instantiate(boolean game) {
|
public DInstanceWorld instantiate(boolean game) {
|
||||||
int id = worlds.generateId();
|
int id = worlds.generateId();
|
||||||
String name = worlds.generateName(game);
|
String name = worlds.generateName(game);
|
||||||
File instanceFolder = new File(Bukkit.getWorldContainer(), name);
|
File instanceFolder = new File(Bukkit.getWorldContainer(), name);
|
||||||
@ -182,15 +182,15 @@ public class ResourceWorld {
|
|||||||
|
|
||||||
World world = plugin.getServer().createWorld(WorldCreator.name(name));
|
World world = plugin.getServer().createWorld(WorldCreator.name(name));
|
||||||
|
|
||||||
InstanceWorld instance = null;
|
DInstanceWorld instance = null;
|
||||||
try {
|
try {
|
||||||
if (game) {
|
if (game) {
|
||||||
new GameWorld(this, instanceFolder, world, id);
|
new DGameWorld(this, instanceFolder, world, id);
|
||||||
signData.deserializeSigns((GameWorld) instance);
|
signData.deserializeSigns((DGameWorld) instance);
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
new EditWorld(this, instanceFolder, world, id);
|
new DEditWorld(this, instanceFolder, world, id);
|
||||||
signData.deserializeSigns((EditWorld) instance);
|
signData.deserializeSigns((DEditWorld) instance);
|
||||||
}
|
}
|
||||||
|
|
||||||
} catch (IOException exception) {
|
} catch (IOException exception) {
|
||||||
@ -203,23 +203,23 @@ public class ResourceWorld {
|
|||||||
/**
|
/**
|
||||||
* @return an instance of this world
|
* @return an instance of this world
|
||||||
*/
|
*/
|
||||||
public EditWorld instantiateAsEditWorld() {
|
public DEditWorld instantiateAsEditWorld() {
|
||||||
return (EditWorld) instantiate(false);
|
return (DEditWorld) instantiate(false);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @return an instance of this world
|
* @return an instance of this world
|
||||||
*/
|
*/
|
||||||
public GameWorld instantiateAsGameWorld() {
|
public DGameWorld instantiateAsGameWorld() {
|
||||||
return (GameWorld) instantiate(true);
|
return (DGameWorld) instantiate(true);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Generate a new ResourceWorld.
|
* Generate a new DResourceWorld.
|
||||||
*
|
*
|
||||||
* @return the automatically created EditWorld instance
|
* @return the automatically created DEditWorld instance
|
||||||
*/
|
*/
|
||||||
public EditWorld generate() {
|
public DEditWorld generate() {
|
||||||
String name = worlds.generateName(false);
|
String name = worlds.generateName(false);
|
||||||
WorldCreator creator = WorldCreator.name(name);
|
WorldCreator creator = WorldCreator.name(name);
|
||||||
creator.type(WorldType.FLAT);
|
creator.type(WorldType.FLAT);
|
||||||
@ -236,7 +236,7 @@ public class ResourceWorld {
|
|||||||
File folder = new File(Bukkit.getWorldContainer(), name);
|
File folder = new File(Bukkit.getWorldContainer(), name);
|
||||||
World world = plugin.getServer().createWorld(creator);
|
World world = plugin.getServer().createWorld(creator);
|
||||||
|
|
||||||
EditWorld editWorld = new EditWorld(this, folder, world, id);
|
DEditWorld editWorld = new DEditWorld(this, folder, world, id);
|
||||||
editWorld.generateIdFile();
|
editWorld.generateIdFile();
|
||||||
|
|
||||||
return editWorld;
|
return editWorld;
|
@ -27,25 +27,25 @@ import org.bukkit.Bukkit;
|
|||||||
/**
|
/**
|
||||||
* @author Daniel Saukel
|
* @author Daniel Saukel
|
||||||
*/
|
*/
|
||||||
public class Worlds {
|
public class DWorlds {
|
||||||
|
|
||||||
private Set<ResourceWorld> resources;
|
private Set<DResourceWorld> resources;
|
||||||
private Set<InstanceWorld> instances;
|
private Set<DInstanceWorld> instances;
|
||||||
|
|
||||||
public Worlds(File folder) {
|
public DWorlds(File folder) {
|
||||||
for (File file : folder.listFiles()) {
|
for (File file : folder.listFiles()) {
|
||||||
if (file.isDirectory()) {
|
if (file.isDirectory()) {
|
||||||
new ResourceWorld(file);
|
new DResourceWorld(file);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Getters and setters */
|
/* Getters and setters */
|
||||||
/**
|
/**
|
||||||
* @return the ResourceWorld that has this name
|
* @return the DResourceWorld that has this name
|
||||||
*/
|
*/
|
||||||
public ResourceWorld getResourceByName(String name) {
|
public DResourceWorld getResourceByName(String name) {
|
||||||
for (ResourceWorld world : resources) {
|
for (DResourceWorld world : resources) {
|
||||||
if (world.getName().equals(name)) {
|
if (world.getName().equals(name)) {
|
||||||
return world;
|
return world;
|
||||||
}
|
}
|
||||||
@ -55,9 +55,9 @@ public class Worlds {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @return the InstanceWorld that has this name
|
* @return the DInstanceWorld that has this name
|
||||||
*/
|
*/
|
||||||
public InstanceWorld getInstanceByName(String name) {
|
public DInstanceWorld getInstanceByName(String name) {
|
||||||
String[] splitted = name.split("_");
|
String[] splitted = name.split("_");
|
||||||
if (splitted.length != 3) {
|
if (splitted.length != 3) {
|
||||||
return null;
|
return null;
|
||||||
@ -67,10 +67,10 @@ public class Worlds {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @return the InstanceWorld that has this ID
|
* @return the DInstanceWorld that has this ID
|
||||||
*/
|
*/
|
||||||
public InstanceWorld getInstanceById(int id) {
|
public DInstanceWorld getInstanceById(int id) {
|
||||||
for (InstanceWorld world : instances) {
|
for (DInstanceWorld world : instances) {
|
||||||
if (world.getId() == id) {
|
if (world.getId() == id) {
|
||||||
return world;
|
return world;
|
||||||
}
|
}
|
||||||
@ -82,57 +82,57 @@ public class Worlds {
|
|||||||
/**
|
/**
|
||||||
* @return the ResourceWorlds in the maps folder
|
* @return the ResourceWorlds in the maps folder
|
||||||
*/
|
*/
|
||||||
public Set<ResourceWorld> getResources() {
|
public Set<DResourceWorld> getResources() {
|
||||||
return resources;
|
return resources;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param resource
|
* @param resource
|
||||||
* the ResourceWorld to add
|
* the DResourceWorld to add
|
||||||
*/
|
*/
|
||||||
public void addResource(ResourceWorld resource) {
|
public void addResource(DResourceWorld resource) {
|
||||||
resources.add(resource);
|
resources.add(resource);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param resource
|
* @param resource
|
||||||
* the ResourceWorld to remove
|
* the DResourceWorld to remove
|
||||||
*/
|
*/
|
||||||
public void removeResource(ResourceWorld resource) {
|
public void removeResource(DResourceWorld resource) {
|
||||||
resources.remove(resource);
|
resources.remove(resource);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @return the loaded InstanceWorlds in the world container
|
* @return the loaded InstanceWorlds in the world container
|
||||||
*/
|
*/
|
||||||
public Set<InstanceWorld> getInstances() {
|
public Set<DInstanceWorld> getInstances() {
|
||||||
return instances;
|
return instances;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param instance
|
* @param instance
|
||||||
* the InstanceWorld to add
|
* the DInstanceWorld to add
|
||||||
*/
|
*/
|
||||||
public void addInstance(InstanceWorld instance) {
|
public void addInstance(DInstanceWorld instance) {
|
||||||
instances.add(instance);
|
instances.add(instance);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param instance
|
* @param instance
|
||||||
* the InstanceWorld to remove
|
* the DInstanceWorld to remove
|
||||||
*/
|
*/
|
||||||
public void removeInstance(InstanceWorld instance) {
|
public void removeInstance(DInstanceWorld instance) {
|
||||||
instances.remove(instance);
|
instances.remove(instance);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @return the loaded GameWorlds
|
* @return the loaded GameWorlds
|
||||||
*/
|
*/
|
||||||
public Set<GameWorld> getGameWorlds() {
|
public Set<DGameWorld> getGameWorlds() {
|
||||||
Set<GameWorld> gameWorlds = new HashSet<>();
|
Set<DGameWorld> gameWorlds = new HashSet<>();
|
||||||
for (InstanceWorld instance : instances) {
|
for (DInstanceWorld instance : instances) {
|
||||||
if (instance instanceof GameWorld) {
|
if (instance instanceof DGameWorld) {
|
||||||
gameWorlds.add((GameWorld) instance);
|
gameWorlds.add((DGameWorld) instance);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return gameWorlds;
|
return gameWorlds;
|
||||||
@ -141,11 +141,11 @@ public class Worlds {
|
|||||||
/**
|
/**
|
||||||
* @return the loaded EditWorlds
|
* @return the loaded EditWorlds
|
||||||
*/
|
*/
|
||||||
public Set<EditWorld> getEditWorlds() {
|
public Set<DEditWorld> getEditWorlds() {
|
||||||
Set<EditWorld> editWorlds = new HashSet<>();
|
Set<DEditWorld> editWorlds = new HashSet<>();
|
||||||
for (InstanceWorld instance : instances) {
|
for (DInstanceWorld instance : instances) {
|
||||||
if (instance instanceof GameWorld) {
|
if (instance instanceof DGameWorld) {
|
||||||
editWorlds.add((EditWorld) instance);
|
editWorlds.add((DEditWorld) instance);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return editWorlds;
|
return editWorlds;
|
||||||
@ -158,13 +158,13 @@ public class Worlds {
|
|||||||
* if a map with this name exists
|
* if a map with this name exists
|
||||||
*/
|
*/
|
||||||
public boolean exists(String name) {
|
public boolean exists(String name) {
|
||||||
for (ResourceWorld resource : resources) {
|
for (DResourceWorld resource : resources) {
|
||||||
if (resource.getName().equalsIgnoreCase(name)) {
|
if (resource.getName().equalsIgnoreCase(name)) {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
for (InstanceWorld instance : instances) {
|
for (DInstanceWorld instance : instances) {
|
||||||
if (instance.getFolder().getName().equalsIgnoreCase(name)) {
|
if (instance.getFolder().getName().equalsIgnoreCase(name)) {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
@ -200,7 +200,7 @@ public class Worlds {
|
|||||||
* Clean up all instances.
|
* Clean up all instances.
|
||||||
*/
|
*/
|
||||||
public void deleteAllInstances() {
|
public void deleteAllInstances() {
|
||||||
for (InstanceWorld instance : instances) {
|
for (DInstanceWorld instance : instances) {
|
||||||
instance.delete();
|
instance.delete();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -209,7 +209,7 @@ public class Worlds {
|
|||||||
* Saves all EditWorlds.
|
* Saves all EditWorlds.
|
||||||
*/
|
*/
|
||||||
public void saveAll() {
|
public void saveAll() {
|
||||||
for (EditWorld editWorld : getEditWorlds()) {
|
for (DEditWorld editWorld : getEditWorlds()) {
|
||||||
editWorld.save();
|
editWorld.save();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -219,7 +219,7 @@ public class Worlds {
|
|||||||
*/
|
*/
|
||||||
public int generateId() {
|
public int generateId() {
|
||||||
int id = 0;
|
int id = 0;
|
||||||
for (InstanceWorld instance : instances) {
|
for (DInstanceWorld instance : instances) {
|
||||||
if (instance.getId() >= id) {
|
if (instance.getId() >= id) {
|
||||||
id = instance.getId() + 1;
|
id = instance.getId() + 1;
|
||||||
}
|
}
|
||||||
@ -231,7 +231,7 @@ public class Worlds {
|
|||||||
* @return a name for the instance
|
* @return a name for the instance
|
||||||
*
|
*
|
||||||
* @param game
|
* @param game
|
||||||
* whether the instance is a GameWorld
|
* whether the instance is a DGameWorld
|
||||||
*/
|
*/
|
||||||
public String generateName(boolean game) {
|
public String generateName(boolean game) {
|
||||||
return "DXL_" + (game ? "Game" : "Edit") + "_" + generateId();
|
return "DXL_" + (game ? "Game" : "Edit") + "_" + generateId();
|
@ -16,7 +16,7 @@
|
|||||||
*/
|
*/
|
||||||
package io.github.dre2n.dungeonsxl.sign;
|
package io.github.dre2n.dungeonsxl.sign;
|
||||||
|
|
||||||
import io.github.dre2n.dungeonsxl.world.GameWorld;
|
import io.github.dre2n.dungeonsxl.world.DGameWorld;
|
||||||
import org.bukkit.block.Sign;
|
import org.bukkit.block.Sign;
|
||||||
import org.bukkit.entity.Player;
|
import org.bukkit.entity.Player;
|
||||||
|
|
||||||
@ -27,7 +27,7 @@ public class CustomSign extends DSign {
|
|||||||
|
|
||||||
private DSignType type = DSignTypeCustom.CUSTOM;
|
private DSignType type = DSignTypeCustom.CUSTOM;
|
||||||
|
|
||||||
public CustomSign(Sign sign, String[] lines, GameWorld gameWorld) {
|
public CustomSign(Sign sign, String[] lines, DGameWorld gameWorld) {
|
||||||
super(sign, lines, gameWorld);
|
super(sign, lines, gameWorld);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -17,7 +17,7 @@
|
|||||||
package io.github.dre2n.dungeonsxl.trigger;
|
package io.github.dre2n.dungeonsxl.trigger;
|
||||||
|
|
||||||
import io.github.dre2n.dungeonsxl.event.trigger.TriggerActionEvent;
|
import io.github.dre2n.dungeonsxl.event.trigger.TriggerActionEvent;
|
||||||
import io.github.dre2n.dungeonsxl.world.GameWorld;
|
import io.github.dre2n.dungeonsxl.world.DGameWorld;
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.HashMap;
|
import java.util.HashMap;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
@ -28,7 +28,7 @@ import org.bukkit.entity.Player;
|
|||||||
*/
|
*/
|
||||||
public class CustomTrigger extends Trigger {
|
public class CustomTrigger extends Trigger {
|
||||||
|
|
||||||
private static Map<GameWorld, ArrayList<CustomTrigger>> triggers = new HashMap<>();
|
private static Map<DGameWorld, ArrayList<CustomTrigger>> triggers = new HashMap<>();
|
||||||
|
|
||||||
private TriggerType type = TriggerTypeCustom.CUSTOM;
|
private TriggerType type = TriggerTypeCustom.CUSTOM;
|
||||||
|
|
||||||
@ -55,7 +55,7 @@ public class CustomTrigger extends Trigger {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void register(GameWorld gameWorld) {
|
public void register(DGameWorld gameWorld) {
|
||||||
if (!hasTriggers(gameWorld)) {
|
if (!hasTriggers(gameWorld)) {
|
||||||
ArrayList<CustomTrigger> list = new ArrayList<>();
|
ArrayList<CustomTrigger> list = new ArrayList<>();
|
||||||
list.add(this);
|
list.add(this);
|
||||||
@ -67,7 +67,7 @@ public class CustomTrigger extends Trigger {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void unregister(GameWorld gameWorld) {
|
public void unregister(DGameWorld gameWorld) {
|
||||||
if (hasTriggers(gameWorld)) {
|
if (hasTriggers(gameWorld)) {
|
||||||
triggers.get(gameWorld).remove(this);
|
triggers.get(gameWorld).remove(this);
|
||||||
}
|
}
|
||||||
@ -78,7 +78,7 @@ public class CustomTrigger extends Trigger {
|
|||||||
return type;
|
return type;
|
||||||
}
|
}
|
||||||
|
|
||||||
public static CustomTrigger getOrCreate(String value, GameWorld gameWorld) {
|
public static CustomTrigger getOrCreate(String value, DGameWorld gameWorld) {
|
||||||
if (triggers.containsKey(gameWorld)) {
|
if (triggers.containsKey(gameWorld)) {
|
||||||
for (CustomTrigger trigger : triggers.get(gameWorld)) {
|
for (CustomTrigger trigger : triggers.get(gameWorld)) {
|
||||||
if (trigger.value.equals(value)) {
|
if (trigger.value.equals(value)) {
|
||||||
@ -90,7 +90,7 @@ public class CustomTrigger extends Trigger {
|
|||||||
return new CustomTrigger(value);
|
return new CustomTrigger(value);
|
||||||
}
|
}
|
||||||
|
|
||||||
public static boolean hasTriggers(GameWorld gameWorld) {
|
public static boolean hasTriggers(DGameWorld gameWorld) {
|
||||||
return !triggers.isEmpty() && triggers.containsKey(gameWorld);
|
return !triggers.isEmpty() && triggers.containsKey(gameWorld);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user