Schemnodes #56
@ -21,6 +21,7 @@ PREFIX = §eBau§8System§8»
|
|||||||
TIME = HH:mm:ss
|
TIME = HH:mm:ss
|
||||||
DATE=........
|
DATE=........
|
||||||
COMMAND_HELP_HEAD=§7---=== (§e{0}§7) ===---
|
COMMAND_HELP_HEAD=§7---=== (§e{0}§7) ===---
|
||||||
|
ONLY_SCHEMS=§cDu kannst hier keinen Ordner angeben
|
||||||
|
|
||||||
PAGE_LIST=§e Seite ({0}/{1}) »»
|
PAGE_LIST=§e Seite ({0}/{1}) »»
|
||||||
LIST_PREVIOUS_PAGE=§eVorherige Seite
|
LIST_PREVIOUS_PAGE=§eVorherige Seite
|
||||||
@ -908,6 +909,7 @@ REGION_TNT_BUILD=§cEine Explosion hätte Blöcke im Baubereich zerstört
|
|||||||
# Team
|
# Team
|
||||||
LOCK_SCHEM_NO_USER=§7Dieser Spieler existiert nicht!
|
LOCK_SCHEM_NO_USER=§7Dieser Spieler existiert nicht!
|
||||||
LOCK_SCHEM_NO_SCHEM=§7Dieser Spieler besitzt keine Schematic mit diesem Namen!
|
LOCK_SCHEM_NO_SCHEM=§7Dieser Spieler besitzt keine Schematic mit diesem Namen!
|
||||||
|
LOCK_SCHEM_DIR=§7Die angegebene Schematic ist ein Ordner
|
||||||
LOCK_SCHEM_LOCKED=§e{0} §7von §e{1} §7wurde von §e{2} §7auf §eNORMAL §7zurück gesetz. §f§lGrund: §f{3}
|
LOCK_SCHEM_LOCKED=§e{0} §7von §e{1} §7wurde von §e{2} §7auf §eNORMAL §7zurück gesetz. §f§lGrund: §f{3}
|
||||||
LOCK_SCHEM_HELP=§8/§eschemlock §8[§7Owner§8] [§7Schematic§8] [§7Grund§8] - §7Sperre eine Schematic
|
LOCK_SCHEM_HELP=§8/§eschemlock §8[§7Owner§8] [§7Schematic§8] [§7Grund§8] - §7Sperre eine Schematic
|
||||||
AFK_KICK_MESSAGE=§cAuf diesem Server ist seit 5 Minuten nichts passiert.
|
AFK_KICK_MESSAGE=§cAuf diesem Server ist seit 5 Minuten nichts passiert.
|
||||||
|
@ -19,7 +19,6 @@
|
|||||||
|
|
||||||
package de.steamwar.bausystem;
|
package de.steamwar.bausystem;
|
||||||
|
|
||||||
import com.comphenix.tinyprotocol.TinyProtocol;
|
|
||||||
import de.steamwar.bausystem.config.ColorConfig;
|
import de.steamwar.bausystem.config.ColorConfig;
|
||||||
import de.steamwar.bausystem.configplayer.Config;
|
import de.steamwar.bausystem.configplayer.Config;
|
||||||
import de.steamwar.bausystem.linkage.LinkageUtils;
|
import de.steamwar.bausystem.linkage.LinkageUtils;
|
||||||
|
@ -32,7 +32,7 @@ import de.steamwar.bausystem.region.flags.flagvalues.ColorMode;
|
|||||||
import de.steamwar.bausystem.region.utils.RegionExtensionType;
|
import de.steamwar.bausystem.region.utils.RegionExtensionType;
|
||||||
import de.steamwar.bausystem.region.utils.RegionType;
|
import de.steamwar.bausystem.region.utils.RegionType;
|
||||||
import de.steamwar.command.*;
|
import de.steamwar.command.*;
|
||||||
import de.steamwar.sql.Schematic;
|
import de.steamwar.sql.SchematicNode;
|
||||||
import net.md_5.bungee.api.chat.ClickEvent;
|
import net.md_5.bungee.api.chat.ClickEvent;
|
||||||
import org.bukkit.Bukkit;
|
import org.bukkit.Bukkit;
|
||||||
import org.bukkit.command.CommandSender;
|
import org.bukkit.command.CommandSender;
|
||||||
@ -125,17 +125,17 @@ public class RegionCommand extends SWCommand {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Register(value = "restore", description = "REGION_REGION_HELP_RESTORE_SCHEMATIC")
|
@Register(value = "restore", description = "REGION_REGION_HELP_RESTORE_SCHEMATIC")
|
||||||
public void schematicRestoreCommand(@Guard("WORLD_EDIT") Player p, String s) {
|
public void schematicRestoreCommand(@Guard("WORLD_EDIT") Player p, SchematicNode node) {
|
||||||
Region region = Region.getRegion(p.getLocation());
|
Region region = Region.getRegion(p.getLocation());
|
||||||
if (checkGlobalRegion(region, p)) return;
|
if (checkGlobalRegion(region, p)) return;
|
||||||
|
|
||||||
Schematic schem = Schematic.getSchemFromDB(s, p.getUniqueId());
|
if(node.isDir()) {
|
||||||
if (schem == null) {
|
BauSystem.MESSAGE.send("ONLY_SCHEMS", p);
|
||||||
BauSystem.MESSAGE.send("REGION_REGION_NO_SCHEM", p);
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
try {
|
try {
|
||||||
region.reset(schem, RegionType.NORMAL, RegionExtensionType.NORMAL, true);
|
region.reset(node, RegionType.NORMAL, RegionExtensionType.NORMAL, true);
|
||||||
RegionUtils.message(region, "REGION_REGION_RESTORED");
|
RegionUtils.message(region, "REGION_REGION_RESTORED");
|
||||||
} catch (IOException e) {
|
} catch (IOException e) {
|
||||||
BauSystem.MESSAGE.send("REGION_REGION_FAILED_RESTORE", p);
|
BauSystem.MESSAGE.send("REGION_REGION_FAILED_RESTORE", p);
|
||||||
|
@ -31,7 +31,7 @@ import de.steamwar.command.GuardCheckType;
|
|||||||
import de.steamwar.command.GuardChecker;
|
import de.steamwar.command.GuardChecker;
|
||||||
import de.steamwar.command.GuardResult;
|
import de.steamwar.command.GuardResult;
|
||||||
import de.steamwar.command.SWCommand;
|
import de.steamwar.command.SWCommand;
|
||||||
import de.steamwar.sql.Schematic;
|
import de.steamwar.sql.SchematicNode;
|
||||||
import org.bukkit.Bukkit;
|
import org.bukkit.Bukkit;
|
||||||
import org.bukkit.entity.Player;
|
import org.bukkit.entity.Player;
|
||||||
|
|
||||||
@ -59,16 +59,15 @@ public class ResetCommand extends SWCommand {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Register(description = "REGION_RESET_HELP_SCHEMATIC")
|
@Register(description = "REGION_RESET_HELP_SCHEMATIC")
|
||||||
public void schematicResetCommand(@Guard Player p, String s) {
|
public void schematicResetCommand(@Guard Player p, SchematicNode node) {
|
||||||
Region region = regionCheck(p);
|
Region region = regionCheck(p);
|
||||||
if (region == null) return;
|
if (region == null) return;
|
||||||
Schematic schem = Schematic.getSchemFromDB(s, p.getUniqueId());
|
if (node.isDir()) {
|
||||||
if (schem == null) {
|
BauSystem.MESSAGE.send("ONLY_SCHEMS", p);
|
||||||
BauSystem.MESSAGE.send("REGION_RESET_NO_SCHEM", p);
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
try {
|
try {
|
||||||
region.reset(schem, RegionType.NORMAL);
|
region.reset(node, RegionType.NORMAL);
|
||||||
RegionUtils.message(region, "REGION_RESET_RESETED");
|
RegionUtils.message(region, "REGION_RESET_RESETED");
|
||||||
} catch (IOException e) {
|
} catch (IOException e) {
|
||||||
BauSystem.MESSAGE.send("REGION_RESET_ERROR", p);
|
BauSystem.MESSAGE.send("REGION_RESET_ERROR", p);
|
||||||
|
@ -28,8 +28,10 @@ import de.steamwar.bausystem.region.RegionUtils;
|
|||||||
import de.steamwar.bausystem.region.utils.RegionExtensionType;
|
import de.steamwar.bausystem.region.utils.RegionExtensionType;
|
||||||
import de.steamwar.bausystem.region.utils.RegionType;
|
import de.steamwar.bausystem.region.utils.RegionType;
|
||||||
import de.steamwar.command.*;
|
import de.steamwar.command.*;
|
||||||
import de.steamwar.sql.Schematic;
|
import de.steamwar.sql.SchematicNode;
|
||||||
|
import de.steamwar.sql.SteamwarUser;
|
||||||
import org.bukkit.Bukkit;
|
import org.bukkit.Bukkit;
|
||||||
|
import org.bukkit.command.CommandSender;
|
||||||
import org.bukkit.entity.Player;
|
import org.bukkit.entity.Player;
|
||||||
|
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
@ -65,29 +67,27 @@ public class TestblockCommand extends SWCommand {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Register(description = "REGION_TB_HELP_SCHEMATIC")
|
@Register(description = "REGION_TB_HELP_SCHEMATIC")
|
||||||
public void schematicTestblockCommand(Player p, String s) {
|
public void schematicTestblockCommand(Player p, @Mapper("withPublic") SchematicNode node) {
|
||||||
schematicTestblockCommand(p, s, RegionExtensionType.NORMAL);
|
schematicTestblockCommand(p, node, RegionExtensionType.NORMAL);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Register
|
@Register
|
||||||
public void schematicTestblockCommand(Player p, RegionExtensionType regionExtensionType, String s) {
|
public void schematicTestblockCommand(Player p, RegionExtensionType regionExtensionType, @Mapper("withPublic") SchematicNode node) {
|
||||||
schematicTestblockCommand(p, s, regionExtensionType);
|
schematicTestblockCommand(p, node, regionExtensionType);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Register(description = "REGION_TB_HELP_SCHEMATIC_EXTENSION")
|
@Register(description = "REGION_TB_HELP_SCHEMATIC_EXTENSION")
|
||||||
public void schematicTestblockCommand(@Guard Player p, String s, RegionExtensionType regionExtensionType) {
|
public void schematicTestblockCommand(@Guard Player p, @Mapper("withPublic") SchematicNode node, RegionExtensionType regionExtensionType) {
|
||||||
Region region = regionCheck(p);
|
Region region = regionCheck(p);
|
||||||
if (region == null) return;
|
if (region == null) return;
|
||||||
Schematic schem = Schematic.getSchemFromDB(s, p.getUniqueId());
|
|
||||||
if (schem == null) {
|
if(node.isDir()) {
|
||||||
schem = Schematic.getSchemFromDB(s, 0);
|
BauSystem.MESSAGE.send("ONLY_SCHEMS", p);
|
||||||
if (schem == null) {
|
|
||||||
BauSystem.MESSAGE.send("REGION_TB_NO_SCHEM", p);
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
}
|
|
||||||
try {
|
try {
|
||||||
region.reset(schem, RegionType.TESTBLOCK, regionExtensionType);
|
region.reset(node, RegionType.TESTBLOCK, regionExtensionType);
|
||||||
RegionUtils.message(region, "REGION_TB_DONE");
|
RegionUtils.message(region, "REGION_TB_DONE");
|
||||||
} catch (IOException e) {
|
} catch (IOException e) {
|
||||||
BauSystem.MESSAGE.send("REGION_TB_ERROR", p);
|
BauSystem.MESSAGE.send("REGION_TB_ERROR", p);
|
||||||
@ -129,4 +129,25 @@ public class TestblockCommand extends SWCommand {
|
|||||||
}
|
}
|
||||||
return region;
|
return region;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Mapper("withPublic")
|
||||||
|
public TypeMapper<SchematicNode> nodeWithPublic() {
|
||||||
|
return new TypeMapper<SchematicNode>() {
|
||||||
|
@Override
|
||||||
|
public List<String> tabCompletes(CommandSender commandSender, String[] strings, String s) {
|
||||||
|
List<String> stringList = new ArrayList<>(SchematicNode.getNodeTabcomplete(SteamwarUser.get(((Player) commandSender).getUniqueId()), s));
|
||||||
|
stringList.addAll(SchematicNode.getNodeTabcomplete(SteamwarUser.get(0), s));
|
||||||
|
return stringList;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public SchematicNode map(CommandSender commandSender, String[] previousArguments, String s) {
|
||||||
|
SchematicNode node = SchematicNode.getNodeFromPath(SteamwarUser.get(((Player) commandSender).getUniqueId()), s);
|
||||||
|
if(node == null) {
|
||||||
|
node = SchematicNode.getNodeFromPath(SteamwarUser.get(0), s);
|
||||||
|
}
|
||||||
|
return node;
|
||||||
|
}
|
||||||
|
};
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
@ -21,24 +21,24 @@ package de.steamwar.bausystem.features.region.items;
|
|||||||
|
|
||||||
import de.steamwar.bausystem.BauSystem;
|
import de.steamwar.bausystem.BauSystem;
|
||||||
import de.steamwar.bausystem.Permission;
|
import de.steamwar.bausystem.Permission;
|
||||||
|
import de.steamwar.bausystem.features.region.ResetCommand;
|
||||||
import de.steamwar.bausystem.linkage.LinkageType;
|
import de.steamwar.bausystem.linkage.LinkageType;
|
||||||
import de.steamwar.bausystem.linkage.Linked;
|
import de.steamwar.bausystem.linkage.Linked;
|
||||||
|
import de.steamwar.bausystem.linkage.LinkedInstance;
|
||||||
import de.steamwar.bausystem.linkage.specific.BauGuiItem;
|
import de.steamwar.bausystem.linkage.specific.BauGuiItem;
|
||||||
import de.steamwar.inventory.SWItem;
|
import de.steamwar.inventory.SWItem;
|
||||||
import de.steamwar.inventory.SWListInv;
|
import de.steamwar.inventory.SchematicSelector;
|
||||||
import de.steamwar.sql.Schematic;
|
|
||||||
import org.bukkit.Material;
|
import org.bukkit.Material;
|
||||||
import org.bukkit.entity.Player;
|
import org.bukkit.entity.Player;
|
||||||
import org.bukkit.event.inventory.ClickType;
|
import org.bukkit.event.inventory.ClickType;
|
||||||
import org.bukkit.inventory.ItemStack;
|
import org.bukkit.inventory.ItemStack;
|
||||||
|
|
||||||
import java.util.ArrayList;
|
|
||||||
import java.util.Collections;
|
|
||||||
import java.util.List;
|
|
||||||
|
|
||||||
@Linked(LinkageType.BAU_GUI_ITEM)
|
@Linked(LinkageType.BAU_GUI_ITEM)
|
||||||
public class ResetBauGuiItem extends BauGuiItem {
|
public class ResetBauGuiItem extends BauGuiItem {
|
||||||
|
|
||||||
|
@LinkedInstance
|
||||||
|
private ResetCommand resetCommand;
|
||||||
|
|
||||||
public ResetBauGuiItem() {
|
public ResetBauGuiItem() {
|
||||||
super(6);
|
super(6);
|
||||||
}
|
}
|
||||||
@ -52,26 +52,13 @@ public class ResetBauGuiItem extends BauGuiItem {
|
|||||||
public boolean click(ClickType click, Player p) {
|
public boolean click(ClickType click, Player p) {
|
||||||
if (click == ClickType.LEFT) {
|
if (click == ClickType.LEFT) {
|
||||||
p.closeInventory();
|
p.closeInventory();
|
||||||
p.performCommand("reset");
|
resetCommand.genericResetCommand(p);
|
||||||
} else {
|
} else {
|
||||||
List<SWListInv.SWListEntry<Schematic>> schemList = new ArrayList<>();
|
SchematicSelector selector = new SchematicSelector(p, SchematicSelector.selectSchematic(), node -> {
|
||||||
for (Schematic schem : Schematic.getSchemsAccessibleByUser(p.getUniqueId())) {
|
|
||||||
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(), clickType -> {
|
|
||||||
});
|
|
||||||
schemList.add(new SWListInv.SWListEntry<>(item, schem));
|
|
||||||
}
|
|
||||||
SWListInv<Schematic> inv = new SWListInv<>(p, BauSystem.MESSAGE.parse("REGION_ITEM_RESET_TITLE", p), schemList, (clickType, schematic) -> {
|
|
||||||
p.closeInventory();
|
p.closeInventory();
|
||||||
p.performCommand("reset " + schematic.getSchemName());
|
resetCommand.schematicResetCommand(p, node);
|
||||||
});
|
});
|
||||||
p.closeInventory();
|
selector.open();
|
||||||
Chaoscaot markierte diese Unterhaltung als gelöst
|
|||||||
inv.open();
|
|
||||||
}
|
}
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
@ -21,24 +21,24 @@ package de.steamwar.bausystem.features.region.items;
|
|||||||
|
|
||||||
import de.steamwar.bausystem.BauSystem;
|
import de.steamwar.bausystem.BauSystem;
|
||||||
import de.steamwar.bausystem.Permission;
|
import de.steamwar.bausystem.Permission;
|
||||||
|
import de.steamwar.bausystem.features.region.TestblockCommand;
|
||||||
import de.steamwar.bausystem.linkage.LinkageType;
|
import de.steamwar.bausystem.linkage.LinkageType;
|
||||||
import de.steamwar.bausystem.linkage.Linked;
|
import de.steamwar.bausystem.linkage.Linked;
|
||||||
|
import de.steamwar.bausystem.linkage.LinkedInstance;
|
||||||
import de.steamwar.bausystem.linkage.specific.BauGuiItem;
|
import de.steamwar.bausystem.linkage.specific.BauGuiItem;
|
||||||
import de.steamwar.inventory.SWItem;
|
import de.steamwar.inventory.SWItem;
|
||||||
import de.steamwar.inventory.SWListInv;
|
import de.steamwar.inventory.SchematicSelector;
|
||||||
import de.steamwar.sql.Schematic;
|
|
||||||
import org.bukkit.Material;
|
import org.bukkit.Material;
|
||||||
import org.bukkit.entity.Player;
|
import org.bukkit.entity.Player;
|
||||||
import org.bukkit.event.inventory.ClickType;
|
import org.bukkit.event.inventory.ClickType;
|
||||||
import org.bukkit.inventory.ItemStack;
|
import org.bukkit.inventory.ItemStack;
|
||||||
|
|
||||||
import java.util.ArrayList;
|
|
||||||
import java.util.Collections;
|
|
||||||
import java.util.List;
|
|
||||||
|
|
||||||
@Linked(LinkageType.BAU_GUI_ITEM)
|
@Linked(LinkageType.BAU_GUI_ITEM)
|
||||||
public class TestblockBauGuiItem extends BauGuiItem {
|
public class TestblockBauGuiItem extends BauGuiItem {
|
||||||
|
|
||||||
|
@LinkedInstance
|
||||||
|
private TestblockCommand testblockCommand;
|
||||||
|
|
||||||
public TestblockBauGuiItem() {
|
public TestblockBauGuiItem() {
|
||||||
super(5);
|
super(5);
|
||||||
}
|
}
|
||||||
@ -52,26 +52,13 @@ public class TestblockBauGuiItem extends BauGuiItem {
|
|||||||
public boolean click(ClickType click, Player p) {
|
public boolean click(ClickType click, Player p) {
|
||||||
if (click == ClickType.LEFT) {
|
if (click == ClickType.LEFT) {
|
||||||
p.closeInventory();
|
p.closeInventory();
|
||||||
p.performCommand("testblock");
|
testblockCommand.genericTestblockCommand(p);
|
||||||
Chaoscaot markierte diese Unterhaltung als gelöst
Veraltet
Lixfel
hat
Auch hier Auch hier
|
|||||||
} else {
|
} else {
|
||||||
|
SchematicSelector selector = new SchematicSelector(p, SchematicSelector.selectSchematic(), node -> {
|
||||||
p.closeInventory();
|
p.closeInventory();
|
||||||
List<SWListInv.SWListEntry<Schematic>> schemList = new ArrayList<>();
|
testblockCommand.schematicTestblockCommand(p, node);
|
||||||
for (Schematic schem : Schematic.getSchemsAccessibleByUser(p.getUniqueId())) {
|
|
||||||
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(), clickType -> {
|
|
||||||
});
|
});
|
||||||
schemList.add(new SWListInv.SWListEntry<>(item, schem));
|
selector.open();
|
||||||
}
|
|
||||||
SWListInv<Schematic> inv = new SWListInv<>(p, BauSystem.MESSAGE.parse("REGION_ITEM_TESTBLOCK_TITLE", p), schemList, (clickType, schematic) -> {
|
|
||||||
p.closeInventory();
|
|
||||||
p.performCommand("testblock " + schematic.getSchemName());
|
|
||||||
});
|
|
||||||
inv.open();
|
|
||||||
}
|
}
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
@ -68,20 +68,25 @@ public class LockSchemCommand extends SWCommand {
|
|||||||
BauSystem.MESSAGE.send("LOCK_SCHEM_NO_USER", p);
|
BauSystem.MESSAGE.send("LOCK_SCHEM_NO_USER", p);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
Schematic schematic = Schematic.getSchemFromDB(schematicName, schemOwner.getUUID());
|
SchematicNode schematic = SchematicNode.getNodeFromPath(schemOwner, schematicName);
|
||||||
if (schematic == null) {
|
if (schematic == null) {
|
||||||
BauSystem.MESSAGE.send("LOCK_SCHEM_NO_SCHEM", p);
|
BauSystem.MESSAGE.send("LOCK_SCHEM_NO_SCHEM", p);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if(schematic.isDir()) {
|
||||||
|
BauSystem.MESSAGE.send("LOCK_SCHEM_DIR", p);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
StringBuilder builder = new StringBuilder();
|
StringBuilder builder = new StringBuilder();
|
||||||
for (String s : reason) {
|
for (String s : reason) {
|
||||||
builder.append(s).append(" ");
|
builder.append(s).append(" ");
|
||||||
}
|
}
|
||||||
|
|
||||||
BauSystem.MESSAGE.send("LOCK_SCHEM_LOCKED", p, schematic.getSchemName(), schemOwner.getUserName(), schematic.getSchemType().name(), builder.toString());
|
BauSystem.MESSAGE.send("LOCK_SCHEM_LOCKED", p, schematic.getName(), schemOwner.getUserName(), schematic.getSchemtype().name(), builder.toString());
|
||||||
schematic.setSchemType(SchematicType.Normal);
|
schematic.setSchemtype(SchematicType.Normal);
|
||||||
new CheckedSchematic(schematic.getSchemName(), schematic.getSchemOwner(), steamwarUser.getId(), Timestamp.from(Instant.now()), Timestamp.from(Instant.now()), builder.toString());
|
new CheckedSchematic(schematic.getName(), schematic.getOwner(), steamwarUser.getId(), Timestamp.from(Instant.now()), Timestamp.from(Instant.now()), builder.toString());
|
||||||
}
|
}
|
||||||
|
|
||||||
private void sendHelp(Player player) {
|
private void sendHelp(Player player) {
|
||||||
|
@ -21,15 +21,13 @@ package de.steamwar.bausystem.features.world;
|
|||||||
|
|
||||||
import de.steamwar.bausystem.linkage.LinkageType;
|
import de.steamwar.bausystem.linkage.LinkageType;
|
||||||
import de.steamwar.bausystem.linkage.Linked;
|
import de.steamwar.bausystem.linkage.Linked;
|
||||||
import de.steamwar.sql.Schematic;
|
import de.steamwar.sql.SchematicNode;
|
||||||
import de.steamwar.sql.SchematicType;
|
import de.steamwar.sql.SteamwarUser;
|
||||||
import org.bukkit.event.EventHandler;
|
import org.bukkit.event.EventHandler;
|
||||||
import org.bukkit.event.Listener;
|
import org.bukkit.event.Listener;
|
||||||
import org.bukkit.event.player.PlayerJoinEvent;
|
import org.bukkit.event.player.PlayerJoinEvent;
|
||||||
import org.bukkit.event.player.PlayerQuitEvent;
|
import org.bukkit.event.player.PlayerQuitEvent;
|
||||||
|
|
||||||
import java.util.UUID;
|
|
||||||
|
|
||||||
@Linked(LinkageType.LISTENER)
|
@Linked(LinkageType.LISTENER)
|
||||||
public class ClipboardListener implements Listener {
|
public class ClipboardListener implements Listener {
|
||||||
|
|
||||||
@ -38,7 +36,7 @@ public class ClipboardListener implements Listener {
|
|||||||
@EventHandler
|
@EventHandler
|
||||||
public void onLogin(PlayerJoinEvent e) {
|
public void onLogin(PlayerJoinEvent e) {
|
||||||
try {
|
try {
|
||||||
Schematic schematic = Schematic.getSchemFromDB(CLIPBOARD_SCHEMNAME, e.getPlayer().getUniqueId());
|
SchematicNode schematic = SchematicNode.getSchematicNode(SteamwarUser.get(e.getPlayer().getUniqueId()).getId(), CLIPBOARD_SCHEMNAME, 0);
|
||||||
if (schematic != null) {
|
if (schematic != null) {
|
||||||
schematic.loadToPlayer(e.getPlayer());
|
schematic.loadToPlayer(e.getPlayer());
|
||||||
}
|
}
|
||||||
@ -49,12 +47,10 @@ public class ClipboardListener implements Listener {
|
|||||||
|
|
||||||
@EventHandler
|
@EventHandler
|
||||||
public void onLogout(PlayerQuitEvent e) {
|
public void onLogout(PlayerQuitEvent e) {
|
||||||
UUID playerUUID = e.getPlayer().getUniqueId();
|
SchematicNode schematic = SchematicNode.getSchematicNode(SteamwarUser.get(e.getPlayer().getUniqueId()).getId(), CLIPBOARD_SCHEMNAME, 0);
|
||||||
Schematic schematic = Schematic.getSchemFromDB(CLIPBOARD_SCHEMNAME, playerUUID);
|
|
||||||
boolean newSchem = false;
|
boolean newSchem = false;
|
||||||
if (schematic == null) {
|
if (schematic == null) {
|
||||||
Schematic.createSchem(CLIPBOARD_SCHEMNAME, playerUUID, "", SchematicType.Normal);
|
schematic = SchematicNode.createSchematic(SteamwarUser.get(e.getPlayer().getUniqueId()).getId(), CLIPBOARD_SCHEMNAME, 0);
|
||||||
schematic = Schematic.getSchemFromDB(CLIPBOARD_SCHEMNAME, playerUUID);
|
|
||||||
newSchem = true;
|
newSchem = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -62,7 +58,7 @@ public class ClipboardListener implements Listener {
|
|||||||
schematic.saveFromPlayer(e.getPlayer());
|
schematic.saveFromPlayer(e.getPlayer());
|
||||||
} catch (Exception ex) {
|
} catch (Exception ex) {
|
||||||
if (newSchem) {
|
if (newSchem) {
|
||||||
schematic.remove();
|
schematic.delete();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -29,7 +29,7 @@ import de.steamwar.bausystem.region.utils.RegionExtensionType;
|
|||||||
import de.steamwar.bausystem.region.utils.RegionType;
|
import de.steamwar.bausystem.region.utils.RegionType;
|
||||||
import de.steamwar.bausystem.shared.SizedStack;
|
import de.steamwar.bausystem.shared.SizedStack;
|
||||||
import de.steamwar.core.VersionedCallable;
|
import de.steamwar.core.VersionedCallable;
|
||||||
import de.steamwar.sql.Schematic;
|
import de.steamwar.sql.SchematicNode;
|
||||||
import lombok.AccessLevel;
|
import lombok.AccessLevel;
|
||||||
import lombok.Getter;
|
import lombok.Getter;
|
||||||
import lombok.NonNull;
|
import lombok.NonNull;
|
||||||
@ -382,7 +382,7 @@ public class Region {
|
|||||||
reset(null, regionType);
|
reset(null, regionType);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void reset(Schematic schematic, RegionType regionType) throws IOException {
|
public void reset(SchematicNode schematic, RegionType regionType) throws IOException {
|
||||||
reset(schematic, regionType, RegionExtensionType.NORMAL, false);
|
reset(schematic, regionType, RegionExtensionType.NORMAL, false);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -390,7 +390,7 @@ public class Region {
|
|||||||
reset(null, regionType, regionExtensionType, false);
|
reset(null, regionType, regionExtensionType, false);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void reset(Schematic schematic, RegionType regionType, RegionExtensionType regionExtensionType) throws IOException {
|
public void reset(SchematicNode schematic, RegionType regionType, RegionExtensionType regionExtensionType) throws IOException {
|
||||||
reset(schematic, regionType, regionExtensionType, false);
|
reset(schematic, regionType, regionExtensionType, false);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -400,11 +400,11 @@ public class Region {
|
|||||||
undoSessions.push(editSession);
|
undoSessions.push(editSession);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void reset(Schematic schematic, RegionType regionType, RegionExtensionType regionExtensionType, boolean ignoreAir) throws IOException {
|
public void reset(SchematicNode schematic, RegionType regionType, RegionExtensionType regionExtensionType, boolean ignoreAir) throws IOException {
|
||||||
reset(schematic, regionType, regionExtensionType, ignoreAir, false);
|
reset(schematic, regionType, regionExtensionType, ignoreAir, false);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void reset(Schematic schematic, RegionType regionType, RegionExtensionType regionExtensionType, boolean ignoreAir, boolean onlyColors) throws IOException {
|
public void reset(SchematicNode schematic, RegionType regionType, RegionExtensionType regionExtensionType, boolean ignoreAir, boolean onlyColors) throws IOException {
|
||||||
if (!hasReset(regionType)) {
|
if (!hasReset(regionType)) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@ -412,7 +412,7 @@ public class Region {
|
|||||||
regionExtensionType = RegionExtensionType.NORMAL;
|
regionExtensionType = RegionExtensionType.NORMAL;
|
||||||
}
|
}
|
||||||
|
|
||||||
PasteOptions pasteOptions = new PasteOptions((schematic != null && (schematic.getSchemType().fightType() || schematic.getSchemType().check())), ignoreAir, getPlain(Flag.COLOR, ColorMode.class).getColor(), onlyColors, regionExtensionType == RegionExtensionType.EXTENSION, getMinPoint(regionType, regionExtensionType), getMaxPoint(regionType, regionExtensionType), waterLevel);
|
PasteOptions pasteOptions = new PasteOptions((schematic != null && (schematic.getSchemtype().fightType() || schematic.getSchemtype().check())), ignoreAir, getPlain(Flag.COLOR, ColorMode.class).getColor(), onlyColors, regionExtensionType == RegionExtensionType.EXTENSION, getMinPoint(regionType, regionExtensionType), getMaxPoint(regionType, regionExtensionType), waterLevel);
|
||||||
|
|
||||||
Point pastePoint;
|
Point pastePoint;
|
||||||
File tempFile = null;
|
File tempFile = null;
|
||||||
|
In neuem Issue referenzieren
Einen Benutzer sperren
Das ist eine extrem unsaubere Lösung. Bitte nach Möglichkeit direkt die richtige Funktion aufrufen, anstatt hier einen neuen Command zu spawnen.