Break & Place
This commit is contained in:
Binary file not shown.
Binary file not shown.
Binary file not shown.
@@ -117,7 +117,7 @@ public class CommandBlockHolder {
|
||||
public CommandBlockHolder addAndWhitelist() {
|
||||
return setWhitelisted(true).add();
|
||||
}
|
||||
|
||||
|
||||
public BlockFace getDirection() {
|
||||
try {
|
||||
return BlockFace.valueOf(facing.toUpperCase());
|
||||
@@ -193,6 +193,7 @@ public class CommandBlockHolder {
|
||||
}
|
||||
|
||||
public void delete() {
|
||||
SerialLocation.translate(this.loc).getBlock().setType(Material.AIR);
|
||||
Sentinel.getInstance().getDirector().io.commandBlocks.holders.removeIf(h->h.loc.isSameLocation(this.loc));
|
||||
Sentinel.getInstance().getDirector().io.commandBlocks.save();
|
||||
}
|
||||
|
||||
@@ -28,8 +28,6 @@ public class CommandBlockBreak extends AbstractViolation{
|
||||
|
||||
@EventHandler
|
||||
public void onBreak(BlockBreakEvent e) {
|
||||
//ServerUtils.verbose("CommandBlockBreak: Detected the event");
|
||||
//ServerUtils.verbose("CommandBlockBreak: Changer is a player");
|
||||
Block b = e.getBlock();
|
||||
if (!(ServerUtils.isCommandBlock(b))) return;
|
||||
ServerUtils.verbose("CommandBlockBreak: Block is a command block");
|
||||
@@ -38,13 +36,16 @@ public class CommandBlockBreak extends AbstractViolation{
|
||||
CommandBlockHolder holder = Sentinel.getInstance().getDirector().whitelistManager.generateHolder(p.getUniqueId(),cb);
|
||||
if (PlayerUtils.isTrusted(e.getPlayer())) {
|
||||
if (!Sentinel.getInstance().getDirector().whitelistManager.autoWhitelist.contains(p.getUniqueId())) {
|
||||
|
||||
return;
|
||||
holder.setWhitelisted(false);
|
||||
holder.delete();
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
||||
if (!Sentinel.getInstance().getDirector().io.violationConfig.commandBlockBreak.enabled) return;
|
||||
if (!Sentinel.getInstance().getDirector().io.violationConfig.commandBlockBreak.enabled) {
|
||||
holder.delete();
|
||||
return;
|
||||
}
|
||||
|
||||
ServerUtils.verbose("CommandBlockBreak: is enabled, performing action");
|
||||
|
||||
|
||||
@@ -33,13 +33,13 @@ public class CommandBlockPlace extends AbstractViolation {
|
||||
CommandBlock cb = (CommandBlock) b.getState();
|
||||
CommandBlockHolder holder = Sentinel.getInstance().getDirector().whitelistManager.generateHolder(p.getUniqueId(),cb);
|
||||
if (PlayerUtils.isTrusted(p)) {
|
||||
holder.addToExisting();
|
||||
if (Sentinel.getInstance().getDirector().whitelistManager.autoWhitelist.contains(p.getUniqueId())) holder.addToWhitelist();
|
||||
if (Sentinel.getInstance().getDirector().whitelistManager.autoWhitelist.contains(p.getUniqueId())) holder.addAndWhitelist();
|
||||
holder.add();
|
||||
return;
|
||||
}
|
||||
|
||||
if (!Sentinel.getInstance().getDirector().io.violationConfig.commandBlockPlace.enabled) {
|
||||
holder.addToExisting();
|
||||
holder.add();
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user