Fix DevServer kicking every member not added Fix WarpListener for 1.20+
Dieser Commit ist enthalten in:
Ursprung
ab6c762323
Commit
2829706d6b
@ -52,6 +52,7 @@ public class BauSystem extends JavaPlugin implements Listener {
|
||||
|
||||
// This should be treated as final!
|
||||
public static Message MESSAGE;
|
||||
public static final boolean DEV_SERVER = !System.getProperty("user.home").endsWith("minecraft");
|
||||
|
||||
@Getter
|
||||
private static BauSystem instance;
|
||||
|
@ -44,6 +44,7 @@ public class DesignEndStone {
|
||||
private REntityServer entityServer = new REntityServer();
|
||||
private List<REntity> entities = new ArrayList<>();
|
||||
private Set<Location> locations = new HashSet<>();
|
||||
private boolean wsOrAs;
|
||||
private double maxBlastResistance;
|
||||
|
||||
public DesignEndStone(Region region) {
|
||||
@ -53,7 +54,17 @@ public class DesignEndStone {
|
||||
this.maxX = region.getMaxPointBuild().getX();
|
||||
this.maxY = region.getMaxPointBuild().getY();
|
||||
this.maxZ = region.getMaxPointBuild().getZ();
|
||||
maxBlastResistance = region.getName().startsWith("ws") || region.getName().startsWith("as") ? 6.0 : 9.0;
|
||||
wsOrAs = region.getName().startsWith("ws") || region.getName().startsWith("as");
|
||||
maxBlastResistance = wsOrAs ? 6.1 : 9.0;
|
||||
|
||||
entityServer.setCallback((player, rEntity, entityAction) -> {
|
||||
if (entityAction != REntityServer.EntityAction.ATTACK) return;
|
||||
Location location = new Location(WORLD, rEntity.getX(), rEntity.getY(), rEntity.getZ());
|
||||
Bukkit.getScheduler().runTaskLater(BauSystem.getInstance(), () -> {
|
||||
location.getBlock().breakNaturally();
|
||||
calc();
|
||||
}, 1);
|
||||
});
|
||||
}
|
||||
|
||||
public void calc() {
|
||||
@ -65,7 +76,23 @@ public class DesignEndStone {
|
||||
calc(minX, minY, maxZ, maxX, maxY, maxZ, 0, 0, -1, maxZ - minZ);
|
||||
calc(minX, minY, minZ, minX, maxY, maxZ, 1, 0, 0, maxX - minX);
|
||||
calc(maxX, minY, minZ, maxX, maxY, maxZ, -1, 0, 0, maxX - minX);
|
||||
// calc(minX, minY, minZ, maxX, minY, maxZ, 0, 1, 0, maxY - minY);
|
||||
if (wsOrAs) {
|
||||
calc(minX, minY, minZ, maxX, minY, maxZ, 0, 1, 0, maxY - minY + 1);
|
||||
} else {
|
||||
int airBlocks = 0;
|
||||
double minAirBlocks = (maxX - minX) * (maxZ - minZ) * 0.1;
|
||||
for (int x = minX; x < maxX; x++) {
|
||||
for (int z = minZ; z < maxZ; z++) {
|
||||
if (WORLD.getBlockAt(x, minY, z).getType().isAir()) {
|
||||
airBlocks++;
|
||||
if (airBlocks > minAirBlocks) break;
|
||||
}
|
||||
}
|
||||
}
|
||||
if (airBlocks > minAirBlocks) {
|
||||
calc(minX, minY, minZ, maxX, minY, maxZ, 0, 1, 0, maxY - minY + 1);
|
||||
}
|
||||
}
|
||||
calc(minX, maxY, minZ, maxX, maxY, maxZ, 0, -1, 0, maxY - minY + 1);
|
||||
}
|
||||
|
||||
@ -79,15 +106,15 @@ public class DesignEndStone {
|
||||
int cz = z + step * dirZ;
|
||||
Material material = WORLD.getBlockAt(cx, cy, cz).getType();
|
||||
|
||||
if (material.getBlastResistance() >= maxBlastResistance) {
|
||||
if (material != Material.WATER && material != Material.LAVA && material.getBlastResistance() >= maxBlastResistance) {
|
||||
Location location = new Location(WORLD, cx + 0.5, cy, cz + 0.5);
|
||||
if (locations.contains(location)) break;
|
||||
if (!locations.add(location)) break;
|
||||
RFallingBlockEntity entity = new RFallingBlockEntity(entityServer, location, Material.RED_STAINED_GLASS);
|
||||
entity.setNoGravity(true);
|
||||
entity.setGlowing(true);
|
||||
entities.add(entity);
|
||||
break;
|
||||
} else if (!material.isAir()) {
|
||||
} else if (!material.isAir() && material != Material.WATER && material != Material.LAVA) {
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
@ -20,6 +20,7 @@
|
||||
package de.steamwar.bausystem.features.warp;
|
||||
|
||||
import de.steamwar.bausystem.region.Region;
|
||||
import de.steamwar.core.Core;
|
||||
import de.steamwar.entity.RArmorStand;
|
||||
import de.steamwar.entity.REntityServer;
|
||||
import de.steamwar.linkage.Linked;
|
||||
@ -107,9 +108,9 @@ public class WarpListener implements Listener {
|
||||
vector.setY(0);
|
||||
|
||||
Vector position = p.getLocation().toVector().clone().add(vector.normalize().multiply(5));
|
||||
position.setY(p.getLocation().getY() - 1);
|
||||
position.setY(p.getLocation().getY() - (Core.getVersion() >= 20 ? 0 : 1));
|
||||
|
||||
if (position.distanceSquared(current) < 0.1) {
|
||||
if ((position.getX() - current.getX()) * (position.getX() - current.getX()) + (position.getZ() - current.getZ()) * (position.getZ() - current.getZ()) < 0.1) {
|
||||
name = "§a§l" + name;
|
||||
selected.computeIfAbsent(p, player -> new ArrayList<>()).add(location);
|
||||
}
|
||||
|
@ -19,6 +19,7 @@
|
||||
|
||||
package de.steamwar.bausystem.features.world;
|
||||
|
||||
import de.steamwar.bausystem.BauSystem;
|
||||
import de.steamwar.bausystem.config.BauServer;
|
||||
import de.steamwar.linkage.Linked;
|
||||
import de.steamwar.sql.BauweltMember;
|
||||
@ -34,6 +35,7 @@ public class AntiBauAddMemberFix implements Listener {
|
||||
|
||||
@EventHandler(priority = EventPriority.LOW)
|
||||
public void onPlayerJoin(PlayerJoinEvent event) {
|
||||
if (BauSystem.DEV_SERVER) return;
|
||||
if (event.getPlayer().getUniqueId().equals(BauServer.getInstance().getOwner())) {
|
||||
return;
|
||||
}
|
||||
|
@ -41,6 +41,7 @@ import org.bukkit.event.block.BlockMultiPlaceEvent;
|
||||
import org.bukkit.event.block.BlockPlaceEvent;
|
||||
import org.bukkit.event.entity.EntityPickupItemEvent;
|
||||
import org.bukkit.event.player.*;
|
||||
import org.bukkit.util.Vector;
|
||||
|
||||
import java.util.HashSet;
|
||||
import java.util.Set;
|
||||
@ -116,9 +117,11 @@ public class SpectatorListener implements Listener {
|
||||
|
||||
private static void resendChunks(Player player) {
|
||||
Location location = player.getLocation().clone();
|
||||
player.teleport(location.clone().add(16.0 * player.getClientViewDistance(), 0, 16.0 * player.getClientViewDistance()));
|
||||
Vector velocity = player.getVelocity().clone();
|
||||
player.teleport(location.clone().add(16.0 * player.getClientViewDistance() + 32, 0, 16.0 * player.getClientViewDistance() + 32));
|
||||
Bukkit.getScheduler().runTaskLater(BauSystem.getInstance(), () -> {
|
||||
player.teleport(location);
|
||||
player.setVelocity(velocity);
|
||||
}, 5);
|
||||
}
|
||||
|
||||
@ -128,6 +131,7 @@ public class SpectatorListener implements Listener {
|
||||
|
||||
@EventHandler
|
||||
public void onPlayerJoin(PlayerJoinEvent event) {
|
||||
if (BauSystem.DEV_SERVER) return;
|
||||
if (event.getPlayer().getUniqueId().equals(BauServer.getInstance().getOwner())) {
|
||||
return;
|
||||
}
|
||||
@ -148,7 +152,7 @@ public class SpectatorListener implements Listener {
|
||||
|
||||
@EventHandler
|
||||
public void onBauMemberUpdate(BauMemberUpdateEvent event) {
|
||||
if (!anySupervisorOnline(null)) {
|
||||
if (!anySupervisorOnline(null) && !BauSystem.DEV_SERVER) {
|
||||
Bukkit.getOnlinePlayers().forEach(player -> {
|
||||
player.kickPlayer("");
|
||||
});
|
||||
@ -165,6 +169,7 @@ public class SpectatorListener implements Listener {
|
||||
@EventHandler
|
||||
public void onPlayerQuit(PlayerQuitEvent event) {
|
||||
NO_TECHHIDER.remove(event.getPlayer());
|
||||
if (BauSystem.DEV_SERVER) return;
|
||||
if (!anySupervisorOnline(event.getPlayer())) {
|
||||
Bukkit.getOnlinePlayers().forEach(player -> {
|
||||
player.kickPlayer("");
|
||||
|
In neuem Issue referenzieren
Einen Benutzer sperren