Schematic Pasting + Kit Management
Dieser Commit ist enthalten in:
Ursprung
eab9235eef
Commit
32028a27de
@ -47,3 +47,6 @@ Money:
|
||||
Win: 0
|
||||
Lose: 0
|
||||
Draw: 0
|
||||
Kits:
|
||||
MemberDefault: default
|
||||
LeaderDefault: default
|
@ -1,6 +1,8 @@
|
||||
package me.yaruma.fightsystem.commands;
|
||||
|
||||
import de.warking.hunjy.MySQL.Schematic;
|
||||
import de.warking.hunjy.MySQL.UserGroup;
|
||||
import de.warking.hunjy.MySQL.WarkingUser;
|
||||
import me.yaruma.fightsystem.FightSystem;
|
||||
import me.yaruma.fightsystem.fight.Fight;
|
||||
import me.yaruma.fightsystem.fight.FightPlayer;
|
||||
@ -159,6 +161,12 @@ public class AkCommand implements CommandExecutor {
|
||||
|
||||
fightTeam.setSchematic(schem);
|
||||
Fight.getPlayerTeam(player).broadcast(FightSystem.PREFIX + "Schematic §6" + args[1] + " §8wird für den Kampf verwendet!");
|
||||
} else if(args[0].equalsIgnoreCase("addkit")){
|
||||
if(WarkingUser.get(player.getUniqueId()).getUserGroup() != UserGroup.Developer){
|
||||
sendHelp(player);
|
||||
return false;
|
||||
}
|
||||
KitManager.saveInventory(args[2], player);
|
||||
}
|
||||
}else{
|
||||
sendHelp(player);
|
||||
@ -175,5 +183,6 @@ public class AkCommand implements CommandExecutor {
|
||||
p.sendMessage("§8/§6ak accept §8- §7Einladung annehmen");
|
||||
p.sendMessage("§8/§6ak decline §8- §7Einladung ablehnen");
|
||||
p.sendMessage("§8/§6ak kit <Kit> §8- §7Wähle ein Kit");
|
||||
p.sendMessage("§8/§6ak schem <Schematic> §8- §7Setze deine Schematic");
|
||||
}
|
||||
}
|
||||
|
@ -52,10 +52,6 @@ public class FightTeam {
|
||||
return null;
|
||||
}
|
||||
|
||||
public void setPlayerOut(Player player) {
|
||||
getFightPlayer(player).setOut(true);
|
||||
}
|
||||
|
||||
public boolean allPlayersOut() {
|
||||
for(FightPlayer fightPlayer : this.players) {
|
||||
if(!fightPlayer.isOut())
|
||||
|
@ -31,11 +31,9 @@ public class KitManager {
|
||||
player.getInventory().setContents(content);
|
||||
}
|
||||
|
||||
private static void saveInventory(String kitName, Player player) throws IOException {
|
||||
YamlConfiguration yamlConfiguration = new YamlConfiguration();
|
||||
yamlConfiguration.set("Kits." + kitName + ".Armor", player.getInventory().getArmorContents());
|
||||
yamlConfiguration.set("Kits." + kitName + ".Items", player.getInventory().getContents());
|
||||
yamlConfiguration.save(new File(kitsPath));
|
||||
public static void saveInventory(String kitName, Player player){
|
||||
loadedKits.add(new Kit(kitName, 0, true, true, player.getInventory()));
|
||||
saveAllKits();
|
||||
}
|
||||
|
||||
public static boolean canBuy(Player player, String kitName) {
|
||||
@ -76,9 +74,9 @@ public class KitManager {
|
||||
}
|
||||
|
||||
public static Kit loadKitFromConfig(String name) {
|
||||
if(instance.getKitData().contains("Kit." + name)) {
|
||||
ItemStack[] armor = (ItemStack[]) instance.getKitData().get("Kit." + name + ".Armor");
|
||||
ItemStack[] items = (ItemStack[]) instance.getKitData().get("Kit." + name + ".Items");
|
||||
if(instance.getKitData().contains("Kits." + name)) {
|
||||
ItemStack[] armor = (ItemStack[]) instance.getKitData().get("Kits." + name + ".Armor");
|
||||
ItemStack[] items = (ItemStack[]) instance.getKitData().get("Kits." + name + ".Items");
|
||||
|
||||
PlayerInventory playerInventory = (PlayerInventory) Bukkit.createInventory(null, InventoryType.PLAYER);
|
||||
playerInventory.setArmorContents(armor);
|
||||
@ -103,6 +101,21 @@ public class KitManager {
|
||||
}
|
||||
}
|
||||
|
||||
private static void saveAllKits(){
|
||||
YamlConfiguration yamlConfiguration = new YamlConfiguration();
|
||||
for(Kit k : loadedKits){
|
||||
String path = "Kits." + k.getName();
|
||||
yamlConfiguration.set(path + ".Armor", k.getInventory().getArmorContents());
|
||||
yamlConfiguration.set(path + ".Items", k.getInventory().getContents());
|
||||
yamlConfiguration.set(path + ".Price", k.getPrice());
|
||||
yamlConfiguration.set(path + ".LeaderAllowed", k.isLeaderAllowed());
|
||||
yamlConfiguration.set(path + ".MemberAllowed", k.isMemberAllowed());
|
||||
}
|
||||
try {
|
||||
yamlConfiguration.save(new File(kitsPath));
|
||||
}catch(IOException ignored){}
|
||||
}
|
||||
|
||||
public static Kit getKitByName(String kitName) {
|
||||
for(Kit kit : loadedKits) {
|
||||
if(kit.getName().equalsIgnoreCase(kitName))
|
||||
@ -110,12 +123,4 @@ public class KitManager {
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
public static String getKitsPath() {
|
||||
return kitsPath;
|
||||
}
|
||||
|
||||
public static ArrayList<Kit> getLoadedKits() {
|
||||
return loadedKits;
|
||||
}
|
||||
}
|
||||
|
@ -58,6 +58,9 @@ public class Config {
|
||||
public static int MoneyLose;
|
||||
public static int MoneyDraw;
|
||||
|
||||
public static String MemberDefault;
|
||||
public static String LeaderDefault;
|
||||
|
||||
public static int TeamRedCornerX;
|
||||
public static int TeamRedCornerY;
|
||||
public static int TeamRedCornerZ;
|
||||
@ -133,6 +136,9 @@ public class Config {
|
||||
MoneyLose = config.getInt("Money.Lose");
|
||||
MoneyDraw = config.getInt("Money.Draw");
|
||||
|
||||
MemberDefault = config.getString("Kits.MemberDefault");
|
||||
LeaderDefault = config.getString("Kits.LeaderDefault");
|
||||
|
||||
if(SchemsizeX < 0){
|
||||
SchemsizeX = -SchemsizeX;
|
||||
TeamBlueCornerX -= SchemsizeX;
|
||||
|
In neuem Issue referenzieren
Einen Benutzer sperren