Compare commits
No commits in common. "16faa5d47831c34c4d53ced9d730accad3515ef8" and "055dc68017fe3f4414fb3cd0a91799b86832e8ce" have entirely different histories.
16faa5d478
...
055dc68017
23 changed files with 0 additions and 909 deletions
113
.gitignore
vendored
113
.gitignore
vendored
|
@ -1,113 +0,0 @@
|
|||
# User-specific stuff
|
||||
.idea/
|
||||
|
||||
*.iml
|
||||
*.ipr
|
||||
*.iws
|
||||
|
||||
# IntelliJ
|
||||
out/
|
||||
|
||||
# Compiled class file
|
||||
*.class
|
||||
|
||||
# Log file
|
||||
*.log
|
||||
|
||||
# BlueJ files
|
||||
*.ctxt
|
||||
|
||||
# Package Files #
|
||||
*.jar
|
||||
*.war
|
||||
*.nar
|
||||
*.ear
|
||||
*.zip
|
||||
*.tar.gz
|
||||
*.rar
|
||||
|
||||
# virtual machine crash logs, see http://www.java.com/en/download/help/error_hotspot.xml
|
||||
hs_err_pid*
|
||||
|
||||
*~
|
||||
|
||||
# temporary files which can be created if a process still has a handle open of a deleted file
|
||||
.fuse_hidden*
|
||||
|
||||
# KDE directory preferences
|
||||
.directory
|
||||
|
||||
# Linux trash folder which might appear on any partition or disk
|
||||
.Trash-*
|
||||
|
||||
# .nfs files are created when an open file is removed but is still being accessed
|
||||
.nfs*
|
||||
|
||||
# General
|
||||
.DS_Store
|
||||
.AppleDouble
|
||||
.LSOverride
|
||||
|
||||
# Icon must end with two \r
|
||||
Icon
|
||||
|
||||
# Thumbnails
|
||||
._*
|
||||
|
||||
# Files that might appear in the root of a volume
|
||||
.DocumentRevisions-V100
|
||||
.fseventsd
|
||||
.Spotlight-V100
|
||||
.TemporaryItems
|
||||
.Trashes
|
||||
.VolumeIcon.icns
|
||||
.com.apple.timemachine.donotpresent
|
||||
|
||||
# Directories potentially created on remote AFP share
|
||||
.AppleDB
|
||||
.AppleDesktop
|
||||
Network Trash Folder
|
||||
Temporary Items
|
||||
.apdisk
|
||||
|
||||
# Windows thumbnail cache files
|
||||
Thumbs.db
|
||||
Thumbs.db:encryptable
|
||||
ehthumbs.db
|
||||
ehthumbs_vista.db
|
||||
|
||||
# Dump file
|
||||
*.stackdump
|
||||
|
||||
# Folder config file
|
||||
[Dd]esktop.ini
|
||||
|
||||
# Recycle Bin used on file shares
|
||||
$RECYCLE.BIN/
|
||||
|
||||
# Windows Installer files
|
||||
*.cab
|
||||
*.msi
|
||||
*.msix
|
||||
*.msm
|
||||
*.msp
|
||||
|
||||
# Windows shortcuts
|
||||
*.lnk
|
||||
|
||||
target/
|
||||
|
||||
pom.xml.tag
|
||||
pom.xml.releaseBackup
|
||||
pom.xml.versionsBackup
|
||||
pom.xml.next
|
||||
|
||||
release.properties
|
||||
dependency-reduced-pom.xml
|
||||
buildNumber.properties
|
||||
.mvn/timing.properties
|
||||
.mvn/wrapper/maven-wrapper.jar
|
||||
.flattened-pom.xml
|
||||
|
||||
# Common working directory
|
||||
run/
|
74
pom.xml
74
pom.xml
|
@ -1,74 +0,0 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project xmlns="http://maven.apache.org/POM/4.0.0"
|
||||
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
|
||||
<groupId>de.Softwarerat</groupId>
|
||||
<artifactId>ModUtils</artifactId>
|
||||
<version>InDev-Alpha</version>
|
||||
<packaging>jar</packaging>
|
||||
|
||||
<name>ModUtils</name>
|
||||
|
||||
<properties>
|
||||
<java.version>1.8</java.version>
|
||||
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
|
||||
</properties>
|
||||
|
||||
<build>
|
||||
<plugins>
|
||||
<plugin>
|
||||
<groupId>org.apache.maven.plugins</groupId>
|
||||
<artifactId>maven-compiler-plugin</artifactId>
|
||||
<version>3.8.1</version>
|
||||
<configuration>
|
||||
<source>10</source>
|
||||
<target>10</target>
|
||||
</configuration>
|
||||
</plugin>
|
||||
<plugin>
|
||||
<groupId>org.apache.maven.plugins</groupId>
|
||||
<artifactId>maven-shade-plugin</artifactId>
|
||||
<version>3.2.4</version>
|
||||
<executions>
|
||||
<execution>
|
||||
<phase>package</phase>
|
||||
<goals>
|
||||
<goal>shade</goal>
|
||||
</goals>
|
||||
<configuration>
|
||||
<createDependencyReducedPom>false</createDependencyReducedPom>
|
||||
</configuration>
|
||||
</execution>
|
||||
</executions>
|
||||
</plugin>
|
||||
</plugins>
|
||||
<resources>
|
||||
<resource>
|
||||
<directory>src/main/resources</directory>
|
||||
<filtering>true</filtering>
|
||||
</resource>
|
||||
</resources>
|
||||
</build>
|
||||
|
||||
<repositories>
|
||||
<repository>
|
||||
<id>spigotmc-repo</id>
|
||||
<url>https://hub.spigotmc.org/nexus/content/repositories/snapshots/</url>
|
||||
</repository>
|
||||
<repository>
|
||||
<id>sonatype</id>
|
||||
<url>https://oss.sonatype.org/content/groups/public/</url>
|
||||
</repository>
|
||||
</repositories>
|
||||
|
||||
<dependencies>
|
||||
<dependency>
|
||||
<groupId>org.spigotmc</groupId>
|
||||
<artifactId>spigot-api</artifactId>
|
||||
<version>1.18.2-R0.1-SNAPSHOT</version>
|
||||
<scope>provided</scope>
|
||||
</dependency>
|
||||
</dependencies>
|
||||
</project>
|
|
@ -1,48 +0,0 @@
|
|||
package de.softwarerat.modutils.Builder;
|
||||
import org.bukkit.Material;
|
||||
import org.bukkit.inventory.ItemFlag;
|
||||
import org.bukkit.inventory.ItemStack;
|
||||
import org.bukkit.inventory.meta.ItemMeta;
|
||||
import java.util.Arrays;
|
||||
|
||||
public class ItemBuilder {
|
||||
private ItemMeta itemMeta;
|
||||
private ItemStack itemStack;
|
||||
public ItemBuilder(Material mat){
|
||||
itemStack = new ItemStack(mat);
|
||||
itemMeta = itemStack.getItemMeta();
|
||||
}
|
||||
public ItemBuilder setDisplayname(String s){
|
||||
itemMeta.setDisplayName(s);
|
||||
return this;
|
||||
}
|
||||
public ItemBuilder setLocalizedName(String s){
|
||||
itemMeta.setLocalizedName(s);
|
||||
return this;
|
||||
}
|
||||
public ItemBuilder setLore(String... s){
|
||||
itemMeta.setLore(Arrays.asList(s));
|
||||
return this;
|
||||
}
|
||||
public ItemBuilder setUnbreakable(boolean s){
|
||||
itemMeta.setUnbreakable(s);
|
||||
return this;
|
||||
}
|
||||
public ItemBuilder addItemFlags(ItemFlag... s){
|
||||
itemMeta.addItemFlags(s);
|
||||
return this;
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return "ItemBuilder{" +
|
||||
"itemMeta=" + itemMeta +
|
||||
", itemStack=" + itemStack +
|
||||
'}';
|
||||
}
|
||||
public ItemStack build(){
|
||||
itemStack.setItemMeta(itemMeta);
|
||||
return itemStack;
|
||||
}
|
||||
}
|
|
@ -1,24 +0,0 @@
|
|||
package de.softwarerat.modutils.Commands;
|
||||
|
||||
import de.softwarerat.modutils.Ranks.AdminRank;
|
||||
import de.softwarerat.modutils.Utils.NametagUtil;
|
||||
import de.softwarerat.modutils.Utils.PermissionLevel;
|
||||
import org.bukkit.Bukkit;
|
||||
import org.bukkit.command.CommandSender;
|
||||
import org.bukkit.entity.Player;
|
||||
|
||||
public class AdminCommand {
|
||||
|
||||
public static void Command(String admin, PermissionLevel PermmissionLevel , CommandSender cs){
|
||||
if (PermmissionLevel == PermissionLevel.ADMIN || cs.isOp() ) {
|
||||
Player player = Bukkit.getPlayer(admin);
|
||||
new AdminRank().getAdmins().add(player);
|
||||
NametagUtil.ChangeNametag(player, "admin");
|
||||
for (Player onlinePlayers : Bukkit.getOnlinePlayers()) {
|
||||
|
||||
onlinePlayers.sendTitle(player.getName() + "wurde zum Admin Ernannt", "", 1, 10, 5);
|
||||
|
||||
}
|
||||
}else cs.sendMessage("Modutils | unausreichende Rechte!");
|
||||
}
|
||||
}
|
|
@ -1,68 +0,0 @@
|
|||
package de.softwarerat.modutils.Commands;
|
||||
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.inventory.ItemStack;
|
||||
import org.bukkit.util.io.BukkitObjectInputStream;
|
||||
import org.bukkit.util.io.BukkitObjectOutputStream;
|
||||
import org.yaml.snakeyaml.external.biz.base64Coder.Base64Coder;
|
||||
|
||||
import java.io.ByteArrayInputStream;
|
||||
import java.io.ByteArrayOutputStream;
|
||||
import java.io.IOException;
|
||||
|
||||
public class InvSeeCommand {
|
||||
|
||||
|
||||
|
||||
public void Command(Player player , Player targetPlayer){
|
||||
|
||||
String CachedInvModerating = itemStackArrayToBase64(player.getInventory().getContents());
|
||||
String CachedInvTarget = itemStackArrayToBase64(targetPlayer.getInventory().getContents());
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
public ItemStack[] itemStackArrayFromBase64(String data) throws IOException {
|
||||
try {
|
||||
ByteArrayInputStream inputStream = new ByteArrayInputStream(Base64Coder.decodeLines(data));
|
||||
BukkitObjectInputStream dataInput = new BukkitObjectInputStream(inputStream);
|
||||
ItemStack[] items = new ItemStack[dataInput.readInt()];
|
||||
|
||||
// Read the serialized inventory
|
||||
for (int i = 0; i < items.length; i++) {
|
||||
items[i] = (ItemStack) dataInput.readObject();
|
||||
}
|
||||
|
||||
dataInput.close();
|
||||
return items;
|
||||
} catch (ClassNotFoundException e) {
|
||||
throw new IOException("Unable to decode class type.", e);
|
||||
}
|
||||
}
|
||||
|
||||
public String itemStackArrayToBase64(ItemStack[] items) throws IllegalStateException {
|
||||
try {
|
||||
ByteArrayOutputStream outputStream = new ByteArrayOutputStream();
|
||||
BukkitObjectOutputStream dataOutput = new BukkitObjectOutputStream(outputStream);
|
||||
|
||||
// Write the size of the inventory
|
||||
dataOutput.writeInt(items.length);
|
||||
|
||||
// Save every element in the list
|
||||
for (int i = 0; i < items.length; i++) {
|
||||
dataOutput.writeObject(items[i]);
|
||||
}
|
||||
|
||||
// Serialize that array
|
||||
dataOutput.close();
|
||||
return Base64Coder.encodeLines(outputStream.toByteArray());
|
||||
} catch (Exception e) {
|
||||
throw new IllegalStateException("Unable to save item stacks.", e);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
|
@ -1,36 +0,0 @@
|
|||
package de.softwarerat.modutils.Commands;
|
||||
|
||||
import de.softwarerat.modutils.Utils.PermissionLevel;
|
||||
import org.bukkit.Bukkit;
|
||||
import org.bukkit.command.Command;
|
||||
import org.bukkit.command.CommandExecutor;
|
||||
import org.bukkit.command.CommandSender;
|
||||
import org.bukkit.entity.Player;
|
||||
|
||||
public class MainCommand implements CommandExecutor {
|
||||
@Override
|
||||
public boolean onCommand(CommandSender sender, Command command, String label, String[] args) {
|
||||
Player player = Bukkit.getPlayer(sender.getName());
|
||||
PermissionLevel permissionLevel = PermissionLevel.getPermissionLevel(player);
|
||||
|
||||
// switch (args[0]) {
|
||||
// case "SetAdmin":
|
||||
// AdminCommand.Command(args[1 ],permissionLevel, sender);
|
||||
// sender.sendMessage("es wird versucht");
|
||||
// break;
|
||||
// case "SetMod":
|
||||
// ModeratorCommand.Command(args[1],permissionLevel, sender);
|
||||
// sender.sendMessage("es wird versucht");
|
||||
// break;
|
||||
// case "SetStreamer":
|
||||
// StreamerCommand.Command(args[1], permissionLevel,sender ) ;
|
||||
// sender.sendMessage("es wird versucht");
|
||||
// break;
|
||||
//
|
||||
//
|
||||
// }
|
||||
sender.sendMessage("test");
|
||||
|
||||
return false;
|
||||
}
|
||||
}
|
|
@ -1,26 +0,0 @@
|
|||
package de.softwarerat.modutils.Commands;
|
||||
|
||||
import de.softwarerat.modutils.Ranks.ModeratorRank;
|
||||
import de.softwarerat.modutils.Utils.NametagUtil;
|
||||
import de.softwarerat.modutils.Utils.PermissionLevel;
|
||||
import de.softwarerat.modutils.Utils.PermissionManager;
|
||||
import org.bukkit.Bukkit;
|
||||
import org.bukkit.command.CommandSender;
|
||||
import org.bukkit.entity.Player;
|
||||
|
||||
public class ModeratorCommand {
|
||||
|
||||
public static void Command(String moderator, PermissionLevel permissionLevel , CommandSender commandSender) {
|
||||
if (permissionLevel == PermissionLevel.ADMIN) {
|
||||
|
||||
Player player = Bukkit.getPlayer(moderator);
|
||||
new PermissionManager().setPermissionLevel(PermissionLevel.MODERATOR , player);
|
||||
NametagUtil.ChangeNametag(player, "moderator");
|
||||
for (Player onlinePlayers : Bukkit.getOnlinePlayers()) {
|
||||
|
||||
onlinePlayers.sendTitle(player.getName() + "wurde zum Moderator Ernannt", "", 1, 10, 5);
|
||||
|
||||
}
|
||||
} else commandSender.sendMessage("Modutils | unasuzureichende rechte!");
|
||||
}
|
||||
}
|
|
@ -1,30 +0,0 @@
|
|||
package de.softwarerat.modutils.Commands;
|
||||
|
||||
import de.softwarerat.modutils.Ranks.StreamerRank;
|
||||
import de.softwarerat.modutils.Utils.NametagUtil;
|
||||
import de.softwarerat.modutils.Utils.PermissionLevel;
|
||||
import org.bukkit.Bukkit;
|
||||
import org.bukkit.command.CommandSender;
|
||||
import org.bukkit.entity.Player;
|
||||
|
||||
|
||||
public class StreamerCommand {
|
||||
|
||||
|
||||
public static void Command(String streamer, PermissionLevel PermissionLevel , CommandSender commandSender) {
|
||||
|
||||
if (PermissionLevel == de.softwarerat.modutils.Utils.PermissionLevel.ADMIN) {
|
||||
Player player = Bukkit.getPlayer(streamer);
|
||||
new StreamerRank().getStreamer().add(player);
|
||||
NametagUtil.ChangeNametag(player, "streamer");
|
||||
for (Player onlinePlayers : Bukkit.getOnlinePlayers()) {
|
||||
|
||||
onlinePlayers.sendTitle(player.getName() + " wurde zum Streamer ernannt", "", 1, 10, 5);
|
||||
|
||||
}
|
||||
} else commandSender.sendMessage("Modutils | unasuzureichende rechte!");
|
||||
|
||||
|
||||
|
||||
}
|
||||
}
|
|
@ -1,65 +0,0 @@
|
|||
package de.softwarerat.modutils.Commands;
|
||||
|
||||
import de.softwarerat.modutils.Utils.PermissionLevel;
|
||||
import de.softwarerat.modutils.Utils.WhitelistUtil;
|
||||
import org.bukkit.Bukkit;
|
||||
import org.bukkit.command.CommandSender;
|
||||
import org.bukkit.entity.Player;
|
||||
|
||||
public class WhitelistCommand {
|
||||
|
||||
|
||||
public static void Command(String State , PermissionLevel PermissionLevel , CommandSender commandSender) {
|
||||
|
||||
if (PermissionLevel == de.softwarerat.modutils.Utils.PermissionLevel.STREAMER) {
|
||||
|
||||
switch (State) {
|
||||
|
||||
case "all":
|
||||
|
||||
|
||||
WhitelistUtil.setWhitelistLevel(State);
|
||||
|
||||
|
||||
for (Player players : Bukkit.getOnlinePlayers()) {
|
||||
|
||||
|
||||
players.sendTitle("die Whitelist ist nun für jeden zugänglich ", "", 7, 6, 3);
|
||||
|
||||
}
|
||||
break;
|
||||
case "streamer":
|
||||
|
||||
|
||||
WhitelistUtil.setWhitelistLevel(State);
|
||||
|
||||
|
||||
for (Player players : Bukkit.getOnlinePlayers()) {
|
||||
|
||||
|
||||
players.sendTitle("die Whitelist ist nun nur für Streamer / Teammitglieder zugänglich ", "", 7, 6, 3);
|
||||
|
||||
}
|
||||
|
||||
break;
|
||||
case "team":
|
||||
|
||||
|
||||
WhitelistUtil.setWhitelistLevel(State);
|
||||
|
||||
|
||||
for (Player players : Bukkit.getOnlinePlayers()) {
|
||||
|
||||
|
||||
players.sendTitle("die Whitelist ist nun nur für Teammitglieder zugänglich ", "", 7, 6, 3);
|
||||
|
||||
}
|
||||
break;
|
||||
|
||||
}
|
||||
|
||||
}else commandSender.sendMessage("Modutils | unasuzureichende rechte!");
|
||||
|
||||
|
||||
}
|
||||
}
|
|
@ -1,40 +0,0 @@
|
|||
package de.softwarerat.modutils.Commands;
|
||||
|
||||
import de.softwarerat.modutils.Utils.PermissionLevel;
|
||||
import org.bukkit.Bukkit;
|
||||
import org.bukkit.command.Command;
|
||||
import org.bukkit.command.CommandExecutor;
|
||||
import org.bukkit.command.CommandSender;
|
||||
import org.bukkit.entity.Player;
|
||||
|
||||
public class testCommand implements CommandExecutor {
|
||||
@Override
|
||||
public boolean onCommand(CommandSender sender, Command command, String label, String[] args) {
|
||||
|
||||
Player player = Bukkit.getPlayer(sender.getName());
|
||||
PermissionLevel permissionLevel = PermissionLevel.getPermissionLevel(player);
|
||||
switch (args[0]) {
|
||||
case "SetAdmin":
|
||||
AdminCommand.Command(args[1 ],permissionLevel, sender);
|
||||
sender.sendMessage("es wird versucht");
|
||||
break;
|
||||
case "SetMod":
|
||||
ModeratorCommand.Command(args[1],permissionLevel, sender);
|
||||
sender.sendMessage("es wird versucht");
|
||||
break;
|
||||
case "SetStreamer":
|
||||
StreamerCommand.Command(args[1], permissionLevel,sender ) ;
|
||||
sender.sendMessage("es wird versucht");
|
||||
break;
|
||||
case"whitelist":
|
||||
WhitelistCommand.Command(args[1], permissionLevel , sender);
|
||||
break;
|
||||
}
|
||||
sender.sendMessage("test");
|
||||
|
||||
|
||||
|
||||
|
||||
return false;
|
||||
}
|
||||
}
|
|
@ -1,33 +0,0 @@
|
|||
package de.softwarerat.modutils;
|
||||
|
||||
import de.softwarerat.modutils.Commands.testCommand;
|
||||
import de.softwarerat.modutils.Utils.MySQL;
|
||||
import de.softwarerat.modutils.events.Chat;
|
||||
import de.softwarerat.modutils.events.Join;
|
||||
import de.softwarerat.modutils.events.Quit;
|
||||
import org.bukkit.Bukkit;
|
||||
import org.bukkit.plugin.PluginManager;
|
||||
import org.bukkit.plugin.java.JavaPlugin;
|
||||
|
||||
public final class Main extends JavaPlugin {
|
||||
|
||||
@Override
|
||||
public void onEnable() {
|
||||
PluginManager manager = Bukkit.getPluginManager();
|
||||
manager.registerEvents(new Chat(), this);
|
||||
manager.registerEvents(new Join(), this);
|
||||
manager.registerEvents(new Quit(), this);
|
||||
MySQL.connect();
|
||||
getCommand("utils").setExecutor(new testCommand());
|
||||
|
||||
// Plugin startup logic
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onDisable() {
|
||||
// Plugin shutdown logic
|
||||
}
|
||||
}
|
|
@ -1,16 +0,0 @@
|
|||
package de.softwarerat.modutils.Ranks;
|
||||
|
||||
import org.bukkit.entity.Player;
|
||||
|
||||
import java.util.ArrayList;
|
||||
|
||||
public class AdminRank {
|
||||
|
||||
public static ArrayList<Player> Admins ;
|
||||
|
||||
public static ArrayList<Player> getAdmins() {
|
||||
|
||||
return Admins;
|
||||
|
||||
}
|
||||
}
|
|
@ -1,14 +0,0 @@
|
|||
package de.softwarerat.modutils.Ranks;
|
||||
|
||||
import org.bukkit.entity.Player;
|
||||
|
||||
import java.util.ArrayList;
|
||||
|
||||
public class ModeratorRank {
|
||||
|
||||
public static ArrayList<Player> Moderators;
|
||||
|
||||
public static ArrayList<Player> getModerators() {
|
||||
return Moderators;
|
||||
}
|
||||
}
|
|
@ -1,16 +0,0 @@
|
|||
package de.softwarerat.modutils.Ranks;
|
||||
|
||||
import org.bukkit.entity.Player;
|
||||
|
||||
import java.util.ArrayList;
|
||||
|
||||
public class StreamerRank {
|
||||
|
||||
public static ArrayList<Player> Streamer ;
|
||||
|
||||
public static ArrayList<Player> getStreamer() {
|
||||
return Streamer;
|
||||
}
|
||||
|
||||
|
||||
}
|
|
@ -1,50 +0,0 @@
|
|||
package de.softwarerat.modutils.Utils;
|
||||
|
||||
import java.sql.Connection;
|
||||
import java.sql.DriverManager;
|
||||
import java.sql.SQLException;
|
||||
|
||||
public class MySQL {
|
||||
|
||||
private static Connection con;
|
||||
private static String Host;
|
||||
private static int port;
|
||||
private static String database;
|
||||
private static String user;
|
||||
private static String password;
|
||||
|
||||
public MySQL(String Host, int port, String database, String user, String password) {
|
||||
MySQL.Host = Host;
|
||||
MySQL.port = port;
|
||||
MySQL.database = database;
|
||||
MySQL.user = user;
|
||||
MySQL.password = password;
|
||||
connect();
|
||||
}
|
||||
|
||||
public static void connect() {
|
||||
try {
|
||||
con = DriverManager.getConnection("jdbc:mysql://127.0.0.1:3306/ModUitls?autoRecconnect=true", "Bansystem", "GGoders0");
|
||||
} catch (SQLException var1) {
|
||||
System.out.println("SQL Disconeccted");
|
||||
System.out.println("SQL Error Connection unreachable");
|
||||
System.out.println("SQL Error Connection unreachable");
|
||||
System.out.println("SQL Error Connection unreachable");
|
||||
System.out.println("SQL Error Connection unreachable");
|
||||
System.out.println("SQL Error Connection unreachable");
|
||||
System.out.println("SQL Error Connection unreachable");
|
||||
System.out.println("SQL Error Connection unreachable");
|
||||
System.out.println("SQL Error Connection unreachable");
|
||||
System.out.println("SQL Error Connection unreachable");
|
||||
System.out.println("SQL Error Connection unreachable");
|
||||
System.out.println("SQL Error Connection unreachable");
|
||||
System.out.println("SQL Error Connection unreachable");
|
||||
System.out.println("SQL Error Connection unreachable");
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
public static Connection getConnection() {
|
||||
return con;
|
||||
}
|
||||
}
|
|
@ -1,35 +0,0 @@
|
|||
package de.softwarerat.modutils.Utils;
|
||||
|
||||
import org.bukkit.ChatColor;
|
||||
import org.bukkit.entity.Player;
|
||||
|
||||
public class NametagUtil {
|
||||
|
||||
|
||||
public static void ChangeNametag(Player player , String rank) {
|
||||
|
||||
switch (rank){
|
||||
case "moderator":
|
||||
player.setDisplayName(ChatColor.DARK_GREEN + "Mod " + ChatColor.GRAY + "| " + player.getName());
|
||||
player.setPlayerListName(ChatColor.DARK_GREEN + "Mod " + ChatColor.GRAY + "| " + player.getName());
|
||||
|
||||
break;
|
||||
case "admin":
|
||||
player.setDisplayName(ChatColor.GOLD + "Admin" + ChatColor.GRAY + "| " + player.getName());
|
||||
player.setPlayerListName(ChatColor.GOLD + "Admin " + ChatColor.GRAY + "| " + player.getName());
|
||||
break;
|
||||
case"streamer":
|
||||
player.setDisplayName(ChatColor.DARK_PURPLE + "Streamer " + ChatColor.GRAY + "| " + player.getName());
|
||||
player.setPlayerListName(ChatColor.DARK_PURPLE + "Streamer " + ChatColor.GRAY + "| " + player.getName());
|
||||
break;
|
||||
case "player":
|
||||
player.setDisplayName(ChatColor.GREEN + "Spieler " + ChatColor.GRAY + "| " + player.getName());
|
||||
player.setPlayerListName(ChatColor.GREEN + "Spieler " + ChatColor.GRAY + "| " + player.getName());
|
||||
break;
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
}
|
|
@ -1,37 +0,0 @@
|
|||
package de.softwarerat.modutils.Utils;
|
||||
|
||||
import org.bukkit.entity.Player;
|
||||
|
||||
|
||||
public enum PermissionLevel {
|
||||
ADMIN,
|
||||
MODERATOR,
|
||||
STREAMER,
|
||||
PLAYER;
|
||||
|
||||
|
||||
PermissionLevel() {
|
||||
}
|
||||
|
||||
|
||||
public static PermissionLevel getPermissionLevel(Player player) {
|
||||
|
||||
return new PermissionManager().getPermissionLevel(player);
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
public static PermissionLevel toPermissionLevel(String permissionLevel){
|
||||
if (permissionLevel == "admin"){
|
||||
return ADMIN;} else if (permissionLevel == "moderator"){
|
||||
return MODERATOR;
|
||||
} else if (permissionLevel == "streamer"){
|
||||
return STREAMER;
|
||||
}if (permissionLevel == "player"){
|
||||
return PLAYER;
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
}
|
|
@ -1,51 +0,0 @@
|
|||
package de.softwarerat.modutils.Utils;
|
||||
|
||||
import org.bukkit.entity.Player;
|
||||
|
||||
import java.sql.PreparedStatement;
|
||||
import java.sql.ResultSet;
|
||||
import java.sql.SQLException;
|
||||
import java.util.Locale;
|
||||
import java.util.UUID;
|
||||
|
||||
public class PermissionManager {
|
||||
|
||||
|
||||
public PermissionLevel getPermissionLevel(Player player) {
|
||||
|
||||
UUID playerUUID = player.getUniqueId();
|
||||
try {
|
||||
PreparedStatement preparedStatement = MySQL.getConnection().prepareStatement("SELECT PermissionLevel FROM permissionlevel WHERE UUID = ?");
|
||||
preparedStatement.setString(1, playerUUID.toString());
|
||||
|
||||
ResultSet rs = preparedStatement.executeQuery();
|
||||
if (rs.next()) {
|
||||
|
||||
|
||||
return PermissionLevel.toPermissionLevel( rs.getString("PermissionLevel"));
|
||||
|
||||
|
||||
}
|
||||
|
||||
} catch (SQLException e) {
|
||||
throw new RuntimeException(e);
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
public void setPermissionLevel(PermissionLevel permissionLevel , Player player){
|
||||
|
||||
|
||||
try {
|
||||
PreparedStatement preparedStatement = MySQL.getConnection().prepareStatement("INSERT INTO permissionlevel(UUID,PermissionLevel) Values ?,? ");
|
||||
preparedStatement.setString(1,player.getUniqueId().toString());
|
||||
preparedStatement.setString(2,permissionLevel.toString().toLowerCase(Locale.ROOT));
|
||||
|
||||
} catch (SQLException e) {
|
||||
throw new RuntimeException(e);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
|
@ -1,14 +0,0 @@
|
|||
package de.softwarerat.modutils.Utils;
|
||||
|
||||
public class WhitelistUtil {
|
||||
|
||||
public static String WhitelistLevel;
|
||||
|
||||
public static String getWhitelistLevel() {
|
||||
return WhitelistLevel;
|
||||
}
|
||||
|
||||
public static void setWhitelistLevel(String whitelistLevel) {
|
||||
WhitelistLevel = whitelistLevel;
|
||||
}
|
||||
}
|
|
@ -1,31 +0,0 @@
|
|||
package de.softwarerat.modutils.events;
|
||||
|
||||
import de.softwarerat.modutils.Ranks.AdminRank;
|
||||
import de.softwarerat.modutils.Ranks.ModeratorRank;
|
||||
import de.softwarerat.modutils.Ranks.StreamerRank;
|
||||
import org.bukkit.ChatColor;
|
||||
import org.bukkit.event.EventHandler;
|
||||
import org.bukkit.event.Listener;
|
||||
import org.bukkit.event.player.AsyncPlayerChatEvent;
|
||||
|
||||
public class Chat implements Listener {
|
||||
|
||||
|
||||
|
||||
@EventHandler
|
||||
public void onAsyncPlayerChat(AsyncPlayerChatEvent event) {
|
||||
var AdminRank = new AdminRank().getAdmins();
|
||||
var ModRank = new ModeratorRank().getModerators();
|
||||
var StreamerRank = new StreamerRank().getStreamer();
|
||||
if (AdminRank.contains(event.getPlayer())){
|
||||
event.setFormat(ChatColor.RED + "Admin " + ChatColor.GRAY + "| " + event.getPlayer() + " >> " + event.getMessage() );
|
||||
} else if (ModRank.contains(event.getPlayer())){
|
||||
event.setFormat(ChatColor.GREEN + "Mod " + ChatColor.GRAY + "| " + event.getPlayer() + " >> " + event.getMessage() );
|
||||
} else if (StreamerRank.contains(event.getPlayer())){
|
||||
event.setFormat(ChatColor.DARK_PURPLE + "Streamer " + ChatColor.GRAY + "| " + event.getPlayer() + " >> " + event.getMessage() );
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
||||
}
|
|
@ -1,48 +0,0 @@
|
|||
package de.softwarerat.modutils.events;
|
||||
|
||||
import de.softwarerat.modutils.Ranks.AdminRank;
|
||||
import de.softwarerat.modutils.Utils.NametagUtil;
|
||||
import de.softwarerat.modutils.Utils.PermissionLevel;
|
||||
import de.softwarerat.modutils.Utils.WhitelistUtil;
|
||||
import org.bukkit.Bukkit;
|
||||
import org.bukkit.ChatColor;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.event.EventHandler;
|
||||
import org.bukkit.event.Listener;
|
||||
import org.bukkit.event.player.PlayerJoinEvent;
|
||||
|
||||
|
||||
public class Join implements Listener {
|
||||
|
||||
@EventHandler
|
||||
public void onPlayerJoin(PlayerJoinEvent event) {
|
||||
PermissionLevel permissionLevel = PermissionLevel.getPermissionLevel(event.getPlayer());
|
||||
|
||||
|
||||
|
||||
if (permissionLevel == PermissionLevel.ADMIN){
|
||||
|
||||
event.setJoinMessage(ChatColor.RED + "Admin | " + ChatColor.GRAY + event.getPlayer().getName() + " hat das Spiel betreten");
|
||||
NametagUtil.ChangeNametag(event.getPlayer() , "admin");
|
||||
} else if (permissionLevel == PermissionLevel.MODERATOR){
|
||||
|
||||
|
||||
event.setJoinMessage(ChatColor.GREEN + "Moderator | " + ChatColor.GRAY + event.getPlayer().getName() + " hat das Spiel betreten");
|
||||
NametagUtil.ChangeNametag(event.getPlayer(), "moderator");
|
||||
} else if (permissionLevel == PermissionLevel.STREAMER) {
|
||||
if (WhitelistUtil.getWhitelistLevel() == "team" ) {
|
||||
|
||||
event.getPlayer().kickPlayer("Mod Utils | Du hast für diesen Server aktuell nicht ausreichende Rechte");
|
||||
|
||||
}
|
||||
event.setJoinMessage(ChatColor.DARK_PURPLE + "Streamer | " + ChatColor.GRAY + event.getPlayer().getName() + " hat das Spiel betreten");
|
||||
NametagUtil.ChangeNametag(event.getPlayer() , "streamer");
|
||||
} else {
|
||||
if (WhitelistUtil.getWhitelistLevel() == "streamer" || WhitelistUtil.getWhitelistLevel() == "team" ) {
|
||||
event.getPlayer().kickPlayer("Mod Utils | Du hast für diesen Server aktuell nicht ausreichende Rechte");
|
||||
}
|
||||
event.setJoinMessage("Spieler | " + event.getPlayer().getName() + " hat das Spiel betreten");
|
||||
}
|
||||
|
||||
}
|
||||
}
|
|
@ -1,33 +0,0 @@
|
|||
package de.softwarerat.modutils.events;
|
||||
|
||||
import de.softwarerat.modutils.Utils.PermissionLevel;
|
||||
import org.bukkit.ChatColor;
|
||||
import org.bukkit.event.EventHandler;
|
||||
import org.bukkit.event.Listener;
|
||||
import org.bukkit.event.player.PlayerQuitEvent;
|
||||
|
||||
public class Quit implements Listener {
|
||||
|
||||
@EventHandler
|
||||
public void onPlayerQuit(PlayerQuitEvent event) {
|
||||
PermissionLevel permissionLevel = PermissionLevel.getPermissionLevel(event.getPlayer());
|
||||
|
||||
|
||||
if (permissionLevel == PermissionLevel.ADMIN){
|
||||
|
||||
event.setQuitMessage(ChatColor.RED + "Admin | " + ChatColor.GRAY + event.getPlayer().getName() + " hat das Spiel verlassen");
|
||||
}else
|
||||
if (permissionLevel == PermissionLevel.MODERATOR){
|
||||
event.setQuitMessage(ChatColor.GREEN + "Moderator | " + ChatColor.GRAY + event.getPlayer().getName() + " hat das Spiel verlassen");
|
||||
} else if (permissionLevel == PermissionLevel.STREAMER){
|
||||
event.setQuitMessage(ChatColor.DARK_PURPLE + "Streamer | " + ChatColor.GRAY + event.getPlayer().getName() + " hat das Spiel verlassen");
|
||||
}else event.setQuitMessage("Spieler | " + event.getPlayer().getName() + " hat das Spiel betreten") ;
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
||||
}
|
|
@ -1,7 +0,0 @@
|
|||
name: ModUtils
|
||||
version: '${project.version}'
|
||||
main: de.softwarerat.modutils.Main
|
||||
api-version: 1.18
|
||||
commands:
|
||||
MUitls:
|
||||
Utils:
|
Loading…
Reference in a new issue