From 63944b2aac495faa186ee622c619a77ae0d37773 Mon Sep 17 00:00:00 2001 From: Johannes Theiner Date: Sun, 6 Dec 2015 11:04:47 +0100 Subject: [PATCH] changed package name, fixed bugs --- .classpath | 1 + src/de/joethei/core/api/Perms.java | 161 ------------ .../joethei => eu/univento}/core/Core.java | 61 +++-- .../univento}/core/api/Actionbar.java | 2 +- .../univento}/core/api/AutoCommand.java | 2 +- .../univento}/core/api/BanSystem.java | 6 +- .../univento}/core/api/Blackscreen.java | 2 +- .../univento}/core/api/BossBar.java | 7 +- .../univento}/core/api/Config.java | 16 +- .../univento}/core/api/CustomPlayer.java | 48 +++- .../univento}/core/api/Database.java | 2 +- .../univento}/core/api/EntityModifier.java | 2 +- .../univento}/core/api/Hologram.java | 2 +- .../univento}/core/api/ItemSkulls.java | 2 +- .../univento}/core/api/Letters.java | 5 +- .../univento}/core/api/Messages.java | 4 +- .../univento}/core/api/MojangService.java | 2 +- .../univento}/core/api/MuteSystem.java | 4 +- .../univento}/core/api/MySQL.java | 2 +- .../joethei => eu/univento}/core/api/NPC.java | 2 +- .../univento}/core/api/NickName.java | 4 +- .../univento}/core/api/Pagifier.java | 2 +- src/eu/univento/core/api/Perms.java | 237 ++++++++++++++++++ .../univento}/core/api/SQLite.java | 2 +- .../univento}/core/api/ServerPinger.java | 2 +- .../univento}/core/api/Servers.java | 5 +- .../univento}/core/api/Settings.java | 2 +- .../univento}/core/api/SignInput.java | 2 +- .../univento}/core/api/SimpleScoreboard.java | 2 +- .../univento}/core/api/Spectator.java | 2 +- src/eu/univento/core/api/TeamSpeak.java | 146 +++++++++++ .../univento}/core/api/Title.java | 2 +- .../univento}/core/api/Utils.java | 2 +- .../univento}/core/api/twitch/API.java | 2 +- .../univento}/core/api/twitch/Twitch_API.java | 2 +- .../core/api/twitch/Twitch_Stream.java | 2 +- .../univento}/core/api/utils/Direction.java | 2 +- .../univento}/core/api/utils/FakeDragon.java | 2 +- .../univento}/core/api/utils/FakeWither.java | 2 +- .../core/api/utils/GameProfileBuilder.java | 2 +- .../univento}/core/api/utils/Maths.java | 2 +- .../univento}/core/api/utils/NameFetcher.java | 2 +- .../core/api/utils/RandomCollection.java | 2 +- .../univento}/core/api/utils/Reflection.java | 2 +- .../univento}/core/api/utils/Vectors.java | 2 +- .../univento}/core/api/youtube/YTAPI.java | 2 +- .../core/api/youtube/YoutubeChannel.java | 2 +- .../univento}/core/commands/Ban.java | 12 +- .../univento}/core/commands/Build.java | 12 +- .../univento}/core/commands/Fix.java | 10 +- .../univento}/core/commands/GameMode.java | 12 +- .../univento}/core/commands/GlobalMute.java | 14 +- .../univento}/core/commands/RunAs.java | 12 +- .../univento}/core/commands/SetRank.java | 14 +- .../univento}/core/commands/SystemInfo.java | 12 +- src/eu/univento/core/commands/TS.java | 57 +++++ .../univento}/core/commands/Twitch.java | 14 +- .../univento}/core/commands/Vanish.java | 12 +- .../univento}/core/commands/Youtuber.java | 14 +- .../univento}/core/listeners/Blocks.java | 8 +- .../univento}/core/listeners/Chat.java | 8 +- .../univento}/core/listeners/Commands.java | 10 +- .../univento}/core/listeners/JoinQuit.java | 18 +- src/plugin.yml | 4 +- 64 files changed, 676 insertions(+), 338 deletions(-) delete mode 100644 src/de/joethei/core/api/Perms.java rename src/{de/joethei => eu/univento}/core/Core.java (76%) rename src/{de/joethei => eu/univento}/core/api/Actionbar.java (93%) rename src/{de/joethei => eu/univento}/core/api/AutoCommand.java (94%) rename src/{de/joethei => eu/univento}/core/api/BanSystem.java (94%) rename src/{de/joethei => eu/univento}/core/api/Blackscreen.java (95%) rename src/{de/joethei => eu/univento}/core/api/BossBar.java (93%) rename src/{de/joethei => eu/univento}/core/api/Config.java (85%) rename src/{de/joethei => eu/univento}/core/api/CustomPlayer.java (80%) rename src/{de/joethei => eu/univento}/core/api/Database.java (93%) rename src/{de/joethei => eu/univento}/core/api/EntityModifier.java (95%) rename src/{de/joethei => eu/univento}/core/api/Hologram.java (96%) rename src/{de/joethei => eu/univento}/core/api/ItemSkulls.java (96%) rename src/{de/joethei => eu/univento}/core/api/Letters.java (95%) rename src/{de/joethei => eu/univento}/core/api/Messages.java (96%) rename src/{de/joethei => eu/univento}/core/api/MojangService.java (95%) rename src/{de/joethei => eu/univento}/core/api/MuteSystem.java (92%) rename src/{de/joethei => eu/univento}/core/api/MySQL.java (93%) rename src/{de/joethei => eu/univento}/core/api/NPC.java (97%) rename src/{de/joethei => eu/univento}/core/api/NickName.java (94%) rename src/{de/joethei => eu/univento}/core/api/Pagifier.java (94%) create mode 100644 src/eu/univento/core/api/Perms.java rename src/{de/joethei => eu/univento}/core/api/SQLite.java (93%) rename src/{de/joethei => eu/univento}/core/api/ServerPinger.java (94%) rename src/{de/joethei => eu/univento}/core/api/Servers.java (93%) rename src/{de/joethei => eu/univento}/core/api/Settings.java (91%) rename src/{de/joethei => eu/univento}/core/api/SignInput.java (96%) rename src/{de/joethei => eu/univento}/core/api/SimpleScoreboard.java (95%) rename src/{de/joethei => eu/univento}/core/api/Spectator.java (93%) create mode 100644 src/eu/univento/core/api/TeamSpeak.java rename src/{de/joethei => eu/univento}/core/api/Title.java (96%) rename src/{de/joethei => eu/univento}/core/api/Utils.java (96%) rename src/{de/joethei => eu/univento}/core/api/twitch/API.java (89%) rename src/{de/joethei => eu/univento}/core/api/twitch/Twitch_API.java (89%) rename src/{de/joethei => eu/univento}/core/api/twitch/Twitch_Stream.java (95%) rename src/{de/joethei => eu/univento}/core/api/utils/Direction.java (88%) rename src/{de/joethei => eu/univento}/core/api/utils/FakeDragon.java (97%) rename src/{de/joethei => eu/univento}/core/api/utils/FakeWither.java (97%) rename src/{de/joethei => eu/univento}/core/api/utils/GameProfileBuilder.java (96%) rename src/{de/joethei => eu/univento}/core/api/utils/Maths.java (95%) rename src/{de/joethei => eu/univento}/core/api/utils/NameFetcher.java (95%) rename src/{de/joethei => eu/univento}/core/api/utils/RandomCollection.java (92%) rename src/{de/joethei => eu/univento}/core/api/utils/Reflection.java (95%) rename src/{de/joethei => eu/univento}/core/api/utils/Vectors.java (93%) rename src/{de/joethei => eu/univento}/core/api/youtube/YTAPI.java (96%) rename src/{de/joethei => eu/univento}/core/api/youtube/YoutubeChannel.java (96%) rename src/{de/joethei => eu/univento}/core/commands/Ban.java (88%) rename src/{de/joethei => eu/univento}/core/commands/Build.java (82%) rename src/{de/joethei => eu/univento}/core/commands/Fix.java (87%) rename src/{de/joethei => eu/univento}/core/commands/GameMode.java (86%) rename src/{de/joethei => eu/univento}/core/commands/GlobalMute.java (78%) rename src/{de/joethei => eu/univento}/core/commands/RunAs.java (85%) rename src/{de/joethei => eu/univento}/core/commands/SetRank.java (86%) rename src/{de/joethei => eu/univento}/core/commands/SystemInfo.java (86%) create mode 100644 src/eu/univento/core/commands/TS.java rename src/{de/joethei => eu/univento}/core/commands/Twitch.java (83%) rename src/{de/joethei => eu/univento}/core/commands/Vanish.java (84%) rename src/{de/joethei => eu/univento}/core/commands/Youtuber.java (82%) rename src/{de/joethei => eu/univento}/core/listeners/Blocks.java (80%) rename src/{de/joethei => eu/univento}/core/listeners/Chat.java (83%) rename src/{de/joethei => eu/univento}/core/listeners/Commands.java (87%) rename src/{de/joethei => eu/univento}/core/listeners/JoinQuit.java (86%) diff --git a/.classpath b/.classpath index 6797ae4..7935976 100644 --- a/.classpath +++ b/.classpath @@ -3,5 +3,6 @@ + diff --git a/src/de/joethei/core/api/Perms.java b/src/de/joethei/core/api/Perms.java deleted file mode 100644 index a63fcc8..0000000 --- a/src/de/joethei/core/api/Perms.java +++ /dev/null @@ -1,161 +0,0 @@ -package de.joethei.core.api; - -import de.joethei.core.Core; - -import java.sql.ResultSet; -import java.sql.SQLException; -import java.util.HashMap; - -/** - * some permission management - * @author joethei - * @version 1.0 - */ -public class Perms{ - - private static HashMap ranks = new HashMap(); - public static HashMap getRanks() { - return ranks; - } - -/** - * gets the prefix of a player - * @param p player - * @return String - */ -public static String getPrefix(CustomPlayer p) { - switch(p.getRank()) { - case Admin: return "§7[§4Admin§7]§4 "; - case Developer: return "§7[§3Developer§7]§3 "; - case HeadBuilder: return "§7[§aHead-Builder§7]§a "; - case Builder: return "§7[§2Builder§7]§2 "; - case Moderator: return "§7[§cModerator§7]§c "; - case Supporter: return "§7[§bSupporter§7]§b "; - case Youtuber: return "§5"; - case Premium: return "§6"; - case Spieler: return "§7"; - default: return "§cFehler "; - } - } - -/** - * gets the suffix of a player - * @param p Player - * @return String - */ -public static String getSuffix(CustomPlayer p) { - switch(p.getRank()) { - case Admin: return " §8» §f§l"; - case Developer: return " §8» §f§l"; - case HeadBuilder: return " §8» §f§l"; - case Builder: return " §8» §f§l"; - case Moderator: return " §8» §f§l"; - case Supporter: return " §8» §f§l"; - case Youtuber: return " §8» §f§l"; - case Premium: return " §8» §f"; - case Spieler: return " §8» §f"; - default: return "§cFehler"; - } - } - -/** - * gets color of a player - * @param p Player - * @return String - */ -public static String getColor(CustomPlayer p) { - switch(p.getRank()) { - case Admin: return "§4"; - case Developer: return "§3"; - case HeadBuilder: return "§a"; - case Builder: return "§2"; - case Moderator: return "§c"; - case Supporter: return "§b"; - case Youtuber: return "§5"; - case Premium: return "§6"; - case Spieler: return "§7"; - default: return "§cFehler"; - } - } - -/** - * gets Rank of player - * @param p Player - * @return Ranks - */ -public static Ranks getRank(CustomPlayer p) { - return getRanks().get(p); - } - -/** - * gets Rank of player fresh from database - * @param p Player - * @return Ranks - * @throws ClassNotFoundException Class couldn't be found - * @throws SQLException SQL server not available or throwing error - */ -public static Ranks getRankFresh(CustomPlayer p) throws SQLException, ClassNotFoundException { - MySQL sql = Core.returnSQL(); - sql.openConnection(); - ResultSet rs = sql.getConnection().createStatement().executeQuery("SELECT * FROM PlayerData WHERE player_uuid='" + p.getUniqueId() + "'"); - rs.next(); - if (rs.getString("player_uuid") != null) { - String rank = rs.getString("Rank"); - Ranks Rank = Ranks.valueOf(rank); - sql.closeConnection(); - return Rank; - } - sql.closeConnection(); - return null; - } - - /** - * sets rank for player - * @param p Player - * @param r Ranks - * @throws ClassNotFoundException Class couldn't be found - * @throws SQLException SQL server not available or throwing error - */ -public static void setRank(CustomPlayer p, Ranks r) throws ClassNotFoundException, SQLException { - MySQL sql = Core.returnSQL(); - sql.openConnection(); - sql.getConnection().createStatement().execute("UPDATE PlayerData SET Rank='" + r.toString() + "' WHERE player_uuid='" + p.getUniqueId() + "';"); - sql.closeConnection(); - } - -/** - * if player is allowed to do - * @param p Player - * @param r Ranks - * @return true / false - * @throws ClassNotFoundException Class couldn't be found - * @throws SQLException SQL server not available or throwing error - */ -public static boolean isAllowed(CustomPlayer p, Ranks r) throws ClassNotFoundException, SQLException{ - Ranks rank; - if(getRank(p) == null) { - rank = getRankFresh(p); - }else { - rank = getRank(p); - } - return rank.value >= r.value; - } - - public static enum Ranks{ - Admin(9), - Developer(8), - HeadBuilder(7), - Builder(6), - Moderator(5), - Supporter(4), - Youtuber(3), - Premium(2), - Spieler(1); - - public final int value; - - private Ranks(int n) { - this.value = n; - } - } -} \ No newline at end of file diff --git a/src/de/joethei/core/Core.java b/src/eu/univento/core/Core.java similarity index 76% rename from src/de/joethei/core/Core.java rename to src/eu/univento/core/Core.java index 129c0a7..a9a593b 100644 --- a/src/de/joethei/core/Core.java +++ b/src/eu/univento/core/Core.java @@ -1,4 +1,4 @@ -package de.joethei.core; +package eu.univento.core; import java.io.IOException; import java.sql.SQLException; @@ -10,25 +10,27 @@ import org.bukkit.Bukkit; import org.bukkit.plugin.PluginManager; import org.bukkit.plugin.java.JavaPlugin; -import de.joethei.core.api.Messages; -import de.joethei.core.api.Config; -import de.joethei.core.api.CustomPlayer; -import de.joethei.core.api.MySQL; -import de.joethei.core.api.Settings; -import de.joethei.core.commands.Ban; -import de.joethei.core.commands.Build; -import de.joethei.core.commands.Fix; -import de.joethei.core.commands.GameMode; -import de.joethei.core.commands.GlobalMute; -import de.joethei.core.commands.RunAs; -import de.joethei.core.commands.SetRank; -import de.joethei.core.commands.SystemInfo; -import de.joethei.core.commands.Vanish; -import de.joethei.core.commands.Youtuber; -import de.joethei.core.listeners.Blocks; -import de.joethei.core.listeners.Chat; -import de.joethei.core.listeners.Commands; -import de.joethei.core.listeners.JoinQuit; +import eu.univento.core.api.Config; +import eu.univento.core.api.CustomPlayer; +import eu.univento.core.api.Messages; +import eu.univento.core.api.MySQL; +import eu.univento.core.api.Perms; +import eu.univento.core.api.Settings; +import eu.univento.core.commands.Ban; +import eu.univento.core.commands.Build; +import eu.univento.core.commands.Fix; +import eu.univento.core.commands.GameMode; +import eu.univento.core.commands.GlobalMute; +import eu.univento.core.commands.RunAs; +import eu.univento.core.commands.SetRank; +import eu.univento.core.commands.SystemInfo; +import eu.univento.core.commands.TS; +import eu.univento.core.commands.Vanish; +import eu.univento.core.commands.Youtuber; +import eu.univento.core.listeners.Blocks; +import eu.univento.core.listeners.Chat; +import eu.univento.core.listeners.Commands; +import eu.univento.core.listeners.JoinQuit; /** * main class @@ -51,7 +53,7 @@ public class Core extends JavaPlugin{ /** * mysql stuff */ - private static MySQL sql = new MySQL(getInstance(), Config.readString("MySQL.Host"), Config.readString("MySQL.Port"), Config.readString("MySQL.DB"), Config.readString("MySQL.User"), Config.readString("MySQL.Pass") + "?autoReconnect=true"); + private static MySQL sql = new MySQL(getInstance(), Config.readString("MySQL.Host"), Config.readString("MySQL.Port"), Config.readString("MySQL.DB"), Config.readString("MySQL.User"), Config.readString("MySQL.Pass")); /** * @return sql */ @@ -83,12 +85,12 @@ public class Core extends JavaPlugin{ Settings.setBuild(true); try { Config.writeDefault(); - } catch (ClassNotFoundException | SQLException | IOException e1) { - e1.printStackTrace(); + } catch (ClassNotFoundException | SQLException | IOException e) { + e.printStackTrace(); } instance = this; if(Settings.isDebug()) log(Level.INFO, "Debug Modus aktiviert"); - + Perms.initScoreboard(); PluginManager pm = Bukkit.getPluginManager(); pm.registerEvents(new Commands(), this); pm.registerEvents(new JoinQuit(), this); @@ -121,6 +123,9 @@ public class Core extends JavaPlugin{ String[] youtuber = {""}; new Youtuber(this, "youtuber", "setzt Spieler in den Youtuber Rang", youtuber); + String[] ts = {""}; + new TS(this, "ts", "verifiziert Spieler auf dem TS", ts); + String[] ban = {""}; new Ban(this, "ban", "Bannt Spieler", ban); @@ -137,7 +142,7 @@ public class Core extends JavaPlugin{ MySQL tempSQL = sql; tempSQL.openConnection(); - tempSQL.getConnection().createStatement().execute("CREATE TABLE IF NOT EXISTS PlayerData(ID bigint PRIMARY KEY auto_increment, player_uuid varchar(50), FirstJoin TIMESTAMP default now(), Coins bigint, mute boolean, Rank varchar(15), nick boolean, FastMenu boolean, teleport boolean);"); + tempSQL.getConnection().createStatement().execute("CREATE TABLE IF NOT EXISTS PlayerData(ID bigint PRIMARY KEY auto_increment, player_uuid varchar(50), FirstJoin TIMESTAMP default now(), Coins bigint, mute boolean, Rank varchar(15),TS-ID bigint, Friends varchar(2500), nick boolean, FastMenu boolean, teleport boolean);"); if(Settings.isDebug()) log(Level.INFO, "MySQL PlayerData ausgeführt"); tempSQL.getConnection().createStatement().execute("CREATE TABLE IF NOT EXISTS bans(ID bigint PRIMARY KEY auto_increment, player_uuid varchar(50), Reason varchar(50), who varchar(50));"); @@ -157,6 +162,12 @@ public class Core extends JavaPlugin{ e.printStackTrace(); } Bukkit.getMessenger().registerOutgoingPluginChannel(this, "BungeeCord"); + try { + Messages.writeDefault(); + Messages.readStrings(); + } catch (ClassNotFoundException | SQLException e) { + e.printStackTrace(); + } log(Level.INFO, "Plugin ver. " + getDescription().getVersion() + " gestartet"); } diff --git a/src/de/joethei/core/api/Actionbar.java b/src/eu/univento/core/api/Actionbar.java similarity index 93% rename from src/de/joethei/core/api/Actionbar.java rename to src/eu/univento/core/api/Actionbar.java index 2c013c9..bd1cfc6 100644 --- a/src/de/joethei/core/api/Actionbar.java +++ b/src/eu/univento/core/api/Actionbar.java @@ -1,4 +1,4 @@ -package de.joethei.core.api; +package eu.univento.core.api; import java.lang.reflect.Field; diff --git a/src/de/joethei/core/api/AutoCommand.java b/src/eu/univento/core/api/AutoCommand.java similarity index 94% rename from src/de/joethei/core/api/AutoCommand.java rename to src/eu/univento/core/api/AutoCommand.java index 403400e..d2b678b 100644 --- a/src/de/joethei/core/api/AutoCommand.java +++ b/src/eu/univento/core/api/AutoCommand.java @@ -1,4 +1,4 @@ -package de.joethei.core.api; +package eu.univento.core.api; import java.lang.reflect.Field; import java.util.ArrayList; diff --git a/src/de/joethei/core/api/BanSystem.java b/src/eu/univento/core/api/BanSystem.java similarity index 94% rename from src/de/joethei/core/api/BanSystem.java rename to src/eu/univento/core/api/BanSystem.java index ea2d1ee..46ef3d7 100644 --- a/src/de/joethei/core/api/BanSystem.java +++ b/src/eu/univento/core/api/BanSystem.java @@ -1,7 +1,7 @@ -package de.joethei.core.api; +package eu.univento.core.api; -import de.joethei.core.Core; -import de.joethei.core.api.utils.NameFetcher; +import eu.univento.core.Core; +import eu.univento.core.api.utils.NameFetcher; import java.sql.ResultSet; import java.sql.SQLException; diff --git a/src/de/joethei/core/api/Blackscreen.java b/src/eu/univento/core/api/Blackscreen.java similarity index 95% rename from src/de/joethei/core/api/Blackscreen.java rename to src/eu/univento/core/api/Blackscreen.java index cbab265..87844cc 100644 --- a/src/de/joethei/core/api/Blackscreen.java +++ b/src/eu/univento/core/api/Blackscreen.java @@ -1,4 +1,4 @@ -package de.joethei.core.api; +package eu.univento.core.api; import java.lang.reflect.Field; import java.lang.reflect.Method; diff --git a/src/de/joethei/core/api/BossBar.java b/src/eu/univento/core/api/BossBar.java similarity index 93% rename from src/de/joethei/core/api/BossBar.java rename to src/eu/univento/core/api/BossBar.java index 7ff3241..f9a3395 100644 --- a/src/de/joethei/core/api/BossBar.java +++ b/src/eu/univento/core/api/BossBar.java @@ -1,11 +1,12 @@ -package de.joethei.core.api; +package eu.univento.core.api; -import de.joethei.core.api.utils.FakeDragon; -import de.joethei.core.api.utils.FakeWither; import java.util.HashMap; import java.util.Map; import org.bukkit.entity.Player; +import eu.univento.core.api.utils.FakeDragon; +import eu.univento.core.api.utils.FakeWither; + public class BossBar { public static Map playerdragonbartask = new HashMap(); diff --git a/src/de/joethei/core/api/Config.java b/src/eu/univento/core/api/Config.java similarity index 85% rename from src/de/joethei/core/api/Config.java rename to src/eu/univento/core/api/Config.java index 1d20917..41a4f9c 100644 --- a/src/de/joethei/core/api/Config.java +++ b/src/eu/univento/core/api/Config.java @@ -1,4 +1,4 @@ -package de.joethei.core.api; +package eu.univento.core.api; import java.io.File; import java.io.IOException; @@ -29,11 +29,15 @@ public class Config { //editable messages will be set here, but do not edit this messages. //seting the default MySQL config. - cfg.set("MySQL.Host", "192.168.0.101"); - cfg.set("MySQL.Port", "3306"); - cfg.set("MySQL.DB", "core"); - cfg.set("MySQL.User", "root");//best user name - cfg.set("MySQL.Pass", "");//best password + cfg.addDefault("MySQL.Host", "192.168.0.101"); + cfg.addDefault("MySQL.Port", "3306"); + cfg.addDefault("MySQL.DB", "core"); + cfg.addDefault("MySQL.User", "root");//best user name + cfg.addDefault("MySQL.Pass", "");//best password + cfg.addDefault("TS.IP", "ts.univento.eu"); + cfg.addDefault("TS.QueryPort", 0); + cfg.addDefault("TS.QueryUser", "ServerQuery"); + cfg.addDefault("TS.QueryPass", "password"); cfg.options().copyDefaults(true); cfg.save(file); diff --git a/src/de/joethei/core/api/CustomPlayer.java b/src/eu/univento/core/api/CustomPlayer.java similarity index 80% rename from src/de/joethei/core/api/CustomPlayer.java rename to src/eu/univento/core/api/CustomPlayer.java index 24f218a..c911632 100644 --- a/src/de/joethei/core/api/CustomPlayer.java +++ b/src/eu/univento/core/api/CustomPlayer.java @@ -1,4 +1,4 @@ -package de.joethei.core.api; +package eu.univento.core.api; import java.sql.SQLException; import java.util.HashMap; @@ -7,8 +7,11 @@ import org.bukkit.Bukkit; import org.bukkit.craftbukkit.v1_8_R3.CraftServer; import org.bukkit.craftbukkit.v1_8_R3.entity.CraftPlayer; import org.bukkit.entity.Player; +import org.bukkit.scoreboard.Team; -import de.joethei.core.api.Perms.Ranks; +import com.github.theholywaffle.teamspeak3.api.wrapper.ClientInfo; + +import eu.univento.core.api.Perms.Ranks; /** * custom player implementation @@ -132,7 +135,7 @@ public class CustomPlayer extends CraftPlayer { if(customPrefix != null) { return customPrefix; }else { - return Perms.getPrefix(this); + return Perms.getPrefix(getRank()); } } @@ -144,7 +147,7 @@ public class CustomPlayer extends CraftPlayer { if(customSuffix != null) { return customSuffix; } - return Perms.getSuffix(this); + return Perms.getSuffix(getRank()); } /** @@ -155,7 +158,7 @@ public class CustomPlayer extends CraftPlayer { if(customColor != null) { return customColor; } - return Perms.getColor(this); + return Perms.getColor(getRank()); } /** @@ -182,6 +185,14 @@ public class CustomPlayer extends CraftPlayer { customColor = color; } + /** + * gets scoreboard team for player + * @return Team + */ + public Team getTeam() { + return Perms.getTeam(getRank()); + } + /** * if player is muted * @return true/false @@ -292,4 +303,31 @@ public class CustomPlayer extends CraftPlayer { } } + /** + * gets Client Info from TeamSpeak + * @return ClientInfo + */ + public ClientInfo getTSClientInfo() { + TeamSpeak ts = new TeamSpeak(); + try { + return ts.getClientInfo(ts.getTsId(this)); + } catch (ClassNotFoundException | SQLException e) { + e.printStackTrace(); + return null; + } + } + + /** + * verifys player account on teamspeak + */ + public void verifyTs() { + TeamSpeak ts = new TeamSpeak(); + try { + ts.setRank(this); + } catch (ClassNotFoundException | SQLException e) { + e.printStackTrace(); + } + } + + } \ No newline at end of file diff --git a/src/de/joethei/core/api/Database.java b/src/eu/univento/core/api/Database.java similarity index 93% rename from src/de/joethei/core/api/Database.java rename to src/eu/univento/core/api/Database.java index a8d3676..9893a65 100644 --- a/src/de/joethei/core/api/Database.java +++ b/src/eu/univento/core/api/Database.java @@ -1,4 +1,4 @@ -package de.joethei.core.api; +package eu.univento.core.api; import java.sql.Connection; import java.sql.ResultSet; diff --git a/src/de/joethei/core/api/EntityModifier.java b/src/eu/univento/core/api/EntityModifier.java similarity index 95% rename from src/de/joethei/core/api/EntityModifier.java rename to src/eu/univento/core/api/EntityModifier.java index 523c3d0..3373927 100644 --- a/src/de/joethei/core/api/EntityModifier.java +++ b/src/eu/univento/core/api/EntityModifier.java @@ -1,4 +1,4 @@ -package de.joethei.core.api; +package eu.univento.core.api; import java.lang.reflect.Field; import net.minecraft.server.v1_8_R3.EntityLiving; diff --git a/src/de/joethei/core/api/Hologram.java b/src/eu/univento/core/api/Hologram.java similarity index 96% rename from src/de/joethei/core/api/Hologram.java rename to src/eu/univento/core/api/Hologram.java index 1e18174..7bf9a04 100644 --- a/src/de/joethei/core/api/Hologram.java +++ b/src/eu/univento/core/api/Hologram.java @@ -1,4 +1,4 @@ -package de.joethei.core.api; +package eu.univento.core.api; import java.lang.reflect.Constructor; import java.lang.reflect.InvocationTargetException; diff --git a/src/de/joethei/core/api/ItemSkulls.java b/src/eu/univento/core/api/ItemSkulls.java similarity index 96% rename from src/de/joethei/core/api/ItemSkulls.java rename to src/eu/univento/core/api/ItemSkulls.java index fdbe580..0480aa2 100644 --- a/src/de/joethei/core/api/ItemSkulls.java +++ b/src/eu/univento/core/api/ItemSkulls.java @@ -1,4 +1,4 @@ -package de.joethei.core.api; +package eu.univento.core.api; import com.mojang.authlib.GameProfile; import com.mojang.authlib.properties.Property; diff --git a/src/de/joethei/core/api/Letters.java b/src/eu/univento/core/api/Letters.java similarity index 95% rename from src/de/joethei/core/api/Letters.java rename to src/eu/univento/core/api/Letters.java index 12c8f3a..95874b1 100644 --- a/src/de/joethei/core/api/Letters.java +++ b/src/eu/univento/core/api/Letters.java @@ -1,12 +1,13 @@ -package de.joethei.core.api; +package eu.univento.core.api; -import de.joethei.core.api.utils.Direction; import java.util.ArrayList; import java.util.List; import org.bukkit.Location; import org.bukkit.Material; import org.bukkit.block.Block; +import eu.univento.core.api.utils.Direction; + public enum Letters { LETTER_A('a', diff --git a/src/de/joethei/core/api/Messages.java b/src/eu/univento/core/api/Messages.java similarity index 96% rename from src/de/joethei/core/api/Messages.java rename to src/eu/univento/core/api/Messages.java index a354fc7..0110f7a 100644 --- a/src/de/joethei/core/api/Messages.java +++ b/src/eu/univento/core/api/Messages.java @@ -1,9 +1,9 @@ -package de.joethei.core.api; +package eu.univento.core.api; import java.sql.ResultSet; import java.sql.SQLException; -import de.joethei.core.Core; +import eu.univento.core.Core; /** * messages from database diff --git a/src/de/joethei/core/api/MojangService.java b/src/eu/univento/core/api/MojangService.java similarity index 95% rename from src/de/joethei/core/api/MojangService.java rename to src/eu/univento/core/api/MojangService.java index 50aab6a..7421f72 100644 --- a/src/de/joethei/core/api/MojangService.java +++ b/src/eu/univento/core/api/MojangService.java @@ -1,4 +1,4 @@ -package de.joethei.core.api; +package eu.univento.core.api; import java.io.BufferedReader; import java.io.IOException; diff --git a/src/de/joethei/core/api/MuteSystem.java b/src/eu/univento/core/api/MuteSystem.java similarity index 92% rename from src/de/joethei/core/api/MuteSystem.java rename to src/eu/univento/core/api/MuteSystem.java index 02089cc..4eff166 100644 --- a/src/de/joethei/core/api/MuteSystem.java +++ b/src/eu/univento/core/api/MuteSystem.java @@ -1,10 +1,10 @@ -package de.joethei.core.api; +package eu.univento.core.api; import java.sql.ResultSet; import java.sql.SQLException; import org.bukkit.entity.Player; -import de.joethei.core.Core; +import eu.univento.core.Core; /** * querys database for muted players diff --git a/src/de/joethei/core/api/MySQL.java b/src/eu/univento/core/api/MySQL.java similarity index 93% rename from src/de/joethei/core/api/MySQL.java rename to src/eu/univento/core/api/MySQL.java index a7dbf9e..b11a920 100644 --- a/src/de/joethei/core/api/MySQL.java +++ b/src/eu/univento/core/api/MySQL.java @@ -1,4 +1,4 @@ -package de.joethei.core.api; +package eu.univento.core.api; import java.sql.Connection; import java.sql.DriverManager; diff --git a/src/de/joethei/core/api/NPC.java b/src/eu/univento/core/api/NPC.java similarity index 97% rename from src/de/joethei/core/api/NPC.java rename to src/eu/univento/core/api/NPC.java index 8f44283..d081bde 100644 --- a/src/de/joethei/core/api/NPC.java +++ b/src/eu/univento/core/api/NPC.java @@ -1,4 +1,4 @@ -package de.joethei.core.api; +package eu.univento.core.api; import com.google.gson.Gson; import com.google.gson.GsonBuilder; diff --git a/src/de/joethei/core/api/NickName.java b/src/eu/univento/core/api/NickName.java similarity index 94% rename from src/de/joethei/core/api/NickName.java rename to src/eu/univento/core/api/NickName.java index 96f34d0..401f1ff 100644 --- a/src/de/joethei/core/api/NickName.java +++ b/src/eu/univento/core/api/NickName.java @@ -1,4 +1,4 @@ -package de.joethei.core.api; +package eu.univento.core.api; import java.sql.ResultSet; import java.sql.SQLException; @@ -6,7 +6,7 @@ import java.util.ArrayList; import java.util.Random; import org.bukkit.entity.Player; -import de.joethei.core.Core; +import eu.univento.core.Core; /** * gets nick settings for players diff --git a/src/de/joethei/core/api/Pagifier.java b/src/eu/univento/core/api/Pagifier.java similarity index 94% rename from src/de/joethei/core/api/Pagifier.java rename to src/eu/univento/core/api/Pagifier.java index aab2585..f024d14 100644 --- a/src/de/joethei/core/api/Pagifier.java +++ b/src/eu/univento/core/api/Pagifier.java @@ -1,4 +1,4 @@ -package de.joethei.core.api; +package eu.univento.core.api; import java.util.ArrayList; import java.util.List; diff --git a/src/eu/univento/core/api/Perms.java b/src/eu/univento/core/api/Perms.java new file mode 100644 index 0000000..56d073b --- /dev/null +++ b/src/eu/univento/core/api/Perms.java @@ -0,0 +1,237 @@ +package eu.univento.core.api; + +import java.sql.ResultSet; +import java.sql.SQLException; +import java.util.HashMap; + +import org.bukkit.Bukkit; +import org.bukkit.scoreboard.NameTagVisibility; +import org.bukkit.scoreboard.Scoreboard; +import org.bukkit.scoreboard.Team; + +import eu.univento.core.Core; + +/** + * some permission management + * @author joethei + * @version 1.0 + */ +public class Perms{ + + private static HashMap ranks = new HashMap(); + public static HashMap getRanks() { + return ranks; + } + +/** + * gets the prefix of a player + * @param r Ranks + * @return String + */ +public static String getPrefix(Ranks r) { + switch(r) { + case Admin: return "§7[§4Admin§7]§4 "; + case Developer: return "§7[§aDeveloper§7]§3 "; + case Moderator: return "§7[§cModerator§7]§c "; + case HeadBuilder: return "§7[§2Head-Builder§7]§a "; + case Builder: return "§7[§2Builder§7]§2 "; + case Supporter: return "§7[§bSupporter§7]§b "; + case Youtuber: return "§5"; + case Premium: return "§6"; + case Spieler: return "§7"; + default: return "§cFehler "; + } + } + +/** + * gets the suffix of a player + * @param r Ranks + * @return String + */ +public static String getSuffix(Ranks r) { + switch(r) { + case Admin: return " §8» §6"; + case Developer: return " §8» §f"; + case Moderator: return " §8» §f"; + case HeadBuilder: return " §8» §f"; + case Builder: return " §8» §f"; + case Supporter: return " §8» §f"; + case Youtuber: return " §8» §f"; + case Premium: return " §8» §f"; + case Spieler: return " §8» §f"; + default: return "§cFehler"; + } + } + +/** + * gets color of a player + * @param r Ranks + * @return String + */ +public static String getColor(Ranks r) { + switch(r) { + case Admin: return "§4"; + case Developer: return "§3"; + case Moderator: return "§c"; + case HeadBuilder: return "§a"; + case Builder: return "§2"; + case Supporter: return "§b"; + case Youtuber: return "§5"; + case Premium: return "§6"; + case Spieler: return "§7"; + default: return "§cFehler"; + } + } + +public static Team getTeam(Ranks r) { + switch(r) { + case Admin: return Teams.Admin; + case Developer: return Teams.Developer; + case Moderator: return Teams.Moderator; + case HeadBuilder: return Teams.HeadBuilder; + case Builder: return Teams.Builder; + case Supporter: return Teams.Supporter; + case Youtuber: return Teams.Youtuber; + case Premium: return Teams.Premium; + case Spieler: return Teams.Spieler; + default: return null; + } +} + +public static class Teams { + private static Scoreboard board = Bukkit.getScoreboardManager().getMainScoreboard(); + public static Team Admin = board.getTeam("a"); + public static Team Developer = board.getTeam("b"); + public static Team Moderator = board.getTeam("c"); + public static Team HeadBuilder = board.getTeam("d"); + public static Team Builder = board.getTeam("e"); + public static Team Supporter = board.getTeam("f"); + public static Team Youtuber = board.getTeam("g"); + public static Team Premium = board.getTeam("h"); + public static Team Spieler = board.getTeam("i"); +} + + +public static void initScoreboard() { + Scoreboard board = Bukkit.getScoreboardManager().getMainScoreboard(); + Teams.Admin.unregister(); + Teams.Developer.unregister(); + Teams.Moderator.unregister(); + Teams.HeadBuilder.unregister(); + Teams.Builder.unregister(); + Teams.Supporter.unregister(); + Teams.Youtuber.unregister(); + Teams.Premium.unregister(); + Teams.Spieler.unregister(); + + Team Admin = board.registerNewTeam("a"); + Team Developer = board.registerNewTeam("b"); + Team Moderator = board.registerNewTeam("c"); + Team HeadBuilder = board.registerNewTeam("d"); + Team Builder = board.registerNewTeam("e"); + Team Supporter = board.registerNewTeam("f"); + Team Youtuber = board.registerNewTeam("g"); + Team Premium = board.registerNewTeam("h"); + Team Spieler = board.registerNewTeam("i"); + + Teams.Admin.setPrefix(getColor(Ranks.Admin)); + Teams.Developer.setPrefix(getColor(Ranks.Developer)); + Teams.Moderator.setPrefix(getColor(Ranks.Moderator)); + Teams.HeadBuilder.setPrefix(getColor(Ranks.HeadBuilder)); + Teams.Builder.setPrefix(getColor(Ranks.Builder)); + Teams.Supporter.setPrefix(getColor(Ranks.Supporter)); + Teams.Youtuber.setPrefix(getColor(Ranks.Youtuber)); + Teams.Premium.setPrefix(getColor(Ranks.Premium)); + Teams.Spieler.setPrefix(getColor(Ranks.Spieler)); + + Teams.Admin.setNameTagVisibility(NameTagVisibility.ALWAYS); + Teams.Developer.setNameTagVisibility(NameTagVisibility.ALWAYS); + Teams.Moderator.setNameTagVisibility(NameTagVisibility.ALWAYS); + Teams.HeadBuilder.setNameTagVisibility(NameTagVisibility.ALWAYS); + Teams.Builder.setNameTagVisibility(NameTagVisibility.ALWAYS); + Teams.Supporter.setNameTagVisibility(NameTagVisibility.ALWAYS); + Teams.Youtuber.setNameTagVisibility(NameTagVisibility.ALWAYS); + Teams.Premium.setNameTagVisibility(NameTagVisibility.ALWAYS); + Teams.Spieler.setNameTagVisibility(NameTagVisibility.ALWAYS); +} +/** + * gets Rank of player + * @param p Player + * @return Ranks + */ +public static Ranks getRank(CustomPlayer p) { + return getRanks().get(p); + } + +/** + * gets Rank of player fresh from database + * @param p Player + * @return Ranks + * @throws ClassNotFoundException Class couldn't be found + * @throws SQLException SQL server not available or throwing error + */ +public static Ranks getRankFresh(CustomPlayer p) throws SQLException, ClassNotFoundException { + MySQL sql = Core.returnSQL(); + sql.openConnection(); + ResultSet rs = sql.getConnection().createStatement().executeQuery("SELECT * FROM PlayerData WHERE player_uuid='" + p.getUniqueId() + "'"); + rs.next(); + if (rs.getString("player_uuid") != null) { + String rank = rs.getString("Rank"); + Ranks Rank = Ranks.valueOf(rank); + sql.closeConnection(); + return Rank; + } + sql.closeConnection(); + return null; + } + + /** + * sets rank for player + * @param p Player + * @param r Ranks + * @throws ClassNotFoundException Class couldn't be found + * @throws SQLException SQL server not available or throwing error + */ +public static void setRank(CustomPlayer p, Ranks r) throws ClassNotFoundException, SQLException { + MySQL sql = Core.returnSQL(); + sql.openConnection(); + sql.getConnection().createStatement().execute("UPDATE PlayerData SET Rank='" + r.toString() + "' WHERE player_uuid='" + p.getUniqueId() + "';"); + sql.closeConnection(); + } + +/** + * if player is allowed to do + * @param p Player + * @param r Ranks + * @return true / false + * @throws ClassNotFoundException Class couldn't be found + * @throws SQLException SQL server not available or throwing error + */ +public static boolean isAllowed(CustomPlayer p, Ranks r) throws ClassNotFoundException, SQLException{ + Ranks rank; + if(getRank(p) == null) { + rank = getRankFresh(p); + }else { + rank = getRank(p); + } + return rank.value >= r.value; + } + + public static enum Ranks{ + Admin(9), + Developer(8), + Moderator(7), + HeadBuilder(6), + Builder(5), + Supporter(4), + Youtuber(3), + Premium(2), + Spieler(1); + + public final int value; + + private Ranks(int n) { + this.value = n; + } + } +} \ No newline at end of file diff --git a/src/de/joethei/core/api/SQLite.java b/src/eu/univento/core/api/SQLite.java similarity index 93% rename from src/de/joethei/core/api/SQLite.java rename to src/eu/univento/core/api/SQLite.java index 46f203f..7dc16f3 100644 --- a/src/de/joethei/core/api/SQLite.java +++ b/src/eu/univento/core/api/SQLite.java @@ -1,4 +1,4 @@ -package de.joethei.core.api; +package eu.univento.core.api; import java.io.File; import java.io.IOException; diff --git a/src/de/joethei/core/api/ServerPinger.java b/src/eu/univento/core/api/ServerPinger.java similarity index 94% rename from src/de/joethei/core/api/ServerPinger.java rename to src/eu/univento/core/api/ServerPinger.java index 18713d9..f46014a 100644 --- a/src/de/joethei/core/api/ServerPinger.java +++ b/src/eu/univento/core/api/ServerPinger.java @@ -1,4 +1,4 @@ -package de.joethei.core.api; +package eu.univento.core.api; import java.io.DataOutputStream; import java.io.InputStream; diff --git a/src/de/joethei/core/api/Servers.java b/src/eu/univento/core/api/Servers.java similarity index 93% rename from src/de/joethei/core/api/Servers.java rename to src/eu/univento/core/api/Servers.java index 598aac0..34ee3e9 100644 --- a/src/de/joethei/core/api/Servers.java +++ b/src/eu/univento/core/api/Servers.java @@ -1,9 +1,10 @@ -package de.joethei.core.api; +package eu.univento.core.api; import com.google.common.collect.Iterables; import com.google.common.io.ByteArrayDataOutput; import com.google.common.io.ByteStreams; -import de.joethei.core.Core; + +import eu.univento.core.Core; import java.io.ByteArrayOutputStream; import java.io.DataOutputStream; diff --git a/src/de/joethei/core/api/Settings.java b/src/eu/univento/core/api/Settings.java similarity index 91% rename from src/de/joethei/core/api/Settings.java rename to src/eu/univento/core/api/Settings.java index 21e8dc3..e384b63 100644 --- a/src/de/joethei/core/api/Settings.java +++ b/src/eu/univento/core/api/Settings.java @@ -1,4 +1,4 @@ -package de.joethei.core.api; +package eu.univento.core.api; /** * server-wide settings diff --git a/src/de/joethei/core/api/SignInput.java b/src/eu/univento/core/api/SignInput.java similarity index 96% rename from src/de/joethei/core/api/SignInput.java rename to src/eu/univento/core/api/SignInput.java index 72a5979..969c44a 100644 --- a/src/de/joethei/core/api/SignInput.java +++ b/src/eu/univento/core/api/SignInput.java @@ -1,4 +1,4 @@ -package de.joethei.core.api; +package eu.univento.core.api; import io.netty.channel.Channel; import io.netty.channel.ChannelHandlerContext; diff --git a/src/de/joethei/core/api/SimpleScoreboard.java b/src/eu/univento/core/api/SimpleScoreboard.java similarity index 95% rename from src/de/joethei/core/api/SimpleScoreboard.java rename to src/eu/univento/core/api/SimpleScoreboard.java index 314a9d5..8de6224 100644 --- a/src/de/joethei/core/api/SimpleScoreboard.java +++ b/src/eu/univento/core/api/SimpleScoreboard.java @@ -1,4 +1,4 @@ -package de.joethei.core.api; +package eu.univento.core.api; import com.google.common.base.Preconditions; import com.google.common.base.Splitter; diff --git a/src/de/joethei/core/api/Spectator.java b/src/eu/univento/core/api/Spectator.java similarity index 93% rename from src/de/joethei/core/api/Spectator.java rename to src/eu/univento/core/api/Spectator.java index a184c83..981ae22 100644 --- a/src/de/joethei/core/api/Spectator.java +++ b/src/eu/univento/core/api/Spectator.java @@ -1,4 +1,4 @@ -package de.joethei.core.api; +package eu.univento.core.api; import java.util.ArrayList; diff --git a/src/eu/univento/core/api/TeamSpeak.java b/src/eu/univento/core/api/TeamSpeak.java new file mode 100644 index 0000000..11b7739 --- /dev/null +++ b/src/eu/univento/core/api/TeamSpeak.java @@ -0,0 +1,146 @@ +package eu.univento.core.api; + +import java.sql.ResultSet; +import java.sql.SQLException; +import java.util.logging.Level; + +import com.github.theholywaffle.teamspeak3.TS3Api; +import com.github.theholywaffle.teamspeak3.TS3Config; +import com.github.theholywaffle.teamspeak3.TS3Query; +import com.github.theholywaffle.teamspeak3.api.wrapper.Client; +import com.github.theholywaffle.teamspeak3.api.wrapper.ClientInfo; + +import eu.univento.core.Core; +import eu.univento.core.api.Perms.Ranks; + +/** + * basic functions for teamspeak communication + * @author joethei + * @version 1.0 + */ +public class TeamSpeak { + + private TS3Api api; + + private static int verified = 11; + public static int getVerifiedId() { + return verified; + } + + /** + * inits class + */ + public TeamSpeak() { + final TS3Config config = new TS3Config(); + config.setHost(Config.readString("TS.IP")); + config.setQueryPort(Config.readInt("TS.QueryPort")); + config.setDebugLevel(Level.ALL); + config.setLoginCredentials(Config.readString("TS.QueryUser"), Config.readString("TS.Query.Pass")); + final TS3Query query = new TS3Query(config); + query.connect(); + + final TS3Api api = query.getApi(); + api.selectVirtualServerById(1); + api.setNickname("Rechteverteiler"); + this.api = api; + } + + /** + * gets teamspeak api + * @return TS3Api + */ + public TS3Api getAPI() { + return api; + } + + /** + * gets client info for id + * @param id database id + * @return ClientInfo + */ + public ClientInfo getClientInfo(int id) { + return api.getClientInfo(id); + } + + /** + * gets database id from teamspeak for player + * @param p CustomPlayer + * @return Integer + * @throws SQLException SQL server not available or throwing error + * @throws ClassNotFoundException class couldn't be found + */ + public int getTsId(CustomPlayer p) throws ClassNotFoundException, SQLException { + MySQL sql = Core.returnSQL(); + sql.openConnection(); + ResultSet rs = sql.getConnection().createStatement().executeQuery("SELECT * FROM PlayerData WHERE player_uuid='" + p.getUniqueId() + "'"); + rs.next(); + if (rs.getInt("TS-ID") != 0) { + int id = rs.getInt("TS-ID"); + sql.closeConnection(); + return id; + } + sql.closeConnection(); + return 0; + } + + /** + * writes id of player to database + * @param p CustomPlayer + * @param id database id + * @throws SQLException SQL server not available or throwing error + * @throws ClassNotFoundException class couldn't be found + */ + private void setTsId(CustomPlayer p, int id) throws ClassNotFoundException, SQLException { + MySQL sql = Core.returnSQL(); + sql.openConnection(); + sql.getConnection().createStatement().execute("UPDATE PlayerData SET TS-ID='" + id + "' WHERE player_uuid='" + p.getUniqueId() + "';"); + sql.closeConnection(); + } + + /** + * sets rank on teamspeak + * @param p CustomPlayer + * @throws SQLException SQL server not available or throwing error + * @throws ClassNotFoundException class couldn't be found + */ + public void setRank(CustomPlayer p) throws ClassNotFoundException, SQLException { + TS3Api api = getAPI(); + for(int i = 0; i >= api.getClients().size(); i++) { + String player_ip = p.getAddress().getHostName(); + Client client = api.getClients().get(i); + ClientInfo info = api.getClientInfo(client.getId()); + String ts_ip = info.getIp(); + if(player_ip == ts_ip) { + int db_id = getTsId(p); + if(db_id == 0) { + api.removeClientFromServerGroup(getIdForRank(p.getRank()), db_id); + api.removeClientFromServerGroup(getVerifiedId(), db_id); + } + api.addClientToServerGroup(getIdForRank(p.getRank()), client.getDatabaseId()); + api.addClientToServerGroup(getVerifiedId(), client.getDatabaseId()); + setTsId(p, client.getDatabaseId()); + } + } + } + + /** + * gets group id for rank + * @param r Ranks + * @return Integer + */ + public int getIdForRank(Ranks r) { + switch(r) { + case Admin: return 10; + case Developer: return 13; + case Moderator: return 12; + case HeadBuilder: return 19; + case Builder: return 20; + case Supporter: return 14; + case Youtuber: return 21; + case Premium: return 22; + case Spieler: return 42; + default: return 0; + } + } + +} \ No newline at end of file diff --git a/src/de/joethei/core/api/Title.java b/src/eu/univento/core/api/Title.java similarity index 96% rename from src/de/joethei/core/api/Title.java rename to src/eu/univento/core/api/Title.java index f70ee97..a7eb6f8 100644 --- a/src/de/joethei/core/api/Title.java +++ b/src/eu/univento/core/api/Title.java @@ -1,4 +1,4 @@ -package de.joethei.core.api; +package eu.univento.core.api; import java.lang.reflect.Field; import net.minecraft.server.v1_8_R3.IChatBaseComponent; diff --git a/src/de/joethei/core/api/Utils.java b/src/eu/univento/core/api/Utils.java similarity index 96% rename from src/de/joethei/core/api/Utils.java rename to src/eu/univento/core/api/Utils.java index d94cc90..e20edea 100644 --- a/src/de/joethei/core/api/Utils.java +++ b/src/eu/univento/core/api/Utils.java @@ -1,4 +1,4 @@ -package de.joethei.core.api; +package eu.univento.core.api; import java.io.File; import java.util.List; diff --git a/src/de/joethei/core/api/twitch/API.java b/src/eu/univento/core/api/twitch/API.java similarity index 89% rename from src/de/joethei/core/api/twitch/API.java rename to src/eu/univento/core/api/twitch/API.java index 25f5545..8faf136 100644 --- a/src/de/joethei/core/api/twitch/API.java +++ b/src/eu/univento/core/api/twitch/API.java @@ -1,4 +1,4 @@ -package de.joethei.core.api.twitch; +package eu.univento.core.api.twitch; import java.io.BufferedReader; diff --git a/src/de/joethei/core/api/twitch/Twitch_API.java b/src/eu/univento/core/api/twitch/Twitch_API.java similarity index 89% rename from src/de/joethei/core/api/twitch/Twitch_API.java rename to src/eu/univento/core/api/twitch/Twitch_API.java index b061394..5f1023d 100644 --- a/src/de/joethei/core/api/twitch/Twitch_API.java +++ b/src/eu/univento/core/api/twitch/Twitch_API.java @@ -1,4 +1,4 @@ -package de.joethei.core.api.twitch; +package eu.univento.core.api.twitch; import com.google.gson.Gson; diff --git a/src/de/joethei/core/api/twitch/Twitch_Stream.java b/src/eu/univento/core/api/twitch/Twitch_Stream.java similarity index 95% rename from src/de/joethei/core/api/twitch/Twitch_Stream.java rename to src/eu/univento/core/api/twitch/Twitch_Stream.java index 796cdde..333cafa 100644 --- a/src/de/joethei/core/api/twitch/Twitch_Stream.java +++ b/src/eu/univento/core/api/twitch/Twitch_Stream.java @@ -1,4 +1,4 @@ -package de.joethei.core.api.twitch; +package eu.univento.core.api.twitch; import com.google.gson.JsonElement; import com.google.gson.JsonObject; diff --git a/src/de/joethei/core/api/utils/Direction.java b/src/eu/univento/core/api/utils/Direction.java similarity index 88% rename from src/de/joethei/core/api/utils/Direction.java rename to src/eu/univento/core/api/utils/Direction.java index 98d7015..2eee2fb 100644 --- a/src/de/joethei/core/api/utils/Direction.java +++ b/src/eu/univento/core/api/utils/Direction.java @@ -1,4 +1,4 @@ -package de.joethei.core.api.utils; +package eu.univento.core.api.utils; public enum Direction { diff --git a/src/de/joethei/core/api/utils/FakeDragon.java b/src/eu/univento/core/api/utils/FakeDragon.java similarity index 97% rename from src/de/joethei/core/api/utils/FakeDragon.java rename to src/eu/univento/core/api/utils/FakeDragon.java index 4a7aa9f..45643e4 100644 --- a/src/de/joethei/core/api/utils/FakeDragon.java +++ b/src/eu/univento/core/api/utils/FakeDragon.java @@ -1,4 +1,4 @@ -package de.joethei.core.api.utils; +package eu.univento.core.api.utils; import java.lang.reflect.Constructor; import java.lang.reflect.Field; diff --git a/src/de/joethei/core/api/utils/FakeWither.java b/src/eu/univento/core/api/utils/FakeWither.java similarity index 97% rename from src/de/joethei/core/api/utils/FakeWither.java rename to src/eu/univento/core/api/utils/FakeWither.java index c7a1673..86f7158 100644 --- a/src/de/joethei/core/api/utils/FakeWither.java +++ b/src/eu/univento/core/api/utils/FakeWither.java @@ -1,4 +1,4 @@ -package de.joethei.core.api.utils; +package eu.univento.core.api.utils; import java.lang.reflect.Constructor; import java.lang.reflect.Field; diff --git a/src/de/joethei/core/api/utils/GameProfileBuilder.java b/src/eu/univento/core/api/utils/GameProfileBuilder.java similarity index 96% rename from src/de/joethei/core/api/utils/GameProfileBuilder.java rename to src/eu/univento/core/api/utils/GameProfileBuilder.java index eca3cc2..935d3b6 100644 --- a/src/de/joethei/core/api/utils/GameProfileBuilder.java +++ b/src/eu/univento/core/api/utils/GameProfileBuilder.java @@ -1,4 +1,4 @@ -package de.joethei.core.api.utils; +package eu.univento.core.api.utils; import com.google.gson.Gson; import com.google.gson.GsonBuilder; diff --git a/src/de/joethei/core/api/utils/Maths.java b/src/eu/univento/core/api/utils/Maths.java similarity index 95% rename from src/de/joethei/core/api/utils/Maths.java rename to src/eu/univento/core/api/utils/Maths.java index 06f64c2..de40715 100644 --- a/src/de/joethei/core/api/utils/Maths.java +++ b/src/eu/univento/core/api/utils/Maths.java @@ -1,4 +1,4 @@ -package de.joethei.core.api.utils; +package eu.univento.core.api.utils; import java.util.Calendar; import java.util.GregorianCalendar; diff --git a/src/de/joethei/core/api/utils/NameFetcher.java b/src/eu/univento/core/api/utils/NameFetcher.java similarity index 95% rename from src/de/joethei/core/api/utils/NameFetcher.java rename to src/eu/univento/core/api/utils/NameFetcher.java index 33ea47d..7365c24 100644 --- a/src/de/joethei/core/api/utils/NameFetcher.java +++ b/src/eu/univento/core/api/utils/NameFetcher.java @@ -1,4 +1,4 @@ -package de.joethei.core.api.utils; +package eu.univento.core.api.utils; import com.google.common.collect.ImmutableList; import java.io.InputStreamReader; diff --git a/src/de/joethei/core/api/utils/RandomCollection.java b/src/eu/univento/core/api/utils/RandomCollection.java similarity index 92% rename from src/de/joethei/core/api/utils/RandomCollection.java rename to src/eu/univento/core/api/utils/RandomCollection.java index b9b72a6..9390669 100644 --- a/src/de/joethei/core/api/utils/RandomCollection.java +++ b/src/eu/univento/core/api/utils/RandomCollection.java @@ -1,4 +1,4 @@ -package de.joethei.core.api.utils; +package eu.univento.core.api.utils; import java.util.NavigableMap; import java.util.Random; diff --git a/src/de/joethei/core/api/utils/Reflection.java b/src/eu/univento/core/api/utils/Reflection.java similarity index 95% rename from src/de/joethei/core/api/utils/Reflection.java rename to src/eu/univento/core/api/utils/Reflection.java index 20cef4a..17880fe 100644 --- a/src/de/joethei/core/api/utils/Reflection.java +++ b/src/eu/univento/core/api/utils/Reflection.java @@ -1,4 +1,4 @@ -package de.joethei.core.api.utils; +package eu.univento.core.api.utils; import java.lang.reflect.Constructor; import java.lang.reflect.Field; diff --git a/src/de/joethei/core/api/utils/Vectors.java b/src/eu/univento/core/api/utils/Vectors.java similarity index 93% rename from src/de/joethei/core/api/utils/Vectors.java rename to src/eu/univento/core/api/utils/Vectors.java index 466f223..f72bdf5 100644 --- a/src/de/joethei/core/api/utils/Vectors.java +++ b/src/eu/univento/core/api/utils/Vectors.java @@ -1,4 +1,4 @@ -package de.joethei.core.api.utils; +package eu.univento.core.api.utils; import org.bukkit.util.Vector; diff --git a/src/de/joethei/core/api/youtube/YTAPI.java b/src/eu/univento/core/api/youtube/YTAPI.java similarity index 96% rename from src/de/joethei/core/api/youtube/YTAPI.java rename to src/eu/univento/core/api/youtube/YTAPI.java index 0e4c897..53bea44 100644 --- a/src/de/joethei/core/api/youtube/YTAPI.java +++ b/src/eu/univento/core/api/youtube/YTAPI.java @@ -1,4 +1,4 @@ -package de.joethei.core.api.youtube; +package eu.univento.core.api.youtube; import java.io.BufferedReader; import java.io.InputStreamReader; diff --git a/src/de/joethei/core/api/youtube/YoutubeChannel.java b/src/eu/univento/core/api/youtube/YoutubeChannel.java similarity index 96% rename from src/de/joethei/core/api/youtube/YoutubeChannel.java rename to src/eu/univento/core/api/youtube/YoutubeChannel.java index 1dd33dc..0e611f3 100644 --- a/src/de/joethei/core/api/youtube/YoutubeChannel.java +++ b/src/eu/univento/core/api/youtube/YoutubeChannel.java @@ -1,4 +1,4 @@ -package de.joethei.core.api.youtube; +package eu.univento.core.api.youtube; import java.beans.ConstructorProperties; diff --git a/src/de/joethei/core/commands/Ban.java b/src/eu/univento/core/commands/Ban.java similarity index 88% rename from src/de/joethei/core/commands/Ban.java rename to src/eu/univento/core/commands/Ban.java index be3b2bf..b6a5280 100644 --- a/src/de/joethei/core/commands/Ban.java +++ b/src/eu/univento/core/commands/Ban.java @@ -1,4 +1,4 @@ -package de.joethei.core.commands; +package eu.univento.core.commands; import java.util.ArrayList; import java.util.HashMap; @@ -8,11 +8,11 @@ import org.bukkit.Bukkit; import org.bukkit.command.CommandSender; import org.bukkit.entity.Player; -import de.joethei.core.Core; -import de.joethei.core.api.AutoCommand; -import de.joethei.core.api.CustomPlayer; -import de.joethei.core.api.Messages; -import de.joethei.core.api.Perms.Ranks; +import eu.univento.core.Core; +import eu.univento.core.api.AutoCommand; +import eu.univento.core.api.CustomPlayer; +import eu.univento.core.api.Messages; +import eu.univento.core.api.Perms.Ranks; /** * command to ban players diff --git a/src/de/joethei/core/commands/Build.java b/src/eu/univento/core/commands/Build.java similarity index 82% rename from src/de/joethei/core/commands/Build.java rename to src/eu/univento/core/commands/Build.java index 6af9575..fadfd52 100644 --- a/src/de/joethei/core/commands/Build.java +++ b/src/eu/univento/core/commands/Build.java @@ -1,4 +1,4 @@ -package de.joethei.core.commands; +package eu.univento.core.commands; import java.util.ArrayList; import java.util.List; @@ -6,11 +6,11 @@ import java.util.List; import org.bukkit.command.CommandSender; import org.bukkit.entity.Player; -import de.joethei.core.Core; -import de.joethei.core.api.AutoCommand; -import de.joethei.core.api.Messages; -import de.joethei.core.api.CustomPlayer; -import de.joethei.core.api.Perms.Ranks; +import eu.univento.core.Core; +import eu.univento.core.api.AutoCommand; +import eu.univento.core.api.CustomPlayer; +import eu.univento.core.api.Messages; +import eu.univento.core.api.Perms.Ranks; /** * lets player build diff --git a/src/de/joethei/core/commands/Fix.java b/src/eu/univento/core/commands/Fix.java similarity index 87% rename from src/de/joethei/core/commands/Fix.java rename to src/eu/univento/core/commands/Fix.java index d881503..a2c7989 100644 --- a/src/de/joethei/core/commands/Fix.java +++ b/src/eu/univento/core/commands/Fix.java @@ -1,4 +1,4 @@ -package de.joethei.core.commands; +package eu.univento.core.commands; import java.util.ArrayList; import java.util.List; @@ -7,10 +7,10 @@ import org.bukkit.Bukkit; import org.bukkit.command.CommandSender; import org.bukkit.entity.Player; -import de.joethei.core.Core; -import de.joethei.core.api.AutoCommand; -import de.joethei.core.api.Messages; -import de.joethei.core.api.CustomPlayer; +import eu.univento.core.Core; +import eu.univento.core.api.AutoCommand; +import eu.univento.core.api.CustomPlayer; +import eu.univento.core.api.Messages; /** * fixes players diff --git a/src/de/joethei/core/commands/GameMode.java b/src/eu/univento/core/commands/GameMode.java similarity index 86% rename from src/de/joethei/core/commands/GameMode.java rename to src/eu/univento/core/commands/GameMode.java index ef30461..7a7cfb1 100644 --- a/src/de/joethei/core/commands/GameMode.java +++ b/src/eu/univento/core/commands/GameMode.java @@ -1,4 +1,4 @@ -package de.joethei.core.commands; +package eu.univento.core.commands; import java.util.ArrayList; import java.util.List; @@ -6,11 +6,11 @@ import java.util.List; import org.bukkit.command.CommandSender; import org.bukkit.entity.Player; -import de.joethei.core.Core; -import de.joethei.core.api.AutoCommand; -import de.joethei.core.api.Messages; -import de.joethei.core.api.CustomPlayer; -import de.joethei.core.api.Perms.Ranks; +import eu.univento.core.Core; +import eu.univento.core.api.AutoCommand; +import eu.univento.core.api.CustomPlayer; +import eu.univento.core.api.Messages; +import eu.univento.core.api.Perms.Ranks; /** * changes game modes diff --git a/src/de/joethei/core/commands/GlobalMute.java b/src/eu/univento/core/commands/GlobalMute.java similarity index 78% rename from src/de/joethei/core/commands/GlobalMute.java rename to src/eu/univento/core/commands/GlobalMute.java index a054834..5c8b8c0 100644 --- a/src/de/joethei/core/commands/GlobalMute.java +++ b/src/eu/univento/core/commands/GlobalMute.java @@ -1,16 +1,16 @@ -package de.joethei.core.commands; +package eu.univento.core.commands; import java.util.List; import org.bukkit.command.CommandSender; import org.bukkit.entity.Player; -import de.joethei.core.Core; -import de.joethei.core.api.AutoCommand; -import de.joethei.core.api.Messages; -import de.joethei.core.api.CustomPlayer; -import de.joethei.core.api.Perms.Ranks; -import de.joethei.core.api.Settings; +import eu.univento.core.Core; +import eu.univento.core.api.AutoCommand; +import eu.univento.core.api.CustomPlayer; +import eu.univento.core.api.Messages; +import eu.univento.core.api.Settings; +import eu.univento.core.api.Perms.Ranks; /** * mutes the whole server diff --git a/src/de/joethei/core/commands/RunAs.java b/src/eu/univento/core/commands/RunAs.java similarity index 85% rename from src/de/joethei/core/commands/RunAs.java rename to src/eu/univento/core/commands/RunAs.java index a533b6a..ad03ac7 100644 --- a/src/de/joethei/core/commands/RunAs.java +++ b/src/eu/univento/core/commands/RunAs.java @@ -1,4 +1,4 @@ -package de.joethei.core.commands; +package eu.univento.core.commands; import java.util.ArrayList; import java.util.List; @@ -7,11 +7,11 @@ import org.bukkit.Bukkit; import org.bukkit.command.CommandSender; import org.bukkit.entity.Player; -import de.joethei.core.Core; -import de.joethei.core.api.AutoCommand; -import de.joethei.core.api.Messages; -import de.joethei.core.api.CustomPlayer; -import de.joethei.core.api.Perms.Ranks; +import eu.univento.core.Core; +import eu.univento.core.api.AutoCommand; +import eu.univento.core.api.CustomPlayer; +import eu.univento.core.api.Messages; +import eu.univento.core.api.Perms.Ranks; /** * lets other player run commands diff --git a/src/de/joethei/core/commands/SetRank.java b/src/eu/univento/core/commands/SetRank.java similarity index 86% rename from src/de/joethei/core/commands/SetRank.java rename to src/eu/univento/core/commands/SetRank.java index 9957208..e108c16 100644 --- a/src/de/joethei/core/commands/SetRank.java +++ b/src/eu/univento/core/commands/SetRank.java @@ -1,4 +1,4 @@ -package de.joethei.core.commands; +package eu.univento.core.commands; import java.sql.SQLException; import java.util.ArrayList; @@ -8,12 +8,12 @@ import org.bukkit.Bukkit; import org.bukkit.command.CommandSender; import org.bukkit.entity.Player; -import de.joethei.core.Core; -import de.joethei.core.api.AutoCommand; -import de.joethei.core.api.Messages; -import de.joethei.core.api.CustomPlayer; -import de.joethei.core.api.Perms; -import de.joethei.core.api.Perms.Ranks; +import eu.univento.core.Core; +import eu.univento.core.api.AutoCommand; +import eu.univento.core.api.CustomPlayer; +import eu.univento.core.api.Messages; +import eu.univento.core.api.Perms; +import eu.univento.core.api.Perms.Ranks; /** * sets ranks for players diff --git a/src/de/joethei/core/commands/SystemInfo.java b/src/eu/univento/core/commands/SystemInfo.java similarity index 86% rename from src/de/joethei/core/commands/SystemInfo.java rename to src/eu/univento/core/commands/SystemInfo.java index 4085e09..e087738 100644 --- a/src/de/joethei/core/commands/SystemInfo.java +++ b/src/eu/univento/core/commands/SystemInfo.java @@ -1,4 +1,4 @@ -package de.joethei.core.commands; +package eu.univento.core.commands; import java.util.List; @@ -6,11 +6,11 @@ import org.bukkit.Bukkit; import org.bukkit.command.CommandSender; import org.bukkit.entity.Player; -import de.joethei.core.Core; -import de.joethei.core.api.AutoCommand; -import de.joethei.core.api.Messages; -import de.joethei.core.api.CustomPlayer; -import de.joethei.core.api.Perms.Ranks; +import eu.univento.core.Core; +import eu.univento.core.api.AutoCommand; +import eu.univento.core.api.CustomPlayer; +import eu.univento.core.api.Messages; +import eu.univento.core.api.Perms.Ranks; /** * prints infos about the server diff --git a/src/eu/univento/core/commands/TS.java b/src/eu/univento/core/commands/TS.java new file mode 100644 index 0000000..8b0c2a8 --- /dev/null +++ b/src/eu/univento/core/commands/TS.java @@ -0,0 +1,57 @@ +package eu.univento.core.commands; + +import java.util.List; + +import org.bukkit.command.CommandSender; +import org.bukkit.entity.Player; + +import eu.univento.core.Core; +import eu.univento.core.api.AutoCommand; +import eu.univento.core.api.CustomPlayer; +import eu.univento.core.api.Messages; +import eu.univento.core.api.TeamSpeak; + +/** + * sets ts groups according to player rank + * @author joethei + * @version 1.0 + */ +public class TS extends AutoCommand{ + + /** + * @param plugin main class + * @param command command to execute + * @param description describes the command + * @param aliases aliases of command + */ + public TS(Core plugin, String command, String description, String[] aliases) { + super(plugin, command, description, aliases); + } + + @Override + public boolean execute(CommandSender sender, String label, String[] args) { + if(sender instanceof Player) { + CustomPlayer p = CustomPlayer.getPlayer(sender.getName()); + if(p.getTSClientInfo() != null) { + for(int i = 0; i >= p.getTSClientInfo().getServerGroups().length; i++) { + int[] groups = p.getTSClientInfo().getServerGroups(); + if(groups[i] == TeamSpeak.getVerifiedId()) { + p.sendMessage(Messages.PREFIX + "§cDu hast schon einen verknüpften TS Account !"); + }else { + p.verifyTs(); + p.sendMessage(Messages.PREFIX + "§aDu bist nun verifiziert"); + } + } + } + }else { + sender.sendMessage(Messages.NOT_A_PLAYER); + } + return true; + } + + @Override + public List tabComplete(CommandSender sender, String label, String[] args) { + return null; + } + +} \ No newline at end of file diff --git a/src/de/joethei/core/commands/Twitch.java b/src/eu/univento/core/commands/Twitch.java similarity index 83% rename from src/de/joethei/core/commands/Twitch.java rename to src/eu/univento/core/commands/Twitch.java index 73cb947..5e8be1e 100644 --- a/src/de/joethei/core/commands/Twitch.java +++ b/src/eu/univento/core/commands/Twitch.java @@ -1,16 +1,16 @@ -package de.joethei.core.commands; +package eu.univento.core.commands; import java.util.List; import org.bukkit.command.CommandSender; import org.bukkit.entity.Player; -import de.joethei.core.Core; -import de.joethei.core.api.AutoCommand; -import de.joethei.core.api.CustomPlayer; -import de.joethei.core.api.Messages; -import de.joethei.core.api.twitch.Twitch_API; -import de.joethei.core.api.twitch.Twitch_Stream; +import eu.univento.core.Core; +import eu.univento.core.api.AutoCommand; +import eu.univento.core.api.CustomPlayer; +import eu.univento.core.api.Messages; +import eu.univento.core.api.twitch.Twitch_API; +import eu.univento.core.api.twitch.Twitch_Stream; /** * send info about twitch streams diff --git a/src/de/joethei/core/commands/Vanish.java b/src/eu/univento/core/commands/Vanish.java similarity index 84% rename from src/de/joethei/core/commands/Vanish.java rename to src/eu/univento/core/commands/Vanish.java index 817fa1a..cc4feff 100644 --- a/src/de/joethei/core/commands/Vanish.java +++ b/src/eu/univento/core/commands/Vanish.java @@ -1,4 +1,4 @@ -package de.joethei.core.commands; +package eu.univento.core.commands; import java.util.ArrayList; import java.util.List; @@ -7,11 +7,11 @@ import org.bukkit.Bukkit; import org.bukkit.command.CommandSender; import org.bukkit.entity.Player; -import de.joethei.core.Core; -import de.joethei.core.api.AutoCommand; -import de.joethei.core.api.Messages; -import de.joethei.core.api.CustomPlayer; -import de.joethei.core.api.Perms.Ranks; +import eu.univento.core.Core; +import eu.univento.core.api.AutoCommand; +import eu.univento.core.api.CustomPlayer; +import eu.univento.core.api.Messages; +import eu.univento.core.api.Perms.Ranks; /** * vanish players diff --git a/src/de/joethei/core/commands/Youtuber.java b/src/eu/univento/core/commands/Youtuber.java similarity index 82% rename from src/de/joethei/core/commands/Youtuber.java rename to src/eu/univento/core/commands/Youtuber.java index c003175..cf9c51e 100644 --- a/src/de/joethei/core/commands/Youtuber.java +++ b/src/eu/univento/core/commands/Youtuber.java @@ -1,16 +1,16 @@ -package de.joethei.core.commands; +package eu.univento.core.commands; import java.util.List; import org.bukkit.command.CommandSender; import org.bukkit.entity.Player; -import de.joethei.core.Core; -import de.joethei.core.api.AutoCommand; -import de.joethei.core.api.CustomPlayer; -import de.joethei.core.api.Messages; -import de.joethei.core.api.youtube.YTAPI; -import de.joethei.core.api.youtube.YoutubeChannel; +import eu.univento.core.Core; +import eu.univento.core.api.AutoCommand; +import eu.univento.core.api.CustomPlayer; +import eu.univento.core.api.Messages; +import eu.univento.core.api.youtube.YTAPI; +import eu.univento.core.api.youtube.YoutubeChannel; /** * sets player to youtube rank diff --git a/src/de/joethei/core/listeners/Blocks.java b/src/eu/univento/core/listeners/Blocks.java similarity index 80% rename from src/de/joethei/core/listeners/Blocks.java rename to src/eu/univento/core/listeners/Blocks.java index 336303b..1b0a27d 100644 --- a/src/de/joethei/core/listeners/Blocks.java +++ b/src/eu/univento/core/listeners/Blocks.java @@ -1,13 +1,13 @@ -package de.joethei.core.listeners; +package eu.univento.core.listeners; import org.bukkit.event.EventHandler; import org.bukkit.event.Listener; import org.bukkit.event.block.BlockBreakEvent; import org.bukkit.event.block.BlockPlaceEvent; -import de.joethei.core.api.CustomPlayer; -import de.joethei.core.api.Settings; -import de.joethei.core.commands.Build; +import eu.univento.core.api.CustomPlayer; +import eu.univento.core.api.Settings; +import eu.univento.core.commands.Build; /** * cancels building diff --git a/src/de/joethei/core/listeners/Chat.java b/src/eu/univento/core/listeners/Chat.java similarity index 83% rename from src/de/joethei/core/listeners/Chat.java rename to src/eu/univento/core/listeners/Chat.java index 65a6906..a930bfe 100644 --- a/src/de/joethei/core/listeners/Chat.java +++ b/src/eu/univento/core/listeners/Chat.java @@ -1,13 +1,13 @@ -package de.joethei.core.listeners; +package eu.univento.core.listeners; import org.bukkit.event.EventHandler; import org.bukkit.event.Listener; import org.bukkit.event.player.AsyncPlayerChatEvent; -import de.joethei.core.api.CustomPlayer; -import de.joethei.core.api.Settings; +import eu.univento.core.api.CustomPlayer; +import eu.univento.core.api.Settings; +import eu.univento.core.api.Perms.Ranks; import net.md_5.bungee.api.ChatColor; -import de.joethei.core.api.Perms.Ranks; /** * manages chat diff --git a/src/de/joethei/core/listeners/Commands.java b/src/eu/univento/core/listeners/Commands.java similarity index 87% rename from src/de/joethei/core/listeners/Commands.java rename to src/eu/univento/core/listeners/Commands.java index 8ca8533..35de661 100644 --- a/src/de/joethei/core/listeners/Commands.java +++ b/src/eu/univento/core/listeners/Commands.java @@ -1,4 +1,4 @@ -package de.joethei.core.listeners; +package eu.univento.core.listeners; import org.bukkit.Bukkit; import org.bukkit.entity.Player; @@ -8,10 +8,10 @@ import org.bukkit.event.Listener; import org.bukkit.event.player.PlayerCommandPreprocessEvent; import org.bukkit.help.HelpTopic; -import de.joethei.core.Core; -import de.joethei.core.api.Messages; -import de.joethei.core.api.CustomPlayer; -import de.joethei.core.api.Perms.Ranks; +import eu.univento.core.Core; +import eu.univento.core.api.CustomPlayer; +import eu.univento.core.api.Messages; +import eu.univento.core.api.Perms.Ranks; /** * commands diff --git a/src/de/joethei/core/listeners/JoinQuit.java b/src/eu/univento/core/listeners/JoinQuit.java similarity index 86% rename from src/de/joethei/core/listeners/JoinQuit.java rename to src/eu/univento/core/listeners/JoinQuit.java index 1acefa8..16f0fa1 100644 --- a/src/de/joethei/core/listeners/JoinQuit.java +++ b/src/eu/univento/core/listeners/JoinQuit.java @@ -1,4 +1,4 @@ -package de.joethei.core.listeners; +package eu.univento.core.listeners; import java.sql.ResultSet; import java.sql.SQLException; @@ -14,13 +14,13 @@ import org.bukkit.event.player.PlayerJoinEvent; import org.bukkit.event.player.PlayerKickEvent; import org.bukkit.event.player.PlayerQuitEvent; -import de.joethei.core.Core; -import de.joethei.core.api.CustomPlayer; -import de.joethei.core.api.MySQL; -import de.joethei.core.api.NickName; -import de.joethei.core.api.Perms; -import de.joethei.core.api.Perms.Ranks; -import de.joethei.core.commands.Vanish; +import eu.univento.core.Core; +import eu.univento.core.api.CustomPlayer; +import eu.univento.core.api.MySQL; +import eu.univento.core.api.NickName; +import eu.univento.core.api.Perms; +import eu.univento.core.api.Perms.Ranks; +import eu.univento.core.commands.Vanish; /** * @author joethei @@ -32,12 +32,14 @@ public class JoinQuit implements Listener{ * Handles JoinMessage and vanished players * @param e event */ + @SuppressWarnings("deprecation") @EventHandler public void onJoin(PlayerJoinEvent e) { CustomPlayer p = CustomPlayer.getPlayer(e.getPlayer().getName()); e.setJoinMessage(null); createPlayer(p); Perms.getRanks().put(p, p.getRankFresh()); + p.getTeam().addPlayer(p); try { setup(p, p.getRank()); } catch (SQLException e1) { diff --git a/src/plugin.yml b/src/plugin.yml index 0d59c8f..a72a69e 100644 --- a/src/plugin.yml +++ b/src/plugin.yml @@ -1,6 +1,6 @@ -main: de.joethei.core.Core +main: eu.univento.core.Core name: Core description: univento Core author: joethei -version: 0.1 +version: 0.5 website: http://univento.eu \ No newline at end of file