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