SteamWar/BauSystem
Archiviert
13
0

VersionedRunnable #193

Manuell gemergt
YoyoNow hat 5 Commits von VersionedRunnable nach master 2021-02-09 09:26:15 +01:00 zusammengeführt
5 geänderte Dateien mit 21 neuen und 63 gelöschten Zeilen

Datei anzeigen

@ -22,7 +22,7 @@ package de.steamwar.bausystem.commands;
import de.steamwar.bausystem.BauSystem;
import de.steamwar.bausystem.Permission;
import de.steamwar.bausystem.world.Welt;
import de.steamwar.core.Core;
import de.steamwar.core.VersionedRunnable;
import org.bukkit.command.Command;
import org.bukkit.command.CommandExecutor;
import org.bukkit.command.CommandSender;
@ -42,14 +42,8 @@ public class CommandDebugStick implements CommandExecutor {
return false;
}
switch(Core.getVersion()){
case 15:
CommandDebugStick_15.giveStick(player);
break;
case 12:
default:
player.sendMessage(BauSystem.PREFIX + "§cDen Debugstick gibt es nicht in der 1.12.");
}
VersionedRunnable.call(new VersionedRunnable(() -> player.sendMessage(BauSystem.PREFIX + "§cDen Debugstick gibt es nicht in der 1.12."), 8),
new VersionedRunnable(() -> CommandDebugStick_15.giveStick(player), 15));
return false;
}
}

Datei anzeigen

@ -20,7 +20,6 @@
package de.steamwar.bausystem.world;
import de.steamwar.bausystem.BauSystem;
import de.steamwar.core.Core;
import de.steamwar.core.VersionedCallable;
import org.bukkit.Bukkit;
import org.bukkit.Location;
@ -225,12 +224,8 @@ public class AutoLoader extends IAutoLoader implements Listener {
@Override
boolean setRedstone(Location location, boolean active){
switch(Core.getVersion()){
case 15:
return AutoLoader_15.setRedstone(location, active);
default:
return AutoLoader_12.setRedstone(location, active);
}
return VersionedCallable.call(new VersionedCallable<>(() -> AutoLoader_12.setRedstone(location, active), 8),
new VersionedCallable<>(() -> AutoLoader_15.setRedstone(location, active), 15));
}
@Override
@ -256,12 +251,8 @@ public class AutoLoader extends IAutoLoader implements Listener {
@Override
public boolean perform() {
switch(Core.getVersion()){
case 15:
return AutoLoader_15.tntPlaceActionPerform(location);
default:
return AutoLoader_12.tntPlaceActionPerform(location);
}
return VersionedCallable.call(new VersionedCallable<>(() -> AutoLoader_12.tntPlaceActionPerform(location), 8),
new VersionedCallable<>(() -> AutoLoader_15.tntPlaceActionPerform(location), 15));
}
@Override

Datei anzeigen

@ -21,7 +21,7 @@ package de.steamwar.bausystem.world;
import com.sk89q.worldedit.extent.clipboard.Clipboard;
import de.steamwar.bausystem.commands.CommandTNT.TNTMode;
import de.steamwar.core.Core;
import de.steamwar.core.VersionedRunnable;
import de.steamwar.sql.NoClipboardException;
import de.steamwar.sql.Schematic;
import org.bukkit.Bukkit;
@ -298,14 +298,8 @@ public class Region {
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(file, x, y, z, rotate);
break;
case 15:
default:
Region_15.fastpaste(file, x, y, z, rotate);
}
VersionedRunnable.call(new VersionedRunnable(() -> Region_12.paste(file, x, y, z, rotate), 8),
new VersionedRunnable(() -> Region_15.fastpaste(file, x, y, z, rotate), 15));
}
public void reset(Region region, Schematic schem) throws IOException, NoClipboardException {
@ -345,25 +339,13 @@ public class Region {
}
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(file, x, y, z, rotate);
break;
case 15:
default:
Region_15.paste(file, x, y, z, rotate);
}
VersionedRunnable.call(new VersionedRunnable(() -> Region_12.paste(file, x, y, z, rotate), 8),
new VersionedRunnable(() -> Region_15.paste(file, x, y, z, rotate), 15));
}
private static void paste(Clipboard clipboard, int x, int y, int z, boolean rotate){
switch(Core.getVersion()){
case 12:
Region_12.paste(clipboard, x, y, z, rotate);
break;
case 15:
default:
Region_15.paste(clipboard, x, y, z, rotate);
}
VersionedRunnable.call(new VersionedRunnable(() -> Region_12.paste(clipboard, x, y, z, rotate), 8),
new VersionedRunnable(() -> Region_15.paste(clipboard, x, y, z, rotate), 15));
}
}
}

Datei anzeigen

@ -21,6 +21,7 @@ package de.steamwar.bausystem.world;
import com.comphenix.protocol.PacketType;
import com.comphenix.protocol.ProtocolLibrary;
import com.comphenix.protocol.events.PacketAdapter;
import com.comphenix.protocol.events.PacketContainer;
import com.comphenix.protocol.events.PacketEvent;
@ -28,10 +29,10 @@ import com.comphenix.protocol.wrappers.BlockPosition;
import de.steamwar.bausystem.BauSystem;
import de.steamwar.bausystem.Permission;
import de.steamwar.core.Core;
import de.steamwar.core.VersionedCallable;
import de.steamwar.core.VersionedRunnable;
import org.bukkit.Bukkit;
import org.bukkit.ChatColor;
import com.comphenix.protocol.ProtocolLibrary;
import org.bukkit.Material;
import org.bukkit.block.Block;
import org.bukkit.block.Sign;
@ -105,13 +106,8 @@ public class RegionListener implements Listener {
if(command.startsWith(shortcut))
return true;
switch(Core.getVersion()){
case 12:
return RegionListener_12.isWorldEditCommand(command);
case 15:
default:
return RegionListener_15.isWorldEditCommand(command);
}
return VersionedCallable.call(new VersionedCallable<>(() -> RegionListener_12.isWorldEditCommand(command), 8),
new VersionedCallable<>(() -> RegionListener_15.isWorldEditCommand(command), 15));
}
@EventHandler

Datei anzeigen

@ -23,7 +23,7 @@ import de.steamwar.bausystem.BauSystem;
import de.steamwar.bausystem.commands.CommandScript;
import de.steamwar.bausystem.commands.CommandTNT;
import de.steamwar.bausystem.tracer.record.RecordStateMachine;
import de.steamwar.core.Core;
import de.steamwar.core.VersionedCallable;
import org.bukkit.Bukkit;
import org.bukkit.ChatColor;
import org.bukkit.entity.Player;
@ -72,13 +72,8 @@ public class ScriptListener implements Listener {
}
private boolean isNoBook(ItemStack item){
switch(Core.getVersion()){
case 12:
return ScriptListener_12.isNoBook(item);
case 15:
default:
return ScriptListener_15.isNoBook(item);
}
return VersionedCallable.call(new VersionedCallable<>(() -> ScriptListener_12.isNoBook(item), 8),
new VersionedCallable<>(() -> ScriptListener_15.isNoBook(item), 15));
}
private static class ScriptExecutor {