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

Datei anzeigen

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

Datei anzeigen

@ -21,7 +21,7 @@ package de.steamwar.bausystem.world;
import com.sk89q.worldedit.extent.clipboard.Clipboard; import com.sk89q.worldedit.extent.clipboard.Clipboard;
import de.steamwar.bausystem.commands.CommandTNT.TNTMode; 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.NoClipboardException;
import de.steamwar.sql.Schematic; import de.steamwar.sql.Schematic;
import org.bukkit.Bukkit; import org.bukkit.Bukkit;
@ -298,14 +298,8 @@ public class Region {
int x = region.minX + offsetX + sizeX/2; int x = region.minX + offsetX + sizeX/2;
int y = region.minY + offsetY; int y = region.minY + offsetY;
int z = region.minZ + offsetZ + sizeZ/2; int z = region.minZ + offsetZ + sizeZ/2;
switch(Core.getVersion()){ VersionedRunnable.call(new VersionedRunnable(() -> Region_12.paste(file, x, y, z, rotate), 8),
case 12: new VersionedRunnable(() -> Region_15.fastpaste(file, x, y, z, rotate), 15));
Region_12.paste(file, x, y, z, rotate);
break;
case 15:
default:
Region_15.fastpaste(file, x, y, z, rotate);
}
} }
public void reset(Region region, Schematic schem) throws IOException, NoClipboardException { 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 private static void paste(File file, int x, int y, int z, boolean rotate){ //Type of protect
switch(Core.getVersion()){ VersionedRunnable.call(new VersionedRunnable(() -> Region_12.paste(file, x, y, z, rotate), 8),
case 12: new VersionedRunnable(() -> Region_15.paste(file, x, y, z, rotate), 15));
Region_12.paste(file, x, y, z, rotate);
break;
case 15:
default:
Region_15.paste(file, x, y, z, rotate);
}
} }
private static void paste(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()){ VersionedRunnable.call(new VersionedRunnable(() -> Region_12.paste(clipboard, x, y, z, rotate), 8),
case 12: new VersionedRunnable(() -> Region_15.paste(clipboard, x, y, z, rotate), 15));
Region_12.paste(clipboard, x, y, z, rotate);
break;
case 15:
default:
Region_15.paste(clipboard, x, y, z, rotate);
}
} }
} }
} }

Datei anzeigen

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

Datei anzeigen

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