* Update to 1.10

* Update Libdisguises dependency
* Java 1.8 compile
* Code Cleanup
This commit is contained in:
Narimm 2016-07-06 12:39:35 +10:00
parent b1fabcdd9c
commit 0b801a70cb
32 changed files with 508 additions and 503 deletions

14
.gitignore vendored
View File

@ -1,15 +1 @@
# Eclipse
.classpath
.project
.settings/
# Intellij
.idea/
*.iml
*.iws
# Maven
log/
target/ target/
*.gitignore

67
pom.xml
View File

@ -2,11 +2,34 @@
<modelVersion>4.0.0</modelVersion> <modelVersion>4.0.0</modelVersion>
<groupId>nl.Steffion</groupId> <groupId>nl.Steffion</groupId>
<artifactId>BlockHunt</artifactId> <artifactId>BlockHunt</artifactId>
<version>0.2.1-b${env.BUILD_NUMBER}</version> <version>0.2.1-SNAPSHOT</version>
<name>BlockHunt</name> <name>BlockHunt</name>
<properties>
<pluginversion>${project.version}-${buildnumber}</pluginversion>
<!-- so as to allow local declaration when building locally-->
<buildnumber />
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
</properties>
<scm>
<connection>scm:git:git@github.com:AddstarMC/Blockhunt.git</connection>
<developerConnection>scm:git:git@github.com:AddstarMC/Blockhunt.git</developerConnection>
<url>https://github.com/AddstarMC/Blockhunt</url>
<tag>master</tag>
</scm>
<distributionManagement>
<repository>
<id>maven.addstar.com.au</id>
<name>maven.addstar.com.au-releases</name>
<url>http://maven.addstar.com.au/artifactory/ext-release-local</url>
</repository>
<snapshotRepository>
<id>maven.addstar.com.au</id>
<name>maven.addstar.com.au-snapshots</name>
<url>http://maven.addstar.com.au/artifactory/ext-snapshot-local</url>
</snapshotRepository>
</distributionManagement>
<repositories> <repositories>
<!-- Addstar repos --> <!-- Addstar repo -->
<repository> <repository>
<id>addstar-repo</id> <id>addstar-repo</id>
<url>http://maven.addstar.com.au/artifactory/ext-release-local</url> <url>http://maven.addstar.com.au/artifactory/ext-release-local</url>
@ -25,12 +48,9 @@
</releases> </releases>
</repository> </repository>
<!-- For spigot -->
<repository> <repository>
<id>md5-repo</id> <id>spigot-repo</id>
<url>http://repo.md-5.net/content/groups/public/</url> <url>https://hub.spigotmc.org/nexus/content/groups/public</url>
<releases><enabled>true</enabled></releases>
<snapshots><enabled>true</enabled></snapshots>
</repository> </repository>
<!-- Other repositories --> <!-- Other repositories -->
@ -38,21 +58,25 @@
<id>maven-central</id> <id>maven-central</id>
<url>http://repo1.maven.org/maven2/</url> <url>http://repo1.maven.org/maven2/</url>
</repository> </repository>
<!--Lib Disguises-->
<repository>
<id>md_5-releases</id>
<url>http://repo.md-5.net/content/repositories/releases/</url>
</repository>
</repositories> </repositories>
<dependencies> <dependencies>
<!-- Bukkit -->
<dependency> <dependency>
<groupId>org.bukkit</groupId> <groupId>org.spigotmc</groupId>
<artifactId>bukkit</artifactId> <artifactId>spigot</artifactId>
<version>1.9-R0.1-SNAPSHOT</version> <version>1.10-R0.1-SNAPSHOT</version>
<scope>provided</scope>
</dependency> </dependency>
<!-- LibsDiguises is required for hiding --> <!-- LibsDiguises is required for hiding -->
<dependency> <dependency>
<groupId>me.libraryaddict.disguise</groupId> <groupId>LibsDisguises</groupId>
<artifactId>LibsDisguises</artifactId> <artifactId>LibsDisguises</artifactId>
<version>9.0.2</version> <version>9.0.7</version>
<scope>provided</scope>
</dependency> </dependency>
</dependencies> </dependencies>
@ -75,11 +99,16 @@
<artifactId>maven-compiler-plugin</artifactId> <artifactId>maven-compiler-plugin</artifactId>
<version>2.3.2</version> <version>2.3.2</version>
<configuration> <configuration>
<source>1.6</source> <source>1.8</source>
<target>1.6</target> <target>1.8</target>
<encoding>ISO-8859-1</encoding> <encoding>UTF-8</encoding>
</configuration> </configuration>
</plugin> </plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-release-plugin</artifactId>
<version>2.5.1</version>
</plugin>
</plugins> </plugins>
</build> </build>
</project> </project>

View File

@ -98,7 +98,7 @@ public class Arena implements ConfigurationSerializable {
hidersTokenWin, hidersTokenWin,
seekersTokenWin, seekersTokenWin,
killTokens, killTokens,
blockAnnouncerTime; blockAnnouncerTime
} }
public enum ArenaState { public enum ArenaState {
@ -106,12 +106,12 @@ public class Arena implements ConfigurationSerializable {
STARTING, STARTING,
INGAME, INGAME,
RESTARTING, RESTARTING,
DISABLED; DISABLED
} }
@Override @Override
public Map<String, Object> serialize() { public Map<String, Object> serialize() {
Map<String, Object> map = new HashMap<String, Object>(); Map<String, Object> map = new HashMap<>();
map.put("arenaName", arenaName); map.put("arenaName", arenaName);
map.put("pos1", pos1); map.put("pos1", pos1);
map.put("pos2", pos2); map.put("pos2", pos2);
@ -147,7 +147,7 @@ public class Arena implements ConfigurationSerializable {
(ArrayList<ItemStack>) M.g(map, "disguiseBlocks", new ArrayList<ItemStack>()),(LocationSerializable) M.g(map, "lobbyWarp", loc), (LocationSerializable) M.g(map, "hidersWarp", loc), (LocationSerializable) M.g(map, "seekersWarp", loc), (ArrayList<ItemStack>) M.g(map, "disguiseBlocks", new ArrayList<ItemStack>()),(LocationSerializable) M.g(map, "lobbyWarp", loc), (LocationSerializable) M.g(map, "hidersWarp", loc), (LocationSerializable) M.g(map, "seekersWarp", loc),
(LocationSerializable) M.g(map, "spawnWarp", loc), (ArrayList<String>) M.g(map, "seekersWinCommands", new ArrayList<String>()), (LocationSerializable) M.g(map, "spawnWarp", loc), (ArrayList<String>) M.g(map, "seekersWinCommands", new ArrayList<String>()),
(ArrayList<String>) M.g(map, "hidersWinCommands", new ArrayList<String>()), (ArrayList<String>) M.g(map, "allowedCommands", new ArrayList<String>()), (ArrayList<String>) M.g(map, "hidersWinCommands", new ArrayList<String>()), (ArrayList<String>) M.g(map, "allowedCommands", new ArrayList<String>()),
(Integer) M.g(map, "seekersTokenWin", 10), (Integer) M.g(map, "hidersTokenWin", 50), (Integer) M.g(map, "killTokens", 8), new ArrayList<Player>(), (Integer) M.g(map, "seekersTokenWin", 10), (Integer) M.g(map, "hidersTokenWin", 50), (Integer) M.g(map, "killTokens", 8), new ArrayList<>(),
ArenaState.WAITING, 0, new ArrayList<Player>(), Bukkit.getScoreboardManager().getNewScoreboard()); ArenaState.WAITING, 0, new ArrayList<>(), Bukkit.getScoreboardManager().getNewScoreboard());
} }
} }

View File

@ -23,7 +23,6 @@ import org.bukkit.inventory.ItemStack;
import org.bukkit.inventory.meta.ItemMeta; import org.bukkit.inventory.meta.ItemMeta;
import org.bukkit.potion.PotionEffect; import org.bukkit.potion.PotionEffect;
@SuppressWarnings("deprecation")
public class ArenaHandler { public class ArenaHandler {
public static void loadArenas() { public static void loadArenas() {
W.arenaList.clear(); W.arenaList.clear();
@ -157,7 +156,7 @@ public class ArenaHandler {
ItemMeta shopBlockChooser_IM = shopBlockChooser.getItemMeta(); ItemMeta shopBlockChooser_IM = shopBlockChooser.getItemMeta();
shopBlockChooser_IM.setDisplayName(MessageM.replaceAll((String) W.config.get(ConfigC.shop_blockChooserv1Name))); shopBlockChooser_IM.setDisplayName(MessageM.replaceAll((String) W.config.get(ConfigC.shop_blockChooserv1Name)));
List<String> lores = W.config.getFile().getStringList(ConfigC.shop_blockChooserv1Description.location); List<String> lores = W.config.getFile().getStringList(ConfigC.shop_blockChooserv1Description.location);
List<String> lores2 = new ArrayList<String>(); List<String> lores2 = new ArrayList<>();
for (String lore : lores) { for (String lore : lores) {
lores2.add(MessageM.replaceAll(lore)); lores2.add(MessageM.replaceAll(lore));
} }
@ -175,7 +174,7 @@ public class ArenaHandler {
ItemMeta shopBlockHuntPass_IM = shopBlockHuntPass.getItemMeta(); ItemMeta shopBlockHuntPass_IM = shopBlockHuntPass.getItemMeta();
shopBlockHuntPass_IM.setDisplayName(MessageM.replaceAll((String) W.config.get(ConfigC.shop_BlockHuntPassv2Name))); shopBlockHuntPass_IM.setDisplayName(MessageM.replaceAll((String) W.config.get(ConfigC.shop_BlockHuntPassv2Name)));
List<String> lores = W.config.getFile().getStringList(ConfigC.shop_BlockHuntPassv2Description.location); List<String> lores = W.config.getFile().getStringList(ConfigC.shop_BlockHuntPassv2Description.location);
List<String> lores2 = new ArrayList<String>(); List<String> lores2 = new ArrayList<>();
for (String lore : lores) { for (String lore : lores) {
lores2.add(MessageM.replaceAll(lore)); lores2.add(MessageM.replaceAll(lore));
} }
@ -351,8 +350,8 @@ public class ArenaHandler {
System.out.println("[BlockHunt] Seekers have won " + arena.arenaName); System.out.println("[BlockHunt] Seekers have won " + arena.arenaName);
ArenaHandler.sendFMessage(arena, ConfigC.normal_winSeekers); ArenaHandler.sendFMessage(arena, ConfigC.normal_winSeekers);
List<Player> winners = new ArrayList<Player>(); List<Player> winners = new ArrayList<>();
List<Player> losers = new ArrayList<Player>(); List<Player> losers = new ArrayList<>();
for (Player player : arena.playersInArena) { for (Player player : arena.playersInArena) {
@ -401,8 +400,8 @@ public class ArenaHandler {
System.out.println("[BlockHunt] Hiders have won " + arena.arenaName); System.out.println("[BlockHunt] Hiders have won " + arena.arenaName);
ArenaHandler.sendFMessage(arena, ConfigC.normal_winHiders); ArenaHandler.sendFMessage(arena, ConfigC.normal_winHiders);
List<Player> winners = new ArrayList<Player>(); List<Player> winners = new ArrayList<>();
List<Player> losers = new ArrayList<Player>(); List<Player> losers = new ArrayList<>();
for (Player player : arena.playersInArena) { for (Player player : arena.playersInArena) {

View File

@ -1,5 +1,15 @@
package nl.Steffion.BlockHunt; package nl.Steffion.BlockHunt;
/**
* 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
*/
import java.util.ArrayList; import java.util.ArrayList;
import java.util.List; import java.util.List;
@ -60,17 +70,7 @@ import org.bukkit.plugin.PluginDescriptionFile;
import org.bukkit.plugin.java.JavaPlugin; import org.bukkit.plugin.java.JavaPlugin;
public class BlockHunt extends JavaPlugin implements Listener { public class BlockHunt extends JavaPlugin implements Listener {
/**
* 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; public static PluginDescriptionFile pdfFile;
public static BlockHunt plugin; public static BlockHunt plugin;
@ -186,11 +186,7 @@ public class BlockHunt extends JavaPlugin implements Listener {
+ BlockHunt.pdfFile.getAuthors().get(0)); + BlockHunt.pdfFile.getAuthors().get(0));
// Welcome to the massive game loop!! // Welcome to the massive game loop!!
getServer().getScheduler().runTaskTimer(this, new Runnable() { getServer().getScheduler().runTaskTimer(this, () -> {
@SuppressWarnings("deprecation")
@Override
public void run() {
for (Arena arena : W.arenaList) { for (Arena arena : W.arenaList) {
if (arena.gameState == ArenaState.WAITING) { if (arena.gameState == ArenaState.WAITING) {
if (arena.playersInArena.size() >= arena.minPlayers) { if (arena.playersInArena.size() >= arena.minPlayers) {
@ -234,7 +230,7 @@ public class BlockHunt extends JavaPlugin implements Listener {
for (Player playerCheck : arena.playersInArena) { for (Player playerCheck : arena.playersInArena) {
if (W.choosenSeeker.get(playerCheck) != null) { if (W.choosenSeeker.get(playerCheck) != null) {
if (W.choosenSeeker.get(playerCheck) == true) { if (W.choosenSeeker.get(playerCheck)) {
seeker = playerCheck; seeker = playerCheck;
W.choosenSeeker.remove(playerCheck); W.choosenSeeker.remove(playerCheck);
} else { } else {
@ -455,7 +451,6 @@ public class BlockHunt extends JavaPlugin implements Listener {
} }
} }
SignsHandler.updateSigns(); //TODO Only do this when needed (gamestate change or player count change) SignsHandler.updateSigns(); //TODO Only do this when needed (gamestate change or player count change)
}
}, 0, 20); }, 0, 20);
} }
@ -509,11 +504,7 @@ public class BlockHunt extends JavaPlugin implements Listener {
boolean equals = true; boolean equals = true;
if (argsSplit == null) { if (argsSplit == null) {
if (args.length == 0) { equals = args.length == 0;
equals = true;
} else {
equals = false;
}
} else { } else {
if (args.length >= argsSplit.length) { if (args.length >= argsSplit.length) {
for (int i2 = argsSplit.length - 1; i2 >= 0; i2 = i2 - 1) { for (int i2 = argsSplit.length - 1; i2 >= 0; i2 = i2 - 1) {

View File

@ -25,9 +25,9 @@ public class CMDcreate extends DefaultCMD {
} else { } else {
if (W.pos1.get(player) != null && W.pos2.get(player) != null) { if (W.pos1.get(player) != null && W.pos2.get(player) != null) {
if (W.pos1.get(player).getWorld().equals(W.pos2.get(player).getWorld())) { 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, 45, false, false, false, false, false, new ArrayList<ItemStack>(), null, null, null, Arena arena = new Arena(args[1], W.pos1.get(player), W.pos2.get(player), 12, 3, 1, 50, 20, 300, 30, 45, false, false, false, false, false, new ArrayList<>(), null, null, null,
null, new ArrayList<String>(), new ArrayList<String>(), new ArrayList<String>(), 10, 50, 8, new ArrayList<Player>(), ArenaState.WAITING, null, new ArrayList<>(), new ArrayList<>(), new ArrayList<>(), 10, 50, 8, new ArrayList<>(), ArenaState.WAITING,
0, new ArrayList<Player>(), Bukkit.getScoreboardManager().getNewScoreboard()); 0, new ArrayList<>(), Bukkit.getScoreboardManager().getNewScoreboard());
W.arenas.getFile().set(args[1], arena); W.arenas.getFile().set(args[1], arena);
W.arenas.save(); W.arenas.save();
W.signs.load(); W.signs.load();

View File

@ -1,5 +1,15 @@
package nl.Steffion.BlockHunt.Commands; package nl.Steffion.BlockHunt.Commands;
/**
* 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
*/
import nl.Steffion.BlockHunt.ConfigC; import nl.Steffion.BlockHunt.ConfigC;
import nl.Steffion.BlockHunt.BlockHunt; import nl.Steffion.BlockHunt.BlockHunt;
import nl.Steffion.BlockHunt.W; import nl.Steffion.BlockHunt.W;
@ -11,17 +21,7 @@ import org.bukkit.command.Command;
import org.bukkit.entity.Player; import org.bukkit.entity.Player;
public class CMDhelp extends DefaultCMD { 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 @Override
public boolean exectue(Player player, Command cmd, String label, String[] args) { public boolean exectue(Player player, Command cmd, String label, String[] args) {

View File

@ -1,14 +1,5 @@
package nl.Steffion.BlockHunt.Commands; package nl.Steffion.BlockHunt.Commands;
/**
import nl.Steffion.BlockHunt.BlockHunt;
import nl.Steffion.BlockHunt.ConfigC;
import nl.Steffion.BlockHunt.Managers.MessageM;
import org.bukkit.command.Command;
import org.bukkit.entity.Player;
public class CMDinfo extends DefaultCMD {
/**
* Steffion's Engine - Made by Steffion. * Steffion's Engine - Made by Steffion.
* *
* You're allowed to use this engine for own usage, you're not allowed to * You're allowed to use this engine for own usage, you're not allowed to
@ -19,6 +10,15 @@ public class CMDinfo extends DefaultCMD {
* *
* @author Steffion * @author Steffion
*/ */
import nl.Steffion.BlockHunt.BlockHunt;
import nl.Steffion.BlockHunt.ConfigC;
import nl.Steffion.BlockHunt.Managers.MessageM;
import org.bukkit.command.Command;
import org.bukkit.entity.Player;
public class CMDinfo extends DefaultCMD {
@Override @Override
public boolean exectue(Player player, Command cmd, String label, String[] args) { public boolean exectue(Player player, Command cmd, String label, String[] args) {

View File

@ -1,13 +1,5 @@
package nl.Steffion.BlockHunt.Commands; package nl.Steffion.BlockHunt.Commands;
/**
import nl.Steffion.BlockHunt.ConfigC;
import nl.Steffion.BlockHunt.Managers.MessageM;
import org.bukkit.command.Command;
import org.bukkit.entity.Player;
public class CMDnotfound {
/**
* Steffion's Engine - Made by Steffion. * Steffion's Engine - Made by Steffion.
* *
* You're allowed to use this engine for own usage, you're not allowed to * You're allowed to use this engine for own usage, you're not allowed to
@ -18,6 +10,14 @@ public class CMDnotfound {
* *
* @author Steffion * @author Steffion
*/ */
import nl.Steffion.BlockHunt.ConfigC;
import nl.Steffion.BlockHunt.Managers.MessageM;
import org.bukkit.command.Command;
import org.bukkit.entity.Player;
public class CMDnotfound {
public static boolean exectue(Player player, Command cmd, String label, String[] args) { public static boolean exectue(Player player, Command cmd, String label, String[] args) {
MessageM.sendFMessage(player, ConfigC.error_commandNotFound); MessageM.sendFMessage(player, ConfigC.error_commandNotFound);

View File

@ -1,5 +1,15 @@
package nl.Steffion.BlockHunt.Commands; package nl.Steffion.BlockHunt.Commands;
/**
* 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
*/
import nl.Steffion.BlockHunt.Arena; import nl.Steffion.BlockHunt.Arena;
import nl.Steffion.BlockHunt.ArenaHandler; import nl.Steffion.BlockHunt.ArenaHandler;
import nl.Steffion.BlockHunt.ConfigC; import nl.Steffion.BlockHunt.ConfigC;
@ -11,17 +21,7 @@ import org.bukkit.command.Command;
import org.bukkit.entity.Player; import org.bukkit.entity.Player;
public class CMDreload extends DefaultCMD { 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 @Override
public boolean exectue(Player player, Command cmd, String label, String[] args) { public boolean exectue(Player player, Command cmd, String label, String[] args) {

View File

@ -39,7 +39,7 @@ public class CMDremove extends DefaultCMD {
W.arenas.save(); W.arenas.save();
W.signs.load(); W.signs.load();
W.arenaList.remove((Arena) arena); W.arenaList.remove(arena);
return true; return true;
} }
} }

View File

@ -1,16 +1,5 @@
package nl.Steffion.BlockHunt.Commands; package nl.Steffion.BlockHunt.Commands;
/**
import nl.Steffion.BlockHunt.BlockHunt;
import nl.Steffion.BlockHunt.ConfigC;
import nl.Steffion.BlockHunt.W;
import nl.Steffion.BlockHunt.Managers.MessageM;
import org.bukkit.Bukkit;
import org.bukkit.command.Command;
import org.bukkit.entity.Player;
public class CMDtokens extends DefaultCMD {
/**
* Steffion's Engine - Made by Steffion. * Steffion's Engine - Made by Steffion.
* *
* You're allowed to use this engine for own usage, you're not allowed to * You're allowed to use this engine for own usage, you're not allowed to
@ -21,6 +10,17 @@ public class CMDtokens extends DefaultCMD {
* *
* @author Steffion * @author Steffion
*/ */
import nl.Steffion.BlockHunt.BlockHunt;
import nl.Steffion.BlockHunt.ConfigC;
import nl.Steffion.BlockHunt.W;
import nl.Steffion.BlockHunt.Managers.MessageM;
import org.bukkit.Bukkit;
import org.bukkit.command.Command;
import org.bukkit.entity.Player;
public class CMDtokens extends DefaultCMD {
@Override @Override
public boolean exectue(Player player, Command cmd, String label, String[] args) { public boolean exectue(Player player, Command cmd, String label, String[] args) {

View File

@ -24,7 +24,7 @@ public class CMDwand extends DefaultCMD {
im.setDisplayName(MessageM.replaceAll((String) W.config.get(ConfigC.wandName))); im.setDisplayName(MessageM.replaceAll((String) W.config.get(ConfigC.wandName)));
W.config.load(); W.config.load();
List<String> lores = W.config.getFile().getStringList(ConfigC.wandDescription.location); List<String> lores = W.config.getFile().getStringList(ConfigC.wandDescription.location);
List<String> lores2 = new ArrayList<String>(); List<String> lores2 = new ArrayList<>();
for (String lore : lores) { for (String lore : lores) {
lores2.add(MessageM.replaceAll(lore)); lores2.add(MessageM.replaceAll(lore));
} }

View File

@ -1,12 +1,5 @@
package nl.Steffion.BlockHunt.Commands; package nl.Steffion.BlockHunt.Commands;
/**
import nl.Steffion.BlockHunt.Managers.MessageM;
import org.bukkit.command.Command;
import org.bukkit.entity.Player;
public class DefaultCMD {
/**
* Steffion's Engine - Made by Steffion. * Steffion's Engine - Made by Steffion.
* *
* You're allowed to use this engine for own usage, you're not allowed to * You're allowed to use this engine for own usage, you're not allowed to
@ -17,6 +10,13 @@ public class DefaultCMD {
* *
* @author Steffion * @author Steffion
*/ */
import nl.Steffion.BlockHunt.Managers.MessageM;
import org.bukkit.command.Command;
import org.bukkit.entity.Player;
public class DefaultCMD {
public boolean exectue(Player player, Command cmd, String label, String[] args) { public boolean exectue(Player player, Command cmd, String label, String[] args) {
MessageM.sendMessage(player, "%TAG%NExample of a Command!"); MessageM.sendMessage(player, "%TAG%NExample of a Command!");

View File

@ -1,9 +1,5 @@
package nl.Steffion.BlockHunt; package nl.Steffion.BlockHunt;
/**
import nl.Steffion.BlockHunt.Managers.ConfigM;
public enum ConfigC {
/**
* Steffion's Engine - Made by Steffion. * Steffion's Engine - Made by Steffion.
* *
* You're allowed to use this engine for own usage, you're not allowed to * You're allowed to use this engine for own usage, you're not allowed to
@ -14,6 +10,10 @@ public enum ConfigC {
* *
* @author Steffion * @author Steffion
*/ */
import nl.Steffion.BlockHunt.Managers.ConfigM;
public enum ConfigC {
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", 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), W.config), chat_header("&9", W.config), chat_headerhigh("%H_______.[ %A%header%%H ]._______", W.config),
@ -117,7 +117,7 @@ public enum ConfigC {
* @param config * @param config
* The config file. * The config file.
*/ */
private ConfigC(Object value, ConfigM config) { ConfigC(Object value, ConfigM config) {
this.value = value; this.value = value;
this.config = config; this.config = config;
this.location = this.name().replaceAll("_", "."); this.location = this.name().replaceAll("_", ".");

View File

@ -189,7 +189,7 @@ public class InventoryHandler {
ItemStack arenaNameNote = new ItemStack(Material.PAPER, 1); ItemStack arenaNameNote = new ItemStack(Material.PAPER, 1);
ItemMeta arenaNameNote_IM = arenaNameNote.getItemMeta(); ItemMeta arenaNameNote_IM = arenaNameNote.getItemMeta();
arenaNameNote_IM.setDisplayName(MessageM.replaceAll("%NDisguiseBlocks of arena: %A" + arenaname)); arenaNameNote_IM.setDisplayName(MessageM.replaceAll("%NDisguiseBlocks of arena: %A" + arenaname));
ArrayList<String> lores = new ArrayList<String>(); ArrayList<String> lores = new ArrayList<>();
lores.add(MessageM.replaceAll("%NPlace the DisguiseBlocks inside this inventory.")); lores.add(MessageM.replaceAll("%NPlace the DisguiseBlocks inside this inventory."));
arenaNameNote_IM.setLore(lores); arenaNameNote_IM.setLore(lores);
arenaNameNote.setItemMeta(arenaNameNote_IM); arenaNameNote.setItemMeta(arenaNameNote_IM);
@ -209,8 +209,8 @@ public class InventoryHandler {
W.shop.save(); W.shop.save();
} }
int playerTokens = W.shop.getFile().getInt(player.getName() + ".tokens"); int playerTokens = W.shop.getFile().getInt(player.getName() + ".tokens");
List<String> lores = new ArrayList<String>(); List<String> lores = new ArrayList<>();
List<String> lores2 = new ArrayList<String>(); List<String> lores2 = new ArrayList<>();
ItemStack shopTokens = new ItemStack(Material.EMERALD, 1); ItemStack shopTokens = new ItemStack(Material.EMERALD, 1);
ItemMeta shopTokens_IM = shopTokens.getItemMeta(); ItemMeta shopTokens_IM = shopTokens.getItemMeta();
@ -221,7 +221,7 @@ public class InventoryHandler {
ItemMeta shopBlockChooser_IM = shopBlockChooser.getItemMeta(); ItemMeta shopBlockChooser_IM = shopBlockChooser.getItemMeta();
shopBlockChooser_IM.setDisplayName(MessageM.replaceAll((String) W.config.get(ConfigC.shop_blockChooserv1Name))); shopBlockChooser_IM.setDisplayName(MessageM.replaceAll((String) W.config.get(ConfigC.shop_blockChooserv1Name)));
lores = W.config.getFile().getStringList(ConfigC.shop_blockChooserv1Description.location); lores = W.config.getFile().getStringList(ConfigC.shop_blockChooserv1Description.location);
lores2 = new ArrayList<String>(); lores2 = new ArrayList<>();
for (String lore : lores) { for (String lore : lores) {
lores2.add(MessageM.replaceAll(lore)); lores2.add(MessageM.replaceAll(lore));
} }
@ -235,7 +235,7 @@ public class InventoryHandler {
ItemMeta shopBlockHuntPass_IM = shopBlockHuntPass.getItemMeta(); ItemMeta shopBlockHuntPass_IM = shopBlockHuntPass.getItemMeta();
shopBlockHuntPass_IM.setDisplayName(MessageM.replaceAll((String) W.config.get(ConfigC.shop_BlockHuntPassv2Name))); shopBlockHuntPass_IM.setDisplayName(MessageM.replaceAll((String) W.config.get(ConfigC.shop_BlockHuntPassv2Name)));
lores = W.config.getFile().getStringList(ConfigC.shop_BlockHuntPassv2Description.location); lores = W.config.getFile().getStringList(ConfigC.shop_BlockHuntPassv2Description.location);
lores2 = new ArrayList<String>(); lores2 = new ArrayList<>();
for (String lore : lores) { for (String lore : lores) {
lores2.add(MessageM.replaceAll(lore)); lores2.add(MessageM.replaceAll(lore));
} }
@ -246,11 +246,11 @@ public class InventoryHandler {
shopBlockHuntPass.setItemMeta(shopBlockHuntPass_IM); shopBlockHuntPass.setItemMeta(shopBlockHuntPass_IM);
shop.setItem(0, shopTokens); shop.setItem(0, shopTokens);
if ((Boolean) W.config.get(ConfigC.shop_blockChooserv1Enabled) == true if ((Boolean) W.config.get(ConfigC.shop_blockChooserv1Enabled)
&& ((Boolean) W.shop.getFile().get(player.getName() + ".blockchooser") == null && !PermissionsM.hasPerm(player, Permissions.shopblockchooser, false))) { && (W.shop.getFile().get(player.getName() + ".blockchooser") == null && !PermissionsM.hasPerm(player, Permissions.shopblockchooser, false))) {
shop.setItem(1, shopBlockChooser); shop.setItem(1, shopBlockChooser);
} }
if ((Boolean) W.config.get(ConfigC.shop_BlockHuntPassv2Enabled) == true) { if ((Boolean) W.config.get(ConfigC.shop_BlockHuntPassv2Enabled)) {
shop.setItem(2, shopBlockHuntPass); shop.setItem(2, shopBlockHuntPass);
} }
player.openInventory(shop); player.openInventory(shop);

View File

@ -125,7 +125,7 @@ public class OnEntityDamageByEntityEvent implements Listener {
int hidercount = (arena.playersInArena.size() - arena.seekers.size()); int hidercount = (arena.playersInArena.size() - arena.seekers.size());
if ((hidercount <= 3) && (hidercount > 0)) { if ((hidercount <= 3) && (hidercount > 0)) {
List<String> hiders = new ArrayList<String>(); List<String> hiders = new ArrayList<>();
for (Player p : arena.playersInArena) { for (Player p : arena.playersInArena) {
if (!arena.seekers.contains(p)) { if (!arena.seekers.contains(p)) {
hiders.add(p.getName()); hiders.add(p.getName());

View File

@ -54,7 +54,7 @@ public class OnInventoryClickEvent implements Listener {
return; return;
if (inv.getName().startsWith("\u00A7r")) { if (inv.getName().startsWith("\u00A7r")) {
if (inv.getName().equals(MessageM.replaceAll((String) "\u00A7r" + W.config.get(ConfigC.shop_title)))) { if (inv.getName().equals(MessageM.replaceAll("\u00A7r" + W.config.get(ConfigC.shop_title)))) {
event.setCancelled(true); event.setCancelled(true);
ItemStack item = event.getCurrentItem(); ItemStack item = event.getCurrentItem();
if (W.shop.getFile().get(player.getName() + ".tokens") == null) { if (W.shop.getFile().get(player.getName() + ".tokens") == null) {
@ -114,7 +114,7 @@ public class OnInventoryClickEvent implements Listener {
if (arena.playersInArena.contains(player)) { if (arena.playersInArena.contains(player)) {
for (Player playerCheck : arena.playersInArena) { for (Player playerCheck : arena.playersInArena) {
if (W.choosenSeeker.get(playerCheck) != null) { if (W.choosenSeeker.get(playerCheck) != null) {
if (W.choosenSeeker.get(playerCheck) == true) { if (W.choosenSeeker.get(playerCheck)) {
i = i + 1; i = i + 1;
} }
} }
@ -145,7 +145,7 @@ public class OnInventoryClickEvent implements Listener {
if (arena.playersInArena.contains(player)) { if (arena.playersInArena.contains(player)) {
for (Player playerCheck : arena.playersInArena) { for (Player playerCheck : arena.playersInArena) {
if (W.choosenSeeker.get(playerCheck) != null) { if (W.choosenSeeker.get(playerCheck) != null) {
if (W.choosenSeeker.get(playerCheck) == false) { if (!W.choosenSeeker.get(playerCheck)) {
i = i + 1; i = i + 1;
} }
} }

View File

@ -32,7 +32,7 @@ public class OnInventoryCloseEvent implements Listener {
} }
} }
ArrayList<ItemStack> blocks = new ArrayList<ItemStack>(); ArrayList<ItemStack> blocks = new ArrayList<>();
for (ItemStack item : inv.getContents()) { for (ItemStack item : inv.getContents()) {
if (item != null) { if (item != null) {
if (!item.getType().equals(Material.PAPER)) { if (!item.getType().equals(Material.PAPER)) {

View File

@ -36,7 +36,7 @@ public class OnPlayerInteractEvent implements Listener {
Player player = event.getPlayer(); Player player = event.getPlayer();
Block block = event.getClickedBlock(); Block block = event.getClickedBlock();
if (PermissionsM.hasPerm(player, Permissions.create, false)) { if (PermissionsM.hasPerm(player, Permissions.create, false)) {
ItemStack item = player.getItemInHand(); ItemStack item = player.getInventory().getItemInMainHand();
if (item.getType() != Material.AIR) { if (item.getType() != Material.AIR) {
if (item.getItemMeta().hasDisplayName()) { if (item.getItemMeta().hasDisplayName()) {
ItemMeta im = item.getItemMeta(); ItemMeta im = item.getItemMeta();
@ -132,7 +132,7 @@ public class OnPlayerInteractEvent implements Listener {
for (Arena arena : W.arenaList) { for (Arena arena : W.arenaList) {
if (arena.playersInArena.contains(player) && (arena.gameState.equals(ArenaState.WAITING) || arena.gameState.equals(ArenaState.STARTING))) { if (arena.playersInArena.contains(player) && (arena.gameState.equals(ArenaState.WAITING) || arena.gameState.equals(ArenaState.STARTING))) {
event.setCancelled(true); event.setCancelled(true);
ItemStack item = player.getInventory().getItemInHand(); ItemStack item = player.getInventory().getItemInMainHand();
if (item.getType() != Material.AIR) { if (item.getType() != Material.AIR) {
if (item.getItemMeta().getDisplayName() != null) { if (item.getItemMeta().getDisplayName() != null) {
if (item.getItemMeta().getDisplayName().equals(MessageM.replaceAll((String) W.config.get(ConfigC.shop_blockChooserv1Name)))) { if (item.getItemMeta().getDisplayName().equals(MessageM.replaceAll((String) W.config.get(ConfigC.shop_blockChooserv1Name)))) {

View File

@ -1,14 +1,5 @@
package nl.Steffion.BlockHunt.Managers; 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. * Steffion's Engine - Made by Steffion.
* *
* You're allowed to use this engine for own usage, you're not allowed to * You're allowed to use this engine for own usage, you're not allowed to
@ -19,6 +10,15 @@ public class CommandM {
* *
* @author Steffion * @author Steffion
*/ */
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 {
public String name; public String name;
public String label; public String label;

View File

@ -1,5 +1,15 @@
package nl.Steffion.BlockHunt.Managers; package nl.Steffion.BlockHunt.Managers;
/**
* 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
*/
import java.io.File; import java.io.File;
import nl.Steffion.BlockHunt.BlockHunt; import nl.Steffion.BlockHunt.BlockHunt;
@ -11,17 +21,7 @@ import org.bukkit.configuration.file.FileConfiguration;
import org.bukkit.configuration.file.YamlConfiguration; import org.bukkit.configuration.file.YamlConfiguration;
public class ConfigM { public class ConfigM {
/**
* 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; String fileName;
File file; File file;
@ -145,7 +145,7 @@ public class ConfigM {
* *
* @param location * @param location
* Config location. * Config location.
* @return * @return Object
*/ */
public Object get(ConfigC location) { public Object get(ConfigC location) {
return this.getFile().get(location.location); return this.getFile().get(location.location);

View File

@ -1,7 +1,5 @@
package nl.Steffion.BlockHunt.Managers; package nl.Steffion.BlockHunt.Managers;
/**
public class EngineInfo {
/**
* Steffion's Engine - Made by Steffion. * Steffion's Engine - Made by Steffion.
* *
* You're allowed to use this engine for own usage, you're not allowed to * You're allowed to use this engine for own usage, you're not allowed to
@ -12,6 +10,8 @@ public class EngineInfo {
* *
* @author Steffion * @author Steffion
*/ */
public class EngineInfo {
public static String engineVersion = "3.0.2"; public static String engineVersion = "3.0.2";
public static String engineAuthors = "Steffion"; public static String engineAuthors = "Steffion";

View File

@ -9,7 +9,7 @@ import java.io.OutputStream;
public class FileM { public class FileM {
/* /*
* Made by @author Steffion, © 2013. * Made by @author Steffion, 2013.
*/ */
public static void copyFolder(File src, File dest) throws IOException { public static void copyFolder(File src, File dest) throws IOException {

View File

@ -110,7 +110,7 @@ public class MessageM {
* @param vars * @param vars
* Variables. Seperated with a - . Ex: "playerName-" + * Variables. Seperated with a - . Ex: "playerName-" +
* player.getName(); * player.getName();
* @return * @return String with the message with values replaced
*/ */
public static String replaceAll(String message, String... vars) { public static String replaceAll(String message, String... vars) {
return MessageM.replaceColours(MessageM.replaceColourVars(MessageM.replaceVars(message, vars))); return MessageM.replaceColours(MessageM.replaceColourVars(MessageM.replaceVars(message, vars)));
@ -185,7 +185,7 @@ public class MessageM {
} }
public static String TAG() { public static String TAG() {
return (String) W.config.get(ConfigC.chat_header) + (String) W.config.get(ConfigC.chat_tag) + (String) W.config.get(ConfigC.chat_normal); return W.config.get(ConfigC.chat_header) + W.config.get(ConfigC.chat_tag) + W.config.get(ConfigC.chat_normal);
} }
} }
} }

View File

@ -1,7 +1,5 @@
package nl.Steffion.BlockHunt; package nl.Steffion.BlockHunt;
/**
public class PermissionsC {
/**
* Steffion's Engine - Made by Steffion. * Steffion's Engine - Made by Steffion.
* *
* You're allowed to use this engine for own usage, you're not allowed to * You're allowed to use this engine for own usage, you're not allowed to
@ -12,11 +10,13 @@ public class PermissionsC {
* *
* @author Steffion * @author Steffion
*/ */
public class PermissionsC {
public static String main = BlockHunt.pdfFile.getName().toLowerCase() + "."; public static String main = BlockHunt.pdfFile.getName().toLowerCase() + ".";
public enum PType { public enum PType {
ALL, PLAYER, MODERATOR, ADMIN, OP; ALL, PLAYER, MODERATOR, ADMIN, OP
} }
public enum Permissions { public enum Permissions {
@ -28,7 +28,7 @@ public class PermissionsC {
public String perm; public String perm;
public PType type; public PType type;
private Permissions(String perm, PType type) { Permissions(String perm, PType type) {
this.perm = perm; this.perm = perm;
this.type = type; this.type = type;
} }

View File

@ -12,7 +12,7 @@ import org.bukkit.scoreboard.Scoreboard;
public class ScoreboardHandler { public class ScoreboardHandler {
public static void createScoreboard(Arena arena) { public static void createScoreboard(Arena arena) {
if ((Boolean) W.config.get(ConfigC.scoreboard_enabled) == true) { if ((Boolean) W.config.get(ConfigC.scoreboard_enabled)) {
Scoreboard board = arena.scoreboard; Scoreboard board = arena.scoreboard;
if (board.getObjective(arena.arenaName) != null) { if (board.getObjective(arena.arenaName) != null) {
updateScoreboard(arena); updateScoreboard(arena);
@ -49,7 +49,7 @@ public class ScoreboardHandler {
} }
public static void updateScoreboard(Arena arena) { public static void updateScoreboard(Arena arena) {
if ((Boolean) W.config.get(ConfigC.scoreboard_enabled) == true) { if ((Boolean) W.config.get(ConfigC.scoreboard_enabled)) {
Scoreboard board = arena.scoreboard; Scoreboard board = arena.scoreboard;
Objective object = board.getObjective(DisplaySlot.SIDEBAR); Objective object = board.getObjective(DisplaySlot.SIDEBAR);
object.setDisplayName(BlockHunt.cutString(MessageM.replaceAll((String) W.config.get(ConfigC.scoreboard_title)), 32)); object.setDisplayName(BlockHunt.cutString(MessageM.replaceAll((String) W.config.get(ConfigC.scoreboard_title)), 32));

View File

@ -33,7 +33,7 @@ public class LocationSerializable extends Location implements ConfigurationSeria
@Override @Override
public Map<String, Object> serialize() { public Map<String, Object> serialize() {
Map<String, Object> map = new HashMap<String, Object>(); Map<String, Object> map = new HashMap<>();
map.put("w", getWorld().getName()); map.put("w", getWorld().getName());
map.put("x", getX()); map.put("x", getX());
map.put("y", getY()); map.put("y", getY());

View File

@ -88,7 +88,6 @@ public class SignsHandler {
return false; return false;
} }
@SuppressWarnings("unchecked")
public static void updateSigns() { public static void updateSigns() {
W.signs.load(); W.signs.load();
for (String sign : W.signs.getFile().getKeys(false)) { for (String sign : W.signs.getFile().getKeys(false)) {

View File

@ -15,7 +15,7 @@ import org.bukkit.entity.Player;
import org.bukkit.inventory.ItemStack; import org.bukkit.inventory.ItemStack;
public class SolidBlockHandler { public class SolidBlockHandler {
@SuppressWarnings("deprecation")
public static void makePlayerUnsolid(Player player) { public static void makePlayerUnsolid(Player player) {
ItemStack block = player.getInventory().getItem(8); ItemStack block = player.getInventory().getItem(8);
if (block == null) { if (block == null) {

View File

@ -1,5 +1,17 @@
package nl.Steffion.BlockHunt; package nl.Steffion.BlockHunt;
/**
* 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
*/
import java.util.ArrayList; import java.util.ArrayList;
import java.util.HashMap; import java.util.HashMap;
import java.util.Random; import java.util.Random;
@ -13,23 +25,12 @@ import org.bukkit.entity.Player;
import org.bukkit.inventory.ItemStack; import org.bukkit.inventory.ItemStack;
public class W { public class W {
/**
* 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
*/
/* /*
* Standard stuff. * Standard stuff.
*/ */
public static ArrayList<String> newFiles = new ArrayList<String>(); public static ArrayList<String> newFiles = new ArrayList<>();
public static ArrayList<CommandM> commands = new ArrayList<CommandM>(); public static ArrayList<CommandM> commands = new ArrayList<>();
/* /*
* If you want another file to be created. Copy and paste this line. * If you want another file to be created. Copy and paste this line.
@ -44,19 +45,19 @@ public class W {
* Add any variable you need in different classes here: * Add any variable you need in different classes here:
*/ */
public static HashMap<Player, LocationSerializable> pos1 = new HashMap<Player, LocationSerializable>(); public static HashMap<Player, LocationSerializable> pos1 = new HashMap<>();
public static HashMap<Player, LocationSerializable> pos2 = new HashMap<Player, LocationSerializable>(); public static HashMap<Player, LocationSerializable> pos2 = new HashMap<>();
public static ArrayList<Arena> arenaList = new ArrayList<Arena>(); public static ArrayList<Arena> arenaList = new ArrayList<>();
public static Random random = new Random(); public static Random random = new Random();
public static HashMap<Player, Integer> seekertime = new HashMap<Player, Integer>(); public static HashMap<Player, Integer> seekertime = new HashMap<>();
public static HashMap<Player, PlayerArenaData> pData = new HashMap<Player, PlayerArenaData>(); public static HashMap<Player, PlayerArenaData> pData = new HashMap<>();
public static HashMap<Player, ItemStack> choosenBlock = new HashMap<Player, ItemStack>(); public static HashMap<Player, ItemStack> choosenBlock = new HashMap<>();
public static HashMap<Player, Boolean> choosenSeeker = new HashMap<Player, Boolean>(); public static HashMap<Player, Boolean> choosenSeeker = new HashMap<>();
public static HashMap<Player, ItemStack> pBlock = new HashMap<Player, ItemStack>(); public static HashMap<Player, ItemStack> pBlock = new HashMap<>();
public static HashMap<Player, Location> moveLoc = new HashMap<Player, Location>(); public static HashMap<Player, Location> moveLoc = new HashMap<>();
public static HashMap<Player, Location> hiddenLoc = new HashMap<Player, Location>(); public static HashMap<Player, Location> hiddenLoc = new HashMap<>();
public static HashMap<Player, Boolean> hiddenLocWater = new HashMap<Player, Boolean>(); public static HashMap<Player, Boolean> hiddenLocWater = new HashMap<>();
} }

View File

@ -1,6 +1,6 @@
name: BlockHunt name: BlockHunt
main: nl.Steffion.BlockHunt.BlockHunt main: nl.Steffion.BlockHunt.BlockHunt
version: ${project.version} version: ${pluginversion}
authors: authors:
- Steffion - Steffion
description: An easy to set up, Hide and seek plugin. Hide as blocks from the killer seekers. description: An easy to set up, Hide and seek plugin. Hide as blocks from the killer seekers.