~ Updated engine.

This commit is contained in:
Steffion 2013-09-22 15:32:02 +02:00
parent 4b6235d548
commit f2dc0f6211
40 changed files with 1388 additions and 1227 deletions

View File

@ -4,12 +4,11 @@ import java.util.ArrayList;
import java.util.List;
import nl.Steffion.BlockHunt.Arena.ArenaState;
import nl.Steffion.BlockHunt.PermissionsC.Permissions;
import nl.Steffion.BlockHunt.Managers.ConfigC;
import nl.Steffion.BlockHunt.Managers.MessageM;
import nl.Steffion.BlockHunt.Managers.MessageM.CType;
import nl.Steffion.BlockHunt.Managers.PlayerM;
import nl.Steffion.BlockHunt.Managers.PlayerM.PermsC;
import nl.Steffion.BlockHunt.Managers.PermissionsM;
import nl.Steffion.BlockHunt.Serializables.LocationSerializable;
import org.bukkit.Bukkit;
@ -38,19 +37,16 @@ public class ArenaHandler {
String... vars) {
for (Player player : arena.playersInArena) {
String pMessage = message.replaceAll("%player%", player.getName());
player.sendMessage(MessageM.replaceAll(CType.TAG(tag) + pMessage,
vars));
player.sendMessage(MessageM.replaceAll(CType.TAG() + pMessage, vars));
}
}
public static void sendFMessage(Arena arena, ConfigC location, Boolean tag,
String... vars) {
for (Player player : arena.playersInArena) {
String pMessage = location.config.getFile()
.get(location.getLocation()).toString()
.replaceAll("%player%", player.getName());
player.sendMessage(MessageM.replaceAll(CType.TAG(tag) + pMessage,
vars));
String pMessage = location.config.getFile().get(location.location)
.toString().replaceAll("%player%", player.getName());
player.sendMessage(MessageM.replaceAll(CType.TAG() + pMessage, vars));
}
}
@ -71,7 +67,7 @@ public class ArenaHandler {
found = true;
if (arena.disguiseBlocks.isEmpty()) {
MessageM.sendFMessage(player,
ConfigC.error_joinNoBlocksSet, true);
ConfigC.error_joinNoBlocksSet);
} else {
LocationSerializable zero = new LocationSerializable(
Bukkit.getWorld(player.getWorld().getName()
@ -84,11 +80,10 @@ public class ArenaHandler {
if (arena.gameState == ArenaState.WAITING
|| arena.gameState == ArenaState.STARTING) {
if (arena.playersInArena.size() >= arena.maxPlayers) {
if (!PlayerM.hasPerm(player,
PermsC.joinfull, false)) {
if (!PermissionsM.hasPerm(player,
Permissions.joinfull, false)) {
MessageM.sendFMessage(player,
ConfigC.error_joinFull,
true);
ConfigC.error_joinFull);
return;
}
}
@ -143,8 +138,7 @@ public class ArenaHandler {
List<String> lores = W.config
.getFile()
.getStringList(
ConfigC.shop_blockChooserDescription
.getLocation());
ConfigC.shop_blockChooserDescription.location);
List<String> lores2 = new ArrayList<String>();
for (String lore : lores) {
lores2.add(MessageM
@ -180,26 +174,26 @@ public class ArenaHandler {
}
} else {
MessageM.sendFMessage(player,
ConfigC.error_joinArenaIngame, true);
ConfigC.error_joinArenaIngame);
}
} else {
MessageM.sendFMessage(player,
ConfigC.error_joinWarpsNotSet, true);
ConfigC.error_joinWarpsNotSet);
}
} else {
MessageM.sendFMessage(player,
ConfigC.error_joinWarpsNotSet, true);
ConfigC.error_joinWarpsNotSet);
}
}
}
}
} else {
MessageM.sendFMessage(player, ConfigC.error_joinAlreadyJoined, true);
MessageM.sendFMessage(player, ConfigC.error_joinAlreadyJoined);
return;
}
if (!found) {
MessageM.sendFMessage(player, ConfigC.error_noArena, true, "name-"
MessageM.sendFMessage(player, ConfigC.error_noArena, "name-"
+ arenaname);
}
@ -311,7 +305,7 @@ public class ArenaHandler {
ScoreboardHandler.removeScoreboard(player);
MessageM.sendFMessage(player, ConfigC.normal_leaveYouLeft, true);
MessageM.sendFMessage(player, ConfigC.normal_leaveYouLeft);
if (message) {
ArenaHandler.sendFMessage(arena, ConfigC.normal_leaveLeftArena,
true, "playername-" + player.getName(), "1-"
@ -320,8 +314,7 @@ public class ArenaHandler {
}
} else {
if (message) {
MessageM.sendFMessage(player, ConfigC.error_leaveNotInArena,
true);
MessageM.sendFMessage(player, ConfigC.error_leaveNotInArena);
}
return;
}
@ -348,7 +341,7 @@ public class ArenaHandler {
playerTokens + arena.seekersTokenWin);
W.shop.save();
MessageM.sendFMessage(player, ConfigC.normal_addedToken, true,
MessageM.sendFMessage(player, ConfigC.normal_addedToken,
"amount-" + arena.seekersTokenWin);
}
}
@ -387,7 +380,7 @@ public class ArenaHandler {
W.shop.save();
MessageM.sendFMessage(player, ConfigC.normal_addedToken,
true, "amount-" + arena.hidersTokenWin);
"amount-" + arena.hidersTokenWin);
}
}
}

View File

@ -1,9 +1,26 @@
package nl.Steffion.BlockHunt;
import java.io.IOException;
import java.util.ArrayList;
import java.util.LinkedList;
import java.util.List;
import nl.Steffion.BlockHunt.Arena.ArenaState;
import nl.Steffion.BlockHunt.PermissionsC.Permissions;
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.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;
@ -17,9 +34,10 @@ import nl.Steffion.BlockHunt.Listeners.OnPlayerInteractEvent;
import nl.Steffion.BlockHunt.Listeners.OnPlayerMoveEvent;
import nl.Steffion.BlockHunt.Listeners.OnPlayerQuitEvent;
import nl.Steffion.BlockHunt.Listeners.OnSignChangeEvent;
import nl.Steffion.BlockHunt.Managers.CommandC;
import nl.Steffion.BlockHunt.Managers.ConfigC;
import nl.Steffion.BlockHunt.Managers.CommandM;
import nl.Steffion.BlockHunt.Managers.ConfigM;
import nl.Steffion.BlockHunt.Managers.MessageM;
import nl.Steffion.BlockHunt.Managers.PermissionsM;
import nl.Steffion.BlockHunt.Serializables.LocationSerializable;
import org.bukkit.Bukkit;
@ -38,6 +56,7 @@ import org.bukkit.enchantments.Enchantment;
import org.bukkit.entity.Player;
import org.bukkit.event.Listener;
import org.bukkit.inventory.ItemStack;
import org.bukkit.plugin.PluginDescriptionFile;
import org.bukkit.plugin.java.JavaPlugin;
import org.mcstats.Metrics;
@ -46,10 +65,54 @@ import pgDev.bukkit.DisguiseCraft.disguise.Disguise;
import pgDev.bukkit.DisguiseCraft.disguise.DisguiseType;
public class BlockHunt extends JavaPlugin implements Listener {
/*
* Made by @author Steffion, © 2013.
/**
* Steffion's Engine - Made by Steffion.
*
* You're allowed to use this engine for own usage, you're not allowed to
* republish the engine. Using this for your own plugin is allowed when a
* credit is placed somewhere in the plugin.
*
* Thanks for your cooperate!
*
* @author Steffion
*/
public static PluginDescriptionFile pdfFile;
@SuppressWarnings("serial")
public static List<String> BlockHuntCMD = new ArrayList<String>() {
{
add("info");
add("help");
add("reload");
add("join");
add("leave");
add("list");
add("shop");
add("start");
add("wand");
add("create");
add("set");
add("setwarp");
add("remove");
}
};
public static CommandM CMD;
public static CommandM CMDinfo;
public static CommandM CMDhelp;
public static CommandM CMDreload;
public static CommandM CMDjoin;
public static CommandM CMDleave;
public static CommandM CMDlist;
public static CommandM CMDshop;
public static CommandM CMDstart;
public static CommandM CMDwand;
public static CommandM CMDcreate;
public static CommandM CMDset;
public static CommandM CMDsetwarp;
public static CommandM CMDremove;
public void onEnable() {
getServer().getPluginManager().registerEvents(this, this);
@ -85,16 +148,78 @@ public class BlockHunt extends JavaPlugin implements Listener {
"BlockHuntLocation");
ConfigurationSerialization.registerClass(Arena.class, "BlockHuntArena");
W.newFiles();
pdfFile = getDescription();
ConfigM.newFiles();
CMD = new CommandM("BlockHunt", "BlockHunt", null, null,
Permissions.info, ConfigC.help_info,
(Boolean) W.config.get(ConfigC.commandEnabled_info),
BlockHuntCMD, new CMDinfo(), null);
CMDinfo = new CommandM("BlockHunt INFO", "BlockHunt", "info", "i",
Permissions.info, ConfigC.help_info,
(Boolean) W.config.get(ConfigC.commandEnabled_info),
BlockHuntCMD, new CMDinfo(), "/BlockHunt [info|i]");
CMDhelp = new CommandM("BlockHunt HELP", "BlockHunt", "help", "h",
Permissions.help, ConfigC.help_help,
(Boolean) W.config.get(ConfigC.commandEnabled_help),
BlockHuntCMD, new CMDhelp(),
"/BlockHunt <help|h> [page number]");
CMDreload = new CommandM("BlockHunt RELOAD", "BlockHunt", "reload",
"r", Permissions.reload, ConfigC.help_reload,
(Boolean) W.config.get(ConfigC.commandEnabled_reload),
BlockHuntCMD, new CMDreload(), "/BlockHunt <reload|r>");
CMDjoin = new CommandM("BlockHunt JOIN", "BlockHunt", "join", "j",
Permissions.join, ConfigC.help_join,
(Boolean) W.config.get(ConfigC.commandEnabled_join),
BlockHuntCMD, new CMDjoin(), "/BlockHunt <join|j> <arenaname>");
CMDleave = new CommandM("BlockHunt LEAVE", "BlockHunt", "leave", "l",
Permissions.leave, ConfigC.help_leave,
(Boolean) W.config.get(ConfigC.commandEnabled_leave),
BlockHuntCMD, new CMDleave(), "/BlockHunt <leave|l>");
CMDlist = new CommandM("BlockHunt LIST", "BlockHunt", "list", "li",
Permissions.list, ConfigC.help_list,
(Boolean) W.config.get(ConfigC.commandEnabled_list),
BlockHuntCMD, new CMDlist(), "/BlockHunt <list|li>");
CMDshop = new CommandM("BlockHunt SHOP", "BlockHunt", "shop", "sh",
Permissions.shop, ConfigC.help_shop,
(Boolean) W.config.get(ConfigC.commandEnabled_shop),
BlockHuntCMD, new CMDshop(), "/BlockHunt <shop|sh>");
CMDstart = new CommandM("BlockHunt START", "BlockHunt", "start", "go",
Permissions.start, ConfigC.help_start,
(Boolean) W.config.get(ConfigC.commandEnabled_start),
BlockHuntCMD, new CMDstart(),
"/BlockHunt <start|st> <arenaname>");
CMDwand = new CommandM("BlockHunt WAND", "BlockHunt", "wand", "w",
Permissions.create, ConfigC.help_wand,
(Boolean) W.config.get(ConfigC.commandEnabled_wand),
BlockHuntCMD, new CMDwand(), "/BlockHunt <wand|w>");
CMDcreate = new CommandM("BlockHunt CREATE", "BlockHunt", "create",
"c", Permissions.create, ConfigC.help_create,
(Boolean) W.config.get(ConfigC.commandEnabled_create),
BlockHuntCMD, new CMDcreate(),
"/BlockHunt <create|c> <arenaname>");
CMDset = new CommandM("BlockHunt SET", "BlockHunt", "set", "s",
Permissions.set, ConfigC.help_set,
(Boolean) W.config.get(ConfigC.commandEnabled_set),
BlockHuntCMD, new CMDset(), "/BlockHunt <set|s> <arenaname>");
CMDsetwarp = new CommandM("BlockHunt SETWARP", "BlockHunt", "setwarp",
"sw", Permissions.setwarp, ConfigC.help_setwarp,
(Boolean) W.config.get(ConfigC.commandEnabled_setwarp),
BlockHuntCMD, new CMDsetwarp(),
"/BlockHunt <setwarp|sw> <lobby|hiders|seekers> <arenaname>");
CMDremove = new CommandM("BlockHunt REMOVE", "BlockHunt", "remove",
"delete", Permissions.remove, ConfigC.help_remove,
(Boolean) W.config.get(ConfigC.commandEnabled_remove),
BlockHuntCMD, new CMDremove(),
"/BlockHunt <remove|delete> <arenaname>");
if (!getServer().getPluginManager().isPluginEnabled("DisguiseCraft")) {
MessageM.broadcastFMessage(ConfigC.error_disguiseCraftNotInstalled,
true);
MessageM.broadcastFMessage(ConfigC.error_disguiseCraftNotInstalled);
}
if (!getServer().getPluginManager().isPluginEnabled("ProtocolLib")) {
MessageM.broadcastFMessage(ConfigC.error_protocolLibNotInstalled,
true);
MessageM.broadcastFMessage(ConfigC.error_protocolLibNotInstalled);
}
W.dcAPI = DisguiseCraft.getAPI();
@ -108,38 +233,33 @@ public class BlockHunt extends JavaPlugin implements Listener {
metrics_fc.load(metrics.getConfigFile());
if (!metrics_fc.getBoolean("opt-out", false)) {
MessageM.sendMessage(null,
"%NSending %AMCStats %Nto their server.", true);
"%TAG%NSending %AMCStats %Nto their server.");
} else {
MessageM.sendMessage(
null,
"%EUnable to send %AMCStats %Eto their server. %AMCStats%E is disabled?",
true);
MessageM.sendMessage(null,
"%TAG%EUnable to send %AMCStats %Eto their server. %AMCStats%E is disabled?");
}
} catch (IOException e) {
MessageM.sendMessage(
null,
"%EUnable to send %AMCStats %Eto their server. Something went wrong ;(!",
true);
MessageM.sendMessage(null,
"%TAG%EUnable to send %AMCStats %Eto their server. Something went wrong ;(!");
} catch (InvalidConfigurationException e) {
MessageM.sendMessage(
null,
"%EUnable to send %AMCStats %Eto their server. Something went wrong ;(!",
true);
MessageM.sendMessage(null,
"%TAG%EUnable to send %AMCStats %Eto their server. Something went wrong ;(!");
}
if ((Boolean) W.config.get(ConfigC.autoUpdateCheck)) {
if ((Boolean) W.config.get(ConfigC.autoDownloadUpdate)) {
new Updater(this, W.pluginName, this.getFile(),
new Updater(this, pdfFile.getName(), this.getFile(),
Updater.UpdateType.DEFAULT, true);
} else {
new Updater(this, W.pluginName, this.getFile(),
new Updater(this, pdfFile.getName(), this.getFile(),
Updater.UpdateType.NO_DOWNLOAD, true);
}
}
MessageM.sendFMessage(null, ConfigC.log_Enabled, true, "name-"
+ W.pluginName, "version-" + W.pluginVersion, "autors-"
+ W.pluginAutors);
MessageM.sendFMessage(null, ConfigC.log_enabledPlugin, "name-"
+ BlockHunt.pdfFile.getName(),
"version-" + BlockHunt.pdfFile.getVersion(), "autors-"
+ BlockHunt.pdfFile.getAuthors().get(0));
getServer().getScheduler().runTaskTimer(this, new Runnable() {
@SuppressWarnings("deprecation")
@ -274,7 +394,6 @@ public class BlockHunt extends JavaPlugin implements Listener {
MessageM.sendFMessage(
arenaPlayer,
ConfigC.normal_ingameBlock,
true,
"block-"
+ block.getType()
.name()
@ -290,7 +409,6 @@ public class BlockHunt extends JavaPlugin implements Listener {
MessageM.sendFMessage(
arenaPlayer,
ConfigC.normal_ingameBlock,
true,
"block-"
+ block.getType()
.name()
@ -346,10 +464,8 @@ public class BlockHunt extends JavaPlugin implements Listener {
if (!arena.seekers.contains(arenaPlayer)) {
arenaPlayer.getInventory().addItem(
sword);
MessageM.sendFMessage(
arenaPlayer,
ConfigC.normal_ingameGivenSword,
true);
MessageM.sendFMessage(arenaPlayer,
ConfigC.normal_ingameGivenSword);
}
}
}
@ -478,7 +594,6 @@ public class BlockHunt extends JavaPlugin implements Listener {
MessageM.sendFMessage(
player,
ConfigC.normal_ingameNowSolid,
true,
"block-"
+ block.getType()
.name()
@ -495,7 +610,6 @@ public class BlockHunt extends JavaPlugin implements Listener {
MessageM.sendFMessage(
player,
ConfigC.normal_ingameNowSolid,
true,
"block-"
+ block.getType()
.name()
@ -522,8 +636,7 @@ public class BlockHunt extends JavaPlugin implements Listener {
} else {
MessageM.sendFMessage(
player,
ConfigC.warning_ingameNoSolidPlace,
true);
ConfigC.warning_ingameNoSolidPlace);
}
}
} else {
@ -556,19 +669,23 @@ public class BlockHunt extends JavaPlugin implements Listener {
ArenaHandler.stopArena(arena);
}
MessageM.sendFMessage(null, ConfigC.log_Disabled, true, "name-"
+ W.pluginName, "version-" + W.pluginVersion, "autors-"
+ W.pluginAutors);
MessageM.sendFMessage(null, ConfigC.log_disabledPlugin, "name-"
+ BlockHunt.pdfFile.getName(),
"version-" + BlockHunt.pdfFile.getVersion(), "autors-"
+ BlockHunt.pdfFile.getAuthors().get(0));
}
/**
* Build a string.
* Args to String. Makes 1 string.
*
* @param input
* String list which should be converted to a string.
* @param startArg
* @return
* Start on this length.
*
* @return The converted string.
*/
public static String argsBuild(String[] input, int startArg) {
public static String stringBuilder(String[] input, int startArg) {
if (input.length - startArg <= 0) {
return null;
}
@ -587,51 +704,70 @@ public class BlockHunt extends JavaPlugin implements Listener {
player = (Player) sender;
}
for (CommandC command : CommandC.values()) {
String[] commandArgsSplit = command.command.split("%");
String[] argsSplit = commandArgsSplit[1].split("_");
String[] argsSplitAlias = command.alias.split("%")[1].split("_");
for (CommandM command : W.commands) {
if (PermissionsM.hasPerm(player, command.permission, true)) {
String[] argsSplit = null;
String[] argsSplitAlias = null;
if (cmd.getName().equalsIgnoreCase(commandArgsSplit[0])) {
int i = 0;
boolean equals = true;
if (command.minLenght == 0) {
if (args.length == 0) {
equals = true;
} else {
equals = false;
}
} else {
if (args.length >= command.minLenght) {
for (String arg : argsSplit) {
for (String arga : argsSplitAlias) {
if (!arg.equalsIgnoreCase(args[i])
&& !arga.equalsIgnoreCase(args[i])) {
equals = false;
}
i = i + 1;
}
}
} else {
equals = false;
}
if (command.args != null && command.argsalias != null) {
argsSplit = command.args.split("/");
argsSplitAlias = command.argsalias.split("/");
}
if (equals) {
if (W.config.getFile().getBoolean(
command.enabled.getLocation())) {
command.cmd.exectue(player, cmd, label, args);
if (cmd.getName().equalsIgnoreCase(command.label)) {
boolean equals = true;
if (argsSplit == null) {
if (args.length == 0) {
equals = true;
} else {
equals = false;
}
} else {
MessageM.sendFMessage(player,
ConfigC.error_commandNotEnabled, true);
if (args.length >= argsSplit.length) {
for (int i2 = argsSplit.length - 1; i2 >= 0; i2 = i2 - 1) {
int loc = argsSplit.length - i2 - 1;
if (!argsSplit[loc].equalsIgnoreCase(args[loc])
&& !argsSplitAlias[loc]
.equalsIgnoreCase(args[loc])) {
equals = false;
}
}
} else {
equals = false;
}
}
return true;
if (equals) {
if (command.enabled) {
command.CMD.exectue(player, cmd, label, args);
} else {
MessageM.sendFMessage(player,
ConfigC.error_commandNotEnabled);
}
return true;
}
}
}
}
CommandC.NOT_FOUND.cmd.exectue(player, cmd, label, args);
CMDnotfound.exectue(player, cmd, label, args);
return true;
}
@Override
public List<String> onTabComplete(CommandSender sender, Command cmd,
String label, String[] args) {
for (CommandM command : W.commands) {
if (cmd.getName().equalsIgnoreCase(command.label)) {
if (args.length == 1) {
return command.mainTABlist;
}
}
}
return null;
}
}

View File

@ -3,14 +3,12 @@ package nl.Steffion.BlockHunt.Commands;
import java.util.ArrayList;
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.ScoreboardHandler;
import nl.Steffion.BlockHunt.W;
import nl.Steffion.BlockHunt.Arena.ArenaState;
import nl.Steffion.BlockHunt.Managers.CommandC;
import nl.Steffion.BlockHunt.Managers.ConfigC;
import nl.Steffion.BlockHunt.Managers.MessageM;
import nl.Steffion.BlockHunt.Managers.PlayerM;
import nl.Steffion.BlockHunt.Managers.PlayerM.PermsC;
import org.bukkit.Bukkit;
import org.bukkit.command.Command;
@ -22,51 +20,45 @@ public class CMDcreate extends DefaultCMD {
@Override
public boolean exectue(Player player, Command cmd, String label,
String[] args) {
if (PlayerM.hasPerm(player, PermsC.create, true)) {
if (player != null) {
if (args.length <= 1) {
MessageM.sendFMessage(player,
ConfigC.error_notEnoughArguments, true, "syntax-"
+ CommandC.CREATE.usage);
} else {
if (W.pos1.get(player) != null
&& W.pos2.get(player) != null) {
if (W.pos1.get(player).getWorld()
.equals(W.pos2.get(player).getWorld())) {
Arena arena = new Arena(args[1],
W.pos1.get(player), W.pos2.get(player), 12,
3, 1, 50, 20, 300, 30,
new ArrayList<ItemStack>(), null, null,
null, new ArrayList<String>(),
new ArrayList<String>(),
new ArrayList<String>(), 10, 50, 8,
new ArrayList<Player>(),
ArenaState.WAITING, 0,
new ArrayList<Player>(), Bukkit
.getScoreboardManager()
.getNewScoreboard());
W.arenas.getFile().set(args[1], arena);
W.arenas.save();
W.signs.load();
if (player != null) {
if (args.length <= 1) {
MessageM.sendFMessage(player, ConfigC.error_notEnoughArguments,
"syntax-" + BlockHunt.CMDcreate.usage);
} else {
if (W.pos1.get(player) != null && W.pos2.get(player) != null) {
if (W.pos1.get(player).getWorld()
.equals(W.pos2.get(player).getWorld())) {
Arena arena = new Arena(args[1], W.pos1.get(player),
W.pos2.get(player), 12, 3, 1, 50, 20, 300, 30,
new ArrayList<ItemStack>(), null, null, null,
new ArrayList<String>(),
new ArrayList<String>(),
new ArrayList<String>(), 10, 50, 8,
new ArrayList<Player>(), ArenaState.WAITING, 0,
new ArrayList<Player>(), Bukkit
.getScoreboardManager()
.getNewScoreboard());
W.arenas.getFile().set(args[1], arena);
W.arenas.save();
W.signs.load();
W.arenaList.add(arena);
ScoreboardHandler.createScoreboard(arena);
W.arenaList.add(arena);
ScoreboardHandler.createScoreboard(arena);
MessageM.sendFMessage(player,
ConfigC.normal_createCreatedArena, true,
"name-" + args[1]);
} else {
MessageM.sendFMessage(player,
ConfigC.error_createNotSameWorld, true);
}
MessageM.sendFMessage(player,
ConfigC.normal_createCreatedArena, "name-"
+ args[1]);
} else {
MessageM.sendFMessage(player,
ConfigC.error_createSelectionFirst, true);
ConfigC.error_createNotSameWorld);
}
} else {
MessageM.sendFMessage(player,
ConfigC.error_createSelectionFirst);
}
} else {
MessageM.sendFMessage(player, ConfigC.error_onlyIngame, true);
}
} else {
MessageM.sendFMessage(player, ConfigC.error_onlyIngame);
}
return true;
}

View File

@ -1,124 +1,124 @@
package nl.Steffion.BlockHunt.Commands;
import nl.Steffion.BlockHunt.ConfigC;
import nl.Steffion.BlockHunt.BlockHunt;
import nl.Steffion.BlockHunt.W;
import nl.Steffion.BlockHunt.Managers.CommandC;
import nl.Steffion.BlockHunt.Managers.ConfigC;
import nl.Steffion.BlockHunt.Managers.CommandM;
import nl.Steffion.BlockHunt.Managers.MessageM;
import nl.Steffion.BlockHunt.Managers.PlayerM;
import nl.Steffion.BlockHunt.Managers.PlayerM.PermsC;
import nl.Steffion.BlockHunt.Managers.PermissionsM;
import org.bukkit.command.Command;
import org.bukkit.entity.Player;
public class CMDhelp extends DefaultCMD {
/**
* Steffion's Engine - Made by Steffion.
*
* You're allowed to use this engine for own usage, you're not allowed to
* republish the engine. Using this for your own plugin is allowed when a
* credit is placed somewhere in the plugin.
*
* Thanks for your cooperate!
*
* @author Steffion
*/
@Override
public boolean exectue(Player player, Command cmd, String label,
String[] args) {
if (PlayerM.hasPerm(player, PermsC.help, true)) {
int amountCommands = 0;
for (CommandC command : CommandC.values()) {
if (command.usage != "-") {
amountCommands = amountCommands + 1;
int amountCommands = 0;
for (CommandM command : W.commands) {
if (command.usage != null) {
amountCommands = amountCommands + 1;
}
}
int maxPages = Math.round(amountCommands / 3);
if (maxPages <= 0) {
maxPages = 1;
}
if (args.length == 1) {
int page = 1;
MessageM.sendFMessage(player, ConfigC.chat_headerhigh, "header-"
+ BlockHunt.pdfFile.getName() + " %Nhelp page %A"
+ page + "%N/%A" + maxPages);
int i = 1;
for (CommandM command : W.commands) {
if (i <= 4) {
if (command.usage != null) {
if (PermissionsM.hasPerm(player, command.permission,
false)) {
MessageM.sendMessage(
player,
"%A"
+ command.usage
+ "%N - "
+ W.messages.getFile().get(
command.help.location));
} else {
MessageM.sendMessage(
player,
"%W"
+ command.usage
+ "%N - "
+ W.messages.getFile().get(
command.help.location));
}
i = i + 1;
}
}
}
int maxPages = Math.round(amountCommands / 3);
if (maxPages <= 0) {
maxPages = 1;
MessageM.sendFMessage(player, ConfigC.chat_headerhigh,
"header-&oHelp Page");
} else {
int page = 1;
try {
page = Integer.valueOf(args[1]);
} catch (NumberFormatException e) {
page = 1;
}
if (args.length == 1) {
int page = 1;
MessageM.sendFMessage(player, ConfigC.chat_headerhigh, false,
"header-" + W.pluginName + " %Nhelp page %A" + page
+ "%N/%A" + maxPages);
int i = 1;
for (CommandC command : CommandC.values()) {
if (i <= 4) {
if (command.usage != "-") {
if (PlayerM.hasPerm(player, command.perm, false)) {
if (maxPages < page) {
maxPages = page;
}
MessageM.sendFMessage(player, ConfigC.chat_headerhigh, "header-"
+ BlockHunt.pdfFile.getName() + " %Nhelp page %A"
+ page + "%N/%A" + maxPages);
int i = 1;
for (CommandM command : W.commands) {
if (i <= (page * 4) + 4) {
if (command.usage != null) {
if (i >= ((page - 1) * 4) + 1
&& i <= ((page - 1) * 4) + 4) {
if (PermissionsM.hasPerm(player,
command.permission, false)) {
MessageM.sendMessage(
player,
"%A/"
"%A"
+ command.usage
+ "%N - "
+ W.messages.getFile().get(
command.help
.getLocation()),
false);
command.help.location));
} else {
MessageM.sendMessage(
player,
"%W/"
"%W"
+ command.usage
+ "%N - "
+ W.messages.getFile().get(
command.help
.getLocation()),
false);
command.help.location));
}
i = i + 1;
}
i = i + 1;
}
}
MessageM.sendFMessage(player, ConfigC.chat_headerhigh, false,
"header-&oHelp Page");
} else {
int page = 1;
try {
page = Integer.valueOf(args[1]);
} catch (NumberFormatException e) {
page = 1;
}
if (maxPages < page) {
maxPages = page;
}
MessageM.sendFMessage(player, ConfigC.chat_headerhigh, false,
"header-" + W.pluginName + " %Nhelp page %A" + page
+ "%N/%A" + maxPages);
int i = 1;
for (CommandC command : CommandC.values()) {
if (i <= (page * 4) + 4) {
if (command.usage != "-") {
if (i >= ((page - 1) * 4) + 1
&& i <= ((page - 1) * 4) + 4) {
if (PlayerM
.hasPerm(player, command.perm, false)) {
MessageM.sendMessage(
player,
"%A/"
+ command.usage
+ "%N - "
+ W.messages
.getFile()
.get(command.help
.getLocation()),
false);
} else {
MessageM.sendMessage(
player,
"%W/"
+ command.usage
+ "%N - "
+ W.messages
.getFile()
.get(command.help
.getLocation()),
false);
}
}
i = i + 1;
}
}
}
MessageM.sendFMessage(player, ConfigC.chat_headerhigh, false,
"header-&oHelp Page");
}
MessageM.sendFMessage(player, ConfigC.chat_headerhigh,
"header-&oHelp Page");
}
return true;
}

View File

@ -1,39 +1,43 @@
package nl.Steffion.BlockHunt.Commands;
import nl.Steffion.BlockHunt.W;
import nl.Steffion.BlockHunt.Managers.CommandC;
import nl.Steffion.BlockHunt.Managers.ConfigC;
import nl.Steffion.BlockHunt.BlockHunt;
import nl.Steffion.BlockHunt.ConfigC;
import nl.Steffion.BlockHunt.Managers.MessageM;
import nl.Steffion.BlockHunt.Managers.PlayerM;
import nl.Steffion.BlockHunt.Managers.PlayerM.PermsC;
import org.bukkit.command.Command;
import org.bukkit.entity.Player;
public class CMDinfo extends DefaultCMD {
/**
* Steffion's Engine - Made by Steffion.
*
* You're allowed to use this engine for own usage, you're not allowed to
* republish the engine. Using this for your own plugin is allowed when a
* credit is placed somewhere in the plugin.
*
* Thanks for your cooperate!
*
* @author Steffion
*/
@Override
public boolean exectue(Player player, Command cmd, String label,
String[] args) {
if (PlayerM.hasPerm(player, PermsC.info, true)) {
MessageM.sendFMessage(player, ConfigC.chat_headerhigh, false,
"header-" + W.pluginName);
MessageM.sendMessage(player, "%A%name%%N made by %A%autors%%N.",
false, "name-" + W.pluginName, "autors-" + W.pluginAutors);
MessageM.sendMessage(player, "%NVersion: %A%version%%N.", false,
"version-" + W.pluginVersion);
MessageM.sendMessage(player, "%NType %A/%helpusage% %Nfor help.",
false, "helpusage-" + CommandC.HELP.usage);
MessageM.sendMessage(
player,
"%NDev-Page: %Ahttp://dev.bukkit.org/bukkit-plugins/blockhunt/",
false);
MessageM.sendMessage(player, "%NDonations are welcome!", false);
MessageM.sendMessage(player,
"%NMade by help from some friends &c<3%N!", false);
MessageM.sendFMessage(player, ConfigC.chat_headerhigh, false,
"header-&oInfo Page");
}
MessageM.sendFMessage(player, ConfigC.chat_headerhigh, "header-"
+ BlockHunt.pdfFile.getName());
MessageM.sendMessage(player, "%A%name%%N made by %A%autors%%N.",
"name-" + BlockHunt.pdfFile.getName(), "autors-"
+ BlockHunt.pdfFile.getAuthors().get(0));
MessageM.sendMessage(player, "%NVersion: %A%version%%N.", "version-"
+ BlockHunt.pdfFile.getVersion());
MessageM.sendMessage(player, "%NType %A%helpusage% %Nfor help.",
"helpusage-" + BlockHunt.CMDhelp.usage);
MessageM.sendMessage(player,
"%NDev-Page: %Ahttp://dev.bukkit.org/bukkit-plugins/blockhunt/");
MessageM.sendMessage(player, "%NDonations are welcome!");
MessageM.sendMessage(player, "%NMade by help from some friends &c<3%N!");
MessageM.sendFMessage(player, ConfigC.chat_headerhigh,
"header-&oInfo Page");
return true;
}
}

View File

@ -1,11 +1,10 @@
package nl.Steffion.BlockHunt.Commands;
import nl.Steffion.BlockHunt.ArenaHandler;
import nl.Steffion.BlockHunt.Managers.CommandC;
import nl.Steffion.BlockHunt.Managers.ConfigC;
import nl.Steffion.BlockHunt.BlockHunt;
import nl.Steffion.BlockHunt.ConfigC;
import nl.Steffion.BlockHunt.Managers.MessageM;
import nl.Steffion.BlockHunt.Managers.PlayerM;
import nl.Steffion.BlockHunt.Managers.PlayerM.PermsC;
import org.bukkit.command.Command;
import org.bukkit.entity.Player;
@ -14,18 +13,15 @@ public class CMDjoin extends DefaultCMD {
@Override
public boolean exectue(Player player, Command cmd, String label,
String[] args) {
if (PlayerM.hasPerm(player, PermsC.join, true)) {
if (player != null) {
if (args.length <= 1) {
MessageM.sendFMessage(player,
ConfigC.error_notEnoughArguments, true, "syntax-"
+ CommandC.JOIN.usage);
} else {
ArenaHandler.playerJoinArena(player, args[1]);
}
if (player != null) {
if (args.length <= 1) {
MessageM.sendFMessage(player, ConfigC.error_notEnoughArguments,
"syntax-" + BlockHunt.CMDjoin.usage);
} else {
MessageM.sendFMessage(player, ConfigC.error_onlyIngame, true);
ArenaHandler.playerJoinArena(player, args[1]);
}
} else {
MessageM.sendFMessage(player, ConfigC.error_onlyIngame);
}
return true;
}

View File

@ -1,10 +1,9 @@
package nl.Steffion.BlockHunt.Commands;
import nl.Steffion.BlockHunt.ArenaHandler;
import nl.Steffion.BlockHunt.Managers.ConfigC;
import nl.Steffion.BlockHunt.ConfigC;
import nl.Steffion.BlockHunt.Managers.MessageM;
import nl.Steffion.BlockHunt.Managers.PlayerM;
import nl.Steffion.BlockHunt.Managers.PlayerM.PermsC;
import org.bukkit.command.Command;
import org.bukkit.entity.Player;
@ -13,12 +12,10 @@ public class CMDleave extends DefaultCMD {
@Override
public boolean exectue(Player player, Command cmd, String label,
String[] args) {
if (PlayerM.hasPerm(player, PermsC.leave, true)) {
if (player != null) {
ArenaHandler.playerLeaveArena(player, true, true);
} else {
MessageM.sendFMessage(player, ConfigC.error_onlyIngame, true);
}
if (player != null) {
ArenaHandler.playerLeaveArena(player, true, true);
} else {
MessageM.sendFMessage(player, ConfigC.error_onlyIngame);
}
return true;
}

View File

@ -1,11 +1,10 @@
package nl.Steffion.BlockHunt.Commands;
import nl.Steffion.BlockHunt.Arena;
import nl.Steffion.BlockHunt.BlockHunt;
import nl.Steffion.BlockHunt.ConfigC;
import nl.Steffion.BlockHunt.W;
import nl.Steffion.BlockHunt.Managers.ConfigC;
import nl.Steffion.BlockHunt.Managers.MessageM;
import nl.Steffion.BlockHunt.Managers.PlayerM;
import nl.Steffion.BlockHunt.Managers.PlayerM.PermsC;
import org.bukkit.command.Command;
import org.bukkit.entity.Player;
@ -15,23 +14,19 @@ public class CMDlist extends DefaultCMD {
@Override
public boolean exectue(Player player, Command cmd, String label,
String[] args) {
if (PlayerM.hasPerm(player, PermsC.list, true)) {
MessageM.sendFMessage(player, ConfigC.chat_headerhigh, false,
"header-" + W.pluginName);
if (W.arenaList.size() >= 1) {
for (Arena arena : W.arenaList) {
MessageM.sendMessage(player, "&7Available arena(s):", false);
MessageM.sendMessage(player, "%A" + arena.arenaName, false);
}
} else {
MessageM.sendMessage(player, "&7&oNo arenas available...",
false);
MessageM.sendMessage(player,
"&7&oCreate an arena first please.", false);
MessageM.sendFMessage(player, ConfigC.chat_headerhigh, "header-"
+ BlockHunt.pdfFile.getName());
if (W.arenaList.size() >= 1) {
for (Arena arena : W.arenaList) {
MessageM.sendMessage(player, "&7Available arena(s):");
MessageM.sendMessage(player, "%A" + arena.arenaName);
}
MessageM.sendFMessage(player, ConfigC.chat_headerhigh, false,
"header-&oArenas list");
} else {
MessageM.sendMessage(player, "&7&oNo arenas available...");
MessageM.sendMessage(player, "&7&oCreate an arena first please.");
}
MessageM.sendFMessage(player, ConfigC.chat_headerhigh,
"header-&oArenas list");
return true;
}
}

View File

@ -1,16 +1,27 @@
package nl.Steffion.BlockHunt.Commands;
import nl.Steffion.BlockHunt.Managers.ConfigC;
import nl.Steffion.BlockHunt.ConfigC;
import nl.Steffion.BlockHunt.Managers.MessageM;
import org.bukkit.command.Command;
import org.bukkit.entity.Player;
public class CMDnotfound extends DefaultCMD {
@Override
public boolean exectue(Player player, Command cmd, String label,
public class CMDnotfound {
/**
* Steffion's Engine - Made by Steffion.
*
* You're allowed to use this engine for own usage, you're not allowed to
* republish the engine. Using this for your own plugin is allowed when a
* credit is placed somewhere in the plugin.
*
* Thanks for your cooperate!
*
* @author Steffion
*/
public static boolean exectue(Player player, Command cmd, String label,
String[] args) {
MessageM.sendFMessage(player, ConfigC.error_commandNotFound, true);
MessageM.sendFMessage(player, ConfigC.error_commandNotFound);
return true;
}
}

View File

@ -2,34 +2,43 @@ package nl.Steffion.BlockHunt.Commands;
import nl.Steffion.BlockHunt.Arena;
import nl.Steffion.BlockHunt.ArenaHandler;
import nl.Steffion.BlockHunt.ConfigC;
import nl.Steffion.BlockHunt.W;
import nl.Steffion.BlockHunt.Managers.ConfigC;
import nl.Steffion.BlockHunt.Managers.ConfigM;
import nl.Steffion.BlockHunt.Managers.MessageM;
import nl.Steffion.BlockHunt.Managers.PlayerM;
import nl.Steffion.BlockHunt.Managers.PlayerM.PermsC;
import org.bukkit.command.Command;
import org.bukkit.entity.Player;
public class CMDreload extends DefaultCMD {
/**
* Steffion's Engine - Made by Steffion.
*
* You're allowed to use this engine for own usage, you're not allowed to
* republish the engine. Using this for your own plugin is allowed when a
* credit is placed somewhere in the plugin.
*
* Thanks for your cooperate!
*
* @author Steffion
*/
@Override
public boolean exectue(Player player, Command cmd, String label,
String[] args) {
if (PlayerM.hasPerm(player, PermsC.reload, true)) {
W.config.load();
W.messages.load();
W.arenas.load();
W.signs.load();
W.shop.load();
for (Arena arena : W.arenaList) {
ArenaHandler.stopArena(arena);
}
ConfigM.newFiles();
ArenaHandler.loadArenas();
W.newFiles();
MessageM.sendFMessage(player, ConfigC.normal_reloadedConfigs, true);
W.config.load();
W.messages.load();
W.arenas.load();
W.signs.load();
W.shop.load();
for (Arena arena : W.arenaList) {
ArenaHandler.stopArena(arena);
}
ArenaHandler.loadArenas();
MessageM.sendFMessage(player, ConfigC.normal_reloadedConfigs);
return true;
}
}

View File

@ -1,12 +1,10 @@
package nl.Steffion.BlockHunt.Commands;
import nl.Steffion.BlockHunt.Arena;
import nl.Steffion.BlockHunt.BlockHunt;
import nl.Steffion.BlockHunt.ConfigC;
import nl.Steffion.BlockHunt.W;
import nl.Steffion.BlockHunt.Managers.CommandC;
import nl.Steffion.BlockHunt.Managers.ConfigC;
import nl.Steffion.BlockHunt.Managers.MessageM;
import nl.Steffion.BlockHunt.Managers.PlayerM;
import nl.Steffion.BlockHunt.Managers.PlayerM.PermsC;
import nl.Steffion.BlockHunt.Serializables.LocationSerializable;
import org.bukkit.Effect;
@ -21,48 +19,45 @@ public class CMDremove extends DefaultCMD {
@Override
public boolean exectue(Player player, Command cmd, String label,
String[] args) {
if (PlayerM.hasPerm(player, PermsC.remove, true)) {
if (player != null) {
if (args.length <= 1) {
MessageM.sendFMessage(player,
ConfigC.error_notEnoughArguments, true, "syntax-"
+ CommandC.REMOVE.usage);
} else {
for (Arena arena : W.arenaList) {
if (args[1].equalsIgnoreCase(arena.arenaName)) {
MessageM.sendFMessage(player,
ConfigC.normal_removeRemovedArena, true,
"name-" + args[1]);
W.arenas.getFile().set(args[1], null);
for (String sign : W.signs.getFile().getKeys(false)) {
if (W.signs.getFile().get(sign + ".arenaName")
.toString().equalsIgnoreCase(args[1])) {
LocationSerializable signLoc = new LocationSerializable(
(Location) W.signs.getFile().get(
sign + ".location"));
signLoc.getBlock().setType(Material.AIR);
signLoc.getWorld().playEffect(signLoc,
Effect.MOBSPAWNER_FLAMES, 0);
signLoc.getWorld().playSound(signLoc,
Sound.ENDERDRAGON_WINGS, 1, 1);
W.signs.getFile().set(sign, null);
}
}
W.arenas.save();
W.signs.load();
W.arenaList.remove((Arena) arena);
return true;
}
}
MessageM.sendFMessage(player, ConfigC.error_noArena, true,
"name-" + args[1]);
}
if (player != null) {
if (args.length <= 1) {
MessageM.sendFMessage(player, ConfigC.error_notEnoughArguments,
"syntax-" + BlockHunt.CMDremove.usage);
} else {
MessageM.sendFMessage(player, ConfigC.error_onlyIngame, true);
for (Arena arena : W.arenaList) {
if (args[1].equalsIgnoreCase(arena.arenaName)) {
MessageM.sendFMessage(player,
ConfigC.normal_removeRemovedArena, "name-"
+ args[1]);
W.arenas.getFile().set(args[1], null);
for (String sign : W.signs.getFile().getKeys(false)) {
if (W.signs.getFile().get(sign + ".arenaName")
.toString().equalsIgnoreCase(args[1])) {
LocationSerializable signLoc = new LocationSerializable(
(Location) W.signs.getFile().get(
sign + ".location"));
signLoc.getBlock().setType(Material.AIR);
signLoc.getWorld().playEffect(signLoc,
Effect.MOBSPAWNER_FLAMES, 0);
signLoc.getWorld().playSound(signLoc,
Sound.ENDERDRAGON_WINGS, 1, 1);
W.signs.getFile().set(sign, null);
}
}
W.arenas.save();
W.signs.load();
W.arenaList.remove((Arena) arena);
return true;
}
}
MessageM.sendFMessage(player, ConfigC.error_noArena, "name-"
+ args[1]);
}
} else {
MessageM.sendFMessage(player, ConfigC.error_onlyIngame);
}
return true;
}

View File

@ -1,11 +1,9 @@
package nl.Steffion.BlockHunt.Commands;
import nl.Steffion.BlockHunt.BlockHunt;
import nl.Steffion.BlockHunt.ConfigC;
import nl.Steffion.BlockHunt.InventoryHandler;
import nl.Steffion.BlockHunt.Managers.CommandC;
import nl.Steffion.BlockHunt.Managers.ConfigC;
import nl.Steffion.BlockHunt.Managers.MessageM;
import nl.Steffion.BlockHunt.Managers.PlayerM;
import nl.Steffion.BlockHunt.Managers.PlayerM.PermsC;
import org.bukkit.command.Command;
import org.bukkit.entity.Player;
@ -15,19 +13,16 @@ public class CMDset extends DefaultCMD {
@Override
public boolean exectue(Player player, Command cmd, String label,
String[] args) {
if (PlayerM.hasPerm(player, PermsC.set, true)) {
if (player != null) {
if (args.length <= 1) {
MessageM.sendFMessage(player,
ConfigC.error_notEnoughArguments, true, "syntax-"
+ CommandC.SET.usage);
} else {
String arenaname = args[1];
InventoryHandler.openPanel(player, arenaname);
}
if (player != null) {
if (args.length <= 1) {
MessageM.sendFMessage(player, ConfigC.error_notEnoughArguments,
"syntax-" + BlockHunt.CMDset.usage);
} else {
MessageM.sendFMessage(player, ConfigC.error_onlyIngame, true);
String arenaname = args[1];
InventoryHandler.openPanel(player, arenaname);
}
} else {
MessageM.sendFMessage(player, ConfigC.error_onlyIngame);
}
return true;
}

View File

@ -2,12 +2,10 @@ package nl.Steffion.BlockHunt.Commands;
import nl.Steffion.BlockHunt.Arena;
import nl.Steffion.BlockHunt.ArenaHandler;
import nl.Steffion.BlockHunt.BlockHunt;
import nl.Steffion.BlockHunt.ConfigC;
import nl.Steffion.BlockHunt.W;
import nl.Steffion.BlockHunt.Managers.CommandC;
import nl.Steffion.BlockHunt.Managers.ConfigC;
import nl.Steffion.BlockHunt.Managers.MessageM;
import nl.Steffion.BlockHunt.Managers.PlayerM;
import nl.Steffion.BlockHunt.Managers.PlayerM.PermsC;
import nl.Steffion.BlockHunt.Serializables.LocationSerializable;
import org.bukkit.command.Command;
@ -18,56 +16,53 @@ public class CMDsetwarp extends DefaultCMD {
@Override
public boolean exectue(Player player, Command cmd, String label,
String[] args) {
if (PlayerM.hasPerm(player, PermsC.set, true)) {
if (player != null) {
if (args.length <= 2) {
MessageM.sendFMessage(player,
ConfigC.error_notEnoughArguments, true, "syntax-"
+ CommandC.SETWARP.usage);
} else {
String arenaname = args[2];
String warpname = args[1];
if (player != null) {
if (args.length <= 2) {
MessageM.sendFMessage(player, ConfigC.error_notEnoughArguments,
"syntax-" + BlockHunt.CMDsetwarp.usage);
} else {
String arenaname = args[2];
String warpname = args[1];
Arena arena = null;
for (Arena arena2 : W.arenaList) {
if (arena2.arenaName.equalsIgnoreCase(arenaname)) {
arena = arena2;
}
}
if (arena != null) {
LocationSerializable loc = new LocationSerializable(
player.getLocation());
if (warpname.equalsIgnoreCase("lobby")) {
arena.lobbyWarp = loc;
save(arena);
MessageM.sendFMessage(player,
ConfigC.normal_setwarpWarpSet, true,
"warp-" + warpname);
} else if (warpname.equalsIgnoreCase("hiders")) {
arena.hidersWarp = loc;
save(arena);
MessageM.sendFMessage(player,
ConfigC.normal_setwarpWarpSet, true,
"warp-" + warpname);
} else if (warpname.equalsIgnoreCase("seekers")) {
arena.seekersWarp = loc;
save(arena);
MessageM.sendFMessage(player,
ConfigC.normal_setwarpWarpSet, true,
"warp-" + warpname);
} else {
MessageM.sendFMessage(player,
ConfigC.error_setwarpWarpNotFound, true,
"warp-" + warpname);
}
} else {
MessageM.sendFMessage(player, ConfigC.error_noArena,
true, "name-" + arenaname);
Arena arena = null;
for (Arena arena2 : W.arenaList) {
if (arena2.arenaName.equalsIgnoreCase(arenaname)) {
arena = arena2;
}
}
} else {
MessageM.sendFMessage(player, ConfigC.error_onlyIngame, true);
if (arena != null) {
LocationSerializable loc = new LocationSerializable(
player.getLocation());
if (warpname.equalsIgnoreCase("lobby")) {
arena.lobbyWarp = loc;
save(arena);
MessageM.sendFMessage(player,
ConfigC.normal_setwarpWarpSet, "warp-"
+ warpname);
} else if (warpname.equalsIgnoreCase("hiders")) {
arena.hidersWarp = loc;
save(arena);
MessageM.sendFMessage(player,
ConfigC.normal_setwarpWarpSet, "warp-"
+ warpname);
} else if (warpname.equalsIgnoreCase("seekers")) {
arena.seekersWarp = loc;
save(arena);
MessageM.sendFMessage(player,
ConfigC.normal_setwarpWarpSet, "warp-"
+ warpname);
} else {
MessageM.sendFMessage(player,
ConfigC.error_setwarpWarpNotFound, "warp-"
+ warpname);
}
} else {
MessageM.sendFMessage(player, ConfigC.error_noArena,
"name-" + arenaname);
}
}
} else {
MessageM.sendFMessage(player, ConfigC.error_onlyIngame);
}
return true;
}

View File

@ -1,8 +1,6 @@
package nl.Steffion.BlockHunt.Commands;
import nl.Steffion.BlockHunt.InventoryHandler;
import nl.Steffion.BlockHunt.Managers.PlayerM;
import nl.Steffion.BlockHunt.Managers.PlayerM.PermsC;
import org.bukkit.command.Command;
import org.bukkit.entity.Player;
@ -12,9 +10,7 @@ public class CMDshop extends DefaultCMD {
@Override
public boolean exectue(Player player, Command cmd, String label,
String[] args) {
if (PlayerM.hasPerm(player, PermsC.shop, true)) {
InventoryHandler.openShop(player);
}
InventoryHandler.openShop(player);
return true;
}
}

View File

@ -2,12 +2,10 @@ package nl.Steffion.BlockHunt.Commands;
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.W;
import nl.Steffion.BlockHunt.Managers.CommandC;
import nl.Steffion.BlockHunt.Managers.ConfigC;
import nl.Steffion.BlockHunt.Managers.MessageM;
import nl.Steffion.BlockHunt.Managers.PlayerM;
import nl.Steffion.BlockHunt.Managers.PlayerM.PermsC;
import org.bukkit.command.Command;
import org.bukkit.entity.Player;
@ -17,54 +15,50 @@ public class CMDstart extends DefaultCMD {
@Override
public boolean exectue(Player player, Command cmd, String label,
String[] args) {
if (PlayerM.hasPerm(player, PermsC.start, true)) {
if (player != null) {
if (args.length <= 1) {
MessageM.sendFMessage(player,
ConfigC.error_notEnoughArguments, true, "syntax-"
+ CommandC.START.usage);
} else {
Arena arena = null;
for (Arena arena2 : W.arenaList) {
if (arena2.arenaName.equalsIgnoreCase(args[1])) {
arena = arena2;
}
}
if (arena != null) {
if (arena.gameState.equals(ArenaState.WAITING)) {
if (arena.playersInArena.size() >= 2) {
arena.timer = 11;
arena.gameState = ArenaState.STARTING;
MessageM.sendFMessage(player,
ConfigC.normal_startForced, true,
"arenaname-" + arena.arenaName);
} else {
MessageM.sendFMessage(player,
ConfigC.warning_lobbyNeedAtleast, true,
"1-2");
}
} else if (arena.gameState.equals(ArenaState.STARTING)) {
if (arena.playersInArena.size() < arena.maxPlayers) {
if (arena.timer >= 10) {
arena.timer = 11;
}
} else {
arena.timer = 1;
}
MessageM.sendFMessage(player,
ConfigC.normal_startForced, true,
"arenaname-" + arena.arenaName);
}
} else {
MessageM.sendFMessage(player, ConfigC.error_noArena,
true, "name-" + args[1]);
if (player != null) {
if (args.length <= 1) {
MessageM.sendFMessage(player, ConfigC.error_notEnoughArguments,
"syntax-" + BlockHunt.CMDstart.usage);
} else {
Arena arena = null;
for (Arena arena2 : W.arenaList) {
if (arena2.arenaName.equalsIgnoreCase(args[1])) {
arena = arena2;
}
}
} else {
MessageM.sendFMessage(player, ConfigC.error_onlyIngame, true);
if (arena != null) {
if (arena.gameState.equals(ArenaState.WAITING)) {
if (arena.playersInArena.size() >= 2) {
arena.timer = 11;
arena.gameState = ArenaState.STARTING;
MessageM.sendFMessage(player,
ConfigC.normal_startForced, "arenaname-"
+ arena.arenaName);
} else {
MessageM.sendFMessage(player,
ConfigC.warning_lobbyNeedAtleast, "1-2");
}
} else if (arena.gameState.equals(ArenaState.STARTING)) {
if (arena.playersInArena.size() < arena.maxPlayers) {
if (arena.timer >= 10) {
arena.timer = 11;
}
} else {
arena.timer = 1;
}
MessageM.sendFMessage(player,
ConfigC.normal_startForced, "arenaname-"
+ arena.arenaName);
}
} else {
MessageM.sendFMessage(player, ConfigC.error_noArena,
"name-" + args[1]);
}
}
} else {
MessageM.sendFMessage(player, ConfigC.error_onlyIngame);
}
return true;
}

View File

@ -3,11 +3,9 @@ package nl.Steffion.BlockHunt.Commands;
import java.util.ArrayList;
import java.util.List;
import nl.Steffion.BlockHunt.ConfigC;
import nl.Steffion.BlockHunt.W;
import nl.Steffion.BlockHunt.Managers.ConfigC;
import nl.Steffion.BlockHunt.Managers.MessageM;
import nl.Steffion.BlockHunt.Managers.PlayerM;
import nl.Steffion.BlockHunt.Managers.PlayerM.PermsC;
import org.bukkit.Material;
import org.bukkit.Sound;
@ -21,33 +19,29 @@ public class CMDwand extends DefaultCMD {
@Override
public boolean exectue(Player player, Command cmd, String label,
String[] args) {
if (PlayerM.hasPerm(player, PermsC.create, true)) {
if (player != null) {
ItemStack wand = new ItemStack(
Material.getMaterial((Integer) W.config
.get(ConfigC.wandID)));
ItemMeta im = wand.getItemMeta();
im.setDisplayName(MessageM.replaceAll((String) W.config
.get(ConfigC.wandName)));
W.config.load();
List<String> lores = W.config.getFile().getStringList(
ConfigC.wandDescription.getLocation());
List<String> lores2 = new ArrayList<String>();
for (String lore : lores) {
lores2.add(MessageM.replaceAll(lore));
}
im.setLore(lores2);
wand.setItemMeta(im);
player.getInventory().addItem(wand);
player.playSound(player.getLocation(), Sound.ORB_PICKUP, 5, 0);
MessageM.sendFMessage(player, ConfigC.normal_wandGaveWand, true,
"type-"
+ wand.getType().toString()
.replaceAll("_", " ").toLowerCase());
} else {
MessageM.sendFMessage(player, ConfigC.error_onlyIngame, true);
if (player != null) {
ItemStack wand = new ItemStack(
Material.getMaterial((Integer) W.config.get(ConfigC.wandID)));
ItemMeta im = wand.getItemMeta();
im.setDisplayName(MessageM.replaceAll((String) W.config
.get(ConfigC.wandName)));
W.config.load();
List<String> lores = W.config.getFile().getStringList(
ConfigC.wandDescription.location);
List<String> lores2 = new ArrayList<String>();
for (String lore : lores) {
lores2.add(MessageM.replaceAll(lore));
}
im.setLore(lores2);
wand.setItemMeta(im);
player.getInventory().addItem(wand);
player.playSound(player.getLocation(), Sound.ORB_PICKUP, 5, 0);
MessageM.sendFMessage(player, ConfigC.normal_wandGaveWand, "type-"
+ wand.getType().toString().replaceAll("_", " ")
.toLowerCase());
} else {
MessageM.sendFMessage(player, ConfigC.error_onlyIngame);
}
return true;
}

View File

@ -6,11 +6,22 @@ import org.bukkit.command.Command;
import org.bukkit.entity.Player;
public class DefaultCMD {
/**
* Steffion's Engine - Made by Steffion.
*
* You're allowed to use this engine for own usage, you're not allowed to
* republish the engine. Using this for your own plugin is allowed when a
* credit is placed somewhere in the plugin.
*
* Thanks for your cooperate!
*
* @author Steffion
*/
public boolean exectue(Player player, Command cmd, String label,
String[] args) {
MessageM.sendMessage(player, "%NExample of a Command!", true);
//TODO Place the command stuff here.
MessageM.sendMessage(player, "%TAG%NExample of a Command!");
// TODO Place the command stuff here.
return true;
}
}

View File

@ -0,0 +1,231 @@
package nl.Steffion.BlockHunt;
import nl.Steffion.BlockHunt.Managers.ConfigM;
public enum ConfigC {
/**
* Steffion's Engine - Made by Steffion.
*
* You're allowed to use this engine for own usage, you're not allowed to
* republish the engine. Using this for your own plugin is allowed when a
* credit is placed somewhere in the plugin.
*
* Thanks for your cooperate!
*
* @author Steffion
*/
chat_tag ("[" + BlockHunt.pdfFile.getName() + "] ", W.config),
chat_normal ("&b", W.config),
chat_warning ("&c", W.config),
chat_error ("&c", W.config),
chat_arg ("&e", W.config),
chat_header ("&9", W.config),
chat_headerhigh ("%H_______.[ %A%header%%H ]._______", W.config),
commandEnabled_info (true, W.config),
commandEnabled_help (true, W.config),
commandEnabled_reload (true, W.config),
commandEnabled_join (true, W.config),
commandEnabled_leave (true, W.config),
commandEnabled_list (true, W.config),
commandEnabled_shop (true, W.config),
commandEnabled_start (true, W.config),
commandEnabled_wand (true, W.config),
commandEnabled_create (true, W.config),
commandEnabled_set (true, W.config),
commandEnabled_setwarp (true, W.config),
commandEnabled_remove (true, W.config),
autoUpdateCheck (true, W.config),
autoDownloadUpdate (false, W.config),
wandID (280, W.config),
wandName ("%A&l" + BlockHunt.pdfFile.getName() + "%N's selection wand",
W.config),
wandDescription (new String[] {
"%NUse this item to select an arena for your arena.",
"%ALeft-Click%N to select point #1.",
"%ARight-Click%N to select point #2.",
"%NUse the create command to define your arena.",
"%A/" + BlockHunt.pdfFile.getName() + " <help|h>" }, W.config),
shop_price ("%NPrice: %A%amount% %Ntokens.", W.config),
shop_blockChooserEnabled (true, W.config),
shop_blockChooserID (340, W.config),
shop_blockChooserPrice (3000, W.config),
shop_blockChooserName ("%H&lBlock Chooser", W.config),
shop_blockChooserDescription (new String[] {
"%NUse this item before the arena starts.",
"%ARight-Click%N in the lobby and choose",
"%Nthe block you want to be!", "&6Unlimited uses." }, W.config),
shop_BlockHuntPassEnabled (true, W.config),
shop_BlockHuntPassID (421, W.config),
shop_BlockHuntPassPrice (150, W.config),
shop_BlockHuntPassName ("%H&lBlockHunt Pass", W.config),
shop_BlockHuntPassDescription (new String[] {
"%NUse this item before the arena starts.",
"%ARight-Click%N in the lobby and choose",
"%Nif you want to be a Hider or a Seeker!", "&61 use.",
"&c&lCOMING SOON!" }, W.config),
sign_LEAVE (new String[] { "%H[" + BlockHunt.pdfFile.getName() + "%H]",
"&4LEAVE", "&8Right-Click", "&8To leave." }, W.config),
sign_WAITING (new String[] { "%H[" + BlockHunt.pdfFile.getName() + "%H]",
"%A%arenaname%", "%A%players%%N/%A%maxplayers%", "&8Waiting..." },
W.config),
sign_STARTING (new String[] { "%H[" + BlockHunt.pdfFile.getName() + "%H]",
"%A%arenaname%", "%A%players%%N/%A%maxplayers%",
"&2Start: %A%timeleft%" }, W.config),
sign_INGAME (new String[] { "%H[" + BlockHunt.pdfFile.getName() + "%H]",
"%A%arenaname%", "%A%players%%N/%A%maxplayers%",
"%EIngame: %A%timeleft%" }, W.config),
scoreboard_timeleft ("%ATime left:", W.config),
scoreboard_seekers ("%NSeekers:", W.config),
scoreboard_hiders ("%NHiders:", W.config),
log_enabledPlugin ("%TAG%N%name%&a&k + %N%version% is now Enabled. Made by %A%autors%%N.",
W.messages),
log_disabledPlugin ("%TAG%N%name%&c&k - %N%version% is now Disabled. Made by %A%autors%%N.",
W.messages),
help_info ("%NDisplays the plugin's info.", W.messages),
help_help ("%NShows a list of commands.", W.messages),
help_reload ("%NReloads all configs.", W.messages),
help_join ("%NJoins a " + BlockHunt.pdfFile.getName() + " game.",
W.messages),
help_leave ("%NLeave a " + BlockHunt.pdfFile.getName() + " game.",
W.messages),
help_list ("%NShows a list of available arenas.", W.messages),
help_shop ("%NOpens the " + BlockHunt.pdfFile.getName() + " shop.",
W.messages),
help_start ("%NForces an arena to start.", W.messages),
help_wand ("%NGives you the wand selection tool.", W.messages),
help_create ("%NCreates an arena from your selection.", W.messages),
help_set ("%NOpens a panel to set settings.", W.messages),
help_setwarp ("%NSets warps for your arena.", W.messages),
help_remove ("%NDeletes an Arena.", W.messages),
button_add ("%NAdd %A%1%%N to %A%2%%N", W.messages),
button_add2 ("Add", W.messages),
button_setting ("%NSetting %A%1%%N is now: %A%2%%N.", W.messages),
button_remove ("%NRemove %A%1%%N from %A%2%%N", W.messages),
button_remove2 ("Remove", W.messages),
normal_reloadedConfigs ("%TAG&aReloaded all configs!", W.messages),
normal_joinJoinedArena ("%TAG%A%playername%%N joined your arena. (%A%1%%N/%A%2%%N)",
W.messages),
normal_leaveYouLeft ("%TAG%NYou left the arena! Thanks for playing ;)!",
W.messages),
normal_leaveLeftArena ("%TAG%A%playername%%N left your arena. (%A%1%%N/%A%2%%N)",
W.messages),
normal_startForced ("%TAG%NYou forced to start arena '%A%arenaname%%N'!",
W.messages),
normal_wandGaveWand ("%TAG%NHere you go ;)! &o(Use the %A&o%type%%N&o!)",
W.messages),
normal_wandSetPosition ("%TAG%NSet position %A#%number%%N to location: (%A%x%%N, %A%y%%N, %A%z%%N).",
W.messages),
normal_createCreatedArena ("%TAG%NCreated an arena with the name '%A%name%%N'.",
W.messages),
normal_lobbyArenaIsStarting ("%TAG%NThe arena will start in %A%1%%N second(s)!",
W.messages),
normal_lobbyArenaStarted ("%TAG%NThe arena has been started! The seeker is coming to find you in %A%secs%%N seconds!",
W.messages),
normal_ingameSeekerChoosen ("%TAG%NPlayer %A%seeker%%N has been choosen as seeker!",
W.messages),
normal_ingameBlock ("%TAG%NYou're disguised as a(n) '%A%block%%N' block.",
W.messages),
normal_ingameArenaEnd ("%TAG%NThe arena will end in %A%1%%N second(s)!",
W.messages),
normal_ingameGivenSword ("%TAG%NYou were given a sword!", W.messages),
normal_HiderDied ("%TAG%NHider %A%playername%%N died! %A%left%%N hider(s) remain...",
W.messages),
normal_SeekerDied ("%TAG%NSeeker %A%playername%%N died! He will respawn in %A%secs%%N seconds!",
W.messages),
normal_winSeekers ("%TAG%NThe %ASEEKERS%N have won!", W.messages),
normal_winHiders ("%TAG%NThe %AHIDERS%N have won!", W.messages),
normal_setwarpWarpSet ("%TAG%NSet warp '%A%warp%%N' to your location!",
W.messages),
normal_addedToken ("%TAG%A%amount%%N tokens were added to your account!",
W.messages),
normal_removeRemovedArena ("%TAG%NRemoved arena '%A%name%%N'!", W.messages),
normal_ingameNowSolid ("%TAG%NYou're now a solid '%A%block%%N' block!",
W.messages),
normal_ingameNoMoreSolid ("%TAG%NYou're no longer a solid block!",
W.messages),
normal_ShopBoughtItem ("%TAG%NYou've bought the '%A%itemname%%N' item!",
W.messages),
normal_ShopChoosenBlock ("%TAG%NYou've choosen to be a(n) '%A%block%%N' block!",
W.messages),
warning_lobbyNeedAtleast ("%TAG%WYou need atleast %A%1%%W player(s) to start the game!",
W.messages),
warning_ingameNEWSeekerChoosen ("%TAG%WThe last seeker left and a new seeker has been choosen!",
W.messages),
warning_unableToCommand ("%TAG%WSorry but that command is disabled in the arena.",
W.messages),
warning_ingameNoSolidPlace ("%TAG%WThat's not a valid place to become solid!",
W.messages),
warning_arenaStopped ("%TAG%WThe arena has been forced to stop!",
W.messages),
error_noPermission ("%TAG%EYou don't have the permissions to do that!",
W.messages),
error_commandNotEnabled ("%TAG%EThis command has been disabled!",
W.messages),
error_commandNotFound ("%TAG%ECouldn't find the command. Try %A/"
+ BlockHunt.pdfFile.getName() + " help %Efor more info.",
W.messages),
error_notEnoughArguments ("%TAG%EYou're missing arguments, correct syntax: %A/%syntax%",
W.messages),
error_disguiseCraftNotInstalled ("%TAG%EThe plugin '%ADisguiseCraft%E' is required to run this plugin! Intall it or it won't work!",
W.messages),
error_protocolLibNotInstalled ("%TAG%EThe plugin '%AProtocolLib%E' is required to run this plugin! Intall it or it won't work!",
W.messages),
error_noArena ("%TAG%ENo arena found with the name '%A%name%%E'.",
W.messages),
error_onlyIngame ("%TAG%EThis is an only in-game command!", W.messages),
error_joinAlreadyJoined ("%TAG%EYou've already joined an arena!",
W.messages),
error_joinNoBlocksSet ("%TAG%EThere are none blocks set for this arena. Notify the administrator.",
W.messages),
error_joinWarpsNotSet ("%TAG%EThere are no warps set for this arena. Notify the administrator.",
W.messages),
error_joinArenaIngame ("%TAG%EThis game has already started.", W.messages),
error_joinFull ("%TAG%EUnable to join this arena. It's full!", W.messages),
error_leaveNotInArena ("%TAG%EYou're not in an arena!", W.messages),
error_createSelectionFirst ("%TAG%EMake a selection first. Use the wand command: %A/"
+ BlockHunt.pdfFile.getName() + " <wand|w>%E.",
W.messages),
error_createNotSameWorld ("%TAG%EMake your selection points in the same world!",
W.messages),
error_setTooHighNumber ("%TAG%EThat amount is too high! Max amount is: %A%max%%E.",
W.messages),
error_setTooLowNumber ("%TAG%EThat amount is too low! Minimal amount is: %A%min%%E.",
W.messages),
error_setNotABlock ("%TAG%EThat is not a block!", W.messages),
error_setwarpWarpNotFound ("%TAG%EWarp '%A%warp%%E' is not valid!",
W.messages),
error_ShopNeedMoreTokens ("%TAG%EYou need more tokens before you can buy this item.",
W.messages);
public Object value;
public ConfigM config;
public String location;
/**
* Makes an object from the list above.
*
* @param value
* Setting in the config file.
* @param config
* The config file.
*/
private ConfigC (Object value, ConfigM config) {
this.value = value;
this.config = config;
this.location = this.name().replaceAll("_", ".");
}
}

View File

@ -4,7 +4,6 @@ import java.util.ArrayList;
import java.util.List;
import nl.Steffion.BlockHunt.Arena.ArenaType;
import nl.Steffion.BlockHunt.Managers.ConfigC;
import nl.Steffion.BlockHunt.Managers.MessageM;
import org.bukkit.Bukkit;
@ -158,7 +157,7 @@ public class InventoryHandler {
player.openInventory(panel);
} else {
MessageM.sendFMessage(player, ConfigC.error_noArena, true, "name-"
MessageM.sendFMessage(player, ConfigC.error_noArena, "name-"
+ arenaname);
}
}
@ -272,7 +271,7 @@ public class InventoryHandler {
.replaceAll((String) W.config
.get(ConfigC.shop_blockChooserName)));
lores = W.config.getFile().getStringList(
ConfigC.shop_blockChooserDescription.getLocation());
ConfigC.shop_blockChooserDescription.location);
lores2 = new ArrayList<String>();
for (String lore : lores) {
lores2.add(MessageM.replaceAll(lore));
@ -293,7 +292,7 @@ public class InventoryHandler {
.replaceAll((String) W.config
.get(ConfigC.shop_BlockHuntPassName)));
lores = W.config.getFile().getStringList(
ConfigC.shop_BlockHuntPassDescription.getLocation());
ConfigC.shop_BlockHuntPassDescription.location);
lores2 = new ArrayList<String>();
for (String lore : lores) {
lores2.add(MessageM.replaceAll(lore));

View File

@ -1,9 +1,10 @@
package nl.Steffion.BlockHunt.Listeners;
import nl.Steffion.BlockHunt.Arena;
import nl.Steffion.BlockHunt.PermissionsC.Permissions;
import nl.Steffion.BlockHunt.W;
import nl.Steffion.BlockHunt.Managers.PlayerM;
import nl.Steffion.BlockHunt.Managers.PlayerM.PermsC;
import nl.Steffion.BlockHunt.Managers.PermissionsM;
import org.bukkit.Material;
import org.bukkit.entity.Player;
import org.bukkit.event.EventHandler;
@ -25,7 +26,7 @@ public class OnBlockBreakEvent implements Listener {
if (event.getBlock().equals(Material.SIGN_POST)
|| event.getBlock().equals(Material.WALL_SIGN)) {
if (!PlayerM.hasPerm(player, PermsC.signcreate, true)) {
if (!PermissionsM.hasPerm(player, Permissions.signcreate, true)) {
event.setCancelled(true);
}
}

View File

@ -3,8 +3,8 @@ package nl.Steffion.BlockHunt.Listeners;
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.W;
import nl.Steffion.BlockHunt.Managers.ConfigC;
import nl.Steffion.BlockHunt.Managers.MessageM;
import org.bukkit.GameMode;
@ -74,7 +74,7 @@ public class OnEntityDamageByEntityEvent implements Listener {
W.shop.save();
MessageM.sendFMessage(damager,
ConfigC.normal_addedToken, true,
ConfigC.normal_addedToken,
"amount-" + arena.killTokens);
if (W.shop.getFile().get(
@ -93,7 +93,7 @@ public class OnEntityDamageByEntityEvent implements Listener {
W.shop.save();
MessageM.sendFMessage(player,
ConfigC.normal_addedToken, true,
ConfigC.normal_addedToken,
"amount-" + (int) addingTokens);
arena.seekers.add(player);

View File

@ -3,9 +3,9 @@ package nl.Steffion.BlockHunt.Listeners;
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.W;
import nl.Steffion.BlockHunt.Managers.ConfigC;
import nl.Steffion.BlockHunt.Managers.MessageM;
import org.bukkit.Bukkit;
@ -40,7 +40,7 @@ public class OnInventoryClickEvent implements Listener {
if (!event.getCurrentItem().getType().isBlock()) {
event.setCancelled(true);
MessageM.sendFMessage(player,
ConfigC.error_setNotABlock, true);
ConfigC.error_setNotABlock);
}
}
@ -74,13 +74,12 @@ public class OnInventoryClickEvent implements Listener {
MessageM.sendFMessage(
player,
ConfigC.normal_ShopBoughtItem,
true,
"itemname-"
+ W.config
.get(ConfigC.shop_blockChooserName));
} else {
MessageM.sendFMessage(player,
ConfigC.error_ShopNeedMoreTokens, true);
ConfigC.error_ShopNeedMoreTokens);
}
}
@ -92,7 +91,7 @@ public class OnInventoryClickEvent implements Listener {
if (event.getCurrentItem().getType() != Material.AIR) {
W.choosenBlock.put(player, event.getCurrentItem());
MessageM.sendFMessage(player,
ConfigC.normal_ShopChoosenBlock, true, "block-"
ConfigC.normal_ShopChoosenBlock, "block-"
+ event.getCurrentItem().getType()
.toString().replaceAll("_", "")
.replaceAll("BLOCK", "")
@ -235,7 +234,7 @@ public class OnInventoryClickEvent implements Listener {
}
} else {
MessageM.sendFMessage(player, ConfigC.error_setTooHighNumber,
true, "max-" + max);
"max-" + max);
}
} else if (item.getItemMeta().getDisplayName()
.contains((String) W.messages.get(ConfigC.button_remove2))) {
@ -274,7 +273,7 @@ public class OnInventoryClickEvent implements Listener {
}
} else {
MessageM.sendFMessage(player, ConfigC.error_setTooLowNumber,
true, "min-" + min);
"min-" + min);
}
}
}

View File

@ -1,8 +1,8 @@
package nl.Steffion.BlockHunt.Listeners;
import nl.Steffion.BlockHunt.Arena;
import nl.Steffion.BlockHunt.ConfigC;
import nl.Steffion.BlockHunt.W;
import nl.Steffion.BlockHunt.Managers.ConfigC;
import nl.Steffion.BlockHunt.Managers.MessageM;
import org.bukkit.entity.Player;
@ -38,8 +38,7 @@ public class OnPlayerCommandPreprocessEvent implements Listener {
}
}
MessageM.sendFMessage(player, ConfigC.warning_unableToCommand,
true);
MessageM.sendFMessage(player, ConfigC.warning_unableToCommand);
event.setCancelled(true);
}
}

View File

@ -3,13 +3,13 @@ package nl.Steffion.BlockHunt.Listeners;
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.PermissionsC.Permissions;
import nl.Steffion.BlockHunt.SignsHandler;
import nl.Steffion.BlockHunt.SolidBlockHandler;
import nl.Steffion.BlockHunt.W;
import nl.Steffion.BlockHunt.Managers.ConfigC;
import nl.Steffion.BlockHunt.Managers.MessageM;
import nl.Steffion.BlockHunt.Managers.PlayerM;
import nl.Steffion.BlockHunt.Managers.PlayerM.PermsC;
import nl.Steffion.BlockHunt.Managers.PermissionsM;
import nl.Steffion.BlockHunt.Serializables.LocationSerializable;
import org.bukkit.Bukkit;
@ -33,7 +33,7 @@ public class OnPlayerInteractEvent implements Listener {
@EventHandler(priority = EventPriority.NORMAL)
public void onPlayerInteractEvent(PlayerInteractEvent event) {
Player player = event.getPlayer();
if (PlayerM.hasPerm(player, PermsC.create, false)) {
if (PermissionsM.hasPerm(player, Permissions.create, false)) {
ItemStack item = player.getItemInHand();
if (item.getType() != Material.AIR) {
if (item.getItemMeta().hasDisplayName()) {
@ -52,7 +52,6 @@ public class OnPlayerInteractEvent implements Listener {
MessageM.sendFMessage(
player,
ConfigC.normal_wandSetPosition,
true,
"number-1",
"pos-%N(%A" + location.getX()
+ "%N, %A"
@ -71,7 +70,6 @@ public class OnPlayerInteractEvent implements Listener {
MessageM.sendFMessage(
player,
ConfigC.normal_wandSetPosition,
true,
"number-2",
"pos-%N(%A" + location.getX()
+ "%N, %A"
@ -100,15 +98,15 @@ public class OnPlayerInteractEvent implements Listener {
.getClickedBlock().getLocation()))) {
Sign sign = (Sign) event.getClickedBlock().getState();
if (sign.getLine(1) != null) {
if (sign.getLine(1).equals(
MessageM.replaceAll(W.config
.getFile()
.getStringList(
ConfigC.sign_LEAVE
.getLocation())
.get(1)))) {
if (PlayerM.hasPerm(player, PermsC.joinsign,
true)) {
if (sign.getLine(1)
.equals(MessageM
.replaceAll(W.config
.getFile()
.getStringList(
ConfigC.sign_LEAVE.location)
.get(1)))) {
if (PermissionsM.hasPerm(player,
Permissions.joinsign, true)) {
ArenaHandler.playerLeaveArena(player, true,
true);
}
@ -116,8 +114,8 @@ public class OnPlayerInteractEvent implements Listener {
for (Arena arena : W.arenaList) {
if (sign.getLines()[1]
.contains(arena.arenaName)) {
if (PlayerM.hasPerm(player,
PermsC.joinsign, true)) {
if (PermissionsM.hasPerm(player,
Permissions.joinsign, true)) {
ArenaHandler.playerJoinArena(
player, arena.arenaName);
}

View File

@ -1,9 +1,9 @@
package nl.Steffion.BlockHunt.Listeners;
import nl.Steffion.BlockHunt.BlockHunt;
import nl.Steffion.BlockHunt.PermissionsC.Permissions;
import nl.Steffion.BlockHunt.SignsHandler;
import nl.Steffion.BlockHunt.W;
import nl.Steffion.BlockHunt.Managers.PlayerM;
import nl.Steffion.BlockHunt.Managers.PlayerM.PermsC;
import nl.Steffion.BlockHunt.Managers.PermissionsM;
import nl.Steffion.BlockHunt.Serializables.LocationSerializable;
import org.bukkit.entity.Player;
@ -19,10 +19,12 @@ public class OnSignChangeEvent implements Listener {
Player player = event.getPlayer();
String[] lines = event.getLines();
if (lines[0] != null) {
if (lines[0].equalsIgnoreCase("[" + W.pluginName + "]")) {
if (PlayerM.hasPerm(player, PermsC.signcreate, true)) {
SignsHandler.createSign(event, lines, new LocationSerializable(
event.getBlock().getLocation()));
if (lines[0].equalsIgnoreCase("[" + BlockHunt.pdfFile.getName()
+ "]")) {
if (PermissionsM.hasPerm(player, Permissions.signcreate, true)) {
SignsHandler.createSign(event, lines,
new LocationSerializable(event.getBlock()
.getLocation()));
}
}
}

View File

@ -1,155 +0,0 @@
package nl.Steffion.BlockHunt.Managers;
import nl.Steffion.BlockHunt.W;
import nl.Steffion.BlockHunt.Commands.*;
import nl.Steffion.BlockHunt.Managers.PlayerM.PermsC;
public enum CommandC {
/*
* Made by @author Steffion, © 2013.
*/
INFO ("BlockHunt%_",
"BlockHunt%_",
new CMDinfo(),
ConfigC.commandEnabled_info,
PermsC.info,
ConfigC.help_info,
0,
"-"),
INFO2 ("BlockHunt%info_",
"BlockHunt%i_",
new CMDinfo(),
ConfigC.commandEnabled_info,
PermsC.info,
ConfigC.help_info,
1,
W.pluginName + " [info|i]"),
HELP ("BlockHunt%help_",
"BlockHunt%h_",
new CMDhelp(),
ConfigC.commandEnabled_help,
PermsC.help,
ConfigC.help_help,
1,
W.pluginName + " <help|h> [pagenumber]"),
RELOAD ("BlockHunt%reload_",
"BlockHunt%r_",
new CMDreload(),
ConfigC.commandEnabled_reload,
PermsC.reload,
ConfigC.help_reload,
1,
W.pluginName + " <reload|r>"),
JOIN ("BlockHunt%join_",
"BlockHunt%j_",
new CMDjoin(),
ConfigC.commandEnabled_join,
PermsC.join,
ConfigC.help_join,
1,
W.pluginName + " <join|j> <arenaname>"),
LEAVE ("BlockHunt%leave_",
"BlockHunt%l_",
new CMDleave(),
ConfigC.commandEnabled_leave,
PermsC.leave,
ConfigC.help_leave,
1,
W.pluginName + " <leave|l>"),
LIST ("BlockHunt%list_",
"BlockHunt%li_",
new CMDlist(),
ConfigC.commandEnabled_list,
PermsC.list,
ConfigC.help_list,
1,
W.pluginName + " <list|li>"),
SHOP ("BlockHunt%shop_",
"BlockHunt%sh_",
new CMDshop(),
ConfigC.commandEnabled_shop,
PermsC.shop,
ConfigC.help_shop,
1,
W.pluginName + " <shop|sh>"),
START ("BlockHunt%start_",
"BlockHunt%go_",
new CMDstart(),
ConfigC.commandEnabled_start,
PermsC.start,
ConfigC.help_start,
1,
W.pluginName + " <start|go> <arenaname>"),
WAND ("BlockHunt%wand_",
"BlockHunt%w_",
new CMDwand(),
ConfigC.commandEnabled_wand,
PermsC.create,
ConfigC.help_wand,
1,
W.pluginName + " <wand|w>"),
CREATE ("BlockHunt%create_",
"BlockHunt%c_",
new CMDcreate(),
ConfigC.commandEnabled_create,
PermsC.create,
ConfigC.help_create,
1,
W.pluginName + " <create|c> <arenaname>"),
SET ("BlockHunt%set_",
"BlockHunt%s_",
new CMDset(),
ConfigC.commandEnabled_set,
PermsC.set,
ConfigC.help_set,
1,
W.pluginName + " <set|s> <arenaname>"),
SETWARP ("BlockHunt%setwarp_",
"BlockHunt%sw_",
new CMDsetwarp(),
ConfigC.commandEnabled_setwarp,
PermsC.setwarp,
ConfigC.help_setwarp,
1,
W.pluginName + " <setwarp|sw> <lobby|hiders|seekers> <arenaname>"),
REMOVE ("BlockHunt%remove_",
"BlockHunt%delete_",
new CMDremove(),
ConfigC.commandEnabled_remove,
PermsC.remove,
ConfigC.help_remove,
1,
W.pluginName + " <remove|delete> <arenaname>"),
NOT_FOUND ("%_",
"%_",
new CMDnotfound(),
null,
PermsC.info,
ConfigC.help_info,
0,
"-");
public String command;
public String alias;
public DefaultCMD cmd;
public ConfigC enabled;
public PermsC perm;
public ConfigC help;
public int minLenght;
public String usage;
private CommandC (String command, String alias, DefaultCMD cmd,
ConfigC enabled, PermsC perm, ConfigC help, int minLenght,
String usage) {
this.command = command;
this.alias = alias;
this.cmd = cmd;
this.enabled = enabled;
this.perm = perm;
this.help = help;
this.minLenght = minLenght;
this.usage = usage;
}
}

View File

@ -0,0 +1,50 @@
package nl.Steffion.BlockHunt.Managers;
import java.util.List;
import nl.Steffion.BlockHunt.ConfigC;
import nl.Steffion.BlockHunt.PermissionsC.Permissions;
import nl.Steffion.BlockHunt.W;
import nl.Steffion.BlockHunt.Commands.DefaultCMD;
public class CommandM {
/**
* Steffion's Engine - Made by Steffion.
*
* You're allowed to use this engine for own usage, you're not allowed to
* republish the engine. Using this for your own plugin is allowed when a
* credit is placed somewhere in the plugin.
*
* Thanks for your cooperate!
*
* @author Steffion
*/
public String name;
public String label;
public String args;
public String argsalias;
public Permissions permission;
public ConfigC help;
public boolean enabled;
public List<String> mainTABlist;
public DefaultCMD CMD;
public String usage;
public CommandM (String name, String label, String args, String argsalias,
Permissions permission, ConfigC help, Boolean enabled,
List<String> mainTABlist, DefaultCMD CMD, String usage) {
this.name = name;
this.label = label;
this.args = args;
this.argsalias = argsalias;
this.permission = permission;
this.help = help;
this.enabled = enabled;
this.mainTABlist = mainTABlist;
this.CMD = CMD;
this.usage = usage;
W.commands.add(this);
}
}

View File

@ -1,206 +0,0 @@
package nl.Steffion.BlockHunt.Managers;
import nl.Steffion.BlockHunt.W;
public enum ConfigC {
/*
* Made by @author Steffion, © 2013.
*/
chat_tag ("[" + W.pluginName + "] ", W.config),
chat_normal ("&b", W.config),
chat_warning ("&c", W.config),
chat_error ("&c", W.config),
chat_arg ("&e", W.config),
chat_header ("&9", W.config),
chat_headerhigh ("%H_______.[ %A%header%%H ]._______", W.config),
commandEnabled_info (true, W.config),
commandEnabled_help (true, W.config),
commandEnabled_reload (true, W.config),
commandEnabled_join (true, W.config),
commandEnabled_leave (true, W.config),
commandEnabled_list (true, W.config),
commandEnabled_shop (true, W.config),
commandEnabled_start (true, W.config),
commandEnabled_wand (true, W.config),
commandEnabled_create (true, W.config),
commandEnabled_set (true, W.config),
commandEnabled_setwarp (true, W.config),
commandEnabled_remove (true, W.config),
autoUpdateCheck (true, W.config),
autoDownloadUpdate (false, W.config),
wandID (280, W.config),
wandName ("%A&l" + W.pluginName + "%N's selection wand", W.config),
wandDescription (new String[] {
"%NUse this item to select an arena for your arena.",
"%ALeft-Click%N to select point #1.",
"%ARight-Click%N to select point #2.",
"%NUse the create command to define your arena.",
"%A/" + W.pluginName + " <help|h>" }, W.config),
shop_price ("%NPrice: %A%amount% %Ntokens.", W.config),
shop_blockChooserEnabled (true, W.config),
shop_blockChooserID (340, W.config),
shop_blockChooserPrice (3000, W.config),
shop_blockChooserName ("%H&lBlock Chooser", W.config),
shop_blockChooserDescription (new String[] {
"%NUse this item before the arena starts.",
"%ARight-Click%N in the lobby and choose",
"%Nthe block you want to be!", "&6Unlimited uses." }, W.config),
shop_BlockHuntPassEnabled (true, W.config),
shop_BlockHuntPassID (421, W.config),
shop_BlockHuntPassPrice (150, W.config),
shop_BlockHuntPassName ("%H&lBlockHunt Pass", W.config),
shop_BlockHuntPassDescription (new String[] {
"%NUse this item before the arena starts.",
"%ARight-Click%N in the lobby and choose",
"%Nif you want to be a Hider or a Seeker!", "&61 use.",
"&c&lCOMING SOON!" }, W.config),
sign_LEAVE (new String[] { "%H[" + W.pluginName + "%H]", "&4LEAVE",
"&8Right-Click", "&8To leave." }, W.config),
sign_WAITING (new String[] { "%H[" + W.pluginName + "%H]", "%A%arenaname%",
"%A%players%%N/%A%maxplayers%", "&8Waiting..." }, W.config),
sign_STARTING (new String[] { "%H[" + W.pluginName + "%H]",
"%A%arenaname%", "%A%players%%N/%A%maxplayers%",
"&2Start: %A%timeleft%" }, W.config),
sign_INGAME (new String[] { "%H[" + W.pluginName + "%H]", "%A%arenaname%",
"%A%players%%N/%A%maxplayers%", "%EIngame: %A%timeleft%" },
W.config),
scoreboard_timeleft ("%ATime left:", W.config),
scoreboard_seekers ("%NSeekers:", W.config),
scoreboard_hiders ("%NHiders:", W.config),
log_Enabled ("%N%name%&a&k + %N%version% is now Enabled. Made by %A%autors%%N.",
W.messages),
log_Disabled ("%N%name%&c&k - %N%version% is now Disabled. Made by %A%autors%%N.",
W.messages),
help_info ("%NDisplays the plugin's info.", W.messages),
help_help ("%NShows a list of commands.", W.messages),
help_reload ("%NReloads all configs.", W.messages),
help_join ("%NJoins a " + W.pluginName + " game.", W.messages),
help_leave ("%NLeave a " + W.pluginName + " game.", W.messages),
help_list ("%NShows a list of available arenas.", W.messages),
help_shop ("%NOpens the " + W.pluginName + " shop.", W.messages),
help_start ("%NForces an arena to start.", W.messages),
help_wand ("%NGives you the wand selection tool.", W.messages),
help_create ("%NCreates an arena from your selection.", W.messages),
help_set ("%NOpens a panel to set settings.", W.messages),
help_setwarp ("%NSets warps for your arena.", W.messages),
help_remove ("%NDeletes an Arena.", W.messages),
button_add ("%NAdd %A%1%%N to %A%2%%N", W.messages),
button_add2 ("Add", W.messages),
button_setting ("%NSetting %A%1%%N is now: %A%2%%N.", W.messages),
button_remove ("%NRemove %A%1%%N from %A%2%%N", W.messages),
button_remove2 ("Remove", W.messages),
normal_reloadedConfigs ("&aReloaded all configs!", W.messages),
normal_joinJoinedArena ("%A%playername%%N joined your arena. (%A%1%%N/%A%2%%N)",
W.messages),
normal_leaveYouLeft ("%NYou left the arena! Thanks for playing ;)!",
W.messages),
normal_leaveLeftArena ("%A%playername%%N left your arena. (%A%1%%N/%A%2%%N)",
W.messages),
normal_startForced ("%NYou forced to start arena '%A%arenaname%%N'!",
W.messages),
normal_wandGaveWand ("%NHere you go ;)! &o(Use the %A&o%type%%N&o!)",
W.messages),
normal_wandSetPosition ("%NSet position %A#%number%%N to location: (%A%x%%N, %A%y%%N, %A%z%%N).",
W.messages),
normal_createCreatedArena ("%NCreated an arena with the name '%A%name%%N'.",
W.messages),
normal_lobbyArenaIsStarting ("%NThe arena will start in %A%1%%N second(s)!",
W.messages),
normal_lobbyArenaStarted ("%NThe arena has been started! The seeker is coming to find you in %A%secs%%N seconds!",
W.messages),
normal_ingameSeekerChoosen ("%NPlayer %A%seeker%%N has been choosen as seeker!",
W.messages),
normal_ingameBlock ("%NYou're disguised as a(n) '%A%block%%N' block.",
W.messages),
normal_ingameArenaEnd ("%NThe arena will end in %A%1%%N second(s)!",
W.messages),
normal_ingameGivenSword ("%NYou were given a sword!", W.messages),
normal_HiderDied ("%NHider %A%playername%%N died! %A%left%%N hider(s) remain...",
W.messages),
normal_SeekerDied ("%NSeeker %A%playername%%N died! He will respawn in %A%secs%%N seconds!",
W.messages),
normal_winSeekers ("%NThe %ASEEKERS%N have won!", W.messages),
normal_winHiders ("%NThe %AHIDERS%N have won!", W.messages),
normal_setwarpWarpSet ("%NSet warp '%A%warp%%N' to your location!",
W.messages),
normal_addedToken ("%A%amount%%N tokens were added to your account!",
W.messages),
normal_removeRemovedArena ("%NRemoved arena '%A%name%%N'!", W.messages),
normal_ingameNowSolid ("%NYou're now a solid '%A%block%%N' block!",
W.messages),
normal_ingameNoMoreSolid ("%NYou're no longer a solid block!", W.messages),
normal_ShopBoughtItem ("%NYou've bought the '%A%itemname%%N' item!",
W.messages),
normal_ShopChoosenBlock ("%NYou've choosen to be a(n) '%A%block%%N' block!",
W.messages),
warning_lobbyNeedAtleast ("%WYou need atleast %A%1%%W player(s) to start the game!",
W.messages),
warning_ingameNEWSeekerChoosen ("%WThe last seeker left and a new seeker has been choosen!",
W.messages),
warning_unableToCommand ("%WSorry but that command is disabled in the arena.",
W.messages),
warning_ingameNoSolidPlace ("%WThat's not a valid place to become solid!",
W.messages),
warning_arenaStopped ("%WThe arena has been forced to stop!", W.messages),
error_noPermission ("%EYou don't have the permissions to do that!",
W.messages),
error_commandNotEnabled ("%EThis command has been disabled!", W.messages),
error_commandNotFound ("%ECouldn't find the command. Try %A/"
+ W.pluginName + " help %Efor more info.", W.messages),
error_notEnoughArguments ("%EYou're missing arguments, correct syntax: %A/%syntax%",
W.messages),
error_disguiseCraftNotInstalled ("%EThe plugin '%ADisguiseCraft%E' is required to run this plugin! Intall it or it won't work!",
W.messages),
error_protocolLibNotInstalled ("%EThe plugin '%AProtocolLib%E' is required to run this plugin! Intall it or it won't work!",
W.messages),
error_noArena ("%ENo arena found with the name '%A%name%%E'.", W.messages),
error_onlyIngame ("%EThis is an only in-game command!", W.messages),
error_joinAlreadyJoined ("%EYou've already joined an arena!", W.messages),
error_joinNoBlocksSet ("%EThere are none blocks set for this arena. Notify the administrator.",
W.messages),
error_joinWarpsNotSet ("%EThere are no warps set for this arena. Notify the administrator.",
W.messages),
error_joinArenaIngame ("%EThis game has already started.", W.messages),
error_joinFull ("%EUnable to join this arena. It's full!", W.messages),
error_leaveNotInArena ("%EYou're not in an arena!", W.messages),
error_createSelectionFirst ("%EMake a selection first. Use the wand command: %A/"
+ W.pluginName + " <wand|w>%E.",
W.messages),
error_createNotSameWorld ("%EMake your selection points in the same world!",
W.messages),
error_setTooHighNumber ("%EThat amount is too high! Max amount is: %A%max%%E.",
W.messages),
error_setTooLowNumber ("%EThat amount is too low! Minimal amount is: %A%min%%E.",
W.messages),
error_setNotABlock ("%EThat is not a block!", W.messages),
error_setwarpWarpNotFound ("%EWarp '%A%warp%%E' is not valid!", W.messages),
error_ShopNeedMoreTokens ("%EYou need more tokens before you can buy this item.",
W.messages);
public Object value;
public ConfigM config;
private ConfigC (Object value, ConfigM config) {
this.value = value;
this.config = config;
}
public String getLocation() {
return this.name().replaceAll("_", ".");
}
}

View File

@ -2,6 +2,8 @@ package nl.Steffion.BlockHunt.Managers;
import java.io.File;
import nl.Steffion.BlockHunt.BlockHunt;
import nl.Steffion.BlockHunt.ConfigC;
import nl.Steffion.BlockHunt.W;
import org.bukkit.configuration.ConfigurationSection;
@ -9,28 +11,90 @@ import org.bukkit.configuration.file.FileConfiguration;
import org.bukkit.configuration.file.YamlConfiguration;
public class ConfigM {
/*
* Made by @author Steffion, © 2013.
/**
* Steffion's Engine - Made by Steffion.
*
* You're allowed to use this engine for own usage, you're not allowed to
* republish the engine. Using this for your own plugin is allowed when a
* credit is placed somewhere in the plugin.
*
* Thanks for your cooperate!
*
* @author Steffion
*/
String fileName;
File file;
FileConfiguration fileC;
ConfigurationSection fileCS;
String location;
String fileLocation;
public ConfigM (String fileName, String location) {
/**
* Use this class to create an automated config file.
*
* @param fileName
* Name of the file.
*/
public ConfigM (String fileName) {
this.fileName = fileName;
this.file = new File("plugins/" + W.pluginName + "/" + location, fileName
+ ".yml");
this.location = W.pluginName + "/" + location;
this.file = new File("plugins/" + BlockHunt.pdfFile.getName(),
fileName + ".yml");
this.fileLocation = BlockHunt.pdfFile.getName();
this.fileC = new YamlConfiguration();
this.checkFile();
this.fileCS = fileC.getConfigurationSection("");
this.load();
}
/**
* Use this class to create an automated config file.
*
* @param fileName
* Name of the file.
* @param fileLocation
* Sub-Location of the file.
*/
public ConfigM (String fileName, String fileLocation) {
this.fileName = fileName;
this.file = new File("plugins/" + BlockHunt.pdfFile.getName()
+ "/" + fileLocation, fileName + ".yml");
this.fileLocation = BlockHunt.pdfFile.getName() + "/"
+ fileLocation;
this.fileC = new YamlConfiguration();
this.checkFile();
this.fileCS = fileC.getConfigurationSection("");
this.load();
}
/**
* Check if there are new files created if so, display a message to the
* console.
*/
public static void newFiles() {
ConfigM.setDefaults();
for (String fileName : W.newFiles) {
MessageM.sendMessage(
null,
"%TAG%WCouldn't find '%A%fileName%.yml%W' creating new one.",
"fileName-" + fileName);
}
W.newFiles.clear();
}
/**
* Add config settings to the files if they don't exist.
*/
public static void setDefaults() {
for (ConfigC value : ConfigC.values()) {
value.config.load();
if (value.config.getFile().get(value.location) == null) {
value.config.getFile().set(value.location, value.value);
value.config.save();
}
}
}
/**
* Check if file exists, if not create one.
*/
@ -39,7 +103,11 @@ public class ConfigM {
try {
this.file.getParentFile().mkdirs();
this.file.createNewFile();
W.newFiles.add(this.location + this.fileName);
if (this.fileLocation == BlockHunt.pdfFile.getName()) {
W.newFiles.add(this.fileName);
} else {
W.newFiles.add(this.fileLocation + this.fileName);
}
} catch (Exception e) {
e.printStackTrace();
}
@ -72,32 +140,20 @@ public class ConfigM {
}
/**
* Add variables to the files if they don't exist.
*/
public static void setDefaults() {
for (ConfigC value : ConfigC.values()) {
value.config.load();
String location = value.getLocation();
if (value.config.getFile().get(location) == null) {
value.config.getFile().set(location, value.value);
value.config.save();
}
}
}
/**
* Get the File.
* Get the File. Very useful for just loading/saving.
*/
public FileConfiguration getFile() {
return this.fileC;
}
/**
* Get object from a Config.
*
* @param location
* Config location.
* @return
*/
public Object get(ConfigC location) {
return this.getFile().get(location.getLocation());
return this.getFile().get(location.location);
}
}

View File

@ -0,0 +1,18 @@
package nl.Steffion.BlockHunt.Managers;
public class EngineInfo {
/**
* Steffion's Engine - Made by Steffion.
*
* You're allowed to use this engine for own usage, you're not allowed to
* republish the engine. Using this for your own plugin is allowed when a
* credit is placed somewhere in the plugin.
*
* Thanks for your cooperate!
*
* @author Steffion
*/
public static String engineVersion = "3.0.0";
public static String engineAuthors = "Steffion";
}

View File

@ -1,105 +1,134 @@
package nl.Steffion.BlockHunt.Managers;
import nl.Steffion.BlockHunt.ConfigC;
import nl.Steffion.BlockHunt.W;
import org.bukkit.Bukkit;
import org.bukkit.entity.Player;
public class MessageM {
/*
* Made by @author Steffion, © 2013.
/**
* Steffion's Engine - Made by Steffion.
*
* You're allowed to use this engine for own usage, you're not allowed to
* republish the engine. Using this for your own plugin is allowed when a
* credit is placed somewhere in the plugin.
*
* Thanks for your cooperate!
*
* @author Steffion
*/
/**
* Send a message to a player.
* Send a message to a player. Also replaces the "%player%" variable to the
* player's name.
*
* @param player
* The player receiving the message.
* @param message
* @param tag
* Message which needs to be send to the player.
* @param vars
* Variables. Seperated with a - . Ex: "playerName-" +
* player.getName();
*/
public static void sendMessage(Player player, String message, Boolean tag,
public static void sendMessage(Player player, String message,
String... vars) {
if (player == null) {
Bukkit.getConsoleSender().sendMessage(
MessageM.replaceAll(CType.TAG(tag) + message, vars));
} else {
player.sendMessage(MessageM.replaceAll(CType.TAG(tag) + message,
vars));
}
}
/**
* Send a message to a player from a Config.
*
* @param player
* @param location
* @param tag
* @param vars
*/
public static void sendFMessage(Player player, ConfigC location,
Boolean tag, String... vars) {
if (player == null) {
Bukkit.getConsoleSender().sendMessage(
MessageM.replaceAll(
CType.TAG(tag)
+ location.config.getFile().get(
location.getLocation()), vars));
message.replaceAll("%player%", "Console"), vars));
} else {
player.sendMessage(MessageM.replaceAll(CType.TAG(tag)
+ location.config.getFile().get(location.getLocation()),
vars));
player.sendMessage(MessageM.replaceAll(
message.replaceAll("%player%", player.getName()), vars));
}
}
/**
* Sends a message to all online players. Replaces %player% tag to the
* Player's name or "Console".
* Send a message to a player from a Config. Also replaces the "%player%"
* variable to the player's name.
*
* @param player
* The player receiving the message.
* @param location
* Location in the config of the message being send.
* @param vars
* Variables. Seperated with a - . Ex: "playerName-" +
* player.getName();
*/
public static void sendFMessage(Player player, ConfigC location,
String... vars) {
if (player == null) {
Bukkit.getConsoleSender().sendMessage(
MessageM.replaceAll(
location.config.getFile().get(location.location)
.toString()
.replaceAll("%player%", "Console"), vars));
} else {
player.sendMessage(MessageM.replaceAll(
location.config.getFile().get(location.location).toString()
.replaceAll("%player%", player.getName()), vars));
}
}
/**
* Send a message to all players online. Also replaces the "%player%"
* variable to the player's name.
*
* @param message
* @param tag
* Message which needs to be send to the player.
* @param vars
* Variables. Seperated with a - . Ex: "playerName-" +
* player.getName();
*/
public static void broadcastMessage(String message, Boolean tag,
String... vars) {
public static void broadcastMessage(String message, String... vars) {
for (Player player : Bukkit.getOnlinePlayers()) {
String pMessage = message.replaceAll("%player%", player.getName());
player.sendMessage(MessageM.replaceAll(CType.TAG(tag) + pMessage,
vars));
// String pMessage = message.replaceAll("%player%",
// player.getName());
player.sendMessage(MessageM.replaceAll(
message.replaceAll("%player%", player.getName()), vars));
}
message = message.replaceAll("%player%", "Console");
// message = message.replaceAll("%player%", "Console");
Bukkit.getConsoleSender().sendMessage(
MessageM.replaceAll(CType.TAG(tag) + message, vars));
MessageM.replaceAll(message.replaceAll("%player%", "Console"),
vars));
}
/**
* Sends a message to all online players from a Config. Replaces %player%
* tag to the Player's name or "Console".
* Send a message to all players online from a Config. Also replaces the
* "%player%" variable to the player's name.
*
* @param location
* @param tag
* Location in the config of the message being send.
* @param vars
* Variables . Seperated with a - . Ex: "playerName-" +
* player.getName();
*/
public static void broadcastFMessage(ConfigC location, Boolean tag,
String... vars) {
public static void broadcastFMessage(ConfigC location, String... vars) {
for (Player player : Bukkit.getOnlinePlayers()) {
String pMessage = location.config.getFile()
.get(location.getLocation()).toString()
.replaceAll("%player%", player.getName());
player.sendMessage(MessageM.replaceAll(CType.TAG(tag) + pMessage,
vars));
// String pMessage =
// location.config.getFile().get(location.location)
// .toString().replaceAll("%player%", player.getName());
player.sendMessage(MessageM.replaceAll(
location.config.getFile().get(location.location).toString()
.replaceAll("%player%", player.getName()), vars));
}
String message = location.config.getFile().get(location.getLocation())
.toString().replaceAll("%player%", "Console");
// String message = location.config.getFile().get(location.location)
// .toString().replaceAll("%player%", "Console");
Bukkit.getConsoleSender().sendMessage(
MessageM.replaceAll(CType.TAG(tag) + message, vars));
MessageM.replaceAll(
location.config.getFile().get(location.location)
.toString().replaceAll("%player%", "Console"),
vars));
}
/**
* Replace all variable codes.
* Replace all variables.
*
* @param message
* Message which needs to be replaced.
* @param vars
* Variables. Seperated with a - . Ex: "playerName-" +
* player.getName();
* @return
*/
public static String replaceAll(String message, String... vars) {
@ -108,20 +137,22 @@ public class MessageM {
}
/**
* Replace all colour codes.
* Replace default Minecraft colour codes.
*
* @param message
* @return
* Message which needs to be replaced.
* @return Colour replaced message.
*/
public static String replaceColours(String message) {
return message.replaceAll("(&([a-fk-or0-9]))", "\u00A7$2");
}
/**
* Replace Colour codes from config.
* Replace colour codes of this plugin.
*
* @param message
* @return
* Message which needs to be replaced.
* @return Colour replaced message.
*/
public static String replaceColourVars(String message) {
message = message.replaceAll("%N", CType.NORMAL());
@ -129,14 +160,18 @@ public class MessageM {
message = message.replaceAll("%E", CType.ERROR());
message = message.replaceAll("%A", CType.ARG());
message = message.replaceAll("%H", CType.HEADER());
message = message.replaceAll("%TAG", CType.TAG());
return message;
}
/**
* Replace all variables.
* Replace custom variables.
*
* @param message
* Message which needs to be replaced.
* @param vars
* Variables. Seperated with a - . Ex: "playerName-" +
* player.getName();
* @return Replaced String.
*/
public static String replaceVars(String message, String... vars) {
@ -171,16 +206,8 @@ public class MessageM {
public static String TAG() {
return (String) W.config.get(ConfigC.chat_header)
+ (String) W.config.get(ConfigC.chat_tag);
}
public static String TAG(Boolean enabled) {
if (enabled) {
return (String) W.config.get(ConfigC.chat_header)
+ (String) W.config.get(ConfigC.chat_tag);
} else {
return "";
}
+ (String) W.config.get(ConfigC.chat_tag)
+ (String) W.config.get(ConfigC.chat_normal);
}
}
}

View File

@ -0,0 +1,135 @@
package nl.Steffion.BlockHunt.Managers;
import nl.Steffion.BlockHunt.ConfigC;
import nl.Steffion.BlockHunt.PermissionsC;
import nl.Steffion.BlockHunt.PermissionsC.PType;
import nl.Steffion.BlockHunt.PermissionsC.Permissions;
import org.bukkit.entity.Player;
public class PermissionsM {
/**
* Steffion's Engine - Made by Steffion.
*
* You're allowed to use this engine for own usage, you're not allowed to
* republish the engine. Using this for your own plugin is allowed when a
* credit is placed somewhere in the plugin.
*
* Thanks for your cooperate!
*
* @author Steffion
*/
/**
* Check if an player has the permission. Also checks * related permissions.
* This permission DOES HAVE TO be registered.
*
* @param player
* The player who needs the permission.
* @param perm
* The permission.
* @param message
* Send a message to the player saying you don't have the
* 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;
if (player == null) {
return true;
}
if (type == PType.ALL) {
return true;
} else if (type == PType.OP) {
if (player.isOp()) {
return true;
}
} else if (type == PType.ADMIN) {
if (player.hasPermission(PermissionsC.main + "admin")) {
return true;
}
} else if (type == PType.MODERATOR) {
if (player.hasPermission(PermissionsC.main + "moderator")) {
return true;
}
} else if (type == PType.PLAYER) {
if (player.hasPermission(PermissionsC.main + "player")) {
return true;
}
}
if (player.hasPermission("*")) {
return true;
} else if (player.hasPermission(PermissionsC.main + "*")) {
return true;
} else if (player.hasPermission(PermissionsC.main + perm.perm)) {
return true;
} else if (player.hasPermission(PermissionsC.main + perm.perm + "*")) {
return true;
} else {
if (message) {
MessageM.sendFMessage(player, ConfigC.error_noPermission);
}
}
return false;
}
/**
* Check if an player has the permission. Also checks * related permissions.
* This permission does NOT have to be registered.
*
* @param player
* The player who needs the permission.
* @param type
* Type permission.
* @param perm
* The permission.
* @param message
* Send a message to the player saying you don't have the
* permission.
* @return True/False when either the player has the permission.
*/
public static boolean hasRawPerm(Player player, PType type, String perm,
Boolean message) {
if (player == null) {
return true;
}
if (type == PType.ALL) {
return true;
} else if (type == PType.OP) {
if (player.isOp()) {
return true;
}
} else if (type == PType.ADMIN) {
if (player.hasPermission(PermissionsC.main + "admin")) {
return true;
}
} else if (type == PType.MODERATOR) {
if (player.hasPermission(PermissionsC.main + "moderator")) {
return true;
}
} else if (type == PType.PLAYER) {
if (player.hasPermission(PermissionsC.main + "player")) {
return true;
}
}
if (player.hasPermission("*")) {
return true;
} else if (player.hasPermission(PermissionsC.main + "*")) {
return true;
} else if (player.hasPermission(perm)) {
return true;
} else if (player.hasPermission(perm)) {
return true;
} else {
if (message) {
MessageM.sendFMessage(player, ConfigC.error_noPermission);
}
}
return false;
}
}

View File

@ -1,144 +0,0 @@
package nl.Steffion.BlockHunt.Managers;
import nl.Steffion.BlockHunt.W;
import org.bukkit.entity.Player;
public class PlayerM {
/*
* Made by @author Steffion, © 2013.
*/
public static String main = W.pluginMainPermission;
public enum PType {
ALL, PLAYER, MODERATOR, ADMIN, OP;
}
public enum PermsC {
info (main + "info", PType.ALL),
help (main + "help", PType.ALL),
reload (main + "reload", PType.ADMIN),
join (main + "join", PType.PLAYER),
joinfull (main + "joinfull", PType.MODERATOR),
joinsign (main + "joinsign", PType.PLAYER),
leave (main + "leave", PType.PLAYER),
list (main + "list", PType.PLAYER),
shop (main + "shop", PType.PLAYER),
start (main + "start", PType.MODERATOR),
create (main + "create", PType.ADMIN),
set (main + "set", PType.MODERATOR),
setwarp (main + "setwarp", PType.MODERATOR),
signcreate (main + "signcreate", PType.MODERATOR),
remove (main + "remove", PType.ADMIN);
public String perm;
public PType type;
private PermsC (String perm, PType type) {
this.perm = perm;
this.type = type;
}
}
/**
* Check if the player has a permission.
*
* @param player
* @param perm
* @param message
* @return
*/
public static boolean hasPerm(Player player, PermsC perm, Boolean message) {
PType type = perm.type;
if (player == null) {
return true;
}
if (type == PType.ALL) {
return true;
} else if (type == PType.OP) {
if (player.isOp()) {
return true;
}
} else if (type == PType.ADMIN) {
if (player.hasPermission(main + "admin")) {
return true;
}
} else if (type == PType.MODERATOR) {
if (player.hasPermission(main + "moderator")) {
return true;
}
} else if (type == PType.PLAYER) {
if (player.hasPermission(main + "player")) {
return true;
}
}
if (player.hasPermission("*")) {
return true;
} else if (player.hasPermission(main + "*")) {
return true;
} else if (player.hasPermission(main + perm)) {
return true;
} else if (player.hasPermission(main + perm + "*")) {
return true;
} else {
if (message) {
MessageM.sendFMessage(player, ConfigC.error_noPermission, true);
}
}
return false;
}
/**
* Check if the player has a permission.
*
* @param player
* @param perm
* @param type
* @param message
* @return
*/
public static boolean hasPermRaw(Player player, String perm, PType type,
Boolean message) {
if (player == null) {
return true;
}
if (type == PType.ALL) {
return true;
} else if (type == PType.OP) {
if (player.isOp()) {
return true;
}
} else if (type == PType.ADMIN) {
if (player.hasPermission(main + "admin")) {
return true;
}
} else if (type == PType.MODERATOR) {
if (player.hasPermission(main + "moderator")) {
return true;
}
} else if (type == PType.PLAYER) {
if (player.hasPermission(main + "player")) {
return true;
}
}
if (player.hasPermission("*")) {
return true;
} else if (player.hasPermission(main + "*")) {
return true;
} else if (player.hasPermission(main + perm)) {
return true;
} else if (player.hasPermission(main + perm + "*")) {
return true;
} else {
if (message) {
MessageM.sendFMessage(player, ConfigC.error_noPermission, true);
}
}
return false;
}
}

View File

@ -0,0 +1,48 @@
package nl.Steffion.BlockHunt;
public class PermissionsC {
/**
* Steffion's Engine - Made by Steffion.
*
* You're allowed to use this engine for own usage, you're not allowed to
* republish the engine. Using this for your own plugin is allowed when a
* credit is placed somewhere in the plugin.
*
* Thanks for your cooperate!
*
* @author Steffion
*/
public static String main = BlockHunt.pdfFile.getName().toLowerCase()
+ ".";
public enum PType {
ALL, PLAYER, MODERATOR, ADMIN, OP;
}
public enum Permissions {
info (main + "info", PType.ALL),
help (main + "help", PType.ALL),
reload (main + "reload", PType.ADMIN),
join (main + "join", PType.PLAYER),
joinfull (main + "joinfull", PType.MODERATOR),
joinsign (main + "joinsign", PType.PLAYER),
leave (main + "leave", PType.PLAYER),
list (main + "list", PType.PLAYER),
shop (main + "shop", PType.PLAYER),
start (main + "start", PType.MODERATOR),
create (main + "create", PType.ADMIN),
set (main + "set", PType.MODERATOR),
setwarp (main + "setwarp", PType.MODERATOR),
signcreate (main + "signcreate", PType.MODERATOR),
remove (main + "remove", PType.ADMIN);
public String perm;
public PType type;
private Permissions (String perm, PType type) {
this.perm = perm;
this.type = type;
}
}
}

View File

@ -1,7 +1,6 @@
package nl.Steffion.BlockHunt;
import nl.Steffion.BlockHunt.Arena.ArenaState;
import nl.Steffion.BlockHunt.Managers.ConfigC;
import nl.Steffion.BlockHunt.Managers.MessageM;
import org.bukkit.Bukkit;

View File

@ -56,7 +56,7 @@ public class LocationSerializable extends Location implements
MessageM.sendMessage(
null,
"%EError deserializing LocationSerializable - world not found! (%A%w%%E)",
true, "w-" + w);
"w-" + w);
return null;
}
return new LocationSerializable(w, (Double) M.g(map, "x", 0D),

View File

@ -2,7 +2,6 @@ package nl.Steffion.BlockHunt;
import java.util.ArrayList;
import nl.Steffion.BlockHunt.Arena.ArenaState;
import nl.Steffion.BlockHunt.Managers.ConfigC;
import nl.Steffion.BlockHunt.Managers.MessageM;
import nl.Steffion.BlockHunt.Serializables.LocationSerializable;
@ -57,7 +56,7 @@ public class SignsHandler {
if (!saved) {
MessageM.sendFMessage(event.getPlayer(),
ConfigC.error_noArena, true, "name-" + lines[1]);
ConfigC.error_noArena, "name-" + lines[1]);
}
}
}
@ -101,8 +100,7 @@ public class SignsHandler {
String[] lines = signblock.getLines();
if (sign.contains("leave")) {
ArrayList<String> signLines = (ArrayList<String>) W.config
.getFile()
.getList(ConfigC.sign_LEAVE.getLocation());
.getFile().getList(ConfigC.sign_LEAVE.location);
int linecount = 0;
for (String line : signLines) {
if (linecount <= 3) {
@ -119,8 +117,7 @@ public class SignsHandler {
if (arena.gameState.equals(ArenaState.WAITING)) {
ArrayList<String> signLines = (ArrayList<String>) W.config
.getFile().getList(
ConfigC.sign_WAITING
.getLocation());
ConfigC.sign_WAITING.location);
int linecount = 0;
if (signLines != null) {
for (String line : signLines) {
@ -149,8 +146,7 @@ public class SignsHandler {
.equals(ArenaState.STARTING)) {
ArrayList<String> signLines = (ArrayList<String>) W.config
.getFile().getList(
ConfigC.sign_STARTING
.getLocation());
ConfigC.sign_STARTING.location);
int linecount = 0;
if (signLines != null) {
for (String line : signLines) {
@ -179,8 +175,7 @@ public class SignsHandler {
.equals(ArenaState.INGAME)) {
ArrayList<String> signLines = (ArrayList<String>) W.config
.getFile().getList(
ConfigC.sign_INGAME
.getLocation());
ConfigC.sign_INGAME.location);
int linecount = 0;
if (signLines != null) {
for (String line : signLines) {

View File

@ -2,7 +2,6 @@ package nl.Steffion.BlockHunt;
import java.util.LinkedList;
import nl.Steffion.BlockHunt.Managers.ConfigC;
import nl.Steffion.BlockHunt.Managers.MessageM;
import org.bukkit.Bukkit;
@ -59,6 +58,6 @@ public class SolidBlockHandler {
W.dcAPI.disguisePlayer(player, disguise);
}
MessageM.sendFMessage(player, ConfigC.normal_ingameNoMoreSolid, true);
MessageM.sendFMessage(player, ConfigC.normal_ingameNoMoreSolid);
}
}

View File

@ -201,11 +201,11 @@ public class Updater {
url = new URL(DBOUrl + slug + "/files.rss");
} catch (MalformedURLException ex) {
// Invalid slug
MessageM.sendMessage(null, "%WThe author of this plugin ("
MessageM.sendMessage(null, "%TAG%WThe author of this plugin ("
+ plugin.getDescription().getAuthors().get(0)
+ ") has misconfigured their Auto Update system", true);
MessageM.sendMessage(null, "%WThe project slug given ('" + slug
+ "') is invalid. Please nag the author about this.", true);
+ ") has misconfigured their Auto Update system");
MessageM.sendMessage(null, "%TAG%WThe project slug given ('" + slug
+ "') is invalid. Please nag the author about this.");
result = Updater.UpdateResult.FAIL_BADSLUG; // Bad slug! Bad!
}
thread = new Thread(new UpdateRunnable());
@ -271,16 +271,16 @@ public class Updater {
byte[] data = new byte[BYTE_SIZE];
int count;
if (announce)
MessageM.sendMessage(null, "%NAbout to download a new update: "
+ versionTitle, true);
MessageM.sendMessage(null,
"%TAG%NAbout to download a new update: " + versionTitle);
long downloaded = 0;
while ((count = in.read(data, 0, BYTE_SIZE)) != -1) {
downloaded += count;
fout.write(data, 0, count);
int percent = (int) (downloaded * 100 / fileLength);
if (announce & (percent % 10 == 0)) {
MessageM.sendMessage(null, "%NDownloading update: "
+ percent + "% of " + fileLength + " bytes.", true);
MessageM.sendMessage(null, "%TAG%NDownloading update: "
+ percent + "% of " + fileLength + " bytes.");
}
}
// Just a quick check to make sure we didn't leave any files from
@ -297,12 +297,10 @@ public class Updater {
unzip(dFile.getCanonicalPath());
}
if (announce)
MessageM.sendMessage(null, "%NFinished updating.", true);
MessageM.sendMessage(null, "%TAG%NFinished updating.");
} catch (Exception ex) {
MessageM.sendMessage(
null,
"%WThe auto-updater tried to download a new update, but was unsuccessful.",
true);
MessageM.sendMessage(null,
"%TAG%WThe auto-updater tried to download a new update, but was unsuccessful.");
result = Updater.UpdateResult.FAIL_DOWNLOAD;
} finally {
try {
@ -405,8 +403,7 @@ public class Updater {
ex.printStackTrace();
MessageM.sendMessage(
null,
"%WThe auto-updater tried to unzip a new update file, but was unsuccessful.",
true);
"%TAG%WThe auto-updater tried to unzip a new update file, but was unsuccessful.");
result = Updater.UpdateResult.FAIL_DOWNLOAD;
}
new File(file).delete();
@ -465,10 +462,8 @@ public class Updater {
buff = null;
} catch (Exception ex) {
ex.printStackTrace();
MessageM.sendMessage(
null,
"%WThe auto-updater tried to contact dev.bukkit.org, but was unsuccessful.",
true);
MessageM.sendMessage(null,
"%TAG%WThe auto-updater tried to contact dev.bukkit.org, but was unsuccessful.");
result = Updater.UpdateResult.FAIL_DBO;
return null;
}
@ -505,13 +500,12 @@ public class Updater {
}
} else {
// The file's name did not contain the string 'vVersion'
MessageM.sendMessage(null, "%WThe author of this plugin ("
MessageM.sendMessage(null, "%TAG%WThe author of this plugin ("
+ plugin.getDescription().getAuthors().get(0)
+ ") has misconfigured their Auto Update system", true);
+ ") has misconfigured their Auto Update system");
MessageM.sendMessage(
null,
"%WFiles uploaded to BukkitDev should contain the version number, seperated from the name by a 'v', such as PluginName v1.0",
true);
"%TAG%WFiles uploaded to BukkitDev should contain the version number, seperated from the name by a 'v', such as PluginName v1.0");
result = Updater.UpdateResult.FAIL_NOVERSION;
return false;
}
@ -598,10 +592,8 @@ public class Updater {
return false;
}
} catch (XMLStreamException e) {
MessageM.sendMessage(
null,
"%WCould not reach dev.bukkit.org for update checking. Is it offline?",
true);
MessageM.sendMessage(null,
"%TAG%WCould not reach dev.bukkit.org for update checking. Is it offline?");
return false;
}
}
@ -615,8 +607,7 @@ public class Updater {
} catch (IOException e) {
MessageM.sendMessage(
null,
"%WCould not reach BukkitDev file stream for update checking. Is dev.bukkit.org offline?",
true);
"%TAG%WCould not reach BukkitDev file stream for update checking. Is dev.bukkit.org offline?");
return null;
}
}

View File

@ -4,8 +4,8 @@ import java.util.ArrayList;
import java.util.HashMap;
import java.util.Random;
import nl.Steffion.BlockHunt.Managers.CommandM;
import nl.Steffion.BlockHunt.Managers.ConfigM;
import nl.Steffion.BlockHunt.Managers.MessageM;
import nl.Steffion.BlockHunt.Serializables.LocationSerializable;
import org.bukkit.Location;
@ -15,24 +15,40 @@ import org.bukkit.inventory.ItemStack;
import pgDev.bukkit.DisguiseCraft.api.DisguiseCraftAPI;
public class W {
/*
* Made by @author Steffion, © 2013.
/**
* Steffion's Engine - Made by Steffion.
*
* You're allowed to use this engine for own usage, you're not allowed to
* republish the engine. Using this for your own plugin is allowed when a
* credit is placed somewhere in the plugin.
*
* Thanks for your cooperate!
*
* @author Steffion
*/
public static String pluginName = "BlockHunt";
public static String pluginVersion = "v0.1.5_ALPHA";
public static String engineVersion = "v1.1.0";
public static String pluginAutors = "Steffion";
public static String pluginMainPermission = pluginName + ".";
/*
* Standard stuff.
*/
public static ArrayList<String> newFiles = new ArrayList<String>();
public static ArrayList<CommandM> commands = new ArrayList<CommandM>();
/*
* If you want another file to be created. Copy and paste this line.
*/
public static ConfigM config = new ConfigM("config");
public static ConfigM messages = new ConfigM("messages");
public static ConfigM arenas = new ConfigM("arenas");
public static ConfigM signs = new ConfigM("signs");
public static ConfigM shop = new ConfigM("shop");
/*
* Add any variable you need in different classes here:
*/
public static HashMap<Player, LocationSerializable> pos1 = new HashMap<Player, LocationSerializable>();
public static HashMap<Player, LocationSerializable> pos2 = new HashMap<Player, LocationSerializable>();
public static ConfigM config = new ConfigM("config", "");
public static ConfigM messages = new ConfigM("messages", "");
public static ConfigM arenas = new ConfigM("arenas", "");
public static ConfigM signs = new ConfigM("signs", "");
public static ConfigM shop = new ConfigM("shop", "");
public static ArrayList<Arena> arenaList = new ArrayList<Arena>();
public static Random random = new Random();
public static DisguiseCraftAPI dcAPI;
@ -45,14 +61,4 @@ public class W {
public static HashMap<Player, Location> moveLoc = new HashMap<Player, Location>();
public static HashMap<Player, Location> hiddenLoc = new HashMap<Player, Location>();
public static HashMap<Player, Boolean> hiddenLocWater = new HashMap<Player, Boolean>();
public static void newFiles() {
ConfigM.setDefaults();
for (String Filename : newFiles) {
MessageM.sendMessage(null,
"%WCouldn't find '%A%Filename%.yml%W' creating new one.",
true, "Filename-" + Filename);
}
newFiles.clear();
}
}