damit das nicht nur

This commit is contained in:
BuildTools 2018-01-15 12:25:45 +01:00
parent b53720692f
commit 4556b70d4e
26 changed files with 3089 additions and 185 deletions

1
.gitignore vendored
View File

@ -3,3 +3,4 @@
/build
Core.iml
run-server.sh
core.png

View File

@ -29,6 +29,7 @@
<SOURCES />
</library>
</orderEntry>
<orderEntry type="library" name="Maven: eu.univento:commons:1.0-SNAPSHOT" level="project" />
<orderEntry type="library" scope="PROVIDED" name="Maven: com.destroystokyo.paper:paper-api:1.12.1-R0.1-SNAPSHOT" level="project" />
<orderEntry type="library" scope="PROVIDED" name="Maven: com.mojang:authlib:1.5.25" level="project" />
<orderEntry type="library" scope="PROVIDED" name="Maven: commons-codec:commons-codec:1.10" level="project" />
@ -43,6 +44,10 @@
<orderEntry type="library" scope="PROVIDED" name="Maven: net.md-5:bungeecord-chat:1.12-SNAPSHOT" level="project" />
<orderEntry type="library" scope="PROVIDED" name="Maven: org.ow2.asm:asm-all:5.0.4" level="project" />
<orderEntry type="library" scope="PROVIDED" name="Maven: org.bukkit:craftbukkit:1.12.1-R0.1-SNAPSHOT" level="project" />
<orderEntry type="library" scope="PROVIDED" name="Maven: com.comphenix.protocol:ProtocolLib-API:4.3.0" level="project" />
<orderEntry type="library" scope="PROVIDED" name="Maven: cglib:cglib-nodep:3.2.5" level="project" />
<orderEntry type="library" scope="PROVIDED" name="Maven: com.comphenix.executors:BukkitExecutors:1.1-SNAPSHOT" level="project" />
<orderEntry type="library" name="Maven: com.github.dmulloy2:PacketWrapper:master-2b4bfddd12-1" level="project" />
<orderEntry type="library" name="Maven: org.projectlombok:lombok:1.16.16" level="project" />
<orderEntry type="library" name="Maven: co.aikar:taskchain-bukkit:3.6.0" level="project" />
<orderEntry type="library" name="Maven: co.aikar:taskchain-core:3.6.0" level="project" />
@ -53,7 +58,6 @@
<orderEntry type="library" name="Maven: io.netty:netty-buffer:5.0.0.Alpha2" level="project" />
<orderEntry type="library" name="Maven: io.netty:netty-common:5.0.0.Alpha2" level="project" />
<orderEntry type="module" module-name="Commons" />
<orderEntry type="library" name="Maven: ai.api:libai:1.4.8" level="project" />
<orderEntry type="library" name="Maven: io.vertx:vertx-core:3.4.1" level="project" />
<orderEntry type="library" name="Maven: io.netty:netty-transport:4.1.8.Final" level="project" />
<orderEntry type="library" name="Maven: io.netty:netty-handler:4.1.8.Final" level="project" />
@ -90,12 +94,17 @@
<orderEntry type="library" name="Maven: org.apache.logging.log4j:log4j-core:2.6.2" level="project" />
<orderEntry type="library" name="Maven: org.slf4j:slf4j-api:1.7.25" level="project" />
<orderEntry type="library" name="Maven: io.sentry:sentry:1.2.2" level="project" />
<orderEntry type="library" name="Maven: io.socket:socket.io-client:1.0.0" level="project" />
<orderEntry type="library" name="Maven: io.socket:engine.io-client:1.0.0" level="project" />
<orderEntry type="library" name="Maven: com.squareup.okhttp3:okhttp:3.8.1" level="project" />
<orderEntry type="library" name="Maven: com.squareup.okio:okio:1.13.0" level="project" />
<orderEntry type="library" name="Maven: org.json:json:20090211" level="project" />
<orderEntry type="library" name="Maven: com.github.ben-manes.caffeine:caffeine:2.5.2" level="project" />
<orderEntry type="library" name="Maven: commons-io:commons-io:2.5" level="project" />
<orderEntry type="library" name="Maven: com.github.nsp:JSkills:master-0.9.0-g8b333ec-15" level="project" />
<orderEntry type="library" name="Maven: org.ejml:simple:0.28" level="project" />
<orderEntry type="library" name="Maven: org.ejml:core:0.28" level="project" />
<orderEntry type="library" name="Maven: org.ejml:dense64:0.28" level="project" />
<orderEntry type="library" scope="PROVIDED" name="Maven: de.dytanic.cloudnet:cloudnet-api:2.0" level="project" />
<orderEntry type="library" scope="PROVIDED" name="Maven: de.dytanic.cloudnet:cloudnet-api:2.1.P41" level="project" />
</component>
</module>

2711
core.uml Normal file

File diff suppressed because it is too large Load Diff

14
pom.xml
View File

@ -67,6 +67,18 @@
<scope>provided</scope>
</dependency>
<dependency>
<groupId>com.comphenix.protocol</groupId>
<artifactId>ProtocolLib-API</artifactId>
<version>4.3.0</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>com.github.dmulloy2</groupId>
<artifactId>PacketWrapper</artifactId>
<version>master-2b4bfddd12-1</version>
</dependency>
<dependency>
<groupId>org.projectlombok</groupId>
<artifactId>lombok</artifactId>
@ -113,7 +125,7 @@
<dependency>
<groupId>de.dytanic.cloudnet</groupId>
<artifactId>cloudnet-api</artifactId>
<version>2.0</version>
<version>LATEST</version>
<scope>provided</scope>
</dependency>
</dependencies>

View File

@ -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, () -> {

View File

@ -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();
}
}

View File

@ -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<Integer, Action> 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);
}

View File

@ -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<Integer, InventoryGUI> 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();
}
}

View File

@ -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<String, String> blocks = new HashMap<>();
@Getter private HashMap<String, String> food = new HashMap<>();
@Getter private HashMap<String, String> electronics = new HashMap<>();
@Getter private HashMap<String, String> characters = new HashMap<>();
@Getter private HashMap<String, String> flags = new HashMap<>();
@Getter private HashMap<String, String> letters = new HashMap<>();
@Getter private HashMap<String, String> halloween = new HashMap<>();
@Getter private HashMap<String, String> 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<String, String> 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"));
});
});
}
}

View File

@ -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}
*

View File

@ -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<UUID, CustomPlayer> PLAYERS = new HashMap<>();
private static final Map<UUID, NickedPlayer> 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() {

View File

@ -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;

View File

@ -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<QuestAction> 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) {
}
}

View File

@ -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) {
}
}

View File

@ -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 {
}

View File

@ -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) {
}
}

View File

@ -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,
}

View File

@ -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 {
}

View File

@ -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,
}

View File

@ -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 {
}

View File

@ -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 {
}

View File

@ -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");

View File

@ -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<Core>{
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<String> tabComplete(CommandSender sender, String label, String[] args) {
List<String> list = Bukkit.getOnlinePlayers().stream().map(Player::getDisplayName).collect(Collectors.toList());
for(Rank rank : Rank.values())
list.add(rank.name());
return list;
}
private void refreshTablist() {
}
}

View File

@ -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<LabyMod, Boolean> 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);

View File

@ -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
*/
@ -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) {

View File

@ -4,3 +4,4 @@ description: univento Core
author: joethei
version: 0.6
website: http://univento.eu
depend: [ProtocolLib]