diff --git a/Core.iml b/Core.iml
index b23cecb..c49390e 100644
--- a/Core.iml
+++ b/Core.iml
@@ -23,25 +23,29 @@
-
+
+
-
-
-
-
-
-
-
-
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/local-maven-repo/The5zigMod.jar b/local-maven-repo/The5zigMod.jar
new file mode 100644
index 0000000..78e3450
Binary files /dev/null and b/local-maven-repo/The5zigMod.jar differ
diff --git a/pom.xml b/pom.xml
index 4deeaea..13beb7f 100644
--- a/pom.xml
+++ b/pom.xml
@@ -72,13 +72,24 @@
org.bukkit
craftbukkit
1.10.2-R0.1-SNAPSHOT
- provided
eu.univento
CloudCommons
1.0-SNAPSHOT
+
+ eu.univento
+ Commons
+ 1.0-SNAPSHOT
+
+
+ eu.the5zig.mod
+ mod
+ 1.0
+ system
+ ${project.basedir}/local-maven-repo/The5zigMod.jar
+
\ 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 76439cc..782af01 100644
--- a/src/main/java/eu/univento/core/Core.java
+++ b/src/main/java/eu/univento/core/Core.java
@@ -4,6 +4,7 @@ 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.debug.DebugManager;
import eu.univento.core.api.effects.Blackscreen;
import eu.univento.core.api.events.MoveEventFilter;
import eu.univento.core.api.items.InventoryManager;
@@ -13,6 +14,8 @@ import eu.univento.core.api.server.ServerSettings;
import eu.univento.core.api.utils.NettyInjection;
import eu.univento.core.commands.*;
import eu.univento.core.listeners.*;
+import io.netty.channel.Channel;
+import lombok.Getter;
import org.bukkit.Bukkit;
import org.bukkit.entity.Player;
import org.bukkit.plugin.Plugin;
@@ -20,7 +23,6 @@ import org.bukkit.plugin.PluginManager;
import org.bukkit.plugin.java.JavaPlugin;
import java.io.IOException;
-import java.nio.channels.Channel;
import java.sql.SQLException;
import java.util.ArrayList;
import java.util.Collection;
@@ -80,10 +82,13 @@ public class Core extends JavaPlugin implements NettyInjection.PacketHandler {
public static void broadcast(String key) {
for (CustomPlayer players : getOnlinePlayers()) {
- players.sendMessage(players.getDatabasePlayer().getMessage(key));
+ players.sendMessage(players.getDatabasePlayer().getLanguage().getWord(key));
}
}
+ @Getter
+ private static DebugManager debugManager;
+
/*
@Override
public void onLoad() {
@@ -205,10 +210,17 @@ public class Core extends JavaPlugin implements NettyInjection.PacketHandler {
this.injection = new NettyInjection(this, this.getName());
this.injection.addHandler("TIMEOUT", new NettyInjection.PacketHandler() {
public Object onPacketIn(Player sender, Channel channel, Object packet) {
+ getCommons().getLoggingHandler().getCore().info("PacketIN: " + sender.getName() + " | " + channel + " | " + packet);
if (timeout.contains(CustomPlayer.getPlayer(sender)))
return null;
return packet;
}
+
+ @Override
+ public Object onPacketOut(Player target, Channel channel, Object packet) {
+ getCommons().getLoggingHandler().getCore().info("PacketOUT: " + target.getName() + " | " + channel + " | " + packet);
+ return packet;
+ }
});
commons.getSecurityHandler().isValidServer(getServer().getIp(), aBoolean -> {
if(!aBoolean) {
@@ -216,6 +228,7 @@ public class Core extends JavaPlugin implements NettyInjection.PacketHandler {
}
});
Bukkit.getScheduler().runTask(this, new TPS());
+ debugManager = new DebugManager();
}
@Override
diff --git a/src/main/java/eu/univento/core/antihack/AntiHack.java b/src/main/java/eu/univento/core/antihack/AntiHack.java
index 646cf80..a0fe67b 100644
--- a/src/main/java/eu/univento/core/antihack/AntiHack.java
+++ b/src/main/java/eu/univento/core/antihack/AntiHack.java
@@ -17,6 +17,7 @@ public class AntiHack implements Listener{
private static final PacketInjector packetInjector = new PacketInjector();
+ //TODO: add nofication system
public static void registerListeners() {
PluginManager pm = Bukkit.getPluginManager();
pm.registerEvents(new AntiHack(), Core.getInstance());
@@ -24,7 +25,6 @@ public class AntiHack implements Listener{
pm.registerEvents(new AutoClicker(), Core.getInstance());
pm.registerEvents(new Criticals(), Core.getInstance());
pm.registerEvents(new Reach(), Core.getInstance());
- pm.registerEvents(new NoSlowDown(), Core.getInstance());
pm.registerEvents(new Regen(), Core.getInstance());
pm.registerEvents(new AutoRespawn(), Core.getInstance());
pm.registerEvents(new FastPlace(), Core.getInstance());
diff --git a/src/main/java/eu/univento/core/antihack/modules/AutoSoup.java b/src/main/java/eu/univento/core/antihack/modules/AutoSoup.java
new file mode 100644
index 0000000..bb95d37
--- /dev/null
+++ b/src/main/java/eu/univento/core/antihack/modules/AutoSoup.java
@@ -0,0 +1,24 @@
+package eu.univento.core.antihack.modules;
+
+import eu.univento.core.api.player.CustomPlayer;
+import org.bukkit.entity.Player;
+import org.bukkit.event.EventHandler;
+import org.bukkit.event.Listener;
+import org.bukkit.event.entity.EntityDamageByEntityEvent;
+
+/**
+ * @author joethei
+ * @version 0.1
+ */
+public class AutoSoup implements Listener{
+
+ @EventHandler
+ public void onEntityDamageByEntity(EntityDamageByEntityEvent e) {
+ if(e.getEntity() instanceof Player && e.getDamager() instanceof Player) {
+ CustomPlayer p = (CustomPlayer) e.getDamager();
+ if(p.getInventory().getViewers().size() < 0) {
+ p.closeInventory();
+ }
+ }
+ }
+}
\ No newline at end of file
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 eaf51a7..83fee61 100644
--- a/src/main/java/eu/univento/core/antihack/modules/Movement.java
+++ b/src/main/java/eu/univento/core/antihack/modules/Movement.java
@@ -1,11 +1,15 @@
package eu.univento.core.antihack.modules;
+import eu.univento.core.api.events.MoveEventFilter;
import eu.univento.core.api.player.CustomPlayer;
import org.bukkit.GameMode;
import org.bukkit.Material;
import org.bukkit.block.BlockFace;
+import org.bukkit.entity.Player;
import org.bukkit.event.EventHandler;
import org.bukkit.event.Listener;
+import org.bukkit.event.entity.EntityShootBowEvent;
+import org.bukkit.event.entity.FoodLevelChangeEvent;
import org.bukkit.event.player.PlayerMoveEvent;
public class Movement implements Listener{
@@ -43,4 +47,40 @@ public class Movement implements Listener{
p.sendMessage("Du hast Glide an");
}
}
+
+ @EventHandler
+ public void onShootBow(EntityShootBowEvent e) {
+ if(e.getEntity() instanceof Player) {
+ CustomPlayer p = CustomPlayer.getPlayer((Player) e.getEntity());
+ if(p.isSprinting()) {
+ e.setCancelled(true);
+ p.damage(2.0D);
+ p.setArrowsInBody(p.getArrowsInBody() + 50);
+ p.sendMessage("Du hast NoSlowDown an");
+ }
+ }
+ }
+
+ @EventHandler
+ public void onFoodChange(FoodLevelChangeEvent e) {
+ if(e.getEntity() instanceof Player) {
+ CustomPlayer p = CustomPlayer.getPlayer((Player) e.getEntity());
+ if(e.getFoodLevel() > p.getFoodLevel() && p.isSprinting()) {
+ e.setCancelled(true);
+ e.setFoodLevel(0);
+ p.sendMessage("Du hast NoSlowDown an");
+ }
+ }
+ }
+
+ @EventHandler
+ public void onMoveByBlock(MoveEventFilter.PlayerBlockMoveEvent e) {
+ CustomPlayer p = CustomPlayer.getPlayer(e.getPlayer());
+ double distance = e.getTo().getY() - e.getFrom().getY();
+ if(distance >= 0.9D) {
+ e.setCancelled(true);
+ p.teleport(e.getFrom());
+ p.sendMessage("Du hast Step an");
+ }
+ }
}
\ No newline at end of file
diff --git a/src/main/java/eu/univento/core/antihack/modules/NoSlowDown.java b/src/main/java/eu/univento/core/antihack/modules/NoSlowDown.java
deleted file mode 100644
index dc0c291..0000000
--- a/src/main/java/eu/univento/core/antihack/modules/NoSlowDown.java
+++ /dev/null
@@ -1,36 +0,0 @@
-package eu.univento.core.antihack.modules;
-
-import eu.univento.core.api.player.CustomPlayer;
-import org.bukkit.entity.Player;
-import org.bukkit.event.EventHandler;
-import org.bukkit.event.Listener;
-import org.bukkit.event.entity.EntityShootBowEvent;
-import org.bukkit.event.entity.FoodLevelChangeEvent;
-
-public class NoSlowDown implements Listener{
-
- @EventHandler
- public void onShootBow(EntityShootBowEvent e) {
- if(e.getEntity() instanceof Player) {
- CustomPlayer p = CustomPlayer.getPlayer((Player) e.getEntity());
- if(p.isSprinting()) {
- e.setCancelled(true);
- p.damage(2.0D);
- p.setArrowsInBody(p.getArrowsInBody() + 50);
- p.sendMessage("Du hast NoSlowDown an");
- }
- }
- }
-
- @EventHandler
- public void onFoodChange(FoodLevelChangeEvent e) {
- if(e.getEntity() instanceof Player) {
- CustomPlayer p = CustomPlayer.getPlayer((Player) e.getEntity());
- if(e.getFoodLevel() > p.getFoodLevel() && p.isSprinting()) {
- e.setCancelled(true);
- e.setFoodLevel(0);
- p.sendMessage("Du hast NoSlowDown an");
- }
- }
- }
-}
\ No newline at end of file
diff --git a/src/main/java/eu/univento/core/antihack/modules/SelfHit.java b/src/main/java/eu/univento/core/antihack/modules/SelfHit.java
new file mode 100644
index 0000000..cee43e5
--- /dev/null
+++ b/src/main/java/eu/univento/core/antihack/modules/SelfHit.java
@@ -0,0 +1,26 @@
+package eu.univento.core.antihack.modules;
+
+import eu.univento.core.api.player.CustomPlayer;
+import org.bukkit.entity.Player;
+import org.bukkit.event.EventHandler;
+import org.bukkit.event.Listener;
+import org.bukkit.event.entity.EntityDamageByEntityEvent;
+
+/**
+ * @author joethei
+ * @version 0.1
+ */
+public class SelfHit implements Listener {
+
+ @EventHandler
+ public void onEntityDamageByEntity(EntityDamageByEntityEvent e) {
+ if(!e.isCancelled() && e.getEntity() instanceof Player && e.getDamager() instanceof Player) {
+ CustomPlayer p = (CustomPlayer) e.getEntity();
+ CustomPlayer damager = (CustomPlayer) e.getDamager();
+ if(damager.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/debug/DebugManager.java b/src/main/java/eu/univento/core/api/debug/DebugManager.java
new file mode 100644
index 0000000..533c702
--- /dev/null
+++ b/src/main/java/eu/univento/core/api/debug/DebugManager.java
@@ -0,0 +1,46 @@
+package eu.univento.core.api.debug;
+
+import eu.the5zig.mod.server.The5zigMod;
+import eu.the5zig.mod.server.api.ModUser;
+import eu.univento.commons.player.Rank;
+import eu.univento.core.api.player.CustomPlayer;
+import org.bukkit.Bukkit;
+import org.bukkit.plugin.Plugin;
+
+/**
+ * @author joethei
+ * @version 0.1
+ */
+public class DebugManager {
+
+ private boolean enabled;
+
+ public DebugManager() {
+ Plugin plugin = Bukkit.getPluginManager().getPlugin("The5zigMod");
+ if(plugin.isEnabled()) {
+ this.enabled = true;
+ }
+ }
+
+ public void sendStat(String stat, String score) {
+ if(enabled) {
+ for(ModUser user : The5zigMod.getInstance().getUserManager().getOnlineModUsers()) {
+ CustomPlayer player = CustomPlayer.getPlayer(user.getPlayer());
+ if(player.getDatabasePlayer().isAllowed(Rank.JrDeveloper)) {
+ user.getStatsManager().getStat(stat).setScore(score);
+ }
+ }
+ }
+ }
+
+ public void sendOverlay(String overlay) {
+ if(enabled) {
+ for(ModUser user : The5zigMod.getInstance().getUserManager().getOnlineModUsers()) {
+ CustomPlayer player = CustomPlayer.getPlayer(user.getPlayer());
+ if(player.getDatabasePlayer().isAllowed(Rank.JrDeveloper)) {
+ user.sendOverlay(overlay);
+ }
+ }
+ }
+ }
+}
\ No newline at end of file
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 a8cca96..6547773 100644
--- a/src/main/java/eu/univento/core/api/entity/EntityModifier.java
+++ b/src/main/java/eu/univento/core/api/entity/EntityModifier.java
@@ -1,5 +1,6 @@
package eu.univento.core.api.entity;
+import eu.univento.core.Core;
import net.minecraft.server.v1_10_R1.EntityLiving;
import net.minecraft.server.v1_10_R1.NBTTagCompound;
import org.bukkit.Bukkit;
@@ -21,18 +22,17 @@ public class EntityModifier {
private static CraftEntity craftentity;
private static net.minecraft.server.v1_10_R1.Entity entityS;
private static int scheduler;
- private static Plugin plugin;
+ private static Plugin plugin = Core.getInstance();
private static Player player = null;
private static float Speed;
- public EntityModifier(org.bukkit.entity.Entity entity, Plugin plugin) {
+ public EntityModifier(org.bukkit.entity.Entity entity) {
EntityModifier.entity = entity;
craftentity = (CraftEntity) entity;
entityS = craftentity.getHandle();
- EntityModifier.plugin = plugin;
}
- public static Builder modify() {
+ public Builder modify() {
return new Builder();
}
@@ -48,7 +48,7 @@ public class EntityModifier {
return this;
}
- public Builder playEffekt(EntityEffect entityeffect) {
+ public Builder playEffect(EntityEffect entityeffect) {
EntityModifier.entity.playEffect(entityeffect);
return this;
}
@@ -75,9 +75,7 @@ public class EntityModifier {
public Builder setYawPitch(float yaw, float pitch) {
Location loc = EntityModifier.entity.getLocation().clone();
- teleport(
- new Location(loc.getWorld(), loc.getX(), loc.getY(),
- loc.getZ(), yaw, pitch));
+ teleport(new Location(loc.getWorld(), loc.getX(), loc.getY(), loc.getZ(), yaw, pitch));
return this;
}
@@ -102,8 +100,7 @@ public class EntityModifier {
public Builder setInvulnerable(boolean invulnerable) {
try {
- Field invulnerableField = net.minecraft.server.v1_10_R1.Entity.class
- .getDeclaredField("invulnerable");
+ Field invulnerableField = net.minecraft.server.v1_10_R1.Entity.class.getDeclaredField("invulnerable");
invulnerableField.setAccessible(true);
invulnerableField.setBoolean(EntityModifier.entityS, invulnerable);
} catch (Exception ex) {
@@ -159,10 +156,7 @@ public class EntityModifier {
}
public Builder walkToLocation(Location location, float speed) {
- ((CraftCreature) EntityModifier.entity)
- .getHandle()
- .getNavigation()
- .a(location.getX(), location.getY(), location.getZ(), speed);
+ ((CraftCreature) EntityModifier.entity).getHandle().getNavigation().a(location.getX(), location.getY(), location.getZ(), speed);
return this;
}
@@ -171,20 +165,13 @@ public class EntityModifier {
EntityModifier.Speed = speed;
EntityModifier.scheduler = Bukkit.getScheduler().scheduleSyncRepeatingTask(EntityModifier.plugin,
() -> {
- double distance = EntityModifier.entity.getLocation().distance(
- EntityModifier.player.getLocation());
+ double distance = EntityModifier.entity.getLocation().distance(EntityModifier.player.getLocation());
if (distance < 11.0D) {
float speed1 = EntityModifier.Speed;
if (distance < 3.0D) {
speed1 = 0.0F;
}
- ((CraftCreature) EntityModifier.entity)
- .getHandle()
- .getNavigation()
- .a(EntityModifier.player.getLocation().getX(),
- EntityModifier.player.getLocation().getY(),
- EntityModifier.player.getLocation().getZ(),
- speed1);
+ ((CraftCreature) EntityModifier.entity).getHandle().getNavigation().a(EntityModifier.player.getLocation().getX(),EntityModifier.player.getLocation().getY(),EntityModifier.player.getLocation().getZ(), speed1);
} else if (EntityModifier.player.isOnGround()) {
EntityModifier.entity.teleport(EntityModifier.player);
}
diff --git a/src/main/java/eu/univento/core/api/game/GameTimer.java b/src/main/java/eu/univento/core/api/game/GameTimer.java
new file mode 100644
index 0000000..677ce8c
--- /dev/null
+++ b/src/main/java/eu/univento/core/api/game/GameTimer.java
@@ -0,0 +1,51 @@
+package eu.univento.core.api.game;
+
+import org.bukkit.plugin.Plugin;
+import org.bukkit.scheduler.BukkitRunnable;
+
+/**
+ * @author joethei
+ * @version 0.1
+ */
+public class GameTimer extends BukkitRunnable{
+
+ private Plugin plugin;
+ private int time;
+ private int minPlayers;
+ private GameTimer following;
+
+ public GameTimer(Plugin plugin, GameTimer following, int time, int minPlayers) {
+ this.plugin = plugin;
+ this.following = following;
+ this.time = time;
+ this.minPlayers = minPlayers;
+ runTaskTimer(plugin, 20L, 20L);
+ }
+
+ @Override
+ public void run() {
+ if(PlayerManager.size() >= minPlayers) {
+ time--;
+
+ }
+ if(time == 0) {
+ if(PlayerManager.size() > minPlayers) {
+ this.cancel();
+ following.run();
+ }else {
+ this.cancel();
+ //TODO: reset timer
+ this.run();
+ }
+ }
+ }
+
+ public int getTime() {
+ return time;
+ }
+
+ public int getMinPlayers() {
+ return minPlayers;
+ }
+
+}
\ No newline at end of file
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 51370e2..cb10e09 100644
--- a/src/main/java/eu/univento/core/api/game/PlayerManager.java
+++ b/src/main/java/eu/univento/core/api/game/PlayerManager.java
@@ -13,7 +13,6 @@ public class PlayerManager {
private static final List players = new LinkedList<>();
-
public static List getPlayers() {
return players;
}
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 84a7a46..7601f54 100644
--- a/src/main/java/eu/univento/core/api/game/TeamManager.java
+++ b/src/main/java/eu/univento/core/api/game/TeamManager.java
@@ -8,7 +8,7 @@ import java.util.ArrayList;
* @author joethei
* @version 0.1
*/
-class TeamManager {
+public class TeamManager {
private static final ArrayList teams = new ArrayList<>();
diff --git a/src/main/java/eu/univento/core/api/items/InventoryManager.java b/src/main/java/eu/univento/core/api/items/InventoryManager.java
index 53eb08f..212d138 100644
--- a/src/main/java/eu/univento/core/api/items/InventoryManager.java
+++ b/src/main/java/eu/univento/core/api/items/InventoryManager.java
@@ -58,10 +58,12 @@ public class InventoryManager implements Listener{
public void onInventoryClick(InventoryClickEvent e) {
int i = 0;
CustomPlayer p = CustomPlayer.getPlayer((Player) e.getWhoClicked());
- for(ClickInventory inventory : inventoryList) {
- if(inventory.getPlayer() == p)
- inventory.onInventoryClick(e);
+ if(e.getInventory() instanceof ClickInventory) {
+ for(ClickInventory inventory : inventoryList) {
+ if(inventory.getPlayer() == p)
+ inventory.onInventoryClick(e);
if(i++ == 1) break;
+ }
}
}
diff --git a/src/main/java/eu/univento/core/api/map/MapDatabase.java b/src/main/java/eu/univento/core/api/map/MapDatabase.java
index 992c4a9..fbeec43 100644
--- a/src/main/java/eu/univento/core/api/map/MapDatabase.java
+++ b/src/main/java/eu/univento/core/api/map/MapDatabase.java
@@ -1,6 +1,6 @@
package eu.univento.core.api.map;
-import eu.univento.cloud.commons.server.ServerType;
+import eu.univento.commons.server.ServerType;
import eu.univento.core.Core;
import org.bukkit.Material;
diff --git a/src/main/java/eu/univento/core/api/player/CustomPlayer.java b/src/main/java/eu/univento/core/api/player/CustomPlayer.java
index 6ba7b6c..0aeed3b 100644
--- a/src/main/java/eu/univento/core/api/player/CustomPlayer.java
+++ b/src/main/java/eu/univento/core/api/player/CustomPlayer.java
@@ -18,13 +18,11 @@ import eu.univento.core.api.utils.GameProfileBuilder;
import eu.univento.core.api.utils.UUIDFetcher;
import io.netty.buffer.ByteBuf;
import io.netty.buffer.Unpooled;
-import net.md_5.bungee.api.ChatMessageType;
-import net.md_5.bungee.api.chat.TextComponent;
import net.minecraft.server.v1_10_R1.*;
-import net.minecraft.server.v1_10_R1.World;
import org.bson.Document;
import org.bukkit.*;
import org.bukkit.Material;
+import org.bukkit.World;
import org.bukkit.attribute.Attribute;
import org.bukkit.attribute.AttributeInstance;
import org.bukkit.attribute.AttributeModifier;
@@ -46,7 +44,7 @@ import java.io.ObjectOutputStream;
import java.lang.reflect.Field;
import java.util.*;
-public class CustomPlayer extends CraftPlayer{
+public class CustomPlayer extends CraftPlayer {
private static final HashMap PLAYERS = new HashMap<>();
@@ -180,7 +178,7 @@ public class CustomPlayer extends CraftPlayer{
*/
public void sendActionBar(String text) {
- spigot().sendMessage(ChatMessageType.ACTION_BAR, new TextComponent(text));
+ //spigot().sendMessage(ChatMessageType.ACTION_BAR, new TextComponent(text));
}
public void sendTitle(int fadeIn, int stay, int fadeOut, String title, String subtitle) {
@@ -326,6 +324,8 @@ public class CustomPlayer extends CraftPlayer{
setDisplayName(name);
Field nameField = getField(GameProfile.class, "name");
try {
+ assert nameField != null;
+ nameField.setAccessible(true);
nameField.set(getProfile(), name);
PacketPlayOutEntityDestroy destroy = new PacketPlayOutEntityDestroy(getEntityId());
sendPacket(destroy);
@@ -349,8 +349,8 @@ public class CustomPlayer extends CraftPlayer{
}
public void strikeLightning(Location loc) {
- World nmsWorld = ((CraftWorld) loc.getWorld()).getHandle();
- EntityLightning lightning = new EntityLightning(nmsWorld, loc.getX(), loc.getY(), loc.getZ(), true);
+ World nmsWorld = (World) ((CraftWorld) loc.getWorld()).getHandle();
+ EntityLightning lightning = new EntityLightning((net.minecraft.server.v1_10_R1.World) nmsWorld, loc.getX(), loc.getY(), loc.getZ(), true);
sendPacket(new PacketPlayOutSpawnEntityWeather(lightning));
playSound(loc, Sound.ENTITY_LIGHTNING_IMPACT, 20.0F, 1.0F);
playSound(loc, Sound.ENTITY_LIGHTNING_THUNDER, 20.0F, 1.0F);
@@ -360,11 +360,6 @@ public class CustomPlayer extends CraftPlayer{
Blackscreen.setBlack(PLAYER, seconds);
}
- @Override
- public boolean isOnline() {
- return DATABASE_PLAYER.isOnline();
- }
-
public void setStoryResourcePack() {
setResourcePack("http://univento.eu/storyPack.zip");
}
diff --git a/src/main/java/eu/univento/core/api/player/SpectateManager.java b/src/main/java/eu/univento/core/api/player/SpectateManager.java
index a1713db..672df84 100644
--- a/src/main/java/eu/univento/core/api/player/SpectateManager.java
+++ b/src/main/java/eu/univento/core/api/player/SpectateManager.java
@@ -18,11 +18,11 @@ public class SpectateManager {
return null;
}
- public static void add(Spectator spectator) {
+ static void add(Spectator spectator) {
if(!spectators.contains(spectator)) spectators.add(spectator);
}
- public static void remove(Spectator spectator) {
+ static void remove(Spectator spectator) {
if(spectators.contains(spectator)) spectators.remove(spectator);
}
diff --git a/src/main/java/eu/univento/core/api/player/Spectator.java b/src/main/java/eu/univento/core/api/player/Spectator.java
index 62f4222..487b89a 100644
--- a/src/main/java/eu/univento/core/api/player/Spectator.java
+++ b/src/main/java/eu/univento/core/api/player/Spectator.java
@@ -1,5 +1,6 @@
package eu.univento.core.api.player;
+import eu.univento.commons.player.language.MessageConstant;
import eu.univento.core.Core;
import eu.univento.core.api.game.PlayerManager;
import eu.univento.core.api.items.ItemBuilder;
@@ -51,7 +52,7 @@ public class Spectator {
}
public void openPlayerListInventory() {
- ScrollingInventory inventory = new ScrollingInventory(player, player.getDatabasePlayer().getMessage("Game.Menu.SpectatorMenu"));
+ ScrollingInventory inventory = new ScrollingInventory(player, player.getDatabasePlayer().getLanguage().getMessage(MessageConstant.GAME_SPECTATE_MENU));
for(CustomPlayer players : PlayerManager.getPlayers()) {
inventory.addItem(new ItemBuilder(Material.SKULL_ITEM).durability((short) 3).skullOwner(players.getDisplayName()).name(players.getDisplayName()).make());
}
diff --git a/src/main/java/eu/univento/core/api/server/ServerInfo.java b/src/main/java/eu/univento/core/api/server/ServerInfo.java
index a499b03..6f79d54 100644
--- a/src/main/java/eu/univento/core/api/server/ServerInfo.java
+++ b/src/main/java/eu/univento/core/api/server/ServerInfo.java
@@ -1,5 +1,7 @@
package eu.univento.core.api.server;
+import eu.univento.commons.server.ServerType;
+
import java.util.regex.Pattern;
/**
diff --git a/src/main/java/eu/univento/core/api/server/ServerSettings.java b/src/main/java/eu/univento/core/api/server/ServerSettings.java
index 7c42fe9..8e8c28c 100644
--- a/src/main/java/eu/univento/core/api/server/ServerSettings.java
+++ b/src/main/java/eu/univento/core/api/server/ServerSettings.java
@@ -1,6 +1,6 @@
package eu.univento.core.api.server;
-import eu.univento.cloud.commons.server.ServerType;
+import eu.univento.commons.server.ServerType;
import eu.univento.core.Core;
import eu.univento.core.commands.Build;
import eu.univento.core.listeners.Blocks;
diff --git a/src/main/java/eu/univento/core/api/shop/ShopCategory.java b/src/main/java/eu/univento/core/api/shop/ShopCategory.java
index 12ec21b..fbc673a 100644
--- a/src/main/java/eu/univento/core/api/shop/ShopCategory.java
+++ b/src/main/java/eu/univento/core/api/shop/ShopCategory.java
@@ -1,6 +1,6 @@
package eu.univento.core.api.shop;
-import eu.univento.cloud.commons.server.ServerType;
+import eu.univento.commons.server.ServerType;
/**
* @author joethei
diff --git a/src/main/java/eu/univento/core/api/story/StoryMission.java b/src/main/java/eu/univento/core/api/story/StoryMission.java
new file mode 100644
index 0000000..a970225
--- /dev/null
+++ b/src/main/java/eu/univento/core/api/story/StoryMission.java
@@ -0,0 +1,51 @@
+package eu.univento.core.api.story;
+
+import eu.univento.core.Core;
+import eu.univento.core.api.player.CustomPlayer;
+import lombok.Data;
+import org.bukkit.Bukkit;
+import org.bukkit.event.HandlerList;
+import org.bukkit.event.Listener;
+import org.bukkit.plugin.PluginManager;
+
+import java.util.List;
+
+/**
+ * @author joethei
+ * @version 0.1
+ */
+
+@Data
+public class StoryMission{
+
+ private PluginManager pluginManager;
+ private List listeners;
+ private StoryMissions mission;
+ private CustomPlayer player;
+
+ public StoryMission(StoryMissions mission, CustomPlayer player) {
+ this.mission = mission;
+ this.player = player;
+ this.pluginManager = Bukkit.getPluginManager();
+ player.getDatabasePlayer().setInDatabase("mission", mission.getId());
+ setStatus(StoryMissionStatus.RUNNING);
+ }
+
+ public void registerEvent(Listener listener) {
+ listeners.add(listener);
+ pluginManager.registerEvents(listener, Core.getInstance());
+ }
+
+ public boolean unregisterEvent(Listener listener) {
+ HandlerList.unregisterAll(listener);
+ return listeners.contains(listener) && listeners.remove(listener);
+ }
+
+ public void unregisterEvents() {
+ listeners.forEach(HandlerList::unregisterAll);
+ }
+
+ public void setStatus(StoryMissionStatus status) {
+ player.getDatabasePlayer().setInDatabase("missionStatus", status.name());
+ }
+}
\ No newline at end of file
diff --git a/src/main/java/eu/univento/core/api/story/StoryMissionStatus.java b/src/main/java/eu/univento/core/api/story/StoryMissionStatus.java
new file mode 100644
index 0000000..1997b97
--- /dev/null
+++ b/src/main/java/eu/univento/core/api/story/StoryMissionStatus.java
@@ -0,0 +1,11 @@
+package eu.univento.core.api.story;
+
+/**
+ * @author joethei
+ * @version 0.1
+ */
+public enum StoryMissionStatus {
+
+ RUNNING,
+ DONE,
+}
\ No newline at end of file
diff --git a/src/main/java/eu/univento/core/api/story/StoryMissions.java b/src/main/java/eu/univento/core/api/story/StoryMissions.java
new file mode 100644
index 0000000..16cc5eb
--- /dev/null
+++ b/src/main/java/eu/univento/core/api/story/StoryMissions.java
@@ -0,0 +1,23 @@
+package eu.univento.core.api.story;
+
+import lombok.Getter;
+
+/**
+ * @author joethei
+ * @version 0.1
+ */
+
+public enum StoryMissions {
+
+ START(1, "Story.Mission.Start");
+
+ @Getter
+ private int id;
+ @Getter
+ private String name;
+
+ StoryMissions(int id, String name) {
+ this.id = id;
+ this.name = name;
+ }
+}
\ No newline at end of file
diff --git a/src/main/java/eu/univento/core/commands/Nick.java b/src/main/java/eu/univento/core/commands/Nick.java
index cf55a6e..9d77f73 100644
--- a/src/main/java/eu/univento/core/commands/Nick.java
+++ b/src/main/java/eu/univento/core/commands/Nick.java
@@ -46,7 +46,9 @@ public class Nick extends AutoCommand{
p.getDatabasePlayer().getSettings().setNickStatus(true);
p.getScoreboard().getTeam(p.getDatabasePlayer().getRank().getTeam()).addEntry(p.getDisplayName());
p.sendMessage(msgs.PREFIX() + msgs.Core_NICK_ON());
- p.setNick(NickName.getRandomNick());
+ String nick = NickName.getRandomNick();
+ p.setNick(nick);
+ //Core.getDebugManager().sendOverlay("der Nick ist " + nick);
}
}else {
p.sendMessage(msgs.NO_PERMS());
diff --git a/src/main/java/eu/univento/core/listeners/JoinQuit.java b/src/main/java/eu/univento/core/listeners/JoinQuit.java
index d6e6837..1d5c536 100644
--- a/src/main/java/eu/univento/core/listeners/JoinQuit.java
+++ b/src/main/java/eu/univento/core/listeners/JoinQuit.java
@@ -1,5 +1,6 @@
package eu.univento.core.listeners;
+import eu.univento.commons.player.language.MessageConstant;
import eu.univento.core.Core;
import eu.univento.core.api.Utils;
import eu.univento.core.api.player.*;
@@ -102,11 +103,11 @@ public class JoinQuit implements Listener {
loading.remove(p);
}
if(e.getStatus() == PlayerResourcePackStatusEvent.Status.FAILED_DOWNLOAD) {
- p.sendMessage(p.getDatabasePlayer().getMessage("Pack.failed_download"));
+ p.sendMessage(p.getDatabasePlayer().getLanguage().getMessage(MessageConstant.PACK_FAILED_DOWNLOAD));
Bukkit.getScheduler().runTaskLaterAsynchronously(Core.getInstance(), p::setStoryResourcePack, 10 * 20L);
}
if(e.getStatus() == PlayerResourcePackStatusEvent.Status.DECLINED) {
- p.sendMessage(p.getDatabasePlayer().getMessage("Pack.declined"));
+ p.sendMessage(p.getDatabasePlayer().getLanguage().getMessage(MessageConstant.PACK_DECLINED));
Bukkit.getScheduler().runTaskLaterAsynchronously(Core.getInstance(), p::setStoryResourcePack, 10 * 20L);
}
}