entry : AutoClicker.clicks.entrySet()) {
if(entry.getValue() > 16) {
- CloudMessenger.sendHackMessage(Hack.AUTOCLICKER, entry.getKey());
//TODO: change to real warn reason
entry.getKey().warn(WarnReason.SPAM, null, "https://players.univento.eu/" + entry.getKey().getUniqueId().toString() + "/hacks");
}
diff --git a/src/main/java/eu/univento/core/antihack/modules/AutoRespawn.java b/src/main/java/eu/univento/core/antihack/modules/AutoRespawn.java
index 5b738a1..48f5669 100644
--- a/src/main/java/eu/univento/core/antihack/modules/AutoRespawn.java
+++ b/src/main/java/eu/univento/core/antihack/modules/AutoRespawn.java
@@ -1,7 +1,5 @@
package eu.univento.core.antihack.modules;
-import eu.univento.cloud.client.CloudMessenger;
-import eu.univento.core.antihack.Hack;
import eu.univento.core.api.player.CustomPlayer;
import eu.univento.core.api.player.WarnReason;
import org.bukkit.event.EventHandler;
@@ -25,7 +23,6 @@ public class AutoRespawn implements Listener {
CustomPlayer p = CustomPlayer.getPlayer(e.getPlayer());
if(time.containsKey(p)) {
if(System.currentTimeMillis() - time.get(p) <= 200L) {
- CloudMessenger.sendHackMessage(Hack.AUTORESPAWN, p);
//TODO: change to real warn reason
p.warn(WarnReason.SPAM, null, "https://players.univento.eu/" + p.getUniqueId().toString() + "/hacks");
}
diff --git a/src/main/java/eu/univento/core/antihack/modules/Criticals.java b/src/main/java/eu/univento/core/antihack/modules/Criticals.java
index de5c94f..9932f6f 100644
--- a/src/main/java/eu/univento/core/antihack/modules/Criticals.java
+++ b/src/main/java/eu/univento/core/antihack/modules/Criticals.java
@@ -1,8 +1,6 @@
package eu.univento.core.antihack.modules;
-import eu.univento.cloud.client.CloudMessenger;
import eu.univento.core.Core;
-import eu.univento.core.antihack.Hack;
import eu.univento.core.api.player.CustomPlayer;
import eu.univento.core.api.player.WarnReason;
import org.bukkit.Bukkit;
@@ -48,7 +46,6 @@ public class Criticals implements Listener {
return;
}
if (fark == 0.125 || fark == 1.0 || fark == 1.3 || fark == 0.6190840103302007 || fark == 0.4414162352399398 || fark == 200.0) {
- CloudMessenger.sendHackMessage(Hack.CRITICALS, p);
//TODO: change to real warn reason
p.warn(WarnReason.SPAM, null, "https://players.univento.eu/" + p.getUniqueId().toString() + "/hacks");
}
diff --git a/src/main/java/eu/univento/core/antihack/modules/FastPlace.java b/src/main/java/eu/univento/core/antihack/modules/FastPlace.java
index 66a6de4..e9d9547 100644
--- a/src/main/java/eu/univento/core/antihack/modules/FastPlace.java
+++ b/src/main/java/eu/univento/core/antihack/modules/FastPlace.java
@@ -1,7 +1,5 @@
package eu.univento.core.antihack.modules;
-import eu.univento.cloud.client.CloudMessenger;
-import eu.univento.core.antihack.Hack;
import eu.univento.core.api.player.CustomPlayer;
import eu.univento.core.api.player.WarnReason;
import org.bukkit.event.EventHandler;
@@ -19,8 +17,7 @@ public class FastPlace implements Listener{
CustomPlayer p = CustomPlayer.getPlayer(e.getPlayer());
if(time.containsKey(p)) {
if(System.currentTimeMillis() - time.get(p) <= 110L) {
- CloudMessenger.sendHackMessage(Hack.FASTPLACE, p);
- //TODO: change to real warn reason
+ //TODO: change to real reason
p.warn(WarnReason.ADVERTISEMENT, null, "https://players.univento.eu/" + p.getUniqueId().toString() + "/hacks");
}
}
diff --git a/src/main/java/eu/univento/core/antihack/modules/Fly.java b/src/main/java/eu/univento/core/antihack/modules/Fly.java
index 6430946..caf47f9 100644
--- a/src/main/java/eu/univento/core/antihack/modules/Fly.java
+++ b/src/main/java/eu/univento/core/antihack/modules/Fly.java
@@ -1,7 +1,5 @@
package eu.univento.core.antihack.modules;
-import eu.univento.cloud.client.CloudMessenger;
-import eu.univento.core.antihack.Hack;
import eu.univento.core.api.player.CustomPlayer;
import org.bukkit.GameMode;
import org.bukkit.event.EventHandler;
@@ -14,8 +12,7 @@ public class Fly implements Listener{
public void onFly(PlayerMoveEvent e) {
CustomPlayer p = CustomPlayer.getPlayer(e.getPlayer());
if(p.getGameMode() != GameMode.CREATIVE && e.getTo().getY() > e.getFrom().getY() + 1.5) {
- CloudMessenger.sendHackMessage(Hack.FLY, p);
- p.warn(Hack.FLY);
+ //p.warn(Hack.FLY);
}
}
}
\ No newline at end of file
diff --git a/src/main/java/eu/univento/core/antihack/modules/Glide.java b/src/main/java/eu/univento/core/antihack/modules/Glide.java
index ebdf334..4d53fd7 100644
--- a/src/main/java/eu/univento/core/antihack/modules/Glide.java
+++ b/src/main/java/eu/univento/core/antihack/modules/Glide.java
@@ -1,7 +1,5 @@
package eu.univento.core.antihack.modules;
-import eu.univento.cloud.client.CloudMessenger;
-import eu.univento.core.antihack.Hack;
import eu.univento.core.api.player.CustomPlayer;
import org.bukkit.Material;
import org.bukkit.event.EventHandler;
@@ -14,8 +12,7 @@ public class Glide implements Listener{
public void onGlide(PlayerMoveEvent e) {
CustomPlayer p = CustomPlayer.getPlayer(e.getPlayer());
if(e.getTo().getY() - e.getFrom().getY() == -0.125 && e.getTo().clone().subtract(0.0, 1.0, 0.0).getBlock().getType().equals(Material.AIR)) {
- CloudMessenger.sendHackMessage(Hack.GLIDE, p);
- p.warn(Hack.GLIDE);
+ //p.warn(Hack.GLIDE);
}
}
}
\ No newline at end of file
diff --git a/src/main/java/eu/univento/core/antihack/modules/NoSlowDown.java b/src/main/java/eu/univento/core/antihack/modules/NoSlowDown.java
index 8482b61..bf08d31 100644
--- a/src/main/java/eu/univento/core/antihack/modules/NoSlowDown.java
+++ b/src/main/java/eu/univento/core/antihack/modules/NoSlowDown.java
@@ -1,7 +1,5 @@
package eu.univento.core.antihack.modules;
-import eu.univento.cloud.client.CloudMessenger;
-import eu.univento.core.antihack.Hack;
import eu.univento.core.api.player.CustomPlayer;
import org.bukkit.entity.Player;
import org.bukkit.event.EventHandler;
@@ -16,8 +14,7 @@ public class NoSlowDown implements Listener{
if(e.getEntity() instanceof Player) {
CustomPlayer p = CustomPlayer.getPlayer((Player) e.getEntity());
if(p.isSprinting()) {
- CloudMessenger.sendHackMessage(Hack.NOSLOWDOWN, p);
- p.warn(Hack.NOSLOWDOWN);
+ //p.warn(Hack.NOSLOWDOWN);
}
}
}
@@ -27,8 +24,7 @@ public class NoSlowDown implements Listener{
if(e.getEntity() instanceof Player) {
CustomPlayer p = CustomPlayer.getPlayer((Player) e.getEntity());
if(e.getFoodLevel() > p.getFoodLevel() && p.isSprinting()) {
- CloudMessenger.sendHackMessage(Hack.NOSLOWDOWN, p);
- p.warn(Hack.NOSLOWDOWN);
+ //p.warn(Hack.NOSLOWDOWN);
}
}
}
diff --git a/src/main/java/eu/univento/core/antihack/modules/Nuker.java b/src/main/java/eu/univento/core/antihack/modules/Nuker.java
index 92e1ee1..e243648 100644
--- a/src/main/java/eu/univento/core/antihack/modules/Nuker.java
+++ b/src/main/java/eu/univento/core/antihack/modules/Nuker.java
@@ -1,7 +1,5 @@
package eu.univento.core.antihack.modules;
-import eu.univento.cloud.client.CloudMessenger;
-import eu.univento.core.antihack.Hack;
import eu.univento.core.api.player.CustomPlayer;
import eu.univento.core.api.player.WarnReason;
import org.bukkit.event.EventHandler;
@@ -13,7 +11,6 @@ import java.util.LinkedHashMap;
/**
* @author joethei
* @version 0.1
- * created on 01.07.2016
*/
class Nuker implements Listener {
@@ -28,7 +25,6 @@ class Nuker implements Listener {
blocks.put(p, blocks.get(p) + 1);
if(blocks.get(p) > 80) {
e.setCancelled(true);
- CloudMessenger.sendHackMessage(Hack.NUKER, p);
p.warn(WarnReason.SPAM, null, "https://players.univento.eu/" + p.getUniqueId().toString() + "/hacks");
}
}else{
diff --git a/src/main/java/eu/univento/core/antihack/modules/Reach.java b/src/main/java/eu/univento/core/antihack/modules/Reach.java
index 1172837..2b288d2 100644
--- a/src/main/java/eu/univento/core/antihack/modules/Reach.java
+++ b/src/main/java/eu/univento/core/antihack/modules/Reach.java
@@ -1,7 +1,5 @@
package eu.univento.core.antihack.modules;
-import eu.univento.cloud.client.CloudMessenger;
-import eu.univento.core.antihack.Hack;
import eu.univento.core.api.player.CustomPlayer;
import org.bukkit.block.Block;
import org.bukkit.entity.Player;
@@ -19,8 +17,7 @@ public class Reach implements Listener{
CustomPlayer p = CustomPlayer.getPlayer((Player) e.getEntity());
if(damager.getLocation().distance(p.getLocation()) > 4.0) {
e.setCancelled(true);
- CloudMessenger.sendHackMessage(Hack.REACH, damager);
- p.warn(Hack.REACH);
+ //p.warn(Hack.REACH);
}
}
}
@@ -32,8 +29,7 @@ public class Reach implements Listener{
if(p.getWorld() != b.getWorld()) return;
if(p.getLocation().distance(b.getLocation()) > 6.1) {
e.setCancelled(true);
- CloudMessenger.sendHackMessage(Hack.REACH, p);
- p.warn(Hack.REACH);
+ //p.warn(Hack.REACH);
}
}
diff --git a/src/main/java/eu/univento/core/antihack/modules/Regen.java b/src/main/java/eu/univento/core/antihack/modules/Regen.java
index 54892ad..189d375 100644
--- a/src/main/java/eu/univento/core/antihack/modules/Regen.java
+++ b/src/main/java/eu/univento/core/antihack/modules/Regen.java
@@ -1,8 +1,6 @@
package eu.univento.core.antihack.modules;
-import eu.univento.cloud.client.CloudMessenger;
import eu.univento.core.Core;
-import eu.univento.core.antihack.Hack;
import eu.univento.core.api.player.CustomPlayer;
import eu.univento.core.api.player.WarnReason;
import org.bukkit.Bukkit;
@@ -29,7 +27,6 @@ public class Regen implements Listener {
}
if (e.getAmount() > 1.0) {
p.setFoodLevel(0);
- CloudMessenger.sendHackMessage(Hack.REGEN, p);
//TODO: change to real warn reason
p.warn(WarnReason.SPAM, null, "https://players.univento.eu/" + p.getUniqueId().toString() + "/hacks");
return;
@@ -41,7 +38,6 @@ public class Regen implements Listener {
if (!a.contains(p)) {
p.setFoodLevel(0);
b.remove(p);
- CloudMessenger.sendHackMessage(Hack.REGEN, p);
//TODO: change to real warn reason
p.warn(WarnReason.SPAM, null, "https://players.univento.eu/" + p.getUniqueId().toString() + "/hacks");
} else if (a.contains(p)) {
diff --git a/src/main/java/eu/univento/core/antihack/utils/PacketHandler.java b/src/main/java/eu/univento/core/antihack/utils/PacketHandler.java
index de65369..656c540 100644
--- a/src/main/java/eu/univento/core/antihack/utils/PacketHandler.java
+++ b/src/main/java/eu/univento/core/antihack/utils/PacketHandler.java
@@ -1,9 +1,7 @@
package eu.univento.core.antihack.utils;
import com.mojang.authlib.GameProfile;
-import eu.univento.cloud.client.CloudMessenger;
import eu.univento.core.Core;
-import eu.univento.core.antihack.Hack;
import eu.univento.core.antihack.modules.KillAura;
import eu.univento.core.api.fakeplayer.FakePlayer;
import eu.univento.core.api.player.CustomPlayer;
@@ -72,7 +70,6 @@ class PacketHandler extends ChannelDuplexHandler {
} else {
count.remove(player);
CustomPlayer p = CustomPlayer.getPlayer(player);
- CloudMessenger.sendHackMessage(Hack.KILLAURA, p);
p.warn(WarnReason.SPAM, null, "https://players.univento.eu/" + p.getUniqueId().toString() + "/hacks");
}
killAura.remove(player);
diff --git a/src/main/java/eu/univento/core/api/AutoCommand.java b/src/main/java/eu/univento/core/api/AutoCommand.java
index 3d6e20f..d50368e 100644
--- a/src/main/java/eu/univento/core/api/AutoCommand.java
+++ b/src/main/java/eu/univento/core/api/AutoCommand.java
@@ -11,7 +11,6 @@ import java.lang.reflect.Field;
import java.util.ArrayList;
import java.util.Collections;
import java.util.List;
-import java.util.logging.Level;
/**
* @author PostCrafter
@@ -25,7 +24,7 @@ public abstract class AutoCommand extends Command {
static {
String path = Bukkit.getServer().getClass().getPackage().getName();
AutoCommand.VERSION = path.substring(path.lastIndexOf(".") + 1, path.length());
- Core.log(Level.INFO, "AutoCommand hook for Bukkit " + AutoCommand.VERSION);
+ Core.getCommons().getLoggingHandler().getCore().info("AutoCommand hook for Bukkit " + AutoCommand.VERSION);
}
private final P plugin;
diff --git a/src/main/java/eu/univento/core/api/Config.java b/src/main/java/eu/univento/core/api/Config.java
index aa77290..bb364ad 100644
--- a/src/main/java/eu/univento/core/api/Config.java
+++ b/src/main/java/eu/univento/core/api/Config.java
@@ -118,10 +118,11 @@ public class Config {
/**
* read integer from config
+ * @param path path
* @return Integer
*/
- public static int readInt() {
- return cfg.getInt("MongoDB.Port");
+ public static int readInt(String path) {
+ return cfg.getInt(path);
}
/**
diff --git a/src/main/java/eu/univento/core/api/Utils.java b/src/main/java/eu/univento/core/api/Utils.java
index 7b53db6..d2566fe 100644
--- a/src/main/java/eu/univento/core/api/Utils.java
+++ b/src/main/java/eu/univento/core/api/Utils.java
@@ -2,6 +2,7 @@ package eu.univento.core.api;
import eu.univento.core.Core;
+import eu.univento.core.api.player.CustomPlayer;
import org.bukkit.*;
import org.bukkit.entity.Entity;
import org.bukkit.entity.Player;
@@ -14,157 +15,174 @@ import java.util.List;
/**
* some utils you may need
+ *
* @author joethei
* @version 1.0
*/
public class Utils {
-
- /**
- * plays sound for all players
- * @param s Sound
- */
- public static void playSoundToAll(Sound s) {
- for (Player all : Bukkit.getOnlinePlayers())
- all.playSound(all.getLocation(), s, 3.0F, 3.0F);
- }
-
- /**
- * plays effect for all players
- * @param e Effect
- */
- @SuppressWarnings("deprecation")
- public static void playEffectToAll(Effect e) {
- for (Player all : Bukkit.getOnlinePlayers())
- all.playEffect(all.getLocation(), e, 3);
- }
-
- /**
- * checks if server version is from spigot
- * @return true/false
- */
- public static boolean isSpigot() {
- return Bukkit.getVersion().contains("Spigot");
- }
-
- /**
- * deletes all folders and files in directory
- * @param file File
- */
- private static void deleteDir(File file) {
- if (file.isDirectory()) {
- if (file.list().length == 0) {
- file.delete();
- } else {
- String[] files = file.list();
- for (String tmp : files) {
- File fileDelete = new File(file, tmp);
- deleteDir(fileDelete);
- }
- if (file.list().length == 0)
- file.delete();
- }
- } else
- file.delete();
- }
- /**
- * creates a random number
- * @param low lowest possible value
- * @param high highest possible value
- * @return double
- */
- public static double random(int low, int high) {
- return Math.random() * (high - low) + low;
- }
+ /**
+ * plays sound for all players
+ *
+ * @param s Sound
+ */
+ public static void playSoundToAll(Sound s) {
+ for (Player all : Bukkit.getOnlinePlayers())
+ all.playSound(all.getLocation(), s, 3.0F, 3.0F);
+ }
- /**
- * checks if player has empty inventory
- * @param p Player
- * @return true/false
- */
- public static boolean hasEmptyInventory(Player p) {
- for (ItemStack item : p.getInventory().getContents()) {
- if ((item != null) && (item.getType() != Material.AIR))
- return false;
- }
- for (ItemStack item : p.getInventory().getArmorContents()) {
- if ((item != null) && (item.getType() != Material.AIR))
- return false;
- }
- return true;
- }
+ /**
+ * plays effect for all players
+ *
+ * @param e Effect
+ */
+ @SuppressWarnings("deprecation")
+ public static void playEffectToAll(Effect e) {
+ for (Player all : Bukkit.getOnlinePlayers())
+ all.playEffect(all.getLocation(), e, 3);
+ }
+
+ /**
+ * checks if server version is from spigot
+ *
+ * @return true/false
+ */
+ public static boolean isSpigot() {
+ return Bukkit.getVersion().contains("Spigot");
+ }
+
+ /**
+ * deletes all folders and files in directory
+ *
+ * @param file File
+ */
+ private static void deleteDir(File file) {
+ if (file.isDirectory()) {
+ if (file.list().length == 0) {
+ file.delete();
+ } else {
+ String[] files = file.list();
+ for (String tmp : files) {
+ File fileDelete = new File(file, tmp);
+ deleteDir(fileDelete);
+ }
+ if (file.list().length == 0)
+ file.delete();
+ }
+ } else
+ file.delete();
+ }
+
+ /**
+ * creates a random number
+ *
+ * @param low lowest possible value
+ * @param high highest possible value
+ * @return double
+ */
+ public static double random(int low, int high) {
+ return Math.random() * (high - low) + low;
+ }
+
+ /**
+ * checks if player has empty inventory
+ *
+ * @param p Player
+ * @return true/false
+ */
+ public static boolean hasEmptyInventory(Player p) {
+ for (ItemStack item : p.getInventory().getContents()) {
+ if ((item != null) && (item.getType() != Material.AIR))
+ return false;
+ }
+ for (ItemStack item : p.getInventory().getArmorContents()) {
+ if ((item != null) && (item.getType() != Material.AIR))
+ return false;
+ }
+ return true;
+ }
- /**
- * removes list of entity and counts them
- * @param e List
- * @return Integer
- */
- public static int removeEntitys(List e) {
- int i = 0;
- for (Entity en : e) {
- en.remove();
- i++;
- }
- return i;
- }
+ /**
+ * removes list of entity and counts them
+ *
+ * @param e Entity list
+ * @return Integer
+ */
+ public static int removeEntitys(List e) {
+ int i = 0;
+ for (Entity en : e) {
+ en.remove();
+ i++;
+ }
+ return i;
+ }
- /**
- * clears all potion effects from player
- * @param player Player
- */
- public static void clearPotionEffects(Player player) {
- for (PotionEffect effect : player.getActivePotionEffects())
- player.removePotionEffect(effect.getType());
- }
+ /**
+ * clears all potion effects from player
+ *
+ * @param player Player
+ */
+ public static void clearPotionEffects(Player player) {
+ for (PotionEffect effect : player.getActivePotionEffects())
+ player.removePotionEffect(effect.getType());
+ }
- /**
- * calculates vector from one location to another
- * @param from Location
- * @param to Location
- * @return Vector
- */
- public static Vector calculateVector(Location from, Location to) {
- Location b = to;
+ /**
+ * calculates vector from one location to another
+ *
+ * @param from Location
+ * @param to Location
+ * @return Vector
+ */
+ public static Vector calculateVector(Location from, Location to) {
+ Location b = to;
- // calculate the distance between the locations (a => from || b => to)
- double dX = from.getX() - b.getX();
- double dY = from.getY() - b.getY();
- double dZ = from.getZ() - b.getZ();
- // -------------------------
+ // calculate the distance between the locations (a => from || b => to)
+ double dX = from.getX() - b.getX();
+ double dY = from.getY() - b.getY();
+ double dZ = from.getZ() - b.getZ();
+ // -------------------------
- // calculate the yaw
- double yaw = Math.atan2(dZ, dX);
- // -------------------------
+ // calculate the yaw
+ double yaw = Math.atan2(dZ, dX);
+ // -------------------------
- // calculate the pitch
- double pitch = Math.atan2(Math.sqrt(dZ * dZ + dX * dX), dY) + Math.PI;
- // -------------------------
+ // calculate the pitch
+ double pitch = Math.atan2(Math.sqrt(dZ * dZ + dX * dX), dY) + Math.PI;
+ // -------------------------
- // calculate and create the new vector
- double x = Math.sin(pitch) * Math.cos(yaw);
- double y = Math.sin(pitch) * Math.sin(yaw);
- double z = Math.cos(pitch);
+ // calculate and create the new vector
+ double x = Math.sin(pitch) * Math.cos(yaw);
+ double y = Math.sin(pitch) * Math.sin(yaw);
+ double z = Math.cos(pitch);
// -------------------------
- return new Vector(x, z, y);
- }
-
- /**
- * restarts server
- */
- public static void restart() {
- Bukkit.getScheduler().scheduleSyncDelayedTask(Core.getInstance(), () -> Bukkit.spigot().restart(), 10 * 20L);
- }
-
- /**
- * shots random firework at specified location
- * @param loc Location
- */
- public static void randomFirework(Location loc) {
- FireworkEffect.Builder builder = FireworkEffect.builder();
- FireworkEffect effect = builder.flicker(false).trail(false).with(FireworkEffect.Type.BALL_LARGE).withColor(Color.RED).withFade(Color.BLUE).build();
- //TODO: make a random fireworks effect
- }
+ return new Vector(x, z, y);
+ }
+
+ /**
+ * restarts server
+ */
+ public static void restart() {
+ Bukkit.getScheduler().scheduleSyncDelayedTask(Core.getInstance(), () -> {
+ if(Core.getOnlinePlayers().size() != 0) {
+ for(CustomPlayer players : Core.getOnlinePlayers())
+ players.connectToServer("Lobby01");
+ }
+ Bukkit.spigot().restart();
+ }, 10 * 20L);
+ }
+
+ /**
+ * shots random firework at specified location
+ *
+ * @param loc Location
+ */
+ public static void randomFirework(Location loc) {
+ FireworkEffect.Builder builder = FireworkEffect.builder();
+ FireworkEffect effect = builder.flicker(false).trail(false).with(FireworkEffect.Type.BALL_LARGE).withColor(Color.RED).withFade(Color.BLUE).build();
+ //TODO: make a random fireworks effect
+ }
}
\ No newline at end of file
diff --git a/src/main/java/eu/univento/core/api/blocks/banners/BannerColor.java b/src/main/java/eu/univento/core/api/blocks/banners/BannerColor.java
new file mode 100644
index 0000000..42e602d
--- /dev/null
+++ b/src/main/java/eu/univento/core/api/blocks/banners/BannerColor.java
@@ -0,0 +1,46 @@
+package eu.univento.core.api.blocks.banners;
+
+import org.bukkit.DyeColor;
+
+/**
+ * @author tschuliaehn
+ * @version 1.0
+ */
+
+public enum BannerColor {
+ BLACK('0', DyeColor.BLACK), BLUE('1', DyeColor.BLUE), BROWN('g', DyeColor.BROWN), CYAN('3', DyeColor.CYAN), GRAY('8', DyeColor.GRAY), GREEN('2', DyeColor.GREEN), LIGHT_BLUE('b', DyeColor.LIGHT_BLUE), LIME('a', DyeColor.LIME), MAGENTA('c', DyeColor.MAGENTA), ORANGE('6', DyeColor.ORANGE), PINK('d', DyeColor.PINK), PURPLE('5', DyeColor.PURPLE), RED('4', DyeColor.RED), SILVER('7', DyeColor.SILVER), WHITE('f', DyeColor.WHITE), YELLOW('e', DyeColor.YELLOW);
+
+ private char colorCode;
+ private DyeColor color;
+ public static final char COLORCODE = '§';
+ public static final char FOREGROUND_COLORCODE = 'F';
+ public static final char BACKGROUND_COLORCODE = 'B';
+
+ private BannerColor(char colorCode, DyeColor color) {
+ this.colorCode = colorCode;
+ this.color = color;
+ }
+
+ public char getColorCode() {
+ return this.colorCode;
+ }
+
+ public DyeColor getColor() {
+ return this.color;
+ }
+
+ public static BannerColor translate(char color) {
+ BannerColor[] arrayOfBannerColor;
+ int j = (arrayOfBannerColor = values()).length;
+ for (int i = 0; i < j; i++) {
+ BannerColor colors = arrayOfBannerColor[i];
+ if (colors.getColorCode() == color) {
+ return colors;
+ }
+ }
+ return WHITE;
+ }
+
+ public static final BannerColor NORMAL_FOREGROUND = WHITE;
+ public static final BannerColor NORMAL_BACKGROUND = BLACK;
+}
diff --git a/src/main/java/eu/univento/core/api/blocks/banners/BannerString.java b/src/main/java/eu/univento/core/api/blocks/banners/BannerString.java
new file mode 100644
index 0000000..27f3ffa
--- /dev/null
+++ b/src/main/java/eu/univento/core/api/blocks/banners/BannerString.java
@@ -0,0 +1,139 @@
+package eu.univento.core.api.blocks.banners;
+
+import org.bukkit.block.Banner;
+
+import java.util.ArrayList;
+import java.util.Collection;
+import java.util.HashMap;
+import java.util.Iterator;
+
+/**
+ * @author tschuliaehn
+ * @version 1.0
+ */
+
+public class BannerString {
+ private HashMap bannerSequence;
+ private boolean autoClear = true;
+ private BannerColor clearColor = BannerColor.WHITE;
+ private BannerColor standardForegroundColor = BannerColor.NORMAL_FOREGROUND;
+ private BannerColor standardBackgroundColor = BannerColor.NORMAL_BACKGROUND;
+
+ public BannerString() {
+ this(new HashMap<>());
+ }
+
+ public BannerString(ArrayList banners) {
+ this.bannerSequence = new HashMap<>();
+ for (int i = 0; i < banners.size(); i++) {
+ this.bannerSequence.put(i, banners.get(i));
+ }
+ }
+
+ public BannerString(HashMap bannerSequence) {
+ this.bannerSequence = bannerSequence;
+ }
+
+ public void insertNextBanner(Banner banner) {
+ Iterator iterator = this.bannerSequence.keySet().iterator();
+ int last = 0;
+ while (iterator.hasNext()) {
+ last = iterator.next();
+ }
+ this.bannerSequence.put(++last, banner);
+ }
+
+ public void draw(String text) {
+ draw(text, 0, 0);
+ }
+
+ public void draw(String text, int skip) {
+ draw(text, skip, 0);
+ }
+
+ public void draw(String text, int skip, int ending) {
+ if (this.autoClear) {
+ clear();
+ }
+ char[] chars = text.toCharArray();
+
+ Collection values = this.bannerSequence.values();
+ Banner[] banners = values.toArray(new Banner[this.bannerSequence.values().size()]);
+
+ BannerColor inUseForeground = this.standardForegroundColor;
+ BannerColor inUseBackground = this.standardBackgroundColor;
+
+ int i = skip;
+ for (int counter = 0; i < banners.length - ending; ) {
+ if (counter == chars.length) {
+ return;
+ }
+ Banner banner = banners[i];
+ char pointed = chars[counter];
+ if ((pointed == '§') && (chars.length > counter + 3)) {
+ char whichSide = chars[(counter + 1)];
+ BannerColor color = BannerColor.translate(chars[(counter + 2)]);
+ if (whichSide == 'F') {
+ inUseForeground = color;
+ counter += 3;
+ continue;
+ }
+ if (whichSide == 'B') {
+ inUseBackground = color;
+ counter += 3;
+ continue;
+ }
+ }
+ ShapeRegistry.paint(Character.toUpperCase(pointed), banner, inUseForeground.getColor(), inUseBackground.getColor());
+ banner.update();
+ counter++;
+ i++;
+ }
+ }
+
+ public void setAutoClear(boolean autoClear) {
+ this.autoClear = autoClear;
+ }
+
+ public void setClearColor(BannerColor clearColor) {
+ this.clearColor = clearColor;
+ }
+
+ public void setStandardForegroundColor(BannerColor standardForegroundColor) {
+ this.standardForegroundColor = standardForegroundColor;
+ }
+
+ public void setStandardBackgroundColor(BannerColor standardBackgroundColor) {
+ this.standardBackgroundColor = standardBackgroundColor;
+ }
+
+ public void clear() {
+ Iterator iterator = this.bannerSequence.values().iterator();
+ while (iterator.hasNext()) {
+ Banner banner = (Banner) iterator.next();
+ banner.setPatterns(new ArrayList());
+ banner.setBaseColor(this.clearColor.getColor());
+ banner.update();
+ }
+ }
+
+ public HashMap getBannerSequence() {
+ return this.bannerSequence;
+ }
+
+ public boolean isAutoClear() {
+ return this.autoClear;
+ }
+
+ public BannerColor getClearColor() {
+ return this.clearColor;
+ }
+
+ public BannerColor getStandardForegroundColor() {
+ return this.standardForegroundColor;
+ }
+
+ public BannerColor getStandardBackgroundColor() {
+ return this.standardBackgroundColor;
+ }
+}
diff --git a/src/main/java/eu/univento/core/api/blocks/banners/FloatingText.java b/src/main/java/eu/univento/core/api/blocks/banners/FloatingText.java
new file mode 100644
index 0000000..8bfd2b3
--- /dev/null
+++ b/src/main/java/eu/univento/core/api/blocks/banners/FloatingText.java
@@ -0,0 +1,70 @@
+package eu.univento.core.api.blocks.banners;
+
+/**
+ * @author tschuliaehn
+ * @version 1.0
+ */
+
+public class FloatingText {
+ private String spacedText;
+
+ public FloatingText(String text, int between) {
+ StringBuilder builder = new StringBuilder();
+ for (int i = 0; i < between; i++) {
+ builder.append(" ");
+ }
+ builder.append(text);
+ this.spacedText = builder.toString();
+ }
+
+ private int pointer = -1;
+ private boolean start = true;
+
+ public String next() {
+ this.pointer += 1;
+
+ int index = this.spacedText.length() - this.pointer;
+
+ StringBuilder builder = new StringBuilder();
+ if (index < 1) {
+ this.pointer = 0;
+ if (this.start) {
+ this.start = false;
+ }
+ }
+ char[] characters = this.spacedText.toCharArray();
+
+ String current = "";
+ boolean changed = false;
+ for (int i = 0; i < index; i++) {
+ if ((characters[i] == '§') &&
+ (characters[(i + 1)] == 'F')) {
+ current = String.valueOf(characters[i] + characters[(i + 1)] + characters[(i + 2)]);
+ if ((i == index) || (i + 1 == index) || (i + 2 == index)) {
+ this.pointer += index - i;
+ changed = true;
+ break;
+ }
+ }
+ }
+ String currentBackground = "";
+ for (int i = 0; i < index; i++) {
+ if ((characters[i] == '§') &&
+ (characters[(i + 1)] == 'B')) {
+ currentBackground = String.valueOf(characters[i] + characters[(i + 1)] + characters[(i + 2)]);
+ if ((i == index) || (i + 1 == index) || (i + 2 == index)) {
+ this.pointer += index - i;
+ changed = true;
+ break;
+ }
+ }
+ }
+ builder.append(current + currentBackground);
+
+ builder.append(changed ? next() : this.spacedText.substring(index, this.spacedText.length()));
+ if (!this.start) {
+ builder.append(this.spacedText);
+ }
+ return builder.toString();
+ }
+}
diff --git a/src/main/java/eu/univento/core/api/blocks/banners/Shape.java b/src/main/java/eu/univento/core/api/blocks/banners/Shape.java
new file mode 100644
index 0000000..860e018
--- /dev/null
+++ b/src/main/java/eu/univento/core/api/blocks/banners/Shape.java
@@ -0,0 +1,12 @@
+package eu.univento.core.api.blocks.banners;
+
+import org.bukkit.DyeColor;
+import org.bukkit.block.Banner;
+
+/**
+ * @author tschuliaehn
+ * @version 1.0
+ */
+public abstract interface Shape {
+ public abstract void draw(Banner paramBanner, DyeColor paramDyeColor1, DyeColor paramDyeColor2);
+}
diff --git a/src/main/java/eu/univento/core/api/blocks/banners/ShapeRegistry.java b/src/main/java/eu/univento/core/api/blocks/banners/ShapeRegistry.java
new file mode 100644
index 0000000..797ae33
--- /dev/null
+++ b/src/main/java/eu/univento/core/api/blocks/banners/ShapeRegistry.java
@@ -0,0 +1,217 @@
+package eu.univento.core.api.blocks.banners;
+
+import org.bukkit.DyeColor;
+import org.bukkit.block.Banner;
+import org.bukkit.block.banner.Pattern;
+import org.bukkit.block.banner.PatternType;
+
+import java.util.HashMap;
+
+/**
+ * @author tschuliaehn
+ * @version 1.0
+ */
+
+public class ShapeRegistry {
+ private static HashMap shapes = new HashMap<>();
+
+ static {
+ shapes.put('A', (banner, foreground, background) -> {
+ banner.setBaseColor(background);
+ banner.addPattern(new Pattern(foreground, PatternType.STRIPE_TOP));
+ banner.addPattern(new Pattern(foreground, PatternType.STRIPE_LEFT));
+ banner.addPattern(new Pattern(foreground, PatternType.STRIPE_RIGHT));
+ banner.addPattern(new Pattern(foreground, PatternType.STRIPE_MIDDLE));
+ });
+ shapes.put('B', (banner, foreground, background) -> {
+ banner.setBaseColor(background);
+ banner.addPattern(new Pattern(foreground, PatternType.STRIPE_TOP));
+ banner.addPattern(new Pattern(foreground, PatternType.STRIPE_LEFT));
+ banner.addPattern(new Pattern(foreground, PatternType.STRIPE_RIGHT));
+ banner.addPattern(new Pattern(foreground, PatternType.STRIPE_MIDDLE));
+ banner.addPattern(new Pattern(foreground, PatternType.STRIPE_BOTTOM));
+ });
+ shapes.put('C', (banner, foreground, background) -> {
+ banner.setBaseColor(background);
+ banner.addPattern(new Pattern(foreground, PatternType.STRIPE_LEFT));
+ banner.addPattern(new Pattern(foreground, PatternType.STRIPE_TOP));
+ banner.addPattern(new Pattern(foreground, PatternType.STRIPE_BOTTOM));
+ });
+ shapes.put('D', (banner, foreground, background) -> {
+ banner.setBaseColor(foreground);
+ banner.addPattern(new Pattern(background, PatternType.RHOMBUS_MIDDLE));
+ banner.addPattern(new Pattern(foreground, PatternType.STRIPE_TOP));
+ banner.addPattern(new Pattern(foreground, PatternType.STRIPE_BOTTOM));
+ banner.addPattern(new Pattern(foreground, PatternType.STRIPE_LEFT));
+ });
+ shapes.put('E', (banner, foreground, background) -> {
+ banner.setBaseColor(background);
+ banner.addPattern(new Pattern(foreground, PatternType.STRIPE_MIDDLE));
+ banner.addPattern(new Pattern(background, PatternType.STRIPE_RIGHT));
+ banner.addPattern(new Pattern(foreground, PatternType.STRIPE_BOTTOM));
+ banner.addPattern(new Pattern(foreground, PatternType.STRIPE_TOP));
+ banner.addPattern(new Pattern(foreground, PatternType.STRIPE_LEFT));
+ });
+ shapes.put('F', (banner, foreground, background) -> {
+ banner.setBaseColor(background);
+ banner.addPattern(new Pattern(foreground, PatternType.STRIPE_MIDDLE));
+ banner.addPattern(new Pattern(background, PatternType.STRIPE_RIGHT));
+ banner.addPattern(new Pattern(foreground, PatternType.STRIPE_LEFT));
+ banner.addPattern(new Pattern(foreground, PatternType.STRIPE_TOP));
+ });
+ shapes.put('G', (banner, foreground, background) -> {
+ banner.setBaseColor(background);
+ banner.addPattern(new Pattern(foreground, PatternType.STRIPE_RIGHT));
+ banner.addPattern(new Pattern(background, PatternType.HALF_HORIZONTAL));
+ banner.addPattern(new Pattern(foreground, PatternType.STRIPE_BOTTOM));
+ banner.addPattern(new Pattern(foreground, PatternType.STRIPE_LEFT));
+ banner.addPattern(new Pattern(foreground, PatternType.STRIPE_TOP));
+ });
+ shapes.put('H', (banner, foreground, background) -> {
+ banner.setBaseColor(foreground);
+ banner.addPattern(new Pattern(background, PatternType.STRIPE_TOP));
+ banner.addPattern(new Pattern(background, PatternType.STRIPE_BOTTOM));
+ banner.addPattern(new Pattern(foreground, PatternType.STRIPE_LEFT));
+ banner.addPattern(new Pattern(foreground, PatternType.STRIPE_RIGHT));
+ });
+ shapes.put('I', (banner, foreground, background) -> {
+ banner.setBaseColor(background);
+ banner.addPattern(new Pattern(foreground, PatternType.STRIPE_BOTTOM));
+ banner.addPattern(new Pattern(foreground, PatternType.STRIPE_TOP));
+ banner.addPattern(new Pattern(foreground, PatternType.STRIPE_CENTER));
+ });
+ shapes.put('J', (banner, foreground, background) -> {
+ banner.setBaseColor(background);
+ banner.addPattern(new Pattern(foreground, PatternType.STRIPE_LEFT));
+ banner.addPattern(new Pattern(background, PatternType.HALF_HORIZONTAL));
+ banner.addPattern(new Pattern(foreground, PatternType.STRIPE_BOTTOM));
+ banner.addPattern(new Pattern(foreground, PatternType.STRIPE_RIGHT));
+ });
+ shapes.put('K', (banner, foreground, background) -> {
+ banner.setBaseColor(background);
+ banner.addPattern(new Pattern(foreground, PatternType.STRIPE_MIDDLE));
+ banner.addPattern(new Pattern(background, PatternType.STRIPE_RIGHT));
+ banner.addPattern(new Pattern(foreground, PatternType.STRIPE_DOWNLEFT));
+ banner.addPattern(new Pattern(foreground, PatternType.STRIPE_DOWNRIGHT));
+ banner.addPattern(new Pattern(foreground, PatternType.STRIPE_LEFT));
+ });
+ shapes.put('L', (banner, foreground, background) -> {
+ banner.setBaseColor(background);
+ banner.addPattern(new Pattern(foreground, PatternType.STRIPE_LEFT));
+ banner.addPattern(new Pattern(foreground, PatternType.STRIPE_BOTTOM));
+ });
+ shapes.put('M', (banner, foreground, background) -> {
+ banner.setBaseColor(background);
+ banner.addPattern(new Pattern(foreground, PatternType.TRIANGLE_TOP));
+ banner.addPattern(new Pattern(background, PatternType.CURLY_BORDER));
+ banner.addPattern(new Pattern(foreground, PatternType.STRIPE_LEFT));
+ banner.addPattern(new Pattern(foreground, PatternType.STRIPE_RIGHT));
+ });
+ shapes.put('N', (banner, foreground, background) -> {
+ banner.setBaseColor(background);
+ banner.addPattern(new Pattern(foreground, PatternType.STRIPE_LEFT));
+ banner.addPattern(new Pattern(background, PatternType.TRIANGLE_TOP));
+ banner.addPattern(new Pattern(foreground, PatternType.STRIPE_RIGHT));
+ banner.addPattern(new Pattern(foreground, PatternType.STRIPE_DOWNRIGHT));
+ });
+ shapes.put('O', (banner, foreground, background) -> {
+ banner.setBaseColor(background);
+ banner.addPattern(new Pattern(foreground, PatternType.STRIPE_TOP));
+ banner.addPattern(new Pattern(foreground, PatternType.STRIPE_RIGHT));
+ banner.addPattern(new Pattern(foreground, PatternType.STRIPE_BOTTOM));
+ banner.addPattern(new Pattern(foreground, PatternType.STRIPE_LEFT));
+ });
+ shapes.put('P', (banner, foreground, background) -> {
+ banner.setBaseColor(foreground);
+ banner.addPattern(new Pattern(background, PatternType.HALF_HORIZONTAL));
+ banner.addPattern(new Pattern(foreground, PatternType.STRIPE_RIGHT));
+ banner.addPattern(new Pattern(background, PatternType.STRIPE_BOTTOM));
+ banner.addPattern(new Pattern(foreground, PatternType.STRIPE_TOP));
+ banner.addPattern(new Pattern(foreground, PatternType.STRIPE_LEFT));
+ });
+ shapes.put('Q', (banner, foreground, background) -> {
+ banner.setBaseColor(background);
+ banner.addPattern(new Pattern(foreground, PatternType.STRIPE_DOWNRIGHT));
+ banner.addPattern(new Pattern(background, PatternType.HALF_HORIZONTAL));
+ banner.addPattern(new Pattern(foreground, PatternType.STRIPE_LEFT));
+ banner.addPattern(new Pattern(foreground, PatternType.STRIPE_BOTTOM));
+ banner.addPattern(new Pattern(foreground, PatternType.STRIPE_RIGHT));
+ banner.addPattern(new Pattern(foreground, PatternType.STRIPE_TOP));
+ });
+ shapes.put('R', (banner, foreground, background) -> {
+ banner.setBaseColor(foreground);
+ banner.addPattern(new Pattern(background, PatternType.HALF_HORIZONTAL_MIRROR));
+ banner.addPattern(new Pattern(foreground, PatternType.STRIPE_DOWNRIGHT));
+ banner.addPattern(new Pattern(background, PatternType.HALF_VERTICAL));
+ banner.addPattern(new Pattern(foreground, PatternType.STRIPE_LEFT));
+ banner.addPattern(new Pattern(foreground, PatternType.STRIPE_TOP));
+ banner.addPattern(new Pattern(foreground, PatternType.STRIPE_MIDDLE));
+ });
+ shapes.put('S', (banner, foreground, background) -> {
+ banner.setBaseColor(background);
+ banner.addPattern(new Pattern(foreground, PatternType.TRIANGLE_TOP));
+ banner.addPattern(new Pattern(foreground, PatternType.TRIANGLE_BOTTOM));
+ banner.addPattern(new Pattern(foreground, PatternType.SQUARE_TOP_RIGHT));
+ banner.addPattern(new Pattern(foreground, PatternType.SQUARE_BOTTOM_LEFT));
+ banner.addPattern(new Pattern(background, PatternType.RHOMBUS_MIDDLE));
+ banner.addPattern(new Pattern(foreground, PatternType.STRIPE_DOWNRIGHT));
+ });
+ shapes.put('T', (banner, foreground, background) -> {
+ banner.setBaseColor(background);
+ banner.addPattern(new Pattern(foreground, PatternType.STRIPE_CENTER));
+ banner.addPattern(new Pattern(foreground, PatternType.STRIPE_TOP));
+ });
+ shapes.put('U', (banner, foreground, background) -> {
+ banner.setBaseColor(background);
+ banner.addPattern(new Pattern(foreground, PatternType.STRIPE_BOTTOM));
+ banner.addPattern(new Pattern(foreground, PatternType.STRIPE_RIGHT));
+ banner.addPattern(new Pattern(foreground, PatternType.STRIPE_LEFT));
+ });
+ shapes.put('V', (banner, foreground, background) -> {
+ banner.setBaseColor(background);
+ banner.addPattern(new Pattern(foreground, PatternType.STRIPE_LEFT));
+ banner.addPattern(new Pattern(background, PatternType.TRIANGLE_BOTTOM));
+ banner.addPattern(new Pattern(foreground, PatternType.STRIPE_DOWNLEFT));
+ });
+ shapes.put('W', (banner, foreground, background) -> {
+ banner.setBaseColor(background);
+ banner.addPattern(new Pattern(foreground, PatternType.TRIANGLE_BOTTOM));
+ banner.addPattern(new Pattern(background, PatternType.CURLY_BORDER));
+ banner.addPattern(new Pattern(foreground, PatternType.STRIPE_RIGHT));
+ banner.addPattern(new Pattern(foreground, PatternType.STRIPE_LEFT));
+ });
+ shapes.put('X', (banner, foreground, background) -> {
+ banner.setBaseColor(background);
+ banner.addPattern(new Pattern(foreground, PatternType.STRIPE_DOWNLEFT));
+ banner.addPattern(new Pattern(foreground, PatternType.STRIPE_DOWNRIGHT));
+ });
+ shapes.put('Y', (banner, foreground, background) -> {
+ banner.setBaseColor(background);
+ banner.addPattern(new Pattern(foreground, PatternType.STRIPE_DOWNRIGHT));
+ banner.addPattern(new Pattern(background, PatternType.HALF_VERTICAL_MIRROR));
+ banner.addPattern(new Pattern(foreground, PatternType.STRIPE_DOWNLEFT));
+ });
+ shapes.put('Z', (banner, foreground, background) -> {
+ banner.setBaseColor(background);
+ banner.addPattern(new Pattern(foreground, PatternType.TRIANGLE_TOP));
+ banner.addPattern(new Pattern(foreground, PatternType.TRIANGLE_BOTTOM));
+ banner.addPattern(new Pattern(foreground, PatternType.SQUARE_TOP_LEFT));
+ banner.addPattern(new Pattern(foreground, PatternType.SQUARE_BOTTOM_RIGHT));
+ banner.addPattern(new Pattern(background, PatternType.RHOMBUS_MIDDLE));
+ banner.addPattern(new Pattern(foreground, PatternType.STRIPE_DOWNLEFT));
+ });
+ shapes.put(' ', (banner, foreground, background) -> banner.setBaseColor(background));
+ }
+
+ public static void addShape(Character character, Shape shape) {
+ shapes.put(character, shape);
+ }
+
+ public static void paint(char character, Banner banner, DyeColor foreground, DyeColor background) {
+ getShape(character).draw(banner, foreground, background);
+ }
+
+ public static Shape getShape(char character) {
+ return shapes.containsKey(character) ? shapes.get(character) : shapes.get(' ');
+ }
+}
diff --git a/src/main/java/eu/univento/core/api/customitems/CustomArmor.java b/src/main/java/eu/univento/core/api/customitems/CustomArmor.java
index 5aba137..43d61d0 100644
--- a/src/main/java/eu/univento/core/api/customitems/CustomArmor.java
+++ b/src/main/java/eu/univento/core/api/customitems/CustomArmor.java
@@ -3,7 +3,6 @@ package eu.univento.core.api.customitems;
/**
* @author joethei
* @version 0.1
- * Created at 20:40 on 12.07.2016.
*/
public class CustomArmor {
diff --git a/src/main/java/eu/univento/core/api/customitems/CustomItemManager.java b/src/main/java/eu/univento/core/api/customitems/CustomItemManager.java
index 7971c2c..8ce9010 100644
--- a/src/main/java/eu/univento/core/api/customitems/CustomItemManager.java
+++ b/src/main/java/eu/univento/core/api/customitems/CustomItemManager.java
@@ -3,7 +3,6 @@ package eu.univento.core.api.customitems;
/**
* @author joethei
* @version 0.1
- * Created at 20:39 on 12.07.2016.
*/
public class CustomItemManager {
diff --git a/src/main/java/eu/univento/core/api/customitems/swords/BestSwordEver.java b/src/main/java/eu/univento/core/api/customitems/swords/BestSwordEver.java
index e4bf25b..3161f66 100644
--- a/src/main/java/eu/univento/core/api/customitems/swords/BestSwordEver.java
+++ b/src/main/java/eu/univento/core/api/customitems/swords/BestSwordEver.java
@@ -12,7 +12,6 @@ import org.bukkit.potion.PotionEffectType;
/**
* @author joethei
* @version 0.1
- * Created at 20:44 on 12.07.2016.
*/
public class BestSwordEver extends CustomSword {
diff --git a/src/main/java/eu/univento/core/api/customitems/swords/CustomSword.java b/src/main/java/eu/univento/core/api/customitems/swords/CustomSword.java
index 9cbd5a5..946423a 100644
--- a/src/main/java/eu/univento/core/api/customitems/swords/CustomSword.java
+++ b/src/main/java/eu/univento/core/api/customitems/swords/CustomSword.java
@@ -7,7 +7,6 @@ import org.bukkit.inventory.ItemStack;
/**
* @author joethei
* @version 0.1
- * Created at 20:41 on 12.07.2016.
*/
public class CustomSword{
diff --git a/src/main/java/eu/univento/core/api/customitems/swords/CustomSwordManager.java b/src/main/java/eu/univento/core/api/customitems/swords/CustomSwordManager.java
index 2ed643a..bdec69c 100644
--- a/src/main/java/eu/univento/core/api/customitems/swords/CustomSwordManager.java
+++ b/src/main/java/eu/univento/core/api/customitems/swords/CustomSwordManager.java
@@ -8,7 +8,6 @@ import java.util.List;
/**
* @author joethei
* @version 1.0
- * Created at 20:56 on 12.07.2016.
*/
public class CustomSwordManager {
diff --git a/src/main/java/eu/univento/core/api/database/AsyncMongoDB.java b/src/main/java/eu/univento/core/api/database/AsyncMongoDB.java
deleted file mode 100644
index 9679e8b..0000000
--- a/src/main/java/eu/univento/core/api/database/AsyncMongoDB.java
+++ /dev/null
@@ -1,47 +0,0 @@
-package eu.univento.core.api.database;
-
-
-import com.mongodb.MongoCredential;
-import com.mongodb.ServerAddress;
-import com.mongodb.async.client.MongoClient;
-import com.mongodb.async.client.MongoClientSettings;
-import com.mongodb.async.client.MongoClients;
-import com.mongodb.async.client.MongoDatabase;
-import com.mongodb.connection.ClusterSettings;
-import eu.univento.core.api.Config;
-
-import java.util.ArrayList;
-import java.util.List;
-
-public class AsyncMongoDB {
-
- private final MongoClient client;
- private MongoDatabase database;
-
- public AsyncMongoDB(String host, int port, String username, String password, String database) {
- List addressList = new ArrayList<>();
- addressList.add(new ServerAddress(host, port));
- List credentials = new ArrayList<>();
- credentials.add(MongoCredential.createCredential(username, database, password.toCharArray()));
- ClusterSettings clusterSettings = ClusterSettings.builder().hosts(addressList).build();
- MongoClientSettings settings = MongoClientSettings.builder().clusterSettings(clusterSettings).credentialList(credentials).build();
- client = MongoClients.create(settings);
- }
-
- private MongoClient getClient() {
- if(client == null)
- new AsyncMongoDB(Config.readString("MongoDB.Host"), Config.readInt(), Config.readString("MongoDB.User"), Config.readString("MongoDB.Password"), Config.readString("MongoDB.Database"));
- return client;
- }
-
- public MongoDatabase getDatabase() {
- if(database == null)
- database = getClient().getDatabase(Config.readString("MongoDB.Database"));
- return database;
- }
-
- public void closeConnection() {
- if(client != null)
- client.close();
- }
-}
\ No newline at end of file
diff --git a/src/main/java/eu/univento/core/api/database/AsyncMySQL.java b/src/main/java/eu/univento/core/api/database/AsyncMySQL.java
deleted file mode 100644
index 1234498..0000000
--- a/src/main/java/eu/univento/core/api/database/AsyncMySQL.java
+++ /dev/null
@@ -1,46 +0,0 @@
-package eu.univento.core.api.database;
-
-import org.bukkit.Bukkit;
-import org.bukkit.plugin.Plugin;
-
-import java.sql.*;
-import java.util.concurrent.ExecutorService;
-import java.util.concurrent.Executors;
-import java.util.function.Consumer;
-
-/**
- * @author joethei
- * @version 0.1
- */
-public class AsyncMySQL {
- private ExecutorService executor;
- private Plugin plugin;
- private MySQL sql;
-
- public AsyncMySQL(Plugin owner, String host, String port, String user, String password, String database) {
- try {
- sql = new MySQL(owner, host, port, user, password, database);
- executor = Executors.newCachedThreadPool();
- plugin = owner;
- } catch (Exception e) {
- e.printStackTrace();
- }
- }
-
- public void update(String update) {
- executor.execute(() -> sql.query(update));
- }
-
- public void query(String query, Consumer consumer) {
- executor.execute(() -> {
- ResultSet result = null;
- result = sql.query(query);
- ResultSet finalResult = result;
- Bukkit.getScheduler().runTask(plugin, () -> consumer.accept(finalResult));
- });
- }
-
- public MySQL getMySQL() {
- return sql;
- }
-}
\ No newline at end of file
diff --git a/src/main/java/eu/univento/core/api/database/Database.java b/src/main/java/eu/univento/core/api/database/Database.java
deleted file mode 100644
index 40856c8..0000000
--- a/src/main/java/eu/univento/core/api/database/Database.java
+++ /dev/null
@@ -1,57 +0,0 @@
-package eu.univento.core.api.database;
-
-import org.bukkit.plugin.Plugin;
-
-import java.sql.*;
-
-abstract class Database {
- Connection connection;
- final Plugin plugin;
-
- Database(Plugin plugin) {
- this.plugin = plugin;
- this.connection = null;
- }
-
- protected abstract Connection openConnection()
- throws SQLException, ClassNotFoundException;
-
- boolean checkConnection()
- throws SQLException {
- return (this.connection != null) && (!this.connection.isClosed());
- }
-
- public Connection getConnection() {
- return this.connection;
- }
-
- public void closeConnection()
- throws SQLException {
- if (this.connection == null) {
- return;
- }
- this.connection.close();
- }
-
- public ResultSet query(String query)
- throws SQLException, ClassNotFoundException {
- if (!checkConnection()) {
- openConnection();
- }
-
- PreparedStatement statement = this.connection.prepareStatement(query);
-
- return statement.executeQuery();
- }
-
- public int update(String query)
- throws SQLException, ClassNotFoundException {
- if (!checkConnection()) {
- openConnection();
- }
-
- PreparedStatement statement = this.connection.prepareStatement(query);
-
- return statement.executeUpdate();
- }
-}
\ No newline at end of file
diff --git a/src/main/java/eu/univento/core/api/database/DatabaseManager.java b/src/main/java/eu/univento/core/api/database/DatabaseManager.java
deleted file mode 100644
index 8f42bec..0000000
--- a/src/main/java/eu/univento/core/api/database/DatabaseManager.java
+++ /dev/null
@@ -1,47 +0,0 @@
-package eu.univento.core.api.database;
-
-import eu.univento.core.api.Config;
-import org.bukkit.plugin.Plugin;
-
-/**
- * @author joethei
- * @version 0.1
- * created on 03.07.2016
- */
-public class DatabaseManager {
-
- private static AsyncMongoDB asyncMongoDB;
- private static MongoDB mongoDB;
- private static AsyncMySQL asyncMySQL;
- private static MySQL mysql;
-
- public DatabaseManager(Plugin plugin) {
- asyncMongoDB = new AsyncMongoDB(Config.readString("MongoDB.Host"), Config.readInt(), Config.readString("MongoDB.User"), Config.readString("MongoDB.Password"), Config.readString("MongoDB.Database"));
- mongoDB = new MongoDB(Config.readString("MongoDB.Host"), Config.readInt(), Config.readString("MongoDB.User"), Config.readString("MongoDB.Password"), Config.readString("MongoDB.Database"));
- mysql = new MySQL(plugin, Config.readString("MySQL.Host"), Config.readString("MySQL.Port"), Config.readString("MySQL.DB"), Config.readString("MySQL.User"), Config.readString("MySQL.Pass"));
- asyncMySQL = new AsyncMySQL(plugin, Config.readString("MySQL.Host"), Config.readString("MySQL.Port"), Config.readString("MySQL.DB"), Config.readString("MySQL.User"), Config.readString("MySQL.Pass"));
- }
-
- public void closeConnections() {
- asyncMongoDB.closeConnection();
- mongoDB.closeConnection();
- mysql.close();
- asyncMySQL.getMySQL().close();
- }
-
- public AsyncMongoDB getAsyncMongoDB() {
- return asyncMongoDB;
- }
-
- public MongoDB getMongoDB() {
- return mongoDB;
- }
-
- public MySQL getMySQL() {
- return mysql;
- }
-
- public AsyncMySQL getAsyncMySQL() {
- return asyncMySQL;
- }
-}
\ No newline at end of file
diff --git a/src/main/java/eu/univento/core/api/database/MongoDB.java b/src/main/java/eu/univento/core/api/database/MongoDB.java
deleted file mode 100644
index 72c0a78..0000000
--- a/src/main/java/eu/univento/core/api/database/MongoDB.java
+++ /dev/null
@@ -1,42 +0,0 @@
-package eu.univento.core.api.database;
-
-import com.mongodb.MongoClient;
-import com.mongodb.MongoCredential;
-import com.mongodb.ServerAddress;
-import com.mongodb.client.MongoDatabase;
-import eu.univento.core.api.Config;
-
-import java.util.Collections;
-
-public class MongoDB {
-
- private final MongoClient client;
- private MongoDatabase database;
-
- public MongoDB(String host, int port, String username, String password, String database) {
- MongoCredential credential = MongoCredential.createCredential(username, database, password.toCharArray());
- client = new MongoClient(new ServerAddress(host, port), Collections.singletonList(credential));
- }
-
- private MongoClient getClient() {
- if(client == null)
- new MongoDB(Config.readString("MongoDB.Host"), Config.readInt(), Config.readString("MongoDB.User"), Config.readString("MongoDB.Password"), Config.readString("MongoDB.Database"));
- return client;
- }
-
- public MongoDatabase getDatabase() {
- if(database == null)
- database = getClient().getDatabase(Config.readString("MongoDB.Database"));
- return database;
- }
-
- public void setDatabase(String database) {
- this.database = getClient().getDatabase(database);
- }
-
- public void closeConnection() {
- if(client != null)
- client.close();
- }
-
-}
\ No newline at end of file
diff --git a/src/main/java/eu/univento/core/api/database/MySQL.java b/src/main/java/eu/univento/core/api/database/MySQL.java
deleted file mode 100644
index f825227..0000000
--- a/src/main/java/eu/univento/core/api/database/MySQL.java
+++ /dev/null
@@ -1,104 +0,0 @@
-package eu.univento.core.api.database;
-
-import com.zaxxer.hikari.HikariConfig;
-import com.zaxxer.hikari.HikariDataSource;
-import org.bukkit.plugin.Plugin;
-
-import java.sql.Connection;
-import java.sql.PreparedStatement;
-import java.sql.ResultSet;
-import java.sql.SQLException;
-
-public class MySQL {
-
- private final Plugin plugin;
- private final String username;
- private final String database;
- private final String password;
- private final String port;
- private final String hostname;
-
- private final HikariDataSource dataSource;
-
- public MySQL(Plugin plugin, String hostname, String port, String database, String username, String password) {
- this.plugin = plugin;
- this.username = username;
- this.database = database;
- this.password = password;
- this.port = port;
- this.hostname = hostname;
- HikariConfig config = new HikariConfig();
- config.setJdbcUrl("jdbc:mysql://" + hostname + ":" + port + "/" + database);
- config.setUsername(username);
- config.setPassword(password);
- config.addDataSourceProperty("cachePrepStmts", "true");
- config.addDataSourceProperty("prepStmtCacheSize", "250");
- config.addDataSourceProperty("prepStmtCacheSqlLimit", "2048");
-
- dataSource = new HikariDataSource(config);
- }
-
- void close() {
- dataSource.close();
- }
-
- public HikariDataSource getDataSource() {
- return dataSource;
- }
-
- public Connection getConnection() {
- try {
- if (dataSource.getConnection() != null)
- return dataSource.getConnection();
- } catch (SQLException e) {
- e.printStackTrace();
- }
- return null;
- }
-
- public int update(String sql) {
- try {
- PreparedStatement statement = getConnection().prepareStatement(sql);
- return statement.executeUpdate();
- } catch (SQLException e) {
- e.printStackTrace();
- }
- return 0;
- }
-
- public ResultSet query(String sql) {
- PreparedStatement statement;
- try {
- statement = getConnection().prepareStatement(sql);
- return statement.executeQuery();
- } catch (SQLException e) {
- e.printStackTrace();
- }
- return null;
- }
-
- /*
- private final String user;
- private final String database;
- private final String password;
- private final String port;
- private final String hostname;
-
- public MySQL(Plugin plugin, String hostname, String port, String database, String username, String password) {
- super(plugin);
- this.hostname = hostname;
- this.port = port;
- this.database = database;
- this.user = username;
- this.password = password;
- }
-
- public Connection openConnection() throws SQLException, ClassNotFoundException {
- if (checkConnection())
- return this.connection;
- Class.forName("com.mysql.jdbc.Driver");
- this.connection = DriverManager.getConnection("jdbc:mysql://" + this.hostname + ":" + this.port + "/" + this.database, this.user, this.password);
- return this.connection;
- }
- */
-}
\ No newline at end of file
diff --git a/src/main/java/eu/univento/core/api/effects/Effects.java b/src/main/java/eu/univento/core/api/effects/Effects.java
index f36a14f..2c0beef 100644
--- a/src/main/java/eu/univento/core/api/effects/Effects.java
+++ b/src/main/java/eu/univento/core/api/effects/Effects.java
@@ -1,7 +1,6 @@
package eu.univento.core.api.effects;
import eu.univento.core.Core;
-import eu.univento.core.api.player.CustomPlayer;
import net.minecraft.server.v1_10_R1.EnumParticle;
import net.minecraft.server.v1_10_R1.PacketPlayOutWorldParticles;
import org.bukkit.Location;
@@ -23,7 +22,7 @@ public class Effects {
*/
public static void playEffect(Location loc, EnumParticle ep, int count) {
PacketPlayOutWorldParticles packet = new PacketPlayOutWorldParticles(ep, true, (float) loc.getX(), (float) loc.getY(), (float) loc.getZ(), (float) 5, (float) 5, (float) 5, 0.0F, count, 0, 0);
- Core.getOnlinePlayers().stream().filter(CustomPlayer::hasEffects).forEach(p -> p.getHandle().playerConnection.sendPacket(packet));
+ Core.getOnlinePlayers().stream().filter(players -> players.getDatabasePlayer().getSettings().hasEffectsEnabled()).forEach(players -> players.sendPacket(packet));
}
public static void playEffectToPlayer(Player p, Location loc, EnumParticle ep, float f, int count) {
diff --git a/src/main/java/eu/univento/core/api/effects/ParticleEffect.java b/src/main/java/eu/univento/core/api/effects/ParticleEffect.java
index b83e868..96cbf22 100644
--- a/src/main/java/eu/univento/core/api/effects/ParticleEffect.java
+++ b/src/main/java/eu/univento/core/api/effects/ParticleEffect.java
@@ -632,8 +632,6 @@ public enum ParticleEffect {
* @throws ParticleVersionException If the particle effect is not supported by the server version
* @throws ParticleDataException If the particle effect requires additional data
* @throws IllegalArgumentException If the particle effect is not directional or if it requires water and none is at the center location
- * @see ParticlePacket#ParticlePacket(ParticleEffect, Vector, float, boolean, ParticleData)
- * @see ParticlePacket#sendTo(Location, double)
*/
public void display(Vector direction, float speed, Location center, double range) throws ParticleVersionException, ParticleDataException, IllegalArgumentException {
if (!isSupported()) {
@@ -704,8 +702,6 @@ public enum ParticleEffect {
* @param range Range of the visibility
* @throws ParticleVersionException If the particle effect is not supported by the server version
* @throws ParticleColorException If the particle effect is not colorable or the color type is incorrect
- * @see ParticlePacket#ParticlePacket(ParticleEffect, ParticleColor, boolean)
- * @see ParticlePacket#sendTo(Location, double)
*/
public void display(ParticleColor color, Location center, double range) throws ParticleVersionException, ParticleColorException {
if (!isSupported()) {
@@ -1370,7 +1366,6 @@ public enum ParticleEffect {
* @param longDistance Indicates whether the maximum distance is increased from 256 to 65536
* @param data Data of the effect
* @throws IllegalArgumentException If the speed is lower than 0
- * @see (ParticleEffect, float, float, float, float, int, boolean, ParticleData)
*/
public ParticlePacket(ParticleEffect effect, Vector direction, float speed, boolean longDistance, ParticleData data) throws IllegalArgumentException {
this(effect, (float) direction.getX(), (float) direction.getY(), (float) direction.getZ(), speed, 0, longDistance, data);
@@ -1382,7 +1377,6 @@ public enum ParticleEffect {
* @param effect Particle effect
* @param color Color of the particle
* @param longDistance Indicates whether the maximum distance is increased from 256 to 65536
- * @see(ParticleEffect, float, float, float, float, int, boolean, ParticleData)
*/
public ParticlePacket(ParticleEffect effect, ParticleColor color, boolean longDistance) {
this(effect, color.getValueX(), color.getValueY(), color.getValueZ(), 1, 0, longDistance, null);
diff --git a/src/main/java/eu/univento/core/api/game/PlayerManager.java b/src/main/java/eu/univento/core/api/game/PlayerManager.java
index 0532b74..51370e2 100644
--- a/src/main/java/eu/univento/core/api/game/PlayerManager.java
+++ b/src/main/java/eu/univento/core/api/game/PlayerManager.java
@@ -8,7 +8,6 @@ import java.util.List;
/**
* @author joethei
* @version 0.1
- * Created at 00:00 on 18.07.2016.
*/
public class PlayerManager {
diff --git a/src/main/java/eu/univento/core/api/items/ItemBuilder.java b/src/main/java/eu/univento/core/api/items/ItemBuilder.java
index e721935..c3e43d8 100644
--- a/src/main/java/eu/univento/core/api/items/ItemBuilder.java
+++ b/src/main/java/eu/univento/core/api/items/ItemBuilder.java
@@ -195,7 +195,7 @@ public class ItemBuilder {
}
/**
- * Adds and UnsafeEnchantment to the {@Link} with a level int value of 1.
+ * Adds and UnsafeEnchantment to the {@link} with a level int value of 1.
*
* @param enchantment
* the {@link Enchantment} to add to the ItemStack.
diff --git a/src/main/java/eu/univento/core/api/languages/Language_DE.java b/src/main/java/eu/univento/core/api/languages/Language_DE.java
index 5ce8a3b..e235a78 100644
--- a/src/main/java/eu/univento/core/api/languages/Language_DE.java
+++ b/src/main/java/eu/univento/core/api/languages/Language_DE.java
@@ -1,7 +1,7 @@
package eu.univento.core.api.languages;
+import eu.univento.commons.player.Rank;
import eu.univento.core.api.player.CustomPlayer;
-import eu.univento.core.api.player.Rank;
/**
* @author joethei
@@ -92,7 +92,7 @@ class Language_DE implements Languages{
@Override
public String Core_BAN_BANNED(CustomPlayer p) {
- return "§7Du hast " + p.getColor() + p.getDisplayName() + " §cgebannt";
+ return "§7Du hast " + p.getDatabasePlayer().getRank().getColor() + p.getDisplayName() + " §cgebannt";
}
@Override
@@ -122,7 +122,7 @@ class Language_DE implements Languages{
@Override
public String Core_RUNAS_RUN(CustomPlayer p) {
- return "§7Der Spieler " + p.getColor() + p.getDisplayName() + " §7hat deinen Befehl §eerfolgreich §7ausgeführt";
+ return "§7Der Spieler " + p.getDatabasePlayer().getRank().getColor() + p.getDisplayName() + " §7hat deinen Befehl §eerfolgreich §7ausgeführt";
}
@Override
@@ -171,7 +171,7 @@ class Language_DE implements Languages{
@Override
public String Core_CHAT_CLEARED(CustomPlayer p) {
- return "§7Der Chat wurde von " + p.getColor() + p.getDisplayName() + " §cgereinigt";
+ return "§7Der Chat wurde von " + p.getDatabasePlayer().getRank().getColor() + p.getDisplayName() + " §cgereinigt";
}
@Override
diff --git a/src/main/java/eu/univento/core/api/languages/Language_EN.java b/src/main/java/eu/univento/core/api/languages/Language_EN.java
index 12e844f..68dbb77 100644
--- a/src/main/java/eu/univento/core/api/languages/Language_EN.java
+++ b/src/main/java/eu/univento/core/api/languages/Language_EN.java
@@ -1,7 +1,7 @@
package eu.univento.core.api.languages;
+import eu.univento.commons.player.Rank;
import eu.univento.core.api.player.CustomPlayer;
-import eu.univento.core.api.player.Rank;
/**
* @author joethei
@@ -16,7 +16,7 @@ public class Language_EN implements Languages{
@Override
public String NO_PERMS() {
- return "§cYou're not allowed do use this command";
+ return "§cYou're not allowed do use this commons";
}
@Override
@@ -41,7 +41,7 @@ public class Language_EN implements Languages{
@Override
public String COMMAND_NOT_FOUND() {
- return "§cThis command hasn't been found.";
+ return "§cThis commons hasn't been found.";
}
@Override
@@ -91,7 +91,7 @@ public class Language_EN implements Languages{
@Override
public String Core_BAN_BANNED(CustomPlayer p) {
- return "§7You've §cbanned " + p.getColor() + p.getDisplayName();
+ return "§7You've §cbanned " + p.getDatabasePlayer().getRank().getColor() + p.getDisplayName();
}
@Override
@@ -116,12 +116,12 @@ public class Language_EN implements Languages{
@Override
public String Core_RUNAS_USAGE() {
- return "§cUse /runas ";
+ return "§cUse /runas ";
}
@Override
public String Core_RUNAS_RUN(CustomPlayer p) {
- return "§7The player " + p.getColor() + p.getDisplayName() + " §7has executed your command §esuccesfully";
+ return "§7The player " + p.getDatabasePlayer().getRank().getColor() + p.getDisplayName() + " §7has executed your commons §esuccesfully";
}
@Override
@@ -171,7 +171,7 @@ public class Language_EN implements Languages{
@Override
public String Core_CHAT_CLEARED(CustomPlayer p) {
- return "§7The chat has been §ccleaned §7by " + p.getColor() + p.getDisplayName();
+ return "§7The chat has been §ccleaned §7by " + p.getDatabasePlayer().getRank().getColor() + p.getDisplayName();
}
@Override
diff --git a/src/main/java/eu/univento/core/api/languages/Language_IT.java b/src/main/java/eu/univento/core/api/languages/Language_IT.java
index b073dc1..ad13af8 100644
--- a/src/main/java/eu/univento/core/api/languages/Language_IT.java
+++ b/src/main/java/eu/univento/core/api/languages/Language_IT.java
@@ -1,7 +1,7 @@
package eu.univento.core.api.languages;
+import eu.univento.commons.player.Rank;
import eu.univento.core.api.player.CustomPlayer;
-import eu.univento.core.api.player.Rank;
/**
* @author joethei
@@ -91,7 +91,7 @@ public class Language_IT implements Languages{
@Override
public String Core_BAN_BANNED(CustomPlayer p) {
- return "§7Tu hai §ebannato " + p.getColor() + p.getDisplayName();
+ return "§7Tu hai §ebannato " + p.getDatabasePlayer().getRank().getColor() + p.getDisplayName();
}
@Override
@@ -121,7 +121,7 @@ public class Language_IT implements Languages{
@Override
public String Core_RUNAS_RUN(CustomPlayer p) {
- return p.getColor() + p.getDisplayName() + " §7ha eseguito il tuo commando";
+ return p.getDatabasePlayer().getRank().getColor() + p.getDisplayName() + " §7ha eseguito il tuo commando";
}
@Override
@@ -139,7 +139,6 @@ public class Language_IT implements Languages{
return "§cQuesto gruppo non esiste";
}
- @Override
public String Core_SETRANK_SET(CustomPlayer p, Rank rank) {
return "§7Hai dato " + p.getDisplayName() + " il gruppo §e" + rank.toString();
}
@@ -170,7 +169,7 @@ public class Language_IT implements Languages{
@Override
public String Core_CHAT_CLEARED(CustomPlayer p) {
- return "§7La chat è stata §cpulita §7da " + p.getColor() + p.getDisplayName();
+ return "§7La chat è stata §cpulita §7da " + p.getDatabasePlayer().getRank().getColor() + p.getDisplayName();
}
@Override
diff --git a/src/main/java/eu/univento/core/api/languages/Languages.java b/src/main/java/eu/univento/core/api/languages/Languages.java
index 4a0e35f..1980fec 100644
--- a/src/main/java/eu/univento/core/api/languages/Languages.java
+++ b/src/main/java/eu/univento/core/api/languages/Languages.java
@@ -1,7 +1,7 @@
package eu.univento.core.api.languages;
+import eu.univento.commons.player.Rank;
import eu.univento.core.api.player.CustomPlayer;
-import eu.univento.core.api.player.Rank;
/**
* @author joethei
diff --git a/src/main/java/eu/univento/core/api/languages/Messages.java b/src/main/java/eu/univento/core/api/languages/Messages.java
index 2830693..10a874a 100644
--- a/src/main/java/eu/univento/core/api/languages/Messages.java
+++ b/src/main/java/eu/univento/core/api/languages/Messages.java
@@ -1,13 +1,14 @@
package eu.univento.core.api.languages;
+import eu.univento.commons.player.Rank;
import eu.univento.core.api.player.CustomPlayer;
-import eu.univento.core.api.player.Rank;
/**
* @author joethei
* @version 2.0
*/
+@Deprecated
public class Messages {
private final CustomPlayer player;
@@ -18,12 +19,11 @@ public class Messages {
private Languages lang;
- @Deprecated
public Messages(CustomPlayer player) {
this.player = player;
- if(player.getLanguage().equals("DE")) this.lang = de;
- if(player.getLanguage().equals("IT")) this.lang = it;
- if(player.getLanguage().equals("EN")) this.lang = en;
+ if(player.getDatabasePlayer().getSettings().getLanguage().equals("DE")) this.lang = de;
+ if(player.getDatabasePlayer().getSettings().getLanguage().equals("IT")) this.lang = it;
+ if(player.getDatabasePlayer().getSettings().getLanguage().equals("EN")) this.lang = en;
}
public String PREFIX() {
diff --git a/src/main/java/eu/univento/core/api/map/MapDownloader.java b/src/main/java/eu/univento/core/api/map/MapDownloader.java
index 3578b5e..024f4d3 100644
--- a/src/main/java/eu/univento/core/api/map/MapDownloader.java
+++ b/src/main/java/eu/univento/core/api/map/MapDownloader.java
@@ -7,7 +7,6 @@ import java.io.FileOutputStream;
import java.io.InputStream;
import java.io.OutputStream;
import java.net.URL;
-import java.util.logging.Level;
/**
* @author joethei
@@ -19,7 +18,7 @@ class MapDownloader {
try {
InputStream is = file.openStream();
File finaldest = new File(dest + "/" + file.getFile());
- if(!finaldest.getParentFile().mkdirs()) Core.log(Level.SEVERE, "Map Ordner konnte nicht erstellt werden");
+ if(!finaldest.getParentFile().mkdirs()) Core.getCommons().getLoggingHandler().getCore().warn("Map Ordner konnte nicht erstellt werden");
finaldest.createNewFile();
OutputStream os = new FileOutputStream(finaldest);
byte data[] = new byte[1024];
diff --git a/src/main/java/eu/univento/core/api/map/MapVoting.java b/src/main/java/eu/univento/core/api/map/MapVoting.java
index d3696d7..8c8ae79 100644
--- a/src/main/java/eu/univento/core/api/map/MapVoting.java
+++ b/src/main/java/eu/univento/core/api/map/MapVoting.java
@@ -1,7 +1,7 @@
package eu.univento.core.api.map;
+import eu.univento.commons.player.Rank;
import eu.univento.core.api.player.CustomPlayer;
-import eu.univento.core.api.player.Rank;
import org.bukkit.Bukkit;
import org.bukkit.entity.Player;
import org.bukkit.event.EventHandler;
@@ -109,7 +109,7 @@ class MapVoting implements Listener{
}
public Inventory getInventory(CustomPlayer p) {
- if(p.isAllowed(Rank.Admin)) {
+ if(p.getDatabasePlayer().isAllowed(Rank.Admin)) {
Inventory inv = Bukkit.createInventory(p, 45, invTitle);
for(Map map : allMaps) {
@@ -164,7 +164,7 @@ class MapVoting implements Listener{
if(e.getWhoClicked() instanceof Player) {
CustomPlayer p = CustomPlayer.getPlayer(e.getWhoClicked().getName());
if(e.getInventory().getName().equals(invTitle)) {
- if(p.isAllowed(Rank.Admin)) {
+ if(p.getDatabasePlayer().isAllowed(Rank.Admin)) {
allMaps.stream().filter(map -> e.getCurrentItem().getType() == map.getItem()).forEach(map -> forcedMap = map);
}else{
if(e.getCurrentItem().getType() == map1.getItem()) {
diff --git a/src/main/java/eu/univento/core/api/pet/NMSHandler.java b/src/main/java/eu/univento/core/api/pet/NMSHandler.java
index 4f23bf2..0a98ca4 100644
--- a/src/main/java/eu/univento/core/api/pet/NMSHandler.java
+++ b/src/main/java/eu/univento/core/api/pet/NMSHandler.java
@@ -13,7 +13,6 @@ import java.lang.reflect.InvocationTargetException;
/**
* @author joethei
* @version 0.1
- * created on 26.06.2016
*/
public class NMSHandler {
diff --git a/src/main/java/eu/univento/core/api/pet/NMSHelper.java b/src/main/java/eu/univento/core/api/pet/NMSHelper.java
index fc87ac4..d256790 100644
--- a/src/main/java/eu/univento/core/api/pet/NMSHelper.java
+++ b/src/main/java/eu/univento/core/api/pet/NMSHelper.java
@@ -12,7 +12,6 @@ import java.util.Map;
/**
* @author joethei
* @version 0.1
- * created on 26.06.2016
*/
class NMSHelper {
diff --git a/src/main/java/eu/univento/core/api/pet/PetManager.java b/src/main/java/eu/univento/core/api/pet/PetManager.java
index bcb512a..1899886 100644
--- a/src/main/java/eu/univento/core/api/pet/PetManager.java
+++ b/src/main/java/eu/univento/core/api/pet/PetManager.java
@@ -3,7 +3,6 @@ package eu.univento.core.api.pet;
/**
* @author joethei
* @version 0.1
- * created on 26.06.2016
*/
public class PetManager {
diff --git a/src/main/java/eu/univento/core/api/pet/PetType.java b/src/main/java/eu/univento/core/api/pet/PetType.java
index 480f0d4..c00d27d 100644
--- a/src/main/java/eu/univento/core/api/pet/PetType.java
+++ b/src/main/java/eu/univento/core/api/pet/PetType.java
@@ -15,7 +15,6 @@ import java.util.List;
*
* @author joethei
* @version 0.1
- * created on 26.06.2016
*/
public enum PetType {
CREEPER("Creeper", 50, EntityType.CREEPER, EntityCreeper.class, CustomCreeper.class),
diff --git a/src/main/java/eu/univento/core/api/pet/custom/CustomCreeper.java b/src/main/java/eu/univento/core/api/pet/custom/CustomCreeper.java
index d0f95c0..c9ceb05 100644
--- a/src/main/java/eu/univento/core/api/pet/custom/CustomCreeper.java
+++ b/src/main/java/eu/univento/core/api/pet/custom/CustomCreeper.java
@@ -6,7 +6,6 @@ import net.minecraft.server.v1_10_R1.*;
/**
* @author joethei
* @version 0.1
- * created on 26.06.2016
*/
public class CustomCreeper extends EntityCreeper{
diff --git a/src/main/java/eu/univento/core/api/pet/custom/CustomPig.java b/src/main/java/eu/univento/core/api/pet/custom/CustomPig.java
index d200793..d1c5613 100644
--- a/src/main/java/eu/univento/core/api/pet/custom/CustomPig.java
+++ b/src/main/java/eu/univento/core/api/pet/custom/CustomPig.java
@@ -6,7 +6,6 @@ import net.minecraft.server.v1_10_R1.*;
/**
* @author joethei
* @version 0.1
- * created on 26.06.2016
*/
public class CustomPig extends EntityPig{
private double rideSpeed;
diff --git a/src/main/java/eu/univento/core/api/player/CustomPlayer.java b/src/main/java/eu/univento/core/api/player/CustomPlayer.java
index 0e465e1..e9371ad 100644
--- a/src/main/java/eu/univento/core/api/player/CustomPlayer.java
+++ b/src/main/java/eu/univento/core/api/player/CustomPlayer.java
@@ -3,16 +3,13 @@ package eu.univento.core.api.player;
import com.mojang.authlib.GameProfile;
import com.mojang.authlib.properties.Property;
import com.mongodb.BasicDBObject;
-import com.mongodb.CursorType;
-import com.mongodb.client.FindIterable;
-import com.mongodb.client.MongoCollection;
+import eu.univento.commons.player.DatabasePlayer;
+import eu.univento.commons.player.Rank;
import eu.univento.core.Core;
import eu.univento.core.api.Hologram;
import eu.univento.core.api.Utils;
-import eu.univento.core.api.database.MongoDB;
import eu.univento.core.api.effects.Blackscreen;
import eu.univento.core.api.effects.Effects;
-import eu.univento.core.api.languages.Language;
import eu.univento.core.api.languages.Messages;
import eu.univento.core.api.server.ServerSettings;
import eu.univento.core.api.server.Servers;
@@ -21,12 +18,11 @@ import eu.univento.core.api.utils.GameProfileBuilder;
import eu.univento.core.api.utils.UUIDFetcher;
import io.netty.buffer.ByteBuf;
import io.netty.buffer.Unpooled;
-import net.md_5.bungee.api.ChatMessageType;
-import net.md_5.bungee.api.chat.TextComponent;
import net.minecraft.server.v1_10_R1.*;
import net.minecraft.server.v1_10_R1.World;
import org.bson.Document;
import org.bukkit.*;
+import org.bukkit.Material;
import org.bukkit.attribute.Attribute;
import org.bukkit.attribute.AttributeInstance;
import org.bukkit.attribute.AttributeModifier;
@@ -47,41 +43,26 @@ import java.io.IOException;
import java.io.ObjectOutputStream;
import java.lang.reflect.Field;
import java.util.*;
-import java.util.logging.Level;
-import java.util.stream.Collectors;
-public class CustomPlayer extends CraftPlayer {
+public class CustomPlayer extends CraftPlayer{
private static final HashMap PLAYERS = new HashMap<>();
private final Player PLAYER;
-
- private String customPrefix;
- private String customSuffix;
- private String customColor;
+ private final DatabasePlayer DATABASE_PLAYER;
private boolean openInventory;
- private final MongoCollection playerCollection;
- private final MongoCollection friendCollection;
- private final MongoCollection onlinePlayerCollection;
- private final MongoCollection warnCollection;
-
private CustomPlayer(Player player) {
super((CraftServer) Bukkit.getServer(), ((CraftPlayer) player).getHandle());
+ DATABASE_PLAYER = new DatabasePlayer(Core.getCommons(), player.getUniqueId());
PLAYERS.put(player.getUniqueId(), this);
PLAYER = player;
- MongoDB mongoDB = Core.getDatabaseManager().getMongoDB();
- playerCollection = mongoDB.getDatabase().getCollection("players");
- friendCollection = mongoDB.getDatabase().getCollection("friends");
- onlinePlayerCollection = mongoDB.getDatabase().getCollection("online-players");
- warnCollection = mongoDB.getDatabase().getCollection("warns");
-
}
public void onLeave() {
Date date = new Date();
- setInDatabase("lastOnline", date);
+ DATABASE_PLAYER.setInDatabase("lastOnline", date);
HashMap location = new HashMap<>();
location.put("X", getLocation().getX());
@@ -90,7 +71,7 @@ public class CustomPlayer extends CraftPlayer {
location.put("Yaw", getLocation().getYaw());
location.put("Pitch", getLocation().getPitch());
- if (ServerSettings.isLobby()) setInDatabase("Pos", new BasicDBObject(location));
+ if (ServerSettings.isLobby()) DATABASE_PLAYER.setInDatabase("Pos", new BasicDBObject(location));
if (PLAYERS.containsKey(getUniqueId())) PLAYERS.remove(getUniqueId());
}
@@ -123,59 +104,13 @@ public class CustomPlayer extends CraftPlayer {
return PLAYER;
}
+ public DatabasePlayer getDatabasePlayer() {
+ return DATABASE_PLAYER;
+ }
+
@Override
public boolean hasPlayedBefore() {
- FindIterable cursor = playerCollection.find(new Document("uuid", getUniqueId().toString()));
- cursor.cursorType(CursorType.NonTailable);
-
- Document obj = cursor.first();
- return obj != null;
- }
-
- public void setRank(Rank rank) {
- setInDatabase("rank", rank.toString());
- }
-
- public void setTSID(int id) {
- setInDatabase("tsid", id);
- }
-
- private void setCoins(int coins) {
- setInDatabase("coins", coins);
- }
-
- private void setExperience(int experience) {
- setInDatabase("experience", experience);
- }
-
- private void setFoundSecrets(ArrayList secrets) {
- setInDatabase("foundSecrets", secrets);
- }
-
- public void addSecret(String name) {
- ArrayList list = getFoundSecrets();
- list.add(name);
- setFoundSecrets(list);
- }
-
- private void setFoundEggs(ArrayList eggs) {
- setInDatabase("foundEggs", eggs);
- }
-
- public void addEgg(String name) {
- ArrayList list = getFoundEggs();
- list.add(name);
- setFoundEggs(list);
- }
-
- private void setSettings(Map settings) {
- setInDatabase("Settings", settings);
- }
-
- private void setSetting(String name, java.io.Serializable setting) {
- Map list = getSettings();
- list.put(name, setting);
- setSettings(list);
+ return DATABASE_PLAYER.hasPlayedBefore();
}
public void buy(ShopItem item) {
@@ -186,7 +121,7 @@ public class CustomPlayer extends CraftPlayer {
public Map getBoughtItems() {
Map map = new HashMap<>();
- for (Map.Entry entry : getMapFromDatabase("bought").entrySet())
+ for (Map.Entry entry : DATABASE_PLAYER.getMapFromDatabase("bought").entrySet())
map.put(ShopItem.valueOf(String.valueOf(entry.getKey())), Boolean.valueOf(String.valueOf(entry.getValue())));
return map;
}
@@ -194,195 +129,18 @@ public class CustomPlayer extends CraftPlayer {
private void setBoughtItems(Map map) {
Map items = new HashMap<>();
for (Map.Entry entry : map.entrySet()) items.put(String.valueOf(entry.getKey()), entry.getValue());
- setInDatabase("bought", items);
- }
-
- public Rank getRank() {
- return Rank.valueOf(getStringFromDatabase("rank"));
- }
-
- public Date getFirstLogin() {
- return getDateFromDatabase("firstLogin");
- }
-
- public Date getLastLogin() {
- return getDateFromDatabase("lastLogin");
- }
-
- public Date getLastOnline() {
- return getDateFromDatabase("lastOnline");
- }
-
- public String getLastIP() {
- return getStringFromDatabase("lastIP");
- }
-
- public int getTSID() {
- return getIntegerFromDatabase("tsid");
- }
-
- private int getTimesJoined() {
- return getIntegerFromDatabase("timesJoined");
- }
-
- public int getCoins() {
- return getIntegerFromDatabase("coins");
- }
-
- public int getExperience() {
- return getIntegerFromDatabase("experience");
- }
-
- public int getSecrets() {
- return getFoundSecrets().size();
- }
-
- private ArrayList getFoundSecrets() {
- return getArrayListFromDatabase("foundSecrets");
- }
-
- public int getEggs() {
- return getFoundEggs().size();
- }
-
- private ArrayList getFoundEggs() {
- return getArrayListFromDatabase("foundEggs");
- }
-
- private Map getSettings() {
- return getMapFromDatabase("Settings");
+ DATABASE_PLAYER.setInDatabase("bought", items);
}
public Location getLastLocation() {
- Map map = getMapFromDatabase("Pos");
+ Map map = DATABASE_PLAYER.getMapFromDatabase("Pos");
return new Location(Bukkit.getWorld("world"), (double) map.get("X"), (double) map.get("Y"), (double) map.get("Z"), (float) map.get("Yaw"), (float) map.get("Pitch"));
}
- public String getPlayerVisibility() {
- return (String) getSettings().get("playerVisibility");
- }
-
- public boolean hasInventoryAnimation() {
- return (boolean) getSettings().get("inventoryAnimation");
- }
-
- public boolean hasTeleportAnimation() {
- return (boolean) getSettings().get("teleportAnimation");
- }
-
- public boolean hasPartyRequests() {
- return (boolean) getSettings().get("partyRequests");
- }
-
- public boolean hasFriendRequests() {
- return (boolean) getSettings().get("friendRequests");
- }
-
- public boolean hasFriendJump() {
- return (boolean) getSettings().get("friendJump");
- }
-
- public boolean hasChatSounds() {
- return (boolean) getSettings().get("chatSounds");
- }
-
- public boolean hasEffects() {
- return (boolean) getSettings().get("effects");
- }
-
- public boolean hasStoryMode() {
- return (boolean) getSettings().get("storyMode");
- }
-
- public String getLanguage() {
- return (String) getSettings().get("language");
- }
-
- public boolean hasTsMove() {
- return (boolean) getSettings().get("tsMove");
- }
-
- public boolean hasScoreboard() {
- return (boolean) getSettings().get("scoreboard");
- }
-
- public void setPlayerVisibility(String visibility) {
- setSetting("playerVisibility", visibility);
- }
-
- public void setInventoryAnimation(boolean animation) {
- setSetting("inventoryAnimation", animation);
- }
-
- public void setTeleportAnimation(boolean animation) {
- setSetting("teleportAnimation", animation);
- }
-
- public void setPartyRequests(boolean requests) {
- setSetting("partyRequests", requests);
- }
-
- public void setFriendRequests(boolean requests) {
- setSetting("friendRequests", requests);
- }
-
- public void setFriendJump(boolean jump) {
- setSetting("friendJump", jump);
- }
-
- public void setChatSounds(boolean sounds) {
- setSetting("chatSounds", sounds);
- }
-
- public void setEffects(boolean effects) {
- setSetting("effects", effects);
- }
-
- public void setStoryMode(boolean storyMode) {
- setSetting("storyMode", storyMode);
- }
-
- public void setLanguage(String language) {
- setSetting("language", language);
- }
-
- public void setTsMove(boolean tsMove) {
- setSetting("tsMove", tsMove);
- }
-
- public void setScoreboard(boolean scoreboard) {
- setSetting("scoreboard", scoreboard);
- }
-
public void connectToServer(String server) {
Servers.connectServer(PLAYER, server);
}
- public boolean isAllowed(Rank rank) {
- return getRank().getValue() >= rank.getValue();
- }
-
- public Collection getFriends() {
- FindIterable cursor = friendCollection.find(new Document("uuid", getUniqueId().toString()));
- cursor.cursorType(CursorType.NonTailable);
-
- Document doc = cursor.first();
- if (doc == null) return null;
-
- LinkedList list = (LinkedList) doc.get("friends");
-
- return list.stream().map(FriendObject::new).collect(Collectors.toCollection(LinkedList::new));
- }
-
- public boolean isFriend(UUID uuid) {
- return getFriends().contains(uuid);
- }
-
-
- public boolean isMuted() {
- return (boolean) getObjectFromDatbase("mute");
- }
-
public void warn(WarnReason reason, CustomPlayer warner, String proof) {
Document doc = new Document("uuid", getUniqueId().toString());
doc.put("reason", reason.name());
@@ -390,42 +148,7 @@ public class CustomPlayer extends CraftPlayer {
doc.put("date", new Date());
doc.put("proof", proof);
- warnCollection.insertOne(doc);
- }
-
- public String getPrefix() {
- if (customPrefix != null) return customPrefix;
- if (isNicked()) return Rank.Premium.getPrefix();
- return getRank().getPrefix();
- }
-
- public String getSuffix() {
- if (customSuffix != null) return customSuffix;
- if (isNicked()) return Rank.Premium.getSuffix();
- return getRank().getSuffix();
- }
-
- public String getColor() {
- if (customColor != null) return customColor;
- if (isNicked()) return Rank.Premium.getColor();
- return getRank().getColor();
- }
-
- public Team getTeam() {
- if (isNicked()) getScoreboard().getTeam(Rank.Premium.getTeam());
- return getScoreboard().getTeam(getRank().getTeam());
- }
-
- public void setCustomPrefix(String prefix) {
- customPrefix = prefix;
- }
-
- public void setCustomSuffix(String suffix) {
- customSuffix = suffix;
- }
-
- public void setCustomColor(String color) {
- customColor = color;
+ DATABASE_PLAYER.getWarnCollection().insertOne(doc);
}
public boolean hasEmptyInventory() {
@@ -445,14 +168,6 @@ public class CustomPlayer extends CraftPlayer {
this.openInventory = openInventory;
}
- public void addCoins(int coins) {
- setCoins(getCoins() + coins);
- }
-
- public void substractCoins(int coins) {
- setCoins(getCoins() - coins);
- }
-
/*
@Deprecated
public void sendActionBar(String text) {
@@ -463,7 +178,7 @@ public class CustomPlayer extends CraftPlayer {
*/
public void sendActionBar(String text) {
- spigot().sendMessage(ChatMessageType.ACTION_BAR, new TextComponent(text));
+ //spigot().sendMessage(ChatMessageType.ACTION_BAR, new TextComponent(text));
}
public void sendTitle(int fadeIn, int stay, int fadeOut, String title, String subtitle) {
@@ -524,27 +239,27 @@ public class CustomPlayer extends CraftPlayer {
}
public void addExperience(int experience) {
- setExperience(getExperience() + experience);
+ DATABASE_PLAYER.setExperience(DATABASE_PLAYER.getExperience() + experience);
setExp(0F);
- giveExp(getExperience());
+ giveExp(DATABASE_PLAYER.getExperience());
playSound(getLocation(), Sound.ENTITY_PLAYER_LEVELUP, 1.0F, 1.0F);
}
public void substractExperience(int experience) {
- setExperience(getExperience() - experience);
+ DATABASE_PLAYER.setExperience(DATABASE_PLAYER.getExperience() - experience);
setExp(0F);
- giveExp(getExperience());
+ giveExp(DATABASE_PLAYER.getExperience());
}
public void refreshExperience() {
setLevel(0);
setExp(0F);
- giveExp(getExperience());
+ giveExp(DATABASE_PLAYER.getExperience());
}
@Deprecated
public void playParticle(Location loc, EnumParticle ep, float f, int count) {
- if (hasEffects()) Effects.playEffectToPlayer(PLAYER, loc, ep, f, count);
+ if (DATABASE_PLAYER.getSettings().hasEffectsEnabled()) Effects.playEffectToPlayer(PLAYER, loc, ep, f, count);
}
public void setAttackSpeed(double speed) {
@@ -568,18 +283,6 @@ public class CustomPlayer extends CraftPlayer {
return new Messages(this);
}
- public String getMessage(String message) {
- return new Language(getLanguage()).getWord(message);
- }
-
- public boolean isNicked() {
- return (boolean) getSettings().get("nicked");
- }
-
- public void setNicked(boolean nicked) {
- setSetting("nicked", nicked);
- }
-
@Deprecated
private void loadSkin(String name) {
//Skin skin = new Skin(UUIDFetcher.getUUID(name).toString());
@@ -606,7 +309,7 @@ public class CustomPlayer extends CraftPlayer {
}.runTaskLater(Core.getInstance(), 4);
} catch (IOException e) {
e.printStackTrace();
- Core.log(Level.SEVERE, "Mojang Skin Server offline");
+ Core.getCommons().getLoggingHandler().getCore().error("Mojang Skin Server offline");
sendMessage("§cSkin Server sind offline");
}
}
@@ -657,68 +360,13 @@ public class CustomPlayer extends CraftPlayer {
@Override
public boolean isOnline() {
- FindIterable cursor = onlinePlayerCollection.find(new Document("uuid", getUniqueId().toString()));
- cursor.cursorType(CursorType.NonTailable);
- Document doc = cursor.first();
- return doc != null;
+ return DATABASE_PLAYER.isOnline();
}
public void setStoryResourcePack() {
setResourcePack("http://univento.eu/storyPack.zip");
}
- private void setInDatabase(String name, Object obj) {
- playerCollection.updateOne(new Document("uuid", getUniqueId().toString()), new Document("$set", new Document(name, obj)));
- }
-
- private Object getObjectFromDatbase(String name) {
- FindIterable cursor = playerCollection.find(new Document("uuid", getUniqueId().toString()));
- cursor.cursorType(CursorType.NonTailable);
-
- Document doc = cursor.first();
- if (doc == null) return null;
-
- return doc.get(name);
- }
-
- private int getIntegerFromDatabase(String name) {
- FindIterable cursor = playerCollection.find(new Document("uuid", getUniqueId().toString()));
- cursor.cursorType(CursorType.NonTailable);
-
- Document doc = cursor.first();
- if (doc == null) return 0;
-
- return doc.getInteger(name);
- }
-
- private String getStringFromDatabase(String name) {
- FindIterable cursor = playerCollection.find(new Document("uuid", getUniqueId().toString()));
- cursor.cursorType(CursorType.NonTailable);
-
- Document doc = cursor.first();
- if (doc == null) return null;
-
- return doc.getString(name);
- }
-
- private Date getDateFromDatabase(String name) {
- FindIterable cursor = playerCollection.find(new Document("uuid", getUniqueId().toString()));
- cursor.cursorType(CursorType.NonTailable);
-
- Document doc = cursor.first();
- if (doc == null) return null;
-
- return doc.getDate(name);
- }
-
- private ArrayList getArrayListFromDatabase(String name) {
- return (ArrayList) getObjectFromDatbase(name);
- }
-
- private Map getMapFromDatabase(String name) {
- return (Map) getObjectFromDatbase(name);
- }
-
public void initScoreboard() {
Scoreboard board = getScoreboard();
board.getTeams().forEach(Team::unregister);
@@ -775,7 +423,7 @@ public class CustomPlayer extends CraftPlayer {
public void refreshTablist() {
for (CustomPlayer player : Core.getOnlinePlayers()) {
setScoreboard(Bukkit.getScoreboardManager().getNewScoreboard());
- getScoreboard().getTeam(player.getTeam().getName()).addEntry(player.getDisplayName());
+ getScoreboard().getTeam(DATABASE_PLAYER.getRank().getTeam()).addEntry(player.getDisplayName());
}
}
@@ -783,8 +431,8 @@ public class CustomPlayer extends CraftPlayer {
*
* @param location location for effect
* @param effect particle effect
- * @param id
- * @param data
+ * @param id the id
+ * @param data the data
* @param offsetX offset in x direction
* @param offsetY offset in y direction
* @param offsetZ offset in z direction
@@ -793,8 +441,17 @@ public class CustomPlayer extends CraftPlayer {
* @param radius effect radius
*/
public void playEffect(Location location, Effect effect, int id, int data, float offsetX, float offsetY, float offsetZ, float speed, int particleCount, int radius) {
- if(hasEffects())
- spigot().playEffect(location, effect, id, data, offsetX, offsetY, offsetZ, speed, particleCount, radius);
+ if(DATABASE_PLAYER.getSettings().hasEffectsEnabled()) {
+ //spigot().playEffect(location, effect, id, data, offsetX, offsetY, offsetZ, speed, particleCount, radius);
+ }
+ }
+
+ public void changeChestState(Location loc, boolean open) {
+ if(loc.getBlock().getType() != Material.CHEST) return;
+ byte dataByte = (open) ? (byte) 1 : 0;
+ BlockPosition position = new BlockPosition(loc.getBlockX(), loc.getBlockY(), loc.getBlockZ());
+ PacketPlayOutBlockAction blockActionPacket = new PacketPlayOutBlockAction(position, net.minecraft.server.v1_10_R1.Block.getById(loc.getBlock().getTypeId()), (byte) 1, dataByte);
+ sendPacket(blockActionPacket);
}
}
\ No newline at end of file
diff --git a/src/main/java/eu/univento/core/api/player/FriendObject.java b/src/main/java/eu/univento/core/api/player/FriendObject.java
index 5c82171..fef7832 100644
--- a/src/main/java/eu/univento/core/api/player/FriendObject.java
+++ b/src/main/java/eu/univento/core/api/player/FriendObject.java
@@ -7,7 +7,6 @@ import java.util.UUID;
/**
* @author joethei
* @version 0.1
- * Created at 21:15 on 25.07.2016.
*/
public class FriendObject {
diff --git a/src/main/java/eu/univento/core/api/player/Rank.java b/src/main/java/eu/univento/core/api/player/Rank.java
deleted file mode 100644
index 8da50fb..0000000
--- a/src/main/java/eu/univento/core/api/player/Rank.java
+++ /dev/null
@@ -1,60 +0,0 @@
-package eu.univento.core.api.player;
-
-public enum Rank {
- Admin(16, "§4", "§8[§4Admin§8] ", " §8»§7 ", "a", "§4Admin | "),
- SrDeveloper(15, "§3", "§8[§3SrDev§8] ", " §8»§7 ", "c", "§3SrDev | "),
- SrBuilder(14, "§2", "§8[§2SrBuilder§8] ", " §8»§7 ", "f", "§2SrBuilder | "),
- SrSupporter(13, "§9", "§8[§9SrSupr§8] ", " §8»§7 ", "i", "§9SrSup | "),
- Developer(12, "§3", "§8[§3Dev§8] ", " §8»§7 ", "d", "§3Dev | "),
- Builder(11, "§2", "§8[§2Builder§8] ", " §8»§7 ", "g", "§2Builder | "),
- Supporter(10, "§9", "§8[§9Sup§8] ", " §8»§7 ", "j", "§9Sup | "),
- JrDeveloper(9, "§3", "§8[§3JrDev§8] ", " §8»§7 ", "e", "§3JrDev | "),
- JrBuilder(8, "§2", "§8[§2JrBuilder§8] ", " §8»§7 ", "h", "§2JrBuilder | "),
- JrSupporter(7, "§9", "§8[§9JrSup§8] ", " §8»§7 ", "k", "§9JrSup | "),
- Manager(6, "§c", "§8[§cManager§8] ", " §8»§7 ", "b", "§cManager | "),
- Grafik(5, "§e", "§8[§eGrafiker§8] ", " §8»§7 ", "l", "§eGrafik | "),
- Sound(4, "§e", "§8[§eSound§8] ", " §8»§7 ", "m", "§eSound | "),
- Partner(3, "§5", "§5", " §8»§7 ", "n", "§5"),
- Premium(2, "§6", "§6", " §8§7» ", "o", "§6"),
- Player(1, "§7", "§7", " §8»§7 ", "p", "§7");
-
- private final int value;
- private final String color;
- private final String prefix;
- private final String suffix;
- private final String team;
- private final String tab;
-
- Rank(int value, String color, String prefix, String suffix, String team, String tab) {
- this.value = value;
- this.color = color;
- this.prefix = prefix;
- this.suffix = suffix;
- this.team = team;
- this.tab = tab;
- }
-
- public int getValue() {
- return value;
- }
-
- public String getColor() {
- return color;
- }
-
- public String getPrefix() {
- return prefix;
- }
-
- public String getSuffix() {
- return suffix;
- }
-
- public String getTeam() {
- return team;
- }
-
- public String getTab() {
- return tab;
- }
-}
\ No newline at end of file
diff --git a/src/main/java/eu/univento/core/api/player/SpectateManager.java b/src/main/java/eu/univento/core/api/player/SpectateManager.java
index 57e831e..a1713db 100644
--- a/src/main/java/eu/univento/core/api/player/SpectateManager.java
+++ b/src/main/java/eu/univento/core/api/player/SpectateManager.java
@@ -6,7 +6,6 @@ import java.util.List;
/**
* @author joethei
* @version 0.1
- * Created at 16:18 on 17.07.2016.
*/
public class SpectateManager {
diff --git a/src/main/java/eu/univento/core/api/player/Spectator.java b/src/main/java/eu/univento/core/api/player/Spectator.java
index 1b4ec53..62f4222 100644
--- a/src/main/java/eu/univento/core/api/player/Spectator.java
+++ b/src/main/java/eu/univento/core/api/player/Spectator.java
@@ -51,7 +51,7 @@ public class Spectator {
}
public void openPlayerListInventory() {
- ScrollingInventory inventory = new ScrollingInventory(player, player.getMessage("Game.Menu.SpectatorMenu"));
+ ScrollingInventory inventory = new ScrollingInventory(player, player.getDatabasePlayer().getMessage("Game.Menu.SpectatorMenu"));
for(CustomPlayer players : PlayerManager.getPlayers()) {
inventory.addItem(new ItemBuilder(Material.SKULL_ITEM).durability((short) 3).skullOwner(players.getDisplayName()).name(players.getDisplayName()).make());
}
diff --git a/src/main/java/eu/univento/core/api/player/WarnReason.java b/src/main/java/eu/univento/core/api/player/WarnReason.java
index a704e45..e66bea2 100644
--- a/src/main/java/eu/univento/core/api/player/WarnReason.java
+++ b/src/main/java/eu/univento/core/api/player/WarnReason.java
@@ -3,7 +3,6 @@ package eu.univento.core.api.player;
/**
* @author joethei
* @version 0.1
- * Created at 21:06 on 13.07.2016.
*/
public enum WarnReason {
ADVERTISEMENT("Advertisement", 10),
diff --git a/src/main/java/eu/univento/core/api/server/NetworkData.java b/src/main/java/eu/univento/core/api/server/NetworkData.java
index 07db660..e9e926f 100644
--- a/src/main/java/eu/univento/core/api/server/NetworkData.java
+++ b/src/main/java/eu/univento/core/api/server/NetworkData.java
@@ -8,8 +8,6 @@ import eu.univento.core.api.player.CustomPlayer;
import org.bukkit.entity.Player;
import org.bukkit.plugin.messaging.PluginMessageListener;
-import java.util.logging.Level;
-
public class NetworkData implements PluginMessageListener{
private CustomPlayer player;
@@ -38,7 +36,7 @@ public class NetworkData implements PluginMessageListener{
public void onPluginMessageReceived(String channel, Player player, byte[] message) {
if(!channel.equals("BungeeCord")) return;
- Core.log(Level.INFO, "Daten incomming");
+ Core.getCommons().getLoggingHandler().getCore().info("Daten incomming");
ByteArrayDataInput input = ByteStreams.newDataInput(message);
String subchannel = input.readUTF();
diff --git a/src/main/java/eu/univento/core/api/server/ServerDatabase.java b/src/main/java/eu/univento/core/api/server/ServerDatabase.java
index a315d43..f85b4d9 100644
--- a/src/main/java/eu/univento/core/api/server/ServerDatabase.java
+++ b/src/main/java/eu/univento/core/api/server/ServerDatabase.java
@@ -1,7 +1,7 @@
package eu.univento.core.api.server;
+import eu.univento.commons.database.MySQL;
import eu.univento.core.Core;
-import eu.univento.core.api.database.MySQL;
import java.sql.ResultSet;
import java.sql.SQLException;
@@ -13,7 +13,7 @@ import java.sql.SQLException;
class ServerDatabase {
static String getIP(String name) {
- MySQL sql = Core.getDatabaseManager().getMySQL();
+ MySQL sql = Core.getCommons().getDatabaseManager().getMySQL();
try {
ResultSet rs = sql.query("SELECT ip FROM Servers WHERE name='" + name + "';");
if(rs.next()) {
@@ -27,7 +27,7 @@ class ServerDatabase {
}
static int getPort(String name) {
- MySQL sql = Core.getDatabaseManager().getMySQL();
+ MySQL sql = Core.getCommons().getDatabaseManager().getMySQL();
try {
ResultSet rs = sql.query("SELECT port FROM Servers WHERE name='" + name + "';");
if(rs.next()) {
@@ -41,7 +41,7 @@ class ServerDatabase {
}
static String getMotd(String name) {
- MySQL sql = Core.getDatabaseManager().getMySQL();
+ MySQL sql = Core.getCommons().getDatabaseManager().getMySQL();
try {
ResultSet rs = sql.query("SELECT motd FROM Servers WHERE name='" + name + "';");
if(rs.next()) {
diff --git a/src/main/java/eu/univento/core/api/server/ServerSettings.java b/src/main/java/eu/univento/core/api/server/ServerSettings.java
index 5958695..d7bcd9d 100644
--- a/src/main/java/eu/univento/core/api/server/ServerSettings.java
+++ b/src/main/java/eu/univento/core/api/server/ServerSettings.java
@@ -7,8 +7,6 @@ import org.bukkit.Bukkit;
import org.bukkit.GameMode;
import org.bukkit.plugin.PluginManager;
-import java.util.logging.Level;
-
/**
* @author joethei
* @version 0.1
@@ -58,7 +56,7 @@ public class ServerSettings {
PluginManager pm = Bukkit.getPluginManager();
new Build(Core.getInstance(), "build", "b");
pm.registerEvents(new Blocks(), Core.getInstance());
- Core.log(Level.INFO, "Build Modus aktiviert");
+ Core.getCommons().getLoggingHandler().getCore().info("Build Modus aktiviert");
}
}
diff --git a/src/main/java/eu/univento/core/api/server/ServerType.java b/src/main/java/eu/univento/core/api/server/ServerType.java
index 32649c2..f13fdff 100644
--- a/src/main/java/eu/univento/core/api/server/ServerType.java
+++ b/src/main/java/eu/univento/core/api/server/ServerType.java
@@ -3,7 +3,6 @@ package eu.univento.core.api.server;
/**
* @author joethei
* @version 0.1
- * Created at 08:39 on 20.07.2016.
*/
public enum ServerType {
diff --git a/src/main/java/eu/univento/core/api/shop/PayType.java b/src/main/java/eu/univento/core/api/shop/PayType.java
index f7f083e..b2e33df 100644
--- a/src/main/java/eu/univento/core/api/shop/PayType.java
+++ b/src/main/java/eu/univento/core/api/shop/PayType.java
@@ -3,7 +3,6 @@ package eu.univento.core.api.shop;
/**
* @author joethei
* @version 0.1
- * Created at 17:10 on 19.07.2016.
*/
public enum PayType {
//TODO: change to real pay type names.
diff --git a/src/main/java/eu/univento/core/api/shop/ShopCategory.java b/src/main/java/eu/univento/core/api/shop/ShopCategory.java
index ac214c1..bb2a80d 100644
--- a/src/main/java/eu/univento/core/api/shop/ShopCategory.java
+++ b/src/main/java/eu/univento/core/api/shop/ShopCategory.java
@@ -5,7 +5,6 @@ import eu.univento.core.api.server.ServerType;
/**
* @author joethei
* @version 0.1
- * Created at 08:36 on 20.07.2016.
*/
enum ShopCategory {
diff --git a/src/main/java/eu/univento/core/api/shop/ShopItem.java b/src/main/java/eu/univento/core/api/shop/ShopItem.java
index 4f04e5d..b2ef2de 100644
--- a/src/main/java/eu/univento/core/api/shop/ShopItem.java
+++ b/src/main/java/eu/univento/core/api/shop/ShopItem.java
@@ -6,7 +6,6 @@ import org.bukkit.inventory.ItemStack;
/**
* @author joethei
* @version 0.1
- * Created at 17:09 on 19.07.2016.
*/
public enum ShopItem {
diff --git a/src/main/java/eu/univento/core/api/shop/ShopMenu.java b/src/main/java/eu/univento/core/api/shop/ShopMenu.java
index 52965bd..ff77d14 100644
--- a/src/main/java/eu/univento/core/api/shop/ShopMenu.java
+++ b/src/main/java/eu/univento/core/api/shop/ShopMenu.java
@@ -16,7 +16,6 @@ import java.util.List;
/**
* @author joethei
* @version 0.1
- * Created at 21:53 on 19.07.2016.
*/
public class ShopMenu implements Listener{
diff --git a/src/main/java/eu/univento/core/api/shop/entity/ShopEntity.java b/src/main/java/eu/univento/core/api/shop/entity/ShopEntity.java
index 4ff3e2e..0294775 100644
--- a/src/main/java/eu/univento/core/api/shop/entity/ShopEntity.java
+++ b/src/main/java/eu/univento/core/api/shop/entity/ShopEntity.java
@@ -15,7 +15,6 @@ import org.bukkit.plugin.Plugin;
/**
* @author joethei
* @version 0.1
- * Created at 10:03 on 20.07.2016.
*/
class ShopEntity implements Listener{
diff --git a/src/main/java/eu/univento/core/api/shop/entity/ShopIronGolem.java b/src/main/java/eu/univento/core/api/shop/entity/ShopIronGolem.java
index 5d14858..e1c706e 100644
--- a/src/main/java/eu/univento/core/api/shop/entity/ShopIronGolem.java
+++ b/src/main/java/eu/univento/core/api/shop/entity/ShopIronGolem.java
@@ -8,7 +8,6 @@ import org.bukkit.plugin.Plugin;
/**
* @author joethei
* @version 0.1
- * Created at 11:15 on 20.07.2016.
*/
public class ShopIronGolem extends ShopEntity{
diff --git a/src/main/java/eu/univento/core/api/shop/entity/ShopVillager.java b/src/main/java/eu/univento/core/api/shop/entity/ShopVillager.java
index 73dfe22..dec835e 100644
--- a/src/main/java/eu/univento/core/api/shop/entity/ShopVillager.java
+++ b/src/main/java/eu/univento/core/api/shop/entity/ShopVillager.java
@@ -9,7 +9,6 @@ import org.bukkit.plugin.Plugin;
/**
* @author joethei
* @version 0.1
- * Created at 17:56 on 19.07.2016.
*/
public class ShopVillager extends ShopEntity {
diff --git a/src/main/java/eu/univento/core/api/utils/GameProfileBuilder.java b/src/main/java/eu/univento/core/api/utils/GameProfileBuilder.java
index b354770..396ab6e 100644
--- a/src/main/java/eu/univento/core/api/utils/GameProfileBuilder.java
+++ b/src/main/java/eu/univento/core/api/utils/GameProfileBuilder.java
@@ -44,7 +44,7 @@ public class GameProfileBuilder {
* @see GameProfile
*/
public static GameProfile fetch(UUID uuid) throws IOException {
- if (!false && cache.containsKey(uuid) && cache.get(uuid).isValid()) {
+ if (cache.containsKey(uuid) && cache.get(uuid).isValid()) {
return cache.get(uuid).profile;
} else {
HttpURLConnection connection = (HttpURLConnection) new URL(String.format(SERVICE_URL, UUIDTypeAdapter.fromUUID(uuid))).openConnection();
diff --git a/src/main/java/eu/univento/core/api/utils/Lamps.java b/src/main/java/eu/univento/core/api/utils/Lamps.java
new file mode 100644
index 0000000..f8f11ac
--- /dev/null
+++ b/src/main/java/eu/univento/core/api/utils/Lamps.java
@@ -0,0 +1,60 @@
+package eu.univento.core.api.utils;
+
+import eu.univento.core.Core;
+import org.bukkit.Material;
+import org.bukkit.block.Block;
+
+import java.lang.reflect.Field;
+import java.lang.reflect.InvocationTargetException;
+
+/**
+ * @author joethei
+ * @version 0.1
+ */
+public class Lamps {
+
+ private static Object getNMCWorld(Object cW) throws ClassNotFoundException {
+ return Class.forName("net.minecraft.server." + Core.getNMSVersion() + ".World", false, Core.class.getClassLoader()).cast(cW);
+ }
+
+ private static Object getCraftWorld(Object worldInstance) throws ClassNotFoundException, InstantiationException, IllegalAccessException {
+ return Class.forName("org.bukkit.craftbukkit." + Core.getNMSVersion() + ".CraftWorld", false, Core.class.getClassLoader()).cast(worldInstance);
+ }
+
+ private static Object getInstanceOfCW(Object cW) throws NoSuchMethodException, InvocationTargetException, IllegalAccessException {
+ return cW.getClass().getDeclaredMethod("getHandle").invoke(cW);
+ }
+
+ public static void switchLight(Block block, boolean light) {
+ try {
+ Object cW = getNMCWorld(getInstanceOfCW(getCraftWorld(block.getWorld())));
+ if (light) {
+ setWorldStatic(cW, true);
+ block.setType(Material.REDSTONE_LAMP_ON);
+ setWorldStatic(cW, false);
+ } else {
+ block.setType(Material.REDSTONE_LAMP_OFF);
+ }
+ } catch (Exception e) {
+ e.printStackTrace();
+ }
+ }
+
+ private static void setWorldStatic(Object cW, boolean static_boolean) throws IllegalAccessException {
+ Field field = null;
+ try {
+ field = cW.getClass().getField("isClientSide");
+ } catch (NoSuchFieldException e) {
+ try {
+ field = cW.getClass().getField("isStatic");
+ } catch (NoSuchFieldException e1) {
+ e1.printStackTrace();
+ }
+ }
+
+ assert field != null;
+ field.setAccessible(true);
+ field.set(cW, static_boolean);
+ }
+
+}
\ No newline at end of file
diff --git a/src/main/java/eu/univento/core/api/utils/Maths.java b/src/main/java/eu/univento/core/api/utils/Maths.java
index 8dd0922..7bdde53 100644
--- a/src/main/java/eu/univento/core/api/utils/Maths.java
+++ b/src/main/java/eu/univento/core/api/utils/Maths.java
@@ -278,4 +278,40 @@ final class Maths
table[((int)(i * 45.511112F) & 0x3FFF)] = (float)Math.sin(i * 0.01745329F);
}
}
+
+
+
+ /**
+ * Compares two version strings.
+ *
+ * Use this instead of String.compareTo() for a non-lexicographical
+ * comparison that works for version strings. e.g. "1.10".compareTo("1.6").
+ *
+ * @note It does not work if "1.10" is supposed to be equal to "1.10.0".
+ *
+ * @param str1 a string of ordinal numbers separated by decimal points.
+ * @param str2 a string of ordinal numbers separated by decimal points.
+ * @return The result is a negative integer if str1 is _numerically_ less than str2.
+ * The result is a positive integer if str1 is _numerically_ greater than str2.
+ * The result is zero if the strings are _numerically_ equal.
+ */
+ public static int versionCompare(String str1, String str2) {
+ String[] vals1 = str1.split("\\.");
+ String[] vals2 = str2.split("\\.");
+ int i = 0;
+ // set index to first non-equal ordinal or length of shortest version string
+ while (i < vals1.length && i < vals2.length && vals1[i].equals(vals2[i])) {
+ i++;
+ }
+ // compare first non-equal ordinal number
+ if (i < vals1.length && i < vals2.length) {
+ int diff = Integer.valueOf(vals1[i]).compareTo(Integer.valueOf(vals2[i]));
+ return Integer.signum(diff);
+ }
+ // the strings are equal or one string is a substring of the other
+ // e.g. "1.2.3" = "1.2.3" or "1.2.3" < "1.2.3.4"
+ return Integer.signum(vals1.length - vals2.length);
+ }
+
+
}
\ No newline at end of file
diff --git a/src/main/java/eu/univento/core/api/utils/NettyInjection.java b/src/main/java/eu/univento/core/api/utils/NettyInjection.java
index 66fd53c..41eb749 100644
--- a/src/main/java/eu/univento/core/api/utils/NettyInjection.java
+++ b/src/main/java/eu/univento/core/api/utils/NettyInjection.java
@@ -20,7 +20,7 @@ import java.util.Map;
* -== NettyInjection ==-
*
* This library was created by @Ingrim4 and allows you to inject a handler inside a channel of a PlayerConnection.class to modify or avoid packets
- * You need my IReflection class -> http://bit.ly/IReflect
+ * You need my IReflection class http://bit.ly/IReflect
* You are welcome to use it and redistribute it under the following conditions:
* * Don't claim this class as your own
* * Don't remove this disclaimer
@@ -116,11 +116,9 @@ public class NettyInjection {
this.registerGlobalChannel();
- for (Player player : Bukkit.getOnlinePlayers())
- this.inject(player);
+ Bukkit.getOnlinePlayers().forEach(this::inject);
}
- @SuppressWarnings("unchecked")
private final void registerGlobalChannel() {
Object server = NettyInjection.FIELD_CRAFTSERVER_MINECRAFTSERVER.get(Bukkit.getServer());
Object connection = NettyInjection.FIELD_MINECRAFTSERVER_SERVERCONNECTION.get(server);
@@ -187,8 +185,7 @@ public class NettyInjection {
}
public final void disable() {
- for (Player player : Bukkit.getOnlinePlayers())
- this.uninject(player);
+ Bukkit.getOnlinePlayers().forEach(this::uninject);
HandlerList.unregisterAll(this.listener);
this.unregisterGlobalChannel();
}
diff --git a/src/main/java/eu/univento/core/api/utils/reflection/ReflectionUtils.java b/src/main/java/eu/univento/core/api/utils/reflection/ReflectionUtils.java
index d62e0ab..3845ab9 100644
--- a/src/main/java/eu/univento/core/api/utils/reflection/ReflectionUtils.java
+++ b/src/main/java/eu/univento/core/api/utils/reflection/ReflectionUtils.java
@@ -60,7 +60,6 @@ public final class ReflectionUtils {
* @return The constructor of the desired target class with the specified parameter types
* @throws NoSuchMethodException If the desired constructor with the specified parameter types cannot be found
* @throws ClassNotFoundException ClassNotFoundException If the desired target class with the specified name and package cannot be found
- * @see String, PackageType)
* @see #getConstructor(Class, Class...)
*/
public static Constructor> getConstructor(String className, PackageType packageType, Class>... parameterTypes) throws NoSuchMethodException, ClassNotFoundException {
@@ -96,7 +95,6 @@ public final class ReflectionUtils {
* @throws InvocationTargetException If the desired constructor cannot be invoked
* @throws NoSuchMethodException If the desired constructor with the specified arguments cannot be found
* @throws ClassNotFoundException If the desired target class with the specified name and package cannot be found
- * @see String, PackageType)
* @see #instantiateObject(Class, Object...)
*/
public static Object instantiateObject(String className, PackageType packageType, Object... arguments) throws InstantiationException, IllegalAccessException, IllegalArgumentException, InvocationTargetException, NoSuchMethodException, ClassNotFoundException {
@@ -135,7 +133,6 @@ public final class ReflectionUtils {
* @return The method of the desired target class with the specified name and parameter types
* @throws NoSuchMethodException If the desired method of the desired target class with the specified name and parameter types cannot be found
* @throws ClassNotFoundException If the desired target class with the specified name and package cannot be found
- * @see String, PackageType)
* @see #getMethod(Class, String, Class...)
*/
public static Method getMethod(String className, PackageType packageType, String methodName, Class>... parameterTypes) throws NoSuchMethodException, ClassNotFoundException {
@@ -193,7 +190,6 @@ public final class ReflectionUtils {
* @throws InvocationTargetException If the desired method cannot be invoked on the target object
* @throws NoSuchMethodException If the desired method of the desired target class with the specified name and arguments cannot be found
* @throws ClassNotFoundException If the desired target class with the specified name and package cannot be found
- * @see String, PackageType)
* @see #invokeMethod(Object, Class, String, Object...)
*/
public static Object invokeMethod(Object instance, String className, PackageType packageType, String methodName, Object... arguments) throws IllegalAccessException, IllegalArgumentException, InvocationTargetException, NoSuchMethodException, ClassNotFoundException {
@@ -354,7 +350,7 @@ public final class ReflectionUtils {
CRAFTBUKKIT("org.bukkit.craftbukkit." + getServerVersion()),
CRAFTBUKKIT_BLOCK(CRAFTBUKKIT, "block"),
CRAFTBUKKIT_CHUNKIO(CRAFTBUKKIT, "chunkio"),
- CRAFTBUKKIT_COMMAND(CRAFTBUKKIT, "command"),
+ CRAFTBUKKIT_COMMAND(CRAFTBUKKIT, "commons"),
CRAFTBUKKIT_CONVERSATIONS(CRAFTBUKKIT, "conversations"),
CRAFTBUKKIT_ENCHANTMENS(CRAFTBUKKIT, "enchantments"),
CRAFTBUKKIT_ENTITY(CRAFTBUKKIT, "entity"),
@@ -368,7 +364,7 @@ public final class ReflectionUtils {
CRAFTBUKKIT_PROJECTILES(CRAFTBUKKIT, "projectiles"),
CRAFTBUKKIT_SCHEDULER(CRAFTBUKKIT, "scheduler"),
CRAFTBUKKIT_SCOREBOARD(CRAFTBUKKIT, "scoreboard"),
- CRAFTBUKKIT_UPDATER(CRAFTBUKKIT, "updater"),
+ CRAFTBUKKIT_UPDATER(CRAFTBUKKIT, "Updater"),
CRAFTBUKKIT_UTIL(CRAFTBUKKIT, "util");
private final String path;
diff --git a/src/main/java/eu/univento/core/commands/Build.java b/src/main/java/eu/univento/core/commands/Build.java
index be5ea09..27ed539 100644
--- a/src/main/java/eu/univento/core/commands/Build.java
+++ b/src/main/java/eu/univento/core/commands/Build.java
@@ -1,10 +1,10 @@
package eu.univento.core.commands;
+import eu.univento.commons.player.Rank;
import eu.univento.core.Core;
import eu.univento.core.api.AutoCommand;
import eu.univento.core.api.languages.Messages;
import eu.univento.core.api.player.CustomPlayer;
-import eu.univento.core.api.player.Rank;
import eu.univento.core.api.server.ServerSettings;
import org.bukkit.GameMode;
import org.bukkit.command.CommandSender;
@@ -35,8 +35,9 @@ public class Build extends AutoCommand{
/**
* @param plugin main class
- * @param description describes the command
- * @param aliases aliases of command
+ * @param command command
+ * @param description describes the commons
+ * @param aliases aliases of commons
*/
public Build(Core plugin, String command, String description, String... aliases) {
super(plugin, command, description, aliases);
@@ -47,7 +48,7 @@ public class Build extends AutoCommand{
if(sender instanceof Player) {
CustomPlayer p = CustomPlayer.getPlayer(sender.getName());
Messages msgs = new Messages(p);
- if(p.isAllowed(Rank.Builder)) {
+ if(p.getDatabasePlayer().isAllowed(Rank.Builder)) {
if(players.containsKey(p)) {
p.sendMessage(msgs.PREFIX() + msgs.Core_BUILD_OFF());
diff --git a/src/main/java/eu/univento/core/commands/ChatClear.java b/src/main/java/eu/univento/core/commands/ChatClear.java
index f44d33d..af98cd8 100644
--- a/src/main/java/eu/univento/core/commands/ChatClear.java
+++ b/src/main/java/eu/univento/core/commands/ChatClear.java
@@ -1,10 +1,10 @@
package eu.univento.core.commands;
+import eu.univento.commons.player.Rank;
import eu.univento.core.Core;
import eu.univento.core.api.AutoCommand;
import eu.univento.core.api.languages.Messages;
import eu.univento.core.api.player.CustomPlayer;
-import eu.univento.core.api.player.Rank;
import org.bukkit.Bukkit;
import org.bukkit.command.CommandSender;
import org.bukkit.entity.Player;
@@ -26,13 +26,13 @@ public class ChatClear extends AutoCommand {
if(sender instanceof Player) {
CustomPlayer p = CustomPlayer.getPlayer(sender.getName());
Messages msgs = new Messages(p);
- if(p.isAllowed(Rank.Supporter)) {
+ if(p.getDatabasePlayer().isAllowed(Rank.Supporter)) {
for(int i = 0; i <= 100; i++) {
Bukkit.broadcastMessage(" ");
}
for(Player players : Bukkit.getOnlinePlayers()) {
CustomPlayer player = CustomPlayer.getPlayer(players);
- if (player.isAllowed(Rank.Supporter)) {
+ if (player.getDatabasePlayer().isAllowed(Rank.Supporter)) {
Messages messages = new Messages(player);
player.sendMessage(messages.Core_CHAT_CLEARED(p));
}
diff --git a/src/main/java/eu/univento/core/commands/Fix.java b/src/main/java/eu/univento/core/commands/Fix.java
index 3fa2cee..d5f2996 100644
--- a/src/main/java/eu/univento/core/commands/Fix.java
+++ b/src/main/java/eu/univento/core/commands/Fix.java
@@ -20,9 +20,9 @@ public class Fix extends AutoCommand{
/**
* @param plugin main class
- * @param command command to execute
- * @param description describes the command
- * @param aliases aliases of command
+ * @param command commons to execute
+ * @param description describes the commons
+ * @param aliases aliases of commons
*/
public Fix(Core plugin, String command, String description, String... aliases) {
super(plugin, command, description, aliases);
diff --git a/src/main/java/eu/univento/core/commands/GameMode.java b/src/main/java/eu/univento/core/commands/GameMode.java
index 1c4f7ef..00c993e 100644
--- a/src/main/java/eu/univento/core/commands/GameMode.java
+++ b/src/main/java/eu/univento/core/commands/GameMode.java
@@ -1,10 +1,10 @@
package eu.univento.core.commands;
+import eu.univento.commons.player.Rank;
import eu.univento.core.Core;
import eu.univento.core.api.AutoCommand;
import eu.univento.core.api.languages.Messages;
import eu.univento.core.api.player.CustomPlayer;
-import eu.univento.core.api.player.Rank;
import org.bukkit.command.CommandSender;
import org.bukkit.entity.Player;
@@ -20,8 +20,9 @@ public class GameMode extends AutoCommand{
/**
* @param plugin main class
- * @param command command to execute
- * @param aliases aliases of command
+ * @param description command description
+ * @param command commons to execute
+ * @param aliases aliases of commons
*/
public GameMode(Core plugin, String command, String description, String... aliases) {
super(plugin, command, description, aliases);
@@ -32,7 +33,7 @@ public class GameMode extends AutoCommand{
if(sender instanceof Player) {
CustomPlayer p = CustomPlayer.getPlayer(sender.getName());
Messages msgs = new Messages(p);
- if(p.isAllowed(Rank.Builder)) {
+ if(p.getDatabasePlayer().isAllowed(Rank.Builder)) {
if(args.length == 1) {
String mode = args[0];
p.setGameMode(getModeFromString(mode));
diff --git a/src/main/java/eu/univento/core/commands/GlobalMute.java b/src/main/java/eu/univento/core/commands/GlobalMute.java
index befeaf8..77563aa 100644
--- a/src/main/java/eu/univento/core/commands/GlobalMute.java
+++ b/src/main/java/eu/univento/core/commands/GlobalMute.java
@@ -1,10 +1,10 @@
package eu.univento.core.commands;
+import eu.univento.commons.player.Rank;
import eu.univento.core.Core;
import eu.univento.core.api.AutoCommand;
import eu.univento.core.api.languages.Messages;
import eu.univento.core.api.player.CustomPlayer;
-import eu.univento.core.api.player.Rank;
import eu.univento.core.api.server.ServerSettings;
import org.bukkit.command.CommandSender;
import org.bukkit.entity.Player;
@@ -20,9 +20,9 @@ public class GlobalMute extends AutoCommand{
/**
* @param plugin main class
- * @param command command to execute
- * @param description describes the command
- * @param aliases aliases of command
+ * @param command commons to execute
+ * @param description describes the commons
+ * @param aliases aliases of commons
*/
public GlobalMute(Core plugin, String command, String description, String... aliases) {
super(plugin, command, description, aliases);
@@ -33,7 +33,7 @@ public class GlobalMute extends AutoCommand{
if(sender instanceof Player) {
CustomPlayer p = CustomPlayer.getPlayer(sender.getName());
Messages msgs = new Messages(p);
- if(p.isAllowed(Rank.Supporter)) {
+ if(p.getDatabasePlayer().isAllowed(Rank.Supporter)) {
if(ServerSettings.isMute()) {
ServerSettings.setMute(false);
p.sendMessage(msgs.Core_GLOBALMUTE_OFF());
diff --git a/src/main/java/eu/univento/core/commands/Nick.java b/src/main/java/eu/univento/core/commands/Nick.java
index 22be14d..cf55a6e 100644
--- a/src/main/java/eu/univento/core/commands/Nick.java
+++ b/src/main/java/eu/univento/core/commands/Nick.java
@@ -1,18 +1,18 @@
package eu.univento.core.commands;
+import eu.univento.commons.player.Rank;
import eu.univento.core.Core;
import eu.univento.core.api.AutoCommand;
import eu.univento.core.api.languages.Messages;
import eu.univento.core.api.player.CustomPlayer;
import eu.univento.core.api.player.NickName;
-import eu.univento.core.api.player.Rank;
import org.bukkit.command.CommandSender;
import org.bukkit.entity.Player;
import java.util.List;
/**
- * nick command
+ * nick commons
* @author joethei
* @version 1.0
*/
@@ -20,9 +20,9 @@ public class Nick extends AutoCommand{
/**
* @param plugin main class
- * @param command command to execute
- * @param description describes the command
- * @param aliases aliases of command
+ * @param command commons to execute
+ * @param description describes the commons
+ * @param aliases aliases of commons
*/
public Nick(Core plugin, String command, String description, String... aliases) {
super(plugin, command, description, aliases);
@@ -34,17 +34,17 @@ public class Nick extends AutoCommand{
if(sender instanceof Player) {
CustomPlayer p = CustomPlayer.getPlayer(sender.getName());
Messages msgs = new Messages(p);
- if(p.isAllowed(Rank.Partner)) {
- if(p.isNicked()) {
- p.getTeam().removeEntry(p.getDisplayName());
- p.setNicked(false);
- p.getTeam().addEntry(p.getDisplayName());
+ if(p.getDatabasePlayer().isAllowed(Rank.Partner)) {
+ if(p.getDatabasePlayer().getSettings().isNicked()) {
+ p.getScoreboard().getTeam(p.getDatabasePlayer().getRank().getTeam()).removeEntry(p.getDisplayName());
+ p.getDatabasePlayer().getSettings().setNickStatus(false);
+ p.getScoreboard().getTeam(p.getDatabasePlayer().getRank().getTeam()).addEntry(p.getDisplayName());
p.sendMessage(msgs.PREFIX() + msgs.Core_NICK_OFF());
p.removeNick();
}else {
- p.getTeam().removeEntry(p.getDisplayName());
- p.setNicked(true);
- p.getTeam().addEntry(p.getDisplayName());
+ p.getScoreboard().getTeam(p.getDatabasePlayer().getRank().getTeam()).removeEntry(p.getDisplayName());
+ p.getDatabasePlayer().getSettings().setNickStatus(true);
+ p.getScoreboard().getTeam(p.getDatabasePlayer().getRank().getTeam()).addEntry(p.getDisplayName());
p.sendMessage(msgs.PREFIX() + msgs.Core_NICK_ON());
p.setNick(NickName.getRandomNick());
}
diff --git a/src/main/java/eu/univento/core/commands/RunAs.java b/src/main/java/eu/univento/core/commands/RunAs.java
index df6f0f9..76d4b9f 100644
--- a/src/main/java/eu/univento/core/commands/RunAs.java
+++ b/src/main/java/eu/univento/core/commands/RunAs.java
@@ -1,10 +1,10 @@
package eu.univento.core.commands;
+import eu.univento.commons.player.Rank;
import eu.univento.core.Core;
import eu.univento.core.api.AutoCommand;
import eu.univento.core.api.languages.Messages;
import eu.univento.core.api.player.CustomPlayer;
-import eu.univento.core.api.player.Rank;
import org.bukkit.Bukkit;
import org.bukkit.command.CommandSender;
import org.bukkit.entity.Player;
@@ -21,9 +21,9 @@ public class RunAs extends AutoCommand{
/**
* @param plugin main class
- * @param command command to execute
- * @param description describes the command
- * @param aliases aliases of command
+ * @param command commons to execute
+ * @param description describes the commons
+ * @param aliases aliases of commons
*/
public RunAs(Core plugin, String command, String description, String... aliases) {
super(plugin, command, description, aliases);
@@ -35,7 +35,7 @@ public class RunAs extends AutoCommand{
if(sender instanceof Player) {
CustomPlayer p = CustomPlayer.getPlayer(sender.getName());
Messages msgs = new Messages(p);
- if(p.isAllowed(Rank.SrDeveloper)) {
+ if(p.getDatabasePlayer().isAllowed(Rank.SrDeveloper)) {
if(args.length >= 2) {
CustomPlayer t = CustomPlayer.getPlayer(Bukkit.getPlayer(args[0]).getName());
if(t != null) {
diff --git a/src/main/java/eu/univento/core/commands/SetRank.java b/src/main/java/eu/univento/core/commands/SetRank.java
index 304e5d1..44836e9 100644
--- a/src/main/java/eu/univento/core/commands/SetRank.java
+++ b/src/main/java/eu/univento/core/commands/SetRank.java
@@ -1,10 +1,10 @@
package eu.univento.core.commands;
+import eu.univento.commons.player.Rank;
import eu.univento.core.Core;
import eu.univento.core.api.AutoCommand;
import eu.univento.core.api.languages.Messages;
import eu.univento.core.api.player.CustomPlayer;
-import eu.univento.core.api.player.Rank;
import org.bukkit.Bukkit;
import org.bukkit.command.CommandSender;
import org.bukkit.entity.Player;
@@ -27,45 +27,45 @@ public class SetRank extends AutoCommand{
public boolean execute(CommandSender sender, String label, String[] args) {
if(sender instanceof Player) {
CustomPlayer p = CustomPlayer.getPlayer(sender.getName());
- if(p.isAllowed(Rank.SrBuilder)) {
+ if(p.getDatabasePlayer().isAllowed(Rank.SrBuilder)) {
if(args.length == 2) {
Rank rank;
try{
rank = Rank.valueOf(args[1]);
if(Bukkit.getPlayer(args[0]) != null) {
CustomPlayer player = CustomPlayer.getPlayer(args[0]);
- if(player.isAllowed(rank)) {
+ if(player.getDatabasePlayer().isAllowed(rank)) {
p.sendMessage(p.getMessages().PREFIX() + "§cDer Spieler hat den Rang schon oder ist besser.");
p.sendMessage(p.getMessages().PREFIX() + "§cÄnderungen müssen in der Datenbank stattfinden.");
return true;
}
- if(p.isAllowed(Rank.Admin)) {
- player.setRank(rank);
- p.sendMessage(p.getMessages().PREFIX() + p.getMessages().Core_SETRANK_SET(player, player.getRank()));
+ if(p.getDatabasePlayer().isAllowed(Rank.Admin)) {
+ player.getDatabasePlayer().setRank(rank);
+ p.sendMessage(p.getMessages().PREFIX() + p.getMessages().Core_SETRANK_SET(player, player.getDatabasePlayer().getRank()));
refreshTablist();
}
- if(p.isAllowed(Rank.SrDeveloper) && rank.equals(Rank.Developer)) {
- player.setRank(Rank.Developer);
+ if(p.getDatabasePlayer().isAllowed(Rank.SrDeveloper) && rank.equals(Rank.Developer)) {
+ player.getDatabasePlayer().setRank(Rank.Developer);
p.sendMessage(p.getMessages().PREFIX() + p.getMessages().Core_SETRANK_SET(player, Rank.Developer));
refreshTablist();
}
- if(p.isAllowed(Rank.SrSupporter) && rank.equals(Rank.Supporter)) {
- player.setRank(Rank.Supporter);
+ if(p.getDatabasePlayer().isAllowed(Rank.SrSupporter) && rank.equals(Rank.Supporter)) {
+ player.getDatabasePlayer().setRank(Rank.Supporter);
p.sendMessage(p.getMessages().PREFIX() + p.getMessages().Core_SETRANK_SET(player, Rank.Supporter));
refreshTablist();
}
- if(p.isAllowed(Rank.SrSupporter) && rank.equals(Rank.JrSupporter)) {
- player.setRank(Rank.JrSupporter);
+ if(p.getDatabasePlayer().isAllowed(Rank.SrSupporter) && rank.equals(Rank.JrSupporter)) {
+ player.getDatabasePlayer().setRank(Rank.JrSupporter);
p.sendMessage(p.getMessages().PREFIX() + p.getMessages().Core_SETRANK_SET(player, Rank.JrSupporter));
refreshTablist();
}
- if(p.isAllowed(Rank.SrBuilder) && rank.equals(Rank.Builder)) {
- player.setRank(Rank.Builder);
+ if(p.getDatabasePlayer().isAllowed(Rank.SrBuilder) && rank.equals(Rank.Builder)) {
+ player.getDatabasePlayer().setRank(Rank.Builder);
p.sendMessage(p.getMessages().PREFIX() + p.getMessages().Core_SETRANK_SET(player, Rank.Builder));
refreshTablist();
}
- if(p.isAllowed(Rank.SrBuilder) && rank.equals(Rank.JrBuilder)) {
- player.setRank(Rank.JrBuilder);
+ if(p.getDatabasePlayer().isAllowed(Rank.SrBuilder) && rank.equals(Rank.JrBuilder)) {
+ player.getDatabasePlayer().setRank(Rank.JrBuilder);
p.sendMessage(p.getMessages().PREFIX() + p.getMessages().Core_SETRANK_SET(player, Rank.JrBuilder));
refreshTablist();
}
diff --git a/src/main/java/eu/univento/core/commands/SystemInfo.java b/src/main/java/eu/univento/core/commands/SystemInfo.java
index 15a914f..84705a6 100644
--- a/src/main/java/eu/univento/core/commands/SystemInfo.java
+++ b/src/main/java/eu/univento/core/commands/SystemInfo.java
@@ -1,10 +1,11 @@
package eu.univento.core.commands;
+import eu.univento.commons.player.Rank;
+import eu.univento.commons.server.TPS;
import eu.univento.core.Core;
import eu.univento.core.api.AutoCommand;
import eu.univento.core.api.languages.Messages;
import eu.univento.core.api.player.CustomPlayer;
-import eu.univento.core.api.player.Rank;
import org.bukkit.Bukkit;
import org.bukkit.command.CommandSender;
import org.bukkit.entity.Player;
@@ -22,9 +23,9 @@ public class SystemInfo extends AutoCommand{
/**
* @param plugin main class
- * @param command command to execute
- * @param description describes the command
- * @param aliases aliases of command
+ * @param command commons to execute
+ * @param description describes the commons
+ * @param aliases aliases of commons
*/
public SystemInfo(Core plugin, String command, String description, String... aliases) {
super(plugin, command, description, aliases);
@@ -35,7 +36,7 @@ public class SystemInfo extends AutoCommand{
if(sender instanceof Player) {
CustomPlayer p = CustomPlayer.getPlayer(sender.getName());
Messages msgs = new Messages(p);
- if(p.isAllowed(Rank.Developer)) {
+ if(p.getDatabasePlayer().isAllowed(Rank.Developer)) {
Runtime run = Runtime.getRuntime();
p.sendMessage("§6§l===SystemInfo <" + Bukkit.getServerName() + ">===");
try {
@@ -43,6 +44,7 @@ public class SystemInfo extends AutoCommand{
} catch (UnknownHostException e) {
e.printStackTrace();
}
+ p.sendMessage("§6TPS: " + TPS.getTPS());
p.sendMessage("§6Spigot version: " + Bukkit.getVersion());
p.sendMessage("§6Java version: " + System.getProperty("java.version"));
p.sendMessage("§6OS: " + System.getProperty("os.name"));
diff --git a/src/main/java/eu/univento/core/commands/Timeout.java b/src/main/java/eu/univento/core/commands/Timeout.java
index 8ded653..53afc9e 100644
--- a/src/main/java/eu/univento/core/commands/Timeout.java
+++ b/src/main/java/eu/univento/core/commands/Timeout.java
@@ -1,10 +1,10 @@
package eu.univento.core.commands;
+import eu.univento.commons.player.Rank;
import eu.univento.core.Core;
import eu.univento.core.api.AutoCommand;
import eu.univento.core.api.languages.Messages;
import eu.univento.core.api.player.CustomPlayer;
-import eu.univento.core.api.player.Rank;
import org.bukkit.Bukkit;
import org.bukkit.command.CommandSender;
import org.bukkit.entity.Player;
@@ -14,7 +14,6 @@ import java.util.List;
/**
* @author joethei
* @version 0.1
- * Created at 17:54 on 27.07.2016.
*/
public class Timeout extends AutoCommand {
@@ -26,7 +25,7 @@ public class Timeout extends AutoCommand {
public boolean execute(CommandSender sender, String label, String[] args) {
if (sender instanceof Player) {
CustomPlayer p = CustomPlayer.getPlayer((Player) sender);
- if (p.isAllowed(Rank.SrDeveloper)) {
+ if (p.getDatabasePlayer().isAllowed(Rank.SrDeveloper)) {
if (args.length == 1) {
if (Bukkit.getPlayer(args[0]) != null) {
CustomPlayer t = CustomPlayer.getPlayer(args[0]);
@@ -36,13 +35,13 @@ public class Timeout extends AutoCommand {
Core.getTimeout().add(p);
}
} else {
- p.sendMessage(p.getMessage("Command.not_online"));
+ p.sendMessage(p.getDatabasePlayer().getMessage("Command.not_online"));
}
} else {
p.sendMessage("Nicht genug Argumente");
}
} else {
- p.sendMessage(p.getMessage("Command.no_perms"));
+ p.sendMessage(p.getDatabasePlayer().getMessage("Command.no_perms"));
}
} else {
sender.sendMessage(Messages.Console.NOT_A_PLAYER);
diff --git a/src/main/java/eu/univento/core/commands/Vanish.java b/src/main/java/eu/univento/core/commands/Vanish.java
index 9680d0c..01877cb 100644
--- a/src/main/java/eu/univento/core/commands/Vanish.java
+++ b/src/main/java/eu/univento/core/commands/Vanish.java
@@ -1,10 +1,10 @@
package eu.univento.core.commands;
+import eu.univento.commons.player.Rank;
import eu.univento.core.Core;
import eu.univento.core.api.AutoCommand;
import eu.univento.core.api.languages.Messages;
import eu.univento.core.api.player.CustomPlayer;
-import eu.univento.core.api.player.Rank;
import org.bukkit.Bukkit;
import org.bukkit.command.CommandSender;
import org.bukkit.entity.Player;
@@ -32,9 +32,9 @@ public class Vanish extends AutoCommand{
/**
* @param plugin main class
- * @param command command to execute
- * @param description describes the command
- * @param aliases aliases of command
+ * @param command commons to execute
+ * @param description describes the commons
+ * @param aliases aliases of commons
*/
public Vanish(Core plugin, String command, String description, String... aliases) {
super(plugin, command, description, aliases);
@@ -45,7 +45,7 @@ public class Vanish extends AutoCommand{
if(sender instanceof Player) {
CustomPlayer p = CustomPlayer.getPlayer(sender.getName());
Messages msgs = new Messages(p);
- if(p.isAllowed(Rank.JrSupporter)) {
+ if(p.getDatabasePlayer().isAllowed(Rank.JrSupporter)) {
if(players.contains(p)) {
for(Player players : Bukkit.getOnlinePlayers()) {
players.showPlayer(p);
diff --git a/src/main/java/eu/univento/core/listeners/Chat.java b/src/main/java/eu/univento/core/listeners/Chat.java
index 5cc809f..b9d23ec 100644
--- a/src/main/java/eu/univento/core/listeners/Chat.java
+++ b/src/main/java/eu/univento/core/listeners/Chat.java
@@ -1,11 +1,11 @@
package eu.univento.core.listeners;
+import eu.univento.commons.player.Rank;
import eu.univento.core.Core;
import eu.univento.core.api.blocks.MiniBlock;
import eu.univento.core.api.customitems.swords.BestSwordEver;
import eu.univento.core.api.languages.Messages;
import eu.univento.core.api.player.CustomPlayer;
-import eu.univento.core.api.player.Rank;
import eu.univento.core.api.player.WarnReason;
import eu.univento.core.api.server.ServerSettings;
import eu.univento.core.api.shop.ShopItem;
@@ -60,12 +60,12 @@ public class Chat implements Listener {
Messages msgs = p.getMessages();
if (ServerSettings.isMute()) {
- if (!p.isAllowed(Rank.Sound)) {
+ if (!p.getDatabasePlayer().isAllowed(Rank.Sound)) {
e.setCancelled(true);
p.sendMessage(msgs.PREFIX() + msgs.Core_SERVER_MUTED());
}
}
- if (p.isMuted()) {
+ if (p.getDatabasePlayer().isMuted()) {
e.setCancelled(true);
p.sendMessage(msgs.PREFIX() + msgs.Core_SERVER_MUTED());
}
@@ -79,7 +79,7 @@ public class Chat implements Listener {
p.sendMessage("Nicht spammen");
spamPlayers.put(p, spamPlayers.get(p) + 1);
}
- if(spamPlayers.get(p) > 100) {
+ if(spamPlayers.get(p) >= 100) {
p.warn(WarnReason.SPAM, null, "https://players.univento.eu/" + p.getUniqueId().toString() + "/chatlog");
}
@@ -98,11 +98,11 @@ public class Chat implements Listener {
}
String format;
- if (p.isAllowed(Rank.Partner)) {
- if (p.isNicked() && !ServerSettings.isLobby()) {
- format = p.getPrefix() + p.getColor() + p.getDisplayName() + p.getSuffix() + ChatColor.translateAlternateColorCodes('&', e.getMessage());
+ if (p.getDatabasePlayer().isAllowed(Rank.Partner)) {
+ if (p.getDatabasePlayer().getSettings().isNicked() && !ServerSettings.isLobby()) {
+ format = p.getDatabasePlayer().getRank().getPrefix() + p.getDatabasePlayer().getRank().getColor() + p.getDisplayName() + p.getDatabasePlayer().getRank().getSuffix() + ChatColor.translateAlternateColorCodes('&', e.getMessage());
} else {
- format = p.getPrefix() + p.getDisplayName() + p.getSuffix() + e.getMessage();
+ format = p.getDatabasePlayer().getRank().getPrefix() + p.getDisplayName() + p.getDatabasePlayer().getRank().getSuffix() + e.getMessage();
}
if (format.contains("%")) format = format.replace("%", "%%");
e.setFormat(format);
diff --git a/src/main/java/eu/univento/core/listeners/Commands.java b/src/main/java/eu/univento/core/listeners/Commands.java
index 2168dcb..8ce34c1 100644
--- a/src/main/java/eu/univento/core/listeners/Commands.java
+++ b/src/main/java/eu/univento/core/listeners/Commands.java
@@ -1,9 +1,9 @@
package eu.univento.core.listeners;
+import eu.univento.commons.player.Rank;
import eu.univento.core.Core;
import eu.univento.core.api.languages.Messages;
import eu.univento.core.api.player.CustomPlayer;
-import eu.univento.core.api.player.Rank;
import org.bukkit.Bukkit;
import org.bukkit.entity.Player;
import org.bukkit.event.EventHandler;
@@ -21,7 +21,7 @@ public class Commands implements Listener{
/**
- * prints unknown command message
+ * prints unknown commons message
* @param e PlayerCommandPreprocessEvent
*/
@EventHandler(priority = EventPriority.NORMAL)
@@ -38,7 +38,7 @@ public class Commands implements Listener{
}
String cmd = e.getMessage();
if(cmd.equalsIgnoreCase("/rl") || cmd.equalsIgnoreCase("/reload")) {
- if(p.isAllowed(Rank.Admin)) {
+ if(p.getDatabasePlayer().isAllowed(Rank.Admin)) {
e.setCancelled(true);
Bukkit.broadcastMessage(msgs.PREFIX() + "§cWarning ! Server will be restarted");
Bukkit.getScheduler().scheduleSyncDelayedTask(Core.getInstance(), () -> {
diff --git a/src/main/java/eu/univento/core/listeners/Events.java b/src/main/java/eu/univento/core/listeners/Events.java
index 476975e..baabe5b 100644
--- a/src/main/java/eu/univento/core/listeners/Events.java
+++ b/src/main/java/eu/univento/core/listeners/Events.java
@@ -2,10 +2,13 @@ package eu.univento.core.listeners;
import eu.univento.core.api.player.CustomPlayer;
import eu.univento.core.api.server.ServerSettings;
+import org.bukkit.entity.Player;
import org.bukkit.event.EventHandler;
import org.bukkit.event.Listener;
import org.bukkit.event.inventory.InventoryCloseEvent;
+import org.bukkit.event.player.PlayerMoveEvent;
import org.bukkit.event.server.ServerListPingEvent;
+import org.bukkit.util.Vector;
/**
* some basic events
@@ -21,9 +24,16 @@ public class Events implements Listener{
@EventHandler
public void onInventoryClose(InventoryCloseEvent e) {
- CustomPlayer p = CustomPlayer.getPlayer(e.getPlayer().getName());
+ CustomPlayer p = CustomPlayer.getPlayer((Player) e.getPlayer());
p.setOpenInventory(false);
}
+ @EventHandler
+ public void onMove(PlayerMoveEvent e) {
+ CustomPlayer p = CustomPlayer.getPlayer(e.getPlayer());
+ if(p.getLocation().getY() <= 0) {
+ p.setVelocity(new Vector().setY(4.0D).multiply(1.0D));
+ }
+ }
}
\ No newline at end of file
diff --git a/src/main/java/eu/univento/core/listeners/JoinQuit.java b/src/main/java/eu/univento/core/listeners/JoinQuit.java
index 69124d8..b4f733a 100644
--- a/src/main/java/eu/univento/core/listeners/JoinQuit.java
+++ b/src/main/java/eu/univento/core/listeners/JoinQuit.java
@@ -78,16 +78,16 @@ public class JoinQuit implements Listener {
p.setScoreboard(Bukkit.getScoreboardManager().getNewScoreboard());
p.initScoreboard();
p.sendTabHeaderAndFooter(p.getMessages().Core_TAB_TITLE() + Bukkit.getServerName(), p.getMessages().TAB_PREFIX());
- if (p.isNicked() && !ServerSettings.isLobby()) {
+ if (p.getDatabasePlayer().getSettings().isNicked() && !ServerSettings.isLobby()) {
p.setNick(NickName.getRandomNick());
}
for (CustomPlayer player : Core.getOnlinePlayers()) {
- p.getScoreboard().getTeam(player.getTeam().getName()).addEntry(player.getDisplayName());
- player.getScoreboard().getTeam(p.getTeam().getName()).addEntry(p.getDisplayName());
+ p.getScoreboard().getTeam(player.getDatabasePlayer().getRank().getTeam()).addEntry(player.getDisplayName());
+ player.getScoreboard().getTeam(p.getDatabasePlayer().getRank().getTeam()).addEntry(p.getDisplayName());
}
p.setCollidable(false);
- p.setStoryResourcePack();
+ //p.setStoryResourcePack();
loading.add(p);
}
@@ -105,11 +105,11 @@ public class JoinQuit implements Listener {
loading.remove(p);
}
if(e.getStatus() == PlayerResourcePackStatusEvent.Status.FAILED_DOWNLOAD) {
- p.sendMessage(p.getMessage("Pack.failed_download"));
+ p.sendMessage(p.getDatabasePlayer().getMessage("Pack.failed_download"));
Bukkit.getScheduler().runTaskLaterAsynchronously(Core.getInstance(), p::setStoryResourcePack, 10 * 20L);
}
if(e.getStatus() == PlayerResourcePackStatusEvent.Status.DECLINED) {
- p.sendMessage(p.getMessage("Pack.declined"));
+ p.sendMessage(p.getDatabasePlayer().getMessage("Pack.declined"));
Bukkit.getScheduler().runTaskLaterAsynchronously(Core.getInstance(), p::setStoryResourcePack, 10 * 20L);
}
}
@@ -119,7 +119,7 @@ public class JoinQuit implements Listener {
CustomPlayer p = CustomPlayer.getPlayer(e.getPlayer());
if (Build.getPlayers().containsKey(p))
Build.getPlayers().remove(p);
- if (p.isNicked() && !ServerSettings.isLobby()) {
+ if (p.getDatabasePlayer().getSettings().isNicked() && !ServerSettings.isLobby()) {
p.removeNick();
}
for (Team team : p.getScoreboard().getTeams()) {
diff --git a/src/main/java/eu/univento/core/listeners/NPCEvents.java b/src/main/java/eu/univento/core/listeners/NPCEvents.java
index 89b97d8..fe35e6d 100644
--- a/src/main/java/eu/univento/core/listeners/NPCEvents.java
+++ b/src/main/java/eu/univento/core/listeners/NPCEvents.java
@@ -5,7 +5,6 @@ import org.bukkit.event.Listener;
/**
* @author joethei
* @version 0.1
- * Created at 17:24 on 27.07.2016.
*/
public class NPCEvents implements Listener {
diff --git a/src/main/java/eu/univento/core/listeners/PluginMessenger.java b/src/main/java/eu/univento/core/listeners/PluginMessenger.java
index 6d3704d..dd0bbf8 100644
--- a/src/main/java/eu/univento/core/listeners/PluginMessenger.java
+++ b/src/main/java/eu/univento/core/listeners/PluginMessenger.java
@@ -9,7 +9,6 @@ import org.bukkit.entity.Player;
import org.bukkit.plugin.messaging.PluginMessageListener;
import java.io.UnsupportedEncodingException;
-import java.util.logging.Level;
public class PluginMessenger implements PluginMessageListener {
@@ -24,8 +23,8 @@ public class PluginMessenger implements PluginMessageListener {
} catch (UnsupportedEncodingException e) {
e.printStackTrace();
}
- Core.log(Level.INFO, p.getName() + " hat WDL installiert. Version : " + version);
- p.sendMessage(p.getMessage("Prefix") + p.getMessage("Hack.WorldDownloader"));
+ Core.getCommons().getLoggingHandler().getCore().info(p.getName() + " hat WDL installiert. Version : " + version);
+ p.sendMessage(p.getDatabasePlayer().getMessage("Prefix") + p.getDatabasePlayer().getMessage("Hack.WorldDownloader"));
}
if(channel.equals("WDL|CONTROL")) {
p.sendPluginMessage(Core.getInstance(), "WDL|CONTROL", createWDLPacket(0, false, false, false, false));
@@ -33,12 +32,12 @@ public class PluginMessenger implements PluginMessageListener {
if (channel.equals("PERMISSIONSREPL") && new String(data).contains("mod.worlddownloader")) {
//TODO: change to real warn reason
p.warn(WarnReason.SPAM, null, "https://players.univento.eu/" + p.getUniqueId().toString() + "/hacks");
- p.sendMessage(p.getMessage("Prefix") + p.getMessage("Hack.WorldDownloader"));
+ p.sendMessage(p.getDatabasePlayer().getMessage("Prefix") + p.getDatabasePlayer().getMessage("Hack.WorldDownloader"));
}
if(channel.equals("5zig_Set")) {
try {
String version = new String(data, "UTF-8");
- Core.log(Level.INFO, p.getName() + " hat den 5zig Mod Version : " + version);
+ Core.getCommons().getLoggingHandler().getCore().info(p.getName() + " hat den 5zig Mod Version : " + version);
//TODO: disable only some 5zig mod settings | https://gist.github.com/5zig/35e0854504edda418f4b
p.sendPluginMessage(Core.getInstance(), "5zig_Set", new byte[]{0x01 | 0x02 | 0x04 | 0x08 | 0x10});
} catch (UnsupportedEncodingException e) {
@@ -54,10 +53,10 @@ public class PluginMessenger implements PluginMessageListener {
output.writeBoolean(false);
output.writeInt(0);
- output.writeBoolean(false && false);
- output.writeBoolean(false && false);
- output.writeBoolean(false && false);
- output.writeBoolean(false && false && false);
+ output.writeBoolean(false);
+ output.writeBoolean(false);
+ output.writeBoolean(false);
+ output.writeBoolean(false);
return output.toByteArray();
}
diff --git a/src/main/java/eu/univento/core/listeners/SpectatorEvents.java b/src/main/java/eu/univento/core/listeners/SpectatorEvents.java
index 6ff9576..fde5561 100644
--- a/src/main/java/eu/univento/core/listeners/SpectatorEvents.java
+++ b/src/main/java/eu/univento/core/listeners/SpectatorEvents.java
@@ -17,7 +17,6 @@ import org.bukkit.inventory.meta.SkullMeta;
/**
* @author joethei
* @version 0.1
- * created at 19:41 on 17.07.2016.
*/
public class SpectatorEvents implements Listener{
@@ -60,7 +59,7 @@ public class SpectatorEvents implements Listener{
public void onInventoryClick(InventoryClickEvent e) {
CustomPlayer p = CustomPlayer.getPlayer((Player) e.getWhoClicked());
if(SpectateManager.contains(p)) {
- if (e.getInventory().getName().equals(p.getMessage("Game.Menu.SpectateMenu"))) {
+ if (e.getInventory().getName().equals(p.getDatabasePlayer().getMessage("Game.Menu.SpectateMenu"))) {
if(e.getCurrentItem().getType() == Material.SKULL_ITEM) {
SkullMeta meta = (SkullMeta) e.getCurrentItem().getItemMeta();
CustomPlayer player = CustomPlayer.getPlayer(meta.getOwner());
@@ -71,7 +70,7 @@ public class SpectatorEvents implements Listener{
p.closeInventory();
spectator.spectate(player);
}else{
- p.sendMessage(p.getMessage("Not_online"));
+ p.sendMessage(p.getDatabasePlayer().getMessage("Not_online"));
}
}
}
diff --git a/src/main/java/eu/univento/core/listeners/WeaponEvents.java b/src/main/java/eu/univento/core/listeners/WeaponEvents.java
index 5ed2d8a..070af27 100644
--- a/src/main/java/eu/univento/core/listeners/WeaponEvents.java
+++ b/src/main/java/eu/univento/core/listeners/WeaponEvents.java
@@ -11,7 +11,6 @@ import org.bukkit.event.player.PlayerInteractEvent;
/**
* @author joethei
* @version 0.1
- * Created at 20:54 on 12.07.2016.
*/
public class WeaponEvents implements Listener {
diff --git a/src/main/resources/language.properties b/src/main/resources/language.properties
deleted file mode 100644
index a37adf2..0000000
--- a/src/main/resources/language.properties
+++ /dev/null
@@ -1,4 +0,0 @@
-Prefix = undefined
-Tab_Prefix = §8• §6U N I V E N T O §8•
-Not_a_player = You are not a valid player
-No_perms =
diff --git a/src/main/resources/language_de.properties b/src/main/resources/language_de.properties
deleted file mode 100644
index 389f41a..0000000
--- a/src/main/resources/language_de.properties
+++ /dev/null
@@ -1,40 +0,0 @@
-Pack.failed_download = Das Pack konnte nicht geladen werden
-Pack.declined = Du hast das Pack abgelehnt, du wirst nicht das volle Spielerlebnis erhalten
-
-System.unknown_error = Es ist ein unbekannter Fehler aufgetreten
-System.critical_error = Es ist leider ein kritischer Fehler aufgetreten
-
-Server.restart = Der Server wurde neugestartet
-Server.stop = Der Server wurde ausgeschaltet
-Server.reconnect = Bitte verbinde dich neu
-Server.full = Dieser Server ist bereits voll
-Server.ip = IP: play.univento.eu
-Server.ts_ip = TeamSpeak IP: ts.univento.eu
-Server.board_ip = Foren Adresse: forum.univento.eu
-
-Command.prefix = univento.eu Default Command Prefix
-Command.command_not_found = Dieser Befehl konnte nicht gefunden werden
-Command.not_online = Der Spieler $player ist nicht online
-Command.no_perms = Um diesen Befehl zu benutzen hast du keine Rechte
-
-Command.Build.usage = Nutze /build
-Command.Build.toogle_on = Du hast den Build Modus aktiviert
-Command.Build.toogle_off = Du hast den Build Modus deaktiviert
-
-Command.TS.usage = Nutze /ts
-Command.TS.already_verified = Du wurdest bereits verifiziert
-Command.TS.not_online = Du bist nicht mit dem TeamSpeak Server verbunden
-Command.TS.verified = Du wurdest verifiziert
-
-Command.Fix.usage = Nutze /fix
-Command.Fix.own = Du hast dich selbst gefixt
-Command.Fix.other = Du hast $player gefixt
-Command.Fix.by_other = Du wurdest von $player gefixt
-
-Shop.Lobby.Main = Lobby Shop
-Shop.Game.Maya.Main = Maya Game Shop
-
-Lobby.Menu.Profile = Dein Profil
-Lobby.Menu.other_Profile = Profil von $player
-Lobby.Menu.Settings = Einstellungen
-Lobby.Menu.Language = Sprache einstellen
\ No newline at end of file
diff --git a/src/site/site.xml b/src/site/site.xml
new file mode 100644
index 0000000..6630a4f
--- /dev/null
+++ b/src/site/site.xml
@@ -0,0 +1,24 @@
+
+
+
+ Maven
+ https://pbs.twimg.com/profile_banners/4068816154/1463424334
+ http://univento.eu
+
+
+ org.apache.maven.skins
+ maven-fluido-skin
+ 1.5
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file