Fix CommandTNT
Fix RegionToggleCommand
Dieser Commit ist enthalten in:
Ursprung
ea345fb46c
Commit
041741bc75
@ -116,31 +116,32 @@ public class CommandTNT implements CommandExecutor, Listener {
|
||||
}
|
||||
}
|
||||
|
||||
TNTMode finalRequestedMode = requestedMode;
|
||||
String finalRequestedMessage = requestedMessage;
|
||||
Region.getRegion(player.getLocation(), region -> {
|
||||
if (finalRequestedMode != null) {
|
||||
region.setTntMode(finalRequestedMode);
|
||||
RegionToggleCommand.actionBar(region, finalRequestedMessage);
|
||||
return;
|
||||
}
|
||||
switch (region.getTntMode()) {
|
||||
case ON:
|
||||
case ONLY_TB:
|
||||
region.setTntMode(TNTMode.OFF);
|
||||
RegionToggleCommand.actionBar(region, getDisableMessage());
|
||||
break;
|
||||
case OFF:
|
||||
if (Region.buildAreaEnabled()) {
|
||||
region.setTntMode(TNTMode.ONLY_TB);
|
||||
RegionToggleCommand.actionBar(region, getTestblockEnableMessage());
|
||||
} else {
|
||||
region.setTntMode(TNTMode.ON);
|
||||
RegionToggleCommand.actionBar(region, getEnableMessage());
|
||||
}
|
||||
break;
|
||||
}
|
||||
}, () -> RegionToggleCommand.actionBar(player, getNoRegionMessage()));
|
||||
Region region = Region.getRegion(player.getLocation());
|
||||
if (region == null) {
|
||||
RegionToggleCommand.actionBar(player, getNoRegionMessage());
|
||||
return false;
|
||||
}
|
||||
if (requestedMode != null) {
|
||||
region.setTntMode(requestedMode);
|
||||
RegionToggleCommand.actionBar(region, requestedMessage);
|
||||
return false;
|
||||
}
|
||||
switch (region.getTntMode()) {
|
||||
case ON:
|
||||
case ONLY_TB:
|
||||
region.setTntMode(TNTMode.OFF);
|
||||
RegionToggleCommand.actionBar(region, getDisableMessage());
|
||||
break;
|
||||
case OFF:
|
||||
if (Region.buildAreaEnabled()) {
|
||||
region.setTntMode(TNTMode.ONLY_TB);
|
||||
RegionToggleCommand.actionBar(region, getTestblockEnableMessage());
|
||||
} else {
|
||||
region.setTntMode(TNTMode.ON);
|
||||
RegionToggleCommand.actionBar(region, getEnableMessage());
|
||||
}
|
||||
break;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
|
@ -52,13 +52,16 @@ public abstract class RegionToggleCommand implements CommandExecutor, Listener {
|
||||
return false;
|
||||
}
|
||||
|
||||
Region.getRegion(player.getLocation(), region -> {
|
||||
if (toggle(region)) {
|
||||
actionBar(region, getEnableMessage());
|
||||
} else {
|
||||
actionBar(region, getDisableMessage());
|
||||
}
|
||||
}, () -> actionBar(player, getNoRegionMessage()));
|
||||
Region region = Region.getRegion(player);
|
||||
if (region == null) {
|
||||
actionBar(player, getNoRegionMessage());
|
||||
return false;
|
||||
}
|
||||
if (toggle(region)) {
|
||||
actionBar(region, getEnableMessage());
|
||||
} else {
|
||||
actionBar(region, getDisableMessage());
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
|
In neuem Issue referenzieren
Einen Benutzer sperren