Include TrueOG Network config file

This commit is contained in:
NotAlexNoyle committed 2025-12-26 12:43:43 -05:00
1 parent 9f00558489
commit 96452cb51e
3 files changed
+288 -42

No files matched your search

@@ -1,22 +1,24 @@
package dev.mylesmor.sudosigns.config;
import dev.mylesmor.sudosigns.SudoSigns;
import dev.mylesmor.sudosigns.data.PlayerInput;
import dev.mylesmor.sudosigns.data.SignCommand;
import dev.mylesmor.sudosigns.data.SignMessage;
import dev.mylesmor.sudosigns.data.SudoSign;
import java.io.File;
import java.io.IOException;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Set;
import net.kyori.adventure.text.TextComponent;
import org.bukkit.Bukkit;
import org.bukkit.configuration.file.FileConfiguration;
import org.bukkit.configuration.file.YamlConfiguration;
import org.bukkit.entity.Player;
import dev.mylesmor.sudosigns.SudoSigns;
import dev.mylesmor.sudosigns.data.PlayerInput;
import dev.mylesmor.sudosigns.data.SignCommand;
import dev.mylesmor.sudosigns.data.SignMessage;
import dev.mylesmor.sudosigns.data.SudoSign;
import net.kyori.adventure.text.TextComponent;
/**
* The class for managing the plugins config.
*
@@ -131,30 +133,25 @@ public class ConfigManager {
public boolean loadCustomConfig() {
if (!SudoSigns.sudoSignsPlugin.getDataFolder().exists()) {
try {
SudoSigns.sudoSignsPlugin.getDataFolder().mkdir();
final File dataFolder = SudoSigns.sudoSignsPlugin.getDataFolder();
if (!dataFolder.exists() && !dataFolder.mkdirs()) {
}
Bukkit.getLogger().warning("ERROR: Failed to create plugin data folder!");
signConfigFile = new File(SudoSigns.sudoSignsPlugin.getDataFolder(), "signs.yml");
if (!signConfigFile.exists()) {
try {
signConfigFile.createNewFile();
} catch (IOException e) {
Bukkit.getLogger().warning(SudoSigns.getPlugin().getConfig().getString("config.console-prefix")
+ "ERROR: Failed to create config!");
e.printStackTrace();
return false;
}
}
signConfigFile = new File(dataFolder, "signs.yml");
try {
// Copy default from jar if missing
if (!signConfigFile.exists()) {
SudoSigns.sudoSignsPlugin.saveResource("signs.yml", false);
}
signConfig = YamlConfiguration.loadConfiguration(signConfigFile);
@@ -180,7 +177,6 @@ public class ConfigManager {
if (!signConfig.contains("version")) {
signConfig.createSection("version");
signConfig.set("version", "1.2.3");
save();
@@ -188,23 +184,24 @@ public class ConfigManager {
}
} catch (Exception e) {
return true;
} catch (Exception error) {
Bukkit.getLogger().warning(SudoSigns.getPlugin().getConfig().getString("config.console-prefix")
+ "ERROR: Failed to initialise signs.yml!");
e.printStackTrace();
error.printStackTrace();
return false;
}
return true;
}
public void fixConfig() {
Set<String> signSection = signConfig.getConfigurationSection("signs").getKeys(false);
final Set<String> signSection = signConfig.getConfigurationSection("signs").getKeys(false);
String name = null;
for (String key : signSection) {
@@ -213,9 +210,9 @@ public class ConfigManager {
name = key;
List<String> pCommands = signConfig.getStringList("signs." + key + ".player-commands");
List<String> cCommands = signConfig.getStringList("signs." + key + ".console-commands");
List<String> messages = signConfig.getStringList("signs." + key + ".messages");
final List<String> pCommands = signConfig.getStringList("signs." + key + ".player-commands");
final List<String> cCommands = signConfig.getStringList("signs." + key + ".console-commands");
final List<String> messages = signConfig.getStringList("signs." + key + ".messages");
if (pCommands.size() == 0 && cCommands.size() == 0 && messages.size() == 0) {
@@ -228,7 +225,7 @@ public class ConfigManager {
try {
ArrayList<HashMap<String, Double>> mapList = new ArrayList<>();
final ArrayList<HashMap<String, Double>> mapList = new ArrayList<>();
HashMap<String, Double> map = new HashMap<>();
for (String cmd : pCommands) {
@@ -26,7 +26,7 @@ import org.bukkit.entity.Player;
public class SignConfig {
private FileConfiguration signConfig;
private ConfigManager configManager;
private final ConfigManager configManager;
SignConfig(ConfigManager configManager) {
@@ -44,12 +44,11 @@ public class SignConfig {
// Loads the signs from the config.
public ArrayList<String> loadSigns() {
Map<String, SudoSign> tempSigns = new HashMap<>();
final Map<String, SudoSign> tempSigns = new HashMap<>();
Set<String> signSection = signConfig.getConfigurationSection("signs").getKeys(false);
String name;
ArrayList<String> invalidSigns = new ArrayList<>();
for (String key : signSection) {
name = key;
@@ -277,10 +276,11 @@ public class SignConfig {
if (s.getSign().getWorld().getBlockAt(s.getSign().getLocation()).getBlockData() instanceof Sign) {
Sign facing = (Sign) s.getSign().getWorld().getBlockAt(s.getSign().getLocation()).getBlockData();
final Sign facing = (Sign) s.getSign().getWorld().getBlockAt(s.getSign().getLocation())
.getBlockData();
Rotatable data = (Rotatable) facing.getBlockData();
BlockFace rotation = data.getRotation();
final Rotatable data = (Rotatable) facing.getBlockData();
final BlockFace rotation = data.getRotation();
locSec.set("rotation", rotation);
@@ -288,7 +288,7 @@ public class SignConfig {
.getBlockData() instanceof WallSign)
{
WallSign facing = (WallSign) s.getSign().getWorld().getBlockAt(s.getSign().getLocation())
final WallSign facing = (WallSign) s.getSign().getWorld().getBlockAt(s.getSign().getLocation())
.getBlockData();
locSec.set("rotation", facing.getFacing().toString());
@@ -304,11 +304,12 @@ public class SignConfig {
}
} catch (Exception e) {
} catch (Exception error) {
if (p != null) {
Util.sudoSignsMessage(p, "&cERROR: Failed to save sign %NAME% to the config!", name);
error.printStackTrace();
}
@@ -320,7 +321,7 @@ public class SignConfig {
if (signConfig.isConfigurationSection("signs." + name + "")) {
List<String> text = signConfig.getStringList("signs." + name + ".text");
final List<String> text = signConfig.getStringList("signs." + name + ".text");
text.set(lineNumber - 1, newText.content());
signConfig.set("signs." + name + ".text", text);
+248
View File
@@ -0,0 +1,248 @@
signs:
1Withdraw:
text:
- §l[Teller]
- §BWithdraw
- §B1 Diamond
- §BFrom Bank
price: 0.0
location:
world: world
x: -121.0
y: 44.0
z: -261.0
rotation: NORTH
blocktype: WARPED_WALL_SIGN
permissions: {}
messages: {}
player-commands:
- withdraw 1: 0.0
console-commands: {}
Deposit:
text:
- §l[Teller]
- §BDeposit
- §BDiamonds
- §BTo Bank
price: 0.0
location:
world: world
x: -123.0
y: 44.0
z: -261.0
rotation: NORTH
blocktype: WARPED_WALL_SIGN
permissions: {}
messages: {}
player-commands:
- deposit all: 0.0
console-commands: {}
Balance:
text:
- §l[Teller]
- §BCheck
- §BYour
- §BBalance
price: 0.0
location:
world: world
x: -125.0
y: 44.0
z: -261.0
rotation: NORTH
blocktype: WARPED_WALL_SIGN
permissions: {}
messages: {}
player-commands:
- balance: 0.0
console-commands: {}
SpleggDuel:
text:
- §8[§31v1 Duel§8]
- §60 of 10
- §6Players Waiting
- §8[§lJOIN§8]
price: 0.0
location:
world: world
x: -1.0
y: 64.0
z: -249.0
rotation: SOUTH
blocktype: OAK_WALL_SIGN
permissions: {}
messages:
- Splegg is not out yet!: 0.0
player-commands: {}
console-commands: {}
SpleggFFA:
text:
- §8[§aFFA§8]
- §60 of 10
- §6Players Waiting
- §8[§B§lJOIN§8]
price: 0.0
location:
world: world
x: 1.0
y: 64.0
z: -249.0
rotation: SOUTH
blocktype: OAK_WALL_SIGN
permissions: {}
messages:
- Splegg is not out yet!: 0.0
player-commands: {}
console-commands: {}
communitychest:
text:
- ''
- §5Community
- §BChest
- ''
price: 0.0
location:
world: world
x: -21.0
y: 63.0
z: -200.0
rotation: NORTH
blocktype: OAK_WALL_SIGN
permissions: {}
messages:
- Use this chest to share items with the community.: 0.0
player-commands: {}
console-commands: {}
balance:
text:
- ''
- §BCHECK
- §BBALANCE
- ''
price: 0.0
location:
world: world
x: -125.0
y: 43.0
z: -261.0
rotation: NORTH
blocktype: WARPED_WALL_SIGN
permissions: {}
messages: {}
player-commands:
- balance: 0.0
console-commands: {}
deposit:
text:
- ''
- §BDEPOSIT
- §BDIAMONDS
- ''
price: 0.0
location:
world: world
x: -123.0
y: 43.0
z: -261.0
rotation: NORTH
blocktype: WARPED_WALL_SIGN
permissions: {}
messages: {}
player-commands:
- deposit all: 0.0
console-commands: {}
withdraw1:
text:
- ''
- §BWITHDRAW
- §B1 DIAMOND
- ''
price: 0.0
location:
world: world
x: -120.0
y: 41.0
z: -261.0
rotation: NORTH
blocktype: WARPED_WALL_SIGN
permissions: {}
messages: {}
player-commands:
- withdraw 1: 0.0
console-commands: {}
withdraw4:
text:
- ''
- §BWITHDRAW
- §B4 DIAMONDS
- ''
price: 0.0
location:
world: world
x: -120.0
y: 42.0
z: -261.0
rotation: NORTH
blocktype: WARPED_WALL_SIGN
permissions: {}
messages: {}
player-commands: {}
console-commands: {}
withdraw16:
text:
- ''
- §BWITHDRAW
- §B16 DIAMONDS
- ''
price: 0.0
location:
world: world
x: -120.0
y: 43.0
z: -261.0
rotation: NORTH
blocktype: WARPED_WALL_SIGN
permissions: {}
messages: {}
player-commands:
- withdraw 16: 0.0
console-commands: {}
withdraw64:
text:
- ''
- §BWITHDRAW
- §B64 DIAMONDS
- ''
price: 0.0
location:
world: world
x: -121.0
y: 43.0
z: -261.0
rotation: NORTH
blocktype: WARPED_WALL_SIGN
permissions: {}
messages: {}
player-commands:
- withdraw 64: 0.0
console-commands: {}
store:
text:
- §2True§4OG Shop
- §BClick here to
- §bpurchase a
- §brank!
price: 0.0
location:
world: world
x: -128.0
y: 42.0
z: -261.0
rotation: NORTH
blocktype: OAK_WALL_SIGN
permissions: {}
messages: {}
player-commands:
- buy: 0.0
console-commands: {}
version: 1.2.3