Merge remote-tracking branch 'origin/master'

This commit is contained in:
Lesley Dom committed 2020-09-14 11:10:40 +02:00
commit dbd811ea78
33 files changed
+99 -58

No files matched your search

+2 -2
View File
@@ -4,7 +4,7 @@
---
Builders- Utilities was a requested plugin by Alex_deGrote,
Builders-Utilities was a requested plugin by Alex_deGrote,
who won the plugin giveaway at my panel from McBcon.
This plugin is a collection of a lot of tiny features that help with building.
@@ -28,4 +28,4 @@ Gradle is the recommended way to build the project. Use `./gradlew build shadowJ
See [here](https://github.com/Brennian/Builders-Utilities/blob/master/CONTRIBUTING.md)
## Suggestions
Suggestions are welcome! We have a separate issue form for suggestions, that can be found [here](https://github.com/Brennian/Builders-Utilities/issues).
Suggestions are welcome! We have a separate issue form for suggestions, that can be found [here](https://github.com/Brennian/Builders-Utilities/issues).
@@ -37,16 +37,12 @@ import org.bukkit.command.Command;
import org.bukkit.command.CommandExecutor;
import org.bukkit.command.CommandSender;
import org.bukkit.plugin.java.JavaPlugin;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
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 + "BuildersUtils> " + ChatColor.AQUA;
public static final String MSG_ERROR = ChatColor.DARK_RED + "Error: " + ChatColor.RED;
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_ERROR = MSG_PREFIX + ChatColor.DARK_RED + "Error: " + ChatColor.RED;
private static final int BSTATS_ID = 5168;
private static Main instance;
private Settings settings;
@@ -71,7 +67,6 @@ public final class Main extends JavaPlugin {
BannerUtil.addColors();
BannerUtil.addPatterns();
Metrics metrics = new Metrics(this, BSTATS_ID);
this.getServer().getPluginManager().registerEvents(new BlockBreakListener(), this);
@@ -39,6 +39,7 @@ public class Settings {
public static boolean fixAttackSpeed;
public static boolean preventDragonEggTeleport;
public static boolean sendErrorMessages;
public static boolean sendDebugMessages;
private final CustomConfig customConfig;
@@ -58,5 +59,6 @@ public class Settings {
fixAttackSpeed = customConfig.get("fix-attackspeed", Boolean.class, false);
preventDragonEggTeleport = customConfig.get("prevent-dragon-egg-teleport", 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) {
if (!player.hasPermission("builders.util.advancedfly")) {
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;
}
@@ -37,7 +37,7 @@ public class BannerCommand implements ICommand {
public void execute(Player player, String[] args) {
if (!player.hasPermission("builders.util.banner")) {
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;
}
@@ -36,7 +36,7 @@ public class ColorCommand implements ICommand {
public void execute(Player player, String[] args) {
if (!player.hasPermission("builders.util.color")) {
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;
}
@@ -36,7 +36,7 @@ public class HelpCommand implements ICommand {
public void execute(Player player, String[] args) {
if (!player.hasPermission("builders.util.help")) {
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) {
if (!player.hasPermission("builders.util.nightvision")) {
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;
}
@@ -38,7 +38,7 @@ public class NoClipCommand implements ICommand {
public void execute(Player player, String[] args) {
if (!player.hasPermission("builders.util.noclip")) {
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;
}
@@ -36,7 +36,7 @@ public class SecretBlockCommand implements ICommand {
public void execute(Player player, String[] args) {
if (!player.hasPermission("builders.util.secretblocks")) {
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;
}
@@ -36,7 +36,7 @@ public class UtilsCommand implements ICommand {
public void execute(Player player, String[] args) {
if (!player.hasPermission("builders.util.gui")) {
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;
}
@@ -35,7 +35,7 @@ public class ConvexSelectionAliasCommand implements ICommand {
public void execute(Player player, String[] args) {
if (!player.hasPermission("builders.util.aliases")) {
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;
}
@@ -35,7 +35,7 @@ public class CopyAliasCommand implements ICommand {
public void execute(Player player, String[] args) {
if (!player.hasPermission("builders.util.aliases")) {
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;
}
@@ -35,7 +35,7 @@ public class CuboidSelectionAliasCommand implements ICommand {
public void execute(Player player, String[] args) {
if (!player.hasPermission("builders.util.aliases")) {
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;
}
@@ -37,7 +37,7 @@ public class DeformRotateAliasCommand implements ICommand {
public void execute(Player player, String[] args) {
if (!player.hasPermission("builders.util.aliases")) {
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;
}
@@ -35,7 +35,7 @@ public class FlipAliasCommand implements ICommand {
public void execute(Player player, String[] args) {
if (!player.hasPermission("builders.util.aliases")) {
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;
}
@@ -35,7 +35,7 @@ public class FlySpeedAliasCommand implements ICommand {
public void execute(Player player, String[] args) {
if (!player.hasPermission("builders.util.aliases")) {
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;
}
@@ -35,7 +35,7 @@ public class PasteAliasCommand implements ICommand {
public void execute(Player player, String[] args) {
if (!player.hasPermission("builders.util.aliases")) {
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;
}
@@ -35,7 +35,7 @@ public class PosOneAliasCommand implements ICommand {
public void execute(Player player, String[] args) {
if (!player.hasPermission("builders.util.aliases")) {
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;
}
@@ -35,7 +35,7 @@ public class PosTwoAliasCommand implements ICommand {
public void execute(Player player, String[] args) {
if (!player.hasPermission("builders.util.aliases")) {
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;
}
@@ -35,7 +35,7 @@ public class ReplaceAliasCommand implements ICommand {
public void execute(Player player, String[] args) {
if (!player.hasPermission("builders.util.aliases")) {
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;
}
@@ -36,7 +36,7 @@ public class ScaleAliasCommand implements ICommand {
public void execute(Player player, String[] args) {
if (!player.hasPermission("builders.util.aliases")) {
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;
}
@@ -35,7 +35,7 @@ public class SetAliasCommand implements ICommand {
public void execute(Player player, String[] args) {
if (!player.hasPermission("builders.util.aliases")) {
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;
}
@@ -37,7 +37,7 @@ public class TwistAliasCommand implements ICommand {
public void execute(Player player, String[] args) {
if (!player.hasPermission("builders.util.aliases")) {
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;
}
@@ -35,7 +35,7 @@ public class WalkSpeedAliasCommand implements ICommand {
public void execute(Player player, String[] args) {
if (!player.hasPermission("builders.util.aliases")) {
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;
}
@@ -26,12 +26,16 @@
package net.arcaniax.buildersutilities.listeners;
import net.arcaniax.buildersutilities.Settings;
import org.bukkit.Bukkit;
import org.bukkit.event.EventHandler;
import org.bukkit.event.Listener;
import org.bukkit.event.block.BlockPhysicsEvent;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
public class BlockPhysicsListener implements Listener {
private static final Logger logger = LoggerFactory.getLogger("BU/" + BlockPhysicsListener.class.getSimpleName());
@EventHandler
public void onPhysics(BlockPhysicsEvent e) {
try {
@@ -71,10 +75,19 @@ public class BlockPhysicsListener implements Listener {
if (e.getChangedType().hasGravity()) {
if (Settings.disableGravityPhysics) {
e.setCancelled(true);
if (Settings.sendDebugMessages) {
logger.info(
"Gravity physics were cancelled because disable-gravity-physics: true");
}
}
} else {
if (Settings.disablePhysics) {
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.Listener;
import org.bukkit.event.entity.EntityExplodeEvent;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
public class ExplosionListener implements Listener {
private static final Logger logger = LoggerFactory.getLogger("BU/" + ExplosionListener.class.getSimpleName());
@EventHandler
public void onExplode(EntityExplodeEvent event) {
if (Settings.disableExplosions) {
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.Listener;
import org.bukkit.event.block.LeavesDecayEvent;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
public class LeafDecayListener implements Listener {
private static final Logger logger = LoggerFactory.getLogger("BU/" + LeafDecayListener.class.getSimpleName());
@EventHandler
public void onLeafDecay(LeavesDecayEvent event) {
if (Settings.disableLeavesDecay) {
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.block.Action;
import org.bukkit.event.player.PlayerInteractEvent;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
public class PlayerInteractListener implements Listener {
private static final Logger logger = LoggerFactory.getLogger("BU/" + PlayerInteractListener.class.getSimpleName());
@EventHandler(priority = EventPriority.MONITOR)
public void onDragonEggTP(PlayerInteractEvent event) {
if (event.isCancelled()) {
@@ -42,9 +47,12 @@ public class PlayerInteractListener implements Listener {
}
if (event.getAction().equals(Action.RIGHT_CLICK_BLOCK)
&& event.getClickedBlock().getType().equals(Material.DRAGON_EGG)
&& (!event.getPlayer().isSneaking())
&& Settings.preventDragonEggTeleport) {
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) {
event.setUseInteractedBlock(org.bukkit.event.Event.Result.DENY);
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;
import net.arcaniax.buildersutilities.Settings;
import org.bukkit.event.EventHandler;
import org.bukkit.event.Listener;
import org.bukkit.event.player.PlayerTeleportEvent;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
public class TeleportListener implements Listener {
private static final Logger logger = LoggerFactory.getLogger("BU/" + TeleportListener.class.getSimpleName());
@EventHandler
public void onTeleport(PlayerTeleportEvent event) {
if (event.isCancelled()) {
return;
}
if (event.getCause().equals(PlayerTeleportEvent.TeleportCause.SPECTATE)) {
//TODO what is this tpgm3 lol
if (!event.getPlayer().hasPermission("builders.util.tpgm3")) {
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.Listener;
import org.bukkit.event.weather.WeatherChangeEvent;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
public class WeatherChangeListener implements Listener {
private static final Logger logger = LoggerFactory.getLogger("BU/" + WeatherChangeListener.class.getSimpleName());
@EventHandler
public void onWeather(WeatherChangeEvent e) {
if (Settings.disableWeatherChanges) {
e.setCancelled(true);
if (Settings.sendDebugMessages) {
logger.info(
"Weather changing was cancelled because disable-weather-changes: true");
}
}
}
}
+5 -1
View File
@@ -35,4 +35,8 @@ prevent-dragon-egg-teleport: true
# "You do not have permission for this command"
# This is useful for when you do not want to give away what
# 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
+1 -22
View File
@@ -11,75 +11,54 @@ commands:
banner:
description: opens banner creator
aliases: bm
permission: builders.util.banner
armorcolor:
description: opens armor color creator
aliases: color
permission: builders.util.color
nc:
aliases: noclip
description: Toggles NoClip.
permission: builders.util.noclip
af:
aliases: advfly
description: Toggles Advanced fly.
permission: builders.util.advancedfly
n:
aliases: nv
description: Toggles Nightvision.
permission: builders.util.nightvision
/1:
description: alias
permission: builders.util.aliases
/2:
description: alias
permission: builders.util.aliases
/r:
description: alias
permission: builders.util.aliases
/s:
description: alias
permission: builders.util.aliases
/c:
description: alias
permission: builders.util.aliases
/f:
description: alias
permission: builders.util.aliases
/pa:
description: alias
permission: builders.util.aliases
/derot:
description: alias
permission: builders.util.aliases
/twist:
description: alias
/scale:
description: alias
permission: builders.util.aliases
/copy:
description: alias
permission: builders.util.aliases
/cuboid:
description: alias
aliases: /cub
permission: builders.util.aliases
/flip:
description: alias
permission: builders.util.aliases
/convex:
description: alias
aliases: /con
permission: builders.util.aliases
blocks:
description: Opens secret blocks menu
aliases: secretblocks
permission: builders.util.secretblocks
ws:
description: alias
permission: builders.util.aliases
fs:
description: alias
permission: builders.util.aliases
help:
permission: builders.util.help
description: Help command