Merge pull request 'Add CommandTNT with extension explode message' (#189) from ExtensionTNT into master
Reviewed-by: Lixfel <lixfel@steamwar.de>
Dieser Commit ist enthalten in:
Commit
02d509a3ab
@ -55,10 +55,6 @@ public class CommandTNT implements CommandExecutor, Listener {
|
||||
Bukkit.getPluginManager().registerEvents(this, BauSystem.getPlugin());
|
||||
}
|
||||
|
||||
private String getNoPermMessage() {
|
||||
return "§cDu darfst hier nicht TNT-Schaden (de-)aktivieren";
|
||||
}
|
||||
|
||||
private String getEnableMessage() {
|
||||
return "§aTNT-Schaden aktiviert";
|
||||
}
|
||||
@ -71,17 +67,13 @@ public class CommandTNT implements CommandExecutor, Listener {
|
||||
return "§aTNT-Schaden außerhalb Baurahmen aktiviert";
|
||||
}
|
||||
|
||||
private String getDamageMessage() {
|
||||
return "§cEine Explosion hätte Blöcke im Baubereich zerstört";
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean onCommand(CommandSender sender, Command command, String s, String[] args) {
|
||||
if (!(sender instanceof Player)) return false;
|
||||
Player player = (Player) sender;
|
||||
|
||||
if (Welt.noPermission(player, Permission.world)) {
|
||||
player.sendMessage(BauSystem.PREFIX + getNoPermMessage());
|
||||
player.sendMessage(BauSystem.PREFIX + "§cDu darfst hier nicht TNT-Schaden (de-)aktivieren");
|
||||
return false;
|
||||
}
|
||||
|
||||
@ -143,13 +135,16 @@ public class CommandTNT implements CommandExecutor, Listener {
|
||||
public void onExplode(EntityExplodeEvent event) {
|
||||
event.blockList().removeIf(block -> {
|
||||
Region region = Region.getRegion(block.getLocation());
|
||||
if (region.getTntMode() == TNTMode.OFF) return true;
|
||||
if (region.getTntMode() == TNTMode.ON) return false;
|
||||
if (region.hasBuildRegion() && region.inBuildRegion(block.getLocation())) {
|
||||
RegionToggleCommand.actionBar(region, getDamageMessage());
|
||||
RegionToggleCommand.actionBar(region, "§cEine Explosion hätte Blöcke im Baubereich zerstört");
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
if (region.hasBuildRegion() && region.inBuildRegionExtension(block.getLocation())) {
|
||||
RegionToggleCommand.actionBar(region, "§cEine Explosion hätte Blöcke im Ausfahrbereich zerstört");
|
||||
return true;
|
||||
}
|
||||
return region.getTntMode() == TNTMode.OFF;
|
||||
});
|
||||
}
|
||||
|
||||
|
@ -162,6 +162,10 @@ public class Region {
|
||||
return prototype.buildArea.inRegion(this, l);
|
||||
}
|
||||
|
||||
public boolean inBuildRegionExtension(Location l) {
|
||||
return prototype.buildArea.inRegionExtension(this, l);
|
||||
}
|
||||
|
||||
public void fastreset(){
|
||||
prototype.fastreset(this);
|
||||
}
|
||||
@ -212,11 +216,6 @@ public class Region {
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean inBuildRegion(Location l) {
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean hasTestblock() {
|
||||
return false;
|
||||
@ -288,6 +287,12 @@ public class Region {
|
||||
inRange(l.getZ(), region.minZ + offsetZ, sizeZ);
|
||||
}
|
||||
|
||||
public boolean inRegionExtension(Region region, Location l) {
|
||||
return inRange(l.getX(), region.minX + offsetX - extensionAxisX + 1, sizeX + extensionAxisX * 2 - 1) &&
|
||||
inRange(l.getY(), region.minY + offsetY, sizeY + extensionPositiveY - 1) &&
|
||||
inRange(l.getZ(), region.minZ + offsetZ - extensionNegativeZ + 1, sizeZ + extensionNegativeZ - 1 + extensionPositiveZ);
|
||||
}
|
||||
|
||||
public void fastreset(Region region){
|
||||
File file = new File(schematic);
|
||||
int x = region.minX + offsetX + sizeX/2;
|
||||
|
In neuem Issue referenzieren
Einen Benutzer sperren