mirror of
https://github.com/TotalFreedomMC/TF-EssentialsX.git
synced 2025-08-06 12:33:03 +00:00
Lots of little fixes in the Essentials modules (#2337) @DoNotSpamPls
Look at changed files for the changes
This commit is contained in:
parent
e8ab2db8e8
commit
82ede4530a
58 changed files with 316 additions and 924 deletions
|
@ -22,15 +22,18 @@ import org.bukkit.event.player.PlayerPickupItemEvent;
|
|||
import org.bukkit.inventory.ItemStack;
|
||||
|
||||
import java.util.logging.Level;
|
||||
import java.util.logging.Logger;
|
||||
|
||||
|
||||
import static com.earth2me.essentials.I18n.tl;
|
||||
|
||||
|
||||
public class EssentialsAntiBuildListener implements Listener {
|
||||
private static final Logger logger = Logger.getLogger("EssentialsAntiBuild");
|
||||
final private transient IAntiBuild prot;
|
||||
final private transient IEssentials ess;
|
||||
|
||||
public EssentialsAntiBuildListener(final IAntiBuild parent) {
|
||||
EssentialsAntiBuildListener(final IAntiBuild parent) {
|
||||
this.prot = parent;
|
||||
this.ess = prot.getEssentialsConnect().getEssentials();
|
||||
|
||||
|
@ -53,14 +56,14 @@ public class EssentialsAntiBuildListener implements Listener {
|
|||
private boolean metaPermCheck(final User user, final String action, final Block block) {
|
||||
if (block == null) {
|
||||
if (ess.getSettings().isDebug()) {
|
||||
ess.getLogger().log(Level.INFO, "AntiBuild permission check failed, invalid block.");
|
||||
logger.log(Level.INFO, "AntiBuild permission check failed, invalid block.");
|
||||
}
|
||||
return false;
|
||||
}
|
||||
return metaPermCheck(user, action, block.getType(), block.getData());
|
||||
}
|
||||
|
||||
private boolean metaPermCheck(final User user, final String action, final Material material) {
|
||||
public boolean metaPermCheck(final User user, final String action, final Material material) {
|
||||
final String blockPerm = "essentials.build." + action + "." + material;
|
||||
return user.isAuthorized(blockPerm);
|
||||
}
|
||||
|
@ -74,7 +77,7 @@ public class EssentialsAntiBuildListener implements Listener {
|
|||
return user.isAuthorized(dataPerm);
|
||||
} else {
|
||||
if (ess.getSettings().isDebug()) {
|
||||
ess.getLogger().log(Level.INFO, "DataValue perm on " + user.getName() + " is not directly set: " + dataPerm);
|
||||
logger.log(Level.INFO, "DataValue perm on " + user.getName() + " is not directly set: " + dataPerm);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -13,14 +13,14 @@ import java.util.logging.Logger;
|
|||
import static com.earth2me.essentials.I18n.tl;
|
||||
|
||||
|
||||
public class EssentialsConnect {
|
||||
private static final Logger LOGGER = Logger.getLogger("Minecraft");
|
||||
class EssentialsConnect {
|
||||
private static final Logger logger = Logger.getLogger("EssentialsAntiBuild");
|
||||
private final transient IEssentials ess;
|
||||
private final transient IAntiBuild protect;
|
||||
|
||||
public EssentialsConnect(Plugin essPlugin, Plugin essProtect) {
|
||||
EssentialsConnect(Plugin essPlugin, Plugin essProtect) {
|
||||
if (!essProtect.getDescription().getVersion().equals(essPlugin.getDescription().getVersion())) {
|
||||
LOGGER.log(Level.WARNING, tl("versionMismatchAll"));
|
||||
logger.log(Level.WARNING, tl("versionMismatchAll"));
|
||||
}
|
||||
ess = (IEssentials) essPlugin;
|
||||
protect = (IAntiBuild) essProtect;
|
||||
|
@ -29,17 +29,14 @@ public class EssentialsConnect {
|
|||
ess.addReloadListener(pr);
|
||||
}
|
||||
|
||||
public void onDisable() {
|
||||
}
|
||||
|
||||
public IEssentials getEssentials() {
|
||||
IEssentials getEssentials() {
|
||||
return ess;
|
||||
}
|
||||
|
||||
public void alert(final User user, final String item, final String type) {
|
||||
void alert(final User user, final String item, final String type) {
|
||||
final Location loc = user.getLocation();
|
||||
final String warnMessage = tl("alertFormat", user.getName(), type, item, loc.getWorld().getName() + "," + loc.getBlockX() + "," + loc.getBlockY() + "," + loc.getBlockZ());
|
||||
LOGGER.log(Level.WARNING, warnMessage);
|
||||
logger.log(Level.WARNING, warnMessage);
|
||||
for (Player p : ess.getServer().getOnlinePlayers()) {
|
||||
final User alertUser = ess.getUser(p);
|
||||
if (alertUser.isAuthorized("essentials.protect.alerts")) {
|
||||
|
@ -48,7 +45,6 @@ public class EssentialsConnect {
|
|||
}
|
||||
}
|
||||
|
||||
|
||||
private class AntiBuildReloader implements IConf {
|
||||
@Override
|
||||
public void reloadConfig() {
|
||||
|
|
|
@ -6,5 +6,5 @@ version: ${full.version}
|
|||
website: http://tiny.cc/EssentialsCommands
|
||||
description: Provides build protection.
|
||||
authors: [Zenexer, ementalo, Aelux, Brettflan, KimKandor, snowleo, ceulemans, Xeology, KHobbits, Iaccidentally]
|
||||
api-version: 1.13
|
||||
depend: [Essentials]
|
||||
api-version: 1.13
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue