* 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/
*.gitignore

67
pom.xml
View File

@ -2,11 +2,34 @@
<modelVersion>4.0.0</modelVersion>
<groupId>nl.Steffion</groupId>
<artifactId>BlockHunt</artifactId>
<version>0.2.1-b${env.BUILD_NUMBER}</version>
<version>0.2.1-SNAPSHOT</version>
<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>
<!-- Addstar repos -->
<!-- Addstar repo -->
<repository>
<id>addstar-repo</id>
<url>http://maven.addstar.com.au/artifactory/ext-release-local</url>
@ -25,12 +48,9 @@
</releases>
</repository>
<!-- For spigot -->
<repository>
<id>md5-repo</id>
<url>http://repo.md-5.net/content/groups/public/</url>
<releases><enabled>true</enabled></releases>
<snapshots><enabled>true</enabled></snapshots>
<id>spigot-repo</id>
<url>https://hub.spigotmc.org/nexus/content/groups/public</url>
</repository>
<!-- Other repositories -->
@ -38,21 +58,25 @@
<id>maven-central</id>
<url>http://repo1.maven.org/maven2/</url>
</repository>
<!--Lib Disguises-->
<repository>
<id>md_5-releases</id>
<url>http://repo.md-5.net/content/repositories/releases/</url>
</repository>
</repositories>
<dependencies>
<!-- Bukkit -->
<dependency>
<groupId>org.bukkit</groupId>
<artifactId>bukkit</artifactId>
<version>1.9-R0.1-SNAPSHOT</version>
<groupId>org.spigotmc</groupId>
<artifactId>spigot</artifactId>
<version>1.10-R0.1-SNAPSHOT</version>
<scope>provided</scope>
</dependency>
<!-- LibsDiguises is required for hiding -->
<dependency>
<groupId>me.libraryaddict.disguise</groupId>
<groupId>LibsDisguises</groupId>
<artifactId>LibsDisguises</artifactId>
<version>9.0.2</version>
<version>9.0.7</version>
<scope>provided</scope>
</dependency>
</dependencies>
@ -75,11 +99,16 @@
<artifactId>maven-compiler-plugin</artifactId>
<version>2.3.2</version>
<configuration>
<source>1.6</source>
<target>1.6</target>
<encoding>ISO-8859-1</encoding>
<source>1.8</source>
<target>1.8</target>
<encoding>UTF-8</encoding>
</configuration>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-release-plugin</artifactId>
<version>2.5.1</version>
</plugin>
</plugins>
</build>
</project>

View File

@ -98,7 +98,7 @@ public class Arena implements ConfigurationSerializable {
hidersTokenWin,
seekersTokenWin,
killTokens,
blockAnnouncerTime;
blockAnnouncerTime
}
public enum ArenaState {
@ -106,12 +106,12 @@ public class Arena implements ConfigurationSerializable {
STARTING,
INGAME,
RESTARTING,
DISABLED;
DISABLED
}
@Override
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("pos1", pos1);
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),
(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>()),
(Integer) M.g(map, "seekersTokenWin", 10), (Integer) M.g(map, "hidersTokenWin", 50), (Integer) M.g(map, "killTokens", 8), new ArrayList<Player>(),
ArenaState.WAITING, 0, new ArrayList<Player>(), Bukkit.getScoreboardManager().getNewScoreboard());
(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<>(), Bukkit.getScoreboardManager().getNewScoreboard());
}
}

View File

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

View File

@ -1,5 +1,15 @@
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.List;
@ -60,17 +70,7 @@ import org.bukkit.plugin.PluginDescriptionFile;
import org.bukkit.plugin.java.JavaPlugin;
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 BlockHunt plugin;
@ -186,277 +186,272 @@ public class BlockHunt extends JavaPlugin implements Listener {
+ BlockHunt.pdfFile.getAuthors().get(0));
// Welcome to the massive game loop!!
getServer().getScheduler().runTaskTimer(this, new Runnable() {
@SuppressWarnings("deprecation")
getServer().getScheduler().runTaskTimer(this, () -> {
for (Arena arena : W.arenaList) {
if (arena.gameState == ArenaState.WAITING) {
if (arena.playersInArena.size() >= arena.minPlayers) {
arena.gameState = ArenaState.STARTING;
arena.timer = arena.timeInLobbyUntilStart;
ArenaHandler.sendFMessage(arena, ConfigC.normal_lobbyArenaIsStarting, "1-" + arena.timeInLobbyUntilStart);
}
} else if (arena.gameState == ArenaState.STARTING) {
arena.timer = arena.timer - 1;
if (arena.timer > 0) {
if (arena.timer == 60) {
ArenaHandler.sendFMessage(arena, ConfigC.normal_lobbyArenaIsStarting, "1-60");
} else if (arena.timer == 30) {
ArenaHandler.sendFMessage(arena, ConfigC.normal_lobbyArenaIsStarting, "1-30");
} else if (arena.timer == 10) {
ArenaHandler.sendFMessage(arena, ConfigC.normal_lobbyArenaIsStarting, "1-10");
} else if (arena.timer == 5) {
arena.lobbyWarp.getWorld().playSound(arena.lobbyWarp, Sound.ENTITY_EXPERIENCE_ORB_PICKUP, 1, 0);
ArenaHandler.sendFMessage(arena, ConfigC.normal_lobbyArenaIsStarting, "1-5");
} else if (arena.timer == 4) {
arena.lobbyWarp.getWorld().playSound(arena.lobbyWarp, Sound.ENTITY_EXPERIENCE_ORB_PICKUP, 1, 0);
ArenaHandler.sendFMessage(arena, ConfigC.normal_lobbyArenaIsStarting, "1-4");
} else if (arena.timer == 3) {
arena.lobbyWarp.getWorld().playSound(arena.lobbyWarp, Sound.ENTITY_EXPERIENCE_ORB_PICKUP, 1, 1);
ArenaHandler.sendFMessage(arena, ConfigC.normal_lobbyArenaIsStarting, "1-3");
} else if (arena.timer == 2) {
arena.lobbyWarp.getWorld().playSound(arena.lobbyWarp, Sound.ENTITY_EXPERIENCE_ORB_PICKUP, 1, 1);
ArenaHandler.sendFMessage(arena, ConfigC.normal_lobbyArenaIsStarting, "1-2");
} else if (arena.timer == 1) {
arena.lobbyWarp.getWorld().playSound(arena.lobbyWarp, Sound.ENTITY_EXPERIENCE_ORB_PICKUP, 1, 2);
ArenaHandler.sendFMessage(arena, ConfigC.normal_lobbyArenaIsStarting, "1-1");
}
} else {
arena.gameState = ArenaState.INGAME;
arena.timer = arena.gameTime;
ArenaHandler.sendFMessage(arena, ConfigC.normal_lobbyArenaStarted, "secs-" + arena.waitingTimeSeeker);
@Override
public void run() {
for (Arena arena : W.arenaList) {
if (arena.gameState == ArenaState.WAITING) {
if (arena.playersInArena.size() >= arena.minPlayers) {
arena.gameState = ArenaState.STARTING;
arena.timer = arena.timeInLobbyUntilStart;
ArenaHandler.sendFMessage(arena, ConfigC.normal_lobbyArenaIsStarting, "1-" + arena.timeInLobbyUntilStart);
}
} else if (arena.gameState == ArenaState.STARTING) {
arena.timer = arena.timer - 1;
if (arena.timer > 0) {
if (arena.timer == 60) {
ArenaHandler.sendFMessage(arena, ConfigC.normal_lobbyArenaIsStarting, "1-60");
} else if (arena.timer == 30) {
ArenaHandler.sendFMessage(arena, ConfigC.normal_lobbyArenaIsStarting, "1-30");
} else if (arena.timer == 10) {
ArenaHandler.sendFMessage(arena, ConfigC.normal_lobbyArenaIsStarting, "1-10");
} else if (arena.timer == 5) {
arena.lobbyWarp.getWorld().playSound(arena.lobbyWarp, Sound.ENTITY_EXPERIENCE_ORB_PICKUP, 1, 0);
ArenaHandler.sendFMessage(arena, ConfigC.normal_lobbyArenaIsStarting, "1-5");
} else if (arena.timer == 4) {
arena.lobbyWarp.getWorld().playSound(arena.lobbyWarp, Sound.ENTITY_EXPERIENCE_ORB_PICKUP, 1, 0);
ArenaHandler.sendFMessage(arena, ConfigC.normal_lobbyArenaIsStarting, "1-4");
} else if (arena.timer == 3) {
arena.lobbyWarp.getWorld().playSound(arena.lobbyWarp, Sound.ENTITY_EXPERIENCE_ORB_PICKUP, 1, 1);
ArenaHandler.sendFMessage(arena, ConfigC.normal_lobbyArenaIsStarting, "1-3");
} else if (arena.timer == 2) {
arena.lobbyWarp.getWorld().playSound(arena.lobbyWarp, Sound.ENTITY_EXPERIENCE_ORB_PICKUP, 1, 1);
ArenaHandler.sendFMessage(arena, ConfigC.normal_lobbyArenaIsStarting, "1-2");
} else if (arena.timer == 1) {
arena.lobbyWarp.getWorld().playSound(arena.lobbyWarp, Sound.ENTITY_EXPERIENCE_ORB_PICKUP, 1, 2);
ArenaHandler.sendFMessage(arena, ConfigC.normal_lobbyArenaIsStarting, "1-1");
}
} else {
arena.gameState = ArenaState.INGAME;
arena.timer = arena.gameTime;
ArenaHandler.sendFMessage(arena, ConfigC.normal_lobbyArenaStarted, "secs-" + arena.waitingTimeSeeker);
for (int i = arena.amountSeekersOnStart; i > 0; i = i - 1) {
boolean loop = true;
Player seeker = arena.playersInArena.get(W.random.nextInt(arena.playersInArena.size()));
for (int i = arena.amountSeekersOnStart; i > 0; i = i - 1) {
boolean loop = true;
Player seeker = arena.playersInArena.get(W.random.nextInt(arena.playersInArena.size()));
for (Player playerCheck : arena.playersInArena) {
if (W.choosenSeeker.get(playerCheck) != null) {
if (W.choosenSeeker.get(playerCheck)) {
seeker = playerCheck;
W.choosenSeeker.remove(playerCheck);
} else {
if (seeker.equals(playerCheck)) {
i = i + 1;
loop = false;
}
}
}
}
for (Player playerCheck : arena.playersInArena) {
if (W.choosenSeeker.get(playerCheck) != null) {
if (W.choosenSeeker.get(playerCheck) == true) {
seeker = playerCheck;
W.choosenSeeker.remove(playerCheck);
} else {
if (seeker.equals(playerCheck)) {
i = i + 1;
loop = false;
}
}
}
}
if (loop) {
if (!arena.seekers.contains(seeker)) {
ArenaHandler.sendFMessage(arena, ConfigC.normal_ingameSeekerChoosen, "seeker-" + seeker.getName());
arena.seekers.add(seeker);
seeker.teleport(arena.seekersWarp);
seeker.getInventory().clear();
seeker.updateInventory();
W.seekertime.put(seeker, arena.waitingTimeSeeker);
} else {
i = i + 1;
}
}
}
if (loop) {
if (!arena.seekers.contains(seeker)) {
ArenaHandler.sendFMessage(arena, ConfigC.normal_ingameSeekerChoosen, "seeker-" + seeker.getName());
arena.seekers.add(seeker);
seeker.teleport(arena.seekersWarp);
seeker.getInventory().clear();
seeker.updateInventory();
W.seekertime.put(seeker, arena.waitingTimeSeeker);
} else {
i = i + 1;
}
}
}
for (Player arenaPlayer : arena.playersInArena) {
if (!arena.seekers.contains(arenaPlayer)) {
arenaPlayer.getInventory().clear();
arenaPlayer.updateInventory();
ItemStack block = arena.disguiseBlocks.get(W.random.nextInt(arena.disguiseBlocks.size()));
for (Player arenaPlayer : arena.playersInArena) {
if (!arena.seekers.contains(arenaPlayer)) {
arenaPlayer.getInventory().clear();
arenaPlayer.updateInventory();
ItemStack block = arena.disguiseBlocks.get(W.random.nextInt(arena.disguiseBlocks.size()));
if (W.choosenBlock.get(arenaPlayer) != null) {
block = W.choosenBlock.get(arenaPlayer);
W.choosenBlock.remove(arenaPlayer);
}
if (W.choosenBlock.get(arenaPlayer) != null) {
block = W.choosenBlock.get(arenaPlayer);
W.choosenBlock.remove(arenaPlayer);
}
MiscDisguise disguise = new MiscDisguise(DisguiseType.FALLING_BLOCK, block.getTypeId(), block.getDurability());
DisguiseAPI.disguiseToAll(arenaPlayer, disguise);
MiscDisguise disguise = new MiscDisguise(DisguiseType.FALLING_BLOCK, block.getTypeId(), block.getDurability());
DisguiseAPI.disguiseToAll(arenaPlayer, disguise);
arenaPlayer.teleport(arena.hidersWarp);
arenaPlayer.teleport(arena.hidersWarp);
ItemStack blockCount = new ItemStack(block.getType(), 5);
blockCount.setDurability(block.getDurability());
arenaPlayer.getInventory().setItem(8, blockCount);
arenaPlayer.getInventory().setHelmet(new ItemStack(block));
W.pBlock.put(arenaPlayer, block);
ItemStack blockCount = new ItemStack(block.getType(), 5);
blockCount.setDurability(block.getDurability());
arenaPlayer.getInventory().setItem(8, blockCount);
arenaPlayer.getInventory().setHelmet(new ItemStack(block));
W.pBlock.put(arenaPlayer, block);
if (block.getDurability() != 0) {
MessageM.sendFMessage(arenaPlayer, ConfigC.normal_ingameBlock,
"block-" + block.getType().name().replaceAll("_", "").replaceAll("BLOCK", "").toLowerCase() + ":" + block.getDurability());
} else {
MessageM.sendFMessage(arenaPlayer, ConfigC.normal_ingameBlock,
"block-" + block.getType().name().replaceAll("_", "").replaceAll("BLOCK", "").toLowerCase());
}
}
}
}
}
if (block.getDurability() != 0) {
MessageM.sendFMessage(arenaPlayer, ConfigC.normal_ingameBlock,
"block-" + block.getType().name().replaceAll("_", "").replaceAll("BLOCK", "").toLowerCase() + ":" + block.getDurability());
} else {
MessageM.sendFMessage(arenaPlayer, ConfigC.normal_ingameBlock,
"block-" + block.getType().name().replaceAll("_", "").replaceAll("BLOCK", "").toLowerCase());
}
}
}
}
}
for (Player player : arena.seekers) {
if (player.getInventory().getItem(0) == null || player.getInventory().getItem(0).getType() != Material.DIAMOND_SWORD) {
player.getInventory().setItem(0, new ItemStack(Material.DIAMOND_SWORD, 1));
player.getInventory().setHelmet(new ItemStack(Material.IRON_HELMET, 1));
player.getInventory().setChestplate(new ItemStack(Material.IRON_CHESTPLATE, 1));
player.getInventory().setLeggings(new ItemStack(Material.IRON_LEGGINGS, 1));
player.getInventory().setBoots(new ItemStack(Material.IRON_BOOTS, 1));
ItemStack infBow = new ItemStack(Material.BOW, 1);
infBow.addEnchantment(Enchantment.ARROW_INFINITE, 1);
player.getInventory().setItem(1, infBow);
player.getInventory().setItem(2, new ItemStack(Material.ARROW, 1));
player.playSound(player.getLocation(), Sound.BLOCK_ANVIL_USE, 1, 1);
}
for (Player player : arena.seekers) {
if (player.getInventory().getItem(0) == null || player.getInventory().getItem(0).getType() != Material.DIAMOND_SWORD) {
player.getInventory().setItem(0, new ItemStack(Material.DIAMOND_SWORD, 1));
player.getInventory().setHelmet(new ItemStack(Material.IRON_HELMET, 1));
player.getInventory().setChestplate(new ItemStack(Material.IRON_CHESTPLATE, 1));
player.getInventory().setLeggings(new ItemStack(Material.IRON_LEGGINGS, 1));
player.getInventory().setBoots(new ItemStack(Material.IRON_BOOTS, 1));
ItemStack infBow = new ItemStack(Material.BOW, 1);
infBow.addEnchantment(Enchantment.ARROW_INFINITE, 1);
player.getInventory().setItem(1, infBow);
player.getInventory().setItem(2, new ItemStack(Material.ARROW, 1));
player.playSound(player.getLocation(), Sound.BLOCK_ANVIL_USE, 1, 1);
}
if (W.seekertime.get(player) != null) {
W.seekertime.put(player, W.seekertime.get(player) - 1);
if (W.seekertime.get(player) <= 0) {
player.teleport(arena.hidersWarp);
W.seekertime.remove(player);
ArenaHandler.sendFMessage(arena, ConfigC.normal_ingameSeekerSpawned, "playername-" + player.getName());
}
}
}
if (W.seekertime.get(player) != null) {
W.seekertime.put(player, W.seekertime.get(player) - 1);
if (W.seekertime.get(player) <= 0) {
player.teleport(arena.hidersWarp);
W.seekertime.remove(player);
ArenaHandler.sendFMessage(arena, ConfigC.normal_ingameSeekerSpawned, "playername-" + player.getName());
}
}
}
if (arena.gameState == ArenaState.INGAME) {
arena.timer = arena.timer - 1;
if (arena.timer > 0) {
if (arena.timer == arena.gameTime - arena.timeUntilHidersSword) {
ItemStack sword = new ItemStack(Material.WOOD_SWORD, 1);
sword.addUnsafeEnchantment(Enchantment.KNOCKBACK, 1);
for (Player arenaPlayer : arena.playersInArena) {
if (!arena.seekers.contains(arenaPlayer)) {
arenaPlayer.getInventory().addItem(sword);
MessageM.sendFMessage(arenaPlayer, ConfigC.normal_ingameGivenSword);
}
}
}
if (arena.gameState == ArenaState.INGAME) {
arena.timer = arena.timer - 1;
if (arena.timer > 0) {
if (arena.timer == arena.gameTime - arena.timeUntilHidersSword) {
ItemStack sword = new ItemStack(Material.WOOD_SWORD, 1);
sword.addUnsafeEnchantment(Enchantment.KNOCKBACK, 1);
for (Player arenaPlayer : arena.playersInArena) {
if (!arena.seekers.contains(arenaPlayer)) {
arenaPlayer.getInventory().addItem(sword);
MessageM.sendFMessage(arenaPlayer, ConfigC.normal_ingameGivenSword);
}
}
}
// blockAnnouncer code.
if ((arena.blockAnnouncerTime > 0) && (arena.timer == arena.blockAnnouncerTime)) {
ArrayList<String> remainingBlocks = new ArrayList<String>();
for (Player arenaPlayer : arena.playersInArena) {
if (!arena.seekers.contains(arenaPlayer)) {
String block = arenaPlayer.getInventory().getItem(8).getType().name();
block = WordUtils.capitalizeFully(block.replace("_", " "));
if (!remainingBlocks.contains(block)) { //Don't print double up block names.
remainingBlocks.add(block);
}
}
}
String blocklist = StringUtils.join(remainingBlocks, ", ");
ArenaHandler.sendFMessage(arena, ConfigC.normal_ingameBlocksLeft, "1-" + blocklist);
}
// blockAnnouncer code.
if ((arena.blockAnnouncerTime > 0) && (arena.timer == arena.blockAnnouncerTime)) {
ArrayList<String> remainingBlocks = new ArrayList<String>();
for (Player arenaPlayer : arena.playersInArena) {
if (!arena.seekers.contains(arenaPlayer)) {
String block = arenaPlayer.getInventory().getItem(8).getType().name();
block = WordUtils.capitalizeFully(block.replace("_", " "));
if (!remainingBlocks.contains(block)) { //Don't print double up block names.
remainingBlocks.add(block);
}
}
}
String blocklist = StringUtils.join(remainingBlocks, ", ");
ArenaHandler.sendFMessage(arena, ConfigC.normal_ingameBlocksLeft, "1-" + blocklist);
}
if (arena.timer == 190) {
ArenaHandler.sendFMessage(arena, ConfigC.normal_ingameArenaEnd, "1-190");
} else if (arena.timer == 60) {
ArenaHandler.sendFMessage(arena, ConfigC.normal_ingameArenaEnd, "1-60");
} else if (arena.timer == 30) {
ArenaHandler.sendFMessage(arena, ConfigC.normal_ingameArenaEnd, "1-30");
} else if (arena.timer == 10) {
ArenaHandler.sendFMessage(arena, ConfigC.normal_ingameArenaEnd, "1-10");
} else if (arena.timer == 5) {
arena.lobbyWarp.getWorld().playSound(arena.lobbyWarp, Sound.ENTITY_EXPERIENCE_ORB_PICKUP, 1, 0);
ArenaHandler.sendFMessage(arena, ConfigC.normal_ingameArenaEnd, "1-5");
} else if (arena.timer == 4) {
arena.lobbyWarp.getWorld().playSound(arena.lobbyWarp, Sound.ENTITY_EXPERIENCE_ORB_PICKUP, 1, 0);
ArenaHandler.sendFMessage(arena, ConfigC.normal_ingameArenaEnd, "1-4");
} else if (arena.timer == 3) {
arena.lobbyWarp.getWorld().playSound(arena.lobbyWarp, Sound.ENTITY_EXPERIENCE_ORB_PICKUP, 1, 1);
ArenaHandler.sendFMessage(arena, ConfigC.normal_ingameArenaEnd, "1-3");
} else if (arena.timer == 2) {
arena.lobbyWarp.getWorld().playSound(arena.lobbyWarp, Sound.ENTITY_EXPERIENCE_ORB_PICKUP, 1, 1);
ArenaHandler.sendFMessage(arena, ConfigC.normal_ingameArenaEnd, "1-2");
} else if (arena.timer == 1) {
arena.lobbyWarp.getWorld().playSound(arena.lobbyWarp, Sound.ENTITY_EXPERIENCE_ORB_PICKUP, 1, 2);
ArenaHandler.sendFMessage(arena, ConfigC.normal_ingameArenaEnd, "1-1");
}
} else {
ArenaHandler.hidersWin(arena);
return;
}
if (arena.timer == 190) {
ArenaHandler.sendFMessage(arena, ConfigC.normal_ingameArenaEnd, "1-190");
} else if (arena.timer == 60) {
ArenaHandler.sendFMessage(arena, ConfigC.normal_ingameArenaEnd, "1-60");
} else if (arena.timer == 30) {
ArenaHandler.sendFMessage(arena, ConfigC.normal_ingameArenaEnd, "1-30");
} else if (arena.timer == 10) {
ArenaHandler.sendFMessage(arena, ConfigC.normal_ingameArenaEnd, "1-10");
} else if (arena.timer == 5) {
arena.lobbyWarp.getWorld().playSound(arena.lobbyWarp, Sound.ENTITY_EXPERIENCE_ORB_PICKUP, 1, 0);
ArenaHandler.sendFMessage(arena, ConfigC.normal_ingameArenaEnd, "1-5");
} else if (arena.timer == 4) {
arena.lobbyWarp.getWorld().playSound(arena.lobbyWarp, Sound.ENTITY_EXPERIENCE_ORB_PICKUP, 1, 0);
ArenaHandler.sendFMessage(arena, ConfigC.normal_ingameArenaEnd, "1-4");
} else if (arena.timer == 3) {
arena.lobbyWarp.getWorld().playSound(arena.lobbyWarp, Sound.ENTITY_EXPERIENCE_ORB_PICKUP, 1, 1);
ArenaHandler.sendFMessage(arena, ConfigC.normal_ingameArenaEnd, "1-3");
} else if (arena.timer == 2) {
arena.lobbyWarp.getWorld().playSound(arena.lobbyWarp, Sound.ENTITY_EXPERIENCE_ORB_PICKUP, 1, 1);
ArenaHandler.sendFMessage(arena, ConfigC.normal_ingameArenaEnd, "1-2");
} else if (arena.timer == 1) {
arena.lobbyWarp.getWorld().playSound(arena.lobbyWarp, Sound.ENTITY_EXPERIENCE_ORB_PICKUP, 1, 2);
ArenaHandler.sendFMessage(arena, ConfigC.normal_ingameArenaEnd, "1-1");
}
} else {
ArenaHandler.hidersWin(arena);
return;
}
for (Player player : arena.playersInArena) {
if (!arena.seekers.contains(player)) {
Location pLoc = player.getLocation();
Location moveLoc = W.moveLoc.get(player);
ItemStack block = player.getInventory().getItem(8);
for (Player player : arena.playersInArena) {
if (!arena.seekers.contains(player)) {
Location pLoc = player.getLocation();
Location moveLoc = W.moveLoc.get(player);
ItemStack block = player.getInventory().getItem(8);
if (block == null) {
if (W.pBlock.get(player) != null) {
block = W.pBlock.get(player);
player.getInventory().setItem(8, block);
player.updateInventory();
}
}
if (block == null) {
if (W.pBlock.get(player) != null) {
block = W.pBlock.get(player);
player.getInventory().setItem(8, block);
player.updateInventory();
}
}
if (moveLoc != null) {
if (moveLoc.getX() == pLoc.getX() && moveLoc.getY() == pLoc.getY() && moveLoc.getZ() == pLoc.getZ()) {
if (block.getAmount() > 1) {
block.setAmount(block.getAmount() - 1);
} else {
Block pBlock = player.getLocation().getBlock();
if (pBlock.getType().equals(Material.AIR) || pBlock.getType().equals(Material.WATER)
|| pBlock.getType().equals(Material.STATIONARY_WATER)) {
if (pBlock.getType().equals(Material.WATER) || pBlock.getType().equals(Material.STATIONARY_WATER)) {
W.hiddenLocWater.put(player, true);
} else {
W.hiddenLocWater.put(player, false);
}
if (DisguiseAPI.isDisguised(player)) {
DisguiseAPI.undisguiseToAll(player);
for (Player pl : Bukkit.getOnlinePlayers()) {
if (!pl.equals(player)) {
pl.hidePlayer(player);
pl.sendBlockChange(pBlock.getLocation(), block.getType(), (byte) block.getDurability());
}
}
if (moveLoc != null) {
if (moveLoc.getX() == pLoc.getX() && moveLoc.getY() == pLoc.getY() && moveLoc.getZ() == pLoc.getZ()) {
if (block.getAmount() > 1) {
block.setAmount(block.getAmount() - 1);
} else {
Block pBlock = player.getLocation().getBlock();
if (pBlock.getType().equals(Material.AIR) || pBlock.getType().equals(Material.WATER)
|| pBlock.getType().equals(Material.STATIONARY_WATER)) {
if (pBlock.getType().equals(Material.WATER) || pBlock.getType().equals(Material.STATIONARY_WATER)) {
W.hiddenLocWater.put(player, true);
} else {
W.hiddenLocWater.put(player, false);
}
if (DisguiseAPI.isDisguised(player)) {
DisguiseAPI.undisguiseToAll(player);
for (Player pl : Bukkit.getOnlinePlayers()) {
if (!pl.equals(player)) {
pl.hidePlayer(player);
pl.sendBlockChange(pBlock.getLocation(), block.getType(), (byte) block.getDurability());
}
}
block.addUnsafeEnchantment(Enchantment.DURABILITY, 10);
player.playSound(pLoc, Sound.ENTITY_EXPERIENCE_ORB_PICKUP, 1, 1);
W.hiddenLoc.put(player, moveLoc);
if (block.getDurability() != 0) {
MessageM.sendFMessage(
player,
ConfigC.normal_ingameNowSolid,
"block-" + block.getType().name().replaceAll("_", "").replaceAll("BLOCK", "").toLowerCase() + ":"
+ block.getDurability());
} else {
MessageM.sendFMessage(player, ConfigC.normal_ingameNowSolid, "block-"
+ block.getType().name().replaceAll("_", "").replaceAll("BLOCK", "").toLowerCase());
}
}
for (Player pl : Bukkit.getOnlinePlayers()) {
if (!pl.equals(player)) {
pl.hidePlayer(player);
pl.sendBlockChange(pBlock.getLocation(), block.getType(), (byte) block.getDurability());
}
}
} else {
MessageM.sendFMessage(player, ConfigC.warning_ingameNoSolidPlace);
}
}
} else {
block.setAmount(5);
if (!DisguiseAPI.isDisguised(player)) {
SolidBlockHandler.makePlayerUnsolid(player);
}
}
}
}
}
ScoreboardHandler.updateScoreboard(arena); // TODO Only do this when needed (player added/removed)
}
block.addUnsafeEnchantment(Enchantment.DURABILITY, 10);
player.playSound(pLoc, Sound.ENTITY_EXPERIENCE_ORB_PICKUP, 1, 1);
W.hiddenLoc.put(player, moveLoc);
if (block.getDurability() != 0) {
MessageM.sendFMessage(
player,
ConfigC.normal_ingameNowSolid,
"block-" + block.getType().name().replaceAll("_", "").replaceAll("BLOCK", "").toLowerCase() + ":"
+ block.getDurability());
} else {
MessageM.sendFMessage(player, ConfigC.normal_ingameNowSolid, "block-"
+ block.getType().name().replaceAll("_", "").replaceAll("BLOCK", "").toLowerCase());
}
}
for (Player pl : Bukkit.getOnlinePlayers()) {
if (!pl.equals(player)) {
pl.hidePlayer(player);
pl.sendBlockChange(pBlock.getLocation(), block.getType(), (byte) block.getDurability());
}
}
} else {
MessageM.sendFMessage(player, ConfigC.warning_ingameNoSolidPlace);
}
}
} else {
block.setAmount(5);
if (!DisguiseAPI.isDisguised(player)) {
SolidBlockHandler.makePlayerUnsolid(player);
}
}
}
}
}
ScoreboardHandler.updateScoreboard(arena); // TODO Only do this when needed (player added/removed)
}
for (Player pl : arena.playersInArena) {
pl.setLevel(arena.timer);
pl.setGameMode(GameMode.SURVIVAL);
}
}
SignsHandler.updateSigns(); //TODO Only do this when needed (gamestate change or player count change)
}
}, 0, 20);
for (Player pl : arena.playersInArena) {
pl.setLevel(arena.timer);
pl.setGameMode(GameMode.SURVIVAL);
}
}
SignsHandler.updateSigns(); //TODO Only do this when needed (gamestate change or player count change)
}, 0, 20);
}
public void onDisable() {
@ -509,11 +504,7 @@ public class BlockHunt extends JavaPlugin implements Listener {
boolean equals = true;
if (argsSplit == null) {
if (args.length == 0) {
equals = true;
} else {
equals = false;
}
equals = args.length == 0;
} else {
if (args.length >= argsSplit.length) {
for (int i2 = argsSplit.length - 1; i2 >= 0; i2 = i2 - 1) {

View File

@ -25,9 +25,9 @@ public class CMDcreate extends DefaultCMD {
} 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, 45, false, false, false, false, false, new ArrayList<ItemStack>(), null, 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());
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<>(), new ArrayList<>(), new ArrayList<>(), 10, 50, 8, new ArrayList<>(), ArenaState.WAITING,
0, new ArrayList<>(), Bukkit.getScoreboardManager().getNewScoreboard());
W.arenas.getFile().set(args[1], arena);
W.arenas.save();
W.signs.load();

View File

@ -1,5 +1,15 @@
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.BlockHunt;
import nl.Steffion.BlockHunt.W;
@ -11,17 +21,7 @@ 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) {

View File

@ -1,5 +1,15 @@
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.BlockHunt;
import nl.Steffion.BlockHunt.ConfigC;
import nl.Steffion.BlockHunt.Managers.MessageM;
@ -8,17 +18,7 @@ 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) {

View File

@ -1,5 +1,15 @@
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.Managers.MessageM;
@ -7,17 +17,7 @@ import org.bukkit.command.Command;
import org.bukkit.entity.Player;
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);

View File

@ -1,5 +1,15 @@
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.ArenaHandler;
import nl.Steffion.BlockHunt.ConfigC;
@ -11,17 +21,7 @@ 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) {

View File

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

View File

@ -1,5 +1,15 @@
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.BlockHunt;
import nl.Steffion.BlockHunt.ConfigC;
import nl.Steffion.BlockHunt.W;
@ -10,17 +20,7 @@ import org.bukkit.command.Command;
import org.bukkit.entity.Player;
public class CMDtokens 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) {

View File

@ -24,7 +24,7 @@ public class CMDwand extends DefaultCMD {
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>();
List<String> lores2 = new ArrayList<>();
for (String lore : lores) {
lores2.add(MessageM.replaceAll(lore));
}

View File

@ -1,22 +1,22 @@
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.Managers.MessageM;
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, "%TAG%NExample of a Command!");

View File

@ -1,19 +1,19 @@
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 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),
@ -117,7 +117,7 @@ public enum ConfigC {
* @param config
* The config file.
*/
private ConfigC(Object value, ConfigM config) {
ConfigC(Object value, ConfigM config) {
this.value = value;
this.config = config;
this.location = this.name().replaceAll("_", ".");

View File

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

View File

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

View File

@ -54,7 +54,7 @@ public class OnInventoryClickEvent implements Listener {
return;
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);
ItemStack item = event.getCurrentItem();
if (W.shop.getFile().get(player.getName() + ".tokens") == null) {
@ -114,7 +114,7 @@ public class OnInventoryClickEvent implements Listener {
if (arena.playersInArena.contains(player)) {
for (Player playerCheck : arena.playersInArena) {
if (W.choosenSeeker.get(playerCheck) != null) {
if (W.choosenSeeker.get(playerCheck) == true) {
if (W.choosenSeeker.get(playerCheck)) {
i = i + 1;
}
}
@ -145,7 +145,7 @@ public class OnInventoryClickEvent implements Listener {
if (arena.playersInArena.contains(player)) {
for (Player playerCheck : arena.playersInArena) {
if (W.choosenSeeker.get(playerCheck) != null) {
if (W.choosenSeeker.get(playerCheck) == false) {
if (!W.choosenSeeker.get(playerCheck)) {
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()) {
if (item != null) {
if (!item.getType().equals(Material.PAPER)) {

View File

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

View File

@ -1,5 +1,15 @@
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.util.List;
import nl.Steffion.BlockHunt.ConfigC;
@ -8,17 +18,7 @@ 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;

View File

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

View File

@ -1,17 +1,17 @@
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
*/
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.2";
public static String engineAuthors = "Steffion";

View File

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

View File

@ -110,7 +110,7 @@ public class MessageM {
* @param vars
* Variables. Seperated with a - . Ex: "playerName-" +
* player.getName();
* @return
* @return String with the message with values replaced
*/
public static String replaceAll(String message, String... vars) {
return MessageM.replaceColours(MessageM.replaceColourVars(MessageM.replaceVars(message, vars)));
@ -185,7 +185,7 @@ public class MessageM {
}
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,22 +1,22 @@
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
*/
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;
ALL, PLAYER, MODERATOR, ADMIN, OP
}
public enum Permissions {
@ -28,7 +28,7 @@ public class PermissionsC {
public String perm;
public PType type;
private Permissions(String perm, PType type) {
Permissions(String perm, PType type) {
this.perm = perm;
this.type = type;
}

View File

@ -12,7 +12,7 @@ import org.bukkit.scoreboard.Scoreboard;
public class ScoreboardHandler {
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;
if (board.getObjective(arena.arenaName) != null) {
updateScoreboard(arena);
@ -49,7 +49,7 @@ public class ScoreboardHandler {
}
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;
Objective object = board.getObjective(DisplaySlot.SIDEBAR);
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
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("x", getX());
map.put("y", getY());

View File

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

View File

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

View File

@ -1,5 +1,17 @@
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.HashMap;
import java.util.Random;
@ -13,23 +25,12 @@ import org.bukkit.entity.Player;
import org.bukkit.inventory.ItemStack;
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.
*/
public static ArrayList<String> newFiles = new ArrayList<String>();
public static ArrayList<CommandM> commands = new ArrayList<CommandM>();
public static ArrayList<String> newFiles = new ArrayList<>();
public static ArrayList<CommandM> commands = new ArrayList<>();
/*
* 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:
*/
public static HashMap<Player, LocationSerializable> pos1 = new HashMap<Player, LocationSerializable>();
public static HashMap<Player, LocationSerializable> pos2 = new HashMap<Player, LocationSerializable>();
public static HashMap<Player, LocationSerializable> pos1 = new HashMap<>();
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 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, ItemStack> choosenBlock = new HashMap<Player, ItemStack>();
public static HashMap<Player, Boolean> choosenSeeker = new HashMap<Player, Boolean>();
public static HashMap<Player, PlayerArenaData> pData = new HashMap<>();
public static HashMap<Player, ItemStack> choosenBlock = new HashMap<>();
public static HashMap<Player, Boolean> choosenSeeker = new HashMap<>();
public static HashMap<Player, ItemStack> pBlock = new HashMap<Player, ItemStack>();
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 HashMap<Player, ItemStack> pBlock = new HashMap<>();
public static HashMap<Player, Location> moveLoc = new HashMap<>();
public static HashMap<Player, Location> hiddenLoc = new HashMap<>();
public static HashMap<Player, Boolean> hiddenLocWater = new HashMap<>();
}

View File

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