Schematic Pasting
Dieser Commit ist enthalten in:
Ursprung
209f1ba88a
Commit
eab9235eef
@ -25,6 +25,7 @@ Schematic:
|
||||
OnlyPublicSchematics: boolean
|
||||
Directory: /home/netuser/schematics/
|
||||
SchematicType: airship
|
||||
Rotate: boolean
|
||||
Output:
|
||||
TeamRedName: Team1
|
||||
TeamRedPrefix: §c
|
||||
|
@ -5,8 +5,8 @@ import org.bukkit.entity.Player;
|
||||
|
||||
public class Fight {
|
||||
|
||||
public static final FightTeam redTeam = new FightTeam(Config.TeamRedName, Config.TeamRedPrefix);
|
||||
public static final FightTeam blueTeam = new FightTeam(Config.TeamBlueName, Config.TeamBluePrefix);
|
||||
public static final FightTeam redTeam = new FightTeam(Config.TeamRedName, Config.TeamRedPrefix, Config.TeamRedSpawn, Config.TeamRedPaste, Config.TeamRedRotate);
|
||||
public static final FightTeam blueTeam = new FightTeam(Config.TeamBlueName, Config.TeamBluePrefix, Config.TeamBlueSpawn, Config.TeamBluePaste, Config.TeamBlueRotate);
|
||||
|
||||
|
||||
public static FightTeam getPlayerTeam(Player player) {
|
||||
|
@ -2,6 +2,7 @@ package me.yaruma.fightsystem.fight;
|
||||
|
||||
import com.boydti.fawe.FaweAPI;
|
||||
import com.sk89q.worldedit.Vector;
|
||||
import com.sk89q.worldedit.bukkit.BukkitWorld;
|
||||
import com.sk89q.worldedit.math.transform.AffineTransform;
|
||||
import com.sk89q.worldedit.world.World;
|
||||
import de.warking.hunjy.MySQL.Schematic;
|
||||
@ -10,6 +11,7 @@ import me.yaruma.fightsystem.FightSystem;
|
||||
import me.yaruma.fightsystem.utils.Config;
|
||||
import me.yaruma.fightsystem.utils.ItemBuilder;
|
||||
import org.bukkit.Bukkit;
|
||||
import org.bukkit.Location;
|
||||
import org.bukkit.Material;
|
||||
import org.bukkit.enchantments.Enchantment;
|
||||
import org.bukkit.entity.Player;
|
||||
@ -24,16 +26,22 @@ public class FightTeam {
|
||||
private final ArrayList<FightPlayer> players;
|
||||
private boolean ready;
|
||||
private final ArrayList<Player> invited;
|
||||
private String name;
|
||||
private String prefix;
|
||||
private final String name;
|
||||
private final String prefix;
|
||||
private Schematic schematic;
|
||||
private final Location spawn;
|
||||
private final Vector paste;
|
||||
private final boolean rotate;
|
||||
|
||||
public FightTeam(String Name, String Prefix) {
|
||||
public FightTeam(String Name, String Prefix, Location Spawn, Vector Paste, boolean Rotate) {
|
||||
players = new ArrayList<>();
|
||||
invited = new ArrayList<>();
|
||||
spawn = Spawn;
|
||||
paste = Paste;
|
||||
name = Name;
|
||||
prefix = Prefix;
|
||||
ready = false;
|
||||
rotate = Rotate;
|
||||
}
|
||||
|
||||
public FightPlayer getFightPlayer(Player player) {
|
||||
@ -95,8 +103,9 @@ public class FightTeam {
|
||||
|
||||
public void setLeader(FightPlayer leader) {
|
||||
this.leader = leader;
|
||||
if(!this.players.contains(leader))
|
||||
if(!this.players.contains(leader)){
|
||||
this.players.add(leader);
|
||||
}
|
||||
}
|
||||
|
||||
public ArrayList<FightPlayer> getPlayers() {
|
||||
@ -108,7 +117,7 @@ public class FightTeam {
|
||||
}
|
||||
|
||||
private void pasteSchematic(){
|
||||
File file = new File(Config.SchematicDirectory + WarkingUser.get(schematic.getSchemOwner()) + "/" + schematic.getSchemName() + ".schematic");
|
||||
File file = new File(Config.SchematicDirectory + WarkingUser.get(schematic.getSchemOwner()).getUUID().toString() + "/" + schematic.getSchemName() + ".schematic");
|
||||
com.boydti.fawe.object.schematic.Schematic schem;
|
||||
try {
|
||||
schem = FaweAPI.load(file);
|
||||
@ -116,13 +125,13 @@ public class FightTeam {
|
||||
e.printStackTrace();
|
||||
return;
|
||||
}
|
||||
World w = new BukkitWorld(Bukkit.getWorlds().get(0));
|
||||
Vector dimensions = schem.getClipboard().getDimensions();
|
||||
Vector v = paste.subtract(dimensions.getX()/2, 0, dimensions.getZ()/2).subtract(schem.getClipboard().getRegion().getMinimumPoint()).add(schem.getClipboard().getOrigin());
|
||||
AffineTransform aT = new AffineTransform();
|
||||
World w = (World) Bukkit.getWorlds().get(0);
|
||||
Vector v = schem.getClipboard().getDimensions().divide(-2);
|
||||
if(this == Fight.getBlueTeam())
|
||||
v = v.add(Config.TeamBluePasteX, Config.TeamBluePasteY, Config.TeamBluePasteZ);
|
||||
else
|
||||
v = v.add(Config.TeamRedPasteX, Config.TeamRedPasteY, Config.TeamRedPasteZ);
|
||||
if(rotate){
|
||||
aT.rotateY(180);
|
||||
}
|
||||
schem.paste(w, v, false, true, aT).flushQueue();
|
||||
}
|
||||
|
||||
|
@ -1,5 +1,6 @@
|
||||
package me.yaruma.fightsystem.utils;
|
||||
|
||||
import com.sk89q.worldedit.Vector;
|
||||
import de.warking.hunjy.MySQL.SchematicType;
|
||||
import me.yaruma.fightsystem.FightSystem;
|
||||
import org.bukkit.Bukkit;
|
||||
@ -33,6 +34,8 @@ public class Config {
|
||||
public static boolean OnlyPublicSchematics;
|
||||
public static String SchematicDirectory;
|
||||
public static SchematicType SchematicType;
|
||||
public static boolean TeamRedRotate;
|
||||
public static boolean TeamBlueRotate;
|
||||
|
||||
public static String TeamRedName;
|
||||
public static String TeamRedPrefix;
|
||||
@ -69,6 +72,8 @@ public class Config {
|
||||
public static int TeamRedPasteX;
|
||||
public static int TeamRedPasteY;
|
||||
public static int TeamRedPasteZ;
|
||||
public static Vector TeamBluePaste;
|
||||
public static Vector TeamRedPaste;
|
||||
|
||||
public static int ArenaMinX;
|
||||
public static int ArenaMinZ;
|
||||
@ -105,6 +110,7 @@ public class Config {
|
||||
OnlyPublicSchematics = config.getBoolean("Schematic.OnlyPublicSchematics");
|
||||
SchematicDirectory = config.getString("Schematic.Directory");
|
||||
SchematicType = de.warking.hunjy.MySQL.SchematicType.valueOf(config.getString("Schematic.SchematicType"));
|
||||
boolean Rotate = config.getBoolean("Schematic.Rotate");
|
||||
|
||||
TeamRedName = config.getString("Output.TeamRedName");
|
||||
TeamRedPrefix = config.getString("Output.TeamRedPrefix");
|
||||
@ -148,31 +154,49 @@ public class Config {
|
||||
TeamBluePasteY = TeamBlueCornerY;
|
||||
TeamBluePasteZ = TeamBlueCornerZ + SchemsizeZ/2;
|
||||
|
||||
TeamBluePaste = new Vector(TeamBlueCornerX + SchemsizeX/2, TeamBlueCornerY, TeamBlueCornerZ + SchemsizeZ/2);
|
||||
TeamRedPaste = new Vector(TeamRedCornerX + SchemsizeX/2, TeamRedCornerY, TeamRedCornerZ + SchemsizeZ/2);
|
||||
|
||||
TeamRedPasteX = TeamBluePasteX + TeamBluetoReddistanceX;
|
||||
TeamRedPasteY = TeamBluePasteY + TeamBluetoReddistanceY;
|
||||
TeamRedPasteZ = TeamBluePasteZ + TeamBluetoReddistanceZ;
|
||||
|
||||
World world = Bukkit.getWorlds().get(0);
|
||||
TeamBlueSpawn = new Location(world, TeamBluePasteX, TeamBluePasteY + SchemsizeY, TeamBluePasteZ);
|
||||
TeamRedSpawn = new Location(world, TeamRedPasteX, TeamRedPasteY + SchemsizeY, TeamRedPasteZ);
|
||||
TeamBlueSpawn = new Location(world, TeamBluePasteX + 0.5, TeamBluePasteY + SchemsizeY, TeamBluePasteZ + 0.5);
|
||||
TeamRedSpawn = new Location(world, TeamRedPasteX + 0.5, TeamRedPasteY + SchemsizeY, TeamRedPasteZ + 0.5);
|
||||
SpecSpawn = new Location(world,
|
||||
TeamBluePasteX + TeamBluetoReddistanceX/2,
|
||||
TeamBluePasteY + TeamBluetoReddistanceY/2,
|
||||
TeamBluePasteY + TeamBluetoReddistanceY/2 + SchemsizeY/2,
|
||||
TeamBluePasteZ + TeamBluetoReddistanceZ/2);
|
||||
|
||||
if(TeamBluetoReddistanceX > 0){
|
||||
ArenaMinX = TeamBlueCornerX - Schem2BorderX;
|
||||
ArenaMaxX = TeamRedCornerX + SchemsizeX + Schem2BorderX;
|
||||
TeamRedRotate = true;
|
||||
TeamBlueRotate = false;
|
||||
}else{
|
||||
ArenaMinX = TeamRedCornerX - Schem2BorderX;
|
||||
ArenaMaxX = TeamBlueCornerX + SchemsizeX + Schem2BorderX;
|
||||
TeamRedRotate = false;
|
||||
TeamBlueRotate = true;
|
||||
}
|
||||
if(TeamBluetoReddistanceZ > 0){
|
||||
ArenaMinZ = TeamBlueCornerZ - Schem2BorderZ;
|
||||
ArenaMaxZ = TeamRedCornerZ + SchemsizeZ + Schem2BorderZ;
|
||||
TeamRedRotate = true;
|
||||
TeamBlueRotate = false;
|
||||
}else{
|
||||
ArenaMinZ = TeamRedCornerZ - Schem2BorderZ;
|
||||
ArenaMaxZ = TeamBlueCornerZ + SchemsizeZ + Schem2BorderZ;
|
||||
if(TeamBluetoReddistanceZ != 0){
|
||||
TeamRedRotate = false;
|
||||
TeamBlueRotate = true;
|
||||
}
|
||||
}
|
||||
|
||||
if(!Rotate){
|
||||
TeamRedRotate = false;
|
||||
TeamBlueRotate = false;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
In neuem Issue referenzieren
Einen Benutzer sperren