Versionssupport für 1.8, 1.9 und 1.10 #35
48
SchematicSystem_14/pom.xml
Normale Datei
48
SchematicSystem_14/pom.xml
Normale Datei
@ -0,0 +1,48 @@
|
|||||||
|
<?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_14</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>SchematicSystem_API</artifactId>
|
||||||
|
<version>1.0</version>
|
||||||
|
</dependency>
|
||||||
|
<dependency>
|
||||||
|
<groupId>steamwar</groupId>
|
||||||
|
<artifactId>Spigot</artifactId>
|
||||||
|
<version>1.14</version>
|
||||||
|
<scope>provided</scope>
|
||||||
|
</dependency>
|
||||||
|
<dependency>
|
||||||
|
<groupId>steamwar</groupId>
|
||||||
|
<artifactId>FAWE</artifactId>
|
||||||
|
<version>1.14</version>
|
||||||
|
<scope>provided</scope>
|
||||||
|
</dependency>
|
||||||
|
</dependencies>
|
||||||
|
</project>
|
@ -0,0 +1,11 @@
|
|||||||
|
package de.steamwar.schematicsystem;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
class CheckSchemType_14 {
|
||||||
|
private CheckSchemType_14(){}
|
||||||
|
|
||||||
|
static void autoCheck(List<String> errors) {
|
||||||
|
errors.add("In der 1.14 können keine Schematics eingesendet werden");
|
||||||
|
}
|
||||||
|
}
|
39
SchematicSystem_14/src/de/steamwar/schematicsystem/WorldEdit_14.java
Normale Datei
39
SchematicSystem_14/src/de/steamwar/schematicsystem/WorldEdit_14.java
Normale Datei
@ -0,0 +1,39 @@
|
|||||||
|
package de.steamwar.schematicsystem;
|
||||||
|
|
||||||
|
import com.sk89q.worldedit.EditSession;
|
||||||
|
import com.sk89q.worldedit.MaxChangedBlocksException;
|
||||||
|
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.math.BlockVector3;
|
||||||
|
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_14 {
|
||||||
|
private WorldEdit_14(){}
|
||||||
|
|
||||||
|
static EditSession pasteSchematic(Player player, Schematic schematic) throws Schematic.WrongVersionException, IOException, NoClipboardException {
|
||||||
|
World weWorld = new BukkitWorld(player.getWorld());
|
||||||
|
Location playerLocation = player.getLocation();
|
||||||
|
Clipboard clipboard = schematic.load();
|
||||||
|
BlockVector3 vector = BlockVector3.at(playerLocation.getBlockX(), playerLocation.getBlockY(), playerLocation.getBlockZ());
|
||||||
|
BlockVector3 offset = clipboard.getRegion().getMinimumPoint().subtract(clipboard.getOrigin());
|
||||||
|
BlockVector3 dimensions = clipboard.getDimensions();
|
||||||
|
BlockVector3 v = vector.subtract(dimensions.getX()/2 - dimensions.getX()%2, 0, dimensions.getZ()).subtract(offset);
|
||||||
|
EditSession e = WorldEdit.getInstance().getEditSessionFactory().getEditSession(weWorld, -1);
|
||||||
|
try {
|
||||||
|
Operations.completeBlindly(new ClipboardHolder(clipboard).createPaste(e).to(v).build());
|
||||||
|
} catch (MaxChangedBlocksException ex) {
|
||||||
|
throw new IOException(ex);
|
||||||
|
}
|
||||||
|
e.flushQueue();
|
||||||
|
return e;
|
||||||
|
}
|
||||||
|
}
|
@ -32,6 +32,11 @@
|
|||||||
<artifactId>SchematicSystem_API</artifactId>
|
<artifactId>SchematicSystem_API</artifactId>
|
||||||
<version>1.0</version>
|
<version>1.0</version>
|
||||||
</dependency>
|
</dependency>
|
||||||
|
<dependency>
|
||||||
|
<groupId>steamwar</groupId>
|
||||||
|
<artifactId>SchematicSystem_14</artifactId>
|
||||||
|
<version>1.0</version>
|
||||||
|
</dependency>
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>steamwar</groupId>
|
<groupId>steamwar</groupId>
|
||||||
<artifactId>Spigot</artifactId>
|
<artifactId>Spigot</artifactId>
|
||||||
|
@ -1,17 +1,8 @@
|
|||||||
package de.steamwar.schematicsystem;
|
package de.steamwar.schematicsystem;
|
||||||
|
|
||||||
import com.sk89q.worldedit.EditSession;
|
import com.sk89q.worldedit.EditSession;
|
||||||
import com.sk89q.worldedit.MaxChangedBlocksException;
|
|
||||||
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.math.BlockVector3;
|
|
||||||
import com.sk89q.worldedit.session.ClipboardHolder;
|
|
||||||
import com.sk89q.worldedit.world.World;
|
|
||||||
import de.steamwar.sql.NoClipboardException;
|
import de.steamwar.sql.NoClipboardException;
|
||||||
import de.steamwar.sql.Schematic;
|
import de.steamwar.sql.Schematic;
|
||||||
import org.bukkit.Location;
|
|
||||||
import org.bukkit.entity.Player;
|
import org.bukkit.entity.Player;
|
||||||
|
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
@ -20,20 +11,6 @@ class WorldEdit_15 {
|
|||||||
private WorldEdit_15(){}
|
private WorldEdit_15(){}
|
||||||
|
|
||||||
static EditSession pasteSchematic(Player player, Schematic schematic) throws Schematic.WrongVersionException, IOException, NoClipboardException {
|
static EditSession pasteSchematic(Player player, Schematic schematic) throws Schematic.WrongVersionException, IOException, NoClipboardException {
|
||||||
World weWorld = new BukkitWorld(player.getWorld());
|
return WorldEdit_14.pasteSchematic(player, schematic);
|
||||||
Location playerLocation = player.getLocation();
|
|
||||||
Clipboard clipboard = schematic.load();
|
|
||||||
BlockVector3 vector = BlockVector3.at(playerLocation.getBlockX(), playerLocation.getBlockY(), playerLocation.getBlockZ());
|
|
||||||
BlockVector3 offset = clipboard.getRegion().getMinimumPoint().subtract(clipboard.getOrigin());
|
|
||||||
BlockVector3 dimensions = clipboard.getDimensions();
|
|
||||||
BlockVector3 v = vector.subtract(dimensions.getX()/2 - dimensions.getX()%2, 0, dimensions.getZ()).subtract(offset);
|
|
||||||
EditSession e = WorldEdit.getInstance().getEditSessionFactory().getEditSession(weWorld, -1);
|
|
||||||
try {
|
|
||||||
Operations.completeBlindly(new ClipboardHolder(clipboard).createPaste(e).to(v).build());
|
|
||||||
} catch (MaxChangedBlocksException ex) {
|
|
||||||
throw new IOException(ex);
|
|
||||||
}
|
|
||||||
e.flushQueue();
|
|
||||||
return e;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -68,6 +68,12 @@
|
|||||||
<version>1.0</version>
|
<version>1.0</version>
|
||||||
<scope>compile</scope>
|
<scope>compile</scope>
|
||||||
</dependency>
|
</dependency>
|
||||||
|
<dependency>
|
||||||
|
<groupId>steamwar</groupId>
|
||||||
|
<artifactId>SchematicSystem_14</artifactId>
|
||||||
|
<version>1.0</version>
|
||||||
|
<scope>compile</scope>
|
||||||
|
</dependency>
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>steamwar</groupId>
|
<groupId>steamwar</groupId>
|
||||||
<artifactId>SchematicSystem_12</artifactId>
|
<artifactId>SchematicSystem_12</artifactId>
|
||||||
|
@ -63,6 +63,9 @@ public class CheckSchemType implements ICheckSchemType {
|
|||||||
case 15:
|
case 15:
|
||||||
CheckSchemType_15.autoCheck(schematic, errors, warnings, this);
|
CheckSchemType_15.autoCheck(schematic, errors, warnings, this);
|
||||||
break;
|
break;
|
||||||
|
case 14:
|
||||||
|
CheckSchemType_14.autoCheck(errors);
|
||||||
|
break;
|
||||||
default:
|
default:
|
||||||
CheckSchemType_12.autoCheck(schematic, errors, warnings, this);
|
CheckSchemType_12.autoCheck(schematic, errors, warnings, this);
|
||||||
}
|
}
|
||||||
|
@ -15,6 +15,8 @@ public class WorldEdit {
|
|||||||
switch(Core.getVersion()){
|
switch(Core.getVersion()){
|
||||||
case 15:
|
case 15:
|
||||||
return WorldEdit_15.pasteSchematic(player, schematic);
|
return WorldEdit_15.pasteSchematic(player, schematic);
|
||||||
|
case 14:
|
||||||
|
return WorldEdit_14.pasteSchematic(player, schematic);
|
||||||
default:
|
default:
|
||||||
return WorldEdit_12.pasteSchematic(player, schematic);
|
return WorldEdit_12.pasteSchematic(player, schematic);
|
||||||
}
|
}
|
||||||
|
1
pom.xml
1
pom.xml
@ -37,6 +37,7 @@
|
|||||||
|
|
||||||
<modules>
|
<modules>
|
||||||
<module>SchematicSystem_12</module>
|
<module>SchematicSystem_12</module>
|
||||||
|
<module>SchematicSystem_14</module>
|
||||||
<module>SchematicSystem_15</module>
|
<module>SchematicSystem_15</module>
|
||||||
<module>SchematicSystem_API</module>
|
<module>SchematicSystem_API</module>
|
||||||
<module>SchematicSystem_Main</module>
|
<module>SchematicSystem_Main</module>
|
||||||
|
In neuem Issue referenzieren
Einen Benutzer sperren