13
0

Versionssupport für 1.8, 1.9 und 1.10 #35

Zusammengeführt
Lixfel hat 10 Commits von OldVersionSupport nach master 2019-12-22 17:25:07 +01:00 zusammengeführt
9 geänderte Dateien mit 116 neuen und 24 gelöschten Zeilen
Nur Änderungen aus Commit a938bde40c werden angezeigt - Alle Commits anzeigen

48
SchematicSystem_14/pom.xml Normale Datei
Datei anzeigen

@ -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>

Datei anzeigen

@ -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");
}
}

Datei anzeigen

@ -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;
}
}

Datei anzeigen

@ -32,6 +32,11 @@
<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>

Datei anzeigen

@ -1,17 +1,8 @@
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;
@ -20,20 +11,6 @@ class WorldEdit_15 {
private WorldEdit_15(){}
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;
return WorldEdit_14.pasteSchematic(player, schematic);
}
}

Datei anzeigen

@ -68,6 +68,12 @@
<version>1.0</version>
<scope>compile</scope>
</dependency>
<dependency>
<groupId>steamwar</groupId>
<artifactId>SchematicSystem_14</artifactId>
<version>1.0</version>
<scope>compile</scope>
</dependency>
<dependency>
<groupId>steamwar</groupId>
<artifactId>SchematicSystem_12</artifactId>

Datei anzeigen

@ -63,6 +63,9 @@ public class CheckSchemType implements ICheckSchemType {
case 15:
CheckSchemType_15.autoCheck(schematic, errors, warnings, this);
break;
case 14:
CheckSchemType_14.autoCheck(errors);
break;
default:
CheckSchemType_12.autoCheck(schematic, errors, warnings, this);
}

Datei anzeigen

@ -15,6 +15,8 @@ public class WorldEdit {
switch(Core.getVersion()){
case 15:
return WorldEdit_15.pasteSchematic(player, schematic);
case 14:
return WorldEdit_14.pasteSchematic(player, schematic);
default:
return WorldEdit_12.pasteSchematic(player, schematic);
}

Datei anzeigen

@ -37,6 +37,7 @@
<modules>
<module>SchematicSystem_12</module>
<module>SchematicSystem_14</module>
<module>SchematicSystem_15</module>
<module>SchematicSystem_API</module>
<module>SchematicSystem_Main</module>