SteamWar/BauSystem2.0
Archiviert
12
0

Add RegionCommand.copyPointCommand

Dieser Commit ist enthalten in:
yoyosource 2021-05-03 16:32:44 +02:00
Ursprung ffc16db480
Commit b0eb0dfae3
6 geänderte Dateien mit 454 neuen und 3 gelöschten Zeilen

Datei anzeigen

@ -19,10 +19,13 @@
package de.steamwar.bausystem.region;
import lombok.*;
import lombok.AllArgsConstructor;
import lombok.EqualsAndHashCode;
import lombok.Getter;
import lombok.ToString;
import org.bukkit.Location;
import org.bukkit.World;
import org.bukkit.entity.Player;
@Getter
@ToString
@ -45,4 +48,20 @@ public class Point {
public Point subtract(int x, int y, int z) {
return new Point(this.x - x, this.y - y, this.z - z);
}
public Location toLocation(World world) {
return new Location(world, x, y, z);
}
public Location toLocation(World world, double dx, double dy, double dz) {
return new Location(world, x + dx, y + dy, z + dz);
}
public Location toLocation(Player player) {
return new Location(player.getWorld(), x, y, z, player.getLocation().getYaw(), player.getLocation().getPitch());
}
public Location toLocation(Player player, double dx, double dy, double dz) {
return new Location(player.getWorld(), x + dx, y + dy, z + dz, player.getLocation().getYaw(), player.getLocation().getPitch());
}
}

Datei anzeigen

@ -14,7 +14,9 @@ import de.steamwar.bausystem.region.utils.RegionType;
import de.steamwar.command.SWCommand;
import de.steamwar.sql.Schematic;
import org.bukkit.Bukkit;
import org.bukkit.Location;
import org.bukkit.entity.Player;
import org.bukkit.event.player.PlayerTeleportEvent;
import java.io.IOException;
import java.util.logging.Level;
@ -127,6 +129,16 @@ public class RegionCommand extends SWCommand {
colorCommand.genericColor(p, color);
}
@Register("copypoint")
public void copyPointCommand(Player p) {
Region region = Region.getRegion(p.getLocation());
if (checkGlobalRegion(region, p)) {
return;
}
p.teleport(region.getCopyPoint().toLocation(p, 0.5, 0, 0.5), PlayerTeleportEvent.TeleportCause.COMMAND);
p.sendMessage(BauSystem.PREFIX + "§7Zum Kopierpunkt teleportiert");
}
static boolean checkGlobalRegion(Region region, Player p) {
if (region.isGlobal()) {
p.sendMessage(BauSystem.PREFIX + "§cDu bist in keiner Region");

Datei anzeigen

@ -49,6 +49,10 @@ public class Prototype {
private final SubPrototype testblock; // Nullable
private final SubPrototype build; // Nullable
private final int copyPointOffsetX;
private final int copyPointOffsetY;
private final int copyPointOffsetZ;
public Prototype(String name, YAPIONObject yapionObject) {
PROTOTYPE_MAP.put(name, this);
@ -59,6 +63,10 @@ public class Prototype {
sizeY = yapionObject.getPlainValue("sizeY");
sizeZ = yapionObject.getPlainValue("sizeZ");
copyPointOffsetX = yapionObject.getPlainValue("copyOffsetX");
copyPointOffsetY = yapionObject.getPlainValue("copyOffsetY");
copyPointOffsetZ = yapionObject.getPlainValue("copyOffsetZ");
schematicFile = new File(yapionObject.getValue("schematic", String.class).get());
floorOffset = yapionObject.getPlainValueOrDefault("floorOffset", 0);

Datei anzeigen

@ -82,6 +82,8 @@ public class Region {
private int floorLevel;
private int waterLevel;
private Point copyPoint; // Nullable
private String linkedRegionName = null; // Nullable
private Region linkedRegion = null; // Nullable
@ -162,6 +164,8 @@ public class Region {
} else {
waterLevel = 0;
}
copyPoint = this.minPoint.add(prototype.getCopyPointOffsetX(), prototype.getCopyPointOffsetY(), prototype.getCopyPointOffsetZ());
}
public boolean inRegion(Location location, RegionType regionType, RegionExtensionType regionExtensionType) {

189
yapion/prototypes.yapion Normale Datei
Datei anzeigen

@ -0,0 +1,189 @@
{
wg{
displayName(WarGear)
schematic(sections4/WGArena.schem)
sizeX(178)
sizeY(119)
sizeZ(221)
copyOffsetX(89)
copyOffsetY(45)
copyOffsetZ(85)
floorOffset(46)
testblock{
sizeX(67)
sizeY(41)
sizeZ(47)
offsetX(56)
offsetY(45)
offsetZ(135)
schematic(sections4/WGTestblock.schem)
extensionX(20)
extensionPositiveY(20)
extensionNegativeZ(12)
extensionPositiveZ(20)
}
build{
sizeX(67)
sizeY(41)
sizeZ(47)
offsetX(56)
offsetY(45)
offsetZ(38)
extensionX(20)
extensionPositiveY(20)
extensionNegativeZ(20)
extensionPositiveZ(12)
}
}
mwg{
displayName(MiniWarGear)
schematic(sections4/MWGArena.schem)
sizeX(107)
sizeY(94)
sizeZ(141)
copyOffsetX(53)
copyOffsetY(45)
copyOffsetZ(45)
floorOffset(46)
testblock{
sizeX(37)
sizeY(26)
sizeZ(22)
offsetX(35)
offsetY(45)
offsetZ(95)
schematic(sections4/MWGTestblock.schem)
extensionX(7)
extensionPositiveY(7)
extensionNegativeZ(7)
extensionPositiveZ(7)
}
build{
sizeX(37)
sizeY(26)
sizeZ(22)
offsetX(35)
offsetY(45)
offsetZ(23)
extensionX(7)
extensionPositiveY(7)
extensionNegativeZ(7)
extensionPositiveZ(7)
}
}
as{
displayName(AirShip)
schematic(sections4/ASArena.schem)
sizeX(121)
sizeY(64)
sizeZ(177)
copyOffsetX(5)
copyOffsetY(11)
copyOffsetZ(38)
testblock{
sizeX(115)
sizeY(45)
sizeZ(65)
offsetX(6)
offsetY(10)
offsetZ(106)
schematic(sections4/ASTestblock.schem)
}
build{
sizeX(115)
sizeY(45)
sizeZ(65)
offsetX(6)
offsetY(10)
offsetZ(6)
}
}
ws{
displayName(WarShip)
schematic(sections4/WSArena.schem)
sizeX(214)
sizeY(97)
sizeZ(185)
copyOffsetX(19)
copyOffsetY(28)
copyOffsetZ(145)
waterLevel(53)
testblock{
sizeX(175)
sizeY(58)
sizeZ(31)
offsetX(20)
offsetY(20)
offsetZ(-1)
schematic(sections4/WSTestblock.schem)
extensionX(12)
extensionNegativeZ(8)
extensionPositiveZ(8)
}
build{
sizeX(175)
sizeY(58)
sizeZ(39)
offsetX(20)
offsetY(20)
offsetZ(126)
extensionX(12)
extensionNegativeZ(8)
extensionPositiveZ(8)
}
}
ws_inner{
displayName(WarShip)
schematic(sections4/WSInnerArena.schem)
sizeX(214)
sizeY(97)
sizeZ(185)
copyOffsetX(19)
copyOffsetY(28)
copyOffsetZ(34)
waterLevel(53)
testblock{
sizeX(175)
sizeY(58)
sizeZ(31)
offsetX(20)
offsetY(20)
offsetZ(154)
schematic(sections4/WSTestblock.schem)
extensionX(12)
extensionNegativeZ(8)
extensionPositiveZ(8)
}
build{
sizeX(175)
sizeY(58)
sizeZ(39)
offsetX(20)
offsetY(20)
offsetZ(19)
extensionX(12)
extensionNegativeZ(8)
extensionPositiveZ(8)
}
}
ws_rumpf{
displayName(WarShip Rumpf)
schematic(sections4/WSRumpf.schem)
sizeX(184)
sizeY(67)
sizeZ(48)
copyOffsetX(4)
copyOffsetY(13)
copyOffsetZ(24)
}
ws_rahmen{
displayName(WarShip Rahmen)
schematic(sections4/WSRahmen.schem)
sizeX(184)
sizeY(67)
sizeZ(48)
copyOffsetX(4)
copyOffsetY(13)
copyOffsetZ(24)
}
}

219
yapion/regions.yapion Normale Datei
Datei anzeigen

@ -0,0 +1,219 @@
{
wg11{
minX(-188)
minY(1)
minZ(26)
prototype(wg)
}
wg12{
minX(-188)
minY(1)
minZ(248)
prototype(wg)
}
wg21{
minX(-367)
minY(1)
minZ(26)
prototype(wg)
}
wg22{
minX(-367)
minY(1)
minZ(248)
prototype(wg)
}
wg31{
minX(-546)
minY(1)
minZ(26)
prototype(wg)
}
wg32{
minX(-546)
minY(1)
minZ(248)
prototype(wg)
}
mwg11{
minX(-119)
minY(1)
minZ(-164)
prototype(mwg)
}
mwg12{
minX(-119)
minY(1)
minZ(-306)
prototype(mwg)
}
mwg13{
minX(-119)
minY(1)
minZ(-448)
prototype(mwg)
}
mwg21{
minX(-225)
minY(1)
minZ(-164)
prototype(mwg)
}
mwg22{
minX(-225)
minY(1)
minZ(-306)
prototype(mwg)
}
mwg23{
minX(-225)
minY(1)
minZ(-448)
prototype(mwg)
}
mwg31{
minX(-331)
minY(1)
minZ(-164)
prototype(mwg)
}
mwg32{
minX(-331)
minY(1)
minZ(-306)
prototype(mwg)
}
mwg33{
minX(-331)
minY(1)
minZ(-448)
prototype(mwg)
}
mwg41{
minX(-437)
minY(1)
minZ(-164)
prototype(mwg)
}
mwg42{
minX(-437)
minY(1)
minZ(-306)
prototype(mwg)
}
mwg43{
minX(-437)
minY(1)
minZ(-448)
prototype(mwg)
}
mwg51{
minX(-543)
minY(1)
minZ(-164)
prototype(mwg)
}
mwg52{
minX(-543)
minY(1)
minZ(-306)
prototype(mwg)
}
mwg53{
minX(-543)
minY(1)
minZ(-448)
prototype(mwg)
}
as11{
minX(33)
minY(55)
minZ(29)
prototype(as)
}
as12{
minX(33)
minY(55)
minZ(218)
prototype(as)
}
as21{
minX(160)
minY(55)
minZ(29)
prototype(as)
}
as22{
minX(160)
minY(55)
minZ(218)
prototype(as)
}
as31{
minX(287)
minY(55)
minZ(29)
prototype(as)
}
as32{
minX(287)
minY(55)
minZ(218)
prototype(as)
}
as41{
minX(414)
minY(55)
minZ(29)
prototype(as)
}
as42{
minX(414)
minY(55)
minZ(218)
prototype(as)
}
ws11{
optionsLinkedWith(ws12)
minX(14)
minY(26)
minZ(-214)
prototype(ws)
}
ws12{
optionsLinkedWith(ws11)
minX(14)
minY(26)
minZ(-369)
prototype(ws_inner)
}
ws21{
optionsLinkedWith(ws22)
minX(266)
minY(26)
minZ(-214)
prototype(ws)
}
ws22{
optionsLinkedWith(ws21)
minX(266)
minY(26)
minZ(-369)
prototype(ws_inner)
}
ws_rumpf{
minX(29)
minY(41)
minZ(-440)
prototype(ws_rumpf)
}
ws_rahmen{
minX(281)
minY(41)
minZ(-440)
prototype(ws_rahmen)
}
}