diff --git a/src/main/java/de/fanta/challenges/Challenges.java b/src/main/java/de/fanta/challenges/Challenges.java index ad81405..5a6c12c 100644 --- a/src/main/java/de/fanta/challenges/Challenges.java +++ b/src/main/java/de/fanta/challenges/Challenges.java @@ -79,7 +79,6 @@ private File backpackConfigFile; private FileConfiguration BackpackConfig; private File AllItemsConfigFile; - private File ServerConfigFile; private Timer timer; private VanishUtils vanish; private BackpackGui backpack; @@ -235,7 +234,7 @@ } texturepacklink = "https://fantacs.de/AdventureMap-TexturePacks/" + textureID + "/" + textureID + ".zip"; } catch (IOException e) { - e.printStackTrace(); + plugin.getLogger().log(Level.SEVERE, "Error while move directory", e); } } getConfig().set("showtimer", false); @@ -296,20 +295,6 @@ EventRegistration.pM.callEvent(new PlayerCountChangedEvent(Bukkit.getOnlinePlayers().size() - plugin.getVanish().countVanishPlayers())); }, 200L); getLogger().info("Plugin loaded!"); - - /*World endWorld = Bukkit.getWorld("world_the_end"); - if (endWorld != null) { - for (Chunk chunk : endWorld.getLoadedChunks()) { - Troll.replaceEndChunk(chunk); - } - } - - World netherWorld = Bukkit.getWorld("world_nether"); - if (netherWorld != null) { - for (Chunk chunk : netherWorld.getLoadedChunks()) { - Troll.replaceNetherChunk(chunk); - } - }*/ } @Override @@ -325,7 +310,7 @@ this.RndDropsConfig.save(this.RndDropsConfigFile); this.AllItemsConfig.save(this.getAllItemsConfigFile()); } catch (IOException e) { - e.printStackTrace(); + plugin.getLogger().log(Level.SEVERE, "Error while saving configs", e); } Config.setValue("timertime", timer.getTime()); if (getConfig().getBoolean("event.enabled")) { @@ -357,7 +342,7 @@ try { this.BackpackConfig.load(this.backpackConfigFile); } catch (InvalidConfigurationException | IOException e) { - e.printStackTrace(); + plugin.getLogger().log(Level.SEVERE, "Error while loading Backpack", e); } } @@ -375,7 +360,7 @@ try { this.RndDropsConfig.load(this.RndDropsConfigFile); } catch (IOException | org.bukkit.configuration.InvalidConfigurationException e) { - e.printStackTrace(); + plugin.getLogger().log(Level.SEVERE, "Error while load RandomDrops Config", e); } } @@ -393,7 +378,7 @@ try { this.AllItemsConfig.load(this.AllItemsConfigFile); } catch (IOException | org.bukkit.configuration.InvalidConfigurationException e) { - e.printStackTrace(); + plugin.getLogger().log(Level.SEVERE, "Error while loading AllItems Config", e); } } @@ -402,16 +387,16 @@ } private void createServerConfig() { - ServerConfigFile = new File(getDataFolder(), "serverconfig.yml"); - if (!ServerConfigFile.exists()) { - ServerConfigFile.getParentFile().mkdirs(); + File serverConfigFile = new File(getDataFolder(), "serverconfig.yml"); + if (!serverConfigFile.exists()) { + serverConfigFile.getParentFile().mkdirs(); saveResource("serverconfig.yml", false); } this.ServerConfig = new YamlConfiguration(); try { - ServerConfig.load(ServerConfigFile); - } catch (IOException | org.bukkit.configuration.InvalidConfigurationException e) { - e.printStackTrace(); + ServerConfig.load(serverConfigFile); + } catch (IOException | InvalidConfigurationException e) { + plugin.getLogger().log(Level.SEVERE, "Error while loading Server Config", e); } } @@ -426,8 +411,8 @@ this.ItemConfig = new YamlConfiguration(); try { ItemConfig.load(ItemConfigFile); - } catch (IOException | org.bukkit.configuration.InvalidConfigurationException e) { - e.printStackTrace(); + } catch (IOException | InvalidConfigurationException e) { + plugin.getLogger().log(Level.SEVERE, "Error while loading Item Config", e); } } diff --git a/src/main/java/de/fanta/challenges/Troll.java b/src/main/java/de/fanta/challenges/Troll.java deleted file mode 100644 index ae16971..0000000 --- a/src/main/java/de/fanta/challenges/Troll.java +++ /dev/null @@ -1,320 +0,0 @@ -package de.fanta.challenges; - -import de.iani.cubesideutils.bukkit.items.ItemGroups; -import org.bukkit.Bukkit; -import org.bukkit.ChatColor; -import org.bukkit.Chunk; -import org.bukkit.GameRule; -import org.bukkit.Location; -import org.bukkit.Material; -import org.bukkit.World; -import org.bukkit.attribute.Attribute; -import org.bukkit.block.Block; -import org.bukkit.block.Chest; -import org.bukkit.boss.BarColor; -import org.bukkit.boss.DragonBattle; -import org.bukkit.entity.EnderDragon; -import org.bukkit.entity.Enderman; -import org.bukkit.entity.Entity; -import org.bukkit.entity.EntityType; -import org.bukkit.entity.Player; -import org.bukkit.entity.minecart.StorageMinecart; -import org.bukkit.event.EventHandler; -import org.bukkit.event.Listener; -import org.bukkit.event.entity.CreatureSpawnEvent; -import org.bukkit.event.entity.EntitySpawnEvent; -import org.bukkit.event.player.PlayerChangedWorldEvent; -import org.bukkit.event.player.PlayerInteractEntityEvent; -import org.bukkit.event.player.PlayerInteractEvent; -import org.bukkit.event.player.PlayerMoveEvent; -import org.bukkit.event.world.ChunkLoadEvent; -import org.bukkit.inventory.Inventory; -import org.bukkit.inventory.ItemStack; -import org.bukkit.potion.PotionEffect; -import org.bukkit.potion.PotionEffectType; - -import java.util.ArrayList; -import java.util.HashSet; -import java.util.List; -import java.util.Random; -import java.util.Set; - -public class Troll implements Listener { - - /*private final Challenges plugin; - private static boolean enderDragonChanged = false; - private int taskId = -1; - - public Troll(Challenges plugin) { - this.plugin = plugin; - } - - @EventHandler - public void playerChangedWorld(PlayerChangedWorldEvent e) { - if (enderDragonChanged) { - return; - } - if (taskId == -1) { - startUpdateTask(); - } - } - - @EventHandler - public void onChunkLoad(ChunkLoadEvent e) { - if (e.getWorld().getEnvironment() == World.Environment.THE_END && e.isNewChunk()) { - Chunk chunk = e.getChunk(); - replaceEndChunk(chunk); - } - if (e.getWorld().getEnvironment() == World.Environment.NETHER && e.isNewChunk()) { - Chunk chunk = e.getChunk(); - replaceNetherChunk(chunk); - } - } - - @EventHandler - public void onMobSpawn(EntitySpawnEvent e) { - if (e.getEntity().getWorld().getEnvironment() == World.Environment.THE_END) { - if (e.getEntity() instanceof Enderman) { - Location loc = e.getEntity().getLocation(); - e.getEntity().remove(); - loc.getWorld().spawnEntity(loc, EntityType.SILVERFISH, CreatureSpawnEvent.SpawnReason.NATURAL); - } - } - } - - @EventHandler - public void onPlayerMove(PlayerMoveEvent e) { - if (e.getFrom().getWorld().getEnvironment() == World.Environment.NETHER) { - Player player = e.getPlayer(); - if (player.isSwimming() || player.isUnderWater() || player.isInWater()) { - if (!player.hasPotionEffect(PotionEffectType.FIRE_RESISTANCE) && !player.hasPotionEffect(PotionEffectType.POISON)) { - player.addPotionEffect(new PotionEffect(PotionEffectType.POISON, 120, 1, false, false, true)); - } - } - } - } - - @EventHandler - public void onPlayerUseLootChest(PlayerInteractEvent e) { - Block block = e.getClickedBlock(); - if (block == null) { - return; - } - if (!(block.getState() instanceof Chest chest)) { - return; - } - if (chest.getLootTable() == null) { - return; - } - randomLootChest(chest.getInventory()); - } - - @EventHandler - public void onPlayerUseEntityLootChest(PlayerInteractEntityEvent e) { - Entity entity = e.getRightClicked(); - - if (!(entity instanceof StorageMinecart minecart)) { - return; - } - - if (minecart.getLootTable() == null) { - return; - } - - randomLootChest(minecart.getInventory()); - } - - public void randomLootChest(Inventory chest) { - plugin.getScheduler().runLocalDelayed(chest.getLocation(), () -> { - for (ItemStack stack : chest.getContents()) { - if (stack != null) { - stack.setType(getRandomBlockFromList(new HashSet<>(plugin.getMaterials()))); - } - } - }, 1L); - } - - public static void replaceEndChunk(Chunk chunk) { - int x = chunk.getX() << 4; - int z = chunk.getZ() << 4; - - World world = chunk.getWorld(); - for (int xx = x; xx < x + 16; xx++) { - for (int zz = z; zz < z + 16; zz++) { - for (int yy = world.getMinHeight(); yy < world.getMaxHeight(); yy++) { - Block block = world.getBlockAt(xx, yy, zz); - - if (block.getType() == Material.END_STONE) { - block.setType(Material.HONEYCOMB_BLOCK, false); - continue; - } - if (block.getType() == Material.OBSIDIAN) { - block.setType(Material.BLACK_TERRACOTTA, false); - } - } - } - } - } - - public static void replaceNetherChunk(Chunk chunk) { - int x = chunk.getX() << 4; - int z = chunk.getZ() << 4; - - World world = chunk.getWorld(); - for (int xx = x; xx < x + 16; xx++) { - for (int zz = z; zz < z + 16; zz++) { - for (int yy = 0; yy < 128; yy++) { - Block block = world.getBlockAt(xx, yy, zz); - if (block.getType() == Material.AIR) { - continue; - } - - if (block.getType() == Material.NETHERRACK || block.getType() == Material.CRIMSON_NYLIUM || block.getType() == Material.WARPED_NYLIUM) { - block.setType(getRandomBlockFromList(ItemGroups.CONCRETE), false); - continue; - } - if (block.getType() == Material.LAVA) { - block.setType(Material.WATER, false); - continue; - } - if (block.getType() == Material.SOUL_SOIL || block.getType() == Material.SOUL_SAND) { - block.setType(Material.HAY_BLOCK, false); - continue; - } - if (block.getType() == Material.GLOWSTONE) { - block.setType(getRandomBlockFromList(ItemGroups.FROG_LIGHT), false); - continue; - } - if (block.getType() == Material.GRAVEL) { - block.setType(getRandomBlockFromList(ItemGroups.CONCRETE_POWDER), false); - continue; - } - if (block.getType() == Material.MAGMA_BLOCK) { - block.setType(Material.MUD, false); - continue; - } - if (block.getType() == Material.BONE_BLOCK) { - block.setType(Material.DIAMOND_ORE, false); - continue; - } - if (block.getType() == Material.FIRE) { - block.setType(Material.PINK_PETALS, false); - continue; - } - if (block.getType() == Material.NETHER_QUARTZ_ORE) { - block.setType(Material.COAL_ORE, false); - continue; - } - if (block.getType() == Material.NETHER_GOLD_ORE) { - block.setType(Material.GOLD_ORE, false); - continue; - } - if (block.getType() == Material.BASALT) { - block.setType(Material.RED_SANDSTONE, false); - continue; - } - if (block.getType() == Material.BLACKSTONE) { - block.setType(Material.DEEPSLATE, false); - continue; - } - if (block.getType() == Material.RED_MUSHROOM || block.getType() == Material.BROWN_MUSHROOM) { - block.setType(getRandomBlockFromList(ItemGroups.SINGLE_BLOCK_PLANTS), false); - continue; - } - if (block.getType() == Material.NETHER_WART_BLOCK) { - block.setType(Material.FLOWERING_AZALEA_LEAVES, false); - continue; - } - if (block.getType() == Material.CRIMSON_STEM) { - block.setType(Material.DARK_OAK_LOG, false); - continue; - } - if (block.getType() == Material.WARPED_STEM) { - block.setType(Material.CHERRY_LOG, false); - continue; - } - if (block.getType() == Material.WARPED_WART_BLOCK) { - block.setType(Material.CHERRY_LEAVES, false); - continue; - } - if (block.getType() == Material.CRIMSON_FUNGUS || block.getType() == Material.WARPED_FUNGUS) { - block.setType(getRandomBlockFromList(ItemGroups.CANDLE), false); - continue; - } - if (block.getType() == Material.CRIMSON_ROOTS) { - block.setType(Material.LIGHT_WEIGHTED_PRESSURE_PLATE, false); - continue; - } - if (block.getType() == Material.WARPED_ROOTS) { - block.setType(Material.HEAVY_WEIGHTED_PRESSURE_PLATE, false); - continue; - } - if (block.getType() == Material.SHROOMLIGHT) { - block.setType(Material.JACK_O_LANTERN, false); - continue; - } - if (block.getType() == Material.WEEPING_VINES || block.getType() == Material.WEEPING_VINES_PLANT) { - block.setType(Material.GLOW_LICHEN, false); - continue; - } - if (block.getType() == Material.TWISTING_VINES || block.getType() == Material.TWISTING_VINES_PLANT) { - block.setType(Material.SCAFFOLDING, false); - continue; - } - if (block.getType() == Material.NETHER_SPROUTS) { - block.setType(getRandomBlockFromList(ItemGroups.CARPET), false); - } - } - } - } - } - - private static Material getRandomBlockFromList(Set materials) { - List list = new ArrayList<>(materials); - int size = list.size(); - int randIdx = new Random().nextInt(size); - return list.get(randIdx); - } - - public void replaceDragon() { - World world = Bukkit.getWorld("world_the_end"); - if (world != null) { - DragonBattle dragonBattle = world.getEnderDragonBattle(); - if (dragonBattle != null && dragonBattle.getEnderDragon() != null) { - EnderDragon dragon = dragonBattle.getEnderDragon(); - dragonBattle.getBossBar().setColor(BarColor.YELLOW); - dragon.setCustomName(ChatColor.YELLOW + "Ender Bee"); - dragon.getAttribute(Attribute.GENERIC_MAX_HEALTH).setBaseValue(2000); - dragon.setHealth(dragon.getAttribute(Attribute.GENERIC_MAX_HEALTH).getValue()); - MobDisguise disguiseType = new MobDisguise(DisguiseType.BEE); - DisguiseAPI.disguiseEntity(dragon, disguiseType); - world.setGameRule(GameRule.MOB_GRIEFING, false); - for (Entity entity : world.getEntities()) { - if (entity instanceof Enderman) { - Location loc = entity.getLocation(); - entity.remove(); - world.spawnEntity(loc, EntityType.SILVERFISH, CreatureSpawnEvent.SpawnReason.NATURAL); - } - } - enderDragonChanged = true; - stopUpdateTask(); - } - } - } - - public void startUpdateTask() { - taskId = plugin.getServer().getScheduler().scheduleSyncRepeatingTask(plugin, this::tick, 1L, 1L); - } - - public void stopUpdateTask() { - plugin.getServer().getScheduler().cancelTask(taskId); - } - - private void tick() { - if (enderDragonChanged) { - return; - } - - replaceDragon(); - }*/ -} diff --git a/src/main/java/de/fanta/challenges/challenges/AllItemsChallenge.java b/src/main/java/de/fanta/challenges/challenges/AllItemsChallenge.java index 6e36c32..9f44af2 100644 --- a/src/main/java/de/fanta/challenges/challenges/AllItemsChallenge.java +++ b/src/main/java/de/fanta/challenges/challenges/AllItemsChallenge.java @@ -20,6 +20,7 @@ import java.util.ArrayList; import java.util.List; import java.util.Random; +import java.util.logging.Level; public class AllItemsChallenge { @@ -128,7 +129,7 @@ try { Challenges.getPlugin().AllItemsConfig.save(Challenges.getPlugin().getAllItemsConfigFile()); } catch (IOException e) { - e.printStackTrace(); + plugin.getLogger().log(Level.SEVERE, "Error while saving Items", e); } } diff --git a/src/main/java/de/fanta/challenges/challenges/RandomDropsChallenge.java b/src/main/java/de/fanta/challenges/challenges/RandomDropsChallenge.java index 66060d3..beab75f 100644 --- a/src/main/java/de/fanta/challenges/challenges/RandomDropsChallenge.java +++ b/src/main/java/de/fanta/challenges/challenges/RandomDropsChallenge.java @@ -19,6 +19,7 @@ import java.util.Collections; import java.util.HashMap; import java.util.Random; +import java.util.logging.Level; import java.util.stream.Collectors; public class RandomDropsChallenge implements Listener { @@ -51,14 +52,6 @@ } } - /* @EventHandler - public void onBlockDestroy(BlockDestroyEvent e) { - if (this.Config.getBoolean("rnddrops") && plugin.getTimer().isRunning()) { - e.getBlock().getWorld().dropItem(e.getBlock().getLocation().add(0.5D, 0.5D, 0.5D), new ItemStack(this.plugin.getRandomDropsManager().getMaterialFromBlock(e.getBlock()))); - e.setCancelled(true); - } - } */ - @EventHandler public void onBlockExplode(BlockExplodeEvent e) { if (Config.getBoolean("rnddrops") && plugin.getTimer().isRunning()) { @@ -102,7 +95,7 @@ try { Challenges.getPlugin().RndDropsConfig.save(Challenges.getPlugin().RndDropsConfigFile); } catch (IOException e) { - e.printStackTrace(); + plugin.getLogger().log(Level.SEVERE, "Error while saving randomDrop Config", e); } } diff --git a/src/main/java/de/fanta/challenges/commands/ChestUnlockCommand.java b/src/main/java/de/fanta/challenges/commands/ChestUnlockCommand.java index 1e81b3a..a445844 100644 --- a/src/main/java/de/fanta/challenges/commands/ChestUnlockCommand.java +++ b/src/main/java/de/fanta/challenges/commands/ChestUnlockCommand.java @@ -1,6 +1,5 @@ package de.fanta.challenges.commands; -import de.fanta.challenges.Challenges; import de.fanta.challenges.listeners.ContainerListener; import de.fanta.challenges.utils.ChatUtil; import de.fanta.challenges.utils.Config; @@ -12,12 +11,6 @@ public class ChestUnlockCommand extends SubCommand { - private final Challenges plugin; - - public ChestUnlockCommand(Challenges plugin) { - this.plugin = plugin; - } - @Override public boolean onCommand(CommandSender sender, Command command, String s, String s1, ArgsParser args) { if (!(sender instanceof Player player)) { diff --git a/src/main/java/de/fanta/challenges/commands/CommandRegistration.java b/src/main/java/de/fanta/challenges/commands/CommandRegistration.java index fc4e228..f5477db 100644 --- a/src/main/java/de/fanta/challenges/commands/CommandRegistration.java +++ b/src/main/java/de/fanta/challenges/commands/CommandRegistration.java @@ -66,7 +66,7 @@ challengesRouter.addCommandMapping(new ChallengesSpeedCommand(), "speed"); challengesRouter.addCommandMapping(new TeleportCommand(), "tp"); challengesRouter.addCommandMapping(new ChallengeMaxPlayersCommand(), "maxplayer"); - challengesRouter.addCommandMapping(new CheckItemsCommand(), "checkitems"); + challengesRouter.addCommandMapping(new CheckItemsCommand(plugin), "checkitems"); challengesRouter.addCommandMapping(new ChallengesInvSeeCommand(), "invsee"); challengesRouter.addCommandMapping(new ChallengesEnderSeeCommand(), "endersee"); @@ -147,6 +147,6 @@ CommandRouter unlockRouter = new CommandRouter(plugin.getCommand("unlock")); unlockRouter.addPluginCommand(plugin.getCommand("cremove")); - unlockRouter.addCommandMapping(new ChestUnlockCommand(plugin)); + unlockRouter.addCommandMapping(new ChestUnlockCommand()); } } diff --git a/src/main/java/de/fanta/challenges/commands/challenges/CheckItemsCommand.java b/src/main/java/de/fanta/challenges/commands/challenges/CheckItemsCommand.java index a2907b7..0252583 100644 --- a/src/main/java/de/fanta/challenges/commands/challenges/CheckItemsCommand.java +++ b/src/main/java/de/fanta/challenges/commands/challenges/CheckItemsCommand.java @@ -3,7 +3,6 @@ import de.fanta.challenges.Challenges; import de.fanta.challenges.guis.CheckItemsGUI; import de.fanta.challenges.utils.ChatUtil; -import de.fanta.challenges.utils.Config; import de.iani.cubesideutils.bukkit.commands.SubCommand; import de.iani.cubesideutils.commands.ArgsParser; import org.bukkit.command.Command; @@ -15,12 +14,15 @@ import java.io.IOException; import java.util.Collection; import java.util.Collections; +import java.util.logging.Level; public class CheckItemsCommand extends SubCommand { + private final Challenges plugin; private boolean reset = false; - public CheckItemsCommand() { + public CheckItemsCommand(Challenges plugin) { + this.plugin = plugin; } @Override @@ -35,7 +37,7 @@ try { Challenges.getPlugin().ItemConfig.save(Challenges.getPlugin().ItemConfigFile); } catch (IOException e) { - e.printStackTrace(); + plugin.getLogger().log(Level.SEVERE, "Error while saving item Config", e); } reset = true; } diff --git a/src/main/java/de/fanta/challenges/gravestones/GravestoneListener.java b/src/main/java/de/fanta/challenges/gravestones/GravestoneListener.java index 89b08ed..062c453 100644 --- a/src/main/java/de/fanta/challenges/gravestones/GravestoneListener.java +++ b/src/main/java/de/fanta/challenges/gravestones/GravestoneListener.java @@ -24,6 +24,7 @@ import java.util.ArrayList; import java.util.Collection; import java.util.List; +import java.util.logging.Level; public class GravestoneListener implements Listener { @@ -114,7 +115,7 @@ armorStand.getLocation().getWorld().dropItem(armorStand.getLocation().add(0, 1, 0), stack); } } catch (InvalidConfigurationException ex) { - ex.printStackTrace(); + plugin.getLogger().log(Level.SEVERE, "Error while loading yaml Config", e); } armorStand.remove(); } else { diff --git a/src/main/java/de/fanta/challenges/guis/CheckItemsGUI.java b/src/main/java/de/fanta/challenges/guis/CheckItemsGUI.java index f9ba8d4..bcd82ca 100644 --- a/src/main/java/de/fanta/challenges/guis/CheckItemsGUI.java +++ b/src/main/java/de/fanta/challenges/guis/CheckItemsGUI.java @@ -15,6 +15,7 @@ import java.io.IOException; import java.util.List; +import java.util.logging.Level; public class CheckItemsGUI extends AbstractWindow { private static final Challenges plugin = Challenges.getPlugin(); @@ -88,7 +89,7 @@ try { Challenges.getPlugin().ItemConfig.save(Challenges.getPlugin().ItemConfigFile); } catch (IOException e) { - e.printStackTrace(); + plugin.getLogger().log(Level.SEVERE, "Error while saving item Config", e); } } } diff --git a/src/main/java/de/fanta/challenges/teams/TeamUtils.java b/src/main/java/de/fanta/challenges/teams/TeamUtils.java index afedb7f..7319f81 100644 --- a/src/main/java/de/fanta/challenges/teams/TeamUtils.java +++ b/src/main/java/de/fanta/challenges/teams/TeamUtils.java @@ -17,7 +17,6 @@ import org.bukkit.persistence.PersistentDataType; import org.bukkit.scoreboard.DisplaySlot; import org.bukkit.scoreboard.Objective; -import org.bukkit.scoreboard.Score; import org.bukkit.scoreboard.Scoreboard; import org.bukkit.scoreboard.Team; import org.jetbrains.annotations.NotNull; @@ -34,9 +33,7 @@ private static final NamespacedKey selectKey = new NamespacedKey(Challenges.getPlugin(), "selectitem"); private static ChallengeTeam[] teams; private static int teamsize; - private static Team[] scoreboardTeams; private static Scoreboard scoreboard; - private static Score[] scoreboardScores; private static Objective teamscoreboardObjective; private static final Challenges plugin = Challenges.getPlugin(); @@ -179,8 +176,7 @@ teamscoreboardObjective.setDisplayName("Event"); teamscoreboardObjective.setDisplaySlot(DisplaySlot.SIDEBAR); } - scoreboardTeams = new Team[teams.length]; - scoreboardScores = new Score[teams.length + 1]; + Team[] scoreboardTeams = new Team[teams.length]; for (int i = 0; i < teams.length; i++) { ChallengeTeam t = getTeam(i); if (scoreboardTeams[i] == null) { @@ -190,8 +186,6 @@ scoreboardTeams[i].setColor(t.getChatColor()); scoreboardTeams[i].setAllowFriendlyFire(false); scoreboardTeams[i].setOption(Team.Option.COLLISION_RULE, Team.OptionStatus.FOR_OWN_TEAM); - - scoreboardScores[i] = teamscoreboardObjective.getScore(t.getChatColor() + t.getName()); } } } diff --git a/src/main/java/de/fanta/challenges/utils/ChatSkullAPI/SkullClass.java b/src/main/java/de/fanta/challenges/utils/ChatSkullAPI/SkullClass.java index d5983f8..dd70ef5 100644 --- a/src/main/java/de/fanta/challenges/utils/ChatSkullAPI/SkullClass.java +++ b/src/main/java/de/fanta/challenges/utils/ChatSkullAPI/SkullClass.java @@ -1,11 +1,13 @@ package de.fanta.challenges.utils.ChatSkullAPI; +import de.fanta.challenges.Challenges; import org.bukkit.Bukkit; import org.bukkit.entity.Player; import javax.imageio.ImageIO; import java.awt.image.BufferedImage; import java.net.URL; +import java.util.logging.Level; public class SkullClass { Player player; @@ -28,7 +30,7 @@ try { imageToSend = ImageIO.read(newURL(name)); } catch (Exception e) { - e.printStackTrace(); + Challenges.getPlugin().getLogger().log(Level.SEVERE, "Error while load skin", e); } (new Message(imageToSend, 8, '█')).appendText(this.lines).sendToPlayer(player); } diff --git a/src/main/java/de/fanta/challenges/utils/SaveWorldUtils.java b/src/main/java/de/fanta/challenges/utils/SaveWorldUtils.java index 190e915..bd05d44 100644 --- a/src/main/java/de/fanta/challenges/utils/SaveWorldUtils.java +++ b/src/main/java/de/fanta/challenges/utils/SaveWorldUtils.java @@ -215,7 +215,7 @@ props.store(out, null); out.close(); } catch (IOException e) { - e.printStackTrace(); + plugin.getLogger().log(Level.SEVERE, "Error while read server properties Config", e); } } @@ -244,7 +244,7 @@ progress = (double) copiedBytes[0] / totalBytes[0] * 100; } } catch (IOException e) { - e.printStackTrace(); + plugin.getLogger().log(Level.SEVERE, "Error while copy files", e); } }); }