mirror of
https://github.com/GeorgH93/Minepacks.git
synced 2024-11-28 13:05:14 +01:00
Add different message if the backpack was cleared by another player
This commit is contained in:
parent
1a5adf8270
commit
160efba42e
@ -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."
|
||||
|
@ -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#############################"
|
||||
|
@ -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
|
||||
{
|
||||
|
Loading…
Reference in New Issue
Block a user