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)
public void onBlockPlace(BlockPlaceEvent event)
{
List<String> blockedBlocksConfig = plugin.config.getStringList("blockedBlocks");
List<String> 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));

View File

@ -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);
}
}
}

View File

@ -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
{

View File

@ -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";

View File

@ -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();
}

View File

@ -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"