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"
|
DontRemoveShortcut_SendMethod: "action_bar"
|
||||||
Clean:
|
Clean:
|
||||||
BackpackCleaned: "Rucksack geleert."
|
BackpackCleaned: "Rucksack geleert."
|
||||||
|
BackpackCleanedBy: "Dein Rucksack wurde von {DisplayName}&r geleert"
|
||||||
|
BackpackCleanedOther: "Der Rucksack von {DisplayName}&r wurde geleert."
|
||||||
Open:
|
Open:
|
||||||
#Parameter: {TimeLeft} time in seconds till he can reopen his backpack
|
#Parameter: {TimeLeft} time in seconds till he can reopen his backpack
|
||||||
Cooldown: "&2Bitte warte noch {TimeLeft} Sekunden bis du deinen Rucksack wieder öffnest."
|
Cooldown: "&2Bitte warte noch {TimeLeft} Sekunden bis du deinen Rucksack wieder öffnest."
|
||||||
|
@ -22,7 +22,9 @@ Language:
|
|||||||
#Parameter: {CurrentGameMode}, {AllowedGameModes}
|
#Parameter: {CurrentGameMode}, {AllowedGameModes}
|
||||||
WrongGameMode: "You are not allowed to open your backpack in your current game-mode."
|
WrongGameMode: "You are not allowed to open your backpack in your current game-mode."
|
||||||
Clean:
|
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:
|
Help:
|
||||||
Header: "&6### Minepacks Commands ###"
|
Header: "&6### Minepacks Commands ###"
|
||||||
Footer: "&6#############################"
|
Footer: "&6#############################"
|
||||||
|
@ -27,6 +27,7 @@
|
|||||||
import at.pcgamingfreaks.Minepacks.Bukkit.Permissions;
|
import at.pcgamingfreaks.Minepacks.Bukkit.Permissions;
|
||||||
|
|
||||||
import org.bukkit.Bukkit;
|
import org.bukkit.Bukkit;
|
||||||
|
import org.bukkit.ChatColor;
|
||||||
import org.bukkit.OfflinePlayer;
|
import org.bukkit.OfflinePlayer;
|
||||||
import org.bukkit.command.CommandSender;
|
import org.bukkit.command.CommandSender;
|
||||||
import org.bukkit.entity.Player;
|
import org.bukkit.entity.Player;
|
||||||
@ -36,15 +37,17 @@
|
|||||||
|
|
||||||
public class ClearCommand extends MinepacksCommand
|
public class ClearCommand extends MinepacksCommand
|
||||||
{
|
{
|
||||||
private final Message messageBackpackCleaned;
|
private final Message messageCleared, messageClearedOther, messageClearedBy;
|
||||||
private final String helpParam, descriptionCleanOthers;
|
private final String helpParam, descriptionCleanOthers;
|
||||||
|
|
||||||
public ClearCommand(Minepacks plugin)
|
public ClearCommand(Minepacks plugin)
|
||||||
{
|
{
|
||||||
super(plugin, "clear", plugin.getLanguage().getTranslated("Commands.Description.Clean"), Permissions.CLEAN, plugin.getLanguage().getCommandAliases("Clean"));
|
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");
|
descriptionCleanOthers = plugin.getLanguage().getTranslated("Commands.Description.CleanOthers");
|
||||||
helpParam = "<" + plugin.getLanguage().get("Commands.PlayerNameVariable") + ">";
|
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
|
@Override
|
||||||
@ -67,7 +70,23 @@ public void onResult(Backpack backpack)
|
|||||||
if(backpack != null)
|
if(backpack != null)
|
||||||
{
|
{
|
||||||
backpack.clear();
|
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
|
else
|
||||||
{
|
{
|
||||||
|
Loading…
Reference in New Issue
Block a user