Change config entries

This commit is contained in:
Telesphoreo 2022-04-09 00:08:03 -05:00
parent e421867f63
commit e35d70bc3c
6 changed files with 30 additions and 18 deletions

View File

@ -28,7 +28,7 @@ public class BlockListener extends PlexListener
@EventHandler(priority = EventPriority.LOW) @EventHandler(priority = EventPriority.LOW)
public void onBlockPlace(BlockPlaceEvent event) public void onBlockPlace(BlockPlaceEvent event)
{ {
List<String> blockedBlocksConfig = plugin.config.getStringList("blockedBlocks"); List<String> blockedBlocksConfig = plugin.config.getStringList("blocked_blocks");
if (blockedBlocksConfig != cachedBlockedBlocksConfig) if (blockedBlocksConfig != cachedBlockedBlocksConfig)
{ {
blockedBlocks.clear(); blockedBlocks.clear();

View File

@ -9,6 +9,9 @@ public class DropListener extends PlexListener
@EventHandler @EventHandler
public void onPlayerDropItem(PlayerDropItemEvent event) public void onPlayerDropItem(PlayerDropItemEvent event)
{ {
if (!plugin.config.getBoolean("allowdrops")) event.setCancelled(true); if (!plugin.config.getBoolean("allowdrops"))
{
event.setCancelled(true);
}
} }
} }

View File

@ -39,7 +39,7 @@ public class SpawnListener extends PlexListener
return; 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); event.setCancelled(true);
Location location = event.getLocation(); Location location = event.getLocation();
@ -109,7 +109,8 @@ public class SpawnListener extends PlexListener
} }
} }
private static EntityType spawnEggToEntityType(Material mat){ private static EntityType spawnEggToEntityType(Material mat)
{
EntityType eggType; EntityType eggType;
try try
{ {

View File

@ -32,10 +32,14 @@ public class MongoConnection extends PlexBase
if (database != null && !database.isEmpty()) if (database != null && !database.isEmpty())
{ {
connectionString = "mongodb://" + username + ":" + password + "@" + host + ":" + port + "/?authSource=" + database; connectionString = "mongodb://" + username + ":" + password + "@" + host + ":" + port + "/?authSource=" + database;
} else { }
else
{
connectionString = "mongodb://" + username + ":" + password + "@" + host + ":" + port + "/"; connectionString = "mongodb://" + username + ":" + password + "@" + host + ":" + port + "/";
} }
} else { }
else
{
connectionString = "mongodb://" + host + ":" + port + "/"; connectionString = "mongodb://" + host + ":" + port + "/";
} }
connectionString += "?uuidRepresentation=STANDARD"; connectionString += "?uuidRepresentation=STANDARD";

View File

@ -45,7 +45,8 @@ public class SQLConnection extends PlexBase
{ {
dataSource.setJdbcUrl("jdbc:sqlite:" + new File(plugin.getDataFolder(), "database.db").getAbsolutePath()); dataSource.setJdbcUrl("jdbc:sqlite:" + new File(plugin.getDataFolder(), "database.db").getAbsolutePath());
plugin.setStorageType(StorageType.SQLITE); 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"); Class.forName("org.mariadb.jdbc.Driver");
dataSource.setJdbcUrl("jdbc:mariadb://" + host + ":" + port + "/" + database); dataSource.setJdbcUrl("jdbc:mariadb://" + host + ":" + port + "/" + database);
@ -53,7 +54,8 @@ public class SQLConnection extends PlexBase
dataSource.setPassword(password); dataSource.setPassword(password);
Plex.get().setStorageType(StorageType.MARIADB); Plex.get().setStorageType(StorageType.MARIADB);
} }
} catch (ClassNotFoundException throwables) }
catch (ClassNotFoundException throwables)
{ {
throwables.printStackTrace(); throwables.printStackTrace();
} }
@ -90,7 +92,8 @@ public class SQLConnection extends PlexBase
"`note` VARCHAR(2000), " + "`note` VARCHAR(2000), " +
"`timestamp` BIGINT" + "`timestamp` BIGINT" +
");").execute(); ");").execute();
} catch (SQLException throwables) }
catch (SQLException throwables)
{ {
throwables.printStackTrace(); throwables.printStackTrace();
} }
@ -105,7 +108,8 @@ public class SQLConnection extends PlexBase
try try
{ {
return dataSource.getConnection(); return dataSource.getConnection();
} catch (SQLException e) }
catch (SQLException e)
{ {
e.printStackTrace(); e.printStackTrace();
} }

View File

@ -139,13 +139,13 @@ autowipe:
allowdrops: true allowdrops: true
# What blocks should be blocked? # What blocks should be blocked?
blockedBlocks: blocked_blocks:
- "SPAWNER" - "SPAWNER"
- "STRUCTURE_BLOCK" - "STRUCTURE_BLOCK"
- "JIGSAW" - "JIGSAW"
# What entities should be blocked? # What entities should be blocked?
blockedEntities: blocked_entities:
- "WITHER" - "WITHER"
- "ENDER_DRAGON" - "ENDER_DRAGON"
- "MINECART_TNT" - "MINECART_TNT"