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;
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.InputStream;
import java.io.InputStreamReader;
import java.nio.charset.Charset;
import java.util.ArrayList;
import java.util.List;
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 {
private static Main plugin;
@ -37,6 +42,7 @@ class Config {
static boolean requireCreative = false;
static int defaultASCmdCooldownTicks = 0;
static boolean ignoreWGForASCmdExecution = false;
static List<String> commandsBlocked = new ArrayList<String>();
static String
invReturned, asDropped, asVisible, isTrue, isFalse,
@ -51,7 +57,7 @@ class Config {
assignedCmdToAS, assignCmdError, ascmdHelp, viewCmd,
removeCmd, assignConsole, assignPlayer, executeCmdError,
cmdOnCooldown, cooldownRemovedFrom, isAnInvalidCooldown,
cooldownSetTo, ticksFor, setCooldown, removeCooldown;
cooldownSetTo, ticksFor, setCooldown, removeCooldown, commandBlocked;
static void reload(Main main) {
plugin = main;
@ -122,6 +128,7 @@ class Config {
ticksFor = languageConfig.getString("ticksFor");
setCooldown = languageConfig.getString("setCooldown");
ticksFor = languageConfig.getString("ticksFor");
commandBlocked = languageConfig.getString("commandBlocked");
}
private static void reloadMainConfig() {
@ -150,6 +157,20 @@ class Config {
debug = config.getBoolean("debug", false);
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()) {
tool.setEnabled(config);
}

Datei anzeigen

@ -52,6 +52,23 @@ public class MainListener implements Listener {
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
public void onPlayerInteractAtEntity(PlayerInteractAtEntityEvent event) {
if(event.getRightClicked() instanceof ArmorStand) {

Datei anzeigen

@ -4,7 +4,7 @@
#
# 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
# 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.
# - Support for WorldGuard regions.
# - User customizable language config.
# - Block commands while player are using AST.
#
# Commands:
# /astools Give yourself all of the armor stand tools (Note: Clears your inventory)
@ -35,6 +36,7 @@
#
# Permissions:
# 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.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)
@ -108,3 +110,6 @@ enableTool:
gui_pHead: true
gui_invul: true
gui_move: true
commandBlocked:
- ehat
- hat

Datei anzeigen

@ -4,7 +4,7 @@
#
# 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
# 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'
setCooldown: 'Set 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 #

Datei anzeigen

@ -1,7 +1,7 @@
main: com.gmail.St3venAU.plugins.ArmorStandTools.Main
name: ArmorStandTools
version: 3.4.0
api-version: 1.13
version: 3.5.0
api-version: 1.14
author: St3venAU
description: Armor stand manipulation tools
softdepend: [WorldGuard, PlotSquared]