diff --git a/SchematicSystem_API/src/de/steamwar/schematicsystem/Constants.java b/SchematicSystem_API/src/de/steamwar/schematicsystem/Constants.java deleted file mode 100644 index 31439aa..0000000 --- a/SchematicSystem_API/src/de/steamwar/schematicsystem/Constants.java +++ /dev/null @@ -1,48 +0,0 @@ -/* - This file is a part of the SteamWar software. - - Copyright (C) 2020 SteamWar.de-Serverteam - - This program is free software: you can redistribute it and/or modify - it under the terms of the GNU Affero General Public License as published by - the Free Software Foundation, either version 3 of the License, or - (at your option) any later version. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU Affero General Public License for more details. - - You should have received a copy of the GNU Affero General Public License - along with this program. If not, see . -*/ - -package de.steamwar.schematicsystem; - -import java.nio.file.attribute.PosixFilePermission; -import java.util.EnumSet; -import java.util.Set; - -public class Constants { - private Constants(){} - - public static final Set FILE_PERMS = EnumSet.of( - PosixFilePermission.OWNER_READ, - PosixFilePermission.OWNER_WRITE, - PosixFilePermission.GROUP_READ, - PosixFilePermission.GROUP_WRITE, - PosixFilePermission.OTHERS_READ, - PosixFilePermission.OTHERS_WRITE); - public static final Set FOLDER_PERMS = EnumSet.of( - PosixFilePermission.OWNER_READ, - PosixFilePermission.OWNER_WRITE, - PosixFilePermission.GROUP_READ, - PosixFilePermission.GROUP_WRITE, - PosixFilePermission.OTHERS_READ, - PosixFilePermission.OTHERS_WRITE, - PosixFilePermission.OWNER_EXECUTE, - PosixFilePermission.GROUP_EXECUTE, - PosixFilePermission.OTHERS_EXECUTE); - - public static final String SCHEM_DIR = "/home/minecraft/schematics/"; -} diff --git a/SchematicSystem_Main/src/de/steamwar/schematicsystem/CheckSchemType.java b/SchematicSystem_Main/src/de/steamwar/schematicsystem/CheckSchemType.java index cd4a8ae..9ed619a 100644 --- a/SchematicSystem_Main/src/de/steamwar/schematicsystem/CheckSchemType.java +++ b/SchematicSystem_Main/src/de/steamwar/schematicsystem/CheckSchemType.java @@ -46,7 +46,7 @@ public class CheckSchemType implements ICheckSchemType { private final int maxDispenser; private final int maxBlocks; - CheckSchemType(ConfigurationSection section) { + private CheckSchemType(ConfigurationSection section) { name = section.getName(); width = section.getInt("width"); height = section.getInt("height"); @@ -64,6 +64,12 @@ public class CheckSchemType implements ICheckSchemType { types.put(SchematicType.fromDB("c" + name), this); } + static void init(ConfigurationSection config){ + ConfigurationSection types = config.getConfigurationSection("Schematics"); + for(String sectionName : types.getKeys(false)) + new CheckSchemType(types.getConfigurationSection(sectionName)); + } + public static CheckSchemType get(SchematicType type){ return types.get(type); } diff --git a/SchematicSystem_Main/src/de/steamwar/schematicsystem/SchematicSystem.java b/SchematicSystem_Main/src/de/steamwar/schematicsystem/SchematicSystem.java index 881cab5..ddb8d6c 100644 --- a/SchematicSystem_Main/src/de/steamwar/schematicsystem/SchematicSystem.java +++ b/SchematicSystem_Main/src/de/steamwar/schematicsystem/SchematicSystem.java @@ -19,36 +19,24 @@ package de.steamwar.schematicsystem; -import de.steamwar.core.CommandRemover; import de.steamwar.schematicsystem.commands.SchematicCommand; import org.bukkit.Bukkit; -import org.bukkit.configuration.ConfigurationSection; -import org.bukkit.configuration.file.FileConfiguration; import org.bukkit.plugin.java.JavaPlugin; import java.io.File; +import java.util.logging.Level; public class SchematicSystem extends JavaPlugin { - public static final String PREFIX = "§eSchematic§8» §7"; - public static SchematicSystem INSTANCE; @Override public void onEnable() { - if (!new File("plugins/" + getName() + "/config.yml").exists()) { + if (!new File(getDataFolder(), "config.yml").exists()) { saveDefaultConfig(); - Bukkit.getLogger().info(SchematicSystem.PREFIX + "config.yml erstellt und geladen!"); - Bukkit.shutdown(); + Bukkit.getLogger().log(Level.SEVERE, "config.yml erstellt und geladen!"); } - FileConfiguration config = getConfig(); - ConfigurationSection types = config.getConfigurationSection("Schematics"); - for(String sectionName : types.getKeys(false)) - new CheckSchemType(types.getConfigurationSection(sectionName)); - - CommandRemover.removeAll("/schematic", "/schem", "//schematic", "//schem"); - + CheckSchemType.init(getConfig()); getCommand("schem").setExecutor(new SchematicCommand()); - INSTANCE = this; } }