13
0

Merge branch 'OldVersionSupport' of SteamWar/SchematicSystem into master

Dieser Commit ist enthalten in:
Lixfel 2019-12-22 17:25:03 +01:00 committet von Gitea
Commit c099d799e1
24 geänderte Dateien mit 606 neuen und 164 gelöschten Zeilen

61
SchematicSystem_10/pom.xml Normale Datei
Datei anzeigen

@ -0,0 +1,61 @@
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<parent>
<groupId>steamwar</groupId>
<artifactId>SchematicSystem</artifactId>
<version>1.0</version>
</parent>
<artifactId>SchematicSystem_10</artifactId>
<version>1.0</version>
<build>
<sourceDirectory>src</sourceDirectory>
<resources>
<resource>
<directory>src</directory>
<excludes>
<exclude>**/*.java</exclude>
<exclude>**/*.kt</exclude>
</excludes>
</resource>
</resources>
</build>
<dependencies>
<dependency>
<groupId>steamwar</groupId>
<artifactId>Spigot</artifactId>
<version>1.10</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>steamwar</groupId>
<artifactId>WorldEdit</artifactId>
<version>1.0</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>steamwar</groupId>
<artifactId>FAWE</artifactId>
<version>1.0</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>steamwar</groupId>
<artifactId>SchematicSystem_9</artifactId>
<version>1.0</version>
<scope>compile</scope>
</dependency>
<dependency>
<groupId>steamwar</groupId>
<artifactId>SchematicSystem_API</artifactId>
<version>1.0</version>
<scope>compile</scope>
</dependency>
</dependencies>
</project>

Datei anzeigen

@ -0,0 +1,11 @@
package de.steamwar.schematicsystem;
import java.util.List;
class CheckSchemType_10 {
private CheckSchemType_10(){}
static void autoCheck(List<String> errors) {
errors.add("In der 1.10 können keine Schematics eingesendet werden");
}
}

Datei anzeigen

@ -0,0 +1,16 @@
package de.steamwar.schematicsystem;
import com.sk89q.worldedit.EditSession;
import de.steamwar.sql.NoClipboardException;
import de.steamwar.sql.Schematic;
import org.bukkit.entity.Player;
import java.io.IOException;
class WorldEdit_10 {
private WorldEdit_10(){}
static EditSession pasteSchematic(Player player, Schematic schematic) throws Schematic.WrongVersionException, NoClipboardException, IOException {
return WorldEdit_8.pasteSchematic(player, schematic);
}
}

Datei anzeigen

@ -45,6 +45,12 @@
<version>1.0</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>steamwar</groupId>
<artifactId>SchematicSystem_10</artifactId>
<version>1.0</version>
<scope>compile</scope>
</dependency>
<dependency>
<groupId>steamwar</groupId>
<artifactId>SchematicSystem_API</artifactId>

Datei anzeigen

@ -143,16 +143,16 @@ class CheckSchemType_12 {
continue;
}
Material t = Material.getMaterial(item.getString("id").split(":")[1].toUpperCase().replace("SHOVEL", "SPADE"));
if(t == null && item.getString("id").equals("minecraft:fire_charge"))
t = Material.FIREBALL;
if(t == null) //Leere Slots
Material itemType = Material.getMaterial(item.getString("id").split(":")[1].toUpperCase().replace("SHOVEL", "SPADE"));
if(itemType == null && item.getString("id").equals("minecraft:fire_charge"))
itemType = Material.FIREBALL;
if(itemType == null) //Leere Slots
continue;
if(blockId == DISPENSER && (t.equals(Material.FIREBALL) || t.equals(Material.ARROW)))
if(blockId == DISPENSER && (itemType.equals(Material.FIREBALL) || itemType.equals(Material.ARROW)))
counter += item.getByte("Count");
else if(!FLOWERS.contains(t) && !(blockId == CHEST && t.equals(Material.TNT)))
errors.add("In einem/r " + Material.getMaterial(blockId).name() + " ist das verbotene Item " + t);
else if(!FLOWERS.contains(itemType) && !(blockId == CHEST && itemType.equals(Material.TNT)))
errors.add("In einem/r " + Material.getMaterial(blockId).name() + " ist das verbotene Item " + itemType);
}
if(counter > type.getMaxDispenserItems())

Datei anzeigen

@ -1,16 +1,8 @@
package de.steamwar.schematicsystem;
import com.sk89q.worldedit.EditSession;
import com.sk89q.worldedit.Vector;
import com.sk89q.worldedit.WorldEdit;
import com.sk89q.worldedit.bukkit.BukkitWorld;
import com.sk89q.worldedit.extent.clipboard.Clipboard;
import com.sk89q.worldedit.function.operation.Operations;
import com.sk89q.worldedit.session.ClipboardHolder;
import com.sk89q.worldedit.world.World;
import de.steamwar.sql.NoClipboardException;
import de.steamwar.sql.Schematic;
import org.bukkit.Location;
import org.bukkit.entity.Player;
import java.io.IOException;
@ -19,16 +11,6 @@ class WorldEdit_12 {
private WorldEdit_12(){}
static EditSession pasteSchematic(Player player, Schematic schematic) throws Schematic.WrongVersionException, NoClipboardException, IOException {
World weWorld = new BukkitWorld(player.getWorld());
Location playerLocation = player.getLocation();
Vector vector = new Vector(playerLocation.getBlockX(), playerLocation.getBlockY(), playerLocation.getBlockZ());
Clipboard clipboard = schematic.load();
Vector offset = new Vector(clipboard.getRegion().getMinimumPoint()).subtract(clipboard.getOrigin());
Vector dimensions = clipboard.getDimensions();
Vector v = vector.subtract(dimensions.getX()/2 - dimensions.getX()%2, 0, dimensions.getZ()).subtract(offset);
EditSession e = WorldEdit.getInstance().getEditSessionFactory().getEditSession(weWorld, -1);
Operations.completeBlindly(new ClipboardHolder(clipboard, weWorld.getWorldData()).createPaste(e, weWorld.getWorldData()).to(v).build());
e.flushQueue();
return e;
return WorldEdit_8.pasteSchematic(player, schematic);
}
}

Datei anzeigen

@ -4,15 +4,15 @@
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<artifactId>SchematicSystem_14</artifactId>
<version>1.0</version>
<parent>
<groupId>steamwar</groupId>
<artifactId>SchematicSystem</artifactId>
<version>1.0</version>
</parent>
<artifactId>SchematicSystem_14</artifactId>
<version>1.0</version>
<build>
<sourceDirectory>src</sourceDirectory>
<resources>

Datei anzeigen

@ -1,143 +1,11 @@
package de.steamwar.schematicsystem;
import com.sk89q.jnbt.CompoundTag;
import com.sk89q.worldedit.extent.clipboard.Clipboard;
import com.sk89q.worldedit.math.BlockVector3;
import com.sk89q.worldedit.regions.Region;
import com.sk89q.worldedit.world.block.BaseBlock;
import de.steamwar.sql.NoClipboardException;
import de.steamwar.sql.Schematic;
import org.bukkit.Bukkit;
import org.bukkit.Material;
import java.io.IOException;
import java.util.EnumSet;
import java.util.List;
import java.util.Set;
import java.util.logging.Level;
class CheckSchemType_14 {
private static final Set<Material> INVENTORY = EnumSet.of(
Material.CHEST,
Material.TRAPPED_CHEST,
Material.HOPPER,
Material.FURNACE,
Material.DROPPER,
Material.JUKEBOX,
Material.DISPENSER,
Material.ANVIL,
Material.BREWING_STAND,
Material.BLACK_SHULKER_BOX,
Material.RED_SHULKER_BOX,
Material.WHITE_SHULKER_BOX,
Material.ORANGE_SHULKER_BOX,
Material.BLUE_SHULKER_BOX,
Material.LIGHT_BLUE_SHULKER_BOX,
Material.YELLOW_SHULKER_BOX,
Material.GREEN_SHULKER_BOX,
Material.BROWN_SHULKER_BOX,
Material.CYAN_SHULKER_BOX,
Material.GRAY_SHULKER_BOX,
Material.LIGHT_GRAY_SHULKER_BOX,
Material.LIME_SHULKER_BOX,
Material.MAGENTA_SHULKER_BOX,
Material.PINK_SHULKER_BOX,
Material.PURPLE_SHULKER_BOX);
//TODO: New Inventory Items
//TODO: Adding flowers
private static final Set<Material> FLOWERS = EnumSet.of(
Material.CORNFLOWER);
private CheckSchemType_14(){}
static void autoCheck(Schematic schematic, List<String> errors, List<String> warnings, ICheckSchemType type) {
Clipboard clipboard;
try {
clipboard = schematic.load();
} catch (Schematic.WrongVersionException e) {
errors.add("Der Schematictyp dieser Schematic kann nicht in dieser Version geändert werden.");
return;
} catch (IOException | NoClipboardException e) {
Bukkit.getLogger().log(Level.SEVERE, "Schematic could not be loaded", e);
errors.add("Die Schematic konnte nicht geladen werden");
return;
}
BlockVector3 dimensions = clipboard.getDimensions();
if(dimensions.getBlockX() > type.getWidth() || dimensions.getBlockY() > type.getHeight() || dimensions.getBlockZ() > type.getDepth())
errors.add("Das " + type.getName() + " überschreitet die Maximalmaße");
Region region = clipboard.getRegion();
BlockVector3 min = region.getMinimumPoint();
BlockVector3 max = region.getMaximumPoint();
int tnt = 0;
int slime = 0;
int dispenser = 0;
for(int x = min.getBlockX(); x <= max.getBlockX(); x++){
for(int y = min.getBlockY(); y <= max.getBlockY(); y++){
for(int z = min.getBlockZ(); z <= max.getBlockZ(); z++){
final BaseBlock block = clipboard.getFullBlock(BlockVector3.at(x, y, z));
final Material blockMaterial = Material.matchMaterial(block.getBlockType().getId());
if(blockMaterial == Material.TNT || blockMaterial == Material.OBSIDIAN)
tnt++;
if(blockMaterial == Material.SLIME_BLOCK || blockMaterial == Material.BEDROCK)
slime++;
if(blockMaterial == Material.DISPENSER)
dispenser++;
if(INVENTORY.contains(blockMaterial)){
checkInventory(errors, warnings, block, blockMaterial, type);
}
if(type.getForbidden().contains(blockMaterial.name()))
errors.add("Der Block " + blockMaterial.name() + " ist verboten");
}
}
}
type.finalChecks(errors, tnt, slime, dispenser);
}
private static void checkInventory(List<String> errors, List<String> warnings, BaseBlock block, Material blockMaterial, ICheckSchemType type){
CompoundTag nbt = block.getNbtData();
if(nbt == null){
warnings.add("Ein(e) " + blockMaterial.name() + " ist defekt");
return;
}
if(blockMaterial == Material.JUKEBOX && nbt.getValue().containsKey("RecordItem")){
errors.add("Schallplatten sind auch nicht in Schallplattenspielern gestattet");
return;
}
List<CompoundTag> items = nbt.getList("Items", CompoundTag.class);
if(items.isEmpty())
return; //Leeres Inventar
int counter = 0;
for(CompoundTag item : items){
if(!item.containsKey("id")){
warnings.add("Ein(e) " + blockMaterial.name() + " ist defekt");
continue;
}
Material t = Material.matchMaterial(item.getString("id"));
if(t == null) //Leere Slots
continue;
if(blockMaterial == Material.DISPENSER && (t.equals(Material.FIRE_CHARGE) || t.equals(Material.ARROW)))
counter += item.getByte("Count");
else if(!FLOWERS.contains(t) && !(blockMaterial == Material.CHEST && t.equals(Material.TNT)))
errors.add("In einem/r " + blockMaterial.name() + " ist das verbotene Item " + t);
}
if(counter > type.getMaxDispenserItems())
errors.add("Ein Werfer enthält mehr als " + type.getMaxDispenserItems() + " Pfeile und Feuerbälle");
static void autoCheck(List<String> errors) {
errors.add("In der 1.14 können keine Schematics eingesendet werden");
}
}

53
SchematicSystem_15/pom.xml Normale Datei
Datei anzeigen

@ -0,0 +1,53 @@
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<artifactId>SchematicSystem_15</artifactId>
<version>1.0</version>
<parent>
<groupId>steamwar</groupId>
<artifactId>SchematicSystem</artifactId>
<version>1.0</version>
</parent>
<build>
<sourceDirectory>src</sourceDirectory>
<resources>
<resource>
<directory>src</directory>
<excludes>
<exclude>**/*.java</exclude>
<exclude>**/*.kt</exclude>
</excludes>
</resource>
</resources>
</build>
<dependencies>
<dependency>
<groupId>steamwar</groupId>
<artifactId>SchematicSystem_API</artifactId>
<version>1.0</version>
</dependency>
<dependency>
<groupId>steamwar</groupId>
<artifactId>SchematicSystem_14</artifactId>
<version>1.0</version>
</dependency>
<dependency>
<groupId>steamwar</groupId>
<artifactId>Spigot</artifactId>
<version>1.15</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>steamwar</groupId>
<artifactId>FAWE</artifactId>
<version>1.14</version>
<scope>provided</scope>
</dependency>
</dependencies>
</project>

Datei anzeigen

@ -0,0 +1,161 @@
package de.steamwar.schematicsystem;
import com.sk89q.jnbt.CompoundTag;
import com.sk89q.worldedit.extent.clipboard.Clipboard;
import com.sk89q.worldedit.math.BlockVector3;
import com.sk89q.worldedit.regions.Region;
import com.sk89q.worldedit.world.block.BaseBlock;
import de.steamwar.sql.NoClipboardException;
import de.steamwar.sql.Schematic;
import org.bukkit.Bukkit;
import org.bukkit.Material;
import java.io.IOException;
import java.util.EnumSet;
import java.util.List;
import java.util.Set;
import java.util.logging.Level;
class CheckSchemType_15 {
private static final Set<Material> INVENTORY = EnumSet.of(
Material.CHEST,
Material.TRAPPED_CHEST,
Material.HOPPER,
Material.FURNACE,
Material.DROPPER,
Material.JUKEBOX,
Material.DISPENSER,
Material.ANVIL,
Material.BREWING_STAND,
Material.BLACK_SHULKER_BOX,
Material.RED_SHULKER_BOX,
Material.WHITE_SHULKER_BOX,
Material.ORANGE_SHULKER_BOX,
Material.BLUE_SHULKER_BOX,
Material.LIGHT_BLUE_SHULKER_BOX,
Material.YELLOW_SHULKER_BOX,
Material.GREEN_SHULKER_BOX,
Material.BROWN_SHULKER_BOX,
Material.CYAN_SHULKER_BOX,
Material.GRAY_SHULKER_BOX,
Material.LIGHT_GRAY_SHULKER_BOX,
Material.LIME_SHULKER_BOX,
Material.MAGENTA_SHULKER_BOX,
Material.PINK_SHULKER_BOX,
Material.PURPLE_SHULKER_BOX,
Material.LECTERN,
Material.BEACON,
Material.BARREL);
private static final Set<Material> FLOWERS = EnumSet.of(
Material.CORNFLOWER,
Material.FERN,
Material.DANDELION,
Material.POPPY,
Material.BLUE_ORCHID,
Material.ALLIUM,
Material.AZURE_BLUET,
Material.RED_TULIP,
Material.ORANGE_TULIP,
Material.WHITE_TULIP,
Material.PINK_TULIP,
Material.OXEYE_DAISY,
Material.CORNFLOWER,
Material.LILY_OF_THE_VALLEY,
Material.WITHER_ROSE,
Material.BROWN_MUSHROOM,
Material.RED_MUSHROOM);
private CheckSchemType_15(){}
static void autoCheck(Schematic schematic, List<String> errors, List<String> warnings, ICheckSchemType type) {
Clipboard clipboard;
try {
clipboard = schematic.load();
} catch (Schematic.WrongVersionException e) {
errors.add("Der Schematictyp dieser Schematic kann nicht in dieser Version geändert werden.");
return;
} catch (IOException | NoClipboardException e) {
Bukkit.getLogger().log(Level.SEVERE, "Schematic could not be loaded", e);
errors.add("Die Schematic konnte nicht geladen werden");
return;
}
BlockVector3 dimensions = clipboard.getDimensions();
if(dimensions.getBlockX() > type.getWidth() || dimensions.getBlockY() > type.getHeight() || dimensions.getBlockZ() > type.getDepth())
errors.add("Das " + type.getName() + " überschreitet die Maximalmaße");
Region region = clipboard.getRegion();
BlockVector3 min = region.getMinimumPoint();
BlockVector3 max = region.getMaximumPoint();
int tnt = 0;
int slime = 0;
int dispenser = 0;
for(int x = min.getBlockX(); x <= max.getBlockX(); x++){
for(int y = min.getBlockY(); y <= max.getBlockY(); y++){
for(int z = min.getBlockZ(); z <= max.getBlockZ(); z++){
final BaseBlock block = clipboard.getFullBlock(BlockVector3.at(x, y, z));
final Material blockMaterial = Material.matchMaterial(block.getBlockType().getId());
if(blockMaterial == Material.TNT || blockMaterial == Material.OBSIDIAN)
tnt++;
if(blockMaterial == Material.SLIME_BLOCK || blockMaterial == Material.BEDROCK)
slime++;
if(blockMaterial == Material.DISPENSER)
dispenser++;
if(INVENTORY.contains(blockMaterial)){
checkInventory(errors, warnings, block, blockMaterial, type);
}
if(type.getForbidden().contains(blockMaterial.name()))
errors.add("Der Block " + blockMaterial.name() + " ist verboten");
}
}
}
type.finalChecks(errors, tnt, slime, dispenser);
}
private static void checkInventory(List<String> errors, List<String> warnings, BaseBlock block, Material blockMaterial, ICheckSchemType type){
CompoundTag nbt = block.getNbtData();
if(nbt == null){
warnings.add("Ein(e) " + blockMaterial.name() + " ist defekt");
return;
}
if(blockMaterial == Material.JUKEBOX && nbt.getValue().containsKey("RecordItem")){
errors.add("Schallplatten sind auch nicht in Schallplattenspielern gestattet");
return;
}
List<CompoundTag> items = nbt.getList("Items", CompoundTag.class);
if(items.isEmpty())
return; //Leeres Inventar
int counter = 0;
for(CompoundTag item : items){
if(!item.containsKey("id")){
warnings.add("Ein(e) " + blockMaterial.name() + " ist defekt");
continue;
}
Material itemType = Material.matchMaterial(item.getString("id"));
if(itemType == null) //Leere Slots
continue;
if(blockMaterial == Material.DISPENSER && (itemType.equals(Material.FIRE_CHARGE) || itemType.equals(Material.ARROW)))
counter += item.getByte("Count");
else if(!FLOWERS.contains(itemType) && !(blockMaterial == Material.CHEST && itemType.equals(Material.TNT)))
errors.add("In einem/r " + blockMaterial.name() + " ist das verbotene Item " + itemType);
}
if(counter > type.getMaxDispenserItems())
errors.add("Ein Werfer enthält mehr als " + type.getMaxDispenserItems() + " Pfeile und Feuerbälle");
}
}

Datei anzeigen

@ -0,0 +1,16 @@
package de.steamwar.schematicsystem;
import com.sk89q.worldedit.EditSession;
import de.steamwar.sql.NoClipboardException;
import de.steamwar.sql.Schematic;
import org.bukkit.entity.Player;
import java.io.IOException;
class WorldEdit_15 {
private WorldEdit_15(){}
static EditSession pasteSchematic(Player player, Schematic schematic) throws Schematic.WrongVersionException, IOException, NoClipboardException {
return WorldEdit_14.pasteSchematic(player, schematic);
}
}

49
SchematicSystem_8/pom.xml Normale Datei
Datei anzeigen

@ -0,0 +1,49 @@
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<parent>
<groupId>steamwar</groupId>
<artifactId>SchematicSystem</artifactId>
<version>1.0</version>
</parent>
<artifactId>SchematicSystem_8</artifactId>
<version>1.0</version>
<build>
<sourceDirectory>src</sourceDirectory>
<resources>
<resource>
<directory>src</directory>
<excludes>
<exclude>**/*.java</exclude>
<exclude>**/*.kt</exclude>
</excludes>
</resource>
</resources>
</build>
<dependencies>
<dependency>
<groupId>steamwar</groupId>
<artifactId>Spigot</artifactId>
<version>1.8</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>steamwar</groupId>
<artifactId>WorldEdit</artifactId>
<version>1.0</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>steamwar</groupId>
<artifactId>SchematicSystem_API</artifactId>
<version>1.0</version>
<scope>compile</scope>
</dependency>
</dependencies>
</project>

Datei anzeigen

@ -0,0 +1,11 @@
package de.steamwar.schematicsystem;
import java.util.List;
class CheckSchemType_8 {
private CheckSchemType_8(){}
static void autoCheck(List<String> errors) {
errors.add("In der 1.8 können keine Schematics eingesendet werden");
}
}

Datei anzeigen

@ -0,0 +1,34 @@
package de.steamwar.schematicsystem;
import com.sk89q.worldedit.EditSession;
import com.sk89q.worldedit.Vector;
import com.sk89q.worldedit.WorldEdit;
import com.sk89q.worldedit.bukkit.BukkitWorld;
import com.sk89q.worldedit.extent.clipboard.Clipboard;
import com.sk89q.worldedit.function.operation.Operations;
import com.sk89q.worldedit.session.ClipboardHolder;
import com.sk89q.worldedit.world.World;
import de.steamwar.sql.NoClipboardException;
import de.steamwar.sql.Schematic;
import org.bukkit.Location;
import org.bukkit.entity.Player;
import java.io.IOException;
class WorldEdit_8 {
private WorldEdit_8(){}
static EditSession pasteSchematic(Player player, Schematic schematic) throws Schematic.WrongVersionException, NoClipboardException, IOException {
World weWorld = new BukkitWorld(player.getWorld());
Location playerLocation = player.getLocation();
Vector vector = new Vector(playerLocation.getBlockX(), playerLocation.getBlockY(), playerLocation.getBlockZ());
Clipboard clipboard = schematic.load();
Vector offset = new Vector(clipboard.getRegion().getMinimumPoint()).subtract(clipboard.getOrigin());
Vector dimensions = clipboard.getDimensions();
Vector v = vector.subtract(dimensions.getX()/2 - dimensions.getX()%2, 0, dimensions.getZ()).subtract(offset);
EditSession e = WorldEdit.getInstance().getEditSessionFactory().getEditSession(weWorld, -1);
Operations.completeBlindly(new ClipboardHolder(clipboard, weWorld.getWorldData()).createPaste(e, weWorld.getWorldData()).to(v).build());
e.flushQueue();
return e;
}
}

61
SchematicSystem_9/pom.xml Normale Datei
Datei anzeigen

@ -0,0 +1,61 @@
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<parent>
<groupId>steamwar</groupId>
<artifactId>SchematicSystem</artifactId>
<version>1.0</version>
</parent>
<artifactId>SchematicSystem_9</artifactId>
<version>1.0</version>
<build>
<sourceDirectory>src</sourceDirectory>
<resources>
<resource>
<directory>src</directory>
<excludes>
<exclude>**/*.java</exclude>
<exclude>**/*.kt</exclude>
</excludes>
</resource>
</resources>
</build>
<dependencies>
<dependency>
<groupId>steamwar</groupId>
<artifactId>Spigot</artifactId>
<version>1.9</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>steamwar</groupId>
<artifactId>WorldEdit</artifactId>
<version>1.0</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>steamwar</groupId>
<artifactId>FAWE</artifactId>
<version>1.0</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>steamwar</groupId>
<artifactId>SchematicSystem_8</artifactId>
<version>1.0</version>
<scope>compile</scope>
</dependency>
<dependency>
<groupId>steamwar</groupId>
<artifactId>SchematicSystem_API</artifactId>
<version>1.0</version>
<scope>compile</scope>
</dependency>
</dependencies>
</project>

Datei anzeigen

@ -0,0 +1,11 @@
package de.steamwar.schematicsystem;
import java.util.List;
class CheckSchemType_9 {
private CheckSchemType_9(){}
static void autoCheck(List<String> errors) {
errors.add("In der 1.9 können keine Schematics eingesendet werden");
}
}

Datei anzeigen

@ -0,0 +1,16 @@
package de.steamwar.schematicsystem;
import com.sk89q.worldedit.EditSession;
import de.steamwar.sql.NoClipboardException;
import de.steamwar.sql.Schematic;
import org.bukkit.entity.Player;
import java.io.IOException;
class WorldEdit_9 {
private WorldEdit_9(){}
static EditSession pasteSchematic(Player player, Schematic schematic) throws Schematic.WrongVersionException, NoClipboardException, IOException {
return WorldEdit_8.pasteSchematic(player, schematic);
}
}

Datei anzeigen

@ -62,6 +62,12 @@
<version>1.0</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>steamwar</groupId>
<artifactId>SchematicSystem_15</artifactId>
<version>1.0</version>
<scope>compile</scope>
</dependency>
<dependency>
<groupId>steamwar</groupId>
<artifactId>SchematicSystem_14</artifactId>
@ -74,6 +80,24 @@
<version>1.0</version>
<scope>compile</scope>
</dependency>
<dependency>
<groupId>steamwar</groupId>
<artifactId>SchematicSystem_10</artifactId>
<version>1.0</version>
<scope>compile</scope>
</dependency>
<dependency>
<groupId>steamwar</groupId>
<artifactId>SchematicSystem_9</artifactId>
<version>1.0</version>
<scope>compile</scope>
</dependency>
<dependency>
<groupId>steamwar</groupId>
<artifactId>SchematicSystem_8</artifactId>
<version>1.0</version>
<scope>compile</scope>
</dependency>
<dependency>
<groupId>steamwar</groupId>
<artifactId>SchematicSystem_API</artifactId>

Datei anzeigen

@ -60,8 +60,20 @@ public class CheckSchemType implements ICheckSchemType {
public void autoCheck(Schematic schematic, List<String> errors, List<String> warnings) {
switch(Core.getVersion()){
case 15:
CheckSchemType_15.autoCheck(schematic, errors, warnings, this);
break;
case 14:
CheckSchemType_14.autoCheck(schematic, errors, warnings, this);
CheckSchemType_14.autoCheck(errors);
break;
case 10:
CheckSchemType_10.autoCheck(errors);
break;
case 9:
CheckSchemType_9.autoCheck(errors);
break;
case 8:
CheckSchemType_8.autoCheck(errors);
break;
default:
CheckSchemType_12.autoCheck(schematic, errors, warnings, this);

Datei anzeigen

@ -13,8 +13,16 @@ public class WorldEdit {
public static EditSession pasteSchematic(Player player, Schematic schematic) throws Schematic.WrongVersionException, IOException, NoClipboardException {
switch(Core.getVersion()){
case 15:
return WorldEdit_15.pasteSchematic(player, schematic);
case 14:
return WorldEdit_14.pasteSchematic(player, schematic);
case 10:
return WorldEdit_10.pasteSchematic(player, schematic);
case 9:
return WorldEdit_9.pasteSchematic(player, schematic);
case 8:
return WorldEdit_8.pasteSchematic(player, schematic);
default:
return WorldEdit_12.pasteSchematic(player, schematic);
}

Datei anzeigen

@ -126,6 +126,10 @@ class GUI {
p.closeInventory();
changeType(p, schem);
});
inv.setItem(5, SWItem.getMaterial("MAGENTA_GLAZED_TERRACOTTA"), "§eDownload", click -> {
p.closeInventory();
SchematicCommand.download(p, schem);
});
inv.setItem(6, SWItem.getMaterial("SKULL_ITEM"), "§eMitglieder", click -> {
p.closeInventory();
delmembers(p, schem);

Datei anzeigen

@ -64,6 +64,9 @@ public class SchematicCommand implements CommandExecutor {
case "delmember":
delmember(player, args);
break;
case "download":
download(player, args);
break;
default:
help(player);
}
@ -281,6 +284,13 @@ public class SchematicCommand implements CommandExecutor {
}
player.spigot().sendMessage(type);
if(SteamwarUser.get(schematic.getSchemOwner()).getUUID().equals(player.getUniqueId())){
TextComponent download = new TextComponent("§eDownload Schematic");
download.setHoverEvent(new HoverEvent(HoverEvent.Action.SHOW_TEXT, TextComponent.fromLegacyText("§eGeneriere Downloadlink")));
download.setClickEvent(new ClickEvent(ClickEvent.Action.RUN_COMMAND, "/schem download " + schematic.getSchemName()));
player.spigot().sendMessage(download);
}
List<CheckedSchematic> checkedSchematics = CheckedSchematic.getLastDeclined(player.getUniqueId());
for(int i = checkedSchematics.size() -1; i >= 0; i--) {
if(checkedSchematics.get(i).getSchemName().equals(schematic.getSchemName()) &&
@ -308,6 +318,28 @@ public class SchematicCommand implements CommandExecutor {
}
}
private void download(Player player, String[] args){
if(args.length < 2){
help(player);
return;
}
Schematic schematic = getSchem(player, args[1]);
if(schematic == null)
return;
download(player, schematic);
}
static void download(Player player, Schematic schematic){
if(schematic.getSchemOwner() != SteamwarUser.get(player.getUniqueId()).getId()){
player.sendMessage("§cDu darfst nur deine eigenen Schematics herunterladen!");
return;
}
player.sendMessage(DownloadSchematic.getLink(schematic));
}
private void addmember(Player player, String[] args){
if(args.length < 3){
help(player);
@ -400,6 +432,7 @@ public class SchematicCommand implements CommandExecutor {
player.sendMessage("§8/§eschem changetype §8[§7Schematic§8] - §7Ändert die Art deiner Schematic");
player.sendMessage("§8/§eschem delete §8[§7Schematic§8] - §7Löscht eine Schematic");
player.sendMessage("§8/§eschem info §8[§7Schematic§8] - §7Zeigt dir Informationen zur Schematic");
player.sendMessage("§8/§eschem download §8[§7Schematic§8] - §7Gibt dir einen Downloadlink (1 min gültig)");
player.sendMessage("§8/§eschem addmember §8[§7Schematic§8] §8[§7Spieler§8] - §7Fügt einen Spieler zu einer Schematic hinzu");
player.sendMessage("§8/§eschem delmember §8[§7Schematic§8] §8[§7Spieler§8] - §7Entfernt einen Spieler von einer Schematic");
}

Datei anzeigen

@ -3,6 +3,7 @@ version: "1.0"
authors: [Yaruma3341, Lixfel]
depend: [SpigotCore, WorldEdit]
main: de.steamwar.schematicsystem.SchematicSystem
api-version: "1.13"
commands:
schem:

Datei anzeigen

@ -36,8 +36,12 @@
</build>
<modules>
<module>SchematicSystem_8</module>
<module>SchematicSystem_9</module>
<module>SchematicSystem_10</module>
<module>SchematicSystem_12</module>
<module>SchematicSystem_14</module>
<module>SchematicSystem_15</module>
<module>SchematicSystem_API</module>
<module>SchematicSystem_Main</module>
</modules>