From e35d70bc3ca65a6f860da42465d15cdae8278ce0 Mon Sep 17 00:00:00 2001 From: Telesphoreo Date: Sat, 9 Apr 2022 00:08:03 -0500 Subject: [PATCH] Change config entries --- .../java/dev/plex/listener/impl/BlockListener.java | 10 +++++----- .../java/dev/plex/listener/impl/DropListener.java | 5 ++++- .../java/dev/plex/listener/impl/SpawnListener.java | 7 ++++--- .../java/dev/plex/storage/MongoConnection.java | 8 ++++++-- src/main/java/dev/plex/storage/SQLConnection.java | 14 +++++++++----- src/main/resources/config.yml | 4 ++-- 6 files changed, 30 insertions(+), 18 deletions(-) diff --git a/src/main/java/dev/plex/listener/impl/BlockListener.java b/src/main/java/dev/plex/listener/impl/BlockListener.java index d01bb07..f9f6e52 100644 --- a/src/main/java/dev/plex/listener/impl/BlockListener.java +++ b/src/main/java/dev/plex/listener/impl/BlockListener.java @@ -28,7 +28,7 @@ public class BlockListener extends PlexListener @EventHandler(priority = EventPriority.LOW) public void onBlockPlace(BlockPlaceEvent event) { - List blockedBlocksConfig = plugin.config.getStringList("blockedBlocks"); + List blockedBlocksConfig = plugin.config.getStringList("blocked_blocks"); if (blockedBlocksConfig != cachedBlockedBlocksConfig) { blockedBlocks.clear(); @@ -57,17 +57,17 @@ public class BlockListener extends PlexListener if (blockedBlocks.contains(block.getType())) { block.setType(Material.CAKE); - PlexUtils.disabledEffect(event.getPlayer(), block.getLocation().add(0.5,0.5,0.5)); + PlexUtils.disabledEffect(event.getPlayer(), block.getLocation().add(0.5, 0.5, 0.5)); } - if(SIGNS.contains(block.getType())) + if (SIGNS.contains(block.getType())) { - Sign sign = (Sign) block.getState(); + Sign sign = (Sign)block.getState(); boolean anythingChanged = false; for (int i = 0; i < sign.lines().size(); i++) { Component line = sign.line(i); - if(line.clickEvent() != null) + if (line.clickEvent() != null) { anythingChanged = true; sign.line(i, line.clickEvent(null)); diff --git a/src/main/java/dev/plex/listener/impl/DropListener.java b/src/main/java/dev/plex/listener/impl/DropListener.java index 1aa2dfb..732fb65 100644 --- a/src/main/java/dev/plex/listener/impl/DropListener.java +++ b/src/main/java/dev/plex/listener/impl/DropListener.java @@ -9,6 +9,9 @@ public class DropListener extends PlexListener @EventHandler public void onPlayerDropItem(PlayerDropItemEvent event) { - if (!plugin.config.getBoolean("allowdrops")) event.setCancelled(true); + if (!plugin.config.getBoolean("allowdrops")) + { + event.setCancelled(true); + } } } diff --git a/src/main/java/dev/plex/listener/impl/SpawnListener.java b/src/main/java/dev/plex/listener/impl/SpawnListener.java index b52b33e..13eac77 100644 --- a/src/main/java/dev/plex/listener/impl/SpawnListener.java +++ b/src/main/java/dev/plex/listener/impl/SpawnListener.java @@ -39,7 +39,7 @@ public class SpawnListener extends PlexListener return; } - if (plugin.config.getStringList("blockedEntities").stream().anyMatch(type -> type.equalsIgnoreCase(event.getEntityType().name()))) + if (plugin.config.getStringList("blocked_entities").stream().anyMatch(type -> type.equalsIgnoreCase(event.getEntityType().name()))) { event.setCancelled(true); Location location = event.getLocation(); @@ -56,7 +56,7 @@ public class SpawnListener extends PlexListener if (SPAWN_EGGS.contains(itemType)) { Block block = event.getBlock(); - Location blockLoc = block.getLocation().add(0.5,0.5,0.5).add(((Directional) block.getBlockData()).getFacing().getDirection().multiply(0.8)); + Location blockLoc = block.getLocation().add(0.5, 0.5, 0.5).add(((Directional)block.getBlockData()).getFacing().getDirection().multiply(0.8)); EntityType eggType = spawnEggToEntityType(itemType); if (eggType != null) { @@ -109,7 +109,8 @@ public class SpawnListener extends PlexListener } } - private static EntityType spawnEggToEntityType(Material mat){ + private static EntityType spawnEggToEntityType(Material mat) + { EntityType eggType; try { diff --git a/src/main/java/dev/plex/storage/MongoConnection.java b/src/main/java/dev/plex/storage/MongoConnection.java index 23768fb..d10c776 100644 --- a/src/main/java/dev/plex/storage/MongoConnection.java +++ b/src/main/java/dev/plex/storage/MongoConnection.java @@ -32,10 +32,14 @@ public class MongoConnection extends PlexBase if (database != null && !database.isEmpty()) { connectionString = "mongodb://" + username + ":" + password + "@" + host + ":" + port + "/?authSource=" + database; - } else { + } + else + { connectionString = "mongodb://" + username + ":" + password + "@" + host + ":" + port + "/"; } - } else { + } + else + { connectionString = "mongodb://" + host + ":" + port + "/"; } connectionString += "?uuidRepresentation=STANDARD"; diff --git a/src/main/java/dev/plex/storage/SQLConnection.java b/src/main/java/dev/plex/storage/SQLConnection.java index 07a6ced..d810625 100644 --- a/src/main/java/dev/plex/storage/SQLConnection.java +++ b/src/main/java/dev/plex/storage/SQLConnection.java @@ -19,7 +19,7 @@ public class SQLConnection extends PlexBase { if (!plugin.config.getString("data.central.storage").equalsIgnoreCase("sqlite") && !plugin.config.getString("data.central.storage").equalsIgnoreCase("mariadb")) { - return; + return; } String host = plugin.config.getString("data.central.hostname"); @@ -45,7 +45,8 @@ public class SQLConnection extends PlexBase { dataSource.setJdbcUrl("jdbc:sqlite:" + new File(plugin.getDataFolder(), "database.db").getAbsolutePath()); plugin.setStorageType(StorageType.SQLITE); - } else if (plugin.config.getString("data.central.storage").equalsIgnoreCase("mariadb")) + } + else if (plugin.config.getString("data.central.storage").equalsIgnoreCase("mariadb")) { Class.forName("org.mariadb.jdbc.Driver"); dataSource.setJdbcUrl("jdbc:mariadb://" + host + ":" + port + "/" + database); @@ -53,7 +54,8 @@ public class SQLConnection extends PlexBase dataSource.setPassword(password); Plex.get().setStorageType(StorageType.MARIADB); } - } catch (ClassNotFoundException throwables) + } + catch (ClassNotFoundException throwables) { throwables.printStackTrace(); } @@ -90,7 +92,8 @@ public class SQLConnection extends PlexBase "`note` VARCHAR(2000), " + "`timestamp` BIGINT" + ");").execute(); - } catch (SQLException throwables) + } + catch (SQLException throwables) { throwables.printStackTrace(); } @@ -105,7 +108,8 @@ public class SQLConnection extends PlexBase try { return dataSource.getConnection(); - } catch (SQLException e) + } + catch (SQLException e) { e.printStackTrace(); } diff --git a/src/main/resources/config.yml b/src/main/resources/config.yml index d3c17c0..12f9c74 100644 --- a/src/main/resources/config.yml +++ b/src/main/resources/config.yml @@ -139,13 +139,13 @@ autowipe: allowdrops: true # What blocks should be blocked? -blockedBlocks: +blocked_blocks: - "SPAWNER" - "STRUCTURE_BLOCK" - "JIGSAW" # What entities should be blocked? -blockedEntities: +blocked_entities: - "WITHER" - "ENDER_DRAGON" - "MINECART_TNT"