started to remove duplicate code and add it to the Commons Module.
This commit is contained in:
parent
c8b19c1c98
commit
989ce68d3f
22
Core.iml
22
Core.iml
|
@ -11,24 +11,30 @@
|
||||||
<orderEntry type="inheritedJdk" />
|
<orderEntry type="inheritedJdk" />
|
||||||
<orderEntry type="sourceFolder" forTests="false" />
|
<orderEntry type="sourceFolder" forTests="false" />
|
||||||
<orderEntry type="library" scope="PROVIDED" name="Maven: org.spigotmc:spigot-api:1.10.2-R0.1-SNAPSHOT" level="project" />
|
<orderEntry type="library" scope="PROVIDED" name="Maven: org.spigotmc:spigot-api:1.10.2-R0.1-SNAPSHOT" level="project" />
|
||||||
<orderEntry type="library" name="Maven: commons-lang:commons-lang:2.6" level="project" />
|
<orderEntry type="library" scope="PROVIDED" name="Maven: commons-lang:commons-lang:2.6" level="project" />
|
||||||
<orderEntry type="library" name="Maven: com.googlecode.json-simple:json-simple:1.1.1" level="project" />
|
<orderEntry type="library" name="Maven: com.googlecode.json-simple:json-simple:1.1.1" level="project" />
|
||||||
<orderEntry type="library" name="Maven: junit:junit:4.10" level="project" />
|
<orderEntry type="library" name="Maven: junit:junit:4.10" level="project" />
|
||||||
<orderEntry type="library" name="Maven: org.hamcrest:hamcrest-core:1.1" level="project" />
|
<orderEntry type="library" name="Maven: org.hamcrest:hamcrest-core:1.1" level="project" />
|
||||||
<orderEntry type="library" name="Maven: org.avaje:ebean:2.8.1" level="project" />
|
<orderEntry type="library" name="Maven: com.google.guava:guava:17.0" level="project" />
|
||||||
<orderEntry type="library" name="Maven: javax.persistence:persistence-api:1.0" level="project" />
|
<orderEntry type="library" name="Maven: com.google.code.gson:gson:2.2.4" level="project" />
|
||||||
<orderEntry type="library" name="Maven: org.yaml:snakeyaml:1.15" level="project" />
|
<orderEntry type="library" scope="PROVIDED" name="Maven: org.avaje:ebean:2.8.1" level="project" />
|
||||||
|
<orderEntry type="library" scope="PROVIDED" name="Maven: javax.persistence:persistence-api:1.0" level="project" />
|
||||||
|
<orderEntry type="library" scope="PROVIDED" name="Maven: org.yaml:snakeyaml:1.15" level="project" />
|
||||||
<orderEntry type="library" scope="PROVIDED" name="Maven: net.md-5:bungeecord-chat:1.10-SNAPSHOT" level="project" />
|
<orderEntry type="library" scope="PROVIDED" name="Maven: net.md-5:bungeecord-chat:1.10-SNAPSHOT" level="project" />
|
||||||
<orderEntry type="library" name="Maven: org.bukkit:bukkit:1.10.2-R0.1-SNAPSHOT" level="project" />
|
<orderEntry type="library" scope="PROVIDED" name="Maven: org.bukkit:bukkit:1.10.2-R0.1-SNAPSHOT" level="project" />
|
||||||
<orderEntry type="library" name="Maven: org.bukkit:craftbukkit:1.10.2-R0.1-SNAPSHOT" level="project" />
|
<orderEntry type="library" scope="PROVIDED" name="Maven: org.bukkit:craftbukkit:1.10.2-R0.1-SNAPSHOT" level="project" />
|
||||||
|
<orderEntry type="module" module-name="Commons" />
|
||||||
<orderEntry type="library" name="Maven: org.mongodb:mongo-java-driver:3.2.2" level="project" />
|
<orderEntry type="library" name="Maven: org.mongodb:mongo-java-driver:3.2.2" level="project" />
|
||||||
<orderEntry type="library" name="Maven: org.mongodb:mongodb-driver-async:3.2.2" level="project" />
|
<orderEntry type="library" name="Maven: org.mongodb:mongodb-driver-async:3.2.2" level="project" />
|
||||||
<orderEntry type="library" name="Maven: org.mongodb:mongodb-driver-core:3.2.2" level="project" />
|
<orderEntry type="library" name="Maven: org.mongodb:mongodb-driver-core:3.2.2" level="project" />
|
||||||
<orderEntry type="library" name="Maven: org.mongodb:bson:3.2.2" level="project" />
|
<orderEntry type="library" name="Maven: org.mongodb:bson:3.2.2" level="project" />
|
||||||
<orderEntry type="library" name="Maven: io.netty:netty-all:4.0.36.Final" level="project" />
|
<orderEntry type="library" name="Maven: io.netty:netty-all:4.0.36.Final" level="project" />
|
||||||
<orderEntry type="library" name="Maven: com.google.code.gson:gson:2.3.1" level="project" />
|
|
||||||
<orderEntry type="library" name="Maven: com.zaxxer:HikariCP:2.4.5" level="project" />
|
<orderEntry type="library" name="Maven: com.zaxxer:HikariCP:2.4.5" level="project" />
|
||||||
<orderEntry type="library" name="Maven: org.slf4j:slf4j-api:1.7.16" level="project" />
|
<orderEntry type="library" name="Maven: org.slf4j:slf4j-api:1.7.16" level="project" />
|
||||||
<orderEntry type="library" name="Maven: com.google.guava:guava:19.0" level="project" />
|
<orderEntry type="library" name="Maven: joda-time:joda-time:2.9.4" level="project" />
|
||||||
|
<orderEntry type="library" name="Maven: org.apache.logging.log4j:log4j-api:2.6.2" level="project" />
|
||||||
|
<orderEntry type="library" name="Maven: org.apache.logging.log4j:log4j-core:2.6.2" level="project" />
|
||||||
|
<orderEntry type="library" name="Maven: org.apache.commons:commons-lang3:3.1" level="project" />
|
||||||
|
<orderEntry type="library" name="Maven: commons-io:commons-io:2.5" level="project" />
|
||||||
</component>
|
</component>
|
||||||
</module>
|
</module>
|
96
pom.xml
96
pom.xml
|
@ -10,8 +10,47 @@
|
||||||
<packaging>jar</packaging>
|
<packaging>jar</packaging>
|
||||||
|
|
||||||
<name>Univento.eu Core System</name>
|
<name>Univento.eu Core System</name>
|
||||||
<url>http://univento.eu</url>
|
<url>https://development.univento.eu/Plugins/Core</url>
|
||||||
|
<description>
|
||||||
|
Plugin used on all Spigot servers to add basic functions and APIs.
|
||||||
|
</description>
|
||||||
|
|
||||||
|
<developers>
|
||||||
|
<developer>
|
||||||
|
<id>joethei</id>
|
||||||
|
<name>Johannes Theiner</name>
|
||||||
|
<email>info@joethei.de</email>
|
||||||
|
<timezone>Europe/Berlin</timezone>
|
||||||
|
<roles>
|
||||||
|
<role>architect</role>
|
||||||
|
<role>project leader</role>
|
||||||
|
<role>senior developer</role>
|
||||||
|
</roles>
|
||||||
|
<properties>
|
||||||
|
<picUrl>https://de.gravatar.com/userimage/65052389/84435a829d76e6b6c48d67cdd463c6ab.png?size=50</picUrl>
|
||||||
|
</properties>
|
||||||
|
</developer>
|
||||||
|
</developers>
|
||||||
|
|
||||||
|
<contributors>
|
||||||
|
<contributor>
|
||||||
|
<name>Daniel Planötscher</name>
|
||||||
|
<email>planiel@univento.eu</email>
|
||||||
|
<timezone>Europe/Berlin</timezone>
|
||||||
|
<roles>
|
||||||
|
<role>designer</role>
|
||||||
|
</roles>
|
||||||
|
<properties>
|
||||||
|
<picUrl>https://pbs.twimg.com/profile_images/706847659416494080/in1AJ9rc.jpg</picUrl>
|
||||||
|
</properties>
|
||||||
|
</contributor>
|
||||||
|
</contributors>
|
||||||
|
|
||||||
|
<inceptionYear>2015</inceptionYear>
|
||||||
|
<organization>
|
||||||
|
<name>univento</name>
|
||||||
|
<url>http://univento.eu</url>
|
||||||
|
</organization>
|
||||||
|
|
||||||
<build>
|
<build>
|
||||||
<plugins>
|
<plugins>
|
||||||
|
@ -47,6 +86,27 @@
|
||||||
</execution>
|
</execution>
|
||||||
</executions>
|
</executions>
|
||||||
</plugin>
|
</plugin>
|
||||||
|
<plugin>
|
||||||
|
<groupId>org.apache.maven.plugins</groupId>
|
||||||
|
<artifactId>maven-site-plugin</artifactId>
|
||||||
|
<version>3.4</version>
|
||||||
|
<configuration>
|
||||||
|
<locales>en</locales>
|
||||||
|
</configuration>
|
||||||
|
</plugin>
|
||||||
|
<plugin>
|
||||||
|
<groupId>org.apache.maven.plugins</groupId>
|
||||||
|
<artifactId>maven-javadoc-plugin</artifactId>
|
||||||
|
<version>2.10.4</version>
|
||||||
|
<executions>
|
||||||
|
<execution>
|
||||||
|
<id>attach-javadocs</id>
|
||||||
|
<goals>
|
||||||
|
<goal>javadoc</goal>
|
||||||
|
</goals>
|
||||||
|
</execution>
|
||||||
|
</executions>
|
||||||
|
</plugin>
|
||||||
</plugins>
|
</plugins>
|
||||||
</build>
|
</build>
|
||||||
|
|
||||||
|
@ -68,42 +128,18 @@
|
||||||
<groupId>org.bukkit</groupId>
|
<groupId>org.bukkit</groupId>
|
||||||
<artifactId>bukkit</artifactId>
|
<artifactId>bukkit</artifactId>
|
||||||
<version>1.10.2-R0.1-SNAPSHOT</version>
|
<version>1.10.2-R0.1-SNAPSHOT</version>
|
||||||
|
<scope>provided</scope>
|
||||||
</dependency>
|
</dependency>
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>org.bukkit</groupId>
|
<groupId>org.bukkit</groupId>
|
||||||
<artifactId>craftbukkit</artifactId>
|
<artifactId>craftbukkit</artifactId>
|
||||||
<version>1.10.2-R0.1-SNAPSHOT</version>
|
<version>1.10.2-R0.1-SNAPSHOT</version>
|
||||||
|
<scope>provided</scope>
|
||||||
</dependency>
|
</dependency>
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>org.mongodb</groupId>
|
<groupId>eu.univento</groupId>
|
||||||
<artifactId>mongo-java-driver</artifactId>
|
<artifactId>Commons</artifactId>
|
||||||
<version>3.2.2</version>
|
<version>1.0-SNAPSHOT</version>
|
||||||
</dependency>
|
|
||||||
<dependency>
|
|
||||||
<groupId>org.mongodb</groupId>
|
|
||||||
<artifactId>mongodb-driver-async</artifactId>
|
|
||||||
<version>3.2.2</version>
|
|
||||||
</dependency>
|
|
||||||
<dependency>
|
|
||||||
<groupId>io.netty</groupId>
|
|
||||||
<artifactId>netty-all</artifactId>
|
|
||||||
<version>4.0.36.Final</version>
|
|
||||||
</dependency>
|
|
||||||
<dependency>
|
|
||||||
<groupId>com.google.code.gson</groupId>
|
|
||||||
<artifactId>gson</artifactId>
|
|
||||||
<version>2.3.1</version>
|
|
||||||
</dependency>
|
|
||||||
<dependency>
|
|
||||||
<groupId>com.zaxxer</groupId>
|
|
||||||
<artifactId>HikariCP</artifactId>
|
|
||||||
<version>2.4.5</version>
|
|
||||||
<scope>compile</scope>
|
|
||||||
</dependency>
|
|
||||||
<dependency>
|
|
||||||
<groupId>com.google.guava</groupId>
|
|
||||||
<artifactId>guava</artifactId>
|
|
||||||
<version>19.0</version>
|
|
||||||
</dependency>
|
</dependency>
|
||||||
</dependencies>
|
</dependencies>
|
||||||
|
|
||||||
|
|
|
@ -1,33 +0,0 @@
|
||||||
package eu.univento.cloud.client;
|
|
||||||
|
|
||||||
import io.netty.bootstrap.Bootstrap;
|
|
||||||
import io.netty.channel.Channel;
|
|
||||||
import io.netty.channel.ChannelInitializer;
|
|
||||||
import io.netty.channel.nio.NioEventLoopGroup;
|
|
||||||
import io.netty.channel.socket.nio.NioSocketChannel;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @author joethei
|
|
||||||
* @version 0.1
|
|
||||||
*/
|
|
||||||
class CloudClient {
|
|
||||||
|
|
||||||
public CloudClient() throws Exception{
|
|
||||||
NioEventLoopGroup child = new NioEventLoopGroup();
|
|
||||||
try{
|
|
||||||
Bootstrap bootstrap = new Bootstrap();
|
|
||||||
bootstrap.channel(NioSocketChannel.class);
|
|
||||||
bootstrap.group(child);
|
|
||||||
bootstrap.handler(new ChannelInitializer<Channel>() {
|
|
||||||
@Override
|
|
||||||
protected void initChannel(Channel channel) throws Exception {
|
|
||||||
|
|
||||||
}
|
|
||||||
});
|
|
||||||
bootstrap.connect("master.univento.eu", 8000).sync().channel().closeFuture().sync();
|
|
||||||
}finally {
|
|
||||||
child.shutdownGracefully();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
|
@ -1,10 +0,0 @@
|
||||||
package eu.univento.cloud.client;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @author joethei
|
|
||||||
* @version 0.1
|
|
||||||
* created on 08.07.2016
|
|
||||||
*/
|
|
||||||
class CloudManager {
|
|
||||||
|
|
||||||
}
|
|
|
@ -1,24 +0,0 @@
|
||||||
package eu.univento.cloud.client;
|
|
||||||
|
|
||||||
import eu.univento.core.antihack.Hack;
|
|
||||||
import eu.univento.core.api.player.CustomPlayer;
|
|
||||||
|
|
||||||
public class CloudMessenger {
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
public static void sendModModeMessage(ModModePrefix prefix, String message) {
|
|
||||||
//TODO: add stuff + server
|
|
||||||
}
|
|
||||||
|
|
||||||
public static void sendHackMessage(Hack hack, CustomPlayer player) {
|
|
||||||
//add function
|
|
||||||
}
|
|
||||||
|
|
||||||
public enum ModModePrefix {
|
|
||||||
HACK,
|
|
||||||
CMD,
|
|
||||||
AD,
|
|
||||||
ERROR
|
|
||||||
}
|
|
||||||
}
|
|
|
@ -1,8 +1,9 @@
|
||||||
package eu.univento.core;
|
package eu.univento.core;
|
||||||
|
|
||||||
|
import eu.univento.commons.Commons;
|
||||||
|
import eu.univento.commons.server.TPS;
|
||||||
import eu.univento.core.antihack.AntiHack;
|
import eu.univento.core.antihack.AntiHack;
|
||||||
import eu.univento.core.api.Config;
|
import eu.univento.core.api.Config;
|
||||||
import eu.univento.core.api.database.DatabaseManager;
|
|
||||||
import eu.univento.core.api.effects.Blackscreen;
|
import eu.univento.core.api.effects.Blackscreen;
|
||||||
import eu.univento.core.api.events.MoveEventFilter;
|
import eu.univento.core.api.events.MoveEventFilter;
|
||||||
import eu.univento.core.api.player.CustomPlayer;
|
import eu.univento.core.api.player.CustomPlayer;
|
||||||
|
@ -24,8 +25,6 @@ import java.util.ArrayList;
|
||||||
import java.util.Collection;
|
import java.util.Collection;
|
||||||
import java.util.LinkedList;
|
import java.util.LinkedList;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.logging.Level;
|
|
||||||
import java.util.logging.Logger;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* main class
|
* main class
|
||||||
|
@ -37,18 +36,17 @@ public class Core extends JavaPlugin implements NettyInjection.PacketHandler {
|
||||||
|
|
||||||
//TODO: rewrite database operations from sync MongoDB to async MongoDB
|
//TODO: rewrite database operations from sync MongoDB to async MongoDB
|
||||||
|
|
||||||
/**
|
|
||||||
* plugin instance
|
|
||||||
*/
|
|
||||||
private static Core instance;
|
private static Core instance;
|
||||||
|
|
||||||
/**
|
|
||||||
* @return plugin instance
|
|
||||||
*/
|
|
||||||
public static Core getInstance() {
|
public static Core getInstance() {
|
||||||
return instance;
|
return instance;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private static Commons commons;
|
||||||
|
public static Commons getCommons() {
|
||||||
|
return commons;
|
||||||
|
}
|
||||||
|
|
||||||
private ArrayList<String> registeredPlugins = new ArrayList<>();
|
private ArrayList<String> registeredPlugins = new ArrayList<>();
|
||||||
|
|
||||||
public void registerPlugin(Plugin plugin) {
|
public void registerPlugin(Plugin plugin) {
|
||||||
|
@ -59,20 +57,17 @@ public class Core extends JavaPlugin implements NettyInjection.PacketHandler {
|
||||||
if (registeredPlugins.contains(plugin.getName())) registeredPlugins.remove(plugin.getName());
|
if (registeredPlugins.contains(plugin.getName())) registeredPlugins.remove(plugin.getName());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static String getNMSVersion() {
|
||||||
|
final String packageName = Bukkit.getServer().getClass().getPackage().getName();
|
||||||
|
return packageName.substring(packageName.lastIndexOf('.') + 1);
|
||||||
|
}
|
||||||
|
|
||||||
private NettyInjection injection;
|
private NettyInjection injection;
|
||||||
private static List<CustomPlayer> timeout = new ArrayList<>();
|
private static List<CustomPlayer> timeout = new LinkedList<>();
|
||||||
public static List<CustomPlayer> getTimeout() {
|
public static List<CustomPlayer> getTimeout() {
|
||||||
return timeout;
|
return timeout;
|
||||||
}
|
}
|
||||||
|
|
||||||
private static DatabaseManager databaseManager;
|
|
||||||
|
|
||||||
public static DatabaseManager getDatabaseManager() {
|
|
||||||
return databaseManager;
|
|
||||||
}
|
|
||||||
|
|
||||||
private static final Logger log = Bukkit.getLogger();
|
|
||||||
|
|
||||||
public static Collection<CustomPlayer> getOnlinePlayers() {
|
public static Collection<CustomPlayer> getOnlinePlayers() {
|
||||||
Collection<CustomPlayer> list = new LinkedList<>();
|
Collection<CustomPlayer> list = new LinkedList<>();
|
||||||
for (Player players : Bukkit.getOnlinePlayers()) {
|
for (Player players : Bukkit.getOnlinePlayers()) {
|
||||||
|
@ -84,23 +79,37 @@ public class Core extends JavaPlugin implements NettyInjection.PacketHandler {
|
||||||
|
|
||||||
public static void broadcast(String key) {
|
public static void broadcast(String key) {
|
||||||
for (CustomPlayer players : getOnlinePlayers()) {
|
for (CustomPlayer players : getOnlinePlayers()) {
|
||||||
players.sendMessage(players.getMessage(key));
|
players.sendMessage(players.getDatabasePlayer().getMessage(key));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/*
|
||||||
* @param level Log level
|
@Override
|
||||||
* @param string String
|
public void onLoad() {
|
||||||
|
Updater updater = new Updater("https://development.univento.eu/files/Core.json", "Core", "1.2.6");
|
||||||
|
if(updater.needsUpdate()) {
|
||||||
|
commons.getLoggingHandler().getCore().info("Downloading update");
|
||||||
|
if(!updater.delete()) {
|
||||||
|
commons.getLoggingHandler().getCore().error("Failed deleting old file, retry");
|
||||||
|
getServer().spigot().restart();
|
||||||
|
}else{
|
||||||
|
commons.getLoggingHandler().getCore().info("New version, updating");
|
||||||
|
Bukkit.getPluginManager().disablePlugin(this);
|
||||||
|
if(!updater.download()) {
|
||||||
|
commons.getLoggingHandler().getCore().error("error while downloading new version");
|
||||||
|
}else{
|
||||||
|
getServer().spigot().restart();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
*/
|
*/
|
||||||
public static void log(Level level, String string) {
|
|
||||||
if (ServerSettings.isDebug()) {
|
|
||||||
log.log(level, "[univento Core] " + string);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onEnable() {
|
public void onEnable() {
|
||||||
log(Level.INFO, "\n" +
|
commons = new Commons();
|
||||||
|
registerPlugin(this);
|
||||||
|
commons.getLoggingHandler().getCore().info("\n" +
|
||||||
"\n" +
|
"\n" +
|
||||||
" \n" +
|
" \n" +
|
||||||
" \n" +
|
" \n" +
|
||||||
|
@ -152,7 +161,7 @@ public class Core extends JavaPlugin implements NettyInjection.PacketHandler {
|
||||||
}
|
}
|
||||||
AntiHack.registerListeners();
|
AntiHack.registerListeners();
|
||||||
|
|
||||||
new RunAs(this, "RunAs", "run command as other player");
|
new RunAs(this, "RunAs", "run commons as other player");
|
||||||
new SystemInfo(this, "SystemInfo", "gives info about the server system");
|
new SystemInfo(this, "SystemInfo", "gives info about the server system");
|
||||||
new Vanish(this, "vanish", "vanish/unvanish your self");
|
new Vanish(this, "vanish", "vanish/unvanish your self");
|
||||||
new GameMode(this, "gamemode", "sets your gamemode", "gm");
|
new GameMode(this, "gamemode", "sets your gamemode", "gm");
|
||||||
|
@ -175,8 +184,7 @@ public class Core extends JavaPlugin implements NettyInjection.PacketHandler {
|
||||||
Bukkit.getMessenger().registerOutgoingPluginChannel(this, "schematica");
|
Bukkit.getMessenger().registerOutgoingPluginChannel(this, "schematica");
|
||||||
|
|
||||||
Blackscreen.setupUtil(getInstance());
|
Blackscreen.setupUtil(getInstance());
|
||||||
databaseManager = new DatabaseManager(getInstance());
|
Bukkit.getScheduler().scheduleSyncDelayedTask(this, () -> commons.getLoggingHandler().getCore().info("\n" +
|
||||||
Bukkit.getScheduler().scheduleSyncDelayedTask(this, () -> log(Level.INFO, "\n" +
|
|
||||||
"\n" +
|
"\n" +
|
||||||
"\n" +
|
"\n" +
|
||||||
" _ _ \n" +
|
" _ _ \n" +
|
||||||
|
@ -191,11 +199,11 @@ public class Core extends JavaPlugin implements NettyInjection.PacketHandler {
|
||||||
Bukkit.getScheduler().scheduleSyncDelayedTask(this, () -> {
|
Bukkit.getScheduler().scheduleSyncDelayedTask(this, () -> {
|
||||||
for (Plugin plugin : pm.getPlugins()) {
|
for (Plugin plugin : pm.getPlugins()) {
|
||||||
if (!plugin.getName().equalsIgnoreCase("WorldEdit") && !plugin.getName().equalsIgnoreCase("VoxelSniper") && !registeredPlugins.contains(plugin.getName())) {
|
if (!plugin.getName().equalsIgnoreCase("WorldEdit") && !plugin.getName().equalsIgnoreCase("VoxelSniper") && !registeredPlugins.contains(plugin.getName())) {
|
||||||
log(Level.WARNING, "§cDas Plugin " + plugin.getName() + " ist nicht für den Server zugelassen.");
|
commons.getLoggingHandler().getCore().warn("§cDas Plugin " + plugin.getName() + " ist nicht für den Server zugelassen.");
|
||||||
|
getServer().shutdown();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}, 5L);
|
}, 5L);
|
||||||
|
|
||||||
this.injection = new NettyInjection(this, this.getName());
|
this.injection = new NettyInjection(this, this.getName());
|
||||||
this.injection.addHandler("TIMEOUT", new NettyInjection.PacketHandler() {
|
this.injection.addHandler("TIMEOUT", new NettyInjection.PacketHandler() {
|
||||||
public Object onPacketIn(Player sender, Channel channel, Object packet) {
|
public Object onPacketIn(Player sender, Channel channel, Object packet) {
|
||||||
|
@ -204,17 +212,23 @@ public class Core extends JavaPlugin implements NettyInjection.PacketHandler {
|
||||||
return packet;
|
return packet;
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
commons.getSecurityHandler().isValidServer(getServer().getIp(), aBoolean -> {
|
||||||
|
if(!aBoolean) {
|
||||||
|
getServer().shutdown();
|
||||||
|
}
|
||||||
|
});
|
||||||
|
Bukkit.getScheduler().runTask(this, new TPS());
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onDisable() {
|
public void onDisable() {
|
||||||
databaseManager.closeConnections();
|
commons.shutdown();
|
||||||
Bukkit.getMessenger().unregisterIncomingPluginChannel(this);
|
Bukkit.getMessenger().unregisterIncomingPluginChannel(this);
|
||||||
Bukkit.getMessenger().unregisterOutgoingPluginChannel(this);
|
Bukkit.getMessenger().unregisterOutgoingPluginChannel(this);
|
||||||
|
|
||||||
this.injection.disable();
|
this.injection.disable();
|
||||||
|
|
||||||
log(Level.INFO, "\n" +
|
commons.getLoggingHandler().getCore().info("\n" +
|
||||||
"\n" +
|
"\n" +
|
||||||
" \n" +
|
" \n" +
|
||||||
" \n" +
|
" \n" +
|
||||||
|
|
|
@ -1,6 +1,5 @@
|
||||||
package eu.univento.core.antihack;
|
package eu.univento.core.antihack;
|
||||||
|
|
||||||
import eu.univento.cloud.client.CloudMessenger;
|
|
||||||
import eu.univento.core.Core;
|
import eu.univento.core.Core;
|
||||||
import eu.univento.core.antihack.modules.*;
|
import eu.univento.core.antihack.modules.*;
|
||||||
import eu.univento.core.antihack.utils.PacketInjector;
|
import eu.univento.core.antihack.utils.PacketInjector;
|
||||||
|
@ -34,7 +33,6 @@ public class AntiHack implements Listener{
|
||||||
|
|
||||||
for(Map.Entry<CustomPlayer, Integer> entry : AutoClicker.clicks.entrySet()) {
|
for(Map.Entry<CustomPlayer, Integer> entry : AutoClicker.clicks.entrySet()) {
|
||||||
if(entry.getValue() > 16) {
|
if(entry.getValue() > 16) {
|
||||||
CloudMessenger.sendHackMessage(Hack.AUTOCLICKER, entry.getKey());
|
|
||||||
//TODO: change to real warn reason
|
//TODO: change to real warn reason
|
||||||
entry.getKey().warn(WarnReason.SPAM, null, "https://players.univento.eu/" + entry.getKey().getUniqueId().toString() + "/hacks");
|
entry.getKey().warn(WarnReason.SPAM, null, "https://players.univento.eu/" + entry.getKey().getUniqueId().toString() + "/hacks");
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,7 +1,5 @@
|
||||||
package eu.univento.core.antihack.modules;
|
package eu.univento.core.antihack.modules;
|
||||||
|
|
||||||
import eu.univento.cloud.client.CloudMessenger;
|
|
||||||
import eu.univento.core.antihack.Hack;
|
|
||||||
import eu.univento.core.api.player.CustomPlayer;
|
import eu.univento.core.api.player.CustomPlayer;
|
||||||
import eu.univento.core.api.player.WarnReason;
|
import eu.univento.core.api.player.WarnReason;
|
||||||
import org.bukkit.event.EventHandler;
|
import org.bukkit.event.EventHandler;
|
||||||
|
@ -25,7 +23,6 @@ public class AutoRespawn implements Listener {
|
||||||
CustomPlayer p = CustomPlayer.getPlayer(e.getPlayer());
|
CustomPlayer p = CustomPlayer.getPlayer(e.getPlayer());
|
||||||
if(time.containsKey(p)) {
|
if(time.containsKey(p)) {
|
||||||
if(System.currentTimeMillis() - time.get(p) <= 200L) {
|
if(System.currentTimeMillis() - time.get(p) <= 200L) {
|
||||||
CloudMessenger.sendHackMessage(Hack.AUTORESPAWN, p);
|
|
||||||
//TODO: change to real warn reason
|
//TODO: change to real warn reason
|
||||||
p.warn(WarnReason.SPAM, null, "https://players.univento.eu/" + p.getUniqueId().toString() + "/hacks");
|
p.warn(WarnReason.SPAM, null, "https://players.univento.eu/" + p.getUniqueId().toString() + "/hacks");
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,8 +1,6 @@
|
||||||
package eu.univento.core.antihack.modules;
|
package eu.univento.core.antihack.modules;
|
||||||
|
|
||||||
import eu.univento.cloud.client.CloudMessenger;
|
|
||||||
import eu.univento.core.Core;
|
import eu.univento.core.Core;
|
||||||
import eu.univento.core.antihack.Hack;
|
|
||||||
import eu.univento.core.api.player.CustomPlayer;
|
import eu.univento.core.api.player.CustomPlayer;
|
||||||
import eu.univento.core.api.player.WarnReason;
|
import eu.univento.core.api.player.WarnReason;
|
||||||
import org.bukkit.Bukkit;
|
import org.bukkit.Bukkit;
|
||||||
|
@ -48,7 +46,6 @@ public class Criticals implements Listener {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if (fark == 0.125 || fark == 1.0 || fark == 1.3 || fark == 0.6190840103302007 || fark == 0.4414162352399398 || fark == 200.0) {
|
if (fark == 0.125 || fark == 1.0 || fark == 1.3 || fark == 0.6190840103302007 || fark == 0.4414162352399398 || fark == 200.0) {
|
||||||
CloudMessenger.sendHackMessage(Hack.CRITICALS, p);
|
|
||||||
//TODO: change to real warn reason
|
//TODO: change to real warn reason
|
||||||
p.warn(WarnReason.SPAM, null, "https://players.univento.eu/" + p.getUniqueId().toString() + "/hacks");
|
p.warn(WarnReason.SPAM, null, "https://players.univento.eu/" + p.getUniqueId().toString() + "/hacks");
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,7 +1,5 @@
|
||||||
package eu.univento.core.antihack.modules;
|
package eu.univento.core.antihack.modules;
|
||||||
|
|
||||||
import eu.univento.cloud.client.CloudMessenger;
|
|
||||||
import eu.univento.core.antihack.Hack;
|
|
||||||
import eu.univento.core.api.player.CustomPlayer;
|
import eu.univento.core.api.player.CustomPlayer;
|
||||||
import eu.univento.core.api.player.WarnReason;
|
import eu.univento.core.api.player.WarnReason;
|
||||||
import org.bukkit.event.EventHandler;
|
import org.bukkit.event.EventHandler;
|
||||||
|
@ -19,8 +17,7 @@ public class FastPlace implements Listener{
|
||||||
CustomPlayer p = CustomPlayer.getPlayer(e.getPlayer());
|
CustomPlayer p = CustomPlayer.getPlayer(e.getPlayer());
|
||||||
if(time.containsKey(p)) {
|
if(time.containsKey(p)) {
|
||||||
if(System.currentTimeMillis() - time.get(p) <= 110L) {
|
if(System.currentTimeMillis() - time.get(p) <= 110L) {
|
||||||
CloudMessenger.sendHackMessage(Hack.FASTPLACE, p);
|
//TODO: change to real reason
|
||||||
//TODO: change to real warn reason
|
|
||||||
p.warn(WarnReason.ADVERTISEMENT, null, "https://players.univento.eu/" + p.getUniqueId().toString() + "/hacks");
|
p.warn(WarnReason.ADVERTISEMENT, null, "https://players.univento.eu/" + p.getUniqueId().toString() + "/hacks");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,7 +1,5 @@
|
||||||
package eu.univento.core.antihack.modules;
|
package eu.univento.core.antihack.modules;
|
||||||
|
|
||||||
import eu.univento.cloud.client.CloudMessenger;
|
|
||||||
import eu.univento.core.antihack.Hack;
|
|
||||||
import eu.univento.core.api.player.CustomPlayer;
|
import eu.univento.core.api.player.CustomPlayer;
|
||||||
import org.bukkit.GameMode;
|
import org.bukkit.GameMode;
|
||||||
import org.bukkit.event.EventHandler;
|
import org.bukkit.event.EventHandler;
|
||||||
|
@ -14,8 +12,7 @@ public class Fly implements Listener{
|
||||||
public void onFly(PlayerMoveEvent e) {
|
public void onFly(PlayerMoveEvent e) {
|
||||||
CustomPlayer p = CustomPlayer.getPlayer(e.getPlayer());
|
CustomPlayer p = CustomPlayer.getPlayer(e.getPlayer());
|
||||||
if(p.getGameMode() != GameMode.CREATIVE && e.getTo().getY() > e.getFrom().getY() + 1.5) {
|
if(p.getGameMode() != GameMode.CREATIVE && e.getTo().getY() > e.getFrom().getY() + 1.5) {
|
||||||
CloudMessenger.sendHackMessage(Hack.FLY, p);
|
//p.warn(Hack.FLY);
|
||||||
p.warn(Hack.FLY);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
|
@ -1,7 +1,5 @@
|
||||||
package eu.univento.core.antihack.modules;
|
package eu.univento.core.antihack.modules;
|
||||||
|
|
||||||
import eu.univento.cloud.client.CloudMessenger;
|
|
||||||
import eu.univento.core.antihack.Hack;
|
|
||||||
import eu.univento.core.api.player.CustomPlayer;
|
import eu.univento.core.api.player.CustomPlayer;
|
||||||
import org.bukkit.Material;
|
import org.bukkit.Material;
|
||||||
import org.bukkit.event.EventHandler;
|
import org.bukkit.event.EventHandler;
|
||||||
|
@ -14,8 +12,7 @@ public class Glide implements Listener{
|
||||||
public void onGlide(PlayerMoveEvent e) {
|
public void onGlide(PlayerMoveEvent e) {
|
||||||
CustomPlayer p = CustomPlayer.getPlayer(e.getPlayer());
|
CustomPlayer p = CustomPlayer.getPlayer(e.getPlayer());
|
||||||
if(e.getTo().getY() - e.getFrom().getY() == -0.125 && e.getTo().clone().subtract(0.0, 1.0, 0.0).getBlock().getType().equals(Material.AIR)) {
|
if(e.getTo().getY() - e.getFrom().getY() == -0.125 && e.getTo().clone().subtract(0.0, 1.0, 0.0).getBlock().getType().equals(Material.AIR)) {
|
||||||
CloudMessenger.sendHackMessage(Hack.GLIDE, p);
|
//p.warn(Hack.GLIDE);
|
||||||
p.warn(Hack.GLIDE);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
|
@ -1,7 +1,5 @@
|
||||||
package eu.univento.core.antihack.modules;
|
package eu.univento.core.antihack.modules;
|
||||||
|
|
||||||
import eu.univento.cloud.client.CloudMessenger;
|
|
||||||
import eu.univento.core.antihack.Hack;
|
|
||||||
import eu.univento.core.api.player.CustomPlayer;
|
import eu.univento.core.api.player.CustomPlayer;
|
||||||
import org.bukkit.entity.Player;
|
import org.bukkit.entity.Player;
|
||||||
import org.bukkit.event.EventHandler;
|
import org.bukkit.event.EventHandler;
|
||||||
|
@ -16,8 +14,7 @@ public class NoSlowDown implements Listener{
|
||||||
if(e.getEntity() instanceof Player) {
|
if(e.getEntity() instanceof Player) {
|
||||||
CustomPlayer p = CustomPlayer.getPlayer((Player) e.getEntity());
|
CustomPlayer p = CustomPlayer.getPlayer((Player) e.getEntity());
|
||||||
if(p.isSprinting()) {
|
if(p.isSprinting()) {
|
||||||
CloudMessenger.sendHackMessage(Hack.NOSLOWDOWN, p);
|
//p.warn(Hack.NOSLOWDOWN);
|
||||||
p.warn(Hack.NOSLOWDOWN);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -27,8 +24,7 @@ public class NoSlowDown implements Listener{
|
||||||
if(e.getEntity() instanceof Player) {
|
if(e.getEntity() instanceof Player) {
|
||||||
CustomPlayer p = CustomPlayer.getPlayer((Player) e.getEntity());
|
CustomPlayer p = CustomPlayer.getPlayer((Player) e.getEntity());
|
||||||
if(e.getFoodLevel() > p.getFoodLevel() && p.isSprinting()) {
|
if(e.getFoodLevel() > p.getFoodLevel() && p.isSprinting()) {
|
||||||
CloudMessenger.sendHackMessage(Hack.NOSLOWDOWN, p);
|
//p.warn(Hack.NOSLOWDOWN);
|
||||||
p.warn(Hack.NOSLOWDOWN);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,7 +1,5 @@
|
||||||
package eu.univento.core.antihack.modules;
|
package eu.univento.core.antihack.modules;
|
||||||
|
|
||||||
import eu.univento.cloud.client.CloudMessenger;
|
|
||||||
import eu.univento.core.antihack.Hack;
|
|
||||||
import eu.univento.core.api.player.CustomPlayer;
|
import eu.univento.core.api.player.CustomPlayer;
|
||||||
import eu.univento.core.api.player.WarnReason;
|
import eu.univento.core.api.player.WarnReason;
|
||||||
import org.bukkit.event.EventHandler;
|
import org.bukkit.event.EventHandler;
|
||||||
|
@ -13,7 +11,6 @@ import java.util.LinkedHashMap;
|
||||||
/**
|
/**
|
||||||
* @author joethei
|
* @author joethei
|
||||||
* @version 0.1
|
* @version 0.1
|
||||||
* created on 01.07.2016
|
|
||||||
*/
|
*/
|
||||||
class Nuker implements Listener {
|
class Nuker implements Listener {
|
||||||
|
|
||||||
|
@ -28,7 +25,6 @@ class Nuker implements Listener {
|
||||||
blocks.put(p, blocks.get(p) + 1);
|
blocks.put(p, blocks.get(p) + 1);
|
||||||
if(blocks.get(p) > 80) {
|
if(blocks.get(p) > 80) {
|
||||||
e.setCancelled(true);
|
e.setCancelled(true);
|
||||||
CloudMessenger.sendHackMessage(Hack.NUKER, p);
|
|
||||||
p.warn(WarnReason.SPAM, null, "https://players.univento.eu/" + p.getUniqueId().toString() + "/hacks");
|
p.warn(WarnReason.SPAM, null, "https://players.univento.eu/" + p.getUniqueId().toString() + "/hacks");
|
||||||
}
|
}
|
||||||
}else{
|
}else{
|
||||||
|
|
|
@ -1,7 +1,5 @@
|
||||||
package eu.univento.core.antihack.modules;
|
package eu.univento.core.antihack.modules;
|
||||||
|
|
||||||
import eu.univento.cloud.client.CloudMessenger;
|
|
||||||
import eu.univento.core.antihack.Hack;
|
|
||||||
import eu.univento.core.api.player.CustomPlayer;
|
import eu.univento.core.api.player.CustomPlayer;
|
||||||
import org.bukkit.block.Block;
|
import org.bukkit.block.Block;
|
||||||
import org.bukkit.entity.Player;
|
import org.bukkit.entity.Player;
|
||||||
|
@ -19,8 +17,7 @@ public class Reach implements Listener{
|
||||||
CustomPlayer p = CustomPlayer.getPlayer((Player) e.getEntity());
|
CustomPlayer p = CustomPlayer.getPlayer((Player) e.getEntity());
|
||||||
if(damager.getLocation().distance(p.getLocation()) > 4.0) {
|
if(damager.getLocation().distance(p.getLocation()) > 4.0) {
|
||||||
e.setCancelled(true);
|
e.setCancelled(true);
|
||||||
CloudMessenger.sendHackMessage(Hack.REACH, damager);
|
//p.warn(Hack.REACH);
|
||||||
p.warn(Hack.REACH);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -32,8 +29,7 @@ public class Reach implements Listener{
|
||||||
if(p.getWorld() != b.getWorld()) return;
|
if(p.getWorld() != b.getWorld()) return;
|
||||||
if(p.getLocation().distance(b.getLocation()) > 6.1) {
|
if(p.getLocation().distance(b.getLocation()) > 6.1) {
|
||||||
e.setCancelled(true);
|
e.setCancelled(true);
|
||||||
CloudMessenger.sendHackMessage(Hack.REACH, p);
|
//p.warn(Hack.REACH);
|
||||||
p.warn(Hack.REACH);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -1,8 +1,6 @@
|
||||||
package eu.univento.core.antihack.modules;
|
package eu.univento.core.antihack.modules;
|
||||||
|
|
||||||
import eu.univento.cloud.client.CloudMessenger;
|
|
||||||
import eu.univento.core.Core;
|
import eu.univento.core.Core;
|
||||||
import eu.univento.core.antihack.Hack;
|
|
||||||
import eu.univento.core.api.player.CustomPlayer;
|
import eu.univento.core.api.player.CustomPlayer;
|
||||||
import eu.univento.core.api.player.WarnReason;
|
import eu.univento.core.api.player.WarnReason;
|
||||||
import org.bukkit.Bukkit;
|
import org.bukkit.Bukkit;
|
||||||
|
@ -29,7 +27,6 @@ public class Regen implements Listener {
|
||||||
}
|
}
|
||||||
if (e.getAmount() > 1.0) {
|
if (e.getAmount() > 1.0) {
|
||||||
p.setFoodLevel(0);
|
p.setFoodLevel(0);
|
||||||
CloudMessenger.sendHackMessage(Hack.REGEN, p);
|
|
||||||
//TODO: change to real warn reason
|
//TODO: change to real warn reason
|
||||||
p.warn(WarnReason.SPAM, null, "https://players.univento.eu/" + p.getUniqueId().toString() + "/hacks");
|
p.warn(WarnReason.SPAM, null, "https://players.univento.eu/" + p.getUniqueId().toString() + "/hacks");
|
||||||
return;
|
return;
|
||||||
|
@ -41,7 +38,6 @@ public class Regen implements Listener {
|
||||||
if (!a.contains(p)) {
|
if (!a.contains(p)) {
|
||||||
p.setFoodLevel(0);
|
p.setFoodLevel(0);
|
||||||
b.remove(p);
|
b.remove(p);
|
||||||
CloudMessenger.sendHackMessage(Hack.REGEN, p);
|
|
||||||
//TODO: change to real warn reason
|
//TODO: change to real warn reason
|
||||||
p.warn(WarnReason.SPAM, null, "https://players.univento.eu/" + p.getUniqueId().toString() + "/hacks");
|
p.warn(WarnReason.SPAM, null, "https://players.univento.eu/" + p.getUniqueId().toString() + "/hacks");
|
||||||
} else if (a.contains(p)) {
|
} else if (a.contains(p)) {
|
||||||
|
|
|
@ -1,9 +1,7 @@
|
||||||
package eu.univento.core.antihack.utils;
|
package eu.univento.core.antihack.utils;
|
||||||
|
|
||||||
import com.mojang.authlib.GameProfile;
|
import com.mojang.authlib.GameProfile;
|
||||||
import eu.univento.cloud.client.CloudMessenger;
|
|
||||||
import eu.univento.core.Core;
|
import eu.univento.core.Core;
|
||||||
import eu.univento.core.antihack.Hack;
|
|
||||||
import eu.univento.core.antihack.modules.KillAura;
|
import eu.univento.core.antihack.modules.KillAura;
|
||||||
import eu.univento.core.api.fakeplayer.FakePlayer;
|
import eu.univento.core.api.fakeplayer.FakePlayer;
|
||||||
import eu.univento.core.api.player.CustomPlayer;
|
import eu.univento.core.api.player.CustomPlayer;
|
||||||
|
@ -72,7 +70,6 @@ class PacketHandler extends ChannelDuplexHandler {
|
||||||
} else {
|
} else {
|
||||||
count.remove(player);
|
count.remove(player);
|
||||||
CustomPlayer p = CustomPlayer.getPlayer(player);
|
CustomPlayer p = CustomPlayer.getPlayer(player);
|
||||||
CloudMessenger.sendHackMessage(Hack.KILLAURA, p);
|
|
||||||
p.warn(WarnReason.SPAM, null, "https://players.univento.eu/" + p.getUniqueId().toString() + "/hacks");
|
p.warn(WarnReason.SPAM, null, "https://players.univento.eu/" + p.getUniqueId().toString() + "/hacks");
|
||||||
}
|
}
|
||||||
killAura.remove(player);
|
killAura.remove(player);
|
||||||
|
|
|
@ -11,7 +11,6 @@ import java.lang.reflect.Field;
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.Collections;
|
import java.util.Collections;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.logging.Level;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @author PostCrafter
|
* @author PostCrafter
|
||||||
|
@ -25,7 +24,7 @@ public abstract class AutoCommand<P extends JavaPlugin> extends Command {
|
||||||
static {
|
static {
|
||||||
String path = Bukkit.getServer().getClass().getPackage().getName();
|
String path = Bukkit.getServer().getClass().getPackage().getName();
|
||||||
AutoCommand.VERSION = path.substring(path.lastIndexOf(".") + 1, path.length());
|
AutoCommand.VERSION = path.substring(path.lastIndexOf(".") + 1, path.length());
|
||||||
Core.log(Level.INFO, "AutoCommand hook for Bukkit " + AutoCommand.VERSION);
|
Core.getCommons().getLoggingHandler().getCore().info("AutoCommand hook for Bukkit " + AutoCommand.VERSION);
|
||||||
}
|
}
|
||||||
|
|
||||||
private final P plugin;
|
private final P plugin;
|
||||||
|
|
|
@ -118,10 +118,11 @@ public class Config {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* read integer from config
|
* read integer from config
|
||||||
|
* @param path path
|
||||||
* @return Integer
|
* @return Integer
|
||||||
*/
|
*/
|
||||||
public static int readInt() {
|
public static int readInt(String path) {
|
||||||
return cfg.getInt("MongoDB.Port");
|
return cfg.getInt(path);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
@ -2,6 +2,7 @@ package eu.univento.core.api;
|
||||||
|
|
||||||
|
|
||||||
import eu.univento.core.Core;
|
import eu.univento.core.Core;
|
||||||
|
import eu.univento.core.api.player.CustomPlayer;
|
||||||
import org.bukkit.*;
|
import org.bukkit.*;
|
||||||
import org.bukkit.entity.Entity;
|
import org.bukkit.entity.Entity;
|
||||||
import org.bukkit.entity.Player;
|
import org.bukkit.entity.Player;
|
||||||
|
@ -14,6 +15,7 @@ import java.util.List;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* some utils you may need
|
* some utils you may need
|
||||||
|
*
|
||||||
* @author joethei
|
* @author joethei
|
||||||
* @version 1.0
|
* @version 1.0
|
||||||
*/
|
*/
|
||||||
|
@ -21,6 +23,7 @@ public class Utils {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* plays sound for all players
|
* plays sound for all players
|
||||||
|
*
|
||||||
* @param s Sound
|
* @param s Sound
|
||||||
*/
|
*/
|
||||||
public static void playSoundToAll(Sound s) {
|
public static void playSoundToAll(Sound s) {
|
||||||
|
@ -30,6 +33,7 @@ public class Utils {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* plays effect for all players
|
* plays effect for all players
|
||||||
|
*
|
||||||
* @param e Effect
|
* @param e Effect
|
||||||
*/
|
*/
|
||||||
@SuppressWarnings("deprecation")
|
@SuppressWarnings("deprecation")
|
||||||
|
@ -40,6 +44,7 @@ public class Utils {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* checks if server version is from spigot
|
* checks if server version is from spigot
|
||||||
|
*
|
||||||
* @return true/false
|
* @return true/false
|
||||||
*/
|
*/
|
||||||
public static boolean isSpigot() {
|
public static boolean isSpigot() {
|
||||||
|
@ -48,6 +53,7 @@ public class Utils {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* deletes all folders and files in directory
|
* deletes all folders and files in directory
|
||||||
|
*
|
||||||
* @param file File
|
* @param file File
|
||||||
*/
|
*/
|
||||||
private static void deleteDir(File file) {
|
private static void deleteDir(File file) {
|
||||||
|
@ -69,6 +75,7 @@ public class Utils {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* creates a random number
|
* creates a random number
|
||||||
|
*
|
||||||
* @param low lowest possible value
|
* @param low lowest possible value
|
||||||
* @param high highest possible value
|
* @param high highest possible value
|
||||||
* @return double
|
* @return double
|
||||||
|
@ -79,6 +86,7 @@ public class Utils {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* checks if player has empty inventory
|
* checks if player has empty inventory
|
||||||
|
*
|
||||||
* @param p Player
|
* @param p Player
|
||||||
* @return true/false
|
* @return true/false
|
||||||
*/
|
*/
|
||||||
|
@ -97,7 +105,8 @@ public class Utils {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* removes list of entity and counts them
|
* removes list of entity and counts them
|
||||||
* @param e List<Entity>
|
*
|
||||||
|
* @param e Entity list
|
||||||
* @return Integer
|
* @return Integer
|
||||||
*/
|
*/
|
||||||
public static int removeEntitys(List<Entity> e) {
|
public static int removeEntitys(List<Entity> e) {
|
||||||
|
@ -111,6 +120,7 @@ public class Utils {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* clears all potion effects from player
|
* clears all potion effects from player
|
||||||
|
*
|
||||||
* @param player Player
|
* @param player Player
|
||||||
*/
|
*/
|
||||||
public static void clearPotionEffects(Player player) {
|
public static void clearPotionEffects(Player player) {
|
||||||
|
@ -120,6 +130,7 @@ public class Utils {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* calculates vector from one location to another
|
* calculates vector from one location to another
|
||||||
|
*
|
||||||
* @param from Location
|
* @param from Location
|
||||||
* @param to Location
|
* @param to Location
|
||||||
* @return Vector
|
* @return Vector
|
||||||
|
@ -155,11 +166,18 @@ public class Utils {
|
||||||
* restarts server
|
* restarts server
|
||||||
*/
|
*/
|
||||||
public static void restart() {
|
public static void restart() {
|
||||||
Bukkit.getScheduler().scheduleSyncDelayedTask(Core.getInstance(), () -> Bukkit.spigot().restart(), 10 * 20L);
|
Bukkit.getScheduler().scheduleSyncDelayedTask(Core.getInstance(), () -> {
|
||||||
|
if(Core.getOnlinePlayers().size() != 0) {
|
||||||
|
for(CustomPlayer players : Core.getOnlinePlayers())
|
||||||
|
players.connectToServer("Lobby01");
|
||||||
|
}
|
||||||
|
Bukkit.spigot().restart();
|
||||||
|
}, 10 * 20L);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* shots random firework at specified location
|
* shots random firework at specified location
|
||||||
|
*
|
||||||
* @param loc Location
|
* @param loc Location
|
||||||
*/
|
*/
|
||||||
public static void randomFirework(Location loc) {
|
public static void randomFirework(Location loc) {
|
||||||
|
|
|
@ -0,0 +1,46 @@
|
||||||
|
package eu.univento.core.api.blocks.banners;
|
||||||
|
|
||||||
|
import org.bukkit.DyeColor;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @author tschuliaehn
|
||||||
|
* @version 1.0
|
||||||
|
*/
|
||||||
|
|
||||||
|
public enum BannerColor {
|
||||||
|
BLACK('0', DyeColor.BLACK), BLUE('1', DyeColor.BLUE), BROWN('g', DyeColor.BROWN), CYAN('3', DyeColor.CYAN), GRAY('8', DyeColor.GRAY), GREEN('2', DyeColor.GREEN), LIGHT_BLUE('b', DyeColor.LIGHT_BLUE), LIME('a', DyeColor.LIME), MAGENTA('c', DyeColor.MAGENTA), ORANGE('6', DyeColor.ORANGE), PINK('d', DyeColor.PINK), PURPLE('5', DyeColor.PURPLE), RED('4', DyeColor.RED), SILVER('7', DyeColor.SILVER), WHITE('f', DyeColor.WHITE), YELLOW('e', DyeColor.YELLOW);
|
||||||
|
|
||||||
|
private char colorCode;
|
||||||
|
private DyeColor color;
|
||||||
|
public static final char COLORCODE = '§';
|
||||||
|
public static final char FOREGROUND_COLORCODE = 'F';
|
||||||
|
public static final char BACKGROUND_COLORCODE = 'B';
|
||||||
|
|
||||||
|
private BannerColor(char colorCode, DyeColor color) {
|
||||||
|
this.colorCode = colorCode;
|
||||||
|
this.color = color;
|
||||||
|
}
|
||||||
|
|
||||||
|
public char getColorCode() {
|
||||||
|
return this.colorCode;
|
||||||
|
}
|
||||||
|
|
||||||
|
public DyeColor getColor() {
|
||||||
|
return this.color;
|
||||||
|
}
|
||||||
|
|
||||||
|
public static BannerColor translate(char color) {
|
||||||
|
BannerColor[] arrayOfBannerColor;
|
||||||
|
int j = (arrayOfBannerColor = values()).length;
|
||||||
|
for (int i = 0; i < j; i++) {
|
||||||
|
BannerColor colors = arrayOfBannerColor[i];
|
||||||
|
if (colors.getColorCode() == color) {
|
||||||
|
return colors;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return WHITE;
|
||||||
|
}
|
||||||
|
|
||||||
|
public static final BannerColor NORMAL_FOREGROUND = WHITE;
|
||||||
|
public static final BannerColor NORMAL_BACKGROUND = BLACK;
|
||||||
|
}
|
|
@ -0,0 +1,139 @@
|
||||||
|
package eu.univento.core.api.blocks.banners;
|
||||||
|
|
||||||
|
import org.bukkit.block.Banner;
|
||||||
|
|
||||||
|
import java.util.ArrayList;
|
||||||
|
import java.util.Collection;
|
||||||
|
import java.util.HashMap;
|
||||||
|
import java.util.Iterator;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @author tschuliaehn
|
||||||
|
* @version 1.0
|
||||||
|
*/
|
||||||
|
|
||||||
|
public class BannerString {
|
||||||
|
private HashMap<Integer, Banner> bannerSequence;
|
||||||
|
private boolean autoClear = true;
|
||||||
|
private BannerColor clearColor = BannerColor.WHITE;
|
||||||
|
private BannerColor standardForegroundColor = BannerColor.NORMAL_FOREGROUND;
|
||||||
|
private BannerColor standardBackgroundColor = BannerColor.NORMAL_BACKGROUND;
|
||||||
|
|
||||||
|
public BannerString() {
|
||||||
|
this(new HashMap<>());
|
||||||
|
}
|
||||||
|
|
||||||
|
public BannerString(ArrayList<Banner> banners) {
|
||||||
|
this.bannerSequence = new HashMap<>();
|
||||||
|
for (int i = 0; i < banners.size(); i++) {
|
||||||
|
this.bannerSequence.put(i, banners.get(i));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public BannerString(HashMap<Integer, Banner> bannerSequence) {
|
||||||
|
this.bannerSequence = bannerSequence;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void insertNextBanner(Banner banner) {
|
||||||
|
Iterator<Integer> iterator = this.bannerSequence.keySet().iterator();
|
||||||
|
int last = 0;
|
||||||
|
while (iterator.hasNext()) {
|
||||||
|
last = iterator.next();
|
||||||
|
}
|
||||||
|
this.bannerSequence.put(++last, banner);
|
||||||
|
}
|
||||||
|
|
||||||
|
public void draw(String text) {
|
||||||
|
draw(text, 0, 0);
|
||||||
|
}
|
||||||
|
|
||||||
|
public void draw(String text, int skip) {
|
||||||
|
draw(text, skip, 0);
|
||||||
|
}
|
||||||
|
|
||||||
|
public void draw(String text, int skip, int ending) {
|
||||||
|
if (this.autoClear) {
|
||||||
|
clear();
|
||||||
|
}
|
||||||
|
char[] chars = text.toCharArray();
|
||||||
|
|
||||||
|
Collection<Banner> values = this.bannerSequence.values();
|
||||||
|
Banner[] banners = values.toArray(new Banner[this.bannerSequence.values().size()]);
|
||||||
|
|
||||||
|
BannerColor inUseForeground = this.standardForegroundColor;
|
||||||
|
BannerColor inUseBackground = this.standardBackgroundColor;
|
||||||
|
|
||||||
|
int i = skip;
|
||||||
|
for (int counter = 0; i < banners.length - ending; ) {
|
||||||
|
if (counter == chars.length) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
Banner banner = banners[i];
|
||||||
|
char pointed = chars[counter];
|
||||||
|
if ((pointed == '§') && (chars.length > counter + 3)) {
|
||||||
|
char whichSide = chars[(counter + 1)];
|
||||||
|
BannerColor color = BannerColor.translate(chars[(counter + 2)]);
|
||||||
|
if (whichSide == 'F') {
|
||||||
|
inUseForeground = color;
|
||||||
|
counter += 3;
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
if (whichSide == 'B') {
|
||||||
|
inUseBackground = color;
|
||||||
|
counter += 3;
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
ShapeRegistry.paint(Character.toUpperCase(pointed), banner, inUseForeground.getColor(), inUseBackground.getColor());
|
||||||
|
banner.update();
|
||||||
|
counter++;
|
||||||
|
i++;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setAutoClear(boolean autoClear) {
|
||||||
|
this.autoClear = autoClear;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setClearColor(BannerColor clearColor) {
|
||||||
|
this.clearColor = clearColor;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setStandardForegroundColor(BannerColor standardForegroundColor) {
|
||||||
|
this.standardForegroundColor = standardForegroundColor;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setStandardBackgroundColor(BannerColor standardBackgroundColor) {
|
||||||
|
this.standardBackgroundColor = standardBackgroundColor;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void clear() {
|
||||||
|
Iterator<Banner> iterator = this.bannerSequence.values().iterator();
|
||||||
|
while (iterator.hasNext()) {
|
||||||
|
Banner banner = (Banner) iterator.next();
|
||||||
|
banner.setPatterns(new ArrayList());
|
||||||
|
banner.setBaseColor(this.clearColor.getColor());
|
||||||
|
banner.update();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public HashMap<Integer, Banner> getBannerSequence() {
|
||||||
|
return this.bannerSequence;
|
||||||
|
}
|
||||||
|
|
||||||
|
public boolean isAutoClear() {
|
||||||
|
return this.autoClear;
|
||||||
|
}
|
||||||
|
|
||||||
|
public BannerColor getClearColor() {
|
||||||
|
return this.clearColor;
|
||||||
|
}
|
||||||
|
|
||||||
|
public BannerColor getStandardForegroundColor() {
|
||||||
|
return this.standardForegroundColor;
|
||||||
|
}
|
||||||
|
|
||||||
|
public BannerColor getStandardBackgroundColor() {
|
||||||
|
return this.standardBackgroundColor;
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,70 @@
|
||||||
|
package eu.univento.core.api.blocks.banners;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @author tschuliaehn
|
||||||
|
* @version 1.0
|
||||||
|
*/
|
||||||
|
|
||||||
|
public class FloatingText {
|
||||||
|
private String spacedText;
|
||||||
|
|
||||||
|
public FloatingText(String text, int between) {
|
||||||
|
StringBuilder builder = new StringBuilder();
|
||||||
|
for (int i = 0; i < between; i++) {
|
||||||
|
builder.append(" ");
|
||||||
|
}
|
||||||
|
builder.append(text);
|
||||||
|
this.spacedText = builder.toString();
|
||||||
|
}
|
||||||
|
|
||||||
|
private int pointer = -1;
|
||||||
|
private boolean start = true;
|
||||||
|
|
||||||
|
public String next() {
|
||||||
|
this.pointer += 1;
|
||||||
|
|
||||||
|
int index = this.spacedText.length() - this.pointer;
|
||||||
|
|
||||||
|
StringBuilder builder = new StringBuilder();
|
||||||
|
if (index < 1) {
|
||||||
|
this.pointer = 0;
|
||||||
|
if (this.start) {
|
||||||
|
this.start = false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
char[] characters = this.spacedText.toCharArray();
|
||||||
|
|
||||||
|
String current = "";
|
||||||
|
boolean changed = false;
|
||||||
|
for (int i = 0; i < index; i++) {
|
||||||
|
if ((characters[i] == '§') &&
|
||||||
|
(characters[(i + 1)] == 'F')) {
|
||||||
|
current = String.valueOf(characters[i] + characters[(i + 1)] + characters[(i + 2)]);
|
||||||
|
if ((i == index) || (i + 1 == index) || (i + 2 == index)) {
|
||||||
|
this.pointer += index - i;
|
||||||
|
changed = true;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
String currentBackground = "";
|
||||||
|
for (int i = 0; i < index; i++) {
|
||||||
|
if ((characters[i] == '§') &&
|
||||||
|
(characters[(i + 1)] == 'B')) {
|
||||||
|
currentBackground = String.valueOf(characters[i] + characters[(i + 1)] + characters[(i + 2)]);
|
||||||
|
if ((i == index) || (i + 1 == index) || (i + 2 == index)) {
|
||||||
|
this.pointer += index - i;
|
||||||
|
changed = true;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
builder.append(current + currentBackground);
|
||||||
|
|
||||||
|
builder.append(changed ? next() : this.spacedText.substring(index, this.spacedText.length()));
|
||||||
|
if (!this.start) {
|
||||||
|
builder.append(this.spacedText);
|
||||||
|
}
|
||||||
|
return builder.toString();
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,12 @@
|
||||||
|
package eu.univento.core.api.blocks.banners;
|
||||||
|
|
||||||
|
import org.bukkit.DyeColor;
|
||||||
|
import org.bukkit.block.Banner;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @author tschuliaehn
|
||||||
|
* @version 1.0
|
||||||
|
*/
|
||||||
|
public abstract interface Shape {
|
||||||
|
public abstract void draw(Banner paramBanner, DyeColor paramDyeColor1, DyeColor paramDyeColor2);
|
||||||
|
}
|
|
@ -0,0 +1,217 @@
|
||||||
|
package eu.univento.core.api.blocks.banners;
|
||||||
|
|
||||||
|
import org.bukkit.DyeColor;
|
||||||
|
import org.bukkit.block.Banner;
|
||||||
|
import org.bukkit.block.banner.Pattern;
|
||||||
|
import org.bukkit.block.banner.PatternType;
|
||||||
|
|
||||||
|
import java.util.HashMap;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @author tschuliaehn
|
||||||
|
* @version 1.0
|
||||||
|
*/
|
||||||
|
|
||||||
|
public class ShapeRegistry {
|
||||||
|
private static HashMap<Character, Shape> shapes = new HashMap<>();
|
||||||
|
|
||||||
|
static {
|
||||||
|
shapes.put('A', (banner, foreground, background) -> {
|
||||||
|
banner.setBaseColor(background);
|
||||||
|
banner.addPattern(new Pattern(foreground, PatternType.STRIPE_TOP));
|
||||||
|
banner.addPattern(new Pattern(foreground, PatternType.STRIPE_LEFT));
|
||||||
|
banner.addPattern(new Pattern(foreground, PatternType.STRIPE_RIGHT));
|
||||||
|
banner.addPattern(new Pattern(foreground, PatternType.STRIPE_MIDDLE));
|
||||||
|
});
|
||||||
|
shapes.put('B', (banner, foreground, background) -> {
|
||||||
|
banner.setBaseColor(background);
|
||||||
|
banner.addPattern(new Pattern(foreground, PatternType.STRIPE_TOP));
|
||||||
|
banner.addPattern(new Pattern(foreground, PatternType.STRIPE_LEFT));
|
||||||
|
banner.addPattern(new Pattern(foreground, PatternType.STRIPE_RIGHT));
|
||||||
|
banner.addPattern(new Pattern(foreground, PatternType.STRIPE_MIDDLE));
|
||||||
|
banner.addPattern(new Pattern(foreground, PatternType.STRIPE_BOTTOM));
|
||||||
|
});
|
||||||
|
shapes.put('C', (banner, foreground, background) -> {
|
||||||
|
banner.setBaseColor(background);
|
||||||
|
banner.addPattern(new Pattern(foreground, PatternType.STRIPE_LEFT));
|
||||||
|
banner.addPattern(new Pattern(foreground, PatternType.STRIPE_TOP));
|
||||||
|
banner.addPattern(new Pattern(foreground, PatternType.STRIPE_BOTTOM));
|
||||||
|
});
|
||||||
|
shapes.put('D', (banner, foreground, background) -> {
|
||||||
|
banner.setBaseColor(foreground);
|
||||||
|
banner.addPattern(new Pattern(background, PatternType.RHOMBUS_MIDDLE));
|
||||||
|
banner.addPattern(new Pattern(foreground, PatternType.STRIPE_TOP));
|
||||||
|
banner.addPattern(new Pattern(foreground, PatternType.STRIPE_BOTTOM));
|
||||||
|
banner.addPattern(new Pattern(foreground, PatternType.STRIPE_LEFT));
|
||||||
|
});
|
||||||
|
shapes.put('E', (banner, foreground, background) -> {
|
||||||
|
banner.setBaseColor(background);
|
||||||
|
banner.addPattern(new Pattern(foreground, PatternType.STRIPE_MIDDLE));
|
||||||
|
banner.addPattern(new Pattern(background, PatternType.STRIPE_RIGHT));
|
||||||
|
banner.addPattern(new Pattern(foreground, PatternType.STRIPE_BOTTOM));
|
||||||
|
banner.addPattern(new Pattern(foreground, PatternType.STRIPE_TOP));
|
||||||
|
banner.addPattern(new Pattern(foreground, PatternType.STRIPE_LEFT));
|
||||||
|
});
|
||||||
|
shapes.put('F', (banner, foreground, background) -> {
|
||||||
|
banner.setBaseColor(background);
|
||||||
|
banner.addPattern(new Pattern(foreground, PatternType.STRIPE_MIDDLE));
|
||||||
|
banner.addPattern(new Pattern(background, PatternType.STRIPE_RIGHT));
|
||||||
|
banner.addPattern(new Pattern(foreground, PatternType.STRIPE_LEFT));
|
||||||
|
banner.addPattern(new Pattern(foreground, PatternType.STRIPE_TOP));
|
||||||
|
});
|
||||||
|
shapes.put('G', (banner, foreground, background) -> {
|
||||||
|
banner.setBaseColor(background);
|
||||||
|
banner.addPattern(new Pattern(foreground, PatternType.STRIPE_RIGHT));
|
||||||
|
banner.addPattern(new Pattern(background, PatternType.HALF_HORIZONTAL));
|
||||||
|
banner.addPattern(new Pattern(foreground, PatternType.STRIPE_BOTTOM));
|
||||||
|
banner.addPattern(new Pattern(foreground, PatternType.STRIPE_LEFT));
|
||||||
|
banner.addPattern(new Pattern(foreground, PatternType.STRIPE_TOP));
|
||||||
|
});
|
||||||
|
shapes.put('H', (banner, foreground, background) -> {
|
||||||
|
banner.setBaseColor(foreground);
|
||||||
|
banner.addPattern(new Pattern(background, PatternType.STRIPE_TOP));
|
||||||
|
banner.addPattern(new Pattern(background, PatternType.STRIPE_BOTTOM));
|
||||||
|
banner.addPattern(new Pattern(foreground, PatternType.STRIPE_LEFT));
|
||||||
|
banner.addPattern(new Pattern(foreground, PatternType.STRIPE_RIGHT));
|
||||||
|
});
|
||||||
|
shapes.put('I', (banner, foreground, background) -> {
|
||||||
|
banner.setBaseColor(background);
|
||||||
|
banner.addPattern(new Pattern(foreground, PatternType.STRIPE_BOTTOM));
|
||||||
|
banner.addPattern(new Pattern(foreground, PatternType.STRIPE_TOP));
|
||||||
|
banner.addPattern(new Pattern(foreground, PatternType.STRIPE_CENTER));
|
||||||
|
});
|
||||||
|
shapes.put('J', (banner, foreground, background) -> {
|
||||||
|
banner.setBaseColor(background);
|
||||||
|
banner.addPattern(new Pattern(foreground, PatternType.STRIPE_LEFT));
|
||||||
|
banner.addPattern(new Pattern(background, PatternType.HALF_HORIZONTAL));
|
||||||
|
banner.addPattern(new Pattern(foreground, PatternType.STRIPE_BOTTOM));
|
||||||
|
banner.addPattern(new Pattern(foreground, PatternType.STRIPE_RIGHT));
|
||||||
|
});
|
||||||
|
shapes.put('K', (banner, foreground, background) -> {
|
||||||
|
banner.setBaseColor(background);
|
||||||
|
banner.addPattern(new Pattern(foreground, PatternType.STRIPE_MIDDLE));
|
||||||
|
banner.addPattern(new Pattern(background, PatternType.STRIPE_RIGHT));
|
||||||
|
banner.addPattern(new Pattern(foreground, PatternType.STRIPE_DOWNLEFT));
|
||||||
|
banner.addPattern(new Pattern(foreground, PatternType.STRIPE_DOWNRIGHT));
|
||||||
|
banner.addPattern(new Pattern(foreground, PatternType.STRIPE_LEFT));
|
||||||
|
});
|
||||||
|
shapes.put('L', (banner, foreground, background) -> {
|
||||||
|
banner.setBaseColor(background);
|
||||||
|
banner.addPattern(new Pattern(foreground, PatternType.STRIPE_LEFT));
|
||||||
|
banner.addPattern(new Pattern(foreground, PatternType.STRIPE_BOTTOM));
|
||||||
|
});
|
||||||
|
shapes.put('M', (banner, foreground, background) -> {
|
||||||
|
banner.setBaseColor(background);
|
||||||
|
banner.addPattern(new Pattern(foreground, PatternType.TRIANGLE_TOP));
|
||||||
|
banner.addPattern(new Pattern(background, PatternType.CURLY_BORDER));
|
||||||
|
banner.addPattern(new Pattern(foreground, PatternType.STRIPE_LEFT));
|
||||||
|
banner.addPattern(new Pattern(foreground, PatternType.STRIPE_RIGHT));
|
||||||
|
});
|
||||||
|
shapes.put('N', (banner, foreground, background) -> {
|
||||||
|
banner.setBaseColor(background);
|
||||||
|
banner.addPattern(new Pattern(foreground, PatternType.STRIPE_LEFT));
|
||||||
|
banner.addPattern(new Pattern(background, PatternType.TRIANGLE_TOP));
|
||||||
|
banner.addPattern(new Pattern(foreground, PatternType.STRIPE_RIGHT));
|
||||||
|
banner.addPattern(new Pattern(foreground, PatternType.STRIPE_DOWNRIGHT));
|
||||||
|
});
|
||||||
|
shapes.put('O', (banner, foreground, background) -> {
|
||||||
|
banner.setBaseColor(background);
|
||||||
|
banner.addPattern(new Pattern(foreground, PatternType.STRIPE_TOP));
|
||||||
|
banner.addPattern(new Pattern(foreground, PatternType.STRIPE_RIGHT));
|
||||||
|
banner.addPattern(new Pattern(foreground, PatternType.STRIPE_BOTTOM));
|
||||||
|
banner.addPattern(new Pattern(foreground, PatternType.STRIPE_LEFT));
|
||||||
|
});
|
||||||
|
shapes.put('P', (banner, foreground, background) -> {
|
||||||
|
banner.setBaseColor(foreground);
|
||||||
|
banner.addPattern(new Pattern(background, PatternType.HALF_HORIZONTAL));
|
||||||
|
banner.addPattern(new Pattern(foreground, PatternType.STRIPE_RIGHT));
|
||||||
|
banner.addPattern(new Pattern(background, PatternType.STRIPE_BOTTOM));
|
||||||
|
banner.addPattern(new Pattern(foreground, PatternType.STRIPE_TOP));
|
||||||
|
banner.addPattern(new Pattern(foreground, PatternType.STRIPE_LEFT));
|
||||||
|
});
|
||||||
|
shapes.put('Q', (banner, foreground, background) -> {
|
||||||
|
banner.setBaseColor(background);
|
||||||
|
banner.addPattern(new Pattern(foreground, PatternType.STRIPE_DOWNRIGHT));
|
||||||
|
banner.addPattern(new Pattern(background, PatternType.HALF_HORIZONTAL));
|
||||||
|
banner.addPattern(new Pattern(foreground, PatternType.STRIPE_LEFT));
|
||||||
|
banner.addPattern(new Pattern(foreground, PatternType.STRIPE_BOTTOM));
|
||||||
|
banner.addPattern(new Pattern(foreground, PatternType.STRIPE_RIGHT));
|
||||||
|
banner.addPattern(new Pattern(foreground, PatternType.STRIPE_TOP));
|
||||||
|
});
|
||||||
|
shapes.put('R', (banner, foreground, background) -> {
|
||||||
|
banner.setBaseColor(foreground);
|
||||||
|
banner.addPattern(new Pattern(background, PatternType.HALF_HORIZONTAL_MIRROR));
|
||||||
|
banner.addPattern(new Pattern(foreground, PatternType.STRIPE_DOWNRIGHT));
|
||||||
|
banner.addPattern(new Pattern(background, PatternType.HALF_VERTICAL));
|
||||||
|
banner.addPattern(new Pattern(foreground, PatternType.STRIPE_LEFT));
|
||||||
|
banner.addPattern(new Pattern(foreground, PatternType.STRIPE_TOP));
|
||||||
|
banner.addPattern(new Pattern(foreground, PatternType.STRIPE_MIDDLE));
|
||||||
|
});
|
||||||
|
shapes.put('S', (banner, foreground, background) -> {
|
||||||
|
banner.setBaseColor(background);
|
||||||
|
banner.addPattern(new Pattern(foreground, PatternType.TRIANGLE_TOP));
|
||||||
|
banner.addPattern(new Pattern(foreground, PatternType.TRIANGLE_BOTTOM));
|
||||||
|
banner.addPattern(new Pattern(foreground, PatternType.SQUARE_TOP_RIGHT));
|
||||||
|
banner.addPattern(new Pattern(foreground, PatternType.SQUARE_BOTTOM_LEFT));
|
||||||
|
banner.addPattern(new Pattern(background, PatternType.RHOMBUS_MIDDLE));
|
||||||
|
banner.addPattern(new Pattern(foreground, PatternType.STRIPE_DOWNRIGHT));
|
||||||
|
});
|
||||||
|
shapes.put('T', (banner, foreground, background) -> {
|
||||||
|
banner.setBaseColor(background);
|
||||||
|
banner.addPattern(new Pattern(foreground, PatternType.STRIPE_CENTER));
|
||||||
|
banner.addPattern(new Pattern(foreground, PatternType.STRIPE_TOP));
|
||||||
|
});
|
||||||
|
shapes.put('U', (banner, foreground, background) -> {
|
||||||
|
banner.setBaseColor(background);
|
||||||
|
banner.addPattern(new Pattern(foreground, PatternType.STRIPE_BOTTOM));
|
||||||
|
banner.addPattern(new Pattern(foreground, PatternType.STRIPE_RIGHT));
|
||||||
|
banner.addPattern(new Pattern(foreground, PatternType.STRIPE_LEFT));
|
||||||
|
});
|
||||||
|
shapes.put('V', (banner, foreground, background) -> {
|
||||||
|
banner.setBaseColor(background);
|
||||||
|
banner.addPattern(new Pattern(foreground, PatternType.STRIPE_LEFT));
|
||||||
|
banner.addPattern(new Pattern(background, PatternType.TRIANGLE_BOTTOM));
|
||||||
|
banner.addPattern(new Pattern(foreground, PatternType.STRIPE_DOWNLEFT));
|
||||||
|
});
|
||||||
|
shapes.put('W', (banner, foreground, background) -> {
|
||||||
|
banner.setBaseColor(background);
|
||||||
|
banner.addPattern(new Pattern(foreground, PatternType.TRIANGLE_BOTTOM));
|
||||||
|
banner.addPattern(new Pattern(background, PatternType.CURLY_BORDER));
|
||||||
|
banner.addPattern(new Pattern(foreground, PatternType.STRIPE_RIGHT));
|
||||||
|
banner.addPattern(new Pattern(foreground, PatternType.STRIPE_LEFT));
|
||||||
|
});
|
||||||
|
shapes.put('X', (banner, foreground, background) -> {
|
||||||
|
banner.setBaseColor(background);
|
||||||
|
banner.addPattern(new Pattern(foreground, PatternType.STRIPE_DOWNLEFT));
|
||||||
|
banner.addPattern(new Pattern(foreground, PatternType.STRIPE_DOWNRIGHT));
|
||||||
|
});
|
||||||
|
shapes.put('Y', (banner, foreground, background) -> {
|
||||||
|
banner.setBaseColor(background);
|
||||||
|
banner.addPattern(new Pattern(foreground, PatternType.STRIPE_DOWNRIGHT));
|
||||||
|
banner.addPattern(new Pattern(background, PatternType.HALF_VERTICAL_MIRROR));
|
||||||
|
banner.addPattern(new Pattern(foreground, PatternType.STRIPE_DOWNLEFT));
|
||||||
|
});
|
||||||
|
shapes.put('Z', (banner, foreground, background) -> {
|
||||||
|
banner.setBaseColor(background);
|
||||||
|
banner.addPattern(new Pattern(foreground, PatternType.TRIANGLE_TOP));
|
||||||
|
banner.addPattern(new Pattern(foreground, PatternType.TRIANGLE_BOTTOM));
|
||||||
|
banner.addPattern(new Pattern(foreground, PatternType.SQUARE_TOP_LEFT));
|
||||||
|
banner.addPattern(new Pattern(foreground, PatternType.SQUARE_BOTTOM_RIGHT));
|
||||||
|
banner.addPattern(new Pattern(background, PatternType.RHOMBUS_MIDDLE));
|
||||||
|
banner.addPattern(new Pattern(foreground, PatternType.STRIPE_DOWNLEFT));
|
||||||
|
});
|
||||||
|
shapes.put(' ', (banner, foreground, background) -> banner.setBaseColor(background));
|
||||||
|
}
|
||||||
|
|
||||||
|
public static void addShape(Character character, Shape shape) {
|
||||||
|
shapes.put(character, shape);
|
||||||
|
}
|
||||||
|
|
||||||
|
public static void paint(char character, Banner banner, DyeColor foreground, DyeColor background) {
|
||||||
|
getShape(character).draw(banner, foreground, background);
|
||||||
|
}
|
||||||
|
|
||||||
|
public static Shape getShape(char character) {
|
||||||
|
return shapes.containsKey(character) ? shapes.get(character) : shapes.get(' ');
|
||||||
|
}
|
||||||
|
}
|
|
@ -3,7 +3,6 @@ package eu.univento.core.api.customitems;
|
||||||
/**
|
/**
|
||||||
* @author joethei
|
* @author joethei
|
||||||
* @version 0.1
|
* @version 0.1
|
||||||
* Created at 20:40 on 12.07.2016.
|
|
||||||
*/
|
*/
|
||||||
public class CustomArmor {
|
public class CustomArmor {
|
||||||
|
|
||||||
|
|
|
@ -3,7 +3,6 @@ package eu.univento.core.api.customitems;
|
||||||
/**
|
/**
|
||||||
* @author joethei
|
* @author joethei
|
||||||
* @version 0.1
|
* @version 0.1
|
||||||
* Created at 20:39 on 12.07.2016.
|
|
||||||
*/
|
*/
|
||||||
public class CustomItemManager {
|
public class CustomItemManager {
|
||||||
|
|
||||||
|
|
|
@ -12,7 +12,6 @@ import org.bukkit.potion.PotionEffectType;
|
||||||
/**
|
/**
|
||||||
* @author joethei
|
* @author joethei
|
||||||
* @version 0.1
|
* @version 0.1
|
||||||
* Created at 20:44 on 12.07.2016.
|
|
||||||
*/
|
*/
|
||||||
public class BestSwordEver extends CustomSword {
|
public class BestSwordEver extends CustomSword {
|
||||||
|
|
||||||
|
|
|
@ -7,7 +7,6 @@ import org.bukkit.inventory.ItemStack;
|
||||||
/**
|
/**
|
||||||
* @author joethei
|
* @author joethei
|
||||||
* @version 0.1
|
* @version 0.1
|
||||||
* Created at 20:41 on 12.07.2016.
|
|
||||||
*/
|
*/
|
||||||
public class CustomSword{
|
public class CustomSword{
|
||||||
|
|
||||||
|
|
|
@ -8,7 +8,6 @@ import java.util.List;
|
||||||
/**
|
/**
|
||||||
* @author joethei
|
* @author joethei
|
||||||
* @version 1.0
|
* @version 1.0
|
||||||
* Created at 20:56 on 12.07.2016.
|
|
||||||
*/
|
*/
|
||||||
public class CustomSwordManager {
|
public class CustomSwordManager {
|
||||||
|
|
||||||
|
|
|
@ -1,47 +0,0 @@
|
||||||
package eu.univento.core.api.database;
|
|
||||||
|
|
||||||
|
|
||||||
import com.mongodb.MongoCredential;
|
|
||||||
import com.mongodb.ServerAddress;
|
|
||||||
import com.mongodb.async.client.MongoClient;
|
|
||||||
import com.mongodb.async.client.MongoClientSettings;
|
|
||||||
import com.mongodb.async.client.MongoClients;
|
|
||||||
import com.mongodb.async.client.MongoDatabase;
|
|
||||||
import com.mongodb.connection.ClusterSettings;
|
|
||||||
import eu.univento.core.api.Config;
|
|
||||||
|
|
||||||
import java.util.ArrayList;
|
|
||||||
import java.util.List;
|
|
||||||
|
|
||||||
public class AsyncMongoDB {
|
|
||||||
|
|
||||||
private final MongoClient client;
|
|
||||||
private MongoDatabase database;
|
|
||||||
|
|
||||||
public AsyncMongoDB(String host, int port, String username, String password, String database) {
|
|
||||||
List<ServerAddress> addressList = new ArrayList<>();
|
|
||||||
addressList.add(new ServerAddress(host, port));
|
|
||||||
List<MongoCredential> credentials = new ArrayList<>();
|
|
||||||
credentials.add(MongoCredential.createCredential(username, database, password.toCharArray()));
|
|
||||||
ClusterSettings clusterSettings = ClusterSettings.builder().hosts(addressList).build();
|
|
||||||
MongoClientSettings settings = MongoClientSettings.builder().clusterSettings(clusterSettings).credentialList(credentials).build();
|
|
||||||
client = MongoClients.create(settings);
|
|
||||||
}
|
|
||||||
|
|
||||||
private MongoClient getClient() {
|
|
||||||
if(client == null)
|
|
||||||
new AsyncMongoDB(Config.readString("MongoDB.Host"), Config.readInt(), Config.readString("MongoDB.User"), Config.readString("MongoDB.Password"), Config.readString("MongoDB.Database"));
|
|
||||||
return client;
|
|
||||||
}
|
|
||||||
|
|
||||||
public MongoDatabase getDatabase() {
|
|
||||||
if(database == null)
|
|
||||||
database = getClient().getDatabase(Config.readString("MongoDB.Database"));
|
|
||||||
return database;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void closeConnection() {
|
|
||||||
if(client != null)
|
|
||||||
client.close();
|
|
||||||
}
|
|
||||||
}
|
|
|
@ -1,46 +0,0 @@
|
||||||
package eu.univento.core.api.database;
|
|
||||||
|
|
||||||
import org.bukkit.Bukkit;
|
|
||||||
import org.bukkit.plugin.Plugin;
|
|
||||||
|
|
||||||
import java.sql.*;
|
|
||||||
import java.util.concurrent.ExecutorService;
|
|
||||||
import java.util.concurrent.Executors;
|
|
||||||
import java.util.function.Consumer;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @author joethei
|
|
||||||
* @version 0.1
|
|
||||||
*/
|
|
||||||
public class AsyncMySQL {
|
|
||||||
private ExecutorService executor;
|
|
||||||
private Plugin plugin;
|
|
||||||
private MySQL sql;
|
|
||||||
|
|
||||||
public AsyncMySQL(Plugin owner, String host, String port, String user, String password, String database) {
|
|
||||||
try {
|
|
||||||
sql = new MySQL(owner, host, port, user, password, database);
|
|
||||||
executor = Executors.newCachedThreadPool();
|
|
||||||
plugin = owner;
|
|
||||||
} catch (Exception e) {
|
|
||||||
e.printStackTrace();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
public void update(String update) {
|
|
||||||
executor.execute(() -> sql.query(update));
|
|
||||||
}
|
|
||||||
|
|
||||||
public void query(String query, Consumer<ResultSet> consumer) {
|
|
||||||
executor.execute(() -> {
|
|
||||||
ResultSet result = null;
|
|
||||||
result = sql.query(query);
|
|
||||||
ResultSet finalResult = result;
|
|
||||||
Bukkit.getScheduler().runTask(plugin, () -> consumer.accept(finalResult));
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
public MySQL getMySQL() {
|
|
||||||
return sql;
|
|
||||||
}
|
|
||||||
}
|
|
|
@ -1,57 +0,0 @@
|
||||||
package eu.univento.core.api.database;
|
|
||||||
|
|
||||||
import org.bukkit.plugin.Plugin;
|
|
||||||
|
|
||||||
import java.sql.*;
|
|
||||||
|
|
||||||
abstract class Database {
|
|
||||||
Connection connection;
|
|
||||||
final Plugin plugin;
|
|
||||||
|
|
||||||
Database(Plugin plugin) {
|
|
||||||
this.plugin = plugin;
|
|
||||||
this.connection = null;
|
|
||||||
}
|
|
||||||
|
|
||||||
protected abstract Connection openConnection()
|
|
||||||
throws SQLException, ClassNotFoundException;
|
|
||||||
|
|
||||||
boolean checkConnection()
|
|
||||||
throws SQLException {
|
|
||||||
return (this.connection != null) && (!this.connection.isClosed());
|
|
||||||
}
|
|
||||||
|
|
||||||
public Connection getConnection() {
|
|
||||||
return this.connection;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void closeConnection()
|
|
||||||
throws SQLException {
|
|
||||||
if (this.connection == null) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
this.connection.close();
|
|
||||||
}
|
|
||||||
|
|
||||||
public ResultSet query(String query)
|
|
||||||
throws SQLException, ClassNotFoundException {
|
|
||||||
if (!checkConnection()) {
|
|
||||||
openConnection();
|
|
||||||
}
|
|
||||||
|
|
||||||
PreparedStatement statement = this.connection.prepareStatement(query);
|
|
||||||
|
|
||||||
return statement.executeQuery();
|
|
||||||
}
|
|
||||||
|
|
||||||
public int update(String query)
|
|
||||||
throws SQLException, ClassNotFoundException {
|
|
||||||
if (!checkConnection()) {
|
|
||||||
openConnection();
|
|
||||||
}
|
|
||||||
|
|
||||||
PreparedStatement statement = this.connection.prepareStatement(query);
|
|
||||||
|
|
||||||
return statement.executeUpdate();
|
|
||||||
}
|
|
||||||
}
|
|
|
@ -1,47 +0,0 @@
|
||||||
package eu.univento.core.api.database;
|
|
||||||
|
|
||||||
import eu.univento.core.api.Config;
|
|
||||||
import org.bukkit.plugin.Plugin;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @author joethei
|
|
||||||
* @version 0.1
|
|
||||||
* created on 03.07.2016
|
|
||||||
*/
|
|
||||||
public class DatabaseManager {
|
|
||||||
|
|
||||||
private static AsyncMongoDB asyncMongoDB;
|
|
||||||
private static MongoDB mongoDB;
|
|
||||||
private static AsyncMySQL asyncMySQL;
|
|
||||||
private static MySQL mysql;
|
|
||||||
|
|
||||||
public DatabaseManager(Plugin plugin) {
|
|
||||||
asyncMongoDB = new AsyncMongoDB(Config.readString("MongoDB.Host"), Config.readInt(), Config.readString("MongoDB.User"), Config.readString("MongoDB.Password"), Config.readString("MongoDB.Database"));
|
|
||||||
mongoDB = new MongoDB(Config.readString("MongoDB.Host"), Config.readInt(), Config.readString("MongoDB.User"), Config.readString("MongoDB.Password"), Config.readString("MongoDB.Database"));
|
|
||||||
mysql = new MySQL(plugin, Config.readString("MySQL.Host"), Config.readString("MySQL.Port"), Config.readString("MySQL.DB"), Config.readString("MySQL.User"), Config.readString("MySQL.Pass"));
|
|
||||||
asyncMySQL = new AsyncMySQL(plugin, Config.readString("MySQL.Host"), Config.readString("MySQL.Port"), Config.readString("MySQL.DB"), Config.readString("MySQL.User"), Config.readString("MySQL.Pass"));
|
|
||||||
}
|
|
||||||
|
|
||||||
public void closeConnections() {
|
|
||||||
asyncMongoDB.closeConnection();
|
|
||||||
mongoDB.closeConnection();
|
|
||||||
mysql.close();
|
|
||||||
asyncMySQL.getMySQL().close();
|
|
||||||
}
|
|
||||||
|
|
||||||
public AsyncMongoDB getAsyncMongoDB() {
|
|
||||||
return asyncMongoDB;
|
|
||||||
}
|
|
||||||
|
|
||||||
public MongoDB getMongoDB() {
|
|
||||||
return mongoDB;
|
|
||||||
}
|
|
||||||
|
|
||||||
public MySQL getMySQL() {
|
|
||||||
return mysql;
|
|
||||||
}
|
|
||||||
|
|
||||||
public AsyncMySQL getAsyncMySQL() {
|
|
||||||
return asyncMySQL;
|
|
||||||
}
|
|
||||||
}
|
|
|
@ -1,42 +0,0 @@
|
||||||
package eu.univento.core.api.database;
|
|
||||||
|
|
||||||
import com.mongodb.MongoClient;
|
|
||||||
import com.mongodb.MongoCredential;
|
|
||||||
import com.mongodb.ServerAddress;
|
|
||||||
import com.mongodb.client.MongoDatabase;
|
|
||||||
import eu.univento.core.api.Config;
|
|
||||||
|
|
||||||
import java.util.Collections;
|
|
||||||
|
|
||||||
public class MongoDB {
|
|
||||||
|
|
||||||
private final MongoClient client;
|
|
||||||
private MongoDatabase database;
|
|
||||||
|
|
||||||
public MongoDB(String host, int port, String username, String password, String database) {
|
|
||||||
MongoCredential credential = MongoCredential.createCredential(username, database, password.toCharArray());
|
|
||||||
client = new MongoClient(new ServerAddress(host, port), Collections.singletonList(credential));
|
|
||||||
}
|
|
||||||
|
|
||||||
private MongoClient getClient() {
|
|
||||||
if(client == null)
|
|
||||||
new MongoDB(Config.readString("MongoDB.Host"), Config.readInt(), Config.readString("MongoDB.User"), Config.readString("MongoDB.Password"), Config.readString("MongoDB.Database"));
|
|
||||||
return client;
|
|
||||||
}
|
|
||||||
|
|
||||||
public MongoDatabase getDatabase() {
|
|
||||||
if(database == null)
|
|
||||||
database = getClient().getDatabase(Config.readString("MongoDB.Database"));
|
|
||||||
return database;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setDatabase(String database) {
|
|
||||||
this.database = getClient().getDatabase(database);
|
|
||||||
}
|
|
||||||
|
|
||||||
public void closeConnection() {
|
|
||||||
if(client != null)
|
|
||||||
client.close();
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
|
@ -1,104 +0,0 @@
|
||||||
package eu.univento.core.api.database;
|
|
||||||
|
|
||||||
import com.zaxxer.hikari.HikariConfig;
|
|
||||||
import com.zaxxer.hikari.HikariDataSource;
|
|
||||||
import org.bukkit.plugin.Plugin;
|
|
||||||
|
|
||||||
import java.sql.Connection;
|
|
||||||
import java.sql.PreparedStatement;
|
|
||||||
import java.sql.ResultSet;
|
|
||||||
import java.sql.SQLException;
|
|
||||||
|
|
||||||
public class MySQL {
|
|
||||||
|
|
||||||
private final Plugin plugin;
|
|
||||||
private final String username;
|
|
||||||
private final String database;
|
|
||||||
private final String password;
|
|
||||||
private final String port;
|
|
||||||
private final String hostname;
|
|
||||||
|
|
||||||
private final HikariDataSource dataSource;
|
|
||||||
|
|
||||||
public MySQL(Plugin plugin, String hostname, String port, String database, String username, String password) {
|
|
||||||
this.plugin = plugin;
|
|
||||||
this.username = username;
|
|
||||||
this.database = database;
|
|
||||||
this.password = password;
|
|
||||||
this.port = port;
|
|
||||||
this.hostname = hostname;
|
|
||||||
HikariConfig config = new HikariConfig();
|
|
||||||
config.setJdbcUrl("jdbc:mysql://" + hostname + ":" + port + "/" + database);
|
|
||||||
config.setUsername(username);
|
|
||||||
config.setPassword(password);
|
|
||||||
config.addDataSourceProperty("cachePrepStmts", "true");
|
|
||||||
config.addDataSourceProperty("prepStmtCacheSize", "250");
|
|
||||||
config.addDataSourceProperty("prepStmtCacheSqlLimit", "2048");
|
|
||||||
|
|
||||||
dataSource = new HikariDataSource(config);
|
|
||||||
}
|
|
||||||
|
|
||||||
void close() {
|
|
||||||
dataSource.close();
|
|
||||||
}
|
|
||||||
|
|
||||||
public HikariDataSource getDataSource() {
|
|
||||||
return dataSource;
|
|
||||||
}
|
|
||||||
|
|
||||||
public Connection getConnection() {
|
|
||||||
try {
|
|
||||||
if (dataSource.getConnection() != null)
|
|
||||||
return dataSource.getConnection();
|
|
||||||
} catch (SQLException e) {
|
|
||||||
e.printStackTrace();
|
|
||||||
}
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
|
|
||||||
public int update(String sql) {
|
|
||||||
try {
|
|
||||||
PreparedStatement statement = getConnection().prepareStatement(sql);
|
|
||||||
return statement.executeUpdate();
|
|
||||||
} catch (SQLException e) {
|
|
||||||
e.printStackTrace();
|
|
||||||
}
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
public ResultSet query(String sql) {
|
|
||||||
PreparedStatement statement;
|
|
||||||
try {
|
|
||||||
statement = getConnection().prepareStatement(sql);
|
|
||||||
return statement.executeQuery();
|
|
||||||
} catch (SQLException e) {
|
|
||||||
e.printStackTrace();
|
|
||||||
}
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
|
|
||||||
/*
|
|
||||||
private final String user;
|
|
||||||
private final String database;
|
|
||||||
private final String password;
|
|
||||||
private final String port;
|
|
||||||
private final String hostname;
|
|
||||||
|
|
||||||
public MySQL(Plugin plugin, String hostname, String port, String database, String username, String password) {
|
|
||||||
super(plugin);
|
|
||||||
this.hostname = hostname;
|
|
||||||
this.port = port;
|
|
||||||
this.database = database;
|
|
||||||
this.user = username;
|
|
||||||
this.password = password;
|
|
||||||
}
|
|
||||||
|
|
||||||
public Connection openConnection() throws SQLException, ClassNotFoundException {
|
|
||||||
if (checkConnection())
|
|
||||||
return this.connection;
|
|
||||||
Class.forName("com.mysql.jdbc.Driver");
|
|
||||||
this.connection = DriverManager.getConnection("jdbc:mysql://" + this.hostname + ":" + this.port + "/" + this.database, this.user, this.password);
|
|
||||||
return this.connection;
|
|
||||||
}
|
|
||||||
*/
|
|
||||||
}
|
|
|
@ -1,7 +1,6 @@
|
||||||
package eu.univento.core.api.effects;
|
package eu.univento.core.api.effects;
|
||||||
|
|
||||||
import eu.univento.core.Core;
|
import eu.univento.core.Core;
|
||||||
import eu.univento.core.api.player.CustomPlayer;
|
|
||||||
import net.minecraft.server.v1_10_R1.EnumParticle;
|
import net.minecraft.server.v1_10_R1.EnumParticle;
|
||||||
import net.minecraft.server.v1_10_R1.PacketPlayOutWorldParticles;
|
import net.minecraft.server.v1_10_R1.PacketPlayOutWorldParticles;
|
||||||
import org.bukkit.Location;
|
import org.bukkit.Location;
|
||||||
|
@ -23,7 +22,7 @@ public class Effects {
|
||||||
*/
|
*/
|
||||||
public static void playEffect(Location loc, EnumParticle ep, int count) {
|
public static void playEffect(Location loc, EnumParticle ep, int count) {
|
||||||
PacketPlayOutWorldParticles packet = new PacketPlayOutWorldParticles(ep, true, (float) loc.getX(), (float) loc.getY(), (float) loc.getZ(), (float) 5, (float) 5, (float) 5, 0.0F, count, 0, 0);
|
PacketPlayOutWorldParticles packet = new PacketPlayOutWorldParticles(ep, true, (float) loc.getX(), (float) loc.getY(), (float) loc.getZ(), (float) 5, (float) 5, (float) 5, 0.0F, count, 0, 0);
|
||||||
Core.getOnlinePlayers().stream().filter(CustomPlayer::hasEffects).forEach(p -> p.getHandle().playerConnection.sendPacket(packet));
|
Core.getOnlinePlayers().stream().filter(players -> players.getDatabasePlayer().getSettings().hasEffectsEnabled()).forEach(players -> players.sendPacket(packet));
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void playEffectToPlayer(Player p, Location loc, EnumParticle ep, float f, int count) {
|
public static void playEffectToPlayer(Player p, Location loc, EnumParticle ep, float f, int count) {
|
||||||
|
|
|
@ -632,8 +632,6 @@ public enum ParticleEffect {
|
||||||
* @throws ParticleVersionException If the particle effect is not supported by the server version
|
* @throws ParticleVersionException If the particle effect is not supported by the server version
|
||||||
* @throws ParticleDataException If the particle effect requires additional data
|
* @throws ParticleDataException If the particle effect requires additional data
|
||||||
* @throws IllegalArgumentException If the particle effect is not directional or if it requires water and none is at the center location
|
* @throws IllegalArgumentException If the particle effect is not directional or if it requires water and none is at the center location
|
||||||
* @see ParticlePacket#ParticlePacket(ParticleEffect, Vector, float, boolean, ParticleData)
|
|
||||||
* @see ParticlePacket#sendTo(Location, double)
|
|
||||||
*/
|
*/
|
||||||
public void display(Vector direction, float speed, Location center, double range) throws ParticleVersionException, ParticleDataException, IllegalArgumentException {
|
public void display(Vector direction, float speed, Location center, double range) throws ParticleVersionException, ParticleDataException, IllegalArgumentException {
|
||||||
if (!isSupported()) {
|
if (!isSupported()) {
|
||||||
|
@ -704,8 +702,6 @@ public enum ParticleEffect {
|
||||||
* @param range Range of the visibility
|
* @param range Range of the visibility
|
||||||
* @throws ParticleVersionException If the particle effect is not supported by the server version
|
* @throws ParticleVersionException If the particle effect is not supported by the server version
|
||||||
* @throws ParticleColorException If the particle effect is not colorable or the color type is incorrect
|
* @throws ParticleColorException If the particle effect is not colorable or the color type is incorrect
|
||||||
* @see ParticlePacket#ParticlePacket(ParticleEffect, ParticleColor, boolean)
|
|
||||||
* @see ParticlePacket#sendTo(Location, double)
|
|
||||||
*/
|
*/
|
||||||
public void display(ParticleColor color, Location center, double range) throws ParticleVersionException, ParticleColorException {
|
public void display(ParticleColor color, Location center, double range) throws ParticleVersionException, ParticleColorException {
|
||||||
if (!isSupported()) {
|
if (!isSupported()) {
|
||||||
|
@ -1370,7 +1366,6 @@ public enum ParticleEffect {
|
||||||
* @param longDistance Indicates whether the maximum distance is increased from 256 to 65536
|
* @param longDistance Indicates whether the maximum distance is increased from 256 to 65536
|
||||||
* @param data Data of the effect
|
* @param data Data of the effect
|
||||||
* @throws IllegalArgumentException If the speed is lower than 0
|
* @throws IllegalArgumentException If the speed is lower than 0
|
||||||
* @see (ParticleEffect, float, float, float, float, int, boolean, ParticleData)
|
|
||||||
*/
|
*/
|
||||||
public ParticlePacket(ParticleEffect effect, Vector direction, float speed, boolean longDistance, ParticleData data) throws IllegalArgumentException {
|
public ParticlePacket(ParticleEffect effect, Vector direction, float speed, boolean longDistance, ParticleData data) throws IllegalArgumentException {
|
||||||
this(effect, (float) direction.getX(), (float) direction.getY(), (float) direction.getZ(), speed, 0, longDistance, data);
|
this(effect, (float) direction.getX(), (float) direction.getY(), (float) direction.getZ(), speed, 0, longDistance, data);
|
||||||
|
@ -1382,7 +1377,6 @@ public enum ParticleEffect {
|
||||||
* @param effect Particle effect
|
* @param effect Particle effect
|
||||||
* @param color Color of the particle
|
* @param color Color of the particle
|
||||||
* @param longDistance Indicates whether the maximum distance is increased from 256 to 65536
|
* @param longDistance Indicates whether the maximum distance is increased from 256 to 65536
|
||||||
* @see(ParticleEffect, float, float, float, float, int, boolean, ParticleData)
|
|
||||||
*/
|
*/
|
||||||
public ParticlePacket(ParticleEffect effect, ParticleColor color, boolean longDistance) {
|
public ParticlePacket(ParticleEffect effect, ParticleColor color, boolean longDistance) {
|
||||||
this(effect, color.getValueX(), color.getValueY(), color.getValueZ(), 1, 0, longDistance, null);
|
this(effect, color.getValueX(), color.getValueY(), color.getValueZ(), 1, 0, longDistance, null);
|
||||||
|
|
|
@ -8,7 +8,6 @@ import java.util.List;
|
||||||
/**
|
/**
|
||||||
* @author joethei
|
* @author joethei
|
||||||
* @version 0.1
|
* @version 0.1
|
||||||
* Created at 00:00 on 18.07.2016.
|
|
||||||
*/
|
*/
|
||||||
public class PlayerManager {
|
public class PlayerManager {
|
||||||
|
|
||||||
|
|
|
@ -195,7 +195,7 @@ public class ItemBuilder {
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Adds and UnsafeEnchantment to the {@Link} with a level int value of 1.
|
* Adds and UnsafeEnchantment to the {@link} with a level int value of 1.
|
||||||
*
|
*
|
||||||
* @param enchantment
|
* @param enchantment
|
||||||
* the {@link Enchantment} to add to the ItemStack.
|
* the {@link Enchantment} to add to the ItemStack.
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
package eu.univento.core.api.languages;
|
package eu.univento.core.api.languages;
|
||||||
|
|
||||||
|
import eu.univento.commons.player.Rank;
|
||||||
import eu.univento.core.api.player.CustomPlayer;
|
import eu.univento.core.api.player.CustomPlayer;
|
||||||
import eu.univento.core.api.player.Rank;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @author joethei
|
* @author joethei
|
||||||
|
@ -92,7 +92,7 @@ class Language_DE implements Languages{
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public String Core_BAN_BANNED(CustomPlayer p) {
|
public String Core_BAN_BANNED(CustomPlayer p) {
|
||||||
return "§7Du hast " + p.getColor() + p.getDisplayName() + " §cgebannt";
|
return "§7Du hast " + p.getDatabasePlayer().getRank().getColor() + p.getDisplayName() + " §cgebannt";
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -122,7 +122,7 @@ class Language_DE implements Languages{
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public String Core_RUNAS_RUN(CustomPlayer p) {
|
public String Core_RUNAS_RUN(CustomPlayer p) {
|
||||||
return "§7Der Spieler " + p.getColor() + p.getDisplayName() + " §7hat deinen Befehl §eerfolgreich §7ausgeführt";
|
return "§7Der Spieler " + p.getDatabasePlayer().getRank().getColor() + p.getDisplayName() + " §7hat deinen Befehl §eerfolgreich §7ausgeführt";
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -171,7 +171,7 @@ class Language_DE implements Languages{
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public String Core_CHAT_CLEARED(CustomPlayer p) {
|
public String Core_CHAT_CLEARED(CustomPlayer p) {
|
||||||
return "§7Der Chat wurde von " + p.getColor() + p.getDisplayName() + " §cgereinigt";
|
return "§7Der Chat wurde von " + p.getDatabasePlayer().getRank().getColor() + p.getDisplayName() + " §cgereinigt";
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
package eu.univento.core.api.languages;
|
package eu.univento.core.api.languages;
|
||||||
|
|
||||||
|
import eu.univento.commons.player.Rank;
|
||||||
import eu.univento.core.api.player.CustomPlayer;
|
import eu.univento.core.api.player.CustomPlayer;
|
||||||
import eu.univento.core.api.player.Rank;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @author joethei
|
* @author joethei
|
||||||
|
@ -16,7 +16,7 @@ public class Language_EN implements Languages{
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public String NO_PERMS() {
|
public String NO_PERMS() {
|
||||||
return "§cYou're not allowed do use this command";
|
return "§cYou're not allowed do use this commons";
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -41,7 +41,7 @@ public class Language_EN implements Languages{
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public String COMMAND_NOT_FOUND() {
|
public String COMMAND_NOT_FOUND() {
|
||||||
return "§cThis command hasn't been found.";
|
return "§cThis commons hasn't been found.";
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -91,7 +91,7 @@ public class Language_EN implements Languages{
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public String Core_BAN_BANNED(CustomPlayer p) {
|
public String Core_BAN_BANNED(CustomPlayer p) {
|
||||||
return "§7You've §cbanned " + p.getColor() + p.getDisplayName();
|
return "§7You've §cbanned " + p.getDatabasePlayer().getRank().getColor() + p.getDisplayName();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -116,12 +116,12 @@ public class Language_EN implements Languages{
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public String Core_RUNAS_USAGE() {
|
public String Core_RUNAS_USAGE() {
|
||||||
return "§cUse /runas <player> <command>";
|
return "§cUse /runas <player> <commons>";
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public String Core_RUNAS_RUN(CustomPlayer p) {
|
public String Core_RUNAS_RUN(CustomPlayer p) {
|
||||||
return "§7The player " + p.getColor() + p.getDisplayName() + " §7has executed your command §esuccesfully";
|
return "§7The player " + p.getDatabasePlayer().getRank().getColor() + p.getDisplayName() + " §7has executed your commons §esuccesfully";
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -171,7 +171,7 @@ public class Language_EN implements Languages{
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public String Core_CHAT_CLEARED(CustomPlayer p) {
|
public String Core_CHAT_CLEARED(CustomPlayer p) {
|
||||||
return "§7The chat has been §ccleaned §7by " + p.getColor() + p.getDisplayName();
|
return "§7The chat has been §ccleaned §7by " + p.getDatabasePlayer().getRank().getColor() + p.getDisplayName();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
package eu.univento.core.api.languages;
|
package eu.univento.core.api.languages;
|
||||||
|
|
||||||
|
import eu.univento.commons.player.Rank;
|
||||||
import eu.univento.core.api.player.CustomPlayer;
|
import eu.univento.core.api.player.CustomPlayer;
|
||||||
import eu.univento.core.api.player.Rank;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @author joethei
|
* @author joethei
|
||||||
|
@ -91,7 +91,7 @@ public class Language_IT implements Languages{
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public String Core_BAN_BANNED(CustomPlayer p) {
|
public String Core_BAN_BANNED(CustomPlayer p) {
|
||||||
return "§7Tu hai §ebannato " + p.getColor() + p.getDisplayName();
|
return "§7Tu hai §ebannato " + p.getDatabasePlayer().getRank().getColor() + p.getDisplayName();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -121,7 +121,7 @@ public class Language_IT implements Languages{
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public String Core_RUNAS_RUN(CustomPlayer p) {
|
public String Core_RUNAS_RUN(CustomPlayer p) {
|
||||||
return p.getColor() + p.getDisplayName() + " §7ha eseguito il tuo commando";
|
return p.getDatabasePlayer().getRank().getColor() + p.getDisplayName() + " §7ha eseguito il tuo commando";
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -139,7 +139,6 @@ public class Language_IT implements Languages{
|
||||||
return "§cQuesto gruppo non esiste";
|
return "§cQuesto gruppo non esiste";
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
public String Core_SETRANK_SET(CustomPlayer p, Rank rank) {
|
public String Core_SETRANK_SET(CustomPlayer p, Rank rank) {
|
||||||
return "§7Hai dato " + p.getDisplayName() + " il gruppo §e" + rank.toString();
|
return "§7Hai dato " + p.getDisplayName() + " il gruppo §e" + rank.toString();
|
||||||
}
|
}
|
||||||
|
@ -170,7 +169,7 @@ public class Language_IT implements Languages{
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public String Core_CHAT_CLEARED(CustomPlayer p) {
|
public String Core_CHAT_CLEARED(CustomPlayer p) {
|
||||||
return "§7La chat è stata §cpulita §7da " + p.getColor() + p.getDisplayName();
|
return "§7La chat è stata §cpulita §7da " + p.getDatabasePlayer().getRank().getColor() + p.getDisplayName();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
package eu.univento.core.api.languages;
|
package eu.univento.core.api.languages;
|
||||||
|
|
||||||
|
import eu.univento.commons.player.Rank;
|
||||||
import eu.univento.core.api.player.CustomPlayer;
|
import eu.univento.core.api.player.CustomPlayer;
|
||||||
import eu.univento.core.api.player.Rank;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @author joethei
|
* @author joethei
|
||||||
|
|
|
@ -1,13 +1,14 @@
|
||||||
package eu.univento.core.api.languages;
|
package eu.univento.core.api.languages;
|
||||||
|
|
||||||
|
import eu.univento.commons.player.Rank;
|
||||||
import eu.univento.core.api.player.CustomPlayer;
|
import eu.univento.core.api.player.CustomPlayer;
|
||||||
import eu.univento.core.api.player.Rank;
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @author joethei
|
* @author joethei
|
||||||
* @version 2.0
|
* @version 2.0
|
||||||
*/
|
*/
|
||||||
|
@Deprecated
|
||||||
public class Messages {
|
public class Messages {
|
||||||
|
|
||||||
private final CustomPlayer player;
|
private final CustomPlayer player;
|
||||||
|
@ -18,12 +19,11 @@ public class Messages {
|
||||||
|
|
||||||
private Languages lang;
|
private Languages lang;
|
||||||
|
|
||||||
@Deprecated
|
|
||||||
public Messages(CustomPlayer player) {
|
public Messages(CustomPlayer player) {
|
||||||
this.player = player;
|
this.player = player;
|
||||||
if(player.getLanguage().equals("DE")) this.lang = de;
|
if(player.getDatabasePlayer().getSettings().getLanguage().equals("DE")) this.lang = de;
|
||||||
if(player.getLanguage().equals("IT")) this.lang = it;
|
if(player.getDatabasePlayer().getSettings().getLanguage().equals("IT")) this.lang = it;
|
||||||
if(player.getLanguage().equals("EN")) this.lang = en;
|
if(player.getDatabasePlayer().getSettings().getLanguage().equals("EN")) this.lang = en;
|
||||||
}
|
}
|
||||||
|
|
||||||
public String PREFIX() {
|
public String PREFIX() {
|
||||||
|
|
|
@ -7,7 +7,6 @@ import java.io.FileOutputStream;
|
||||||
import java.io.InputStream;
|
import java.io.InputStream;
|
||||||
import java.io.OutputStream;
|
import java.io.OutputStream;
|
||||||
import java.net.URL;
|
import java.net.URL;
|
||||||
import java.util.logging.Level;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @author joethei
|
* @author joethei
|
||||||
|
@ -19,7 +18,7 @@ class MapDownloader {
|
||||||
try {
|
try {
|
||||||
InputStream is = file.openStream();
|
InputStream is = file.openStream();
|
||||||
File finaldest = new File(dest + "/" + file.getFile());
|
File finaldest = new File(dest + "/" + file.getFile());
|
||||||
if(!finaldest.getParentFile().mkdirs()) Core.log(Level.SEVERE, "Map Ordner konnte nicht erstellt werden");
|
if(!finaldest.getParentFile().mkdirs()) Core.getCommons().getLoggingHandler().getCore().warn("Map Ordner konnte nicht erstellt werden");
|
||||||
finaldest.createNewFile();
|
finaldest.createNewFile();
|
||||||
OutputStream os = new FileOutputStream(finaldest);
|
OutputStream os = new FileOutputStream(finaldest);
|
||||||
byte data[] = new byte[1024];
|
byte data[] = new byte[1024];
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
package eu.univento.core.api.map;
|
package eu.univento.core.api.map;
|
||||||
|
|
||||||
|
import eu.univento.commons.player.Rank;
|
||||||
import eu.univento.core.api.player.CustomPlayer;
|
import eu.univento.core.api.player.CustomPlayer;
|
||||||
import eu.univento.core.api.player.Rank;
|
|
||||||
import org.bukkit.Bukkit;
|
import org.bukkit.Bukkit;
|
||||||
import org.bukkit.entity.Player;
|
import org.bukkit.entity.Player;
|
||||||
import org.bukkit.event.EventHandler;
|
import org.bukkit.event.EventHandler;
|
||||||
|
@ -109,7 +109,7 @@ class MapVoting implements Listener{
|
||||||
}
|
}
|
||||||
|
|
||||||
public Inventory getInventory(CustomPlayer p) {
|
public Inventory getInventory(CustomPlayer p) {
|
||||||
if(p.isAllowed(Rank.Admin)) {
|
if(p.getDatabasePlayer().isAllowed(Rank.Admin)) {
|
||||||
Inventory inv = Bukkit.createInventory(p, 45, invTitle);
|
Inventory inv = Bukkit.createInventory(p, 45, invTitle);
|
||||||
|
|
||||||
for(Map map : allMaps) {
|
for(Map map : allMaps) {
|
||||||
|
@ -164,7 +164,7 @@ class MapVoting implements Listener{
|
||||||
if(e.getWhoClicked() instanceof Player) {
|
if(e.getWhoClicked() instanceof Player) {
|
||||||
CustomPlayer p = CustomPlayer.getPlayer(e.getWhoClicked().getName());
|
CustomPlayer p = CustomPlayer.getPlayer(e.getWhoClicked().getName());
|
||||||
if(e.getInventory().getName().equals(invTitle)) {
|
if(e.getInventory().getName().equals(invTitle)) {
|
||||||
if(p.isAllowed(Rank.Admin)) {
|
if(p.getDatabasePlayer().isAllowed(Rank.Admin)) {
|
||||||
allMaps.stream().filter(map -> e.getCurrentItem().getType() == map.getItem()).forEach(map -> forcedMap = map);
|
allMaps.stream().filter(map -> e.getCurrentItem().getType() == map.getItem()).forEach(map -> forcedMap = map);
|
||||||
}else{
|
}else{
|
||||||
if(e.getCurrentItem().getType() == map1.getItem()) {
|
if(e.getCurrentItem().getType() == map1.getItem()) {
|
||||||
|
|
|
@ -13,7 +13,6 @@ import java.lang.reflect.InvocationTargetException;
|
||||||
/**
|
/**
|
||||||
* @author joethei
|
* @author joethei
|
||||||
* @version 0.1
|
* @version 0.1
|
||||||
* created on 26.06.2016
|
|
||||||
*/
|
*/
|
||||||
public class NMSHandler {
|
public class NMSHandler {
|
||||||
|
|
||||||
|
|
|
@ -12,7 +12,6 @@ import java.util.Map;
|
||||||
/**
|
/**
|
||||||
* @author joethei
|
* @author joethei
|
||||||
* @version 0.1
|
* @version 0.1
|
||||||
* created on 26.06.2016
|
|
||||||
*/
|
*/
|
||||||
class NMSHelper {
|
class NMSHelper {
|
||||||
|
|
||||||
|
|
|
@ -3,7 +3,6 @@ package eu.univento.core.api.pet;
|
||||||
/**
|
/**
|
||||||
* @author joethei
|
* @author joethei
|
||||||
* @version 0.1
|
* @version 0.1
|
||||||
* created on 26.06.2016
|
|
||||||
*/
|
*/
|
||||||
public class PetManager {
|
public class PetManager {
|
||||||
|
|
||||||
|
|
|
@ -15,7 +15,6 @@ import java.util.List;
|
||||||
*
|
*
|
||||||
* @author joethei
|
* @author joethei
|
||||||
* @version 0.1
|
* @version 0.1
|
||||||
* created on 26.06.2016
|
|
||||||
*/
|
*/
|
||||||
public enum PetType {
|
public enum PetType {
|
||||||
CREEPER("Creeper", 50, EntityType.CREEPER, EntityCreeper.class, CustomCreeper.class),
|
CREEPER("Creeper", 50, EntityType.CREEPER, EntityCreeper.class, CustomCreeper.class),
|
||||||
|
|
|
@ -6,7 +6,6 @@ import net.minecraft.server.v1_10_R1.*;
|
||||||
/**
|
/**
|
||||||
* @author joethei
|
* @author joethei
|
||||||
* @version 0.1
|
* @version 0.1
|
||||||
* created on 26.06.2016
|
|
||||||
*/
|
*/
|
||||||
public class CustomCreeper extends EntityCreeper{
|
public class CustomCreeper extends EntityCreeper{
|
||||||
|
|
||||||
|
|
|
@ -6,7 +6,6 @@ import net.minecraft.server.v1_10_R1.*;
|
||||||
/**
|
/**
|
||||||
* @author joethei
|
* @author joethei
|
||||||
* @version 0.1
|
* @version 0.1
|
||||||
* created on 26.06.2016
|
|
||||||
*/
|
*/
|
||||||
public class CustomPig extends EntityPig{
|
public class CustomPig extends EntityPig{
|
||||||
private double rideSpeed;
|
private double rideSpeed;
|
||||||
|
|
|
@ -3,16 +3,13 @@ package eu.univento.core.api.player;
|
||||||
import com.mojang.authlib.GameProfile;
|
import com.mojang.authlib.GameProfile;
|
||||||
import com.mojang.authlib.properties.Property;
|
import com.mojang.authlib.properties.Property;
|
||||||
import com.mongodb.BasicDBObject;
|
import com.mongodb.BasicDBObject;
|
||||||
import com.mongodb.CursorType;
|
import eu.univento.commons.player.DatabasePlayer;
|
||||||
import com.mongodb.client.FindIterable;
|
import eu.univento.commons.player.Rank;
|
||||||
import com.mongodb.client.MongoCollection;
|
|
||||||
import eu.univento.core.Core;
|
import eu.univento.core.Core;
|
||||||
import eu.univento.core.api.Hologram;
|
import eu.univento.core.api.Hologram;
|
||||||
import eu.univento.core.api.Utils;
|
import eu.univento.core.api.Utils;
|
||||||
import eu.univento.core.api.database.MongoDB;
|
|
||||||
import eu.univento.core.api.effects.Blackscreen;
|
import eu.univento.core.api.effects.Blackscreen;
|
||||||
import eu.univento.core.api.effects.Effects;
|
import eu.univento.core.api.effects.Effects;
|
||||||
import eu.univento.core.api.languages.Language;
|
|
||||||
import eu.univento.core.api.languages.Messages;
|
import eu.univento.core.api.languages.Messages;
|
||||||
import eu.univento.core.api.server.ServerSettings;
|
import eu.univento.core.api.server.ServerSettings;
|
||||||
import eu.univento.core.api.server.Servers;
|
import eu.univento.core.api.server.Servers;
|
||||||
|
@ -21,12 +18,11 @@ import eu.univento.core.api.utils.GameProfileBuilder;
|
||||||
import eu.univento.core.api.utils.UUIDFetcher;
|
import eu.univento.core.api.utils.UUIDFetcher;
|
||||||
import io.netty.buffer.ByteBuf;
|
import io.netty.buffer.ByteBuf;
|
||||||
import io.netty.buffer.Unpooled;
|
import io.netty.buffer.Unpooled;
|
||||||
import net.md_5.bungee.api.ChatMessageType;
|
|
||||||
import net.md_5.bungee.api.chat.TextComponent;
|
|
||||||
import net.minecraft.server.v1_10_R1.*;
|
import net.minecraft.server.v1_10_R1.*;
|
||||||
import net.minecraft.server.v1_10_R1.World;
|
import net.minecraft.server.v1_10_R1.World;
|
||||||
import org.bson.Document;
|
import org.bson.Document;
|
||||||
import org.bukkit.*;
|
import org.bukkit.*;
|
||||||
|
import org.bukkit.Material;
|
||||||
import org.bukkit.attribute.Attribute;
|
import org.bukkit.attribute.Attribute;
|
||||||
import org.bukkit.attribute.AttributeInstance;
|
import org.bukkit.attribute.AttributeInstance;
|
||||||
import org.bukkit.attribute.AttributeModifier;
|
import org.bukkit.attribute.AttributeModifier;
|
||||||
|
@ -47,41 +43,26 @@ import java.io.IOException;
|
||||||
import java.io.ObjectOutputStream;
|
import java.io.ObjectOutputStream;
|
||||||
import java.lang.reflect.Field;
|
import java.lang.reflect.Field;
|
||||||
import java.util.*;
|
import java.util.*;
|
||||||
import java.util.logging.Level;
|
|
||||||
import java.util.stream.Collectors;
|
|
||||||
|
|
||||||
public class CustomPlayer extends CraftPlayer{
|
public class CustomPlayer extends CraftPlayer{
|
||||||
|
|
||||||
|
|
||||||
private static final HashMap<UUID, CustomPlayer> PLAYERS = new HashMap<>();
|
private static final HashMap<UUID, CustomPlayer> PLAYERS = new HashMap<>();
|
||||||
private final Player PLAYER;
|
private final Player PLAYER;
|
||||||
|
private final DatabasePlayer DATABASE_PLAYER;
|
||||||
private String customPrefix;
|
|
||||||
private String customSuffix;
|
|
||||||
private String customColor;
|
|
||||||
|
|
||||||
private boolean openInventory;
|
private boolean openInventory;
|
||||||
|
|
||||||
private final MongoCollection<Document> playerCollection;
|
|
||||||
private final MongoCollection<Document> friendCollection;
|
|
||||||
private final MongoCollection<Document> onlinePlayerCollection;
|
|
||||||
private final MongoCollection<Document> warnCollection;
|
|
||||||
|
|
||||||
private CustomPlayer(Player player) {
|
private CustomPlayer(Player player) {
|
||||||
super((CraftServer) Bukkit.getServer(), ((CraftPlayer) player).getHandle());
|
super((CraftServer) Bukkit.getServer(), ((CraftPlayer) player).getHandle());
|
||||||
|
DATABASE_PLAYER = new DatabasePlayer(Core.getCommons(), player.getUniqueId());
|
||||||
PLAYERS.put(player.getUniqueId(), this);
|
PLAYERS.put(player.getUniqueId(), this);
|
||||||
PLAYER = player;
|
PLAYER = player;
|
||||||
MongoDB mongoDB = Core.getDatabaseManager().getMongoDB();
|
|
||||||
playerCollection = mongoDB.getDatabase().getCollection("players");
|
|
||||||
friendCollection = mongoDB.getDatabase().getCollection("friends");
|
|
||||||
onlinePlayerCollection = mongoDB.getDatabase().getCollection("online-players");
|
|
||||||
warnCollection = mongoDB.getDatabase().getCollection("warns");
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public void onLeave() {
|
public void onLeave() {
|
||||||
Date date = new Date();
|
Date date = new Date();
|
||||||
setInDatabase("lastOnline", date);
|
DATABASE_PLAYER.setInDatabase("lastOnline", date);
|
||||||
|
|
||||||
HashMap<String, Object> location = new HashMap<>();
|
HashMap<String, Object> location = new HashMap<>();
|
||||||
location.put("X", getLocation().getX());
|
location.put("X", getLocation().getX());
|
||||||
|
@ -90,7 +71,7 @@ public class CustomPlayer extends CraftPlayer {
|
||||||
location.put("Yaw", getLocation().getYaw());
|
location.put("Yaw", getLocation().getYaw());
|
||||||
location.put("Pitch", getLocation().getPitch());
|
location.put("Pitch", getLocation().getPitch());
|
||||||
|
|
||||||
if (ServerSettings.isLobby()) setInDatabase("Pos", new BasicDBObject(location));
|
if (ServerSettings.isLobby()) DATABASE_PLAYER.setInDatabase("Pos", new BasicDBObject(location));
|
||||||
|
|
||||||
if (PLAYERS.containsKey(getUniqueId())) PLAYERS.remove(getUniqueId());
|
if (PLAYERS.containsKey(getUniqueId())) PLAYERS.remove(getUniqueId());
|
||||||
}
|
}
|
||||||
|
@ -123,59 +104,13 @@ public class CustomPlayer extends CraftPlayer {
|
||||||
return PLAYER;
|
return PLAYER;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public DatabasePlayer getDatabasePlayer() {
|
||||||
|
return DATABASE_PLAYER;
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean hasPlayedBefore() {
|
public boolean hasPlayedBefore() {
|
||||||
FindIterable<Document> cursor = playerCollection.find(new Document("uuid", getUniqueId().toString()));
|
return DATABASE_PLAYER.hasPlayedBefore();
|
||||||
cursor.cursorType(CursorType.NonTailable);
|
|
||||||
|
|
||||||
Document obj = cursor.first();
|
|
||||||
return obj != null;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setRank(Rank rank) {
|
|
||||||
setInDatabase("rank", rank.toString());
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setTSID(int id) {
|
|
||||||
setInDatabase("tsid", id);
|
|
||||||
}
|
|
||||||
|
|
||||||
private void setCoins(int coins) {
|
|
||||||
setInDatabase("coins", coins);
|
|
||||||
}
|
|
||||||
|
|
||||||
private void setExperience(int experience) {
|
|
||||||
setInDatabase("experience", experience);
|
|
||||||
}
|
|
||||||
|
|
||||||
private void setFoundSecrets(ArrayList<String> secrets) {
|
|
||||||
setInDatabase("foundSecrets", secrets);
|
|
||||||
}
|
|
||||||
|
|
||||||
public void addSecret(String name) {
|
|
||||||
ArrayList<String> list = getFoundSecrets();
|
|
||||||
list.add(name);
|
|
||||||
setFoundSecrets(list);
|
|
||||||
}
|
|
||||||
|
|
||||||
private void setFoundEggs(ArrayList<String> eggs) {
|
|
||||||
setInDatabase("foundEggs", eggs);
|
|
||||||
}
|
|
||||||
|
|
||||||
public void addEgg(String name) {
|
|
||||||
ArrayList<String> list = getFoundEggs();
|
|
||||||
list.add(name);
|
|
||||||
setFoundEggs(list);
|
|
||||||
}
|
|
||||||
|
|
||||||
private void setSettings(Map<String, Object> settings) {
|
|
||||||
setInDatabase("Settings", settings);
|
|
||||||
}
|
|
||||||
|
|
||||||
private void setSetting(String name, java.io.Serializable setting) {
|
|
||||||
Map<String, Object> list = getSettings();
|
|
||||||
list.put(name, setting);
|
|
||||||
setSettings(list);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public void buy(ShopItem item) {
|
public void buy(ShopItem item) {
|
||||||
|
@ -186,7 +121,7 @@ public class CustomPlayer extends CraftPlayer {
|
||||||
|
|
||||||
public Map<ShopItem, Boolean> getBoughtItems() {
|
public Map<ShopItem, Boolean> getBoughtItems() {
|
||||||
Map<ShopItem, Boolean> map = new HashMap<>();
|
Map<ShopItem, Boolean> map = new HashMap<>();
|
||||||
for (Map.Entry<String, Object> entry : getMapFromDatabase("bought").entrySet())
|
for (Map.Entry<String, Object> entry : DATABASE_PLAYER.getMapFromDatabase("bought").entrySet())
|
||||||
map.put(ShopItem.valueOf(String.valueOf(entry.getKey())), Boolean.valueOf(String.valueOf(entry.getValue())));
|
map.put(ShopItem.valueOf(String.valueOf(entry.getKey())), Boolean.valueOf(String.valueOf(entry.getValue())));
|
||||||
return map;
|
return map;
|
||||||
}
|
}
|
||||||
|
@ -194,195 +129,18 @@ public class CustomPlayer extends CraftPlayer {
|
||||||
private void setBoughtItems(Map<ShopItem, Boolean> map) {
|
private void setBoughtItems(Map<ShopItem, Boolean> map) {
|
||||||
Map<String, Boolean> items = new HashMap<>();
|
Map<String, Boolean> items = new HashMap<>();
|
||||||
for (Map.Entry<ShopItem, Boolean> entry : map.entrySet()) items.put(String.valueOf(entry.getKey()), entry.getValue());
|
for (Map.Entry<ShopItem, Boolean> entry : map.entrySet()) items.put(String.valueOf(entry.getKey()), entry.getValue());
|
||||||
setInDatabase("bought", items);
|
DATABASE_PLAYER.setInDatabase("bought", items);
|
||||||
}
|
|
||||||
|
|
||||||
public Rank getRank() {
|
|
||||||
return Rank.valueOf(getStringFromDatabase("rank"));
|
|
||||||
}
|
|
||||||
|
|
||||||
public Date getFirstLogin() {
|
|
||||||
return getDateFromDatabase("firstLogin");
|
|
||||||
}
|
|
||||||
|
|
||||||
public Date getLastLogin() {
|
|
||||||
return getDateFromDatabase("lastLogin");
|
|
||||||
}
|
|
||||||
|
|
||||||
public Date getLastOnline() {
|
|
||||||
return getDateFromDatabase("lastOnline");
|
|
||||||
}
|
|
||||||
|
|
||||||
public String getLastIP() {
|
|
||||||
return getStringFromDatabase("lastIP");
|
|
||||||
}
|
|
||||||
|
|
||||||
public int getTSID() {
|
|
||||||
return getIntegerFromDatabase("tsid");
|
|
||||||
}
|
|
||||||
|
|
||||||
private int getTimesJoined() {
|
|
||||||
return getIntegerFromDatabase("timesJoined");
|
|
||||||
}
|
|
||||||
|
|
||||||
public int getCoins() {
|
|
||||||
return getIntegerFromDatabase("coins");
|
|
||||||
}
|
|
||||||
|
|
||||||
public int getExperience() {
|
|
||||||
return getIntegerFromDatabase("experience");
|
|
||||||
}
|
|
||||||
|
|
||||||
public int getSecrets() {
|
|
||||||
return getFoundSecrets().size();
|
|
||||||
}
|
|
||||||
|
|
||||||
private ArrayList<String> getFoundSecrets() {
|
|
||||||
return getArrayListFromDatabase("foundSecrets");
|
|
||||||
}
|
|
||||||
|
|
||||||
public int getEggs() {
|
|
||||||
return getFoundEggs().size();
|
|
||||||
}
|
|
||||||
|
|
||||||
private ArrayList<String> getFoundEggs() {
|
|
||||||
return getArrayListFromDatabase("foundEggs");
|
|
||||||
}
|
|
||||||
|
|
||||||
private Map<String, Object> getSettings() {
|
|
||||||
return getMapFromDatabase("Settings");
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public Location getLastLocation() {
|
public Location getLastLocation() {
|
||||||
Map<String, Object> map = getMapFromDatabase("Pos");
|
Map<String, Object> map = DATABASE_PLAYER.getMapFromDatabase("Pos");
|
||||||
return new Location(Bukkit.getWorld("world"), (double) map.get("X"), (double) map.get("Y"), (double) map.get("Z"), (float) map.get("Yaw"), (float) map.get("Pitch"));
|
return new Location(Bukkit.getWorld("world"), (double) map.get("X"), (double) map.get("Y"), (double) map.get("Z"), (float) map.get("Yaw"), (float) map.get("Pitch"));
|
||||||
}
|
}
|
||||||
|
|
||||||
public String getPlayerVisibility() {
|
|
||||||
return (String) getSettings().get("playerVisibility");
|
|
||||||
}
|
|
||||||
|
|
||||||
public boolean hasInventoryAnimation() {
|
|
||||||
return (boolean) getSettings().get("inventoryAnimation");
|
|
||||||
}
|
|
||||||
|
|
||||||
public boolean hasTeleportAnimation() {
|
|
||||||
return (boolean) getSettings().get("teleportAnimation");
|
|
||||||
}
|
|
||||||
|
|
||||||
public boolean hasPartyRequests() {
|
|
||||||
return (boolean) getSettings().get("partyRequests");
|
|
||||||
}
|
|
||||||
|
|
||||||
public boolean hasFriendRequests() {
|
|
||||||
return (boolean) getSettings().get("friendRequests");
|
|
||||||
}
|
|
||||||
|
|
||||||
public boolean hasFriendJump() {
|
|
||||||
return (boolean) getSettings().get("friendJump");
|
|
||||||
}
|
|
||||||
|
|
||||||
public boolean hasChatSounds() {
|
|
||||||
return (boolean) getSettings().get("chatSounds");
|
|
||||||
}
|
|
||||||
|
|
||||||
public boolean hasEffects() {
|
|
||||||
return (boolean) getSettings().get("effects");
|
|
||||||
}
|
|
||||||
|
|
||||||
public boolean hasStoryMode() {
|
|
||||||
return (boolean) getSettings().get("storyMode");
|
|
||||||
}
|
|
||||||
|
|
||||||
public String getLanguage() {
|
|
||||||
return (String) getSettings().get("language");
|
|
||||||
}
|
|
||||||
|
|
||||||
public boolean hasTsMove() {
|
|
||||||
return (boolean) getSettings().get("tsMove");
|
|
||||||
}
|
|
||||||
|
|
||||||
public boolean hasScoreboard() {
|
|
||||||
return (boolean) getSettings().get("scoreboard");
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setPlayerVisibility(String visibility) {
|
|
||||||
setSetting("playerVisibility", visibility);
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setInventoryAnimation(boolean animation) {
|
|
||||||
setSetting("inventoryAnimation", animation);
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setTeleportAnimation(boolean animation) {
|
|
||||||
setSetting("teleportAnimation", animation);
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setPartyRequests(boolean requests) {
|
|
||||||
setSetting("partyRequests", requests);
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setFriendRequests(boolean requests) {
|
|
||||||
setSetting("friendRequests", requests);
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setFriendJump(boolean jump) {
|
|
||||||
setSetting("friendJump", jump);
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setChatSounds(boolean sounds) {
|
|
||||||
setSetting("chatSounds", sounds);
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setEffects(boolean effects) {
|
|
||||||
setSetting("effects", effects);
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setStoryMode(boolean storyMode) {
|
|
||||||
setSetting("storyMode", storyMode);
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setLanguage(String language) {
|
|
||||||
setSetting("language", language);
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setTsMove(boolean tsMove) {
|
|
||||||
setSetting("tsMove", tsMove);
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setScoreboard(boolean scoreboard) {
|
|
||||||
setSetting("scoreboard", scoreboard);
|
|
||||||
}
|
|
||||||
|
|
||||||
public void connectToServer(String server) {
|
public void connectToServer(String server) {
|
||||||
Servers.connectServer(PLAYER, server);
|
Servers.connectServer(PLAYER, server);
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean isAllowed(Rank rank) {
|
|
||||||
return getRank().getValue() >= rank.getValue();
|
|
||||||
}
|
|
||||||
|
|
||||||
public Collection<FriendObject> getFriends() {
|
|
||||||
FindIterable<Document> cursor = friendCollection.find(new Document("uuid", getUniqueId().toString()));
|
|
||||||
cursor.cursorType(CursorType.NonTailable);
|
|
||||||
|
|
||||||
Document doc = cursor.first();
|
|
||||||
if (doc == null) return null;
|
|
||||||
|
|
||||||
LinkedList<UUID> list = (LinkedList<UUID>) doc.get("friends");
|
|
||||||
|
|
||||||
return list.stream().map(FriendObject::new).collect(Collectors.toCollection(LinkedList::new));
|
|
||||||
}
|
|
||||||
|
|
||||||
public boolean isFriend(UUID uuid) {
|
|
||||||
return getFriends().contains(uuid);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
public boolean isMuted() {
|
|
||||||
return (boolean) getObjectFromDatbase("mute");
|
|
||||||
}
|
|
||||||
|
|
||||||
public void warn(WarnReason reason, CustomPlayer warner, String proof) {
|
public void warn(WarnReason reason, CustomPlayer warner, String proof) {
|
||||||
Document doc = new Document("uuid", getUniqueId().toString());
|
Document doc = new Document("uuid", getUniqueId().toString());
|
||||||
doc.put("reason", reason.name());
|
doc.put("reason", reason.name());
|
||||||
|
@ -390,42 +148,7 @@ public class CustomPlayer extends CraftPlayer {
|
||||||
doc.put("date", new Date());
|
doc.put("date", new Date());
|
||||||
doc.put("proof", proof);
|
doc.put("proof", proof);
|
||||||
|
|
||||||
warnCollection.insertOne(doc);
|
DATABASE_PLAYER.getWarnCollection().insertOne(doc);
|
||||||
}
|
|
||||||
|
|
||||||
public String getPrefix() {
|
|
||||||
if (customPrefix != null) return customPrefix;
|
|
||||||
if (isNicked()) return Rank.Premium.getPrefix();
|
|
||||||
return getRank().getPrefix();
|
|
||||||
}
|
|
||||||
|
|
||||||
public String getSuffix() {
|
|
||||||
if (customSuffix != null) return customSuffix;
|
|
||||||
if (isNicked()) return Rank.Premium.getSuffix();
|
|
||||||
return getRank().getSuffix();
|
|
||||||
}
|
|
||||||
|
|
||||||
public String getColor() {
|
|
||||||
if (customColor != null) return customColor;
|
|
||||||
if (isNicked()) return Rank.Premium.getColor();
|
|
||||||
return getRank().getColor();
|
|
||||||
}
|
|
||||||
|
|
||||||
public Team getTeam() {
|
|
||||||
if (isNicked()) getScoreboard().getTeam(Rank.Premium.getTeam());
|
|
||||||
return getScoreboard().getTeam(getRank().getTeam());
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setCustomPrefix(String prefix) {
|
|
||||||
customPrefix = prefix;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setCustomSuffix(String suffix) {
|
|
||||||
customSuffix = suffix;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setCustomColor(String color) {
|
|
||||||
customColor = color;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean hasEmptyInventory() {
|
public boolean hasEmptyInventory() {
|
||||||
|
@ -445,14 +168,6 @@ public class CustomPlayer extends CraftPlayer {
|
||||||
this.openInventory = openInventory;
|
this.openInventory = openInventory;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void addCoins(int coins) {
|
|
||||||
setCoins(getCoins() + coins);
|
|
||||||
}
|
|
||||||
|
|
||||||
public void substractCoins(int coins) {
|
|
||||||
setCoins(getCoins() - coins);
|
|
||||||
}
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
@Deprecated
|
@Deprecated
|
||||||
public void sendActionBar(String text) {
|
public void sendActionBar(String text) {
|
||||||
|
@ -463,7 +178,7 @@ public class CustomPlayer extends CraftPlayer {
|
||||||
*/
|
*/
|
||||||
|
|
||||||
public void sendActionBar(String text) {
|
public void sendActionBar(String text) {
|
||||||
spigot().sendMessage(ChatMessageType.ACTION_BAR, new TextComponent(text));
|
//spigot().sendMessage(ChatMessageType.ACTION_BAR, new TextComponent(text));
|
||||||
}
|
}
|
||||||
|
|
||||||
public void sendTitle(int fadeIn, int stay, int fadeOut, String title, String subtitle) {
|
public void sendTitle(int fadeIn, int stay, int fadeOut, String title, String subtitle) {
|
||||||
|
@ -524,27 +239,27 @@ public class CustomPlayer extends CraftPlayer {
|
||||||
}
|
}
|
||||||
|
|
||||||
public void addExperience(int experience) {
|
public void addExperience(int experience) {
|
||||||
setExperience(getExperience() + experience);
|
DATABASE_PLAYER.setExperience(DATABASE_PLAYER.getExperience() + experience);
|
||||||
setExp(0F);
|
setExp(0F);
|
||||||
giveExp(getExperience());
|
giveExp(DATABASE_PLAYER.getExperience());
|
||||||
playSound(getLocation(), Sound.ENTITY_PLAYER_LEVELUP, 1.0F, 1.0F);
|
playSound(getLocation(), Sound.ENTITY_PLAYER_LEVELUP, 1.0F, 1.0F);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void substractExperience(int experience) {
|
public void substractExperience(int experience) {
|
||||||
setExperience(getExperience() - experience);
|
DATABASE_PLAYER.setExperience(DATABASE_PLAYER.getExperience() - experience);
|
||||||
setExp(0F);
|
setExp(0F);
|
||||||
giveExp(getExperience());
|
giveExp(DATABASE_PLAYER.getExperience());
|
||||||
}
|
}
|
||||||
|
|
||||||
public void refreshExperience() {
|
public void refreshExperience() {
|
||||||
setLevel(0);
|
setLevel(0);
|
||||||
setExp(0F);
|
setExp(0F);
|
||||||
giveExp(getExperience());
|
giveExp(DATABASE_PLAYER.getExperience());
|
||||||
}
|
}
|
||||||
|
|
||||||
@Deprecated
|
@Deprecated
|
||||||
public void playParticle(Location loc, EnumParticle ep, float f, int count) {
|
public void playParticle(Location loc, EnumParticle ep, float f, int count) {
|
||||||
if (hasEffects()) Effects.playEffectToPlayer(PLAYER, loc, ep, f, count);
|
if (DATABASE_PLAYER.getSettings().hasEffectsEnabled()) Effects.playEffectToPlayer(PLAYER, loc, ep, f, count);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setAttackSpeed(double speed) {
|
public void setAttackSpeed(double speed) {
|
||||||
|
@ -568,18 +283,6 @@ public class CustomPlayer extends CraftPlayer {
|
||||||
return new Messages(this);
|
return new Messages(this);
|
||||||
}
|
}
|
||||||
|
|
||||||
public String getMessage(String message) {
|
|
||||||
return new Language(getLanguage()).getWord(message);
|
|
||||||
}
|
|
||||||
|
|
||||||
public boolean isNicked() {
|
|
||||||
return (boolean) getSettings().get("nicked");
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setNicked(boolean nicked) {
|
|
||||||
setSetting("nicked", nicked);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Deprecated
|
@Deprecated
|
||||||
private void loadSkin(String name) {
|
private void loadSkin(String name) {
|
||||||
//Skin skin = new Skin(UUIDFetcher.getUUID(name).toString());
|
//Skin skin = new Skin(UUIDFetcher.getUUID(name).toString());
|
||||||
|
@ -606,7 +309,7 @@ public class CustomPlayer extends CraftPlayer {
|
||||||
}.runTaskLater(Core.getInstance(), 4);
|
}.runTaskLater(Core.getInstance(), 4);
|
||||||
} catch (IOException e) {
|
} catch (IOException e) {
|
||||||
e.printStackTrace();
|
e.printStackTrace();
|
||||||
Core.log(Level.SEVERE, "Mojang Skin Server offline");
|
Core.getCommons().getLoggingHandler().getCore().error("Mojang Skin Server offline");
|
||||||
sendMessage("§cSkin Server sind offline");
|
sendMessage("§cSkin Server sind offline");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -657,68 +360,13 @@ public class CustomPlayer extends CraftPlayer {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean isOnline() {
|
public boolean isOnline() {
|
||||||
FindIterable<Document> cursor = onlinePlayerCollection.find(new Document("uuid", getUniqueId().toString()));
|
return DATABASE_PLAYER.isOnline();
|
||||||
cursor.cursorType(CursorType.NonTailable);
|
|
||||||
Document doc = cursor.first();
|
|
||||||
return doc != null;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setStoryResourcePack() {
|
public void setStoryResourcePack() {
|
||||||
setResourcePack("http://univento.eu/storyPack.zip");
|
setResourcePack("http://univento.eu/storyPack.zip");
|
||||||
}
|
}
|
||||||
|
|
||||||
private void setInDatabase(String name, Object obj) {
|
|
||||||
playerCollection.updateOne(new Document("uuid", getUniqueId().toString()), new Document("$set", new Document(name, obj)));
|
|
||||||
}
|
|
||||||
|
|
||||||
private Object getObjectFromDatbase(String name) {
|
|
||||||
FindIterable<Document> cursor = playerCollection.find(new Document("uuid", getUniqueId().toString()));
|
|
||||||
cursor.cursorType(CursorType.NonTailable);
|
|
||||||
|
|
||||||
Document doc = cursor.first();
|
|
||||||
if (doc == null) return null;
|
|
||||||
|
|
||||||
return doc.get(name);
|
|
||||||
}
|
|
||||||
|
|
||||||
private int getIntegerFromDatabase(String name) {
|
|
||||||
FindIterable<Document> cursor = playerCollection.find(new Document("uuid", getUniqueId().toString()));
|
|
||||||
cursor.cursorType(CursorType.NonTailable);
|
|
||||||
|
|
||||||
Document doc = cursor.first();
|
|
||||||
if (doc == null) return 0;
|
|
||||||
|
|
||||||
return doc.getInteger(name);
|
|
||||||
}
|
|
||||||
|
|
||||||
private String getStringFromDatabase(String name) {
|
|
||||||
FindIterable<Document> cursor = playerCollection.find(new Document("uuid", getUniqueId().toString()));
|
|
||||||
cursor.cursorType(CursorType.NonTailable);
|
|
||||||
|
|
||||||
Document doc = cursor.first();
|
|
||||||
if (doc == null) return null;
|
|
||||||
|
|
||||||
return doc.getString(name);
|
|
||||||
}
|
|
||||||
|
|
||||||
private Date getDateFromDatabase(String name) {
|
|
||||||
FindIterable<Document> cursor = playerCollection.find(new Document("uuid", getUniqueId().toString()));
|
|
||||||
cursor.cursorType(CursorType.NonTailable);
|
|
||||||
|
|
||||||
Document doc = cursor.first();
|
|
||||||
if (doc == null) return null;
|
|
||||||
|
|
||||||
return doc.getDate(name);
|
|
||||||
}
|
|
||||||
|
|
||||||
private ArrayList<String> getArrayListFromDatabase(String name) {
|
|
||||||
return (ArrayList<String>) getObjectFromDatbase(name);
|
|
||||||
}
|
|
||||||
|
|
||||||
private Map<String, Object> getMapFromDatabase(String name) {
|
|
||||||
return (Map<String, Object>) getObjectFromDatbase(name);
|
|
||||||
}
|
|
||||||
|
|
||||||
public void initScoreboard() {
|
public void initScoreboard() {
|
||||||
Scoreboard board = getScoreboard();
|
Scoreboard board = getScoreboard();
|
||||||
board.getTeams().forEach(Team::unregister);
|
board.getTeams().forEach(Team::unregister);
|
||||||
|
@ -775,7 +423,7 @@ public class CustomPlayer extends CraftPlayer {
|
||||||
public void refreshTablist() {
|
public void refreshTablist() {
|
||||||
for (CustomPlayer player : Core.getOnlinePlayers()) {
|
for (CustomPlayer player : Core.getOnlinePlayers()) {
|
||||||
setScoreboard(Bukkit.getScoreboardManager().getNewScoreboard());
|
setScoreboard(Bukkit.getScoreboardManager().getNewScoreboard());
|
||||||
getScoreboard().getTeam(player.getTeam().getName()).addEntry(player.getDisplayName());
|
getScoreboard().getTeam(DATABASE_PLAYER.getRank().getTeam()).addEntry(player.getDisplayName());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -783,8 +431,8 @@ public class CustomPlayer extends CraftPlayer {
|
||||||
*
|
*
|
||||||
* @param location location for effect
|
* @param location location for effect
|
||||||
* @param effect particle effect
|
* @param effect particle effect
|
||||||
* @param id
|
* @param id the id
|
||||||
* @param data
|
* @param data the data
|
||||||
* @param offsetX offset in x direction
|
* @param offsetX offset in x direction
|
||||||
* @param offsetY offset in y direction
|
* @param offsetY offset in y direction
|
||||||
* @param offsetZ offset in z direction
|
* @param offsetZ offset in z direction
|
||||||
|
@ -793,8 +441,17 @@ public class CustomPlayer extends CraftPlayer {
|
||||||
* @param radius effect radius
|
* @param radius effect radius
|
||||||
*/
|
*/
|
||||||
public void playEffect(Location location, Effect effect, int id, int data, float offsetX, float offsetY, float offsetZ, float speed, int particleCount, int radius) {
|
public void playEffect(Location location, Effect effect, int id, int data, float offsetX, float offsetY, float offsetZ, float speed, int particleCount, int radius) {
|
||||||
if(hasEffects())
|
if(DATABASE_PLAYER.getSettings().hasEffectsEnabled()) {
|
||||||
spigot().playEffect(location, effect, id, data, offsetX, offsetY, offsetZ, speed, particleCount, radius);
|
//spigot().playEffect(location, effect, id, data, offsetX, offsetY, offsetZ, speed, particleCount, radius);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public void changeChestState(Location loc, boolean open) {
|
||||||
|
if(loc.getBlock().getType() != Material.CHEST) return;
|
||||||
|
byte dataByte = (open) ? (byte) 1 : 0;
|
||||||
|
BlockPosition position = new BlockPosition(loc.getBlockX(), loc.getBlockY(), loc.getBlockZ());
|
||||||
|
PacketPlayOutBlockAction blockActionPacket = new PacketPlayOutBlockAction(position, net.minecraft.server.v1_10_R1.Block.getById(loc.getBlock().getTypeId()), (byte) 1, dataByte);
|
||||||
|
sendPacket(blockActionPacket);
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
|
@ -7,7 +7,6 @@ import java.util.UUID;
|
||||||
/**
|
/**
|
||||||
* @author joethei
|
* @author joethei
|
||||||
* @version 0.1
|
* @version 0.1
|
||||||
* Created at 21:15 on 25.07.2016.
|
|
||||||
*/
|
*/
|
||||||
public class FriendObject {
|
public class FriendObject {
|
||||||
|
|
||||||
|
|
|
@ -1,60 +0,0 @@
|
||||||
package eu.univento.core.api.player;
|
|
||||||
|
|
||||||
public enum Rank {
|
|
||||||
Admin(16, "§4", "§8[§4Admin§8] ", " §8»§7 ", "a", "§4Admin | "),
|
|
||||||
SrDeveloper(15, "§3", "§8[§3SrDev§8] ", " §8»§7 ", "c", "§3SrDev | "),
|
|
||||||
SrBuilder(14, "§2", "§8[§2SrBuilder§8] ", " §8»§7 ", "f", "§2SrBuilder | "),
|
|
||||||
SrSupporter(13, "§9", "§8[§9SrSupr§8] ", " §8»§7 ", "i", "§9SrSup | "),
|
|
||||||
Developer(12, "§3", "§8[§3Dev§8] ", " §8»§7 ", "d", "§3Dev | "),
|
|
||||||
Builder(11, "§2", "§8[§2Builder§8] ", " §8»§7 ", "g", "§2Builder | "),
|
|
||||||
Supporter(10, "§9", "§8[§9Sup§8] ", " §8»§7 ", "j", "§9Sup | "),
|
|
||||||
JrDeveloper(9, "§3", "§8[§3JrDev§8] ", " §8»§7 ", "e", "§3JrDev | "),
|
|
||||||
JrBuilder(8, "§2", "§8[§2JrBuilder§8] ", " §8»§7 ", "h", "§2JrBuilder | "),
|
|
||||||
JrSupporter(7, "§9", "§8[§9JrSup§8] ", " §8»§7 ", "k", "§9JrSup | "),
|
|
||||||
Manager(6, "§c", "§8[§cManager§8] ", " §8»§7 ", "b", "§cManager | "),
|
|
||||||
Grafik(5, "§e", "§8[§eGrafiker§8] ", " §8»§7 ", "l", "§eGrafik | "),
|
|
||||||
Sound(4, "§e", "§8[§eSound§8] ", " §8»§7 ", "m", "§eSound | "),
|
|
||||||
Partner(3, "§5", "§5", " §8»§7 ", "n", "§5"),
|
|
||||||
Premium(2, "§6", "§6", " §8§7» ", "o", "§6"),
|
|
||||||
Player(1, "§7", "§7", " §8»§7 ", "p", "§7");
|
|
||||||
|
|
||||||
private final int value;
|
|
||||||
private final String color;
|
|
||||||
private final String prefix;
|
|
||||||
private final String suffix;
|
|
||||||
private final String team;
|
|
||||||
private final String tab;
|
|
||||||
|
|
||||||
Rank(int value, String color, String prefix, String suffix, String team, String tab) {
|
|
||||||
this.value = value;
|
|
||||||
this.color = color;
|
|
||||||
this.prefix = prefix;
|
|
||||||
this.suffix = suffix;
|
|
||||||
this.team = team;
|
|
||||||
this.tab = tab;
|
|
||||||
}
|
|
||||||
|
|
||||||
public int getValue() {
|
|
||||||
return value;
|
|
||||||
}
|
|
||||||
|
|
||||||
public String getColor() {
|
|
||||||
return color;
|
|
||||||
}
|
|
||||||
|
|
||||||
public String getPrefix() {
|
|
||||||
return prefix;
|
|
||||||
}
|
|
||||||
|
|
||||||
public String getSuffix() {
|
|
||||||
return suffix;
|
|
||||||
}
|
|
||||||
|
|
||||||
public String getTeam() {
|
|
||||||
return team;
|
|
||||||
}
|
|
||||||
|
|
||||||
public String getTab() {
|
|
||||||
return tab;
|
|
||||||
}
|
|
||||||
}
|
|
|
@ -6,7 +6,6 @@ import java.util.List;
|
||||||
/**
|
/**
|
||||||
* @author joethei
|
* @author joethei
|
||||||
* @version 0.1
|
* @version 0.1
|
||||||
* Created at 16:18 on 17.07.2016.
|
|
||||||
*/
|
*/
|
||||||
public class SpectateManager {
|
public class SpectateManager {
|
||||||
|
|
||||||
|
|
|
@ -51,7 +51,7 @@ public class Spectator {
|
||||||
}
|
}
|
||||||
|
|
||||||
public void openPlayerListInventory() {
|
public void openPlayerListInventory() {
|
||||||
ScrollingInventory inventory = new ScrollingInventory(player, player.getMessage("Game.Menu.SpectatorMenu"));
|
ScrollingInventory inventory = new ScrollingInventory(player, player.getDatabasePlayer().getMessage("Game.Menu.SpectatorMenu"));
|
||||||
for(CustomPlayer players : PlayerManager.getPlayers()) {
|
for(CustomPlayer players : PlayerManager.getPlayers()) {
|
||||||
inventory.addItem(new ItemBuilder(Material.SKULL_ITEM).durability((short) 3).skullOwner(players.getDisplayName()).name(players.getDisplayName()).make());
|
inventory.addItem(new ItemBuilder(Material.SKULL_ITEM).durability((short) 3).skullOwner(players.getDisplayName()).name(players.getDisplayName()).make());
|
||||||
}
|
}
|
||||||
|
|
|
@ -3,7 +3,6 @@ package eu.univento.core.api.player;
|
||||||
/**
|
/**
|
||||||
* @author joethei
|
* @author joethei
|
||||||
* @version 0.1
|
* @version 0.1
|
||||||
* Created at 21:06 on 13.07.2016.
|
|
||||||
*/
|
*/
|
||||||
public enum WarnReason {
|
public enum WarnReason {
|
||||||
ADVERTISEMENT("Advertisement", 10),
|
ADVERTISEMENT("Advertisement", 10),
|
||||||
|
|
|
@ -8,8 +8,6 @@ import eu.univento.core.api.player.CustomPlayer;
|
||||||
import org.bukkit.entity.Player;
|
import org.bukkit.entity.Player;
|
||||||
import org.bukkit.plugin.messaging.PluginMessageListener;
|
import org.bukkit.plugin.messaging.PluginMessageListener;
|
||||||
|
|
||||||
import java.util.logging.Level;
|
|
||||||
|
|
||||||
public class NetworkData implements PluginMessageListener{
|
public class NetworkData implements PluginMessageListener{
|
||||||
|
|
||||||
private CustomPlayer player;
|
private CustomPlayer player;
|
||||||
|
@ -38,7 +36,7 @@ public class NetworkData implements PluginMessageListener{
|
||||||
public void onPluginMessageReceived(String channel, Player player, byte[] message) {
|
public void onPluginMessageReceived(String channel, Player player, byte[] message) {
|
||||||
if(!channel.equals("BungeeCord")) return;
|
if(!channel.equals("BungeeCord")) return;
|
||||||
|
|
||||||
Core.log(Level.INFO, "Daten incomming");
|
Core.getCommons().getLoggingHandler().getCore().info("Daten incomming");
|
||||||
|
|
||||||
ByteArrayDataInput input = ByteStreams.newDataInput(message);
|
ByteArrayDataInput input = ByteStreams.newDataInput(message);
|
||||||
String subchannel = input.readUTF();
|
String subchannel = input.readUTF();
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
package eu.univento.core.api.server;
|
package eu.univento.core.api.server;
|
||||||
|
|
||||||
|
import eu.univento.commons.database.MySQL;
|
||||||
import eu.univento.core.Core;
|
import eu.univento.core.Core;
|
||||||
import eu.univento.core.api.database.MySQL;
|
|
||||||
|
|
||||||
import java.sql.ResultSet;
|
import java.sql.ResultSet;
|
||||||
import java.sql.SQLException;
|
import java.sql.SQLException;
|
||||||
|
@ -13,7 +13,7 @@ import java.sql.SQLException;
|
||||||
class ServerDatabase {
|
class ServerDatabase {
|
||||||
|
|
||||||
static String getIP(String name) {
|
static String getIP(String name) {
|
||||||
MySQL sql = Core.getDatabaseManager().getMySQL();
|
MySQL sql = Core.getCommons().getDatabaseManager().getMySQL();
|
||||||
try {
|
try {
|
||||||
ResultSet rs = sql.query("SELECT ip FROM Servers WHERE name='" + name + "';");
|
ResultSet rs = sql.query("SELECT ip FROM Servers WHERE name='" + name + "';");
|
||||||
if(rs.next()) {
|
if(rs.next()) {
|
||||||
|
@ -27,7 +27,7 @@ class ServerDatabase {
|
||||||
}
|
}
|
||||||
|
|
||||||
static int getPort(String name) {
|
static int getPort(String name) {
|
||||||
MySQL sql = Core.getDatabaseManager().getMySQL();
|
MySQL sql = Core.getCommons().getDatabaseManager().getMySQL();
|
||||||
try {
|
try {
|
||||||
ResultSet rs = sql.query("SELECT port FROM Servers WHERE name='" + name + "';");
|
ResultSet rs = sql.query("SELECT port FROM Servers WHERE name='" + name + "';");
|
||||||
if(rs.next()) {
|
if(rs.next()) {
|
||||||
|
@ -41,7 +41,7 @@ class ServerDatabase {
|
||||||
}
|
}
|
||||||
|
|
||||||
static String getMotd(String name) {
|
static String getMotd(String name) {
|
||||||
MySQL sql = Core.getDatabaseManager().getMySQL();
|
MySQL sql = Core.getCommons().getDatabaseManager().getMySQL();
|
||||||
try {
|
try {
|
||||||
ResultSet rs = sql.query("SELECT motd FROM Servers WHERE name='" + name + "';");
|
ResultSet rs = sql.query("SELECT motd FROM Servers WHERE name='" + name + "';");
|
||||||
if(rs.next()) {
|
if(rs.next()) {
|
||||||
|
|
|
@ -7,8 +7,6 @@ import org.bukkit.Bukkit;
|
||||||
import org.bukkit.GameMode;
|
import org.bukkit.GameMode;
|
||||||
import org.bukkit.plugin.PluginManager;
|
import org.bukkit.plugin.PluginManager;
|
||||||
|
|
||||||
import java.util.logging.Level;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @author joethei
|
* @author joethei
|
||||||
* @version 0.1
|
* @version 0.1
|
||||||
|
@ -58,7 +56,7 @@ public class ServerSettings {
|
||||||
PluginManager pm = Bukkit.getPluginManager();
|
PluginManager pm = Bukkit.getPluginManager();
|
||||||
new Build(Core.getInstance(), "build", "b");
|
new Build(Core.getInstance(), "build", "b");
|
||||||
pm.registerEvents(new Blocks(), Core.getInstance());
|
pm.registerEvents(new Blocks(), Core.getInstance());
|
||||||
Core.log(Level.INFO, "Build Modus aktiviert");
|
Core.getCommons().getLoggingHandler().getCore().info("Build Modus aktiviert");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -3,7 +3,6 @@ package eu.univento.core.api.server;
|
||||||
/**
|
/**
|
||||||
* @author joethei
|
* @author joethei
|
||||||
* @version 0.1
|
* @version 0.1
|
||||||
* Created at 08:39 on 20.07.2016.
|
|
||||||
*/
|
*/
|
||||||
public enum ServerType {
|
public enum ServerType {
|
||||||
|
|
||||||
|
|
|
@ -3,7 +3,6 @@ package eu.univento.core.api.shop;
|
||||||
/**
|
/**
|
||||||
* @author joethei
|
* @author joethei
|
||||||
* @version 0.1
|
* @version 0.1
|
||||||
* Created at 17:10 on 19.07.2016.
|
|
||||||
*/
|
*/
|
||||||
public enum PayType {
|
public enum PayType {
|
||||||
//TODO: change to real pay type names.
|
//TODO: change to real pay type names.
|
||||||
|
|
|
@ -5,7 +5,6 @@ import eu.univento.core.api.server.ServerType;
|
||||||
/**
|
/**
|
||||||
* @author joethei
|
* @author joethei
|
||||||
* @version 0.1
|
* @version 0.1
|
||||||
* Created at 08:36 on 20.07.2016.
|
|
||||||
*/
|
*/
|
||||||
enum ShopCategory {
|
enum ShopCategory {
|
||||||
|
|
||||||
|
|
|
@ -6,7 +6,6 @@ import org.bukkit.inventory.ItemStack;
|
||||||
/**
|
/**
|
||||||
* @author joethei
|
* @author joethei
|
||||||
* @version 0.1
|
* @version 0.1
|
||||||
* Created at 17:09 on 19.07.2016.
|
|
||||||
*/
|
*/
|
||||||
public enum ShopItem {
|
public enum ShopItem {
|
||||||
|
|
||||||
|
|
|
@ -16,7 +16,6 @@ import java.util.List;
|
||||||
/**
|
/**
|
||||||
* @author joethei
|
* @author joethei
|
||||||
* @version 0.1
|
* @version 0.1
|
||||||
* Created at 21:53 on 19.07.2016.
|
|
||||||
*/
|
*/
|
||||||
public class ShopMenu implements Listener{
|
public class ShopMenu implements Listener{
|
||||||
|
|
||||||
|
|
|
@ -15,7 +15,6 @@ import org.bukkit.plugin.Plugin;
|
||||||
/**
|
/**
|
||||||
* @author joethei
|
* @author joethei
|
||||||
* @version 0.1
|
* @version 0.1
|
||||||
* Created at 10:03 on 20.07.2016.
|
|
||||||
*/
|
*/
|
||||||
class ShopEntity implements Listener{
|
class ShopEntity implements Listener{
|
||||||
|
|
||||||
|
|
|
@ -8,7 +8,6 @@ import org.bukkit.plugin.Plugin;
|
||||||
/**
|
/**
|
||||||
* @author joethei
|
* @author joethei
|
||||||
* @version 0.1
|
* @version 0.1
|
||||||
* Created at 11:15 on 20.07.2016.
|
|
||||||
*/
|
*/
|
||||||
public class ShopIronGolem extends ShopEntity{
|
public class ShopIronGolem extends ShopEntity{
|
||||||
|
|
||||||
|
|
|
@ -9,7 +9,6 @@ import org.bukkit.plugin.Plugin;
|
||||||
/**
|
/**
|
||||||
* @author joethei
|
* @author joethei
|
||||||
* @version 0.1
|
* @version 0.1
|
||||||
* Created at 17:56 on 19.07.2016.
|
|
||||||
*/
|
*/
|
||||||
public class ShopVillager extends ShopEntity {
|
public class ShopVillager extends ShopEntity {
|
||||||
|
|
||||||
|
|
|
@ -44,7 +44,7 @@ public class GameProfileBuilder {
|
||||||
* @see GameProfile
|
* @see GameProfile
|
||||||
*/
|
*/
|
||||||
public static GameProfile fetch(UUID uuid) throws IOException {
|
public static GameProfile fetch(UUID uuid) throws IOException {
|
||||||
if (!false && cache.containsKey(uuid) && cache.get(uuid).isValid()) {
|
if (cache.containsKey(uuid) && cache.get(uuid).isValid()) {
|
||||||
return cache.get(uuid).profile;
|
return cache.get(uuid).profile;
|
||||||
} else {
|
} else {
|
||||||
HttpURLConnection connection = (HttpURLConnection) new URL(String.format(SERVICE_URL, UUIDTypeAdapter.fromUUID(uuid))).openConnection();
|
HttpURLConnection connection = (HttpURLConnection) new URL(String.format(SERVICE_URL, UUIDTypeAdapter.fromUUID(uuid))).openConnection();
|
||||||
|
|
|
@ -0,0 +1,60 @@
|
||||||
|
package eu.univento.core.api.utils;
|
||||||
|
|
||||||
|
import eu.univento.core.Core;
|
||||||
|
import org.bukkit.Material;
|
||||||
|
import org.bukkit.block.Block;
|
||||||
|
|
||||||
|
import java.lang.reflect.Field;
|
||||||
|
import java.lang.reflect.InvocationTargetException;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @author joethei
|
||||||
|
* @version 0.1
|
||||||
|
*/
|
||||||
|
public class Lamps {
|
||||||
|
|
||||||
|
private static Object getNMCWorld(Object cW) throws ClassNotFoundException {
|
||||||
|
return Class.forName("net.minecraft.server." + Core.getNMSVersion() + ".World", false, Core.class.getClassLoader()).cast(cW);
|
||||||
|
}
|
||||||
|
|
||||||
|
private static Object getCraftWorld(Object worldInstance) throws ClassNotFoundException, InstantiationException, IllegalAccessException {
|
||||||
|
return Class.forName("org.bukkit.craftbukkit." + Core.getNMSVersion() + ".CraftWorld", false, Core.class.getClassLoader()).cast(worldInstance);
|
||||||
|
}
|
||||||
|
|
||||||
|
private static Object getInstanceOfCW(Object cW) throws NoSuchMethodException, InvocationTargetException, IllegalAccessException {
|
||||||
|
return cW.getClass().getDeclaredMethod("getHandle").invoke(cW);
|
||||||
|
}
|
||||||
|
|
||||||
|
public static void switchLight(Block block, boolean light) {
|
||||||
|
try {
|
||||||
|
Object cW = getNMCWorld(getInstanceOfCW(getCraftWorld(block.getWorld())));
|
||||||
|
if (light) {
|
||||||
|
setWorldStatic(cW, true);
|
||||||
|
block.setType(Material.REDSTONE_LAMP_ON);
|
||||||
|
setWorldStatic(cW, false);
|
||||||
|
} else {
|
||||||
|
block.setType(Material.REDSTONE_LAMP_OFF);
|
||||||
|
}
|
||||||
|
} catch (Exception e) {
|
||||||
|
e.printStackTrace();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private static void setWorldStatic(Object cW, boolean static_boolean) throws IllegalAccessException {
|
||||||
|
Field field = null;
|
||||||
|
try {
|
||||||
|
field = cW.getClass().getField("isClientSide");
|
||||||
|
} catch (NoSuchFieldException e) {
|
||||||
|
try {
|
||||||
|
field = cW.getClass().getField("isStatic");
|
||||||
|
} catch (NoSuchFieldException e1) {
|
||||||
|
e1.printStackTrace();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
assert field != null;
|
||||||
|
field.setAccessible(true);
|
||||||
|
field.set(cW, static_boolean);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
|
@ -278,4 +278,40 @@ final class Maths
|
||||||
table[((int)(i * 45.511112F) & 0x3FFF)] = (float)Math.sin(i * 0.01745329F);
|
table[((int)(i * 45.511112F) & 0x3FFF)] = (float)Math.sin(i * 0.01745329F);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Compares two version strings.
|
||||||
|
*
|
||||||
|
* Use this instead of String.compareTo() for a non-lexicographical
|
||||||
|
* comparison that works for version strings. e.g. "1.10".compareTo("1.6").
|
||||||
|
*
|
||||||
|
* @note It does not work if "1.10" is supposed to be equal to "1.10.0".
|
||||||
|
*
|
||||||
|
* @param str1 a string of ordinal numbers separated by decimal points.
|
||||||
|
* @param str2 a string of ordinal numbers separated by decimal points.
|
||||||
|
* @return The result is a negative integer if str1 is _numerically_ less than str2.
|
||||||
|
* The result is a positive integer if str1 is _numerically_ greater than str2.
|
||||||
|
* The result is zero if the strings are _numerically_ equal.
|
||||||
|
*/
|
||||||
|
public static int versionCompare(String str1, String str2) {
|
||||||
|
String[] vals1 = str1.split("\\.");
|
||||||
|
String[] vals2 = str2.split("\\.");
|
||||||
|
int i = 0;
|
||||||
|
// set index to first non-equal ordinal or length of shortest version string
|
||||||
|
while (i < vals1.length && i < vals2.length && vals1[i].equals(vals2[i])) {
|
||||||
|
i++;
|
||||||
|
}
|
||||||
|
// compare first non-equal ordinal number
|
||||||
|
if (i < vals1.length && i < vals2.length) {
|
||||||
|
int diff = Integer.valueOf(vals1[i]).compareTo(Integer.valueOf(vals2[i]));
|
||||||
|
return Integer.signum(diff);
|
||||||
|
}
|
||||||
|
// the strings are equal or one string is a substring of the other
|
||||||
|
// e.g. "1.2.3" = "1.2.3" or "1.2.3" < "1.2.3.4"
|
||||||
|
return Integer.signum(vals1.length - vals2.length);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
|
@ -20,7 +20,7 @@ import java.util.Map;
|
||||||
* -== NettyInjection ==-
|
* -== NettyInjection ==-
|
||||||
*
|
*
|
||||||
* This library was created by @Ingrim4 and allows you to inject a handler inside a channel of a PlayerConnection.class to modify or avoid packets
|
* This library was created by @Ingrim4 and allows you to inject a handler inside a channel of a PlayerConnection.class to modify or avoid packets
|
||||||
* You need my IReflection class -> http://bit.ly/IReflect
|
* You need my IReflection class http://bit.ly/IReflect
|
||||||
* You are welcome to use it and redistribute it under the following conditions:
|
* You are welcome to use it and redistribute it under the following conditions:
|
||||||
* * Don't claim this class as your own
|
* * Don't claim this class as your own
|
||||||
* * Don't remove this disclaimer
|
* * Don't remove this disclaimer
|
||||||
|
@ -116,11 +116,9 @@ public class NettyInjection {
|
||||||
|
|
||||||
this.registerGlobalChannel();
|
this.registerGlobalChannel();
|
||||||
|
|
||||||
for (Player player : Bukkit.getOnlinePlayers())
|
Bukkit.getOnlinePlayers().forEach(this::inject);
|
||||||
this.inject(player);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@SuppressWarnings("unchecked")
|
|
||||||
private final void registerGlobalChannel() {
|
private final void registerGlobalChannel() {
|
||||||
Object server = NettyInjection.FIELD_CRAFTSERVER_MINECRAFTSERVER.get(Bukkit.getServer());
|
Object server = NettyInjection.FIELD_CRAFTSERVER_MINECRAFTSERVER.get(Bukkit.getServer());
|
||||||
Object connection = NettyInjection.FIELD_MINECRAFTSERVER_SERVERCONNECTION.get(server);
|
Object connection = NettyInjection.FIELD_MINECRAFTSERVER_SERVERCONNECTION.get(server);
|
||||||
|
@ -187,8 +185,7 @@ public class NettyInjection {
|
||||||
}
|
}
|
||||||
|
|
||||||
public final void disable() {
|
public final void disable() {
|
||||||
for (Player player : Bukkit.getOnlinePlayers())
|
Bukkit.getOnlinePlayers().forEach(this::uninject);
|
||||||
this.uninject(player);
|
|
||||||
HandlerList.unregisterAll(this.listener);
|
HandlerList.unregisterAll(this.listener);
|
||||||
this.unregisterGlobalChannel();
|
this.unregisterGlobalChannel();
|
||||||
}
|
}
|
||||||
|
|
|
@ -60,7 +60,6 @@ public final class ReflectionUtils {
|
||||||
* @return The constructor of the desired target class with the specified parameter types
|
* @return The constructor of the desired target class with the specified parameter types
|
||||||
* @throws NoSuchMethodException If the desired constructor with the specified parameter types cannot be found
|
* @throws NoSuchMethodException If the desired constructor with the specified parameter types cannot be found
|
||||||
* @throws ClassNotFoundException ClassNotFoundException If the desired target class with the specified name and package cannot be found
|
* @throws ClassNotFoundException ClassNotFoundException If the desired target class with the specified name and package cannot be found
|
||||||
* @see String, PackageType)
|
|
||||||
* @see #getConstructor(Class, Class...)
|
* @see #getConstructor(Class, Class...)
|
||||||
*/
|
*/
|
||||||
public static Constructor<?> getConstructor(String className, PackageType packageType, Class<?>... parameterTypes) throws NoSuchMethodException, ClassNotFoundException {
|
public static Constructor<?> getConstructor(String className, PackageType packageType, Class<?>... parameterTypes) throws NoSuchMethodException, ClassNotFoundException {
|
||||||
|
@ -96,7 +95,6 @@ public final class ReflectionUtils {
|
||||||
* @throws InvocationTargetException If the desired constructor cannot be invoked
|
* @throws InvocationTargetException If the desired constructor cannot be invoked
|
||||||
* @throws NoSuchMethodException If the desired constructor with the specified arguments cannot be found
|
* @throws NoSuchMethodException If the desired constructor with the specified arguments cannot be found
|
||||||
* @throws ClassNotFoundException If the desired target class with the specified name and package cannot be found
|
* @throws ClassNotFoundException If the desired target class with the specified name and package cannot be found
|
||||||
* @see String, PackageType)
|
|
||||||
* @see #instantiateObject(Class, Object...)
|
* @see #instantiateObject(Class, Object...)
|
||||||
*/
|
*/
|
||||||
public static Object instantiateObject(String className, PackageType packageType, Object... arguments) throws InstantiationException, IllegalAccessException, IllegalArgumentException, InvocationTargetException, NoSuchMethodException, ClassNotFoundException {
|
public static Object instantiateObject(String className, PackageType packageType, Object... arguments) throws InstantiationException, IllegalAccessException, IllegalArgumentException, InvocationTargetException, NoSuchMethodException, ClassNotFoundException {
|
||||||
|
@ -135,7 +133,6 @@ public final class ReflectionUtils {
|
||||||
* @return The method of the desired target class with the specified name and parameter types
|
* @return The method of the desired target class with the specified name and parameter types
|
||||||
* @throws NoSuchMethodException If the desired method of the desired target class with the specified name and parameter types cannot be found
|
* @throws NoSuchMethodException If the desired method of the desired target class with the specified name and parameter types cannot be found
|
||||||
* @throws ClassNotFoundException If the desired target class with the specified name and package cannot be found
|
* @throws ClassNotFoundException If the desired target class with the specified name and package cannot be found
|
||||||
* @see String, PackageType)
|
|
||||||
* @see #getMethod(Class, String, Class...)
|
* @see #getMethod(Class, String, Class...)
|
||||||
*/
|
*/
|
||||||
public static Method getMethod(String className, PackageType packageType, String methodName, Class<?>... parameterTypes) throws NoSuchMethodException, ClassNotFoundException {
|
public static Method getMethod(String className, PackageType packageType, String methodName, Class<?>... parameterTypes) throws NoSuchMethodException, ClassNotFoundException {
|
||||||
|
@ -193,7 +190,6 @@ public final class ReflectionUtils {
|
||||||
* @throws InvocationTargetException If the desired method cannot be invoked on the target object
|
* @throws InvocationTargetException If the desired method cannot be invoked on the target object
|
||||||
* @throws NoSuchMethodException If the desired method of the desired target class with the specified name and arguments cannot be found
|
* @throws NoSuchMethodException If the desired method of the desired target class with the specified name and arguments cannot be found
|
||||||
* @throws ClassNotFoundException If the desired target class with the specified name and package cannot be found
|
* @throws ClassNotFoundException If the desired target class with the specified name and package cannot be found
|
||||||
* @see String, PackageType)
|
|
||||||
* @see #invokeMethod(Object, Class, String, Object...)
|
* @see #invokeMethod(Object, Class, String, Object...)
|
||||||
*/
|
*/
|
||||||
public static Object invokeMethod(Object instance, String className, PackageType packageType, String methodName, Object... arguments) throws IllegalAccessException, IllegalArgumentException, InvocationTargetException, NoSuchMethodException, ClassNotFoundException {
|
public static Object invokeMethod(Object instance, String className, PackageType packageType, String methodName, Object... arguments) throws IllegalAccessException, IllegalArgumentException, InvocationTargetException, NoSuchMethodException, ClassNotFoundException {
|
||||||
|
@ -354,7 +350,7 @@ public final class ReflectionUtils {
|
||||||
CRAFTBUKKIT("org.bukkit.craftbukkit." + getServerVersion()),
|
CRAFTBUKKIT("org.bukkit.craftbukkit." + getServerVersion()),
|
||||||
CRAFTBUKKIT_BLOCK(CRAFTBUKKIT, "block"),
|
CRAFTBUKKIT_BLOCK(CRAFTBUKKIT, "block"),
|
||||||
CRAFTBUKKIT_CHUNKIO(CRAFTBUKKIT, "chunkio"),
|
CRAFTBUKKIT_CHUNKIO(CRAFTBUKKIT, "chunkio"),
|
||||||
CRAFTBUKKIT_COMMAND(CRAFTBUKKIT, "command"),
|
CRAFTBUKKIT_COMMAND(CRAFTBUKKIT, "commons"),
|
||||||
CRAFTBUKKIT_CONVERSATIONS(CRAFTBUKKIT, "conversations"),
|
CRAFTBUKKIT_CONVERSATIONS(CRAFTBUKKIT, "conversations"),
|
||||||
CRAFTBUKKIT_ENCHANTMENS(CRAFTBUKKIT, "enchantments"),
|
CRAFTBUKKIT_ENCHANTMENS(CRAFTBUKKIT, "enchantments"),
|
||||||
CRAFTBUKKIT_ENTITY(CRAFTBUKKIT, "entity"),
|
CRAFTBUKKIT_ENTITY(CRAFTBUKKIT, "entity"),
|
||||||
|
@ -368,7 +364,7 @@ public final class ReflectionUtils {
|
||||||
CRAFTBUKKIT_PROJECTILES(CRAFTBUKKIT, "projectiles"),
|
CRAFTBUKKIT_PROJECTILES(CRAFTBUKKIT, "projectiles"),
|
||||||
CRAFTBUKKIT_SCHEDULER(CRAFTBUKKIT, "scheduler"),
|
CRAFTBUKKIT_SCHEDULER(CRAFTBUKKIT, "scheduler"),
|
||||||
CRAFTBUKKIT_SCOREBOARD(CRAFTBUKKIT, "scoreboard"),
|
CRAFTBUKKIT_SCOREBOARD(CRAFTBUKKIT, "scoreboard"),
|
||||||
CRAFTBUKKIT_UPDATER(CRAFTBUKKIT, "updater"),
|
CRAFTBUKKIT_UPDATER(CRAFTBUKKIT, "Updater"),
|
||||||
CRAFTBUKKIT_UTIL(CRAFTBUKKIT, "util");
|
CRAFTBUKKIT_UTIL(CRAFTBUKKIT, "util");
|
||||||
|
|
||||||
private final String path;
|
private final String path;
|
||||||
|
|
|
@ -1,10 +1,10 @@
|
||||||
package eu.univento.core.commands;
|
package eu.univento.core.commands;
|
||||||
|
|
||||||
|
import eu.univento.commons.player.Rank;
|
||||||
import eu.univento.core.Core;
|
import eu.univento.core.Core;
|
||||||
import eu.univento.core.api.AutoCommand;
|
import eu.univento.core.api.AutoCommand;
|
||||||
import eu.univento.core.api.languages.Messages;
|
import eu.univento.core.api.languages.Messages;
|
||||||
import eu.univento.core.api.player.CustomPlayer;
|
import eu.univento.core.api.player.CustomPlayer;
|
||||||
import eu.univento.core.api.player.Rank;
|
|
||||||
import eu.univento.core.api.server.ServerSettings;
|
import eu.univento.core.api.server.ServerSettings;
|
||||||
import org.bukkit.GameMode;
|
import org.bukkit.GameMode;
|
||||||
import org.bukkit.command.CommandSender;
|
import org.bukkit.command.CommandSender;
|
||||||
|
@ -35,8 +35,9 @@ public class Build extends AutoCommand<Core>{
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param plugin main class
|
* @param plugin main class
|
||||||
* @param description describes the command
|
* @param command command
|
||||||
* @param aliases aliases of command
|
* @param description describes the commons
|
||||||
|
* @param aliases aliases of commons
|
||||||
*/
|
*/
|
||||||
public Build(Core plugin, String command, String description, String... aliases) {
|
public Build(Core plugin, String command, String description, String... aliases) {
|
||||||
super(plugin, command, description, aliases);
|
super(plugin, command, description, aliases);
|
||||||
|
@ -47,7 +48,7 @@ public class Build extends AutoCommand<Core>{
|
||||||
if(sender instanceof Player) {
|
if(sender instanceof Player) {
|
||||||
CustomPlayer p = CustomPlayer.getPlayer(sender.getName());
|
CustomPlayer p = CustomPlayer.getPlayer(sender.getName());
|
||||||
Messages msgs = new Messages(p);
|
Messages msgs = new Messages(p);
|
||||||
if(p.isAllowed(Rank.Builder)) {
|
if(p.getDatabasePlayer().isAllowed(Rank.Builder)) {
|
||||||
if(players.containsKey(p)) {
|
if(players.containsKey(p)) {
|
||||||
p.sendMessage(msgs.PREFIX() + msgs.Core_BUILD_OFF());
|
p.sendMessage(msgs.PREFIX() + msgs.Core_BUILD_OFF());
|
||||||
|
|
||||||
|
|
|
@ -1,10 +1,10 @@
|
||||||
package eu.univento.core.commands;
|
package eu.univento.core.commands;
|
||||||
|
|
||||||
|
import eu.univento.commons.player.Rank;
|
||||||
import eu.univento.core.Core;
|
import eu.univento.core.Core;
|
||||||
import eu.univento.core.api.AutoCommand;
|
import eu.univento.core.api.AutoCommand;
|
||||||
import eu.univento.core.api.languages.Messages;
|
import eu.univento.core.api.languages.Messages;
|
||||||
import eu.univento.core.api.player.CustomPlayer;
|
import eu.univento.core.api.player.CustomPlayer;
|
||||||
import eu.univento.core.api.player.Rank;
|
|
||||||
import org.bukkit.Bukkit;
|
import org.bukkit.Bukkit;
|
||||||
import org.bukkit.command.CommandSender;
|
import org.bukkit.command.CommandSender;
|
||||||
import org.bukkit.entity.Player;
|
import org.bukkit.entity.Player;
|
||||||
|
@ -26,13 +26,13 @@ public class ChatClear extends AutoCommand<Core> {
|
||||||
if(sender instanceof Player) {
|
if(sender instanceof Player) {
|
||||||
CustomPlayer p = CustomPlayer.getPlayer(sender.getName());
|
CustomPlayer p = CustomPlayer.getPlayer(sender.getName());
|
||||||
Messages msgs = new Messages(p);
|
Messages msgs = new Messages(p);
|
||||||
if(p.isAllowed(Rank.Supporter)) {
|
if(p.getDatabasePlayer().isAllowed(Rank.Supporter)) {
|
||||||
for(int i = 0; i <= 100; i++) {
|
for(int i = 0; i <= 100; i++) {
|
||||||
Bukkit.broadcastMessage(" ");
|
Bukkit.broadcastMessage(" ");
|
||||||
}
|
}
|
||||||
for(Player players : Bukkit.getOnlinePlayers()) {
|
for(Player players : Bukkit.getOnlinePlayers()) {
|
||||||
CustomPlayer player = CustomPlayer.getPlayer(players);
|
CustomPlayer player = CustomPlayer.getPlayer(players);
|
||||||
if (player.isAllowed(Rank.Supporter)) {
|
if (player.getDatabasePlayer().isAllowed(Rank.Supporter)) {
|
||||||
Messages messages = new Messages(player);
|
Messages messages = new Messages(player);
|
||||||
player.sendMessage(messages.Core_CHAT_CLEARED(p));
|
player.sendMessage(messages.Core_CHAT_CLEARED(p));
|
||||||
}
|
}
|
||||||
|
|
|
@ -20,9 +20,9 @@ public class Fix extends AutoCommand<Core>{
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param plugin main class
|
* @param plugin main class
|
||||||
* @param command command to execute
|
* @param command commons to execute
|
||||||
* @param description describes the command
|
* @param description describes the commons
|
||||||
* @param aliases aliases of command
|
* @param aliases aliases of commons
|
||||||
*/
|
*/
|
||||||
public Fix(Core plugin, String command, String description, String... aliases) {
|
public Fix(Core plugin, String command, String description, String... aliases) {
|
||||||
super(plugin, command, description, aliases);
|
super(plugin, command, description, aliases);
|
||||||
|
|
|
@ -1,10 +1,10 @@
|
||||||
package eu.univento.core.commands;
|
package eu.univento.core.commands;
|
||||||
|
|
||||||
|
import eu.univento.commons.player.Rank;
|
||||||
import eu.univento.core.Core;
|
import eu.univento.core.Core;
|
||||||
import eu.univento.core.api.AutoCommand;
|
import eu.univento.core.api.AutoCommand;
|
||||||
import eu.univento.core.api.languages.Messages;
|
import eu.univento.core.api.languages.Messages;
|
||||||
import eu.univento.core.api.player.CustomPlayer;
|
import eu.univento.core.api.player.CustomPlayer;
|
||||||
import eu.univento.core.api.player.Rank;
|
|
||||||
import org.bukkit.command.CommandSender;
|
import org.bukkit.command.CommandSender;
|
||||||
import org.bukkit.entity.Player;
|
import org.bukkit.entity.Player;
|
||||||
|
|
||||||
|
@ -20,8 +20,9 @@ public class GameMode extends AutoCommand<Core>{
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param plugin main class
|
* @param plugin main class
|
||||||
* @param command command to execute
|
* @param description command description
|
||||||
* @param aliases aliases of command
|
* @param command commons to execute
|
||||||
|
* @param aliases aliases of commons
|
||||||
*/
|
*/
|
||||||
public GameMode(Core plugin, String command, String description, String... aliases) {
|
public GameMode(Core plugin, String command, String description, String... aliases) {
|
||||||
super(plugin, command, description, aliases);
|
super(plugin, command, description, aliases);
|
||||||
|
@ -32,7 +33,7 @@ public class GameMode extends AutoCommand<Core>{
|
||||||
if(sender instanceof Player) {
|
if(sender instanceof Player) {
|
||||||
CustomPlayer p = CustomPlayer.getPlayer(sender.getName());
|
CustomPlayer p = CustomPlayer.getPlayer(sender.getName());
|
||||||
Messages msgs = new Messages(p);
|
Messages msgs = new Messages(p);
|
||||||
if(p.isAllowed(Rank.Builder)) {
|
if(p.getDatabasePlayer().isAllowed(Rank.Builder)) {
|
||||||
if(args.length == 1) {
|
if(args.length == 1) {
|
||||||
String mode = args[0];
|
String mode = args[0];
|
||||||
p.setGameMode(getModeFromString(mode));
|
p.setGameMode(getModeFromString(mode));
|
||||||
|
|
|
@ -1,10 +1,10 @@
|
||||||
package eu.univento.core.commands;
|
package eu.univento.core.commands;
|
||||||
|
|
||||||
|
import eu.univento.commons.player.Rank;
|
||||||
import eu.univento.core.Core;
|
import eu.univento.core.Core;
|
||||||
import eu.univento.core.api.AutoCommand;
|
import eu.univento.core.api.AutoCommand;
|
||||||
import eu.univento.core.api.languages.Messages;
|
import eu.univento.core.api.languages.Messages;
|
||||||
import eu.univento.core.api.player.CustomPlayer;
|
import eu.univento.core.api.player.CustomPlayer;
|
||||||
import eu.univento.core.api.player.Rank;
|
|
||||||
import eu.univento.core.api.server.ServerSettings;
|
import eu.univento.core.api.server.ServerSettings;
|
||||||
import org.bukkit.command.CommandSender;
|
import org.bukkit.command.CommandSender;
|
||||||
import org.bukkit.entity.Player;
|
import org.bukkit.entity.Player;
|
||||||
|
@ -20,9 +20,9 @@ public class GlobalMute extends AutoCommand<Core>{
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param plugin main class
|
* @param plugin main class
|
||||||
* @param command command to execute
|
* @param command commons to execute
|
||||||
* @param description describes the command
|
* @param description describes the commons
|
||||||
* @param aliases aliases of command
|
* @param aliases aliases of commons
|
||||||
*/
|
*/
|
||||||
public GlobalMute(Core plugin, String command, String description, String... aliases) {
|
public GlobalMute(Core plugin, String command, String description, String... aliases) {
|
||||||
super(plugin, command, description, aliases);
|
super(plugin, command, description, aliases);
|
||||||
|
@ -33,7 +33,7 @@ public class GlobalMute extends AutoCommand<Core>{
|
||||||
if(sender instanceof Player) {
|
if(sender instanceof Player) {
|
||||||
CustomPlayer p = CustomPlayer.getPlayer(sender.getName());
|
CustomPlayer p = CustomPlayer.getPlayer(sender.getName());
|
||||||
Messages msgs = new Messages(p);
|
Messages msgs = new Messages(p);
|
||||||
if(p.isAllowed(Rank.Supporter)) {
|
if(p.getDatabasePlayer().isAllowed(Rank.Supporter)) {
|
||||||
if(ServerSettings.isMute()) {
|
if(ServerSettings.isMute()) {
|
||||||
ServerSettings.setMute(false);
|
ServerSettings.setMute(false);
|
||||||
p.sendMessage(msgs.Core_GLOBALMUTE_OFF());
|
p.sendMessage(msgs.Core_GLOBALMUTE_OFF());
|
||||||
|
|
|
@ -1,18 +1,18 @@
|
||||||
package eu.univento.core.commands;
|
package eu.univento.core.commands;
|
||||||
|
|
||||||
|
import eu.univento.commons.player.Rank;
|
||||||
import eu.univento.core.Core;
|
import eu.univento.core.Core;
|
||||||
import eu.univento.core.api.AutoCommand;
|
import eu.univento.core.api.AutoCommand;
|
||||||
import eu.univento.core.api.languages.Messages;
|
import eu.univento.core.api.languages.Messages;
|
||||||
import eu.univento.core.api.player.CustomPlayer;
|
import eu.univento.core.api.player.CustomPlayer;
|
||||||
import eu.univento.core.api.player.NickName;
|
import eu.univento.core.api.player.NickName;
|
||||||
import eu.univento.core.api.player.Rank;
|
|
||||||
import org.bukkit.command.CommandSender;
|
import org.bukkit.command.CommandSender;
|
||||||
import org.bukkit.entity.Player;
|
import org.bukkit.entity.Player;
|
||||||
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* nick command
|
* nick commons
|
||||||
* @author joethei
|
* @author joethei
|
||||||
* @version 1.0
|
* @version 1.0
|
||||||
*/
|
*/
|
||||||
|
@ -20,9 +20,9 @@ public class Nick extends AutoCommand<Core>{
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param plugin main class
|
* @param plugin main class
|
||||||
* @param command command to execute
|
* @param command commons to execute
|
||||||
* @param description describes the command
|
* @param description describes the commons
|
||||||
* @param aliases aliases of command
|
* @param aliases aliases of commons
|
||||||
*/
|
*/
|
||||||
public Nick(Core plugin, String command, String description, String... aliases) {
|
public Nick(Core plugin, String command, String description, String... aliases) {
|
||||||
super(plugin, command, description, aliases);
|
super(plugin, command, description, aliases);
|
||||||
|
@ -34,17 +34,17 @@ public class Nick extends AutoCommand<Core>{
|
||||||
if(sender instanceof Player) {
|
if(sender instanceof Player) {
|
||||||
CustomPlayer p = CustomPlayer.getPlayer(sender.getName());
|
CustomPlayer p = CustomPlayer.getPlayer(sender.getName());
|
||||||
Messages msgs = new Messages(p);
|
Messages msgs = new Messages(p);
|
||||||
if(p.isAllowed(Rank.Partner)) {
|
if(p.getDatabasePlayer().isAllowed(Rank.Partner)) {
|
||||||
if(p.isNicked()) {
|
if(p.getDatabasePlayer().getSettings().isNicked()) {
|
||||||
p.getTeam().removeEntry(p.getDisplayName());
|
p.getScoreboard().getTeam(p.getDatabasePlayer().getRank().getTeam()).removeEntry(p.getDisplayName());
|
||||||
p.setNicked(false);
|
p.getDatabasePlayer().getSettings().setNickStatus(false);
|
||||||
p.getTeam().addEntry(p.getDisplayName());
|
p.getScoreboard().getTeam(p.getDatabasePlayer().getRank().getTeam()).addEntry(p.getDisplayName());
|
||||||
p.sendMessage(msgs.PREFIX() + msgs.Core_NICK_OFF());
|
p.sendMessage(msgs.PREFIX() + msgs.Core_NICK_OFF());
|
||||||
p.removeNick();
|
p.removeNick();
|
||||||
}else {
|
}else {
|
||||||
p.getTeam().removeEntry(p.getDisplayName());
|
p.getScoreboard().getTeam(p.getDatabasePlayer().getRank().getTeam()).removeEntry(p.getDisplayName());
|
||||||
p.setNicked(true);
|
p.getDatabasePlayer().getSettings().setNickStatus(true);
|
||||||
p.getTeam().addEntry(p.getDisplayName());
|
p.getScoreboard().getTeam(p.getDatabasePlayer().getRank().getTeam()).addEntry(p.getDisplayName());
|
||||||
p.sendMessage(msgs.PREFIX() + msgs.Core_NICK_ON());
|
p.sendMessage(msgs.PREFIX() + msgs.Core_NICK_ON());
|
||||||
p.setNick(NickName.getRandomNick());
|
p.setNick(NickName.getRandomNick());
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,10 +1,10 @@
|
||||||
package eu.univento.core.commands;
|
package eu.univento.core.commands;
|
||||||
|
|
||||||
|
import eu.univento.commons.player.Rank;
|
||||||
import eu.univento.core.Core;
|
import eu.univento.core.Core;
|
||||||
import eu.univento.core.api.AutoCommand;
|
import eu.univento.core.api.AutoCommand;
|
||||||
import eu.univento.core.api.languages.Messages;
|
import eu.univento.core.api.languages.Messages;
|
||||||
import eu.univento.core.api.player.CustomPlayer;
|
import eu.univento.core.api.player.CustomPlayer;
|
||||||
import eu.univento.core.api.player.Rank;
|
|
||||||
import org.bukkit.Bukkit;
|
import org.bukkit.Bukkit;
|
||||||
import org.bukkit.command.CommandSender;
|
import org.bukkit.command.CommandSender;
|
||||||
import org.bukkit.entity.Player;
|
import org.bukkit.entity.Player;
|
||||||
|
@ -21,9 +21,9 @@ public class RunAs extends AutoCommand<Core>{
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param plugin main class
|
* @param plugin main class
|
||||||
* @param command command to execute
|
* @param command commons to execute
|
||||||
* @param description describes the command
|
* @param description describes the commons
|
||||||
* @param aliases aliases of command
|
* @param aliases aliases of commons
|
||||||
*/
|
*/
|
||||||
public RunAs(Core plugin, String command, String description, String... aliases) {
|
public RunAs(Core plugin, String command, String description, String... aliases) {
|
||||||
super(plugin, command, description, aliases);
|
super(plugin, command, description, aliases);
|
||||||
|
@ -35,7 +35,7 @@ public class RunAs extends AutoCommand<Core>{
|
||||||
if(sender instanceof Player) {
|
if(sender instanceof Player) {
|
||||||
CustomPlayer p = CustomPlayer.getPlayer(sender.getName());
|
CustomPlayer p = CustomPlayer.getPlayer(sender.getName());
|
||||||
Messages msgs = new Messages(p);
|
Messages msgs = new Messages(p);
|
||||||
if(p.isAllowed(Rank.SrDeveloper)) {
|
if(p.getDatabasePlayer().isAllowed(Rank.SrDeveloper)) {
|
||||||
if(args.length >= 2) {
|
if(args.length >= 2) {
|
||||||
CustomPlayer t = CustomPlayer.getPlayer(Bukkit.getPlayer(args[0]).getName());
|
CustomPlayer t = CustomPlayer.getPlayer(Bukkit.getPlayer(args[0]).getName());
|
||||||
if(t != null) {
|
if(t != null) {
|
||||||
|
|
|
@ -1,10 +1,10 @@
|
||||||
package eu.univento.core.commands;
|
package eu.univento.core.commands;
|
||||||
|
|
||||||
|
import eu.univento.commons.player.Rank;
|
||||||
import eu.univento.core.Core;
|
import eu.univento.core.Core;
|
||||||
import eu.univento.core.api.AutoCommand;
|
import eu.univento.core.api.AutoCommand;
|
||||||
import eu.univento.core.api.languages.Messages;
|
import eu.univento.core.api.languages.Messages;
|
||||||
import eu.univento.core.api.player.CustomPlayer;
|
import eu.univento.core.api.player.CustomPlayer;
|
||||||
import eu.univento.core.api.player.Rank;
|
|
||||||
import org.bukkit.Bukkit;
|
import org.bukkit.Bukkit;
|
||||||
import org.bukkit.command.CommandSender;
|
import org.bukkit.command.CommandSender;
|
||||||
import org.bukkit.entity.Player;
|
import org.bukkit.entity.Player;
|
||||||
|
@ -27,45 +27,45 @@ public class SetRank extends AutoCommand<Core>{
|
||||||
public boolean execute(CommandSender sender, String label, String[] args) {
|
public boolean execute(CommandSender sender, String label, String[] args) {
|
||||||
if(sender instanceof Player) {
|
if(sender instanceof Player) {
|
||||||
CustomPlayer p = CustomPlayer.getPlayer(sender.getName());
|
CustomPlayer p = CustomPlayer.getPlayer(sender.getName());
|
||||||
if(p.isAllowed(Rank.SrBuilder)) {
|
if(p.getDatabasePlayer().isAllowed(Rank.SrBuilder)) {
|
||||||
if(args.length == 2) {
|
if(args.length == 2) {
|
||||||
Rank rank;
|
Rank rank;
|
||||||
try{
|
try{
|
||||||
rank = Rank.valueOf(args[1]);
|
rank = Rank.valueOf(args[1]);
|
||||||
if(Bukkit.getPlayer(args[0]) != null) {
|
if(Bukkit.getPlayer(args[0]) != null) {
|
||||||
CustomPlayer player = CustomPlayer.getPlayer(args[0]);
|
CustomPlayer player = CustomPlayer.getPlayer(args[0]);
|
||||||
if(player.isAllowed(rank)) {
|
if(player.getDatabasePlayer().isAllowed(rank)) {
|
||||||
p.sendMessage(p.getMessages().PREFIX() + "§cDer Spieler hat den Rang schon oder ist besser.");
|
p.sendMessage(p.getMessages().PREFIX() + "§cDer Spieler hat den Rang schon oder ist besser.");
|
||||||
p.sendMessage(p.getMessages().PREFIX() + "§cÄnderungen müssen in der Datenbank stattfinden.");
|
p.sendMessage(p.getMessages().PREFIX() + "§cÄnderungen müssen in der Datenbank stattfinden.");
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
if(p.isAllowed(Rank.Admin)) {
|
if(p.getDatabasePlayer().isAllowed(Rank.Admin)) {
|
||||||
player.setRank(rank);
|
player.getDatabasePlayer().setRank(rank);
|
||||||
p.sendMessage(p.getMessages().PREFIX() + p.getMessages().Core_SETRANK_SET(player, player.getRank()));
|
p.sendMessage(p.getMessages().PREFIX() + p.getMessages().Core_SETRANK_SET(player, player.getDatabasePlayer().getRank()));
|
||||||
refreshTablist();
|
refreshTablist();
|
||||||
}
|
}
|
||||||
if(p.isAllowed(Rank.SrDeveloper) && rank.equals(Rank.Developer)) {
|
if(p.getDatabasePlayer().isAllowed(Rank.SrDeveloper) && rank.equals(Rank.Developer)) {
|
||||||
player.setRank(Rank.Developer);
|
player.getDatabasePlayer().setRank(Rank.Developer);
|
||||||
p.sendMessage(p.getMessages().PREFIX() + p.getMessages().Core_SETRANK_SET(player, Rank.Developer));
|
p.sendMessage(p.getMessages().PREFIX() + p.getMessages().Core_SETRANK_SET(player, Rank.Developer));
|
||||||
refreshTablist();
|
refreshTablist();
|
||||||
}
|
}
|
||||||
if(p.isAllowed(Rank.SrSupporter) && rank.equals(Rank.Supporter)) {
|
if(p.getDatabasePlayer().isAllowed(Rank.SrSupporter) && rank.equals(Rank.Supporter)) {
|
||||||
player.setRank(Rank.Supporter);
|
player.getDatabasePlayer().setRank(Rank.Supporter);
|
||||||
p.sendMessage(p.getMessages().PREFIX() + p.getMessages().Core_SETRANK_SET(player, Rank.Supporter));
|
p.sendMessage(p.getMessages().PREFIX() + p.getMessages().Core_SETRANK_SET(player, Rank.Supporter));
|
||||||
refreshTablist();
|
refreshTablist();
|
||||||
}
|
}
|
||||||
if(p.isAllowed(Rank.SrSupporter) && rank.equals(Rank.JrSupporter)) {
|
if(p.getDatabasePlayer().isAllowed(Rank.SrSupporter) && rank.equals(Rank.JrSupporter)) {
|
||||||
player.setRank(Rank.JrSupporter);
|
player.getDatabasePlayer().setRank(Rank.JrSupporter);
|
||||||
p.sendMessage(p.getMessages().PREFIX() + p.getMessages().Core_SETRANK_SET(player, Rank.JrSupporter));
|
p.sendMessage(p.getMessages().PREFIX() + p.getMessages().Core_SETRANK_SET(player, Rank.JrSupporter));
|
||||||
refreshTablist();
|
refreshTablist();
|
||||||
}
|
}
|
||||||
if(p.isAllowed(Rank.SrBuilder) && rank.equals(Rank.Builder)) {
|
if(p.getDatabasePlayer().isAllowed(Rank.SrBuilder) && rank.equals(Rank.Builder)) {
|
||||||
player.setRank(Rank.Builder);
|
player.getDatabasePlayer().setRank(Rank.Builder);
|
||||||
p.sendMessage(p.getMessages().PREFIX() + p.getMessages().Core_SETRANK_SET(player, Rank.Builder));
|
p.sendMessage(p.getMessages().PREFIX() + p.getMessages().Core_SETRANK_SET(player, Rank.Builder));
|
||||||
refreshTablist();
|
refreshTablist();
|
||||||
}
|
}
|
||||||
if(p.isAllowed(Rank.SrBuilder) && rank.equals(Rank.JrBuilder)) {
|
if(p.getDatabasePlayer().isAllowed(Rank.SrBuilder) && rank.equals(Rank.JrBuilder)) {
|
||||||
player.setRank(Rank.JrBuilder);
|
player.getDatabasePlayer().setRank(Rank.JrBuilder);
|
||||||
p.sendMessage(p.getMessages().PREFIX() + p.getMessages().Core_SETRANK_SET(player, Rank.JrBuilder));
|
p.sendMessage(p.getMessages().PREFIX() + p.getMessages().Core_SETRANK_SET(player, Rank.JrBuilder));
|
||||||
refreshTablist();
|
refreshTablist();
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,10 +1,11 @@
|
||||||
package eu.univento.core.commands;
|
package eu.univento.core.commands;
|
||||||
|
|
||||||
|
import eu.univento.commons.player.Rank;
|
||||||
|
import eu.univento.commons.server.TPS;
|
||||||
import eu.univento.core.Core;
|
import eu.univento.core.Core;
|
||||||
import eu.univento.core.api.AutoCommand;
|
import eu.univento.core.api.AutoCommand;
|
||||||
import eu.univento.core.api.languages.Messages;
|
import eu.univento.core.api.languages.Messages;
|
||||||
import eu.univento.core.api.player.CustomPlayer;
|
import eu.univento.core.api.player.CustomPlayer;
|
||||||
import eu.univento.core.api.player.Rank;
|
|
||||||
import org.bukkit.Bukkit;
|
import org.bukkit.Bukkit;
|
||||||
import org.bukkit.command.CommandSender;
|
import org.bukkit.command.CommandSender;
|
||||||
import org.bukkit.entity.Player;
|
import org.bukkit.entity.Player;
|
||||||
|
@ -22,9 +23,9 @@ public class SystemInfo extends AutoCommand<Core>{
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param plugin main class
|
* @param plugin main class
|
||||||
* @param command command to execute
|
* @param command commons to execute
|
||||||
* @param description describes the command
|
* @param description describes the commons
|
||||||
* @param aliases aliases of command
|
* @param aliases aliases of commons
|
||||||
*/
|
*/
|
||||||
public SystemInfo(Core plugin, String command, String description, String... aliases) {
|
public SystemInfo(Core plugin, String command, String description, String... aliases) {
|
||||||
super(plugin, command, description, aliases);
|
super(plugin, command, description, aliases);
|
||||||
|
@ -35,7 +36,7 @@ public class SystemInfo extends AutoCommand<Core>{
|
||||||
if(sender instanceof Player) {
|
if(sender instanceof Player) {
|
||||||
CustomPlayer p = CustomPlayer.getPlayer(sender.getName());
|
CustomPlayer p = CustomPlayer.getPlayer(sender.getName());
|
||||||
Messages msgs = new Messages(p);
|
Messages msgs = new Messages(p);
|
||||||
if(p.isAllowed(Rank.Developer)) {
|
if(p.getDatabasePlayer().isAllowed(Rank.Developer)) {
|
||||||
Runtime run = Runtime.getRuntime();
|
Runtime run = Runtime.getRuntime();
|
||||||
p.sendMessage("§6§l===SystemInfo <" + Bukkit.getServerName() + ">===");
|
p.sendMessage("§6§l===SystemInfo <" + Bukkit.getServerName() + ">===");
|
||||||
try {
|
try {
|
||||||
|
@ -43,6 +44,7 @@ public class SystemInfo extends AutoCommand<Core>{
|
||||||
} catch (UnknownHostException e) {
|
} catch (UnknownHostException e) {
|
||||||
e.printStackTrace();
|
e.printStackTrace();
|
||||||
}
|
}
|
||||||
|
p.sendMessage("§6TPS: " + TPS.getTPS());
|
||||||
p.sendMessage("§6Spigot version: " + Bukkit.getVersion());
|
p.sendMessage("§6Spigot version: " + Bukkit.getVersion());
|
||||||
p.sendMessage("§6Java version: " + System.getProperty("java.version"));
|
p.sendMessage("§6Java version: " + System.getProperty("java.version"));
|
||||||
p.sendMessage("§6OS: " + System.getProperty("os.name"));
|
p.sendMessage("§6OS: " + System.getProperty("os.name"));
|
||||||
|
|
|
@ -1,10 +1,10 @@
|
||||||
package eu.univento.core.commands;
|
package eu.univento.core.commands;
|
||||||
|
|
||||||
|
import eu.univento.commons.player.Rank;
|
||||||
import eu.univento.core.Core;
|
import eu.univento.core.Core;
|
||||||
import eu.univento.core.api.AutoCommand;
|
import eu.univento.core.api.AutoCommand;
|
||||||
import eu.univento.core.api.languages.Messages;
|
import eu.univento.core.api.languages.Messages;
|
||||||
import eu.univento.core.api.player.CustomPlayer;
|
import eu.univento.core.api.player.CustomPlayer;
|
||||||
import eu.univento.core.api.player.Rank;
|
|
||||||
import org.bukkit.Bukkit;
|
import org.bukkit.Bukkit;
|
||||||
import org.bukkit.command.CommandSender;
|
import org.bukkit.command.CommandSender;
|
||||||
import org.bukkit.entity.Player;
|
import org.bukkit.entity.Player;
|
||||||
|
@ -14,7 +14,6 @@ import java.util.List;
|
||||||
/**
|
/**
|
||||||
* @author joethei
|
* @author joethei
|
||||||
* @version 0.1
|
* @version 0.1
|
||||||
* Created at 17:54 on 27.07.2016.
|
|
||||||
*/
|
*/
|
||||||
public class Timeout extends AutoCommand<Core> {
|
public class Timeout extends AutoCommand<Core> {
|
||||||
|
|
||||||
|
@ -26,7 +25,7 @@ public class Timeout extends AutoCommand<Core> {
|
||||||
public boolean execute(CommandSender sender, String label, String[] args) {
|
public boolean execute(CommandSender sender, String label, String[] args) {
|
||||||
if (sender instanceof Player) {
|
if (sender instanceof Player) {
|
||||||
CustomPlayer p = CustomPlayer.getPlayer((Player) sender);
|
CustomPlayer p = CustomPlayer.getPlayer((Player) sender);
|
||||||
if (p.isAllowed(Rank.SrDeveloper)) {
|
if (p.getDatabasePlayer().isAllowed(Rank.SrDeveloper)) {
|
||||||
if (args.length == 1) {
|
if (args.length == 1) {
|
||||||
if (Bukkit.getPlayer(args[0]) != null) {
|
if (Bukkit.getPlayer(args[0]) != null) {
|
||||||
CustomPlayer t = CustomPlayer.getPlayer(args[0]);
|
CustomPlayer t = CustomPlayer.getPlayer(args[0]);
|
||||||
|
@ -36,13 +35,13 @@ public class Timeout extends AutoCommand<Core> {
|
||||||
Core.getTimeout().add(p);
|
Core.getTimeout().add(p);
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
p.sendMessage(p.getMessage("Command.not_online"));
|
p.sendMessage(p.getDatabasePlayer().getMessage("Command.not_online"));
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
p.sendMessage("Nicht genug Argumente");
|
p.sendMessage("Nicht genug Argumente");
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
p.sendMessage(p.getMessage("Command.no_perms"));
|
p.sendMessage(p.getDatabasePlayer().getMessage("Command.no_perms"));
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
sender.sendMessage(Messages.Console.NOT_A_PLAYER);
|
sender.sendMessage(Messages.Console.NOT_A_PLAYER);
|
||||||
|
|
|
@ -1,10 +1,10 @@
|
||||||
package eu.univento.core.commands;
|
package eu.univento.core.commands;
|
||||||
|
|
||||||
|
import eu.univento.commons.player.Rank;
|
||||||
import eu.univento.core.Core;
|
import eu.univento.core.Core;
|
||||||
import eu.univento.core.api.AutoCommand;
|
import eu.univento.core.api.AutoCommand;
|
||||||
import eu.univento.core.api.languages.Messages;
|
import eu.univento.core.api.languages.Messages;
|
||||||
import eu.univento.core.api.player.CustomPlayer;
|
import eu.univento.core.api.player.CustomPlayer;
|
||||||
import eu.univento.core.api.player.Rank;
|
|
||||||
import org.bukkit.Bukkit;
|
import org.bukkit.Bukkit;
|
||||||
import org.bukkit.command.CommandSender;
|
import org.bukkit.command.CommandSender;
|
||||||
import org.bukkit.entity.Player;
|
import org.bukkit.entity.Player;
|
||||||
|
@ -32,9 +32,9 @@ public class Vanish extends AutoCommand<Core>{
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param plugin main class
|
* @param plugin main class
|
||||||
* @param command command to execute
|
* @param command commons to execute
|
||||||
* @param description describes the command
|
* @param description describes the commons
|
||||||
* @param aliases aliases of command
|
* @param aliases aliases of commons
|
||||||
*/
|
*/
|
||||||
public Vanish(Core plugin, String command, String description, String... aliases) {
|
public Vanish(Core plugin, String command, String description, String... aliases) {
|
||||||
super(plugin, command, description, aliases);
|
super(plugin, command, description, aliases);
|
||||||
|
@ -45,7 +45,7 @@ public class Vanish extends AutoCommand<Core>{
|
||||||
if(sender instanceof Player) {
|
if(sender instanceof Player) {
|
||||||
CustomPlayer p = CustomPlayer.getPlayer(sender.getName());
|
CustomPlayer p = CustomPlayer.getPlayer(sender.getName());
|
||||||
Messages msgs = new Messages(p);
|
Messages msgs = new Messages(p);
|
||||||
if(p.isAllowed(Rank.JrSupporter)) {
|
if(p.getDatabasePlayer().isAllowed(Rank.JrSupporter)) {
|
||||||
if(players.contains(p)) {
|
if(players.contains(p)) {
|
||||||
for(Player players : Bukkit.getOnlinePlayers()) {
|
for(Player players : Bukkit.getOnlinePlayers()) {
|
||||||
players.showPlayer(p);
|
players.showPlayer(p);
|
||||||
|
|
|
@ -1,11 +1,11 @@
|
||||||
package eu.univento.core.listeners;
|
package eu.univento.core.listeners;
|
||||||
|
|
||||||
|
import eu.univento.commons.player.Rank;
|
||||||
import eu.univento.core.Core;
|
import eu.univento.core.Core;
|
||||||
import eu.univento.core.api.blocks.MiniBlock;
|
import eu.univento.core.api.blocks.MiniBlock;
|
||||||
import eu.univento.core.api.customitems.swords.BestSwordEver;
|
import eu.univento.core.api.customitems.swords.BestSwordEver;
|
||||||
import eu.univento.core.api.languages.Messages;
|
import eu.univento.core.api.languages.Messages;
|
||||||
import eu.univento.core.api.player.CustomPlayer;
|
import eu.univento.core.api.player.CustomPlayer;
|
||||||
import eu.univento.core.api.player.Rank;
|
|
||||||
import eu.univento.core.api.player.WarnReason;
|
import eu.univento.core.api.player.WarnReason;
|
||||||
import eu.univento.core.api.server.ServerSettings;
|
import eu.univento.core.api.server.ServerSettings;
|
||||||
import eu.univento.core.api.shop.ShopItem;
|
import eu.univento.core.api.shop.ShopItem;
|
||||||
|
@ -60,12 +60,12 @@ public class Chat implements Listener {
|
||||||
|
|
||||||
Messages msgs = p.getMessages();
|
Messages msgs = p.getMessages();
|
||||||
if (ServerSettings.isMute()) {
|
if (ServerSettings.isMute()) {
|
||||||
if (!p.isAllowed(Rank.Sound)) {
|
if (!p.getDatabasePlayer().isAllowed(Rank.Sound)) {
|
||||||
e.setCancelled(true);
|
e.setCancelled(true);
|
||||||
p.sendMessage(msgs.PREFIX() + msgs.Core_SERVER_MUTED());
|
p.sendMessage(msgs.PREFIX() + msgs.Core_SERVER_MUTED());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (p.isMuted()) {
|
if (p.getDatabasePlayer().isMuted()) {
|
||||||
e.setCancelled(true);
|
e.setCancelled(true);
|
||||||
p.sendMessage(msgs.PREFIX() + msgs.Core_SERVER_MUTED());
|
p.sendMessage(msgs.PREFIX() + msgs.Core_SERVER_MUTED());
|
||||||
}
|
}
|
||||||
|
@ -79,7 +79,7 @@ public class Chat implements Listener {
|
||||||
p.sendMessage("Nicht spammen");
|
p.sendMessage("Nicht spammen");
|
||||||
spamPlayers.put(p, spamPlayers.get(p) + 1);
|
spamPlayers.put(p, spamPlayers.get(p) + 1);
|
||||||
}
|
}
|
||||||
if(spamPlayers.get(p) > 100) {
|
if(spamPlayers.get(p) >= 100) {
|
||||||
p.warn(WarnReason.SPAM, null, "https://players.univento.eu/" + p.getUniqueId().toString() + "/chatlog");
|
p.warn(WarnReason.SPAM, null, "https://players.univento.eu/" + p.getUniqueId().toString() + "/chatlog");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -98,11 +98,11 @@ public class Chat implements Listener {
|
||||||
}
|
}
|
||||||
|
|
||||||
String format;
|
String format;
|
||||||
if (p.isAllowed(Rank.Partner)) {
|
if (p.getDatabasePlayer().isAllowed(Rank.Partner)) {
|
||||||
if (p.isNicked() && !ServerSettings.isLobby()) {
|
if (p.getDatabasePlayer().getSettings().isNicked() && !ServerSettings.isLobby()) {
|
||||||
format = p.getPrefix() + p.getColor() + p.getDisplayName() + p.getSuffix() + ChatColor.translateAlternateColorCodes('&', e.getMessage());
|
format = p.getDatabasePlayer().getRank().getPrefix() + p.getDatabasePlayer().getRank().getColor() + p.getDisplayName() + p.getDatabasePlayer().getRank().getSuffix() + ChatColor.translateAlternateColorCodes('&', e.getMessage());
|
||||||
} else {
|
} else {
|
||||||
format = p.getPrefix() + p.getDisplayName() + p.getSuffix() + e.getMessage();
|
format = p.getDatabasePlayer().getRank().getPrefix() + p.getDisplayName() + p.getDatabasePlayer().getRank().getSuffix() + e.getMessage();
|
||||||
}
|
}
|
||||||
if (format.contains("%")) format = format.replace("%", "%%");
|
if (format.contains("%")) format = format.replace("%", "%%");
|
||||||
e.setFormat(format);
|
e.setFormat(format);
|
||||||
|
|
|
@ -1,9 +1,9 @@
|
||||||
package eu.univento.core.listeners;
|
package eu.univento.core.listeners;
|
||||||
|
|
||||||
|
import eu.univento.commons.player.Rank;
|
||||||
import eu.univento.core.Core;
|
import eu.univento.core.Core;
|
||||||
import eu.univento.core.api.languages.Messages;
|
import eu.univento.core.api.languages.Messages;
|
||||||
import eu.univento.core.api.player.CustomPlayer;
|
import eu.univento.core.api.player.CustomPlayer;
|
||||||
import eu.univento.core.api.player.Rank;
|
|
||||||
import org.bukkit.Bukkit;
|
import org.bukkit.Bukkit;
|
||||||
import org.bukkit.entity.Player;
|
import org.bukkit.entity.Player;
|
||||||
import org.bukkit.event.EventHandler;
|
import org.bukkit.event.EventHandler;
|
||||||
|
@ -21,7 +21,7 @@ public class Commands implements Listener{
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* prints unknown command message
|
* prints unknown commons message
|
||||||
* @param e PlayerCommandPreprocessEvent
|
* @param e PlayerCommandPreprocessEvent
|
||||||
*/
|
*/
|
||||||
@EventHandler(priority = EventPriority.NORMAL)
|
@EventHandler(priority = EventPriority.NORMAL)
|
||||||
|
@ -38,7 +38,7 @@ public class Commands implements Listener{
|
||||||
}
|
}
|
||||||
String cmd = e.getMessage();
|
String cmd = e.getMessage();
|
||||||
if(cmd.equalsIgnoreCase("/rl") || cmd.equalsIgnoreCase("/reload")) {
|
if(cmd.equalsIgnoreCase("/rl") || cmd.equalsIgnoreCase("/reload")) {
|
||||||
if(p.isAllowed(Rank.Admin)) {
|
if(p.getDatabasePlayer().isAllowed(Rank.Admin)) {
|
||||||
e.setCancelled(true);
|
e.setCancelled(true);
|
||||||
Bukkit.broadcastMessage(msgs.PREFIX() + "§cWarning ! Server will be restarted");
|
Bukkit.broadcastMessage(msgs.PREFIX() + "§cWarning ! Server will be restarted");
|
||||||
Bukkit.getScheduler().scheduleSyncDelayedTask(Core.getInstance(), () -> {
|
Bukkit.getScheduler().scheduleSyncDelayedTask(Core.getInstance(), () -> {
|
||||||
|
|
|
@ -2,10 +2,13 @@ package eu.univento.core.listeners;
|
||||||
|
|
||||||
import eu.univento.core.api.player.CustomPlayer;
|
import eu.univento.core.api.player.CustomPlayer;
|
||||||
import eu.univento.core.api.server.ServerSettings;
|
import eu.univento.core.api.server.ServerSettings;
|
||||||
|
import org.bukkit.entity.Player;
|
||||||
import org.bukkit.event.EventHandler;
|
import org.bukkit.event.EventHandler;
|
||||||
import org.bukkit.event.Listener;
|
import org.bukkit.event.Listener;
|
||||||
import org.bukkit.event.inventory.InventoryCloseEvent;
|
import org.bukkit.event.inventory.InventoryCloseEvent;
|
||||||
|
import org.bukkit.event.player.PlayerMoveEvent;
|
||||||
import org.bukkit.event.server.ServerListPingEvent;
|
import org.bukkit.event.server.ServerListPingEvent;
|
||||||
|
import org.bukkit.util.Vector;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* some basic events
|
* some basic events
|
||||||
|
@ -21,9 +24,16 @@ public class Events implements Listener{
|
||||||
|
|
||||||
@EventHandler
|
@EventHandler
|
||||||
public void onInventoryClose(InventoryCloseEvent e) {
|
public void onInventoryClose(InventoryCloseEvent e) {
|
||||||
CustomPlayer p = CustomPlayer.getPlayer(e.getPlayer().getName());
|
CustomPlayer p = CustomPlayer.getPlayer((Player) e.getPlayer());
|
||||||
p.setOpenInventory(false);
|
p.setOpenInventory(false);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@EventHandler
|
||||||
|
public void onMove(PlayerMoveEvent e) {
|
||||||
|
CustomPlayer p = CustomPlayer.getPlayer(e.getPlayer());
|
||||||
|
if(p.getLocation().getY() <= 0) {
|
||||||
|
p.setVelocity(new Vector().setY(4.0D).multiply(1.0D));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
|
@ -78,16 +78,16 @@ public class JoinQuit implements Listener {
|
||||||
p.setScoreboard(Bukkit.getScoreboardManager().getNewScoreboard());
|
p.setScoreboard(Bukkit.getScoreboardManager().getNewScoreboard());
|
||||||
p.initScoreboard();
|
p.initScoreboard();
|
||||||
p.sendTabHeaderAndFooter(p.getMessages().Core_TAB_TITLE() + Bukkit.getServerName(), p.getMessages().TAB_PREFIX());
|
p.sendTabHeaderAndFooter(p.getMessages().Core_TAB_TITLE() + Bukkit.getServerName(), p.getMessages().TAB_PREFIX());
|
||||||
if (p.isNicked() && !ServerSettings.isLobby()) {
|
if (p.getDatabasePlayer().getSettings().isNicked() && !ServerSettings.isLobby()) {
|
||||||
p.setNick(NickName.getRandomNick());
|
p.setNick(NickName.getRandomNick());
|
||||||
}
|
}
|
||||||
for (CustomPlayer player : Core.getOnlinePlayers()) {
|
for (CustomPlayer player : Core.getOnlinePlayers()) {
|
||||||
p.getScoreboard().getTeam(player.getTeam().getName()).addEntry(player.getDisplayName());
|
p.getScoreboard().getTeam(player.getDatabasePlayer().getRank().getTeam()).addEntry(player.getDisplayName());
|
||||||
player.getScoreboard().getTeam(p.getTeam().getName()).addEntry(p.getDisplayName());
|
player.getScoreboard().getTeam(p.getDatabasePlayer().getRank().getTeam()).addEntry(p.getDisplayName());
|
||||||
}
|
}
|
||||||
p.setCollidable(false);
|
p.setCollidable(false);
|
||||||
|
|
||||||
p.setStoryResourcePack();
|
//p.setStoryResourcePack();
|
||||||
loading.add(p);
|
loading.add(p);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -105,11 +105,11 @@ public class JoinQuit implements Listener {
|
||||||
loading.remove(p);
|
loading.remove(p);
|
||||||
}
|
}
|
||||||
if(e.getStatus() == PlayerResourcePackStatusEvent.Status.FAILED_DOWNLOAD) {
|
if(e.getStatus() == PlayerResourcePackStatusEvent.Status.FAILED_DOWNLOAD) {
|
||||||
p.sendMessage(p.getMessage("Pack.failed_download"));
|
p.sendMessage(p.getDatabasePlayer().getMessage("Pack.failed_download"));
|
||||||
Bukkit.getScheduler().runTaskLaterAsynchronously(Core.getInstance(), p::setStoryResourcePack, 10 * 20L);
|
Bukkit.getScheduler().runTaskLaterAsynchronously(Core.getInstance(), p::setStoryResourcePack, 10 * 20L);
|
||||||
}
|
}
|
||||||
if(e.getStatus() == PlayerResourcePackStatusEvent.Status.DECLINED) {
|
if(e.getStatus() == PlayerResourcePackStatusEvent.Status.DECLINED) {
|
||||||
p.sendMessage(p.getMessage("Pack.declined"));
|
p.sendMessage(p.getDatabasePlayer().getMessage("Pack.declined"));
|
||||||
Bukkit.getScheduler().runTaskLaterAsynchronously(Core.getInstance(), p::setStoryResourcePack, 10 * 20L);
|
Bukkit.getScheduler().runTaskLaterAsynchronously(Core.getInstance(), p::setStoryResourcePack, 10 * 20L);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -119,7 +119,7 @@ public class JoinQuit implements Listener {
|
||||||
CustomPlayer p = CustomPlayer.getPlayer(e.getPlayer());
|
CustomPlayer p = CustomPlayer.getPlayer(e.getPlayer());
|
||||||
if (Build.getPlayers().containsKey(p))
|
if (Build.getPlayers().containsKey(p))
|
||||||
Build.getPlayers().remove(p);
|
Build.getPlayers().remove(p);
|
||||||
if (p.isNicked() && !ServerSettings.isLobby()) {
|
if (p.getDatabasePlayer().getSettings().isNicked() && !ServerSettings.isLobby()) {
|
||||||
p.removeNick();
|
p.removeNick();
|
||||||
}
|
}
|
||||||
for (Team team : p.getScoreboard().getTeams()) {
|
for (Team team : p.getScoreboard().getTeams()) {
|
||||||
|
|
|
@ -5,7 +5,6 @@ import org.bukkit.event.Listener;
|
||||||
/**
|
/**
|
||||||
* @author joethei
|
* @author joethei
|
||||||
* @version 0.1
|
* @version 0.1
|
||||||
* Created at 17:24 on 27.07.2016.
|
|
||||||
*/
|
*/
|
||||||
public class NPCEvents implements Listener {
|
public class NPCEvents implements Listener {
|
||||||
|
|
||||||
|
|
|
@ -9,7 +9,6 @@ import org.bukkit.entity.Player;
|
||||||
import org.bukkit.plugin.messaging.PluginMessageListener;
|
import org.bukkit.plugin.messaging.PluginMessageListener;
|
||||||
|
|
||||||
import java.io.UnsupportedEncodingException;
|
import java.io.UnsupportedEncodingException;
|
||||||
import java.util.logging.Level;
|
|
||||||
|
|
||||||
public class PluginMessenger implements PluginMessageListener {
|
public class PluginMessenger implements PluginMessageListener {
|
||||||
|
|
||||||
|
@ -24,8 +23,8 @@ public class PluginMessenger implements PluginMessageListener {
|
||||||
} catch (UnsupportedEncodingException e) {
|
} catch (UnsupportedEncodingException e) {
|
||||||
e.printStackTrace();
|
e.printStackTrace();
|
||||||
}
|
}
|
||||||
Core.log(Level.INFO, p.getName() + " hat WDL installiert. Version : " + version);
|
Core.getCommons().getLoggingHandler().getCore().info(p.getName() + " hat WDL installiert. Version : " + version);
|
||||||
p.sendMessage(p.getMessage("Prefix") + p.getMessage("Hack.WorldDownloader"));
|
p.sendMessage(p.getDatabasePlayer().getMessage("Prefix") + p.getDatabasePlayer().getMessage("Hack.WorldDownloader"));
|
||||||
}
|
}
|
||||||
if(channel.equals("WDL|CONTROL")) {
|
if(channel.equals("WDL|CONTROL")) {
|
||||||
p.sendPluginMessage(Core.getInstance(), "WDL|CONTROL", createWDLPacket(0, false, false, false, false));
|
p.sendPluginMessage(Core.getInstance(), "WDL|CONTROL", createWDLPacket(0, false, false, false, false));
|
||||||
|
@ -33,12 +32,12 @@ public class PluginMessenger implements PluginMessageListener {
|
||||||
if (channel.equals("PERMISSIONSREPL") && new String(data).contains("mod.worlddownloader")) {
|
if (channel.equals("PERMISSIONSREPL") && new String(data).contains("mod.worlddownloader")) {
|
||||||
//TODO: change to real warn reason
|
//TODO: change to real warn reason
|
||||||
p.warn(WarnReason.SPAM, null, "https://players.univento.eu/" + p.getUniqueId().toString() + "/hacks");
|
p.warn(WarnReason.SPAM, null, "https://players.univento.eu/" + p.getUniqueId().toString() + "/hacks");
|
||||||
p.sendMessage(p.getMessage("Prefix") + p.getMessage("Hack.WorldDownloader"));
|
p.sendMessage(p.getDatabasePlayer().getMessage("Prefix") + p.getDatabasePlayer().getMessage("Hack.WorldDownloader"));
|
||||||
}
|
}
|
||||||
if(channel.equals("5zig_Set")) {
|
if(channel.equals("5zig_Set")) {
|
||||||
try {
|
try {
|
||||||
String version = new String(data, "UTF-8");
|
String version = new String(data, "UTF-8");
|
||||||
Core.log(Level.INFO, p.getName() + " hat den 5zig Mod Version : " + version);
|
Core.getCommons().getLoggingHandler().getCore().info(p.getName() + " hat den 5zig Mod Version : " + version);
|
||||||
//TODO: disable only some 5zig mod settings | https://gist.github.com/5zig/35e0854504edda418f4b
|
//TODO: disable only some 5zig mod settings | https://gist.github.com/5zig/35e0854504edda418f4b
|
||||||
p.sendPluginMessage(Core.getInstance(), "5zig_Set", new byte[]{0x01 | 0x02 | 0x04 | 0x08 | 0x10});
|
p.sendPluginMessage(Core.getInstance(), "5zig_Set", new byte[]{0x01 | 0x02 | 0x04 | 0x08 | 0x10});
|
||||||
} catch (UnsupportedEncodingException e) {
|
} catch (UnsupportedEncodingException e) {
|
||||||
|
@ -54,10 +53,10 @@ public class PluginMessenger implements PluginMessageListener {
|
||||||
|
|
||||||
output.writeBoolean(false);
|
output.writeBoolean(false);
|
||||||
output.writeInt(0);
|
output.writeInt(0);
|
||||||
output.writeBoolean(false && false);
|
output.writeBoolean(false);
|
||||||
output.writeBoolean(false && false);
|
output.writeBoolean(false);
|
||||||
output.writeBoolean(false && false);
|
output.writeBoolean(false);
|
||||||
output.writeBoolean(false && false && false);
|
output.writeBoolean(false);
|
||||||
|
|
||||||
return output.toByteArray();
|
return output.toByteArray();
|
||||||
}
|
}
|
||||||
|
|
|
@ -17,7 +17,6 @@ import org.bukkit.inventory.meta.SkullMeta;
|
||||||
/**
|
/**
|
||||||
* @author joethei
|
* @author joethei
|
||||||
* @version 0.1
|
* @version 0.1
|
||||||
* created at 19:41 on 17.07.2016.
|
|
||||||
*/
|
*/
|
||||||
public class SpectatorEvents implements Listener{
|
public class SpectatorEvents implements Listener{
|
||||||
|
|
||||||
|
@ -60,7 +59,7 @@ public class SpectatorEvents implements Listener{
|
||||||
public void onInventoryClick(InventoryClickEvent e) {
|
public void onInventoryClick(InventoryClickEvent e) {
|
||||||
CustomPlayer p = CustomPlayer.getPlayer((Player) e.getWhoClicked());
|
CustomPlayer p = CustomPlayer.getPlayer((Player) e.getWhoClicked());
|
||||||
if(SpectateManager.contains(p)) {
|
if(SpectateManager.contains(p)) {
|
||||||
if (e.getInventory().getName().equals(p.getMessage("Game.Menu.SpectateMenu"))) {
|
if (e.getInventory().getName().equals(p.getDatabasePlayer().getMessage("Game.Menu.SpectateMenu"))) {
|
||||||
if(e.getCurrentItem().getType() == Material.SKULL_ITEM) {
|
if(e.getCurrentItem().getType() == Material.SKULL_ITEM) {
|
||||||
SkullMeta meta = (SkullMeta) e.getCurrentItem().getItemMeta();
|
SkullMeta meta = (SkullMeta) e.getCurrentItem().getItemMeta();
|
||||||
CustomPlayer player = CustomPlayer.getPlayer(meta.getOwner());
|
CustomPlayer player = CustomPlayer.getPlayer(meta.getOwner());
|
||||||
|
@ -71,7 +70,7 @@ public class SpectatorEvents implements Listener{
|
||||||
p.closeInventory();
|
p.closeInventory();
|
||||||
spectator.spectate(player);
|
spectator.spectate(player);
|
||||||
}else{
|
}else{
|
||||||
p.sendMessage(p.getMessage("Not_online"));
|
p.sendMessage(p.getDatabasePlayer().getMessage("Not_online"));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -11,7 +11,6 @@ import org.bukkit.event.player.PlayerInteractEvent;
|
||||||
/**
|
/**
|
||||||
* @author joethei
|
* @author joethei
|
||||||
* @version 0.1
|
* @version 0.1
|
||||||
* Created at 20:54 on 12.07.2016.
|
|
||||||
*/
|
*/
|
||||||
public class WeaponEvents implements Listener {
|
public class WeaponEvents implements Listener {
|
||||||
|
|
||||||
|
|
|
@ -1,4 +0,0 @@
|
||||||
Prefix = undefined
|
|
||||||
Tab_Prefix = §8• §6U N I V E N T O §8•
|
|
||||||
Not_a_player = You are not a valid player
|
|
||||||
No_perms =
|
|
|
@ -1,40 +0,0 @@
|
||||||
Pack.failed_download = Das Pack konnte nicht geladen werden
|
|
||||||
Pack.declined = Du hast das Pack abgelehnt, du wirst nicht das volle Spielerlebnis erhalten
|
|
||||||
|
|
||||||
System.unknown_error = Es ist ein unbekannter Fehler aufgetreten
|
|
||||||
System.critical_error = Es ist leider ein kritischer Fehler aufgetreten
|
|
||||||
|
|
||||||
Server.restart = Der Server wurde neugestartet
|
|
||||||
Server.stop = Der Server wurde ausgeschaltet
|
|
||||||
Server.reconnect = Bitte verbinde dich neu
|
|
||||||
Server.full = Dieser Server ist bereits voll
|
|
||||||
Server.ip = IP: play.univento.eu
|
|
||||||
Server.ts_ip = TeamSpeak IP: ts.univento.eu
|
|
||||||
Server.board_ip = Foren Adresse: forum.univento.eu
|
|
||||||
|
|
||||||
Command.prefix = univento.eu Default Command Prefix
|
|
||||||
Command.command_not_found = Dieser Befehl konnte nicht gefunden werden
|
|
||||||
Command.not_online = Der Spieler $player ist nicht online
|
|
||||||
Command.no_perms = Um diesen Befehl zu benutzen hast du keine Rechte
|
|
||||||
|
|
||||||
Command.Build.usage = Nutze /build
|
|
||||||
Command.Build.toogle_on = Du hast den Build Modus aktiviert
|
|
||||||
Command.Build.toogle_off = Du hast den Build Modus deaktiviert
|
|
||||||
|
|
||||||
Command.TS.usage = Nutze /ts
|
|
||||||
Command.TS.already_verified = Du wurdest bereits verifiziert
|
|
||||||
Command.TS.not_online = Du bist nicht mit dem TeamSpeak Server verbunden
|
|
||||||
Command.TS.verified = Du wurdest verifiziert
|
|
||||||
|
|
||||||
Command.Fix.usage = Nutze /fix <Spieler>
|
|
||||||
Command.Fix.own = Du hast dich selbst gefixt
|
|
||||||
Command.Fix.other = Du hast $player gefixt
|
|
||||||
Command.Fix.by_other = Du wurdest von $player gefixt
|
|
||||||
|
|
||||||
Shop.Lobby.Main = Lobby Shop
|
|
||||||
Shop.Game.Maya.Main = Maya Game Shop
|
|
||||||
|
|
||||||
Lobby.Menu.Profile = Dein Profil
|
|
||||||
Lobby.Menu.other_Profile = Profil von $player
|
|
||||||
Lobby.Menu.Settings = Einstellungen
|
|
||||||
Lobby.Menu.Language = Sprache einstellen
|
|
|
@ -0,0 +1,24 @@
|
||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<project>
|
||||||
|
<bannerLeft>
|
||||||
|
<name>Maven</name>
|
||||||
|
<src>https://pbs.twimg.com/profile_banners/4068816154/1463424334</src>
|
||||||
|
<href>http://univento.eu</href>
|
||||||
|
</bannerLeft>
|
||||||
|
<skin>
|
||||||
|
<groupId>org.apache.maven.skins</groupId>
|
||||||
|
<artifactId>maven-fluido-skin</artifactId>
|
||||||
|
<version>1.5</version>
|
||||||
|
</skin>
|
||||||
|
<body>
|
||||||
|
<breadcrumbs>
|
||||||
|
<item name="Development" href="https://development.univento.eu"/>
|
||||||
|
<item name="Plugins" href="https://development.univento.eu/Plugins"/>
|
||||||
|
</breadcrumbs>
|
||||||
|
|
||||||
|
<menu name="Overview">
|
||||||
|
<item name="Javadoc" href="/apidocs"/>
|
||||||
|
</menu>
|
||||||
|
<menu ref="reports"/>
|
||||||
|
</body>
|
||||||
|
</project>
|
Loading…
Reference in New Issue