diff --git a/.gitignore b/.gitignore index 465e7ae..f264249 100644 --- a/.gitignore +++ b/.gitignore @@ -2,4 +2,5 @@ /server /build Core.iml -run-server.sh \ No newline at end of file +run-server.sh +core.png \ No newline at end of file diff --git a/Core.iml b/Core.iml index 31d1fd1..11dd5a8 100644 --- a/Core.iml +++ b/Core.iml @@ -29,6 +29,7 @@ + @@ -43,6 +44,10 @@ + + + + @@ -53,7 +58,6 @@ - @@ -90,12 +94,17 @@ + + + + + - + \ No newline at end of file diff --git a/core.uml b/core.uml new file mode 100644 index 0000000..9e3593d --- /dev/null +++ b/core.uml @@ -0,0 +1,2711 @@ + + + JAVA + eu.univento.core + + eu.univento.core.api.command.CommandFramework + eu.univento.core.api.camera.CameraUtil + eu.univento.core.api.command.Command + eu.univento.core.api.utils.reflection.IReflection.ConstructorAccessor + eu.univento.core.api.server.MojangService + eu.univento.core.api.player.NickedPlayer + eu.univento.core.listeners.Events + eu.univento.core.api.shop.ShopCategory + eu.univento.core.commands.ModCommands + eu.univento.core.api.advancement.CustomAdvancement + eu.univento.core.api.quest.QuestRequirement + eu.univento.core.antihack.modules.Packets + eu.univento.core.api.map.MapVoting + eu.univento.core.api.command.BukkitCompleter + eu.univento.core.api.gui.AnvilGUI.AnvilSlot + eu.univento.core.api.gui.hologram.components.GUIComponent + eu.univento.core.api.gui.inventory.InventoryGUI + eu.univento.core.api.advancement.Advancement + eu.univento.core.api.customitems.swords.CustomSwordManager + eu.univento.core.api.gui.hologram.components.GUIPageModel + eu.univento.core.api.quest.QuestRewardType + eu.univento.core.commands.HologramCommands + eu.univento.core.api.blocks.banners.BannerString + eu.univento.core.api.blocks.banners.BannerColor + eu.univento.core.api.utils.Vectors + eu.univento.core.api.shop.ShopMenu + eu.univento.core.antihack.AntiHack + eu.univento.core.api.effects.ParticleEffect.ParticleColor + eu.univento.core.listeners.Commands + eu.univento.core.listeners.PluginMessenger + eu.univento.core.api.blocks.MiniBlock + eu.univento.core.listeners.WorkbenchEvents + eu.univento.core.api.customitems.CustomItemActions.CustomItemActionsBuilder + eu.univento.core.api.gui.AnvilGUI.AnvilClickEventHandler + eu.univento.core.api.events.HologramClickEvent + eu.univento.core.api.Config + eu.univento.core.api.customitems.CustomItems + eu.univento.core.api.advancement.Advancement.AdvancementBackground + eu.univento.core.api.items.attribute.ItemAttributes + eu.univento.core.api.gui.hologram.components.ComponentPosition + eu.univento.core.antihack.modules.SelfHit + eu.univento.core.api.map.MapDownloader + eu.univento.core.antihack.Hack + eu.univento.core.api.customitems.CustomItemManager + eu.univento.core.api.player.Skin + eu.univento.core.api.shop.ShopItem + eu.univento.core.api.events.MoveEventFilter.PlayerBlockMoveEvent + eu.univento.core.api.player.BetterPvP + eu.univento.core.antihack.modules.AutoRespawn + eu.univento.core.api.game.PlayerManager + eu.univento.core.api.utils.reflection.IReflection.FieldAccessor + eu.univento.core.api.items.HeadDB + eu.univento.core.listeners.cloud.Servers + eu.univento.core.api.story.StoryMissions + eu.univento.core.api.customitems.swords.CustomSword + eu.univento.core.api.events.BorderLeaveEvent + eu.univento.core.api.map.Map + eu.univento.core.listeners.cloud.CloudNet + eu.univento.core.api.customitems.CustomArmor + eu.univento.core.api.utils.reflection.IReflection.DataType + eu.univento.core.api.shop.entity.ShopEntity + eu.univento.core.api.quest.QuestRequirementType + eu.univento.core.api.gui.AnvilGUI + eu.univento.core.api.blocks.banners.Shape + eu.univento.core.listeners.JoinQuit + eu.univento.core.api.effects.ParticleEffect.ParticleProperty + eu.univento.core.api.utils.RandomCollection + eu.univento.core.api.gui.sign.SignInputHandler + eu.univento.core.api.utils.reflection.ReflectionUtils.DataType + eu.univento.core.customitems.weapons.closecombat.ThiefsDagger + eu.univento.core.api.entity.EntityModifier.Builder + eu.univento.core.api.player.Spectator + eu.univento.core.api.schematic.Schematic + eu.univento.core.api.entity.pathfinding.PathingResult + eu.univento.core.api.cloud.CloudApiWrapper + eu.univento.core.api.utils.reflection.IReflection.ServerPacket + eu.univento.core.api.chat.DefaultFontInfo + eu.univento.core.api.effects.ParticleEffect.ParticlePacket.PacketSendingException + eu.univento.core.api.gui.hologram.components.PlayerGUIPageModel + eu.univento.core.api.utils.Maths.Atan2 + eu.univento.core.api.gui.hologram.components.PlayerGUIComponent + eu.univento.core.api.gui.inventory.PagedInventoryGUI + eu.univento.core.commands.VIPCommands + eu.univento.core.api.utils.reflection.IReflection.MethodAccessor + eu.univento.core.api.utils.Maths.Sin + eu.univento.core.api.quest.QuestActionType + eu.univento.core.api.entity.ArmorStandAnimator + eu.univento.core.commands.BuilderCommands + eu.univento.core.api.entity.pathfinding.AStar + eu.univento.core.api.effects.ParticleEffect.ParticleColorException + eu.univento.core.api.gui.hologram.components.PlayerGUIPage + eu.univento.core.api.blocks.banners.ShapeRegistry + eu.univento.core.commands.DevCommands + eu.univento.core.api.map.MapDatabase + eu.univento.core.api.gui.hologram.components.GUIPage + eu.univento.core.api.schematic.Cuboid + eu.univento.core.api.utils.Direction + eu.univento.core.api.effects.ParticleEffect.ParticlePacket.PacketInstantiationException + eu.univento.core.api.utils.reflection.ReflectionUtils.PackageType + eu.univento.core.api.utils.UUIDFetcher + eu.univento.core.api.events.MoveEventFilter.BlockPosition + eu.univento.core.api.gui.sign.SignInput + eu.univento.core.api.command.Completer + eu.univento.core.api.player.SpectateManager + eu.univento.core.api.server.MojangService.Status + eu.univento.core.Core + eu.univento.core.listeners.Chat + eu.univento.core.antihack.modules.Reach + eu.univento.core.api.command.CommandArgs + eu.univento.core.listeners.NPCEvents + eu.univento.core.customitems.weapons.closecombat.CloseCombatEvents + eu.univento.core.api.effects.ParticleEffect.BlockData + eu.univento.core.antihack.modules.Nuker + eu.univento.core.api.customitems.actions.InteractBlockAction + eu.univento.core.api.advancement.Advancement.FrameType + eu.univento.core.api.items.ItemBuilder + eu.univento.core.api.quest.QuestTaskType + eu.univento.core.api.effects.Effects + eu.univento.core.api.effects.ParticleEffect.ParticleData + eu.univento.core.api.AutoCommand + eu.univento.core.api.hologram.Hologram + eu.univento.core.api.customitems.CustomItem.CustomItemBuilder + eu.univento.core.api.items.attribute.ItemSlot + eu.univento.core.api.command.BukkitCommand + eu.univento.core.api.npc.NPC + eu.univento.core.api.customitems.Rarity + eu.univento.core.api.utils.GameProfileBuilder.GameProfileSerializer + eu.univento.core.api.entity.pathfinding.Tile + eu.univento.core.api.gui.AnvilGUI.AnvilContainer + eu.univento.core.antihack.modules.Movement + eu.univento.core.api.player.CustomPlayer + eu.univento.core.api.shop.entity.ShopVillager + eu.univento.core.api.effects.Blackscreen + eu.univento.core.api.npc.NPCChannel + eu.univento.core.api.story.StoryMissionStatus + eu.univento.core.api.gui.sign.PlayerSignInputEvent + eu.univento.core.api.effects.ParticleEffect.ItemData + eu.univento.core.api.quest.Quest + eu.univento.core.api.utils.GameProfileBuilder.CachedProfile + eu.univento.core.api.effects.ParticleEffect.ParticlePacket.VersionIncompatibleException + eu.univento.core.api.gui.hologram.components.PlayerGUITextBoxComponent + eu.univento.core.api.entity.ArmorStandAnimator.Frame + eu.univento.core.api.effects.ParticleEffect.ParticleDataException + eu.univento.core.api.player.NickName + eu.univento.core.api.effects.ParticleEffect.NoteColor + eu.univento.core.api.game.TeamManager + eu.univento.core.api.effects.ParticleEffect.ParticleVersionException + eu.univento.core.api.gui.hologram.components.StationaryPlayerGUIPage + eu.univento.core.api.gui.hologram.components.ComponentProperties + eu.univento.core.api.utils.GameProfileBuilder + eu.univento.core.api.hologram.HologramManager + eu.univento.core.api.customitems.actions.InteractPlayerAction + eu.univento.core.api.blocks.banners.FloatingText + eu.univento.core.api.effects.ParticleEffect.OrdinaryColor + eu.univento.core.api.gui.AnvilGUI.AnvilClickEvent + eu.univento.core.api.utils.Maths + eu.univento.core.api.customitems.actions.PlayerHitAction + eu.univento.core.api.gui.hologram.HologramGUI + eu.univento.core.api.utils.NettyInjection.PacketInjection + eu.univento.core.antihack.modules.AutoClicker + eu.univento.core.api.gui.hologram.components.IValueHolder + eu.univento.core.antihack.modules.FastPlace + eu.univento.core.api.utils.reflection.IReflection + eu.univento.core.commands.AdminCommands + eu.univento.core.api.camera.Traveller + eu.univento.core.api.items.attribute.Attribute + eu.univento.core.api.effects.ParticleEffect + eu.univento.core.api.items.attribute.AttributeModifier + eu.univento.core.api.story.StoryMission + eu.univento.core.api.quest.QuestReward + eu.univento.core.commands.PlayerCommands + eu.univento.core.api.customitems.CustomItemActions + eu.univento.core.api.utils.NettyInjection + eu.univento.core.api.player.LabyMod + eu.univento.core.api.utils.Lamps + eu.univento.core.listeners.WeaponEvents + eu.univento.core.api.entity.EntityModifier + eu.univento.core.antihack.modules.Criticals + eu.univento.core.api.quest.QuestAction + eu.univento.core.api.Hologram + eu.univento.core.api.npc.NPCNetworkManager + eu.univento.core.api.effects.ParticleWorldBoarder + eu.univento.core.api.npc.NPCPlayerConnection + eu.univento.core.antihack.modules.AutoSoup + eu.univento.core.api.gui.hologram.HologramData + eu.univento.core.api.entity.pathfinding.AStar.InvalidPathException + eu.univento.core.api.items.Pagifier + eu.univento.core.api.effects.ParticleEffect.ParticlePacket + eu.univento.core.api.schematic.SchematicManager + eu.univento.core.api.events.MoveEventFilter + eu.univento.core.api.utils.reflection.ReflectionUtils + eu.univento.core.api.customitems.CustomItem + eu.univento.core.api.quest.QuestTask + eu.univento.core.antihack.modules.Regen + eu.univento.core.api.game.Team + eu.univento.core.listeners.Blocks + eu.univento.core.api.gui.hologram.components.PlayerGUIValueBoxComponent + eu.univento.core.api.gui.Action + eu.univento.core.api.utils.reflection.ArrayWrapper + eu.univento.core.listeners.SpectatorEvents + eu.univento.core.api.utils.NettyInjection.PacketHandler + eu.univento.core.api.server.ServerSettings + eu.univento.core.api.world.WorldReset + eu.univento.core.api.shop.entity.ShopIronGolem + eu.univento.core.antihack.modules.BowAimbot + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + Fields + Inner Classes + Constructors + Properties + Methods + + All + private + + diff --git a/pom.xml b/pom.xml index 8a4d6b9..132eaf5 100644 --- a/pom.xml +++ b/pom.xml @@ -67,6 +67,18 @@ provided + + com.comphenix.protocol + ProtocolLib-API + 4.3.0 + provided + + + com.github.dmulloy2 + PacketWrapper + master-2b4bfddd12-1 + + org.projectlombok lombok @@ -113,7 +125,7 @@ de.dytanic.cloudnet cloudnet-api - 2.0 + LATEST provided diff --git a/src/main/java/eu/univento/core/Core.java b/src/main/java/eu/univento/core/Core.java index c2b0e02..50f8263 100644 --- a/src/main/java/eu/univento/core/Core.java +++ b/src/main/java/eu/univento/core/Core.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2017 univento.eu - All rights reserved + * Copyright (c) 2018 univento.eu - All rights reserved * You are not allowed to use, distribute or modify this code */ @@ -7,13 +7,20 @@ package eu.univento.core; import co.aikar.taskchain.BukkitTaskChainFactory; import co.aikar.taskchain.TaskChainFactory; +import com.comphenix.protocol.PacketType; +import com.comphenix.protocol.ProtocolLibrary; +import com.comphenix.protocol.ProtocolManager; +import com.comphenix.protocol.events.ListenerOptions; +import com.comphenix.protocol.events.ListenerPriority; +import com.comphenix.protocol.events.PacketAdapter; +import com.comphenix.protocol.events.PacketEvent; import eu.univento.commons.Commons; -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.HeadDB; import eu.univento.core.api.player.CustomPlayer; import eu.univento.core.commands.*; import eu.univento.core.customitems.weapons.closecombat.CloseCombatEvents; @@ -31,10 +38,10 @@ 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.Collections; import java.util.Iterator; import java.util.LinkedList; import java.util.logging.Level; @@ -53,6 +60,8 @@ public class Core extends JavaPlugin{ @Getter private static TaskChainFactory taskChainFactory; @Getter private static Tasket tasket; @Getter private static CloudApiWrapper cloudAPI; + @Getter private static ProtocolManager protocolManager; + @Getter private static HeadDB headDB; public static String getNMSVersion() { final String packageName = Bukkit.getServer().getClass().getPackage().getName(); @@ -71,6 +80,14 @@ public class Core extends JavaPlugin{ @Override public void onEnable() { commons = new Commons(); + instance = this; + protocolManager = ProtocolLibrary.getProtocolManager(); + protocolManager.addPacketListener(new PacketAdapter(this, ListenerPriority.NORMAL, Collections.singletonList(PacketType.Play.Server.CHAT), ListenerOptions.SKIP_PLUGIN_VERIFIER) { + @Override + public void onPacketSending(PacketEvent event) { + super.onPacketSending(event); + } + }); SentryClient sentryClient = Sentry.init(commons.getConfigurationHandler().getString("Sentry.DSN.Core")); try { @@ -86,40 +103,6 @@ public class Core extends JavaPlugin{ logHandler.setLevel(Level.INFO); getLogger().addHandler(logHandler); - getLogger().info("\n" + - "\n" + - " \n" + - " \n" + - " \n" + - " \n" + - " \n" + - " \n" + - " \n" + - " \n" + - " _ _ _ \n" + - " | | | | (_) \n" + - " ___ ___ _ ____ _____ _ __ ___| |_ __ _ _ __| |_ _ _ __ __ _ \n" + - "/ __|/ _ \\ '__\\ \\ / / _ \\ '__| / __| __/ _` | '__| __| | '_ \\ / _` |\n" + - "\\__ \\ __/ | \\ V / __/ | \\__ \\ || (_| | | | |_| | | | | (_| |\n" + - "|___/\\___|_| \\_/ \\___|_| |___/\\__\\__,_|_| \\__|_|_| |_|\\__, |\n" + - " __/ |\n" + - " |___/ \n" + - " \n" + - " \n" + - " \n" + - " \n" + - " \n" + - " \n" + - " \n" + - " \n" + - "\n"); - try { - Config.writeDefault(); - } catch (IOException e) { - e.printStackTrace(); - } - instance = this; - taskChainFactory = BukkitTaskChainFactory.create(this); tasket = new BukkitTasket(this); cloudAPI = new CloudApiWrapper(); @@ -146,10 +129,8 @@ public class Core extends JavaPlugin{ 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"); @@ -164,7 +145,7 @@ public class Core extends JavaPlugin{ Bukkit.getMessenger().registerOutgoingPluginChannel(this, "schematica"); Servers.register(); - + headDB = new HeadDB(); Blackscreen.setupUtil(getInstance()); for(CustomAdvancement advancement : CustomAdvancement.values()) advancement.load(); @@ -179,20 +160,6 @@ public class Core extends JavaPlugin{ } */ } - - Bukkit.getScheduler().scheduleSyncDelayedTask(this, () -> getLogger().info("\n" + - "\n" + - "\n" + - " _ _ \n" + - " | (_) \n" + - " ___ ___ _ ____ _____ _ __ ___ _ __ | |_ _ __ ___ \n" + - "/ __|/ _ \\ '__\\ \\ / / _ \\ '__| / _ \\| '_ \\| | | '_ \\ / _ \\\n" + - "\\__ \\ __/ | \\ V / __/ | | (_) | | | | | | | | | __/\n" + - "|___/\\___|_| \\_/ \\___|_| \\___/|_| |_|_|_|_| |_|\\___|\n" + - " \n" + - " \n" + - "\n"), 0L); - /* Bukkit.getScheduler().scheduleSyncRepeatingTask(this, () -> { diff --git a/src/main/java/eu/univento/core/api/cloud/CloudApiWrapper.java b/src/main/java/eu/univento/core/api/cloud/CloudApiWrapper.java index c93e86f..37e972a 100644 --- a/src/main/java/eu/univento/core/api/cloud/CloudApiWrapper.java +++ b/src/main/java/eu/univento/core/api/cloud/CloudApiWrapper.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2017 univento.eu - All rights reserved + * Copyright (c) 2018 univento.eu - All rights reserved * You are not allowed to use, distribute or modify this code */ @@ -51,4 +51,8 @@ public class CloudApiWrapper { return future; } + public String getServerId() { + return cloudAPI.getServerId(); + } + } \ No newline at end of file diff --git a/src/main/java/eu/univento/core/api/gui/InventoryGUI.java b/src/main/java/eu/univento/core/api/gui/inventory/InventoryGUI.java similarity index 79% rename from src/main/java/eu/univento/core/api/gui/InventoryGUI.java rename to src/main/java/eu/univento/core/api/gui/inventory/InventoryGUI.java index aae1db6..9931cc6 100644 --- a/src/main/java/eu/univento/core/api/gui/InventoryGUI.java +++ b/src/main/java/eu/univento/core/api/gui/inventory/InventoryGUI.java @@ -1,12 +1,14 @@ /* - * Copyright (c) 2017 univento.eu - All rights reserved + * Copyright (c) 2018 univento.eu - All rights reserved * You are not allowed to use, distribute or modify this code */ -package eu.univento.core.api.gui; +package eu.univento.core.api.gui.inventory; import eu.univento.core.Core; +import eu.univento.core.api.gui.Action; import eu.univento.core.api.player.CustomPlayer; +import lombok.Getter; import org.bukkit.Bukkit; import org.bukkit.entity.Player; import org.bukkit.event.EventHandler; @@ -25,7 +27,7 @@ import java.util.Map; public class InventoryGUI implements Listener{ private CustomPlayer player; - private Inventory inventory; + @Getter private Inventory inventory; private Map actions; public InventoryGUI(CustomPlayer player, int size, String title) { @@ -40,6 +42,12 @@ public class InventoryGUI implements Listener{ actions.put(slot, action); } + public void addItem(ItemStack item, Action action) { + int slot = inventory.firstEmpty(); + inventory.setItem(slot, item); + actions.put(slot, action); + } + public void open() { player.openInventory(inventory); } diff --git a/src/main/java/eu/univento/core/api/gui/inventory/PagedInventoryGUI.java b/src/main/java/eu/univento/core/api/gui/inventory/PagedInventoryGUI.java new file mode 100644 index 0000000..ef2df49 --- /dev/null +++ b/src/main/java/eu/univento/core/api/gui/inventory/PagedInventoryGUI.java @@ -0,0 +1,57 @@ +/* + * Copyright (c) 2018 univento.eu - All rights reserved + * You are not allowed to use, distribute or modify this code + */ + +package eu.univento.core.api.gui.inventory; + +import eu.univento.core.api.gui.Action; +import eu.univento.core.api.items.ItemBuilder; +import eu.univento.core.api.player.CustomPlayer; +import org.bukkit.Material; +import org.bukkit.event.Listener; +import org.bukkit.inventory.ItemStack; + +import java.util.HashMap; +import java.util.Map; + +public class PagedInventoryGUI implements Listener{ + + private CustomPlayer player; + private String title; + private ItemStack next = new ItemBuilder(Material.ARROW).name("§eNächste Seite").build(); + private ItemStack back = new ItemBuilder(Material.ARROW).name("§eVorherige Seite Seite").build(); + + private Map pages = new HashMap<>(); + + public PagedInventoryGUI(CustomPlayer player, String title) { + this.player = player; + this.title = title; + } + + public PagedInventoryGUI(CustomPlayer player, String title, ItemStack back, ItemStack next) { + this.player = player; + this.title = title; + this.back = back; + this.next = next; + } + + public void addItem(ItemStack item, Action action) { + if(pages.get(pages.size()).getInventory().firstEmpty() == 46) { + pages.put(pages.size() + 1, new InventoryGUI(player, 54, title + " Seite " + pages.size())); + pages.get(pages.size()).addItem(53, next, player -> { + player.closeInventory(); + pages.get(pages.size() -1).open(); + }); + pages.get(pages.size()).addItem(45, back, player -> { + player.closeInventory(); + pages.get(pages.size() - 1).open(); + }); + } + pages.get(pages.size()).addItem(item, action); + } + + public void open() { + pages.get(0).open(); + } +} \ No newline at end of file diff --git a/src/main/java/eu/univento/core/api/items/HeadDB.java b/src/main/java/eu/univento/core/api/items/HeadDB.java new file mode 100644 index 0000000..83abc0d --- /dev/null +++ b/src/main/java/eu/univento/core/api/items/HeadDB.java @@ -0,0 +1,46 @@ +/* + * Copyright (c) 2018 univento.eu - All rights reserved + * You are not allowed to use, distribute or modify this code + */ + +package eu.univento.core.api.items; + +import eu.univento.core.Core; +import io.vertx.core.json.JsonObject; +import io.vertx.ext.web.client.WebClient; +import lombok.Getter; + +import java.util.HashMap; + +public class HeadDB { + + @Getter private HashMap blocks = new HashMap<>(); + @Getter private HashMap food = new HashMap<>(); + @Getter private HashMap electronics = new HashMap<>(); + @Getter private HashMap characters = new HashMap<>(); + @Getter private HashMap flags = new HashMap<>(); + @Getter private HashMap letters = new HashMap<>(); + @Getter private HashMap halloween = new HashMap<>(); + @Getter private HashMap christmas = new HashMap<>(); + + public HeadDB() { + get("blocks", blocks); + get("food", food); + get("electronics", electronics); + get("characters", characters); + get("flags", flags); + get("letters", letters); + get("halloween", halloween); + get("christmas", christmas); + } + + private void get(String name, HashMap map) { + WebClient.create(Core.getCommons().getVertx()).get(443, "headdb.com", "/api/category/" + name).ssl(true).send(event -> { + if (event.failed()) event.cause().printStackTrace(); + event.result().bodyAsJsonObject().forEach(stringObjectEntry -> { + JsonObject json = new JsonObject(stringObjectEntry.getValue().toString()); + map.put(json.getString("name"), json.getJsonObject("valueDecoded").getJsonObject("textures").getJsonObject("SKIN").getString("url")); + }); + }); + } +} \ No newline at end of file diff --git a/src/main/java/eu/univento/core/api/items/ItemBuilder.java b/src/main/java/eu/univento/core/api/items/ItemBuilder.java index b0bd34d..b9ef50f 100644 --- a/src/main/java/eu/univento/core/api/items/ItemBuilder.java +++ b/src/main/java/eu/univento/core/api/items/ItemBuilder.java @@ -1,11 +1,12 @@ /* - * Copyright (c) 2017 univento.eu - All rights reserved + * Copyright (c) 2018 univento.eu - All rights reserved * You are not allowed to use, distribute or modify this code */ package eu.univento.core.api.items; import com.mojang.authlib.GameProfile; +import com.mojang.authlib.properties.Property; import eu.univento.commons.player.language.MessageConstant; import eu.univento.commons.player.user.UserInformation; import eu.univento.core.api.items.attribute.Attribute; @@ -370,6 +371,25 @@ public class ItemBuilder { return this; } + public ItemBuilder skullUrl(String url) { + + SkullMeta headMeta = (SkullMeta) meta(); + GameProfile profile = new GameProfile(UUID.randomUUID(), null); + byte[] encodedData = Base64.getEncoder().encode(String.format("{textures:{SKIN:{url:\"%s\"}}}", url).getBytes()); + profile.getProperties().put("textures", new Property("textures", new String(encodedData))); + Field profileField; + try { + profileField = headMeta.getClass().getDeclaredField("profile"); + profileField.setAccessible(true); + profileField.set(headMeta, profile); + } catch (NoSuchFieldException | IllegalArgumentException | IllegalAccessException e1) { + e1.printStackTrace(); + } + item.setItemMeta(headMeta); + + return this; + } + /** * Returns the {@link ItemMeta} of the {@link ItemStack} * 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 e1ba7ac..c3190a9 100644 --- a/src/main/java/eu/univento/core/api/player/CustomPlayer.java +++ b/src/main/java/eu/univento/core/api/player/CustomPlayer.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2017 univento.eu - All rights reserved + * Copyright (c) 2018 univento.eu - All rights reserved * You are not allowed to use, distribute or modify this code */ @@ -19,6 +19,7 @@ import eu.univento.core.api.chat.DefaultFontInfo; import eu.univento.core.api.effects.Blackscreen; import eu.univento.core.api.effects.Effects; import eu.univento.core.api.gui.hologram.HologramData; +import eu.univento.core.api.quest.Quest; import eu.univento.core.api.server.ServerSettings; import io.netty.buffer.ByteBuf; import io.netty.buffer.Unpooled; @@ -62,7 +63,6 @@ import java.util.concurrent.CompletableFuture; public class CustomPlayer extends CraftPlayer { - private static final HashMap PLAYERS = new HashMap<>(); private static final Map nickedPlayers = new HashMap<>(); private final Player PLAYER; @@ -72,8 +72,7 @@ public class CustomPlayer extends CraftPlayer { private final GameProfile gameProfile; - @Getter - private HologramData hologramData; + @Getter private HologramData hologramData; private CustomPlayer(Player player) { super((CraftServer) Bukkit.getServer(), ((CraftPlayer) player).getHandle()); @@ -385,6 +384,13 @@ public class CustomPlayer extends CraftPlayer { return nickedPlayers.containsKey(getUniqueId()); } + /* + Quest + */ + + @Getter private Quest quest; + + /* Miscellaneous */ @@ -451,7 +457,8 @@ public class CustomPlayer extends CraftPlayer { } public void setStoryResourcePack() { - setResourcePack("http://univento.eu/storyPack.zip"); + setResourcePack("http://download1053.mediafireuserdownload.com/azvfl4fchheg/czy67lcvstrl9r5/TSF+Resource+Pack+v1.3.2.zip"); + //setResourcePack("http://univento.eu/storyPack.zip"); } public void initScoreboard() { 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 53246a4..8d17fa7 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,5 @@ /* - * Copyright (c) 2017 univento.eu - All rights reserved + * Copyright (c) 2018 univento.eu - All rights reserved * You are not allowed to use, distribute or modify this code */ @@ -7,7 +7,7 @@ package eu.univento.core.api.player; import eu.univento.core.Core; import eu.univento.core.api.game.PlayerManager; -import eu.univento.core.api.gui.InventoryGUI; +import eu.univento.core.api.gui.inventory.InventoryGUI; import eu.univento.core.api.items.ItemBuilder; import eu.univento.core.api.server.ServerSettings; import org.bukkit.GameMode; diff --git a/src/main/java/eu/univento/core/api/quest/Quest.java b/src/main/java/eu/univento/core/api/quest/Quest.java new file mode 100644 index 0000000..ac8c506 --- /dev/null +++ b/src/main/java/eu/univento/core/api/quest/Quest.java @@ -0,0 +1,35 @@ +/* + * Copyright (c) 2018 univento.eu - All rights reserved + * You are not allowed to use, distribute or modify this code + */ + +package eu.univento.core.api.quest; + +import eu.univento.core.Core; +import eu.univento.core.api.player.CustomPlayer; +import io.vertx.core.json.JsonObject; +import lombok.Getter; + +import java.util.List; + +@Getter +public class Quest { + + private String name; + private String description; + private QuestRequirement requirement; + private QuestRewardType reward; + private List tasks; + + public Quest(String name) { + this.name = name; + Core.getCommons().getDatabaseManager().getMongoDB().getClient().findOne("quests", new JsonObject().put("name", name), null, event -> { + if(event.failed()) event.cause().printStackTrace(); + this.description = event.result().getString("description"); + }); + } + + public void start(CustomPlayer player) { + + } +} \ No newline at end of file diff --git a/src/main/java/eu/univento/core/api/quest/QuestAction.java b/src/main/java/eu/univento/core/api/quest/QuestAction.java new file mode 100644 index 0000000..4aefaaa --- /dev/null +++ b/src/main/java/eu/univento/core/api/quest/QuestAction.java @@ -0,0 +1,17 @@ +/* + * Copyright (c) 2018 univento.eu - All rights reserved + * You are not allowed to use, distribute or modify this code + */ + +package eu.univento.core.api.quest; + +import lombok.Getter; + +public class QuestAction { + + @Getter private boolean done; + + public QuestAction(Quest quest, String name) { + + } +} \ No newline at end of file diff --git a/src/main/java/eu/univento/core/api/quest/QuestActionType.java b/src/main/java/eu/univento/core/api/quest/QuestActionType.java new file mode 100644 index 0000000..6a691a3 --- /dev/null +++ b/src/main/java/eu/univento/core/api/quest/QuestActionType.java @@ -0,0 +1,10 @@ +/* + * Copyright (c) 2018 univento.eu - All rights reserved + * You are not allowed to use, distribute or modify this code + */ + +package eu.univento.core.api.quest; + +public enum QuestActionType { + +} \ No newline at end of file diff --git a/src/main/java/eu/univento/core/api/quest/QuestRequirement.java b/src/main/java/eu/univento/core/api/quest/QuestRequirement.java new file mode 100644 index 0000000..a4af75e --- /dev/null +++ b/src/main/java/eu/univento/core/api/quest/QuestRequirement.java @@ -0,0 +1,17 @@ +/* + * Copyright (c) 2018 univento.eu - All rights reserved + * You are not allowed to use, distribute or modify this code + */ + +package eu.univento.core.api.quest; + +import lombok.Getter; + +public class QuestRequirement { + + @Getter private QuestRequirementType type; + + public QuestRequirement(Quest quest) { + + } +} \ No newline at end of file diff --git a/src/main/java/eu/univento/core/api/quest/QuestRequirementType.java b/src/main/java/eu/univento/core/api/quest/QuestRequirementType.java new file mode 100644 index 0000000..6f41e8e --- /dev/null +++ b/src/main/java/eu/univento/core/api/quest/QuestRequirementType.java @@ -0,0 +1,13 @@ +/* + * Copyright (c) 2018 univento.eu - All rights reserved + * You are not allowed to use, distribute or modify this code + */ + +package eu.univento.core.api.quest; + +public enum QuestRequirementType { + + OTHER_QUEST, + SEEN_AREA, + +} \ No newline at end of file diff --git a/src/main/java/eu/univento/core/api/quest/QuestReward.java b/src/main/java/eu/univento/core/api/quest/QuestReward.java new file mode 100644 index 0000000..f7b8b85 --- /dev/null +++ b/src/main/java/eu/univento/core/api/quest/QuestReward.java @@ -0,0 +1,10 @@ +/* + * Copyright (c) 2018 univento.eu - All rights reserved + * You are not allowed to use, distribute or modify this code + */ + +package eu.univento.core.api.quest; + +public class QuestReward { + +} diff --git a/src/main/java/eu/univento/core/api/quest/QuestRewardType.java b/src/main/java/eu/univento/core/api/quest/QuestRewardType.java new file mode 100644 index 0000000..25dca83 --- /dev/null +++ b/src/main/java/eu/univento/core/api/quest/QuestRewardType.java @@ -0,0 +1,14 @@ +/* + * Copyright (c) 2018 univento.eu - All rights reserved + * You are not allowed to use, distribute or modify this code + */ + +package eu.univento.core.api.quest; + +public enum QuestRewardType { + + Currency, + Item, + Cosmetic, + +} \ No newline at end of file diff --git a/src/main/java/eu/univento/core/api/quest/QuestTask.java b/src/main/java/eu/univento/core/api/quest/QuestTask.java new file mode 100644 index 0000000..d23dac6 --- /dev/null +++ b/src/main/java/eu/univento/core/api/quest/QuestTask.java @@ -0,0 +1,10 @@ +/* + * Copyright (c) 2018 univento.eu - All rights reserved + * You are not allowed to use, distribute or modify this code + */ + +package eu.univento.core.api.quest; + +public class QuestTask { + +} \ No newline at end of file diff --git a/src/main/java/eu/univento/core/api/quest/QuestTaskType.java b/src/main/java/eu/univento/core/api/quest/QuestTaskType.java new file mode 100644 index 0000000..d608f19 --- /dev/null +++ b/src/main/java/eu/univento/core/api/quest/QuestTaskType.java @@ -0,0 +1,10 @@ +/* + * Copyright (c) 2018 univento.eu - All rights reserved + * You are not allowed to use, distribute or modify this code + */ + +package eu.univento.core.api.quest; + +public enum QuestTaskType { + +} \ No newline at end of file diff --git a/src/main/java/eu/univento/core/commands/AdminCommands.java b/src/main/java/eu/univento/core/commands/AdminCommands.java index 65605a3..67382e6 100644 --- a/src/main/java/eu/univento/core/commands/AdminCommands.java +++ b/src/main/java/eu/univento/core/commands/AdminCommands.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2017 univento.eu - All rights reserved + * Copyright (c) 2018 univento.eu - All rights reserved * You are not allowed to use, distribute or modify this code */ @@ -10,11 +10,36 @@ import eu.univento.core.Core; import eu.univento.core.api.camera.Traveller; import eu.univento.core.api.command.Command; import eu.univento.core.api.command.CommandArgs; +import eu.univento.core.api.player.CustomPlayer; import io.vertx.core.json.JsonObject; import org.bukkit.Location; public class AdminCommands { + @Command(name = "setrank", description = "set the ranks of other users", rank = Rank.Admin, inGameOnly = true) + public void setRank(CommandArgs args) { + CustomPlayer p = args.getPlayer(); + if(args.length() == 2) { + if(CustomPlayer.getPlayer(args.getArg(0)) != null) { + CustomPlayer target = CustomPlayer.getPlayer(args.getArg(0)); + assert target != null; + Rank rank; + try { + rank = Rank.valueOf(args.getArg(1)); + if(target.getDatabasePlayer().isAllowed(rank)) { + p.sendMessage("§cDieser Spieler hat diesen Rang schon oder einen höheren"); + p.sendMessage("§cÄnderungen müssen in der Datenbank stattfinden"); + }else { + target.getDatabasePlayer().setRank(rank); + } + }catch (IllegalArgumentException ex) { + p.sendMessage("§cDiesen Rang gibt es nicht"); + } + + }else args.getPlayer().sendMessage("§cDu hast keinen Spieler angegeben"); + } + } + @Command(name = "camera", description = "control the camera", rank = Rank.Admin, inGameOnly = true) public void camera(CommandArgs args) { args.getPlayer().sendMessage("/camera add | add a new location to the route"); diff --git a/src/main/java/eu/univento/core/commands/SetRank.java b/src/main/java/eu/univento/core/commands/SetRank.java deleted file mode 100644 index 5bae16f..0000000 --- a/src/main/java/eu/univento/core/commands/SetRank.java +++ /dev/null @@ -1,106 +0,0 @@ -/* - * Copyright (c) 2017 univento.eu - All rights reserved - * You are not allowed to use, distribute or modify this code - */ - -package eu.univento.core.commands; - -import eu.univento.commons.player.rank.Rank; -import eu.univento.core.Core; -import eu.univento.core.api.AutoCommand; -import eu.univento.core.api.player.CustomPlayer; -import org.bukkit.Bukkit; -import org.bukkit.command.CommandSender; -import org.bukkit.entity.Player; - -import java.util.List; -import java.util.stream.Collectors; - -/** - * sets ranks for players - * @author joethei - * @version 1.0 - */ - -public class SetRank extends AutoCommand{ - - public SetRank(Core plugin, String command, String description, String... aliases) { - super(plugin, command, description, aliases); - } - - @Override - public boolean execute(CommandSender sender, String label, String[] args) { - if(sender instanceof Player) { - CustomPlayer p = CustomPlayer.getPlayer(sender.getName()); - if(p.getDatabasePlayer().isAllowed(Rank.SrBuilder)) { - if(args.length == 2) { - Rank rank; - try{ - rank = Rank.valueOf(args[1]); - if(Bukkit.getPlayer(args[0]) != null) { - CustomPlayer player = CustomPlayer.getPlayer(args[0]); - if(player.getDatabasePlayer().isAllowed(rank)) { - //p.sendMessage(p.getMessages().PREFIX() + "§cDer Spieler hat den Rang schon oder ist besser."); - //p.sendMessage(p.getMessages().PREFIX() + "§cÄnderungen müssen in der Datenbank stattfinden."); - return true; - } - if(p.getDatabasePlayer().isAllowed(Rank.Admin)) { - player.getDatabasePlayer().setRank(rank); - //p.sendMessage(p.getMessages().PREFIX() + p.getMessages().Core_SETRANK_SET(player, player.getDatabasePlayer().getRank())); - refreshTablist(); - } - if(p.getDatabasePlayer().isAllowed(Rank.SrDeveloper) && rank.equals(Rank.Developer)) { - player.getDatabasePlayer().setRank(Rank.Developer); - //p.sendMessage(p.getMessages().PREFIX() + p.getMessages().Core_SETRANK_SET(player, Rank.Developer)); - refreshTablist(); - } - if(p.getDatabasePlayer().isAllowed(Rank.SrSupporter) && rank.equals(Rank.Supporter)) { - player.getDatabasePlayer().setRank(Rank.Supporter); - //p.sendMessage(p.getMessages().PREFIX() + p.getMessages().Core_SETRANK_SET(player, Rank.Supporter)); - refreshTablist(); - } - if(p.getDatabasePlayer().isAllowed(Rank.SrSupporter) && rank.equals(Rank.JrSupporter)) { - player.getDatabasePlayer().setRank(Rank.JrSupporter); - //p.sendMessage(p.getMessages().PREFIX() + p.getMessages().Core_SETRANK_SET(player, Rank.JrSupporter)); - refreshTablist(); - } - if(p.getDatabasePlayer().isAllowed(Rank.SrBuilder) && rank.equals(Rank.Builder)) { - player.getDatabasePlayer().setRank(Rank.Builder); - //p.sendMessage(p.getMessages().PREFIX() + p.getMessages().Core_SETRANK_SET(player, Rank.Builder)); - refreshTablist(); - } - if(p.getDatabasePlayer().isAllowed(Rank.SrBuilder) && rank.equals(Rank.JrBuilder)) { - player.getDatabasePlayer().setRank(Rank.JrBuilder); - //p.sendMessage(p.getMessages().PREFIX() + p.getMessages().Core_SETRANK_SET(player, Rank.JrBuilder)); - refreshTablist(); - } - }else { - //p.sendMessage(p.getMessages().NOT_ONLINE(args[0])); - } - }catch(IllegalArgumentException ex) { - ex.printStackTrace(); - } - //p.sendMessage(p.getMessages().Core_SETRANK_NO_RANK()); - } - }else { - //p.sendMessage(p.getMessages().NO_PERMS()); - } - }else { - //sender.sendMessage(Messages.Console.NOT_A_PLAYER); - } - return true; - } - - @Override - public List tabComplete(CommandSender sender, String label, String[] args) { - List list = Bukkit.getOnlinePlayers().stream().map(Player::getDisplayName).collect(Collectors.toList()); - for(Rank rank : Rank.values()) - list.add(rank.name()); - return list; - } - - private void refreshTablist() { - - } - -} \ No newline at end of file diff --git a/src/main/java/eu/univento/core/listeners/JoinQuit.java b/src/main/java/eu/univento/core/listeners/JoinQuit.java index 5836b4f..ae10575 100644 --- a/src/main/java/eu/univento/core/listeners/JoinQuit.java +++ b/src/main/java/eu/univento/core/listeners/JoinQuit.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2017 univento.eu - All rights reserved + * Copyright (c) 2018 univento.eu - All rights reserved * You are not allowed to use, distribute or modify this code */ @@ -13,6 +13,7 @@ import eu.univento.core.commands.BuilderCommands; import eu.univento.core.commands.ModCommands; import eu.univento.core.listeners.cloud.Servers; import org.bukkit.Bukkit; +import org.bukkit.SoundCategory; import org.bukkit.entity.Player; import org.bukkit.event.EventHandler; import org.bukkit.event.EventPriority; @@ -50,7 +51,8 @@ public class JoinQuit implements Listener { @EventHandler public void onLogin(PlayerLoginEvent e) { CustomPlayer p = CustomPlayer.getPlayer(e.getPlayer()); - p.getDatabasePlayer().load(e.getHostname()); + if(e.getHostname() == null) p.getDatabasePlayer().load("unknown"); + else p.getDatabasePlayer().load(e.getHostname()); } @EventHandler @@ -61,6 +63,8 @@ public class JoinQuit implements Listener { p.hidePlayer(player); } } + if(Servers.getTeleport().containsKey(p.getUniqueId())) p.teleport(Bukkit.getPlayer(Servers.getTeleport().remove(p.getUniqueId()))); + HashMap labyModFeatures = new HashMap<>(); labyModFeatures.put(LabyMod.DAMAGEINDICATOR, false); labyModFeatures.put(LabyMod.MINIMAP_RADAR, false); @@ -104,8 +108,8 @@ public class JoinQuit implements Listener { Servers.getTeleport().remove(p.getUniqueId()); } - //p.setStoryResourcePack(); - //loading.add(p); + p.setStoryResourcePack(); + loading.add(p); } @EventHandler @@ -115,7 +119,7 @@ public class JoinQuit implements Listener { if (firstJoin.contains(p)) { firstJoin.remove(p); if (ServerSettings.isLobby()) { - //TODO: add story intro here. + p.playSound(p.getEyeLocation(), "glider.boot_up", SoundCategory.MASTER, 1.0F, 1.0F); } } loading.remove(p); diff --git a/src/main/java/eu/univento/core/listeners/cloud/Servers.java b/src/main/java/eu/univento/core/listeners/cloud/Servers.java index c6e1b3e..27cb053 100644 --- a/src/main/java/eu/univento/core/listeners/cloud/Servers.java +++ b/src/main/java/eu/univento/core/listeners/cloud/Servers.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2017 univento.eu - All rights reserved + * Copyright (c) 2018 univento.eu - All rights reserved * You are not allowed to use, distribute or modify this code */ @@ -21,7 +21,7 @@ import java.util.regex.Pattern; * @author joethei * @version 1.0 */ -public class Servers { +public class Servers{ @Getter private static Map teleport = new HashMap<>(); @@ -49,6 +49,8 @@ public class Servers { if(CustomPlayer.getPlayer(UUID.fromString(split[2])) != null && CustomPlayer.getPlayer(UUID.fromString(split[3])) != null) { CustomPlayer p = CustomPlayer.getPlayer(UUID.fromString(split[2])); CustomPlayer t = CustomPlayer.getPlayer(UUID.fromString(split[3])); + assert p != null; + assert t != null; p.teleport(t); } if(CustomPlayer.getPlayer(UUID.fromString(split[2])) == null && CustomPlayer.getPlayer(UUID.fromString(split[3])) != null) { diff --git a/src/main/resources/plugin.yml b/src/main/resources/plugin.yml index 21ffbaa..fdff91e 100644 --- a/src/main/resources/plugin.yml +++ b/src/main/resources/plugin.yml @@ -3,4 +3,5 @@ name: Core description: univento Core author: joethei version: 0.6 -website: http://univento.eu \ No newline at end of file +website: http://univento.eu +depend: [ProtocolLib] \ No newline at end of file