diff --git a/.gitignore b/.gitignore
index 9a9e56b..465e7ae 100644
--- a/.gitignore
+++ b/.gitignore
@@ -1,4 +1,5 @@
/target
/server
/build
-Core.iml
\ No newline at end of file
+Core.iml
+run-server.sh
\ No newline at end of file
diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml
deleted file mode 100644
index a99baa2..0000000
--- a/.gitlab-ci.yml
+++ /dev/null
@@ -1,8 +0,0 @@
-image: maven:3-jdk-8
-
-build:
- script: "mvn clean --settings .gitlab/settings.xml"
- artifacts:
- name: "Core"
- paths:
- - "target/*.jar"
\ No newline at end of file
diff --git a/.gitlab/settings.xml b/.gitlab/settings.xml
deleted file mode 100644
index 8093b52..0000000
--- a/.gitlab/settings.xml
+++ /dev/null
@@ -1,18 +0,0 @@
-
-
-
- univentoEU
- download
- ${env.password}
-
-
-
-
-
- univentoEU
- univentoEU Mirror Repo
- http://play.univento.eu:8081/repository/public/
- *
-
-
-
\ No newline at end of file
diff --git a/Core.iml b/Core.iml
index 3bed099..31d1fd1 100644
--- a/Core.iml
+++ b/Core.iml
@@ -20,25 +20,35 @@
-
+
+
+
+
+
+
+
+
+
+
+
+
-
-
-
-
-
-
+
+
+
+
-
-
-
-
-
-
+
+
+
+
+
+
+
@@ -64,6 +74,7 @@
+
@@ -73,17 +84,18 @@
-
-
-
-
-
+
+
+
+
+
+
-
+
\ No newline at end of file
diff --git a/pom.xml b/pom.xml
index f1ebe52..8a4d6b9 100644
--- a/pom.xml
+++ b/pom.xml
@@ -13,7 +13,7 @@
1.0-SNAPSHOT
jar
- Univento.eu Core System
+ univento.eu Core System
@@ -53,61 +53,69 @@
-
-
- univentoEU
- http://play.univento.eu:8081/repository/univento/
-
-
-
com.destroystokyo.paper
paper-api
- 1.11.2-R0.1-SNAPSHOT
- provided
-
-
- org.spigotmc
- spigot-api
- 1.11.2-R0.1-SNAPSHOT
- provided
-
-
- org.bukkit
- bukkit
- 1.11.2-R0.1-SNAPSHOT
+ 1.12.1-R0.1-SNAPSHOT
provided
org.bukkit
craftbukkit
- 1.11.2-R0.1-SNAPSHOT
+ 1.12.1-R0.1-SNAPSHOT
provided
org.projectlombok
lombok
- 1.16.10
+ 1.16.16
co.aikar
taskchain-bukkit
- 3.4.3
+ 3.6.0
+
+ pl.kacperduras
+ tasket-core
+ 1.1.0
+ compile
+
+
+ pl.kacperduras
+ tasket-bukkit
+ 1.1.0
+
+
io.github.lordakkarin
nbt
1.0
+
+
eu.univento
- Commons
+ commons
1.0-SNAPSHOT
+
+
+ de.dytanic.cloudnet
+ cloudnet-api
+ 2.0
+ provided
+
\ No newline at end of file
diff --git a/src/main/java/eu/univento/core/Core.java b/src/main/java/eu/univento/core/Core.java
index 483b474..c2b0e02 100644
--- a/src/main/java/eu/univento/core/Core.java
+++ b/src/main/java/eu/univento/core/Core.java
@@ -1,26 +1,43 @@
+/*
+ * Copyright (c) 2017 univento.eu - All rights reserved
+ * You are not allowed to use, distribute or modify this code
+ */
+
package eu.univento.core;
+import co.aikar.taskchain.BukkitTaskChainFactory;
+import co.aikar.taskchain.TaskChainFactory;
import eu.univento.commons.Commons;
-import eu.univento.commons.server.TPS;
-import eu.univento.core.antihack.AntiHack;
import eu.univento.core.api.Config;
+import eu.univento.core.api.advancement.CustomAdvancement;
+import eu.univento.core.api.cloud.CloudApiWrapper;
import eu.univento.core.api.command.CommandFramework;
import eu.univento.core.api.effects.Blackscreen;
import eu.univento.core.api.events.MoveEventFilter;
-import eu.univento.core.api.items.InventoryManager;
import eu.univento.core.api.player.CustomPlayer;
import eu.univento.core.commands.*;
+import eu.univento.core.customitems.weapons.closecombat.CloseCombatEvents;
import eu.univento.core.listeners.*;
import eu.univento.core.listeners.cloud.Servers;
+import io.sentry.Sentry;
+import io.sentry.SentryClient;
+import io.sentry.jul.SentryHandler;
import lombok.Getter;
import org.bukkit.Bukkit;
import org.bukkit.entity.Player;
+import org.bukkit.inventory.Recipe;
import org.bukkit.plugin.PluginManager;
import org.bukkit.plugin.java.JavaPlugin;
+import pl.kacperduras.tasket.Tasket;
+import pl.kacperduras.tasket.bukkit.BukkitTasket;
import java.io.IOException;
+import java.net.InetAddress;
+import java.net.UnknownHostException;
import java.util.Collection;
+import java.util.Iterator;
import java.util.LinkedList;
+import java.util.logging.Level;
/**
* main class
@@ -33,6 +50,9 @@ public class Core extends JavaPlugin{
@Getter private static Core instance;
@Getter private static Commons commons;
@Getter private static CommandFramework commandFramework;
+ @Getter private static TaskChainFactory taskChainFactory;
+ @Getter private static Tasket tasket;
+ @Getter private static CloudApiWrapper cloudAPI;
public static String getNMSVersion() {
final String packageName = Bukkit.getServer().getClass().getPackage().getName();
@@ -52,7 +72,21 @@ public class Core extends JavaPlugin{
public void onEnable() {
commons = new Commons();
- System.out.println("\n" +
+ SentryClient sentryClient = Sentry.init(commons.getConfigurationHandler().getString("Sentry.DSN.Core"));
+ try {
+ sentryClient.setServerName(InetAddress.getLocalHost().getHostName());
+ sentryClient.setEnvironment("");
+ sentryClient.setDist("Core");
+ sentryClient.setRelease("1.0.0");
+ } catch (UnknownHostException e) {
+ e.printStackTrace();
+ }
+
+ SentryHandler logHandler = new SentryHandler();
+ logHandler.setLevel(Level.INFO);
+ getLogger().addHandler(logHandler);
+
+ getLogger().info("\n" +
"\n" +
" \n" +
" \n" +
@@ -85,20 +119,14 @@ public class Core extends JavaPlugin{
e.printStackTrace();
}
instance = this;
- PluginManager pm = Bukkit.getPluginManager();
- pm.registerEvents(new Commands(), this);
- pm.registerEvents(new JoinQuit(), this);
- pm.registerEvents(new Chat(), this);
- pm.registerEvents(new Events(), this);
- pm.registerEvents(new WeaponEvents(), this);
- pm.registerEvents(new SpectatorEvents(), this);
- pm.registerEvents(new MoveEventFilter(getServer()), this);
- pm.registerEvents(new InventoryManager(), this);
- pm.registerEvents(new WorkbenchEvents(), this);
- pm.registerEvents(new NPCEvents(), this);
+
+ taskChainFactory = BukkitTaskChainFactory.create(this);
+ tasket = new BukkitTasket(this);
+ cloudAPI = new CloudApiWrapper();
commandFramework = new CommandFramework(this);
+ commandFramework.registerCommands(new AdminCommands());
commandFramework.registerCommands(new DevCommands());
commandFramework.registerCommands(new ModCommands());
commandFramework.registerCommands(new BuilderCommands());
@@ -107,11 +135,25 @@ public class Core extends JavaPlugin{
commandFramework.registerCommands(new HologramCommands());
- new AntiHack().registerListeners();
+
+ PluginManager pm = Bukkit.getPluginManager();
+ pm.registerEvents(new Commands(), this);
+ pm.registerEvents(new JoinQuit(), this);
+ pm.registerEvents(new Chat(), this);
+ pm.registerEvents(new Events(), this);
+ pm.registerEvents(new WeaponEvents(), this);
+ pm.registerEvents(new SpectatorEvents(), this);
+ pm.registerEvents(new MoveEventFilter(getServer()), this);
+ pm.registerEvents(new WorkbenchEvents(), this);
+ pm.registerEvents(new NPCEvents(), this);
+
+ pm.registerEvents(new CloseCombatEvents(), this);
new SetRank(this, "setrank", "sets the rank for other players", "sr");
PluginMessenger pluginMessenger = new PluginMessenger();
+ Bukkit.getMessenger().registerOutgoingPluginChannel(this, "BungeeCord");
+ Bukkit.getMessenger().registerIncomingPluginChannel(this, "BungeeCord", pluginMessenger);
Bukkit.getMessenger().registerOutgoingPluginChannel(this, "5zig_Set");
Bukkit.getMessenger().registerIncomingPluginChannel(this, "5zig_Set", pluginMessenger);
Bukkit.getMessenger().registerOutgoingPluginChannel(this, "LABYMOD");
@@ -124,7 +166,21 @@ public class Core extends JavaPlugin{
Servers.register();
Blackscreen.setupUtil(getInstance());
- Bukkit.getScheduler().scheduleSyncDelayedTask(this, () -> System.out.println("\n" +
+
+ for(CustomAdvancement advancement : CustomAdvancement.values()) advancement.load();
+
+ Iterator iterator = Bukkit.recipeIterator();
+ while(iterator.hasNext()) {
+ Recipe recipe = iterator.next();
+ //TODO: remove unwanted recipes and add own recipies
+ /*
+ if() {
+ iterator.remove();
+ }
+ */
+ }
+
+ Bukkit.getScheduler().scheduleSyncDelayedTask(this, () -> getLogger().info("\n" +
"\n" +
"\n" +
" _ _ \n" +
@@ -137,7 +193,15 @@ public class Core extends JavaPlugin{
" \n" +
"\n"), 0L);
- Bukkit.getScheduler().runTask(this, new TPS());
+ /*
+ Bukkit.getScheduler().scheduleSyncRepeatingTask(this, () -> {
+
+ String[] args = new SimpleDateFormat("HH:mm").format(new Date()).split(":");
+ long time = (Integer.parseInt(args[0])*1000) + (Integer.parseInt(args[1])*100/60) + 18000;
+
+ for(World world : Bukkit.getWorlds()) world.setTime(time);
+ }, 20L, 1L);
+ */
}
@Override
@@ -145,7 +209,7 @@ public class Core extends JavaPlugin{
Bukkit.getMessenger().unregisterIncomingPluginChannel(this);
Bukkit.getMessenger().unregisterOutgoingPluginChannel(this);
- System.out.println("\n" +
+ getLogger().info("\n" +
"\n" +
" \n" +
" \n" +
@@ -172,7 +236,6 @@ public class Core extends JavaPlugin{
" \n" +
" \n" +
"\n");
- //new PluginUpdater("Core").update();
commons.shutdown();
}
diff --git a/src/main/java/eu/univento/core/antihack/AntiHack.java b/src/main/java/eu/univento/core/antihack/AntiHack.java
index 20e07bb..4ba0405 100644
--- a/src/main/java/eu/univento/core/antihack/AntiHack.java
+++ b/src/main/java/eu/univento/core/antihack/AntiHack.java
@@ -1,3 +1,8 @@
+/*
+ * Copyright (c) 2017 univento.eu - All rights reserved
+ * You are not allowed to use, distribute or modify this code
+ */
+
package eu.univento.core.antihack;
import eu.univento.commons.player.warn.WarnReason;
diff --git a/src/main/java/eu/univento/core/antihack/Hack.java b/src/main/java/eu/univento/core/antihack/Hack.java
index f1dfc15..5a71816 100644
--- a/src/main/java/eu/univento/core/antihack/Hack.java
+++ b/src/main/java/eu/univento/core/antihack/Hack.java
@@ -1,3 +1,8 @@
+/*
+ * Copyright (c) 2017 univento.eu - All rights reserved
+ * You are not allowed to use, distribute or modify this code
+ */
+
package eu.univento.core.antihack;
public enum Hack {
diff --git a/src/main/java/eu/univento/core/antihack/modules/AutoClicker.java b/src/main/java/eu/univento/core/antihack/modules/AutoClicker.java
index fba81ee..aac81eb 100644
--- a/src/main/java/eu/univento/core/antihack/modules/AutoClicker.java
+++ b/src/main/java/eu/univento/core/antihack/modules/AutoClicker.java
@@ -1,3 +1,8 @@
+/*
+ * Copyright (c) 2017 univento.eu - All rights reserved
+ * You are not allowed to use, distribute or modify this code
+ */
+
package eu.univento.core.antihack.modules;
import eu.univento.core.api.player.CustomPlayer;
diff --git a/src/main/java/eu/univento/core/antihack/modules/AutoRespawn.java b/src/main/java/eu/univento/core/antihack/modules/AutoRespawn.java
index 00c3a59..d1439ba 100644
--- a/src/main/java/eu/univento/core/antihack/modules/AutoRespawn.java
+++ b/src/main/java/eu/univento/core/antihack/modules/AutoRespawn.java
@@ -1,3 +1,8 @@
+/*
+ * Copyright (c) 2017 univento.eu - All rights reserved
+ * You are not allowed to use, distribute or modify this code
+ */
+
package eu.univento.core.antihack.modules;
import eu.univento.commons.player.warn.WarnReason;
diff --git a/src/main/java/eu/univento/core/antihack/modules/AutoSoup.java b/src/main/java/eu/univento/core/antihack/modules/AutoSoup.java
index 921c974..4571d09 100644
--- a/src/main/java/eu/univento/core/antihack/modules/AutoSoup.java
+++ b/src/main/java/eu/univento/core/antihack/modules/AutoSoup.java
@@ -1,3 +1,8 @@
+/*
+ * Copyright (c) 2017 univento.eu - All rights reserved
+ * You are not allowed to use, distribute or modify this code
+ */
+
package eu.univento.core.antihack.modules;
import eu.univento.commons.player.warn.WarnReason;
diff --git a/src/main/java/eu/univento/core/antihack/modules/BowAimbot.java b/src/main/java/eu/univento/core/antihack/modules/BowAimbot.java
index 07bc709..e95f1ef 100644
--- a/src/main/java/eu/univento/core/antihack/modules/BowAimbot.java
+++ b/src/main/java/eu/univento/core/antihack/modules/BowAimbot.java
@@ -1,3 +1,8 @@
+/*
+ * Copyright (c) 2017 univento.eu - All rights reserved
+ * You are not allowed to use, distribute or modify this code
+ */
+
package eu.univento.core.antihack.modules;
import eu.univento.core.api.player.CustomPlayer;
diff --git a/src/main/java/eu/univento/core/antihack/modules/Criticals.java b/src/main/java/eu/univento/core/antihack/modules/Criticals.java
index 35139c3..be71b61 100644
--- a/src/main/java/eu/univento/core/antihack/modules/Criticals.java
+++ b/src/main/java/eu/univento/core/antihack/modules/Criticals.java
@@ -1,3 +1,8 @@
+/*
+ * Copyright (c) 2017 univento.eu - All rights reserved
+ * You are not allowed to use, distribute or modify this code
+ */
+
package eu.univento.core.antihack.modules;
import eu.univento.commons.player.warn.WarnReason;
diff --git a/src/main/java/eu/univento/core/antihack/modules/FastPlace.java b/src/main/java/eu/univento/core/antihack/modules/FastPlace.java
index d16e19f..df719e3 100644
--- a/src/main/java/eu/univento/core/antihack/modules/FastPlace.java
+++ b/src/main/java/eu/univento/core/antihack/modules/FastPlace.java
@@ -1,3 +1,8 @@
+/*
+ * Copyright (c) 2017 univento.eu - All rights reserved
+ * You are not allowed to use, distribute or modify this code
+ */
+
package eu.univento.core.antihack.modules;
import eu.univento.commons.player.warn.WarnReason;
diff --git a/src/main/java/eu/univento/core/antihack/modules/Movement.java b/src/main/java/eu/univento/core/antihack/modules/Movement.java
index f7ef778..c453cbd 100644
--- a/src/main/java/eu/univento/core/antihack/modules/Movement.java
+++ b/src/main/java/eu/univento/core/antihack/modules/Movement.java
@@ -1,3 +1,8 @@
+/*
+ * Copyright (c) 2017 univento.eu - All rights reserved
+ * You are not allowed to use, distribute or modify this code
+ */
+
package eu.univento.core.antihack.modules;
import eu.univento.core.api.events.MoveEventFilter;
diff --git a/src/main/java/eu/univento/core/antihack/modules/Nuker.java b/src/main/java/eu/univento/core/antihack/modules/Nuker.java
index 304bc34..dec7ebe 100644
--- a/src/main/java/eu/univento/core/antihack/modules/Nuker.java
+++ b/src/main/java/eu/univento/core/antihack/modules/Nuker.java
@@ -1,3 +1,8 @@
+/*
+ * Copyright (c) 2017 univento.eu - All rights reserved
+ * You are not allowed to use, distribute or modify this code
+ */
+
package eu.univento.core.antihack.modules;
import eu.univento.commons.player.warn.WarnReason;
diff --git a/src/main/java/eu/univento/core/antihack/modules/Packets.java b/src/main/java/eu/univento/core/antihack/modules/Packets.java
index 8b0827a..3364359 100644
--- a/src/main/java/eu/univento/core/antihack/modules/Packets.java
+++ b/src/main/java/eu/univento/core/antihack/modules/Packets.java
@@ -1,3 +1,8 @@
+/*
+ * Copyright (c) 2017 univento.eu - All rights reserved
+ * You are not allowed to use, distribute or modify this code
+ */
+
package eu.univento.core.antihack.modules;
import com.destroystokyo.paper.event.player.IllegalPacketEvent;
diff --git a/src/main/java/eu/univento/core/antihack/modules/Reach.java b/src/main/java/eu/univento/core/antihack/modules/Reach.java
index 2b288d2..ef24c1f 100644
--- a/src/main/java/eu/univento/core/antihack/modules/Reach.java
+++ b/src/main/java/eu/univento/core/antihack/modules/Reach.java
@@ -1,3 +1,8 @@
+/*
+ * Copyright (c) 2017 univento.eu - All rights reserved
+ * You are not allowed to use, distribute or modify this code
+ */
+
package eu.univento.core.antihack.modules;
import eu.univento.core.api.player.CustomPlayer;
diff --git a/src/main/java/eu/univento/core/antihack/modules/Regen.java b/src/main/java/eu/univento/core/antihack/modules/Regen.java
index f3d56bb..1f9fe5b 100644
--- a/src/main/java/eu/univento/core/antihack/modules/Regen.java
+++ b/src/main/java/eu/univento/core/antihack/modules/Regen.java
@@ -1,3 +1,8 @@
+/*
+ * Copyright (c) 2017 univento.eu - All rights reserved
+ * You are not allowed to use, distribute or modify this code
+ */
+
package eu.univento.core.antihack.modules;
import eu.univento.commons.player.warn.WarnReason;
diff --git a/src/main/java/eu/univento/core/antihack/modules/SelfHit.java b/src/main/java/eu/univento/core/antihack/modules/SelfHit.java
index cee43e5..ce96479 100644
--- a/src/main/java/eu/univento/core/antihack/modules/SelfHit.java
+++ b/src/main/java/eu/univento/core/antihack/modules/SelfHit.java
@@ -1,7 +1,13 @@
+/*
+ * Copyright (c) 2017 univento.eu - All rights reserved
+ * You are not allowed to use, distribute or modify this code
+ */
+
package eu.univento.core.antihack.modules;
import eu.univento.core.api.player.CustomPlayer;
import org.bukkit.entity.Player;
+import org.bukkit.entity.Projectile;
import org.bukkit.event.EventHandler;
import org.bukkit.event.Listener;
import org.bukkit.event.entity.EntityDamageByEntityEvent;
@@ -22,5 +28,13 @@ public class SelfHit implements Listener {
e.setDamage(0.0D);
}
}
+ if(!e.isCancelled() && e.getEntity() instanceof Player && e.getDamager() instanceof Projectile) {
+ CustomPlayer p = (CustomPlayer) e.getEntity();
+ Projectile projectile = (Projectile) e.getDamager();
+ if(projectile.getShooter().equals(p)) {
+ e.setCancelled(true);
+ e.setDamage(0.0D);
+ }
+ }
}
}
\ No newline at end of file
diff --git a/src/main/java/eu/univento/core/api/AutoCommand.java b/src/main/java/eu/univento/core/api/AutoCommand.java
index b31248f..4f41ccb 100644
--- a/src/main/java/eu/univento/core/api/AutoCommand.java
+++ b/src/main/java/eu/univento/core/api/AutoCommand.java
@@ -1,3 +1,8 @@
+/*
+ * Copyright (c) 2017 univento.eu - All rights reserved
+ * You are not allowed to use, distribute or modify this code
+ */
+
package eu.univento.core.api;
import org.bukkit.Bukkit;
diff --git a/src/main/java/eu/univento/core/api/Config.java b/src/main/java/eu/univento/core/api/Config.java
index fcc346b..f40d23c 100644
--- a/src/main/java/eu/univento/core/api/Config.java
+++ b/src/main/java/eu/univento/core/api/Config.java
@@ -1,3 +1,8 @@
+/*
+ * Copyright (c) 2017 univento.eu - All rights reserved
+ * You are not allowed to use, distribute or modify this code
+ */
+
package eu.univento.core.api;
import org.bukkit.Bukkit;
@@ -14,6 +19,7 @@ import java.sql.SQLException;
* @author joethei
* @version 1.1
*/
+@Deprecated
public class Config {
/**config file*/
diff --git a/src/main/java/eu/univento/core/api/Hologram.java b/src/main/java/eu/univento/core/api/Hologram.java
index 86a6e86..47c65bf 100644
--- a/src/main/java/eu/univento/core/api/Hologram.java
+++ b/src/main/java/eu/univento/core/api/Hologram.java
@@ -1,15 +1,20 @@
+/*
+ * Copyright (c) 2017 univento.eu - All rights reserved
+ * You are not allowed to use, distribute or modify this code
+ */
+
package eu.univento.core.api;
import eu.univento.core.Core;
import eu.univento.core.api.player.CustomPlayer;
-import net.minecraft.server.v1_11_R1.EntityArmorStand;
-import net.minecraft.server.v1_11_R1.EnumHand;
-import net.minecraft.server.v1_11_R1.PacketPlayOutEntityDestroy;
-import net.minecraft.server.v1_11_R1.PacketPlayOutSpawnEntityLiving;
+import net.minecraft.server.v1_12_R1.EntityArmorStand;
+import net.minecraft.server.v1_12_R1.EnumHand;
+import net.minecraft.server.v1_12_R1.PacketPlayOutEntityDestroy;
+import net.minecraft.server.v1_12_R1.PacketPlayOutSpawnEntityLiving;
import org.bukkit.Bukkit;
import org.bukkit.Location;
-import org.bukkit.craftbukkit.v1_11_R1.CraftWorld;
-import org.bukkit.craftbukkit.v1_11_R1.inventory.CraftItemStack;
+import org.bukkit.craftbukkit.v1_12_R1.CraftWorld;
+import org.bukkit.craftbukkit.v1_12_R1.inventory.CraftItemStack;
import org.bukkit.inventory.ItemStack;
import java.util.ArrayList;
diff --git a/src/main/java/eu/univento/core/api/Utils.java b/src/main/java/eu/univento/core/api/Utils.java
deleted file mode 100644
index 794a1be..0000000
--- a/src/main/java/eu/univento/core/api/Utils.java
+++ /dev/null
@@ -1,177 +0,0 @@
-package eu.univento.core.api;
-
-
-import eu.univento.core.Core;
-import eu.univento.core.api.player.CustomPlayer;
-import org.bukkit.*;
-import org.bukkit.entity.Entity;
-import org.bukkit.entity.Player;
-import org.bukkit.inventory.ItemStack;
-import org.bukkit.potion.PotionEffect;
-import org.bukkit.util.Vector;
-
-import java.io.File;
-import java.util.List;
-
-/**
- * some utils you may need
- *
- * @author joethei
- * @version 1.0
- */
-public class Utils {
-
- /**
- * plays sound for all players
- *
- * @param s Sound
- */
- public static void playSoundToAll(Sound s) {
- for (Player all : Bukkit.getOnlinePlayers())
- all.playSound(all.getLocation(), s, 3.0F, 3.0F);
- }
-
- /**
- * plays effect for all players
- *
- * @param e Effect
- */
- public static void playEffectToAll(Effect e) {
- for (Player all : Bukkit.getOnlinePlayers())
- all.playEffect(all.getLocation(), e, 3);
- }
-
- /**
- * checks if server version is from spigot
- *
- * @return true/false
- */
- public static boolean isSpigot() {
- return Bukkit.getVersion().contains("Spigot");
- }
-
- /**
- * deletes all folders and files in directory
- *
- * @param file File
- */
- private static void deleteDir(File file) {
- if (file.isDirectory()) {
- if (file.list().length == 0) {
- file.delete();
- } else {
- String[] files = file.list();
- for (String tmp : files) {
- File fileDelete = new File(file, tmp);
- deleteDir(fileDelete);
- }
- if (file.list().length == 0)
- file.delete();
- }
- } else
- file.delete();
- }
-
- /**
- * creates a random number
- *
- * @param low lowest possible value
- * @param high highest possible value
- * @return double
- */
- public static double random(int low, int high) {
- return Math.random() * (high - low) + low;
- }
-
- /**
- * checks if player has empty inventory
- *
- * @param p Player
- * @return true/false
- */
- public static boolean hasEmptyInventory(Player p) {
- for (ItemStack item : p.getInventory().getContents()) {
- if ((item != null) && (item.getType() != Material.AIR))
- return false;
- }
- for (ItemStack item : p.getInventory().getArmorContents()) {
- if ((item != null) && (item.getType() != Material.AIR))
- return false;
- }
- return true;
- }
-
-
- /**
- * removes list of entity and counts them
- *
- * @param e Entity list
- * @return Integer
- */
- public static int removeEntitys(List e) {
- int i = 0;
- for (Entity en : e) {
- en.remove();
- i++;
- }
- return i;
- }
-
- /**
- * clears all potion effects from player
- *
- * @param player Player
- */
- public static void clearPotionEffects(Player player) {
- for (PotionEffect effect : player.getActivePotionEffects())
- player.removePotionEffect(effect.getType());
- }
-
- /**
- * calculates vector from one location to another
- *
- * @param from Location
- * @param to Location
- * @return Vector
- */
- public static Vector calculateVector(Location from, Location to) {
- Location b = to;
-
- // calculate the distance between the locations (a => from || b => to)
- double dX = from.getX() - b.getX();
- double dY = from.getY() - b.getY();
- double dZ = from.getZ() - b.getZ();
- // -------------------------
-
- // calculate the yaw
- double yaw = Math.atan2(dZ, dX);
- // -------------------------
-
- // calculate the pitch
- double pitch = Math.atan2(Math.sqrt(dZ * dZ + dX * dX), dY) + Math.PI;
- // -------------------------
-
- // calculate and create the new vector
- double x = Math.sin(pitch) * Math.cos(yaw);
- double y = Math.sin(pitch) * Math.sin(yaw);
- double z = Math.cos(pitch);
-
- // -------------------------
-
- return new Vector(x, z, y);
- }
-
- /**
- * restarts server
- */
- public static void restart() {
- Bukkit.getScheduler().scheduleSyncDelayedTask(Core.getInstance(), () -> {
- if(Core.getOnlinePlayers().size() != 0) {
- for(CustomPlayer players : Core.getOnlinePlayers())
- //TODO: add connect to optimal lobby server here
- players.connectToServer("Lobby01");
- }
- Bukkit.spigot().restart();
- }, 10 * 20L);
- }
-}
\ No newline at end of file
diff --git a/src/main/java/eu/univento/core/api/advancement/Advancement.java b/src/main/java/eu/univento/core/api/advancement/Advancement.java
new file mode 100644
index 0000000..03febab
--- /dev/null
+++ b/src/main/java/eu/univento/core/api/advancement/Advancement.java
@@ -0,0 +1,179 @@
+package eu.univento.core.api.advancement;
+
+import com.google.common.collect.Lists;
+import com.google.gson.Gson;
+import com.google.gson.GsonBuilder;
+import lombok.Getter;
+import org.bukkit.NamespacedKey;
+import org.bukkit.inventory.ItemStack;
+import org.json.simple.JSONArray;
+import org.json.simple.JSONObject;
+
+import java.util.List;
+
+/**
+ * Created by charliej on 14/05/2017.
+ * Last modification DiscowZombie on 5/06/2017.
+ */
+
+@Getter
+public class Advancement {
+
+ private NamespacedKey id;
+ private String title, parent, trigger, icon, description, background;
+ private boolean announce, toast;
+ private FrameType frame;
+ private List items;
+
+ public Advancement(NamespacedKey id) {
+ this.id = id;
+ this.items = Lists.newArrayList();
+ this.announce = true;
+ this.toast = true;
+ }
+
+
+ public Advancement withIcon(String icon) {
+ this.icon = icon;
+ return this;
+ }
+
+ public String getDescription() {
+ return description;
+ }
+
+ public Advancement withDescription(String description) {
+ this.description = description;
+ return this;
+ }
+
+ public Advancement withBackground(String url) {
+ this.background = url;
+ return this;
+ }
+
+ public Advancement withBackground(AdvancementBackground background) {
+ this.background = background.getUrl();
+ return this;
+ }
+
+ public Advancement withTitle(String title) {
+ this.title = title;
+ return this;
+ }
+
+ public Advancement withParent(String parent) {
+ this.parent = parent;
+ return this;
+ }
+
+ public Advancement withTrigger(String trigger) {
+ this.trigger = trigger;
+ return this;
+ }
+
+ public Advancement withItem(ItemStack is) {
+ items.add(is);
+ return this;
+ }
+
+ public Advancement withFrame(FrameType frame) {
+ this.frame = frame;
+ return this;
+ }
+
+ public Advancement withAnnouncement(boolean announce){
+ this.announce = announce;
+ return this;
+ }
+
+ public Advancement withToast(boolean toast){
+ this.toast = toast;
+ return this;
+ }
+
+ public String getJSON() {
+ JSONObject json = new JSONObject();
+
+ JSONObject icon = new JSONObject();
+ icon.put("item", getIcon());
+
+ JSONObject display = new JSONObject();
+ display.put("icon", icon);
+ display.put("title", getTitle());
+ display.put("description", getDescription());
+ display.put("background", getBackground());
+ display.put("frame", getFrame().toString());
+ display.put("announce_to_chat", isAnnounce());
+ display.put("show_toast", isToast());
+
+ json.put("parent", getParent());
+
+ JSONObject criteria = new JSONObject();
+ JSONObject conditions = new JSONObject();
+ JSONObject elytra = new JSONObject();
+
+ JSONArray itemArray = new JSONArray();
+ JSONObject itemJSON = new JSONObject();
+
+ for(ItemStack i : getItems()) {
+ itemJSON.put("item", "minecraft:"+ i.getType().name().toLowerCase());
+ itemJSON.put("amount", i.getAmount());
+ itemArray.add(itemJSON);
+ }
+
+ /**
+ * Define each criteria, for each criteria in list,
+ * add items, trigger and conditions
+ */
+
+ conditions.put("items", itemArray);
+ elytra.put("trigger", getTrigger());
+ elytra.put("conditions", conditions);
+
+ criteria.put("elytra", elytra);
+
+ json.put("criteria", criteria);
+ json.put("display", display);
+
+ Gson gson = new GsonBuilder().setPrettyPrinting().create();
+
+ return gson.toJson(json);
+ }
+
+ public enum FrameType {
+ TASK("task"),
+ GOAL("goal"),
+ CHALLENGE("challenge");
+
+ private String name = "task";
+
+ FrameType(String name){
+ this.name = name;
+ }
+
+ public String toString(){
+ return name;
+ }
+ }
+
+ public enum AdvancementBackground{
+ ADVENTURE("minecraft:textures/gui/advancements/backgrounds/adventure.png"),
+ END("minecraft:textures/gui/advancements/backgrounds/end.png"),
+ HUSBANDRY("minecraft:textures/gui/advancements/backgrounds/husbandry.png"),
+ NETHER("minecraft:textures/gui/advancements/backgrounds/nether.png"),
+ STONE("minecraft:textures/gui/advancements/backgrounds/stone.png"),
+ fromNamespace(null);
+
+ @Getter private String url;
+
+ AdvancementBackground(String url){
+ this.url = url;
+ }
+
+ public void fromNamespace(String string) {
+ url = string;
+ }
+ }
+
+}
diff --git a/src/main/java/eu/univento/core/api/advancement/CustomAdvancement.java b/src/main/java/eu/univento/core/api/advancement/CustomAdvancement.java
new file mode 100644
index 0000000..5656936
--- /dev/null
+++ b/src/main/java/eu/univento/core/api/advancement/CustomAdvancement.java
@@ -0,0 +1,49 @@
+/*
+ * Copyright (c) 2017 univento.eu - All rights reserved
+ * You are not allowed to use, distribute or modify this code
+ */
+
+package eu.univento.core.api.advancement;
+
+import eu.univento.core.Core;
+import eu.univento.core.api.player.CustomPlayer;
+import lombok.Getter;
+import org.bukkit.Bukkit;
+import org.bukkit.Material;
+import org.bukkit.NamespacedKey;
+import org.bukkit.inventory.ItemStack;
+
+/**
+ * @author joethei
+ * @version 1.0
+ */
+
+@Getter
+public enum CustomAdvancement {
+ CHAT_T(new Advancement(new NamespacedKey(Core.getInstance(), "chat_t")).withTrigger("minecraft:impossible").withIcon("minecraft:apple")
+ .withBackground(Advancement.AdvancementBackground.ADVENTURE).withFrame(Advancement.FrameType.GOAL).withTitle("Chatten").withDescription("Schreibe etwas in den Chat").withItem(new ItemStack(Material.TNT)).withAnnouncement(false).withToast(true));
+
+ private Advancement advancement;
+
+ CustomAdvancement(Advancement advancement) {
+ this.advancement = advancement;
+ }
+
+ public void load() {
+ if(Bukkit.getAdvancement(advancement.getId()) == null)
+ Bukkit.getUnsafe().loadAdvancement(advancement.getId(), advancement.getJSON());
+ }
+
+ public void award(CustomPlayer p, String criteria) {
+ if(!p.getAdvancementProgress(Bukkit.getAdvancement(advancement.getId())).isDone()) {
+ p.getAdvancementProgress(Bukkit.getAdvancement(advancement.getId())).awardCriteria(criteria);
+ }
+ }
+
+ public void revoke(CustomPlayer p, String criteria) {
+ if(p.getAdvancementProgress(Bukkit.getAdvancement(advancement.getId())).isDone()) {
+ p.getAdvancementProgress(Bukkit.getAdvancement(advancement.getId())).revokeCriteria(criteria);
+ }
+ }
+
+}
\ No newline at end of file
diff --git a/src/main/java/eu/univento/core/api/blocks/MiniBlock.java b/src/main/java/eu/univento/core/api/blocks/MiniBlock.java
index 8356d72..cfee5d9 100644
--- a/src/main/java/eu/univento/core/api/blocks/MiniBlock.java
+++ b/src/main/java/eu/univento/core/api/blocks/MiniBlock.java
@@ -1,3 +1,8 @@
+/*
+ * Copyright (c) 2017 univento.eu - All rights reserved
+ * You are not allowed to use, distribute or modify this code
+ */
+
package eu.univento.core.api.blocks;
import org.bukkit.*;
diff --git a/src/main/java/eu/univento/core/api/blocks/banners/BannerColor.java b/src/main/java/eu/univento/core/api/blocks/banners/BannerColor.java
index 2756299..a989034 100644
--- a/src/main/java/eu/univento/core/api/blocks/banners/BannerColor.java
+++ b/src/main/java/eu/univento/core/api/blocks/banners/BannerColor.java
@@ -1,3 +1,8 @@
+/*
+ * Copyright (c) 2017 univento.eu - All rights reserved
+ * You are not allowed to use, distribute or modify this code
+ */
+
package eu.univento.core.api.blocks.banners;
import org.bukkit.DyeColor;
diff --git a/src/main/java/eu/univento/core/api/blocks/banners/BannerString.java b/src/main/java/eu/univento/core/api/blocks/banners/BannerString.java
index 27f3ffa..43470ef 100644
--- a/src/main/java/eu/univento/core/api/blocks/banners/BannerString.java
+++ b/src/main/java/eu/univento/core/api/blocks/banners/BannerString.java
@@ -1,3 +1,8 @@
+/*
+ * Copyright (c) 2017 univento.eu - All rights reserved
+ * You are not allowed to use, distribute or modify this code
+ */
+
package eu.univento.core.api.blocks.banners;
import org.bukkit.block.Banner;
diff --git a/src/main/java/eu/univento/core/api/blocks/banners/FloatingText.java b/src/main/java/eu/univento/core/api/blocks/banners/FloatingText.java
index 8bfd2b3..e6d0e10 100644
--- a/src/main/java/eu/univento/core/api/blocks/banners/FloatingText.java
+++ b/src/main/java/eu/univento/core/api/blocks/banners/FloatingText.java
@@ -1,3 +1,8 @@
+/*
+ * Copyright (c) 2017 univento.eu - All rights reserved
+ * You are not allowed to use, distribute or modify this code
+ */
+
package eu.univento.core.api.blocks.banners;
/**
diff --git a/src/main/java/eu/univento/core/api/blocks/banners/Shape.java b/src/main/java/eu/univento/core/api/blocks/banners/Shape.java
index 860e018..01885ee 100644
--- a/src/main/java/eu/univento/core/api/blocks/banners/Shape.java
+++ b/src/main/java/eu/univento/core/api/blocks/banners/Shape.java
@@ -1,3 +1,8 @@
+/*
+ * Copyright (c) 2017 univento.eu - All rights reserved
+ * You are not allowed to use, distribute or modify this code
+ */
+
package eu.univento.core.api.blocks.banners;
import org.bukkit.DyeColor;
diff --git a/src/main/java/eu/univento/core/api/blocks/banners/ShapeRegistry.java b/src/main/java/eu/univento/core/api/blocks/banners/ShapeRegistry.java
index 797ae33..db8f3e7 100644
--- a/src/main/java/eu/univento/core/api/blocks/banners/ShapeRegistry.java
+++ b/src/main/java/eu/univento/core/api/blocks/banners/ShapeRegistry.java
@@ -1,3 +1,8 @@
+/*
+ * Copyright (c) 2017 univento.eu - All rights reserved
+ * You are not allowed to use, distribute or modify this code
+ */
+
package eu.univento.core.api.blocks.banners;
import org.bukkit.DyeColor;
diff --git a/src/main/java/eu/univento/core/api/utils/Camera.java b/src/main/java/eu/univento/core/api/camera/CameraUtil.java
similarity index 59%
rename from src/main/java/eu/univento/core/api/utils/Camera.java
rename to src/main/java/eu/univento/core/api/camera/CameraUtil.java
index 6dc3a8b..599b4c9 100644
--- a/src/main/java/eu/univento/core/api/utils/Camera.java
+++ b/src/main/java/eu/univento/core/api/camera/CameraUtil.java
@@ -1,50 +1,29 @@
-package eu.univento.core.api.utils;
+/*
+ * Copyright (c) 2017 univento.eu - All rights reserved
+ * You are not allowed to use, distribute or modify this code
+ */
-import eu.univento.core.api.player.CustomPlayer;
-import org.bukkit.Location;
+package eu.univento.core.api.camera;
import java.math.BigDecimal;
-import java.text.ParseException;
import java.text.SimpleDateFormat;
-import java.util.*;
+import java.util.Calendar;
+import java.util.Date;
+import java.util.GregorianCalendar;
-class Camera {
+/**
+ * @author CrushedPixel
+ * @version 1.0
+ */
+public class CameraUtil {
- //TODO: add full functionality
-
- private int time;
- private ArrayList players = new ArrayList<>();
- private ArrayList locations = new ArrayList<>();
-
- private double round(double unrounded, int precision) {
- BigDecimal bigDecimal = new BigDecimal(unrounded);
- BigDecimal rounded = bigDecimal.setScale(precision, 4);
+ public static double round(double unrounded, int precision) {
+ BigDecimal bd = new BigDecimal(unrounded);
+ BigDecimal rounded = bd.setScale(precision, 4);
return rounded.doubleValue();
}
- private double positionDifference(Location loc1, Location loc2) {
- double x1 = loc1.getX();
- double y1 = loc1.getY();
- double z1 = loc1.getZ();
-
- double x2 = loc2.getX();
- double y2 = loc2.getY();
- double z2 = loc2.getZ();
-
- double x = x2 - x1;
- if (x < 0.0D)
- x = -x;
- double z = z2 - z1;
- if (z < 0.0D)
- z = -z;
- double xz = Math.hypot(x, z);
- double y = y2 - y1;
- if (y < 0.0D)
- y = -y;
- return Math.hypot(xz, y);
- }
-
- private Date parseTimeString(String timeString) throws ParseException {
+ public static int parseTimeString(String timeString) throws java.text.ParseException {
Date length;
try {
SimpleDateFormat formatter = new SimpleDateFormat("mm'm'ss's'");
@@ -83,18 +62,11 @@ class Camera {
}
}
}
- return length;
- }
- private void load() {
+ Calendar cal = GregorianCalendar.getInstance();
+ cal.setTime(length);
- }
-
- public Camera(String name) {
- load();
- }
-
- public void start(CustomPlayer p) {
+ return (cal.get(Calendar.MINUTE) * 60 + cal.get(Calendar.SECOND)) * 20;
}
}
\ No newline at end of file
diff --git a/src/main/java/eu/univento/core/api/camera/Traveller.java b/src/main/java/eu/univento/core/api/camera/Traveller.java
new file mode 100644
index 0000000..30c91c0
--- /dev/null
+++ b/src/main/java/eu/univento/core/api/camera/Traveller.java
@@ -0,0 +1,141 @@
+/*
+ * Copyright (c) 2017 univento.eu - All rights reserved
+ * You are not allowed to use, distribute or modify this code
+ */
+
+package eu.univento.core.api.camera;
+
+import eu.univento.core.Core;
+import eu.univento.core.api.player.CustomPlayer;
+import io.vertx.core.json.JsonArray;
+import io.vertx.core.json.JsonObject;
+import lombok.Getter;
+import org.bukkit.Bukkit;
+import org.bukkit.Location;
+
+import java.util.ArrayList;
+import java.util.List;
+import java.util.UUID;
+
+/**
+ * @author Redstoneore, joethei
+ * @version 1.0
+ */
+public class Traveller {
+
+ private CustomPlayer player;
+ @Getter private List points = new ArrayList<>();
+ @Getter private int time;
+ private boolean traveling = false;
+ private String finished;
+ private String failed;
+
+ public Traveller(CustomPlayer player, String route) {
+ this.player = player;
+
+ Core.getCommons().getDatabaseManager().getMongoDB().getClient().findOne("routes", new JsonObject().put("route", route), null, event -> {
+ finished = event.result().getString("finished");
+ failed = event.result().getString("failed");
+ time = event.result().getInteger("time");
+ JsonArray locations = event.result().getJsonArray("locations");
+ for(int i = 0; i > locations.size(); i++) {
+ JsonObject json = locations.getJsonObject(i);
+ points.add(new Location(Bukkit.getWorld(json.getString("world")), json.getDouble("X"), json.getDouble("Y"), json.getDouble("Z"), json.getFloat("Yaw"), json.getFloat("Pitch")));
+ }
+ });
+ }
+
+ public void travel() {
+ if(points.size() == 0) {
+ player.sendMessage(failed);
+ return;
+ }
+ List diffs = new ArrayList<>();
+ List travelTimes = new ArrayList<>();
+
+ Double totalDiff = 0.0D;
+
+ for (int i = 0; i < points.size() - 1; i++) {
+ Location start = points.get(i);
+ Location next = points.get(i + 1);
+
+ Double diff = start.distance(next);
+ totalDiff += diff;
+ diffs.add(diff);
+ }
+
+ for (Double d : diffs) {
+ travelTimes.add((int) (d / totalDiff * time));
+ }
+
+ final List tps = new ArrayList<>();
+
+ UUID world = player.getLocation().getWorld().getUID();
+
+ for (int i = 0; i < points.size() - 1; i++) {
+ Location thisPoint = points.get(i);
+ Location nextPoint = points.get(i + 1);
+ int travelPoint = travelTimes.get(i);
+
+ double moveX = nextPoint.getX() - thisPoint.getX();
+ double moveY = nextPoint.getY() - thisPoint.getY();
+ double moveZ = nextPoint.getZ() - thisPoint.getZ();
+ double movePitch = nextPoint.getPitch() - thisPoint.getPitch();
+
+ double yawDiff = Math.abs(nextPoint.getYaw() - thisPoint.getYaw());
+ double c;
+
+ if (yawDiff <= 180.0) {
+ if (thisPoint.getYaw() < nextPoint.getYaw()) {
+ c = yawDiff;
+ } else {
+ c = -yawDiff;
+ }
+ } else if (thisPoint.getYaw() < nextPoint.getYaw()) {
+ c = -(360.0 - yawDiff);
+ } else {
+ c = 360.0 - yawDiff;
+ }
+
+ double d = c / travelPoint;
+
+ for (int x = 0; x < travelPoint; x++) {
+ Location l = new Location(Bukkit.getWorld(world), thisPoint.getX() + moveX / travelPoint * x, thisPoint.getY() + moveY / travelPoint * x, thisPoint.getZ() + moveZ / travelPoint * x, (float) (thisPoint.getYaw() + d * x), (float) (thisPoint.getPitch() + movePitch / travelPoint * x));
+
+ tps.add(l);
+ }
+
+ }
+
+ try {
+
+ player.teleport(tps.get(0));
+
+ Bukkit.getScheduler().runTaskLater(Core.getInstance(), new Runnable() {
+ private int ticks = 0;
+
+ public void run() {
+ if (this.ticks < tps.size()) {
+
+ player.teleport(tps.get(this.ticks));
+
+ // check if they cancelled
+ if (traveling) {
+ Bukkit.getScheduler().runTaskLater(Core.getInstance(), this, 1L);
+ }
+ this.ticks += 1;
+ } else {
+ traveling = false;
+ player.sendMessage(finished);
+ }
+ }
+ }, 1L);
+ } catch (Exception e) {
+ player.sendMessage(failed);
+ e.printStackTrace();
+ }
+ }
+
+ //TODO: GitHub repo to code after: https://github.com/redstone/RCameraStudio
+
+}
\ No newline at end of file
diff --git a/src/main/java/eu/univento/core/api/chat/DefaultFontInfo.java b/src/main/java/eu/univento/core/api/chat/DefaultFontInfo.java
index 6f82d04..59d6c3e 100644
--- a/src/main/java/eu/univento/core/api/chat/DefaultFontInfo.java
+++ b/src/main/java/eu/univento/core/api/chat/DefaultFontInfo.java
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2016 univento.eu - All rights reserved
+ * Copyright (c) 2017 univento.eu - All rights reserved
* You are not allowed to use, distribute or modify this code
*/
diff --git a/src/main/java/eu/univento/core/api/cloud/CloudApiWrapper.java b/src/main/java/eu/univento/core/api/cloud/CloudApiWrapper.java
new file mode 100644
index 0000000..c93e86f
--- /dev/null
+++ b/src/main/java/eu/univento/core/api/cloud/CloudApiWrapper.java
@@ -0,0 +1,54 @@
+/*
+ * Copyright (c) 2017 univento.eu - All rights reserved
+ * You are not allowed to use, distribute or modify this code
+ */
+
+package eu.univento.core.api.cloud;
+
+import de.dytanic.cloudnet.api.CloudAPI;
+import de.dytanic.cloudnet.lib.server.ServerState;
+import de.dytanic.cloudnet.lib.server.info.ServerInfo;
+import eu.univento.commons.server.ServerType;
+import eu.univento.core.Core;
+import eu.univento.core.api.player.CustomPlayer;
+import lombok.Getter;
+
+import java.util.Collection;
+import java.util.concurrent.CompletableFuture;
+
+/**
+ * @author joethei
+ * @version 1.0
+ */
+public class CloudApiWrapper {
+
+ @Getter private CloudAPI cloudAPI;
+
+ public CloudApiWrapper() {
+ cloudAPI = CloudAPI.getInstance();
+ }
+
+ public CompletableFuture getOptimalServer(CustomPlayer player, ServerType type) {
+ CompletableFuture future = new CompletableFuture<>();
+ Collection servers = cloudAPI.getServers(type.getName());
+
+ Core.getCommons().getPartyManager().isInParty(player.getDatabasePlayer()).whenComplete(((bool, throwable) -> servers.forEach(serverInfo -> {
+ if (serverInfo.isOnline() && serverInfo.getServerState() == ServerState.LOBBY) {
+ if (bool) {
+ Core.getCommons().getPartyManager().getParty(player.getDatabasePlayer()).whenComplete((party, throwable1) -> {
+ if (serverInfo.getOnlineCount() < serverInfo.getMaxPlayers() - party.getMembers().size()) {
+ future.complete(serverInfo.getServiceId().getServerId());
+ }
+ });
+ } else {
+ if (serverInfo.getOnlineCount() < serverInfo.getMaxPlayers() - 1) {
+ future.complete(serverInfo.getServiceId().getServerId());
+ }
+ }
+ }
+ })));
+
+ return future;
+ }
+
+}
\ No newline at end of file
diff --git a/src/main/java/eu/univento/core/api/command/BukkitCommand.java b/src/main/java/eu/univento/core/api/command/BukkitCommand.java
index fb1b2f9..be1a443 100644
--- a/src/main/java/eu/univento/core/api/command/BukkitCommand.java
+++ b/src/main/java/eu/univento/core/api/command/BukkitCommand.java
@@ -1,3 +1,8 @@
+/*
+ * Copyright (c) 2017 univento.eu - All rights reserved
+ * You are not allowed to use, distribute or modify this code
+ */
+
package eu.univento.core.api.command;
import org.apache.commons.lang3.Validate;
diff --git a/src/main/java/eu/univento/core/api/command/BukkitCompleter.java b/src/main/java/eu/univento/core/api/command/BukkitCompleter.java
index 847d77f..1a687e2 100644
--- a/src/main/java/eu/univento/core/api/command/BukkitCompleter.java
+++ b/src/main/java/eu/univento/core/api/command/BukkitCompleter.java
@@ -1,3 +1,8 @@
+/*
+ * Copyright (c) 2017 univento.eu - All rights reserved
+ * You are not allowed to use, distribute or modify this code
+ */
+
package eu.univento.core.api.command;
import org.bukkit.command.CommandSender;
diff --git a/src/main/java/eu/univento/core/api/command/Command.java b/src/main/java/eu/univento/core/api/command/Command.java
index 9661ce7..e49dddc 100644
--- a/src/main/java/eu/univento/core/api/command/Command.java
+++ b/src/main/java/eu/univento/core/api/command/Command.java
@@ -1,3 +1,8 @@
+/*
+ * Copyright (c) 2017 univento.eu - All rights reserved
+ * You are not allowed to use, distribute or modify this code
+ */
+
package eu.univento.core.api.command;
import eu.univento.commons.player.rank.Group;
@@ -28,17 +33,17 @@ public @interface Command {
*
* @return
*/
- public String name();
+ String name();
/**
* Gets the required permission of the command
*
* @return
*/
- public Rank rank() default Rank.Player;
- public Group group() default Group.None;
+ Rank rank() default Rank.Player;
+ Group group() default Group.None;
- public ServerType serverType() default ServerType.NONE;
+ ServerType serverType() default ServerType.NONE;
/**
* The message sent to the player when they do not have permission to
@@ -46,7 +51,7 @@ public @interface Command {
*
* @return
*/
- public String notAllowed() default "§cYou do not have permission to perform that action";
+ String notAllowed() default "§cYou do not have permission to perform that action";
/**
* A list of alternate names that the command is executed under. See
@@ -54,26 +59,26 @@ public @interface Command {
*
* @return
*/
- public String[] aliases() default {};
+ String[] aliases() default {};
/**
* The description that will appear in /help of the command
*
* @return
*/
- public String description() default "";
+ String description() default "";
/**
* The usage that will appear in /help (commandname)
*
* @return
*/
- public String usage() default "";
+ String usage() default "";
/**
* Whether or not the command is available to players only
*
* @return
*/
- public boolean inGameOnly() default false;
+ boolean inGameOnly() default false;
}
\ No newline at end of file
diff --git a/src/main/java/eu/univento/core/api/command/CommandArgs.java b/src/main/java/eu/univento/core/api/command/CommandArgs.java
index a0dd75f..d5ccc68 100644
--- a/src/main/java/eu/univento/core/api/command/CommandArgs.java
+++ b/src/main/java/eu/univento/core/api/command/CommandArgs.java
@@ -1,3 +1,8 @@
+/*
+ * Copyright (c) 2017 univento.eu - All rights reserved
+ * You are not allowed to use, distribute or modify this code
+ */
+
package eu.univento.core.api.command;
import eu.univento.core.api.player.CustomPlayer;
@@ -19,17 +24,14 @@ public class CommandArgs {
private String label;
private String[] args;
- protected CommandArgs(CommandSender sender, org.bukkit.command.Command command, String label, String[] args,
- int subCommand) {
+ protected CommandArgs(CommandSender sender, org.bukkit.command.Command command, String label, String[] args, int subCommand) {
String[] modArgs = new String[args.length - subCommand];
- for (int i = 0; i < args.length - subCommand; i++) {
- modArgs[i] = args[i + subCommand];
- }
+ System.arraycopy(args, subCommand, modArgs, 0, args.length - subCommand);
- StringBuffer buffer = new StringBuffer();
+ StringBuilder buffer = new StringBuilder();
buffer.append(label);
for (int x = 0; x < subCommand; x++) {
- buffer.append("." + args[x]);
+ buffer.append(".").append(args[x]);
}
String cmdLabel = buffer.toString();
this.sender = sender;
@@ -41,7 +43,7 @@ public class CommandArgs {
/**
* Gets the command sender
*
- * @return
+ * @return CommandSender
*/
public CommandSender getSender() {
return sender;
@@ -50,7 +52,7 @@ public class CommandArgs {
/**
* Gets the original command object
*
- * @return
+ * @return Command
*/
public org.bukkit.command.Command getCommand() {
return command;
@@ -70,7 +72,7 @@ public class CommandArgs {
* label was test.subcommand and the arguments were subcommand foo foo, it
* would only return 'foo foo' because 'subcommand' is part of the command
*
- * @return
+ * @return String[]
*/
public String[] getArgs() {
return args;
diff --git a/src/main/java/eu/univento/core/api/command/CommandFramework.java b/src/main/java/eu/univento/core/api/command/CommandFramework.java
index 857a3cd..e0178cb 100644
--- a/src/main/java/eu/univento/core/api/command/CommandFramework.java
+++ b/src/main/java/eu/univento/core/api/command/CommandFramework.java
@@ -1,3 +1,8 @@
+/*
+ * Copyright (c) 2017 univento.eu - All rights reserved
+ * You are not allowed to use, distribute or modify this code
+ */
+
package eu.univento.core.api.command;
import eu.univento.commons.player.rank.Group;
@@ -26,7 +31,7 @@ import java.util.*;
* Command Framework - CommandFramework
* The main command framework class used for controlling the framework.
*
- * @author minnymin3
+ * @author minnymin3, joethei
*/
public class CommandFramework implements CommandExecutor {
diff --git a/src/main/java/eu/univento/core/api/command/Completer.java b/src/main/java/eu/univento/core/api/command/Completer.java
index 78bcacb..6e11deb 100644
--- a/src/main/java/eu/univento/core/api/command/Completer.java
+++ b/src/main/java/eu/univento/core/api/command/Completer.java
@@ -1,3 +1,8 @@
+/*
+ * Copyright (c) 2017 univento.eu - All rights reserved
+ * You are not allowed to use, distribute or modify this code
+ */
+
package eu.univento.core.api.command;
import java.lang.annotation.ElementType;
diff --git a/src/main/java/eu/univento/core/api/customitems/CustomArmor.java b/src/main/java/eu/univento/core/api/customitems/CustomArmor.java
index 43d61d0..a7636ea 100644
--- a/src/main/java/eu/univento/core/api/customitems/CustomArmor.java
+++ b/src/main/java/eu/univento/core/api/customitems/CustomArmor.java
@@ -1,3 +1,8 @@
+/*
+ * Copyright (c) 2017 univento.eu - All rights reserved
+ * You are not allowed to use, distribute or modify this code
+ */
+
package eu.univento.core.api.customitems;
/**
diff --git a/src/main/java/eu/univento/core/api/customitems/CustomItem.java b/src/main/java/eu/univento/core/api/customitems/CustomItem.java
new file mode 100644
index 0000000..4f79ffd
--- /dev/null
+++ b/src/main/java/eu/univento/core/api/customitems/CustomItem.java
@@ -0,0 +1,24 @@
+/*
+ * Copyright (c) 2017 univento.eu - All rights reserved
+ * You are not allowed to use, distribute or modify this code
+ */
+
+package eu.univento.core.api.customitems;
+
+import lombok.Builder;
+import lombok.Getter;
+import org.bukkit.inventory.ItemStack;
+
+/**
+ * @author joethei
+ * @version 1.0
+ */
+@Getter
+@Builder
+public class CustomItem {
+
+ private ItemStack itemStack;
+ private Rarity rarity;
+ private CustomItemActions actions;
+
+}
\ No newline at end of file
diff --git a/src/main/java/eu/univento/core/api/customitems/CustomItemActions.java b/src/main/java/eu/univento/core/api/customitems/CustomItemActions.java
new file mode 100644
index 0000000..4bfd2a4
--- /dev/null
+++ b/src/main/java/eu/univento/core/api/customitems/CustomItemActions.java
@@ -0,0 +1,26 @@
+/*
+ * Copyright (c) 2017 univento.eu - All rights reserved
+ * You are not allowed to use, distribute or modify this code
+ */
+
+package eu.univento.core.api.customitems;
+
+import eu.univento.core.api.customitems.actions.InteractBlockAction;
+import eu.univento.core.api.customitems.actions.InteractPlayerAction;
+import eu.univento.core.api.customitems.actions.PlayerHitAction;
+import lombok.Builder;
+import lombok.Getter;
+
+/**
+ * @author joethei
+ * @version 1.0
+ */
+
+@Getter
+@Builder
+public class CustomItemActions {
+
+ private PlayerHitAction playerHitAction;
+ private InteractBlockAction interactBlockAction;
+ private InteractPlayerAction interactPlayerAction;
+}
\ No newline at end of file
diff --git a/src/main/java/eu/univento/core/api/customitems/CustomItemManager.java b/src/main/java/eu/univento/core/api/customitems/CustomItemManager.java
index 8ce9010..f222502 100644
--- a/src/main/java/eu/univento/core/api/customitems/CustomItemManager.java
+++ b/src/main/java/eu/univento/core/api/customitems/CustomItemManager.java
@@ -1,3 +1,8 @@
+/*
+ * Copyright (c) 2017 univento.eu - All rights reserved
+ * You are not allowed to use, distribute or modify this code
+ */
+
package eu.univento.core.api.customitems;
/**
diff --git a/src/main/java/eu/univento/core/api/customitems/CustomItems.java b/src/main/java/eu/univento/core/api/customitems/CustomItems.java
new file mode 100644
index 0000000..4c64f33
--- /dev/null
+++ b/src/main/java/eu/univento/core/api/customitems/CustomItems.java
@@ -0,0 +1,44 @@
+/*
+ * Copyright (c) 2017 univento.eu - All rights reserved
+ * You are not allowed to use, distribute or modify this code
+ */
+
+package eu.univento.core.api.customitems;
+
+import eu.univento.core.api.items.ItemBuilder;
+import eu.univento.core.api.items.attribute.Attribute;
+import eu.univento.core.api.items.attribute.ItemSlot;
+import lombok.Getter;
+import org.bukkit.Material;
+import org.bukkit.inventory.ItemStack;
+
+/**
+ * @author joethei
+ * @version 1.0
+ */
+@Getter
+public enum CustomItems {
+
+ Thiefs_Dagger(CustomItem.builder().itemStack(new ItemBuilder(Material.DIAMOND_SWORD).attribute(Attribute.ATTACK_SPEED, "ThiefsDaggerSpeed", ItemSlot.MAIN_HAND, 0, 0.0D)
+ .name(Rarity.Epic.getColor() + "Dolch des Diebes").build()).rarity(Rarity.Epic).actions(CustomItemActions.builder()
+ .playerHitAction((player, hitPlayer, damage, cause) -> player.sendMessage("Du hast " + hitPlayer.getDisplayName() + " geschlagen"))
+ .interactBlockAction((player, action, block, blockFace) -> player.sendMessage("Du hast auf einen " + block.getType().name() + " geklickt"))
+ .interactPlayerAction((player, interactPlayer) -> player.sendMessage("Du hast auf den Spieler " + interactPlayer.getDisplayName() + " geklickt"))
+ .build()).build());
+
+ private CustomItem item;
+
+ CustomItems(CustomItem item) {
+ this.item = item;
+ }
+
+ public static CustomItem valueOf(ItemStack item) {
+ return null;
+ /*
+ for (CustomItems customItems : values()) {
+ if (item.equals(customItems.getItem().getItemStack())) return customItems.getItem();
+ }
+ return null;
+ */
+ }
+}
\ No newline at end of file
diff --git a/src/main/java/eu/univento/core/api/customitems/Rarity.java b/src/main/java/eu/univento/core/api/customitems/Rarity.java
new file mode 100644
index 0000000..eb0d05d
--- /dev/null
+++ b/src/main/java/eu/univento/core/api/customitems/Rarity.java
@@ -0,0 +1,29 @@
+/*
+ * Copyright (c) 2017 univento.eu - All rights reserved
+ * You are not allowed to use, distribute or modify this code
+ */
+
+package eu.univento.core.api.customitems;
+
+import lombok.AllArgsConstructor;
+import lombok.Getter;
+
+/**
+ * @author joethei
+ * @version 1.0
+ */
+
+@AllArgsConstructor
+public enum Rarity {
+
+ Normal("§7", "Normal"),
+ Rare("§6", "Selten"),
+ Epic("§5", "Episch"),
+ Legendary("§f", "Legendär"),
+ Secret("§8", "Geheim"),
+ Unique("§c", "Einzigartig");
+
+ @Getter private String color;
+ @Getter private String name;
+
+}
\ No newline at end of file
diff --git a/src/main/java/eu/univento/core/api/customitems/actions/InteractBlockAction.java b/src/main/java/eu/univento/core/api/customitems/actions/InteractBlockAction.java
new file mode 100644
index 0000000..352c5f9
--- /dev/null
+++ b/src/main/java/eu/univento/core/api/customitems/actions/InteractBlockAction.java
@@ -0,0 +1,20 @@
+/*
+ * Copyright (c) 2017 univento.eu - All rights reserved
+ * You are not allowed to use, distribute or modify this code
+ */
+
+package eu.univento.core.api.customitems.actions;
+
+import eu.univento.core.api.player.CustomPlayer;
+import org.bukkit.block.Block;
+import org.bukkit.block.BlockFace;
+import org.bukkit.event.block.Action;
+
+/**
+ * @author joethei
+ * @version 1.0
+ */
+public interface InteractBlockAction {
+
+ void onInteract(CustomPlayer player, Action action, Block block, BlockFace blockFace);
+}
\ No newline at end of file
diff --git a/src/main/java/eu/univento/core/api/customitems/actions/InteractPlayerAction.java b/src/main/java/eu/univento/core/api/customitems/actions/InteractPlayerAction.java
new file mode 100644
index 0000000..f5f847b
--- /dev/null
+++ b/src/main/java/eu/univento/core/api/customitems/actions/InteractPlayerAction.java
@@ -0,0 +1,17 @@
+/*
+ * Copyright (c) 2017 univento.eu - All rights reserved
+ * You are not allowed to use, distribute or modify this code
+ */
+
+package eu.univento.core.api.customitems.actions;
+
+import eu.univento.core.api.player.CustomPlayer;
+
+/**
+ * @author joethei
+ * @version 1.0
+ */
+public interface InteractPlayerAction {
+
+ void onInteract(CustomPlayer player, CustomPlayer interactPlayer);
+}
\ No newline at end of file
diff --git a/src/main/java/eu/univento/core/api/customitems/actions/PlayerHitAction.java b/src/main/java/eu/univento/core/api/customitems/actions/PlayerHitAction.java
new file mode 100644
index 0000000..b6238a0
--- /dev/null
+++ b/src/main/java/eu/univento/core/api/customitems/actions/PlayerHitAction.java
@@ -0,0 +1,18 @@
+/*
+ * Copyright (c) 2017 univento.eu - All rights reserved
+ * You are not allowed to use, distribute or modify this code
+ */
+
+package eu.univento.core.api.customitems.actions;
+
+import eu.univento.core.api.player.CustomPlayer;
+import org.bukkit.event.entity.EntityDamageEvent;
+
+/**
+ * @author joethei
+ * @version 0.1
+ */
+public interface PlayerHitAction {
+
+ void onHit(CustomPlayer player, CustomPlayer hitPlayer, double damage, EntityDamageEvent.DamageCause cause);
+}
\ No newline at end of file
diff --git a/src/main/java/eu/univento/core/api/customitems/swords/CustomSword.java b/src/main/java/eu/univento/core/api/customitems/swords/CustomSword.java
index 76c1ded..82b5740 100644
--- a/src/main/java/eu/univento/core/api/customitems/swords/CustomSword.java
+++ b/src/main/java/eu/univento/core/api/customitems/swords/CustomSword.java
@@ -1,38 +1,25 @@
+/*
+ * Copyright (c) 2017 univento.eu - All rights reserved
+ * You are not allowed to use, distribute or modify this code
+ */
+
package eu.univento.core.api.customitems.swords;
-import eu.univento.core.api.player.CustomPlayer;
import org.bukkit.inventory.ItemStack;
/**
* @author joethei
* @version 0.1
*/
-public class CustomSword{
+public interface CustomSword{
- public CustomPlayer player;
+ void primaryAttack();
- public CustomSword(CustomPlayer player) {
- this.player = player;
- CustomSwordManager.add(this);
- }
+ void secondaryAttack();
- public void primaryAttack() {
+ void sneakingAttack();
- }
+ ItemStack getItem();
- public void secondaryAttack() {
-
- }
-
- public void sneakingAttack() {
-
- }
-
- public ItemStack getItem() {
- return null;
- }
-
- public void addItem() {
- player.getInventory().addItem(getItem());
- }
+ void addItem();
}
\ No newline at end of file
diff --git a/src/main/java/eu/univento/core/api/customitems/swords/CustomSwordManager.java b/src/main/java/eu/univento/core/api/customitems/swords/CustomSwordManager.java
index bdec69c..8e43bf2 100644
--- a/src/main/java/eu/univento/core/api/customitems/swords/CustomSwordManager.java
+++ b/src/main/java/eu/univento/core/api/customitems/swords/CustomSwordManager.java
@@ -1,9 +1,15 @@
+/*
+ * Copyright (c) 2017 univento.eu - All rights reserved
+ * You are not allowed to use, distribute or modify this code
+ */
+
package eu.univento.core.api.customitems.swords;
+import eu.univento.core.api.player.CustomPlayer;
import org.bukkit.inventory.ItemStack;
-import java.util.LinkedList;
-import java.util.List;
+import java.util.LinkedHashMap;
+import java.util.Map;
/**
* @author joethei
@@ -11,23 +17,24 @@ import java.util.List;
*/
public class CustomSwordManager {
- private static List swords = new LinkedList<>();
+ private static Map swords = new LinkedHashMap<>();
public static CustomSword valueOf(ItemStack item) {
- for(CustomSword sword : swords)
+ for(CustomSword sword : swords.values())
if(sword.getItem().equals(item)) return sword;
return null;
}
- public static void add(CustomSword sword) {
- swords.add(sword);
+ public static void add(CustomPlayer p, CustomSword sword) {
+ swords.put(p, sword);
}
- public static void remove(CustomSword sword) {
- swords.remove(sword);
+ public static void remove(CustomPlayer p, CustomSword sword) {
+ if(swords.get(p).equals(sword))
+ swords.remove(p);
}
public static boolean contains(CustomSword sword) {
- return swords.contains(sword);
+ return swords.containsValue(sword);
}
}
\ No newline at end of file
diff --git a/src/main/java/eu/univento/core/api/effects/Blackscreen.java b/src/main/java/eu/univento/core/api/effects/Blackscreen.java
index ad4bf9c..92f580a 100644
--- a/src/main/java/eu/univento/core/api/effects/Blackscreen.java
+++ b/src/main/java/eu/univento/core/api/effects/Blackscreen.java
@@ -1,35 +1,26 @@
+/*
+ * Copyright (c) 2017 univento.eu - All rights reserved
+ * You are not allowed to use, distribute or modify this code
+ */
+
package eu.univento.core.api.effects;
+import eu.univento.core.api.player.CustomPlayer;
+import net.minecraft.server.v1_12_R1.PacketPlayOutGameStateChange;
import org.bukkit.Bukkit;
import org.bukkit.entity.Player;
import org.bukkit.plugin.Plugin;
-import java.lang.reflect.Field;
-import java.lang.reflect.Method;
import java.util.HashMap;
import java.util.Map;
import java.util.UUID;
/**
- * @author janhektor
+ * @author janhektor, joethei
*/
public class Blackscreen {
- private static Object packetObject;
- private static Class> packetClass;
private static Map ticksLeft = new HashMap<>();
- static {
- String path = Bukkit.getServer().getClass().getPackage().getName();
- String VERSION = path.substring(path.lastIndexOf(".") + 1, path.length());
- try {
- packetClass = Class.forName("net.minecraft.server." + VERSION + ".Packet");
- Class> packetGameStateClass = Class.forName("net.minecraft.server." + VERSION + ".PacketPlayOutGameStateChange");
- packetObject = packetGameStateClass.getConstructor(new Class[]{Integer.TYPE, Float.TYPE}).newInstance(4, 0);
- } catch (Exception ex) {
- ex.printStackTrace();
- }
- }
-
public static void setupUtil(Plugin instance) {
Bukkit.getScheduler().runTaskTimer(instance, () -> {
for (UUID uuid : Blackscreen.ticksLeft.keySet()) {
@@ -46,20 +37,10 @@ public class Blackscreen {
, 0L, 2);
}
- private static void sendPacket(Player p) {
- try {
- Object nmsPlayer = p.getClass().getMethod("getHandle", new Class[0]).invoke(p);
- Field playerConnectionField = nmsPlayer.getClass().getField("playerConnection");
- Object pConnection = playerConnectionField.get(nmsPlayer);
- Method sendPacket = pConnection.getClass().getMethod("sendPacket", packetClass);
- sendPacket.invoke(pConnection, packetObject);
- } catch (Exception ex) {
- ex.printStackTrace();
- }
- }
-
- public static void setBlack(Player p, int seconds) {
+ public static void setBlack(CustomPlayer p, int seconds) {
ticksLeft.put(p.getUniqueId(), seconds * 20);
- sendPacket(p);
+ PacketPlayOutGameStateChange packet = new PacketPlayOutGameStateChange(4, 0);
+ p.sendPacket(packet);
+
}
}
\ No newline at end of file
diff --git a/src/main/java/eu/univento/core/api/effects/Effects.java b/src/main/java/eu/univento/core/api/effects/Effects.java
index 23477ee..860905b 100644
--- a/src/main/java/eu/univento/core/api/effects/Effects.java
+++ b/src/main/java/eu/univento/core/api/effects/Effects.java
@@ -1,10 +1,15 @@
+/*
+ * Copyright (c) 2017 univento.eu - All rights reserved
+ * You are not allowed to use, distribute or modify this code
+ */
+
package eu.univento.core.api.effects;
import eu.univento.core.Core;
-import net.minecraft.server.v1_11_R1.EnumParticle;
-import net.minecraft.server.v1_11_R1.PacketPlayOutWorldParticles;
+import net.minecraft.server.v1_12_R1.EnumParticle;
+import net.minecraft.server.v1_12_R1.PacketPlayOutWorldParticles;
import org.bukkit.Location;
-import org.bukkit.craftbukkit.v1_11_R1.entity.CraftPlayer;
+import org.bukkit.craftbukkit.v1_12_R1.entity.CraftPlayer;
import org.bukkit.entity.Player;
/**
diff --git a/src/main/java/eu/univento/core/api/effects/ParticleEffect.java b/src/main/java/eu/univento/core/api/effects/ParticleEffect.java
index 96cbf22..156595b 100644
--- a/src/main/java/eu/univento/core/api/effects/ParticleEffect.java
+++ b/src/main/java/eu/univento/core/api/effects/ParticleEffect.java
@@ -1,3 +1,8 @@
+/*
+ * Copyright (c) 2017 univento.eu - All rights reserved
+ * You are not allowed to use, distribute or modify this code
+ */
+
package eu.univento.core.api.effects;
import eu.univento.core.api.utils.reflection.ReflectionUtils;
diff --git a/src/main/java/eu/univento/core/api/effects/ParticleWorldBoarder.java b/src/main/java/eu/univento/core/api/effects/ParticleWorldBoarder.java
index 843c7cd..db0542c 100644
--- a/src/main/java/eu/univento/core/api/effects/ParticleWorldBoarder.java
+++ b/src/main/java/eu/univento/core/api/effects/ParticleWorldBoarder.java
@@ -1,7 +1,9 @@
-package eu.univento.core.api.effects;
+/*
+ * Copyright (c) 2017 univento.eu - All rights reserved
+ * You are not allowed to use, distribute or modify this code
+ */
-import java.util.ArrayList;
-import java.util.List;
+package eu.univento.core.api.effects;
import eu.univento.core.api.events.BorderLeaveEvent;
import org.bukkit.Bukkit;
@@ -12,6 +14,9 @@ import org.bukkit.event.Listener;
import org.bukkit.event.player.PlayerMoveEvent;
import org.bukkit.plugin.Plugin;
+import java.util.ArrayList;
+import java.util.List;
+
/**
* @author Janhektor
* @version 1.0
diff --git a/src/main/java/eu/univento/core/api/entity/ArmorStandAnimator.java b/src/main/java/eu/univento/core/api/entity/ArmorStandAnimator.java
index 90feac1..82f127c 100644
--- a/src/main/java/eu/univento/core/api/entity/ArmorStandAnimator.java
+++ b/src/main/java/eu/univento/core/api/entity/ArmorStandAnimator.java
@@ -1,3 +1,8 @@
+/*
+ * Copyright (c) 2017 univento.eu - All rights reserved
+ * You are not allowed to use, distribute or modify this code
+ */
+
package eu.univento.core.api.entity;
import org.bukkit.Location;
@@ -12,33 +17,6 @@ import java.util.HashSet;
import java.util.Map;
import java.util.Set;
-/**
- * The original thread that this code belongs to can be found here:
- * https://www.spigotmc.org/threads/armor-stand-animator-class.152863/
- * MIT License
-
- Copyright (c) 2016 Bram Stout
-
- Permission is hereby granted, free of charge, to any person obtaining a copy
- of this software and associated documentation files (the "Software"), to deal
- in the Software without restriction, including without limitation the rights
- to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
- copies of the Software, and to permit persons to whom the Software is
- furnished to do so, subject to the following conditions:
-
- The above copyright notice and this permission notice shall be included in all
- copies or substantial portions of the Software.
-
- THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
- IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
- FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
- AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
- LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
- OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
- SOFTWARE.
- * @author Bram
- *
- */
public class ArmorStandAnimator {
/**
diff --git a/src/main/java/eu/univento/core/api/entity/EntityModifier.java b/src/main/java/eu/univento/core/api/entity/EntityModifier.java
index 767cb4d..330efda 100644
--- a/src/main/java/eu/univento/core/api/entity/EntityModifier.java
+++ b/src/main/java/eu/univento/core/api/entity/EntityModifier.java
@@ -1,13 +1,18 @@
+/*
+ * Copyright (c) 2017 univento.eu - All rights reserved
+ * You are not allowed to use, distribute or modify this code
+ */
+
package eu.univento.core.api.entity;
import eu.univento.core.Core;
-import net.minecraft.server.v1_11_R1.EntityLiving;
-import net.minecraft.server.v1_11_R1.NBTTagCompound;
+import net.minecraft.server.v1_12_R1.EntityLiving;
+import net.minecraft.server.v1_12_R1.NBTTagCompound;
import org.bukkit.Bukkit;
import org.bukkit.EntityEffect;
import org.bukkit.Location;
-import org.bukkit.craftbukkit.v1_11_R1.entity.CraftCreature;
-import org.bukkit.craftbukkit.v1_11_R1.entity.CraftEntity;
+import org.bukkit.craftbukkit.v1_12_R1.entity.CraftCreature;
+import org.bukkit.craftbukkit.v1_12_R1.entity.CraftEntity;
import org.bukkit.entity.Player;
import org.bukkit.plugin.Plugin;
@@ -20,7 +25,7 @@ import java.lang.reflect.Field;
public class EntityModifier {
private static org.bukkit.entity.Entity entity;
private static CraftEntity craftentity;
- private static net.minecraft.server.v1_11_R1.Entity entityS;
+ private static net.minecraft.server.v1_12_R1.Entity entityS;
private static int scheduler;
private static Plugin plugin = Core.getInstance();
private static Player player = null;
@@ -100,7 +105,7 @@ public class EntityModifier {
public Builder setInvulnerable(boolean invulnerable) {
try {
- Field invulnerableField = net.minecraft.server.v1_11_R1.Entity.class.getDeclaredField("invulnerable");
+ Field invulnerableField = net.minecraft.server.v1_12_R1.Entity.class.getDeclaredField("invulnerable");
invulnerableField.setAccessible(true);
invulnerableField.setBoolean(EntityModifier.entityS, invulnerable);
} catch (Exception ex) {
diff --git a/src/main/java/eu/univento/core/api/entity/pathfinding/AStar.java b/src/main/java/eu/univento/core/api/entity/pathfinding/AStar.java
index b4bf39c..3c7580e 100644
--- a/src/main/java/eu/univento/core/api/entity/pathfinding/AStar.java
+++ b/src/main/java/eu/univento/core/api/entity/pathfinding/AStar.java
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2016 univento.eu - All rights reserved
+ * Copyright (c) 2017 univento.eu - All rights reserved
* You are not allowed to use, distribute or modify this code
*/
diff --git a/src/main/java/eu/univento/core/api/entity/pathfinding/PathingResult.java b/src/main/java/eu/univento/core/api/entity/pathfinding/PathingResult.java
index 30776fb..6d7fa73 100644
--- a/src/main/java/eu/univento/core/api/entity/pathfinding/PathingResult.java
+++ b/src/main/java/eu/univento/core/api/entity/pathfinding/PathingResult.java
@@ -1,12 +1,12 @@
/*
- * Copyright (c) 2016 univento.eu - All rights reserved
+ * Copyright (c) 2017 univento.eu - All rights reserved
* You are not allowed to use, distribute or modify this code
*/
package eu.univento.core.api.entity.pathfinding;
/**
- * @author joethei
+ * @author Adamk11s
* @version 1.0
*/
public enum PathingResult {
diff --git a/src/main/java/eu/univento/core/api/entity/pathfinding/Tile.java b/src/main/java/eu/univento/core/api/entity/pathfinding/Tile.java
index ca498e5..4923842 100644
--- a/src/main/java/eu/univento/core/api/entity/pathfinding/Tile.java
+++ b/src/main/java/eu/univento/core/api/entity/pathfinding/Tile.java
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2016 univento.eu - All rights reserved
+ * Copyright (c) 2017 univento.eu - All rights reserved
* You are not allowed to use, distribute or modify this code
*/
diff --git a/src/main/java/eu/univento/core/api/events/BorderLeaveEvent.java b/src/main/java/eu/univento/core/api/events/BorderLeaveEvent.java
index 3f1e453..96bd28a 100644
--- a/src/main/java/eu/univento/core/api/events/BorderLeaveEvent.java
+++ b/src/main/java/eu/univento/core/api/events/BorderLeaveEvent.java
@@ -1,3 +1,8 @@
+/*
+ * Copyright (c) 2017 univento.eu - All rights reserved
+ * You are not allowed to use, distribute or modify this code
+ */
+
package eu.univento.core.api.events;
import org.bukkit.entity.Player;
diff --git a/src/main/java/eu/univento/core/api/events/HologramClickEvent.java b/src/main/java/eu/univento/core/api/events/HologramClickEvent.java
index 7154416..3876e0e 100644
--- a/src/main/java/eu/univento/core/api/events/HologramClickEvent.java
+++ b/src/main/java/eu/univento/core/api/events/HologramClickEvent.java
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2017 univento.eu - All rights reserved
+ * Copyright (c) 2017 univento.eu - All rights reserved
* You are not allowed to use, distribute or modify this code
*/
@@ -12,7 +12,7 @@ import org.bukkit.event.player.PlayerInteractEntityEvent;
/**
* @author joethei
- * @version 0.1
+ * @version 1.0
*/
public class HologramClickEvent extends PlayerInteractEntityEvent{
diff --git a/src/main/java/eu/univento/core/api/events/MoveEventFilter.java b/src/main/java/eu/univento/core/api/events/MoveEventFilter.java
index 3f9a00d..5feb792 100644
--- a/src/main/java/eu/univento/core/api/events/MoveEventFilter.java
+++ b/src/main/java/eu/univento/core/api/events/MoveEventFilter.java
@@ -1,3 +1,8 @@
+/*
+ * Copyright (c) 2017 univento.eu - All rights reserved
+ * You are not allowed to use, distribute or modify this code
+ */
+
package eu.univento.core.api.events;
import org.bukkit.Location;
diff --git a/src/main/java/eu/univento/core/api/game/PlayerManager.java b/src/main/java/eu/univento/core/api/game/PlayerManager.java
index cb10e09..481f79e 100644
--- a/src/main/java/eu/univento/core/api/game/PlayerManager.java
+++ b/src/main/java/eu/univento/core/api/game/PlayerManager.java
@@ -1,3 +1,8 @@
+/*
+ * Copyright (c) 2017 univento.eu - All rights reserved
+ * You are not allowed to use, distribute or modify this code
+ */
+
package eu.univento.core.api.game;
import eu.univento.core.api.player.CustomPlayer;
@@ -7,7 +12,7 @@ import java.util.List;
/**
* @author joethei
- * @version 0.1
+ * @version 1.0
*/
public class PlayerManager {
diff --git a/src/main/java/eu/univento/core/api/game/Team.java b/src/main/java/eu/univento/core/api/game/Team.java
index c0e1bc6..5af387c 100644
--- a/src/main/java/eu/univento/core/api/game/Team.java
+++ b/src/main/java/eu/univento/core/api/game/Team.java
@@ -1,59 +1,51 @@
+/*
+ * Copyright (c) 2017 univento.eu - All rights reserved
+ * You are not allowed to use, distribute or modify this code
+ */
+
package eu.univento.core.api.game;
import eu.univento.core.api.player.CustomPlayer;
+import lombok.Getter;
import org.bukkit.Bukkit;
import java.util.ArrayList;
/**
* @author joethei
- * @version 0.1
+ * @version 1.0
*/
+
+@Getter
public class Team {
- private final ArrayList players = new ArrayList<>();
+ private ArrayList players = new ArrayList<>();
private final String name;
private final String prefix;
- private final org.bukkit.scoreboard.Team team;
+ private final org.bukkit.scoreboard.Team scoreboardTeam;
public Team(String name, String prefix) {
this.name = name;
this.prefix = prefix;
if(Bukkit.getScoreboardManager().getMainScoreboard().getTeam(name) == null) {
- team = Bukkit.getScoreboardManager().getMainScoreboard().registerNewTeam(name);
+ scoreboardTeam = Bukkit.getScoreboardManager().getMainScoreboard().registerNewTeam(name);
}else{
- team = Bukkit.getScoreboardManager().getMainScoreboard().getTeam(name);
+ scoreboardTeam = Bukkit.getScoreboardManager().getMainScoreboard().getTeam(name);
}
- team.setPrefix(prefix);
+ scoreboardTeam.setPrefix(prefix);
}
public void addPlayer(CustomPlayer p) {
players.add(p);
- team.addEntry(p.getName());
+ scoreboardTeam.addEntry(p.getName());
}
public void removePlayer(CustomPlayer p) {
players.remove(p);
- team.removeEntry(p.getName());
+ scoreboardTeam.removeEntry(p.getName());
}
public boolean isPlayer(CustomPlayer p) {
return players.contains(p);
}
-
- public String getName() {
- return name;
- }
-
- public String getPrefix() {
- return prefix;
- }
-
- public ArrayList getPlayers() {
- return players;
- }
-
- public org.bukkit.scoreboard.Team getScoreboardTeam() {
- return team;
- }
}
\ No newline at end of file
diff --git a/src/main/java/eu/univento/core/api/game/TeamManager.java b/src/main/java/eu/univento/core/api/game/TeamManager.java
index 7601f54..c96dde0 100644
--- a/src/main/java/eu/univento/core/api/game/TeamManager.java
+++ b/src/main/java/eu/univento/core/api/game/TeamManager.java
@@ -1,3 +1,8 @@
+/*
+ * Copyright (c) 2017 univento.eu - All rights reserved
+ * You are not allowed to use, distribute or modify this code
+ */
+
package eu.univento.core.api.game;
import eu.univento.core.api.player.CustomPlayer;
@@ -6,7 +11,7 @@ import java.util.ArrayList;
/**
* @author joethei
- * @version 0.1
+ * @version 1.0
*/
public class TeamManager {
diff --git a/src/main/java/eu/univento/core/api/gui/Action.java b/src/main/java/eu/univento/core/api/gui/Action.java
new file mode 100644
index 0000000..1f001aa
--- /dev/null
+++ b/src/main/java/eu/univento/core/api/gui/Action.java
@@ -0,0 +1,17 @@
+/*
+ * Copyright (c) 2017 univento.eu - All rights reserved
+ * You are not allowed to use, distribute or modify this code
+ */
+
+package eu.univento.core.api.gui;
+
+import eu.univento.core.api.player.CustomPlayer;
+
+/**
+ * @author joethei
+ * @version 1.0
+ */
+
+public interface Action {
+ void onClick(CustomPlayer player);
+}
diff --git a/src/main/java/eu/univento/core/api/gui/AnvilGUI.java b/src/main/java/eu/univento/core/api/gui/AnvilGUI.java
index 3374cfc..399cd94 100644
--- a/src/main/java/eu/univento/core/api/gui/AnvilGUI.java
+++ b/src/main/java/eu/univento/core/api/gui/AnvilGUI.java
@@ -1,9 +1,14 @@
+/*
+ * Copyright (c) 2017 univento.eu - All rights reserved
+ * You are not allowed to use, distribute or modify this code
+ */
+
package eu.univento.core.api.gui;
import eu.univento.core.Core;
-import net.minecraft.server.v1_11_R1.*;
+import net.minecraft.server.v1_12_R1.*;
import org.bukkit.Bukkit;
-import org.bukkit.craftbukkit.v1_11_R1.entity.CraftPlayer;
+import org.bukkit.craftbukkit.v1_12_R1.entity.CraftPlayer;
import org.bukkit.entity.Player;
import org.bukkit.event.EventHandler;
import org.bukkit.event.HandlerList;
diff --git a/src/main/java/eu/univento/core/api/gui/InventoryGUI.java b/src/main/java/eu/univento/core/api/gui/InventoryGUI.java
new file mode 100644
index 0000000..aae1db6
--- /dev/null
+++ b/src/main/java/eu/univento/core/api/gui/InventoryGUI.java
@@ -0,0 +1,58 @@
+/*
+ * Copyright (c) 2017 univento.eu - All rights reserved
+ * You are not allowed to use, distribute or modify this code
+ */
+
+package eu.univento.core.api.gui;
+
+import eu.univento.core.Core;
+import eu.univento.core.api.player.CustomPlayer;
+import org.bukkit.Bukkit;
+import org.bukkit.entity.Player;
+import org.bukkit.event.EventHandler;
+import org.bukkit.event.Listener;
+import org.bukkit.event.inventory.InventoryClickEvent;
+import org.bukkit.inventory.Inventory;
+import org.bukkit.inventory.ItemStack;
+
+import java.util.HashMap;
+import java.util.Map;
+
+/**
+ * @author joethei
+ * @version 1.0
+ */
+public class InventoryGUI implements Listener{
+
+ private CustomPlayer player;
+ private Inventory inventory;
+ private Map actions;
+
+ public InventoryGUI(CustomPlayer player, int size, String title) {
+ this.player = player;
+ inventory = Bukkit.createInventory(player, size, title);
+ actions = new HashMap<>();
+ Bukkit.getPluginManager().registerEvents(this, Core.getInstance());
+ }
+
+ public void addItem(int slot, ItemStack item, Action action) {
+ inventory.setItem(slot, item);
+ actions.put(slot, action);
+ }
+
+ public void open() {
+ player.openInventory(inventory);
+ }
+
+ @EventHandler
+ private void onClick(InventoryClickEvent e) {
+ CustomPlayer p = CustomPlayer.getPlayer((Player) e.getWhoClicked());
+ if(e.getInventory().getTitle().equals(inventory.getTitle())) {
+ if(actions.get(e.getSlot()) != null) {
+ actions.get(e.getSlot()).onClick(p);
+ }
+ }
+ }
+}
+
+
diff --git a/src/main/java/eu/univento/core/api/gui/SignInput.java b/src/main/java/eu/univento/core/api/gui/SignInput.java
deleted file mode 100644
index c4e1565..0000000
--- a/src/main/java/eu/univento/core/api/gui/SignInput.java
+++ /dev/null
@@ -1,21 +0,0 @@
-package eu.univento.core.api.gui;
-
-import eu.univento.core.api.player.CustomPlayer;
-import net.minecraft.server.v1_11_R1.BlockPosition;
-import net.minecraft.server.v1_11_R1.EntityPlayer;
-import net.minecraft.server.v1_11_R1.PacketPlayOutOpenSignEditor;
-
-/**
- * @author joethei
- * @version 0.1
- */
-class SignInput {
-
- public static void openSignInput(CustomPlayer p) {
- EntityPlayer player = p.getHandle();
- BlockPosition bp = new BlockPosition(p.getHandle());
- PacketPlayOutOpenSignEditor packet = new PacketPlayOutOpenSignEditor(bp);
- player.playerConnection.sendPacket(packet);
- SignInputHandler.injectNetty(p);
- }
-}
\ No newline at end of file
diff --git a/src/main/java/eu/univento/core/api/gui/hologram/HologramData.java b/src/main/java/eu/univento/core/api/gui/hologram/HologramData.java
index 0baa14e..88e4532 100644
--- a/src/main/java/eu/univento/core/api/gui/hologram/HologramData.java
+++ b/src/main/java/eu/univento/core/api/gui/hologram/HologramData.java
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2016 univento.eu - All rights reserved
+ * Copyright (c) 2017 univento.eu - All rights reserved
* You are not allowed to use, distribute or modify this code
*/
diff --git a/src/main/java/eu/univento/core/api/gui/hologram/HologramGUI.java b/src/main/java/eu/univento/core/api/gui/hologram/HologramGUI.java
index 4d39879..d5d828e 100644
--- a/src/main/java/eu/univento/core/api/gui/hologram/HologramGUI.java
+++ b/src/main/java/eu/univento/core/api/gui/hologram/HologramGUI.java
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2016 univento.eu - All rights reserved
+ * Copyright (c) 2017 univento.eu - All rights reserved
* You are not allowed to use, distribute or modify this code
*/
diff --git a/src/main/java/eu/univento/core/api/gui/hologram/components/ComponentPosition.java b/src/main/java/eu/univento/core/api/gui/hologram/components/ComponentPosition.java
index c0a06d5..998d2b0 100644
--- a/src/main/java/eu/univento/core/api/gui/hologram/components/ComponentPosition.java
+++ b/src/main/java/eu/univento/core/api/gui/hologram/components/ComponentPosition.java
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2016 univento.eu - All rights reserved
+ * Copyright (c) 2017 univento.eu - All rights reserved
* You are not allowed to use, distribute or modify this code
*/
diff --git a/src/main/java/eu/univento/core/api/gui/hologram/components/ComponentProperties.java b/src/main/java/eu/univento/core/api/gui/hologram/components/ComponentProperties.java
index 1008100..7ae149d 100644
--- a/src/main/java/eu/univento/core/api/gui/hologram/components/ComponentProperties.java
+++ b/src/main/java/eu/univento/core/api/gui/hologram/components/ComponentProperties.java
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2016 univento.eu - All rights reserved
+ * Copyright (c) 2017 univento.eu - All rights reserved
* You are not allowed to use, distribute or modify this code
*/
diff --git a/src/main/java/eu/univento/core/api/gui/hologram/components/GUIComponent.java b/src/main/java/eu/univento/core/api/gui/hologram/components/GUIComponent.java
index ec1cf09..d3ece9b 100644
--- a/src/main/java/eu/univento/core/api/gui/hologram/components/GUIComponent.java
+++ b/src/main/java/eu/univento/core/api/gui/hologram/components/GUIComponent.java
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2016 univento.eu - All rights reserved
+ * Copyright (c) 2017 univento.eu - All rights reserved
* You are not allowed to use, distribute or modify this code
*/
diff --git a/src/main/java/eu/univento/core/api/gui/hologram/components/GUIPage.java b/src/main/java/eu/univento/core/api/gui/hologram/components/GUIPage.java
index 626cf0c..7be0651 100644
--- a/src/main/java/eu/univento/core/api/gui/hologram/components/GUIPage.java
+++ b/src/main/java/eu/univento/core/api/gui/hologram/components/GUIPage.java
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2016 univento.eu - All rights reserved
+ * Copyright (c) 2017 univento.eu - All rights reserved
* You are not allowed to use, distribute or modify this code
*/
diff --git a/src/main/java/eu/univento/core/api/gui/hologram/components/GUIPageModel.java b/src/main/java/eu/univento/core/api/gui/hologram/components/GUIPageModel.java
index d0d41ca..3ae4246 100644
--- a/src/main/java/eu/univento/core/api/gui/hologram/components/GUIPageModel.java
+++ b/src/main/java/eu/univento/core/api/gui/hologram/components/GUIPageModel.java
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2016 univento.eu - All rights reserved
+ * Copyright (c) 2017 univento.eu - All rights reserved
* You are not allowed to use, distribute or modify this code
*/
diff --git a/src/main/java/eu/univento/core/api/gui/hologram/components/IValueHolder.java b/src/main/java/eu/univento/core/api/gui/hologram/components/IValueHolder.java
index 61ba726..d83817a 100644
--- a/src/main/java/eu/univento/core/api/gui/hologram/components/IValueHolder.java
+++ b/src/main/java/eu/univento/core/api/gui/hologram/components/IValueHolder.java
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2016 univento.eu - All rights reserved
+ * Copyright (c) 2017 univento.eu - All rights reserved
* You are not allowed to use, distribute or modify this code
*/
diff --git a/src/main/java/eu/univento/core/api/gui/hologram/components/PlayerGUIComponent.java b/src/main/java/eu/univento/core/api/gui/hologram/components/PlayerGUIComponent.java
index 8f6cf00..826cbee 100644
--- a/src/main/java/eu/univento/core/api/gui/hologram/components/PlayerGUIComponent.java
+++ b/src/main/java/eu/univento/core/api/gui/hologram/components/PlayerGUIComponent.java
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2016 univento.eu - All rights reserved
+ * Copyright (c) 2017 univento.eu - All rights reserved
* You are not allowed to use, distribute or modify this code
*/
diff --git a/src/main/java/eu/univento/core/api/gui/hologram/components/PlayerGUIPage.java b/src/main/java/eu/univento/core/api/gui/hologram/components/PlayerGUIPage.java
index e593873..059077f 100644
--- a/src/main/java/eu/univento/core/api/gui/hologram/components/PlayerGUIPage.java
+++ b/src/main/java/eu/univento/core/api/gui/hologram/components/PlayerGUIPage.java
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2016 univento.eu - All rights reserved
+ * Copyright (c) 2017 univento.eu - All rights reserved
* You are not allowed to use, distribute or modify this code
*/
diff --git a/src/main/java/eu/univento/core/api/gui/hologram/components/PlayerGUIPageModel.java b/src/main/java/eu/univento/core/api/gui/hologram/components/PlayerGUIPageModel.java
index f6fec98..7613684 100644
--- a/src/main/java/eu/univento/core/api/gui/hologram/components/PlayerGUIPageModel.java
+++ b/src/main/java/eu/univento/core/api/gui/hologram/components/PlayerGUIPageModel.java
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2016 univento.eu - All rights reserved
+ * Copyright (c) 2017 univento.eu - All rights reserved
* You are not allowed to use, distribute or modify this code
*/
diff --git a/src/main/java/eu/univento/core/api/gui/hologram/components/PlayerGUITextBoxComponent.java b/src/main/java/eu/univento/core/api/gui/hologram/components/PlayerGUITextBoxComponent.java
index 70a7466..cde7305 100644
--- a/src/main/java/eu/univento/core/api/gui/hologram/components/PlayerGUITextBoxComponent.java
+++ b/src/main/java/eu/univento/core/api/gui/hologram/components/PlayerGUITextBoxComponent.java
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2016 univento.eu - All rights reserved
+ * Copyright (c) 2017 univento.eu - All rights reserved
* You are not allowed to use, distribute or modify this code
*/
diff --git a/src/main/java/eu/univento/core/api/gui/hologram/components/PlayerGUIValueBoxComponent.java b/src/main/java/eu/univento/core/api/gui/hologram/components/PlayerGUIValueBoxComponent.java
index 731a0cd..1c7a338 100644
--- a/src/main/java/eu/univento/core/api/gui/hologram/components/PlayerGUIValueBoxComponent.java
+++ b/src/main/java/eu/univento/core/api/gui/hologram/components/PlayerGUIValueBoxComponent.java
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2016 univento.eu - All rights reserved
+ * Copyright (c) 2017 univento.eu - All rights reserved
* You are not allowed to use, distribute or modify this code
*/
diff --git a/src/main/java/eu/univento/core/api/gui/hologram/components/StationaryPlayerGUIPage.java b/src/main/java/eu/univento/core/api/gui/hologram/components/StationaryPlayerGUIPage.java
index 022edff..f2af365 100644
--- a/src/main/java/eu/univento/core/api/gui/hologram/components/StationaryPlayerGUIPage.java
+++ b/src/main/java/eu/univento/core/api/gui/hologram/components/StationaryPlayerGUIPage.java
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2016 univento.eu - All rights reserved
+ * Copyright (c) 2017 univento.eu - All rights reserved
* You are not allowed to use, distribute or modify this code
*/
diff --git a/src/main/java/eu/univento/core/api/gui/PlayerSignInputEvent.java b/src/main/java/eu/univento/core/api/gui/sign/PlayerSignInputEvent.java
similarity index 77%
rename from src/main/java/eu/univento/core/api/gui/PlayerSignInputEvent.java
rename to src/main/java/eu/univento/core/api/gui/sign/PlayerSignInputEvent.java
index a79e9b3..7129719 100644
--- a/src/main/java/eu/univento/core/api/gui/PlayerSignInputEvent.java
+++ b/src/main/java/eu/univento/core/api/gui/sign/PlayerSignInputEvent.java
@@ -1,4 +1,9 @@
-package eu.univento.core.api.gui;
+/*
+ * Copyright (c) 2017 univento.eu - All rights reserved
+ * You are not allowed to use, distribute or modify this code
+ */
+
+package eu.univento.core.api.gui.sign;
import org.bukkit.entity.Player;
import org.bukkit.event.HandlerList;
@@ -16,7 +21,6 @@ class PlayerSignInputEvent extends PlayerEvent{
public PlayerSignInputEvent(Player p, String[] lines) {
super(p);
this.lines = lines;
- SignInputHandler.ejectNetty(p);
}
@Override
diff --git a/src/main/java/eu/univento/core/api/gui/sign/SignInput.java b/src/main/java/eu/univento/core/api/gui/sign/SignInput.java
new file mode 100644
index 0000000..0e3a50a
--- /dev/null
+++ b/src/main/java/eu/univento/core/api/gui/sign/SignInput.java
@@ -0,0 +1,67 @@
+/*
+ * Copyright (c) 2017 univento.eu - All rights reserved
+ * You are not allowed to use, distribute or modify this code
+ */
+
+package eu.univento.core.api.gui.sign;
+
+import eu.univento.core.api.player.CustomPlayer;
+import lombok.Getter;
+import net.minecraft.server.v1_12_R1.BlockPosition;
+import net.minecraft.server.v1_12_R1.PacketPlayOutOpenSignEditor;
+import org.bukkit.event.EventHandler;
+import org.bukkit.event.Listener;
+
+import java.util.HashMap;
+import java.util.Map;
+import java.util.UUID;
+import java.util.concurrent.CompletableFuture;
+
+/**
+ * @author joethei
+ * @version 1.0
+ */
+
+class SignInput implements Listener{
+
+ @Getter private CustomPlayer player;
+ @Getter private String[] lines;
+
+ public SignInput(CustomPlayer player, String[] lines) {
+ this.player = player;
+ this.lines = lines;
+ }
+
+ private static Map> futures = new HashMap<>();
+
+
+ public static CompletableFuture openSignInput(CustomPlayer p) {
+ CompletableFuture future = new CompletableFuture<>();
+ p.sendPacket(new PacketPlayOutOpenSignEditor(new BlockPosition(p.getHandle())));
+ SignInputHandler.injectNetty(p);
+ futures.put(p.getUniqueId(), future);
+ return future;
+ }
+
+ @EventHandler
+ public void onSignInput(PlayerSignInputEvent e) {
+ if(futures.get(e.getPlayer().getUniqueId()) != null) {
+ futures.get(e.getPlayer().getUniqueId()).complete(new SignInput(CustomPlayer.getPlayer(e.getPlayer()), e.getLines()));
+ SignInputHandler.ejectNetty(e.getPlayer());
+ }
+ }
+
+
+
+ /*
+
+ public static void openSignInput(CustomPlayer p) {
+ EntityPlayer player = p.getHandle();
+ BlockPosition bp = new BlockPosition(p.getHandle());
+ PacketPlayOutOpenSignEditor packet = new PacketPlayOutOpenSignEditor(bp);
+ player.playerConnection.sendPacket(packet);
+ SignInputHandler.injectNetty(p);
+ }
+ */
+
+}
\ No newline at end of file
diff --git a/src/main/java/eu/univento/core/api/gui/SignInputHandler.java b/src/main/java/eu/univento/core/api/gui/sign/SignInputHandler.java
similarity index 76%
rename from src/main/java/eu/univento/core/api/gui/SignInputHandler.java
rename to src/main/java/eu/univento/core/api/gui/sign/SignInputHandler.java
index 646e13d..49585c4 100644
--- a/src/main/java/eu/univento/core/api/gui/SignInputHandler.java
+++ b/src/main/java/eu/univento/core/api/gui/sign/SignInputHandler.java
@@ -1,13 +1,18 @@
-package eu.univento.core.api.gui;
+/*
+ * Copyright (c) 2017 univento.eu - All rights reserved
+ * You are not allowed to use, distribute or modify this code
+ */
+
+package eu.univento.core.api.gui.sign;
import io.netty.channel.Channel;
import io.netty.channel.ChannelHandlerContext;
import io.netty.handler.codec.MessageToMessageDecoder;
-import net.minecraft.server.v1_11_R1.NetworkManager;
-import net.minecraft.server.v1_11_R1.Packet;
-import net.minecraft.server.v1_11_R1.PacketPlayInUpdateSign;
+import net.minecraft.server.v1_12_R1.NetworkManager;
+import net.minecraft.server.v1_12_R1.Packet;
+import net.minecraft.server.v1_12_R1.PacketPlayInUpdateSign;
import org.bukkit.Bukkit;
-import org.bukkit.craftbukkit.v1_11_R1.entity.CraftPlayer;
+import org.bukkit.craftbukkit.v1_12_R1.entity.CraftPlayer;
import org.bukkit.entity.Player;
import java.lang.reflect.Field;
@@ -22,15 +27,15 @@ class SignInputHandler {
private static Field channelField = null;
static{
- for(Field filed : NetworkManager.class.getDeclaredFields()) {
+ for(Field field : NetworkManager.class.getDeclaredFields()) {
if(channelField.getType().isAssignableFrom(Channel.class)) {
- channelField = filed;
+ channelField = field;
break;
}
}
}
- public static void injectNetty(final Player player) {
+ static void injectNetty(final Player player) {
try {
Channel channel = (Channel) channelField.get(((CraftPlayer) player).getHandle().playerConnection.networkManager);
if (channel != null) {
@@ -52,7 +57,7 @@ class SignInputHandler {
}
}
- public static void ejectNetty(Player player) {
+ static void ejectNetty(Player player) {
try {
Channel channel = (Channel) channelField.get(((CraftPlayer) player).getHandle().playerConnection.networkManager);
if (channel != null) {
diff --git a/src/main/java/eu/univento/core/api/hologram/Hologram.java b/src/main/java/eu/univento/core/api/hologram/Hologram.java
index bbec925..eb2a44a 100644
--- a/src/main/java/eu/univento/core/api/hologram/Hologram.java
+++ b/src/main/java/eu/univento/core/api/hologram/Hologram.java
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2017 univento.eu - All rights reserved
+ * Copyright (c) 2017 univento.eu - All rights reserved
* You are not allowed to use, distribute or modify this code
*/
@@ -9,13 +9,13 @@ import eu.univento.core.Core;
import eu.univento.core.api.events.HologramClickEvent;
import eu.univento.core.api.player.CustomPlayer;
import lombok.Getter;
-import net.minecraft.server.v1_11_R1.EntityArmorStand;
-import net.minecraft.server.v1_11_R1.PacketPlayOutEntityDestroy;
-import net.minecraft.server.v1_11_R1.PacketPlayOutSpawnEntityLiving;
+import net.minecraft.server.v1_12_R1.EntityArmorStand;
+import net.minecraft.server.v1_12_R1.PacketPlayOutEntityDestroy;
+import net.minecraft.server.v1_12_R1.PacketPlayOutSpawnEntityLiving;
import org.bukkit.Bukkit;
import org.bukkit.ChatColor;
import org.bukkit.Location;
-import org.bukkit.craftbukkit.v1_11_R1.CraftWorld;
+import org.bukkit.craftbukkit.v1_12_R1.CraftWorld;
import org.bukkit.entity.ArmorStand;
import org.bukkit.event.EventHandler;
import org.bukkit.event.Listener;
diff --git a/src/main/java/eu/univento/core/api/hologram/HologramManager.java b/src/main/java/eu/univento/core/api/hologram/HologramManager.java
index 4d865e8..8f017d4 100644
--- a/src/main/java/eu/univento/core/api/hologram/HologramManager.java
+++ b/src/main/java/eu/univento/core/api/hologram/HologramManager.java
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2017 univento.eu - All rights reserved
+ * Copyright (c) 2017 univento.eu - All rights reserved
* You are not allowed to use, distribute or modify this code
*/
@@ -11,7 +11,7 @@ import java.util.HashMap;
/**
* @author joethei
- * @version 0.1
+ * @version 1.0
*/
public class HologramManager {
diff --git a/src/main/java/eu/univento/core/api/items/ClickInventory.java b/src/main/java/eu/univento/core/api/items/ClickInventory.java
deleted file mode 100644
index e995d65..0000000
--- a/src/main/java/eu/univento/core/api/items/ClickInventory.java
+++ /dev/null
@@ -1,238 +0,0 @@
-package eu.univento.core.api.items;
-
-import eu.univento.core.api.items.events.NamedCloseEvent;
-import eu.univento.core.api.items.events.PageCloseEvent;
-import eu.univento.core.api.player.CustomPlayer;
-import org.bukkit.Bukkit;
-import org.bukkit.Material;
-import org.bukkit.event.inventory.InventoryClickEvent;
-import org.bukkit.event.inventory.InventoryDragEvent;
-import org.bukkit.inventory.Inventory;
-import org.bukkit.inventory.ItemStack;
-import org.bukkit.metadata.FixedMetadataValue;
-import org.bukkit.plugin.java.JavaPlugin;
-
-import java.lang.reflect.Array;
-import java.util.HashMap;
-
-/**
- * @author joethei
- * @version 0.1
- */
-public abstract class ClickInventory{
-
- protected static JavaPlugin plugin;
- protected Inventory currentInventory;
- protected boolean inventoryInUse;
- private boolean modifiable;
- private CustomPlayer player;
- private boolean playerInventoryUsed;
- private ItemStack[] previousContents;
- private String inventoryName;
- private HashMap