Fix last stuff
Dieser Commit ist enthalten in:
Ursprung
e0e3eb2a84
Commit
ddcbec834e
@ -41,7 +41,7 @@ public class CommandInfo implements CommandExecutor {
|
|||||||
Player player = (Player) sender;
|
Player player = (Player) sender;
|
||||||
|
|
||||||
sender.sendMessage(BauSystem.PREFIX + "Besitzer: §e" + SteamwarUser.get(BauSystem.getOwnerID()).getUserName());
|
sender.sendMessage(BauSystem.PREFIX + "Besitzer: §e" + SteamwarUser.get(BauSystem.getOwnerID()).getUserName());
|
||||||
Region region = Region.getRegion(player);
|
Region region = Region.getRegion(player.getLocation());
|
||||||
if (region == null) {
|
if (region == null) {
|
||||||
sender.sendMessage(BauSystem.PREFIX + "§eTNT§8: " + Region.NoRegion.tnt.getName() + " §eFire§8: " + (Region.NoRegion.fire ? "§aAUS" : "§cAN") + " §eFreeze§8: " + (Region.NoRegion.freeze ? "§aAN" : "§cAUS"));
|
sender.sendMessage(BauSystem.PREFIX + "§eTNT§8: " + Region.NoRegion.tnt.getName() + " §eFire§8: " + (Region.NoRegion.fire ? "§aAUS" : "§cAN") + " §eFreeze§8: " + (Region.NoRegion.freeze ? "§aAN" : "§cAUS"));
|
||||||
} else {
|
} else {
|
||||||
|
@ -45,7 +45,7 @@ public class CommandProtect implements CommandExecutor {
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
Region region = Region.getRegion(player);
|
Region region = Region.getRegion(player.getLocation());
|
||||||
if (region == null || !region.hasProtection()) {
|
if (region == null || !region.hasProtection()) {
|
||||||
player.sendMessage(BauSystem.PREFIX + "§cDu befindest dich derzeit in keiner (M)WG-Region");
|
player.sendMessage(BauSystem.PREFIX + "§cDu befindest dich derzeit in keiner (M)WG-Region");
|
||||||
return false;
|
return false;
|
||||||
|
@ -45,7 +45,7 @@ public class CommandReset implements CommandExecutor {
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
Region region = Region.getRegion(player);
|
Region region = Region.getRegion(player.getLocation());
|
||||||
if (region == null) {
|
if (region == null) {
|
||||||
player.sendMessage(BauSystem.PREFIX + "§cDu befindest dich derzeit in keiner Region");
|
player.sendMessage(BauSystem.PREFIX + "§cDu befindest dich derzeit in keiner Region");
|
||||||
return false;
|
return false;
|
||||||
|
@ -45,7 +45,7 @@ public class CommandTestblock implements CommandExecutor {
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
Region region = Region.getRegion(player);
|
Region region = Region.getRegion(player.getLocation());
|
||||||
if (region == null || !region.hasTestblock()) {
|
if (region == null || !region.hasTestblock()) {
|
||||||
player.sendMessage(BauSystem.PREFIX + "§cDu befindest dich derzeit in keiner Region");
|
player.sendMessage(BauSystem.PREFIX + "§cDu befindest dich derzeit in keiner Region");
|
||||||
return false;
|
return false;
|
||||||
|
@ -51,7 +51,7 @@ public abstract class RegionToggleCommand implements CommandExecutor, Listener {
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
Region region = Region.getRegion(player);
|
Region region = Region.getRegion(player.getLocation());
|
||||||
if (region == null) {
|
if (region == null) {
|
||||||
if (toggleGlobal()) {
|
if (toggleGlobal()) {
|
||||||
actionBar(player, getEnableMessage());
|
actionBar(player, getEnableMessage());
|
||||||
|
@ -59,7 +59,7 @@ public class BauScoreboard implements Listener {
|
|||||||
strings.add("§1");
|
strings.add("§1");
|
||||||
strings.add("§eUhrzeit§8: §7" + new SimpleDateFormat("HH:mm:ss").format(Calendar.getInstance().getTime()));
|
strings.add("§eUhrzeit§8: §7" + new SimpleDateFormat("HH:mm:ss").format(Calendar.getInstance().getTime()));
|
||||||
strings.add("§2");
|
strings.add("§2");
|
||||||
Region region = Region.getRegion(p);
|
Region region = Region.getRegion(p.getLocation());
|
||||||
if (region != null) {
|
if (region != null) {
|
||||||
strings.add("§eTNT§8: " + region.getTntMode().getName());
|
strings.add("§eTNT§8: " + region.getTntMode().getName());
|
||||||
strings.add("§eFreeze§8: " + (region.isFreeze() ? "§aan" : "§caus"));
|
strings.add("§eFreeze§8: " + (region.isFreeze() ? "§aan" : "§caus"));
|
||||||
|
@ -29,7 +29,6 @@ import org.bukkit.Location;
|
|||||||
import org.bukkit.configuration.ConfigurationSection;
|
import org.bukkit.configuration.ConfigurationSection;
|
||||||
import org.bukkit.configuration.InvalidConfigurationException;
|
import org.bukkit.configuration.InvalidConfigurationException;
|
||||||
import org.bukkit.configuration.file.YamlConfiguration;
|
import org.bukkit.configuration.file.YamlConfiguration;
|
||||||
import org.bukkit.entity.Player;
|
|
||||||
|
|
||||||
import java.io.File;
|
import java.io.File;
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
@ -74,10 +73,6 @@ public class Region {
|
|||||||
return buildArea;
|
return buildArea;
|
||||||
}
|
}
|
||||||
|
|
||||||
public static Region getRegion(Player player) {
|
|
||||||
return getRegion(player.getLocation());
|
|
||||||
}
|
|
||||||
|
|
||||||
public static Region getRegion(Location location) {
|
public static Region getRegion(Location location) {
|
||||||
for (Region region : regions) {
|
for (Region region : regions) {
|
||||||
if (region.inRegion(location)) return region;
|
if (region.inRegion(location)) return region;
|
||||||
@ -93,20 +88,7 @@ public class Region {
|
|||||||
b = false;
|
b = false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (b) {
|
if (b) noRegion.run();
|
||||||
noRegion.run();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
public static List<Region> getRegions(){
|
|
||||||
return regions;
|
|
||||||
}
|
|
||||||
|
|
||||||
private static Region getRegionByName(String name) {
|
|
||||||
for (Region region : regions) {
|
|
||||||
if (region.name.equals(name)) return region;
|
|
||||||
}
|
|
||||||
return null;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private final String name;
|
private final String name;
|
||||||
@ -131,9 +113,20 @@ public class Region {
|
|||||||
regions.add(this);
|
regions.add(this);
|
||||||
}
|
}
|
||||||
|
|
||||||
private void link() {
|
private void setLinkedRegion(Consumer<Region> regionConsumer) {
|
||||||
if (optionsLinkedWith != null && linkedRegion == null) {
|
if (optionsLinkedWith == null) {
|
||||||
linkedRegion = getRegionByName(optionsLinkedWith);
|
return;
|
||||||
|
}
|
||||||
|
if (linkedRegion != null) {
|
||||||
|
regionConsumer.accept(linkedRegion);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
for (Region region : regions) {
|
||||||
|
if (region.name.equals(name)) {
|
||||||
|
linkedRegion = region;
|
||||||
|
regionConsumer.accept(linkedRegion);
|
||||||
|
return;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -143,14 +136,7 @@ public class Region {
|
|||||||
|
|
||||||
public void setTntMode(TNTMode tntMode) {
|
public void setTntMode(TNTMode tntMode) {
|
||||||
this.tntMode = tntMode;
|
this.tntMode = tntMode;
|
||||||
link();
|
setLinkedRegion(region -> region.tntMode = tntMode);
|
||||||
if (linkedRegion != null) {
|
|
||||||
linkedRegion.setTntModeOther(tntMode);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
private void setTntModeOther(TNTMode tntMode) {
|
|
||||||
this.tntMode = tntMode;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean isFreeze() {
|
public boolean isFreeze() {
|
||||||
@ -159,14 +145,7 @@ public class Region {
|
|||||||
|
|
||||||
public void setFreeze(boolean freeze) {
|
public void setFreeze(boolean freeze) {
|
||||||
this.freeze = freeze;
|
this.freeze = freeze;
|
||||||
link();
|
setLinkedRegion(region -> region.freeze = freeze);
|
||||||
if (linkedRegion != null) {
|
|
||||||
linkedRegion.setFreezeOther(freeze);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setFreezeOther(boolean freeze) {
|
|
||||||
this.freeze = freeze;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean isFire() {
|
public boolean isFire() {
|
||||||
@ -175,14 +154,7 @@ public class Region {
|
|||||||
|
|
||||||
public void setFire(boolean fire) {
|
public void setFire(boolean fire) {
|
||||||
this.fire = fire;
|
this.fire = fire;
|
||||||
link();
|
setLinkedRegion(region -> region.fire = fire);
|
||||||
if (linkedRegion != null) {
|
|
||||||
linkedRegion.setFireOther(fire);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setFireOther(boolean fire) {
|
|
||||||
this.fire = fire;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean inRegion(Location l){
|
public boolean inRegion(Location l){
|
||||||
|
@ -282,7 +282,7 @@ public class ScriptListener implements Listener {
|
|||||||
}
|
}
|
||||||
|
|
||||||
private static int getValue(ScriptExecutor scriptExecutor, String key) {
|
private static int getValue(ScriptExecutor scriptExecutor, String key) {
|
||||||
Region region = Region.getRegion(scriptExecutor.player);
|
Region region = Region.getRegion(scriptExecutor.player.getLocation());
|
||||||
switch (key) {
|
switch (key) {
|
||||||
case "trace":
|
case "trace":
|
||||||
return RecordStateMachine.getRecordStatus().isTracing() ? 1 : 0;
|
return RecordStateMachine.getRecordStatus().isTracing() ? 1 : 0;
|
||||||
|
In neuem Issue referenzieren
Einen Benutzer sperren