Format code

This commit is contained in:
2026-05-16 23:08:09 +02:00
parent 81dd8045f2
commit d110df924e
562 changed files with 11025 additions and 10059 deletions
@@ -49,9 +49,9 @@ public class Fightserver {
Instant timeout = Instant.now().minus(5, ChronoUnit.SECONDS);
Iterator<Map.Entry<String, Fightserver>> it = servers.entrySet().iterator();
while(it.hasNext()) {
while (it.hasNext()) {
Map.Entry<String, Fightserver> server = it.next();
if(timeout.isAfter(server.getValue().lastUpdate)) {
if (timeout.isAfter(server.getValue().lastUpdate)) {
server.getValue().remove();
it.remove();
}
@@ -76,7 +76,7 @@ public class Fightserver {
private void setupPortal(String gameMode) {
FightserverPortal portal = FightserverPortal.findFree(gameMode);
if(portal == null)
if (portal == null)
return;
portals.add(portal);
@@ -107,7 +107,7 @@ public class Fightserver {
}
private <T> void update(T old, T current, Consumer<FightserverPortal> observer) {
if(!old.equals(current))
if (!old.equals(current))
portals.forEach(observer);
}
@@ -19,8 +19,8 @@
PREFIX = §eLobby§8System§8»§7
TIME = HH:mm:ss
DATE=........
COMMAND_HELP_HEAD=§7---=== (§e{0}§7) ===---
DATE = ........
COMMAND_HELP_HEAD = §7---=== (§e{0}§7) ===---
# ServerTeamNPC's
NPC_CHAT_0 = §fHello, I''m {0} and I''m a(n) {1}§f.
@@ -306,7 +306,7 @@ EASTER_EGG_88 = Advertisement
EASTER_EGG_89 = Stairway to heaven
# Advent Calendar
ADVENT_CALENDAR_TITLE=§eAdvent Calendar
ADVENT_CALENDAR_DAY=§7Day§8: §e{0}
ADVENT_CALENDAR_MESSAGE=§eDid you already open your advent calendar? Click the Big Presents to claim!
ADVENT_CALENDAR_OPEN=§7You got §e{0} §7from the advent calendar!
ADVENT_CALENDAR_TITLE = §eAdvent Calendar
ADVENT_CALENDAR_DAY = §7Day§8: §e{0}
ADVENT_CALENDAR_MESSAGE = §eDid you already open your advent calendar? Click the Big Presents to claim!
ADVENT_CALENDAR_OPEN = §7You got §e{0} §7from the advent calendar!
@@ -19,8 +19,8 @@
PREFIX = §eLobby§8System§8»
TIME = HH:mm:ss
DATE=........
COMMAND_HELP_HEAD=§7---=== (§e{0}§7) ===---
DATE = ........
COMMAND_HELP_HEAD = §7---=== (§e{0}§7) ===---
# ServerTeamNPC's
NPC_CHAT_0 = §fHallo, ich bin {0} und bin ein {1}§f.
@@ -290,7 +290,7 @@ EASTER_EGG_88 = Werbung
EASTER_EGG_89 = Stairway to heaven
# Advent Calendar
ADVENT_CALENDAR_TITLE=§eAdventskalender
ADVENT_CALENDAR_DAY=§7Tag§8: §e{0}
ADVENT_CALENDAR_MESSAGE=§eHast du heute schon dein Geschenk geholt? Klicke die großen Geschenke zum erhalten!
ADVENT_CALENDAR_OPEN=§7Du hast §e{0}§7 aus dem Adventskalender erhalten!
ADVENT_CALENDAR_TITLE = §eAdventskalender
ADVENT_CALENDAR_DAY = §7Tag§8: §e{0}
ADVENT_CALENDAR_MESSAGE = §eHast du heute schon dein Geschenk geholt? Klicke die großen Geschenke zum erhalten!
ADVENT_CALENDAR_OPEN = §7Du hast §e{0}§7 aus dem Adventskalender erhalten!
@@ -85,14 +85,14 @@ public class BoatRace implements EventListener, Listener {
lastDistance = event.getFrom().distance(event.getTo());
if(nextCheckpoint == 0 && inRegion(player, BoatRacePositions.BACKWARDS[0], BoatRacePositions.BACKWARDS[1])) {
if (nextCheckpoint == 0 && inRegion(player, BoatRacePositions.BACKWARDS[0], BoatRacePositions.BACKWARDS[1])) {
player.eject();
player.teleport(BoatRacePositions.END);
oneNotStarted = false;
return;
}
if(player.getLocation().getY() < MIN_HEIGHT) {
if (player.getLocation().getY() < MIN_HEIGHT) {
Location[] backTo = BoatRacePositions.CHECKPOINTS[nextCheckpoint - 1];
Location avg = new Location(backTo[0].getWorld(), (backTo[0].getX() + backTo[1].getX()) / 2, Math.max(backTo[0].getY(), backTo[1].getY()), (backTo[0].getZ() + backTo[1].getZ()) / 2, backTo[0].getYaw(), backTo[0].getPitch());
Boat nboat = Bukkit.getWorlds().get(0).spawn(avg, Boat.class);
@@ -107,8 +107,8 @@ public class BoatRace implements EventListener, Listener {
}
Location[] checkpoint = BoatRacePositions.CHECKPOINTS[nextCheckpoint];
if(inRegion(player, checkpoint[0], checkpoint[1])) {
if(nextCheckpoint == 0) {
if (inRegion(player, checkpoint[0], checkpoint[1])) {
if (nextCheckpoint == 0) {
oneNotStarted = false;
startTime = System.currentTimeMillis();
bossBar.addPlayer(player);
@@ -30,36 +30,36 @@ public class BoatRacePositions {
public static final Location START = loc(2410.5, 6, 1537.5, -90, 0);
public static final Location[][] CHECKPOINTS = new Location[][] {
new Location[] {
public static final Location[][] CHECKPOINTS = new Location[][]{
new Location[]{
loc(2414, 4, 1528, -90, 0),
loc(2415, 8, 1542),
},
new Location[] {
new Location[]{
loc(2484, 4, 1456, -180, 0),
loc(2494, 8, 1459),
},
new Location[] {
new Location[]{
loc(2310, 4, 1475, 0, 0),
loc(2321, 8, 1477),
},
new Location[] {
new Location[]{
loc(2428, 4, 1448, -90, 0),
loc(2430, 8, 1458),
},
new Location[] {
new Location[]{
loc(2392, 4, 1492, 90, 0),
loc(2394, 8, 1502),
},
new Location[] {
new Location[]{
loc(2414, 4, 1528, -90, 0),
loc(2416, 8, 1542),
},
};
public static final Location[] BACKWARDS = new Location[] {
loc(2407, 3,1526),
loc(2408, 9,1544)
public static final Location[] BACKWARDS = new Location[]{
loc(2407, 3, 1526),
loc(2408, 9, 1544)
};
public static final Location END = loc(2449.5, 6, 1550, -180, 0);
@@ -53,17 +53,17 @@ public class ModifyCommand extends SWCommand implements Listener {
@Register
public void modify(Player player) {
SteamwarUser user = SteamwarUser.get(player.getUniqueId());
if(!user.hasPerm(UserPerm.ADMINISTRATION)) {
if (!user.hasPerm(UserPerm.ADMINISTRATION)) {
return;
}
if(modifying(player)) {
if (modifying(player)) {
modifying.remove(player);
LobbySystem.getEntityServer(true).removePlayer(player);
player.setGameMode(GameMode.ADVENTURE);
player.setOp(false);
PlayerSpawn.giveItems(player);
}else {
} else {
modifying.add(player);
LobbySystem.getEntityServer(true).addPlayer(player);
player.setGameMode(GameMode.CREATIVE);
@@ -82,9 +82,9 @@ public class ModifyCommand extends SWCommand implements Listener {
@Register("waitinghallspawn")
public void setWaitingHallSpawn(Player player) {
SteamwarUser user = SteamwarUser.get(player.getUniqueId());
if(!user.hasPerm(UserPerm.ADMINISTRATION))
if (!user.hasPerm(UserPerm.ADMINISTRATION))
return;
LobbySystem.config().setWaitingHallSpawn(player.getLocation());
}
}
@@ -128,7 +128,7 @@ public class PortalCommand extends SWCommand {
private Location locationOfPlayer(Player player) {
Location l = player.getLocation();
l.setYaw(((CraftPlayer)player).getHandle().getYHeadRot());
l.setYaw(((CraftPlayer) player).getHandle().getYHeadRot());
return l;
}
@@ -136,14 +136,14 @@ public class PortalCommand extends SWCommand {
public void portalRemoveBlue(Player player, Portal portal, int i) {
if (noPermissions(player)) return;
FightserverPortal handler = (FightserverPortal) portal.getHandler();
handler.removeBlue(i-1);
handler.removeBlue(i - 1);
}
@Register({"removered"})
public void portalRemoveRed(Player player, Portal portal, int i) {
if (noPermissions(player)) return;
FightserverPortal handler = (FightserverPortal) portal.getHandler();
handler.removeRed(i-1);
handler.removeRed(i - 1);
}
@Register("remove")
@@ -180,7 +180,7 @@ public class PortalCommand extends SWCommand {
.getRegionSelector(BukkitAdapter.adapt(player.getWorld()));
try {
CuboidRegion region = (CuboidRegion)regionSelector.getRegion();
CuboidRegion region = (CuboidRegion) regionSelector.getRegion();
return new PortalLocations(adapt(player.getWorld(), region.getPos1()), adapt(player.getWorld(), region.getPos2()));
} catch (IncompleteRegionException e) {
LobbySystem.getMessage().send("PORTAL_NO_WORLDEDIT_SELECTION", player);
@@ -36,6 +36,7 @@ public class Hologram implements ConfigurationSerializable {
public static List<Hologram> getHolograms() {
return new ArrayList<>(holograms.values());
}
public static Hologram getHologram(String id) {
return holograms.get(id);
}
@@ -56,7 +57,7 @@ public class Hologram implements ConfigurationSerializable {
entity.setInvisible(true);
entity.setDisplayName(text);
if(id != null)
if (id != null)
holograms.put(id, this);
}
@@ -75,7 +76,7 @@ public class Hologram implements ConfigurationSerializable {
public void delete() {
entity.die();
if(id != null)
if (id != null)
holograms.remove(id);
}
@@ -48,7 +48,7 @@ public class AlphaWall implements Listener {
@EventHandler
public void onMove(PlayerMoveEvent event) {
Player player = event.getPlayer();
if(ModifyCommand.modifying(player) || allowed.apply(event.getTo()))
if (ModifyCommand.modifying(player) || allowed.apply(event.getTo()))
return;
Location to = event.getFrom().clone();
@@ -74,7 +74,7 @@ public class DoubleJumpListener implements Listener {
Player player = event.getPlayer();
if (JumpAndRun.isPlayerInJumpAndRun(player)) return;
if(player.getLocation().add(0, -1, 0).getBlock().getType() == Material.AIR) return;
if (player.getLocation().add(0, -1, 0).getBlock().getType() == Material.AIR) return;
if (LobbyPlayer.getLobbyPlayer(player).isFlying()) return;
player.setAllowFlight(true);
@@ -42,10 +42,10 @@ public class InventoryInteraction implements Listener {
@EventHandler
public void handlePlayerInteract(PlayerInteractEvent event) {
ItemStack item = event.getItem();
if(item == null)
if (item == null)
return;
if(item.getType() == Material.FIREWORK_ROCKET && (event.getAction() == Action.RIGHT_CLICK_AIR || event.getAction() == Action.RIGHT_CLICK_BLOCK)) {
if (item.getType() == Material.FIREWORK_ROCKET && (event.getAction() == Action.RIGHT_CLICK_AIR || event.getAction() == Action.RIGHT_CLICK_BLOCK)) {
int offset;
if (AdventsCalendar.active()) {
offset = -1;
@@ -59,7 +59,7 @@ public class InventoryInteraction implements Listener {
return;
}
if(!ModifyCommand.modifying(event.getPlayer()))
if (!ModifyCommand.modifying(event.getPlayer()))
event.setCancelled(true);
}
@@ -75,13 +75,13 @@ public class InventoryInteraction implements Listener {
@EventHandler(priority = EventPriority.LOWEST)
public void handleInventoryClick(InventoryClickEvent event) {
if(!ModifyCommand.modifying(event.getWhoClicked()))
if (!ModifyCommand.modifying(event.getWhoClicked()))
event.setCancelled(true);
}
@EventHandler
public void handlePlayerSwapHandItemsEvent(PlayerSwapHandItemsEvent event) {
if(!ModifyCommand.modifying(event.getPlayer()))
if (!ModifyCommand.modifying(event.getPlayer()))
event.setCancelled(true);
}
@@ -50,11 +50,11 @@ public class PlayerSeatListener implements Listener {
new BukkitRunnable() {
@Override
public void run() {
for(Arrow arrow : world.getEntitiesByClass(Arrow.class)) {
for (Arrow arrow : world.getEntitiesByClass(Arrow.class)) {
arrow.setTicksLived(1);
}
}
}.runTaskTimer(LobbySystem.getInstance(), 20*60,20*60);
}.runTaskTimer(LobbySystem.getInstance(), 20 * 60, 20 * 60);
}
@EventHandler
@@ -113,7 +113,7 @@ public class PlayerSeatListener implements Listener {
}
public Location getSeatLocation(Location location) {
return new Location(world,location.getBlockX(), location.getBlockY(), location.getBlockZ());
return new Location(world, location.getBlockX(), location.getBlockY(), location.getBlockZ());
}
private boolean isArrow(Entity entity) {
@@ -60,7 +60,7 @@ public class Portals implements Listener {
Player player = e.getPlayer();
Deque<Portal> lastPortals = portalStack.get(player);
if(!lastPortals.isEmpty() && lastPortals.peek() == portal)
if (!lastPortals.isEmpty() && lastPortals.peek() == portal)
return;
portal.handle(player, from, to);
@@ -35,10 +35,10 @@ public class TeleporterListener implements Listener {
private static final World world = Bukkit.getWorlds().get(0);
private static final Location spawn = world.getSpawnLocation().clone().add(0.5, 0, 0.5);
private static final Location team = new Location(world,2719.5, 59, 1311.5, -90, -5);
private static final Location map = new Location(world,2336.5,38,1423.5);
private static final Location bau = new Location(world,1951,66.1,1337, -38, -5);
private static final Location arenen = new Location(world,2255.5,21,1450.5);
private static final Location team = new Location(world, 2719.5, 59, 1311.5, -90, -5);
private static final Location map = new Location(world, 2336.5, 38, 1423.5);
private static final Location bau = new Location(world, 1951, 66.1, 1337, -38, -5);
private static final Location arenen = new Location(world, 2255.5, 21, 1450.5);
@EventHandler
public void handlePlayerInteract(PlayerInteractEvent event) {
@@ -47,7 +47,7 @@ public class WorldInteraction implements Listener {
if (!(event.getDamager() instanceof Player)) {
return;
}
if(!ModifyCommand.modifying((Player) event.getDamager())) {
if (!ModifyCommand.modifying((Player) event.getDamager())) {
event.setCancelled(true);
return;
}
@@ -71,28 +71,28 @@ public class WorldInteraction implements Listener {
@EventHandler
public void handleBlockBreak(BlockBreakEvent event) {
if(!ModifyCommand.modifying(event.getPlayer()))
if (!ModifyCommand.modifying(event.getPlayer()))
event.setCancelled(true);
}
@EventHandler
public void handleBlockPlace(BlockPlaceEvent event) {
if(!ModifyCommand.modifying(event.getPlayer()))
if (!ModifyCommand.modifying(event.getPlayer()))
event.setCancelled(true);
}
@EventHandler
public void handleHangingBreak(HangingBreakByEntityEvent event) {
if(!ModifyCommand.modifying((HumanEntity) event.getRemover()))
if (!ModifyCommand.modifying((HumanEntity) event.getRemover()))
event.setCancelled(true);
}
@EventHandler
public void handleGoldenPressurePlate(PlayerInteractEvent event) {
if(!ModifyCommand.modifying(event.getPlayer()) && (event.getAction() == Action.RIGHT_CLICK_BLOCK || event.getAction() == Action.LEFT_CLICK_BLOCK))
if (!ModifyCommand.modifying(event.getPlayer()) && (event.getAction() == Action.RIGHT_CLICK_BLOCK || event.getAction() == Action.LEFT_CLICK_BLOCK))
event.setCancelled(true);
if(!event.hasBlock() || event.getAction() != Action.PHYSICAL || event.getClickedBlock().getType() != Material.LIGHT_WEIGHTED_PRESSURE_PLATE)
if (!event.hasBlock() || event.getAction() != Action.PHYSICAL || event.getClickedBlock().getType() != Material.LIGHT_WEIGHTED_PRESSURE_PLATE)
return;
Player player = event.getPlayer();
@@ -106,7 +106,7 @@ public class WorldInteraction implements Listener {
@EventHandler
public void onPlayerArmorStandManipulate(PlayerArmorStandManipulateEvent event) {
if(!ModifyCommand.modifying(event.getPlayer()))
if (!ModifyCommand.modifying(event.getPlayer()))
event.setCancelled(true);
}
}
@@ -47,7 +47,7 @@ public class ColorInit {
} else {
try {
byte[] bytes = inputStream.readAllBytes();
if (bytes.length != 256*256*256) {
if (bytes.length != 256 * 256 * 256) {
throw new RuntimeException("Invalid colors.nearest file");
}
colors = bytes;
@@ -90,6 +90,7 @@ public class ParticleData {
} else {
lore.add(LobbySystem.getMessage().parse("PARTICLE_LOCKED", player));
}
return new SWItem(material, translatedName, lore, false, clickType -> {});
return new SWItem(material, translatedName, lore, false, clickType -> {
});
}
}
@@ -61,7 +61,7 @@ public class ParticleInventory {
};
public String convertToString(ParticleEnum particleEnum) {
return particleEnum.getClass().getSimpleName() + "@" + ((Enum<?>)particleEnum).name();
return particleEnum.getClass().getSimpleName() + "@" + ((Enum<?>) particleEnum).name();
}
public ParticleEnum convertFromString(String string) {
@@ -38,6 +38,7 @@ import java.util.stream.Collectors;
public interface ParticleRequirement {
String getRequirementName(Player player);
boolean test(SteamwarUser user, Set<Integer> eventTeilname, String eggHuntConfig);
ParticleRequirement SERVER_TEAM = new ParticleRequirement() {
@@ -38,7 +38,7 @@ public class PulseShimmer extends DelegatingParticleElement {
}
private double y(double time) {
return (8 * Math.pow(time, 2.2) - time) / (6.5 / 3.5) -0.1;
return (8 * Math.pow(time, 2.2) - time) / (6.5 / 3.5) - 0.1;
}
public PulseShimmer(ParticleElement particleElement, int speed, int rotationSpeed) {
@@ -56,7 +56,7 @@ public enum EventParticlePlacement implements ParticleEnum {
UnderwaterMWG(new ParticleData(Material.CYAN_CARPET, "PARTICLE_EVENT_RAIN_CLOUD", ParticleRequirement.eventPlacement(35, 9, 210),
new Always(new Delayed(new NonFlying(new Wing(new SimpleParticle(Particle.CRIT, 0, 0, 0, 0, 1), 0.15, WingDesign.SW)), 20)))
),
WarGearSeason2022(new ParticleData(Material.DIAMOND_HELMET, "PARTICLE_EVENT_WGS", ParticleRequirement.eventPlacement(37, 285, 210, 122),
WarGearSeason2022(new ParticleData(Material.DIAMOND_HELMET, "PARTICLE_EVENT_WGS", ParticleRequirement.eventPlacement(37, 285, 210, 122),
new Always(new Delayed(new NonFlying(new Wing(new SimpleParticle(Particle.FIREWORK, 0, 0, 0, 0, 1), 0.15, WingDesign.WGS)), 20)))
),
WargearClash(new ParticleData(Material.GOLDEN_SWORD, "PARTICLE_EVENT_WARGEARCLASH", ParticleRequirement.eventPlacement(38, 210, 158, 167, 286),
@@ -51,16 +51,16 @@ public enum PlayerParticle implements ParticleEnum {
new LocationMutator(new SimpleParticle(Particle.NOTE), 0, 2.2, 0))
),
NAUTILUS(new ParticleData(Material.NAUTILUS_SHELL, "PARTICLE_NAUTILUS",
new SimpleParticle(Particle.NAUTILUS, 0.2F, 0.2F ,0.2F, 0.01))
new SimpleParticle(Particle.NAUTILUS, 0.2F, 0.2F, 0.2F, 0.01))
),
SNOWBALL(new ParticleData(Material.SNOWBALL, "PARTICLE_SNOWBALL",
new SimpleParticle(Particle.SNOWFLAKE, 0.2F, 0.2F ,0.2F, 0.01))
new SimpleParticle(Particle.SNOWFLAKE, 0.2F, 0.2F, 0.2F, 0.01))
),
EFFECT(new ParticleData(Material.GLASS_BOTTLE, "PARTICLE_EFFECT",
new DustParticle(Particle.DUST, 0, 0.2F, 0, 0.01, 5, null))
),
CAMPFIRE(new ParticleData(Material.CAMPFIRE, "PARTICLE_CAMPFIRE",
new SimpleParticle(Particle.CAMPFIRE_COSY_SMOKE, 0, 0.2F ,0, 0.01))
new SimpleParticle(Particle.CAMPFIRE_COSY_SMOKE, 0, 0.2F, 0, 0.01))
),
MAGIC(new ParticleData(Material.CAULDRON, "PARTICLE_MAGIC",
new SimpleParticle(Particle.CRIT, 0.2F, 0.2F, 0.2F, 0.01))
@@ -107,7 +107,7 @@ public enum CustomEasterParticle implements ParticleEnum {
0.7,
0.5), location -> location.add(0, 0.6, 0)
))))
)
)
),
// TODO: Implement Gehfxhler!
// TODO: Implement SchwarzerFuerst
@@ -35,8 +35,8 @@ public enum CustomPlayerParticle implements ParticleEnum {
Haylim_(new ParticleData(Material.WHITE_CANDLE, "PARTICLE_PLAYER_HAYLIM_AURA", ParticleRequirement.specificPlayer(9426),
new Always(new NonMoving(new NonFlying(new Group(
new DoubleCircle(new YOffset(new SimpleParticle(Particle.ENCHANT, 0, 0, 0, 0.01, 5), 40, 0, 2, false, false), new YOffset(new SimpleParticle(Particle.ENCHANT, 0, 0, 0, 0.0,5), 40, 0, 2, true, false)),
new DoubleCircle(new YOffset(new SimpleParticle(Particle.ENCHANT, 0, 0, 0, 0.01, 5), 40, 0, 2, true, false), new YOffset(new SimpleParticle(Particle.ENCHANT, 0, 0, 0, 0.0,5), 40, 0, 2, false, false))
new DoubleCircle(new YOffset(new SimpleParticle(Particle.ENCHANT, 0, 0, 0, 0.01, 5), 40, 0, 2, false, false), new YOffset(new SimpleParticle(Particle.ENCHANT, 0, 0, 0, 0.0, 5), 40, 0, 2, true, false)),
new DoubleCircle(new YOffset(new SimpleParticle(Particle.ENCHANT, 0, 0, 0, 0.01, 5), 40, 0, 2, true, false), new YOffset(new SimpleParticle(Particle.ENCHANT, 0, 0, 0, 0.0, 5), 40, 0, 2, false, false))
)))))
),
;
@@ -48,27 +48,27 @@ public class CommandPortal implements PortalHandler {
public void handle(Player player, Location loc) {
String[] parts = command.split("\\\\");
int[] stackIds = new int[parts.length-1];
int[] stackIds = new int[parts.length - 1];
int maxId = 0;
for(int i = 1; i < parts.length; i++) {
stackIds[i-1] = Integer.parseInt(parts[i].substring(0, 1));
if(stackIds[i-1] > maxId)
maxId = stackIds[i-1];
for (int i = 1; i < parts.length; i++) {
stackIds[i - 1] = Integer.parseInt(parts[i].substring(0, 1));
if (stackIds[i - 1] > maxId)
maxId = stackIds[i - 1];
}
Iterator<Portal> stack = Portals.getStack(player).iterator();
String[] pieces = new String[stackIds.length];
while (maxId > 0) {
if(!stack.hasNext()) {
if (!stack.hasNext()) {
LobbySystem.getInstance().getLogger().log(Level.WARNING, "Stackportal with missing elements: " + player.getName() + " /" + command);
player.sendMessage("§cEigentlich solltest du gerade gar nicht durch dieses Portal durchgehen können...");
return;
}
Portal portal = stack.next();
if(portal.type() == PortalType.STACK) {
for(int i = 0; i < stackIds.length; i++) {
if(stackIds[i] == maxId) {
if (portal.type() == PortalType.STACK) {
for (int i = 0; i < stackIds.length; i++) {
if (stackIds[i] == maxId) {
pieces[i] = ((StackPortal) portal.getHandler()).getText();
}
}
@@ -78,11 +78,11 @@ public class CommandPortal implements PortalHandler {
}
StringBuilder cmd = new StringBuilder(parts[0]);
for(int i = 0; i < pieces.length; i++) {
cmd.append(pieces[i]).append(parts[i+1].substring(1));
for (int i = 0; i < pieces.length; i++) {
cmd.append(pieces[i]).append(parts[i + 1].substring(1));
}
if(ModifyCommand.modifying(player))
if (ModifyCommand.modifying(player))
player.sendMessage("/" + cmd);
NetworkSender.send(new ExecuteCommandPacket(SteamwarUser.get(player.getUniqueId()).getId(), cmd.toString()));
}
@@ -39,8 +39,8 @@ public class FightserverPortal implements PortalHandler, Comparable<FightserverP
public static FightserverPortal findFree(String gamemode) {
List<FightserverPortal> list = portals.getOrDefault(gamemode, Collections.emptyList());
for(FightserverPortal portal : list) {
if(portal.server == null)
for (FightserverPortal portal : list) {
if (portal.server == null)
return portal;
}
return null;
@@ -100,7 +100,7 @@ public class FightserverPortal implements PortalHandler, Comparable<FightserverP
}
public void updateText() {
if(server == null) {
if (server == null) {
hologram.updateText("§7Neuen Kampf starten");
return;
}
@@ -126,7 +126,7 @@ public class FightserverPortal implements PortalHandler, Comparable<FightserverP
List<Location> remainingLocations = new ArrayList<>(locations);
npcs.removeIf(npc -> {
SteamwarUser user = SteamwarUser.get(npc.getUuid());
if(remainingPlayers.contains(user)) {
if (remainingPlayers.contains(user)) {
remainingPlayers.remove(user);
remainingLocations.remove(npc.getLocation());
return false;
@@ -136,8 +136,8 @@ public class FightserverPortal implements PortalHandler, Comparable<FightserverP
}
});
for(SteamwarUser user : remainingPlayers) {
if(remainingLocations.isEmpty())
for (SteamwarUser user : remainingPlayers) {
if (remainingLocations.isEmpty())
break;
npcs.add(new NPC(remainingLocations.remove(0), user.getUUID(), user.getUserName()));
@@ -46,17 +46,17 @@ public class Portal implements PortalHandler, ConfigurationSerializable {
public static Portal getPortal(Location from, Location to) {
ChunkCoords in = new ChunkCoords(from);
ChunkCoords out = new ChunkCoords(to);
for(ChunkCoords coords : perChunk(Math.min(in.x, out.x), Math.max(in.x, out.x), Math.min(in.z, out.z), Math.max(in.z, out.z))) {
for(Portal portal : chunkPortals.getOrDefault(coords, Collections.emptyList())) {
for (ChunkCoords coords : perChunk(Math.min(in.x, out.x), Math.max(in.x, out.x), Math.min(in.z, out.z), Math.max(in.z, out.z))) {
for (Portal portal : chunkPortals.getOrDefault(coords, Collections.emptyList())) {
Vector normalizedFrom = portal.normalize(from);
Vector normalizedTo = portal.normalize(to);
if(portal.depth == 0.0) {
if (portal.depth == 0.0) {
normalizedFrom.setX(normalizedFrom.getX() > 0 ? 2 : -1);
normalizedTo.setX(normalizedTo.getX() > 0 ? 2 : -1);
}
if(inside(normalizedFrom.getX(), normalizedTo.getX()) && inside(normalizedFrom.getY(), normalizedTo.getY()) && inside(normalizedFrom.getZ(), normalizedTo.getZ())) {
if (inside(normalizedFrom.getX(), normalizedTo.getX()) && inside(normalizedFrom.getY(), normalizedTo.getY()) && inside(normalizedFrom.getZ(), normalizedTo.getZ())) {
return portal;
}
}
@@ -121,7 +121,7 @@ public class Portal implements PortalHandler, ConfigurationSerializable {
Vector orientation = pos2.toVector().subtract(pos1.toVector());
this.yRotation = Math.atan2(orientation.getX(), orientation.getZ());
this.pos1Vector = pos1.toVector().subtract(new Vector(depth/2, 0, 0).rotateAroundY(yRotation));
this.pos1Vector = pos1.toVector().subtract(new Vector(depth / 2, 0, 0).rotateAroundY(yRotation));
this.rotatedShape = new Vector(depth == 0.0 ? 1.0 : depth, orientation.getY(), orientation.clone().setY(0).length());
this.handler = handlerConstructor.apply(this);
@@ -263,7 +263,7 @@ public class Portal implements PortalHandler, ConfigurationSerializable {
@Override
public boolean equals(Object obj) {
if(!(obj instanceof ChunkCoords))
if (!(obj instanceof ChunkCoords))
return false;
ChunkCoords coords = (ChunkCoords) obj;
@@ -61,7 +61,7 @@ public class TeleportPortal implements PortalHandler {
@Override
public void handle(Player player, Location from, Location to) {
Deque<Portal> stack = Portals.getStack(player);
if(!stack.isEmpty() && sources.contains(stack.peek().getHandler())) {
if (!stack.isEmpty() && sources.contains(stack.peek().getHandler())) {
teleport(player, from, to, stack.pop());
} else {
teleport(player, from, to, Portal.getPortal(target));
@@ -69,12 +69,12 @@ public class TeleportPortal implements PortalHandler {
}
private void teleport(Player player, Location from, Location to, Portal target) {
if(target == null) {
if (target == null) {
LobbySystem.getInstance().getLogger().log(Level.WARNING, "Portal with unknown target: " + portal.getId());
player.sendMessage("§cAus unbekannten Gründen führt dieses Portal zurzeit in den Limbus");
return;
}
if(ModifyCommand.modifying(player))
if (ModifyCommand.modifying(player))
player.sendMessage("teleport " + portal.getId() + " -> " + target.getId());
Vector normalized = portal.normalize(to);
@@ -34,6 +34,7 @@ public class AdventListener implements Listener {
public static final int ADVENT_SLOT = 7;
public static final SWItem ADVENT = SWItem.getPlayerSkull("MHF_Present1");
static {
ADVENT.setName("§fAdvent");
}
@@ -41,7 +42,7 @@ public class AdventListener implements Listener {
@EventHandler(priority = EventPriority.LOWEST)
public void handlePlayerInteract(PlayerInteractEvent event) {
ItemStack item = event.getItem();
if(item == null)
if (item == null)
return;
if (item.getType() == Material.PLAYER_HEAD && item.getItemMeta() != null && item.getItemMeta().getDisplayName().equals("§fAdvent")) {
@@ -44,7 +44,8 @@ public class PresentClickListener implements Listener {
}
AdventsCalendar.getPresentList().forEach(present -> {
if (present.getDay() != day) return;
if (NodeMember.getNodeMember(present.getSchematicId(), SteamwarUser.get(event.getPlayer().getUniqueId()).getId()) != null) return;
if (NodeMember.getNodeMember(present.getSchematicId(), SteamwarUser.get(event.getPlayer().getUniqueId()).getId()) != null)
return;
LobbySystem.getMessage().send("ADVENT_CALENDAR_MESSAGE", event.getPlayer());
});
}
@@ -42,7 +42,7 @@ public class EggHuntListener implements Listener {
@EventHandler(priority = EventPriority.LOWEST)
public void handlePlayerInteract(PlayerInteractEvent event) {
ItemStack item = event.getItem();
if(item == null)
if (item == null)
return;
if (item.getType() == Material.DRAGON_EGG && item.getItemMeta() != null && item.getItemMeta().getDisplayName().equals("§fEaster Hunt")) {
@@ -145,7 +145,7 @@ public class LeaderboardManager implements Listener {
public long getPlayerTime(SteamwarUser user) {
Leaderboard lb = Leaderboard.getPlayerTime(user, configKey);
if(lb != null) return lb.getTime();
if (lb != null) return lb.getTime();
return Long.MAX_VALUE;
}