New Fight UI #288
@ -106,7 +106,7 @@ public class WorldeditWrapper14 implements WorldeditWrapper.IWorldeditWrapper {
|
|||||||
ch.setTransform(aT);
|
ch.setTransform(aT);
|
||||||
Operations.completeBlindly(ch.createPaste(e).to(BukkitAdapter.asVector(position).add(
|
Operations.completeBlindly(ch.createPaste(e).to(BukkitAdapter.asVector(position).add(
|
||||||
aT.apply(Vector3.at(offset.getX(), offset.getY(), offset.getZ()).add(clipboard.getOrigin().toVector3()).subtract(clipboard.getMinimumPoint().toVector3()))
|
aT.apply(Vector3.at(offset.getX(), offset.getY(), offset.getZ()).add(clipboard.getOrigin().toVector3()).subtract(clipboard.getMinimumPoint().toVector3()))
|
||||||
).round().toBlockPoint()).build());
|
).toBlockPoint()).build());
|
||||||
e.flushSession();
|
e.flushSession();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -105,7 +105,7 @@ public class WorldeditWrapper8 implements WorldeditWrapper.IWorldeditWrapper {
|
|||||||
ch.setTransform(aT);
|
ch.setTransform(aT);
|
||||||
Operations.completeBlindly(ch.createPaste(e, w.getWorldData()).to(new Vector(position.getX(), position.getY(), position.getZ()).add(
|
Operations.completeBlindly(ch.createPaste(e, w.getWorldData()).to(new Vector(position.getX(), position.getY(), position.getZ()).add(
|
||||||
aT.apply(new Vector(offset.getX(), offset.getY(), offset.getZ()).add(clipboard.getOrigin()).subtract(clipboard.getMinimumPoint()))
|
aT.apply(new Vector(offset.getX(), offset.getY(), offset.getZ()).add(clipboard.getOrigin()).subtract(clipboard.getMinimumPoint()))
|
||||||
).round().toBlockPoint()).build());
|
).toBlockPoint()).build());
|
||||||
e.flushQueue();
|
e.flushQueue();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -30,7 +30,6 @@ import de.steamwar.fightsystem.ArenaMode;
|
|||||||
import de.steamwar.fightsystem.Config;
|
import de.steamwar.fightsystem.Config;
|
||||||
import de.steamwar.fightsystem.FightSystem;
|
import de.steamwar.fightsystem.FightSystem;
|
||||||
import de.steamwar.fightsystem.record.GlobalRecorder;
|
import de.steamwar.fightsystem.record.GlobalRecorder;
|
||||||
import de.steamwar.sql.Schematic;
|
|
||||||
import org.bukkit.Bukkit;
|
import org.bukkit.Bukkit;
|
||||||
import org.bukkit.GameMode;
|
import org.bukkit.GameMode;
|
||||||
import org.bukkit.Sound;
|
import org.bukkit.Sound;
|
||||||
@ -123,16 +122,7 @@ public class Fight {
|
|||||||
Bukkit.getScheduler().runTaskLater(FightSystem.getPlugin(), () -> {
|
Bukkit.getScheduler().runTaskLater(FightSystem.getPlugin(), () -> {
|
||||||
if(!player.isOnline())
|
if(!player.isOnline())
|
||||||
return;
|
return;
|
||||||
PacketContainer gm1packet = ProtocolLibrary.getProtocolManager().createPacket(PacketType.Play.Server.PLAYER_INFO);
|
pseudoSpectator(player, true);
|
||||||
gm1packet.getPlayerInfoAction().write(0, EnumWrappers.PlayerInfoAction.UPDATE_GAME_MODE);
|
|
||||||
List<PlayerInfoData> playerInfoActions = new ArrayList<>();
|
|
||||||
playerInfoActions.add(new PlayerInfoData(WrappedGameProfile.fromPlayer(player), 1, EnumWrappers.NativeGameMode.CREATIVE, WrappedChatComponent.fromText(player.getDisplayName())));
|
|
||||||
gm1packet.getPlayerInfoDataLists().write(0, playerInfoActions);
|
|
||||||
try {
|
|
||||||
ProtocolLibrary.getProtocolManager().sendServerPacket(player, gm1packet);
|
|
||||||
} catch (InvocationTargetException e) {
|
|
||||||
Bukkit.getLogger().log(Level.SEVERE, "Invocation target exception", e);
|
|
||||||
}
|
|
||||||
}, 2);
|
}, 2);
|
||||||
}else if(gameMode == GameMode.SURVIVAL) {
|
}else if(gameMode == GameMode.SURVIVAL) {
|
||||||
for(Player currentPlayer : Bukkit.getServer().getOnlinePlayers()) {
|
for(Player currentPlayer : Bukkit.getServer().getOnlinePlayers()) {
|
||||||
@ -144,6 +134,19 @@ public class Fight {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static void pseudoSpectator(Player player, boolean enable) {
|
||||||
|
PacketContainer gm1packet = ProtocolLibrary.getProtocolManager().createPacket(PacketType.Play.Server.PLAYER_INFO);
|
||||||
|
gm1packet.getPlayerInfoAction().write(0, EnumWrappers.PlayerInfoAction.UPDATE_GAME_MODE);
|
||||||
|
List<PlayerInfoData> playerInfoActions = new ArrayList<>();
|
||||||
|
playerInfoActions.add(new PlayerInfoData(WrappedGameProfile.fromPlayer(player), 1, enable ? EnumWrappers.NativeGameMode.CREATIVE : EnumWrappers.NativeGameMode.SPECTATOR, WrappedChatComponent.fromText(player.getDisplayName())));
|
||||||
|
gm1packet.getPlayerInfoDataLists().write(0, playerInfoActions);
|
||||||
|
try {
|
||||||
|
ProtocolLibrary.getProtocolManager().sendServerPacket(player, gm1packet);
|
||||||
|
} catch (InvocationTargetException e) {
|
||||||
|
Bukkit.getLogger().log(Level.SEVERE, "Invocation target exception", e);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
public static int getMaxRank(){
|
public static int getMaxRank(){
|
||||||
/* MaxRank of 0 is Pubonly*/
|
/* MaxRank of 0 is Pubonly*/
|
||||||
if(Config.OnlyPublicSchematics){
|
if(Config.OnlyPublicSchematics){
|
||||||
@ -159,22 +162,6 @@ public class Fight {
|
|||||||
return 1000;
|
return 1000;
|
||||||
}
|
}
|
||||||
|
|
||||||
if(Config.RanksEnabled)
|
return Math.min(redTeam.getSchemRank(), blueTeam.getSchemRank());
|
||||||
return Math.min(schemRank(redTeam.getLeader()), schemRank(blueTeam.getLeader()));
|
|
||||||
else if(Schematic.getSchemsOfType(redTeam.getLeader().getPlayer().getUniqueId(), Config.SchematicType).isEmpty() ||
|
|
||||||
Schematic.getSchemsOfType(blueTeam.getLeader().getPlayer().getUniqueId(), Config.SchematicType).isEmpty())
|
|
||||||
return 0;
|
|
||||||
else
|
|
||||||
return 1;
|
|
||||||
}
|
|
||||||
|
|
||||||
private static int schemRank(FightPlayer fightPlayer){
|
|
||||||
int rank = 1;
|
|
||||||
List<Schematic> schematics = Schematic.getSchemsOfType(fightPlayer.getPlayer().getUniqueId(), Config.SchematicType);
|
|
||||||
for(Schematic schem : schematics){
|
|
||||||
if(schem.getRank() > rank)
|
|
||||||
rank = schem.getRank();
|
|
||||||
}
|
|
||||||
return rank;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -135,8 +135,8 @@ public class FightSchematic extends StateDependent {
|
|||||||
-(Config.PasteAligned && Config.BlueToRedX != 0 ? region.getSizeX() : dims.getBlockX())/2.0,
|
-(Config.PasteAligned && Config.BlueToRedX != 0 ? region.getSizeX() : dims.getBlockX())/2.0,
|
||||||
Config.WaterDepth != 0 ? Config.WaterDepth - WorldeditWrapper.impl.getWaterDepth(clipboard) : 0,
|
Config.WaterDepth != 0 ? Config.WaterDepth - WorldeditWrapper.impl.getWaterDepth(clipboard) : 0,
|
||||||
-(Config.PasteAligned && Config.BlueToRedZ != 0 ? region.getSizeZ() : dims.getBlockZ())/2.0
|
-(Config.PasteAligned && Config.BlueToRedZ != 0 ? region.getSizeZ() : dims.getBlockZ())/2.0
|
||||||
),
|
).add(new Vector(rotate ? 1 : 0, 0, rotate ? 1 : 0)),
|
||||||
new AffineTransform().rotateY(rotate ? 180 : 0).translate(rotate ? 0.5 : 0, 0, rotate ? 0.5 : 0)
|
new AffineTransform().rotateY(rotate ? 180 : 0)
|
||||||
);
|
);
|
||||||
|
|
||||||
Bukkit.getScheduler().runTaskLater(FightSystem.getPlugin(), freezer::disable, 3);
|
Bukkit.getScheduler().runTaskLater(FightSystem.getPlugin(), freezer::disable, 3);
|
||||||
|
@ -48,6 +48,8 @@ public class FightTeam {
|
|||||||
|
|
||||||
private UUID designatedLeader;
|
private UUID designatedLeader;
|
||||||
private FightPlayer leader;
|
private FightPlayer leader;
|
||||||
|
private int schemRank;
|
||||||
|
|
||||||
private final Map<Player, FightPlayer> players = new HashMap<>();
|
private final Map<Player, FightPlayer> players = new HashMap<>();
|
||||||
private final Set<Player> invited = new HashSet<>();
|
private final Set<Player> invited = new HashSet<>();
|
||||||
|
|
||||||
@ -69,6 +71,7 @@ public class FightTeam {
|
|||||||
this.spawn = spawn;
|
this.spawn = spawn;
|
||||||
this.schemRegion = schemRegion;
|
this.schemRegion = schemRegion;
|
||||||
this.extendRegion = extendRegion;
|
this.extendRegion = extendRegion;
|
||||||
|
this.schemRank = 0;
|
||||||
this.ready = false;
|
this.ready = false;
|
||||||
this.skip = false;
|
this.skip = false;
|
||||||
this.blue = blue;
|
this.blue = blue;
|
||||||
@ -112,6 +115,10 @@ public class FightTeam {
|
|||||||
return isLeaderless() && (designatedLeader == null || designatedLeader.equals(p.getUniqueId()));
|
return isLeaderless() && (designatedLeader == null || designatedLeader.equals(p.getUniqueId()));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public int getSchemRank() {
|
||||||
|
return schemRank;
|
||||||
|
}
|
||||||
|
|
||||||
public void teleportToSpawn(){
|
public void teleportToSpawn(){
|
||||||
players.forEach((player, fp) -> player.teleport(spawn));
|
players.forEach((player, fp) -> player.teleport(spawn));
|
||||||
}
|
}
|
||||||
@ -258,6 +265,12 @@ public class FightTeam {
|
|||||||
if(ready)
|
if(ready)
|
||||||
setReady(false);
|
setReady(false);
|
||||||
|
|
||||||
|
Optional<Integer> maxRank = Schematic.getSchemsOfType(leader.getPlayer().getUniqueId(), Config.SchematicType).stream().map(Schematic::getRank).max(Integer::compare);
|
||||||
|
if(Config.RanksEnabled)
|
||||||
|
schemRank = maxRank.orElse(1);
|
||||||
|
else
|
||||||
|
schemRank = maxRank.isPresent() ? 1 : 0;
|
||||||
|
|
||||||
if(!Config.PersonalKits)
|
if(!Config.PersonalKits)
|
||||||
leader.setKit(Kit.getKitByName(Config.LeaderDefault));
|
leader.setKit(Kit.getKitByName(Config.LeaderDefault));
|
||||||
|
|
||||||
|
@ -26,15 +26,18 @@ import de.steamwar.fightsystem.fight.Fight;
|
|||||||
import de.steamwar.fightsystem.fight.FightTeam;
|
import de.steamwar.fightsystem.fight.FightTeam;
|
||||||
import de.steamwar.fightsystem.states.FightState;
|
import de.steamwar.fightsystem.states.FightState;
|
||||||
import de.steamwar.fightsystem.states.StateDependentListener;
|
import de.steamwar.fightsystem.states.StateDependentListener;
|
||||||
|
import de.steamwar.fightsystem.utils.Region;
|
||||||
import net.md_5.bungee.api.chat.TextComponent;
|
import net.md_5.bungee.api.chat.TextComponent;
|
||||||
import org.bukkit.Bukkit;
|
import org.bukkit.Bukkit;
|
||||||
import org.bukkit.GameMode;
|
import org.bukkit.GameMode;
|
||||||
import org.bukkit.Location;
|
|
||||||
import org.bukkit.entity.Player;
|
import org.bukkit.entity.Player;
|
||||||
import org.bukkit.event.EventHandler;
|
import org.bukkit.event.EventHandler;
|
||||||
import org.bukkit.event.Listener;
|
import org.bukkit.event.Listener;
|
||||||
import org.bukkit.event.player.PlayerMoveEvent;
|
import org.bukkit.event.player.PlayerMoveEvent;
|
||||||
|
import org.bukkit.event.player.PlayerQuitEvent;
|
||||||
|
|
||||||
|
import java.util.HashSet;
|
||||||
|
import java.util.Set;
|
||||||
import java.util.logging.Level;
|
import java.util.logging.Level;
|
||||||
|
|
||||||
public class TeamArea implements Listener {
|
public class TeamArea implements Listener {
|
||||||
@ -42,6 +45,8 @@ public class TeamArea implements Listener {
|
|||||||
private static final String DENY_TEAM = "§cDu darfst nicht zu den Teams";
|
private static final String DENY_TEAM = "§cDu darfst nicht zu den Teams";
|
||||||
private static final String DENY_ENTERN = "§cDu darfst nicht entern";
|
private static final String DENY_ENTERN = "§cDu darfst nicht entern";
|
||||||
|
|
||||||
|
private static final Set<Player> realSpectator = new HashSet<>();
|
||||||
|
|
||||||
public TeamArea() {
|
public TeamArea() {
|
||||||
new StateDependentListener(ArenaMode.AntiTest, FightState.All, this);
|
new StateDependentListener(ArenaMode.AntiTest, FightState.All, this);
|
||||||
}
|
}
|
||||||
@ -52,37 +57,48 @@ public class TeamArea implements Listener {
|
|||||||
if(player == FightSystem.getEventLeiter())
|
if(player == FightSystem.getEventLeiter())
|
||||||
return;
|
return;
|
||||||
|
|
||||||
Location to = event.getTo();
|
|
||||||
assert to != null;
|
|
||||||
|
|
||||||
FightTeam team = Fight.getPlayerTeam(player);
|
FightTeam team = Fight.getPlayerTeam(player);
|
||||||
|
checkInTeamRegion(event, Fight.getBlueTeam(), player, team);
|
||||||
|
checkInTeamRegion(event, Fight.getRedTeam(), player, team);
|
||||||
|
}
|
||||||
|
|
||||||
if(Config.BlueExtendRegion.playerInRegion(to)){
|
@EventHandler
|
||||||
if(team == null)
|
public void playerQuit(PlayerQuitEvent e) {
|
||||||
reset(event, DENY_TEAM);
|
realSpectator.remove(e.getPlayer());
|
||||||
else if(team == Fight.getRedTeam() && (player.getGameMode() == GameMode.SPECTATOR || !team.canPlayerEntern(player)))
|
}
|
||||||
reset(event, DENY_ENTERN);
|
|
||||||
else
|
private void checkInTeamRegion(PlayerMoveEvent event, FightTeam team, Player player, FightTeam playerTeam) {
|
||||||
return; // Is allowed in area
|
boolean spectator = player.getGameMode() == GameMode.SPECTATOR;
|
||||||
checkInInnerArea(event.getPlayer(), to, Fight.getBlueTeam());
|
if(!spectator && playerTeam != null && playerTeam.canPlayerEntern(player))
|
||||||
}else if(Config.RedExtendRegion.playerInRegion(to)){
|
return; // Player can entern
|
||||||
if(team == null)
|
|
||||||
reset(event, DENY_TEAM);
|
Region region = team.getExtendRegion();
|
||||||
else if(team == Fight.getBlueTeam() && (player.getGameMode() == GameMode.SPECTATOR || !team.canPlayerEntern(player)))
|
boolean inRegion = region.playerInRegion(event.getTo());
|
||||||
reset(event, DENY_ENTERN);
|
if(team == playerTeam) {
|
||||||
else
|
if(spectator) {
|
||||||
return; // Is allowed in area
|
realSpectator(inRegion, player);
|
||||||
checkInInnerArea(event.getPlayer(), to, Fight.getRedTeam());
|
} else if (!playerTeam.canPlayerEntern(player) && !inRegion) {
|
||||||
}else{
|
reset(event, DENY_ENTERN); // Leaving prior to entern
|
||||||
if(team != null && player.getGameMode() != GameMode.SPECTATOR && !team.canPlayerEntern(player) && !team.getExtendRegion().in2dRegion(to))
|
}
|
||||||
reset(event, DENY_ENTERN);
|
return; // Always allowed in own region
|
||||||
|
}
|
||||||
|
|
||||||
|
if(inRegion) {
|
||||||
|
reset(event, DENY_TEAM); // Not allowed in region
|
||||||
|
if(team.getSchemRegion().playerInRegion(event.getTo()) && Config.PreperationArea >= 5){ // Preventing false positives due to small extension
|
||||||
|
player.kickPlayer(null);
|
||||||
|
Bukkit.getLogger().log(Level.INFO, player.getName() + " ist in einen Teambereich eingedrungen.");
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private void checkInInnerArea(Player player, Location to, FightTeam team){
|
private void realSpectator(boolean inRegion, Player player) {
|
||||||
if(team.getSchemRegion().playerInRegion(to) && Config.PreperationArea >= 5){ // Preventing false positives due to small extension
|
if(inRegion && !realSpectator.contains(player)) {
|
||||||
player.kickPlayer(null);
|
Fight.pseudoSpectator(player, false);
|
||||||
Bukkit.getLogger().log(Level.INFO, player.getName() + " ist in einen Teambereich eingedrungen.");
|
realSpectator.add(player);
|
||||||
|
}else if(!inRegion && realSpectator.contains(player)) {
|
||||||
|
Fight.pseudoSpectator(player, true);
|
||||||
|
realSpectator.remove(player);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
6
steamwarci.yml
Normale Datei
6
steamwarci.yml
Normale Datei
@ -0,0 +1,6 @@
|
|||||||
|
build:
|
||||||
|
- "ln -s /home/gitea/lib"
|
||||||
|
- "mvn package -B"
|
||||||
|
|
||||||
|
artifacts:
|
||||||
|
"/binarys/fightsystem.jar": "FightSystem_Main/target/fightsystem.jar"
|
In neuem Issue referenzieren
Einen Benutzer sperren