Vault -> DiamondBank-OG API
This commit is contained in:
1 parent
1f684943b3
commit
6f38551ab8
100 files changed
+1432
-1004
No files matched your search
@@ -0,0 +1,6 @@
|
||||
[submodule "libs/Utilities-OG"]
|
||||
path = libs/Utilities-OG
|
||||
url = https://github.com/true-og/Utilities-OG
|
||||
[submodule "libs/DiamondBank-OG"]
|
||||
path = libs/DiamondBank-OG
|
||||
url = https://github.com/true-og/DiamondBank-OG
|
||||
Executable
+4
@@ -0,0 +1,4 @@
|
||||
#!/usr/bin/bash
|
||||
|
||||
# Fetch all submodule content.
|
||||
git submodule update --force --recursive --init
|
||||
+21
-3
@@ -9,6 +9,10 @@ plugins {
|
||||
kotlin("jvm") version "2.1.21" // Import Kotlin JVM plugin.
|
||||
}
|
||||
|
||||
extra["kotlinAttribute"] = Attribute.of("kotlin-tag", Boolean::class.javaObjectType)
|
||||
|
||||
val kotlinAttribute: Attribute<Boolean> by rootProject.extra
|
||||
|
||||
/* --------------------------- JDK / Kotlin ---------------------------- */
|
||||
java {
|
||||
sourceCompatibility = JavaVersion.VERSION_17 // Compile with JDK 17 compatibility.
|
||||
@@ -23,7 +27,7 @@ kotlin { jvmToolchain(17) }
|
||||
/* ----------------------------- Metadata ------------------------------ */
|
||||
group = "net.trueog.cosmetics-og" // Declare bundle identifier.
|
||||
|
||||
version = "4.6.2" // Declare plugin version (will be in .jar).
|
||||
version = "4.6.4" // Declare plugin version (will be in .jar).
|
||||
|
||||
val apiVersion = "1.19" // Declare minecraft server target version.
|
||||
|
||||
@@ -48,10 +52,14 @@ dependencies {
|
||||
compileOnly("org.purpurmc.purpur:purpur-api:1.19.4-R0.1-SNAPSHOT") // Declare Purpur API version to be packaged.
|
||||
implementation("com.zaxxer:HikariCP:3.3.1") // Import HikariCP API.
|
||||
implementation("org.slf4j:slf4j-nop:1.7.25") // Import SLF4J API.
|
||||
compileOnly("com.github.Realizedd:TokenManager:3.2.4") { exclude(group = "*", module = "*") } // TokenManager API.
|
||||
compileOnly("com.github.MilkBowl:VaultAPI:1.7") { exclude(group = "org.bukkit", module = "bukkit") } // Vault API.
|
||||
compileOnlyApi(project(":libs:Utilities-OG")) // Import TrueOG Network Utilities-OG Java API (from source).
|
||||
compileOnlyApi(project(":libs:DiamondBank-OG")) {
|
||||
attributes { attribute(kotlinAttribute, true) }
|
||||
} // Import TrueOG network DiamondBank-OG Kotlin API (from source).
|
||||
}
|
||||
|
||||
apply(from = "eclipse.gradle.kts") // Import eclipse classpath support script.
|
||||
|
||||
/* ---------------------- Reproducible jars ---------------------------- */
|
||||
tasks.withType<AbstractArchiveTask>().configureEach { // Ensure reproducible .jars
|
||||
isPreserveFileTimestamps = false
|
||||
@@ -108,3 +116,13 @@ tasks.named("compileJava") {
|
||||
tasks.named("spotlessCheck") {
|
||||
dependsOn("spotlessApply") // Run spotless before checking if spotless ran.
|
||||
}
|
||||
|
||||
/* ------------------------------ Eclipse SHIM ------------------------- */
|
||||
|
||||
// This can't be put in eclipse.gradle.kts because Gradle is weird.
|
||||
subprojects {
|
||||
apply(plugin = "java-library")
|
||||
apply(plugin = "eclipse")
|
||||
eclipse.project.name = "${project.name}-${rootProject.name}"
|
||||
tasks.withType<Jar>().configureEach { archiveBaseName.set("${project.name}-${rootProject.name}") }
|
||||
}
|
||||
@@ -0,0 +1,158 @@
|
||||
/* This is free and unencumbered software released into the public domain */
|
||||
|
||||
import org.gradle.api.tasks.bundling.Jar
|
||||
import org.gradle.plugins.ide.eclipse.model.EclipseModel
|
||||
import java.nio.file.Files
|
||||
import javax.xml.parsers.DocumentBuilderFactory
|
||||
import javax.xml.transform.OutputKeys
|
||||
import javax.xml.transform.TransformerFactory
|
||||
import javax.xml.transform.dom.DOMSource
|
||||
import javax.xml.transform.stream.StreamResult
|
||||
|
||||
val sourcePluginProjects =
|
||||
configurations
|
||||
.getByName("compileClasspath")
|
||||
.allDependencies
|
||||
.filterIsInstance<ProjectDependency>()
|
||||
.map { it.path }
|
||||
.filter { it.startsWith(":libs:") }
|
||||
.distinct()
|
||||
val sourcePluginProjectNames = sourcePluginProjects.map { it.substringAfterLast(":") }.toSet()
|
||||
sourcePluginProjects.forEach { evaluationDependsOn(it) }
|
||||
|
||||
val ideLibs: Configuration by
|
||||
configurations.creating {
|
||||
isCanBeResolved = true
|
||||
isCanBeConsumed = false
|
||||
}
|
||||
|
||||
configure<EclipseModel> {
|
||||
project {
|
||||
name = "${rootProject.name}-Plugin"
|
||||
}
|
||||
classpath {
|
||||
plusConfigurations.add(ideLibs)
|
||||
}
|
||||
}
|
||||
|
||||
val ideLibDir = layout.buildDirectory.dir("ide-libs")
|
||||
val hashRegex = Regex("-[0-9a-fA-F]{10}(?=\\.jar$)") // Black magic.
|
||||
|
||||
val copyTasks = mutableListOf<TaskProvider<Copy>>()
|
||||
|
||||
sourcePluginProjects.forEach { path ->
|
||||
val sub = project(path)
|
||||
val archiveTaskName = if ("shadowJar" in sub.tasks.names) "shadowJar" else "jar"
|
||||
val archiveTask = sub.tasks.named<Jar>(archiveTaskName)
|
||||
val copyTask =
|
||||
tasks.register<Copy>("ideCopy${sub.name.replaceFirstChar(Char::titlecase)}") {
|
||||
dependsOn(archiveTask)
|
||||
from(archiveTask.flatMap { it.archiveFile })
|
||||
into(ideLibDir)
|
||||
rename { it.replace(hashRegex, "") } // Remove git commit hash from jarfile.
|
||||
}
|
||||
copyTasks += copyTask
|
||||
}
|
||||
|
||||
/* Ensure the jars exist before .classpath is generated */
|
||||
tasks.named("eclipseClasspath").configure { dependsOn(copyTasks) }
|
||||
|
||||
/* Supply those jars to the ideLibs configuration (after evaluation) */
|
||||
afterEvaluate { dependencies { add("ideLibs", fileTree(ideLibDir) { include("*.jar") }) } }
|
||||
|
||||
val injectIdeLibs =
|
||||
tasks.register("injectIdeLibs") {
|
||||
dependsOn("eclipse") // run after all eclipse files are generated
|
||||
doLast {
|
||||
val cpFile = file(".classpath")
|
||||
if (!cpFile.exists()) return@doLast
|
||||
|
||||
val jars = fileTree(ideLibDir.get()) { include("*.jar") }.files.sortedBy { it.name }
|
||||
if (jars.isEmpty()) return@doLast
|
||||
|
||||
// Parse DOM
|
||||
val dbf = DocumentBuilderFactory.newInstance()
|
||||
val doc = dbf.newDocumentBuilder().parse(cpFile)
|
||||
val root = doc.documentElement
|
||||
|
||||
// Helper to see if an entry already exists
|
||||
fun exists(path: String): Boolean =
|
||||
root.getElementsByTagName("classpathentry").let { list ->
|
||||
(0 until list.length).any { i ->
|
||||
val n = list.item(i)
|
||||
val kind = n.attributes?.getNamedItem("kind")?.nodeValue
|
||||
val p = n.attributes?.getNamedItem("path")?.nodeValue
|
||||
kind == "lib" && p == path
|
||||
}
|
||||
}
|
||||
|
||||
// Remove any entry that points to ide-libs dir or unresolved :libs: project refs.
|
||||
val toRemove = mutableListOf<org.w3c.dom.Node>()
|
||||
val list = root.getElementsByTagName("classpathentry")
|
||||
val dirPath = ideLibDir.get().asFile.absolutePath
|
||||
for (i in 0 until list.length) {
|
||||
val n = list.item(i)
|
||||
val kind = n.attributes?.getNamedItem("kind")?.nodeValue
|
||||
val p = n.attributes?.getNamedItem("path")?.nodeValue ?: ""
|
||||
val isIdeLibEntry = kind == "lib" && (p == dirPath || p.startsWith("$dirPath/"))
|
||||
val sourceProjectPath = p.removePrefix("/")
|
||||
val isHalfImportedSourceModule = kind == "src" && p.startsWith("/libs:")
|
||||
val isSourcePluginModule = kind == "src" && sourceProjectPath in sourcePluginProjectNames
|
||||
if (isIdeLibEntry || isHalfImportedSourceModule || isSourcePluginModule) {
|
||||
toRemove += n
|
||||
}
|
||||
}
|
||||
toRemove.forEach { root.removeChild(it) }
|
||||
|
||||
// Append our jar entries LAST
|
||||
jars.forEach { f ->
|
||||
val abs = f.absolutePath
|
||||
if (!exists(abs)) {
|
||||
val entry = doc.createElement("classpathentry")
|
||||
entry.setAttribute("kind", "lib")
|
||||
entry.setAttribute("path", abs)
|
||||
root.appendChild(entry)
|
||||
}
|
||||
}
|
||||
|
||||
// Write back pretty
|
||||
val tf =
|
||||
TransformerFactory.newInstance().newTransformer().apply {
|
||||
setOutputProperty(OutputKeys.INDENT, "yes")
|
||||
setOutputProperty("{http://xml.apache.org/xslt}indent-amount", "1")
|
||||
setOutputProperty(OutputKeys.OMIT_XML_DECLARATION, "no")
|
||||
setOutputProperty(OutputKeys.ENCODING, "UTF-8")
|
||||
}
|
||||
Files.newBufferedWriter(cpFile.toPath()).use { w -> tf.transform(DOMSource(doc), StreamResult(w)) }
|
||||
}
|
||||
}
|
||||
|
||||
tasks.named("eclipse").configure { finalizedBy(injectIdeLibs) }
|
||||
|
||||
val eclipseModel = extensions.getByType<EclipseModel>()
|
||||
|
||||
fun Project.addResolvableEclipseConfigs() {
|
||||
val jarAttr =
|
||||
objects.named(org.gradle.api.attributes.LibraryElements::class, org.gradle.api.attributes.LibraryElements.JAR)
|
||||
val apiAttr = objects.named(org.gradle.api.attributes.Usage::class, org.gradle.api.attributes.Usage.JAVA_API)
|
||||
|
||||
val compileOnlyRes =
|
||||
configurations.create("eclipseCompileOnly") {
|
||||
extendsFrom(configurations.getByName("compileOnly"))
|
||||
isCanBeResolved = true
|
||||
isCanBeConsumed = false
|
||||
attributes.attribute(org.gradle.api.attributes.Usage.USAGE_ATTRIBUTE, apiAttr)
|
||||
attributes.attribute(org.gradle.api.attributes.LibraryElements.LIBRARY_ELEMENTS_ATTRIBUTE, jarAttr)
|
||||
}
|
||||
val compileOnlyApiRes =
|
||||
configurations.create("eclipseCompileOnlyApi") {
|
||||
extendsFrom(configurations.getByName("compileOnlyApi"))
|
||||
isCanBeResolved = true
|
||||
isCanBeConsumed = false
|
||||
attributes.attribute(org.gradle.api.attributes.Usage.USAGE_ATTRIBUTE, apiAttr)
|
||||
attributes.attribute(org.gradle.api.attributes.LibraryElements.LIBRARY_ELEMENTS_ATTRIBUTE, jarAttr)
|
||||
}
|
||||
eclipseModel.classpath.plusConfigurations.addAll(listOf(compileOnlyRes, compileOnlyApiRes))
|
||||
}
|
||||
|
||||
addResolvableEclipseConfigs()
|
||||
Submodule
+1
Submodule libs/DiamondBank-OG added at ddd98df0a7.
Submodule
+1
Submodule libs/Utilities-OG added at cfb722c394.
@@ -1 +1,13 @@
|
||||
rootProject.name = "Cosmetics-OG"
|
||||
|
||||
ProcessBuilder("sh", "bootstrap.sh").directory(rootDir).inheritIO().start().let {
|
||||
if (it.waitFor() != 0) throw GradleException("bootstrap.sh failed")
|
||||
}
|
||||
|
||||
file("libs")
|
||||
.listFiles()
|
||||
?.filter { it.isDirectory && !it.name.startsWith(".") }
|
||||
?.forEach { dir ->
|
||||
include(":libs:${dir.name}")
|
||||
project(":libs:${dir.name}").projectDir = dir
|
||||
}
|
||||
@@ -55,7 +55,8 @@ public class HatAPI extends ParticleHatsAPI {
|
||||
|
||||
if (tellPlayer) {
|
||||
|
||||
player.sendMessage(Message.COMMAND_SET_SUCCESS.getValue().replace("{1}", hat.getDisplayName()));
|
||||
CosmeticsOG.chatMessage(player,
|
||||
Message.COMMAND_SET_SUCCESS.getValue().replace("{1}", hat.getDisplayName()));
|
||||
|
||||
}
|
||||
|
||||
|
||||
@@ -1,5 +1,24 @@
|
||||
package cosmeticsOG;
|
||||
|
||||
import java.io.File;
|
||||
import java.io.IOException;
|
||||
import java.io.InputStream;
|
||||
import java.nio.file.Files;
|
||||
import java.nio.file.Paths;
|
||||
import java.util.Collection;
|
||||
import java.util.UUID;
|
||||
import java.util.concurrent.ConcurrentHashMap;
|
||||
import java.util.logging.Level;
|
||||
import java.util.logging.Logger;
|
||||
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
import org.bukkit.Bukkit;
|
||||
import org.bukkit.configuration.file.YamlConfiguration;
|
||||
import org.bukkit.entity.Entity;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.plugin.RegisteredServiceProvider;
|
||||
import org.bukkit.plugin.java.JavaPlugin;
|
||||
|
||||
import cosmeticsOG.API.HatAPI;
|
||||
import cosmeticsOG.API.ParticleHatsAPI;
|
||||
import cosmeticsOG.database.Database;
|
||||
@@ -25,23 +44,9 @@ import cosmeticsOG.tasks.MenuTask;
|
||||
import cosmeticsOG.tasks.PromptTask;
|
||||
import cosmeticsOG.ui.MenuManagerFactory;
|
||||
import cosmeticsOG.util.YamlUtil;
|
||||
import java.io.File;
|
||||
import java.io.IOException;
|
||||
import java.io.InputStream;
|
||||
import java.nio.file.Files;
|
||||
import java.nio.file.Paths;
|
||||
import java.util.Collection;
|
||||
import java.util.UUID;
|
||||
import java.util.concurrent.ConcurrentHashMap;
|
||||
import java.util.logging.Level;
|
||||
import java.util.logging.Logger;
|
||||
import org.bukkit.Bukkit;
|
||||
import org.bukkit.configuration.file.YamlConfiguration;
|
||||
import org.bukkit.entity.Entity;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.plugin.java.JavaPlugin;
|
||||
import net.trueog.diamondbankog.api.DiamondBankAPIJava;
|
||||
import net.trueog.utilitiesog.UtilitiesOG;
|
||||
|
||||
@SuppressWarnings("unused")
|
||||
public class CosmeticsOG extends JavaPlugin {
|
||||
|
||||
// [Future] Are features that i plan on adding.
|
||||
@@ -53,7 +58,6 @@ public class CosmeticsOG extends JavaPlugin {
|
||||
// groups as well.
|
||||
|
||||
// TODO: [?] Enjin economy support?
|
||||
// TODO: [?] Custom Player Head support? (Head Database, Heads Plugin)
|
||||
// TODO: [?] Type texture support? Lets built-in types display custom images
|
||||
// (eg. capes)
|
||||
// TODO: [?] More flexible mode support?
|
||||
@@ -62,9 +66,8 @@ public class CosmeticsOG extends JavaPlugin {
|
||||
// Display when: (running, walking, flying, etc)
|
||||
// Disable when: (pvp, swimming, etc)
|
||||
|
||||
// TODO: [Future] Add update notifier
|
||||
// TODO: [Future] Allow adding custom types images as frames to an animation
|
||||
// TODO: [Future] Re-implement text particle type
|
||||
// TODO: [Future] Allow adding custom types images as frames to an animation.
|
||||
// TODO: [Future] Re-implement text particle type.
|
||||
// TODO: [Future] Let particles be attached to blocks...
|
||||
// Have a separate block menu that shows nearby particles for the player to
|
||||
// edit.
|
||||
@@ -81,14 +84,16 @@ public class CosmeticsOG extends JavaPlugin {
|
||||
|
||||
private ParticleRenderer particleRenderer;
|
||||
|
||||
// Managers
|
||||
private static DiamondBankAPIJava diamondBankAPI;
|
||||
|
||||
// Managers.
|
||||
private ResourceManager resourceManager;
|
||||
private EventManager eventManager;
|
||||
private CommandManager commandManager;
|
||||
private ParticleManager particleManager;
|
||||
private HookManager hookManager;
|
||||
|
||||
// Lang
|
||||
// Lang.
|
||||
private File langFile;
|
||||
private YamlConfiguration lang;
|
||||
|
||||
@@ -97,18 +102,18 @@ public class CosmeticsOG extends JavaPlugin {
|
||||
|
||||
private ConcurrentHashMap<UUID, EntityState> entityState;
|
||||
|
||||
// Lets us know we can use the BaseComponent class from the bungee api
|
||||
// Lets us know we can use the BaseComponent class from the bungee api.
|
||||
private boolean supportsBaseComponent = true;
|
||||
private Prompt prompt;
|
||||
|
||||
// Tasks
|
||||
// Tasks.
|
||||
private MenuTask menuTask;
|
||||
private PromptTask promptTask;
|
||||
private EntityTask entityTask;
|
||||
|
||||
private boolean enabled = false;
|
||||
|
||||
// Debugging
|
||||
// Debugging.
|
||||
public static final boolean debugging = false;
|
||||
|
||||
@Override
|
||||
@@ -119,17 +124,38 @@ public class CosmeticsOG extends JavaPlugin {
|
||||
logger = instance.getLogger();
|
||||
hatAPI = new HatAPI(this);
|
||||
|
||||
// Make sure we're running on a supported version
|
||||
// Initialize the DiamondBank-OG API.
|
||||
final RegisteredServiceProvider<DiamondBankAPIJava> provider = getServer().getServicesManager()
|
||||
.getRegistration(DiamondBankAPIJava.class);
|
||||
|
||||
// If the DiamondBank-OG API failed to initialize, do this...
|
||||
if (provider == null) {
|
||||
|
||||
// Tell Bukkit to disable this plugin, and inform the console.
|
||||
disableSelf("DiamondBank-OG API is null – disabling " + getPluginMeta().getName() + "!");
|
||||
|
||||
return;
|
||||
|
||||
}
|
||||
|
||||
// Assign the active instance of DiamondBank-OG to the API handler.
|
||||
diamondBankAPI = provider.getProvider();
|
||||
|
||||
// Make sure we're running on a supported version.
|
||||
if (serverVersion < 13) {
|
||||
|
||||
particleRenderer = new LegacyParticleRenderer();
|
||||
|
||||
if (serverVersion < 8) {
|
||||
|
||||
Utils.logToConsole("-----------------------------------------------------------------------");
|
||||
Utils.logToConsole("This version of ParticleHats is not compatible with your server version");
|
||||
Utils.logToConsole("Download version 3.7.5 if your server is on a version older than 1.8");
|
||||
Utils.logToConsole("-----------------------------------------------------------------------");
|
||||
UtilitiesOG.logToConsole(CosmeticsOG.getPrefix(),
|
||||
"-----------------------------------------------------------------------");
|
||||
UtilitiesOG.logToConsole(CosmeticsOG.getPrefix(),
|
||||
"This version of ParticleHats is not compatible with your server version");
|
||||
UtilitiesOG.logToConsole(CosmeticsOG.getPrefix(),
|
||||
"Download version 3.7.5 if your server is on a version older than 1.8");
|
||||
UtilitiesOG.logToConsole(CosmeticsOG.getPrefix(),
|
||||
"-----------------------------------------------------------------------");
|
||||
|
||||
getServer().getPluginManager().disablePlugin(this);
|
||||
return;
|
||||
@@ -142,56 +168,60 @@ public class CosmeticsOG extends JavaPlugin {
|
||||
|
||||
}
|
||||
|
||||
// Check to see if we're running on Spigot
|
||||
// Check to see if we're running on Spigot.
|
||||
try {
|
||||
|
||||
Class.forName("net.md_5.bungee.api.chat.BaseComponent");
|
||||
|
||||
} catch (ClassNotFoundException e) {
|
||||
} catch (ClassNotFoundException classNotFoundException) {
|
||||
|
||||
supportsBaseComponent = false;
|
||||
|
||||
}
|
||||
|
||||
// Save default config
|
||||
// Save default config.
|
||||
saveDefaultConfig();
|
||||
|
||||
Utils.logToConsole("Loading ParticleHats v" + getPluginMeta().getVersion());
|
||||
Utils.logToConsole("");
|
||||
UtilitiesOG.logToConsole(CosmeticsOG.getPrefix(), "Loading ParticleHats v" + getPluginMeta().getVersion());
|
||||
UtilitiesOG.logToConsole(CosmeticsOG.getPrefix(), "");
|
||||
{
|
||||
|
||||
// Create our menu manager factory
|
||||
// Create our menu manager factory.
|
||||
menuManagerFactory = new MenuManagerFactory(this);
|
||||
|
||||
if (YamlUtil.checkConfigForUpdates(getConfig())) {
|
||||
|
||||
if (SettingsManager.CONFIG_AUTO_UPDATE.getBoolean()) {
|
||||
|
||||
Utils.logToConsole("Updating config.yml");
|
||||
UtilitiesOG.logToConsole(CosmeticsOG.getPrefix(), "Updating config.yml");
|
||||
YamlUtil.updateConfig(this, getConfig());
|
||||
|
||||
} else {
|
||||
|
||||
Utils.logToConsole("There is an update for config.yml, auto updates are disabled.");
|
||||
UtilitiesOG.logToConsole(CosmeticsOG.getPrefix(),
|
||||
"There is an update for config.yml, auto updates are disabled.");
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
// Load our database
|
||||
// Load our database.
|
||||
databaseType = DatabaseType.fromAlias(SettingsManager.DATABASE_TYPE.getString());
|
||||
database = databaseType.getDatabase(this);
|
||||
|
||||
// yaml always returns true, mysql will return false if the connection could not
|
||||
// be made
|
||||
// be made.
|
||||
if (!database.isEnabled()) {
|
||||
|
||||
Utils.logToConsole("---------------------------------------------------");
|
||||
Utils.logToConsole("There was an error connecting to the MySQL database");
|
||||
UtilitiesOG.logToConsole(CosmeticsOG.getPrefix(),
|
||||
"---------------------------------------------------");
|
||||
UtilitiesOG.logToConsole(CosmeticsOG.getPrefix(),
|
||||
"There was an error connecting to the MySQL database");
|
||||
|
||||
if (database.getException() != null) {
|
||||
|
||||
Utils.logToConsole("Error: " + database.getException().getClass().getSimpleName());
|
||||
UtilitiesOG.logToConsole(CosmeticsOG.getPrefix(),
|
||||
"Error: " + database.getException().getClass().getSimpleName());
|
||||
if (debugging) {
|
||||
|
||||
database.getException().printStackTrace();
|
||||
@@ -200,23 +230,24 @@ public class CosmeticsOG extends JavaPlugin {
|
||||
|
||||
}
|
||||
|
||||
Utils.logToConsole("Switching to yaml");
|
||||
Utils.logToConsole("---------------------------------------------------");
|
||||
Utils.logToConsole("");
|
||||
UtilitiesOG.logToConsole(CosmeticsOG.getPrefix(), "Switching to yaml");
|
||||
UtilitiesOG.logToConsole(CosmeticsOG.getPrefix(),
|
||||
"---------------------------------------------------");
|
||||
UtilitiesOG.logToConsole(CosmeticsOG.getPrefix(), "");
|
||||
|
||||
databaseType = DatabaseType.YAML;
|
||||
database = databaseType.getDatabase(this);
|
||||
|
||||
}
|
||||
|
||||
// Initialize our player state map
|
||||
entityState = new ConcurrentHashMap<UUID, EntityState>();
|
||||
// Initialize our player state map.
|
||||
entityState = new ConcurrentHashMap<>();
|
||||
|
||||
// log("");
|
||||
checkDefaultLang();
|
||||
loadLang();
|
||||
|
||||
// Create our managers
|
||||
// Create our managers.
|
||||
resourceManager = new ResourceManager(this);
|
||||
eventManager = new EventManager(this);
|
||||
commandManager = new CommandManager(this, "cosmetics");
|
||||
@@ -233,22 +264,22 @@ public class CosmeticsOG extends JavaPlugin {
|
||||
|
||||
}
|
||||
|
||||
// Handles menu updates
|
||||
// Handles menu updates.
|
||||
menuTask = new MenuTask(this);
|
||||
menuTask.runTaskTimer(this, 0, SettingsManager.LIVE_MENU_UPDATE_FREQUENCY.getInt());
|
||||
|
||||
// Handles meta editing prompts
|
||||
// Handles meta editing prompts.
|
||||
promptTask = new PromptTask(this);
|
||||
promptTask.runTaskTimer(this, 0, 40);
|
||||
|
||||
// Handles displaying particles
|
||||
// Handles displaying particles.
|
||||
entityTask = new EntityTask(this);
|
||||
entityTask.runTaskTimer(this, 0, 4);
|
||||
|
||||
}
|
||||
|
||||
Utils.logToConsole("");
|
||||
Utils.logToConsole("Done :)");
|
||||
UtilitiesOG.logToConsole(CosmeticsOG.getPrefix(), "");
|
||||
UtilitiesOG.logToConsole(CosmeticsOG.getPrefix(), "Done :)");
|
||||
|
||||
enabled = true;
|
||||
|
||||
@@ -260,19 +291,32 @@ public class CosmeticsOG extends JavaPlugin {
|
||||
|
||||
}
|
||||
|
||||
public static String getPrefix() {
|
||||
|
||||
return "&7[&aCosmetics-OG&f-&4OG&7]";
|
||||
|
||||
}
|
||||
|
||||
public static void chatMessage(Player player, String message) {
|
||||
|
||||
UtilitiesOG.trueogMessage(player, getPrefix() + " " + message);
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onDisable() {
|
||||
|
||||
if (enabled) {
|
||||
if (!enabled) {
|
||||
|
||||
database.onDisable();
|
||||
|
||||
menuTask.cancel();
|
||||
promptTask.cancel();
|
||||
entityTask.cancel();
|
||||
return;
|
||||
|
||||
}
|
||||
|
||||
database.onDisable();
|
||||
menuTask.cancel();
|
||||
promptTask.cancel();
|
||||
entityTask.cancel();
|
||||
|
||||
}
|
||||
|
||||
public void onReload() {
|
||||
@@ -308,7 +352,7 @@ public class CosmeticsOG extends JavaPlugin {
|
||||
resourceManager.onReload();
|
||||
hookManager.onReload();
|
||||
|
||||
// Reload each equipped hats async task
|
||||
// Reload each equipped hats async task.
|
||||
entityState.values().forEach(EntityState::reload);
|
||||
|
||||
}
|
||||
@@ -414,7 +458,7 @@ public class CosmeticsOG extends JavaPlugin {
|
||||
|
||||
public PlayerState getNewPlayerState(Player player) {
|
||||
|
||||
UUID id = player.getUniqueId();
|
||||
final UUID id = player.getUniqueId();
|
||||
removePlayerState(id);
|
||||
|
||||
return (PlayerState) getEntityState(player);
|
||||
@@ -423,8 +467,7 @@ public class CosmeticsOG extends JavaPlugin {
|
||||
|
||||
public EntityState getEntityState(Entity entity, int entityID) {
|
||||
|
||||
UUID id = entity.getUniqueId();
|
||||
|
||||
final UUID id = entity.getUniqueId();
|
||||
if (entityState.containsKey(id)) {
|
||||
|
||||
return entityState.get(id);
|
||||
@@ -433,7 +476,7 @@ public class CosmeticsOG extends JavaPlugin {
|
||||
|
||||
if (entity instanceof Player) {
|
||||
|
||||
EntityState eState;
|
||||
final EntityState eState;
|
||||
|
||||
if (entity.hasMetadata("NPC")) {
|
||||
|
||||
@@ -446,13 +489,15 @@ public class CosmeticsOG extends JavaPlugin {
|
||||
}
|
||||
|
||||
entityState.put(id, eState);
|
||||
|
||||
return eState;
|
||||
|
||||
}
|
||||
|
||||
EntityState eState = new EntityState(entity, entityID);
|
||||
final EntityState eState = new EntityState(entity, entityID);
|
||||
|
||||
entityState.put(id, eState);
|
||||
|
||||
return eState;
|
||||
|
||||
}
|
||||
@@ -488,7 +533,7 @@ public class CosmeticsOG extends JavaPlugin {
|
||||
|
||||
public void removePlayerState(UUID id) {
|
||||
|
||||
EntityState es = entityState.remove(id);
|
||||
final EntityState es = entityState.remove(id);
|
||||
if (es != null) {
|
||||
|
||||
es.clearActiveHats();
|
||||
@@ -515,7 +560,7 @@ public class CosmeticsOG extends JavaPlugin {
|
||||
*/
|
||||
public double getServerVersion() {
|
||||
|
||||
String version = Bukkit.getBukkitVersion().split("-")[0].substring(2);
|
||||
final String version = StringUtils.substring(Bukkit.getBukkitVersion().split("-")[0], 2);
|
||||
return Double.parseDouble(version);
|
||||
|
||||
}
|
||||
@@ -564,8 +609,8 @@ public class CosmeticsOG extends JavaPlugin {
|
||||
*/
|
||||
public boolean fileExists(String folderName, String fileName) {
|
||||
|
||||
String directory = getDataFolder() + File.separator + folderName + File.separator + fileName;
|
||||
File file = new File(directory);
|
||||
final String directory = getDataFolder() + File.separator + folderName + File.separator + fileName;
|
||||
final File file = new File(directory);
|
||||
|
||||
return file.exists();
|
||||
|
||||
@@ -590,26 +635,28 @@ public class CosmeticsOG extends JavaPlugin {
|
||||
|
||||
String targetLang = SettingsManager.LANG.getString();
|
||||
|
||||
File langFile = new File(getDataFolder() + File.separator + "lang" + File.separator + targetLang);
|
||||
final File langFile = new File(getDataFolder() + File.separator + "lang" + File.separator + targetLang);
|
||||
if (!langFile.exists()) {
|
||||
|
||||
if (targetLang.equals("en_US.lang")) {
|
||||
if ("en_US.lang".equals(targetLang)) {
|
||||
|
||||
Utils.logToConsole("Creating en_US.lang");
|
||||
UtilitiesOG.logToConsole(CosmeticsOG.getPrefix(), "Creating en_US.lang");
|
||||
|
||||
} else {
|
||||
|
||||
Utils.logToConsole("Could not find locale " + targetLang + ", switching to en_US.lang");
|
||||
UtilitiesOG.logToConsole(CosmeticsOG.getPrefix(),
|
||||
"Could not find locale " + targetLang + ", switching to en_US.lang");
|
||||
|
||||
}
|
||||
|
||||
// Create our default .lang file since the specified one doesn't exist
|
||||
// Create our default .lang file since the specified one doesn't exist.
|
||||
createDefaultLang();
|
||||
targetLang = "en_US.lang";
|
||||
|
||||
}
|
||||
|
||||
Utils.logToConsole("Loaded locale " + targetLang);
|
||||
UtilitiesOG.logToConsole(CosmeticsOG.getPrefix(), "Loaded locale " + targetLang);
|
||||
|
||||
this.langFile = new File(getDataFolder() + File.separator + "lang" + File.separator + targetLang);
|
||||
this.lang = YamlConfiguration.loadConfiguration(this.langFile);
|
||||
|
||||
@@ -617,31 +664,35 @@ public class CosmeticsOG extends JavaPlugin {
|
||||
|
||||
private void createDefaultLang() {
|
||||
|
||||
File langFolder = new File(getDataFolder() + File.separator + "lang");
|
||||
final File langFolder = new File(getDataFolder() + File.separator + "lang");
|
||||
if (!langFolder.exists()) {
|
||||
|
||||
langFolder.mkdirs();
|
||||
|
||||
}
|
||||
|
||||
InputStream langStream = getResource("lang/en_US.lang");
|
||||
if (langStream != null) {
|
||||
final InputStream langStream = getResource("lang/en_US.lang");
|
||||
if (langStream == null) {
|
||||
|
||||
File langFile = new File(getDataFolder() + File.separator + "lang" + File.separator + "en_US.lang");
|
||||
return;
|
||||
|
||||
if (langFile.exists()) {
|
||||
}
|
||||
|
||||
langFile.delete();
|
||||
final File langFile = new File(getDataFolder() + File.separator + "lang" + File.separator + "en_US.lang");
|
||||
if (langFile.exists()) {
|
||||
|
||||
}
|
||||
langFile.delete();
|
||||
|
||||
try {
|
||||
}
|
||||
|
||||
Files.copy(langStream, Paths.get(langFile.getPath()));
|
||||
try {
|
||||
|
||||
} catch (IOException e) {
|
||||
Files.copy(langStream, Paths.get(langFile.getPath()));
|
||||
|
||||
}
|
||||
} catch (IOException ioException) {
|
||||
|
||||
UtilitiesOG.logToConsole(CosmeticsOG.getPrefix(), "Error creating en_US.lang");
|
||||
ioException.printStackTrace();
|
||||
|
||||
}
|
||||
|
||||
@@ -649,17 +700,18 @@ public class CosmeticsOG extends JavaPlugin {
|
||||
|
||||
private void checkDefaultLang() {
|
||||
|
||||
File langFile = new File(getDataFolder() + File.separator + "lang" + File.separator + "en_US.lang");
|
||||
final File langFile = new File(getDataFolder() + File.separator + "lang" + File.separator + "en_US.lang");
|
||||
if (!langFile.exists()) {
|
||||
|
||||
createDefaultLang();
|
||||
|
||||
} else {
|
||||
|
||||
YamlConfiguration tempLangConfig = YamlConfiguration.loadConfiguration(langFile);
|
||||
final YamlConfiguration tempLangConfig = YamlConfiguration.loadConfiguration(langFile);
|
||||
if (tempLangConfig.getDouble("version", 1.0) != LANG_VERSION) {
|
||||
|
||||
Utils.logToConsole("Updating en_US.lang");
|
||||
UtilitiesOG.logToConsole(CosmeticsOG.getPrefix(), "Updating en_US.lang");
|
||||
|
||||
createDefaultLang();
|
||||
|
||||
}
|
||||
@@ -668,4 +720,39 @@ public class CosmeticsOG extends JavaPlugin {
|
||||
|
||||
}
|
||||
|
||||
// Helps this plugin kill itself gracefully (in minecraft).
|
||||
public static void disableSelf(String reason) {
|
||||
|
||||
final CosmeticsOG pluginInstance = getInstance();
|
||||
if (pluginInstance == null) {
|
||||
|
||||
return;
|
||||
|
||||
}
|
||||
|
||||
Bukkit.getScheduler().runTask(pluginInstance, () -> {
|
||||
|
||||
// If this plugin is already disabled, do this...
|
||||
if (!pluginInstance.isEnabled()) {
|
||||
|
||||
// Do nothing, task already completed.
|
||||
return;
|
||||
|
||||
}
|
||||
|
||||
// Inform console of this plugin being disabled.
|
||||
UtilitiesOG.logToConsole(getPrefix(), reason);
|
||||
|
||||
Bukkit.getPluginManager().disablePlugin(pluginInstance);
|
||||
|
||||
});
|
||||
|
||||
}
|
||||
|
||||
public static DiamondBankAPIJava getDiamondBankAPI() {
|
||||
|
||||
return diamondBankAPI;
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
@@ -1,132 +0,0 @@
|
||||
package cosmeticsOG;
|
||||
|
||||
import java.util.regex.Pattern;
|
||||
import net.kyori.adventure.text.Component;
|
||||
import net.kyori.adventure.text.TextComponent;
|
||||
import net.kyori.adventure.text.minimessage.MiniMessage;
|
||||
import net.kyori.adventure.text.serializer.legacy.LegacyComponentSerializer;
|
||||
import org.bukkit.entity.Player;
|
||||
|
||||
public class Utils {
|
||||
|
||||
// Regular expressions to match color codes starting with § or & in Strings.
|
||||
private static final Pattern LEGACY_COLOR_PATTERN = Pattern.compile("(?i)[§&][0-9A-FK-OR]");
|
||||
private static final Pattern MINIMESSAGE_TAG_PATTERN = Pattern.compile("<[^>]*>");
|
||||
|
||||
// Sends a formatted message to the player (including name replacement).
|
||||
public static void cosmeticsOGPlaceholderMessage(Player p, String message) {
|
||||
|
||||
p.sendMessage(legacySerializerAnyCase((message)));
|
||||
|
||||
}
|
||||
|
||||
public static void logToConsole(Component component) {
|
||||
|
||||
String serialized = MiniMessage.miniMessage().serialize(component);
|
||||
String stripped = stripColors(serialized);
|
||||
|
||||
CosmeticsOG.getInstance().getLogger().info("Cosmetics-OG " + stripped);
|
||||
|
||||
}
|
||||
|
||||
public static void logToConsole(String message) {
|
||||
|
||||
TextComponent component = LegacyComponentSerializer.legacyAmpersand().deserialize(message);
|
||||
|
||||
String serialized = MiniMessage.miniMessage().serialize(component);
|
||||
String stripped = stripColors(serialized);
|
||||
|
||||
CosmeticsOG.getInstance().getLogger().info("Cosmetics-OG " + stripped);
|
||||
|
||||
}
|
||||
|
||||
public static TextComponent legacySerializerAnyCase(String subject) {
|
||||
|
||||
int count = 0;
|
||||
// Count the number of '&' characters to determine the size of the array
|
||||
for (char c : subject.toCharArray()) {
|
||||
|
||||
if (c == '&') {
|
||||
|
||||
count++;
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
// Create an array to store the positions of '&' characters
|
||||
int[] positions = new int[count];
|
||||
int index = 0;
|
||||
// Find the positions of '&' characters and store in the array
|
||||
for (int i = 0; i < subject.length(); i++) {
|
||||
|
||||
if (subject.charAt(i) == '&') {
|
||||
|
||||
if (isUpperBukkitCode(subject.charAt(i + 1))) {
|
||||
|
||||
subject = replaceCharAtIndex(subject, (i + 1), Character.toLowerCase(subject.charAt(i + 1)));
|
||||
|
||||
}
|
||||
|
||||
positions[index++] = i;
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
return LegacyComponentSerializer.legacyAmpersand().deserialize(subject);
|
||||
|
||||
}
|
||||
|
||||
private static boolean isUpperBukkitCode(char input) {
|
||||
|
||||
char[] bukkitColorCodes = { 'A', 'B', 'C', 'D', 'E', 'F', 'K', 'L', 'M', 'N', 'O', 'R' };
|
||||
boolean match = false;
|
||||
|
||||
// Loop through each character in the array.
|
||||
for (char c : bukkitColorCodes) {
|
||||
|
||||
// Check if the current character in the array is equal to the input character.
|
||||
if (c == input) {
|
||||
|
||||
match = true;
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
return match;
|
||||
|
||||
}
|
||||
|
||||
private static String replaceCharAtIndex(String original, int index, char newChar) {
|
||||
|
||||
// Check if the index is valid
|
||||
if (index >= 0 && index < original.length()) {
|
||||
|
||||
// Create a new string with the replaced character
|
||||
return original.substring(0, index) + newChar + original.substring(index + 1);
|
||||
|
||||
}
|
||||
|
||||
// If the index is invalid, return the original string
|
||||
return original;
|
||||
|
||||
}
|
||||
|
||||
public static String stripColors(String input) {
|
||||
|
||||
if (input == null)
|
||||
return null;
|
||||
|
||||
// Remove MiniMessage tags
|
||||
String stripped = MINIMESSAGE_TAG_PATTERN.matcher(input).replaceAll("");
|
||||
|
||||
// Remove legacy color codes
|
||||
stripped = LEGACY_COLOR_PATTERN.matcher(stripped).replaceAll("");
|
||||
|
||||
return stripped;
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
@@ -1,7 +1,7 @@
|
||||
package cosmeticsOG.commands;
|
||||
|
||||
import net.trueog.utilitiesog.UtilitiesOG;
|
||||
import cosmeticsOG.CosmeticsOG;
|
||||
import cosmeticsOG.Utils;
|
||||
import cosmeticsOG.locale.Message;
|
||||
import cosmeticsOG.permission.Permission;
|
||||
import java.util.ArrayList;
|
||||
@@ -62,7 +62,7 @@ public abstract class Command {
|
||||
|
||||
if (!sender.isPlayer() && isPlayerOnly()) {
|
||||
|
||||
Utils.logToConsole(Message.COMMAND_ERROR_PLAYER_ONLY.getValue());
|
||||
UtilitiesOG.logToConsole(CosmeticsOG.getPrefix(), Message.COMMAND_ERROR_PLAYER_ONLY.getValue());
|
||||
return false;
|
||||
|
||||
}
|
||||
@@ -78,11 +78,11 @@ public abstract class Command {
|
||||
|
||||
if (sender.isPlayer()) {
|
||||
|
||||
Utils.cosmeticsOGPlaceholderMessage(sender.getPlayer(), Message.COMMAND_ERROR_NO_PERMISSION.getValue());
|
||||
CosmeticsOG.chatMessage(sender.getPlayer(), Message.COMMAND_ERROR_NO_PERMISSION.getValue());
|
||||
|
||||
} else {
|
||||
|
||||
Utils.logToConsole(Message.COMMAND_ERROR_NO_PERMISSION.getValue());
|
||||
UtilitiesOG.logToConsole(CosmeticsOG.getPrefix(), Message.COMMAND_ERROR_NO_PERMISSION.getValue());
|
||||
|
||||
}
|
||||
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
package cosmeticsOG.commands;
|
||||
|
||||
import net.trueog.utilitiesog.UtilitiesOG;
|
||||
import cosmeticsOG.CosmeticsOG;
|
||||
import cosmeticsOG.Utils;
|
||||
import cosmeticsOG.database.Database;
|
||||
import cosmeticsOG.database.properties.Group;
|
||||
import cosmeticsOG.locale.Message;
|
||||
@@ -26,7 +26,7 @@ public class MainCommand extends Command {
|
||||
|
||||
if (!sender.isPlayer()) {
|
||||
|
||||
Utils.logToConsole(Message.COMMAND_ERROR_PLAYER_ONLY.getValue());
|
||||
UtilitiesOG.logToConsole(CosmeticsOG.getPrefix(), Message.COMMAND_ERROR_PLAYER_ONLY.getValue());
|
||||
return false;
|
||||
|
||||
}
|
||||
@@ -63,16 +63,16 @@ public class MainCommand extends Command {
|
||||
|
||||
if (usingGroupMenu) {
|
||||
|
||||
Utils.cosmeticsOGPlaceholderMessage(sender.getPlayer(),
|
||||
CosmeticsOG.chatMessage(sender.getPlayer(),
|
||||
Message.COMMAND_ERROR_UNKNOWN_GROUP_MENU.getValue().replace("{1}", menuName));
|
||||
|
||||
} else {
|
||||
|
||||
// TODO: Figure out why the menu isn't in the database.
|
||||
Player player = sender.getPlayer();
|
||||
Utils.cosmeticsOGPlaceholderMessage(player,
|
||||
CosmeticsOG.chatMessage(player,
|
||||
"Does the menu exist in the database?: " + String.valueOf(database.menuExists(menuName)));
|
||||
Utils.cosmeticsOGPlaceholderMessage(player,
|
||||
CosmeticsOG.chatMessage(player,
|
||||
Message.COMMAND_ERROR_UNKNOWN_MENU.getValue().replace("{1}", menuName));
|
||||
|
||||
}
|
||||
@@ -98,11 +98,11 @@ public class MainCommand extends Command {
|
||||
|
||||
if (sender.isPlayer()) {
|
||||
|
||||
Utils.cosmeticsOGPlaceholderMessage(sender.getPlayer(), Message.COMMAND_ERROR_UNKNOWN.getValue());
|
||||
CosmeticsOG.chatMessage(sender.getPlayer(), Message.COMMAND_ERROR_UNKNOWN.getValue());
|
||||
|
||||
} else {
|
||||
|
||||
Utils.logToConsole(Message.COMMAND_ERROR_UNKNOWN.getValue());
|
||||
UtilitiesOG.logToConsole(CosmeticsOG.getPrefix(), Message.COMMAND_ERROR_UNKNOWN.getValue());
|
||||
|
||||
}
|
||||
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
package cosmeticsOG.commands.subcommands;
|
||||
|
||||
import net.trueog.utilitiesog.UtilitiesOG;
|
||||
import cosmeticsOG.CosmeticsOG;
|
||||
import cosmeticsOG.Utils;
|
||||
import cosmeticsOG.commands.Command;
|
||||
import cosmeticsOG.commands.Sender;
|
||||
import cosmeticsOG.database.properties.Group;
|
||||
@@ -23,13 +23,13 @@ public class AddGroupCommand extends Command {
|
||||
|
||||
if (sender.isPlayer()) {
|
||||
|
||||
Utils.cosmeticsOGPlaceholderMessage((Player) sender, Message.COMMAND_ERROR_ARGUMENTS.getValue());
|
||||
Utils.cosmeticsOGPlaceholderMessage((Player) sender, getUsage().getValue());
|
||||
CosmeticsOG.chatMessage((Player) sender, Message.COMMAND_ERROR_ARGUMENTS.getValue());
|
||||
CosmeticsOG.chatMessage((Player) sender, getUsage().getValue());
|
||||
|
||||
} else {
|
||||
|
||||
Utils.logToConsole(Message.COMMAND_ERROR_ARGUMENTS.getValue());
|
||||
Utils.logToConsole(getUsage().getValue());
|
||||
UtilitiesOG.logToConsole(CosmeticsOG.getPrefix(), Message.COMMAND_ERROR_ARGUMENTS.getValue());
|
||||
UtilitiesOG.logToConsole(CosmeticsOG.getPrefix(), getUsage().getValue());
|
||||
|
||||
}
|
||||
|
||||
@@ -66,12 +66,12 @@ public class AddGroupCommand extends Command {
|
||||
|
||||
if (sender.isPlayer()) {
|
||||
|
||||
Utils.cosmeticsOGPlaceholderMessage((Player) sender,
|
||||
Message.COMMAND_ERROR_GROUP_EXISTS.replace("{1}", groupName));
|
||||
CosmeticsOG.chatMessage((Player) sender, Message.COMMAND_ERROR_GROUP_EXISTS.replace("{1}", groupName));
|
||||
|
||||
} else {
|
||||
|
||||
Utils.logToConsole(Message.COMMAND_ERROR_GROUP_EXISTS.replace("{1}", groupName));
|
||||
UtilitiesOG.logToConsole(CosmeticsOG.getPrefix(),
|
||||
Message.COMMAND_ERROR_GROUP_EXISTS.replace("{1}", groupName));
|
||||
|
||||
}
|
||||
|
||||
@@ -83,12 +83,12 @@ public class AddGroupCommand extends Command {
|
||||
|
||||
if (sender.isPlayer()) {
|
||||
|
||||
Utils.cosmeticsOGPlaceholderMessage((Player) sender,
|
||||
Message.COMMAND_ADD_GROUP_SUCCESS.replace("{1}", groupName));
|
||||
CosmeticsOG.chatMessage((Player) sender, Message.COMMAND_ADD_GROUP_SUCCESS.replace("{1}", groupName));
|
||||
|
||||
} else {
|
||||
|
||||
Utils.logToConsole(Message.COMMAND_ADD_GROUP_SUCCESS.replace("{1}", groupName));
|
||||
UtilitiesOG.logToConsole(CosmeticsOG.getPrefix(),
|
||||
Message.COMMAND_ADD_GROUP_SUCCESS.replace("{1}", groupName));
|
||||
|
||||
}
|
||||
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
package cosmeticsOG.commands.subcommands;
|
||||
|
||||
import net.trueog.utilitiesog.UtilitiesOG;
|
||||
import cosmeticsOG.CosmeticsOG;
|
||||
import cosmeticsOG.Utils;
|
||||
import cosmeticsOG.commands.Command;
|
||||
import cosmeticsOG.commands.Sender;
|
||||
import cosmeticsOG.database.type.DatabaseType;
|
||||
@@ -26,13 +26,13 @@ public class AddTypeCommand extends Command {
|
||||
|
||||
if (sender.isPlayer()) {
|
||||
|
||||
Utils.cosmeticsOGPlaceholderMessage((Player) sender, Message.COMMAND_ERROR_ARGUMENTS.getValue());
|
||||
Utils.cosmeticsOGPlaceholderMessage((Player) sender, getUsage().getValue());
|
||||
CosmeticsOG.chatMessage((Player) sender, Message.COMMAND_ERROR_ARGUMENTS.getValue());
|
||||
CosmeticsOG.chatMessage((Player) sender, getUsage().getValue());
|
||||
|
||||
} else {
|
||||
|
||||
Utils.logToConsole(Message.COMMAND_ERROR_ARGUMENTS.getValue());
|
||||
Utils.logToConsole(getUsage().getValue());
|
||||
UtilitiesOG.logToConsole(CosmeticsOG.getPrefix(), Message.COMMAND_ERROR_ARGUMENTS.getValue());
|
||||
UtilitiesOG.logToConsole(CosmeticsOG.getPrefix(), getUsage().getValue());
|
||||
|
||||
}
|
||||
|
||||
@@ -44,11 +44,11 @@ public class AddTypeCommand extends Command {
|
||||
|
||||
if (sender.isPlayer()) {
|
||||
|
||||
Utils.cosmeticsOGPlaceholderMessage((Player) sender, Message.COMMAND_ADD_TYPE_ERROR.getValue());
|
||||
CosmeticsOG.chatMessage((Player) sender, Message.COMMAND_ADD_TYPE_ERROR.getValue());
|
||||
|
||||
} else {
|
||||
|
||||
Utils.logToConsole(Message.COMMAND_ADD_TYPE_ERROR.getValue());
|
||||
UtilitiesOG.logToConsole(CosmeticsOG.getPrefix(), Message.COMMAND_ADD_TYPE_ERROR.getValue());
|
||||
|
||||
}
|
||||
|
||||
@@ -61,12 +61,12 @@ public class AddTypeCommand extends Command {
|
||||
|
||||
if (sender.isPlayer()) {
|
||||
|
||||
Utils.cosmeticsOGPlaceholderMessage((Player) sender,
|
||||
Message.COMMAND_ERROR_TYPE_EXISTS.replace("{1}", imageName));
|
||||
CosmeticsOG.chatMessage((Player) sender, Message.COMMAND_ERROR_TYPE_EXISTS.replace("{1}", imageName));
|
||||
|
||||
} else {
|
||||
|
||||
Utils.logToConsole(Message.COMMAND_ERROR_TYPE_EXISTS.replace("{1}", imageName));
|
||||
UtilitiesOG.logToConsole(CosmeticsOG.getPrefix(),
|
||||
Message.COMMAND_ERROR_TYPE_EXISTS.replace("{1}", imageName));
|
||||
|
||||
}
|
||||
|
||||
@@ -80,12 +80,12 @@ public class AddTypeCommand extends Command {
|
||||
|
||||
if (sender.isPlayer()) {
|
||||
|
||||
Utils.cosmeticsOGPlaceholderMessage((Player) sender,
|
||||
Message.COMMAND_ADD_TYPE_SUCCESS.replace("{1}", imageName));
|
||||
CosmeticsOG.chatMessage((Player) sender, Message.COMMAND_ADD_TYPE_SUCCESS.replace("{1}", imageName));
|
||||
|
||||
} else {
|
||||
|
||||
Utils.logToConsole(Message.COMMAND_ADD_TYPE_SUCCESS.replace("{1}", imageName));
|
||||
UtilitiesOG.logToConsole(CosmeticsOG.getPrefix(),
|
||||
Message.COMMAND_ADD_TYPE_SUCCESS.replace("{1}", imageName));
|
||||
|
||||
}
|
||||
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
package cosmeticsOG.commands.subcommands;
|
||||
|
||||
import net.trueog.utilitiesog.UtilitiesOG;
|
||||
import cosmeticsOG.CosmeticsOG;
|
||||
import cosmeticsOG.Utils;
|
||||
import cosmeticsOG.commands.Command;
|
||||
import cosmeticsOG.commands.Sender;
|
||||
import cosmeticsOG.locale.Message;
|
||||
@@ -62,14 +62,15 @@ public class BukkitHelpCommand extends Command {
|
||||
|
||||
Player player = sender.getPlayer();
|
||||
|
||||
Utils.cosmeticsOGPlaceholderMessage(player,
|
||||
CosmeticsOG.chatMessage(player,
|
||||
"<white>> <light_purple>Cosmetics<red>-OG <yellow>v" + core.getPluginMeta().getVersion());
|
||||
Utils.cosmeticsOGPlaceholderMessage(player, "<gray>> " + Message.COMMAND_HELP_TIP.getValue());
|
||||
CosmeticsOG.chatMessage(player, "<gray>> " + Message.COMMAND_HELP_TIP.getValue());
|
||||
|
||||
} else {
|
||||
|
||||
Utils.logToConsole("&r&2Cosmetics&c-OG &ev" + core.getPluginMeta().getVersion());
|
||||
Utils.logToConsole("&7 " + Message.COMMAND_HELP_TIP.getValue());
|
||||
UtilitiesOG.logToConsole(CosmeticsOG.getPrefix(),
|
||||
"&r&2Cosmetics&c-OG &ev" + core.getPluginMeta().getVersion());
|
||||
UtilitiesOG.logToConsole(CosmeticsOG.getPrefix(), "&7 " + Message.COMMAND_HELP_TIP.getValue());
|
||||
|
||||
}
|
||||
|
||||
@@ -82,7 +83,7 @@ public class BukkitHelpCommand extends Command {
|
||||
|
||||
} else {
|
||||
|
||||
Utils.logToConsole(MiniMessage.miniMessage().serialize(component));
|
||||
UtilitiesOG.logToConsole(CosmeticsOG.getPrefix(), MiniMessage.miniMessage().serialize(component));
|
||||
|
||||
}
|
||||
|
||||
@@ -114,11 +115,11 @@ public class BukkitHelpCommand extends Command {
|
||||
|
||||
if (sender.isPlayer()) {
|
||||
|
||||
Utils.cosmeticsOGPlaceholderMessage(sender.getPlayer(), Message.COMMAND_ERROR_NO_PERMISSION.getValue());
|
||||
CosmeticsOG.chatMessage(sender.getPlayer(), Message.COMMAND_ERROR_NO_PERMISSION.getValue());
|
||||
|
||||
} else {
|
||||
|
||||
Utils.logToConsole(Message.COMMAND_ERROR_NO_PERMISSION.getValue());
|
||||
UtilitiesOG.logToConsole(CosmeticsOG.getPrefix(), Message.COMMAND_ERROR_NO_PERMISSION.getValue());
|
||||
|
||||
}
|
||||
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
package cosmeticsOG.commands.subcommands;
|
||||
|
||||
import net.trueog.utilitiesog.UtilitiesOG;
|
||||
import cosmeticsOG.CosmeticsOG;
|
||||
import cosmeticsOG.Utils;
|
||||
import cosmeticsOG.commands.Command;
|
||||
import cosmeticsOG.commands.Sender;
|
||||
import cosmeticsOG.locale.Message;
|
||||
@@ -33,8 +33,8 @@ public class ClearCommand extends Command {
|
||||
|
||||
if (!sender.isPlayer()) {
|
||||
|
||||
Utils.cosmeticsOGPlaceholderMessage((Player) sender, Message.COMMAND_ERROR_ARGUMENTS.getValue());
|
||||
Utils.cosmeticsOGPlaceholderMessage((Player) sender, Message.COMMAND_CLEAR_PLAYER_USAGE.getValue());
|
||||
CosmeticsOG.chatMessage((Player) sender, Message.COMMAND_ERROR_ARGUMENTS.getValue());
|
||||
CosmeticsOG.chatMessage((Player) sender, Message.COMMAND_CLEAR_PLAYER_USAGE.getValue());
|
||||
|
||||
return false;
|
||||
|
||||
@@ -44,11 +44,11 @@ public class ClearCommand extends Command {
|
||||
|
||||
if (sender.isPlayer()) {
|
||||
|
||||
Utils.cosmeticsOGPlaceholderMessage((Player) sender, Message.COMMAND_CLEAR_SUCCESS.getValue());
|
||||
CosmeticsOG.chatMessage((Player) sender, Message.COMMAND_CLEAR_SUCCESS.getValue());
|
||||
|
||||
} else {
|
||||
|
||||
Utils.logToConsole(Message.COMMAND_CLEAR_SUCCESS.getValue());
|
||||
UtilitiesOG.logToConsole(CosmeticsOG.getPrefix(), Message.COMMAND_CLEAR_SUCCESS.getValue());
|
||||
|
||||
}
|
||||
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
package cosmeticsOG.commands.subcommands;
|
||||
|
||||
import net.trueog.utilitiesog.UtilitiesOG;
|
||||
import cosmeticsOG.CosmeticsOG;
|
||||
import cosmeticsOG.Utils;
|
||||
import cosmeticsOG.commands.Command;
|
||||
import cosmeticsOG.commands.Sender;
|
||||
import cosmeticsOG.locale.Message;
|
||||
@@ -20,12 +20,13 @@ public class ClearPlayerCommand extends Command {
|
||||
|
||||
if (sender.isPlayer()) {
|
||||
|
||||
Utils.cosmeticsOGPlaceholderMessage((Player) sender,
|
||||
CosmeticsOG.chatMessage((Player) sender,
|
||||
Message.COMMAND_ERROR_UNKNOWN_PLAYER.getValue().replace("{1}", args.get(0)));
|
||||
|
||||
} else {
|
||||
|
||||
Utils.logToConsole(Message.COMMAND_ERROR_UNKNOWN_PLAYER.getValue().replace("{1}", args.get(0)));
|
||||
UtilitiesOG.logToConsole(CosmeticsOG.getPrefix(),
|
||||
Message.COMMAND_ERROR_UNKNOWN_PLAYER.getValue().replace("{1}", args.get(0)));
|
||||
|
||||
}
|
||||
|
||||
@@ -37,12 +38,13 @@ public class ClearPlayerCommand extends Command {
|
||||
|
||||
if (sender.isPlayer()) {
|
||||
|
||||
Utils.cosmeticsOGPlaceholderMessage((Player) sender,
|
||||
CosmeticsOG.chatMessage((Player) sender,
|
||||
Message.COMMAND_ERROR_OFFLINE_PLAYER.getValue().replace("{1}", player.getName()));
|
||||
|
||||
} else {
|
||||
|
||||
Utils.logToConsole(Message.COMMAND_ERROR_OFFLINE_PLAYER.getValue().replace("{1}", player.getName()));
|
||||
UtilitiesOG.logToConsole(CosmeticsOG.getPrefix(),
|
||||
Message.COMMAND_ERROR_OFFLINE_PLAYER.getValue().replace("{1}", player.getName()));
|
||||
|
||||
}
|
||||
|
||||
@@ -54,12 +56,13 @@ public class ClearPlayerCommand extends Command {
|
||||
|
||||
if (sender.isPlayer()) {
|
||||
|
||||
Utils.cosmeticsOGPlaceholderMessage((Player) sender,
|
||||
CosmeticsOG.chatMessage((Player) sender,
|
||||
Message.COMMAND_CLEAR_PLAYER_SUCCESS.getValue().replace("{1}", player.getName()));
|
||||
|
||||
} else {
|
||||
|
||||
Utils.logToConsole(Message.COMMAND_CLEAR_PLAYER_SUCCESS.getValue().replace("{1}", player.getName()));
|
||||
UtilitiesOG.logToConsole(CosmeticsOG.getPrefix(),
|
||||
Message.COMMAND_CLEAR_PLAYER_SUCCESS.getValue().replace("{1}", player.getName()));
|
||||
|
||||
}
|
||||
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
package cosmeticsOG.commands.subcommands;
|
||||
|
||||
import net.trueog.utilitiesog.UtilitiesOG;
|
||||
import cosmeticsOG.CosmeticsOG;
|
||||
import cosmeticsOG.Utils;
|
||||
import cosmeticsOG.commands.Command;
|
||||
import cosmeticsOG.commands.Sender;
|
||||
import cosmeticsOG.database.Database;
|
||||
@@ -27,8 +27,7 @@ public class CreateCommand extends Command {
|
||||
PlayerState playerState = core.getPlayerState(sender.getPlayer());
|
||||
if (playerState.hasEditorOpen()) {
|
||||
|
||||
Utils.cosmeticsOGPlaceholderMessage((Player) sender,
|
||||
Message.COMMAND_ERROR_ALREADY_EDITING.getValue());
|
||||
CosmeticsOG.chatMessage((Player) sender, Message.COMMAND_ERROR_ALREADY_EDITING.getValue());
|
||||
|
||||
return false;
|
||||
|
||||
@@ -42,11 +41,11 @@ public class CreateCommand extends Command {
|
||||
|
||||
if (sender.isPlayer()) {
|
||||
|
||||
Utils.cosmeticsOGPlaceholderMessage((Player) sender, Message.COMMAND_CREATE_INVALID.getValue());
|
||||
CosmeticsOG.chatMessage((Player) sender, Message.COMMAND_CREATE_INVALID.getValue());
|
||||
|
||||
} else {
|
||||
|
||||
Utils.logToConsole(Message.COMMAND_CREATE_INVALID.getValue());
|
||||
UtilitiesOG.logToConsole(CosmeticsOG.getPrefix(), Message.COMMAND_CREATE_INVALID.getValue());
|
||||
|
||||
}
|
||||
|
||||
@@ -61,12 +60,13 @@ public class CreateCommand extends Command {
|
||||
|
||||
if (sender.isPlayer()) {
|
||||
|
||||
Utils.cosmeticsOGPlaceholderMessage((Player) sender,
|
||||
CosmeticsOG.chatMessage((Player) sender,
|
||||
Message.COMMAND_ERROR_MENU_EXISTS.getValue().replace("{1}", menuName));
|
||||
|
||||
} else {
|
||||
|
||||
Utils.logToConsole(Message.COMMAND_ERROR_MENU_EXISTS.getValue().replace("{1}", menuName));
|
||||
UtilitiesOG.logToConsole(CosmeticsOG.getPrefix(),
|
||||
Message.COMMAND_ERROR_MENU_EXISTS.getValue().replace("{1}", menuName));
|
||||
|
||||
}
|
||||
|
||||
@@ -78,18 +78,18 @@ public class CreateCommand extends Command {
|
||||
|
||||
if (!sender.isPlayer()) {
|
||||
|
||||
Utils.logToConsole(Message.COMMAND_CREATE_SUCCESS.replace("{1}", menuName));
|
||||
UtilitiesOG.logToConsole(CosmeticsOG.getPrefix(),
|
||||
Message.COMMAND_CREATE_SUCCESS.replace("{1}", menuName));
|
||||
|
||||
return true;
|
||||
|
||||
} else {
|
||||
|
||||
Utils.cosmeticsOGPlaceholderMessage((Player) sender,
|
||||
Message.COMMAND_CREATE_SUCCESS.replace("{1}", menuName));
|
||||
CosmeticsOG.chatMessage((Player) sender, Message.COMMAND_CREATE_SUCCESS.replace("{1}", menuName));
|
||||
|
||||
PlayerState playerState = core.getPlayerState(sender.getPlayer());
|
||||
EditorMenuManager editorManager = core.getMenuManagerFactory().getEditorMenuManager(playerState);
|
||||
MenuInventory inventory = new MenuInventory(menuName, Utils.legacySerializerAnyCase(menuName), 6, null);
|
||||
MenuInventory inventory = new MenuInventory(menuName, UtilitiesOG.trueogColorize(menuName), 6, null);
|
||||
|
||||
editorManager.setEditingMenu(inventory);
|
||||
editorManager.open();
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
package cosmeticsOG.commands.subcommands;
|
||||
|
||||
import net.trueog.utilitiesog.UtilitiesOG;
|
||||
import cosmeticsOG.CosmeticsOG;
|
||||
import cosmeticsOG.Utils;
|
||||
import cosmeticsOG.commands.Command;
|
||||
import cosmeticsOG.commands.Sender;
|
||||
import cosmeticsOG.database.properties.Group;
|
||||
@@ -22,13 +22,13 @@ public class DeleteGroupCommand extends Command {
|
||||
|
||||
if (sender.isPlayer()) {
|
||||
|
||||
Utils.cosmeticsOGPlaceholderMessage((Player) sender, Message.COMMAND_ERROR_ARGUMENTS.getValue());
|
||||
Utils.cosmeticsOGPlaceholderMessage((Player) sender, getUsage().getValue());
|
||||
CosmeticsOG.chatMessage((Player) sender, Message.COMMAND_ERROR_ARGUMENTS.getValue());
|
||||
CosmeticsOG.chatMessage((Player) sender, getUsage().getValue());
|
||||
|
||||
} else {
|
||||
|
||||
Utils.logToConsole(Message.COMMAND_ERROR_ARGUMENTS.getValue());
|
||||
Utils.logToConsole(getUsage().getValue());
|
||||
UtilitiesOG.logToConsole(CosmeticsOG.getPrefix(), Message.COMMAND_ERROR_ARGUMENTS.getValue());
|
||||
UtilitiesOG.logToConsole(CosmeticsOG.getPrefix(), getUsage().getValue());
|
||||
|
||||
}
|
||||
|
||||
@@ -56,12 +56,12 @@ public class DeleteGroupCommand extends Command {
|
||||
|
||||
if (sender.isPlayer()) {
|
||||
|
||||
Utils.cosmeticsOGPlaceholderMessage((Player) sender,
|
||||
Message.COMMAND_ERROR_UNKNOWN_GROUP.replace("{1}", groupName));
|
||||
CosmeticsOG.chatMessage((Player) sender, Message.COMMAND_ERROR_UNKNOWN_GROUP.replace("{1}", groupName));
|
||||
|
||||
} else {
|
||||
|
||||
Utils.logToConsole(Message.COMMAND_ERROR_UNKNOWN_GROUP.replace("{1}", groupName));
|
||||
UtilitiesOG.logToConsole(CosmeticsOG.getPrefix(),
|
||||
Message.COMMAND_ERROR_UNKNOWN_GROUP.replace("{1}", groupName));
|
||||
|
||||
}
|
||||
|
||||
@@ -73,12 +73,12 @@ public class DeleteGroupCommand extends Command {
|
||||
|
||||
if (sender.isPlayer()) {
|
||||
|
||||
Utils.cosmeticsOGPlaceholderMessage((Player) sender,
|
||||
Message.COMMAND_REMOVE_GROUP_SUCCESS.replace("{1}", groupName));
|
||||
CosmeticsOG.chatMessage((Player) sender, Message.COMMAND_REMOVE_GROUP_SUCCESS.replace("{1}", groupName));
|
||||
|
||||
} else {
|
||||
|
||||
Utils.logToConsole(Message.COMMAND_REMOVE_GROUP_SUCCESS.replace("{1}", groupName));
|
||||
UtilitiesOG.logToConsole(CosmeticsOG.getPrefix(),
|
||||
Message.COMMAND_REMOVE_GROUP_SUCCESS.replace("{1}", groupName));
|
||||
|
||||
}
|
||||
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
package cosmeticsOG.commands.subcommands;
|
||||
|
||||
import net.trueog.utilitiesog.UtilitiesOG;
|
||||
import cosmeticsOG.CosmeticsOG;
|
||||
import cosmeticsOG.Utils;
|
||||
import cosmeticsOG.commands.Command;
|
||||
import cosmeticsOG.commands.Sender;
|
||||
import cosmeticsOG.database.Database;
|
||||
@@ -62,13 +62,13 @@ public class EditCommand extends Command {
|
||||
|
||||
if (sender.isPlayer()) {
|
||||
|
||||
Utils.cosmeticsOGPlaceholderMessage((Player) sender, Message.COMMAND_ERROR_ARGUMENTS.getValue());
|
||||
Utils.cosmeticsOGPlaceholderMessage((Player) sender, Message.COMMAND_EDIT_USAGE.getValue());
|
||||
CosmeticsOG.chatMessage((Player) sender, Message.COMMAND_ERROR_ARGUMENTS.getValue());
|
||||
CosmeticsOG.chatMessage((Player) sender, Message.COMMAND_EDIT_USAGE.getValue());
|
||||
|
||||
} else {
|
||||
|
||||
Utils.logToConsole(Message.COMMAND_ERROR_ARGUMENTS.getValue());
|
||||
Utils.logToConsole(Message.COMMAND_EDIT_USAGE.getValue());
|
||||
UtilitiesOG.logToConsole(CosmeticsOG.getPrefix(), Message.COMMAND_ERROR_ARGUMENTS.getValue());
|
||||
UtilitiesOG.logToConsole(CosmeticsOG.getPrefix(), Message.COMMAND_EDIT_USAGE.getValue());
|
||||
|
||||
}
|
||||
|
||||
@@ -80,7 +80,7 @@ public class EditCommand extends Command {
|
||||
Database database = core.getDatabase();
|
||||
if (playerState.hasEditorOpen()) {
|
||||
|
||||
Utils.cosmeticsOGPlaceholderMessage((Player) sender, Message.COMMAND_ERROR_ALREADY_EDITING.getValue());
|
||||
CosmeticsOG.chatMessage((Player) sender, Message.COMMAND_ERROR_ALREADY_EDITING.getValue());
|
||||
|
||||
return false;
|
||||
|
||||
@@ -105,8 +105,7 @@ public class EditCommand extends Command {
|
||||
|
||||
if (!database.menuExists(menuName)) {
|
||||
|
||||
Utils.cosmeticsOGPlaceholderMessage((Player) sender,
|
||||
Message.COMMAND_ERROR_UNKNOWN_MENU.replace("{1}", menuName));
|
||||
CosmeticsOG.chatMessage((Player) sender, Message.COMMAND_ERROR_UNKNOWN_MENU.replace("{1}", menuName));
|
||||
|
||||
return false;
|
||||
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
package cosmeticsOG.commands.subcommands;
|
||||
|
||||
import net.trueog.utilitiesog.UtilitiesOG;
|
||||
import cosmeticsOG.CosmeticsOG;
|
||||
import cosmeticsOG.Utils;
|
||||
import cosmeticsOG.commands.Command;
|
||||
import cosmeticsOG.commands.Sender;
|
||||
import cosmeticsOG.database.Database;
|
||||
@@ -24,13 +24,13 @@ public class EditGroupCommand extends Command {
|
||||
|
||||
if (sender.isPlayer()) {
|
||||
|
||||
Utils.cosmeticsOGPlaceholderMessage((Player) sender, Message.COMMAND_ERROR_ARGUMENTS.getValue());
|
||||
Utils.cosmeticsOGPlaceholderMessage((Player) sender, getUsage().getValue());
|
||||
CosmeticsOG.chatMessage((Player) sender, Message.COMMAND_ERROR_ARGUMENTS.getValue());
|
||||
CosmeticsOG.chatMessage((Player) sender, getUsage().getValue());
|
||||
|
||||
} else {
|
||||
|
||||
Utils.logToConsole(Message.COMMAND_ERROR_ARGUMENTS.getValue());
|
||||
Utils.logToConsole(getUsage().getValue());
|
||||
UtilitiesOG.logToConsole(CosmeticsOG.getPrefix(), Message.COMMAND_ERROR_ARGUMENTS.getValue());
|
||||
UtilitiesOG.logToConsole(CosmeticsOG.getPrefix(), getUsage().getValue());
|
||||
|
||||
}
|
||||
|
||||
@@ -65,12 +65,12 @@ public class EditGroupCommand extends Command {
|
||||
|
||||
if (sender.isPlayer()) {
|
||||
|
||||
Utils.cosmeticsOGPlaceholderMessage((Player) sender,
|
||||
Message.COMMAND_ERROR_UNKNOWN_GROUP.replace("{1}", groupName));
|
||||
CosmeticsOG.chatMessage((Player) sender, Message.COMMAND_ERROR_UNKNOWN_GROUP.replace("{1}", groupName));
|
||||
|
||||
} else {
|
||||
|
||||
Utils.logToConsole(Message.COMMAND_ERROR_UNKNOWN_GROUP.replace("{1}", groupName));
|
||||
UtilitiesOG.logToConsole(CosmeticsOG.getPrefix(),
|
||||
Message.COMMAND_ERROR_UNKNOWN_GROUP.replace("{1}", groupName));
|
||||
|
||||
}
|
||||
|
||||
@@ -82,12 +82,12 @@ public class EditGroupCommand extends Command {
|
||||
|
||||
if (sender.isPlayer()) {
|
||||
|
||||
Utils.cosmeticsOGPlaceholderMessage((Player) sender,
|
||||
Message.COMMAND_ERROR_UNKNOWN_MENU.replace("{1}", menuName));
|
||||
CosmeticsOG.chatMessage((Player) sender, Message.COMMAND_ERROR_UNKNOWN_MENU.replace("{1}", menuName));
|
||||
|
||||
} else {
|
||||
|
||||
Utils.logToConsole(Message.COMMAND_ERROR_UNKNOWN_MENU.replace("{1}", menuName));
|
||||
UtilitiesOG.logToConsole(CosmeticsOG.getPrefix(),
|
||||
Message.COMMAND_ERROR_UNKNOWN_MENU.replace("{1}", menuName));
|
||||
|
||||
}
|
||||
|
||||
@@ -105,12 +105,12 @@ public class EditGroupCommand extends Command {
|
||||
|
||||
if (sender.isPlayer()) {
|
||||
|
||||
Utils.cosmeticsOGPlaceholderMessage((Player) sender,
|
||||
Message.COMMAND_EDIT_GROUP_SUCCESS.replace("{1}", groupName));
|
||||
CosmeticsOG.chatMessage((Player) sender, Message.COMMAND_EDIT_GROUP_SUCCESS.replace("{1}", groupName));
|
||||
|
||||
} else {
|
||||
|
||||
Utils.logToConsole(Message.COMMAND_EDIT_GROUP_SUCCESS.replace("{1}", groupName));
|
||||
UtilitiesOG.logToConsole(CosmeticsOG.getPrefix(),
|
||||
Message.COMMAND_EDIT_GROUP_SUCCESS.replace("{1}", groupName));
|
||||
|
||||
}
|
||||
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
package cosmeticsOG.commands.subcommands;
|
||||
|
||||
import net.trueog.utilitiesog.UtilitiesOG;
|
||||
import cosmeticsOG.CosmeticsOG;
|
||||
import cosmeticsOG.Utils;
|
||||
import cosmeticsOG.commands.Command;
|
||||
import cosmeticsOG.commands.Sender;
|
||||
import cosmeticsOG.database.properties.Group;
|
||||
@@ -22,11 +22,11 @@ public class GroupInfoCommand extends Command {
|
||||
|
||||
if (sender.isPlayer()) {
|
||||
|
||||
Utils.cosmeticsOGPlaceholderMessage((Player) sender, Message.COMMAND_GROUP_INFO_TIP.getValue());
|
||||
CosmeticsOG.chatMessage((Player) sender, Message.COMMAND_GROUP_INFO_TIP.getValue());
|
||||
|
||||
} else {
|
||||
|
||||
Utils.logToConsole(Message.COMMAND_GROUP_INFO_TIP.getValue());
|
||||
UtilitiesOG.logToConsole(CosmeticsOG.getPrefix(), Message.COMMAND_GROUP_INFO_TIP.getValue());
|
||||
|
||||
}
|
||||
|
||||
@@ -37,11 +37,11 @@ public class GroupInfoCommand extends Command {
|
||||
|
||||
if (sender.isPlayer()) {
|
||||
|
||||
Utils.cosmeticsOGPlaceholderMessage((Player) sender, ("&f> " + info));
|
||||
CosmeticsOG.chatMessage((Player) sender, ("&f> " + info));
|
||||
|
||||
} else {
|
||||
|
||||
Utils.logToConsole("> " + info);
|
||||
UtilitiesOG.logToConsole(CosmeticsOG.getPrefix(), "> " + info);
|
||||
|
||||
}
|
||||
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
package cosmeticsOG.commands.subcommands;
|
||||
|
||||
import net.trueog.utilitiesog.UtilitiesOG;
|
||||
import cosmeticsOG.CosmeticsOG;
|
||||
import cosmeticsOG.Utils;
|
||||
import cosmeticsOG.commands.Command;
|
||||
import cosmeticsOG.commands.Sender;
|
||||
import cosmeticsOG.configuration.CustomConfig;
|
||||
@@ -24,13 +24,13 @@ public class ImportCommand extends Command {
|
||||
|
||||
if (sender.isPlayer()) {
|
||||
|
||||
Utils.cosmeticsOGPlaceholderMessage((Player) sender, Message.COMMAND_ERROR_ARGUMENTS.getValue());
|
||||
Utils.cosmeticsOGPlaceholderMessage((Player) sender, Message.COMMAND_IMPORT_USAGE.getValue());
|
||||
CosmeticsOG.chatMessage((Player) sender, Message.COMMAND_ERROR_ARGUMENTS.getValue());
|
||||
CosmeticsOG.chatMessage((Player) sender, Message.COMMAND_IMPORT_USAGE.getValue());
|
||||
|
||||
} else {
|
||||
|
||||
Utils.logToConsole(Message.COMMAND_ERROR_ARGUMENTS.getValue());
|
||||
Utils.logToConsole(Message.COMMAND_IMPORT_USAGE.getValue());
|
||||
UtilitiesOG.logToConsole(CosmeticsOG.getPrefix(), Message.COMMAND_ERROR_ARGUMENTS.getValue());
|
||||
UtilitiesOG.logToConsole(CosmeticsOG.getPrefix(), Message.COMMAND_IMPORT_USAGE.getValue());
|
||||
|
||||
}
|
||||
|
||||
@@ -42,11 +42,11 @@ public class ImportCommand extends Command {
|
||||
|
||||
if (sender.isPlayer()) {
|
||||
|
||||
Utils.cosmeticsOGPlaceholderMessage((Player) sender, Message.COMMAND_ADD_TYPE_ERROR.getValue());
|
||||
CosmeticsOG.chatMessage((Player) sender, Message.COMMAND_ADD_TYPE_ERROR.getValue());
|
||||
|
||||
} else {
|
||||
|
||||
Utils.logToConsole(Message.COMMAND_ADD_TYPE_ERROR.getValue());
|
||||
UtilitiesOG.logToConsole(CosmeticsOG.getPrefix(), Message.COMMAND_ADD_TYPE_ERROR.getValue());
|
||||
|
||||
}
|
||||
|
||||
@@ -59,12 +59,12 @@ public class ImportCommand extends Command {
|
||||
|
||||
if (sender.isPlayer()) {
|
||||
|
||||
Utils.cosmeticsOGPlaceholderMessage((Player) sender,
|
||||
Message.COMMAND_ERROR_MENU_EXISTS.replace("{1}", menuName));
|
||||
CosmeticsOG.chatMessage((Player) sender, Message.COMMAND_ERROR_MENU_EXISTS.replace("{1}", menuName));
|
||||
|
||||
} else {
|
||||
|
||||
Utils.logToConsole(Message.COMMAND_ERROR_MENU_EXISTS.replace("{1}", menuName));
|
||||
UtilitiesOG.logToConsole(CosmeticsOG.getPrefix(),
|
||||
Message.COMMAND_ERROR_MENU_EXISTS.replace("{1}", menuName));
|
||||
|
||||
}
|
||||
|
||||
@@ -79,12 +79,12 @@ public class ImportCommand extends Command {
|
||||
|
||||
if (sender.isPlayer()) {
|
||||
|
||||
Utils.cosmeticsOGPlaceholderMessage((Player) sender,
|
||||
Message.COMMAND_ERROR_UNKNOWN_MENU.replace("{1}", menuName));
|
||||
CosmeticsOG.chatMessage((Player) sender, Message.COMMAND_ERROR_UNKNOWN_MENU.replace("{1}", menuName));
|
||||
|
||||
} else {
|
||||
|
||||
Utils.logToConsole(Message.COMMAND_ERROR_UNKNOWN_MENU.replace("{1}", menuName));
|
||||
UtilitiesOG.logToConsole(CosmeticsOG.getPrefix(),
|
||||
Message.COMMAND_ERROR_UNKNOWN_MENU.replace("{1}", menuName));
|
||||
|
||||
}
|
||||
|
||||
@@ -96,12 +96,11 @@ public class ImportCommand extends Command {
|
||||
|
||||
if (sender.isPlayer()) {
|
||||
|
||||
Utils.cosmeticsOGPlaceholderMessage((Player) sender,
|
||||
Message.COMMAND_IMPORT_SUCCESS.replace("{1}", menuName));
|
||||
CosmeticsOG.chatMessage((Player) sender, Message.COMMAND_IMPORT_SUCCESS.replace("{1}", menuName));
|
||||
|
||||
} else {
|
||||
|
||||
Utils.logToConsole(Message.COMMAND_IMPORT_SUCCESS.replace("{1}", menuName));
|
||||
UtilitiesOG.logToConsole(CosmeticsOG.getPrefix(), Message.COMMAND_IMPORT_SUCCESS.replace("{1}", menuName));
|
||||
|
||||
}
|
||||
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
package cosmeticsOG.commands.subcommands;
|
||||
|
||||
import net.trueog.utilitiesog.UtilitiesOG;
|
||||
import cosmeticsOG.CosmeticsOG;
|
||||
import cosmeticsOG.Utils;
|
||||
import cosmeticsOG.commands.Sender;
|
||||
import cosmeticsOG.editor.EditorMenuManager;
|
||||
import cosmeticsOG.editor.MetaState;
|
||||
@@ -30,7 +30,7 @@ public class MetaCommand extends EditCommand {
|
||||
PlayerState playerState = core.getPlayerState(player);
|
||||
if (!playerState.hasEditorOpen()) {
|
||||
|
||||
Utils.cosmeticsOGPlaceholderMessage(player, Message.META_ERROR.getValue());
|
||||
CosmeticsOG.chatMessage(player, Message.META_ERROR.getValue());
|
||||
|
||||
return false;
|
||||
|
||||
@@ -38,8 +38,8 @@ public class MetaCommand extends EditCommand {
|
||||
|
||||
if (args.size() == 0) {
|
||||
|
||||
Utils.cosmeticsOGPlaceholderMessage(player, Message.COMMAND_ERROR_ARGUMENTS.getValue());
|
||||
Utils.cosmeticsOGPlaceholderMessage(player,
|
||||
CosmeticsOG.chatMessage(player, Message.COMMAND_ERROR_ARGUMENTS.getValue());
|
||||
CosmeticsOG.chatMessage(player,
|
||||
Message.COMMAND_META_USAGE.replace("{1}", playerState.getMetaState().getSuggestion()));
|
||||
|
||||
return false;
|
||||
@@ -61,7 +61,7 @@ public class MetaCommand extends EditCommand {
|
||||
|
||||
} else {
|
||||
|
||||
Utils.logToConsole(Message.COMMAND_ERROR_PLAYER_ONLY.getValue());
|
||||
UtilitiesOG.logToConsole(CosmeticsOG.getPrefix(), Message.COMMAND_ERROR_PLAYER_ONLY.getValue());
|
||||
|
||||
}
|
||||
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
package cosmeticsOG.commands.subcommands;
|
||||
|
||||
import net.trueog.utilitiesog.UtilitiesOG;
|
||||
import cosmeticsOG.CosmeticsOG;
|
||||
import cosmeticsOG.Utils;
|
||||
import cosmeticsOG.commands.Command;
|
||||
import cosmeticsOG.commands.Sender;
|
||||
import cosmeticsOG.database.Database;
|
||||
@@ -72,13 +72,13 @@ public class OpenCommand extends Command {
|
||||
|
||||
if (sender.isPlayer()) {
|
||||
|
||||
Utils.cosmeticsOGPlaceholderMessage((Player) sender, Message.COMMAND_ERROR_ARGUMENTS.getValue());
|
||||
Utils.cosmeticsOGPlaceholderMessage((Player) sender, Message.COMMAND_OPEN_USAGE.getValue());
|
||||
CosmeticsOG.chatMessage((Player) sender, Message.COMMAND_ERROR_ARGUMENTS.getValue());
|
||||
CosmeticsOG.chatMessage((Player) sender, Message.COMMAND_OPEN_USAGE.getValue());
|
||||
|
||||
} else {
|
||||
|
||||
Utils.logToConsole(Message.COMMAND_ERROR_ARGUMENTS.getValue());
|
||||
Utils.logToConsole(Message.COMMAND_OPEN_USAGE.getValue());
|
||||
UtilitiesOG.logToConsole(CosmeticsOG.getPrefix(), Message.COMMAND_ERROR_ARGUMENTS.getValue());
|
||||
UtilitiesOG.logToConsole(CosmeticsOG.getPrefix(), Message.COMMAND_OPEN_USAGE.getValue());
|
||||
|
||||
}
|
||||
|
||||
@@ -90,7 +90,7 @@ public class OpenCommand extends Command {
|
||||
|
||||
if (!sender.isPlayer()) {
|
||||
|
||||
Utils.logToConsole(Message.COMMAND_ERROR_PLAYER_ONLY.getValue());
|
||||
UtilitiesOG.logToConsole(CosmeticsOG.getPrefix(), Message.COMMAND_ERROR_PLAYER_ONLY.getValue());
|
||||
|
||||
return false;
|
||||
|
||||
@@ -99,8 +99,7 @@ public class OpenCommand extends Command {
|
||||
PlayerState playerState = core.getPlayerState(sender.getPlayer());
|
||||
if (playerState.hasEditorOpen()) {
|
||||
|
||||
Utils.cosmeticsOGPlaceholderMessage((Player) sender,
|
||||
Message.COMMAND_ERROR_ALREADY_EDITING.getValue());
|
||||
CosmeticsOG.chatMessage((Player) sender, Message.COMMAND_ERROR_ALREADY_EDITING.getValue());
|
||||
|
||||
return false;
|
||||
|
||||
@@ -285,7 +284,7 @@ public class OpenCommand extends Command {
|
||||
|
||||
if (menuName.equals("purchase")) {
|
||||
|
||||
Utils.cosmeticsOGPlaceholderMessage((Player) sender, Message.COMMAND_OPEN_ERROR.replace("{1}", menuName));
|
||||
CosmeticsOG.chatMessage((Player) sender, Message.COMMAND_OPEN_ERROR.replace("{1}", menuName));
|
||||
|
||||
return null;
|
||||
|
||||
@@ -300,8 +299,7 @@ public class OpenCommand extends Command {
|
||||
|
||||
if (menuInventory == null) {
|
||||
|
||||
Utils.cosmeticsOGPlaceholderMessage((Player) sender,
|
||||
Message.COMMAND_ERROR_UNKNOWN_MENU.replace("{1}", menuName));
|
||||
CosmeticsOG.chatMessage((Player) sender, Message.COMMAND_ERROR_UNKNOWN_MENU.replace("{1}", menuName));
|
||||
|
||||
return null;
|
||||
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
package cosmeticsOG.commands.subcommands;
|
||||
|
||||
import net.trueog.utilitiesog.UtilitiesOG;
|
||||
import cosmeticsOG.CosmeticsOG;
|
||||
import cosmeticsOG.Utils;
|
||||
import cosmeticsOG.commands.Command;
|
||||
import cosmeticsOG.commands.Sender;
|
||||
import cosmeticsOG.locale.Message;
|
||||
@@ -33,11 +33,11 @@ public class OpenPlayerCommand extends Command {
|
||||
|
||||
if (sender.isPlayer()) {
|
||||
|
||||
Utils.cosmeticsOGPlaceholderMessage((Player) sender, getUsage().getValue());
|
||||
CosmeticsOG.chatMessage((Player) sender, getUsage().getValue());
|
||||
|
||||
} else {
|
||||
|
||||
Utils.logToConsole(getUsage().getValue());
|
||||
UtilitiesOG.logToConsole(CosmeticsOG.getPrefix(), getUsage().getValue());
|
||||
|
||||
}
|
||||
|
||||
@@ -50,12 +50,13 @@ public class OpenPlayerCommand extends Command {
|
||||
|
||||
if (sender.isPlayer()) {
|
||||
|
||||
Utils.cosmeticsOGPlaceholderMessage((Player) sender,
|
||||
CosmeticsOG.chatMessage((Player) sender,
|
||||
Message.COMMAND_ERROR_UNKNOWN_PLAYER.getValue().replace("{1}", args.get(1)));
|
||||
|
||||
} else {
|
||||
|
||||
Utils.logToConsole(Message.COMMAND_ERROR_UNKNOWN_PLAYER.getValue().replace("{1}", args.get(1)));
|
||||
UtilitiesOG.logToConsole(CosmeticsOG.getPrefix(),
|
||||
Message.COMMAND_ERROR_UNKNOWN_PLAYER.getValue().replace("{1}", args.get(1)));
|
||||
|
||||
}
|
||||
|
||||
@@ -67,12 +68,12 @@ public class OpenPlayerCommand extends Command {
|
||||
|
||||
if (sender.isPlayer()) {
|
||||
|
||||
Utils.cosmeticsOGPlaceholderMessage((Player) sender,
|
||||
CosmeticsOG.chatMessage((Player) sender,
|
||||
Message.COMMAND_ERROR_OFFLINE_PLAYER.getValue().replace("{1}", targetPlayer.getName()));
|
||||
|
||||
} else {
|
||||
|
||||
Utils.logToConsole(
|
||||
UtilitiesOG.logToConsole(CosmeticsOG.getPrefix(),
|
||||
Message.COMMAND_ERROR_OFFLINE_PLAYER.getValue().replace("{1}", targetPlayer.getName()));
|
||||
|
||||
}
|
||||
@@ -86,12 +87,13 @@ public class OpenPlayerCommand extends Command {
|
||||
|
||||
if (sender.isPlayer()) {
|
||||
|
||||
Utils.cosmeticsOGPlaceholderMessage((Player) sender,
|
||||
CosmeticsOG.chatMessage((Player) sender,
|
||||
Message.COMMAND_OPEN_PLAYER_EDITING.replace("{1}", targetPlayer.getName()));
|
||||
|
||||
} else {
|
||||
|
||||
Utils.logToConsole(Message.COMMAND_OPEN_PLAYER_EDITING.replace("{1}", targetPlayer.getName()));
|
||||
UtilitiesOG.logToConsole(CosmeticsOG.getPrefix(),
|
||||
Message.COMMAND_OPEN_PLAYER_EDITING.replace("{1}", targetPlayer.getName()));
|
||||
|
||||
}
|
||||
|
||||
|
||||
@@ -1,7 +1,6 @@
|
||||
package cosmeticsOG.commands.subcommands;
|
||||
|
||||
import cosmeticsOG.CosmeticsOG;
|
||||
import cosmeticsOG.Utils;
|
||||
import cosmeticsOG.commands.Command;
|
||||
import cosmeticsOG.commands.Sender;
|
||||
import cosmeticsOG.locale.Message;
|
||||
@@ -23,7 +22,7 @@ public class ParticlesCommand extends Command {
|
||||
PlayerState playerState = core.getPlayerState(sender.getPlayer());
|
||||
if (playerState.hasEditorOpen()) {
|
||||
|
||||
Utils.cosmeticsOGPlaceholderMessage((Player) sender, Message.COMMAND_ERROR_ALREADY_EDITING.getValue());
|
||||
CosmeticsOG.chatMessage((Player) sender, Message.COMMAND_ERROR_ALREADY_EDITING.getValue());
|
||||
|
||||
return false;
|
||||
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
package cosmeticsOG.commands.subcommands;
|
||||
|
||||
import net.trueog.utilitiesog.UtilitiesOG;
|
||||
import cosmeticsOG.CosmeticsOG;
|
||||
import cosmeticsOG.Utils;
|
||||
import cosmeticsOG.commands.Command;
|
||||
import cosmeticsOG.commands.Sender;
|
||||
import cosmeticsOG.locale.Message;
|
||||
@@ -19,11 +19,11 @@ public class ReloadCommand extends Command {
|
||||
|
||||
if (sender.isPlayer()) {
|
||||
|
||||
Utils.cosmeticsOGPlaceholderMessage((Player) sender, Message.COMMAND_RELOAD_SUCCESS.getValue());
|
||||
CosmeticsOG.chatMessage((Player) sender, Message.COMMAND_RELOAD_SUCCESS.getValue());
|
||||
|
||||
} else {
|
||||
|
||||
Utils.logToConsole(Message.COMMAND_RELOAD_SUCCESS.getValue());
|
||||
UtilitiesOG.logToConsole(CosmeticsOG.getPrefix(), Message.COMMAND_RELOAD_SUCCESS.getValue());
|
||||
|
||||
}
|
||||
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
package cosmeticsOG.commands.subcommands;
|
||||
|
||||
import net.trueog.utilitiesog.UtilitiesOG;
|
||||
import cosmeticsOG.CosmeticsOG;
|
||||
import cosmeticsOG.Utils;
|
||||
import cosmeticsOG.commands.Command;
|
||||
import cosmeticsOG.commands.Sender;
|
||||
import cosmeticsOG.locale.Message;
|
||||
@@ -21,13 +21,13 @@ public class RemoveTypeCommand extends Command {
|
||||
|
||||
if (sender.isPlayer()) {
|
||||
|
||||
Utils.cosmeticsOGPlaceholderMessage((Player) sender, Message.COMMAND_ERROR_ARGUMENTS.getValue());
|
||||
Utils.cosmeticsOGPlaceholderMessage((Player) sender, getUsage().getValue());
|
||||
CosmeticsOG.chatMessage((Player) sender, Message.COMMAND_ERROR_ARGUMENTS.getValue());
|
||||
CosmeticsOG.chatMessage((Player) sender, getUsage().getValue());
|
||||
|
||||
} else {
|
||||
|
||||
Utils.logToConsole(Message.COMMAND_ERROR_ARGUMENTS.getValue());
|
||||
Utils.logToConsole(getUsage().getValue());
|
||||
UtilitiesOG.logToConsole(CosmeticsOG.getPrefix(), Message.COMMAND_ERROR_ARGUMENTS.getValue());
|
||||
UtilitiesOG.logToConsole(CosmeticsOG.getPrefix(), getUsage().getValue());
|
||||
|
||||
}
|
||||
|
||||
@@ -40,12 +40,12 @@ public class RemoveTypeCommand extends Command {
|
||||
|
||||
if (sender.isPlayer()) {
|
||||
|
||||
Utils.cosmeticsOGPlaceholderMessage((Player) sender,
|
||||
Message.COMMAND_ERROR_UNKNOWN_TYPE.replace("{1}", imageName));
|
||||
CosmeticsOG.chatMessage((Player) sender, Message.COMMAND_ERROR_UNKNOWN_TYPE.replace("{1}", imageName));
|
||||
|
||||
} else {
|
||||
|
||||
Utils.logToConsole(Message.COMMAND_ERROR_UNKNOWN_TYPE.replace("{1}", imageName));
|
||||
UtilitiesOG.logToConsole(CosmeticsOG.getPrefix(),
|
||||
Message.COMMAND_ERROR_UNKNOWN_TYPE.replace("{1}", imageName));
|
||||
|
||||
}
|
||||
|
||||
@@ -57,12 +57,12 @@ public class RemoveTypeCommand extends Command {
|
||||
|
||||
if (sender.isPlayer()) {
|
||||
|
||||
Utils.cosmeticsOGPlaceholderMessage((Player) sender,
|
||||
Message.COMMAND_REMOVE_TYPE_SUCCESS.replace("{1}", imageName));
|
||||
CosmeticsOG.chatMessage((Player) sender, Message.COMMAND_REMOVE_TYPE_SUCCESS.replace("{1}", imageName));
|
||||
|
||||
} else {
|
||||
|
||||
Utils.logToConsole(Message.COMMAND_REMOVE_TYPE_SUCCESS.replace("{1}", imageName));
|
||||
UtilitiesOG.logToConsole(CosmeticsOG.getPrefix(),
|
||||
Message.COMMAND_REMOVE_TYPE_SUCCESS.replace("{1}", imageName));
|
||||
|
||||
}
|
||||
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
package cosmeticsOG.commands.subcommands;
|
||||
|
||||
import net.trueog.utilitiesog.UtilitiesOG;
|
||||
import cosmeticsOG.CosmeticsOG;
|
||||
import cosmeticsOG.Utils;
|
||||
import cosmeticsOG.commands.Command;
|
||||
import cosmeticsOG.commands.Sender;
|
||||
import cosmeticsOG.database.Database;
|
||||
@@ -26,13 +26,13 @@ public class SetCommand extends Command {
|
||||
|
||||
if (sender.isPlayer()) {
|
||||
|
||||
Utils.cosmeticsOGPlaceholderMessage((Player) sender, Message.COMMAND_ERROR_ARGUMENTS.getValue());
|
||||
Utils.cosmeticsOGPlaceholderMessage((Player) sender, Message.COMMAND_SET_USAGE.getValue());
|
||||
CosmeticsOG.chatMessage((Player) sender, Message.COMMAND_ERROR_ARGUMENTS.getValue());
|
||||
CosmeticsOG.chatMessage((Player) sender, Message.COMMAND_SET_USAGE.getValue());
|
||||
|
||||
} else {
|
||||
|
||||
Utils.logToConsole(Message.COMMAND_ERROR_ARGUMENTS.getValue());
|
||||
Utils.logToConsole(Message.COMMAND_SET_USAGE.getValue());
|
||||
UtilitiesOG.logToConsole(CosmeticsOG.getPrefix(), Message.COMMAND_ERROR_ARGUMENTS.getValue());
|
||||
UtilitiesOG.logToConsole(CosmeticsOG.getPrefix(), Message.COMMAND_SET_USAGE.getValue());
|
||||
|
||||
}
|
||||
|
||||
@@ -45,12 +45,13 @@ public class SetCommand extends Command {
|
||||
|
||||
if (sender.isPlayer()) {
|
||||
|
||||
Utils.cosmeticsOGPlaceholderMessage((Player) sender,
|
||||
CosmeticsOG.chatMessage((Player) sender,
|
||||
Message.COMMAND_ERROR_UNKNOWN_PLAYER.getValue().replace("{1}", args.get(0)));
|
||||
|
||||
} else {
|
||||
|
||||
Utils.logToConsole(Message.COMMAND_ERROR_UNKNOWN_PLAYER.getValue().replace("{1}", args.get(0)));
|
||||
UtilitiesOG.logToConsole(CosmeticsOG.getPrefix(),
|
||||
Message.COMMAND_ERROR_UNKNOWN_PLAYER.getValue().replace("{1}", args.get(0)));
|
||||
|
||||
}
|
||||
|
||||
@@ -62,12 +63,13 @@ public class SetCommand extends Command {
|
||||
|
||||
if (sender.isPlayer()) {
|
||||
|
||||
Utils.cosmeticsOGPlaceholderMessage((Player) sender,
|
||||
CosmeticsOG.chatMessage((Player) sender,
|
||||
Message.COMMAND_ERROR_OFFLINE_PLAYER.getValue().replace("{1}", player.getName()));
|
||||
|
||||
} else {
|
||||
|
||||
Utils.logToConsole(Message.COMMAND_ERROR_OFFLINE_PLAYER.getValue().replace("{1}", player.getName()));
|
||||
UtilitiesOG.logToConsole(CosmeticsOG.getPrefix(),
|
||||
Message.COMMAND_ERROR_OFFLINE_PLAYER.getValue().replace("{1}", player.getName()));
|
||||
|
||||
}
|
||||
|
||||
@@ -112,12 +114,13 @@ public class SetCommand extends Command {
|
||||
|
||||
if (sender.isPlayer()) {
|
||||
|
||||
Utils.cosmeticsOGPlaceholderMessage((Player) sender,
|
||||
CosmeticsOG.chatMessage((Player) sender,
|
||||
Message.COMMAND_SET_ALREADY_SET.getValue().replace("{1}", player.getName()));
|
||||
|
||||
} else {
|
||||
|
||||
Utils.logToConsole(Message.COMMAND_SET_ALREADY_SET.getValue().replace("{1}", player.getName()));
|
||||
UtilitiesOG.logToConsole(CosmeticsOG.getPrefix(),
|
||||
Message.COMMAND_SET_ALREADY_SET.getValue().replace("{1}", player.getName()));
|
||||
|
||||
}
|
||||
|
||||
@@ -133,12 +136,13 @@ public class SetCommand extends Command {
|
||||
|
||||
if (sender.isPlayer()) {
|
||||
|
||||
Utils.cosmeticsOGPlaceholderMessage((Player) sender,
|
||||
CosmeticsOG.chatMessage((Player) sender,
|
||||
Message.COMMAND_SET_LABEL_ERROR.getValue().replace("{1}", hatLabel));
|
||||
|
||||
} else {
|
||||
|
||||
Utils.logToConsole(Message.COMMAND_SET_LABEL_ERROR.getValue().replace("{1}", hatLabel));
|
||||
UtilitiesOG.logToConsole(CosmeticsOG.getPrefix(),
|
||||
Message.COMMAND_SET_LABEL_ERROR.getValue().replace("{1}", hatLabel));
|
||||
|
||||
}
|
||||
|
||||
@@ -158,7 +162,8 @@ public class SetCommand extends Command {
|
||||
|
||||
if (tellPlayer) {
|
||||
|
||||
player.sendMessage(Message.COMMAND_SET_SUCCESS.getValue().replace("{1}", hat.getDisplayName()));
|
||||
CosmeticsOG.chatMessage(player,
|
||||
Message.COMMAND_SET_SUCCESS.getValue().replace("{1}", hat.getDisplayName()));
|
||||
|
||||
}
|
||||
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
package cosmeticsOG.commands.subcommands;
|
||||
|
||||
import net.trueog.utilitiesog.UtilitiesOG;
|
||||
import cosmeticsOG.CosmeticsOG;
|
||||
import cosmeticsOG.Utils;
|
||||
import cosmeticsOG.commands.Command;
|
||||
import cosmeticsOG.commands.Sender;
|
||||
import cosmeticsOG.locale.Message;
|
||||
@@ -30,13 +30,13 @@ public class SpigotHelpCommand extends BukkitHelpCommand {
|
||||
Command command = cmds.getValue();
|
||||
if (command != null) {
|
||||
|
||||
String commandText = "&3Command: &f" + Utils.stripColors(command.getName()) + "\n" + "&3Description: &8"
|
||||
+ Utils.stripColors(command.getDescription().getValue()) + "\n" + "&3Usage: &8"
|
||||
+ Utils.stripColors(command.getUsage().getValue()) + "\n" + "&3Permission: &8"
|
||||
+ Utils.stripColors(command.getPermission().getPermission());
|
||||
String commandText = "&3Command: &f" + UtilitiesOG.stripFormatting(command.getName()) + "\n"
|
||||
+ "&3Description: &8" + UtilitiesOG.stripFormatting(command.getDescription().getValue()) + "\n"
|
||||
+ "&3Usage: &8" + UtilitiesOG.stripFormatting(command.getUsage().getValue()) + "\n"
|
||||
+ "&3Permission: &8" + UtilitiesOG.stripFormatting(command.getPermission().getPermission());
|
||||
|
||||
TextComponent hoverText = Utils.legacySerializerAnyCase(commandText);
|
||||
TextComponent commandComponent = Utils.legacySerializerAnyCase("&7> &3" + command.getUsage().getValue())
|
||||
TextComponent hoverText = UtilitiesOG.trueogColorize(commandText);
|
||||
TextComponent commandComponent = UtilitiesOG.trueogColorize("&7> &3" + command.getUsage().getValue())
|
||||
.hoverEvent(HoverEvent.showText(hoverText))
|
||||
.clickEvent(ClickEvent.suggestCommand(command.getUsage().getValue()));
|
||||
|
||||
@@ -54,13 +54,14 @@ public class SpigotHelpCommand extends BukkitHelpCommand {
|
||||
if (sender.isPlayer()) {
|
||||
|
||||
Player player = sender.getPlayer();
|
||||
Utils.cosmeticsOGPlaceholderMessage(player, "&f> &6ParticleHats v" + core.getPluginMeta().getVersion());
|
||||
Utils.cosmeticsOGPlaceholderMessage(player, "&7> " + Message.COMMAND_HELP_TIP.getValue());
|
||||
CosmeticsOG.chatMessage(player, "&f> &6ParticleHats v" + core.getPluginMeta().getVersion());
|
||||
CosmeticsOG.chatMessage(player, "&7> " + Message.COMMAND_HELP_TIP.getValue());
|
||||
|
||||
} else {
|
||||
|
||||
Utils.logToConsole("&f> &6ParticleHats v" + core.getPluginMeta().getVersion());
|
||||
Utils.logToConsole("&7> " + Message.COMMAND_HELP_TIP.getValue());
|
||||
UtilitiesOG.logToConsole(CosmeticsOG.getPrefix(),
|
||||
"&f> &6ParticleHats v" + core.getPluginMeta().getVersion());
|
||||
UtilitiesOG.logToConsole(CosmeticsOG.getPrefix(), "&7> " + Message.COMMAND_HELP_TIP.getValue());
|
||||
|
||||
}
|
||||
|
||||
@@ -76,7 +77,7 @@ public class SpigotHelpCommand extends BukkitHelpCommand {
|
||||
|
||||
} else {
|
||||
|
||||
Utils.logToConsole(component.content());
|
||||
UtilitiesOG.logToConsole(CosmeticsOG.getPrefix(), component.content());
|
||||
|
||||
}
|
||||
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
package cosmeticsOG.commands.subcommands;
|
||||
|
||||
import net.trueog.utilitiesog.UtilitiesOG;
|
||||
import cosmeticsOG.CosmeticsOG;
|
||||
import cosmeticsOG.Utils;
|
||||
import cosmeticsOG.commands.Command;
|
||||
import cosmeticsOG.commands.Sender;
|
||||
import cosmeticsOG.locale.Message;
|
||||
@@ -31,13 +31,13 @@ public class ToggleCommand extends Command {
|
||||
|
||||
if (sender.isPlayer()) {
|
||||
|
||||
Utils.cosmeticsOGPlaceholderMessage((Player) sender, Message.COMMAND_ERROR_ARGUMENTS.getValue());
|
||||
Utils.cosmeticsOGPlaceholderMessage((Player) sender, getUsage().getValue());
|
||||
CosmeticsOG.chatMessage((Player) sender, Message.COMMAND_ERROR_ARGUMENTS.getValue());
|
||||
CosmeticsOG.chatMessage((Player) sender, getUsage().getValue());
|
||||
|
||||
} else {
|
||||
|
||||
Utils.logToConsole(Message.COMMAND_ERROR_ARGUMENTS.getValue());
|
||||
Utils.logToConsole(getUsage().getValue());
|
||||
UtilitiesOG.logToConsole(CosmeticsOG.getPrefix(), Message.COMMAND_ERROR_ARGUMENTS.getValue());
|
||||
UtilitiesOG.logToConsole(CosmeticsOG.getPrefix(), getUsage().getValue());
|
||||
|
||||
}
|
||||
|
||||
@@ -57,11 +57,11 @@ public class ToggleCommand extends Command {
|
||||
core.getPlayerState(sender.getPlayer()).toggleHats(!toggleStatus);
|
||||
if (toggleStatus) {
|
||||
|
||||
Utils.cosmeticsOGPlaceholderMessage((Player) sender, Message.COMMAND_TOGGLE_ON.getValue());
|
||||
CosmeticsOG.chatMessage((Player) sender, Message.COMMAND_TOGGLE_ON.getValue());
|
||||
|
||||
} else {
|
||||
|
||||
Utils.cosmeticsOGPlaceholderMessage((Player) sender, Message.COMMAND_TOGGLE_OFF.getValue());
|
||||
CosmeticsOG.chatMessage((Player) sender, Message.COMMAND_TOGGLE_OFF.getValue());
|
||||
|
||||
}
|
||||
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
package cosmeticsOG.commands.subcommands;
|
||||
|
||||
import net.trueog.utilitiesog.UtilitiesOG;
|
||||
import cosmeticsOG.CosmeticsOG;
|
||||
import cosmeticsOG.Utils;
|
||||
import cosmeticsOG.commands.Command;
|
||||
import cosmeticsOG.commands.Sender;
|
||||
import cosmeticsOG.locale.Message;
|
||||
@@ -23,13 +23,13 @@ public class TogglePlayerCommand extends Command {
|
||||
|
||||
if (sender.isPlayer()) {
|
||||
|
||||
Utils.cosmeticsOGPlaceholderMessage((Player) sender, Message.COMMAND_ERROR_ARGUMENTS.getValue());
|
||||
Utils.cosmeticsOGPlaceholderMessage((Player) sender, getUsage().getValue());
|
||||
CosmeticsOG.chatMessage((Player) sender, Message.COMMAND_ERROR_ARGUMENTS.getValue());
|
||||
CosmeticsOG.chatMessage((Player) sender, getUsage().getValue());
|
||||
|
||||
} else {
|
||||
|
||||
Utils.logToConsole(Message.COMMAND_ERROR_ARGUMENTS.getValue());
|
||||
Utils.logToConsole(getUsage().getValue());
|
||||
UtilitiesOG.logToConsole(CosmeticsOG.getPrefix(), Message.COMMAND_ERROR_ARGUMENTS.getValue());
|
||||
UtilitiesOG.logToConsole(CosmeticsOG.getPrefix(), getUsage().getValue());
|
||||
|
||||
}
|
||||
|
||||
@@ -42,12 +42,13 @@ public class TogglePlayerCommand extends Command {
|
||||
|
||||
if (sender.isPlayer()) {
|
||||
|
||||
Utils.cosmeticsOGPlaceholderMessage((Player) sender,
|
||||
CosmeticsOG.chatMessage((Player) sender,
|
||||
Message.COMMAND_ERROR_UNKNOWN_PLAYER.getValue().replace("{1}", args.get(1)));
|
||||
|
||||
} else {
|
||||
|
||||
Utils.logToConsole(Message.COMMAND_ERROR_UNKNOWN_PLAYER.getValue().replace("{1}", args.get(1)));
|
||||
UtilitiesOG.logToConsole(CosmeticsOG.getPrefix(),
|
||||
Message.COMMAND_ERROR_UNKNOWN_PLAYER.getValue().replace("{1}", args.get(1)));
|
||||
|
||||
}
|
||||
|
||||
@@ -59,12 +60,13 @@ public class TogglePlayerCommand extends Command {
|
||||
|
||||
if (sender.isPlayer()) {
|
||||
|
||||
Utils.cosmeticsOGPlaceholderMessage((Player) sender,
|
||||
CosmeticsOG.chatMessage((Player) sender,
|
||||
Message.COMMAND_ERROR_OFFLINE_PLAYER.getValue().replace("{1}", player.getName()));
|
||||
|
||||
} else {
|
||||
|
||||
Utils.logToConsole(Message.COMMAND_ERROR_OFFLINE_PLAYER.getValue().replace("{1}", player.getName()));
|
||||
UtilitiesOG.logToConsole(CosmeticsOG.getPrefix(),
|
||||
Message.COMMAND_ERROR_OFFLINE_PLAYER.getValue().replace("{1}", player.getName()));
|
||||
|
||||
}
|
||||
|
||||
@@ -78,12 +80,13 @@ public class TogglePlayerCommand extends Command {
|
||||
|
||||
if (sender.isPlayer()) {
|
||||
|
||||
Utils.cosmeticsOGPlaceholderMessage((Player) sender,
|
||||
CosmeticsOG.chatMessage((Player) sender,
|
||||
Message.COMMAND_TOGGLE_PLAYER_ON.getValue().replace("{1}", player.getName()));
|
||||
|
||||
} else {
|
||||
|
||||
Utils.logToConsole(Message.COMMAND_TOGGLE_PLAYER_ON.getValue().replace("{1}", player.getName()));
|
||||
UtilitiesOG.logToConsole(CosmeticsOG.getPrefix(),
|
||||
Message.COMMAND_TOGGLE_PLAYER_ON.getValue().replace("{1}", player.getName()));
|
||||
|
||||
}
|
||||
|
||||
@@ -91,12 +94,13 @@ public class TogglePlayerCommand extends Command {
|
||||
|
||||
if (sender.isPlayer()) {
|
||||
|
||||
Utils.cosmeticsOGPlaceholderMessage((Player) sender,
|
||||
CosmeticsOG.chatMessage((Player) sender,
|
||||
Message.COMMAND_TOGGLE_PLAYER_OFF.getValue().replace("{1}", player.getName()));
|
||||
|
||||
} else {
|
||||
|
||||
Utils.logToConsole(Message.COMMAND_TOGGLE_PLAYER_OFF.getValue().replace("{1}", player.getName()));
|
||||
UtilitiesOG.logToConsole(CosmeticsOG.getPrefix(),
|
||||
Message.COMMAND_TOGGLE_PLAYER_OFF.getValue().replace("{1}", player.getName()));
|
||||
|
||||
}
|
||||
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
package cosmeticsOG.commands.subcommands;
|
||||
|
||||
import net.trueog.utilitiesog.UtilitiesOG;
|
||||
import cosmeticsOG.CosmeticsOG;
|
||||
import cosmeticsOG.Utils;
|
||||
import cosmeticsOG.commands.Command;
|
||||
import cosmeticsOG.commands.Sender;
|
||||
import cosmeticsOG.database.Database;
|
||||
@@ -26,13 +26,13 @@ public class UnsetCommand extends Command {
|
||||
|
||||
if (sender.isPlayer()) {
|
||||
|
||||
Utils.cosmeticsOGPlaceholderMessage((Player) sender, Message.COMMAND_ERROR_ARGUMENTS.getValue());
|
||||
Utils.cosmeticsOGPlaceholderMessage((Player) sender, Message.COMMAND_UNSET_USAGE.getValue());
|
||||
CosmeticsOG.chatMessage((Player) sender, Message.COMMAND_ERROR_ARGUMENTS.getValue());
|
||||
CosmeticsOG.chatMessage((Player) sender, Message.COMMAND_UNSET_USAGE.getValue());
|
||||
|
||||
} else {
|
||||
|
||||
Utils.logToConsole(Message.COMMAND_ERROR_ARGUMENTS.getValue());
|
||||
Utils.logToConsole(Message.COMMAND_UNSET_USAGE.getValue());
|
||||
UtilitiesOG.logToConsole(CosmeticsOG.getPrefix(), Message.COMMAND_ERROR_ARGUMENTS.getValue());
|
||||
UtilitiesOG.logToConsole(CosmeticsOG.getPrefix(), Message.COMMAND_UNSET_USAGE.getValue());
|
||||
|
||||
}
|
||||
|
||||
@@ -45,12 +45,13 @@ public class UnsetCommand extends Command {
|
||||
|
||||
if (sender.isPlayer()) {
|
||||
|
||||
Utils.cosmeticsOGPlaceholderMessage((Player) sender,
|
||||
CosmeticsOG.chatMessage((Player) sender,
|
||||
Message.COMMAND_ERROR_UNKNOWN_PLAYER.getValue().replace("{1}", args.get(0)));
|
||||
|
||||
} else {
|
||||
|
||||
Utils.logToConsole(Message.COMMAND_ERROR_UNKNOWN_PLAYER.getValue().replace("{1}", args.get(0)));
|
||||
UtilitiesOG.logToConsole(CosmeticsOG.getPrefix(),
|
||||
Message.COMMAND_ERROR_UNKNOWN_PLAYER.getValue().replace("{1}", args.get(0)));
|
||||
|
||||
}
|
||||
|
||||
@@ -62,12 +63,13 @@ public class UnsetCommand extends Command {
|
||||
|
||||
if (sender.isPlayer()) {
|
||||
|
||||
Utils.cosmeticsOGPlaceholderMessage((Player) sender,
|
||||
CosmeticsOG.chatMessage((Player) sender,
|
||||
Message.COMMAND_ERROR_OFFLINE_PLAYER.getValue().replace("{1}", player.getName()));
|
||||
|
||||
} else {
|
||||
|
||||
Utils.logToConsole(Message.COMMAND_ERROR_OFFLINE_PLAYER.getValue().replace("{1}", player.getName()));
|
||||
UtilitiesOG.logToConsole(CosmeticsOG.getPrefix(),
|
||||
Message.COMMAND_ERROR_OFFLINE_PLAYER.getValue().replace("{1}", player.getName()));
|
||||
|
||||
}
|
||||
|
||||
@@ -91,12 +93,13 @@ public class UnsetCommand extends Command {
|
||||
|
||||
if (sender.isPlayer()) {
|
||||
|
||||
Utils.cosmeticsOGPlaceholderMessage((Player) sender,
|
||||
CosmeticsOG.chatMessage((Player) sender,
|
||||
Message.COMMAND_UNSET_NOT_WEARING.getValue().replace("{1}", player.getName()));
|
||||
|
||||
} else {
|
||||
|
||||
Utils.logToConsole(Message.COMMAND_UNSET_NOT_WEARING.getValue().replace("{1}", player.getName()));
|
||||
UtilitiesOG.logToConsole(CosmeticsOG.getPrefix(),
|
||||
Message.COMMAND_UNSET_NOT_WEARING.getValue().replace("{1}", player.getName()));
|
||||
|
||||
}
|
||||
|
||||
@@ -110,12 +113,13 @@ public class UnsetCommand extends Command {
|
||||
|
||||
if (sender.isPlayer()) {
|
||||
|
||||
Utils.cosmeticsOGPlaceholderMessage((Player) sender,
|
||||
CosmeticsOG.chatMessage((Player) sender,
|
||||
Message.COMMAND_UNSET_LABEL_ERROR.getValue().replace("{1}", hatLabel));
|
||||
|
||||
} else {
|
||||
|
||||
Utils.logToConsole(Message.COMMAND_UNSET_LABEL_ERROR.getValue().replace("{1}", hatLabel));
|
||||
UtilitiesOG.logToConsole(CosmeticsOG.getPrefix(),
|
||||
Message.COMMAND_UNSET_LABEL_ERROR.getValue().replace("{1}", hatLabel));
|
||||
|
||||
}
|
||||
|
||||
@@ -126,7 +130,8 @@ public class UnsetCommand extends Command {
|
||||
core.getPlayerState(player).removeHat(hat);
|
||||
if (tellPlayer) {
|
||||
|
||||
player.sendMessage(Message.COMMAND_UNSET_SUCCESS.getValue().replace("{1}", hat.getDisplayName()));
|
||||
CosmeticsOG.chatMessage(player,
|
||||
Message.COMMAND_UNSET_SUCCESS.getValue().replace("{1}", hat.getDisplayName()));
|
||||
|
||||
}
|
||||
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
package cosmeticsOG.configuration;
|
||||
|
||||
import net.trueog.utilitiesog.UtilitiesOG;
|
||||
import cosmeticsOG.CosmeticsOG;
|
||||
import cosmeticsOG.Utils;
|
||||
import cosmeticsOG.util.ResourceUtil;
|
||||
import java.io.File;
|
||||
import java.io.IOException;
|
||||
@@ -37,7 +37,7 @@ public class CustomConfig {
|
||||
|
||||
} else if (logOutput) {
|
||||
|
||||
Utils.logToConsole("Loading " + path + File.separator + fileName);
|
||||
UtilitiesOG.logToConsole(CosmeticsOG.getPrefix(), "Loading " + path + File.separator + fileName);
|
||||
|
||||
}
|
||||
|
||||
@@ -47,7 +47,8 @@ public class CustomConfig {
|
||||
|
||||
} catch (Exception error) {
|
||||
|
||||
Utils.logToConsole("There was an error loading " + name + ", error: " + error.getClass().getSimpleName());
|
||||
UtilitiesOG.logToConsole(CosmeticsOG.getPrefix(),
|
||||
"There was an error loading " + name + ", error: " + error.getClass().getSimpleName());
|
||||
|
||||
}
|
||||
|
||||
@@ -69,7 +70,8 @@ public class CustomConfig {
|
||||
|
||||
} catch (Exception error) {
|
||||
|
||||
Utils.logToConsole("There was an error loading " + name + ", error: " + error.getClass().getSimpleName());
|
||||
UtilitiesOG.logToConsole(CosmeticsOG.getPrefix(),
|
||||
"There was an error loading " + name + ", error: " + error.getClass().getSimpleName());
|
||||
|
||||
}
|
||||
|
||||
@@ -86,7 +88,8 @@ public class CustomConfig {
|
||||
|
||||
} catch (Exception error) {
|
||||
|
||||
Utils.logToConsole("There was an error saving the config file: " + error.getMessage());
|
||||
UtilitiesOG.logToConsole(CosmeticsOG.getPrefix(),
|
||||
"There was an error saving the config file: " + error.getMessage());
|
||||
|
||||
}
|
||||
|
||||
@@ -103,7 +106,8 @@ public class CustomConfig {
|
||||
|
||||
} catch (Exception error) {
|
||||
|
||||
Utils.logToConsole("There was an error loading " + name + ", error: " + error.getClass().getSimpleName());
|
||||
UtilitiesOG.logToConsole(CosmeticsOG.getPrefix(),
|
||||
"There was an error loading " + name + ", error: " + error.getClass().getSimpleName());
|
||||
|
||||
}
|
||||
|
||||
@@ -175,8 +179,8 @@ public class CustomConfig {
|
||||
|
||||
} catch (IOException error) {
|
||||
|
||||
Utils.logToConsole("ERROR: Failed to copy resource: " + core.getResource(fileName) + "into file: "
|
||||
+ file.getAbsolutePath());
|
||||
UtilitiesOG.logToConsole(CosmeticsOG.getPrefix(), "ERROR: Failed to copy resource: "
|
||||
+ core.getResource(fileName) + "into file: " + file.getAbsolutePath());
|
||||
|
||||
}
|
||||
|
||||
@@ -190,7 +194,8 @@ public class CustomConfig {
|
||||
|
||||
} catch (IOException error) {
|
||||
|
||||
Utils.logToConsole("ERROR: Failed to create file: " + file.getAbsolutePath());
|
||||
UtilitiesOG.logToConsole(CosmeticsOG.getPrefix(),
|
||||
"ERROR: Failed to create file: " + file.getAbsolutePath());
|
||||
|
||||
}
|
||||
|
||||
@@ -200,7 +205,7 @@ public class CustomConfig {
|
||||
|
||||
if (logOutput) {
|
||||
|
||||
Utils.logToConsole("Creating " + path + File.separator + fileName);
|
||||
UtilitiesOG.logToConsole(CosmeticsOG.getPrefix(), "Creating " + path + File.separator + fileName);
|
||||
|
||||
}
|
||||
|
||||
|
||||
@@ -1,9 +1,9 @@
|
||||
package cosmeticsOG.database.type.mysql;
|
||||
|
||||
import net.trueog.utilitiesog.UtilitiesOG;
|
||||
import com.zaxxer.hikari.HikariConfig;
|
||||
import com.zaxxer.hikari.HikariDataSource;
|
||||
import cosmeticsOG.CosmeticsOG;
|
||||
import cosmeticsOG.Utils;
|
||||
import cosmeticsOG.commands.Sender;
|
||||
import cosmeticsOG.compatibility.CompatibleMaterial;
|
||||
import cosmeticsOG.configuration.CustomConfig;
|
||||
@@ -115,7 +115,7 @@ public class MySQLDatabase implements Database {
|
||||
helper.initDatabase(core);
|
||||
connected = true;
|
||||
|
||||
Utils.logToConsole("Successfully connected to MySQL database");
|
||||
UtilitiesOG.logToConsole(CosmeticsOG.getPrefix(), "Successfully connected to MySQL database");
|
||||
|
||||
} catch (Exception e) {
|
||||
|
||||
@@ -1246,12 +1246,13 @@ public class MySQLDatabase implements Database {
|
||||
|
||||
if (sender.isPlayer()) {
|
||||
|
||||
Utils.cosmeticsOGPlaceholderMessage((Player) sender,
|
||||
CosmeticsOG.chatMessage((Player) sender,
|
||||
Message.COMMAND_IMPORT_SUCCESS.replace("{1}", menuConfig.getName()));
|
||||
|
||||
} else {
|
||||
|
||||
Utils.logToConsole(Message.COMMAND_IMPORT_SUCCESS.replace("{1}", menuConfig.getName()));
|
||||
UtilitiesOG.logToConsole(CosmeticsOG.getPrefix(),
|
||||
Message.COMMAND_IMPORT_SUCCESS.replace("{1}", menuConfig.getName()));
|
||||
|
||||
}
|
||||
|
||||
@@ -1263,12 +1264,12 @@ public class MySQLDatabase implements Database {
|
||||
|
||||
if (sender.isPlayer()) {
|
||||
|
||||
Utils.cosmeticsOGPlaceholderMessage((Player) sender,
|
||||
CosmeticsOG.chatMessage((Player) sender,
|
||||
Message.COMMAND_IMPORT_ERROR.replace("{1}", error.getClass().getSimpleName()));
|
||||
|
||||
} else {
|
||||
|
||||
Utils.logToConsole(
|
||||
UtilitiesOG.logToConsole(CosmeticsOG.getPrefix(),
|
||||
Message.COMMAND_IMPORT_ERROR.replace("{1}", error.getClass().getSimpleName()));
|
||||
|
||||
}
|
||||
@@ -1815,7 +1816,7 @@ public class MySQLDatabase implements Database {
|
||||
|
||||
while (menuResult.next()) {
|
||||
|
||||
final TextComponent menuTitle = Utils.legacySerializerAnyCase(menuResult.getString("title"));
|
||||
final TextComponent menuTitle = UtilitiesOG.trueogColorize(menuResult.getString("title"));
|
||||
final int menuSize = menuResult.getInt("size");
|
||||
final String alias = menuResult.getString("alias");
|
||||
|
||||
@@ -2013,8 +2014,8 @@ public class MySQLDatabase implements Database {
|
||||
|
||||
// Using legacySerializerAnyCase to handle any-case color codes
|
||||
ItemMeta meta = item.getItemMeta();
|
||||
meta.displayName(Utils.legacySerializerAnyCase(hat.getDisplayName())); // Convert color-coded string to
|
||||
// Component
|
||||
meta.displayName(UtilitiesOG.trueogColorize(hat.getDisplayName())); // Convert color-coded string to
|
||||
// Component
|
||||
|
||||
while (set.next()) {
|
||||
|
||||
@@ -2022,16 +2023,16 @@ public class MySQLDatabase implements Database {
|
||||
switch (type) {
|
||||
|
||||
case DESCRIPTION:
|
||||
descriptionComponents.add(Utils.legacySerializerAnyCase(set.getString("value"))); // Handle
|
||||
// any-case
|
||||
// color codes
|
||||
descriptionComponents.add(UtilitiesOG.trueogColorize(set.getString("value"))); // Handle
|
||||
// any-case
|
||||
// color codes
|
||||
break;
|
||||
|
||||
case PERMISSION_DESCRIPTION:
|
||||
permissionDescriptionComponents.add(Utils.legacySerializerAnyCase(set.getString("value"))); // Handle
|
||||
// any-case
|
||||
// color
|
||||
// codes
|
||||
permissionDescriptionComponents.add(UtilitiesOG.trueogColorize(set.getString("value"))); // Handle
|
||||
// any-case
|
||||
// color
|
||||
// codes
|
||||
break;
|
||||
|
||||
case ICON:
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
package cosmeticsOG.database.type.yaml;
|
||||
|
||||
import net.trueog.utilitiesog.UtilitiesOG;
|
||||
import cosmeticsOG.CosmeticsOG;
|
||||
import cosmeticsOG.Utils;
|
||||
import cosmeticsOG.compatibility.CompatibleMaterial;
|
||||
import cosmeticsOG.configuration.CustomConfig;
|
||||
import cosmeticsOG.database.Database;
|
||||
@@ -73,7 +73,7 @@ public class YamlDatabase implements Database {
|
||||
|
||||
public YamlDatabase(CosmeticsOG core) {
|
||||
|
||||
Utils.logToConsole("Loaded YAML database.");
|
||||
UtilitiesOG.logToConsole(CosmeticsOG.getPrefix(), "Loaded YAML database.");
|
||||
|
||||
this.core = core;
|
||||
|
||||
@@ -131,7 +131,8 @@ public class YamlDatabase implements Database {
|
||||
core.getDataFolder() + File.separator + "menus" + File.separator + "particles.yml");
|
||||
if (!particlesFile.exists()) {
|
||||
|
||||
Utils.logToConsole("particlesFile does not exist at path: " + particlesFile.getAbsolutePath());
|
||||
UtilitiesOG.logToConsole(CosmeticsOG.getPrefix(),
|
||||
"particlesFile does not exist at path: " + particlesFile.getAbsolutePath());
|
||||
InputStream particleStream = ResourceUtil.getMostCompatibleParticlesMenu();
|
||||
if (particleStream != null) {
|
||||
|
||||
@@ -914,7 +915,7 @@ public class YamlDatabase implements Database {
|
||||
File menusFolder = new File(core.getDataFolder() + File.separator + "menus");
|
||||
if (!menusFolder.isDirectory()) {
|
||||
|
||||
Utils.logToConsole("Unable to find menus folder");
|
||||
UtilitiesOG.logToConsole(CosmeticsOG.getPrefix(), "Unable to find menus folder");
|
||||
return;
|
||||
|
||||
}
|
||||
@@ -1060,7 +1061,7 @@ public class YamlDatabase implements Database {
|
||||
|
||||
FileConfiguration config = menuConfig.getConfig();
|
||||
final String menuName = menuConfig.getName();
|
||||
final TextComponent menuTitle = Utils.legacySerializerAnyCase(config.getString("settings.title", "New Menu"));
|
||||
final TextComponent menuTitle = UtilitiesOG.trueogColorize(config.getString("settings.title", "New Menu"));
|
||||
final int menuSize = config.getInt("settings.size", 6);
|
||||
final String alias = config.getString("settings.alias");
|
||||
final MenuInventory inventory = new MenuInventory(menuName, menuTitle, menuSize, alias);
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
package cosmeticsOG.editor;
|
||||
|
||||
import net.trueog.utilitiesog.UtilitiesOG;
|
||||
import cosmeticsOG.CosmeticsOG;
|
||||
import cosmeticsOG.Utils;
|
||||
import cosmeticsOG.locale.Message;
|
||||
import cosmeticsOG.managers.SettingsManager;
|
||||
import cosmeticsOG.particles.Hat;
|
||||
@@ -904,7 +904,7 @@ public class EditorLore {
|
||||
List<Component> footerDescription = StringUtil
|
||||
.parseDescription(Message.EDITOR_HAT_FOOTER_DESCRIPTION.getValue());
|
||||
List<String> footerStrings = footerDescription.stream()
|
||||
.map(component -> Utils.legacySerializerAnyCase(component.toString()).content())
|
||||
.map(component -> UtilitiesOG.trueogColorize(component.toString()).content())
|
||||
.collect(Collectors.toList());
|
||||
|
||||
description.addAll(footerStrings);
|
||||
@@ -998,7 +998,7 @@ public class EditorLore {
|
||||
String formattedTitle = menuTitle.replace(extraInfo[0], title);
|
||||
|
||||
// Process color codes.
|
||||
return Utils.legacySerializerAnyCase(formattedTitle).content();
|
||||
return UtilitiesOG.trueogColorize(formattedTitle).content();
|
||||
|
||||
}
|
||||
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
package cosmeticsOG.editor;
|
||||
|
||||
import net.trueog.utilitiesog.UtilitiesOG;
|
||||
import cosmeticsOG.CosmeticsOG;
|
||||
import cosmeticsOG.Utils;
|
||||
import cosmeticsOG.database.Database;
|
||||
import cosmeticsOG.locale.Message;
|
||||
import cosmeticsOG.particles.Hat;
|
||||
@@ -92,7 +92,7 @@ public enum MetaState {
|
||||
sb.deleteCharAt(0);
|
||||
|
||||
String value = sb.toString();
|
||||
String rawString = Utils.stripColors(value);
|
||||
String rawString = UtilitiesOG.stripFormatting(value);
|
||||
|
||||
Hat targetHat = editorManager.getBaseHat();
|
||||
|
||||
@@ -123,7 +123,7 @@ public enum MetaState {
|
||||
|
||||
case MENU_ALIAS: {
|
||||
|
||||
editorManager.getEditingMenu().setAlias(Utils.stripColors(args.get(0)));
|
||||
editorManager.getEditingMenu().setAlias(UtilitiesOG.stripFormatting(args.get(0)));
|
||||
editorManager.reopen();
|
||||
|
||||
}
|
||||
@@ -137,7 +137,8 @@ public enum MetaState {
|
||||
|
||||
if (database.menuExists(menuName)) {
|
||||
|
||||
player.sendMessage(Message.COMMAND_ERROR_MENU_EXISTS.getValue().replace("{1}", menuName));
|
||||
CosmeticsOG.chatMessage(player,
|
||||
Message.COMMAND_ERROR_MENU_EXISTS.getValue().replace("{1}", menuName));
|
||||
return;
|
||||
|
||||
}
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
package cosmeticsOG.editor.menus;
|
||||
|
||||
import net.trueog.utilitiesog.UtilitiesOG;
|
||||
import cosmeticsOG.CosmeticsOG;
|
||||
import cosmeticsOG.Utils;
|
||||
import cosmeticsOG.compatibility.CompatibleMaterial;
|
||||
import cosmeticsOG.editor.EditorMenuManager;
|
||||
import cosmeticsOG.locale.Message;
|
||||
@@ -122,8 +122,8 @@ public class EditorActionMenu extends AbstractListMenu {
|
||||
String titleStr = menuTitle.replace(leftClickInfo[0], leftClick).replace(rightClickInfo[0], rightClick)
|
||||
.replace("{3}", Integer.toString(i + 1)).replace("{4}", Integer.toString(totalPages));
|
||||
|
||||
// Convert the title string to a colorized TextComponent using TrueOG Utils.
|
||||
Component title = Utils.legacySerializerAnyCase(titleStr);
|
||||
// Convert the title string to a colorized TextComponent using Utilities-OG.
|
||||
Component title = UtilitiesOG.trueogColorize(titleStr);
|
||||
|
||||
// Pass the colorized title Component to createInventory.
|
||||
Inventory menu = Bukkit.createInventory(null, 54, title);
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
package cosmeticsOG.editor.menus;
|
||||
|
||||
import net.trueog.utilitiesog.UtilitiesOG;
|
||||
import cosmeticsOG.CosmeticsOG;
|
||||
import cosmeticsOG.Utils;
|
||||
import cosmeticsOG.compatibility.CompatibleMaterial;
|
||||
import cosmeticsOG.editor.EditorLore;
|
||||
import cosmeticsOG.editor.EditorMenuManager;
|
||||
@@ -33,7 +33,7 @@ public class EditorActionMenuOverview extends AbstractStaticMenu {
|
||||
this.callback = callback;
|
||||
this.targetHat = menuManager.getBaseHat();
|
||||
this.inventory = Bukkit.createInventory(null, 27,
|
||||
Utils.legacySerializerAnyCase(Message.EDITOR_ACTION_OVERVIEW_MENU_TITlE.getValue()));
|
||||
UtilitiesOG.trueogColorize(Message.EDITOR_ACTION_OVERVIEW_MENU_TITlE.getValue()));
|
||||
|
||||
build();
|
||||
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
package cosmeticsOG.editor.menus;
|
||||
|
||||
import net.trueog.utilitiesog.UtilitiesOG;
|
||||
import cosmeticsOG.CosmeticsOG;
|
||||
import cosmeticsOG.Utils;
|
||||
import cosmeticsOG.compatibility.CompatibleMaterial;
|
||||
import cosmeticsOG.editor.EditorLore;
|
||||
import cosmeticsOG.editor.EditorMenuManager;
|
||||
@@ -27,7 +27,7 @@ public class EditorAngleMenu extends AbstractStaticMenu {
|
||||
this.editorManager = menuManager;
|
||||
this.callback = callback;
|
||||
this.inventory = Bukkit.createInventory(null, 27,
|
||||
Utils.legacySerializerAnyCase(Message.EDITOR_ANGLE_MENU_TITLE.getValue()));
|
||||
UtilitiesOG.trueogColorize(Message.EDITOR_ANGLE_MENU_TITLE.getValue()));
|
||||
|
||||
build();
|
||||
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
package cosmeticsOG.editor.menus;
|
||||
|
||||
import net.trueog.utilitiesog.UtilitiesOG;
|
||||
import cosmeticsOG.CosmeticsOG;
|
||||
import cosmeticsOG.Utils;
|
||||
import cosmeticsOG.compatibility.CompatibleMaterial;
|
||||
import cosmeticsOG.editor.EditorLore;
|
||||
import cosmeticsOG.editor.EditorMenuManager;
|
||||
@@ -49,7 +49,7 @@ public class EditorBaseMenu extends AbstractStaticMenu {
|
||||
StringUtil.parseDescription(Message.EDITOR_SLOT_DESCRIPTION.getValue()));
|
||||
this.editingTitle = EditorLore.getTrimmedMenuTitle(menuInventory.getName(), Message.EDITOR_BASE_MENU_TITLE);
|
||||
this.inventory = Bukkit.createInventory(null, menuInventory.getSize(),
|
||||
Utils.legacySerializerAnyCase(editingTitle));
|
||||
UtilitiesOG.trueogColorize(editingTitle));
|
||||
this.inventory.setContents(menuInventory.getContents());
|
||||
|
||||
emptyParticleAction = (event, slot) -> {
|
||||
@@ -235,10 +235,10 @@ public class EditorBaseMenu extends AbstractStaticMenu {
|
||||
*/
|
||||
public void setTitle(String title) {
|
||||
|
||||
menuInventory.setTitle(Utils.legacySerializerAnyCase(title));
|
||||
menuInventory.setTitle(UtilitiesOG.trueogColorize(title));
|
||||
|
||||
Inventory replacementInventory = Bukkit.createInventory(null, inventory.getSize(),
|
||||
Utils.legacySerializerAnyCase(editingTitle));
|
||||
UtilitiesOG.trueogColorize(editingTitle));
|
||||
replacementInventory.setContents(inventory.getContents());
|
||||
|
||||
inventory = replacementInventory;
|
||||
@@ -337,7 +337,7 @@ public class EditorBaseMenu extends AbstractStaticMenu {
|
||||
if (this.rows != rows) {
|
||||
|
||||
Inventory replacementInventory = Bukkit.createInventory(null, (9 * rows),
|
||||
Utils.legacySerializerAnyCase(editingTitle));
|
||||
UtilitiesOG.trueogColorize(editingTitle));
|
||||
|
||||
// inventory.setContents() only works when resizing the menus to a smaller size.
|
||||
// So, we need to use a loop
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
package cosmeticsOG.editor.menus;
|
||||
|
||||
import net.trueog.utilitiesog.UtilitiesOG;
|
||||
import cosmeticsOG.CosmeticsOG;
|
||||
import cosmeticsOG.Utils;
|
||||
import cosmeticsOG.compatibility.CompatibleMaterial;
|
||||
import cosmeticsOG.editor.EditorLore;
|
||||
import cosmeticsOG.editor.EditorMenuManager;
|
||||
@@ -40,7 +40,7 @@ public class EditorColorMenu extends AbstractStaticMenu {
|
||||
this.callback = callback;
|
||||
this.colors = new HashMap<Integer, Color>();
|
||||
this.inventory = Bukkit.createInventory(null, 54,
|
||||
Utils.legacySerializerAnyCase(Message.EDITOR_COLOUR_MENU_TITLE.getValue()));
|
||||
UtilitiesOG.trueogColorize(Message.EDITOR_COLOUR_MENU_TITLE.getValue()));
|
||||
|
||||
this.setColorAction = (event, slot) -> {
|
||||
|
||||
@@ -202,7 +202,7 @@ public class EditorColorMenu extends AbstractStaticMenu {
|
||||
private String getColorDescription(Color color, String title) {
|
||||
|
||||
String description = Message.EDITOR_COLOUR_MENU_PRESET_DESCRIPTION.getValue();
|
||||
String s = description.replace("{1}", Utils.stripColors(title.toLowerCase()))
|
||||
String s = description.replace("{1}", UtilitiesOG.stripFormatting(title.toLowerCase()))
|
||||
.replace("{2}", Integer.toString(color.getRed())).replace("{3}", Integer.toString(color.getGreen()))
|
||||
.replace("{4}", Integer.toString(color.getBlue()));
|
||||
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
package cosmeticsOG.editor.menus;
|
||||
|
||||
import net.trueog.utilitiesog.UtilitiesOG;
|
||||
import cosmeticsOG.CosmeticsOG;
|
||||
import cosmeticsOG.Utils;
|
||||
import cosmeticsOG.compatibility.CompatibleMaterial;
|
||||
import cosmeticsOG.locale.Message;
|
||||
import cosmeticsOG.ui.AbstractStaticMenu;
|
||||
@@ -22,7 +22,7 @@ public class EditorDeleteMenu extends AbstractStaticMenu {
|
||||
|
||||
this.editorBaseMenu = editorBaseMenu;
|
||||
this.inventory = Bukkit.createInventory(null, 27,
|
||||
Utils.legacySerializerAnyCase(Message.EDITOR_DELETE_MENU_TITLE.getValue()));
|
||||
UtilitiesOG.trueogColorize(Message.EDITOR_DELETE_MENU_TITLE.getValue()));
|
||||
|
||||
build();
|
||||
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
package cosmeticsOG.editor.menus;
|
||||
|
||||
import net.trueog.utilitiesog.UtilitiesOG;
|
||||
import cosmeticsOG.CosmeticsOG;
|
||||
import cosmeticsOG.Utils;
|
||||
import cosmeticsOG.compatibility.CompatibleMaterial;
|
||||
import cosmeticsOG.database.Database;
|
||||
import cosmeticsOG.database.Database.DataType;
|
||||
@@ -47,7 +47,7 @@ public class EditorDescriptionMenu extends AbstractListMenu {
|
||||
this.totalPages = 1;
|
||||
|
||||
setMenu(0, Bukkit.createInventory(null, 54,
|
||||
Utils.legacySerializerAnyCase(Message.EDITOR_DESCRIPTION_MENU_TITLE.getValue())));
|
||||
UtilitiesOG.trueogColorize(Message.EDITOR_DESCRIPTION_MENU_TITLE.getValue())));
|
||||
|
||||
build();
|
||||
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
package cosmeticsOG.editor.menus;
|
||||
|
||||
import net.trueog.utilitiesog.UtilitiesOG;
|
||||
import cosmeticsOG.CosmeticsOG;
|
||||
import cosmeticsOG.Utils;
|
||||
import cosmeticsOG.editor.EditorLore;
|
||||
import cosmeticsOG.editor.EditorMenuManager;
|
||||
import cosmeticsOG.locale.Message;
|
||||
@@ -25,7 +25,7 @@ public class EditorDurationMenu extends AbstractStaticMenu {
|
||||
this.targetHat = menuManager.getBaseHat();
|
||||
this.callback = callback;
|
||||
this.inventory = Bukkit.createInventory(null, 27,
|
||||
Utils.legacySerializerAnyCase(Message.EDITOR_DURATION_MENU_TITLE.getValue()));
|
||||
UtilitiesOG.trueogColorize(Message.EDITOR_DURATION_MENU_TITLE.getValue()));
|
||||
|
||||
build();
|
||||
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
package cosmeticsOG.editor.menus;
|
||||
|
||||
import net.trueog.utilitiesog.UtilitiesOG;
|
||||
import cosmeticsOG.CosmeticsOG;
|
||||
import cosmeticsOG.Utils;
|
||||
import cosmeticsOG.compatibility.CompatibleMaterial;
|
||||
import cosmeticsOG.database.Database.DataType;
|
||||
import cosmeticsOG.editor.EditorLore;
|
||||
@@ -50,7 +50,7 @@ public class EditorIconMenuOverview extends AbstractListMenu {
|
||||
this.totalPages = 1;
|
||||
|
||||
setMenu(0, Bukkit.createInventory(null, 54,
|
||||
Utils.legacySerializerAnyCase(Message.EDITOR_ICON_OVERVIEW_MENU_TITLE.getValue())));
|
||||
UtilitiesOG.trueogColorize(Message.EDITOR_ICON_OVERVIEW_MENU_TITLE.getValue())));
|
||||
|
||||
build();
|
||||
|
||||
@@ -257,8 +257,8 @@ public class EditorIconMenuOverview extends AbstractListMenu {
|
||||
|
||||
int index = getNormalIndex(i, 10, 2);
|
||||
|
||||
// Convert the display name to TextComponent using TrueOG Utils for color codes.
|
||||
TextComponent nameComponent = Utils.legacySerializerAnyCase(displayName);
|
||||
// Convert the display name to TextComponent using Utilities-OG color codes.
|
||||
TextComponent nameComponent = UtilitiesOG.trueogColorize(displayName);
|
||||
|
||||
// Parse and process the description if it's a List<String>, converting it to
|
||||
// List<TextComponent>.
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
package cosmeticsOG.editor.menus;
|
||||
|
||||
import net.trueog.utilitiesog.UtilitiesOG;
|
||||
import cosmeticsOG.CosmeticsOG;
|
||||
import cosmeticsOG.Utils;
|
||||
import cosmeticsOG.compatibility.CompatibleMaterial;
|
||||
import cosmeticsOG.editor.EditorMenuManager;
|
||||
import cosmeticsOG.editor.MetaState;
|
||||
@@ -35,7 +35,7 @@ public class EditorItemPromptMenu extends AbstractStaticMenu {
|
||||
this.callback = callback;
|
||||
this.itemName = itemName;
|
||||
this.itemDescription = itemDescription;
|
||||
this.inventory = Bukkit.createInventory(null, 54, Utils.legacySerializerAnyCase(title.getValue()));
|
||||
this.inventory = Bukkit.createInventory(null, 54, UtilitiesOG.trueogColorize(title.getValue()));
|
||||
|
||||
build();
|
||||
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
package cosmeticsOG.editor.menus;
|
||||
|
||||
import net.trueog.utilitiesog.UtilitiesOG;
|
||||
import cosmeticsOG.CosmeticsOG;
|
||||
import cosmeticsOG.Utils;
|
||||
import cosmeticsOG.compatibility.CompatibleMaterial;
|
||||
import cosmeticsOG.database.Database.DataType;
|
||||
import cosmeticsOG.editor.EditorLore;
|
||||
@@ -112,7 +112,7 @@ public class EditorItemStackMenu extends AbstractListMenu {
|
||||
};
|
||||
|
||||
setMenu(0, Bukkit.createInventory(null, 54,
|
||||
Utils.legacySerializerAnyCase(Message.EDITOR_ITEMSTACK_MENU_TITLE.getValue())));
|
||||
UtilitiesOG.trueogColorize(Message.EDITOR_ITEMSTACK_MENU_TITLE.getValue())));
|
||||
|
||||
build();
|
||||
|
||||
@@ -260,7 +260,7 @@ public class EditorItemStackMenu extends AbstractListMenu {
|
||||
String displayName = Message.EDITOR_ICON_MENU_ITEM_PREFIX.getValue()
|
||||
+ StringUtil.getMaterialName(item.getType());
|
||||
|
||||
ItemUtil.setNameAndDescription(item, Utils.legacySerializerAnyCase(displayName),
|
||||
ItemUtil.setNameAndDescription(item, UtilitiesOG.trueogColorize(displayName),
|
||||
StringUtil.parseDescription(Message.EDITOR_ICON_MENU_ICON_DESCRIPTION.getValue()));
|
||||
|
||||
setItem(0, getNormalIndex(i, 10, 2), item);
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
package cosmeticsOG.editor.menus;
|
||||
|
||||
import net.trueog.utilitiesog.UtilitiesOG;
|
||||
import cosmeticsOG.CosmeticsOG;
|
||||
import cosmeticsOG.Utils;
|
||||
import cosmeticsOG.compatibility.CompatibleMaterial;
|
||||
import cosmeticsOG.compatibility.CompatibleSound;
|
||||
import cosmeticsOG.database.Database;
|
||||
@@ -63,7 +63,7 @@ public class EditorMainMenu extends AbstractStaticMenu {
|
||||
this.targetHat = editorManager.getTargetHat();
|
||||
this.ownerState = core.getPlayerState(owner);
|
||||
this.inventory = Bukkit.createInventory(null, 54,
|
||||
Utils.legacySerializerAnyCase(Message.EDITOR_MAIN_MENU_TITLE.getValue()));
|
||||
UtilitiesOG.trueogColorize(Message.EDITOR_MAIN_MENU_TITLE.getValue()));
|
||||
|
||||
setParticleAction = (event, slot) -> {
|
||||
|
||||
@@ -385,7 +385,7 @@ public class EditorMainMenu extends AbstractStaticMenu {
|
||||
// Stop if the player has more than the maximum allowed hats.
|
||||
if (!ownerState.canEquip()) {
|
||||
|
||||
owner.sendMessage(Message.HAT_EQUIPPED_OVERFLOW.replace("{1}",
|
||||
CosmeticsOG.chatMessage(owner, Message.HAT_EQUIPPED_OVERFLOW.replace("{1}",
|
||||
Integer.toString(SettingsManager.MAXIMUM_HAT_LIMIT.getInt())));
|
||||
|
||||
return MenuClickResult.NEGATIVE;
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
package cosmeticsOG.editor.menus;
|
||||
|
||||
import net.trueog.utilitiesog.UtilitiesOG;
|
||||
import cosmeticsOG.CosmeticsOG;
|
||||
import cosmeticsOG.Utils;
|
||||
import cosmeticsOG.compatibility.CompatibleMaterial;
|
||||
import cosmeticsOG.editor.EditorMenuManager;
|
||||
import cosmeticsOG.editor.MetaState;
|
||||
@@ -183,7 +183,7 @@ public class EditorMenuSelectionMenu extends AbstractListMenu {
|
||||
String menuTitle = title.replace("{1}", Integer.toString(index + 1)).replace("{2}",
|
||||
Integer.toString(totalPages));
|
||||
|
||||
Inventory menu = Bukkit.createInventory(null, 54, Utils.legacySerializerAnyCase(menuTitle));
|
||||
Inventory menu = Bukkit.createInventory(null, 54, UtilitiesOG.trueogColorize(menuTitle));
|
||||
menu.setItem(49, backButtonItem);
|
||||
|
||||
// Next Page.
|
||||
@@ -251,8 +251,8 @@ public class EditorMenuSelectionMenu extends AbstractListMenu {
|
||||
String name = Message.EDITOR_MENU_SELECTION_MENU_PREFIX.getValue() + key;
|
||||
|
||||
ItemStack item = ItemUtil.createItem(Material.BOOK, 1, name);
|
||||
ItemUtil.setItemDescription(item, Utils.legacySerializerAnyCase(
|
||||
Message.EDITOR_MENU_SELECTION_MENU_DESCRIPTION.getValue().replace("{1}", value)));
|
||||
ItemUtil.setItemDescription(item, UtilitiesOG
|
||||
.trueogColorize(Message.EDITOR_MENU_SELECTION_MENU_DESCRIPTION.getValue().replace("{1}", value)));
|
||||
|
||||
setItem(page, getNormalIndex(index++, 10, 2), item);
|
||||
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
package cosmeticsOG.editor.menus;
|
||||
|
||||
import net.trueog.utilitiesog.UtilitiesOG;
|
||||
import cosmeticsOG.CosmeticsOG;
|
||||
import cosmeticsOG.Utils;
|
||||
import cosmeticsOG.compatibility.CompatibleMaterial;
|
||||
import cosmeticsOG.database.Database;
|
||||
import cosmeticsOG.database.Database.DataType;
|
||||
@@ -29,7 +29,7 @@ public class EditorMetaMenu extends AbstractStaticMenu {
|
||||
this.editorManager = menuManager;
|
||||
this.targetHat = menuManager.getBaseHat();
|
||||
this.inventory = Bukkit.createInventory(null, 54,
|
||||
Utils.legacySerializerAnyCase(Message.EDITOR_META_MENU_TITLE.getValue()));
|
||||
UtilitiesOG.trueogColorize(Message.EDITOR_META_MENU_TITLE.getValue()));
|
||||
|
||||
build();
|
||||
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
package cosmeticsOG.editor.menus;
|
||||
|
||||
import net.trueog.utilitiesog.UtilitiesOG;
|
||||
import cosmeticsOG.CosmeticsOG;
|
||||
import cosmeticsOG.Utils;
|
||||
import cosmeticsOG.editor.EditorMenuManager;
|
||||
import cosmeticsOG.locale.Message;
|
||||
import org.bukkit.Bukkit;
|
||||
@@ -19,7 +19,7 @@ public class EditorNodeMainMenu extends EditorMainMenu {
|
||||
public void build() {
|
||||
|
||||
this.inventory = Bukkit.createInventory(null, 45,
|
||||
Utils.legacySerializerAnyCase(Message.EDITOR_MAIN_MENU_TITLE.getValue()));
|
||||
UtilitiesOG.trueogColorize(Message.EDITOR_MAIN_MENU_TITLE.getValue()));
|
||||
this.particleButtonSlot = 13;
|
||||
this.trackingButtonSlot = 19;
|
||||
this.countButtonSlot = 15;
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
package cosmeticsOG.editor.menus;
|
||||
|
||||
import net.trueog.utilitiesog.UtilitiesOG;
|
||||
import cosmeticsOG.CosmeticsOG;
|
||||
import cosmeticsOG.Utils;
|
||||
import cosmeticsOG.compatibility.CompatibleMaterial;
|
||||
import cosmeticsOG.editor.EditorLore;
|
||||
import cosmeticsOG.editor.EditorMenuManager;
|
||||
@@ -33,7 +33,7 @@ public class EditorNodeMenuOverview extends AbstractListMenu {
|
||||
this.totalPages = 1;
|
||||
|
||||
setMenu(0, Bukkit.createInventory(null, 54,
|
||||
Utils.legacySerializerAnyCase(Message.EDITOR_NODE_OVERVIEW_MENU_TITLE.getValue())));
|
||||
UtilitiesOG.trueogColorize(Message.EDITOR_NODE_OVERVIEW_MENU_TITLE.getValue())));
|
||||
|
||||
build();
|
||||
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
package cosmeticsOG.editor.menus;
|
||||
|
||||
import net.trueog.utilitiesog.UtilitiesOG;
|
||||
import cosmeticsOG.CosmeticsOG;
|
||||
import cosmeticsOG.Utils;
|
||||
import cosmeticsOG.compatibility.CompatibleMaterial;
|
||||
import cosmeticsOG.editor.EditorLore;
|
||||
import cosmeticsOG.editor.EditorMenuManager;
|
||||
@@ -26,7 +26,7 @@ public class EditorOffsetMenu extends AbstractStaticMenu {
|
||||
this.editorManager = menuManager;
|
||||
this.callback = callback;
|
||||
this.inventory = Bukkit.createInventory(null, 45,
|
||||
Utils.legacySerializerAnyCase(Message.EDITOR_OFFSET_MENU_TITLE.getValue()));
|
||||
UtilitiesOG.trueogColorize(Message.EDITOR_OFFSET_MENU_TITLE.getValue()));
|
||||
|
||||
build();
|
||||
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
package cosmeticsOG.editor.menus;
|
||||
|
||||
import net.trueog.utilitiesog.UtilitiesOG;
|
||||
import cosmeticsOG.CosmeticsOG;
|
||||
import cosmeticsOG.Utils;
|
||||
import cosmeticsOG.database.Database;
|
||||
import cosmeticsOG.editor.EditorLore;
|
||||
import cosmeticsOG.editor.EditorMenuManager;
|
||||
@@ -39,7 +39,7 @@ public class EditorParticleMenuOverview extends AbstractStaticMenu {
|
||||
this.particles = new HashMap<Integer, ParticleEffect>();
|
||||
this.modifiedParticles = new HashMap<Integer, Boolean>();
|
||||
this.inventory = Bukkit.createInventory(null, 54,
|
||||
Utils.legacySerializerAnyCase(Message.EDITOR_PARTICLE_OVERVIEW_MENU_TITLE.getValue()));
|
||||
UtilitiesOG.trueogColorize(Message.EDITOR_PARTICLE_OVERVIEW_MENU_TITLE.getValue()));
|
||||
|
||||
build();
|
||||
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
package cosmeticsOG.editor.menus;
|
||||
|
||||
import net.trueog.utilitiesog.UtilitiesOG;
|
||||
import cosmeticsOG.CosmeticsOG;
|
||||
import cosmeticsOG.Utils;
|
||||
import cosmeticsOG.compatibility.CompatibleMaterial;
|
||||
import cosmeticsOG.editor.EditorLore;
|
||||
import cosmeticsOG.editor.EditorMenuManager;
|
||||
@@ -59,7 +59,7 @@ public class EditorParticleSelectionMenu extends AbstractStaticMenu {
|
||||
this.colorFilterMenus = new HashMap<Integer, Inventory>();
|
||||
this.dataFilterMenus = new HashMap<Integer, Inventory>();
|
||||
this.recentFilterMenu = Bukkit.createInventory(null, 54,
|
||||
Utils.legacySerializerAnyCase(Message.EDITOR_PARTICLE_MENU_RECENT_FILTER_TITLE.getValue()));
|
||||
UtilitiesOG.trueogColorize(Message.EDITOR_PARTICLE_MENU_RECENT_FILTER_TITLE.getValue()));
|
||||
|
||||
this.particles = new HashMap<Integer, ParticleEffect>();
|
||||
this.colorParticles = new HashMap<Integer, ParticleEffect>();
|
||||
@@ -395,7 +395,7 @@ public class EditorParticleSelectionMenu extends AbstractStaticMenu {
|
||||
|
||||
String menuTitle = title.replace("{1}", Integer.toString(i + 1)).replace("{2}",
|
||||
Integer.toString(totalPages));
|
||||
Inventory inventory = Bukkit.createInventory(null, 54, Utils.legacySerializerAnyCase(menuTitle));
|
||||
Inventory inventory = Bukkit.createInventory(null, 54, UtilitiesOG.trueogColorize(menuTitle));
|
||||
|
||||
inventory.setItem(49, backButtonItem);
|
||||
inventory.setItem(45,
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
package cosmeticsOG.editor.menus;
|
||||
|
||||
import net.trueog.utilitiesog.UtilitiesOG;
|
||||
import cosmeticsOG.CosmeticsOG;
|
||||
import cosmeticsOG.Utils;
|
||||
import cosmeticsOG.compatibility.CompatibleMaterial;
|
||||
import cosmeticsOG.editor.EditorLore;
|
||||
import cosmeticsOG.editor.EditorMenuManager;
|
||||
@@ -91,7 +91,7 @@ public class EditorPotionMenu extends AbstractListMenu {
|
||||
|
||||
String title = menuTitle.replace("{1}", Integer.toString(i + 1)).replace("{2}",
|
||||
Integer.toString(totalPages));
|
||||
Inventory menu = Bukkit.createInventory(null, 54, Utils.legacySerializerAnyCase(title));
|
||||
Inventory menu = Bukkit.createInventory(null, 54, UtilitiesOG.trueogColorize(title));
|
||||
|
||||
menu.setItem(49, backButtonItem);
|
||||
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
package cosmeticsOG.editor.menus;
|
||||
|
||||
import net.trueog.utilitiesog.UtilitiesOG;
|
||||
import cosmeticsOG.CosmeticsOG;
|
||||
import cosmeticsOG.Utils;
|
||||
import cosmeticsOG.compatibility.CompatibleMaterial;
|
||||
import cosmeticsOG.locale.Message;
|
||||
import cosmeticsOG.ui.AbstractStaticMenu;
|
||||
@@ -24,7 +24,7 @@ public class EditorResizeMenu extends AbstractStaticMenu {
|
||||
|
||||
this.editorBaseMenu = editorBaseMenu;
|
||||
this.inventory = Bukkit.createInventory(null, 27,
|
||||
Utils.legacySerializerAnyCase(Message.EDITOR_RESIZE_MENU_TITLE.getValue()));
|
||||
UtilitiesOG.trueogColorize(Message.EDITOR_RESIZE_MENU_TITLE.getValue()));
|
||||
|
||||
build();
|
||||
|
||||
@@ -60,7 +60,7 @@ public class EditorResizeMenu extends AbstractStaticMenu {
|
||||
i == 0 ? "" : suffixInfo[1]);
|
||||
String description = Message.EDITOR_RESIZE_MENU_SET_ROW_DESCRIPTION.getValue();
|
||||
|
||||
List<TextComponent> descriptionList = List.of(Utils.legacySerializerAnyCase(description));
|
||||
List<TextComponent> descriptionList = List.of(UtilitiesOG.trueogColorize(description));
|
||||
|
||||
ItemStack row = ItemUtil.createItem(CompatibleMaterial.GRAY_DYE.getMaterial(), 1, t, descriptionList);
|
||||
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
package cosmeticsOG.editor.menus;
|
||||
|
||||
import net.trueog.utilitiesog.UtilitiesOG;
|
||||
import cosmeticsOG.CosmeticsOG;
|
||||
import cosmeticsOG.Utils;
|
||||
import cosmeticsOG.compatibility.CompatibleMaterial;
|
||||
import cosmeticsOG.editor.EditorLore;
|
||||
import cosmeticsOG.locale.Message;
|
||||
@@ -127,7 +127,7 @@ public class EditorSearchMenu extends AbstractListMenu {
|
||||
|
||||
for (int i = 0; i < totalPages; i++) {
|
||||
|
||||
Inventory inventory = Bukkit.createInventory(null, 54, Utils.legacySerializerAnyCase(menuTitle));
|
||||
Inventory inventory = Bukkit.createInventory(null, 54, UtilitiesOG.trueogColorize(menuTitle));
|
||||
|
||||
inventory.setItem(49, backButtonItem);
|
||||
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
package cosmeticsOG.editor.menus;
|
||||
|
||||
import net.trueog.utilitiesog.UtilitiesOG;
|
||||
import cosmeticsOG.CosmeticsOG;
|
||||
import cosmeticsOG.Utils;
|
||||
import cosmeticsOG.compatibility.CompatibleMaterial;
|
||||
import cosmeticsOG.editor.EditorLore;
|
||||
import cosmeticsOG.editor.EditorMenuManager;
|
||||
@@ -32,7 +32,7 @@ public class EditorSettingsMenu extends AbstractStaticMenu {
|
||||
this.editorBaseMenu = editorBaseMenu;
|
||||
this.menuInventory = editorBaseMenu.getMenuInventory();
|
||||
this.inventory = Bukkit.createInventory(null, 54,
|
||||
Utils.legacySerializerAnyCase(Message.EDITOR_SETTINGS_MENU_TITLE.getValue()));
|
||||
UtilitiesOG.trueogColorize(Message.EDITOR_SETTINGS_MENU_TITLE.getValue()));
|
||||
|
||||
build();
|
||||
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
package cosmeticsOG.editor.menus;
|
||||
|
||||
import net.trueog.utilitiesog.UtilitiesOG;
|
||||
import cosmeticsOG.CosmeticsOG;
|
||||
import cosmeticsOG.Utils;
|
||||
import cosmeticsOG.compatibility.CompatibleMaterial;
|
||||
import cosmeticsOG.compatibility.CompatibleSound;
|
||||
import cosmeticsOG.editor.EditorMenuManager;
|
||||
@@ -33,7 +33,7 @@ public class EditorSlotMenu extends AbstractStaticMenu {
|
||||
this.cloning = cloning;
|
||||
this.size = editorBaseMenu.getMenuInventory().getSize();
|
||||
this.inventory = Bukkit.createInventory(null, size,
|
||||
Utils.legacySerializerAnyCase(Message.EDITOR_SLOT_MENU_TITlE.getValue()));
|
||||
UtilitiesOG.trueogColorize(Message.EDITOR_SLOT_MENU_TITlE.getValue()));
|
||||
|
||||
build();
|
||||
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
package cosmeticsOG.editor.menus;
|
||||
|
||||
import net.trueog.utilitiesog.UtilitiesOG;
|
||||
import cosmeticsOG.CosmeticsOG;
|
||||
import cosmeticsOG.Utils;
|
||||
import cosmeticsOG.compatibility.CompatibleMaterial;
|
||||
import cosmeticsOG.editor.EditorLore;
|
||||
import cosmeticsOG.editor.EditorMenuManager;
|
||||
@@ -339,7 +339,7 @@ public class EditorSoundMenu extends AbstractStaticMenu {
|
||||
|
||||
String menuTitle = startingTitle.getValue().replace("{1}", Integer.toString(i + 1)).replace("{2}",
|
||||
Integer.toString(pages));
|
||||
Inventory menu = Bukkit.createInventory(null, 54, Utils.legacySerializerAnyCase(menuTitle));
|
||||
Inventory menu = Bukkit.createInventory(null, 54, UtilitiesOG.trueogColorize(menuTitle));
|
||||
|
||||
// Filters.
|
||||
menu.setItem(45, ItemUtil.createItem(Material.BOWL, 1, Message.EDITOR_SOUND_MENU_MISC_FILTER.getValue()));
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
package cosmeticsOG.editor.menus;
|
||||
|
||||
import net.trueog.utilitiesog.UtilitiesOG;
|
||||
import cosmeticsOG.CosmeticsOG;
|
||||
import cosmeticsOG.Utils;
|
||||
import cosmeticsOG.compatibility.CompatibleMaterial;
|
||||
import cosmeticsOG.locale.Message;
|
||||
import cosmeticsOG.particles.properties.ParticleTag;
|
||||
@@ -67,7 +67,7 @@ public class EditorTagMenu extends AbstractListMenu {
|
||||
|
||||
for (int i = 0; i < totalPages; i++) {
|
||||
|
||||
Inventory menu = Bukkit.createInventory(null, 54, Utils.legacySerializerAnyCase(title));
|
||||
Inventory menu = Bukkit.createInventory(null, 54, UtilitiesOG.trueogColorize(title));
|
||||
menu.setItem(49, backButtonItem);
|
||||
|
||||
// Next page.
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
package cosmeticsOG.editor.menus;
|
||||
|
||||
import net.trueog.utilitiesog.UtilitiesOG;
|
||||
import cosmeticsOG.CosmeticsOG;
|
||||
import cosmeticsOG.Utils;
|
||||
import cosmeticsOG.compatibility.CompatibleMaterial;
|
||||
import cosmeticsOG.database.Database.DataType;
|
||||
import cosmeticsOG.editor.EditorMenuManager;
|
||||
@@ -37,7 +37,7 @@ public class EditorTagMenuOverview extends AbstractListMenu {
|
||||
this.totalPages = 1;
|
||||
|
||||
setMenu(0, Bukkit.createInventory(null, 54,
|
||||
Utils.legacySerializerAnyCase(Message.EDITOR_TAG_OVERVIEW_MENU_TITLE.getValue())));
|
||||
UtilitiesOG.trueogColorize(Message.EDITOR_TAG_OVERVIEW_MENU_TITLE.getValue())));
|
||||
|
||||
build();
|
||||
|
||||
@@ -164,7 +164,7 @@ public class EditorTagMenuOverview extends AbstractListMenu {
|
||||
for (int i = 0; i < tags.size(); i++) {
|
||||
|
||||
ParticleTag tag = tags.get(i);
|
||||
String titleString = Utils.legacySerializerAnyCase(tagTitle.replace("{1}", tag.getDisplayName())).content();
|
||||
String titleString = UtilitiesOG.trueogColorize(tagTitle.replace("{1}", tag.getDisplayName())).content();
|
||||
List<TextComponent> textComponents = StringUtil
|
||||
.parseDescription(Message.EDITOR_TAG_OVERVIEW_MENU_TAG_DESCRIPTION.getValue()).stream()
|
||||
.map(component -> (TextComponent) component).collect(Collectors.toList());
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
package cosmeticsOG.editor.menus;
|
||||
|
||||
import net.trueog.utilitiesog.UtilitiesOG;
|
||||
import cosmeticsOG.CosmeticsOG;
|
||||
import cosmeticsOG.Utils;
|
||||
import cosmeticsOG.compatibility.CompatibleMaterial;
|
||||
import cosmeticsOG.compatibility.CompatibleSound;
|
||||
import cosmeticsOG.editor.EditorLore;
|
||||
@@ -40,7 +40,7 @@ public class EditorTransferMenu extends AbstractStaticMenu {
|
||||
this.editorManager = menuManager;
|
||||
this.menuName = menuName;
|
||||
this.menuInventory = core.getDatabase().loadInventory(menuName, core.getPlayerState(owner));
|
||||
this.inventory = Bukkit.createInventory(null, menuInventory.getSize(), Utils.legacySerializerAnyCase(
|
||||
this.inventory = Bukkit.createInventory(null, menuInventory.getSize(), UtilitiesOG.trueogColorize(
|
||||
EditorLore.getTrimmedMenuTitle(menuInventory.getTitle().content(), Message.EDITOR_MOVE_MENU_TITLE)));
|
||||
|
||||
build();
|
||||
@@ -100,7 +100,7 @@ public class EditorTransferMenu extends AbstractStaticMenu {
|
||||
} else {
|
||||
|
||||
ItemUtil.setNameAndDescription(item,
|
||||
Utils.legacySerializerAnyCase(Message.EDITOR_MOVE_MENU_OCCUPIED.getValue()),
|
||||
UtilitiesOG.trueogColorize(Message.EDITOR_MOVE_MENU_OCCUPIED.getValue()),
|
||||
StringUtil.parseDescription(Message.EDITOR_MOVE_MENU_OCCUPIED_DESCRIPTION.getValue()));
|
||||
|
||||
setButton(i, item, cancelAction);
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
package cosmeticsOG.editor.menus;
|
||||
|
||||
import net.trueog.utilitiesog.UtilitiesOG;
|
||||
import cosmeticsOG.CosmeticsOG;
|
||||
import cosmeticsOG.Utils;
|
||||
import cosmeticsOG.compatibility.CompatibleMaterial;
|
||||
import cosmeticsOG.editor.EditorLore;
|
||||
import cosmeticsOG.editor.EditorMenuManager;
|
||||
@@ -373,7 +373,7 @@ public class EditorTypeMenu extends AbstractStaticMenu {
|
||||
|
||||
String menuTitle = title.replace("{1}", Integer.toString(i + 1)).replace("{2}", Integer.toString(pages));
|
||||
|
||||
Inventory menu = Bukkit.createInventory(null, 54, Utils.legacySerializerAnyCase(menuTitle));
|
||||
Inventory menu = Bukkit.createInventory(null, 54, UtilitiesOG.trueogColorize(menuTitle));
|
||||
menu.setItem(49, backButtonItem);
|
||||
|
||||
// Next page.
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
package cosmeticsOG.editor.menus;
|
||||
|
||||
import net.trueog.utilitiesog.UtilitiesOG;
|
||||
import cosmeticsOG.CosmeticsOG;
|
||||
import cosmeticsOG.Utils;
|
||||
import cosmeticsOG.compatibility.CompatibleMaterial;
|
||||
import cosmeticsOG.editor.EditorLore;
|
||||
import cosmeticsOG.editor.EditorMenuManager;
|
||||
@@ -32,7 +32,7 @@ public class EditorVelocityMenu extends AbstractStaticMenu {
|
||||
this.particleIndex = particleIndex;
|
||||
this.callback = callback;
|
||||
this.inventory = Bukkit.createInventory(null, 27,
|
||||
Utils.legacySerializerAnyCase(Message.EDITOR_VELOCITY_MENU_TITLE.getValue()));
|
||||
UtilitiesOG.trueogColorize(Message.EDITOR_VELOCITY_MENU_TITLE.getValue()));
|
||||
|
||||
build();
|
||||
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
package cosmeticsOG.editor.purchase.menus;
|
||||
|
||||
import net.trueog.utilitiesog.UtilitiesOG;
|
||||
import cosmeticsOG.CosmeticsOG;
|
||||
import cosmeticsOG.Utils;
|
||||
import cosmeticsOG.compatibility.CompatibleMaterial;
|
||||
import cosmeticsOG.database.Database;
|
||||
import cosmeticsOG.database.Database.DataType;
|
||||
@@ -40,7 +40,7 @@ public class PurchaseEditorMainMenu extends AbstractStaticMenu {
|
||||
this.editorBaseMenu = menuManager.getEditingMenu();
|
||||
this.targetHat = menuManager.getBaseHat();
|
||||
this.inventory = Bukkit.createInventory(null, 36,
|
||||
Utils.legacySerializerAnyCase(Message.EDITOR_MAIN_MENU_TITLE.getValue()));
|
||||
UtilitiesOG.trueogColorize(Message.EDITOR_MAIN_MENU_TITLE.getValue()));
|
||||
|
||||
build();
|
||||
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
package cosmeticsOG.editor.purchase.menus;
|
||||
|
||||
import net.trueog.utilitiesog.UtilitiesOG;
|
||||
import cosmeticsOG.CosmeticsOG;
|
||||
import cosmeticsOG.Utils;
|
||||
import cosmeticsOG.compatibility.CompatibleMaterial;
|
||||
import cosmeticsOG.editor.EditorLore;
|
||||
import cosmeticsOG.editor.MetaState;
|
||||
@@ -32,7 +32,7 @@ public class PurchaseEditorSettingsMenu extends AbstractStaticMenu {
|
||||
this.editorBaseMenu = menuManager.getEditingMenu();
|
||||
this.menuInventory = editorBaseMenu.getMenuInventory();
|
||||
this.inventory = Bukkit.createInventory(null, 36,
|
||||
Utils.legacySerializerAnyCase(Message.EDITOR_SETTINGS_MENU_TITLE.getValue()));
|
||||
UtilitiesOG.trueogColorize(Message.EDITOR_SETTINGS_MENU_TITLE.getValue()));
|
||||
|
||||
build();
|
||||
|
||||
|
||||
@@ -1,31 +0,0 @@
|
||||
package cosmeticsOG.hooks;
|
||||
|
||||
import org.bukkit.entity.Player;
|
||||
|
||||
public interface CurrencyHook {
|
||||
|
||||
/**
|
||||
* Gets the players current economy balance
|
||||
*
|
||||
* @param id
|
||||
* @return
|
||||
*/
|
||||
public int getBalance(Player player);
|
||||
|
||||
/**
|
||||
* Withdraws the provided amount from the players economy balance
|
||||
*
|
||||
* @param id
|
||||
* @param amount
|
||||
* @return
|
||||
*/
|
||||
public boolean withdraw(Player player, int amount);
|
||||
|
||||
/**
|
||||
* Checks to see if this hook has been loaded
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
public boolean isEnabled();
|
||||
|
||||
}
|
||||
@@ -10,11 +10,11 @@ public interface VanishHook {
|
||||
* @param player
|
||||
* @return
|
||||
*/
|
||||
public boolean isVanished(Player player);
|
||||
boolean isVanished(Player player);
|
||||
|
||||
/**
|
||||
* Unregisters this hook
|
||||
*/
|
||||
public void unregister();
|
||||
void unregister();
|
||||
|
||||
}
|
||||
@@ -1,41 +0,0 @@
|
||||
package cosmeticsOG.hooks.economy;
|
||||
|
||||
import cosmeticsOG.hooks.CurrencyHook;
|
||||
import java.util.OptionalLong;
|
||||
import me.realized.tokenmanager.api.TokenManager;
|
||||
import org.bukkit.Bukkit;
|
||||
import org.bukkit.entity.Player;
|
||||
|
||||
public class TokenManagerHook implements CurrencyHook {
|
||||
|
||||
private final TokenManager api;
|
||||
|
||||
public TokenManagerHook() {
|
||||
|
||||
api = (TokenManager) Bukkit.getServer().getPluginManager().getPlugin("TokenManager");
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getBalance(Player player) {
|
||||
|
||||
OptionalLong balance = api.getTokens(player);
|
||||
return (int) balance.orElse(0);
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean withdraw(Player player, int amount) {
|
||||
|
||||
return api.removeTokens(player, amount);
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isEnabled() {
|
||||
|
||||
return api != null;
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
@@ -1,49 +0,0 @@
|
||||
package cosmeticsOG.hooks.economy;
|
||||
|
||||
import cosmeticsOG.CosmeticsOG;
|
||||
import cosmeticsOG.hooks.CurrencyHook;
|
||||
import net.milkbowl.vault.economy.Economy;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.plugin.RegisteredServiceProvider;
|
||||
|
||||
public class VaultHook implements CurrencyHook {
|
||||
|
||||
private Economy economy;
|
||||
private boolean economyEnabled;
|
||||
|
||||
public VaultHook(final CosmeticsOG core) {
|
||||
|
||||
RegisteredServiceProvider<Economy> econProvider = core.getServer().getServicesManager()
|
||||
.getRegistration(net.milkbowl.vault.economy.Economy.class);
|
||||
if (econProvider != null) {
|
||||
|
||||
economy = econProvider.getProvider();
|
||||
|
||||
}
|
||||
|
||||
economyEnabled = economy != null;
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getBalance(Player player) {
|
||||
|
||||
return (int) economy.getBalance(player);
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean withdraw(Player player, int amount) {
|
||||
|
||||
return economy.withdrawPlayer(player, amount).transactionSuccess();
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isEnabled() {
|
||||
|
||||
return economyEnabled;
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,193 @@
|
||||
package cosmeticsOG.hooks.vanish;
|
||||
|
||||
import cosmeticsOG.CosmeticsOG;
|
||||
import cosmeticsOG.hooks.VanishHook;
|
||||
import cosmeticsOG.particles.Hat;
|
||||
import cosmeticsOG.player.PlayerState;
|
||||
import java.lang.reflect.Method;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.event.Event;
|
||||
import org.bukkit.event.EventPriority;
|
||||
import org.bukkit.event.HandlerList;
|
||||
import org.bukkit.event.Listener;
|
||||
import org.bukkit.event.player.PlayerEvent;
|
||||
import org.bukkit.metadata.MetadataValue;
|
||||
import org.bukkit.plugin.EventExecutor;
|
||||
import org.bukkit.plugin.Plugin;
|
||||
|
||||
public class SuperVanishHook implements VanishHook, Listener {
|
||||
|
||||
private static final String VANISH_METADATA_KEY = "vanished";
|
||||
private static final String VANISH_API_CLASS = "de.myzelyam.api.vanish.VanishAPI";
|
||||
private static final String[] VANISH_EVENT_CLASSES = { "de.myzelyam.api.vanish.PostPlayerHideEvent",
|
||||
"de.myzelyam.api.vanish.PostPlayerShowEvent", "de.myzelyam.api.vanish.PlayerHideEvent",
|
||||
"de.myzelyam.api.vanish.PlayerShowEvent" };
|
||||
|
||||
private final CosmeticsOG core;
|
||||
private final Plugin vanishPlugin;
|
||||
private Method isVanishedMethod;
|
||||
private boolean hasLoadedVanishAPI;
|
||||
|
||||
public SuperVanishHook(final CosmeticsOG core, final Plugin vanishPlugin) {
|
||||
|
||||
this.core = core;
|
||||
this.vanishPlugin = vanishPlugin;
|
||||
|
||||
registerVanishEvents();
|
||||
syncOnlinePlayers();
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isVanished(Player player) {
|
||||
|
||||
Boolean apiVanished = getVanishAPIState(player);
|
||||
if (apiVanished != null) {
|
||||
|
||||
return apiVanished;
|
||||
|
||||
}
|
||||
|
||||
return hasVanishMetadata(player);
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void unregister() {
|
||||
|
||||
HandlerList.unregisterAll(this);
|
||||
|
||||
}
|
||||
|
||||
private void registerVanishEvents() {
|
||||
|
||||
registerVanishEvent(VANISH_EVENT_CLASSES[0], true);
|
||||
registerVanishEvent(VANISH_EVENT_CLASSES[1], false);
|
||||
registerVanishEvent(VANISH_EVENT_CLASSES[2], true);
|
||||
registerVanishEvent(VANISH_EVENT_CLASSES[3], false);
|
||||
|
||||
}
|
||||
|
||||
@SuppressWarnings("unchecked")
|
||||
private void registerVanishEvent(String eventClassName, boolean vanished) {
|
||||
|
||||
try {
|
||||
|
||||
Class<?> eventClass = Class.forName(eventClassName, false, vanishPlugin.getClass().getClassLoader());
|
||||
if (!Event.class.isAssignableFrom(eventClass)) {
|
||||
|
||||
return;
|
||||
|
||||
}
|
||||
|
||||
EventExecutor executor = (listener, event) -> handleVanishEvent(event, vanished);
|
||||
core.getServer().getPluginManager().registerEvent((Class<? extends Event>) eventClass, this,
|
||||
EventPriority.MONITOR, executor, core, true);
|
||||
|
||||
} catch (ClassNotFoundException ignored) {
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
private void handleVanishEvent(Event event, boolean vanished) {
|
||||
|
||||
if (event instanceof PlayerEvent) {
|
||||
|
||||
syncPlayer(((PlayerEvent) event).getPlayer(), vanished);
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
private void syncOnlinePlayers() {
|
||||
|
||||
for (Player player : core.getServer().getOnlinePlayers()) {
|
||||
|
||||
syncPlayer(player, isVanished(player));
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
private void syncPlayer(Player player, boolean vanished) {
|
||||
|
||||
if (!core.hasEntityState(player)) {
|
||||
|
||||
return;
|
||||
|
||||
}
|
||||
|
||||
PlayerState playerState = core.getPlayerState(player);
|
||||
for (Hat hat : playerState.getActiveHats()) {
|
||||
|
||||
hat.setVanished(vanished);
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
private Boolean getVanishAPIState(Player player) {
|
||||
|
||||
Method method = getIsVanishedMethod();
|
||||
if (method == null) {
|
||||
|
||||
return null;
|
||||
|
||||
}
|
||||
|
||||
try {
|
||||
|
||||
Object result = method.invoke(null, player);
|
||||
if (result instanceof Boolean) {
|
||||
|
||||
return (Boolean) result;
|
||||
|
||||
}
|
||||
|
||||
} catch (ReflectiveOperationException | RuntimeException ignored) {
|
||||
|
||||
}
|
||||
|
||||
return null;
|
||||
|
||||
}
|
||||
|
||||
private Method getIsVanishedMethod() {
|
||||
|
||||
if (!hasLoadedVanishAPI) {
|
||||
|
||||
hasLoadedVanishAPI = true;
|
||||
try {
|
||||
|
||||
Class<?> vanishAPI = Class.forName(VANISH_API_CLASS, false, vanishPlugin.getClass().getClassLoader());
|
||||
isVanishedMethod = vanishAPI.getMethod("isVanished", Player.class);
|
||||
|
||||
} catch (ReflectiveOperationException | RuntimeException ignored) {
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
return isVanishedMethod;
|
||||
|
||||
}
|
||||
|
||||
private boolean hasVanishMetadata(Player player) {
|
||||
|
||||
for (MetadataValue value : player.getMetadata(VANISH_METADATA_KEY)) {
|
||||
|
||||
Plugin owningPlugin = value.getOwningPlugin();
|
||||
if (owningPlugin != null && owningPlugin.equals(vanishPlugin) && value.asBoolean()) {
|
||||
|
||||
return true;
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
return false;
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
@@ -1,7 +1,7 @@
|
||||
package cosmeticsOG.listeners;
|
||||
|
||||
import net.trueog.utilitiesog.UtilitiesOG;
|
||||
import cosmeticsOG.CosmeticsOG;
|
||||
import cosmeticsOG.Utils;
|
||||
import cosmeticsOG.editor.EditorMenuManager;
|
||||
import cosmeticsOG.editor.MetaState;
|
||||
import cosmeticsOG.managers.SettingsManager;
|
||||
@@ -68,7 +68,7 @@ public class ChatListener implements Listener {
|
||||
// Convert the Component to a plain string
|
||||
String messageString = PlainTextComponentSerializer.plainText().serialize(event.message());
|
||||
|
||||
if (Utils.stripColors(messageString).equals("cancel")) {
|
||||
if (UtilitiesOG.stripFormatting(messageString).equals("cancel")) {
|
||||
|
||||
editorManager.reopen();
|
||||
|
||||
|
||||
@@ -43,7 +43,7 @@ public class CommandListener implements Listener {
|
||||
MetaState metaState = playerState.getMetaState();
|
||||
if (metaState != MetaState.NONE) {
|
||||
|
||||
player.sendMessage(Message.COMMAND_ERROR_ALREADY_EDITING.getValue());
|
||||
CosmeticsOG.chatMessage(player, Message.COMMAND_ERROR_ALREADY_EDITING.getValue());
|
||||
event.setCancelled(true);
|
||||
|
||||
}
|
||||
|
||||
@@ -35,6 +35,8 @@ public class ConnectionListener implements Listener {
|
||||
Player player = event.getPlayer();
|
||||
UUID id = event.getPlayer().getUniqueId();
|
||||
PlayerState playerState = core.getNewPlayerState(player);
|
||||
VanishHook vanishHook = core.getHookManager().getVanishHook();
|
||||
boolean isVanished = vanishHook != null && vanishHook.isVanished(player);
|
||||
|
||||
// Load equipped hats
|
||||
core.getDatabase().loadPlayerEquippedHats(id, (loadedHats) -> {
|
||||
@@ -45,6 +47,7 @@ public class ConnectionListener implements Listener {
|
||||
List<Hat> hats = (ArrayList<Hat>) loadedHats;
|
||||
for (Hat hat : hats) {
|
||||
|
||||
hat.setVanished(isVanished);
|
||||
playerState.addHat(hat);
|
||||
|
||||
}
|
||||
@@ -94,17 +97,6 @@ public class ConnectionListener implements Listener {
|
||||
|
||||
}
|
||||
|
||||
VanishHook vanishHook = core.getHookManager().getVanishHook();
|
||||
if (vanishHook != null) {
|
||||
|
||||
if (vanishHook.isVanished(player)) {
|
||||
|
||||
playerState.getActiveHats().forEach(hat -> hat.setVanished(true));
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@EventHandler
|
||||
|
||||
@@ -89,7 +89,8 @@ public class InteractListener implements Listener {
|
||||
|
||||
if (inventory == null) {
|
||||
|
||||
player.sendMessage(Message.COMMAND_ERROR_UNKNOWN_MENU.getValue().replace("{1}", menuName));
|
||||
CosmeticsOG.chatMessage(player,
|
||||
Message.COMMAND_ERROR_UNKNOWN_MENU.getValue().replace("{1}", menuName));
|
||||
return;
|
||||
|
||||
}
|
||||
|
||||
@@ -851,7 +851,7 @@ public enum Message {
|
||||
*/
|
||||
public void sendTo(Player player) {
|
||||
|
||||
player.sendMessage(getValue());
|
||||
CosmeticsOG.chatMessage(player, getValue());
|
||||
|
||||
}
|
||||
|
||||
@@ -862,6 +862,13 @@ public enum Message {
|
||||
*/
|
||||
public void sendTo(CommandSender sender) {
|
||||
|
||||
if (sender instanceof Player) {
|
||||
|
||||
CosmeticsOG.chatMessage((Player) sender, getValue());
|
||||
return;
|
||||
|
||||
}
|
||||
|
||||
sender.sendMessage(getValue());
|
||||
|
||||
}
|
||||
|
||||
@@ -1,18 +1,20 @@
|
||||
package cosmeticsOG.managers;
|
||||
|
||||
import cosmeticsOG.CosmeticsOG;
|
||||
import cosmeticsOG.Utils;
|
||||
import cosmeticsOG.hooks.CurrencyHook;
|
||||
import cosmeticsOG.hooks.VanishHook;
|
||||
import cosmeticsOG.hooks.economy.TokenManagerHook;
|
||||
import cosmeticsOG.hooks.economy.VaultHook;
|
||||
import org.bukkit.plugin.Plugin;
|
||||
import org.bukkit.plugin.PluginManager;
|
||||
|
||||
import cosmeticsOG.CosmeticsOG;
|
||||
import cosmeticsOG.hooks.VanishHook;
|
||||
import cosmeticsOG.hooks.vanish.SuperVanishHook;
|
||||
import net.trueog.utilitiesog.UtilitiesOG;
|
||||
|
||||
public class HookManager {
|
||||
|
||||
private static final String[] VANISH_PLUGIN_NAMES = { "Vanish-OG", "SuperVanish", "PremiumVanish",
|
||||
"VanishNoPacket" };
|
||||
|
||||
private final CosmeticsOG core;
|
||||
|
||||
private CurrencyHook currencyHook;
|
||||
private VanishHook vanishHook;
|
||||
|
||||
public HookManager(final CosmeticsOG core) {
|
||||
@@ -29,17 +31,6 @@ public class HookManager {
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* Get this plugin's CurrencyHook
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
public CurrencyHook getCurrencyHook() {
|
||||
|
||||
return currencyHook;
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* Get this plugin's VanishHook
|
||||
*
|
||||
@@ -53,66 +44,38 @@ public class HookManager {
|
||||
|
||||
private void loadHooks() {
|
||||
|
||||
PluginManager pluginManager = core.getServer().getPluginManager();
|
||||
final PluginManager pluginManager = core.getServer().getPluginManager();
|
||||
|
||||
// Vault Hook.
|
||||
if (SettingsManager.FLAG_VAULT.getBoolean()) {
|
||||
if (pluginManager.isPluginEnabled("DiamondBank-OG")) {
|
||||
|
||||
if (currencyHook != null && currencyHook instanceof VaultHook) {
|
||||
UtilitiesOG.logToConsole(CosmeticsOG.getPrefix(), "Hooking into DiamondBank-OG...");
|
||||
|
||||
return;
|
||||
} else {
|
||||
|
||||
}
|
||||
SettingsManager.FLAG_DIAMONDBANK.addOverride(false);
|
||||
|
||||
if (pluginManager.isPluginEnabled("Vault")) {
|
||||
|
||||
currencyHook = new VaultHook(core);
|
||||
|
||||
Utils.logToConsole("Hooking into Vault...");
|
||||
|
||||
} else {
|
||||
|
||||
Utils.logToConsole("WARNING: Could not find Vault, disabling economy support!");
|
||||
|
||||
SettingsManager.FLAG_VAULT.addOverride(false);
|
||||
|
||||
currencyHook = null;
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
// TokenManager Hook.
|
||||
else if (SettingsManager.FLAG_TOKEN_MANAGER.getBoolean()) {
|
||||
|
||||
if (currencyHook != null && currencyHook instanceof TokenManagerHook) {
|
||||
|
||||
return;
|
||||
|
||||
}
|
||||
|
||||
if (pluginManager.isPluginEnabled("TokenManager")) {
|
||||
|
||||
currencyHook = new TokenManagerHook();
|
||||
|
||||
Utils.logToConsole("Hooking into TokenManager...");
|
||||
|
||||
} else {
|
||||
|
||||
Utils.logToConsole("WARNING: Could not find TokenManager, disabling economy support!");
|
||||
|
||||
SettingsManager.FLAG_TOKEN_MANAGER.addOverride(false);
|
||||
|
||||
currencyHook = null;
|
||||
|
||||
}
|
||||
CosmeticsOG.disableSelf("Could not find DiamondBank-OG! Disabling Cosmetics-OG...");
|
||||
|
||||
}
|
||||
|
||||
// Vanish Hooks.
|
||||
if (vanishHook == null && SettingsManager.FLAG_VANISH.getBoolean()) {
|
||||
|
||||
// TODO: TrueOG vanish hook.
|
||||
final Plugin vanishPlugin = getEnabledVanishPlugin(pluginManager);
|
||||
if (vanishPlugin != null) {
|
||||
|
||||
vanishHook = new SuperVanishHook(core, vanishPlugin);
|
||||
|
||||
UtilitiesOG.logToConsole(CosmeticsOG.getPrefix(), "Hooking into " + vanishPlugin.getName() + "...");
|
||||
|
||||
} else {
|
||||
|
||||
UtilitiesOG.logToConsole(CosmeticsOG.getPrefix(),
|
||||
"WARNING: Could not find a supported vanish plugin, disabling vanish support!");
|
||||
|
||||
SettingsManager.FLAG_VANISH.addOverride(false);
|
||||
|
||||
}
|
||||
|
||||
} else {
|
||||
|
||||
@@ -127,4 +90,20 @@ public class HookManager {
|
||||
|
||||
}
|
||||
|
||||
private Plugin getEnabledVanishPlugin(PluginManager pluginManager) {
|
||||
|
||||
for (String pluginName : VANISH_PLUGIN_NAMES) {
|
||||
|
||||
if (pluginManager.isPluginEnabled(pluginName)) {
|
||||
|
||||
return pluginManager.getPlugin(pluginName);
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
return null;
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
@@ -1,7 +1,6 @@
|
||||
package cosmeticsOG.managers;
|
||||
|
||||
import cosmeticsOG.CosmeticsOG;
|
||||
import cosmeticsOG.Utils;
|
||||
import cosmeticsOG.hooks.VanishHook;
|
||||
import cosmeticsOG.locale.Message;
|
||||
import cosmeticsOG.particles.Hat;
|
||||
@@ -121,7 +120,7 @@ public class ParticleManager {
|
||||
// Disabled World.
|
||||
if (disabledWorlds.contains(worldName)) {
|
||||
|
||||
Utils.cosmeticsOGPlaceholderMessage(player, Message.WORLD_DISABLED.getValue());
|
||||
CosmeticsOG.chatMessage(player, Message.WORLD_DISABLED.getValue());
|
||||
|
||||
return false;
|
||||
|
||||
@@ -134,7 +133,7 @@ public class ParticleManager {
|
||||
&& !player.hasPermission(Permission.WORLD.append(worldName)))
|
||||
{
|
||||
|
||||
Utils.cosmeticsOGPlaceholderMessage(player, Message.WORLD_NO_PERMISSION.getValue());
|
||||
CosmeticsOG.chatMessage(player, Message.WORLD_NO_PERMISSION.getValue());
|
||||
|
||||
return false;
|
||||
|
||||
@@ -155,7 +154,7 @@ public class ParticleManager {
|
||||
|
||||
} else {
|
||||
|
||||
Utils.cosmeticsOGPlaceholderMessage(player, Message.HAT_EQUIPPED_OVERFLOW.replace("{1}",
|
||||
CosmeticsOG.chatMessage(player, Message.HAT_EQUIPPED_OVERFLOW.replace("{1}",
|
||||
Integer.toString(SettingsManager.MAXIMUM_HAT_LIMIT.getInt())));
|
||||
|
||||
return false;
|
||||
@@ -187,13 +186,13 @@ public class ParticleManager {
|
||||
|
||||
if (!equipMessage.equals("")) {
|
||||
|
||||
Utils.cosmeticsOGPlaceholderMessage(player, equipMessage);
|
||||
CosmeticsOG.chatMessage(player, equipMessage);
|
||||
|
||||
} else {
|
||||
|
||||
Message defaultMessage = hat.isVanished() ? Message.HAT_EQUIPPED_VANISHED : Message.HAT_EQUIPPED;
|
||||
|
||||
Utils.cosmeticsOGPlaceholderMessage(player, defaultMessage.replace("{1}", hat.getDisplayName()));
|
||||
CosmeticsOG.chatMessage(player, defaultMessage.replace("{1}", hat.getDisplayName()));
|
||||
|
||||
}
|
||||
|
||||
|
||||
@@ -23,7 +23,7 @@ public enum SettingsManager {
|
||||
LOAD_INCLUDED_CUSTOM_TYPES("load-included-custom-types", Type.BOOLEAN, true),
|
||||
DISABLED_WORLDS("disabled-worlds", Type.STRING_LIST, new ArrayList<String>()),
|
||||
CHECK_WORLD_PERMISSION("check-world-permission", Type.BOOLEAN, true),
|
||||
CLOSE_MENU_ON_EQUIP("close-menu-on-equip", Type.BOOLEAN, true), CURRENCY("currency", Type.STRING, "$"),
|
||||
CLOSE_MENU_ON_EQUIP("close-menu-on-equip", Type.BOOLEAN, true), CURRENCY("currency", Type.STRING, "&bShards"),
|
||||
LIVE_MENUS("live-menus", Type.BOOLEAN, true), LIVE_MENU_UPDATE_FREQUENCY("live-menu-update-frequency", Type.INT, 5),
|
||||
MAXIMUM_HAT_LIMIT("max-hats", Type.INT_CLAMPED, 7, 28),
|
||||
UNEQUIP_OVERFLOW_HATS("unequip-overflow-hats", Type.BOOLEAN, false),
|
||||
@@ -43,8 +43,7 @@ public enum SettingsManager {
|
||||
/**
|
||||
* Flags
|
||||
*/
|
||||
FLAG_VAULT("flags.vault", Type.BOOLEAN, false), FLAG_PLAYERPOINTS("flags.playerpoints", Type.BOOLEAN, false),
|
||||
FLAG_TOKEN_MANAGER("flags.token-manager", Type.BOOLEAN, false),
|
||||
FLAG_DIAMONDBANK("flags.diamondbank", Type.BOOLEAN, false),
|
||||
FLAG_EXPERIENCE("flags.experience", Type.BOOLEAN, false), FLAG_PERMISSION("flags.permission", Type.BOOLEAN, true),
|
||||
FLAG_VANISH("flags.vanish", Type.BOOLEAN, false),
|
||||
FLAG_ESSENTIALS_VANISH("flags.essentials-vanish", Type.BOOLEAN, false),
|
||||
@@ -157,7 +156,7 @@ public enum SettingsManager {
|
||||
|
||||
public static boolean isEconomyEnabled() {
|
||||
|
||||
return FLAG_VAULT.getBoolean() || FLAG_PLAYERPOINTS.getBoolean() || FLAG_TOKEN_MANAGER.getBoolean();
|
||||
return FLAG_DIAMONDBANK.getBoolean();
|
||||
|
||||
}
|
||||
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
package cosmeticsOG.particles;
|
||||
|
||||
import net.trueog.utilitiesog.UtilitiesOG;
|
||||
import cosmeticsOG.CosmeticsOG;
|
||||
import cosmeticsOG.Utils;
|
||||
import cosmeticsOG.compatibility.CompatibleMaterial;
|
||||
import cosmeticsOG.locale.Message;
|
||||
import cosmeticsOG.particles.effects.PixelEffect;
|
||||
@@ -2194,8 +2194,8 @@ public class Hat {
|
||||
}
|
||||
|
||||
menuItem = item.clone();
|
||||
ItemUtil.setNameAndDescription(menuItem, Utils.legacySerializerAnyCase(name),
|
||||
normalDescription.stream().map(Utils::legacySerializerAnyCase).collect(Collectors.toList()));
|
||||
ItemUtil.setNameAndDescription(menuItem, UtilitiesOG.trueogColorize(name),
|
||||
normalDescription.stream().map(UtilitiesOG::trueogColorize).collect(Collectors.toList()));
|
||||
|
||||
return menuItem;
|
||||
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
package cosmeticsOG.particles;
|
||||
|
||||
import net.trueog.utilitiesog.UtilitiesOG;
|
||||
import cosmeticsOG.CosmeticsOG;
|
||||
import cosmeticsOG.Utils;
|
||||
import cosmeticsOG.compatibility.CompatibleMaterial;
|
||||
import cosmeticsOG.locale.Message;
|
||||
import cosmeticsOG.util.ItemUtil;
|
||||
@@ -367,7 +367,7 @@ public enum ParticleEffect {
|
||||
*/
|
||||
public String getStrippedName() {
|
||||
|
||||
return Utils.stripColors(getDisplayName());
|
||||
return UtilitiesOG.stripFormatting(getDisplayName());
|
||||
|
||||
}
|
||||
|
||||
|
||||
@@ -1,14 +1,14 @@
|
||||
package cosmeticsOG.particles.effects;
|
||||
|
||||
import cosmeticsOG.Utils;
|
||||
import net.trueog.utilitiesog.UtilitiesOG;
|
||||
import cosmeticsOG.util.ResourceUtil;
|
||||
|
||||
public class ParticleHatsEffect extends CommunityEffect {
|
||||
|
||||
public ParticleHatsEffect() {
|
||||
|
||||
super(ResourceUtil.getImage("particlehats.png"), "particlehats",
|
||||
Utils.legacySerializerAnyCase("&6ParticleHats"), Utils.legacySerializerAnyCase("&7Medius_Echo"));
|
||||
super(ResourceUtil.getImage("particlehats.png"), "particlehats", UtilitiesOG.trueogColorize("&6ParticleHats"),
|
||||
UtilitiesOG.trueogColorize("&7Medius_Echo"));
|
||||
|
||||
}
|
||||
|
||||
|
||||
@@ -1,9 +1,21 @@
|
||||
package cosmeticsOG.particles.properties;
|
||||
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.UUID;
|
||||
import java.util.concurrent.CompletableFuture;
|
||||
import java.util.concurrent.CompletionException;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
import org.bukkit.Bukkit;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.inventory.Inventory;
|
||||
import org.bukkit.inventory.ItemStack;
|
||||
|
||||
import cosmeticsOG.CosmeticsOG;
|
||||
import cosmeticsOG.Utils;
|
||||
import cosmeticsOG.events.HatEquipEvent;
|
||||
import cosmeticsOG.hooks.CurrencyHook;
|
||||
import cosmeticsOG.locale.Message;
|
||||
import cosmeticsOG.managers.SettingsManager;
|
||||
import cosmeticsOG.particles.Hat;
|
||||
@@ -16,15 +28,10 @@ import cosmeticsOG.ui.StaticMenu;
|
||||
import cosmeticsOG.ui.StaticMenuManager;
|
||||
import cosmeticsOG.util.ItemUtil;
|
||||
import cosmeticsOG.util.PlayerUtil;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.stream.Collectors;
|
||||
import net.kyori.adventure.text.Component;
|
||||
import org.bukkit.Bukkit;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.inventory.Inventory;
|
||||
import org.bukkit.inventory.ItemStack;
|
||||
import net.trueog.diamondbankog.DiamondBankException;
|
||||
import net.trueog.diamondbankog.balance.shard.PlayerShards;
|
||||
import net.trueog.utilitiesog.UtilitiesOG;
|
||||
|
||||
public enum ParticleAction {
|
||||
|
||||
@@ -38,7 +45,7 @@ public enum ParticleAction {
|
||||
private final boolean hasData;
|
||||
private final boolean isHidden;
|
||||
|
||||
private static final Map<Integer, ParticleAction> actionID = new HashMap<Integer, ParticleAction>();
|
||||
private static final Map<Integer, ParticleAction> actionID = new HashMap<>();
|
||||
|
||||
static {
|
||||
|
||||
@@ -83,7 +90,7 @@ public enum ParticleAction {
|
||||
|
||||
public String getName() {
|
||||
|
||||
return this.toString().toLowerCase();
|
||||
return StringUtils.lowerCase(this.toString());
|
||||
|
||||
}
|
||||
|
||||
@@ -136,7 +143,7 @@ public enum ParticleAction {
|
||||
*/
|
||||
public String getStrippedName() {
|
||||
|
||||
return Utils.stripColors(getDisplayName());
|
||||
return UtilitiesOG.stripFormatting(getDisplayName());
|
||||
|
||||
}
|
||||
|
||||
@@ -167,26 +174,25 @@ public enum ParticleAction {
|
||||
@SuppressWarnings("incomplete-switch")
|
||||
public void onClick(Player player, Hat hat, int slot, Inventory inventory, String argument) {
|
||||
|
||||
PlayerState playerState = core.getPlayerState(player);
|
||||
boolean canClose = SettingsManager.CLOSE_MENU_ON_EQUIP.getBoolean();
|
||||
final PlayerState playerState = core.getPlayerState(player);
|
||||
final boolean canClose = SettingsManager.CLOSE_MENU_ON_EQUIP.getBoolean();
|
||||
|
||||
switch (this) {
|
||||
|
||||
case EQUIP: {
|
||||
case EQUIP -> {
|
||||
|
||||
HatEquipEvent event = new HatEquipEvent(player, hat);
|
||||
final HatEquipEvent event = new HatEquipEvent(player, hat);
|
||||
Bukkit.getPluginManager().callEvent(event);
|
||||
|
||||
if (!event.isCancelled()) {
|
||||
|
||||
// Remove an already equipped hat
|
||||
// Remove an already equipped hat.
|
||||
if (checkAgainstEquippedHats(hat, slot, playerState, inventory)) {
|
||||
|
||||
return;
|
||||
|
||||
}
|
||||
|
||||
// Check to see if we have already purchased this hat
|
||||
// Check to see if we have already purchased this hat.
|
||||
if (playerState.hasPurchased(hat)) {
|
||||
|
||||
core.getParticleManager().equipHat(player, hat);
|
||||
@@ -201,26 +207,27 @@ public enum ParticleAction {
|
||||
|
||||
}
|
||||
|
||||
boolean canUsePermission = SettingsManager.FLAG_PERMISSION.getBoolean();
|
||||
boolean canUseCurrency = SettingsManager.isEconomyEnabled();
|
||||
boolean canUseExp = SettingsManager.FLAG_EXPERIENCE.getBoolean();
|
||||
final boolean canUsePermission = SettingsManager.FLAG_PERMISSION.getBoolean();
|
||||
final boolean canUseCurrency = SettingsManager.isEconomyEnabled();
|
||||
final boolean canUseExp = SettingsManager.FLAG_EXPERIENCE.getBoolean();
|
||||
|
||||
if (canUsePermission) {
|
||||
|
||||
if (hat.isLocked()) {
|
||||
|
||||
// Only show the permission denied message if vault and exp are also disabled.
|
||||
// Only show the permission denied message if currency and exp are also
|
||||
// disabled.
|
||||
if (!canUseCurrency && !canUseExp) {
|
||||
|
||||
String deniedMessage = hat.getPermissionDeniedDisplayMessage();
|
||||
final String deniedMessage = hat.getPermissionDeniedDisplayMessage();
|
||||
|
||||
if (!deniedMessage.equals("")) {
|
||||
if (!"".equals(deniedMessage)) {
|
||||
|
||||
Utils.cosmeticsOGPlaceholderMessage(player, deniedMessage);
|
||||
CosmeticsOG.chatMessage(player, deniedMessage);
|
||||
|
||||
} else {
|
||||
|
||||
Utils.cosmeticsOGPlaceholderMessage(player, Message.HAT_NO_PERMISSION.getValue());
|
||||
CosmeticsOG.chatMessage(player, Message.HAT_NO_PERMISSION.getValue());
|
||||
|
||||
}
|
||||
|
||||
@@ -253,18 +260,15 @@ public enum ParticleAction {
|
||||
|
||||
}
|
||||
|
||||
double playerBalance = -1;
|
||||
|
||||
if (canUseCurrency) {
|
||||
|
||||
CurrencyHook currencyHook = core.getHookManager().getCurrencyHook();
|
||||
if (currencyHook != null && currencyHook.isEnabled()) {
|
||||
openPurchaseMenuIfAffordable(player, playerState, hat, canClose);
|
||||
return;
|
||||
|
||||
playerBalance = currencyHook.getBalance(player);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
} else if (canUseExp) {
|
||||
long playerBalance = -1;
|
||||
if (canUseExp) {
|
||||
|
||||
playerBalance = player.getLevel();
|
||||
|
||||
@@ -274,9 +278,7 @@ public enum ParticleAction {
|
||||
|
||||
if (playerBalance < hat.getPrice()) {
|
||||
|
||||
String currency = SettingsManager.CURRENCY.getString();
|
||||
Utils.cosmeticsOGPlaceholderMessage(player,
|
||||
Message.INSUFFICIENT_FUNDS.getValue().replace("{1}", currency));
|
||||
sendInsufficientFunds(player);
|
||||
|
||||
if (canClose) {
|
||||
|
||||
@@ -288,26 +290,7 @@ public enum ParticleAction {
|
||||
|
||||
} else {
|
||||
|
||||
StaticMenuManager staticManager = core.getMenuManagerFactory()
|
||||
.getStaticMenuManager(playerState);
|
||||
playerState.setPendingPurchase(hat);
|
||||
|
||||
MenuInventory purchaseInventory = core.getDatabase().getPurchaseMenu(playerState);
|
||||
AbstractMenu pendingPurchaseMenu;
|
||||
|
||||
if (purchaseInventory != null) {
|
||||
|
||||
pendingPurchaseMenu = new StaticMenu(core, staticManager, player, purchaseInventory);
|
||||
|
||||
} else {
|
||||
|
||||
pendingPurchaseMenu = new StaticMenu(core, staticManager, player,
|
||||
PendingPurchaseMenu.defaultPendingPurchaseInventory.clone());
|
||||
|
||||
}
|
||||
|
||||
staticManager.addMenu(pendingPurchaseMenu);
|
||||
pendingPurchaseMenu.open();
|
||||
openPendingPurchaseMenu(player, playerState, hat);
|
||||
|
||||
}
|
||||
|
||||
@@ -329,42 +312,22 @@ public enum ParticleAction {
|
||||
|
||||
}
|
||||
|
||||
break;
|
||||
|
||||
}
|
||||
case TOGGLE -> {
|
||||
|
||||
case TOGGLE: {
|
||||
|
||||
List<Hat> hats = playerState.getActiveHats();
|
||||
|
||||
// Toggles all active hats based on the first hats toggle state
|
||||
// Players can toggle individual hats through the hat manager
|
||||
|
||||
final List<Hat> hats = playerState.getActiveHats();
|
||||
if (hats.size() > 0) {
|
||||
|
||||
boolean initialToggle = hats.get(0).isHidden();
|
||||
for (Hat h : hats) {
|
||||
|
||||
h.setHidden(!initialToggle);
|
||||
|
||||
}
|
||||
final boolean initialToggle = hats.get(0).isHidden();
|
||||
hats.forEach(h -> h.setHidden(!initialToggle));
|
||||
|
||||
}
|
||||
|
||||
break;
|
||||
|
||||
}
|
||||
case CLOSE -> PlayerUtil.closeInventory(player);
|
||||
case OVERRIDE -> {
|
||||
|
||||
case CLOSE: {
|
||||
|
||||
PlayerUtil.closeInventory(player);
|
||||
break;
|
||||
|
||||
}
|
||||
|
||||
case OVERRIDE: {
|
||||
|
||||
// Remove an already equipped hat
|
||||
// Remove an already equipped hat.
|
||||
if (checkAgainstEquippedHats(hat, slot, playerState, inventory)) {
|
||||
|
||||
return;
|
||||
@@ -378,21 +341,16 @@ public enum ParticleAction {
|
||||
|
||||
}
|
||||
|
||||
break;
|
||||
|
||||
}
|
||||
|
||||
case CLEAR: {
|
||||
case CLEAR -> {
|
||||
|
||||
core.getPlayerState(player).clearActiveHats();
|
||||
Utils.cosmeticsOGPlaceholderMessage(player, Message.COMMAND_CLEAR_SUCCESS.getValue());
|
||||
break;
|
||||
CosmeticsOG.chatMessage(player, Message.COMMAND_CLEAR_SUCCESS.getValue());
|
||||
|
||||
}
|
||||
case COMMAND -> {
|
||||
|
||||
case COMMAND: {
|
||||
|
||||
if (!argument.equals("")) {
|
||||
if (!"".equals(argument)) {
|
||||
|
||||
PlayerUtil.runNextTick(() -> {
|
||||
|
||||
@@ -403,12 +361,8 @@ public enum ParticleAction {
|
||||
|
||||
}
|
||||
|
||||
break;
|
||||
|
||||
}
|
||||
|
||||
case OPEN_MENU_PERMISSION:
|
||||
case OPEN_MENU: {
|
||||
case OPEN_MENU_PERMISSION, OPEN_MENU -> {
|
||||
|
||||
if (this == OPEN_MENU_PERMISSION && !player.hasPermission(hat.getFullPermission())) {
|
||||
|
||||
@@ -416,71 +370,60 @@ public enum ParticleAction {
|
||||
|
||||
}
|
||||
|
||||
StaticMenuManager staticManager = (StaticMenuManager) playerState.getMenuManager();
|
||||
final StaticMenuManager staticManager = (StaticMenuManager) playerState.getMenuManager();
|
||||
if (staticManager == null) {
|
||||
|
||||
return;
|
||||
|
||||
}
|
||||
|
||||
AbstractMenu menu = staticManager.getMenuFromCache(argument);
|
||||
final AbstractMenu menu = staticManager.getMenuFromCache(argument);
|
||||
if (menu != null) {
|
||||
|
||||
menu.open();
|
||||
|
||||
} else {
|
||||
|
||||
MenuInventory menuInventory = core.getDatabase().loadInventory(argument, playerState);
|
||||
final MenuInventory menuInventory = core.getDatabase().loadInventory(argument, playerState);
|
||||
if (menuInventory == null) {
|
||||
|
||||
Utils.cosmeticsOGPlaceholderMessage(player,
|
||||
CosmeticsOG.chatMessage(player,
|
||||
Message.COMMAND_ERROR_UNKNOWN_MENU.getValue().replace("{1}", argument));
|
||||
break;
|
||||
|
||||
}
|
||||
|
||||
StaticMenu staticMenu = new StaticMenu(core, staticManager, player, menuInventory);
|
||||
final StaticMenu staticMenu = new StaticMenu(core, staticManager, player, menuInventory);
|
||||
staticManager.addMenu(staticMenu);
|
||||
|
||||
staticMenu.open();
|
||||
|
||||
}
|
||||
|
||||
break;
|
||||
|
||||
}
|
||||
case PURCHASE_CONFIRM -> {
|
||||
|
||||
case PURCHASE_CONFIRM: {
|
||||
|
||||
Hat pendingHat = playerState.getPendingPurchase();
|
||||
|
||||
final Hat pendingHat = playerState.getPendingPurchase();
|
||||
// Go back to the previous menu if the pending hat is null
|
||||
if (pendingHat == null) {
|
||||
|
||||
gotoPreviousMenu(playerState);
|
||||
return;
|
||||
|
||||
}
|
||||
|
||||
int price = pendingHat.getPrice();
|
||||
final int price = pendingHat.getPrice();
|
||||
boolean purchased = false;
|
||||
|
||||
if (SettingsManager.isEconomyEnabled()) {
|
||||
|
||||
CurrencyHook currencyHook = core.getHookManager().getCurrencyHook();
|
||||
if (currencyHook != null && currencyHook.isEnabled()) {
|
||||
|
||||
if (currencyHook.withdraw(player, price)) {
|
||||
|
||||
purchased = true;
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
playerState.setPendingPurchase(null);
|
||||
purchaseWithDiamondBank(player, playerState, pendingHat, price);
|
||||
return;
|
||||
|
||||
} else if (SettingsManager.FLAG_EXPERIENCE.getBoolean()) {
|
||||
|
||||
double currentBalance = player.getLevel();
|
||||
double newBalance = currentBalance - price;
|
||||
final double currentBalance = player.getLevel();
|
||||
final double newBalance = currentBalance - price;
|
||||
player.setLevel((int) newBalance);
|
||||
|
||||
purchased = true;
|
||||
@@ -489,39 +432,21 @@ public enum ParticleAction {
|
||||
|
||||
if (purchased) {
|
||||
|
||||
playerState.addPurchasedHat(pendingHat);
|
||||
|
||||
core.getDatabase().savePlayerPurchase(player.getUniqueId(), pendingHat);
|
||||
core.getParticleManager().equipHat(player, pendingHat);
|
||||
|
||||
if (SettingsManager.CLOSE_MENU_ON_EQUIP.getBoolean()) {
|
||||
|
||||
PlayerUtil.closeInventory(player);
|
||||
|
||||
} else {
|
||||
|
||||
gotoPreviousMenu(playerState);
|
||||
|
||||
}
|
||||
finishPurchase(player, playerState, pendingHat);
|
||||
|
||||
}
|
||||
|
||||
break;
|
||||
|
||||
}
|
||||
case PURCHASE_DENY -> {
|
||||
|
||||
case PURCHASE_DENY: {
|
||||
|
||||
playerState.setPendingPurchase(null);
|
||||
gotoPreviousMenu(playerState);
|
||||
break;
|
||||
|
||||
}
|
||||
case DEMO -> {
|
||||
|
||||
case DEMO: {
|
||||
|
||||
HatEquipEvent event = new HatEquipEvent(player, hat);
|
||||
final HatEquipEvent event = new HatEquipEvent(player, hat);
|
||||
Bukkit.getPluginManager().callEvent(event);
|
||||
|
||||
if (!event.isCancelled()) {
|
||||
|
||||
hat.setPermanent(false);
|
||||
@@ -529,18 +454,14 @@ public enum ParticleAction {
|
||||
|
||||
}
|
||||
|
||||
break;
|
||||
|
||||
}
|
||||
case ACTIVE_PARTICLES -> {
|
||||
|
||||
case ACTIVE_PARTICLES: {
|
||||
|
||||
StaticMenuManager staticManager = core.getMenuManagerFactory().getStaticMenuManager(playerState);
|
||||
EquippedParticlesMenu particlesMenu = new EquippedParticlesMenu(core, staticManager, player, true);
|
||||
|
||||
final StaticMenuManager staticManager = core.getMenuManagerFactory().getStaticMenuManager(playerState);
|
||||
final EquippedParticlesMenu particlesMenu = new EquippedParticlesMenu(core, staticManager, player,
|
||||
true);
|
||||
staticManager.addMenu(particlesMenu);
|
||||
particlesMenu.open();
|
||||
break;
|
||||
|
||||
}
|
||||
|
||||
@@ -582,7 +503,7 @@ public enum ParticleAction {
|
||||
|
||||
try {
|
||||
|
||||
return ParticleAction.valueOf(name.toUpperCase());
|
||||
return ParticleAction.valueOf(StringUtils.upperCase(name));
|
||||
|
||||
} catch (IllegalArgumentException e) {
|
||||
|
||||
@@ -594,9 +515,8 @@ public enum ParticleAction {
|
||||
|
||||
private void gotoPreviousMenu(PlayerState playerState) {
|
||||
|
||||
StaticMenuManager staticManager = (StaticMenuManager) playerState.getMenuManager();
|
||||
AbstractMenu menu = staticManager.getPreviousOpenMenu();
|
||||
|
||||
final StaticMenuManager staticManager = (StaticMenuManager) playerState.getMenuManager();
|
||||
final AbstractMenu menu = staticManager.getPreviousOpenMenu();
|
||||
if (menu == null) {
|
||||
|
||||
return;
|
||||
@@ -609,24 +529,277 @@ public enum ParticleAction {
|
||||
|
||||
private boolean checkAgainstEquippedHats(Hat hat, int slot, PlayerState playerState, Inventory inventory) {
|
||||
|
||||
if (playerState.isEquipped(hat)) {
|
||||
if (!playerState.isEquipped(hat)) {
|
||||
|
||||
playerState.removeHat(hat);
|
||||
ItemStack item = inventory.getItem(slot);
|
||||
return false;
|
||||
|
||||
ItemUtil.stripHighlight(item);
|
||||
}
|
||||
|
||||
// Convert List<String> to List<Component>.
|
||||
List<Component> components = hat.getCachedDescription().stream().map(Component::text)
|
||||
.collect(Collectors.toList());
|
||||
playerState.removeHat(hat);
|
||||
|
||||
final ItemStack item = inventory.getItem(slot);
|
||||
ItemUtil.stripHighlight(item);
|
||||
|
||||
// Convert List<String> to List<Component>.
|
||||
final List<Component> components = hat.getCachedDescription().stream().map(Component::text)
|
||||
.collect(Collectors.toList());
|
||||
ItemUtil.setItemDescription(item, components);
|
||||
|
||||
return true;
|
||||
|
||||
}
|
||||
|
||||
private void openPurchaseMenuIfAffordable(Player player, PlayerState playerState, Hat hat, boolean canClose) {
|
||||
|
||||
if (!isDiamondBankAvailable()) {
|
||||
|
||||
return;
|
||||
|
||||
}
|
||||
|
||||
final UUID uuid = player.getUniqueId();
|
||||
final long priceShards = hat.getPrice();
|
||||
getSpendableShardBalance(uuid).whenComplete((playerBalance, throwable) -> {
|
||||
|
||||
if (throwable != null) {
|
||||
|
||||
handleDiamondBankFailure(player, throwable);
|
||||
return;
|
||||
|
||||
}
|
||||
|
||||
runOnMainThread(() -> {
|
||||
|
||||
if (!player.isOnline()) {
|
||||
|
||||
return;
|
||||
|
||||
}
|
||||
|
||||
if (playerBalance < priceShards) {
|
||||
|
||||
sendInsufficientFunds(player);
|
||||
if (canClose) {
|
||||
|
||||
PlayerUtil.closeInventory(player);
|
||||
|
||||
}
|
||||
|
||||
return;
|
||||
|
||||
}
|
||||
|
||||
openPendingPurchaseMenu(player, playerState, hat);
|
||||
|
||||
});
|
||||
|
||||
});
|
||||
|
||||
}
|
||||
|
||||
private void openPendingPurchaseMenu(Player player, PlayerState playerState, Hat hat) {
|
||||
|
||||
final StaticMenuManager staticManager = core.getMenuManagerFactory().getStaticMenuManager(playerState);
|
||||
playerState.setPendingPurchase(hat);
|
||||
|
||||
final MenuInventory purchaseInventory = core.getDatabase().getPurchaseMenu(playerState);
|
||||
final AbstractMenu pendingPurchaseMenu;
|
||||
if (purchaseInventory != null) {
|
||||
|
||||
pendingPurchaseMenu = new StaticMenu(core, staticManager, player, purchaseInventory);
|
||||
|
||||
} else {
|
||||
|
||||
pendingPurchaseMenu = new StaticMenu(core, staticManager, player,
|
||||
PendingPurchaseMenu.defaultPendingPurchaseInventory.clone());
|
||||
|
||||
}
|
||||
|
||||
staticManager.addMenu(pendingPurchaseMenu);
|
||||
pendingPurchaseMenu.open();
|
||||
|
||||
}
|
||||
|
||||
private void purchaseWithDiamondBank(Player player, PlayerState playerState, Hat pendingHat, long priceShards) {
|
||||
|
||||
if (!isDiamondBankAvailable()) {
|
||||
|
||||
return;
|
||||
|
||||
}
|
||||
|
||||
final UUID uuid = player.getUniqueId();
|
||||
final String notes = "Purchased " + UtilitiesOG.stripFormatting(pendingHat.getDisplayName());
|
||||
consumePlayerShards(uuid, priceShards, notes).whenComplete((ignored, throwable) -> {
|
||||
|
||||
if (throwable != null) {
|
||||
|
||||
handleDiamondBankFailure(player, throwable);
|
||||
return;
|
||||
|
||||
}
|
||||
|
||||
runOnMainThread(() -> finishPurchase(player, playerState, pendingHat));
|
||||
|
||||
});
|
||||
|
||||
}
|
||||
|
||||
private void finishPurchase(Player player, PlayerState playerState, Hat pendingHat) {
|
||||
|
||||
if (!player.isOnline()) {
|
||||
|
||||
return;
|
||||
|
||||
}
|
||||
|
||||
playerState.setPendingPurchase(null);
|
||||
playerState.addPurchasedHat(pendingHat);
|
||||
|
||||
core.getDatabase().savePlayerPurchase(player.getUniqueId(), pendingHat);
|
||||
core.getParticleManager().equipHat(player, pendingHat);
|
||||
|
||||
if (SettingsManager.CLOSE_MENU_ON_EQUIP.getBoolean()) {
|
||||
|
||||
PlayerUtil.closeInventory(player);
|
||||
|
||||
} else {
|
||||
|
||||
gotoPreviousMenu(playerState);
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
private CompletableFuture<Long> getSpendableShardBalance(UUID uuid) {
|
||||
|
||||
return callDiamondBankAsync(() -> {
|
||||
|
||||
final PlayerShards shards = CosmeticsOG.getDiamondBankAPI().getAllShards(uuid);
|
||||
return shards.getBank() + shards.getInventory();
|
||||
|
||||
});
|
||||
|
||||
}
|
||||
|
||||
private CompletableFuture<Void> consumePlayerShards(UUID uuid, long priceShards, String notes) {
|
||||
|
||||
return callDiamondBankAsync(() -> {
|
||||
|
||||
CosmeticsOG.getDiamondBankAPI().consumeFromPlayer(uuid, priceShards, "Cosmetics-OG purchase", notes);
|
||||
return null;
|
||||
|
||||
});
|
||||
|
||||
}
|
||||
|
||||
private <T> CompletableFuture<T> callDiamondBankAsync(DiamondBankCall<T> call) {
|
||||
|
||||
final CompletableFuture<T> future = new CompletableFuture<>();
|
||||
Bukkit.getScheduler().runTaskAsynchronously(CosmeticsOG.getInstance(), () -> {
|
||||
|
||||
try {
|
||||
|
||||
future.complete(call.execute());
|
||||
|
||||
} catch (Throwable t) {
|
||||
|
||||
future.completeExceptionally(t);
|
||||
|
||||
}
|
||||
|
||||
});
|
||||
|
||||
return future;
|
||||
|
||||
}
|
||||
|
||||
private boolean isDiamondBankAvailable() {
|
||||
|
||||
if (CosmeticsOG.getDiamondBankAPI() != null) {
|
||||
|
||||
ItemUtil.setItemDescription(item, components);
|
||||
return true;
|
||||
|
||||
}
|
||||
|
||||
CosmeticsOG.disableSelf("Could not find DiamondBank-OG! Disabling Cosmetics-OG...");
|
||||
return false;
|
||||
|
||||
}
|
||||
|
||||
private void handleDiamondBankFailure(Player player, Throwable throwable) {
|
||||
|
||||
final Throwable cause = unwrapCompletionException(throwable);
|
||||
if (cause instanceof DiamondBankException.EconomyDisabledException) {
|
||||
|
||||
CosmeticsOG.disableSelf("The DiamondBank-OG economy is disabled - disabling Cosmetics-OG!");
|
||||
return;
|
||||
|
||||
}
|
||||
|
||||
if (cause instanceof DiamondBankException.InsufficientFundsException
|
||||
|| cause instanceof DiamondBankException.InsufficientBalanceException)
|
||||
{
|
||||
|
||||
runOnMainThread(() -> {
|
||||
|
||||
if (player.isOnline()) {
|
||||
|
||||
sendInsufficientFunds(player);
|
||||
|
||||
}
|
||||
|
||||
});
|
||||
return;
|
||||
|
||||
}
|
||||
|
||||
if (cause instanceof DiamondBankException.PlayerNotOnlineException) {
|
||||
|
||||
return;
|
||||
|
||||
}
|
||||
|
||||
UtilitiesOG.logToConsole(CosmeticsOG.getPrefix(),
|
||||
"DiamondBank-OG transaction failed: " + cause.getClass().getSimpleName());
|
||||
if (CosmeticsOG.debugging) {
|
||||
|
||||
cause.printStackTrace();
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
private Throwable unwrapCompletionException(Throwable throwable) {
|
||||
|
||||
if (throwable instanceof CompletionException && throwable.getCause() != null) {
|
||||
|
||||
return throwable.getCause();
|
||||
|
||||
}
|
||||
|
||||
return throwable;
|
||||
|
||||
}
|
||||
|
||||
private void sendInsufficientFunds(Player player) {
|
||||
|
||||
final String currency = SettingsManager.CURRENCY.getString();
|
||||
CosmeticsOG.chatMessage(player, Message.INSUFFICIENT_FUNDS.getValue().replace("{1}", currency));
|
||||
|
||||
}
|
||||
|
||||
private void runOnMainThread(Runnable runnable) {
|
||||
|
||||
Bukkit.getScheduler().runTask(CosmeticsOG.getInstance(), runnable);
|
||||
|
||||
}
|
||||
|
||||
@FunctionalInterface
|
||||
private interface DiamondBankCall<T> {
|
||||
|
||||
T execute() throws Exception;
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
@@ -1,6 +1,6 @@
|
||||
package cosmeticsOG.particles.properties;
|
||||
|
||||
import cosmeticsOG.Utils;
|
||||
import net.trueog.utilitiesog.UtilitiesOG;
|
||||
import cosmeticsOG.locale.Message;
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
@@ -82,7 +82,7 @@ public enum ParticleAnimation {
|
||||
*/
|
||||
public String getStrippedName() {
|
||||
|
||||
return Utils.stripColors(getDisplayName());
|
||||
return UtilitiesOG.stripFormatting(getDisplayName());
|
||||
|
||||
}
|
||||
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
package cosmeticsOG.particles.properties;
|
||||
|
||||
import cosmeticsOG.Utils;
|
||||
import net.trueog.utilitiesog.UtilitiesOG;
|
||||
import cosmeticsOG.locale.Message;
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
@@ -98,7 +98,7 @@ public enum ParticleLocation {
|
||||
*/
|
||||
public String getStrippedName() {
|
||||
|
||||
return Utils.stripColors(getDisplayName());
|
||||
return UtilitiesOG.stripFormatting(getDisplayName());
|
||||
|
||||
}
|
||||
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
package cosmeticsOG.particles.properties;
|
||||
|
||||
import net.trueog.utilitiesog.UtilitiesOG;
|
||||
import cosmeticsOG.CosmeticsOG;
|
||||
import cosmeticsOG.Utils;
|
||||
import cosmeticsOG.locale.Message;
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashMap;
|
||||
@@ -86,7 +86,7 @@ public enum ParticleMode {
|
||||
*/
|
||||
public String getStrippedName() {
|
||||
|
||||
return Utils.stripColors(getDisplayName());
|
||||
return UtilitiesOG.stripFormatting(getDisplayName());
|
||||
|
||||
}
|
||||
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
package cosmeticsOG.particles.properties;
|
||||
|
||||
import cosmeticsOG.Utils;
|
||||
import net.trueog.utilitiesog.UtilitiesOG;
|
||||
import cosmeticsOG.particles.Effect;
|
||||
import cosmeticsOG.particles.effects.AngelWingsEffect;
|
||||
import cosmeticsOG.particles.effects.AnimatedEffect;
|
||||
@@ -145,7 +145,7 @@ public enum ParticleType {
|
||||
*/
|
||||
public String getStrippedName() {
|
||||
|
||||
return Utils.stripColors(effect.getDisplayName());
|
||||
return UtilitiesOG.stripFormatting(effect.getDisplayName());
|
||||
|
||||
}
|
||||
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
package cosmeticsOG.prompt;
|
||||
|
||||
import cosmeticsOG.Utils;
|
||||
import net.trueog.utilitiesog.UtilitiesOG;
|
||||
import cosmeticsOG.editor.MetaState;
|
||||
import net.kyori.adventure.text.Component;
|
||||
import org.bukkit.entity.Player;
|
||||
@@ -14,7 +14,7 @@ public class SpigotPrompt extends BukkitPrompt {
|
||||
|
||||
try {
|
||||
|
||||
Component component = Utils.legacySerializerAnyCase(message);
|
||||
Component component = UtilitiesOG.trueogColorize(message);
|
||||
|
||||
// Send an action bar message using Adventure API.
|
||||
player.sendActionBar(component);
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
package cosmeticsOG.ui;
|
||||
|
||||
import net.trueog.utilitiesog.UtilitiesOG;
|
||||
import cosmeticsOG.CosmeticsOG;
|
||||
import cosmeticsOG.Utils;
|
||||
import cosmeticsOG.compatibility.CompatibleMaterial;
|
||||
import cosmeticsOG.editor.EditorLore;
|
||||
import cosmeticsOG.locale.Message;
|
||||
@@ -32,7 +32,7 @@ public class EquippedParticlesMenu extends AbstractListMenu {
|
||||
this.totalPages = 1;
|
||||
|
||||
this.setMenu(0, Bukkit.createInventory(null, 54,
|
||||
Utils.legacySerializerAnyCase(Message.ACTIVE_PARTICLES_MENU_TITLE.getValue())));
|
||||
UtilitiesOG.trueogColorize(Message.ACTIVE_PARTICLES_MENU_TITLE.getValue())));
|
||||
|
||||
hatAction = (event, slot) -> {
|
||||
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
package cosmeticsOG.ui;
|
||||
|
||||
import net.trueog.utilitiesog.UtilitiesOG;
|
||||
import cosmeticsOG.CosmeticsOG;
|
||||
import cosmeticsOG.Utils;
|
||||
import cosmeticsOG.locale.Message;
|
||||
import cosmeticsOG.managers.SettingsManager;
|
||||
import cosmeticsOG.particles.Hat;
|
||||
@@ -100,7 +100,7 @@ public class StaticMenu extends AbstractStaticMenu {
|
||||
|
||||
Material lockedMaterial = SettingsManager.MENU_LOCKED_ITEM.getMaterial();
|
||||
int lockedMaterialDurability = SettingsManager.MENU_LOCKED_ITEM_DAMAGE.getInt();
|
||||
TextComponent lockedTitle = Utils.legacySerializerAnyCase(SettingsManager.MENU_LOCKED_ITEM_TITLE.getString());
|
||||
TextComponent lockedTitle = UtilitiesOG.trueogColorize(SettingsManager.MENU_LOCKED_ITEM_TITLE.getString());
|
||||
|
||||
List<Hat> equippedHats = core.getPlayerState(owner).getActiveHats();
|
||||
for (int i = 0; i < inventory.getSize(); i++) {
|
||||
@@ -248,7 +248,7 @@ public class StaticMenu extends AbstractStaticMenu {
|
||||
|
||||
}
|
||||
|
||||
TextComponent equippedLore = Utils.legacySerializerAnyCase(Message.HAT_EQUIPPED_DESCRIPTION.getValue());
|
||||
TextComponent equippedLore = UtilitiesOG.trueogColorize(Message.HAT_EQUIPPED_DESCRIPTION.getValue());
|
||||
|
||||
String[] lineInfo = StringUtil.parseValue(equippedLore.content(), "1");
|
||||
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
package cosmeticsOG.util;
|
||||
|
||||
import net.trueog.utilitiesog.UtilitiesOG;
|
||||
import cosmeticsOG.CosmeticsOG;
|
||||
import cosmeticsOG.Utils;
|
||||
import cosmeticsOG.compatibility.CompatibleMaterial;
|
||||
import cosmeticsOG.locale.Message;
|
||||
import java.util.Arrays;
|
||||
@@ -66,7 +66,7 @@ public class ItemUtil {
|
||||
List<TextComponent> description)
|
||||
{
|
||||
|
||||
TextComponent title = Utils.legacySerializerAnyCase(titleString);
|
||||
TextComponent title = UtilitiesOG.trueogColorize(titleString);
|
||||
|
||||
ItemStack item = new ItemStack(material, quantity);
|
||||
ItemMeta itemMeta = item.getItemMeta();
|
||||
@@ -90,7 +90,7 @@ public class ItemUtil {
|
||||
ItemStack item = new ItemStack(material, quantity);
|
||||
ItemMeta itemMeta = item.getItemMeta();
|
||||
|
||||
itemMeta.displayName(Utils.legacySerializerAnyCase(title));
|
||||
itemMeta.displayName(UtilitiesOG.trueogColorize(title));
|
||||
|
||||
addItemFlags(itemMeta);
|
||||
item.setItemMeta(itemMeta);
|
||||
@@ -101,7 +101,7 @@ public class ItemUtil {
|
||||
|
||||
public static ItemStack createItem(Material material, String displayNameString, List<Component> description) {
|
||||
|
||||
TextComponent displayName = Utils.legacySerializerAnyCase(displayNameString);
|
||||
TextComponent displayName = UtilitiesOG.trueogColorize(displayNameString);
|
||||
|
||||
// Create the item with the material.
|
||||
ItemStack item = new ItemStack(material);
|
||||
@@ -143,7 +143,7 @@ public class ItemUtil {
|
||||
if (component instanceof TextComponent) {
|
||||
|
||||
// Process color codes for TextComponent
|
||||
return Utils.legacySerializerAnyCase(((TextComponent) component).content());
|
||||
return UtilitiesOG.trueogColorize(((TextComponent) component).content());
|
||||
|
||||
} else {
|
||||
|
||||
@@ -170,8 +170,7 @@ public class ItemUtil {
|
||||
|
||||
// Convert TextComponent array to List<Component> for color code processing.
|
||||
List<Component> components = Arrays.stream(description)
|
||||
.map(textComponent -> Utils.legacySerializerAnyCase(textComponent.content()))
|
||||
.collect(Collectors.toList());
|
||||
.map(textComponent -> UtilitiesOG.trueogColorize(textComponent.content())).collect(Collectors.toList());
|
||||
|
||||
ItemMeta itemMeta = item.getItemMeta();
|
||||
|
||||
@@ -204,7 +203,7 @@ public class ItemUtil {
|
||||
}
|
||||
|
||||
// Set the display name of the item using the legacy formatted string.
|
||||
meta.displayName(Utils.legacySerializerAnyCase(name));
|
||||
meta.displayName(UtilitiesOG.trueogColorize(name));
|
||||
|
||||
// Apply the modified meta back to the item.
|
||||
item.setItemMeta(meta);
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
package cosmeticsOG.util;
|
||||
|
||||
import cosmeticsOG.Utils;
|
||||
import net.trueog.utilitiesog.UtilitiesOG;
|
||||
import cosmeticsOG.managers.SettingsManager;
|
||||
import cosmeticsOG.particles.Hat;
|
||||
import java.util.ArrayList;
|
||||
@@ -168,7 +168,7 @@ public class StringUtil {
|
||||
List<TextComponent> result = new ArrayList<>();
|
||||
for (String s : list) {
|
||||
|
||||
result.add(Utils.legacySerializerAnyCase(s));
|
||||
result.add(UtilitiesOG.trueogColorize(s));
|
||||
|
||||
}
|
||||
|
||||
@@ -268,7 +268,7 @@ public class StringUtil {
|
||||
|
||||
for (String s : values) {
|
||||
|
||||
desc.add(Utils.legacySerializerAnyCase(s));
|
||||
desc.add(UtilitiesOG.trueogColorize(s));
|
||||
|
||||
}
|
||||
|
||||
@@ -281,7 +281,7 @@ public class StringUtil {
|
||||
List<TextComponent> desc = new ArrayList<>();
|
||||
for (String line : description) {
|
||||
|
||||
desc.add(Utils.legacySerializerAnyCase(parseString(line, hat)));
|
||||
desc.add(UtilitiesOG.trueogColorize(parseString(line, hat)));
|
||||
|
||||
}
|
||||
|
||||
@@ -382,13 +382,13 @@ public class StringUtil {
|
||||
for (String s : list) {
|
||||
|
||||
String formatted = s.replaceAll("(?<=<" + regex + ">).*?(?=</" + regex + ">)", "");
|
||||
if (Utils.stripColors(formatted).length() == 0) {
|
||||
if (UtilitiesOG.stripFormatting(formatted).length() == 0) {
|
||||
|
||||
continue;
|
||||
|
||||
}
|
||||
|
||||
formattedList.add(Utils.legacySerializerAnyCase(formatted));
|
||||
formattedList.add(UtilitiesOG.trueogColorize(formatted));
|
||||
|
||||
}
|
||||
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
package cosmeticsOG.util;
|
||||
|
||||
import net.trueog.utilitiesog.UtilitiesOG;
|
||||
import cosmeticsOG.CosmeticsOG;
|
||||
import cosmeticsOG.Utils;
|
||||
import cosmeticsOG.configuration.CustomConfig;
|
||||
import cosmeticsOG.managers.SettingsManager;
|
||||
import cosmeticsOG.managers.SettingsManager.Type;
|
||||
@@ -15,7 +15,7 @@ import org.bukkit.configuration.file.FileConfiguration;
|
||||
public class YamlUtil {
|
||||
|
||||
private static final double MENU_VERSION = 4.0;
|
||||
private static final double CONFIG_VERSION = 2.2;
|
||||
private static final double CONFIG_VERSION = 2.3;
|
||||
|
||||
/**
|
||||
* Checks to see if this CustomConfig is updated to the current version
|
||||
@@ -36,7 +36,8 @@ public class YamlUtil {
|
||||
*/
|
||||
public static void updateMenuSaveFormat(CustomConfig menuConfig) {
|
||||
|
||||
Utils.logToConsole("Updating " + menuConfig.getFileName() + " to new save format...");
|
||||
UtilitiesOG.logToConsole(CosmeticsOG.getPrefix(),
|
||||
"Updating " + menuConfig.getFileName() + " to new save format...");
|
||||
|
||||
FileConfiguration config = menuConfig.getConfig();
|
||||
config.set("version", MENU_VERSION);
|
||||
@@ -311,6 +312,8 @@ public class YamlUtil {
|
||||
|
||||
}
|
||||
|
||||
migrateLegacyEconomyConfig(config);
|
||||
|
||||
// Update any missing values.
|
||||
for (SettingsManager setting : SettingsManager.values()) {
|
||||
|
||||
@@ -325,11 +328,39 @@ public class YamlUtil {
|
||||
config.set("version", CONFIG_VERSION);
|
||||
|
||||
core.saveConfig();
|
||||
SettingsManager.onReload();
|
||||
|
||||
}
|
||||
|
||||
private static void migrateLegacyEconomyConfig(FileConfiguration config) {
|
||||
|
||||
if (!config.isSet(SettingsManager.FLAG_DIAMONDBANK.getKey())) {
|
||||
|
||||
final boolean legacyEconomyEnabled = config.getBoolean("flags.vault", false)
|
||||
|| config.getBoolean("flags.playerpoints", false);
|
||||
if (legacyEconomyEnabled) {
|
||||
|
||||
config.set(SettingsManager.FLAG_DIAMONDBANK.getKey(), true);
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
config.set("flags.vault", null);
|
||||
config.set("flags.playerpoints", null);
|
||||
|
||||
}
|
||||
|
||||
private static void updateLegacyConfig(FileConfiguration config) {
|
||||
|
||||
final boolean legacyEconomyEnabled = config.getBoolean("defaults.flags.vault", false)
|
||||
|| config.getBoolean("defaults.flag.playerpoints", false);
|
||||
if (legacyEconomyEnabled) {
|
||||
|
||||
config.set(SettingsManager.FLAG_DIAMONDBANK.getKey(), true);
|
||||
|
||||
}
|
||||
|
||||
// Loop through all legacy config keys and update.
|
||||
for (LegacyType type : LegacyType.values()) {
|
||||
|
||||
@@ -382,12 +413,12 @@ public class YamlUtil {
|
||||
DISABLED_WORLDS("defaults.disabled_worlds", "disabled-worlds", Type.STRING_LIST, new ArrayList<String>()),
|
||||
CHECK_WORLD_PERMISSION("defaults.check_world_permission", "check-world-permission", Type.BOOLEAN, false),
|
||||
HALO("defaults.halo", "", Type.DEPRECATED, 0), EFFECT("defaults.effect", "", Type.DEPRECATED, 0),
|
||||
FLAGS_VAULT("defaults.flags.vault", "flags.vault", Type.BOOLEAN, false),
|
||||
FLAGS_VAULT("defaults.flags.vault", "", Type.DEPRECATED, 0),
|
||||
FLAGS_EXPERIENCE("defaults.flags.experience", "flags.experience", Type.BOOLEAN, false),
|
||||
FLAGS_PERMISSION("defaults.flags.permission", "flags.permission", Type.BOOLEAN, true),
|
||||
FLAGS_VANISH("defaults.flags.vanish", "flags.vanish", Type.BOOLEAN, false),
|
||||
FLAGS_PLAYERPOINTS("defaults.flag.playerpoints", "flags.playerpoints", Type.BOOLEAN, false),
|
||||
CURRENCY_TYPE("defaults.currency_type", "currency", Type.STRING, "$"),
|
||||
FLAGS_PLAYERPOINTS("defaults.flag.playerpoints", "", Type.DEPRECATED, 0),
|
||||
CURRENCY_TYPE("defaults.currency_type", "currency", Type.STRING, "&bShards"),
|
||||
CLOSE_MENU_ON_EQUIP("defaults.close_menu_on_equip", "close-menu-on-equip", Type.BOOLEAN, true),
|
||||
MENU_LOCK_HATS_WITHOUT_PERMISSION("defaults.menu.lock_hats_without_permission",
|
||||
"menu.lock-hats-without-permission", Type.BOOLEAN, false),
|
||||
|
||||
@@ -10,7 +10,7 @@
|
||||
#
|
||||
# Don't Change This!
|
||||
# This value gets updated automatically
|
||||
version: 2.2
|
||||
version: 2.3
|
||||
#
|
||||
# Enable automatic config updates
|
||||
config-auto-update: true
|
||||
@@ -40,8 +40,9 @@ check-world-permission: false
|
||||
# Closes the players menu any time they equip a hat
|
||||
close-menu-on-equip: true
|
||||
#
|
||||
# Use {CURRENCY} in your item descriptions to utilize this value
|
||||
currency: &BDiamonds
|
||||
# Use {CURRENCY} in your item descriptions to utilize this value.
|
||||
# Purchase prices are stored and calculated as DiamondBank-OG shards.
|
||||
currency: '&bShards'
|
||||
#
|
||||
# Let menus dynamically update their content (Cosmetic only)
|
||||
live-menus: true
|
||||
@@ -83,11 +84,8 @@ database:
|
||||
#
|
||||
flags:
|
||||
#
|
||||
# Enable Vault and use any economy plugin you want to unlock hats
|
||||
vault: false
|
||||
#
|
||||
# Enable PlayerPoints economy
|
||||
playerpoints: false
|
||||
# Enable DiamondBank-OG economy purchases.
|
||||
diamondbank: false
|
||||
#
|
||||
# Allow players to unlock hats using their experience points
|
||||
experience: false
|
||||
@@ -96,14 +94,11 @@ flags:
|
||||
permission: true
|
||||
#
|
||||
# Use a supported vanish plugin, and hide particles any time a player vanishes
|
||||
# Supported plugins are: SuperVanish, PremiumVanish, & VanishNoPacket
|
||||
# Supported plugins are: Vanish-OG, SuperVanish, PremiumVanish, & VanishNoPacket
|
||||
vanish: false
|
||||
#
|
||||
# Disable particle effects when a player has a potion of invisibility effect
|
||||
essentials-vanish: true
|
||||
#
|
||||
# Enable TokenManager economy
|
||||
token-manager: false
|
||||
#
|
||||
afk:
|
||||
# Set how many seconds the plugin will wait before marking a player as AFK
|
||||
|
||||
@@ -3,7 +3,8 @@ main: cosmeticsOG.CosmeticsOG
|
||||
version: '${version}'
|
||||
api-version: '${apiVersion}'
|
||||
authors: [MediusEcho, NotAlexNoyle]
|
||||
softdepend: [Vault, SuperVanish, PremiumVanish, VanishNoPacket, PlayerPoints, Citizens, TokenManager]
|
||||
depend: [DiamondBank-OG]
|
||||
softdepend: [Vanish-OG, SuperVanish, PremiumVanish, VanishNoPacket, Citizens]
|
||||
commands:
|
||||
cosmetics:
|
||||
description: Main command for Cosmetics-OG
|
||||
|
||||
Reference in new issue
Block a user