Compare commits

..

No commits in common. "49c0f16934d4d05ee0870238b9109acce918e5fb" and "813fee1017de2ee5219fcefc6d2306fd47752bff" have entirely different histories.

16 changed files with 15 additions and 295 deletions

View file

@ -209,4 +209,4 @@ VALID_DONATION_KEY: "Valid donation key."
VERSION_INCOMPATIBLE: "{0} {1} is not supported." VERSION_INCOMPATIBLE: "{0} {1} is not supported."
VERSION_NOTICE: "Version {0} is now available." VERSION_NOTICE: "Version {0} is now available."
VERSION_REQUIRED: "{0} {1} or higher is required." VERSION_REQUIRED: "{0} {1} or higher is required."
WORLD_NOT_FOUND: "World \"{0}\" not found." WORLD_NOT_FOUND: "World \"{0}\" not found."

View file

@ -139,7 +139,7 @@ PATCH_SKIP_UPDATE: "{Пропущена таблица|Пропущен инде
PATCH_STARTED: "Выполняется обновление {0}. Пожалуйста, подождите..." PATCH_STARTED: "Выполняется обновление {0}. Пожалуйста, подождите..."
PATCH_SUCCESS: "Успешно обновлен до {0}." PATCH_SUCCESS: "Успешно обновлен до {0}."
PATCH_UPGRADING: "Выполняется обновление базы данных. Пожалуйста, подождите..." PATCH_UPGRADING: "Выполняется обновление базы данных. Пожалуйста, подождите..."
PLEASE_SELECT: "Пожалуйста выберите: «{0}» или «{1}»." PLEASE_SELECT: "Пожалуйста выберете: «{0}» или «{1}»."
PREVIEW_CANCELLED: "Предварительный просмотр отменен." PREVIEW_CANCELLED: "Предварительный просмотр отменен."
PREVIEW_CANCELLING: "Отмена предварительного просмотра..." PREVIEW_CANCELLING: "Отмена предварительного просмотра..."
PREVIEW_IN_GAME: "Предварительный просмотр откатов доступен только в игре." PREVIEW_IN_GAME: "Предварительный просмотр откатов доступен только в игре."

25
pom.xml
View file

@ -113,31 +113,6 @@
<skipTests>${skipTests}</skipTests> <skipTests>${skipTests}</skipTests>
</configuration> </configuration>
</plugin> </plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-enforcer-plugin</artifactId>
<version>3.6.1</version>
<executions>
<execution>
<phase>validate</phase>
<goals><goal>enforce</goal></goals>
<configuration>
<rules>
<requireNoRepositories>
<allowedRepositories>
<allowedRepository>central</allowedRepository>
<allowedRepository>enginehub-repo</allowedRepository>
<allowedRepository>spigot-repo</allowedRepository>
<allowedRepository>paper-repo</allowedRepository>
<allowedRepository>codemc-repo</allowedRepository>
<allowedRepository>jitpack.io</allowedRepository>
</allowedRepositories>
</requireNoRepositories>
</rules>
</configuration>
</execution>
</executions>
</plugin>
</plugins> </plugins>
</build> </build>
<profiles> <profiles>

View file

@ -1,10 +1,7 @@
package net.coreprotect.bukkit; package net.coreprotect.bukkit;
import java.util.Arrays;
import java.util.HashSet;
import java.util.List; import java.util.List;
import java.util.Map; import java.util.Map;
import java.util.Set;
import org.bukkit.Color; import org.bukkit.Color;
import org.bukkit.DyeColor; import org.bukkit.DyeColor;
@ -23,7 +20,6 @@ import org.bukkit.entity.EntityType;
import org.bukkit.entity.ItemFrame; import org.bukkit.entity.ItemFrame;
import org.bukkit.entity.LivingEntity; import org.bukkit.entity.LivingEntity;
import org.bukkit.event.block.SignChangeEvent; import org.bukkit.event.block.SignChangeEvent;
import org.bukkit.event.inventory.InventoryType;
import org.bukkit.event.player.PlayerInteractEvent; import org.bukkit.event.player.PlayerInteractEvent;
import org.bukkit.inventory.ItemStack; import org.bukkit.inventory.ItemStack;
import org.bukkit.inventory.MerchantRecipe; import org.bukkit.inventory.MerchantRecipe;
@ -89,7 +85,6 @@ public class BukkitAdapter implements BukkitInterface {
} }
// -------------------- Basic data conversion methods -------------------- // -------------------- Basic data conversion methods --------------------
public static Set<Material> EMPTY_SET = new HashSet<>(Arrays.asList());
@Override @Override
public String parseLegacyName(String name) { public String parseLegacyName(String name) {
@ -355,19 +350,4 @@ public class BukkitAdapter implements BukkitInterface {
public Object getRegistryValue(String key, Object tClass) { public Object getRegistryValue(String key, Object tClass) {
return null; return null;
} }
@Override
public boolean isCrafter(InventoryType type) {
return false;
}
@Override
public boolean isCopperChest(Material material) {
return false;
}
@Override
public Set<Material> copperChestMaterials() {
return EMPTY_SET;
}
} }

View file

@ -2,7 +2,6 @@ package net.coreprotect.bukkit;
import java.util.List; import java.util.List;
import java.util.Map; import java.util.Map;
import java.util.Set;
import org.bukkit.Material; import org.bukkit.Material;
import org.bukkit.World; import org.bukkit.World;
@ -15,7 +14,6 @@ import org.bukkit.entity.Entity;
import org.bukkit.entity.EntityType; import org.bukkit.entity.EntityType;
import org.bukkit.entity.LivingEntity; import org.bukkit.entity.LivingEntity;
import org.bukkit.event.block.SignChangeEvent; import org.bukkit.event.block.SignChangeEvent;
import org.bukkit.event.inventory.InventoryType;
import org.bukkit.event.player.PlayerInteractEvent; import org.bukkit.event.player.PlayerInteractEvent;
import org.bukkit.inventory.ItemStack; import org.bukkit.inventory.ItemStack;
import org.bukkit.inventory.MerchantRecipe; import org.bukkit.inventory.MerchantRecipe;
@ -434,11 +432,4 @@ public interface BukkitInterface {
* @return The parsed name * @return The parsed name
*/ */
String parseLegacyName(String name); String parseLegacyName(String name);
boolean isCrafter(InventoryType type);
boolean isCopperChest(Material material);
Set<Material> copperChestMaterials();
} }

View file

@ -1,7 +1,5 @@
package net.coreprotect.bukkit; package net.coreprotect.bukkit;
import java.util.Arrays;
import java.util.HashSet;
import java.util.List; import java.util.List;
import java.util.Set; import java.util.Set;
@ -11,7 +9,6 @@ import org.bukkit.Material;
import org.bukkit.NamespacedKey; import org.bukkit.NamespacedKey;
import org.bukkit.Tag; import org.bukkit.Tag;
import org.bukkit.entity.EntityType; import org.bukkit.entity.EntityType;
import org.bukkit.event.inventory.InventoryType;
import net.coreprotect.model.BlockGroup; import net.coreprotect.model.BlockGroup;
@ -25,8 +22,6 @@ import net.coreprotect.model.BlockGroup;
*/ */
public class Bukkit_v1_21 extends Bukkit_v1_20 implements BukkitInterface { public class Bukkit_v1_21 extends Bukkit_v1_20 implements BukkitInterface {
public static Set<Material> COPPER_CHESTS = new HashSet<>(Arrays.asList());
/** /**
* Initializes the Bukkit_v1_21 adapter with 1.21-specific block groups and mappings. * Initializes the Bukkit_v1_21 adapter with 1.21-specific block groups and mappings.
* Sets up collections of blocks with similar behavior for efficient handling. * Sets up collections of blocks with similar behavior for efficient handling.
@ -34,9 +29,6 @@ public class Bukkit_v1_21 extends Bukkit_v1_20 implements BukkitInterface {
public Bukkit_v1_21() { public Bukkit_v1_21() {
initializeBlockGroups(); initializeBlockGroups();
initializeTrapdoorBlocks(); initializeTrapdoorBlocks();
BlockGroup.INTERACT_BLOCKS.addAll(copperChestMaterials());
BlockGroup.CONTAINERS.addAll(copperChestMaterials());
BlockGroup.UPDATE_STATE.addAll(copperChestMaterials());
} }
/** /**
@ -162,40 +154,4 @@ public class Bukkit_v1_21 extends Bukkit_v1_20 implements BukkitInterface {
wolf.setVariant(variant); wolf.setVariant(variant);
} }
@Override
public boolean isCrafter(InventoryType type) {
return type == InventoryType.CRAFTER;
}
@Override
public boolean isCopperChest(Material material) {
if (COPPER_CHESTS.contains(material) && material != Material.CHEST) {
return true;
}
return false;
}
@Override
public Set<Material> copperChestMaterials() {
if (COPPER_CHESTS.isEmpty()) {
Material copperChest = Material.getMaterial("COPPER_CHEST");
if (copperChest == null) {
COPPER_CHESTS.add(Material.CHEST);
}
else {
COPPER_CHESTS.add(Material.getMaterial("COPPER_CHEST"));
COPPER_CHESTS.add(Material.getMaterial("EXPOSED_COPPER_CHEST"));
COPPER_CHESTS.add(Material.getMaterial("WEATHERED_COPPER_CHEST"));
COPPER_CHESTS.add(Material.getMaterial("OXIDIZED_COPPER_CHEST"));
COPPER_CHESTS.add(Material.getMaterial("WAXED_COPPER_CHEST"));
COPPER_CHESTS.add(Material.getMaterial("WAXED_EXPOSED_COPPER_CHEST"));
COPPER_CHESTS.add(Material.getMaterial("WAXED_WEATHERED_COPPER_CHEST"));
COPPER_CHESTS.add(Material.getMaterial("WAXED_OXIDIZED_COPPER_CHEST"));
}
}
return COPPER_CHESTS;
}
} }

View file

@ -39,13 +39,9 @@ public class StatusCommand {
String versionCheck = ""; String versionCheck = "";
if (Config.getGlobal().CHECK_UPDATES) { if (Config.getGlobal().CHECK_UPDATES) {
String latestVersion = NetworkHandler.latestVersion(); String latestVersion = NetworkHandler.latestVersion();
String latestEdgeVersion = NetworkHandler.latestEdgeVersion();
if (latestVersion != null) { if (latestVersion != null) {
versionCheck = " (" + Phrase.build(Phrase.LATEST_VERSION, "v" + latestVersion) + ")"; versionCheck = " (" + Phrase.build(Phrase.LATEST_VERSION, "v" + latestVersion) + ")";
} }
else if (latestEdgeVersion != null && !VersionUtils.isCommunityEdition()) {
versionCheck = " (" + Phrase.build(Phrase.LATEST_VERSION, "v" + latestEdgeVersion) + ")";
}
} }
Chat.sendMessage(player, Color.WHITE + "----- " + Color.DARK_AQUA + "CoreProtect" + (VersionUtils.isCommunityEdition() ? " " + ConfigHandler.COMMUNITY_EDITION : "") + Color.WHITE + " -----"); Chat.sendMessage(player, Color.WHITE + "----- " + Color.DARK_AQUA + "CoreProtect" + (VersionUtils.isCommunityEdition() ? " " + ConfigHandler.COMMUNITY_EDITION : "") + Color.WHITE + " -----");

View file

@ -40,11 +40,6 @@ import net.coreprotect.utility.VersionUtils;
import oshi.hardware.CentralProcessor; import oshi.hardware.CentralProcessor;
public class ConfigHandler extends Queue { public class ConfigHandler extends Queue {
public enum CacheType {
MATERIALS, BLOCKDATA, ART, ENTITIES, WORLDS
}
public static int SERVER_VERSION = 0; public static int SERVER_VERSION = 0;
public static final int EDITION_VERSION = 2; public static final int EDITION_VERSION = 2;
public static final String EDITION_BRANCH = VersionUtils.getBranch(); public static final String EDITION_BRANCH = VersionUtils.getBranch();
@ -52,8 +47,7 @@ public class ConfigHandler extends Queue {
public static final String COMMUNITY_EDITION = "Community Edition"; public static final String COMMUNITY_EDITION = "Community Edition";
public static final String JAVA_VERSION = "11.0"; public static final String JAVA_VERSION = "11.0";
public static final String MINECRAFT_VERSION = "1.16"; public static final String MINECRAFT_VERSION = "1.16";
public static final String PATCH_VERSION = "23.0"; public static final String LATEST_VERSION = "1.21.8";
public static final String LATEST_VERSION = "1.21.10";
public static String path = "plugins/CoreProtect/"; public static String path = "plugins/CoreProtect/";
public static String sqlite = "database.db"; public static String sqlite = "database.db";
public static String host = "127.0.0.1"; public static String host = "127.0.0.1";
@ -274,7 +268,7 @@ public class ConfigHandler extends Queue {
Database.createDatabaseTables(ConfigHandler.prefix, false, null, Config.getGlobal().MYSQL, false); Database.createDatabaseTables(ConfigHandler.prefix, false, null, Config.getGlobal().MYSQL, false);
} }
public static void loadMaterials(Statement statement) { public static void loadTypes(Statement statement) {
try { try {
String query = "SELECT id,material FROM " + ConfigHandler.prefix + "material_map"; String query = "SELECT id,material FROM " + ConfigHandler.prefix + "material_map";
ResultSet rs = statement.executeQuery(query); ResultSet rs = statement.executeQuery(query);
@ -292,16 +286,9 @@ public class ConfigHandler extends Queue {
} }
} }
rs.close(); rs.close();
}
catch (Exception e) {
e.printStackTrace();
}
}
public static void loadBlockdata(Statement statement) { query = "SELECT id,data FROM " + ConfigHandler.prefix + "blockdata_map";
try { rs = statement.executeQuery(query);
String query = "SELECT id,data FROM " + ConfigHandler.prefix + "blockdata_map";
ResultSet rs = statement.executeQuery(query);
ConfigHandler.blockdata.clear(); ConfigHandler.blockdata.clear();
ConfigHandler.blockdataReversed.clear(); ConfigHandler.blockdataReversed.clear();
blockdataId = 0; blockdataId = 0;
@ -316,16 +303,9 @@ public class ConfigHandler extends Queue {
} }
} }
rs.close(); rs.close();
}
catch (Exception e) {
e.printStackTrace();
}
}
public static void loadArt(Statement statement) { query = "SELECT id,art FROM " + ConfigHandler.prefix + "art_map";
try { rs = statement.executeQuery(query);
String query = "SELECT id,art FROM " + ConfigHandler.prefix + "art_map";
ResultSet rs = statement.executeQuery(query);
ConfigHandler.art.clear(); ConfigHandler.art.clear();
ConfigHandler.artReversed.clear(); ConfigHandler.artReversed.clear();
artId = 0; artId = 0;
@ -340,16 +320,9 @@ public class ConfigHandler extends Queue {
} }
} }
rs.close(); rs.close();
}
catch (Exception e) {
e.printStackTrace();
}
}
public static void loadEntities(Statement statement) { query = "SELECT id,entity FROM " + ConfigHandler.prefix + "entity_map";
try { rs = statement.executeQuery(query);
String query = "SELECT id,entity FROM " + ConfigHandler.prefix + "entity_map";
ResultSet rs = statement.executeQuery(query);
ConfigHandler.entities.clear(); ConfigHandler.entities.clear();
ConfigHandler.entitiesReversed.clear(); ConfigHandler.entitiesReversed.clear();
entityId = 0; entityId = 0;
@ -370,67 +343,6 @@ public class ConfigHandler extends Queue {
} }
} }
public static void loadTypes(Statement statement) {
loadMaterials(statement);
loadBlockdata(statement);
loadArt(statement);
loadEntities(statement);
}
/**
* Unified method to reload cache from database when DATABASE_LOCK is false (multi-server setup)
*
* @param type
* The type of cache to reload
* @param name
* The name to look up after reload
* @return The ID if found after reload, or -1 if not found
*/
public static int reloadAndGetId(CacheType type, String name) {
// Only reload if DATABASE_LOCK is false (multi-server setup)
if (Config.getGlobal().DATABASE_LOCK) {
return -1;
}
try (Connection connection = Database.getConnection(true)) {
if (connection != null) {
Statement statement = connection.createStatement();
// Reload appropriate cache based on type
switch (type) {
case MATERIALS:
loadMaterials(statement);
statement.close();
return materials.getOrDefault(name, -1);
case BLOCKDATA:
loadBlockdata(statement);
statement.close();
return blockdata.getOrDefault(name, -1);
case ART:
loadArt(statement);
statement.close();
return art.getOrDefault(name, -1);
case ENTITIES:
loadEntities(statement);
statement.close();
return entities.getOrDefault(name, -1);
case WORLDS:
loadWorlds(statement);
statement.close();
return worlds.getOrDefault(name, -1);
default:
statement.close();
return -1;
}
}
}
catch (Exception e) {
e.printStackTrace();
}
return -1;
}
public static void loadWorlds(Statement statement) { public static void loadWorlds(Statement statement) {
try { try {
String query = "SELECT id,world FROM " + ConfigHandler.prefix + "world"; String query = "SELECT id,world FROM " + ConfigHandler.prefix + "world";

View file

@ -209,7 +209,7 @@ public class RollbackProcessor {
BlockData checkData = rowType == Material.AIR ? blockData : rawBlockData; BlockData checkData = rowType == Material.AIR ? blockData : rawBlockData;
if (checkData != null) { if (checkData != null) {
if (checkData.getAsString().equals(pendingChangeData.getAsString()) || checkData instanceof org.bukkit.block.data.MultipleFacing || checkData instanceof org.bukkit.block.data.type.Stairs || checkData instanceof org.bukkit.block.data.type.RedstoneWire) { if (checkData.getAsString().equals(pendingChangeData.getAsString()) || checkData instanceof org.bukkit.block.data.MultipleFacing || checkData instanceof org.bukkit.block.data.type.Stairs || checkData instanceof org.bukkit.block.data.type.RedstoneWire) {
if (rowType != Material.CHEST && rowType != Material.TRAPPED_CHEST && !BukkitAdapter.ADAPTER.isCopperChest(rowType)) { // always update double chests if (rowType != Material.CHEST && rowType != Material.TRAPPED_CHEST) { // always update double chests
changeBlock = false; changeBlock = false;
} }
} }

View file

@ -10,14 +10,12 @@ import java.util.concurrent.atomic.AtomicLong;
import org.bukkit.Location; import org.bukkit.Location;
import org.bukkit.Material; import org.bukkit.Material;
import org.bukkit.World; import org.bukkit.World;
import org.bukkit.block.Block;
import org.bukkit.block.BlockState; import org.bukkit.block.BlockState;
import org.bukkit.block.DoubleChest; import org.bukkit.block.DoubleChest;
import org.bukkit.entity.Player; import org.bukkit.entity.Player;
import org.bukkit.event.EventHandler; import org.bukkit.event.EventHandler;
import org.bukkit.event.EventPriority; import org.bukkit.event.EventPriority;
import org.bukkit.event.Listener; import org.bukkit.event.Listener;
import org.bukkit.event.inventory.ClickType;
import org.bukkit.event.inventory.InventoryAction; import org.bukkit.event.inventory.InventoryAction;
import org.bukkit.event.inventory.InventoryClickEvent; import org.bukkit.event.inventory.InventoryClickEvent;
import org.bukkit.event.inventory.InventoryDragEvent; import org.bukkit.event.inventory.InventoryDragEvent;
@ -29,7 +27,6 @@ import org.bukkit.inventory.InventoryHolder;
import org.bukkit.inventory.ItemStack; import org.bukkit.inventory.ItemStack;
import net.coreprotect.CoreProtect; import net.coreprotect.CoreProtect;
import net.coreprotect.bukkit.BukkitAdapter;
import net.coreprotect.config.Config; import net.coreprotect.config.Config;
import net.coreprotect.config.ConfigHandler; import net.coreprotect.config.ConfigHandler;
import net.coreprotect.consumer.Queue; import net.coreprotect.consumer.Queue;
@ -345,58 +342,9 @@ public final class InventoryChangeListener extends Queue implements Listener {
return true; return true;
} }
private boolean checkCrafterSlotChange(InventoryClickEvent event) {
// Check if the clicked inventory is a crafter
if (!BukkitAdapter.ADAPTER.isCrafter(event.getInventory().getType())) {
return false;
}
// Check that the Action is NOTHING
if (event.getAction() != InventoryAction.NOTHING) {
return false;
}
// Check if the clicked slot is one of the crafter slots
if (event.getRawSlot() < 0 || event.getRawSlot() > 8) {
return false;
}
// Check that the click type is not a middle click
if (!(event.getClick() == ClickType.LEFT || event.getClick() == ClickType.RIGHT)) {
return false;
}
// Gather other necessary information
Player player = (Player) event.getWhoClicked();
Inventory inventory = event.getInventory();
Location location = null;
try {
location = inventory.getLocation();
}
catch (Exception e) {
return false;
}
if (location == null) {
return false;
}
Block block = location.getBlock();
BlockState blockState = block.getState();
Queue.queueBlockPlace(player.getName(), blockState, block.getType(), blockState, block.getType(), -1, 0, blockState.getBlockData().getAsString());
return true;
}
@EventHandler(priority = EventPriority.LOWEST) @EventHandler(priority = EventPriority.LOWEST)
protected void onInventoryClick(InventoryClickEvent event) { protected void onInventoryClick(InventoryClickEvent event) {
InventoryAction inventoryAction = event.getAction(); InventoryAction inventoryAction = event.getAction();
if (checkCrafterSlotChange(event)) {
return;
}
if (inventoryAction == InventoryAction.NOTHING) { if (inventoryAction == InventoryAction.NOTHING) {
return; return;
} }

View file

@ -145,7 +145,7 @@ public final class PlayerInteractListener extends Queue implements Listener {
} }
else if (isContainerBlock && Config.getConfig(world).ITEM_TRANSACTIONS) { else if (isContainerBlock && Config.getConfig(world).ITEM_TRANSACTIONS) {
Location location = null; Location location = null;
if (type.equals(Material.CHEST) || type.equals(Material.TRAPPED_CHEST) || BukkitAdapter.ADAPTER.isCopperChest(type)) { if (type.equals(Material.CHEST) || type.equals(Material.TRAPPED_CHEST)) {
Chest chest = (Chest) clickedBlock.getState(); Chest chest = (Chest) clickedBlock.getState();
InventoryHolder inventoryHolder = chest.getInventory().getHolder(); InventoryHolder inventoryHolder = chest.getInventory().getHolder();

View file

@ -44,13 +44,6 @@ public class VersionCheckService {
return false; return false;
} }
// Patch version validation
if (VersionUtils.newVersion(ConfigHandler.PATCH_VERSION, VersionUtils.getPluginVersion()) && !VersionUtils.isBranch("dev")) {
Chat.console(Phrase.build(Phrase.VERSION_INCOMPATIBLE, "CoreProtect", "v" + VersionUtils.getPluginVersion()));
Chat.sendConsoleMessage(Color.GREY + "[CoreProtect] " + Phrase.build(Phrase.INVALID_BRANCH_2));
return false;
}
// Branch validation // Branch validation
if (ConfigHandler.EDITION_BRANCH.length() == 0) { if (ConfigHandler.EDITION_BRANCH.length() == 0) {
Chat.sendConsoleMessage(Color.RED + "[CoreProtect] " + Phrase.build(Phrase.INVALID_BRANCH_1)); Chat.sendConsoleMessage(Color.RED + "[CoreProtect] " + Phrase.build(Phrase.INVALID_BRANCH_1));

View file

@ -207,8 +207,7 @@ public class BlockUtils {
try { try {
if (blockState instanceof BlockInventoryHolder) { if (blockState instanceof BlockInventoryHolder) {
if (singleBlock) { if (singleBlock) {
List<Material> chests = new java.util.ArrayList<>(java.util.Arrays.asList(Material.CHEST, Material.TRAPPED_CHEST)); List<Material> chests = java.util.Arrays.asList(Material.CHEST, Material.TRAPPED_CHEST);
chests.addAll(BukkitAdapter.ADAPTER.copperChestMaterials());
Material type = blockState.getType(); Material type = blockState.getType();
if (chests.contains(type)) { if (chests.contains(type)) {
inventory = ((org.bukkit.block.Chest) blockState).getBlockInventory(); inventory = ((org.bukkit.block.Chest) blockState).getBlockInventory();

View file

@ -33,12 +33,6 @@ public class EntityUtils extends Queue {
id = ConfigHandler.entities.get(name); id = ConfigHandler.entities.get(name);
} }
else if (internal) { else if (internal) {
// Check if another server has already added this entity (multi-server setup)
id = ConfigHandler.reloadAndGetId(ConfigHandler.CacheType.ENTITIES, name);
if (id != -1) {
return id;
}
int entityID = ConfigHandler.entityId + 1; int entityID = ConfigHandler.entityId + 1;
ConfigHandler.entities.put(name, entityID); ConfigHandler.entities.put(name, entityID);
ConfigHandler.entitiesReversed.put(entityID, name); ConfigHandler.entitiesReversed.put(entityID, name);

View file

@ -35,12 +35,6 @@ public class MaterialUtils extends Queue {
id = ConfigHandler.materials.get(name); id = ConfigHandler.materials.get(name);
} }
else if (internal) { else if (internal) {
// Check if another server has already added this material (multi-server setup)
id = ConfigHandler.reloadAndGetId(ConfigHandler.CacheType.MATERIALS, name);
if (id != -1) {
return id;
}
int mid = ConfigHandler.materialId + 1; int mid = ConfigHandler.materialId + 1;
ConfigHandler.materials.put(name, mid); ConfigHandler.materials.put(name, mid);
ConfigHandler.materialsReversed.put(mid, name); ConfigHandler.materialsReversed.put(mid, name);
@ -60,12 +54,6 @@ public class MaterialUtils extends Queue {
id = ConfigHandler.blockdata.get(data); id = ConfigHandler.blockdata.get(data);
} }
else if (internal) { else if (internal) {
// Check if another server has already added this blockdata (multi-server setup)
id = ConfigHandler.reloadAndGetId(ConfigHandler.CacheType.BLOCKDATA, data);
if (id != -1) {
return id;
}
int bid = ConfigHandler.blockdataId + 1; int bid = ConfigHandler.blockdataId + 1;
ConfigHandler.blockdata.put(data, bid); ConfigHandler.blockdata.put(data, bid);
ConfigHandler.blockdataReversed.put(bid, data); ConfigHandler.blockdataReversed.put(bid, data);
@ -147,12 +135,6 @@ public class MaterialUtils extends Queue {
id = ConfigHandler.art.get(name); id = ConfigHandler.art.get(name);
} }
else if (internal) { else if (internal) {
// Check if another server has already added this art (multi-server setup)
id = ConfigHandler.reloadAndGetId(ConfigHandler.CacheType.ART, name);
if (id != -1) {
return id;
}
int artID = ConfigHandler.artId + 1; int artID = ConfigHandler.artId + 1;
ConfigHandler.art.put(name, artID); ConfigHandler.art.put(name, artID);
ConfigHandler.artReversed.put(artID, name); ConfigHandler.artReversed.put(artID, name);

View file

@ -16,12 +16,6 @@ public class WorldUtils extends Queue {
int id = -1; int id = -1;
try { try {
if (ConfigHandler.worlds.get(name) == null) { if (ConfigHandler.worlds.get(name) == null) {
// Check if another server has already added this world (multi-server setup)
id = ConfigHandler.reloadAndGetId(ConfigHandler.CacheType.WORLDS, name);
if (id != -1) {
return id;
}
int wid = ConfigHandler.worldId + 1; int wid = ConfigHandler.worldId + 1;
ConfigHandler.worlds.put(name, wid); ConfigHandler.worlds.put(name, wid);
ConfigHandler.worldsReversed.put(wid, name); ConfigHandler.worldsReversed.put(wid, name);
@ -90,7 +84,7 @@ public class WorldUtils extends Queue {
return id; return id;
} }
public static String getWidIndex(String queryTable) { public static String getWidIndex(String queryTable) {
String index = ""; String index = "";
boolean isMySQL = net.coreprotect.config.Config.getGlobal().MYSQL; boolean isMySQL = net.coreprotect.config.Config.getGlobal().MYSQL;
@ -127,4 +121,4 @@ public class WorldUtils extends Queue {
return index; return index;
} }
} }