Skip to content

Commit

Permalink
Blocs don't end bug
Browse files Browse the repository at this point in the history
  • Loading branch information
ChagnonSebastien committed May 27, 2016
1 parent e74fe6d commit 2bc5c48
Show file tree
Hide file tree
Showing 8 changed files with 56 additions and 48 deletions.
2 changes: 1 addition & 1 deletion Bukkit_1.8/plugin.yml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
name: CubeRunner
main : me.poutineqc.cuberunner.CubeRunner
version: 2.2
version: 2.2.1
description: Blocks are falling over your head! Can you outrun them?
load: postworld
author: PoutineQc
Expand Down
27 changes: 13 additions & 14 deletions Bukkit_1.8/src/me/poutineqc/cuberunner/CubeRunner.java
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ public class CubeRunner extends JavaPlugin {
private static Economy economy;

public void onEnable() {
PluginDescriptionFile pdfFile = getDescription();
final PluginDescriptionFile pdfFile = getDescription();
final Logger logger = getLogger();

config = new Configuration(this);
Expand All @@ -64,18 +64,6 @@ public void onEnable() {
enableListeners();
getCommand("cuberunner").setExecutor(playerCommands);

if (!playerData.isLatestVersion()) {
logger.info("----------------------------");
logger.info("CubeRunner Updater");
logger.info("");
logger.info("An update for CubeRunner has been found!");
logger.info("CubeRunner " + playerData.getLatestVersion());
logger.info("You are running " + pdfFile.getVersion());
logger.info("");
logger.info("Download at https://www.spigotmc.org/resources/cuberunner.19715/");
logger.info("----------------------------");
}

try {
Metrics metrics;
metrics = new Metrics(this);
Expand All @@ -86,6 +74,17 @@ public void onEnable() {

Bukkit.getServer().getScheduler().scheduleSyncDelayedTask(this, new Runnable() {
public void run() {
if (!playerData.isLatestVersion()) {
logger.info("----------------------------");
logger.info("CubeRunner Updater");
logger.info("");
logger.info("An update for CubeRunner has been found!");
logger.info("CubeRunner " + playerData.getLatestVersion());
logger.info("You are running " + pdfFile.getVersion());
logger.info("");
logger.info("Download at https://www.spigotmc.org/resources/cuberunner.19715/");
logger.info("----------------------------");
}
Arena.loadExistingArenas();
}
}, 1L);
Expand Down Expand Up @@ -166,7 +165,7 @@ public boolean initialiseEconomy() {
if (!setupEconomy()) {
getLogger().warning("Vault not found.");
getLogger().warning("Add Vault to your plugins or disable monetary rewards in the config.");
getLogger().info("Disabling DeACoudre...");
getLogger().info("Disabling CubeRunner...");
getServer().getPluginManager().disablePlugin(this);
return false;
}
Expand Down
17 changes: 11 additions & 6 deletions Bukkit_1.8/src/me/poutineqc/cuberunner/games/Arena.java
Original file line number Diff line number Diff line change
Expand Up @@ -779,8 +779,8 @@ public void run() {

ItemStackManager fallingBlock = arena.colorManager.getRandomAvailableBlock();

FallingSand clay = (FallingSand) player.getWorld().spawnFallingBlock(l,
fallingBlock.getMaterial(), (byte) fallingBlock.getData());
FallingSand clay = (FallingSand) player.getWorld().spawnFallingBlock(l, fallingBlock.getMaterial(),
(byte) fallingBlock.getData());

clay.setDropItem(false);
clay.setHurtEntities(true);
Expand Down Expand Up @@ -954,11 +954,11 @@ private void endingSequence() {

Bukkit.getServer().getScheduler().scheduleSyncDelayedTask(plugin, new Runnable() {
public void run() {
kickUsers();
kickUsers(false);
}
}, 100L);
} else
kickUsers();
kickUsers(true);

}

Expand All @@ -979,14 +979,19 @@ private static int getAmountInGame(Arena arena) {
return i;
}

private void kickUsers() {
private void kickUsers(boolean wait) {
for (User user : users) {
user.quit();
user.returnStats();
}

users.clear();
gameState = GameState.READY;

Bukkit.getServer().getScheduler().scheduleSyncDelayedTask(plugin, new Runnable() {
public void run() {
gameState = GameState.READY;
}
}, wait ? 5L : 0L);
}

public void removeUser(Player player) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,9 @@ public void onPlayerDamageByEntity(EntityDamageByEntityEvent event) {
return;
}

event.setDamage(0);
arena.eliminateUser(arena.getUser(player), false);

String dammagerUUID = event.getDamager().getCustomName();
if (!dammagerUUID.equalsIgnoreCase(player.getUniqueId().toString())) {
int kills = 0;
Expand All @@ -82,9 +85,6 @@ public void onPlayerDamageByEntity(EntityDamageByEntityEvent event) {

achievements.checkAchievement(AchievementType.AMOUNT_KILLS, arena.getPlayerFromUUID(dammagerUUID));
}

event.setDamage(0);
arena.eliminateUser(arena.getUser(player), false);
}

@EventHandler
Expand Down
2 changes: 1 addition & 1 deletion Bukkit_1.9/plugin.yml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
name: CubeRunner
main : me.poutineqc.cuberunner.CubeRunner
version: 2.2
version: 2.2.1
description: Blocks are falling over your head! Can you outrun them?
load: postworld
author: PoutineQc
Expand Down
27 changes: 13 additions & 14 deletions Bukkit_1.9/src/me/poutineqc/cuberunner/CubeRunner.java
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ public class CubeRunner extends JavaPlugin {
private static Economy economy;

public void onEnable() {
PluginDescriptionFile pdfFile = getDescription();
final PluginDescriptionFile pdfFile = getDescription();
final Logger logger = getLogger();

config = new Configuration(this);
Expand All @@ -64,18 +64,6 @@ public void onEnable() {
enableListeners();
getCommand("cuberunner").setExecutor(playerCommands);

if (!playerData.isLatestVersion()) {
logger.info("----------------------------");
logger.info("CubeRunner Updater");
logger.info("");
logger.info("An update for CubeRunner has been found!");
logger.info("CubeRunner " + playerData.getLatestVersion());
logger.info("You are running " + pdfFile.getVersion());
logger.info("");
logger.info("Download at https://www.spigotmc.org/resources/cuberunner.19715/");
logger.info("----------------------------");
}

try {
Metrics metrics;
metrics = new Metrics(this);
Expand All @@ -86,6 +74,17 @@ public void onEnable() {

Bukkit.getServer().getScheduler().scheduleSyncDelayedTask(this, new Runnable() {
public void run() {
if (!playerData.isLatestVersion()) {
logger.info("----------------------------");
logger.info("CubeRunner Updater");
logger.info("");
logger.info("An update for CubeRunner has been found!");
logger.info("CubeRunner " + playerData.getLatestVersion());
logger.info("You are running " + pdfFile.getVersion());
logger.info("");
logger.info("Download at https://www.spigotmc.org/resources/cuberunner.19715/");
logger.info("----------------------------");
}
Arena.loadExistingArenas();
}
}, 1L);
Expand Down Expand Up @@ -166,7 +165,7 @@ public boolean initialiseEconomy() {
if (!setupEconomy()) {
getLogger().warning("Vault not found.");
getLogger().warning("Add Vault to your plugins or disable monetary rewards in the config.");
getLogger().info("Disabling DeACoudre...");
getLogger().info("Disabling CubeRunner...");
getServer().getPluginManager().disablePlugin(this);
return false;
}
Expand Down
17 changes: 11 additions & 6 deletions Bukkit_1.9/src/me/poutineqc/cuberunner/games/Arena.java
Original file line number Diff line number Diff line change
Expand Up @@ -779,8 +779,8 @@ public void run() {

ItemStackManager fallingBlock = arena.colorManager.getRandomAvailableBlock();

FallingSand clay = (FallingSand) player.getWorld().spawnFallingBlock(l,
fallingBlock.getMaterial(), (byte) fallingBlock.getData());
FallingSand clay = (FallingSand) player.getWorld().spawnFallingBlock(l, fallingBlock.getMaterial(),
(byte) fallingBlock.getData());

clay.setDropItem(false);
clay.setHurtEntities(true);
Expand Down Expand Up @@ -954,11 +954,11 @@ private void endingSequence() {

Bukkit.getServer().getScheduler().scheduleSyncDelayedTask(plugin, new Runnable() {
public void run() {
kickUsers();
kickUsers(false);
}
}, 100L);
} else
kickUsers();
kickUsers(true);

}

Expand All @@ -979,14 +979,19 @@ private static int getAmountInGame(Arena arena) {
return i;
}

private void kickUsers() {
private void kickUsers(boolean wait) {
for (User user : users) {
user.quit();
user.returnStats();
}

users.clear();
gameState = GameState.READY;

Bukkit.getServer().getScheduler().scheduleSyncDelayedTask(plugin, new Runnable() {
public void run() {
gameState = GameState.READY;
}
}, wait ? 5L : 0L);
}

public void removeUser(Player player) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,9 @@ public void onPlayerDamageByEntity(EntityDamageByEntityEvent event) {
return;
}

event.setDamage(0);
arena.eliminateUser(arena.getUser(player), false);

String dammagerUUID = event.getDamager().getCustomName();
if (!dammagerUUID.equalsIgnoreCase(player.getUniqueId().toString())) {
int kills = 0;
Expand All @@ -82,9 +85,6 @@ public void onPlayerDamageByEntity(EntityDamageByEntityEvent event) {

achievements.checkAchievement(AchievementType.AMOUNT_KILLS, arena.getPlayerFromUUID(dammagerUUID));
}

event.setDamage(0);
arena.eliminateUser(arena.getUser(player), false);
}

@EventHandler
Expand Down

0 comments on commit 2bc5c48

Please sign in to comment.