Skip to content

Commit

Permalink
Fix invitation system; resolves #141
Browse files Browse the repository at this point in the history
  • Loading branch information
Sataniel98 committed Sep 28, 2016
1 parent 2c1ff4a commit b14ed1f
Show file tree
Hide file tree
Showing 5 changed files with 8 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,6 @@ public void onExecute(String[] args, CommandSender sender) {
return;
}

org.bukkit.Bukkit.broadcastMessage(resource.getConfig().getInvitedPlayers().toString());
if (!resource.isInvitedPlayer(player) && !DPermissions.hasPermission(player, DPermissions.EDIT)) {
MessageUtil.sendMessage(player, DMessages.ERROR_NO_PERMISSIONS.getMessage());
return;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -46,10 +46,11 @@ public InviteCommand() {
@Override
public void onExecute(String[] args, CommandSender sender) {
DResourceWorld resource = plugin.getDWorlds().getResourceByName(args[2]);
OfflinePlayer player = Bukkit.getOfflinePlayer(args[2]);
OfflinePlayer player = Bukkit.getOfflinePlayer(args[1]);

if (resource != null) {
if (player != null) {
resource.addInvitedPlayer(player);
MessageUtil.sendMessage(sender, DMessages.CMD_INVITE_SUCCESS.getMessage(args[1], args[2]));

} else {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,7 @@ public void onExecute(String[] args, CommandSender sender) {
DResourceWorld resource = plugin.getDWorlds().getResourceByName(args[2]);
if (resource == null) {
MessageUtil.sendMessage(sender, DMessages.ERROR_DUNGEON_NOT_EXIST.getMessage(args[2]));
return;
}

OfflinePlayer player = Bukkit.getOfflinePlayer(args[1]);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ public enum DMessages implements Messages {
CMD_MSG_UPDATED("Cmd_Msg_Updated", "&6Messages (&4&v1&6) updated!"),
CMD_RELOAD_DONE("Cmd_Reload_Done", "&7Successfully reloaded DungeonsXL."),
CMD_SAVE_SUCCESS("Cmd_Save_Success", "&6Map saved!"),
CMD_UNINVITE_SUCCESS("Cmd_Uninvite_Success", "&4&v1&6 was successfully uninvited to edit the map &4&v1&6!"),
CMD_UNINVITE_SUCCESS("Cmd_Uninvite_Success", "&4&v1&6's permission to edit the map &4&v2&6 has been removed successfully."),
ERROR_BED("Error_Bed", "&4You cannot use a bed while in a dungeon!"),
ERROR_CHEST_IS_OPENED("Error_ChestIsOpened", "&4This chest has already been opened."),
ERROR_CMD("Error_Cmd", "&4Commands are not allowed while in a dungeon!"),
Expand All @@ -78,7 +78,7 @@ public enum DMessages implements Messages {
ERROR_NO_CONSOLE_COMMAND("Error_NoConsoleCommand", "&6/dxl &v1&4 cannot be executed as console!"),
ERROR_NO_GAME("Error_NoGame", "&4You currently do not take part in a game."),
ERROR_NO_LEAVE_IN_TUTORIAL("Error_NoLeaveInTutorial", "&4You cannot use this command in the tutorial!"),
ERROR_NO_PERMISSIONS("Error_NoPermissions", "&4You have no permission to do this!"),
ERROR_NO_PERMISSIONS("Error_NoPermissions", "&4You do not have permission to do this!"),
ERROR_NO_PLAYER_COMMAND("Error_NoPlayerCommand", "&6/dxl &v1&4 cannot be executed as player!"),
ERROR_NO_PROTECTED_BLOCK("Error_NoDXLBlock", "&4This is not a block protected by DungeonsXL!"),
ERROR_NO_REWARDS_LEFT("Error_NoRewardsLeft", "&4You do not have any item rewards left."),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -311,7 +311,9 @@ public CopyOnWriteArrayList<String> getInvitedPlayers() {
* the player's unique ID
*/
public void addInvitedPlayer(String uuid) {
invitedPlayers.add(uuid);
if (!invitedPlayers.contains(uuid)) {
invitedPlayers.add(uuid);
}
}

/**
Expand Down

0 comments on commit b14ed1f

Please sign in to comment.