SteamWar/BauSystem
Archiviert
13
0

Removing changes from player history

Dieser Commit ist enthalten in:
Lixfel 2020-12-12 17:13:43 +01:00
Ursprung 2f123d9a97
Commit 9126e6b303
6 geänderte Dateien mit 34 neuen und 41 gelöschten Zeilen

Datei anzeigen

@ -23,7 +23,6 @@ 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.bukkit.WorldEditPlugin;
import com.sk89q.worldedit.extent.clipboard.Clipboard;
import com.sk89q.worldedit.extent.clipboard.io.ClipboardFormat;
import com.sk89q.worldedit.function.operation.Operations;
@ -31,7 +30,6 @@ import com.sk89q.worldedit.math.transform.AffineTransform;
import com.sk89q.worldedit.session.ClipboardHolder;
import com.sk89q.worldedit.world.World;
import org.bukkit.Bukkit;
import org.bukkit.entity.Player;
import java.io.File;
import java.io.FileInputStream;
@ -41,7 +39,7 @@ import java.util.Objects;
class Region_12 {
private Region_12(){}
static void paste(Player player, File file, int x, int y, int z, boolean rotate){
static void paste(File file, int x, int y, int z, boolean rotate){
World w = new BukkitWorld(Bukkit.getWorlds().get(0));
Clipboard clipboard;
try {
@ -50,10 +48,10 @@ class Region_12 {
throw new SecurityException("Bausystem schematic not found", e);
}
paste(player, clipboard, x, y, z, rotate);
paste(clipboard, x, y, z, rotate);
}
static void paste(Player player, Clipboard clipboard, int x, int y, int z, boolean rotate){
static void paste(Clipboard clipboard, int x, int y, int z, boolean rotate){
World w = new BukkitWorld(Bukkit.getWorlds().get(0));
Vector dimensions = clipboard.getDimensions();
@ -72,6 +70,5 @@ class Region_12 {
ch.setTransform(aT);
Operations.completeBlindly(ch.createPaste(e, w.getWorldData()).to(v).build());
e.flushQueue();
((WorldEditPlugin) Bukkit.getServer().getPluginManager() .getPlugin("WorldEdit")).getSession(player).remember(e);
}
}

Datei anzeigen

@ -23,7 +23,6 @@ import com.sk89q.worldedit.EditSession;
import com.sk89q.worldedit.WorldEdit;
import com.sk89q.worldedit.bukkit.BukkitAdapter;
import com.sk89q.worldedit.bukkit.BukkitWorld;
import com.sk89q.worldedit.bukkit.WorldEditPlugin;
import com.sk89q.worldedit.extent.clipboard.Clipboard;
import com.sk89q.worldedit.extent.clipboard.io.ClipboardFormats;
import com.sk89q.worldedit.function.operation.Operations;
@ -38,7 +37,6 @@ import org.bukkit.Material;
import org.bukkit.block.data.BlockData;
import org.bukkit.craftbukkit.v1_15_R1.CraftWorld;
import org.bukkit.craftbukkit.v1_15_R1.block.data.CraftBlockData;
import org.bukkit.entity.Player;
import java.io.File;
import java.io.FileInputStream;
@ -48,7 +46,7 @@ import java.util.Objects;
class Region_15 {
private Region_15(){}
static void paste(Player player, File file, int x, int y, int z, boolean rotate){
static void paste(File file, int x, int y, int z, boolean rotate){
Clipboard clipboard;
try {
clipboard = Objects.requireNonNull(ClipboardFormats.findByFile(file)).getReader(new FileInputStream(file)).read();
@ -56,10 +54,10 @@ class Region_15 {
throw new SecurityException("Bausystem schematic not found", e);
}
paste(player, clipboard, x, y, z, rotate);
paste(clipboard, x, y, z, rotate);
}
static void paste(Player player, Clipboard clipboard, int x, int y, int z, boolean rotate){
static void paste(Clipboard clipboard, int x, int y, int z, boolean rotate){
BlockVector3 dimensions = clipboard.getDimensions();
BlockVector3 v = BlockVector3.at(x, y, z);
BlockVector3 offset = clipboard.getRegion().getMinimumPoint().subtract(clipboard.getOrigin());
@ -76,7 +74,6 @@ class Region_15 {
ch.setTransform(aT);
Operations.completeBlindly(ch.createPaste(e).to(v).build());
e.flushSession();
((WorldEditPlugin) Objects.requireNonNull(Bukkit.getServer().getPluginManager().getPlugin("WorldEdit"))).getSession(player).remember(e);
}
static void fastpaste(File file, int x, int y, int z, boolean rotate){

Datei anzeigen

@ -56,7 +56,7 @@ public class CommandProtect implements CommandExecutor {
return false;
}
}
region.protect(player, schem);
region.protect(schem);
player.sendMessage(BauSystem.PREFIX + "§7Boden geschützt");
}catch(Exception e){
player.sendMessage(BauSystem.PREFIX + "§cFehler beim Schützen der Region");

Datei anzeigen

@ -54,9 +54,9 @@ public class CommandReset implements CommandExecutor {
player.sendMessage(BauSystem.PREFIX + "§cSchematic nicht gefunden");
return false;
}
region.reset(player, schem);
region.reset(schem);
}else{
region.fastreset(player);
region.fastreset();
}
player.sendMessage(BauSystem.PREFIX + "§7Region zurückgesetzt");
}catch(Exception e){

Datei anzeigen

@ -56,7 +56,7 @@ public class CommandTestblock implements CommandExecutor {
return false;
}
}
region.resetTestblock(player, schem);
region.resetTestblock(schem);
player.sendMessage(BauSystem.PREFIX + "§7Testblock zurückgesetzt");
}catch(Exception e){
player.sendMessage(BauSystem.PREFIX + "§cFehler beim Zurücksetzen des Testblocks");

Datei anzeigen

@ -28,7 +28,6 @@ import org.bukkit.Location;
import org.bukkit.configuration.ConfigurationSection;
import org.bukkit.configuration.InvalidConfigurationException;
import org.bukkit.configuration.file.YamlConfiguration;
import org.bukkit.entity.Player;
import java.io.File;
import java.io.IOException;
@ -81,24 +80,24 @@ public class Region {
return prototype.inRegion(this, l);
}
public void fastreset(Player player){
prototype.fastreset(player, this);
public void fastreset(){
prototype.fastreset(this);
}
public void reset(Player player, Schematic schem) throws IOException, NoClipboardException {
prototype.reset(player, this, schem);
public void reset(Schematic schem) throws IOException, NoClipboardException {
prototype.reset(this, schem);
}
public void resetTestblock(Player player, Schematic schem) throws IOException, NoClipboardException{
prototype.resetTestblock(player, this, schem);
public void resetTestblock(Schematic schem) throws IOException, NoClipboardException{
prototype.resetTestblock(this, schem);
}
public boolean hasProtection(){
return prototype.hasProtection();
}
public void protect(Player player, Schematic schem) throws IOException, NoClipboardException {
prototype.protect(player, this, schem);
public void protect(Schematic schem) throws IOException, NoClipboardException {
prototype.protect(this, schem);
}
public static class Prototype{
@ -143,14 +142,14 @@ public class Region {
inRange(l.getZ(), region.minZ + offsetZ, sizeZ + offsetZ);
}
public void fastreset(Player player, Region region){
public void fastreset(Region region){
File file = new File(SECTION_PATH + schematic);
int x = region.minX + offsetX + sizeX/2;
int y = region.minY + offsetY;
int z = region.minZ + offsetZ + sizeZ/2;
switch(Core.getVersion()){
case 12:
Region_12.paste(player, file, x, y, z, rotate);
Region_12.paste(file, x, y, z, rotate);
break;
case 15:
default:
@ -158,57 +157,57 @@ public class Region {
}
}
public void reset(Player player, Region region, Schematic schem) throws IOException, NoClipboardException {
public void reset(Region region, Schematic schem) throws IOException, NoClipboardException {
int x = region.minX + offsetX + sizeX / 2;
int y = region.minY + offsetY;
int z = region.minZ + offsetZ + sizeZ / 2;
if(schem == null)
paste(player, new File(SECTION_PATH + schematic), x, y, z, rotate);
paste(new File(SECTION_PATH + schematic), x, y, z, rotate);
else
paste(player, schem.load(), x, y, z, rotate);
paste(schem.load(), x, y, z, rotate);
}
public boolean hasProtection(){
return protectSchematic != null;
}
public void protect(Player player, Region region, Schematic schem) throws IOException, NoClipboardException {
public void protect(Region region, Schematic schem) throws IOException, NoClipboardException {
int x = region.minX + offsetX + sizeX / 2;
int y = region.minY + testblock.offsetY - 1;
int z = region.minZ + offsetZ + sizeZ / 2;
if(schem == null)
paste(player, new File(SECTION_PATH + protectSchematic), x, y, z, rotate);
paste(new File(SECTION_PATH + protectSchematic), x, y, z, rotate);
else
paste(player, schem.load(), x, y, z, rotate);
paste(schem.load(), x, y, z, rotate);
}
public void resetTestblock(Player player, Region region, Schematic schem) throws IOException, NoClipboardException {
testblock.reset(player, region, schem);
public void resetTestblock(Region region, Schematic schem) throws IOException, NoClipboardException {
testblock.reset(region, schem);
}
private static boolean inRange(double l, int min, int size){
return min <= l && l <= min + size;
}
private static void paste(Player player, File file, int x, int y, int z, boolean rotate){ //Type of protect
private static void paste(File file, int x, int y, int z, boolean rotate){ //Type of protect
switch(Core.getVersion()){
case 12:
Region_12.paste(player, file, x, y, z, rotate);
Region_12.paste(file, x, y, z, rotate);
break;
case 15:
default:
Region_15.paste(player, file, x, y, z, rotate);
Region_15.paste(file, x, y, z, rotate);
}
}
private static void paste(Player player, Clipboard clipboard, int x, int y, int z, boolean rotate){
private static void paste(Clipboard clipboard, int x, int y, int z, boolean rotate){
switch(Core.getVersion()){
case 12:
Region_12.paste(player, clipboard, x, y, z, rotate);
Region_12.paste(clipboard, x, y, z, rotate);
break;
case 15:
default:
Region_15.paste(player, clipboard, x, y, z, rotate);
Region_15.paste(clipboard, x, y, z, rotate);
}
}
}