3
0
Mirror von https://github.com/St3venAU/ArmorStandTools.git synchronisiert 2024-12-28 04:20:08 +01:00

Merge pull request #2 from Breakerland/v3.5.0

Update config.yml
Dieser Commit ist enthalten in:
Corentin Boiteau 2019-11-17 16:54:58 +01:00 committet von GitHub
Commit 8c88cc02ac
Es konnte kein GPG-Schlüssel zu dieser Signatur gefunden werden
GPG-Schlüssel-ID: 4AEE18F83AFDEB23
5 geänderte Dateien mit 60 neuen und 15 gelöschten Zeilen

Datei anzeigen

@ -1,18 +1,23 @@
package com.gmail.St3venAU.plugins.ArmorStandTools; package com.gmail.St3venAU.plugins.ArmorStandTools;
import com.sk89q.worldguard.bukkit.WorldGuardPlugin;
import org.bukkit.Material;
import org.bukkit.configuration.file.FileConfiguration;
import org.bukkit.configuration.file.YamlConfiguration;
import org.bukkit.inventory.ItemStack;
import org.bukkit.plugin.Plugin;
import java.io.File; import java.io.File;
import java.io.InputStream; import java.io.InputStream;
import java.io.InputStreamReader; import java.io.InputStreamReader;
import java.nio.charset.Charset; import java.nio.charset.Charset;
import java.util.ArrayList;
import java.util.List;
import java.util.logging.Level; import java.util.logging.Level;
import org.bukkit.Material;
import org.bukkit.command.Command;
import org.bukkit.command.PluginCommandYamlParser;
import org.bukkit.configuration.file.FileConfiguration;
import org.bukkit.configuration.file.YamlConfiguration;
import org.bukkit.inventory.ItemStack;
import org.bukkit.plugin.Plugin;
import com.sk89q.worldguard.bukkit.WorldGuardPlugin;
class Config { class Config {
private static Main plugin; private static Main plugin;
@ -37,6 +42,7 @@ class Config {
static boolean requireCreative = false; static boolean requireCreative = false;
static int defaultASCmdCooldownTicks = 0; static int defaultASCmdCooldownTicks = 0;
static boolean ignoreWGForASCmdExecution = false; static boolean ignoreWGForASCmdExecution = false;
static List<String> commandsBlocked = new ArrayList<String>();
static String static String
invReturned, asDropped, asVisible, isTrue, isFalse, invReturned, asDropped, asVisible, isTrue, isFalse,
@ -51,7 +57,7 @@ class Config {
assignedCmdToAS, assignCmdError, ascmdHelp, viewCmd, assignedCmdToAS, assignCmdError, ascmdHelp, viewCmd,
removeCmd, assignConsole, assignPlayer, executeCmdError, removeCmd, assignConsole, assignPlayer, executeCmdError,
cmdOnCooldown, cooldownRemovedFrom, isAnInvalidCooldown, cmdOnCooldown, cooldownRemovedFrom, isAnInvalidCooldown,
cooldownSetTo, ticksFor, setCooldown, removeCooldown; cooldownSetTo, ticksFor, setCooldown, removeCooldown, commandBlocked;
static void reload(Main main) { static void reload(Main main) {
plugin = main; plugin = main;
@ -122,6 +128,7 @@ class Config {
ticksFor = languageConfig.getString("ticksFor"); ticksFor = languageConfig.getString("ticksFor");
setCooldown = languageConfig.getString("setCooldown"); setCooldown = languageConfig.getString("setCooldown");
ticksFor = languageConfig.getString("ticksFor"); ticksFor = languageConfig.getString("ticksFor");
commandBlocked = languageConfig.getString("commandBlocked");
} }
private static void reloadMainConfig() { private static void reloadMainConfig() {
@ -150,6 +157,20 @@ class Config {
debug = config.getBoolean("debug", false); debug = config.getBoolean("debug", false);
plugin.carryingArmorStand.clear(); plugin.carryingArmorStand.clear();
plugin.getServer().getScheduler().runTaskAsynchronously(plugin, () -> {
for (String blocked : config.getStringList("commandBlocked")) {
for (Plugin plugin : plugin.getServer().getPluginManager().getPlugins()) {
command: for (Command command : PluginCommandYamlParser.parse(plugin)) {
if (command.getAliases().contains(blocked)) {
commandsBlocked.addAll(command.getAliases());
break command;
}
}
}
commandsBlocked.add(blocked);
}});
for(ArmorStandTool tool : ArmorStandTool.values()) { for(ArmorStandTool tool : ArmorStandTool.values()) {
tool.setEnabled(config); tool.setEnabled(config);
} }

Datei anzeigen

@ -52,6 +52,23 @@ public class MainListener implements Listener {
this.plugin = main; this.plugin = main;
} }
@EventHandler(ignoreCancelled = true)
public void onCommandProcess(PlayerCommandPreprocessEvent event) {
Player player = event.getPlayer();
if (!plugin.carryingArmorStand.containsKey(player.getUniqueId()))
return;
String command = event.getMessage().split(" ")[0].toLowerCase();
for (String block : Config.commandsBlocked) {
if (!command.contains(block))
continue;
player.sendMessage(ChatColor.RED + Config.commandBlocked);
event.setCancelled(true);
return;
}
}
@EventHandler @EventHandler
public void onPlayerInteractAtEntity(PlayerInteractAtEntityEvent event) { public void onPlayerInteractAtEntity(PlayerInteractAtEntityEvent event) {
if(event.getRightClicked() instanceof ArmorStand) { if(event.getRightClicked() instanceof ArmorStand) {

Datei anzeigen

@ -4,7 +4,7 @@
# #
# Main Config # Main Config
# #
# File generated by: v3.4.0 # File generated by: v3.5.0
# (If this is not the version you are running, consider deleting this # (If this is not the version you are running, consider deleting this
# config to allow it to be re-created. There may be new config options) # config to allow it to be re-created. There may be new config options)
# #
@ -20,6 +20,7 @@
# - Player head tool: Set's an armor stand's head to the head of a specified player. # - Player head tool: Set's an armor stand's head to the head of a specified player.
# - Support for WorldGuard regions. # - Support for WorldGuard regions.
# - User customizable language config. # - User customizable language config.
# - Block commands while player are using AST.
# #
# Commands: # Commands:
# /astools Give yourself all of the armor stand tools (Note: Clears your inventory) # /astools Give yourself all of the armor stand tools (Note: Clears your inventory)
@ -35,6 +36,7 @@
# #
# Permissions: # Permissions:
# astools.command Permission for the /astools command # astools.command Permission for the /astools command
# astools.bypass Permission for the bypass blocked commands
# astools.reload Permission to reload the plugin with /astools reload # astools.reload Permission to reload the plugin with /astools reload
# astools.use Permission for using any of the tools (except the ones below that have their own separate permissions) # astools.use Permission for using any of the tools (except the ones below that have their own separate permissions)
# astools.clone Permission to use the clone tool (Clones an armor stand without requiring the materials) # astools.clone Permission to use the clone tool (Clones an armor stand without requiring the materials)
@ -107,4 +109,7 @@ enableTool:
gui_slots: true gui_slots: true
gui_pHead: true gui_pHead: true
gui_invul: true gui_invul: true
gui_move: true gui_move: true
commandBlocked:
- ehat
- hat

Datei anzeigen

@ -4,7 +4,7 @@
# #
# Language Config # Language Config
# #
# File generated by: v3.4.0 # File generated by: v3.5.0
# (If this is not the version you are running, consider deleting this # (If this is not the version you are running, consider deleting this
# config to allow it to be re-created. There may be new config options) # config to allow it to be re-created. There may be new config options)
# #
@ -89,6 +89,8 @@ cooldownSetTo: 'Cooldown set to'
ticksFor: 'ticks for' ticksFor: 'ticks for'
setCooldown: 'Set the cooldown for the command' setCooldown: 'Set the cooldown for the command'
removeCooldown: 'Remove the cooldown for the command' removeCooldown: 'Remove the cooldown for the command'
# New since v3.4.0
commandBlocked: 'You cannot use this command while you are using AST'
# #
############################# #############################
# Tool names & descriptions # # Tool names & descriptions #
@ -254,4 +256,4 @@ tool:
lore: lore:
gui_invul: gui_invul:
name: 'Toggle Invulnerability' name: 'Toggle Invulnerability'
lore: lore:

Datei anzeigen

@ -1,7 +1,7 @@
main: com.gmail.St3venAU.plugins.ArmorStandTools.Main main: com.gmail.St3venAU.plugins.ArmorStandTools.Main
name: ArmorStandTools name: ArmorStandTools
version: 3.4.0 version: 3.5.0
api-version: 1.13 api-version: 1.14
author: St3venAU author: St3venAU
description: Armor stand manipulation tools description: Armor stand manipulation tools
softdepend: [WorldGuard, PlotSquared] softdepend: [WorldGuard, PlotSquared]
@ -12,4 +12,4 @@ commands:
usage: Usage /astools or /astools reload usage: Usage /astools or /astools reload
ascmd: ascmd:
description: View/Remove/Assign the command assigned to the nearest armor stand description: View/Remove/Assign the command assigned to the nearest armor stand
usage: Usage /ascmd view, /ascmd remove, /ascmd assign <player/console> <command> usage: Usage /ascmd view, /ascmd remove, /ascmd assign <player/console> <command>