Schemnodes Schematic System #93
@ -26,6 +26,7 @@ import com.sk89q.worldedit.extent.clipboard.Clipboard;
|
|||||||
import com.sk89q.worldedit.regions.Region;
|
import com.sk89q.worldedit.regions.Region;
|
||||||
import de.steamwar.sql.NoClipboardException;
|
import de.steamwar.sql.NoClipboardException;
|
||||||
import de.steamwar.sql.Schematic;
|
import de.steamwar.sql.Schematic;
|
||||||
|
import de.steamwar.sql.SchematicNode;
|
||||||
import org.bukkit.Bukkit;
|
import org.bukkit.Bukkit;
|
||||||
import org.bukkit.Material;
|
import org.bukkit.Material;
|
||||||
|
|
||||||
@ -90,7 +91,7 @@ class CheckSchemType_12 {
|
|||||||
|
|
||||||
private CheckSchemType_12(){}
|
private CheckSchemType_12(){}
|
||||||
|
|
||||||
static AutoCheckResult autoCheck(Schematic schematic, ICheckSchemType type) {
|
static AutoCheckResult autoCheck(SchematicNode schematic, ICheckSchemType type) {
|
||||||
AutoCheckResult result = new AutoCheckResult(type);
|
AutoCheckResult result = new AutoCheckResult(type);
|
||||||
Clipboard clipboard;
|
Clipboard clipboard;
|
||||||
try {
|
try {
|
||||||
|
@ -26,6 +26,7 @@ import com.sk89q.worldedit.regions.Region;
|
|||||||
import com.sk89q.worldedit.world.block.BaseBlock;
|
import com.sk89q.worldedit.world.block.BaseBlock;
|
||||||
import de.steamwar.sql.NoClipboardException;
|
import de.steamwar.sql.NoClipboardException;
|
||||||
import de.steamwar.sql.Schematic;
|
import de.steamwar.sql.Schematic;
|
||||||
|
import de.steamwar.sql.SchematicNode;
|
||||||
import org.bukkit.Bukkit;
|
import org.bukkit.Bukkit;
|
||||||
import org.bukkit.Material;
|
import org.bukkit.Material;
|
||||||
|
|
||||||
@ -91,7 +92,7 @@ class CheckSchemType_15 {
|
|||||||
|
|
||||||
private CheckSchemType_15(){}
|
private CheckSchemType_15(){}
|
||||||
|
|
||||||
static AutoCheckResult autoCheck(Schematic schematic, ICheckSchemType type) {
|
static AutoCheckResult autoCheck(SchematicNode schematic, ICheckSchemType type) {
|
||||||
AutoCheckResult result = new AutoCheckResult(type);
|
AutoCheckResult result = new AutoCheckResult(type);
|
||||||
Clipboard clipboard;
|
Clipboard clipboard;
|
||||||
try {
|
try {
|
||||||
|
@ -82,15 +82,5 @@
|
|||||||
<version>1.0</version>
|
<version>1.0</version>
|
||||||
<scope>compile</scope>
|
<scope>compile</scope>
|
||||||
</dependency>
|
</dependency>
|
||||||
<dependency>
|
|
||||||
<groupId>org.apache.httpcomponents</groupId>
|
|
||||||
<artifactId>httpclient</artifactId>
|
|
||||||
<version>4.5.13</version>
|
|
||||||
</dependency>
|
|
||||||
<dependency>
|
|
||||||
<groupId>org.apache.httpcomponents</groupId>
|
|
||||||
<artifactId>httpmime</artifactId>
|
|
||||||
<version>4.5.13</version>
|
|
||||||
</dependency>
|
|
||||||
</dependencies>
|
</dependencies>
|
||||||
</project>
|
</project>
|
@ -21,6 +21,7 @@ package de.steamwar.schematicsystem;
|
|||||||
|
|
||||||
import de.steamwar.core.VersionedCallable;
|
import de.steamwar.core.VersionedCallable;
|
||||||
import de.steamwar.sql.Schematic;
|
import de.steamwar.sql.Schematic;
|
||||||
|
import de.steamwar.sql.SchematicNode;
|
||||||
import de.steamwar.sql.SchematicType;
|
import de.steamwar.sql.SchematicType;
|
||||||
import org.bukkit.configuration.ConfigurationSection;
|
import org.bukkit.configuration.ConfigurationSection;
|
||||||
|
|
||||||
@ -74,7 +75,7 @@ public class CheckSchemType implements ICheckSchemType {
|
|||||||
return types.get(type);
|
return types.get(type);
|
||||||
}
|
}
|
||||||
|
|
||||||
public AutoCheckResult autoCheck(Schematic schematic) {
|
public AutoCheckResult autoCheck(SchematicNode schematic) {
|
||||||
return VersionedCallable.call(new VersionedCallable<>(AutoCheckResult::new, 8),
|
return VersionedCallable.call(new VersionedCallable<>(AutoCheckResult::new, 8),
|
||||||
new VersionedCallable<>(() -> CheckSchemType_12.autoCheck(schematic, this), 12),
|
new VersionedCallable<>(() -> CheckSchemType_12.autoCheck(schematic, this), 12),
|
||||||
new VersionedCallable<>(AutoCheckResult::new, 13),
|
new VersionedCallable<>(AutoCheckResult::new, 13),
|
||||||
|
@ -29,14 +29,18 @@ import java.util.logging.Level;
|
|||||||
public class SchematicSystem extends JavaPlugin {
|
public class SchematicSystem extends JavaPlugin {
|
||||||
public static final String PREFIX = "§eSchematic§8» §7";
|
public static final String PREFIX = "§eSchematic§8» §7";
|
||||||
|
|
||||||
|
public static SchematicSystem INSTANCE;
|
||||||
|
public static SchematicCommand SCHEMATIC_COMMAND;
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onEnable() {
|
public void onEnable() {
|
||||||
|
INSTANCE = this;
|
||||||
if (!new File(getDataFolder(), "config.yml").exists()) {
|
if (!new File(getDataFolder(), "config.yml").exists()) {
|
||||||
saveDefaultConfig();
|
saveDefaultConfig();
|
||||||
Bukkit.getLogger().log(Level.SEVERE, "config.yml erstellt und geladen!");
|
Bukkit.getLogger().log(Level.SEVERE, "config.yml erstellt und geladen!");
|
||||||
}
|
}
|
||||||
|
|
||||||
CheckSchemType.init(getConfig());
|
CheckSchemType.init(getConfig());
|
||||||
getCommand("schem").setExecutor(new SchematicCommand());
|
SCHEMATIC_COMMAND = new SchematicCommand();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -32,10 +32,109 @@ import org.bukkit.event.inventory.ClickType;
|
|||||||
|
|
||||||
import java.util.*;
|
import java.util.*;
|
||||||
|
|
||||||
class GUI {
|
public class GUI {
|
||||||
private GUI(){}
|
|
||||||
|
|
||||||
static void changeType(Player p, Schematic schem){
|
public static void open(Player player) {
|
||||||
|
list(player, SchematicNode.getSchematicsAccessibleByUser(SteamwarUser.get(player.getUniqueId()).getId(), null), false, "/");
|
||||||
|
}
|
||||||
|
|
||||||
|
private static void list(Player player, List<SchematicNode> schems, boolean publics, String path) {
|
||||||
|
List<SWListInv.SWListEntry<SchematicNode>> schemList = new ArrayList<>();
|
||||||
|
|
||||||
|
for(SchematicNode schem : schems) {
|
||||||
|
Material m;
|
||||||
|
if (schem.getItem().isEmpty())
|
||||||
|
m = SWItem.getMaterial("CAULDRON_ITEM");
|
||||||
|
else
|
||||||
|
m = SWItem.getMaterial(schem.getItem());
|
||||||
|
|
||||||
|
SWItem item = new SWItem(m, "§e" + schem.getName(), Collections.singletonList(schem.isDir()?"§9Ordner":"§7" + schem.getSchemtype().name()), schem.isDir()?false:!schem.getSchemtype().writeable(), click -> {});
|
||||||
|
if(!schem.isDir()) {
|
||||||
|
if(schem.getRank() > 0)
|
||||||
|
item.setLore(Lists.newArrayList("§7" + schem.getSchemtype().name(), "§8Rang " + schem.getRank()));
|
||||||
|
}
|
||||||
|
schemList.add(new SWListInv.SWListEntry<>(item, schem));
|
||||||
|
}
|
||||||
|
|
||||||
|
SWListInv<SchematicNode> inv = new SWListInv<>(player, "§eSchematicliste §8- §r" + path, false, schemList, (clickType, schem) -> info(player, schem));
|
||||||
|
if(publics)
|
||||||
|
inv.setItem(48, Material.BUCKET, "§7Eigene Schematics", clickType -> open(player));
|
||||||
|
else
|
||||||
|
inv.setItem(48, Material.GLASS, "§7Public Schematics", clickType -> list(player, SchematicNode.getSchematicsAccessibleByUser(0, null), true, "/"));
|
||||||
|
inv.setItem(50, Material.NAME_TAG, "§7Suche", clickType -> search(player, publics));
|
||||||
|
inv.open();
|
||||||
|
}
|
||||||
|
|
||||||
|
private static void info(Player player, SchematicNode node) {
|
||||||
|
SteamwarUser user = SteamwarUser.get(player.getUniqueId());
|
||||||
|
if(node.isDir()) {
|
||||||
|
list(player, SchematicNode.getSchematicNodeInNode(node), node.getOwner() == 0, node.generateBreadcrumbs(user));
|
||||||
|
} else {
|
||||||
|
SWInventory inv = new SWInventory(player, 9, node.generateBreadcrumbs(user));
|
||||||
|
inv.setItem(0, SWItem.getMaterial("WOOD_AXE"), "§eLaden", click -> {
|
||||||
|
player.closeInventory();
|
||||||
|
SchematicSystem.SCHEMATIC_COMMAND.loadSchem(player, node);
|
||||||
|
});
|
||||||
|
|
||||||
|
if(node.getOwner() == user.getId()){
|
||||||
|
if(node.getSchemtype().writeable()){
|
||||||
|
List<CheckedSchematic> checkedSchematics = CheckedSchematic.getLastDeclined(player.getUniqueId());
|
||||||
|
ListIterator<CheckedSchematic> i = checkedSchematics.listIterator(checkedSchematics.size());
|
||||||
|
while(i.hasPrevious()) {
|
||||||
|
CheckedSchematic checkedSchematic = i.previous();
|
||||||
|
if(checkedSchematic.getNode() == node.getId()) {
|
||||||
|
inv.setItem(1, SWItem.getDye(10), (byte) 10, "§eStatus " + node.getSchemtype().name(), Collections.singletonList("§7" + checkedSchematic.getDeclineReason()), false, click -> {});
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
Material mat = SWItem.getMaterial("CAULDRON_ITEM");
|
||||||
|
if(node.getItem() != null && !node.getItem().equals(""))
|
||||||
|
mat = SWItem.getMaterial(node.getItem());
|
||||||
|
|
||||||
|
inv.setItem(2, mat, "§e" + mat.name(), Arrays.asList("§7Zum Ändern", "§7anklicken"), false, click -> {
|
||||||
|
player.closeInventory();
|
||||||
|
changeItem(player, node);
|
||||||
|
});
|
||||||
|
inv.setItem(4, SWItem.getMaterial("CAULDRON_ITEM"), "§e" + node.getSchemtype().name(), Arrays.asList("§7Zum Ändern", "§7anklicken"), false, click -> {
|
||||||
|
player.closeInventory();
|
||||||
|
changeType(player, node);
|
||||||
|
});
|
||||||
|
inv.setItem(5, SWItem.getMaterial("MAGENTA_GLAZED_TERRACOTTA"), "§eDownload", click -> {
|
||||||
|
player.closeInventory();
|
||||||
|
SchematicSystem.SCHEMATIC_COMMAND.download(player, node);
|
||||||
|
});
|
||||||
|
SWItem skull = SWItem.getPlayerSkull("MHF_STEVE");
|
||||||
|
skull.setCallback(click -> {
|
||||||
|
player.closeInventory();
|
||||||
|
delmembers(player, node);
|
||||||
|
});
|
||||||
|
skull.setName("§eMitglieder");
|
||||||
|
inv.setItem(6, skull);
|
||||||
|
inv.setItem(8, SWItem.getDye(1), (byte) 1, "§cLöschen", click -> {
|
||||||
|
player.closeInventory();
|
||||||
|
delete(player, node);
|
||||||
|
});
|
||||||
|
}else{
|
||||||
|
inv.setItem(4, SWItem.getMaterial("CAULDRON_ITEM"), "§e" + node.getSchemtype().name(), click -> {});
|
||||||
|
|
||||||
|
SteamwarUser owneruser = SteamwarUser.get(node.getOwner());
|
||||||
|
SWItem skull = SWItem.getPlayerSkull(owneruser.getUserName());
|
||||||
|
skull.setName("§7von §e" + owneruser.getUserName());
|
||||||
|
inv.setItem(6, skull);
|
||||||
|
|
||||||
|
inv.setItem(8, SWItem.getDye(1), (byte) 1, "§cZugriff entfernen", click -> {
|
||||||
|
player.closeInventory();
|
||||||
|
delete(player, node);
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
inv.setCallback(-999, click -> player.closeInventory());
|
||||||
|
inv.open();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
static void changeType(Player p, SchematicNode schem){
|
||||||
List<SWListInv.SWListEntry<SchematicType>> types = new LinkedList<>();
|
List<SWListInv.SWListEntry<SchematicType>> types = new LinkedList<>();
|
||||||
for(SchematicType type : SchematicType.values()){
|
for(SchematicType type : SchematicType.values()){
|
||||||
if(!type.isAssignable())
|
if(!type.isAssignable())
|
||||||
@ -49,24 +148,24 @@ class GUI {
|
|||||||
}
|
}
|
||||||
|
|
||||||
SWListInv<SchematicType> inv = new SWListInv<>(p, "Typ ändern", types, (clickType, schematicType) -> {
|
SWListInv<SchematicType> inv = new SWListInv<>(p, "Typ ändern", types, (clickType, schematicType) -> {
|
||||||
SchematicCommand.changetype(p, schem, schematicType);
|
p.closeInventory();
|
||||||
|
SchematicSystem.SCHEMATIC_COMMAND.changeType(p, schem, schematicType);
|
||||||
});
|
});
|
||||||
inv.setCallback(-999, (ClickType click) -> p.closeInventory());
|
inv.setCallback(-999, (ClickType click) -> p.closeInventory());
|
||||||
inv.open();
|
inv.open();
|
||||||
}
|
}
|
||||||
|
|
||||||
private static void deleteOwn(Player p, Schematic schem){
|
private static void deleteOwn(Player p, SchematicNode schem){
|
||||||
SWInventory inv = new SWInventory(p, 9, schem.getSchemName() + " löschen");
|
SteamwarUser user = SteamwarUser.get(p.getUniqueId());
|
||||||
|
SWInventory inv = new SWInventory(p, 9, schem.generateBreadcrumbs(user) + " löschen");
|
||||||
inv.setItem(0, SWItem.getDye(1), (byte) 1, "§eLöschen", click -> {
|
inv.setItem(0, SWItem.getDye(1), (byte) 1, "§eLöschen", click -> {
|
||||||
schem.remove();
|
schem.delete();
|
||||||
|
|
||||||
List<CheckedSchematic> checkedSchematics = CheckedSchematic.getLastDeclined(p.getUniqueId());
|
List<CheckedSchematic> checkedSchematics = CheckedSchematic.getLastDeclined(schem);
|
||||||
for(CheckedSchematic checkedSchematic : checkedSchematics) {
|
for(CheckedSchematic checkedSchematic : checkedSchematics) {
|
||||||
if(checkedSchematic.getSchemOwner() == schem.getSchemOwner() &&
|
checkedSchematic.remove();
|
||||||
checkedSchematic.getSchemName().equals(schem.getSchemName()))
|
|
||||||
checkedSchematic.remove();
|
|
||||||
}
|
}
|
||||||
p.sendMessage(SchematicSystem.PREFIX + "Schematic §e" + schem.getSchemName() + " §7gelöscht");
|
p.sendMessage(SchematicSystem.PREFIX + "Schematic §e" + schem.generateBreadcrumbs(user) + " §7gelöscht");
|
||||||
p.closeInventory();
|
p.closeInventory();
|
||||||
});
|
});
|
||||||
inv.setItem(8, SWItem.getDye(14), (byte) 14, "§cAbbruch", click -> p.closeInventory());
|
inv.setItem(8, SWItem.getDye(14), (byte) 14, "§cAbbruch", click -> p.closeInventory());
|
||||||
@ -74,13 +173,14 @@ class GUI {
|
|||||||
inv.open();
|
inv.open();
|
||||||
}
|
}
|
||||||
|
|
||||||
private static void deleteMembership(Player p, Schematic schem){
|
private static void deleteMembership(Player p, SchematicNode schem){
|
||||||
SWInventory inv = new SWInventory(p, 9, schem.getSchemName() + " entfernen");
|
SteamwarUser user = SteamwarUser.get(p.getUniqueId());
|
||||||
|
SWInventory inv = new SWInventory(p, 9, schem.generateBreadcrumbs(user) + " entfernen");
|
||||||
inv.setItem(0, SWItem.getDye(1), (byte) 1, "§eZugriff entfernen", click -> {
|
inv.setItem(0, SWItem.getDye(1), (byte) 1, "§eZugriff entfernen", click -> {
|
||||||
SchematicMember member = SchematicMember.getSchemMemberFromDB(schem.getSchemName(), schem.getSchemOwner(), SteamwarUser.get(p.getUniqueId()).getId());
|
NodeMember member = NodeMember.getNodeMember(schem.getId(), user.getId());
|
||||||
if(member != null)
|
if(member != null)
|
||||||
member.remove();
|
member.delete();
|
||||||
p.sendMessage(SchematicSystem.PREFIX + "Zugriff zu Schematic §e" + schem.getSchemName() + " §7entfernt");
|
p.sendMessage(SchematicSystem.PREFIX + "Zugriff zu Schematic §e" + schem.generateBreadcrumbs(user) + " §7entfernt");
|
||||||
p.closeInventory();
|
p.closeInventory();
|
||||||
});
|
});
|
||||||
inv.setItem(8, SWItem.getDye(14), (byte) 14, "§cAbbruch", click -> p.closeInventory());
|
inv.setItem(8, SWItem.getDye(14), (byte) 14, "§cAbbruch", click -> p.closeInventory());
|
||||||
@ -88,22 +188,22 @@ class GUI {
|
|||||||
inv.open();
|
inv.open();
|
||||||
}
|
}
|
||||||
|
|
||||||
static void delete(Player p, Schematic schem){
|
static void delete(Player p, SchematicNode schem){
|
||||||
if(SteamwarUser.get(p.getUniqueId()).getId() == schem.getSchemOwner())
|
if(SteamwarUser.get(p.getUniqueId()).getId() == schem.getOwner())
|
||||||
deleteOwn(p, schem);
|
deleteOwn(p, schem);
|
||||||
else
|
else
|
||||||
deleteMembership(p, schem);
|
deleteMembership(p, schem);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void delmembers(Player p, Schematic schem){
|
static void delmembers(Player p, SchematicNode schem){
|
||||||
List<SWListInv.SWListEntry<SchematicMember>> members = new LinkedList<>();
|
List<SWListInv.SWListEntry<NodeMember>> members = new LinkedList<>();
|
||||||
for(SchematicMember member : SchematicMember.getSchemMembers(schem.getSchemName(), schem.getSchemOwner())){
|
for(NodeMember member : schem.getMembers()){
|
||||||
SteamwarUser user = SteamwarUser.get(member.getMember());
|
SteamwarUser user = SteamwarUser.get(member.getMember());
|
||||||
members.add(new SWListInv.SWListEntry<>(SWItem.getPlayerSkull(user.getUserName()), member));
|
members.add(new SWListInv.SWListEntry<>(SWItem.getPlayerSkull(user.getUserName()), member));
|
||||||
}
|
}
|
||||||
|
|
||||||
SWListInv<SchematicMember> inv = new SWListInv<>(p, "Mitglieder entfernen", members, (clickType, member) -> {
|
SWListInv<NodeMember> inv = new SWListInv<>(p, "Mitglieder entfernen", members, (clickType, member) -> {
|
||||||
member.remove();
|
member.delete();
|
||||||
p.closeInventory();
|
p.closeInventory();
|
||||||
delmembers(p, schem);
|
delmembers(p, schem);
|
||||||
});
|
});
|
||||||
@ -111,7 +211,7 @@ class GUI {
|
|||||||
inv.open();
|
inv.open();
|
||||||
}
|
}
|
||||||
|
|
||||||
private static void changeItem(Player p, Schematic schem){
|
private static void changeItem(Player p, SchematicNode schem){
|
||||||
List<SWListInv.SWListEntry<Material>> materials = new LinkedList<>();
|
List<SWListInv.SWListEntry<Material>> materials = new LinkedList<>();
|
||||||
for(Material material : Material.values()){
|
for(Material material : Material.values()){
|
||||||
SWItem item = new SWItem(material, "§7" + material.name());
|
SWItem item = new SWItem(material, "§7" + material.name());
|
||||||
@ -128,108 +228,12 @@ class GUI {
|
|||||||
inv.open();
|
inv.open();
|
||||||
}
|
}
|
||||||
|
|
||||||
private static void info(Player p, Schematic schem){
|
private static void search(Player player, boolean publics) {
|
||||||
SWInventory inv = new SWInventory(p, 9, schem.getSchemName());
|
SWAnvilInv inv = new SWAnvilInv(player, "Schematics suchen");
|
||||||
if(schem.availible())
|
inv.setItem(SWItem.getMaterial("CAULDRON_ITEM"));
|
||||||
inv.setItem(0, SWItem.getMaterial("WOOD_AXE"), "§eLaden", click -> {
|
inv.setCallback(s -> {
|
||||||
SchematicCommand.load(p, schem);
|
SteamwarUser user = SteamwarUser.get(player.getUniqueId());
|
||||||
p.closeInventory();
|
list(player, SchematicNode.filterSchems(publics?0:user.getId(), node -> node.getName().contains(s)), publics, "/");
|
||||||
});
|
|
||||||
|
|
||||||
if(schem.getSchemOwner() == SteamwarUser.get(p.getUniqueId()).getId()){
|
|
||||||
if(schem.getSchemType().writeable()){
|
|
||||||
List<CheckedSchematic> checkedSchematics = CheckedSchematic.getLastDeclined(p.getUniqueId());
|
|
||||||
ListIterator<CheckedSchematic> i = checkedSchematics.listIterator(checkedSchematics.size());
|
|
||||||
while(i.hasPrevious()) {
|
|
||||||
CheckedSchematic checkedSchematic = i.previous();
|
|
||||||
if(checkedSchematic.getSchemName().equals(schem.getSchemName()) &&
|
|
||||||
checkedSchematic.getSchemOwner() == schem.getSchemOwner()) {
|
|
||||||
inv.setItem(1, SWItem.getDye(10), (byte) 10, "§eStatus " + schem.getSchemType().name(), Collections.singletonList("§7" + checkedSchematic.getDeclineReason()), false, click -> {});
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
Material mat = SWItem.getMaterial("CAULDRON_ITEM");
|
|
||||||
if(schem.getItem() != null && !schem.getItem().equals(""))
|
|
||||||
mat = SWItem.getMaterial(schem.getItem());
|
|
||||||
|
|
||||||
inv.setItem(2, mat, "§e" + mat.name(), Arrays.asList("§7Zum Ändern", "§7anklicken"), false, click -> {
|
|
||||||
p.closeInventory();
|
|
||||||
changeItem(p, schem);
|
|
||||||
});
|
|
||||||
if(schem.availible())
|
|
||||||
inv.setItem(4, SWItem.getMaterial("CAULDRON_ITEM"), "§e" + schem.getSchemType().name(), Arrays.asList("§7Zum Ändern", "§7anklicken"), false, click -> {
|
|
||||||
p.closeInventory();
|
|
||||||
changeType(p, schem);
|
|
||||||
});
|
|
||||||
inv.setItem(5, SWItem.getMaterial("MAGENTA_GLAZED_TERRACOTTA"), "§eDownload", click -> {
|
|
||||||
p.closeInventory();
|
|
||||||
SchematicCommand.download(p, schem);
|
|
||||||
});
|
|
||||||
SWItem skull = SWItem.getPlayerSkull("MHF_STEVE");
|
|
||||||
skull.setCallback(click -> {
|
|
||||||
p.closeInventory();
|
|
||||||
delmembers(p, schem);
|
|
||||||
});
|
|
||||||
skull.setName("§eMitglieder");
|
|
||||||
inv.setItem(6, skull);
|
|
||||||
inv.setItem(8, SWItem.getDye(1), (byte) 1, "§cLöschen", click -> {
|
|
||||||
p.closeInventory();
|
|
||||||
delete(p, schem);
|
|
||||||
});
|
|
||||||
}else{
|
|
||||||
inv.setItem(4, SWItem.getMaterial("CAULDRON_ITEM"), "§e" + schem.getSchemType().name(), click -> {});
|
|
||||||
|
|
||||||
SteamwarUser owneruser = SteamwarUser.get(schem.getSchemOwner());
|
|
||||||
SWItem skull = SWItem.getPlayerSkull(owneruser.getUserName());
|
|
||||||
skull.setName("§7von §e" + owneruser.getUserName());
|
|
||||||
inv.setItem(6, skull);
|
|
||||||
|
|
||||||
inv.setItem(8, SWItem.getDye(1), (byte) 1, "§cZugriff entfernen", click -> {
|
|
||||||
p.closeInventory();
|
|
||||||
delete(p, schem);
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
inv.setCallback(-999, click -> p.closeInventory());
|
|
||||||
inv.open();
|
|
||||||
}
|
|
||||||
|
|
||||||
static void list(Player p){
|
|
||||||
list(p, Schematic.getSchemsAccessibleByUser(SteamwarUser.get(p.getUniqueId()).getId()), false);
|
|
||||||
}
|
|
||||||
|
|
||||||
private static void list(Player p, List<Schematic> schems, boolean publics){
|
|
||||||
List<SWListInv.SWListEntry<Schematic>> schemList = new ArrayList<>();
|
|
||||||
|
|
||||||
for(Schematic schem : schems) {
|
|
||||||
Material m;
|
|
||||||
if (schem.getItem().isEmpty())
|
|
||||||
m = SWItem.getMaterial("CAULDRON_ITEM");
|
|
||||||
else
|
|
||||||
m = SWItem.getMaterial(schem.getItem());
|
|
||||||
|
|
||||||
SWItem item = new SWItem(m, "§e" + schem.getSchemName(), Collections.singletonList("§7" + schem.getSchemType().name()), !schem.getSchemType().writeable(), click -> {});
|
|
||||||
if(schem.getRank() > 0)
|
|
||||||
item.setLore(Lists.newArrayList("§7" + schem.getSchemType().name(), "§8Rang " + schem.getRank()));
|
|
||||||
schemList.add(new SWListInv.SWListEntry<>(item, schem));
|
|
||||||
}
|
|
||||||
|
|
||||||
SWListInv<Schematic> inv = new SWListInv<>(p, "§eSchematicliste", false, schemList, (clickType, schem) -> info(p, schem));
|
|
||||||
if(publics)
|
|
||||||
inv.setItem(48, Material.BUCKET, "§7Eigene Schematics", clickType -> list(p));
|
|
||||||
else
|
|
||||||
inv.setItem(48, Material.GLASS, "§7Public Schematics", clickType -> list(p, Schematic.getSchemsAccessibleByUser(0), true));
|
|
||||||
inv.setItem(50, Material.NAME_TAG, "§7Suche", clickType -> search(p, schems));
|
|
||||||
inv.open();
|
|
||||||
}
|
|
||||||
|
|
||||||
static void search(Player p, List<Schematic> schems){
|
|
||||||
SWAnvilInv inv = new SWAnvilInv(p, "§7Schematicsuche");
|
|
||||||
inv.setCallback(term -> {
|
|
||||||
ArrayList<Schematic> schemCopy = new ArrayList<>(schems);
|
|
||||||
schemCopy.removeIf(schem -> !schem.getSchemName().toLowerCase().contains(term.toLowerCase()));
|
|
||||||
list(p, schemCopy, false);
|
|
||||||
});
|
});
|
||||||
inv.open();
|
inv.open();
|
||||||
}
|
}
|
||||||
|
Datei-Diff unterdrückt, da er zu groß ist
Diff laden
@ -1,14 +1,15 @@
|
|||||||
name: SchematicSystem
|
name: SchematicSystem
|
||||||
version: "1.0"
|
version: "2.0"
|
||||||
authors: [Yaruma3341, Lixfel]
|
authors: [Yaruma3341, Lixfel, Chaoscaot]
|
||||||
depend: [SpigotCore, WorldEdit]
|
depend: [SpigotCore, WorldEdit]
|
||||||
main: de.steamwar.schematicsystem.SchematicSystem
|
main: de.steamwar.schematicsystem.SchematicSystem
|
||||||
|
website: steamwar.de
|
||||||
api-version: "1.13"
|
api-version: "1.13"
|
||||||
|
|
||||||
commands:
|
commands:
|
||||||
schem:
|
#schem:
|
||||||
aliases:
|
# aliases:
|
||||||
- schematic
|
# - schematic
|
||||||
- /schematic
|
# - /schematic
|
||||||
- /schem
|
# - /schem
|
||||||
check:
|
check:
|
In neuem Issue referenzieren
Einen Benutzer sperren