Fixing Some PR Stuff
Dieser Commit ist enthalten in:
Ursprung
79aab75d18
Commit
94c4d8107e
@ -27,9 +27,6 @@ class CommandDebugStick_15 {
|
||||
private CommandDebugStick_15(){}
|
||||
|
||||
static void giveStick(Player player){
|
||||
if(player.getInventory().getItemInMainHand().getType() == Material.AIR)
|
||||
player.getInventory().setItemInMainHand(new ItemStack(Material.DEBUG_STICK));
|
||||
else
|
||||
player.getInventory().addItem(new ItemStack(Material.DEBUG_STICK));
|
||||
player.getInventory().setItemInMainHand(new ItemStack(Material.DEBUG_STICK, 1));
|
||||
}
|
||||
}
|
||||
|
@ -23,7 +23,6 @@ import de.steamwar.bausystem.BauSystem;
|
||||
import de.steamwar.bausystem.Permission;
|
||||
import de.steamwar.bausystem.world.Detonator;
|
||||
import de.steamwar.bausystem.world.Welt;
|
||||
import org.bukkit.Material;
|
||||
import org.bukkit.command.Command;
|
||||
import org.bukkit.command.CommandExecutor;
|
||||
import org.bukkit.command.CommandSender;
|
||||
@ -63,10 +62,7 @@ public class CommandDetonator implements CommandExecutor {
|
||||
case "wand":
|
||||
case "detonator":
|
||||
case "item":
|
||||
if(player.getInventory().getItemInMainHand().getType() == Material.AIR)
|
||||
player.getInventory().setItemInMainHand(Detonator.WAND);
|
||||
else
|
||||
player.getInventory().addItem(Detonator.WAND);
|
||||
player.updateInventory();
|
||||
Detonator.getDetonator(player);
|
||||
break;
|
||||
|
@ -138,7 +138,7 @@ public class CommandGUI implements CommandExecutor, Listener {
|
||||
inv.setItem(4, skull);
|
||||
}
|
||||
|
||||
inv.setItem(6, Material.BOOK, "§7Script Bücher", Arrays.asList("§7Aktuell §e" + ScriptBook.getBookCount() + " §7Bücher"), true, clickType -> {
|
||||
inv.setItem(6, Material.BOOK, "§7Script Bücher", Arrays.asList("§7Aktuell §e" + PredefinedBook.getBookCount() + " §7Bücher"), true, clickType -> {
|
||||
player.closeInventory();
|
||||
scriptBooksGUI(player);
|
||||
});
|
||||
@ -355,12 +355,12 @@ public class CommandGUI implements CommandExecutor, Listener {
|
||||
}
|
||||
|
||||
private static void scriptBooksGUI(Player player) {
|
||||
List<SWListInv.SWListEntry<ScriptBook>> entries = new ArrayList<>();
|
||||
List<ScriptBook> books = ScriptBook.getBooks();
|
||||
books.forEach(scriptBook -> entries.add(new SWListInv.SWListEntry<>(new SWItem(scriptBook.getBookMat(), scriptBook.getName(), scriptBook.getLore(), false, clickType -> {}), scriptBook)));
|
||||
SWListInv<ScriptBook> inv = new SWListInv<>(player, "Script Bücher", entries, (clickType, scriptBook) -> {
|
||||
List<SWListInv.SWListEntry<PredefinedBook>> entries = new ArrayList<>();
|
||||
List<PredefinedBook> books = PredefinedBook.getBooks();
|
||||
books.forEach(predefinedBook -> entries.add(new SWListInv.SWListEntry<>(new SWItem(predefinedBook.getBookMat(), predefinedBook.getName(), predefinedBook.getLore(), false, clickType -> {}), predefinedBook)));
|
||||
SWListInv<PredefinedBook> inv = new SWListInv<>(player, "Script Bücher", entries, (clickType, predefinedBook) -> {
|
||||
player.closeInventory();
|
||||
player.getInventory().addItem(scriptBook.toItemStack());
|
||||
player.getInventory().addItem(predefinedBook.toItemStack());
|
||||
});
|
||||
inv.open();
|
||||
}
|
||||
|
@ -21,7 +21,6 @@ package de.steamwar.bausystem.commands;
|
||||
|
||||
import de.steamwar.bausystem.BauSystem;
|
||||
import de.steamwar.inventory.SWItem;
|
||||
import org.bukkit.Material;
|
||||
import org.bukkit.command.Command;
|
||||
import org.bukkit.command.CommandExecutor;
|
||||
import org.bukkit.command.CommandSender;
|
||||
@ -47,10 +46,7 @@ public class CommandSkull implements CommandExecutor {
|
||||
assert sm != null;
|
||||
sm.setDisplayName("§e" + args[0] + "§8s Kopf");
|
||||
is.setItemMeta(sm);
|
||||
if(p.getInventory().getItemInMainHand().getType() == Material.AIR)
|
||||
p.getInventory().setItemInMainHand(is);
|
||||
else
|
||||
p.getInventory().addItem(is);
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
@ -34,12 +34,6 @@ import org.bukkit.event.entity.EntityExplodeEvent;
|
||||
|
||||
public class CommandTNT implements CommandExecutor, Listener {
|
||||
|
||||
private static TNTMode tntMode = Region.buildAreaEnabled() ? TNTMode.ONLY_TB : TNTMode.OFF;
|
||||
|
||||
public static TNTMode getTntMode() {
|
||||
return tntMode;
|
||||
}
|
||||
|
||||
public enum TNTMode {
|
||||
ON("§aan"),
|
||||
ONLY_TB("§7Kein §eBaurahmen"),
|
||||
|
@ -1,7 +1,6 @@
|
||||
package de.steamwar.bausystem.world;
|
||||
|
||||
import de.steamwar.bausystem.BauSystem;
|
||||
import de.steamwar.core.VersionedCallable;
|
||||
import org.bukkit.Material;
|
||||
import org.bukkit.configuration.ConfigurationSection;
|
||||
import org.bukkit.configuration.file.FileConfiguration;
|
||||
@ -14,22 +13,22 @@ import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.Objects;
|
||||
|
||||
public class ScriptBook {
|
||||
public class PredefinedBook {
|
||||
|
||||
private static final FileConfiguration configuration;
|
||||
private static List<ScriptBook> bookCache;
|
||||
private static List<PredefinedBook> bookCache;
|
||||
|
||||
static {
|
||||
configuration = YamlConfiguration.loadConfiguration(new File(BauSystem.getPlugin().getDataFolder(), "books.yml"));
|
||||
}
|
||||
|
||||
public static List<ScriptBook> getBooks() {
|
||||
public static List<PredefinedBook> getBooks() {
|
||||
if(bookCache != null)
|
||||
return bookCache;
|
||||
List<ScriptBook> books = new ArrayList<>();
|
||||
List<PredefinedBook> books = new ArrayList<>();
|
||||
for (String book:configuration.getKeys(false)) {
|
||||
ConfigurationSection section = Objects.requireNonNull(configuration.getConfigurationSection(book));
|
||||
books.add(new ScriptBook(section));
|
||||
books.add(new PredefinedBook(section));
|
||||
}
|
||||
bookCache = books;
|
||||
return books;
|
||||
@ -44,7 +43,7 @@ public class ScriptBook {
|
||||
private String author;
|
||||
private String name;
|
||||
|
||||
ScriptBook(ConfigurationSection section) {
|
||||
PredefinedBook(ConfigurationSection section) {
|
||||
this.lines = section.getStringList("lines");
|
||||
this.lore = section.getStringList("lore");
|
||||
this.author = section.getString("author", "§8Steam§eWar");
|
In neuem Issue referenzieren
Einen Benutzer sperren