personalKit #106
@ -97,6 +97,7 @@ public class Config {
|
||||
//default kits
|
||||
public static final String MemberDefault;
|
||||
public static final String LeaderDefault;
|
||||
public static final boolean PersonalKits;
|
||||
|
||||
//tech hider parameter
|
||||
public static final Set<Integer> HiddenBlocks;
|
||||
@ -177,6 +178,7 @@ public class Config {
|
||||
|
||||
MemberDefault = config.getString("Kits.MemberDefault");
|
||||
LeaderDefault = config.getString("Kits.LeaderDefault");
|
||||
PersonalKits = config.getBoolean("Kits.PersonalKits");
|
||||
|
||||
ConfigurationSection techhiderConfig = config.getConfigurationSection("Techhider.HiddenBlocks");
|
||||
Set<Integer> blocks = new HashSet<>();
|
||||
|
@ -0,0 +1,46 @@
|
||||
package de.steamwar.fightsystem.utils;
|
||||
|
||||
import de.steamwar.fightsystem.FightSystem;
|
||||
import org.bukkit.Bukkit;
|
||||
import org.bukkit.GameMode;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.event.EventHandler;
|
||||
import org.bukkit.event.HandlerList;
|
||||
import org.bukkit.event.Listener;
|
||||
import org.bukkit.event.inventory.InventoryCloseEvent;
|
||||
import org.bukkit.inventory.ItemStack;
|
||||
|
||||
public class PersonalKitCreator implements Listener {
|
||||
|
||||
private final Player player;
|
||||
private final ItemStack[] contents;
|
||||
private final ItemStack[] armor;
|
||||
|
||||
public PersonalKitCreator(Player player){
|
||||
this.player = player;
|
||||
contents = player.getInventory().getContents();
|
||||
armor = player.getInventory().getArmorContents();
|
||||
|
||||
//TODO Get Current Kit inventory
|
||||
//TODO Prevent unwanted items
|
||||
player.getInventory().setContents();
|
||||
player.getInventory().setArmorContents();
|
||||
|
||||
player.setGameMode(GameMode.CREATIVE);
|
||||
player.openInventory(this.inventory);
|
||||
Bukkit.getPluginManager().registerEvents(this, FightSystem.getPlugin());
|
||||
}
|
||||
|
||||
@EventHandler
|
||||
public void onInventoryClose(InventoryCloseEvent e) {
|
||||
if(!player.equals(e.getPlayer()))
|
||||
return;
|
||||
|
||||
//TODO Autoclose inventory on PreFightStart
|
||||
player.closeInventory();
|
||||
player.getInventory().setContents(contents);
|
||||
player.getInventory().setArmorContents(contents);
|
||||
player.setGameMode(GameMode.SURVIVAL);
|
||||
HandlerList.unregisterAll(this);
|
||||
}
|
||||
}
|
In neuem Issue referenzieren
Einen Benutzer sperren