mirror of
https://github.com/GeorgH93/Minepacks.git
synced 2024-12-04 14:03:24 +01:00
Add shortcut command
This commit is contained in:
parent
0067202e8d
commit
1ce63cb8c3
@ -59,6 +59,8 @@ Language:
|
||||
Cleared: "Inventar gelöscht."
|
||||
ClearedOther: "Das Inventar von {DisplayName}&r wurde gelöscht."
|
||||
ClearedOtherTarget: "Dein Inventar wurde von {DisplayName}&r gelöscht."
|
||||
Shortcut:
|
||||
Given: "Du hast das Rucksack Item erhalten."
|
||||
Commands:
|
||||
HelpFormat: "[\"\",{\"text\":\"/{MainCommand} {SubCommand} {Parameters}\",\"clickEvent\":{\"action\":\"suggest_command\",\"value\":\"/{MainCommand} {SubCommand}\"}},{\"text\":\" - \",\"color\":\"white\"},{\"text\":\"{Description}\",\"color\":\"aqua\"}]"
|
||||
PlayerNameVariable: "player_name"
|
||||
@ -76,6 +78,7 @@ Language:
|
||||
Version: "Gibt die Versionsdetails über das Plugin und seine Abhängigkeiten aus."
|
||||
Help: "Zeigt die verfügbaren Befehle an."
|
||||
Migrate: "Erlaubt das Konvertieren der Datenbank in ein anderes Format."
|
||||
Shortcut: "Fügt den Rucksack in dein Inventar hinzu."
|
||||
|
||||
Command:
|
||||
Backpack:
|
||||
@ -110,6 +113,8 @@ Command:
|
||||
Help:
|
||||
- help
|
||||
- hilfe
|
||||
Shortcut:
|
||||
- shortcut
|
||||
InventoryClear:
|
||||
- clear
|
||||
- inventoryclear
|
||||
|
@ -60,6 +60,8 @@ Language:
|
||||
Cleared: "Inventory cleared."
|
||||
ClearedOther: "{DisplayName}'s&r inventory has been cleared."
|
||||
ClearedOtherTarget: "Your inventory has been cleared by {DisplayName}&r."
|
||||
Shortcut:
|
||||
Given: "The backpack shortcut item has been added to your inventory."
|
||||
Commands:
|
||||
HelpFormat: "[\"\",{\"text\":\"/{MainCommand} {SubCommand} {Parameters}\",\"clickEvent\":{\"action\":\"suggest_command\",\"value\":\"/{MainCommand} {SubCommand}\"}},{\"text\":\" - \",\"color\":\"white\"},{\"text\":\"{Description}\",\"color\":\"aqua\"}]"
|
||||
PlayerNameVariable: "player_name"
|
||||
@ -77,6 +79,7 @@ Language:
|
||||
RestoreList: "Lists all available backups."
|
||||
Help: "Shows all available commands and their description."
|
||||
Migrate: "Migrates the used database from one type to another."
|
||||
Shortcut: "Adds the backpack shortcut item to your inventory."
|
||||
|
||||
Command:
|
||||
Backpack:
|
||||
@ -105,6 +108,8 @@ Command:
|
||||
- version
|
||||
Help:
|
||||
- help
|
||||
Shortcut:
|
||||
- shortcut
|
||||
InventoryClear:
|
||||
- clear
|
||||
- inventoryclear
|
||||
@ -115,4 +120,4 @@ LanguageName: "english"
|
||||
Author: "GeorgH93"
|
||||
|
||||
# Language file version. Don't touch it!
|
||||
Version: 18
|
||||
Version: 19
|
@ -0,0 +1,56 @@
|
||||
/*
|
||||
* Copyright (C) 2020 GeorgH93
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
package at.pcgamingfreaks.Minepacks.Bukkit.Command;
|
||||
|
||||
import at.pcgamingfreaks.Bukkit.Message.Message;
|
||||
import at.pcgamingfreaks.Minepacks.Bukkit.API.MinepacksCommand;
|
||||
import at.pcgamingfreaks.Minepacks.Bukkit.Listener.ItemShortcut;
|
||||
import at.pcgamingfreaks.Minepacks.Bukkit.Minepacks;
|
||||
import at.pcgamingfreaks.Minepacks.Bukkit.Permissions;
|
||||
|
||||
import org.bukkit.command.CommandSender;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
public class ShortcutCommand extends MinepacksCommand
|
||||
{
|
||||
private final Message messageItemGiven;
|
||||
private final ItemShortcut itemShortcut;
|
||||
|
||||
public ShortcutCommand(Minepacks plugin, final @NotNull ItemShortcut itemShortcut)
|
||||
{
|
||||
super(plugin, "shortcut", plugin.getLanguage().getTranslated("Commands.Description.Shortcut"), Permissions.USE, true, plugin.getLanguage().getCommandAliases("Shortcut"));
|
||||
this.itemShortcut = itemShortcut;
|
||||
messageItemGiven = plugin.getLanguage().getMessage("Ingame.Shortcut.Given");
|
||||
}
|
||||
|
||||
@Override
|
||||
public void execute(@NotNull CommandSender sender, @NotNull String mainCommandAlias, @NotNull String alias, @NotNull String[] args)
|
||||
{
|
||||
itemShortcut.addItem((Player) sender);
|
||||
messageItemGiven.send(sender);
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<String> tabComplete(@NotNull CommandSender sender, @NotNull String mainCommandAlias, @NotNull String alias, @NotNull String[] args)
|
||||
{
|
||||
return null;
|
||||
}
|
||||
}
|
@ -28,7 +28,7 @@
|
||||
|
||||
public class Language extends at.pcgamingfreaks.Bukkit.Language
|
||||
{
|
||||
private static final int LANG_VERSION = 18, UPGRADE_THRESHOLD = LANG_VERSION;
|
||||
private static final int LANG_VERSION = 19, UPGRADE_THRESHOLD = LANG_VERSION;
|
||||
|
||||
public Language(JavaPlugin plugin)
|
||||
{
|
||||
|
@ -39,6 +39,7 @@
|
||||
import org.bukkit.event.player.*;
|
||||
import org.bukkit.inventory.EquipmentSlot;
|
||||
import org.bukkit.inventory.ItemStack;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
import org.jetbrains.annotations.Nullable;
|
||||
|
||||
import java.util.HashSet;
|
||||
@ -93,7 +94,7 @@ private boolean isItemShortcut(@Nullable ItemStack stack)
|
||||
return stack != null && stack.getType() == itemConfig.getMaterial() && stack.hasItemMeta() && itemConfig.getDisplayName().equals(stack.getItemMeta().getDisplayName());
|
||||
}
|
||||
|
||||
private void addItem(Player player)
|
||||
public void addItem(final @NotNull Player player)
|
||||
{
|
||||
if(player.hasPermission(Permissions.USE))
|
||||
{
|
||||
|
@ -28,6 +28,7 @@
|
||||
import at.pcgamingfreaks.Minepacks.Bukkit.API.MinepacksPlugin;
|
||||
import at.pcgamingfreaks.Minepacks.Bukkit.Command.CommandManager;
|
||||
import at.pcgamingfreaks.Minepacks.Bukkit.Command.InventoryClearCommand;
|
||||
import at.pcgamingfreaks.Minepacks.Bukkit.Command.ShortcutCommand;
|
||||
import at.pcgamingfreaks.Minepacks.Bukkit.Database.Config;
|
||||
import at.pcgamingfreaks.Minepacks.Bukkit.Database.Database;
|
||||
import at.pcgamingfreaks.Minepacks.Bukkit.Database.Helper.WorldBlacklistMode;
|
||||
@ -203,7 +204,9 @@ private void load()
|
||||
{
|
||||
try
|
||||
{
|
||||
pluginManager.registerEvents(new ItemShortcut(this), this);
|
||||
ItemShortcut itemShortcut = new ItemShortcut(this);
|
||||
pluginManager.registerEvents(itemShortcut, this);
|
||||
commandManager.registerSubCommand(new ShortcutCommand(this, itemShortcut));
|
||||
}
|
||||
catch(IllegalArgumentException ignored) {}
|
||||
catch(Exception e)
|
||||
|
Loading…
Reference in New Issue
Block a user