diff --git a/Minepacks/resources/lang/de.yml b/Minepacks/resources/lang/de.yml index bac9645..939e913 100644 --- a/Minepacks/resources/lang/de.yml +++ b/Minepacks/resources/lang/de.yml @@ -17,6 +17,8 @@ Language: DontRemoveShortcut_SendMethod: "action_bar" Clean: BackpackCleaned: "Rucksack geleert." + BackpackCleanedBy: "Dein Rucksack wurde von {DisplayName}&r geleert" + BackpackCleanedOther: "Der Rucksack von {DisplayName}&r wurde geleert." Open: #Parameter: {TimeLeft} time in seconds till he can reopen his backpack Cooldown: "&2Bitte warte noch {TimeLeft} Sekunden bis du deinen Rucksack wieder öffnest." diff --git a/Minepacks/resources/lang/en.yml b/Minepacks/resources/lang/en.yml index 48e7922..065ecfb 100644 --- a/Minepacks/resources/lang/en.yml +++ b/Minepacks/resources/lang/en.yml @@ -22,7 +22,9 @@ Language: #Parameter: {CurrentGameMode}, {AllowedGameModes} WrongGameMode: "You are not allowed to open your backpack in your current game-mode." Clean: - BackpackCleaned: "Backpack cleaned." + BackpackCleaned: "Backpack cleared." + BackpackCleanedBy: "Your backpack has been cleared by {DisplayName}&r." + BackpackCleanedOther: "{DisplayName}'s&r backpack has been cleared." Help: Header: "&6### Minepacks Commands ###" Footer: "&6#############################" diff --git a/Minepacks/src/at/pcgamingfreaks/Minepacks/Bukkit/Command/ClearCommand.java b/Minepacks/src/at/pcgamingfreaks/Minepacks/Bukkit/Command/ClearCommand.java index 22a2b42..98e4278 100644 --- a/Minepacks/src/at/pcgamingfreaks/Minepacks/Bukkit/Command/ClearCommand.java +++ b/Minepacks/src/at/pcgamingfreaks/Minepacks/Bukkit/Command/ClearCommand.java @@ -27,6 +27,7 @@ import at.pcgamingfreaks.Minepacks.Bukkit.Permissions; import org.bukkit.Bukkit; +import org.bukkit.ChatColor; import org.bukkit.OfflinePlayer; import org.bukkit.command.CommandSender; import org.bukkit.entity.Player; @@ -36,15 +37,17 @@ public class ClearCommand extends MinepacksCommand { - private final Message messageBackpackCleaned; + private final Message messageCleared, messageClearedOther, messageClearedBy; private final String helpParam, descriptionCleanOthers; public ClearCommand(Minepacks plugin) { super(plugin, "clear", plugin.getLanguage().getTranslated("Commands.Description.Clean"), Permissions.CLEAN, plugin.getLanguage().getCommandAliases("Clean")); - messageBackpackCleaned = plugin.getLanguage().getMessage("Ingame.Clean.BackpackCleaned"); descriptionCleanOthers = plugin.getLanguage().getTranslated("Commands.Description.CleanOthers"); helpParam = "<" + plugin.getLanguage().get("Commands.PlayerNameVariable") + ">"; + messageCleared = plugin.getLanguage().getMessage("Ingame.Clean.BackpackCleaned"); + messageClearedBy = plugin.getLanguage().getMessage("Ingame.Clean.BackpackCleanedBy").replaceAll("\\{Name}", "%1\\$s").replaceAll("\\{DisplayName}", "%2\\$s"); + messageClearedOther = plugin.getLanguage().getMessage("Ingame.Clean.BackpackCleanedOther").replaceAll("\\{Name}", "%1\\$s").replaceAll("\\{DisplayName}", "%2\\$s"); } @Override @@ -67,7 +70,23 @@ public void onResult(Backpack backpack) if(backpack != null) { backpack.clear(); - messageBackpackCleaned.send(commandSender); + if(commandSender.equals(backpack.getOwner())) + { + messageCleared.send(commandSender); + } + else + { + if(backpack.getOwner().isOnline()) + { + Player owner = backpack.getOwner().getPlayer(); + messageClearedOther.send(commandSender, backpack.getOwner().getName(), owner.getDisplayName()); + messageClearedBy.send(owner, commandSender.getName(), (commandSender instanceof Player) ? ((Player) commandSender).getDisplayName() : ChatColor.GRAY + commandSender.getName()); + } + else + { + messageClearedOther.send(commandSender, backpack.getOwner().getName(), ChatColor.GRAY + backpack.getOwner().getName()); + } + } } else {