mirror of
https://github.com/DRE2N/DungeonsXL.git
synced 2024-11-24 19:45:43 +01:00
Fix invitation system; resolves #141
This commit is contained in:
parent
2c1ff4af65
commit
b14ed1fd97
@ -63,7 +63,6 @@ public class EditCommand extends BRCommand {
|
||||
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;
|
||||
|
@ -46,10 +46,11 @@ public class InviteCommand extends BRCommand {
|
||||
@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 {
|
||||
|
@ -48,6 +48,7 @@ public class UninviteCommand extends BRCommand {
|
||||
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]);
|
||||
|
@ -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!"),
|
||||
@ -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."),
|
||||
|
@ -311,8 +311,10 @@ public class WorldConfig extends GameRules {
|
||||
* the player's unique ID
|
||||
*/
|
||||
public void addInvitedPlayer(String uuid) {
|
||||
if (!invitedPlayers.contains(uuid)) {
|
||||
invitedPlayers.add(uuid);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @param uuid
|
||||
|
Loading…
Reference in New Issue
Block a user