Skip to content

Commit

Permalink
added more debug outputs when duels are ended. Should make finding of…
Browse files Browse the repository at this point in the history
… when duels are not resetting more easier.
  • Loading branch information
teozfrank committed Nov 10, 2014
1 parent 9ee2e01 commit 7badeec
Show file tree
Hide file tree
Showing 3 changed files with 25 additions and 12 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -383,7 +383,6 @@ public void acceptRequest(Player accepter, String senderIn) {
} else {
Util.sendMsg(accepter, ChatColor.RED +
"You do not have any duel requests from " + ChatColor.AQUA + senderIn + ".");
return;
}

}
Expand Down Expand Up @@ -638,6 +637,9 @@ public void restorePlayerData(Player player) {
* @param player the player
*/
public void endDuel(Player player) {
if(plugin.isDebugEnabled()) {
SendConsoleMessage.debug("End duel.");
}
ItemManager im = plugin.getItemManager();
String playerName = player.getName();
UUID playerUUID = player.getUniqueId();
Expand Down Expand Up @@ -667,6 +669,9 @@ public void endDuel(Player player) {
* @param arena the arena to be ended
*/
public void endDuel(DuelArena arena) {
if(plugin.isDebugEnabled()) {
SendConsoleMessage.debug("End duel by duel arena.");
}
ItemManager im = plugin.getItemManager();
DuelManager dm = plugin.getDuelManager();
FileManager fm = plugin.getFileManager();
Expand Down Expand Up @@ -695,10 +700,7 @@ public void endDuel(DuelArena arena) {
arena.getPlayers().remove(playerUUID);//remove the player
}

arena.setHasBet(false);
arena.setBetAmount(0);
arena.getPlayers().clear();
arena.setDuelState(DuelState.WAITING);
this.resetArena(arena);
}

/**
Expand All @@ -714,4 +716,18 @@ public boolean hasEnoughMoney(String player, double amount) {
}
return false;
}

/**
* reset a duel arena to initial state
* @param arena the duel arena
*/
public void resetArena(DuelArena arena) {
if(plugin.isDebugEnabled()) {
SendConsoleMessage.debug("resetting arena.");
}
arena.setHasBet(false);
arena.setBetAmount(0);
arena.getPlayers().clear();
arena.setDuelState(DuelState.WAITING);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -95,10 +95,7 @@ public void rewardPlayer(DuelArena arena) {
}
}

arena.setHasBet(false);
arena.setBetAmount(0);
arena.getPlayers().clear();
arena.setDuelState(DuelState.WAITING);
dm.resetArena(arena);
}

}
Expand Down
6 changes: 3 additions & 3 deletions src/main/resources/plugin.yml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
name: DuelMe
version: 0.9.9 Beta
version: 0.9.9.1 Beta
author: teozfrank
description: allows players to duel each other in a controlled environment
main: com.teozcommunity.teozfrank.duelme.main.DuelMe
Expand All @@ -17,12 +17,12 @@ commands:
useage: /<command>
permissions:
duelme.*:
description: Gives access to all toolkit permissions
description: Gives access to all duelme permissions
children:
duelme.player.*: true
duelme.admin.*: true
duelme.admin.*:
description: Gives access to all toolkit staff commands
description: Gives access to all duelme admin commands
children:
duelme.admin.info: true
duelme.admin.create: true
Expand Down

0 comments on commit 7badeec

Please sign in to comment.