mirror of
https://github.com/darksaid98/Builders-Utilities.git
synced 2026-12-03 22:15:34 +00:00
Implement debug listener and optimize permission handling (#9)
* Improve permission handling and implement debug listener * Fix custom no-permission message * Fix ender dragon egg teleport bypass when sneaking
This commit is contained in:
1 parent
4abd7644aa
commit
17041d4c47
32 files changed
+96
-55
No files matched your search
@@ -37,16 +37,12 @@ import org.bukkit.command.Command;
|
|||||||
import org.bukkit.command.CommandExecutor;
|
import org.bukkit.command.CommandExecutor;
|
||||||
import org.bukkit.command.CommandSender;
|
import org.bukkit.command.CommandSender;
|
||||||
import org.bukkit.plugin.java.JavaPlugin;
|
import org.bukkit.plugin.java.JavaPlugin;
|
||||||
import org.slf4j.Logger;
|
|
||||||
import org.slf4j.LoggerFactory;
|
|
||||||
|
|
||||||
|
|
||||||
public final class Main extends JavaPlugin {
|
public final class Main extends JavaPlugin {
|
||||||
|
|
||||||
private static final Logger logger = LoggerFactory.getLogger("BU/" + Main.class.getSimpleName());
|
public static final String MSG_PREFIX = ChatColor.DARK_AQUA + "Builders-Utilities > " + ChatColor.AQUA;
|
||||||
|
public static final String MSG_NO_PERMISSION = MSG_PREFIX + ChatColor.AQUA + "You do not have access to this command. Lacking permission: " + ChatColor.RED;
|
||||||
public static final String MSG_PREFIX = ChatColor.DARK_AQUA + "BuildersUtils> " + ChatColor.AQUA;
|
public static final String MSG_ERROR = MSG_PREFIX + ChatColor.DARK_RED + "Error: " + ChatColor.RED;
|
||||||
public static final String MSG_ERROR = ChatColor.DARK_RED + "Error: " + ChatColor.RED;
|
|
||||||
private static final int BSTATS_ID = 5168;
|
private static final int BSTATS_ID = 5168;
|
||||||
private static Main instance;
|
private static Main instance;
|
||||||
private Settings settings;
|
private Settings settings;
|
||||||
@@ -71,7 +67,6 @@ public final class Main extends JavaPlugin {
|
|||||||
BannerUtil.addColors();
|
BannerUtil.addColors();
|
||||||
BannerUtil.addPatterns();
|
BannerUtil.addPatterns();
|
||||||
|
|
||||||
|
|
||||||
Metrics metrics = new Metrics(this, BSTATS_ID);
|
Metrics metrics = new Metrics(this, BSTATS_ID);
|
||||||
|
|
||||||
this.getServer().getPluginManager().registerEvents(new BlockBreakListener(), this);
|
this.getServer().getPluginManager().registerEvents(new BlockBreakListener(), this);
|
||||||
|
|||||||
@@ -39,6 +39,7 @@ public class Settings {
|
|||||||
public static boolean fixAttackSpeed;
|
public static boolean fixAttackSpeed;
|
||||||
public static boolean preventDragonEggTeleport;
|
public static boolean preventDragonEggTeleport;
|
||||||
public static boolean sendErrorMessages;
|
public static boolean sendErrorMessages;
|
||||||
|
public static boolean sendDebugMessages;
|
||||||
|
|
||||||
private final CustomConfig customConfig;
|
private final CustomConfig customConfig;
|
||||||
|
|
||||||
@@ -58,5 +59,6 @@ public class Settings {
|
|||||||
fixAttackSpeed = customConfig.get("fix-attackspeed", Boolean.class, false);
|
fixAttackSpeed = customConfig.get("fix-attackspeed", Boolean.class, false);
|
||||||
preventDragonEggTeleport = customConfig.get("prevent-dragon-egg-teleport", Boolean.class, true);
|
preventDragonEggTeleport = customConfig.get("prevent-dragon-egg-teleport", Boolean.class, true);
|
||||||
sendErrorMessages = customConfig.get("send-error-messages", Boolean.class, true);
|
sendErrorMessages = customConfig.get("send-error-messages", Boolean.class, true);
|
||||||
|
sendDebugMessages = customConfig.get("send-debug-messages", Boolean.class, true);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -37,7 +37,7 @@ public class AdvancedFlyCommand implements ICommand {
|
|||||||
public void execute(Player player, String[] args) {
|
public void execute(Player player, String[] args) {
|
||||||
if (!player.hasPermission("builders.util.advancedfly")) {
|
if (!player.hasPermission("builders.util.advancedfly")) {
|
||||||
if (Settings.sendErrorMessages) {
|
if (Settings.sendErrorMessages) {
|
||||||
player.sendMessage(Main.MSG_ERROR + "You do not have access to this command.");
|
player.sendMessage(Main.MSG_NO_PERMISSION + "builders.util.advancedfly");
|
||||||
}
|
}
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -37,7 +37,7 @@ public class BannerCommand implements ICommand {
|
|||||||
public void execute(Player player, String[] args) {
|
public void execute(Player player, String[] args) {
|
||||||
if (!player.hasPermission("builders.util.banner")) {
|
if (!player.hasPermission("builders.util.banner")) {
|
||||||
if (Settings.sendErrorMessages) {
|
if (Settings.sendErrorMessages) {
|
||||||
player.sendMessage(Main.MSG_ERROR + "You do not have access to this command.");
|
player.sendMessage(Main.MSG_NO_PERMISSION + "builders.util.banner");
|
||||||
}
|
}
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -36,7 +36,7 @@ public class ColorCommand implements ICommand {
|
|||||||
public void execute(Player player, String[] args) {
|
public void execute(Player player, String[] args) {
|
||||||
if (!player.hasPermission("builders.util.color")) {
|
if (!player.hasPermission("builders.util.color")) {
|
||||||
if (Settings.sendErrorMessages) {
|
if (Settings.sendErrorMessages) {
|
||||||
player.sendMessage(Main.MSG_ERROR + "You do not have access to this command.");
|
player.sendMessage(Main.MSG_NO_PERMISSION + "builders.util.color");
|
||||||
}
|
}
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -36,7 +36,7 @@ public class HelpCommand implements ICommand {
|
|||||||
public void execute(Player player, String[] args) {
|
public void execute(Player player, String[] args) {
|
||||||
if (!player.hasPermission("builders.util.help")) {
|
if (!player.hasPermission("builders.util.help")) {
|
||||||
if (Settings.sendErrorMessages) {
|
if (Settings.sendErrorMessages) {
|
||||||
player.sendMessage(Main.MSG_ERROR + "You do not have access to this command.");
|
player.sendMessage(Main.MSG_NO_PERMISSION + "builders.util.help");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -38,7 +38,7 @@ public class NightVisionCommand implements ICommand {
|
|||||||
public void execute(Player player, String[] args) {
|
public void execute(Player player, String[] args) {
|
||||||
if (!player.hasPermission("builders.util.nightvision")) {
|
if (!player.hasPermission("builders.util.nightvision")) {
|
||||||
if (Settings.sendErrorMessages) {
|
if (Settings.sendErrorMessages) {
|
||||||
player.sendMessage(Main.MSG_ERROR + "You do not have access to this command.");
|
player.sendMessage(Main.MSG_NO_PERMISSION + "builders.util.nightvision");
|
||||||
}
|
}
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -38,7 +38,7 @@ public class NoClipCommand implements ICommand {
|
|||||||
public void execute(Player player, String[] args) {
|
public void execute(Player player, String[] args) {
|
||||||
if (!player.hasPermission("builders.util.noclip")) {
|
if (!player.hasPermission("builders.util.noclip")) {
|
||||||
if (Settings.sendErrorMessages) {
|
if (Settings.sendErrorMessages) {
|
||||||
player.sendMessage(Main.MSG_ERROR + "You do not have access to this command.");
|
player.sendMessage(Main.MSG_NO_PERMISSION + "builders.util.noclip");
|
||||||
}
|
}
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -36,7 +36,7 @@ public class SecretBlockCommand implements ICommand {
|
|||||||
public void execute(Player player, String[] args) {
|
public void execute(Player player, String[] args) {
|
||||||
if (!player.hasPermission("builders.util.secretblocks")) {
|
if (!player.hasPermission("builders.util.secretblocks")) {
|
||||||
if (Settings.sendErrorMessages) {
|
if (Settings.sendErrorMessages) {
|
||||||
player.sendMessage(Main.MSG_ERROR + "You do not have access to this command.");
|
player.sendMessage(Main.MSG_NO_PERMISSION + "builders.util.secretblocks");
|
||||||
}
|
}
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -36,7 +36,7 @@ public class UtilsCommand implements ICommand {
|
|||||||
public void execute(Player player, String[] args) {
|
public void execute(Player player, String[] args) {
|
||||||
if (!player.hasPermission("builders.util.gui")) {
|
if (!player.hasPermission("builders.util.gui")) {
|
||||||
if (Settings.sendErrorMessages) {
|
if (Settings.sendErrorMessages) {
|
||||||
player.sendMessage(Main.MSG_ERROR + "You do not have access to this command.");
|
player.sendMessage(Main.MSG_NO_PERMISSION + "builders.util.gui");
|
||||||
}
|
}
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|||||||
+1
-1
@@ -35,7 +35,7 @@ public class ConvexSelectionAliasCommand implements ICommand {
|
|||||||
public void execute(Player player, String[] args) {
|
public void execute(Player player, String[] args) {
|
||||||
if (!player.hasPermission("builders.util.aliases")) {
|
if (!player.hasPermission("builders.util.aliases")) {
|
||||||
if (Settings.sendErrorMessages) {
|
if (Settings.sendErrorMessages) {
|
||||||
player.sendMessage(Main.MSG_ERROR + "You do not have access to this command.");
|
player.sendMessage(Main.MSG_NO_PERMISSION + "builders.util.aliases");
|
||||||
}
|
}
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -35,7 +35,7 @@ public class CopyAliasCommand implements ICommand {
|
|||||||
public void execute(Player player, String[] args) {
|
public void execute(Player player, String[] args) {
|
||||||
if (!player.hasPermission("builders.util.aliases")) {
|
if (!player.hasPermission("builders.util.aliases")) {
|
||||||
if (Settings.sendErrorMessages) {
|
if (Settings.sendErrorMessages) {
|
||||||
player.sendMessage(Main.MSG_ERROR + "You do not have access to this command.");
|
player.sendMessage(Main.MSG_NO_PERMISSION + "builders.util.aliases");
|
||||||
}
|
}
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|||||||
+1
-1
@@ -35,7 +35,7 @@ public class CuboidSelectionAliasCommand implements ICommand {
|
|||||||
public void execute(Player player, String[] args) {
|
public void execute(Player player, String[] args) {
|
||||||
if (!player.hasPermission("builders.util.aliases")) {
|
if (!player.hasPermission("builders.util.aliases")) {
|
||||||
if (Settings.sendErrorMessages) {
|
if (Settings.sendErrorMessages) {
|
||||||
player.sendMessage(Main.MSG_ERROR + "You do not have access to this command.");
|
player.sendMessage(Main.MSG_NO_PERMISSION + "builders.util.aliases");
|
||||||
}
|
}
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|||||||
+1
-1
@@ -37,7 +37,7 @@ public class DeformRotateAliasCommand implements ICommand {
|
|||||||
public void execute(Player player, String[] args) {
|
public void execute(Player player, String[] args) {
|
||||||
if (!player.hasPermission("builders.util.aliases")) {
|
if (!player.hasPermission("builders.util.aliases")) {
|
||||||
if (Settings.sendErrorMessages) {
|
if (Settings.sendErrorMessages) {
|
||||||
player.sendMessage(Main.MSG_ERROR + "You do not have access to this command.");
|
player.sendMessage(Main.MSG_NO_PERMISSION + "builders.util.aliases");
|
||||||
}
|
}
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -35,7 +35,7 @@ public class FlipAliasCommand implements ICommand {
|
|||||||
public void execute(Player player, String[] args) {
|
public void execute(Player player, String[] args) {
|
||||||
if (!player.hasPermission("builders.util.aliases")) {
|
if (!player.hasPermission("builders.util.aliases")) {
|
||||||
if (Settings.sendErrorMessages) {
|
if (Settings.sendErrorMessages) {
|
||||||
player.sendMessage(Main.MSG_ERROR + "You do not have access to this command.");
|
player.sendMessage(Main.MSG_NO_PERMISSION + "builders.util.aliases");
|
||||||
}
|
}
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|||||||
+1
-1
@@ -35,7 +35,7 @@ public class FlySpeedAliasCommand implements ICommand {
|
|||||||
public void execute(Player player, String[] args) {
|
public void execute(Player player, String[] args) {
|
||||||
if (!player.hasPermission("builders.util.aliases")) {
|
if (!player.hasPermission("builders.util.aliases")) {
|
||||||
if (Settings.sendErrorMessages) {
|
if (Settings.sendErrorMessages) {
|
||||||
player.sendMessage(Main.MSG_ERROR + "You do not have access to this command.");
|
player.sendMessage(Main.MSG_NO_PERMISSION + "builders.util.aliases");
|
||||||
}
|
}
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|||||||
+1
-1
@@ -35,7 +35,7 @@ public class PasteAliasCommand implements ICommand {
|
|||||||
public void execute(Player player, String[] args) {
|
public void execute(Player player, String[] args) {
|
||||||
if (!player.hasPermission("builders.util.aliases")) {
|
if (!player.hasPermission("builders.util.aliases")) {
|
||||||
if (Settings.sendErrorMessages) {
|
if (Settings.sendErrorMessages) {
|
||||||
player.sendMessage(Main.MSG_ERROR + "You do not have access to this command.");
|
player.sendMessage(Main.MSG_NO_PERMISSION + "builders.util.aliases");
|
||||||
}
|
}
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|||||||
+1
-1
@@ -35,7 +35,7 @@ public class PosOneAliasCommand implements ICommand {
|
|||||||
public void execute(Player player, String[] args) {
|
public void execute(Player player, String[] args) {
|
||||||
if (!player.hasPermission("builders.util.aliases")) {
|
if (!player.hasPermission("builders.util.aliases")) {
|
||||||
if (Settings.sendErrorMessages) {
|
if (Settings.sendErrorMessages) {
|
||||||
player.sendMessage(Main.MSG_ERROR + "You do not have access to this command.");
|
player.sendMessage(Main.MSG_NO_PERMISSION + "builders.util.aliases");
|
||||||
}
|
}
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|||||||
+1
-1
@@ -35,7 +35,7 @@ public class PosTwoAliasCommand implements ICommand {
|
|||||||
public void execute(Player player, String[] args) {
|
public void execute(Player player, String[] args) {
|
||||||
if (!player.hasPermission("builders.util.aliases")) {
|
if (!player.hasPermission("builders.util.aliases")) {
|
||||||
if (Settings.sendErrorMessages) {
|
if (Settings.sendErrorMessages) {
|
||||||
player.sendMessage(Main.MSG_ERROR + "You do not have access to this command.");
|
player.sendMessage(Main.MSG_NO_PERMISSION + "builders.util.aliases");
|
||||||
}
|
}
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|||||||
+1
-1
@@ -35,7 +35,7 @@ public class ReplaceAliasCommand implements ICommand {
|
|||||||
public void execute(Player player, String[] args) {
|
public void execute(Player player, String[] args) {
|
||||||
if (!player.hasPermission("builders.util.aliases")) {
|
if (!player.hasPermission("builders.util.aliases")) {
|
||||||
if (Settings.sendErrorMessages) {
|
if (Settings.sendErrorMessages) {
|
||||||
player.sendMessage(Main.MSG_ERROR + "You do not have access to this command.");
|
player.sendMessage(Main.MSG_NO_PERMISSION + "builders.util.aliases");
|
||||||
}
|
}
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|||||||
+1
-1
@@ -36,7 +36,7 @@ public class ScaleAliasCommand implements ICommand {
|
|||||||
public void execute(Player player, String[] args) {
|
public void execute(Player player, String[] args) {
|
||||||
if (!player.hasPermission("builders.util.aliases")) {
|
if (!player.hasPermission("builders.util.aliases")) {
|
||||||
if (Settings.sendErrorMessages) {
|
if (Settings.sendErrorMessages) {
|
||||||
player.sendMessage(Main.MSG_ERROR + "You do not have access to this command.");
|
player.sendMessage(Main.MSG_NO_PERMISSION + "builders.util.aliases");
|
||||||
}
|
}
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -35,7 +35,7 @@ public class SetAliasCommand implements ICommand {
|
|||||||
public void execute(Player player, String[] args) {
|
public void execute(Player player, String[] args) {
|
||||||
if (!player.hasPermission("builders.util.aliases")) {
|
if (!player.hasPermission("builders.util.aliases")) {
|
||||||
if (Settings.sendErrorMessages) {
|
if (Settings.sendErrorMessages) {
|
||||||
player.sendMessage(Main.MSG_ERROR + "You do not have access to this command.");
|
player.sendMessage(Main.MSG_NO_PERMISSION + "builders.util.aliases");
|
||||||
}
|
}
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|||||||
+1
-1
@@ -37,7 +37,7 @@ public class TwistAliasCommand implements ICommand {
|
|||||||
public void execute(Player player, String[] args) {
|
public void execute(Player player, String[] args) {
|
||||||
if (!player.hasPermission("builders.util.aliases")) {
|
if (!player.hasPermission("builders.util.aliases")) {
|
||||||
if (Settings.sendErrorMessages) {
|
if (Settings.sendErrorMessages) {
|
||||||
player.sendMessage(Main.MSG_ERROR + "You do not have access to this command.");
|
player.sendMessage(Main.MSG_NO_PERMISSION + "builders.util.aliases");
|
||||||
}
|
}
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|||||||
+1
-1
@@ -35,7 +35,7 @@ public class WalkSpeedAliasCommand implements ICommand {
|
|||||||
public void execute(Player player, String[] args) {
|
public void execute(Player player, String[] args) {
|
||||||
if (!player.hasPermission("builders.util.aliases")) {
|
if (!player.hasPermission("builders.util.aliases")) {
|
||||||
if (Settings.sendErrorMessages) {
|
if (Settings.sendErrorMessages) {
|
||||||
player.sendMessage(Main.MSG_ERROR + "You do not have access to this command.");
|
player.sendMessage(Main.MSG_NO_PERMISSION + "builders.util.aliases");
|
||||||
}
|
}
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -26,12 +26,16 @@
|
|||||||
package net.arcaniax.buildersutilities.listeners;
|
package net.arcaniax.buildersutilities.listeners;
|
||||||
|
|
||||||
import net.arcaniax.buildersutilities.Settings;
|
import net.arcaniax.buildersutilities.Settings;
|
||||||
import org.bukkit.Bukkit;
|
|
||||||
import org.bukkit.event.EventHandler;
|
import org.bukkit.event.EventHandler;
|
||||||
import org.bukkit.event.Listener;
|
import org.bukkit.event.Listener;
|
||||||
import org.bukkit.event.block.BlockPhysicsEvent;
|
import org.bukkit.event.block.BlockPhysicsEvent;
|
||||||
|
import org.slf4j.Logger;
|
||||||
|
import org.slf4j.LoggerFactory;
|
||||||
|
|
||||||
public class BlockPhysicsListener implements Listener {
|
public class BlockPhysicsListener implements Listener {
|
||||||
|
|
||||||
|
private static final Logger logger = LoggerFactory.getLogger("BU/" + BlockPhysicsListener.class.getSimpleName());
|
||||||
|
|
||||||
@EventHandler
|
@EventHandler
|
||||||
public void onPhysics(BlockPhysicsEvent e) {
|
public void onPhysics(BlockPhysicsEvent e) {
|
||||||
try {
|
try {
|
||||||
@@ -71,10 +75,19 @@ public class BlockPhysicsListener implements Listener {
|
|||||||
if (e.getChangedType().hasGravity()) {
|
if (e.getChangedType().hasGravity()) {
|
||||||
if (Settings.disableGravityPhysics) {
|
if (Settings.disableGravityPhysics) {
|
||||||
e.setCancelled(true);
|
e.setCancelled(true);
|
||||||
|
if (Settings.sendDebugMessages) {
|
||||||
|
logger.info(
|
||||||
|
"Gravity physics were cancelled because disable-gravity-physics: true");
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
if (Settings.disablePhysics) {
|
if (Settings.disablePhysics) {
|
||||||
e.setCancelled(true);
|
e.setCancelled(true);
|
||||||
|
if (Settings.sendDebugMessages) {
|
||||||
|
logger.info(
|
||||||
|
"Physics were cancelled because disable-physics: true");
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -29,12 +29,21 @@ import net.arcaniax.buildersutilities.Settings;
|
|||||||
import org.bukkit.event.EventHandler;
|
import org.bukkit.event.EventHandler;
|
||||||
import org.bukkit.event.Listener;
|
import org.bukkit.event.Listener;
|
||||||
import org.bukkit.event.entity.EntityExplodeEvent;
|
import org.bukkit.event.entity.EntityExplodeEvent;
|
||||||
|
import org.slf4j.Logger;
|
||||||
|
import org.slf4j.LoggerFactory;
|
||||||
|
|
||||||
public class ExplosionListener implements Listener {
|
public class ExplosionListener implements Listener {
|
||||||
|
|
||||||
|
private static final Logger logger = LoggerFactory.getLogger("BU/" + ExplosionListener.class.getSimpleName());
|
||||||
|
|
||||||
@EventHandler
|
@EventHandler
|
||||||
public void onExplode(EntityExplodeEvent event) {
|
public void onExplode(EntityExplodeEvent event) {
|
||||||
if (Settings.disableExplosions) {
|
if (Settings.disableExplosions) {
|
||||||
event.setCancelled(true);
|
event.setCancelled(true);
|
||||||
|
if (Settings.sendDebugMessages) {
|
||||||
|
logger.info(
|
||||||
|
"Explosion was cancelled because disable-explosions: true");
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -29,12 +29,21 @@ import net.arcaniax.buildersutilities.Settings;
|
|||||||
import org.bukkit.event.EventHandler;
|
import org.bukkit.event.EventHandler;
|
||||||
import org.bukkit.event.Listener;
|
import org.bukkit.event.Listener;
|
||||||
import org.bukkit.event.block.LeavesDecayEvent;
|
import org.bukkit.event.block.LeavesDecayEvent;
|
||||||
|
import org.slf4j.Logger;
|
||||||
|
import org.slf4j.LoggerFactory;
|
||||||
|
|
||||||
public class LeafDecayListener implements Listener {
|
public class LeafDecayListener implements Listener {
|
||||||
|
|
||||||
|
private static final Logger logger = LoggerFactory.getLogger("BU/" + LeafDecayListener.class.getSimpleName());
|
||||||
|
|
||||||
@EventHandler
|
@EventHandler
|
||||||
public void onLeafDecay(LeavesDecayEvent event) {
|
public void onLeafDecay(LeavesDecayEvent event) {
|
||||||
if (Settings.disableLeavesDecay) {
|
if (Settings.disableLeavesDecay) {
|
||||||
event.setCancelled(true);
|
event.setCancelled(true);
|
||||||
|
if (Settings.sendDebugMessages) {
|
||||||
|
logger.info(
|
||||||
|
"Leaf decay was cancelled because disable-leaves-decay: true");
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -33,8 +33,13 @@ import org.bukkit.event.EventPriority;
|
|||||||
import org.bukkit.event.Listener;
|
import org.bukkit.event.Listener;
|
||||||
import org.bukkit.event.block.Action;
|
import org.bukkit.event.block.Action;
|
||||||
import org.bukkit.event.player.PlayerInteractEvent;
|
import org.bukkit.event.player.PlayerInteractEvent;
|
||||||
|
import org.slf4j.Logger;
|
||||||
|
import org.slf4j.LoggerFactory;
|
||||||
|
|
||||||
public class PlayerInteractListener implements Listener {
|
public class PlayerInteractListener implements Listener {
|
||||||
|
|
||||||
|
private static final Logger logger = LoggerFactory.getLogger("BU/" + PlayerInteractListener.class.getSimpleName());
|
||||||
|
|
||||||
@EventHandler(priority = EventPriority.MONITOR)
|
@EventHandler(priority = EventPriority.MONITOR)
|
||||||
public void onDragonEggTP(PlayerInteractEvent event) {
|
public void onDragonEggTP(PlayerInteractEvent event) {
|
||||||
if (event.isCancelled()) {
|
if (event.isCancelled()) {
|
||||||
@@ -42,9 +47,12 @@ public class PlayerInteractListener implements Listener {
|
|||||||
}
|
}
|
||||||
if (event.getAction().equals(Action.RIGHT_CLICK_BLOCK)
|
if (event.getAction().equals(Action.RIGHT_CLICK_BLOCK)
|
||||||
&& event.getClickedBlock().getType().equals(Material.DRAGON_EGG)
|
&& event.getClickedBlock().getType().equals(Material.DRAGON_EGG)
|
||||||
&& (!event.getPlayer().isSneaking())
|
|
||||||
&& Settings.preventDragonEggTeleport) {
|
&& Settings.preventDragonEggTeleport) {
|
||||||
event.setCancelled(true);
|
event.setCancelled(true);
|
||||||
|
if (Settings.sendDebugMessages) {
|
||||||
|
logger.info(
|
||||||
|
"Dragon egg teleport was cancelled because prevent-dragon-egg-teleport: true");
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -59,6 +67,10 @@ public class PlayerInteractListener implements Listener {
|
|||||||
if (block != null && block.getType() == Material.FARMLAND) {
|
if (block != null && block.getType() == Material.FARMLAND) {
|
||||||
event.setUseInteractedBlock(org.bukkit.event.Event.Result.DENY);
|
event.setUseInteractedBlock(org.bukkit.event.Event.Result.DENY);
|
||||||
event.setCancelled(true);
|
event.setCancelled(true);
|
||||||
|
if (Settings.sendDebugMessages) {
|
||||||
|
logger.info(
|
||||||
|
"Soil trampling was cancelled because disable-soil-trample: true");
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -25,20 +25,29 @@
|
|||||||
|
|
||||||
package net.arcaniax.buildersutilities.listeners;
|
package net.arcaniax.buildersutilities.listeners;
|
||||||
|
|
||||||
|
import net.arcaniax.buildersutilities.Settings;
|
||||||
import org.bukkit.event.EventHandler;
|
import org.bukkit.event.EventHandler;
|
||||||
import org.bukkit.event.Listener;
|
import org.bukkit.event.Listener;
|
||||||
import org.bukkit.event.player.PlayerTeleportEvent;
|
import org.bukkit.event.player.PlayerTeleportEvent;
|
||||||
|
import org.slf4j.Logger;
|
||||||
|
import org.slf4j.LoggerFactory;
|
||||||
|
|
||||||
public class TeleportListener implements Listener {
|
public class TeleportListener implements Listener {
|
||||||
|
|
||||||
|
private static final Logger logger = LoggerFactory.getLogger("BU/" + TeleportListener.class.getSimpleName());
|
||||||
|
|
||||||
@EventHandler
|
@EventHandler
|
||||||
public void onTeleport(PlayerTeleportEvent event) {
|
public void onTeleport(PlayerTeleportEvent event) {
|
||||||
if (event.isCancelled()) {
|
if (event.isCancelled()) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if (event.getCause().equals(PlayerTeleportEvent.TeleportCause.SPECTATE)) {
|
if (event.getCause().equals(PlayerTeleportEvent.TeleportCause.SPECTATE)) {
|
||||||
//TODO what is this tpgm3 lol
|
|
||||||
if (!event.getPlayer().hasPermission("builders.util.tpgm3")) {
|
if (!event.getPlayer().hasPermission("builders.util.tpgm3")) {
|
||||||
event.setCancelled(true);
|
event.setCancelled(true);
|
||||||
|
if (Settings.sendDebugMessages) {
|
||||||
|
logger.info(
|
||||||
|
"Spectate teleport was cancelled because {} lacks the permission builders.util.tpgm3", event.getPlayer());
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -29,12 +29,21 @@ import net.arcaniax.buildersutilities.Settings;
|
|||||||
import org.bukkit.event.EventHandler;
|
import org.bukkit.event.EventHandler;
|
||||||
import org.bukkit.event.Listener;
|
import org.bukkit.event.Listener;
|
||||||
import org.bukkit.event.weather.WeatherChangeEvent;
|
import org.bukkit.event.weather.WeatherChangeEvent;
|
||||||
|
import org.slf4j.Logger;
|
||||||
|
import org.slf4j.LoggerFactory;
|
||||||
|
|
||||||
public class WeatherChangeListener implements Listener {
|
public class WeatherChangeListener implements Listener {
|
||||||
|
|
||||||
|
private static final Logger logger = LoggerFactory.getLogger("BU/" + WeatherChangeListener.class.getSimpleName());
|
||||||
|
|
||||||
@EventHandler
|
@EventHandler
|
||||||
public void onWeather(WeatherChangeEvent e) {
|
public void onWeather(WeatherChangeEvent e) {
|
||||||
if (Settings.disableWeatherChanges) {
|
if (Settings.disableWeatherChanges) {
|
||||||
e.setCancelled(true);
|
e.setCancelled(true);
|
||||||
|
if (Settings.sendDebugMessages) {
|
||||||
|
logger.info(
|
||||||
|
"Weather changing was cancelled because disable-weather-changes: true");
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -36,3 +36,7 @@ prevent-dragon-egg-teleport: true
|
|||||||
# This is useful for when you do not want to give away what
|
# This is useful for when you do not want to give away what
|
||||||
# plugins exist on your server.
|
# plugins exist on your server.
|
||||||
send-error-messages: true
|
send-error-messages: true
|
||||||
|
|
||||||
|
# Whether or not Builders-Utilities should send debug messages
|
||||||
|
# Leave it on "false" unless you are debugging Builders-Utilities' events.
|
||||||
|
send-debug-messages: false
|
||||||
@@ -11,75 +11,54 @@ commands:
|
|||||||
banner:
|
banner:
|
||||||
description: opens banner creator
|
description: opens banner creator
|
||||||
aliases: bm
|
aliases: bm
|
||||||
permission: builders.util.banner
|
|
||||||
armorcolor:
|
armorcolor:
|
||||||
description: opens armor color creator
|
description: opens armor color creator
|
||||||
aliases: color
|
aliases: color
|
||||||
permission: builders.util.color
|
|
||||||
nc:
|
nc:
|
||||||
aliases: noclip
|
aliases: noclip
|
||||||
description: Toggles NoClip.
|
description: Toggles NoClip.
|
||||||
permission: builders.util.noclip
|
|
||||||
af:
|
af:
|
||||||
aliases: advfly
|
aliases: advfly
|
||||||
description: Toggles Advanced fly.
|
description: Toggles Advanced fly.
|
||||||
permission: builders.util.advancedfly
|
|
||||||
n:
|
n:
|
||||||
aliases: nv
|
aliases: nv
|
||||||
description: Toggles Nightvision.
|
description: Toggles Nightvision.
|
||||||
permission: builders.util.nightvision
|
|
||||||
/1:
|
/1:
|
||||||
description: alias
|
description: alias
|
||||||
permission: builders.util.aliases
|
|
||||||
/2:
|
/2:
|
||||||
description: alias
|
description: alias
|
||||||
permission: builders.util.aliases
|
|
||||||
/r:
|
/r:
|
||||||
description: alias
|
description: alias
|
||||||
permission: builders.util.aliases
|
|
||||||
/s:
|
/s:
|
||||||
description: alias
|
description: alias
|
||||||
permission: builders.util.aliases
|
|
||||||
/c:
|
/c:
|
||||||
description: alias
|
description: alias
|
||||||
permission: builders.util.aliases
|
|
||||||
/f:
|
/f:
|
||||||
description: alias
|
description: alias
|
||||||
permission: builders.util.aliases
|
|
||||||
/pa:
|
/pa:
|
||||||
description: alias
|
description: alias
|
||||||
permission: builders.util.aliases
|
|
||||||
/derot:
|
/derot:
|
||||||
description: alias
|
description: alias
|
||||||
permission: builders.util.aliases
|
|
||||||
/twist:
|
/twist:
|
||||||
description: alias
|
description: alias
|
||||||
/scale:
|
/scale:
|
||||||
description: alias
|
description: alias
|
||||||
permission: builders.util.aliases
|
|
||||||
/copy:
|
/copy:
|
||||||
description: alias
|
description: alias
|
||||||
permission: builders.util.aliases
|
|
||||||
/cuboid:
|
/cuboid:
|
||||||
description: alias
|
description: alias
|
||||||
aliases: /cub
|
aliases: /cub
|
||||||
permission: builders.util.aliases
|
|
||||||
/flip:
|
/flip:
|
||||||
description: alias
|
description: alias
|
||||||
permission: builders.util.aliases
|
|
||||||
/convex:
|
/convex:
|
||||||
description: alias
|
description: alias
|
||||||
aliases: /con
|
aliases: /con
|
||||||
permission: builders.util.aliases
|
|
||||||
blocks:
|
blocks:
|
||||||
description: Opens secret blocks menu
|
description: Opens secret blocks menu
|
||||||
aliases: secretblocks
|
aliases: secretblocks
|
||||||
permission: builders.util.secretblocks
|
|
||||||
ws:
|
ws:
|
||||||
description: alias
|
description: alias
|
||||||
permission: builders.util.aliases
|
|
||||||
fs:
|
fs:
|
||||||
description: alias
|
description: alias
|
||||||
permission: builders.util.aliases
|
|
||||||
help:
|
help:
|
||||||
permission: builders.util.help
|
description: Help command
|
||||||
Reference in new issue
Block a user