Improve Code Style
Dieser Commit ist enthalten in:
Ursprung
c0a09b8634
Commit
4d991e3089
@ -31,9 +31,7 @@ public class FlyCommand implements CommandExecutor {
|
||||
|
||||
@Override
|
||||
public boolean onCommand(CommandSender sender, Command command, String label, String[] args) {
|
||||
if (!(sender instanceof Player)) {
|
||||
return false;
|
||||
}
|
||||
if (!(sender instanceof Player)) return false;
|
||||
|
||||
Player player = (Player) sender;
|
||||
SteamwarUser steamwarUser = SteamwarUser.get(player.getUniqueId());
|
||||
|
@ -38,47 +38,42 @@ public class ParticleInventory {
|
||||
private ParticleInventory() {
|
||||
}
|
||||
|
||||
private static List<String> lore = Arrays.asList("§aKlicken zum Auswählen");
|
||||
private static final List<String> lore = Arrays.asList("§aKlicken zum Auswählen");
|
||||
|
||||
private static SpecialParticle SNEEZE = new SimpleParticle(Material.SLIME_BLOCK, "§aSneeze", lore, Particle.SNEEZE, 0.2F, 0.2F, 0.2F, 0.01);
|
||||
private static SpecialParticle SMOKE = new SimpleParticle(Material.COBWEB, "§7Smoke", lore, Particle.SMOKE_NORMAL, 0.2F, 0.2F, 0.2F, 0.01);
|
||||
private static SpecialParticle FLAME = new SimpleParticle(Material.LAVA_BUCKET, "§cFeuer", lore, Particle.DRIP_LAVA);
|
||||
private static SpecialParticle WATER = new SimpleParticle(Material.WATER_BUCKET, "§bWasser", lore, Particle.DRIP_WATER);
|
||||
private static SpecialParticle HEART = new FunctionalParticle(Material.RED_DYE, "§cHerzen", lore, (world, player, integer) -> world.spawnParticle(Particle.HEART, player.getLocation().add(0, 2.2, 0), 5));
|
||||
private static SpecialParticle NOTES = new FunctionalParticle(Material.NOTE_BLOCK, "§eNoten", lore, (world, player, integer) -> world.spawnParticle(Particle.NOTE, player.getLocation().add(0, 2.2, 0), 5));
|
||||
private static SpecialParticle NAUTILIS = new SimpleParticle(Material.NAUTILUS_SHELL, "§aNautilis", lore, Particle.NAUTILUS, 0.2F, 0F, 0.2F, 0.01);
|
||||
private static final SpecialParticle SNEEZE = new SimpleParticle(Material.SLIME_BLOCK, "§aSneeze", lore, Particle.SNEEZE, 0.2F, 0.2F, 0.2F, 0.01);
|
||||
private static final SpecialParticle SMOKE = new SimpleParticle(Material.COBWEB, "§7Smoke", lore, Particle.SMOKE_NORMAL, 0.2F, 0.2F, 0.2F, 0.01);
|
||||
private static final SpecialParticle FLAME = new SimpleParticle(Material.LAVA_BUCKET, "§cFeuer", lore, Particle.DRIP_LAVA);
|
||||
private static final SpecialParticle WATER = new SimpleParticle(Material.WATER_BUCKET, "§bWasser", lore, Particle.DRIP_WATER);
|
||||
private static final SpecialParticle HEART = new FunctionalParticle(Material.RED_DYE, "§cHerzen", lore, (world, player, integer) -> world.spawnParticle(Particle.HEART, player.getLocation().add(0, 2.2, 0), 5));
|
||||
private static final SpecialParticle NOTES = new FunctionalParticle(Material.NOTE_BLOCK, "§eNoten", lore, (world, player, integer) -> world.spawnParticle(Particle.NOTE, player.getLocation().add(0, 2.2, 0), 5));
|
||||
private static final SpecialParticle NAUTILIS = new SimpleParticle(Material.NAUTILUS_SHELL, "§aNautilis", lore, Particle.NAUTILUS, 0.2F, 0F, 0.2F, 0.01);
|
||||
|
||||
private static SpecialParticle SNOWBALL = new SimpleParticle(Material.SNOWBALL, "§fSnowball", lore, Particle.SNOWBALL, 0.2F, 0F, 0.2F, 0.01);
|
||||
private static SpecialParticle EFFECT = new SimpleParticle(Material.GLASS_BOTTLE, "§5Effekt", lore, Particle.REDSTONE, 0F, 0.2F, 0F, 0.01);
|
||||
private static SpecialParticle CAMPFIRE = new SimpleParticle(Material.CAMPFIRE, "§7Rauch", lore, Particle.CAMPFIRE_COSY_SMOKE, 0.0F, 0.2F, 0F, 0.01);
|
||||
private static SpecialParticle MAGIC = new SimpleParticle(Material.CAULDRON, "§5Magie", lore, Particle.CRIT_MAGIC, 0.2F, 0.2F, 0.2F, 0.01);
|
||||
private static SpecialParticle RAGE = new SimpleParticle(Material.REDSTONE_BLOCK, "§4Wut", lore, Particle.VILLAGER_ANGRY, 0.2F, 0.02F, 0.2F, 0.01);
|
||||
private static SpecialParticle SLIME = new SimpleParticle(Material.SLIME_BALL, "§aSchleim", lore, Particle.SLIME);
|
||||
private static SpecialParticle MOB = new SimpleParticle(Material.ZOMBIE_HEAD, "§7Mob", lore, Particle.SPELL_MOB);
|
||||
private static final SpecialParticle SNOWBALL = new SimpleParticle(Material.SNOWBALL, "§fSnowball", lore, Particle.SNOWBALL, 0.2F, 0F, 0.2F, 0.01);
|
||||
private static final SpecialParticle EFFECT = new SimpleParticle(Material.GLASS_BOTTLE, "§5Effekt", lore, Particle.REDSTONE, 0F, 0.2F, 0F, 0.01);
|
||||
private static final SpecialParticle CAMPFIRE = new SimpleParticle(Material.CAMPFIRE, "§7Rauch", lore, Particle.CAMPFIRE_COSY_SMOKE, 0.0F, 0.2F, 0F, 0.01);
|
||||
private static final SpecialParticle MAGIC = new SimpleParticle(Material.CAULDRON, "§5Magie", lore, Particle.CRIT_MAGIC, 0.2F, 0.2F, 0.2F, 0.01);
|
||||
private static final SpecialParticle RAGE = new SimpleParticle(Material.REDSTONE_BLOCK, "§4Wut", lore, Particle.VILLAGER_ANGRY, 0.2F, 0.02F, 0.2F, 0.01);
|
||||
private static final SpecialParticle SLIME = new SimpleParticle(Material.SLIME_BALL, "§aSchleim", lore, Particle.SLIME);
|
||||
private static final SpecialParticle MOB = new SimpleParticle(Material.ZOMBIE_HEAD, "§7Mob", lore, Particle.SPELL_MOB);
|
||||
|
||||
private static SpecialParticle DAMAGE = new SimpleParticle(Material.SPIDER_EYE, "§5Damage", lore, Particle.DAMAGE_INDICATOR, 0.2F, 0F, 0.2F, 0.01);
|
||||
private static SpecialParticle WITCH = new SimpleParticle(Material.EXPERIENCE_BOTTLE, "§5Hexe", lore, Particle.SPELL_WITCH);
|
||||
private static SpecialParticle ENCHANTING = new SimpleParticle(Material.ENCHANTING_TABLE, "§eZauber", lore, Particle.ENCHANTMENT_TABLE);
|
||||
private static SpecialParticle FRIEND = new SimpleParticle(Material.EMERALD_BLOCK, "§2Freude", lore, Particle.VILLAGER_HAPPY, 0.2F, 0.2F, 0.2F, 0.01);
|
||||
private static SpecialParticle FIRE = new SimpleParticle(Material.FLINT_AND_STEEL, "§7Flammen", lore, Particle.FLAME, 0F, 0.2F, 0F, 0.01);
|
||||
private static SpecialParticle TOTEM = new SimpleParticle(Material.TOTEM_OF_UNDYING, "§aTotem", lore, Particle.TOTEM, 0F, 0.2F, 0F, 0.01);
|
||||
private static SpecialParticle END = new SimpleParticle(Material.END_ROD, "§fEnd Rod", lore, Particle.END_ROD, 0.2F, 0.2F, 0.2F, 0.01);
|
||||
private static final SpecialParticle DAMAGE = new SimpleParticle(Material.SPIDER_EYE, "§5Damage", lore, Particle.DAMAGE_INDICATOR, 0.2F, 0F, 0.2F, 0.01);
|
||||
private static final SpecialParticle WITCH = new SimpleParticle(Material.EXPERIENCE_BOTTLE, "§5Hexe", lore, Particle.SPELL_WITCH);
|
||||
private static final SpecialParticle ENCHANTING = new SimpleParticle(Material.ENCHANTING_TABLE, "§eZauber", lore, Particle.ENCHANTMENT_TABLE);
|
||||
private static final SpecialParticle FRIEND = new SimpleParticle(Material.EMERALD_BLOCK, "§2Freude", lore, Particle.VILLAGER_HAPPY, 0.2F, 0.2F, 0.2F, 0.01);
|
||||
private static final SpecialParticle FIRE = new SimpleParticle(Material.FLINT_AND_STEEL, "§7Flammen", lore, Particle.FLAME, 0F, 0.2F, 0F, 0.01);
|
||||
private static final SpecialParticle TOTEM = new SimpleParticle(Material.TOTEM_OF_UNDYING, "§aTotem", lore, Particle.TOTEM, 0F, 0.2F, 0F, 0.01);
|
||||
private static final SpecialParticle END = new SimpleParticle(Material.END_ROD, "§fEnd Rod", lore, Particle.END_ROD, 0.2F, 0.2F, 0.2F, 0.01);
|
||||
|
||||
private static SpecialParticle[] row_1 = new SpecialParticle[]{SNEEZE, SMOKE, FLAME, WATER, HEART, NOTES, NAUTILIS};
|
||||
private static SpecialParticle[] row_2 = new SpecialParticle[]{SNOWBALL, EFFECT, CAMPFIRE, MAGIC, RAGE, SLIME, MOB};
|
||||
private static SpecialParticle[] row_3 = new SpecialParticle[]{DAMAGE, WITCH, ENCHANTING, FRIEND, FIRE, TOTEM, END};
|
||||
private static final SpecialParticle[] row_1 = new SpecialParticle[]{SNEEZE, SMOKE, FLAME, WATER, HEART, NOTES, NAUTILIS};
|
||||
private static final SpecialParticle[] row_2 = new SpecialParticle[]{SNOWBALL, EFFECT, CAMPFIRE, MAGIC, RAGE, SLIME, MOB};
|
||||
private static final SpecialParticle[] row_3 = new SpecialParticle[]{DAMAGE, WITCH, ENCHANTING, FRIEND, FIRE, TOTEM, END};
|
||||
|
||||
private static SWInventory createInventory(Player player) {
|
||||
LobbyPlayer lobbyPlayer = LobbyPlayer.getLobbyPlayer(player);
|
||||
SteamwarUser steamwarUser = SteamwarUser.get(player.getUniqueId());
|
||||
UserGroup userGroup = steamwarUser.getUserGroup();
|
||||
|
||||
SWInventory swInventory;
|
||||
if (userGroup == UserGroup.Member) {
|
||||
swInventory = new SWInventory(player, 9 * 5, "§6Partikel");
|
||||
} else {
|
||||
swInventory = new SWInventory(player, 9 * 6, "§6Partikel");
|
||||
}
|
||||
SWInventory swInventory = new SWInventory(player, 9 * (userGroup == UserGroup.Member ? 5 : 6), "§6Partikel");
|
||||
|
||||
add(swInventory, row_1, 10, lobbyPlayer);
|
||||
add(swInventory, row_2, 19, lobbyPlayer);
|
||||
|
@ -69,12 +69,8 @@ public class DoubleJumpListener implements Listener {
|
||||
public void handlePlayerMove(PlayerMoveEvent event) {
|
||||
Player player = event.getPlayer();
|
||||
|
||||
if(player.getLocation().add(0, -1, 0).getBlock().getType() == Material.AIR) {
|
||||
return;
|
||||
}
|
||||
if (LobbyPlayer.getLobbyPlayer(player).isFly()) {
|
||||
return;
|
||||
}
|
||||
if (player.getLocation().add(0, -1, 0).getBlock().getType() == Material.AIR) return;
|
||||
if (LobbyPlayer.getLobbyPlayer(player).isFly()) return;
|
||||
|
||||
player.setAllowFlight(true);
|
||||
if (player.getGameMode() == GameMode.ADVENTURE || player.getGameMode() == GameMode.SURVIVAL) {
|
||||
|
@ -32,8 +32,6 @@ import org.bukkit.event.Listener;
|
||||
import org.bukkit.event.player.PlayerInteractEvent;
|
||||
import org.bukkit.event.player.PlayerMoveEvent;
|
||||
|
||||
import java.util.Random;
|
||||
|
||||
public class ParticleListener implements Listener {
|
||||
|
||||
private static int deg = 0;
|
||||
@ -50,8 +48,7 @@ public class ParticleListener implements Listener {
|
||||
@EventHandler(priority = EventPriority.NORMAL)
|
||||
public void handlePlayerInteract(PlayerInteractEvent event) {
|
||||
Player player = event.getPlayer();
|
||||
if(event.getMaterial() != LobbyInventory.PARTICLE)
|
||||
return;
|
||||
if (event.getMaterial() != LobbyInventory.PARTICLE) return;
|
||||
|
||||
ParticleInventory.openParticleInventory(player);
|
||||
}
|
||||
|
@ -34,27 +34,10 @@ public class PlayerMoveListener implements Listener {
|
||||
@EventHandler
|
||||
public void handleWorldBorder(PlayerMoveEvent event) {
|
||||
Location to = event.getTo();
|
||||
if (!isInRegion(borderMinVector, borderMaxVector, to.toVector())) {
|
||||
if (!to.toVector().isInAABB(borderMinVector, borderMaxVector)) {
|
||||
event.getPlayer().teleport(event.getFrom());
|
||||
}
|
||||
}
|
||||
|
||||
private boolean isInRegion(Vector minPoint, Vector maxPoint, Vector location) {
|
||||
int x = location.getBlockX();
|
||||
int y = location.getBlockY();
|
||||
int z = location.getBlockZ();
|
||||
|
||||
if (x >= minPoint.getBlockX()
|
||||
&& x <= maxPoint.getBlockX()
|
||||
&& y >= minPoint.getBlockY()
|
||||
&& y <= maxPoint.getBlockY()
|
||||
&& z >= minPoint.getBlockZ()
|
||||
&& z <= maxPoint.getBlockZ()) {
|
||||
return true;
|
||||
} else {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
@ -111,9 +111,6 @@ public class PlayerSeatListener implements Listener {
|
||||
public void onEntityDismount(EntityDismountEvent event) {
|
||||
seats.remove(getSeatLocation(event.getDismounted().getLocation()));
|
||||
|
||||
if (event.getDismounted().getType() != EntityType.ARROW)
|
||||
return;
|
||||
|
||||
if (event.getEntityType() != EntityType.PLAYER)
|
||||
return;
|
||||
|
||||
|
@ -21,7 +21,6 @@ package de.steamwar.lobby.particle;
|
||||
|
||||
import de.steamwar.inventory.SWInventory;
|
||||
import de.steamwar.inventory.SWItem;
|
||||
import de.steamwar.lobby.LobbySystem;
|
||||
import de.steamwar.lobby.utils.LobbyPlayer;
|
||||
import org.bukkit.Color;
|
||||
import org.bukkit.Material;
|
||||
@ -38,30 +37,18 @@ public abstract class SpecialParticle {
|
||||
private static final List<String> emptyLore = new ArrayList<>();
|
||||
private static Random random = new Random();
|
||||
|
||||
protected final Color randomColor() {
|
||||
protected static Color randomColor() {
|
||||
return Color.fromRGB(random.nextInt(256), random.nextInt(256), random.nextInt(256));
|
||||
}
|
||||
|
||||
protected final float randomSize() {
|
||||
protected static float randomSize() {
|
||||
return random.nextFloat() / 2 + 1;
|
||||
}
|
||||
|
||||
protected final Particle.DustOptions getParticleDust() {
|
||||
protected static Particle.DustOptions getParticleDust() {
|
||||
return new Particle.DustOptions(randomColor(), randomSize());
|
||||
}
|
||||
|
||||
protected final Particle.DustOptions getParticleDust(float size) {
|
||||
return new Particle.DustOptions(randomColor(), size);
|
||||
}
|
||||
|
||||
protected final Particle.DustOptions getParticleDust(int r, int g, int b) {
|
||||
return new Particle.DustOptions(Color.fromRGB(r, g, b), randomSize());
|
||||
}
|
||||
|
||||
protected final Particle.DustOptions getParticleDust(int r, int g, int b, float size) {
|
||||
return new Particle.DustOptions(Color.fromRGB(r, g, b), size);
|
||||
}
|
||||
|
||||
private Material material;
|
||||
private String name;
|
||||
private List<String> lore;
|
||||
|
@ -19,15 +19,14 @@
|
||||
|
||||
package de.steamwar.lobby.utils;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
import org.bukkit.Material;
|
||||
import org.bukkit.enchantments.Enchantment;
|
||||
import org.bukkit.inventory.ItemFlag;
|
||||
import org.bukkit.inventory.ItemStack;
|
||||
import org.bukkit.inventory.meta.ItemMeta;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
public class ItemBuilder {
|
||||
|
||||
private ItemStack item;
|
||||
|
In neuem Issue referenzieren
Einen Benutzer sperren