initial commit
This commit is contained in:
commit
37b687b999
3
.gitignore
vendored
Normal file
3
.gitignore
vendored
Normal file
@ -0,0 +1,3 @@
|
|||||||
|
.idea
|
||||||
|
out
|
||||||
|
target
|
63
config.yml
Normal file
63
config.yml
Normal file
@ -0,0 +1,63 @@
|
|||||||
|
menu:
|
||||||
|
navigator:
|
||||||
|
title: "Navigator"
|
||||||
|
material: "COMPASS"
|
||||||
|
slots: 54
|
||||||
|
slot: 4
|
||||||
|
permission: slpnet.lobby.navigator
|
||||||
|
items:
|
||||||
|
tridentwar:
|
||||||
|
title: "TridentWar"
|
||||||
|
material: "TRIDENT"
|
||||||
|
description: "test\ntest"
|
||||||
|
slot: 18
|
||||||
|
action:
|
||||||
|
type: "connect"
|
||||||
|
argument: "tw1"
|
||||||
|
bedwars:
|
||||||
|
title: "Bedwars"
|
||||||
|
material: "RED_BED"
|
||||||
|
description: "test\ntest"
|
||||||
|
slot: 20
|
||||||
|
action:
|
||||||
|
type: "connect"
|
||||||
|
argument: "tw1"
|
||||||
|
masterbuilders:
|
||||||
|
title: "Master Builder"
|
||||||
|
material: "CRAFTING_TABLE"
|
||||||
|
description: "test\ntest"
|
||||||
|
slot: 22
|
||||||
|
action:
|
||||||
|
type: "connect"
|
||||||
|
argument: "tw1"
|
||||||
|
profile:
|
||||||
|
title: "Profile"
|
||||||
|
material: "BOOK"
|
||||||
|
slot: 2
|
||||||
|
slots: 54
|
||||||
|
permission: slpnet.lobby.profile
|
||||||
|
items:
|
||||||
|
tridentwar:
|
||||||
|
title: "TridentWar"
|
||||||
|
material: "TRIDENT"
|
||||||
|
description: "test\ntest"
|
||||||
|
slot: 18
|
||||||
|
action:
|
||||||
|
type: "connect"
|
||||||
|
argument: "tw1"
|
||||||
|
bedwars:
|
||||||
|
title: "Bedwars"
|
||||||
|
material: "RED_BED"
|
||||||
|
description: "test\ntest"
|
||||||
|
slot: 20
|
||||||
|
action:
|
||||||
|
type: "connect"
|
||||||
|
argument: "tw1"
|
||||||
|
masterbuilders:
|
||||||
|
title: "Master Builder"
|
||||||
|
material: "CRAFTING_TABLE"
|
||||||
|
description: "test\ntest"
|
||||||
|
slot: 22
|
||||||
|
action:
|
||||||
|
type: "connect"
|
||||||
|
argument: "tw1"
|
20
off.txt
Normal file
20
off.txt
Normal file
@ -0,0 +1,20 @@
|
|||||||
|
Inventory inv = inventories.get(this.lobbyManager.getLobby().config.getString(key + ".title"));
|
||||||
|
|
||||||
|
// Nullpointer debugging
|
||||||
|
System.out.println(key + "0");
|
||||||
|
if(this.lobbyManager.getLobby().config.get("menu." + key + ".items") == null) System.out.println("Error: no items have been set, Menu will not be created"); // fixes nullpointer
|
||||||
|
if(this.lobbyManager.getLobby().config.get("menu." + key + ".items") == null) return; // fixes nullpointer
|
||||||
|
|
||||||
|
for(String keyItem : this.lobbyManager.getLobby().config.getConfigurationSection("menu." + key + ".items").getKeys(true)) {
|
||||||
|
if(this.lobbyManager.getLobby().config.get("menu." + key + ".items") == null) System.out.println("Error: no items have been set, Menu will not be created"); // fixes nullpointer
|
||||||
|
if(this.lobbyManager.getLobby().config.get("menu." + key + ".items") == null) return; // fixes nullpointer
|
||||||
|
// Error: material from config results null though it shouldn't
|
||||||
|
System.out.println(this.lobbyManager.getLobby().config.getString("menu."+key+".items."+keyItem+".material") + "1");
|
||||||
|
System.out.println(keyItem + "2");
|
||||||
|
inv.setItem(this.lobbyManager.getLobby().config.getInt("menu." + key + ".items." + keyItem + ".slot"),
|
||||||
|
createGuiItem(Material.getMaterial(this.lobbyManager.getLobby().config.getString("menu." + key + ".items." + keyItem + ".material")),
|
||||||
|
this.lobbyManager.getLobby().config.getString("menu." + key + ".items." + keyItem + ".title"),
|
||||||
|
this.lobbyManager.getLobby().config.getString("menu." + key + ".items." + keyItem + ".description")
|
||||||
|
)
|
||||||
|
);
|
||||||
|
}
|
4
plugin.yml
Normal file
4
plugin.yml
Normal file
@ -0,0 +1,4 @@
|
|||||||
|
name: Lobby
|
||||||
|
main: de.slpnetwork.lobby.Lobby
|
||||||
|
version: 0.1
|
||||||
|
api-version: 1.18
|
34
pom.xml
Normal file
34
pom.xml
Normal file
@ -0,0 +1,34 @@
|
|||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<project xmlns="http://maven.apache.org/POM/4.0.0"
|
||||||
|
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||||
|
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
|
||||||
|
<modelVersion>4.0.0</modelVersion>
|
||||||
|
|
||||||
|
<groupId>de.slpnetwork.lobby</groupId>
|
||||||
|
<artifactId>slpnetlobby</artifactId>
|
||||||
|
<version>1.0</version>
|
||||||
|
|
||||||
|
<properties>
|
||||||
|
<maven.compiler.source>17</maven.compiler.source>
|
||||||
|
<maven.compiler.target>17</maven.compiler.target>
|
||||||
|
</properties>
|
||||||
|
|
||||||
|
<repositories>
|
||||||
|
<!-- This adds the Spigot Maven repository to the build -->
|
||||||
|
<repository>
|
||||||
|
<id>spigot-repo</id>
|
||||||
|
<url>https://hub.spigotmc.org/nexus/content/repositories/snapshots/</url>
|
||||||
|
</repository>
|
||||||
|
</repositories>
|
||||||
|
|
||||||
|
<dependencies>
|
||||||
|
<!--This adds the Spigot API artifact to the build -->
|
||||||
|
<dependency>
|
||||||
|
<groupId>org.spigotmc</groupId>
|
||||||
|
<artifactId>spigot-api</artifactId>
|
||||||
|
<version>1.18.2-R0.1-SNAPSHOT</version>
|
||||||
|
<scope>provided</scope>
|
||||||
|
</dependency>
|
||||||
|
</dependencies>
|
||||||
|
|
||||||
|
</project>
|
12
slpnetlobby.iml
Normal file
12
slpnetlobby.iml
Normal file
@ -0,0 +1,12 @@
|
|||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<module version="4">
|
||||||
|
<component name="FacetManager">
|
||||||
|
<facet type="minecraft" name="Minecraft">
|
||||||
|
<configuration>
|
||||||
|
<autoDetectTypes>
|
||||||
|
<platformType>SPIGOT</platformType>
|
||||||
|
</autoDetectTypes>
|
||||||
|
</configuration>
|
||||||
|
</facet>
|
||||||
|
</component>
|
||||||
|
</module>
|
91
src/main/java/de/slpnetwork/lobby/Lobby.java
Normal file
91
src/main/java/de/slpnetwork/lobby/Lobby.java
Normal file
@ -0,0 +1,91 @@
|
|||||||
|
package de.slpnetwork.lobby;
|
||||||
|
|
||||||
|
import de.slpnetwork.lobby.Manager.InventoryManager;
|
||||||
|
import de.slpnetwork.lobby.Manager.LobbyManager;
|
||||||
|
import org.bukkit.Material;
|
||||||
|
import org.bukkit.configuration.file.FileConfiguration;
|
||||||
|
import org.bukkit.configuration.file.YamlConfiguration;
|
||||||
|
import org.bukkit.entity.Player;
|
||||||
|
import org.bukkit.event.EventHandler;
|
||||||
|
import org.bukkit.event.Listener;
|
||||||
|
import org.bukkit.event.player.PlayerInteractEvent;
|
||||||
|
import org.bukkit.event.player.PlayerJoinEvent;
|
||||||
|
import org.bukkit.inventory.ItemFlag;
|
||||||
|
import org.bukkit.inventory.ItemStack;
|
||||||
|
import org.bukkit.inventory.meta.ItemMeta;
|
||||||
|
import org.bukkit.plugin.java.JavaPlugin;
|
||||||
|
import org.bukkit.plugin.messaging.PluginMessageListener;
|
||||||
|
|
||||||
|
import java.io.File;
|
||||||
|
|
||||||
|
public class Lobby extends JavaPlugin implements Listener, PluginMessageListener {
|
||||||
|
public LobbyManager lobbyManager;
|
||||||
|
public FileConfiguration config;
|
||||||
|
public File itemData;
|
||||||
|
public FileConfiguration itemDataConfig;
|
||||||
|
public File menuData;
|
||||||
|
public FileConfiguration menuDataConfig;
|
||||||
|
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onEnable(){
|
||||||
|
super.onEnable();
|
||||||
|
this.getServer().getLogger().info("Initializing Configs");
|
||||||
|
try {
|
||||||
|
this.saveDefaultConfig();
|
||||||
|
config = this.getConfig();
|
||||||
|
itemData = new File(this.getDataFolder(), "items.yml");
|
||||||
|
itemDataConfig = YamlConfiguration.loadConfiguration(itemData);
|
||||||
|
menuData = new File(this.getDataFolder(), "menu.yml");
|
||||||
|
menuDataConfig = YamlConfiguration.loadConfiguration(menuData);
|
||||||
|
}catch (Exception ex) {
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
this.lobbyManager = new LobbyManager(this);
|
||||||
|
this.getServer().getPluginManager().registerEvents(this, this);
|
||||||
|
this.getServer().getPluginManager().registerEvents(new InventoryManager(this.lobbyManager), this);
|
||||||
|
this.getServer().getMessenger().registerOutgoingPluginChannel(this, "BungeeCord");
|
||||||
|
this.getServer().getMessenger().registerIncomingPluginChannel(this, "BungeeCord", this);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onDisable(){
|
||||||
|
super.onDisable();
|
||||||
|
}
|
||||||
|
|
||||||
|
@EventHandler
|
||||||
|
public void onPlayerJoin(PlayerJoinEvent e) {
|
||||||
|
e.getPlayer().getInventory().clear();
|
||||||
|
|
||||||
|
// TODO: loop over itemdataconfig(items)
|
||||||
|
for (String key: this.config.getConfigurationSection("menu").getKeys(false)) {
|
||||||
|
// TODO: replace current datapoints with new ones
|
||||||
|
ItemStack is = new ItemStack(Material.getMaterial(this.config.getString("menu." + key + ".material")));
|
||||||
|
ItemMeta im = is.getItemMeta();
|
||||||
|
im.setDisplayName(this.config.getString("menu." + key + ".title"));
|
||||||
|
im.addItemFlags();
|
||||||
|
is.setItemMeta(im);
|
||||||
|
e.getPlayer().getInventory().setItem(this.config.getInt("menu." + key + ".slot"), is);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@EventHandler
|
||||||
|
public void onPlayerUse(PlayerInteractEvent e) {
|
||||||
|
// Error: somewhere on the way of triggering
|
||||||
|
// The menu does not get opened
|
||||||
|
try {
|
||||||
|
Player p = e.getPlayer();
|
||||||
|
// TODO: Replace current datapoints with new ones
|
||||||
|
// TODO: Grab menu Datapoint based on Material Type
|
||||||
|
this.lobbyManager.getInventoryManager().openInventory(p, p.getInventory().getItemInMainHand().getItemMeta().getDisplayName());
|
||||||
|
} catch (Exception ex) {
|
||||||
|
// possibly nullpointer nothing else can happen here
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onPluginMessageReceived(String channel, Player player, byte[] bytes) {
|
||||||
|
if (!channel.equals("BungeeCord")) { return; }
|
||||||
|
}
|
||||||
|
}
|
115
src/main/java/de/slpnetwork/lobby/Manager/InventoryManager.java
Normal file
115
src/main/java/de/slpnetwork/lobby/Manager/InventoryManager.java
Normal file
@ -0,0 +1,115 @@
|
|||||||
|
package de.slpnetwork.lobby.Manager;
|
||||||
|
|
||||||
|
import org.bukkit.Bukkit;
|
||||||
|
import org.bukkit.Material;
|
||||||
|
import org.bukkit.entity.HumanEntity;
|
||||||
|
import org.bukkit.entity.Player;
|
||||||
|
import org.bukkit.event.EventHandler;
|
||||||
|
import org.bukkit.event.Listener;
|
||||||
|
import org.bukkit.event.inventory.InventoryClickEvent;
|
||||||
|
import org.bukkit.event.inventory.InventoryDragEvent;
|
||||||
|
import org.bukkit.inventory.Inventory;
|
||||||
|
import org.bukkit.inventory.ItemStack;
|
||||||
|
import org.bukkit.inventory.meta.ItemMeta;
|
||||||
|
|
||||||
|
import java.util.Arrays;
|
||||||
|
import java.util.HashMap;
|
||||||
|
|
||||||
|
public class InventoryManager implements Listener {
|
||||||
|
private final LobbyManager lobbyManager;
|
||||||
|
private HashMap<String, Inventory> inventories;
|
||||||
|
|
||||||
|
public InventoryManager(LobbyManager lobbyManager){
|
||||||
|
this.lobbyManager = lobbyManager;
|
||||||
|
this.lobbyManager.getLobby().getServer().getLogger().info("Initializing Lobby");
|
||||||
|
this.lobbyManager.setInventoryManager(this);
|
||||||
|
this.inventories = new HashMap<String, Inventory>();
|
||||||
|
|
||||||
|
// TODO: replace default config with menudataconfig and iterate over its menu datapoint
|
||||||
|
for(String key: this.lobbyManager.getLobby().config.getConfigurationSection("menu").getKeys(false)) {
|
||||||
|
// TODO: replace current datapoints with new ones
|
||||||
|
this.inventories.put(
|
||||||
|
this.lobbyManager.getLobby().config.getString("menu." + key + ".title"), Bukkit.createInventory(null,
|
||||||
|
this.lobbyManager.getLobby().config.getInt("menu." + key + ".slots"),
|
||||||
|
this.lobbyManager.getLobby().config.getString("menu." + key + ".title")
|
||||||
|
)
|
||||||
|
);
|
||||||
|
System.out.println(this.inventories.size() + " inventories stored"); // debugging inventories not beeing generated
|
||||||
|
initializeItems(key);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void initializeItems(String key){
|
||||||
|
Inventory inv = inventories.get(this.lobbyManager.getLobby().config.getString("menu." + key + ".title"));
|
||||||
|
|
||||||
|
// Nullpointer debugging
|
||||||
|
System.out.println(key + "0");
|
||||||
|
if(this.lobbyManager.getLobby().config.get("menu." + key) == null) System.out.println("Error: no items have been set, Menu will not be created"); // fixes nullpointer
|
||||||
|
if(this.lobbyManager.getLobby().config.get("menu." + key) == null) return; // fixes nullpointer
|
||||||
|
|
||||||
|
for(String keyItem : this.lobbyManager.getLobby().config.getConfigurationSection("menu." + key + ".items").getKeys(false)) {
|
||||||
|
System.out.println("debug-> " + keyItem);
|
||||||
|
System.out.println(this.lobbyManager.getLobby().config.getString("menu."+key+".items."+keyItem+".material") + "1");
|
||||||
|
|
||||||
|
inv.setItem(this.lobbyManager.getLobby().config.getInt("menu." + key + ".items." + keyItem + ".slot"),
|
||||||
|
createGuiItem(Material.getMaterial(this.lobbyManager.getLobby().config.getString("menu." + key + ".items." + keyItem + ".material")),
|
||||||
|
this.lobbyManager.getLobby().config.getString("menu." + key + ".items." + keyItem + ".title"),
|
||||||
|
this.lobbyManager.getLobby().config.getString("menu." + key + ".items." + keyItem + ".description")
|
||||||
|
)
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
protected ItemStack createGuiItem(final Material material, final String name, final String... lore) {
|
||||||
|
final ItemStack item = new ItemStack(material, 1);
|
||||||
|
final ItemMeta meta = item.getItemMeta();
|
||||||
|
|
||||||
|
// Set the name of the item
|
||||||
|
meta.setDisplayName(name);
|
||||||
|
|
||||||
|
// Set the lore of the item
|
||||||
|
meta.setLore(Arrays.asList(lore));
|
||||||
|
|
||||||
|
item.setItemMeta(meta);
|
||||||
|
|
||||||
|
return item;
|
||||||
|
}
|
||||||
|
|
||||||
|
// You can open the inventory with this
|
||||||
|
public void openInventory(final HumanEntity ent, String Inventory) {
|
||||||
|
System.out.println(Inventory);
|
||||||
|
System.out.println(inventories.containsKey(Inventory));
|
||||||
|
if(inventories.containsKey(Inventory)) {
|
||||||
|
ent.openInventory(inventories.get(Inventory));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// Check for clicks on items
|
||||||
|
@EventHandler
|
||||||
|
public void onInventoryClick(final InventoryClickEvent e) {
|
||||||
|
if(!inventories.containsValue(e.getInventory())) return;
|
||||||
|
|
||||||
|
e.setCancelled(true);
|
||||||
|
|
||||||
|
final ItemStack clickedItem = e.getCurrentItem();
|
||||||
|
this.lobbyManager.getLobby().getServer().getLogger().info(clickedItem.toString());
|
||||||
|
|
||||||
|
// verify current item is not null
|
||||||
|
if (clickedItem == null || clickedItem.getType().isAir()) return;
|
||||||
|
|
||||||
|
final Player p = (Player) e.getWhoClicked();
|
||||||
|
this.lobbyManager.getCommandInterpreter().execute(p.getPlayer(),
|
||||||
|
this.lobbyManager.getLobby().config.getString("menu." + e.getView().getTitle().toLowerCase()+ ".items."+ clickedItem.getItemMeta().getDisplayName().toLowerCase() + ".action.type"),
|
||||||
|
this.lobbyManager.getLobby().config.getString("menu." + e.getView().getTitle().toLowerCase()+ ".items."+ clickedItem.getItemMeta().getDisplayName().toLowerCase() + ".action.argument"));
|
||||||
|
// Using slots click is a best option for your inventory click's
|
||||||
|
p.sendMessage("You clicked at slot " + e.getRawSlot());
|
||||||
|
}
|
||||||
|
|
||||||
|
// Cancel dragging in our inventory
|
||||||
|
@EventHandler
|
||||||
|
public void onInventoryClick(final InventoryDragEvent e) {
|
||||||
|
if (inventories.containsValue(e.getInventory())) {
|
||||||
|
e.setCancelled(true);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
37
src/main/java/de/slpnetwork/lobby/Manager/LobbyManager.java
Normal file
37
src/main/java/de/slpnetwork/lobby/Manager/LobbyManager.java
Normal file
@ -0,0 +1,37 @@
|
|||||||
|
package de.slpnetwork.lobby.Manager;
|
||||||
|
|
||||||
|
import de.slpnetwork.lobby.Lobby;
|
||||||
|
import de.slpnetwork.lobby.Utils.CommandInterpreter;
|
||||||
|
|
||||||
|
public class LobbyManager {
|
||||||
|
private Lobby lobby;
|
||||||
|
private InventoryManager inventoryManager;
|
||||||
|
private CommandInterpreter commandInterpreter;
|
||||||
|
private PlayerManager playerManager;
|
||||||
|
|
||||||
|
public LobbyManager(Lobby lobby) {
|
||||||
|
this.lobby = lobby;
|
||||||
|
this.commandInterpreter = new CommandInterpreter(this);
|
||||||
|
this.playerManager = new PlayerManager(this);
|
||||||
|
}
|
||||||
|
|
||||||
|
public Lobby getLobby() {
|
||||||
|
return lobby;
|
||||||
|
}
|
||||||
|
|
||||||
|
public InventoryManager getInventoryManager() {
|
||||||
|
return inventoryManager;
|
||||||
|
}
|
||||||
|
|
||||||
|
public CommandInterpreter getCommandInterpreter() {
|
||||||
|
return commandInterpreter;
|
||||||
|
}
|
||||||
|
|
||||||
|
public PlayerManager getPlayerManager() {
|
||||||
|
return playerManager;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setInventoryManager(InventoryManager inventoryManager) {
|
||||||
|
this.inventoryManager = inventoryManager;
|
||||||
|
}
|
||||||
|
}
|
43
src/main/java/de/slpnetwork/lobby/Manager/PlayerManager.java
Normal file
43
src/main/java/de/slpnetwork/lobby/Manager/PlayerManager.java
Normal file
@ -0,0 +1,43 @@
|
|||||||
|
package de.slpnetwork.lobby.Manager;
|
||||||
|
|
||||||
|
import com.google.common.io.ByteArrayDataOutput;
|
||||||
|
import com.google.common.io.ByteStreams;
|
||||||
|
import org.bukkit.Location;
|
||||||
|
import org.bukkit.Material;
|
||||||
|
import org.bukkit.entity.Player;
|
||||||
|
import org.bukkit.inventory.ItemStack;
|
||||||
|
|
||||||
|
public class PlayerManager {
|
||||||
|
private LobbyManager lobbyManager;
|
||||||
|
|
||||||
|
public PlayerManager(LobbyManager lobbyManager) {
|
||||||
|
this.lobbyManager = lobbyManager;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void giveItems(Player player){
|
||||||
|
player.getInventory().addItem(new ItemStack(Material.BOOK));
|
||||||
|
player.getInventory().addItem(new ItemStack(Material.COMPASS));
|
||||||
|
player.getInventory().addItem(new ItemStack(Material.PLAYER_HEAD));
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* teleports a player to a location
|
||||||
|
* @param player the wanted player
|
||||||
|
* @param loc the wanted location
|
||||||
|
*/
|
||||||
|
public void teleportPlayer(Player player, Location loc) {
|
||||||
|
player.teleport(loc);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Moves a player from a server to another
|
||||||
|
* @param dest the destination
|
||||||
|
* @param target the player to send
|
||||||
|
*/
|
||||||
|
public void moveFromServer(String dest, Player target) {
|
||||||
|
ByteArrayDataOutput aOut = ByteStreams.newDataOutput();
|
||||||
|
aOut.writeUTF("Connect");
|
||||||
|
aOut.writeUTF(dest);
|
||||||
|
target.sendPluginMessage(this.lobbyManager.getLobby(), "BungeeCord", aOut.toByteArray());
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,4 @@
|
|||||||
|
package de.slpnetwork.lobby.Manager;
|
||||||
|
|
||||||
|
public class ScoreboradManager {
|
||||||
|
}
|
@ -0,0 +1,38 @@
|
|||||||
|
package de.slpnetwork.lobby.Utils;
|
||||||
|
|
||||||
|
import de.slpnetwork.lobby.Manager.LobbyManager;
|
||||||
|
import org.bukkit.entity.Player;
|
||||||
|
|
||||||
|
import java.util.Objects;
|
||||||
|
|
||||||
|
public class CommandInterpreter {
|
||||||
|
private LobbyManager lobbyManager;
|
||||||
|
public CommandInterpreter(LobbyManager lobbyManager) {
|
||||||
|
this.lobbyManager = lobbyManager;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Executes configured action
|
||||||
|
* @param executor User who performed the Action
|
||||||
|
* @param action the action to perform
|
||||||
|
* @param args aditional arguments
|
||||||
|
*/
|
||||||
|
public void execute(Player executor, String action, String args){
|
||||||
|
switch (action.toLowerCase()) {
|
||||||
|
default:
|
||||||
|
this.lobbyManager.getLobby().getServer().getLogger().warning("The Action: '" + action + "' is not defined");
|
||||||
|
break;
|
||||||
|
case "menu":
|
||||||
|
// opens menu
|
||||||
|
this.lobbyManager.getInventoryManager().openInventory(executor, args);
|
||||||
|
break;
|
||||||
|
case "teleport":
|
||||||
|
break;
|
||||||
|
case "connect":
|
||||||
|
this.lobbyManager.getPlayerManager().moveFromServer(args, Objects.requireNonNull(executor.getPlayer()));
|
||||||
|
break;
|
||||||
|
case "execute":
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
7
src/main/resources/items.yml
Normal file
7
src/main/resources/items.yml
Normal file
@ -0,0 +1,7 @@
|
|||||||
|
items:
|
||||||
|
COMPASS:
|
||||||
|
menu: "navigator"
|
||||||
|
display: "Navigator"
|
||||||
|
slot: 4
|
||||||
|
material: "COMPASS"
|
||||||
|
permission: "lobby.item.navigator"
|
15
src/main/resources/menus.yml
Normal file
15
src/main/resources/menus.yml
Normal file
@ -0,0 +1,15 @@
|
|||||||
|
navigator:
|
||||||
|
title: "Navigator"
|
||||||
|
identifier: "navigator"
|
||||||
|
slots: 54
|
||||||
|
slot: 4
|
||||||
|
permission: slpnet.lobby.navigator
|
||||||
|
items:
|
||||||
|
tridentwar:
|
||||||
|
title: "TridentWar"
|
||||||
|
material: "TRIDENT"
|
||||||
|
description: "test\ntest"
|
||||||
|
slot: 18
|
||||||
|
action:
|
||||||
|
type: "connect"
|
||||||
|
argument: "tw1"
|
30
todo.md
Normal file
30
todo.md
Normal file
@ -0,0 +1,30 @@
|
|||||||
|
# first target
|
||||||
|
- [X] Plugin Stabillity
|
||||||
|
- [X] Debuggin: items properly handed on Join [In Progress]
|
||||||
|
- [ ] command interpreter
|
||||||
|
- [ ] Player prefix
|
||||||
|
- [ ] Connection Prefix
|
||||||
|
- [ ] Teleportation Prefix
|
||||||
|
- [ ] Comamnd Execution Prefix
|
||||||
|
- [ ] open prefix
|
||||||
|
- Opens a specified new inventory and closes the old one
|
||||||
|
- [ ] prefix chainig (eg. execute prefix + player prefix)
|
||||||
|
- [ ] Inventory Layering
|
||||||
|
# secondary
|
||||||
|
- [ ] Scoreboard Support
|
||||||
|
- [ ] Motd Message Suport
|
||||||
|
- [ ] Custom Bossbar support
|
||||||
|
- [ ] Scheduled Message Support
|
||||||
|
- [ ] Custom event based Title Support
|
||||||
|
- [ ] Firework Support
|
||||||
|
- [ ] Sound Support
|
||||||
|
- [ ] Updatable Items in Inventory
|
||||||
|
- [ ] Items change on events (eg. settings toggle)
|
||||||
|
- [ ] User Settings
|
||||||
|
- [ ] Players will be shown
|
||||||
|
- [ ] Toggle Referal Program
|
||||||
|
- [ ] Languages
|
||||||
|
- [ ] fly
|
||||||
|
- [ ] Doublejump
|
||||||
|
- [ ] User Refereal Program
|
||||||
|
- [ ] Documentation
|
Loading…
x
Reference in New Issue
Block a user