Changes package name, and cleans up code a little bit
This commit is contained in:
parent
f8292f54b7
commit
177f585145
@ -1,43 +1,44 @@
|
||||
package nl.Steffion.BlockHunt;
|
||||
package net.knarcraft.blockhunt;
|
||||
|
||||
import me.libraryaddict.disguise.DisguiseAPI;
|
||||
import me.libraryaddict.disguise.disguisetypes.DisguiseType;
|
||||
import me.libraryaddict.disguise.disguisetypes.MiscDisguise;
|
||||
import nl.Steffion.BlockHunt.Arena.ArenaState;
|
||||
import nl.Steffion.BlockHunt.Commands.CMDCreate;
|
||||
import nl.Steffion.BlockHunt.Commands.CMDHelp;
|
||||
import nl.Steffion.BlockHunt.Commands.CMDInfo;
|
||||
import nl.Steffion.BlockHunt.Commands.CMDJoin;
|
||||
import nl.Steffion.BlockHunt.Commands.CMDTokens;
|
||||
import nl.Steffion.BlockHunt.Commands.CMDleave;
|
||||
import nl.Steffion.BlockHunt.Commands.CMDlist;
|
||||
import nl.Steffion.BlockHunt.Commands.CMDnotfound;
|
||||
import nl.Steffion.BlockHunt.Commands.CMDreload;
|
||||
import nl.Steffion.BlockHunt.Commands.CMDremove;
|
||||
import nl.Steffion.BlockHunt.Commands.CMDset;
|
||||
import nl.Steffion.BlockHunt.Commands.CMDsetwarp;
|
||||
import nl.Steffion.BlockHunt.Commands.CMDshop;
|
||||
import nl.Steffion.BlockHunt.Commands.CMDstart;
|
||||
import nl.Steffion.BlockHunt.Commands.CMDwand;
|
||||
import nl.Steffion.BlockHunt.Listeners.OnBlockBreakEvent;
|
||||
import nl.Steffion.BlockHunt.Listeners.OnBlockPlaceEvent;
|
||||
import nl.Steffion.BlockHunt.Listeners.OnEntityDamageByEntityEvent;
|
||||
import nl.Steffion.BlockHunt.Listeners.OnEntityDamageEvent;
|
||||
import nl.Steffion.BlockHunt.Listeners.OnFoodLevelChangeEvent;
|
||||
import nl.Steffion.BlockHunt.Listeners.OnInventoryClickEvent;
|
||||
import nl.Steffion.BlockHunt.Listeners.OnInventoryCloseEvent;
|
||||
import nl.Steffion.BlockHunt.Listeners.OnPlayerDropItemEvent;
|
||||
import nl.Steffion.BlockHunt.Listeners.OnPlayerInteractEvent;
|
||||
import nl.Steffion.BlockHunt.Listeners.OnPlayerMoveEvent;
|
||||
import nl.Steffion.BlockHunt.Listeners.OnPlayerQuitEvent;
|
||||
import nl.Steffion.BlockHunt.Listeners.OnPlayerSwapHandItemsEvent;
|
||||
import nl.Steffion.BlockHunt.Listeners.OnPlayerTeleportEvent;
|
||||
import nl.Steffion.BlockHunt.Listeners.OnSignChangeEvent;
|
||||
import nl.Steffion.BlockHunt.Managers.CommandManager;
|
||||
import nl.Steffion.BlockHunt.Managers.ConfigManager;
|
||||
import nl.Steffion.BlockHunt.Managers.MessageManager;
|
||||
import nl.Steffion.BlockHunt.Managers.PermissionsManager;
|
||||
import nl.Steffion.BlockHunt.PermissionsC.Permissions;
|
||||
import net.knarcraft.blockhunt.arena.Arena;
|
||||
import net.knarcraft.blockhunt.arena.ArenaHandler;
|
||||
import net.knarcraft.blockhunt.arena.ArenaState;
|
||||
import net.knarcraft.blockhunt.command.CreateCommand;
|
||||
import net.knarcraft.blockhunt.command.HelpCommand;
|
||||
import net.knarcraft.blockhunt.command.InfoCommand;
|
||||
import net.knarcraft.blockhunt.command.JoinCommand;
|
||||
import net.knarcraft.blockhunt.command.LeaveCommand;
|
||||
import net.knarcraft.blockhunt.command.ListCommand;
|
||||
import net.knarcraft.blockhunt.command.NotFoundCommand;
|
||||
import net.knarcraft.blockhunt.command.ReloadCommand;
|
||||
import net.knarcraft.blockhunt.command.RemoveCommand;
|
||||
import net.knarcraft.blockhunt.command.SetCommand;
|
||||
import net.knarcraft.blockhunt.command.SetWarpCommand;
|
||||
import net.knarcraft.blockhunt.command.ShopCommand;
|
||||
import net.knarcraft.blockhunt.command.StartCommand;
|
||||
import net.knarcraft.blockhunt.command.TokensCommand;
|
||||
import net.knarcraft.blockhunt.command.WandCommand;
|
||||
import net.knarcraft.blockhunt.listener.OnBlockBreakEvent;
|
||||
import net.knarcraft.blockhunt.listener.OnBlockPlaceEvent;
|
||||
import net.knarcraft.blockhunt.listener.OnEntityDamageByEntityEvent;
|
||||
import net.knarcraft.blockhunt.listener.OnEntityDamageEvent;
|
||||
import net.knarcraft.blockhunt.listener.OnFoodLevelChangeEvent;
|
||||
import net.knarcraft.blockhunt.listener.OnInventoryClickEvent;
|
||||
import net.knarcraft.blockhunt.listener.OnInventoryCloseEvent;
|
||||
import net.knarcraft.blockhunt.listener.OnPlayerDropItemEvent;
|
||||
import net.knarcraft.blockhunt.listener.OnPlayerInteractEvent;
|
||||
import net.knarcraft.blockhunt.listener.OnPlayerMoveEvent;
|
||||
import net.knarcraft.blockhunt.listener.OnPlayerQuitEvent;
|
||||
import net.knarcraft.blockhunt.listener.OnPlayerSwapHandItemsEvent;
|
||||
import net.knarcraft.blockhunt.listener.OnPlayerTeleportEvent;
|
||||
import net.knarcraft.blockhunt.listener.OnSignChangeEvent;
|
||||
import net.knarcraft.blockhunt.manager.CommandManager;
|
||||
import net.knarcraft.blockhunt.manager.ConfigManager;
|
||||
import net.knarcraft.blockhunt.manager.MessageManager;
|
||||
import net.knarcraft.blockhunt.manager.PermissionsManager;
|
||||
import org.apache.commons.lang.StringUtils;
|
||||
import org.apache.commons.lang.WordUtils;
|
||||
import org.bukkit.Bukkit;
|
||||
@ -140,37 +141,37 @@ public class BlockHunt extends JavaPlugin implements Listener {
|
||||
|
||||
ConfigManager.newFiles();
|
||||
|
||||
CMD = new CommandManager("BlockHunt", "BlockHunt", null, null, Permissions.info, ConfigC.help_info, (Boolean) MemoryStorage.config.get(ConfigC.commandEnabled_info), BlockHuntCMD,
|
||||
new CMDInfo(), null);
|
||||
CMDInfo = new CommandManager("BlockHunt INFO", "BlockHunt", "info", "i", Permissions.info, ConfigC.help_info, (Boolean) MemoryStorage.config.get(ConfigC.commandEnabled_info),
|
||||
BlockHuntCMD, new CMDInfo(), "/BlockHunt [info|i]");
|
||||
CMDHelp = new CommandManager("BlockHunt HELP", "BlockHunt", "help", "h", Permissions.help, ConfigC.help_help, (Boolean) MemoryStorage.config.get(ConfigC.commandEnabled_help),
|
||||
BlockHuntCMD, new CMDHelp(), "/BlockHunt <help|h> [page number]");
|
||||
CMDReload = new CommandManager("BlockHunt RELOAD", "BlockHunt", "reload", "r", Permissions.reload, ConfigC.help_reload,
|
||||
(Boolean) MemoryStorage.config.get(ConfigC.commandEnabled_reload), BlockHuntCMD, new CMDreload(), "/BlockHunt <reload|r>");
|
||||
CMDJoin = new CommandManager("BlockHunt JOIN", "BlockHunt", "join", "j", Permissions.join, ConfigC.help_join, (Boolean) MemoryStorage.config.get(ConfigC.commandEnabled_join),
|
||||
BlockHuntCMD, new CMDJoin(), "/BlockHunt <join|j> <arena name>");
|
||||
CMDLeave = new CommandManager("BlockHunt LEAVE", "BlockHunt", "leave", "l", Permissions.leave, ConfigC.help_leave,
|
||||
(Boolean) MemoryStorage.config.get(ConfigC.commandEnabled_leave), BlockHuntCMD, new CMDleave(), "/BlockHunt <leave|l>");
|
||||
CMDList = new CommandManager("BlockHunt LIST", "BlockHunt", "list", "li", Permissions.list, ConfigC.help_list, (Boolean) MemoryStorage.config.get(ConfigC.commandEnabled_list),
|
||||
BlockHuntCMD, new CMDlist(), "/BlockHunt <list|li>");
|
||||
CMDShop = new CommandManager("BlockHunt SHOP", "BlockHunt", "shop", "sh", Permissions.shop, ConfigC.help_shop, (Boolean) MemoryStorage.config.get(ConfigC.commandEnabled_shop),
|
||||
BlockHuntCMD, new CMDshop(), "/BlockHunt <shop|sh>");
|
||||
CMDStart = new CommandManager("BlockHunt START", "BlockHunt", "start", "go", Permissions.start, ConfigC.help_start,
|
||||
(Boolean) MemoryStorage.config.get(ConfigC.commandEnabled_start), BlockHuntCMD, new CMDstart(), "/BlockHunt <start|go> <arena name>");
|
||||
CMDWand = new CommandManager("BlockHunt WAND", "BlockHunt", "wand", "w", Permissions.create, ConfigC.help_wand, (Boolean) MemoryStorage.config.get(ConfigC.commandEnabled_wand),
|
||||
BlockHuntCMD, new CMDwand(), "/BlockHunt <wand|w>");
|
||||
CMDCreate = new CommandManager("BlockHunt CREATE", "BlockHunt", "create", "c", Permissions.create, ConfigC.help_create,
|
||||
(Boolean) MemoryStorage.config.get(ConfigC.commandEnabled_create), BlockHuntCMD, new CMDCreate(), "/BlockHunt <create|c> <arena name>");
|
||||
CMDSet = new CommandManager("BlockHunt SET", "BlockHunt", "set", "s", Permissions.set, ConfigC.help_set, (Boolean) MemoryStorage.config.get(ConfigC.commandEnabled_set),
|
||||
BlockHuntCMD, new CMDset(), "/BlockHunt <set|s> <arena name>");
|
||||
CMDSetWarp = new CommandManager("BlockHunt SETWARP", "BlockHunt", "setwarp", "sw", Permissions.setwarp, ConfigC.help_setwarp,
|
||||
(Boolean) MemoryStorage.config.get(ConfigC.commandEnabled_setwarp), BlockHuntCMD, new CMDsetwarp(),
|
||||
CMD = new CommandManager("BlockHunt", "BlockHunt", null, null, PermissionsC.Permissions.info, ConfigC.help_info, (Boolean) MemoryStorage.config.get(ConfigC.commandEnabled_info), BlockHuntCMD,
|
||||
new InfoCommand(), null);
|
||||
CMDInfo = new CommandManager("BlockHunt INFO", "BlockHunt", "info", "i", PermissionsC.Permissions.info, ConfigC.help_info, (Boolean) MemoryStorage.config.get(ConfigC.commandEnabled_info),
|
||||
BlockHuntCMD, new InfoCommand(), "/BlockHunt [info|i]");
|
||||
CMDHelp = new CommandManager("BlockHunt HELP", "BlockHunt", "help", "h", PermissionsC.Permissions.help, ConfigC.help_help, (Boolean) MemoryStorage.config.get(ConfigC.commandEnabled_help),
|
||||
BlockHuntCMD, new HelpCommand(), "/BlockHunt <help|h> [page number]");
|
||||
CMDReload = new CommandManager("BlockHunt RELOAD", "BlockHunt", "reload", "r", PermissionsC.Permissions.reload, ConfigC.help_reload,
|
||||
(Boolean) MemoryStorage.config.get(ConfigC.commandEnabled_reload), BlockHuntCMD, new ReloadCommand(), "/BlockHunt <reload|r>");
|
||||
CMDJoin = new CommandManager("BlockHunt JOIN", "BlockHunt", "join", "j", PermissionsC.Permissions.join, ConfigC.help_join, (Boolean) MemoryStorage.config.get(ConfigC.commandEnabled_join),
|
||||
BlockHuntCMD, new JoinCommand(), "/BlockHunt <join|j> <arena name>");
|
||||
CMDLeave = new CommandManager("BlockHunt LEAVE", "BlockHunt", "leave", "l", PermissionsC.Permissions.leave, ConfigC.help_leave,
|
||||
(Boolean) MemoryStorage.config.get(ConfigC.commandEnabled_leave), BlockHuntCMD, new LeaveCommand(), "/BlockHunt <leave|l>");
|
||||
CMDList = new CommandManager("BlockHunt LIST", "BlockHunt", "list", "li", PermissionsC.Permissions.list, ConfigC.help_list, (Boolean) MemoryStorage.config.get(ConfigC.commandEnabled_list),
|
||||
BlockHuntCMD, new ListCommand(), "/BlockHunt <list|li>");
|
||||
CMDShop = new CommandManager("BlockHunt SHOP", "BlockHunt", "shop", "sh", PermissionsC.Permissions.shop, ConfigC.help_shop, (Boolean) MemoryStorage.config.get(ConfigC.commandEnabled_shop),
|
||||
BlockHuntCMD, new ShopCommand(), "/BlockHunt <shop|sh>");
|
||||
CMDStart = new CommandManager("BlockHunt START", "BlockHunt", "start", "go", PermissionsC.Permissions.start, ConfigC.help_start,
|
||||
(Boolean) MemoryStorage.config.get(ConfigC.commandEnabled_start), BlockHuntCMD, new StartCommand(), "/BlockHunt <start|go> <arena name>");
|
||||
CMDWand = new CommandManager("BlockHunt WAND", "BlockHunt", "wand", "w", PermissionsC.Permissions.create, ConfigC.help_wand, (Boolean) MemoryStorage.config.get(ConfigC.commandEnabled_wand),
|
||||
BlockHuntCMD, new WandCommand(), "/BlockHunt <wand|w>");
|
||||
CMDCreate = new CommandManager("BlockHunt CREATE", "BlockHunt", "create", "c", PermissionsC.Permissions.create, ConfigC.help_create,
|
||||
(Boolean) MemoryStorage.config.get(ConfigC.commandEnabled_create), BlockHuntCMD, new CreateCommand(), "/BlockHunt <create|c> <arena name>");
|
||||
CMDSet = new CommandManager("BlockHunt SET", "BlockHunt", "set", "s", PermissionsC.Permissions.set, ConfigC.help_set, (Boolean) MemoryStorage.config.get(ConfigC.commandEnabled_set),
|
||||
BlockHuntCMD, new SetCommand(), "/BlockHunt <set|s> <arena name>");
|
||||
CMDSetWarp = new CommandManager("BlockHunt SETWARP", "BlockHunt", "setwarp", "sw", PermissionsC.Permissions.setwarp, ConfigC.help_setwarp,
|
||||
(Boolean) MemoryStorage.config.get(ConfigC.commandEnabled_setwarp), BlockHuntCMD, new SetWarpCommand(),
|
||||
"/BlockHunt <setwarp|sw> <lobby|hiders|seekers|spawn> <arena name>");
|
||||
CMDRemove = new CommandManager("BlockHunt REMOVE", "BlockHunt", "remove", "delete", Permissions.remove, ConfigC.help_remove,
|
||||
(Boolean) MemoryStorage.config.get(ConfigC.commandEnabled_remove), BlockHuntCMD, new CMDremove(), "/BlockHunt <remove|delete> <arena name>");
|
||||
CMDTokens = new CommandManager("BlockHunt TOKENS", "BlockHunt", "tokens", "t", Permissions.tokens, ConfigC.help_tokens,
|
||||
(Boolean) MemoryStorage.config.get(ConfigC.commandEnabled_tokens), BlockHuntCMD, new CMDTokens(), "/BlockHunt <tokens|t> <set|add|take> <player name> <amount>");
|
||||
CMDRemove = new CommandManager("BlockHunt REMOVE", "BlockHunt", "remove", "delete", PermissionsC.Permissions.remove, ConfigC.help_remove,
|
||||
(Boolean) MemoryStorage.config.get(ConfigC.commandEnabled_remove), BlockHuntCMD, new RemoveCommand(), "/BlockHunt <remove|delete> <arena name>");
|
||||
CMDTokens = new CommandManager("BlockHunt TOKENS", "BlockHunt", "tokens", "t", PermissionsC.Permissions.tokens, ConfigC.help_tokens,
|
||||
(Boolean) MemoryStorage.config.get(ConfigC.commandEnabled_tokens), BlockHuntCMD, new TokensCommand(), "/BlockHunt <tokens|t> <set|add|take> <player name> <amount>");
|
||||
|
||||
if (!getServer().getPluginManager().isPluginEnabled("LibsDisguises")) {
|
||||
MessageManager.broadcastFMessage(ConfigC.error_libsDisguisesNotInstalled);
|
||||
@ -504,7 +505,7 @@ public class BlockHunt extends JavaPlugin implements Listener {
|
||||
}
|
||||
}
|
||||
}
|
||||
new CMDnotfound().execute(player, cmd, label, args);
|
||||
new NotFoundCommand().execute(player, cmd, label, args);
|
||||
return true;
|
||||
}
|
||||
|
@ -1,4 +1,4 @@
|
||||
package nl.Steffion.BlockHunt;
|
||||
package net.knarcraft.blockhunt;
|
||||
/**
|
||||
* Steffion's Engine - Made by Steffion.
|
||||
* <p>
|
||||
@ -11,7 +11,7 @@ package nl.Steffion.BlockHunt;
|
||||
* @author Steffion
|
||||
*/
|
||||
|
||||
import nl.Steffion.BlockHunt.Managers.ConfigManager;
|
||||
import net.knarcraft.blockhunt.manager.ConfigManager;
|
||||
|
||||
public enum ConfigC {
|
||||
|
@ -1,9 +1,9 @@
|
||||
package nl.Steffion.BlockHunt;
|
||||
package net.knarcraft.blockhunt;
|
||||
|
||||
import nl.Steffion.BlockHunt.Arena.ArenaType;
|
||||
import nl.Steffion.BlockHunt.Managers.MessageManager;
|
||||
import nl.Steffion.BlockHunt.Managers.PermissionsManager;
|
||||
import nl.Steffion.BlockHunt.PermissionsC.Permissions;
|
||||
import net.knarcraft.blockhunt.arena.Arena;
|
||||
import net.knarcraft.blockhunt.arena.ArenaProperty;
|
||||
import net.knarcraft.blockhunt.manager.MessageManager;
|
||||
import net.knarcraft.blockhunt.manager.PermissionsManager;
|
||||
import org.bukkit.Bukkit;
|
||||
import org.bukkit.Material;
|
||||
import org.bukkit.entity.Player;
|
||||
@ -93,32 +93,32 @@ public class InventoryHandler {
|
||||
|
||||
//
|
||||
|
||||
updownButton(panel, arena, ArenaType.maxPlayers, "maxPlayers", "1", maxPlayers_UP, maxPlayers, maxPlayers_DOWN, 1, 10, 19);
|
||||
updownButton(panel, arena, ArenaProperty.MAX_PLAYERS, "maxPlayers", "1", maxPlayers_UP, maxPlayers, maxPlayers_DOWN, 1, 10, 19);
|
||||
|
||||
updownButton(panel, arena, ArenaType.minPlayers, "minPlayers", "1", minPlayers_UP, minPlayers, minPlayers_DOWN, 2, 11, 20);
|
||||
updownButton(panel, arena, ArenaProperty.MIN_PLAYERS, "minPlayers", "1", minPlayers_UP, minPlayers, minPlayers_DOWN, 2, 11, 20);
|
||||
|
||||
updownButton(panel, arena, ArenaType.amountSeekersOnStart, "amountSeekersOnStart", "1", amountSeekersOnStart_UP, amountSeekersOnStart,
|
||||
updownButton(panel, arena, ArenaProperty.AMOUNT_SEEKERS_ON_START, "amountSeekersOnStart", "1", amountSeekersOnStart_UP, amountSeekersOnStart,
|
||||
amountSeekersOnStart_DOWN, 4, 13, 22);
|
||||
|
||||
updownButton(panel, arena, ArenaType.timeInLobbyUntilStart, "timeInLobbyUntilStart", "1 %Nsecond", timeInLobbyUntilStart_UP, timeInLobbyUntilStart,
|
||||
updownButton(panel, arena, ArenaProperty.TIME_IN_LOBBY_UNTIL_START, "timeInLobbyUntilStart", "1 %Nsecond", timeInLobbyUntilStart_UP, timeInLobbyUntilStart,
|
||||
timeInLobbyUntilStart_DOWN, 6, 15, 24);
|
||||
|
||||
updownButton(panel, arena, ArenaType.waitingTimeSeeker, "waitingTimeSeeker", "1 %Nsecond", waitingTimeSeeker_UP, waitingTimeSeeker, waitingTimeSeeker_DOWN,
|
||||
updownButton(panel, arena, ArenaProperty.WAITING_TIME_SEEKER, "waitingTimeSeeker", "1 %Nsecond", waitingTimeSeeker_UP, waitingTimeSeeker, waitingTimeSeeker_DOWN,
|
||||
7, 16, 25);
|
||||
|
||||
updownButton(panel, arena, ArenaType.gameTime, "gameTime", "1 %Nsecond", gameTime_UP, gameTime, gameTime_DOWN, 8, 17, 26);
|
||||
updownButton(panel, arena, ArenaProperty.GAME_TIME, "gameTime", "1 %Nsecond", gameTime_UP, gameTime, gameTime_DOWN, 8, 17, 26);
|
||||
|
||||
updownButton(panel, arena, ArenaType.blockAnnouncerTime, "blockAnnouncerTime", "5 %Nseconds", blockAnnouncerTime_UP, blockAnnouncerTime,
|
||||
updownButton(panel, arena, ArenaProperty.BLOCK_ANNOUNCER_TIME, "blockAnnouncerTime", "5 %Nseconds", blockAnnouncerTime_UP, blockAnnouncerTime,
|
||||
blockAnnouncerTime_DOWN, 29, 38, 47);
|
||||
|
||||
updownButton(panel, arena, ArenaType.timeUntilHidersSword, "timeUntilHidersSword", "1 %Nsecond", timeUntilHidersSword_UP, timeUntilHidersSword,
|
||||
updownButton(panel, arena, ArenaProperty.TIME_UNTIL_HIDERS_SWORD, "timeUntilHidersSword", "1 %Nsecond", timeUntilHidersSword_UP, timeUntilHidersSword,
|
||||
timeUntilHidersSword_DOWN, 30, 39, 48);
|
||||
|
||||
updownButton(panel, arena, ArenaType.hidersTokenWin, "hidersTokenWin", "1 %Ntoken", hidersTokenWin_UP, hidersTokenWin, hidersTokenWin_DOWN, 32, 41, 50);
|
||||
updownButton(panel, arena, ArenaProperty.HIDERS_TOKEN_WIN, "hidersTokenWin", "1 %Ntoken", hidersTokenWin_UP, hidersTokenWin, hidersTokenWin_DOWN, 32, 41, 50);
|
||||
|
||||
updownButton(panel, arena, ArenaType.seekersTokenWin, "seekersTokenWin", "1 %Ntoken", seekersTokenWin_UP, seekersTokenWin, seekersTokenWin_DOWN, 33, 42, 51);
|
||||
updownButton(panel, arena, ArenaProperty.SEEKERS_TOKEN_WIN, "seekersTokenWin", "1 %Ntoken", seekersTokenWin_UP, seekersTokenWin, seekersTokenWin_DOWN, 33, 42, 51);
|
||||
|
||||
updownButton(panel, arena, ArenaType.killTokens, "killTokens", "1 %Ntoken", killTokens_UP, killTokens, killTokens_DOWN, 34, 43, 52);
|
||||
updownButton(panel, arena, ArenaProperty.KILL_TOKENS, "killTokens", "1 %Ntoken", killTokens_UP, killTokens, killTokens_DOWN, 34, 43, 52);
|
||||
|
||||
player.openInventory(panel);
|
||||
} else {
|
||||
@ -126,24 +126,24 @@ public class InventoryHandler {
|
||||
}
|
||||
}
|
||||
|
||||
public static void updownButton(Inventory panel, Arena arena, ArenaType at, String option, String addremove, ItemStack UP, ItemStack BUTTON, ItemStack DOWN, int up,
|
||||
public static void updownButton(Inventory panel, Arena arena, ArenaProperty at, String option, String addremove, ItemStack UP, ItemStack BUTTON, ItemStack DOWN, int up,
|
||||
int button, int down) {
|
||||
ItemMeta UP_IM = UP.getItemMeta();
|
||||
UP_IM.setDisplayName(MessageManager.replaceAll((String) MemoryStorage.messages.get(ConfigC.button_add), "1-" + addremove, "2-" + option));
|
||||
UP.setItemMeta(UP_IM);
|
||||
|
||||
int setting = switch (at) {
|
||||
case maxPlayers -> arena.maxPlayers;
|
||||
case minPlayers -> arena.minPlayers;
|
||||
case amountSeekersOnStart -> arena.amountSeekersOnStart;
|
||||
case timeInLobbyUntilStart -> arena.timeInLobbyUntilStart;
|
||||
case waitingTimeSeeker -> arena.waitingTimeSeeker;
|
||||
case gameTime -> arena.gameTime;
|
||||
case timeUntilHidersSword -> arena.timeUntilHidersSword;
|
||||
case blockAnnouncerTime -> arena.blockAnnouncerTime;
|
||||
case hidersTokenWin -> arena.hidersTokenWin;
|
||||
case seekersTokenWin -> arena.seekersTokenWin;
|
||||
case killTokens -> arena.killTokens;
|
||||
case MAX_PLAYERS -> arena.maxPlayers;
|
||||
case MIN_PLAYERS -> arena.minPlayers;
|
||||
case AMOUNT_SEEKERS_ON_START -> arena.amountSeekersOnStart;
|
||||
case TIME_IN_LOBBY_UNTIL_START -> arena.timeInLobbyUntilStart;
|
||||
case WAITING_TIME_SEEKER -> arena.waitingTimeSeeker;
|
||||
case GAME_TIME -> arena.gameTime;
|
||||
case TIME_UNTIL_HIDERS_SWORD -> arena.timeUntilHidersSword;
|
||||
case BLOCK_ANNOUNCER_TIME -> arena.blockAnnouncerTime;
|
||||
case HIDERS_TOKEN_WIN -> arena.hidersTokenWin;
|
||||
case SEEKERS_TOKEN_WIN -> arena.seekersTokenWin;
|
||||
case KILL_TOKENS -> arena.killTokens;
|
||||
default -> 0;
|
||||
};
|
||||
|
||||
@ -225,7 +225,7 @@ public class InventoryHandler {
|
||||
|
||||
shop.setItem(0, shopTokens);
|
||||
if ((Boolean) MemoryStorage.config.get(ConfigC.shop_blockChooserv1Enabled)
|
||||
&& (MemoryStorage.shop.getFile().get(player.getName() + ".blockchooser") == null && !PermissionsManager.hasPerm(player, Permissions.shopblockchooser, false))) {
|
||||
&& (MemoryStorage.shop.getFile().get(player.getName() + ".blockchooser") == null && !PermissionsManager.hasPerm(player, PermissionsC.Permissions.shopblockchooser, false))) {
|
||||
shop.setItem(1, shopBlockChooser);
|
||||
}
|
||||
if ((Boolean) MemoryStorage.config.get(ConfigC.shop_BlockHuntPassv2Enabled)) {
|
@ -1,4 +1,4 @@
|
||||
package nl.Steffion.BlockHunt;
|
||||
package net.knarcraft.blockhunt;
|
||||
|
||||
/**
|
||||
* Steffion's Engine - Made by Steffion.
|
||||
@ -12,8 +12,9 @@ package nl.Steffion.BlockHunt;
|
||||
* @author Steffion
|
||||
*/
|
||||
|
||||
import nl.Steffion.BlockHunt.Managers.CommandManager;
|
||||
import nl.Steffion.BlockHunt.Managers.ConfigManager;
|
||||
import net.knarcraft.blockhunt.arena.Arena;
|
||||
import net.knarcraft.blockhunt.manager.CommandManager;
|
||||
import net.knarcraft.blockhunt.manager.ConfigManager;
|
||||
import org.bukkit.Location;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.inventory.ItemStack;
|
@ -1,4 +1,4 @@
|
||||
package nl.Steffion.BlockHunt;
|
||||
package net.knarcraft.blockhunt;
|
||||
|
||||
/**
|
||||
* Steffion's Engine - Made by Steffion.
|
@ -1,4 +1,4 @@
|
||||
package nl.Steffion.BlockHunt;
|
||||
package net.knarcraft.blockhunt;
|
||||
|
||||
import org.bukkit.GameMode;
|
||||
import org.bukkit.Location;
|
@ -1,4 +1,4 @@
|
||||
package nl.Steffion.BlockHunt;
|
||||
package net.knarcraft.blockhunt;
|
||||
|
||||
import org.bukkit.Location;
|
||||
import org.bukkit.entity.Player;
|
@ -1,7 +1,8 @@
|
||||
package nl.Steffion.BlockHunt;
|
||||
package net.knarcraft.blockhunt;
|
||||
|
||||
import nl.Steffion.BlockHunt.Arena.ArenaState;
|
||||
import nl.Steffion.BlockHunt.Managers.MessageManager;
|
||||
import net.knarcraft.blockhunt.arena.Arena;
|
||||
import net.knarcraft.blockhunt.arena.ArenaState;
|
||||
import net.knarcraft.blockhunt.manager.MessageManager;
|
||||
import org.bukkit.Bukkit;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.scoreboard.DisplaySlot;
|
142
src/main/java/net/knarcraft/blockhunt/SignsHandler.java
Normal file
142
src/main/java/net/knarcraft/blockhunt/SignsHandler.java
Normal file
@ -0,0 +1,142 @@
|
||||
package net.knarcraft.blockhunt;
|
||||
|
||||
import net.knarcraft.blockhunt.arena.Arena;
|
||||
import net.knarcraft.blockhunt.arena.ArenaState;
|
||||
import net.knarcraft.blockhunt.manager.MessageManager;
|
||||
import org.bukkit.Location;
|
||||
import org.bukkit.block.Sign;
|
||||
import org.bukkit.event.block.SignChangeEvent;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
public class SignsHandler {
|
||||
|
||||
public static void createSign(SignChangeEvent event, String[] lines, Location location) {
|
||||
if (lines[1] != null) {
|
||||
if (lines[1].equalsIgnoreCase("leave")) {
|
||||
saveSign("leave", location);
|
||||
} else if (lines[1].equalsIgnoreCase("shop")) {
|
||||
saveSign("shop", location);
|
||||
} else {
|
||||
boolean saved = false;
|
||||
for (Arena arena : MemoryStorage.arenaList) {
|
||||
if (lines[1].equals(arena.arenaName)) {
|
||||
saveSign(arena.arenaName, location);
|
||||
saved = true;
|
||||
}
|
||||
}
|
||||
|
||||
if (!saved) {
|
||||
MessageManager.sendFMessage(event.getPlayer(), ConfigC.error_noArena, "name-" + lines[1]);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private static void saveSign(String key, Location location) {
|
||||
boolean saved = false;
|
||||
int number = 1;
|
||||
while (!saved) {
|
||||
if (MemoryStorage.signs.getFile().get(key + "_" + number) == null) {
|
||||
MemoryStorage.signs.getFile().set(key + "_" + number + ".arenaName", key);
|
||||
MemoryStorage.signs.getFile().set(key + "_" + number + ".location", location);
|
||||
MemoryStorage.signs.save();
|
||||
|
||||
saved = true;
|
||||
} else {
|
||||
number = number + 1;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public static void removeSign(Location location) {
|
||||
//TODO: This seems really inefficient
|
||||
for (String sign : MemoryStorage.signs.getFile().getKeys(false)) {
|
||||
Location loc = (Location) MemoryStorage.signs.getFile().get(sign + ".location");
|
||||
if (loc.equals(location)) {
|
||||
MemoryStorage.signs.getFile().set(sign, null);
|
||||
MemoryStorage.signs.save();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public static boolean isSign(Location location) {
|
||||
for (String sign : MemoryStorage.signs.getFile().getKeys(false)) {
|
||||
Location loc = (Location) MemoryStorage.signs.getFile().get(sign + ".location");
|
||||
if (loc == null) {
|
||||
throw new IllegalArgumentException("Sign location could not be loaded.");
|
||||
}
|
||||
if (loc.equals(location)) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
public static void updateSigns() {
|
||||
//TODO: Instead of this awful method of signs updating every second for no reason, it would be preferable for
|
||||
// sign changes to be directly triggered when its contents changes
|
||||
MemoryStorage.signs.load(); //TODO: This loads from disk once every second which seems unnecessary
|
||||
for (String sign : MemoryStorage.signs.getFile().getKeys(false)) {
|
||||
Location location = (Location) MemoryStorage.signs.getFile().get(sign + ".location");
|
||||
if (location == null) {
|
||||
throw new IllegalArgumentException("Sign location could not be loaded.");
|
||||
}
|
||||
if (location.getWorld() == null) {
|
||||
throw new IllegalArgumentException("Sign world is null!");
|
||||
}
|
||||
|
||||
// check if that area is actually loaded. If not move on.
|
||||
if (!location.getWorld().isChunkLoaded(location.getBlockX() >> 4, location.getBlockZ() >> 4)) {
|
||||
continue;
|
||||
}
|
||||
if (location.getBlock().getState() instanceof Sign signBlock) {
|
||||
String[] lines = signBlock.getLines();
|
||||
if (sign.contains("leave")) {
|
||||
drawSign(MemoryStorage.config.getFile().getStringList(ConfigC.sign_LEAVE.location), signBlock);
|
||||
} else if (sign.contains("shop")) {
|
||||
drawSign(MemoryStorage.config.getFile().getStringList(ConfigC.sign_SHOP.location), signBlock);
|
||||
} else {
|
||||
drawArenaSign(lines[1], signBlock);
|
||||
}
|
||||
} else {
|
||||
removeSign(location);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private static void drawArenaSign(String arenaName, Sign signBlock) {
|
||||
for (Arena arena : MemoryStorage.arenaList) {
|
||||
//Find the correct arena
|
||||
if (!arenaName.endsWith(arena.arenaName)) {
|
||||
continue;
|
||||
}
|
||||
if (arena.gameState.equals(ArenaState.WAITING)) {
|
||||
drawSign(MemoryStorage.config.getFile().getStringList(ConfigC.sign_WAITING.location), signBlock, arena);
|
||||
} else if (arena.gameState.equals(ArenaState.STARTING)) {
|
||||
drawSign(MemoryStorage.config.getFile().getStringList(ConfigC.sign_STARTING.location), signBlock, arena);
|
||||
} else if (arena.gameState.equals(ArenaState.IN_GAME)) {
|
||||
drawSign(MemoryStorage.config.getFile().getStringList(ConfigC.sign_INGAME.location), signBlock, arena);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private static void drawSign(List<String> signLines, Sign signBlock, Arena arena) {
|
||||
drawSign(signLines, signBlock, "arenaname-" + arena.arenaName, "players-" + arena.playersInArena.size(),
|
||||
"maxplayers-" + arena.maxPlayers, "timeleft-" + arena.timer);
|
||||
}
|
||||
|
||||
private static void drawSign(List<String> signLines, Sign signBlock, String... variables) {
|
||||
int lineCount = 0;
|
||||
for (String line : signLines) {
|
||||
if (lineCount <= 3) {
|
||||
signBlock.setLine(lineCount, MessageManager.replaceAll(line, variables));
|
||||
}
|
||||
|
||||
lineCount = lineCount + 1;
|
||||
}
|
||||
signBlock.update();
|
||||
}
|
||||
|
||||
}
|
@ -1,9 +1,9 @@
|
||||
package nl.Steffion.BlockHunt;
|
||||
package net.knarcraft.blockhunt;
|
||||
|
||||
import me.libraryaddict.disguise.DisguiseAPI;
|
||||
import me.libraryaddict.disguise.disguisetypes.DisguiseType;
|
||||
import me.libraryaddict.disguise.disguisetypes.MiscDisguise;
|
||||
import nl.Steffion.BlockHunt.Managers.MessageManager;
|
||||
import net.knarcraft.blockhunt.manager.MessageManager;
|
||||
import org.bukkit.Bukkit;
|
||||
import org.bukkit.ChatColor;
|
||||
import org.bukkit.Material;
|
||||
@ -31,19 +31,20 @@ public class SolidBlockHandler {
|
||||
|
||||
block.setAmount(5);
|
||||
for (Player pl : Bukkit.getOnlinePlayers()) {
|
||||
if (!pl.equals(player)) {
|
||||
if (MemoryStorage.hiddenLocWater.get(player) != null) {
|
||||
if (MemoryStorage.hiddenLocWater.get(player)) {
|
||||
pl.sendBlockChange(pBlock.getLocation(), Bukkit.createBlockData(Material.WATER));
|
||||
} else {
|
||||
pl.sendBlockChange(pBlock.getLocation(), Bukkit.createBlockData(Material.AIR));
|
||||
}
|
||||
if (pl.equals(player)) {
|
||||
continue;
|
||||
}
|
||||
if (MemoryStorage.hiddenLocWater.get(player) != null) {
|
||||
if (MemoryStorage.hiddenLocWater.get(player)) {
|
||||
pl.sendBlockChange(pBlock.getLocation(), Bukkit.createBlockData(Material.WATER));
|
||||
} else {
|
||||
pl.sendBlockChange(pBlock.getLocation(), Bukkit.createBlockData(Material.AIR));
|
||||
}
|
||||
|
||||
MemoryStorage.hiddenLocWater.remove(player);
|
||||
} else {
|
||||
pl.sendBlockChange(pBlock.getLocation(), Bukkit.createBlockData(Material.AIR));
|
||||
}
|
||||
|
||||
MemoryStorage.hiddenLocWater.remove(player);
|
||||
}
|
||||
|
||||
player.playSound(player.getLocation(), Sound.ENTITY_BAT_HURT, 1, 1);
|
||||
@ -58,4 +59,5 @@ public class SolidBlockHandler {
|
||||
|
||||
MessageManager.sendFMessage(player, ConfigC.normal_ingameNoMoreSolid);
|
||||
}
|
||||
|
||||
}
|
@ -1,4 +1,4 @@
|
||||
package nl.Steffion.BlockHunt;
|
||||
package net.knarcraft.blockhunt.arena;
|
||||
|
||||
import org.bukkit.Bukkit;
|
||||
import org.bukkit.Location;
|
||||
@ -7,6 +7,7 @@ import org.bukkit.configuration.serialization.SerializableAs;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.inventory.ItemStack;
|
||||
import org.bukkit.scoreboard.Scoreboard;
|
||||
import org.bukkit.scoreboard.ScoreboardManager;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
|
||||
import java.util.ArrayList;
|
||||
@ -16,6 +17,7 @@ import java.util.Map;
|
||||
|
||||
@SerializableAs("BlockHuntArena")
|
||||
public class Arena implements ConfigurationSerializable {
|
||||
|
||||
public final String arenaName;
|
||||
public final Location pos1;
|
||||
public final Location pos2;
|
||||
@ -32,7 +34,7 @@ public class Arena implements ConfigurationSerializable {
|
||||
public final boolean hidersCanHurtHiders;
|
||||
public final boolean seekersTakeFallDamage;
|
||||
public final boolean hidersTakeFallDamage;
|
||||
public ArrayList<ItemStack> disguiseBlocks;
|
||||
public List<ItemStack> disguiseBlocks;
|
||||
public Location lobbyWarp;
|
||||
public Location hidersWarp;
|
||||
public Location seekersWarp;
|
||||
@ -51,11 +53,14 @@ public class Arena implements ConfigurationSerializable {
|
||||
public final Scoreboard scoreboard;
|
||||
|
||||
public Arena(String arenaName, Location pos1, Location pos2, int maxPlayers, int minPlayers, int amountSeekersOnStart,
|
||||
int timeInLobbyUntilStart, int waitingTimeSeeker, int gameTime, int timeUntilHidersSword, int blockAnnouncerTime,
|
||||
boolean seekersCanHurtSeekers, boolean hidersCanHurtSeekers, boolean hidersCanHurtHiders, boolean seekersTakeFallDamage, boolean hidersTakeFallDamage,
|
||||
ArrayList<ItemStack> disguiseBlocks, Location lobbyWarp, Location hidersWarp, Location seekersWarp, Location spawnWarp,
|
||||
List<String> seekersWinCommands, List<String> hidersWinCommands, List<String> allowedCommands, int seekersTokenWin, int hidersTokenWin, int killTokens,
|
||||
List<Player> playersInArena, ArenaState gameState, int timer, List<Player> seekers, Scoreboard scoreboard) {
|
||||
int timeInLobbyUntilStart, int waitingTimeSeeker, int gameTime, int timeUntilHidersSword,
|
||||
int blockAnnouncerTime, boolean seekersCanHurtSeekers, boolean hidersCanHurtSeekers,
|
||||
boolean hidersCanHurtHiders, boolean seekersTakeFallDamage, boolean hidersTakeFallDamage,
|
||||
List<ItemStack> disguiseBlocks, Location lobbyWarp, Location hidersWarp, Location seekersWarp,
|
||||
Location spawnWarp, List<String> seekersWinCommands, List<String> hidersWinCommands,
|
||||
List<String> allowedCommands, int seekersTokenWin, int hidersTokenWin, int killTokens,
|
||||
List<Player> playersInArena, ArenaState gameState, int timer, List<Player> seekers,
|
||||
Scoreboard scoreboard) {
|
||||
this.arenaName = arenaName;
|
||||
this.pos1 = pos1;
|
||||
this.pos2 = pos2;
|
||||
@ -90,28 +95,6 @@ public class Arena implements ConfigurationSerializable {
|
||||
this.scoreboard = scoreboard;
|
||||
}
|
||||
|
||||
public enum ArenaType {
|
||||
maxPlayers,
|
||||
minPlayers,
|
||||
amountSeekersOnStart,
|
||||
timeInLobbyUntilStart,
|
||||
waitingTimeSeeker,
|
||||
gameTime,
|
||||
timeUntilHidersSword,
|
||||
hidersTokenWin,
|
||||
seekersTokenWin,
|
||||
killTokens,
|
||||
blockAnnouncerTime
|
||||
}
|
||||
|
||||
public enum ArenaState {
|
||||
WAITING,
|
||||
STARTING,
|
||||
IN_GAME,
|
||||
RESTARTING,
|
||||
DISABLED
|
||||
}
|
||||
|
||||
@Override
|
||||
public @NotNull Map<String, Object> serialize() {
|
||||
Map<String, Object> map = new HashMap<>();
|
||||
@ -148,6 +131,11 @@ public class Arena implements ConfigurationSerializable {
|
||||
@SuppressWarnings({"unchecked", "unused"})
|
||||
public static Arena deserialize(Map<String, Object> map) {
|
||||
Location loc = new Location(Bukkit.getWorld("world"), 0, 0, 0, 0, 0);
|
||||
ScoreboardManager scoreboardManager = Bukkit.getScoreboardManager();
|
||||
Scoreboard scoreboard = null;
|
||||
if (scoreboardManager != null) {
|
||||
scoreboard = scoreboardManager.getNewScoreboard();
|
||||
}
|
||||
return new Arena(
|
||||
(String) map.getOrDefault("arenaName", "UNKNOWN_NAME"),
|
||||
(Location) map.getOrDefault("pos1", loc),
|
||||
@ -165,18 +153,19 @@ public class Arena implements ConfigurationSerializable {
|
||||
(Boolean) map.getOrDefault("hidersCanHurtHiders", false),
|
||||
(Boolean) map.getOrDefault("seekersTakeFallDamage", false),
|
||||
(Boolean) map.getOrDefault("hidersTakeFallDamage", false),
|
||||
(ArrayList<ItemStack>) map.getOrDefault("disguiseBlocks", new ArrayList<ItemStack>()),
|
||||
(List<ItemStack>) map.getOrDefault("disguiseBlocks", new ArrayList<ItemStack>()),
|
||||
(Location) map.getOrDefault("lobbyWarp", loc),
|
||||
(Location) map.getOrDefault("hidersWarp", loc),
|
||||
(Location) map.getOrDefault("seekersWarp", loc),
|
||||
(Location) map.getOrDefault("spawnWarp", loc),
|
||||
(ArrayList<String>) map.getOrDefault("seekersWinCommands", new ArrayList<String>()),
|
||||
(ArrayList<String>) map.getOrDefault("hidersWinCommands", new ArrayList<String>()),
|
||||
(ArrayList<String>) map.getOrDefault("allowedCommands", new ArrayList<String>()),
|
||||
(List<String>) map.getOrDefault("seekersWinCommands", new ArrayList<String>()),
|
||||
(List<String>) map.getOrDefault("hidersWinCommands", new ArrayList<String>()),
|
||||
(List<String>) map.getOrDefault("allowedCommands", new ArrayList<String>()),
|
||||
(Integer) map.getOrDefault("seekersTokenWin", 10),
|
||||
(Integer) map.getOrDefault("hidersTokenWin", 50),
|
||||
(Integer) map.getOrDefault("killTokens", 8),
|
||||
new ArrayList<>(), ArenaState.WAITING, 0, new ArrayList<>(), Bukkit.getScoreboardManager().getNewScoreboard()
|
||||
new ArrayList<>(), ArenaState.WAITING, 0, new ArrayList<>(), scoreboard
|
||||
);
|
||||
}
|
||||
|
||||
}
|
@ -1,13 +1,19 @@
|
||||
package nl.Steffion.BlockHunt;
|
||||
package net.knarcraft.blockhunt.arena;
|
||||
|
||||
import me.libraryaddict.disguise.DisguiseAPI;
|
||||
import nl.Steffion.BlockHunt.Arena.ArenaState;
|
||||
import nl.Steffion.BlockHunt.Events.EndArenaEvent;
|
||||
import nl.Steffion.BlockHunt.Events.JoinArenaEvent;
|
||||
import nl.Steffion.BlockHunt.Events.LeaveArenaEvent;
|
||||
import nl.Steffion.BlockHunt.Managers.MessageManager;
|
||||
import nl.Steffion.BlockHunt.Managers.PermissionsManager;
|
||||
import nl.Steffion.BlockHunt.PermissionsC.Permissions;
|
||||
import net.knarcraft.blockhunt.BlockHunt;
|
||||
import net.knarcraft.blockhunt.ConfigC;
|
||||
import net.knarcraft.blockhunt.MemoryStorage;
|
||||
import net.knarcraft.blockhunt.PermissionsC;
|
||||
import net.knarcraft.blockhunt.PlayerArenaData;
|
||||
import net.knarcraft.blockhunt.PlayerHandler;
|
||||
import net.knarcraft.blockhunt.ScoreboardHandler;
|
||||
import net.knarcraft.blockhunt.SignsHandler;
|
||||
import net.knarcraft.blockhunt.event.EndArenaEvent;
|
||||
import net.knarcraft.blockhunt.event.JoinArenaEvent;
|
||||
import net.knarcraft.blockhunt.event.LeaveArenaEvent;
|
||||
import net.knarcraft.blockhunt.manager.MessageManager;
|
||||
import net.knarcraft.blockhunt.manager.PermissionsManager;
|
||||
import org.bukkit.Bukkit;
|
||||
import org.bukkit.GameMode;
|
||||
import org.bukkit.Location;
|
||||
@ -24,6 +30,7 @@ import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
public class ArenaHandler {
|
||||
|
||||
public static void loadArenas() {
|
||||
MemoryStorage.arenaList.clear();
|
||||
for (String arenaName : MemoryStorage.arenas.getFile().getKeys(false)) {
|
||||
@ -53,10 +60,9 @@ public class ArenaHandler {
|
||||
boolean found = false;
|
||||
boolean alreadyJoined = false;
|
||||
for (Arena arena : MemoryStorage.arenaList) {
|
||||
if (arena.playersInArena != null) {
|
||||
if (arena.playersInArena.contains(player)) {
|
||||
alreadyJoined = true;
|
||||
}
|
||||
if (arena.playersInArena != null && arena.playersInArena.contains(player)) {
|
||||
alreadyJoined = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
@ -94,7 +100,7 @@ public class ArenaHandler {
|
||||
if (!arena.lobbyWarp.equals(zero) && !arena.hidersWarp.equals(zero) && !arena.seekersWarp.equals(zero) && !arena.spawnWarp.equals(zero)) {
|
||||
if (arena.gameState == ArenaState.WAITING || arena.gameState == ArenaState.STARTING) {
|
||||
if (arena.playersInArena.size() >= arena.maxPlayers) {
|
||||
if (!PermissionsManager.hasPerm(player, Permissions.joinfull, false)) {
|
||||
if (!PermissionsManager.hasPerm(player, PermissionsC.Permissions.joinfull, false)) {
|
||||
MessageManager.sendFMessage(player, ConfigC.error_joinFull);
|
||||
return;
|
||||
}
|
||||
@ -159,7 +165,7 @@ public class ArenaHandler {
|
||||
|
||||
if ((Boolean) MemoryStorage.config.get(ConfigC.shop_blockChooserv1Enabled)) {
|
||||
if (MemoryStorage.shop.getFile().get(player.getName() + ".blockchooser") != null
|
||||
|| PermissionsManager.hasPerm(player, Permissions.shopblockchooser, false)) {
|
||||
|| PermissionsManager.hasPerm(player, PermissionsC.Permissions.shopblockchooser, false)) {
|
||||
ItemStack shopBlockChooser = new ItemStack(Material.getMaterial((String) MemoryStorage.config.get(ConfigC.shop_blockChooserv1IDname)), 1);
|
||||
ItemMeta shopBlockChooser_IM = shopBlockChooser.getItemMeta();
|
||||
shopBlockChooser_IM.setDisplayName(MessageManager.replaceAll((String) MemoryStorage.config.get(ConfigC.shop_blockChooserv1Name)));
|
||||
@ -201,7 +207,7 @@ public class ArenaHandler {
|
||||
ArenaHandler.sendFMessage(arena, ConfigC.normal_joinJoinedArena, "playername-" + player.getName(),
|
||||
"1-" + arena.playersInArena.size(), "2-" + arena.maxPlayers);
|
||||
if (arena.playersInArena.size() < arena.minPlayers) {
|
||||
ArenaHandler.sendFMessage(arena, ConfigC.warning_lobbyNeedAtleast, "1-" + arena.minPlayers);
|
||||
sendFMessage(arena, ConfigC.warning_lobbyNeedAtleast, "1-" + arena.minPlayers);
|
||||
}
|
||||
} else {
|
||||
MessageManager.sendFMessage(player, ConfigC.error_joinArenaIngame);
|
||||
@ -253,7 +259,7 @@ public class ArenaHandler {
|
||||
arena.gameState = ArenaState.WAITING;
|
||||
arena.timer = 0;
|
||||
|
||||
ArenaHandler.sendFMessage(arena, ConfigC.warning_lobbyNeedAtleast, "1-" + arena.minPlayers);
|
||||
sendFMessage(arena, ConfigC.warning_lobbyNeedAtleast, "1-" + arena.minPlayers);
|
||||
}
|
||||
|
||||
if (arena.playersInArena.size() <= 1 && arena.gameState == ArenaState.IN_GAME) {
|
||||
@ -458,4 +464,5 @@ public class ArenaHandler {
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
}
|
@ -0,0 +1,17 @@
|
||||
package net.knarcraft.blockhunt.arena;
|
||||
|
||||
public enum ArenaProperty {
|
||||
|
||||
MAX_PLAYERS,
|
||||
MIN_PLAYERS,
|
||||
AMOUNT_SEEKERS_ON_START,
|
||||
TIME_IN_LOBBY_UNTIL_START,
|
||||
WAITING_TIME_SEEKER,
|
||||
GAME_TIME,
|
||||
TIME_UNTIL_HIDERS_SWORD,
|
||||
HIDERS_TOKEN_WIN,
|
||||
SEEKERS_TOKEN_WIN,
|
||||
KILL_TOKENS,
|
||||
BLOCK_ANNOUNCER_TIME
|
||||
|
||||
}
|
11
src/main/java/net/knarcraft/blockhunt/arena/ArenaState.java
Normal file
11
src/main/java/net/knarcraft/blockhunt/arena/ArenaState.java
Normal file
@ -0,0 +1,11 @@
|
||||
package net.knarcraft.blockhunt.arena;
|
||||
|
||||
public enum ArenaState {
|
||||
|
||||
WAITING,
|
||||
STARTING,
|
||||
IN_GAME,
|
||||
RESTARTING,
|
||||
DISABLED
|
||||
|
||||
}
|
@ -1,19 +1,19 @@
|
||||
package nl.Steffion.BlockHunt.Commands;
|
||||
package net.knarcraft.blockhunt.command;
|
||||
|
||||
import nl.Steffion.BlockHunt.Arena;
|
||||
import nl.Steffion.BlockHunt.Arena.ArenaState;
|
||||
import nl.Steffion.BlockHunt.BlockHunt;
|
||||
import nl.Steffion.BlockHunt.ConfigC;
|
||||
import nl.Steffion.BlockHunt.Managers.MessageManager;
|
||||
import nl.Steffion.BlockHunt.MemoryStorage;
|
||||
import nl.Steffion.BlockHunt.ScoreboardHandler;
|
||||
import net.knarcraft.blockhunt.BlockHunt;
|
||||
import net.knarcraft.blockhunt.ConfigC;
|
||||
import net.knarcraft.blockhunt.MemoryStorage;
|
||||
import net.knarcraft.blockhunt.ScoreboardHandler;
|
||||
import net.knarcraft.blockhunt.arena.Arena;
|
||||
import net.knarcraft.blockhunt.arena.ArenaState;
|
||||
import net.knarcraft.blockhunt.manager.MessageManager;
|
||||
import org.bukkit.Bukkit;
|
||||
import org.bukkit.command.Command;
|
||||
import org.bukkit.entity.Player;
|
||||
|
||||
import java.util.ArrayList;
|
||||
|
||||
public class CMDCreate extends DefaultCMD {
|
||||
public class CreateCommand extends DefaultCommand {
|
||||
|
||||
@Override
|
||||
public boolean execute(Player player, Command cmd, String label, String[] args) {
|
||||
@ -41,8 +41,6 @@ public class CMDCreate extends DefaultCMD {
|
||||
MessageManager.sendFMessage(player, ConfigC.error_createSelectionFirst);
|
||||
}
|
||||
}
|
||||
} else {
|
||||
MessageManager.sendFMessage(player, ConfigC.error_onlyIngame);
|
||||
}
|
||||
return true;
|
||||
}
|
@ -1,4 +1,4 @@
|
||||
package nl.Steffion.BlockHunt.Commands;
|
||||
package net.knarcraft.blockhunt.command;
|
||||
/**
|
||||
* Steffion's Engine - Made by Steffion.
|
||||
* <p>
|
||||
@ -14,7 +14,7 @@ package nl.Steffion.BlockHunt.Commands;
|
||||
import org.bukkit.command.Command;
|
||||
import org.bukkit.entity.Player;
|
||||
|
||||
public abstract class DefaultCMD {
|
||||
public abstract class DefaultCommand {
|
||||
|
||||
public abstract boolean execute(Player player, Command cmd, String label, String[] args);
|
||||
|
@ -1,4 +1,4 @@
|
||||
package nl.Steffion.BlockHunt.Commands;
|
||||
package net.knarcraft.blockhunt.command;
|
||||
/**
|
||||
* Steffion's Engine - Made by Steffion.
|
||||
* <p>
|
||||
@ -11,16 +11,16 @@ package nl.Steffion.BlockHunt.Commands;
|
||||
* @author Steffion
|
||||
*/
|
||||
|
||||
import nl.Steffion.BlockHunt.BlockHunt;
|
||||
import nl.Steffion.BlockHunt.ConfigC;
|
||||
import nl.Steffion.BlockHunt.Managers.CommandManager;
|
||||
import nl.Steffion.BlockHunt.Managers.MessageManager;
|
||||
import nl.Steffion.BlockHunt.Managers.PermissionsManager;
|
||||
import nl.Steffion.BlockHunt.MemoryStorage;
|
||||
import net.knarcraft.blockhunt.BlockHunt;
|
||||
import net.knarcraft.blockhunt.ConfigC;
|
||||
import net.knarcraft.blockhunt.MemoryStorage;
|
||||
import net.knarcraft.blockhunt.manager.CommandManager;
|
||||
import net.knarcraft.blockhunt.manager.MessageManager;
|
||||
import net.knarcraft.blockhunt.manager.PermissionsManager;
|
||||
import org.bukkit.command.Command;
|
||||
import org.bukkit.entity.Player;
|
||||
|
||||
public class CMDHelp extends DefaultCMD {
|
||||
public class HelpCommand extends DefaultCommand {
|
||||
|
||||
|
||||
@Override
|
@ -1,4 +1,4 @@
|
||||
package nl.Steffion.BlockHunt.Commands;
|
||||
package net.knarcraft.blockhunt.command;
|
||||
/**
|
||||
* Steffion's Engine - Made by Steffion.
|
||||
* <p>
|
||||
@ -11,13 +11,13 @@ package nl.Steffion.BlockHunt.Commands;
|
||||
* @author Steffion
|
||||
*/
|
||||
|
||||
import nl.Steffion.BlockHunt.BlockHunt;
|
||||
import nl.Steffion.BlockHunt.ConfigC;
|
||||
import nl.Steffion.BlockHunt.Managers.MessageManager;
|
||||
import net.knarcraft.blockhunt.BlockHunt;
|
||||
import net.knarcraft.blockhunt.ConfigC;
|
||||
import net.knarcraft.blockhunt.manager.MessageManager;
|
||||
import org.bukkit.command.Command;
|
||||
import org.bukkit.entity.Player;
|
||||
|
||||
public class CMDInfo extends DefaultCMD {
|
||||
public class InfoCommand extends DefaultCommand {
|
||||
|
||||
|
||||
@Override
|
@ -1,13 +1,13 @@
|
||||
package nl.Steffion.BlockHunt.Commands;
|
||||
package net.knarcraft.blockhunt.command;
|
||||
|
||||
import nl.Steffion.BlockHunt.ArenaHandler;
|
||||
import nl.Steffion.BlockHunt.BlockHunt;
|
||||
import nl.Steffion.BlockHunt.ConfigC;
|
||||
import nl.Steffion.BlockHunt.Managers.MessageManager;
|
||||
import net.knarcraft.blockhunt.BlockHunt;
|
||||
import net.knarcraft.blockhunt.ConfigC;
|
||||
import net.knarcraft.blockhunt.arena.ArenaHandler;
|
||||
import net.knarcraft.blockhunt.manager.MessageManager;
|
||||
import org.bukkit.command.Command;
|
||||
import org.bukkit.entity.Player;
|
||||
|
||||
public class CMDJoin extends DefaultCMD {
|
||||
public class JoinCommand extends DefaultCommand {
|
||||
|
||||
@Override
|
||||
public boolean execute(Player player, Command cmd, String label, String[] args) {
|
@ -1,12 +1,12 @@
|
||||
package nl.Steffion.BlockHunt.Commands;
|
||||
package net.knarcraft.blockhunt.command;
|
||||
|
||||
import nl.Steffion.BlockHunt.ArenaHandler;
|
||||
import nl.Steffion.BlockHunt.ConfigC;
|
||||
import nl.Steffion.BlockHunt.Managers.MessageManager;
|
||||
import net.knarcraft.blockhunt.ConfigC;
|
||||
import net.knarcraft.blockhunt.arena.ArenaHandler;
|
||||
import net.knarcraft.blockhunt.manager.MessageManager;
|
||||
import org.bukkit.command.Command;
|
||||
import org.bukkit.entity.Player;
|
||||
|
||||
public class CMDleave extends DefaultCMD {
|
||||
public class LeaveCommand extends DefaultCommand {
|
||||
|
||||
@Override
|
||||
public boolean execute(Player player, Command cmd, String label, String[] args) {
|
@ -1,14 +1,14 @@
|
||||
package nl.Steffion.BlockHunt.Commands;
|
||||
package net.knarcraft.blockhunt.command;
|
||||
|
||||
import nl.Steffion.BlockHunt.Arena;
|
||||
import nl.Steffion.BlockHunt.BlockHunt;
|
||||
import nl.Steffion.BlockHunt.ConfigC;
|
||||
import nl.Steffion.BlockHunt.Managers.MessageManager;
|
||||
import nl.Steffion.BlockHunt.MemoryStorage;
|
||||
import net.knarcraft.blockhunt.BlockHunt;
|
||||
import net.knarcraft.blockhunt.ConfigC;
|
||||
import net.knarcraft.blockhunt.MemoryStorage;
|
||||
import net.knarcraft.blockhunt.arena.Arena;
|
||||
import net.knarcraft.blockhunt.manager.MessageManager;
|
||||
import org.bukkit.command.Command;
|
||||
import org.bukkit.entity.Player;
|
||||
|
||||
public class CMDlist extends DefaultCMD {
|
||||
public class ListCommand extends DefaultCommand {
|
||||
|
||||
@Override
|
||||
public boolean execute(Player player, Command cmd, String label, String[] args) {
|
@ -1,4 +1,4 @@
|
||||
package nl.Steffion.BlockHunt.Commands;
|
||||
package net.knarcraft.blockhunt.command;
|
||||
/**
|
||||
* Steffion's Engine - Made by Steffion.
|
||||
* <p>
|
||||
@ -11,12 +11,12 @@ package nl.Steffion.BlockHunt.Commands;
|
||||
* @author Steffion
|
||||
*/
|
||||
|
||||
import nl.Steffion.BlockHunt.ConfigC;
|
||||
import nl.Steffion.BlockHunt.Managers.MessageManager;
|
||||
import net.knarcraft.blockhunt.ConfigC;
|
||||
import net.knarcraft.blockhunt.manager.MessageManager;
|
||||
import org.bukkit.command.Command;
|
||||
import org.bukkit.entity.Player;
|
||||
|
||||
public class CMDnotfound extends DefaultCMD {
|
||||
public class NotFoundCommand extends DefaultCommand {
|
||||
|
||||
@Override
|
||||
public boolean execute(Player player, Command cmd, String label, String[] args) {
|
@ -1,4 +1,4 @@
|
||||
package nl.Steffion.BlockHunt.Commands;
|
||||
package net.knarcraft.blockhunt.command;
|
||||
/**
|
||||
* Steffion's Engine - Made by Steffion.
|
||||
* <p>
|
||||
@ -11,16 +11,16 @@ package nl.Steffion.BlockHunt.Commands;
|
||||
* @author Steffion
|
||||
*/
|
||||
|
||||
import nl.Steffion.BlockHunt.Arena;
|
||||
import nl.Steffion.BlockHunt.ArenaHandler;
|
||||
import nl.Steffion.BlockHunt.ConfigC;
|
||||
import nl.Steffion.BlockHunt.Managers.ConfigManager;
|
||||
import nl.Steffion.BlockHunt.Managers.MessageManager;
|
||||
import nl.Steffion.BlockHunt.MemoryStorage;
|
||||
import net.knarcraft.blockhunt.ConfigC;
|
||||
import net.knarcraft.blockhunt.MemoryStorage;
|
||||
import net.knarcraft.blockhunt.arena.Arena;
|
||||
import net.knarcraft.blockhunt.arena.ArenaHandler;
|
||||
import net.knarcraft.blockhunt.manager.ConfigManager;
|
||||
import net.knarcraft.blockhunt.manager.MessageManager;
|
||||
import org.bukkit.command.Command;
|
||||
import org.bukkit.entity.Player;
|
||||
|
||||
public class CMDreload extends DefaultCMD {
|
||||
public class ReloadCommand extends DefaultCommand {
|
||||
|
||||
|
||||
@Override
|
@ -1,10 +1,10 @@
|
||||
package nl.Steffion.BlockHunt.Commands;
|
||||
package net.knarcraft.blockhunt.command;
|
||||
|
||||
import nl.Steffion.BlockHunt.Arena;
|
||||
import nl.Steffion.BlockHunt.BlockHunt;
|
||||
import nl.Steffion.BlockHunt.ConfigC;
|
||||
import nl.Steffion.BlockHunt.Managers.MessageManager;
|
||||
import nl.Steffion.BlockHunt.MemoryStorage;
|
||||
import net.knarcraft.blockhunt.BlockHunt;
|
||||
import net.knarcraft.blockhunt.ConfigC;
|
||||
import net.knarcraft.blockhunt.MemoryStorage;
|
||||
import net.knarcraft.blockhunt.arena.Arena;
|
||||
import net.knarcraft.blockhunt.manager.MessageManager;
|
||||
import org.bukkit.Effect;
|
||||
import org.bukkit.Location;
|
||||
import org.bukkit.Material;
|
||||
@ -12,7 +12,7 @@ import org.bukkit.Sound;
|
||||
import org.bukkit.command.Command;
|
||||
import org.bukkit.entity.Player;
|
||||
|
||||
public class CMDremove extends DefaultCMD {
|
||||
public class RemoveCommand extends DefaultCommand {
|
||||
|
||||
@Override
|
||||
public boolean execute(Player player, Command cmd, String label, String[] args) {
|
@ -1,13 +1,13 @@
|
||||
package nl.Steffion.BlockHunt.Commands;
|
||||
package net.knarcraft.blockhunt.command;
|
||||
|
||||
import nl.Steffion.BlockHunt.BlockHunt;
|
||||
import nl.Steffion.BlockHunt.ConfigC;
|
||||
import nl.Steffion.BlockHunt.InventoryHandler;
|
||||
import nl.Steffion.BlockHunt.Managers.MessageManager;
|
||||
import net.knarcraft.blockhunt.BlockHunt;
|
||||
import net.knarcraft.blockhunt.ConfigC;
|
||||
import net.knarcraft.blockhunt.InventoryHandler;
|
||||
import net.knarcraft.blockhunt.manager.MessageManager;
|
||||
import org.bukkit.command.Command;
|
||||
import org.bukkit.entity.Player;
|
||||
|
||||
public class CMDset extends DefaultCMD {
|
||||
public class SetCommand extends DefaultCommand {
|
||||
|
||||
@Override
|
||||
public boolean execute(Player player, Command cmd, String label, String[] args) {
|
@ -1,16 +1,16 @@
|
||||
package nl.Steffion.BlockHunt.Commands;
|
||||
package net.knarcraft.blockhunt.command;
|
||||
|
||||
import nl.Steffion.BlockHunt.Arena;
|
||||
import nl.Steffion.BlockHunt.ArenaHandler;
|
||||
import nl.Steffion.BlockHunt.BlockHunt;
|
||||
import nl.Steffion.BlockHunt.ConfigC;
|
||||
import nl.Steffion.BlockHunt.Managers.MessageManager;
|
||||
import nl.Steffion.BlockHunt.MemoryStorage;
|
||||
import net.knarcraft.blockhunt.BlockHunt;
|
||||
import net.knarcraft.blockhunt.ConfigC;
|
||||
import net.knarcraft.blockhunt.MemoryStorage;
|
||||
import net.knarcraft.blockhunt.arena.Arena;
|
||||
import net.knarcraft.blockhunt.arena.ArenaHandler;
|
||||
import net.knarcraft.blockhunt.manager.MessageManager;
|
||||
import org.bukkit.Location;
|
||||
import org.bukkit.command.Command;
|
||||
import org.bukkit.entity.Player;
|
||||
|
||||
public class CMDsetwarp extends DefaultCMD {
|
||||
public class SetWarpCommand extends DefaultCommand {
|
||||
|
||||
@Override
|
||||
public boolean execute(Player player, Command cmd, String label, String[] args) {
|
@ -1,10 +1,10 @@
|
||||
package nl.Steffion.BlockHunt.Commands;
|
||||
package net.knarcraft.blockhunt.command;
|
||||
|
||||
import nl.Steffion.BlockHunt.InventoryHandler;
|
||||
import net.knarcraft.blockhunt.InventoryHandler;
|
||||
import org.bukkit.command.Command;
|
||||
import org.bukkit.entity.Player;
|
||||
|
||||
public class CMDshop extends DefaultCMD {
|
||||
public class ShopCommand extends DefaultCommand {
|
||||
|
||||
@Override
|
||||
public boolean execute(Player player, Command cmd, String label, String[] args) {
|
@ -1,15 +1,15 @@
|
||||
package nl.Steffion.BlockHunt.Commands;
|
||||
package net.knarcraft.blockhunt.command;
|
||||
|
||||
import nl.Steffion.BlockHunt.Arena;
|
||||
import nl.Steffion.BlockHunt.Arena.ArenaState;
|
||||
import nl.Steffion.BlockHunt.BlockHunt;
|
||||
import nl.Steffion.BlockHunt.ConfigC;
|
||||
import nl.Steffion.BlockHunt.Managers.MessageManager;
|
||||
import nl.Steffion.BlockHunt.MemoryStorage;
|
||||
import net.knarcraft.blockhunt.BlockHunt;
|
||||
import net.knarcraft.blockhunt.ConfigC;
|
||||
import net.knarcraft.blockhunt.MemoryStorage;
|
||||
import net.knarcraft.blockhunt.arena.Arena;
|
||||
import net.knarcraft.blockhunt.arena.ArenaState;
|
||||
import net.knarcraft.blockhunt.manager.MessageManager;
|
||||
import org.bukkit.command.Command;
|
||||
import org.bukkit.entity.Player;
|
||||
|
||||
public class CMDstart extends DefaultCMD {
|
||||
public class StartCommand extends DefaultCommand {
|
||||
|
||||
@Override
|
||||
public boolean execute(Player player, Command cmd, String label, String[] args) {
|
@ -1,4 +1,4 @@
|
||||
package nl.Steffion.BlockHunt.Commands;
|
||||
package net.knarcraft.blockhunt.command;
|
||||
/**
|
||||
* Steffion's Engine - Made by Steffion.
|
||||
* <p>
|
||||
@ -11,15 +11,15 @@ package nl.Steffion.BlockHunt.Commands;
|
||||
* @author Steffion
|
||||
*/
|
||||
|
||||
import nl.Steffion.BlockHunt.BlockHunt;
|
||||
import nl.Steffion.BlockHunt.ConfigC;
|
||||
import nl.Steffion.BlockHunt.Managers.MessageManager;
|
||||
import nl.Steffion.BlockHunt.MemoryStorage;
|
||||
import net.knarcraft.blockhunt.BlockHunt;
|
||||
import net.knarcraft.blockhunt.ConfigC;
|
||||
import net.knarcraft.blockhunt.MemoryStorage;
|
||||
import net.knarcraft.blockhunt.manager.MessageManager;
|
||||
import org.bukkit.Bukkit;
|
||||
import org.bukkit.command.Command;
|
||||
import org.bukkit.entity.Player;
|
||||
|
||||
public class CMDTokens extends DefaultCMD {
|
||||
public class TokensCommand extends DefaultCommand {
|
||||
|
||||
|
||||
@Override
|
@ -1,8 +1,8 @@
|
||||
package nl.Steffion.BlockHunt.Commands;
|
||||
package net.knarcraft.blockhunt.command;
|
||||
|
||||
import nl.Steffion.BlockHunt.ConfigC;
|
||||
import nl.Steffion.BlockHunt.Managers.MessageManager;
|
||||
import nl.Steffion.BlockHunt.MemoryStorage;
|
||||
import net.knarcraft.blockhunt.ConfigC;
|
||||
import net.knarcraft.blockhunt.MemoryStorage;
|
||||
import net.knarcraft.blockhunt.manager.MessageManager;
|
||||
import org.bukkit.Material;
|
||||
import org.bukkit.Sound;
|
||||
import org.bukkit.command.Command;
|
||||
@ -13,7 +13,7 @@ import org.bukkit.inventory.meta.ItemMeta;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
public class CMDwand extends DefaultCMD {
|
||||
public class WandCommand extends DefaultCommand {
|
||||
|
||||
@Override
|
||||
public boolean execute(Player player, Command cmd, String label, String[] args) {
|
@ -1,6 +1,6 @@
|
||||
package nl.Steffion.BlockHunt.Events;
|
||||
package net.knarcraft.blockhunt.event;
|
||||
|
||||
import nl.Steffion.BlockHunt.Arena;
|
||||
import net.knarcraft.blockhunt.arena.Arena;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.event.Event;
|
||||
import org.bukkit.event.HandlerList;
|
@ -1,6 +1,6 @@
|
||||
package nl.Steffion.BlockHunt.Events;
|
||||
package net.knarcraft.blockhunt.event;
|
||||
|
||||
import nl.Steffion.BlockHunt.Arena;
|
||||
import net.knarcraft.blockhunt.arena.Arena;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.event.Event;
|
||||
import org.bukkit.event.HandlerList;
|
@ -1,6 +1,6 @@
|
||||
package nl.Steffion.BlockHunt.Events;
|
||||
package net.knarcraft.blockhunt.event;
|
||||
|
||||
import nl.Steffion.BlockHunt.Arena;
|
||||
import net.knarcraft.blockhunt.arena.Arena;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.event.Event;
|
||||
import org.bukkit.event.HandlerList;
|
@ -1,8 +1,8 @@
|
||||
package nl.Steffion.BlockHunt.Listeners;
|
||||
package net.knarcraft.blockhunt.listener;
|
||||
|
||||
import nl.Steffion.BlockHunt.Arena;
|
||||
import nl.Steffion.BlockHunt.ArenaHandler;
|
||||
import nl.Steffion.BlockHunt.MemoryStorage;
|
||||
import net.knarcraft.blockhunt.MemoryStorage;
|
||||
import net.knarcraft.blockhunt.arena.Arena;
|
||||
import net.knarcraft.blockhunt.arena.ArenaHandler;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.event.EventHandler;
|
||||
import org.bukkit.event.EventPriority;
|
@ -1,8 +1,8 @@
|
||||
package nl.Steffion.BlockHunt.Listeners;
|
||||
package net.knarcraft.blockhunt.listener;
|
||||
|
||||
import nl.Steffion.BlockHunt.Arena;
|
||||
import nl.Steffion.BlockHunt.ArenaHandler;
|
||||
import nl.Steffion.BlockHunt.MemoryStorage;
|
||||
import net.knarcraft.blockhunt.MemoryStorage;
|
||||
import net.knarcraft.blockhunt.arena.Arena;
|
||||
import net.knarcraft.blockhunt.arena.ArenaHandler;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.event.EventHandler;
|
||||
import org.bukkit.event.EventPriority;
|
@ -1,14 +1,14 @@
|
||||
package nl.Steffion.BlockHunt.Listeners;
|
||||
package net.knarcraft.blockhunt.listener;
|
||||
|
||||
import me.libraryaddict.disguise.DisguiseAPI;
|
||||
import nl.Steffion.BlockHunt.Arena;
|
||||
import nl.Steffion.BlockHunt.Arena.ArenaState;
|
||||
import nl.Steffion.BlockHunt.ArenaHandler;
|
||||
import nl.Steffion.BlockHunt.BlockHunt;
|
||||
import nl.Steffion.BlockHunt.ConfigC;
|
||||
import nl.Steffion.BlockHunt.Managers.MessageManager;
|
||||
import nl.Steffion.BlockHunt.MemoryStorage;
|
||||
import nl.Steffion.BlockHunt.PlayerHandler;
|
||||
import net.knarcraft.blockhunt.BlockHunt;
|
||||
import net.knarcraft.blockhunt.ConfigC;
|
||||
import net.knarcraft.blockhunt.MemoryStorage;
|
||||
import net.knarcraft.blockhunt.PlayerHandler;
|
||||
import net.knarcraft.blockhunt.arena.Arena;
|
||||
import net.knarcraft.blockhunt.arena.ArenaHandler;
|
||||
import net.knarcraft.blockhunt.arena.ArenaState;
|
||||
import net.knarcraft.blockhunt.manager.MessageManager;
|
||||
import org.apache.commons.lang.StringUtils;
|
||||
import org.bukkit.GameMode;
|
||||
import org.bukkit.Sound;
|
@ -1,8 +1,8 @@
|
||||
package nl.Steffion.BlockHunt.Listeners;
|
||||
package net.knarcraft.blockhunt.listener;
|
||||
|
||||
import nl.Steffion.BlockHunt.Arena;
|
||||
import nl.Steffion.BlockHunt.ArenaHandler;
|
||||
import nl.Steffion.BlockHunt.MemoryStorage;
|
||||
import net.knarcraft.blockhunt.MemoryStorage;
|
||||
import net.knarcraft.blockhunt.arena.Arena;
|
||||
import net.knarcraft.blockhunt.arena.ArenaHandler;
|
||||
import org.bukkit.entity.Entity;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.event.EventHandler;
|
@ -1,7 +1,7 @@
|
||||
package nl.Steffion.BlockHunt.Listeners;
|
||||
package net.knarcraft.blockhunt.listener;
|
||||
|
||||
import nl.Steffion.BlockHunt.Arena;
|
||||
import nl.Steffion.BlockHunt.MemoryStorage;
|
||||
import net.knarcraft.blockhunt.MemoryStorage;
|
||||
import net.knarcraft.blockhunt.arena.Arena;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.event.EventHandler;
|
||||
import org.bukkit.event.EventPriority;
|
@ -1,12 +1,12 @@
|
||||
package nl.Steffion.BlockHunt.Listeners;
|
||||
package net.knarcraft.blockhunt.listener;
|
||||
|
||||
import nl.Steffion.BlockHunt.Arena;
|
||||
import nl.Steffion.BlockHunt.Arena.ArenaType;
|
||||
import nl.Steffion.BlockHunt.ArenaHandler;
|
||||
import nl.Steffion.BlockHunt.ConfigC;
|
||||
import nl.Steffion.BlockHunt.InventoryHandler;
|
||||
import nl.Steffion.BlockHunt.Managers.MessageManager;
|
||||
import nl.Steffion.BlockHunt.MemoryStorage;
|
||||
import net.knarcraft.blockhunt.ConfigC;
|
||||
import net.knarcraft.blockhunt.InventoryHandler;
|
||||
import net.knarcraft.blockhunt.MemoryStorage;
|
||||
import net.knarcraft.blockhunt.arena.Arena;
|
||||
import net.knarcraft.blockhunt.arena.ArenaHandler;
|
||||
import net.knarcraft.blockhunt.arena.ArenaProperty;
|
||||
import net.knarcraft.blockhunt.manager.MessageManager;
|
||||
import org.apache.commons.lang.WordUtils;
|
||||
import org.bukkit.Bukkit;
|
||||
import org.bukkit.Material;
|
||||
@ -199,27 +199,27 @@ public class OnInventoryClickEvent implements Listener {
|
||||
}
|
||||
if (item.getType().equals(Material.GOLD_NUGGET)) {
|
||||
if (item.getItemMeta().getDisplayName().contains("maxPlayers")) {
|
||||
updownButton(player, item, arena, ArenaType.maxPlayers, arena.maxPlayers, Bukkit.getMaxPlayers(), 2, 1, 1);
|
||||
updownButton(player, item, arena, ArenaProperty.MAX_PLAYERS, arena.maxPlayers, Bukkit.getMaxPlayers(), 2, 1, 1);
|
||||
} else if (item.getItemMeta().getDisplayName().contains("minPlayers")) {
|
||||
updownButton(player, item, arena, ArenaType.minPlayers, arena.minPlayers, Bukkit.getMaxPlayers() - 1, 2, 1, 1);
|
||||
updownButton(player, item, arena, ArenaProperty.MIN_PLAYERS, arena.minPlayers, Bukkit.getMaxPlayers() - 1, 2, 1, 1);
|
||||
} else if (item.getItemMeta().getDisplayName().contains("amountSeekersOnStart")) {
|
||||
updownButton(player, item, arena, ArenaType.amountSeekersOnStart, arena.amountSeekersOnStart, arena.maxPlayers - 1, 1, 1, 1);
|
||||
updownButton(player, item, arena, ArenaProperty.AMOUNT_SEEKERS_ON_START, arena.amountSeekersOnStart, arena.maxPlayers - 1, 1, 1, 1);
|
||||
} else if (item.getItemMeta().getDisplayName().contains("timeInLobbyUntilStart")) {
|
||||
updownButton(player, item, arena, ArenaType.timeInLobbyUntilStart, arena.timeInLobbyUntilStart, 1000, 5, 1, 1);
|
||||
updownButton(player, item, arena, ArenaProperty.TIME_IN_LOBBY_UNTIL_START, arena.timeInLobbyUntilStart, 1000, 5, 1, 1);
|
||||
} else if (item.getItemMeta().getDisplayName().contains("waitingTimeSeeker")) {
|
||||
updownButton(player, item, arena, ArenaType.waitingTimeSeeker, arena.waitingTimeSeeker, 1000, 5, 1, 1);
|
||||
updownButton(player, item, arena, ArenaProperty.WAITING_TIME_SEEKER, arena.waitingTimeSeeker, 1000, 5, 1, 1);
|
||||
} else if (item.getItemMeta().getDisplayName().contains("gameTime")) {
|
||||
updownButton(player, item, arena, ArenaType.gameTime, arena.gameTime, 1000, 5, 1, 1);
|
||||
updownButton(player, item, arena, ArenaProperty.GAME_TIME, arena.gameTime, 1000, 5, 1, 1);
|
||||
} else if (item.getItemMeta().getDisplayName().contains("blockAnnouncerTime")) {
|
||||
updownButton(player, item, arena, ArenaType.blockAnnouncerTime, arena.blockAnnouncerTime, 1000, 0, 5, 5);
|
||||
updownButton(player, item, arena, ArenaProperty.BLOCK_ANNOUNCER_TIME, arena.blockAnnouncerTime, 1000, 0, 5, 5);
|
||||
} else if (item.getItemMeta().getDisplayName().contains("timeUntilHidersSword")) {
|
||||
updownButton(player, item, arena, ArenaType.timeUntilHidersSword, arena.timeUntilHidersSword, 1000, 0, 1, 1);
|
||||
updownButton(player, item, arena, ArenaProperty.TIME_UNTIL_HIDERS_SWORD, arena.timeUntilHidersSword, 1000, 0, 1, 1);
|
||||
} else if (item.getItemMeta().getDisplayName().contains("hidersTokenWin")) {
|
||||
updownButton(player, item, arena, ArenaType.hidersTokenWin, arena.hidersTokenWin, 1000, 0, 1, 1);
|
||||
updownButton(player, item, arena, ArenaProperty.HIDERS_TOKEN_WIN, arena.hidersTokenWin, 1000, 0, 1, 1);
|
||||
} else if (item.getItemMeta().getDisplayName().contains("seekersTokenWin")) {
|
||||
updownButton(player, item, arena, ArenaType.seekersTokenWin, arena.seekersTokenWin, 1000, 0, 1, 1);
|
||||
updownButton(player, item, arena, ArenaProperty.SEEKERS_TOKEN_WIN, arena.seekersTokenWin, 1000, 0, 1, 1);
|
||||
} else if (item.getItemMeta().getDisplayName().contains("killTokens")) {
|
||||
updownButton(player, item, arena, ArenaType.killTokens, arena.killTokens, 1000, 0, 1, 1);
|
||||
updownButton(player, item, arena, ArenaProperty.KILL_TOKENS, arena.killTokens, 1000, 0, 1, 1);
|
||||
}
|
||||
|
||||
save(arena);
|
||||
@ -241,21 +241,21 @@ public class OnInventoryClickEvent implements Listener {
|
||||
ArenaHandler.loadArenas();
|
||||
}
|
||||
|
||||
public static void updownButton(Player player, ItemStack item, Arena arena, ArenaType at, int option, int max, int min, int add, int remove) {
|
||||
public static void updownButton(Player player, ItemStack item, Arena arena, ArenaProperty at, int option, int max, int min, int add, int remove) {
|
||||
if (item.getItemMeta().getDisplayName().contains((String) MemoryStorage.messages.get(ConfigC.button_add2))) {
|
||||
if (option < max) {
|
||||
switch (at) {
|
||||
case maxPlayers -> arena.maxPlayers = option + add;
|
||||
case minPlayers -> arena.minPlayers = option + add;
|
||||
case amountSeekersOnStart -> arena.amountSeekersOnStart = option + add;
|
||||
case timeInLobbyUntilStart -> arena.timeInLobbyUntilStart = option + add;
|
||||
case waitingTimeSeeker -> arena.waitingTimeSeeker = option + add;
|
||||
case gameTime -> arena.gameTime = option + add;
|
||||
case blockAnnouncerTime -> arena.blockAnnouncerTime = option + add;
|
||||
case timeUntilHidersSword -> arena.timeUntilHidersSword = option + add;
|
||||
case hidersTokenWin -> arena.hidersTokenWin = option + add;
|
||||
case seekersTokenWin -> arena.seekersTokenWin = option + add;
|
||||
case killTokens -> arena.killTokens = option + add;
|
||||
case MAX_PLAYERS -> arena.maxPlayers = option + add;
|
||||
case MIN_PLAYERS -> arena.minPlayers = option + add;
|
||||
case AMOUNT_SEEKERS_ON_START -> arena.amountSeekersOnStart = option + add;
|
||||
case TIME_IN_LOBBY_UNTIL_START -> arena.timeInLobbyUntilStart = option + add;
|
||||
case WAITING_TIME_SEEKER -> arena.waitingTimeSeeker = option + add;
|
||||
case GAME_TIME -> arena.gameTime = option + add;
|
||||
case BLOCK_ANNOUNCER_TIME -> arena.blockAnnouncerTime = option + add;
|
||||
case TIME_UNTIL_HIDERS_SWORD -> arena.timeUntilHidersSword = option + add;
|
||||
case HIDERS_TOKEN_WIN -> arena.hidersTokenWin = option + add;
|
||||
case SEEKERS_TOKEN_WIN -> arena.seekersTokenWin = option + add;
|
||||
case KILL_TOKENS -> arena.killTokens = option + add;
|
||||
}
|
||||
} else {
|
||||
MessageManager.sendFMessage(player, ConfigC.error_setTooHighNumber, "max-" + max);
|
||||
@ -263,17 +263,17 @@ public class OnInventoryClickEvent implements Listener {
|
||||
} else if (item.getItemMeta().getDisplayName().contains((String) MemoryStorage.messages.get(ConfigC.button_remove2))) {
|
||||
if (option > min) {
|
||||
switch (at) {
|
||||
case maxPlayers -> arena.maxPlayers = option - remove;
|
||||
case minPlayers -> arena.minPlayers = option - remove;
|
||||
case amountSeekersOnStart -> arena.amountSeekersOnStart = option - remove;
|
||||
case timeInLobbyUntilStart -> arena.timeInLobbyUntilStart = option - remove;
|
||||
case waitingTimeSeeker -> arena.waitingTimeSeeker = option - remove;
|
||||
case gameTime -> arena.gameTime = option - remove;
|
||||
case blockAnnouncerTime -> arena.blockAnnouncerTime = option - remove;
|
||||
case timeUntilHidersSword -> arena.timeUntilHidersSword = option - remove;
|
||||
case hidersTokenWin -> arena.hidersTokenWin = option - remove;
|
||||
case seekersTokenWin -> arena.seekersTokenWin = option - remove;
|
||||
case killTokens -> arena.killTokens = option - remove;
|
||||
case MAX_PLAYERS -> arena.maxPlayers = option - remove;
|
||||
case MIN_PLAYERS -> arena.minPlayers = option - remove;
|
||||
case AMOUNT_SEEKERS_ON_START -> arena.amountSeekersOnStart = option - remove;
|
||||
case TIME_IN_LOBBY_UNTIL_START -> arena.timeInLobbyUntilStart = option - remove;
|
||||
case WAITING_TIME_SEEKER -> arena.waitingTimeSeeker = option - remove;
|
||||
case GAME_TIME -> arena.gameTime = option - remove;
|
||||
case BLOCK_ANNOUNCER_TIME -> arena.blockAnnouncerTime = option - remove;
|
||||
case TIME_UNTIL_HIDERS_SWORD -> arena.timeUntilHidersSword = option - remove;
|
||||
case HIDERS_TOKEN_WIN -> arena.hidersTokenWin = option - remove;
|
||||
case SEEKERS_TOKEN_WIN -> arena.seekersTokenWin = option - remove;
|
||||
case KILL_TOKENS -> arena.killTokens = option - remove;
|
||||
}
|
||||
} else {
|
||||
MessageManager.sendFMessage(player, ConfigC.error_setTooLowNumber, "min-" + min);
|
@ -1,9 +1,9 @@
|
||||
package nl.Steffion.BlockHunt.Listeners;
|
||||
package net.knarcraft.blockhunt.listener;
|
||||
|
||||
import nl.Steffion.BlockHunt.Arena;
|
||||
import nl.Steffion.BlockHunt.ArenaHandler;
|
||||
import nl.Steffion.BlockHunt.Managers.MessageManager;
|
||||
import nl.Steffion.BlockHunt.MemoryStorage;
|
||||
import net.knarcraft.blockhunt.MemoryStorage;
|
||||
import net.knarcraft.blockhunt.arena.Arena;
|
||||
import net.knarcraft.blockhunt.arena.ArenaHandler;
|
||||
import net.knarcraft.blockhunt.manager.MessageManager;
|
||||
import org.bukkit.Material;
|
||||
import org.bukkit.event.EventHandler;
|
||||
import org.bukkit.event.EventPriority;
|
@ -1,7 +1,7 @@
|
||||
package nl.Steffion.BlockHunt.Listeners;
|
||||
package net.knarcraft.blockhunt.listener;
|
||||
|
||||
import nl.Steffion.BlockHunt.Arena;
|
||||
import nl.Steffion.BlockHunt.MemoryStorage;
|
||||
import net.knarcraft.blockhunt.MemoryStorage;
|
||||
import net.knarcraft.blockhunt.arena.Arena;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.event.EventHandler;
|
||||
import org.bukkit.event.EventPriority;
|
@ -1,16 +1,16 @@
|
||||
package nl.Steffion.BlockHunt.Listeners;
|
||||
package net.knarcraft.blockhunt.listener;
|
||||
|
||||
import nl.Steffion.BlockHunt.Arena;
|
||||
import nl.Steffion.BlockHunt.Arena.ArenaState;
|
||||
import nl.Steffion.BlockHunt.ArenaHandler;
|
||||
import nl.Steffion.BlockHunt.ConfigC;
|
||||
import nl.Steffion.BlockHunt.InventoryHandler;
|
||||
import nl.Steffion.BlockHunt.Managers.MessageManager;
|
||||
import nl.Steffion.BlockHunt.Managers.PermissionsManager;
|
||||
import nl.Steffion.BlockHunt.MemoryStorage;
|
||||
import nl.Steffion.BlockHunt.PermissionsC.Permissions;
|
||||
import nl.Steffion.BlockHunt.SignsHandler;
|
||||
import nl.Steffion.BlockHunt.SolidBlockHandler;
|
||||
import net.knarcraft.blockhunt.ConfigC;
|
||||
import net.knarcraft.blockhunt.InventoryHandler;
|
||||
import net.knarcraft.blockhunt.MemoryStorage;
|
||||
import net.knarcraft.blockhunt.PermissionsC;
|
||||
import net.knarcraft.blockhunt.SignsHandler;
|
||||
import net.knarcraft.blockhunt.SolidBlockHandler;
|
||||
import net.knarcraft.blockhunt.arena.Arena;
|
||||
import net.knarcraft.blockhunt.arena.ArenaHandler;
|
||||
import net.knarcraft.blockhunt.arena.ArenaState;
|
||||
import net.knarcraft.blockhunt.manager.MessageManager;
|
||||
import net.knarcraft.blockhunt.manager.PermissionsManager;
|
||||
import org.bukkit.Bukkit;
|
||||
import org.bukkit.Location;
|
||||
import org.bukkit.Material;
|
||||
@ -33,7 +33,7 @@ public class OnPlayerInteractEvent implements Listener {
|
||||
public void onPlayerInteractEvent(PlayerInteractEvent event) {
|
||||
Player player = event.getPlayer();
|
||||
Block block = event.getClickedBlock();
|
||||
if (PermissionsManager.hasPerm(player, Permissions.create, false)) {
|
||||
if (PermissionsManager.hasPerm(player, PermissionsC.Permissions.create, false)) {
|
||||
ItemStack item = player.getInventory().getItemInMainHand();
|
||||
if (item.getType() != Material.AIR) {
|
||||
if (item.getItemMeta().hasDisplayName()) {
|
||||
@ -72,17 +72,17 @@ public class OnPlayerInteractEvent implements Listener {
|
||||
Sign sign = (Sign) event.getClickedBlock().getState();
|
||||
if (sign.getLine(1) != null) {
|
||||
if (sign.getLine(1).equals(MessageManager.replaceAll(MemoryStorage.config.getFile().getStringList(ConfigC.sign_LEAVE.location).get(1)))) {
|
||||
if (PermissionsManager.hasPerm(player, Permissions.joinsign, true)) {
|
||||
if (PermissionsManager.hasPerm(player, PermissionsC.Permissions.joinsign, true)) {
|
||||
ArenaHandler.playerLeaveArena(player, true, true);
|
||||
}
|
||||
} else if (sign.getLine(1).equals(MessageManager.replaceAll(MemoryStorage.config.getFile().getStringList(ConfigC.sign_SHOP.location).get(1)))) {
|
||||
if (PermissionsManager.hasPerm(player, Permissions.shop, true)) {
|
||||
if (PermissionsManager.hasPerm(player, PermissionsC.Permissions.shop, true)) {
|
||||
InventoryHandler.openShop(player);
|
||||
}
|
||||
} else {
|
||||
for (Arena arena : MemoryStorage.arenaList) {
|
||||
if (sign.getLines()[1].contains(arena.arenaName)) {
|
||||
if (PermissionsManager.hasPerm(player, Permissions.joinsign, true)) {
|
||||
if (PermissionsManager.hasPerm(player, PermissionsC.Permissions.joinsign, true)) {
|
||||
ArenaHandler.playerJoinArena(player, arena.arenaName);
|
||||
}
|
||||
}
|
@ -1,11 +1,11 @@
|
||||
package nl.Steffion.BlockHunt.Listeners;
|
||||
package net.knarcraft.blockhunt.listener;
|
||||
|
||||
import nl.Steffion.BlockHunt.Arena;
|
||||
import nl.Steffion.BlockHunt.Arena.ArenaState;
|
||||
import nl.Steffion.BlockHunt.ArenaHandler;
|
||||
import nl.Steffion.BlockHunt.BlockHunt;
|
||||
import nl.Steffion.BlockHunt.MemoryStorage;
|
||||
import nl.Steffion.BlockHunt.PlayerHandler;
|
||||
import net.knarcraft.blockhunt.BlockHunt;
|
||||
import net.knarcraft.blockhunt.MemoryStorage;
|
||||
import net.knarcraft.blockhunt.PlayerHandler;
|
||||
import net.knarcraft.blockhunt.arena.Arena;
|
||||
import net.knarcraft.blockhunt.arena.ArenaHandler;
|
||||
import net.knarcraft.blockhunt.arena.ArenaState;
|
||||
import org.bukkit.Effect;
|
||||
import org.bukkit.Location;
|
||||
import org.bukkit.Sound;
|
@ -1,8 +1,8 @@
|
||||
package nl.Steffion.BlockHunt.Listeners;
|
||||
package net.knarcraft.blockhunt.listener;
|
||||
|
||||
import nl.Steffion.BlockHunt.Arena;
|
||||
import nl.Steffion.BlockHunt.ArenaHandler;
|
||||
import nl.Steffion.BlockHunt.MemoryStorage;
|
||||
import net.knarcraft.blockhunt.MemoryStorage;
|
||||
import net.knarcraft.blockhunt.arena.Arena;
|
||||
import net.knarcraft.blockhunt.arena.ArenaHandler;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.event.EventHandler;
|
||||
import org.bukkit.event.EventPriority;
|
@ -1,8 +1,8 @@
|
||||
package nl.Steffion.BlockHunt.Listeners;
|
||||
package net.knarcraft.blockhunt.listener;
|
||||
|
||||
import nl.Steffion.BlockHunt.Arena;
|
||||
import nl.Steffion.BlockHunt.ArenaHandler;
|
||||
import nl.Steffion.BlockHunt.MemoryStorage;
|
||||
import net.knarcraft.blockhunt.MemoryStorage;
|
||||
import net.knarcraft.blockhunt.arena.Arena;
|
||||
import net.knarcraft.blockhunt.arena.ArenaHandler;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.event.EventHandler;
|
||||
import org.bukkit.event.EventPriority;
|
@ -1,8 +1,8 @@
|
||||
package nl.Steffion.BlockHunt.Listeners;
|
||||
package net.knarcraft.blockhunt.listener;
|
||||
|
||||
import nl.Steffion.BlockHunt.ConfigC;
|
||||
import nl.Steffion.BlockHunt.Managers.MessageManager;
|
||||
import nl.Steffion.BlockHunt.MemoryStorage;
|
||||
import net.knarcraft.blockhunt.ConfigC;
|
||||
import net.knarcraft.blockhunt.MemoryStorage;
|
||||
import net.knarcraft.blockhunt.manager.MessageManager;
|
||||
import org.bukkit.Location;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.event.EventHandler;
|
@ -1,9 +1,9 @@
|
||||
package nl.Steffion.BlockHunt.Listeners;
|
||||
package net.knarcraft.blockhunt.listener;
|
||||
|
||||
import nl.Steffion.BlockHunt.BlockHunt;
|
||||
import nl.Steffion.BlockHunt.Managers.PermissionsManager;
|
||||
import nl.Steffion.BlockHunt.PermissionsC.Permissions;
|
||||
import nl.Steffion.BlockHunt.SignsHandler;
|
||||
import net.knarcraft.blockhunt.BlockHunt;
|
||||
import net.knarcraft.blockhunt.PermissionsC;
|
||||
import net.knarcraft.blockhunt.SignsHandler;
|
||||
import net.knarcraft.blockhunt.manager.PermissionsManager;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.event.EventHandler;
|
||||
import org.bukkit.event.EventPriority;
|
||||
@ -18,7 +18,7 @@ public class OnSignChangeEvent implements Listener {
|
||||
String[] lines = event.getLines();
|
||||
if (lines[0] != null) {
|
||||
if (lines[0].equalsIgnoreCase("[" + BlockHunt.pdfFile.getName() + "]")) {
|
||||
if (PermissionsManager.hasPerm(player, Permissions.signcreate, true)) {
|
||||
if (PermissionsManager.hasPerm(player, PermissionsC.Permissions.signcreate, true)) {
|
||||
SignsHandler.createSign(event, lines, event.getBlock().getLocation());
|
||||
}
|
||||
}
|
@ -1,4 +1,4 @@
|
||||
package nl.Steffion.BlockHunt.Managers;
|
||||
package net.knarcraft.blockhunt.manager;
|
||||
/**
|
||||
* Steffion's Engine - Made by Steffion.
|
||||
* <p>
|
||||
@ -11,10 +11,10 @@ package nl.Steffion.BlockHunt.Managers;
|
||||
* @author Steffion
|
||||
*/
|
||||
|
||||
import nl.Steffion.BlockHunt.Commands.DefaultCMD;
|
||||
import nl.Steffion.BlockHunt.ConfigC;
|
||||
import nl.Steffion.BlockHunt.MemoryStorage;
|
||||
import nl.Steffion.BlockHunt.PermissionsC.Permissions;
|
||||
import net.knarcraft.blockhunt.ConfigC;
|
||||
import net.knarcraft.blockhunt.MemoryStorage;
|
||||
import net.knarcraft.blockhunt.PermissionsC;
|
||||
import net.knarcraft.blockhunt.command.DefaultCommand;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
@ -25,15 +25,15 @@ public class CommandManager {
|
||||
public final String label;
|
||||
public final String args;
|
||||
public final String argsalias;
|
||||
public final Permissions permission;
|
||||
public final PermissionsC.Permissions permission;
|
||||
public final ConfigC help;
|
||||
public final boolean enabled;
|
||||
public final List<String> mainTABlist;
|
||||
public final DefaultCMD CMD;
|
||||
public final DefaultCommand CMD;
|
||||
public final String usage;
|
||||
|
||||
public CommandManager(String name, String label, String args, String argsalias, Permissions permission, ConfigC help, Boolean enabled, List<String> mainTABlist,
|
||||
DefaultCMD CMD, String usage) {
|
||||
public CommandManager(String name, String label, String args, String argsalias, PermissionsC.Permissions permission, ConfigC help, Boolean enabled, List<String> mainTABlist,
|
||||
DefaultCommand CMD, String usage) {
|
||||
this.name = name;
|
||||
this.label = label;
|
||||
this.args = args;
|
@ -1,4 +1,4 @@
|
||||
package nl.Steffion.BlockHunt.Managers;
|
||||
package net.knarcraft.blockhunt.manager;
|
||||
/**
|
||||
* Steffion's Engine - Made by Steffion.
|
||||
* <p>
|
||||
@ -11,9 +11,9 @@ package nl.Steffion.BlockHunt.Managers;
|
||||
* @author Steffion
|
||||
*/
|
||||
|
||||
import nl.Steffion.BlockHunt.BlockHunt;
|
||||
import nl.Steffion.BlockHunt.ConfigC;
|
||||
import nl.Steffion.BlockHunt.MemoryStorage;
|
||||
import net.knarcraft.blockhunt.BlockHunt;
|
||||
import net.knarcraft.blockhunt.ConfigC;
|
||||
import net.knarcraft.blockhunt.MemoryStorage;
|
||||
import org.bukkit.configuration.ConfigurationSection;
|
||||
import org.bukkit.configuration.file.FileConfiguration;
|
||||
import org.bukkit.configuration.file.YamlConfiguration;
|
@ -1,7 +1,7 @@
|
||||
package nl.Steffion.BlockHunt.Managers;
|
||||
package net.knarcraft.blockhunt.manager;
|
||||
|
||||
import nl.Steffion.BlockHunt.ConfigC;
|
||||
import nl.Steffion.BlockHunt.MemoryStorage;
|
||||
import net.knarcraft.blockhunt.ConfigC;
|
||||
import net.knarcraft.blockhunt.MemoryStorage;
|
||||
import org.bukkit.Bukkit;
|
||||
import org.bukkit.entity.Player;
|
||||
|
@ -1,9 +1,7 @@
|
||||
package nl.Steffion.BlockHunt.Managers;
|
||||
package net.knarcraft.blockhunt.manager;
|
||||
|
||||
import nl.Steffion.BlockHunt.ConfigC;
|
||||
import nl.Steffion.BlockHunt.PermissionsC;
|
||||
import nl.Steffion.BlockHunt.PermissionsC.PType;
|
||||
import nl.Steffion.BlockHunt.PermissionsC.Permissions;
|
||||
import net.knarcraft.blockhunt.ConfigC;
|
||||
import net.knarcraft.blockhunt.PermissionsC;
|
||||
import org.bukkit.entity.Player;
|
||||
|
||||
public class PermissionsManager {
|
||||
@ -29,27 +27,27 @@ public class PermissionsManager {
|
||||
* permission.
|
||||
* @return True/False when either the player has the permission.
|
||||
*/
|
||||
public static boolean hasPerm(Player player, Permissions perm, Boolean message) {
|
||||
PType type = perm.type;
|
||||
public static boolean hasPerm(Player player, PermissionsC.Permissions perm, Boolean message) {
|
||||
PermissionsC.PType type = perm.type;
|
||||
if (player == null) {
|
||||
return true;
|
||||
}
|
||||
|
||||
if (type == PType.ALL) {
|
||||
if (type == PermissionsC.PType.ALL) {
|
||||
return true;
|
||||
} else if (type == PType.OP) {
|
||||
} else if (type == PermissionsC.PType.OP) {
|
||||
if (player.isOp()) {
|
||||
return true;
|
||||
}
|
||||
} else if (type == PType.ADMIN) {
|
||||
} else if (type == PermissionsC.PType.ADMIN) {
|
||||
if (player.hasPermission(PermissionsC.main + "admin")) {
|
||||
return true;
|
||||
}
|
||||
} else if (type == PType.MODERATOR) {
|
||||
} else if (type == PermissionsC.PType.MODERATOR) {
|
||||
if (player.hasPermission(PermissionsC.main + "moderator")) {
|
||||
return true;
|
||||
}
|
||||
} else if (type == PType.PLAYER) {
|
||||
} else if (type == PermissionsC.PType.PLAYER) {
|
||||
if (player.hasPermission(PermissionsC.main + "player")) {
|
||||
return true;
|
||||
}
|
||||
@ -82,26 +80,26 @@ public class PermissionsManager {
|
||||
* permission.
|
||||
* @return True/False when either the player has the permission.
|
||||
*/
|
||||
public static boolean hasRawPerm(Player player, PType type, String perm, Boolean message) {
|
||||
public static boolean hasRawPerm(Player player, PermissionsC.PType type, String perm, Boolean message) {
|
||||
if (player == null) {
|
||||
return true;
|
||||
}
|
||||
|
||||
if (type == PType.ALL) {
|
||||
if (type == PermissionsC.PType.ALL) {
|
||||
return true;
|
||||
} else if (type == PType.OP) {
|
||||
} else if (type == PermissionsC.PType.OP) {
|
||||
if (player.isOp()) {
|
||||
return true;
|
||||
}
|
||||
} else if (type == PType.ADMIN) {
|
||||
} else if (type == PermissionsC.PType.ADMIN) {
|
||||
if (player.hasPermission(PermissionsC.main + "admin")) {
|
||||
return true;
|
||||
}
|
||||
} else if (type == PType.MODERATOR) {
|
||||
} else if (type == PermissionsC.PType.MODERATOR) {
|
||||
if (player.hasPermission(PermissionsC.main + "moderator")) {
|
||||
return true;
|
||||
}
|
||||
} else if (type == PType.PLAYER) {
|
||||
} else if (type == PermissionsC.PType.PLAYER) {
|
||||
if (player.hasPermission(PermissionsC.main + "player")) {
|
||||
return true;
|
||||
}
|
@ -1,183 +0,0 @@
|
||||
package nl.Steffion.BlockHunt;
|
||||
|
||||
import nl.Steffion.BlockHunt.Arena.ArenaState;
|
||||
import nl.Steffion.BlockHunt.Managers.MessageManager;
|
||||
import org.bukkit.Location;
|
||||
import org.bukkit.block.Sign;
|
||||
import org.bukkit.event.block.SignChangeEvent;
|
||||
|
||||
import java.util.ArrayList;
|
||||
|
||||
public class SignsHandler {
|
||||
|
||||
public static void createSign(SignChangeEvent event, String[] lines, Location location) {
|
||||
if (lines[1] != null) {
|
||||
if (lines[1].equalsIgnoreCase("leave")) {
|
||||
boolean saved = false;
|
||||
int number = 1;
|
||||
while (!saved) {
|
||||
if (MemoryStorage.signs.getFile().get("leave_" + number) == null) {
|
||||
MemoryStorage.signs.getFile().set("leave_" + number + ".arenaName", "leave");
|
||||
MemoryStorage.signs.getFile().set("leave_" + number + ".location", location);
|
||||
MemoryStorage.signs.save();
|
||||
|
||||
saved = true;
|
||||
} else {
|
||||
number = number + 1;
|
||||
}
|
||||
}
|
||||
} else if (lines[1].equalsIgnoreCase("shop")) {
|
||||
boolean saved = false;
|
||||
int number = 1;
|
||||
while (!saved) {
|
||||
if (MemoryStorage.signs.getFile().get("shop_" + number) == null) {
|
||||
MemoryStorage.signs.getFile().set("shop_" + number + ".arenaName", "shop");
|
||||
MemoryStorage.signs.getFile().set("shop_" + number + ".location", location);
|
||||
MemoryStorage.signs.save();
|
||||
|
||||
saved = true;
|
||||
} else {
|
||||
number = number + 1;
|
||||
}
|
||||
}
|
||||
} else {
|
||||
boolean saved = false;
|
||||
for (Arena arena : MemoryStorage.arenaList) {
|
||||
if (lines[1].equals(arena.arenaName)) {
|
||||
int number = 1;
|
||||
while (!saved) {
|
||||
if (MemoryStorage.signs.getFile().get(arena.arenaName + "_" + number) == null) {
|
||||
MemoryStorage.signs.getFile().set(arena.arenaName + "_" + number + ".arenaName", lines[1]);
|
||||
MemoryStorage.signs.getFile().set(arena.arenaName + "_" + number + ".location", location);
|
||||
MemoryStorage.signs.save();
|
||||
|
||||
saved = true;
|
||||
} else {
|
||||
number = number + 1;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (!saved) {
|
||||
MessageManager.sendFMessage(event.getPlayer(), ConfigC.error_noArena, "name-" + lines[1]);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public static void removeSign(Location location) {
|
||||
for (String sign : MemoryStorage.signs.getFile().getKeys(false)) {
|
||||
Location loc = (Location) MemoryStorage.signs.getFile().get(sign + ".location");
|
||||
if (loc.equals(location)) {
|
||||
MemoryStorage.signs.getFile().set(sign, null);
|
||||
MemoryStorage.signs.save();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public static boolean isSign(Location location) {
|
||||
for (String sign : MemoryStorage.signs.getFile().getKeys(false)) {
|
||||
Location loc = (Location) MemoryStorage.signs.getFile().get(sign + ".location");
|
||||
if (loc.equals(location)) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
public static void updateSigns() {
|
||||
MemoryStorage.signs.load();
|
||||
for (String sign : MemoryStorage.signs.getFile().getKeys(false)) {
|
||||
Location loc = (Location) MemoryStorage.signs.getFile().get(sign + ".location");
|
||||
|
||||
// check if that area is actually loaded. If not move on.
|
||||
if (loc.getWorld().isChunkLoaded(loc.getBlockX() >> 4, loc.getBlockZ() >> 4)) {
|
||||
if (loc.getBlock().getState() instanceof Sign signblock) {
|
||||
String[] lines = signblock.getLines();
|
||||
if (sign.contains("leave")) {
|
||||
|
||||
ArrayList<String> signLines = (ArrayList<String>) MemoryStorage.config.getFile().getStringList(ConfigC.sign_LEAVE.location);
|
||||
int linecount = 0;
|
||||
for (String line : signLines) {
|
||||
if (linecount <= 3) {
|
||||
signblock.setLine(linecount, MessageManager.replaceAll(line));
|
||||
}
|
||||
|
||||
linecount = linecount + 1;
|
||||
}
|
||||
signblock.update();
|
||||
} else if (sign.contains("shop")) {
|
||||
ArrayList<String> signLines = (ArrayList<String>) MemoryStorage.config.getFile().getStringList(ConfigC.sign_SHOP.location);
|
||||
int linecount = 0;
|
||||
for (String line : signLines) {
|
||||
if (linecount <= 3) {
|
||||
signblock.setLine(linecount, MessageManager.replaceAll(line));
|
||||
}
|
||||
|
||||
linecount = linecount + 1;
|
||||
}
|
||||
signblock.update();
|
||||
} else {
|
||||
for (Arena arena : MemoryStorage.arenaList) {
|
||||
if (lines[1].endsWith(arena.arenaName)) {
|
||||
if (arena.gameState.equals(ArenaState.WAITING)) {
|
||||
ArrayList<String> signLines = (ArrayList<String>) MemoryStorage.config.getFile().getStringList(ConfigC.sign_WAITING.location);
|
||||
int linecount = 0;
|
||||
if (signLines != null) {
|
||||
for (String line : signLines) {
|
||||
if (linecount <= 3) {
|
||||
signblock.setLine(
|
||||
linecount,
|
||||
MessageManager.replaceAll(line, "arenaname-" + arena.arenaName, "players-" + arena.playersInArena.size(), "maxplayers-"
|
||||
+ arena.maxPlayers, "timeleft-" + arena.timer));
|
||||
}
|
||||
|
||||
linecount = linecount + 1;
|
||||
}
|
||||
}
|
||||
signblock.update();
|
||||
} else if (arena.gameState.equals(ArenaState.STARTING)) {
|
||||
ArrayList<String> signLines = (ArrayList<String>) MemoryStorage.config.getFile().getStringList(ConfigC.sign_STARTING.location);
|
||||
int linecount = 0;
|
||||
if (signLines != null) {
|
||||
for (String line : signLines) {
|
||||
if (linecount <= 3) {
|
||||
signblock.setLine(
|
||||
linecount,
|
||||
MessageManager.replaceAll(line, "arenaname-" + arena.arenaName, "players-" + arena.playersInArena.size(), "maxplayers-"
|
||||
+ arena.maxPlayers, "timeleft-" + arena.timer));
|
||||
}
|
||||
|
||||
linecount = linecount + 1;
|
||||
}
|
||||
}
|
||||
signblock.update();
|
||||
} else if (arena.gameState.equals(ArenaState.IN_GAME)) {
|
||||
ArrayList<String> signLines = (ArrayList<String>) MemoryStorage.config.getFile().getStringList(ConfigC.sign_INGAME.location);
|
||||
int linecount = 0;
|
||||
if (signLines != null) {
|
||||
for (String line : signLines) {
|
||||
if (linecount <= 3) {
|
||||
signblock.setLine(
|
||||
linecount,
|
||||
MessageManager.replaceAll(line, "arenaname-" + arena.arenaName, "players-" + arena.playersInArena.size(), "maxplayers-"
|
||||
+ arena.maxPlayers, "timeleft-" + arena.timer));
|
||||
}
|
||||
|
||||
linecount = linecount + 1;
|
||||
}
|
||||
}
|
||||
signblock.update();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
} else {
|
||||
removeSign(loc);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
@ -1,8 +1,9 @@
|
||||
name: BlockHunt
|
||||
main: nl.Steffion.BlockHunt.BlockHunt
|
||||
main: net.knarcraft.blockhunt.BlockHunt
|
||||
version: ${plugin.version}
|
||||
api-version: ${spigot.api.version}
|
||||
authors:
|
||||
- EpicKnarvik97
|
||||
- Steffion
|
||||
description: An easy to set up, Hide and seek plugin. Hide as blocks from the killer seekers.
|
||||
softdepend: [ LibsDisguises, ProtocolLib, Multiverse-Core, My Worlds ]
|
||||
|
Loading…
Reference in New Issue
Block a user