diff --git a/Diamant-ix_Corre/.classpath b/Diamant-ix_Corre/.classpath
new file mode 100644
index 0000000..8c4ef6a
--- /dev/null
+++ b/Diamant-ix_Corre/.classpath
@@ -0,0 +1,7 @@
+
+
+
+
+
+
+
diff --git a/Diamant-ix_Corre/.project b/Diamant-ix_Corre/.project
new file mode 100644
index 0000000..4e45fa2
--- /dev/null
+++ b/Diamant-ix_Corre/.project
@@ -0,0 +1,17 @@
+
+
+ Diamant-ix_Corre
+
+
+
+
+
+ org.eclipse.jdt.core.javabuilder
+
+
+
+
+
+ org.eclipse.jdt.core.javanature
+
+
diff --git a/Diamant-ix_Corre/.settings/org.eclipse.core.resources.prefs b/Diamant-ix_Corre/.settings/org.eclipse.core.resources.prefs
new file mode 100644
index 0000000..c4ad22a
--- /dev/null
+++ b/Diamant-ix_Corre/.settings/org.eclipse.core.resources.prefs
@@ -0,0 +1,2 @@
+eclipse.preferences.version=1
+encoding//src/de/diamant/hunjy/PlayerManager/events/PlayerJoin.java=UTF-8
diff --git a/Diamant-ix_Corre/.settings/org.eclipse.jdt.core.prefs b/Diamant-ix_Corre/.settings/org.eclipse.jdt.core.prefs
new file mode 100644
index 0000000..bb35fa0
--- /dev/null
+++ b/Diamant-ix_Corre/.settings/org.eclipse.jdt.core.prefs
@@ -0,0 +1,11 @@
+eclipse.preferences.version=1
+org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled
+org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.8
+org.eclipse.jdt.core.compiler.codegen.unusedLocal=preserve
+org.eclipse.jdt.core.compiler.compliance=1.8
+org.eclipse.jdt.core.compiler.debug.lineNumber=generate
+org.eclipse.jdt.core.compiler.debug.localVariable=generate
+org.eclipse.jdt.core.compiler.debug.sourceFile=generate
+org.eclipse.jdt.core.compiler.problem.assertIdentifier=error
+org.eclipse.jdt.core.compiler.problem.enumIdentifier=error
+org.eclipse.jdt.core.compiler.source=1.8
diff --git a/Diamant-ix_Corre/bin/de/diamant/hunjy/CoinSystem/CoinSystem.class b/Diamant-ix_Corre/bin/de/diamant/hunjy/CoinSystem/CoinSystem.class
new file mode 100644
index 0000000..bf1a347
Binary files /dev/null and b/Diamant-ix_Corre/bin/de/diamant/hunjy/CoinSystem/CoinSystem.class differ
diff --git a/Diamant-ix_Corre/bin/de/diamant/hunjy/CoinSystem/command/CoinCommand.class b/Diamant-ix_Corre/bin/de/diamant/hunjy/CoinSystem/command/CoinCommand.class
new file mode 100644
index 0000000..8d4e142
Binary files /dev/null and b/Diamant-ix_Corre/bin/de/diamant/hunjy/CoinSystem/command/CoinCommand.class differ
diff --git a/Diamant-ix_Corre/bin/de/diamant/hunjy/CoinSystem/events/PlayerCoinsChangeEvent.class b/Diamant-ix_Corre/bin/de/diamant/hunjy/CoinSystem/events/PlayerCoinsChangeEvent.class
new file mode 100644
index 0000000..c35fc3d
Binary files /dev/null and b/Diamant-ix_Corre/bin/de/diamant/hunjy/CoinSystem/events/PlayerCoinsChangeEvent.class differ
diff --git a/Diamant-ix_Corre/bin/de/diamant/hunjy/CoinSystem/events/PlayerPayPlayerEvent.class b/Diamant-ix_Corre/bin/de/diamant/hunjy/CoinSystem/events/PlayerPayPlayerEvent.class
new file mode 100644
index 0000000..a05fd9b
Binary files /dev/null and b/Diamant-ix_Corre/bin/de/diamant/hunjy/CoinSystem/events/PlayerPayPlayerEvent.class differ
diff --git a/Diamant-ix_Corre/bin/de/diamant/hunjy/CoinSystem/manager/CoinsManager.class b/Diamant-ix_Corre/bin/de/diamant/hunjy/CoinSystem/manager/CoinsManager.class
new file mode 100644
index 0000000..5eef6a5
Binary files /dev/null and b/Diamant-ix_Corre/bin/de/diamant/hunjy/CoinSystem/manager/CoinsManager.class differ
diff --git a/Diamant-ix_Corre/bin/de/diamant/hunjy/Core.class b/Diamant-ix_Corre/bin/de/diamant/hunjy/Core.class
new file mode 100644
index 0000000..b774817
Binary files /dev/null and b/Diamant-ix_Corre/bin/de/diamant/hunjy/Core.class differ
diff --git a/Diamant-ix_Corre/bin/de/diamant/hunjy/MySQL/MySQL.class b/Diamant-ix_Corre/bin/de/diamant/hunjy/MySQL/MySQL.class
new file mode 100644
index 0000000..29dd558
Binary files /dev/null and b/Diamant-ix_Corre/bin/de/diamant/hunjy/MySQL/MySQL.class differ
diff --git a/Diamant-ix_Corre/bin/de/diamant/hunjy/Permissions/Manager/GroupManager.class b/Diamant-ix_Corre/bin/de/diamant/hunjy/Permissions/Manager/GroupManager.class
new file mode 100644
index 0000000..9f902ef
Binary files /dev/null and b/Diamant-ix_Corre/bin/de/diamant/hunjy/Permissions/Manager/GroupManager.class differ
diff --git a/Diamant-ix_Corre/bin/de/diamant/hunjy/Permissions/PermissionsManager.class b/Diamant-ix_Corre/bin/de/diamant/hunjy/Permissions/PermissionsManager.class
new file mode 100644
index 0000000..db553eb
Binary files /dev/null and b/Diamant-ix_Corre/bin/de/diamant/hunjy/Permissions/PermissionsManager.class differ
diff --git a/Diamant-ix_Corre/bin/de/diamant/hunjy/Permissions/commands/PermsCommand.class b/Diamant-ix_Corre/bin/de/diamant/hunjy/Permissions/commands/PermsCommand.class
new file mode 100644
index 0000000..978d8b5
Binary files /dev/null and b/Diamant-ix_Corre/bin/de/diamant/hunjy/Permissions/commands/PermsCommand.class differ
diff --git a/Diamant-ix_Corre/bin/de/diamant/hunjy/PlayerManager/PlayerManager.class b/Diamant-ix_Corre/bin/de/diamant/hunjy/PlayerManager/PlayerManager.class
new file mode 100644
index 0000000..9a3c97d
Binary files /dev/null and b/Diamant-ix_Corre/bin/de/diamant/hunjy/PlayerManager/PlayerManager.class differ
diff --git a/Diamant-ix_Corre/bin/de/diamant/hunjy/PlayerManager/events/ChatingEvent.class b/Diamant-ix_Corre/bin/de/diamant/hunjy/PlayerManager/events/ChatingEvent.class
new file mode 100644
index 0000000..36c98ed
Binary files /dev/null and b/Diamant-ix_Corre/bin/de/diamant/hunjy/PlayerManager/events/ChatingEvent.class differ
diff --git a/Diamant-ix_Corre/bin/de/diamant/hunjy/PlayerManager/events/PlayerChengeTeamEvent.class b/Diamant-ix_Corre/bin/de/diamant/hunjy/PlayerManager/events/PlayerChengeTeamEvent.class
new file mode 100644
index 0000000..4d45517
Binary files /dev/null and b/Diamant-ix_Corre/bin/de/diamant/hunjy/PlayerManager/events/PlayerChengeTeamEvent.class differ
diff --git a/Diamant-ix_Corre/bin/de/diamant/hunjy/PlayerManager/events/PlayerJoin.class b/Diamant-ix_Corre/bin/de/diamant/hunjy/PlayerManager/events/PlayerJoin.class
new file mode 100644
index 0000000..f6e6781
Binary files /dev/null and b/Diamant-ix_Corre/bin/de/diamant/hunjy/PlayerManager/events/PlayerJoin.class differ
diff --git a/Diamant-ix_Corre/bin/de/diamant/hunjy/manager/CacheManager.class b/Diamant-ix_Corre/bin/de/diamant/hunjy/manager/CacheManager.class
new file mode 100644
index 0000000..4df1f8e
Binary files /dev/null and b/Diamant-ix_Corre/bin/de/diamant/hunjy/manager/CacheManager.class differ
diff --git a/Diamant-ix_Corre/bin/de/diamant/hunjy/manager/FileManager.class b/Diamant-ix_Corre/bin/de/diamant/hunjy/manager/FileManager.class
new file mode 100644
index 0000000..5fbbc8e
Binary files /dev/null and b/Diamant-ix_Corre/bin/de/diamant/hunjy/manager/FileManager.class differ
diff --git a/Diamant-ix_Corre/bin/plugin.yml b/Diamant-ix_Corre/bin/plugin.yml
new file mode 100644
index 0000000..65d0ad6
--- /dev/null
+++ b/Diamant-ix_Corre/bin/plugin.yml
@@ -0,0 +1,15 @@
+name: CoreSystem
+version: 1.0
+
+author: hunjy
+
+main: de.diamant.hunjy.Core
+
+commands:
+ coins:
+ pay:
+ addcoins:
+ removecoins:
+ setcoins:
+ perms:
+ dperms:
\ No newline at end of file
diff --git a/Diamant-ix_Corre/src/de/diamant/hunjy/CoinSystem/CoinSystem.java b/Diamant-ix_Corre/src/de/diamant/hunjy/CoinSystem/CoinSystem.java
new file mode 100644
index 0000000..7777234
--- /dev/null
+++ b/Diamant-ix_Corre/src/de/diamant/hunjy/CoinSystem/CoinSystem.java
@@ -0,0 +1,18 @@
+package de.diamant.hunjy.CoinSystem;
+
+import org.bukkit.entity.Player;
+
+import de.diamant.hunjy.CoinSystem.manager.CoinsManager;
+
+public class CoinSystem {
+
+ public static String prefix = "§6Bank §8» ";
+
+ public CoinSystem() {
+ }
+
+ public static CoinsManager getCoinsManager(Player player) {
+ return new CoinsManager(player);
+ }
+
+}
diff --git a/Diamant-ix_Corre/src/de/diamant/hunjy/CoinSystem/command/CoinCommand.java b/Diamant-ix_Corre/src/de/diamant/hunjy/CoinSystem/command/CoinCommand.java
new file mode 100644
index 0000000..5e0a62e
--- /dev/null
+++ b/Diamant-ix_Corre/src/de/diamant/hunjy/CoinSystem/command/CoinCommand.java
@@ -0,0 +1,180 @@
+package de.diamant.hunjy.CoinSystem.command;
+
+/**
+ * @author hunjy
+ *
+ */
+
+import org.bukkit.entity.Player;
+
+import de.diamant.hunjy.CoinSystem.CoinSystem;
+import de.diamant.hunjy.CoinSystem.events.PlayerCoinsChangeEvent;
+import de.diamant.hunjy.CoinSystem.events.PlayerPayPlayerEvent;
+
+import org.bukkit.Bukkit;
+import org.bukkit.command.Command;
+import org.bukkit.command.CommandExecutor;
+import org.bukkit.command.CommandSender;
+
+public class CoinCommand implements CommandExecutor{
+
+ @Override
+ public boolean onCommand(CommandSender sender, Command command, String label, String[] args) {
+ if(!(sender instanceof Player))
+ return false;
+
+ Player player = (Player)sender;
+
+ if(command.getName().equals("coins")) {
+ if(args.length == 0) {
+ int coins = CoinSystem.getCoinsManager(player).getCoins();
+ player.sendMessage(CoinSystem.prefix + "§aDu hast §6" + coins + " Münzen§a.");
+ }else if(args.length == 1) {
+
+ if(player.hasPermission("admin.coins.seecoins")) {
+ Player target = Bukkit.getPlayer(args[0]);
+ if(target == null) {
+ player.sendMessage(CoinSystem.prefix + "§cDer Spieler ist nicht Online!");
+ return false;
+ }
+ int coins = CoinSystem.getCoinsManager(target).getCoins();
+ player.sendMessage(CoinSystem.prefix + "§7" + target.getName() + " §ahat §6" + coins + " Münzen§a.");
+ }
+ }
+ }else if(command.getName().equals("addcoins")) {
+ if(player.hasPermission("admin.coins.addcoins")) {
+ if(args.length == 2) {
+
+ Player target = Bukkit.getPlayer(args[0]);
+ if(target == null) {
+ player.sendMessage(CoinSystem.prefix + "§cDer Spieler ist nicht Online!");
+ return false;
+ }
+ try {
+ int coins = Integer.valueOf(args[1]);
+
+ if(coins == 0) {
+ player.sendMessage(CoinSystem.prefix + "§cBitte gebe einen gültigen Wert ein!");
+ return false;
+ }
+ CoinSystem.getCoinsManager(target).addCoins(coins);
+
+ target.sendMessage(CoinSystem.prefix + "§aDu hast §6"+ coins + " Münzen §avon §7" + player.getDisplayName() + " §aerhalten");
+ player.sendMessage(CoinSystem.prefix + "§aDu hast dem Spieler §7" + target.getDisplayName() + " §aerfolgreich §6" + coins + " Münzen §agegeben.");
+ Bukkit.getPluginManager().callEvent(new PlayerCoinsChangeEvent(player, target, "add",coins));
+ }catch (NumberFormatException e) {
+ player.sendMessage(CoinSystem.prefix + "§cBitte gebe einen gültigen Wert ein!");
+ return false;
+ }
+ }else {
+ player.sendMessage(CoinSystem.prefix + "§cBenutze: /addcoins [Spieler] [Anzahl]");
+ }
+ }else {
+ return false;
+ }
+ }else if(command.getName().equals("removecoins")) {
+ if(player.hasPermission("admin.coins.removecoins")) {
+ if(args.length == 2) {
+
+ Player target = Bukkit.getPlayer(args[0]);
+ if(target == null) {
+ player.sendMessage(CoinSystem.prefix + "§cDer Spieler ist nicht Online!");
+ return false;
+ }
+ try {
+ int coins = Integer.valueOf(args[1]);
+
+ if(coins == 0) {
+ player.sendMessage(CoinSystem.prefix + "§cBitte gebe einen gültigen Wert ein!");
+ return false;
+ }
+ if(CoinSystem.getCoinsManager(target).getCoins() < coins) {
+ player.sendMessage(CoinSystem.prefix + "§cDer Spieler hat nicht so viele §6Münzen§c.");
+ return false;
+ }
+ CoinSystem.getCoinsManager(target).removeCoins(coins);
+
+ player.sendMessage(CoinSystem.prefix + "§aDu hast dem Spieler §7" + target.getDisplayName() + " §aerfolgreich §6" + coins + " Münzen §aweggenommen.");
+ Bukkit.getPluginManager().callEvent(new PlayerCoinsChangeEvent(player, target, "remove",coins));
+ }catch (NumberFormatException e) {
+ player.sendMessage(CoinSystem.prefix + "§cBitte gebe einen gültigen Wert ein!");
+ return false;
+ }
+ }else {
+ player.sendMessage(CoinSystem.prefix + "§cBenutze: /removecoins [Spieler] [Anzahl]");
+ }
+ }else {
+ return false;
+ }
+ }else if(command.getName().equals("setcoins")) {
+ if(player.hasPermission("admin.coins.setcoins")) {
+ if(args.length == 2) {
+
+ Player target = Bukkit.getPlayer(args[0]);
+ if(target == null) {
+ player.sendMessage(CoinSystem.prefix + "§cDer Spieler ist nicht Online!");
+ return false;
+ }
+ try {
+ int coins = Integer.valueOf(args[1]);
+ if(coins < 0) {
+ player.sendMessage(CoinSystem.prefix + "§cBitte gebe einen gültigen Wert ein!");
+ return false;
+ }
+ CoinSystem.getCoinsManager(target).setCoins(coins);
+
+
+ player.sendMessage(CoinSystem.prefix + "§aDu hast den Kontostand von §7" + target.getDisplayName() + " §aauf §6" + coins + " Münzen §agesetzt.");
+ Bukkit.getPluginManager().callEvent(new PlayerCoinsChangeEvent(player, target, "set",coins));
+ }catch (NumberFormatException e) {
+ player.sendMessage(CoinSystem.prefix + "§cBitte gebe einen gültigen Wert ein!");
+ return false;
+ }
+ }else {
+ player.sendMessage(CoinSystem.prefix + "§cBenutze: /setcoins [Spieler] [Anzahl]");
+ }
+ }else {
+ return false;
+ }
+ }else if(command.getName().equals("pay")) {
+ if(args.length != 2) {
+ player.sendMessage(CoinSystem.prefix + "§cBenutze: /pay [Spieler] [Anzahl]");
+ }else {
+ Player target = Bukkit.getPlayer(args[0]);
+ if(target == null) {
+ player.sendMessage(CoinSystem.prefix + "§cDer Spieler ist nicht Online!");
+ return false;
+ }
+
+ if(target == player || target.getAddress().getHostName() == player.getAddress().getHostName()){
+ player.sendMessage(CoinSystem.prefix + "§cDu kannst dir kein Geld überweisen!");
+ return false;
+ }
+
+ try {
+ int coins = Integer.valueOf(args[1]);
+
+ if(CoinSystem.getCoinsManager(player).getCoins() < coins) {
+ player.sendMessage(CoinSystem.prefix + "§cDu hast nicht genügend §6Münzen§c.");
+ return false;
+ }
+ if(coins == 0) {
+ player.sendMessage(CoinSystem.prefix + "§cBitte gebe einen gültigen Wert ein!");
+ return false;
+ }
+ CoinSystem.getCoinsManager(player).removeCoins(coins);
+ CoinSystem.getCoinsManager(target).addCoins(coins);
+
+ target.sendMessage(CoinSystem.prefix + "§aDu hast §6"+ coins + " Münzen §avon §7" + player.getDisplayName() + " §aerhalten");
+ player.sendMessage(CoinSystem.prefix + "§aDu hast dem Spieler §7" + target.getDisplayName() + " §aerfolgreich §6" + coins + " Münzen §agegeben");
+ Bukkit.getPluginManager().callEvent(new PlayerPayPlayerEvent(player, target, coins));
+ }catch (NumberFormatException e) {
+ player.sendMessage(CoinSystem.prefix + "§cBitte gebe einen gültigen Wert ein!");
+ return false;
+ }
+ }
+ }
+ return false;
+ }
+
+}
\ No newline at end of file
diff --git a/Diamant-ix_Corre/src/de/diamant/hunjy/CoinSystem/events/PlayerCoinsChangeEvent.java b/Diamant-ix_Corre/src/de/diamant/hunjy/CoinSystem/events/PlayerCoinsChangeEvent.java
new file mode 100644
index 0000000..7132354
--- /dev/null
+++ b/Diamant-ix_Corre/src/de/diamant/hunjy/CoinSystem/events/PlayerCoinsChangeEvent.java
@@ -0,0 +1,68 @@
+package de.diamant.hunjy.CoinSystem.events;
+
+
+import org.bukkit.entity.Player;
+import org.bukkit.event.Cancellable;
+import org.bukkit.event.Event;
+import org.bukkit.event.HandlerList;
+
+import de.diamant.hunjy.Core;
+
+
+public class PlayerCoinsChangeEvent extends Event implements Cancellable{
+
+ public static HandlerList handlers = new HandlerList();
+ public boolean cancelled = false;
+
+ Player player;
+ String msg;
+
+ public PlayerCoinsChangeEvent(Player player, Player target, String option, int Coins) {
+ this.player = player;
+ switch (option) {
+ case "add":
+ this.msg = "§8[§c"+ player.getName() + "§8] §7Gibt " + target.getName() + " §6" + Coins + "§6 Münze/n" ;
+ break;
+ case "set":
+ this.msg = "§8[§c"+ player.getName() + "§8] §7Setzt den Kontostand von " + target.getName() + " §7auf §6" + Coins + "§6 Münze/n" ;
+ break;
+ case "remove":
+ this.msg = "§8[§c"+ player.getName() + "§8] §7Entfernt " + target.getName() + " §6" + Coins + "§6 Münze/n" ;
+ break;
+
+ default:
+ break;
+ }
+
+ Core.getInstance().getCacheManager().addCache(this.msg);
+ }
+
+ @Override
+ public boolean isCancelled() {
+ return cancelled;
+ }
+
+ @Override
+ public void setCancelled(boolean cancelled) {
+ this.cancelled = cancelled;
+ }
+
+ @Override
+ public HandlerList getHandlers() {
+ return handlers;
+ }
+
+ public static HandlerList getHandlerList() {
+ return handlers;
+
+ }
+
+ public Player getPlayer() {
+ return player;
+ }
+
+ public String getLog() {
+ return msg;
+ }
+
+}
diff --git a/Diamant-ix_Corre/src/de/diamant/hunjy/CoinSystem/events/PlayerPayPlayerEvent.java b/Diamant-ix_Corre/src/de/diamant/hunjy/CoinSystem/events/PlayerPayPlayerEvent.java
new file mode 100644
index 0000000..8f41b4b
--- /dev/null
+++ b/Diamant-ix_Corre/src/de/diamant/hunjy/CoinSystem/events/PlayerPayPlayerEvent.java
@@ -0,0 +1,53 @@
+package de.diamant.hunjy.CoinSystem.events;
+
+import org.bukkit.entity.Player;
+import org.bukkit.event.Cancellable;
+import org.bukkit.event.Event;
+import org.bukkit.event.HandlerList;
+
+import de.diamant.hunjy.Core;
+
+public class PlayerPayPlayerEvent extends Event implements Cancellable{
+
+ public static HandlerList handlers = new HandlerList();
+ public boolean cancelled = false;
+
+ Player player;
+ String msg;
+
+ public PlayerPayPlayerEvent(Player player, Player target, int coins) {
+ this.player = player;
+ this.msg = "§7" + player.getName() + " §8-> §7" + target.getName() + " §8[§6" + coins + " Münzen§8]";
+
+ Core.getInstance().getCacheManager().addCache(this.msg);
+ }
+
+ @Override
+ public boolean isCancelled() {
+ return cancelled;
+ }
+
+ @Override
+ public void setCancelled(boolean cancelled) {
+ this.cancelled = cancelled;
+ }
+
+ @Override
+ public HandlerList getHandlers() {
+ return handlers;
+ }
+
+ public static HandlerList getHandlerList() {
+ return handlers;
+
+ }
+
+ public Player getPlayer() {
+ return player;
+ }
+
+ public String getMsg() {
+ return msg;
+ }
+
+}
diff --git a/Diamant-ix_Corre/src/de/diamant/hunjy/CoinSystem/manager/CoinsManager.java b/Diamant-ix_Corre/src/de/diamant/hunjy/CoinSystem/manager/CoinsManager.java
new file mode 100644
index 0000000..be6c668
--- /dev/null
+++ b/Diamant-ix_Corre/src/de/diamant/hunjy/CoinSystem/manager/CoinsManager.java
@@ -0,0 +1,82 @@
+package de.diamant.hunjy.CoinSystem.manager;
+
+import java.sql.PreparedStatement;
+import java.sql.ResultSet;
+import java.sql.SQLException;
+
+import org.bukkit.entity.Player;
+
+import de.diamant.hunjy.Core;
+import de.diamant.hunjy.MySQL.MySQL;
+/**
+ * @author hunjy
+ *
+ */
+public class CoinsManager {
+
+ private MySQL mySQL;
+ Player player;
+
+ public CoinsManager(Player player) {
+ mySQL = Core.getInstance().getMySQL();
+ this.player = player;
+ }
+
+ public boolean playerExist() {
+ try {
+ PreparedStatement st = mySQL.getCon().prepareStatement("SELECT * FROM Coins WHERE UUID=?");
+ st.setString(1, player.getUniqueId().toString());
+ ResultSet rs = st.executeQuery();
+ return rs.next();
+ } catch (SQLException e) {
+ e.printStackTrace();
+ }
+
+ return false;
+ }
+
+ public void createPlayer() {
+ mySQL.update("INSERT INTO Coins(UUID, Coins) VALUES ('"+ player.getUniqueId().toString() +"','0')");
+ }
+
+ public int getCoins() {
+ if(!playerExist())
+ createPlayer();
+ int coins = 0;
+
+ ResultSet rs = mySQL.getResultSet("SELECT * FROM Coins WHERE UUID='"+ player.getUniqueId().toString() +"'");
+ try {
+ if(rs.next() && Integer.valueOf(rs.getInt("Coins")) != null) {
+ coins = rs.getInt("Coins");
+ }
+ } catch (SQLException e) {
+ e.printStackTrace();
+ }
+ return coins;
+ }
+
+ public void setCoins(int amount) {
+ if(!playerExist())
+ createPlayer();
+ mySQL.update("UPDATE Coins Set Coins='" + amount + "' WHERE UUID='" + player.getUniqueId().toString() + "'");
+ }
+
+ public void addCoins( int amount) {
+ if(!playerExist())
+ createPlayer();
+ int coins = getCoins();
+ coins += amount;
+ mySQL.update("UPDATE Coins Set Coins='" + coins + "' WHERE UUID='" + player.getUniqueId().toString() + "'");
+ }
+
+ public void removeCoins( int amount) {
+ if(!playerExist())
+ createPlayer();
+ int coins = getCoins();
+ coins -= amount;
+ if(coins >= 0)
+ mySQL.update("UPDATE Coins Set Coins='" + coins + "' WHERE UUID='" + player.getUniqueId().toString() + "'");
+ }
+
+}
+
diff --git a/Diamant-ix_Corre/src/de/diamant/hunjy/Core.java b/Diamant-ix_Corre/src/de/diamant/hunjy/Core.java
new file mode 100644
index 0000000..8fdb27f
--- /dev/null
+++ b/Diamant-ix_Corre/src/de/diamant/hunjy/Core.java
@@ -0,0 +1,90 @@
+package de.diamant.hunjy;
+
+import java.util.UUID;
+
+import org.bukkit.Bukkit;
+import org.bukkit.entity.Player;
+import org.bukkit.plugin.java.JavaPlugin;
+
+import de.diamant.hunjy.CoinSystem.CoinSystem;
+import de.diamant.hunjy.CoinSystem.command.CoinCommand;
+import de.diamant.hunjy.MySQL.MySQL;
+import de.diamant.hunjy.Permissions.PermissionsManager;
+import de.diamant.hunjy.Permissions.commands.PermsCommand;
+import de.diamant.hunjy.PlayerManager.PlayerManager;
+import de.diamant.hunjy.PlayerManager.events.ChatingEvent;
+import de.diamant.hunjy.PlayerManager.events.PlayerJoin;
+import de.diamant.hunjy.manager.CacheManager;
+import de.diamant.hunjy.manager.FileManager;
+
+
+
+public class Core extends JavaPlugin{
+
+ private MySQL mySQL;
+
+
+ public static String prefix = "§eCore §8» ";
+ private static Core instance;
+ private CacheManager cacheManager;
+ private FileManager fileManager;
+
+ @Override
+ public void onLoad() {
+ instance = this;
+ cacheManager = new CacheManager();
+ }
+
+ @Override
+ public void onEnable() {
+
+ fileManager = new FileManager();
+
+
+ mySQL = new MySQL("localhost", "3306", "core", "core", "150965Ingo");
+ mySQL.update("CREATE TABLE IF NOT EXISTS Coins(ID INT(16) PRIMARY KEY NOT NULL, Coins INT(16));");
+ mySQL.update("CREATE TABLE IF NOT EXISTS Permisson(GroupSortID VARCHAR(64), GroupName VARCHAR(64), GroupDisplay VARCHAR(64), Permissons LONGTEXT);");
+ mySQL.update("CREATE TABLE IF NOT EXISTS UserData(ID INT(16) PRIMARY KEY AUTO_INCREMENT NOT NULL,UUID VARCHAR(64), UserName VARCHAR(64) NOT NULL, UserGroup VARCHAR(64));");
+
+ new CoinSystem();
+ new PermissionsManager();
+
+ instance.getCommand("coins").setExecutor(new CoinCommand());
+ instance.getCommand("pay").setExecutor(new CoinCommand());
+ instance.getCommand("addcoins").setExecutor(new CoinCommand());
+ instance.getCommand("setcoins").setExecutor(new CoinCommand());
+ instance.getCommand("removecoins").setExecutor(new CoinCommand());
+
+
+ instance.getCommand("perms").setExecutor(new PermsCommand());
+ instance.getCommand("dperms").setExecutor(new PermsCommand());
+
+ Bukkit.getPluginManager().registerEvents(new PlayerJoin(), this);
+ Bukkit.getPluginManager().registerEvents(new ChatingEvent(), this);
+ }
+
+ public static Core getInstance() {
+ return instance;
+ }
+
+ public MySQL getMySQL() {
+ return mySQL;
+ }
+
+ public CacheManager getCacheManager() {
+ return cacheManager;
+ }
+
+ public PlayerManager getPlayerManager(Player player) {
+ return new PlayerManager(player);
+ }
+
+ public PlayerManager getPlayerManager(UUID uuid) {
+ return new PlayerManager(uuid);
+ }
+
+ public FileManager getFileManager() {
+ return fileManager;
+ }
+
+}
diff --git a/Diamant-ix_Corre/src/de/diamant/hunjy/MySQL/MySQL.java b/Diamant-ix_Corre/src/de/diamant/hunjy/MySQL/MySQL.java
new file mode 100644
index 0000000..bbe8569
--- /dev/null
+++ b/Diamant-ix_Corre/src/de/diamant/hunjy/MySQL/MySQL.java
@@ -0,0 +1,95 @@
+package de.diamant.hunjy.MySQL;
+
+import java.sql.Connection;
+import java.sql.DriverManager;
+import java.sql.PreparedStatement;
+import java.sql.ResultSet;
+import java.sql.SQLException;
+
+import de.diamant.hunjy.Core;
+
+
+public class MySQL {
+ private String HOST = "";
+ private String PORT = "";
+ private String DATABASE = "";
+ private String USER = "";
+ private String PASSWORD = "";
+ private Connection con;
+
+
+ public MySQL(String HOST, String PORT, String DATABASE, String USER, String PASSWORD) {
+ this.HOST = HOST;
+ this.PORT = PORT;
+ this.DATABASE = DATABASE;
+ this.USER = USER;
+ this.PASSWORD = PASSWORD;
+
+ connect();
+ }
+
+ public MySQL(String HOST, String PORT, String DATABASE, String USER) {
+ this.HOST = HOST;
+ this.PORT = PORT;
+ this.DATABASE = DATABASE;
+ this.USER = USER;
+
+ connect();
+ }
+ public MySQL() {
+ this.HOST = Core.getInstance().getFileManager().getConfig().getString("HOST");
+ this.PORT = Core.getInstance().getFileManager().getConfig().getString("PORT");
+ this.DATABASE = Core.getInstance().getFileManager().getConfig().getString("DATABASE");
+ this.USER = Core.getInstance().getFileManager().getConfig().getString("USER");
+
+ if(!Core.getInstance().getFileManager().getConfig().getString("PASSWORD").equals("")) {
+ this.PASSWORD = Core.getInstance().getFileManager().getConfig().getString("PASSWORD");
+ }
+
+ connect();
+ }
+
+ public void connect() {
+ try {
+ con = DriverManager.getConnection("jdbc:mysql://" + HOST + ":" + PORT + "/" + DATABASE + "?autoreconnect=true", USER, PASSWORD);
+ if(con != null)
+ System.out.println(Core.getInstance().getDescription().getFullName() + " >> MySQL: Verbunden");
+ }catch (SQLException e) {
+ e.printStackTrace();
+ }
+ }
+
+ public void closeConnection() {
+ try {
+ if(con != null)
+ con.close();
+ }catch (SQLException e) {
+ e.printStackTrace();
+ }
+ }
+
+ public void update(String qry) {
+ try {
+ PreparedStatement st = con.prepareStatement(qry);
+ st.executeUpdate();
+ } catch (SQLException e) {
+ e.printStackTrace();
+ }
+ }
+
+ public ResultSet getResultSet(String qry) {
+
+ try {
+ PreparedStatement st = con.prepareStatement(qry);
+ return st.executeQuery();
+ } catch (SQLException e) {
+ e.printStackTrace();
+ }
+
+ return null;
+ }
+
+ public Connection getCon() {
+ return con;
+ }
+}
diff --git a/Diamant-ix_Corre/src/de/diamant/hunjy/Permissions/Manager/GroupManager.java b/Diamant-ix_Corre/src/de/diamant/hunjy/Permissions/Manager/GroupManager.java
new file mode 100644
index 0000000..9606817
--- /dev/null
+++ b/Diamant-ix_Corre/src/de/diamant/hunjy/Permissions/Manager/GroupManager.java
@@ -0,0 +1,158 @@
+package de.diamant.hunjy.Permissions.Manager;
+
+import java.sql.PreparedStatement;
+import java.sql.ResultSet;
+import java.sql.SQLException;
+import java.util.ArrayList;
+import java.util.Arrays;
+import java.util.List;
+
+import de.diamant.hunjy.Core;
+import de.diamant.hunjy.MySQL.MySQL;
+
+public class GroupManager {
+
+
+ private MySQL mySQL;
+
+ public GroupManager() {
+ mySQL = Core.getInstance().getMySQL();
+ }
+
+ public boolean existGroup(String groupName) {
+ try {
+ PreparedStatement st = mySQL.getCon().prepareStatement("SELECT * FROM Permisson WHERE GroupName=?");
+ st.setString(1, groupName);
+ ResultSet rs = st.executeQuery();
+ return rs.next();
+ } catch (SQLException e) {
+ e.printStackTrace();
+ }
+ return false;
+ }
+
+ public boolean createGroup(int groupPower, String groupName, String display) {
+ if(!existGroup(groupName)) {
+ mySQL.update("INSERT INTO Permisson(GroupSortID, GroupName, GroupDisplay, Permissons) VALUES ('"+ groupPower +"', '" + groupName + "', '" + display + "', '')");
+ return true;
+ }
+
+ return false;
+ }
+
+ public void setPerms(String groupName, ArrayList perms) {
+ mySQL.update("UPDATE Permisson SET Permissons='" + perms.toString() + "' WHERE GroupName='" + groupName + "'");
+ }
+ public void setDisplay(String groupName, String display) {
+ mySQL.update("UPDATE Permisson SET GroupDisplay='" + display + "' WHERE GroupName='" + groupName + "'");
+}
+
+ public boolean deleteGroup(String groupName) {
+ if(existGroup(groupName)) {
+ try {
+ PreparedStatement st = mySQL.getCon().prepareStatement("DELETE FROM Permisson WHERE GroupName=?");
+ st.setString(1, groupName);
+ st.executeUpdate();
+ } catch (SQLException e) {
+ e.printStackTrace();
+ }
+ return true;
+ }
+
+ return false;
+ }
+
+ public String getDisplayFromGroup(String groupName) {
+ if(existGroup(groupName)) {
+ String display = "";
+ try {
+ PreparedStatement st = mySQL.getCon().prepareStatement("SELECT * FROM Permisson WHERE GroupName=?");
+ st.setString(1, groupName);
+ ResultSet rs = st.executeQuery();
+ while(rs.next()) {
+ display = rs.getString("GroupDisplay").replaceAll("&", "§");
+ }
+ } catch (SQLException e) {
+ e.printStackTrace();
+ }
+ return display;
+ }else {
+ return null;
+ }
+ }
+
+ public int getSortIDFromGroup(String groupName) {
+ if(existGroup(groupName)) {
+ int sortID = 0;
+ try {
+ PreparedStatement st = mySQL.getCon().prepareStatement("SELECT * FROM Permisson WHERE GroupName=?");
+ st.setString(1, groupName);
+ ResultSet rs = st.executeQuery();
+ while(rs.next()) {
+ sortID = rs.getInt("GroupSortID");
+ }
+ } catch (SQLException e) {
+ e.printStackTrace();
+ }
+ return sortID;
+ }else {
+ return 0;
+ }
+ }
+
+ public String getGroupFromSortID(int sortID) {
+ String group = "";
+ try {
+ PreparedStatement st = mySQL.getCon().prepareStatement("SELECT * FROM Permisson WHERE GroupSortID=?");
+ st.setInt(1, sortID);
+ ResultSet rs = st.executeQuery();
+ while(rs.next()) {
+ group = rs.getString("GroupName");
+ }
+ } catch (SQLException e) {
+ e.printStackTrace();
+ }
+ return group;
+ }
+
+ public List getGroups() {
+ List list = new ArrayList<>();
+ try {
+ PreparedStatement st = mySQL.getCon().prepareStatement("SELECT * FROM Permisson");
+ ResultSet rs = st.executeQuery();
+ while(rs.next()) {
+ list.add(rs.getString("GroupName"));
+ }
+ } catch (SQLException e) {
+ e.printStackTrace();
+ }
+
+ return list;
+
+ }
+
+
+ public ArrayList getGroupPermissions(String groupName) {
+ ArrayList list;
+ String perms = "";
+ try {
+ PreparedStatement st = mySQL.getCon().prepareStatement("SELECT * FROM Permisson WHERE GroupName=?");
+ st.setString(1, groupName);
+ ResultSet rs = st.executeQuery();
+ while(rs.next()) {
+ perms = rs.getString("Permissons");
+ }
+ } catch (SQLException e) {
+ e.printStackTrace();
+ }
+ if(perms.length() > 0) {
+ perms = perms.substring(1, perms.length()-1);
+ }else {
+ return new ArrayList();
+ }
+ String[] array = perms.split(", ");
+ list = new ArrayList(Arrays.asList(array));
+ return list;
+
+ }
+}
diff --git a/Diamant-ix_Corre/src/de/diamant/hunjy/Permissions/PermissionsManager.java b/Diamant-ix_Corre/src/de/diamant/hunjy/Permissions/PermissionsManager.java
new file mode 100644
index 0000000..5966a0f
--- /dev/null
+++ b/Diamant-ix_Corre/src/de/diamant/hunjy/Permissions/PermissionsManager.java
@@ -0,0 +1,49 @@
+package de.diamant.hunjy.Permissions;
+
+import java.util.ArrayList;
+
+import org.bukkit.entity.Player;
+import org.bukkit.permissions.PermissionAttachment;
+
+import de.diamant.hunjy.Core;
+import de.diamant.hunjy.Permissions.Manager.GroupManager;
+
+public class PermissionsManager {
+
+ public static String prefix = "§3Perms §8» §7";
+
+ public static GroupManager groupManager;
+
+ public PermissionsManager() {
+ groupManager = new GroupManager();
+ }
+
+ public static GroupManager getGroupManager() {
+ return groupManager;
+ }
+
+ public static void unssetPermission(Player player) {
+ player.setOp(false);
+
+ for(String group : PermissionsManager.getGroupManager().getGroups()) {
+ ArrayList perms = getGroupManager().getGroupPermissions(group);
+ for(String perm : perms) {
+ PermissionAttachment attachment = player.addAttachment(Core.getInstance());
+ attachment.setPermission(perm, false);
+ }
+ }
+ }
+
+ public static void setPermission(Player player) {
+ player.setOp(false);
+ String group = Core.getInstance().getPlayerManager(player).getGroupName();
+ ArrayList perms = getGroupManager().getGroupPermissions(group);
+ for(String perm : perms) {
+ PermissionAttachment attachment = player.addAttachment(Core.getInstance());
+ attachment.setPermission(perm, true);
+ if(perm.equals("*")) {
+ player.setOp(true);
+ }
+ }
+ }
+}
diff --git a/Diamant-ix_Corre/src/de/diamant/hunjy/Permissions/commands/PermsCommand.java b/Diamant-ix_Corre/src/de/diamant/hunjy/Permissions/commands/PermsCommand.java
new file mode 100644
index 0000000..ac70564
--- /dev/null
+++ b/Diamant-ix_Corre/src/de/diamant/hunjy/Permissions/commands/PermsCommand.java
@@ -0,0 +1,205 @@
+package de.diamant.hunjy.Permissions.commands;
+import java.util.ArrayList;
+import java.util.Collections;
+import java.util.List;
+
+import org.bukkit.Bukkit;
+import org.bukkit.command.Command;
+import org.bukkit.command.CommandExecutor;
+import org.bukkit.command.CommandSender;
+import org.bukkit.entity.Player;
+
+import de.diamant.hunjy.Core;
+import de.diamant.hunjy.Permissions.PermissionsManager;
+import de.diamant.hunjy.PlayerManager.events.PlayerChengeTeamEvent;
+
+public class PermsCommand implements CommandExecutor {
+
+ @Override
+ public boolean onCommand(CommandSender sender, Command command, String lable, String[] args) {
+ if(!(sender instanceof Player))return false;
+
+ Player player = (Player)sender;
+
+ if(player.isOp() || player.hasPermission("core.admin,premission")) {
+ if(args.length == 0) {
+ player.sendMessage("§7§m--------------------[§3 Permissions §7§m]--------------------");
+ player.sendMessage(" " + PermissionsManager.prefix + "/perms list");
+ player.sendMessage(" " + PermissionsManager.prefix + "/perms user ");
+
+ player.sendMessage(" " + PermissionsManager.prefix + "/perms createGroup ");
+ player.sendMessage(" " + PermissionsManager.prefix + "/perms removeGroup ");
+
+
+ player.sendMessage(" " + PermissionsManager.prefix + "/perms addPermission ");
+ player.sendMessage(" " + PermissionsManager.prefix + "/perms removePermission ");
+
+ player.sendMessage(" " + PermissionsManager.prefix + "/perms changeDisplay ");
+
+
+ player.sendMessage(" " + PermissionsManager.prefix + "/perms player set group ");
+ player.sendMessage(" " + PermissionsManager.prefix + "/perms player remove group");
+ player.sendMessage("§7§m--------------------[§3 Permissions §7§m]--------------------");
+
+ }else if(args.length >= 1) {
+ if(args[0].equalsIgnoreCase("list")) {
+ player.sendMessage("");
+ List idList = new ArrayList();
+ for(String current : PermissionsManager.getGroupManager().getGroups()) {
+ idList.add(PermissionsManager.getGroupManager().getSortIDFromGroup(current));
+ }
+ Collections.reverse(idList);;
+
+ for(int id : idList) {
+ String group = PermissionsManager.getGroupManager().getGroupFromSortID(id);
+ String display = PermissionsManager.getGroupManager().getDisplayFromGroup(group);
+
+ player.sendMessage("§8[§7" + id + "§8] §7" + group + " §8» §7" + display);
+ }
+ }else if(args[0].equalsIgnoreCase("user")) {
+ if(args.length == 2) {
+ Player target = Bukkit.getPlayer(args[1]);
+ if(target == null) {
+ player.sendMessage("§cDer Spieler ist nicht Online!");
+ return false;
+ }
+ player.sendMessage("§aDer Spieler §e" + target.getName() + " §aist in der Gruppe §8[§7" + Core.getInstance().getPlayerManager(target).getGroupName() + "§8]");
+ }else{
+
+ }
+ }else if(args[0].equalsIgnoreCase("createGroup")) {
+ if(args.length == 4) {
+
+ try {
+ int groupPower = Integer.valueOf(args[1]);
+ String groupName = args[2];
+ String display = "";
+ display = args[3];
+
+ if(PermissionsManager.getGroupManager().createGroup(groupPower, groupName, display)) {
+ player.sendMessage("§aDie Gruppe §8[§7"+ display.replaceAll("&", "§") + "§8] §awurde erstellt!");
+ }else {
+ player.sendMessage("§cDie Gruppe §8[§7"+ groupName + "§8] §cgibt es bereits!");
+ }
+ }catch (NumberFormatException e) {
+ player.sendMessage(PermissionsManager.prefix + "§cBitte gebe einen Richtigen Wert ein!");
+ }
+ }else {
+ player.sendMessage(PermissionsManager.prefix + "/perms createGroup ");
+ return false;
+ }
+ }else if(args[0].equalsIgnoreCase("removeGroup")) {
+ if(args.length == 2) {
+
+ String groupName = args[1];
+
+ if(PermissionsManager.getGroupManager().deleteGroup(groupName)){
+ player.sendMessage("§aDie Gruppe wurde erfolgreich gelöscht!");
+ }else {
+ player.sendMessage("§cDiese Gruppe gibt es nicht!");
+ }
+
+ }else {
+ player.sendMessage(" " + PermissionsManager.prefix + "/perms removeGroup ");
+ return false;
+ }
+ }else if(args[0].equalsIgnoreCase("addPermission")) {
+ if(args.length == 3) {
+ String groupName = args[1];
+ if(!PermissionsManager.getGroupManager().existGroup(groupName)) {
+ player.sendMessage("§cDiese Gruppe gibt es nicht!");
+ return false;
+ }
+ String newPerm = args[2];
+ ArrayList perms = PermissionsManager.getGroupManager().getGroupPermissions(groupName);
+
+ if(perms.contains(newPerm)) {
+ player.sendMessage("§cDie Gruppe hat diese Berechtigung bereits!");
+ return false;
+ }
+
+ perms.add(newPerm);
+ PermissionsManager.getGroupManager().setPerms(groupName, perms);
+ player.sendMessage("§aDie Permission §8[§7" + newPerm + "§8] §awurde der Gruppe " + PermissionsManager.getGroupManager().getDisplayFromGroup(groupName) + " §ahinzugefügt");
+
+ }else {
+ player.sendMessage(" " + PermissionsManager.prefix + "/perms addPermission ");
+ }
+ }else if(args[0].equalsIgnoreCase("removePermission")) {
+ if(args.length == 3) {
+ String groupName = args[1];
+ if(!PermissionsManager.getGroupManager().existGroup(groupName)) {
+ player.sendMessage("§cDiese Gruppe gibt es nicht!");
+ return false;
+ }
+ String newPerm = args[2];
+ ArrayList perms = PermissionsManager.getGroupManager().getGroupPermissions(groupName);
+
+ if(!perms.contains(newPerm)) {
+ player.sendMessage("§cDie Gruppe hat diese Berechtigung nicht!");
+ return false;
+ }
+
+ perms.remove(newPerm);
+ PermissionsManager.getGroupManager().setPerms(groupName, perms);
+ player.sendMessage("§aDie Permission §8[§7" + newPerm + "§8] §awurde der Gruppe " + PermissionsManager.getGroupManager().getDisplayFromGroup(groupName) + " §aentfernt");
+
+ }else {
+ player.sendMessage(" " + PermissionsManager.prefix + "/perms removePermission ");
+ }
+ }else if(args[0].equalsIgnoreCase("changeDisplay")) {
+ if(args.length == 3) {
+ String group = args[1];
+ if(!PermissionsManager.getGroupManager().existGroup(group)) {
+ player.sendMessage("§cDiese Guppe gibt es nicht!");
+ return false;
+ }
+ String display = args[2];
+ PermissionsManager.getGroupManager().setDisplay(group, display);
+ player.sendMessage("§aDie Gruppe §8[§7" + group + "§8] §ahat jetzt den Display §r" + display.replaceAll("&", "§"));
+ }else {
+
+ }
+ }else if(args[0].equalsIgnoreCase("player")) {
+ if(args.length >= 3) {
+ if((args[2].equalsIgnoreCase("set") || args[2].equalsIgnoreCase("add")) && args[3].equalsIgnoreCase("group")) {
+ Player target = Bukkit.getPlayer(args[1]);
+ if(target == null) {
+ player.sendMessage("§cDer Spieler ist nicht Online!");
+ return false;
+ }
+ String group = args[4];
+ if(!PermissionsManager.getGroupManager().existGroup(group)) {
+ player.sendMessage("§cDiese Guppe gibt es nicht!");
+ return false;
+ }
+
+ if(Core.getInstance().getPlayerManager(target).getGroupName().equalsIgnoreCase(group)) {
+ player.sendMessage("§cDer Spieler ist bereits in deiser Gruppe");
+ return false;
+ }
+ Bukkit.getPluginManager().callEvent(new PlayerChengeTeamEvent(target, Core.getInstance().getPlayerManager(target).getGroupDisplay(), PermissionsManager.getGroupManager().getDisplayFromGroup(group)));
+ Core.getInstance().getPlayerManager(target).setGroup(group);
+ player.sendMessage("§aDer Spieler §e" + target.getName() + " §aist jetzt in der Gruppe §8[§7" + group + "§8]");
+ }else if(args[2].equalsIgnoreCase("remove") && args[3].equalsIgnoreCase("group")){
+ Player target = Bukkit.getPlayer(args[1]);
+ if(target == null) {
+ player.sendMessage("§cDer Spieler ist nicht Online!");
+ return false;
+ }
+ Bukkit.getPluginManager().callEvent(new PlayerChengeTeamEvent(target, Core.getInstance().getPlayerManager(target).getGroupDisplay(), PermissionsManager.getGroupManager().getDisplayFromGroup(PermissionsManager.getGroupManager().getGroupFromSortID(0))));
+ Core.getInstance().getPlayerManager(target).setGroup(PermissionsManager.getGroupManager().getGroupFromSortID(0));
+ player.sendMessage("§aDer Spieler §e" + target.getName() + " §aist jetzt in der Gruppe §8[§7" + PermissionsManager.getGroupManager().getGroupFromSortID(0) + "§8]");
+ return true;
+ }
+ }else {
+ player.sendMessage(PermissionsManager.prefix + "/perms setGroup ");
+ }
+ }
+ }
+ }
+
+ return false;
+ }
+
+}
diff --git a/Diamant-ix_Corre/src/de/diamant/hunjy/PlayerManager/PlayerManager.java b/Diamant-ix_Corre/src/de/diamant/hunjy/PlayerManager/PlayerManager.java
new file mode 100644
index 0000000..5bf0253
--- /dev/null
+++ b/Diamant-ix_Corre/src/de/diamant/hunjy/PlayerManager/PlayerManager.java
@@ -0,0 +1,75 @@
+package de.diamant.hunjy.PlayerManager;
+
+import java.sql.PreparedStatement;
+import java.sql.ResultSet;
+import java.sql.SQLException;
+import java.util.UUID;
+
+import org.bukkit.Bukkit;
+import org.bukkit.entity.Player;
+
+import de.diamant.hunjy.Core;
+import de.diamant.hunjy.MySQL.MySQL;
+import de.diamant.hunjy.Permissions.PermissionsManager;
+
+public class PlayerManager {
+
+ UUID uuid;
+ private MySQL mySQL;
+
+ public PlayerManager(Player player) {
+ mySQL = Core.getInstance().getMySQL();
+ this.uuid = player.getUniqueId();
+ }
+
+ public PlayerManager(UUID uuid) {
+ mySQL = Core.getInstance().getMySQL();
+ this.uuid = uuid;
+ }
+
+ public boolean playerExist() {
+ try {
+ PreparedStatement st = mySQL.getCon().prepareStatement("SELECT * FROM UserData WHERE UUID=?");
+ st.setString(1, uuid.toString());
+ ResultSet rs = st.executeQuery();
+ return rs.next();
+ } catch (SQLException e) {
+ e.printStackTrace();
+ }
+ return false;
+ }
+
+ public void createPlayer() {
+ mySQL.update("INSERT INTO UserData(UUID, UserName, UserGroup) VALUES ('"+ uuid.toString() +"','" + Bukkit.getPlayer(uuid).getName() + "', '" + PermissionsManager.getGroupManager().getGroupFromSortID(0) + "')");
+ }
+
+
+ public String getGroupName() {
+ try {
+ PreparedStatement st = mySQL.getCon().prepareStatement("SELECT * FROM UserData WHERE UUID=?");
+ st.setString(1, uuid.toString());
+ ResultSet rs = st.executeQuery();
+ while(rs.next()) {
+ return rs.getString("UserGroup");
+ }
+ } catch (SQLException e) {
+ e.printStackTrace();
+ }
+ return null;
+ }
+ public int getGroupID() {
+ return PermissionsManager.getGroupManager().getSortIDFromGroup(getGroupName());
+ }
+
+ public String getGroupDisplay() {
+ return PermissionsManager.getGroupManager().getDisplayFromGroup(getGroupName());
+ }
+
+ public void setGroup(String group) {
+ mySQL.update("UPDATE UserData Set UserGroup='" + group + "' WHERE UUID='" + uuid.toString() + "'");
+ }
+
+ public void removeGroup() {
+ mySQL.update("UPDATE UserData Set UserGroup='" + PermissionsManager.getGroupManager().getGroupFromSortID(0) + "' WHERE UUID='" + uuid.toString() + "'");
+ }
+}
diff --git a/Diamant-ix_Corre/src/de/diamant/hunjy/PlayerManager/events/ChatingEvent.java b/Diamant-ix_Corre/src/de/diamant/hunjy/PlayerManager/events/ChatingEvent.java
new file mode 100644
index 0000000..1ca2c86
--- /dev/null
+++ b/Diamant-ix_Corre/src/de/diamant/hunjy/PlayerManager/events/ChatingEvent.java
@@ -0,0 +1,26 @@
+package de.diamant.hunjy.PlayerManager.events;
+
+import org.bukkit.entity.Player;
+import org.bukkit.event.EventHandler;
+import org.bukkit.event.Listener;
+import org.bukkit.event.player.AsyncPlayerChatEvent;
+
+public class ChatingEvent implements Listener {
+
+ @EventHandler
+ private void onChat(AsyncPlayerChatEvent event) {
+ Player player = event.getPlayer();
+ event.setFormat(player.getDisplayName() + "§8» §7" + event.getMessage());
+
+ }
+
+ @EventHandler
+ private void onGroupChange(PlayerChengeTeamEvent event) {
+ Player player = event.getPlayer();
+
+
+ player.kickPlayer("§7Du hast einen neuen Rang erhalten\n\n" + event.getOldGroup() + " §8» " + event.getNewGroup() + "\n\n§7Bitte Joine neu auf §9Diamant-ix.de");
+
+ }
+
+}
diff --git a/Diamant-ix_Corre/src/de/diamant/hunjy/PlayerManager/events/PlayerChengeTeamEvent.java b/Diamant-ix_Corre/src/de/diamant/hunjy/PlayerManager/events/PlayerChengeTeamEvent.java
new file mode 100644
index 0000000..5ba2a39
--- /dev/null
+++ b/Diamant-ix_Corre/src/de/diamant/hunjy/PlayerManager/events/PlayerChengeTeamEvent.java
@@ -0,0 +1,56 @@
+package de.diamant.hunjy.PlayerManager.events;
+
+import org.bukkit.entity.Player;
+import org.bukkit.event.Cancellable;
+import org.bukkit.event.Event;
+import org.bukkit.event.HandlerList;
+
+public class PlayerChengeTeamEvent extends Event implements Cancellable{
+
+ public static HandlerList handlers = new HandlerList();
+ public boolean cancelled = false;
+
+ Player player;
+ String oldGroup;
+ String newGroup;
+
+
+ public PlayerChengeTeamEvent(Player player, String oldGroup, String newGroup) {
+ this.player = player;
+ this.oldGroup = oldGroup;
+ this.newGroup = newGroup;
+ }
+
+ @Override
+ public boolean isCancelled() {
+ return cancelled;
+ }
+
+ @Override
+ public void setCancelled(boolean cancelled) {
+ this.cancelled = cancelled;
+ }
+
+ @Override
+ public HandlerList getHandlers() {
+ return handlers;
+ }
+
+ public static HandlerList getHandlerList() {
+ return handlers;
+
+ }
+
+ public Player getPlayer() {
+ return player;
+ }
+
+ public String getOldGroup() {
+ return oldGroup;
+ }
+
+ public String getNewGroup() {
+ return newGroup;
+ }
+
+}
diff --git a/Diamant-ix_Corre/src/de/diamant/hunjy/PlayerManager/events/PlayerJoin.java b/Diamant-ix_Corre/src/de/diamant/hunjy/PlayerManager/events/PlayerJoin.java
new file mode 100644
index 0000000..e85a3cf
--- /dev/null
+++ b/Diamant-ix_Corre/src/de/diamant/hunjy/PlayerManager/events/PlayerJoin.java
@@ -0,0 +1,34 @@
+package de.diamant.hunjy.PlayerManager.events;
+
+import org.bukkit.entity.Player;
+import org.bukkit.event.EventHandler;
+import org.bukkit.event.Listener;
+import org.bukkit.event.player.PlayerJoinEvent;
+import org.bukkit.event.player.PlayerQuitEvent;
+
+import de.diamant.hunjy.Core;
+import de.diamant.hunjy.Permissions.PermissionsManager;
+import de.diamant.hunjy.PlayerManager.PlayerManager;
+
+public class PlayerJoin implements Listener{
+
+ @EventHandler
+ private void onJoin(PlayerJoinEvent event) {
+ Player player = event.getPlayer();
+ PlayerManager pm = Core.getInstance().getPlayerManager(player);
+ if(!pm.playerExist())
+ pm.createPlayer();
+
+ player.setDisplayName(Core.getInstance().getPlayerManager(player).getGroupDisplay() + " §8◠§7" + Core.getInstance().getPlayerManager(player).getGroupDisplay().substring(0, 2) + player.getName() + " §r");
+ PermissionsManager.setPermission(player);
+
+ }
+
+ @EventHandler
+ private void onQuit(PlayerQuitEvent event) {
+ Player player = event.getPlayer();
+ PermissionsManager.setPermission(player);
+
+ }
+
+}
diff --git a/Diamant-ix_Corre/src/de/diamant/hunjy/manager/CacheManager.java b/Diamant-ix_Corre/src/de/diamant/hunjy/manager/CacheManager.java
new file mode 100644
index 0000000..64568c3
--- /dev/null
+++ b/Diamant-ix_Corre/src/de/diamant/hunjy/manager/CacheManager.java
@@ -0,0 +1,37 @@
+package de.diamant.hunjy.manager;
+
+import java.io.File;
+import java.io.IOException;
+import java.sql.Time;
+
+import org.bukkit.configuration.file.YamlConfiguration;
+
+import de.diamant.hunjy.Core;
+
+
+public class CacheManager {
+
+ private File file;
+ private YamlConfiguration config;
+
+ public CacheManager() {
+ file = new File(Core.getInstance().getDataFolder(), "cache.yml");
+ config = YamlConfiguration.loadConfiguration(file);
+ }
+
+ @SuppressWarnings("deprecation")
+ public void addCache(String qry) {
+
+ long millis = System.currentTimeMillis();
+ Time time = new Time(millis);
+
+ config.set(time.toLocaleString(), qry);
+
+ try {
+ config.save(file);
+ } catch (IOException e) {
+ e.printStackTrace();
+ }
+ }
+
+}
diff --git a/Diamant-ix_Corre/src/de/diamant/hunjy/manager/FileManager.java b/Diamant-ix_Corre/src/de/diamant/hunjy/manager/FileManager.java
new file mode 100644
index 0000000..fa8966d
--- /dev/null
+++ b/Diamant-ix_Corre/src/de/diamant/hunjy/manager/FileManager.java
@@ -0,0 +1,49 @@
+package de.diamant.hunjy.manager;
+
+import java.io.File;
+import java.io.IOException;
+
+import org.bukkit.configuration.file.YamlConfiguration;
+
+import de.diamant.hunjy.Core;
+
+
+public class FileManager {
+
+ private File file;
+ private YamlConfiguration config;
+
+ public FileManager() {
+ file = new File(Core.getInstance().getDataFolder(), "MySQL.yml");
+ config = YamlConfiguration.loadConfiguration(file);
+ setDefaults();
+ }
+
+ private void setDefaults() {
+ if(!file.exists()) {
+ config.set("HOST", "localhost");
+ config.set("PORT", "3306");
+ config.set("DATABASE", "coinsystem");
+ config.set("USER", "root");
+ config.set("PASSWORD", "");
+
+ try {
+ config.save(file);
+ } catch (IOException e) {
+
+ e.printStackTrace();
+ }
+ }
+ }
+
+ public File getFile() {
+ return file;
+ }
+
+ public YamlConfiguration getConfig() {
+ return config;
+ }
+
+
+
+}
diff --git a/Diamant-ix_Corre/src/plugin.yml b/Diamant-ix_Corre/src/plugin.yml
new file mode 100644
index 0000000..65d0ad6
--- /dev/null
+++ b/Diamant-ix_Corre/src/plugin.yml
@@ -0,0 +1,15 @@
+name: CoreSystem
+version: 1.0
+
+author: hunjy
+
+main: de.diamant.hunjy.Core
+
+commands:
+ coins:
+ pay:
+ addcoins:
+ removecoins:
+ setcoins:
+ perms:
+ dperms:
\ No newline at end of file