diff --git a/.project b/.project
index 4da6727..3c5ec30 100644
--- a/.project
+++ b/.project
@@ -15,9 +15,15 @@
+
+ org.eclipse.buildship.core.gradleprojectbuilder
+
+
+
org.eclipse.jdt.core.javanature
org.eclipse.m2e.core.maven2Nature
+ org.eclipse.buildship.core.gradleprojectnature
diff --git a/.settings/org.eclipse.buildship.core.prefs b/.settings/org.eclipse.buildship.core.prefs
new file mode 100644
index 0000000..7ddafc5
--- /dev/null
+++ b/.settings/org.eclipse.buildship.core.prefs
@@ -0,0 +1,8 @@
+connection.arguments=
+connection.gradle.distribution=GRADLE_DISTRIBUTION(WRAPPER)
+connection.java.home=null
+connection.jvm.arguments=
+connection.project.dir=
+derived.resources=.gradle,build
+eclipse.preferences.version=1
+project.path=\:
diff --git a/pom.xml b/pom.xml
index f9a407b..a66d8e6 100644
--- a/pom.xml
+++ b/pom.xml
@@ -2,7 +2,7 @@
4.0.0
com.xpgaming
xPBottles
- 0.2
+ 0.3
xPBottles
diff --git a/src/main/java/com/xpgaming/xPBottles/Bottle.java b/src/main/java/com/xpgaming/xPBottles/Bottle.java
index 323303b..b449d86 100644
--- a/src/main/java/com/xpgaming/xPBottles/Bottle.java
+++ b/src/main/java/com/xpgaming/xPBottles/Bottle.java
@@ -40,9 +40,10 @@
public class Bottle implements CommandExecutor {
public CommandResult execute(CommandSource src, CommandContext args) throws CommandException {
+ String prefix = Config.getInstance().getConfig().getNode("bottles", "prefix").getString();
if(src instanceof Player) {
Player player = (Player) src;
- player.sendMessage(Text.of("§f[§bxP//§f] §b§l-- COMMANDS --"));
+ player.sendMessage(Text.of("§f[§b"+prefix+"§f] §b§l-- COMMANDS --"));
if(player.hasPermission("xpgaming.bottles.use")) {
player.sendMessage(Text.of(" §7> §b/bottle confirm §7- Convert your XP into bottles!"));
}
@@ -50,7 +51,7 @@ public CommandResult execute(CommandSource src, CommandContext args) throws Comm
player.sendMessage(Text.of(" §7> §b/bottle reload §7- Reload plugin configuration!"));
}
} else {
- src.sendMessage(Text.of("§f[§bxP//§f] §b§l-- COMMANDS --"));
+ src.sendMessage(Text.of("§f[§b"+prefix+"§f] §b§l-- COMMANDS --"));
src.sendMessage(Text.of(" §7> §b/bottle confirm §7- Convert your XP into bottles!"));
src.sendMessage(Text.of(" §7> §b/bottle reload §7- Reload plugin configuration!"));
}
diff --git a/src/main/java/com/xpgaming/xPBottles/BottleXP.java b/src/main/java/com/xpgaming/xPBottles/BottleXP.java
index e48cbf6..605c7ab 100644
--- a/src/main/java/com/xpgaming/xPBottles/BottleXP.java
+++ b/src/main/java/com/xpgaming/xPBottles/BottleXP.java
@@ -1,6 +1,7 @@
package com.xpgaming.xPBottles;
import java.net.URL;
+import net.minecraft.server.MinecraftServer;
import java.nio.file.Path;
import java.util.Collection;
import java.util.Optional;
@@ -40,6 +41,7 @@
public class BottleXP implements CommandExecutor {
public CommandResult execute(CommandSource src, CommandContext args) throws CommandException {
+ String prefix = Config.getInstance().getConfig().getNode("bottles", "prefix").getString();
if(src instanceof Player) {
Player player = (Player) src;
if(player.gameMode().get() == GameModes.SURVIVAL) {
@@ -50,20 +52,20 @@ public CommandResult execute(CommandSource src, CommandContext args) throws Comm
double bottlesNeeded = Math.ceil(totalEXP / 11);
createBottles(bottlesNeeded, player);
if(bottlesNeeded == 1) {
- player.sendMessage(Text.of("§f[§axP//§f] §aSuccessfully exchanged your XP for §2" + (int)bottlesNeeded + "§a bottle!"));
- } else player.sendMessage(Text.of("§f[§axP//§f] §aSuccessfully exchanged your XP for §2" + (int)bottlesNeeded + "§a bottles!"));
+ player.sendMessage(Text.of("§f[§a"+prefix+"§f] §aSuccessfully exchanged your XP for §2" + (int)bottlesNeeded + "§a bottle!"));
+ } else player.sendMessage(Text.of("§f[§a"+prefix+"§f] §aSuccessfully exchanged your XP for §2" + (int)bottlesNeeded + "§a bottles!"));
player.offer(Keys.TOTAL_EXPERIENCE, 0);
} else {
- player.sendMessage(Text.of("§f[§cxP//§f] §cYou need at least " + minLevels + " levels to convert to bottles!"));
+ player.sendMessage(Text.of("§f[§c"+prefix+"§f] §cYou need at least " + minLevels + " levels to convert to bottles!"));
}
return CommandResult.success();
} else {
- player.sendMessage(Text.of("§f[§cxP//§f] §cYou need to be in Survival mode to use this!"));
+ player.sendMessage(Text.of("§f[§c"+prefix+"§f] §cYou need to be in Survival mode to use this!"));
return CommandResult.success();
}
}
else {
- src.sendMessage(Text.of("[xP//] You need to be a player to run this command!"));
+ src.sendMessage(Text.of("["+prefix+"] You need to be a player to run this command!"));
return CommandResult.success();
}
}
diff --git a/src/main/java/com/xpgaming/xPBottles/Config.java b/src/main/java/com/xpgaming/xPBottles/Config.java
index 612eafb..15e5502 100644
--- a/src/main/java/com/xpgaming/xPBottles/Config.java
+++ b/src/main/java/com/xpgaming/xPBottles/Config.java
@@ -22,7 +22,8 @@ public void configCreate() {
configFile.createNewFile();
configLoad();
CommentedConfigurationNode bottles = config.getNode("bottles").setComment("xP// Bottles coded by Xenoyia! Check out mc.xpgaming.com!");
- bottles.getNode("min_level").setComment("Do not set this to lower than 2, it's hardcoded to not give half a bottle.").setValue("30");
+ bottles.getNode("min_level").setComment("Do not set this to lower than 2, it's hardcoded to not give half a bottle.").setValue("30");
+ bottles.getNode("prefix").setComment("[Prefix] goes before the messages, its default is 'Bottles'.").setValue("Bottles");
configSave();
} catch (IOException e) {
e.printStackTrace();
diff --git a/src/main/java/com/xpgaming/xPBottles/Main.java b/src/main/java/com/xpgaming/xPBottles/Main.java
index e5cd5a3..06ee6f5 100644
--- a/src/main/java/com/xpgaming/xPBottles/Main.java
+++ b/src/main/java/com/xpgaming/xPBottles/Main.java
@@ -7,6 +7,8 @@
import java.nio.file.Paths;
import javax.inject.Inject;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
import org.spongepowered.api.Sponge;
import org.spongepowered.api.command.spec.CommandSpec;
import org.spongepowered.api.config.ConfigDir;
@@ -21,8 +23,11 @@
import ninja.leaping.configurate.hocon.HoconConfigurationLoader;
import ninja.leaping.configurate.loader.ConfigurationLoader;
-@Plugin(id = "xpbottles", name = "xP// Bottles", version = "0.2")
+@Plugin(id = Main.id, name = Main.name, version = "0.3")
public class Main {
+ public static final String id = "xpbottles";
+ public static final String name = "xP// Bottles";
+ private static final Logger log = LoggerFactory.getLogger(name);
CommandSpec confirm = CommandSpec.builder()
.description(Text.of("Bottle 30 levels of XP!"))
@@ -55,6 +60,7 @@ public class Main {
@Listener
public void onGameInitialization(GameInitializationEvent event) {
Config.getInstance().setup(configFile, configLoader);
+ log.info("Loaded v0.3!");
}
@Listener
@@ -62,11 +68,6 @@ public void onPreInitializationEvent(GameInitializationEvent event) {
Sponge.getCommandManager().register(this, bottle, "bottle", "xpbottle", "bottlexp", "xptobottle", "bxp");
}
- @Listener
- public void onServerStart(GameStartedServerEvent event) {
- System.out.println("[xP// Bottles] Loaded v0.2!");
- }
-
}
diff --git a/src/main/java/com/xpgaming/xPBottles/Reload.java b/src/main/java/com/xpgaming/xPBottles/Reload.java
index 81f3280..e8a1618 100644
--- a/src/main/java/com/xpgaming/xPBottles/Reload.java
+++ b/src/main/java/com/xpgaming/xPBottles/Reload.java
@@ -40,11 +40,12 @@
public class Reload implements CommandExecutor {
public CommandResult execute(CommandSource src, CommandContext args) throws CommandException {
Config.getInstance().configLoad();
+ String prefix = Config.getInstance().getConfig().getNode("bottles", "prefix").getString();
if(src instanceof Player) {
Player player = (Player) src;
- player.sendMessage(Text.of("§f[§bxP//§f] §bSuccessfully reloaded xP// Bottles!"));
+ player.sendMessage(Text.of("§f[§b"+prefix+"§f] §bSuccessfully reloaded xP// Bottles!"));
} else {
- src.sendMessage(Text.of("§f[§bxP//§f] §bSuccessfully reloaded xP// Bottles!"));
+ src.sendMessage(Text.of("§f[§b"+prefix+"§f] §bSuccessfully reloaded xP// Bottles!"));
}
return CommandResult.success();
}