SteamWar/FightSystem
Archiviert
13
1

Merge branch 'master' into configRefactoring

Dieser Commit ist enthalten in:
Lixfel 2021-12-02 08:51:18 +01:00
Commit f4c66565f6
10 geänderte Dateien mit 44 neuen und 29 gelöschten Zeilen

Datei anzeigen

@ -29,16 +29,19 @@ import java.util.Set;
public class BlockIdWrapper8 implements BlockIdWrapper.IBlockIdWrapper {
@Override
@SuppressWarnings("deprecation")
public int blockToId(Block block) {
return block.getTypeId() << 4 + block.getData();
}
@Override
@SuppressWarnings("deprecation")
public void setBlock(World world, int x, int y, int z, int blockState) {
world.getBlockAt(x, y, z).setTypeIdAndData(blockState >> 4, (byte)(blockState & 0b1111), false);
}
@Override
@SuppressWarnings("deprecation")
public Set<Integer> getHiddenBlockIds() {
Set<Integer> hiddenBlockIds = new HashSet<>();
for(String tag : Config.HiddenBlocks){
@ -48,6 +51,7 @@ public class BlockIdWrapper8 implements BlockIdWrapper.IBlockIdWrapper {
}
@Override
@SuppressWarnings("deprecation")
public int getObfuscateWith() {
return Material.matchMaterial(Config.ObfuscateWith).getId() << 4;
}

Datei anzeigen

@ -139,8 +139,8 @@ KIT_DELETION_DELETE=
NO_ARENA_LEAVING=§cDu darfst die Arena nicht verlassen
CHECK_JOIN_DENIED=§cAuf diesem Server wird momentan eine Schematic geprüft!
CHECK_COMMAND_LOCKED=§cDieser Befehl ist beim Prüfen gesperrt! Admin wird benachrichtigt.
NO_BLOCK_BREAK=§cDu darfst derzeit keine Blöcke abbauen
NO_BLOCK_PLACE=§cDu darfst derzeit keine Blöcke setzen
NO_BLOCK_BREAK=§cDu darfst hier derzeit keine Blöcke abbauen
NO_BLOCK_PLACE=§cDu darfst hier derzeit keine Blöcke setzen
NO_BOW_USAGE=§cDu darfst den Bogen erst nach Kampfbeginn nutzen
NO_PARTICIPANT=§cDu bist kein Kampfteilnehmer
NO_FRIENDLY_FIRE=§cDu darfst deinen Teamkollegen keinen Schaden zufügen
@ -188,7 +188,7 @@ BAR_PRE_LEADER=
BAR_PRE_SCHEM={1} §7Schemauswahl {0} {2}
BAR_PREPARE={1} {3} §7Vorbereitung {0} {4} {2}
BAR_PRE_RUNNING={1} {3} §7Kampfbeginn in {0} {4} {2}
BAR_RUNNING0={1} {3} lW {0} rW {4} {2}
BAR_RUNNING0={1} {3} {0} {4} {2}
BAR_RUNNING1={1} {3} {5} {0} {6} {4} {2}
BAR_RUNNING2={1} {3} {5} {7} {0} {6} {8} {4} {2}
BAR_RUNNING3={1} {3} {5} {7} {9} {0} {6} {8} {10} {4} {2}
@ -205,7 +205,7 @@ BAR_WATER={0}
HELLS_BELLS_COUNTDOWN=bis die Bomben fallen
TECHKO_COUNTDOWN=bis {0} §7einen Schuss abgegeben haben muss
WIN_FIGHTLEADER="§7Kampfleiterentscheidung"
WIN_FIGHTLEADER=§7Kampfleiterentscheidung
WIN_PERCENT={0} §7zu beschädigt
WIN_OFFLINE_BOTH=§7Beide Teams offline
WIN_OFFLINE={0} §7offline

Datei anzeigen

@ -139,7 +139,7 @@ public class GUI {
anvilInv.setItem(Material.LEATHER_CHESTPLATE);
anvilInv.setCallback(s -> {
SteamwarUser user = SteamwarUser.get(p.getUniqueId());
if(PersonalKit.nameInUse(user.getId(), Config.SchematicType.toDB(), s)) {
if(PersonalKit.get(user.getId(), Config.SchematicType.toDB(), s) != null) {
msg.sendPrefixless("KITNAME_IN_USE", p, ChatMessageType.ACTION_BAR);
p.closeInventory();
return;

Datei anzeigen

@ -63,8 +63,6 @@ public class ArenaBorder implements Listener {
player.damage(2);
else if(!Config.GroundWalkable)
player.teleport(team.getSpawn());
}else if(to.getY() + 1.8 > Config.ArenaRegion.getMaxY()){
reset(event);
}
}

Datei anzeigen

@ -49,7 +49,6 @@ public class HotbarGUI implements Listener {
if(event.getItem() == null)
return;
event.setCancelled(true);
FightTeam fightTeam = Fight.getPlayerTeam(player);
if(fightTeam == null)
return;
@ -60,6 +59,7 @@ public class HotbarGUI implements Listener {
if(displayName == null)
return;
event.setCancelled(true);
onMatch(player, displayName, "CHOOSE_SCHEMATIC", () -> GUI.preSchemDialog(player), Config.GameName);
onMatch(player, displayName, "INVITE_PLAYERS", () -> GUI.chooseInvitation(player));
onMatch(player, displayName, "REMOVE_PLAYERS", () -> GUI.chooseRemove(player));

Datei anzeigen

@ -29,33 +29,27 @@ import org.bukkit.event.block.BlockDispenseEvent;
import org.bukkit.event.inventory.InventoryClickEvent;
import org.bukkit.event.inventory.InventoryDragEvent;
import org.bukkit.event.inventory.InventoryType;
import org.bukkit.inventory.Inventory;
import org.bukkit.inventory.ItemStack;
import java.util.Collections;
import java.util.EnumSet;
import java.util.Set;
public class InFightInventory implements Listener {
private static final Set<Material> allowed = Collections.unmodifiableSet(EnumSet.of(Material.TNT, Material.AIR));
public InFightInventory() {
new StateDependentListener(ArenaMode.AntiReplay, FightState.Ingame, this);
}
@EventHandler
public void onInventoryClick(InventoryClickEvent event) {
Inventory clicked = event.getClickedInventory();
if(event.getClick().isShiftClick()){
ItemStack clickedOn = event.getCurrentItem();
InventoryType top = event.getView().getTopInventory().getType();
if(top == InventoryType.CRAFTING)
return;
if(
clickedOn != null &&
event.getView().getTopInventory().getType() != InventoryType.CRAFTING &&
clicked == event.getWhoClicked().getInventory())
event.setCancelled(true);
}else if (
clicked != event.getWhoClicked().getInventory() &&
clicked != null &&
clicked.getType() != InventoryType.PLAYER &&
event.getCursor() != null &&
event.getCursor().getType() != Material.AIR)
event.setCancelled(true);
if ((event.getCursor() != null && !allowed.contains(event.getCursor().getType())) || (event.getCurrentItem() != null && !allowed.contains(event.getCurrentItem().getType())))
event.setCancelled(true); // Deny if transferred item is not TNT
}
@EventHandler

Datei anzeigen

@ -19,6 +19,7 @@
package de.steamwar.fightsystem.listener;
import de.steamwar.fightsystem.ArenaMode;
import de.steamwar.fightsystem.Config;
import de.steamwar.fightsystem.states.FightState;
import de.steamwar.fightsystem.states.StateDependentListener;
@ -32,8 +33,10 @@ public class PistonListener implements Listener {
public PistonListener() {
//Wenn Entern aktiv ist, sollen Raketen etc. entern können
new StateDependentListener(Config.EnterStages.isEmpty(), FightState.All, this);
new StateDependentListener(!Config.EnterStages.isEmpty(), FightState.Setup, this);
if(!ArenaMode.Check.contains(Config.mode)) {
new StateDependentListener(Config.EnterStages.isEmpty(), FightState.All, this);
new StateDependentListener(!Config.EnterStages.isEmpty(), FightState.Setup, this);
}
}
@EventHandler

Datei anzeigen

@ -30,9 +30,11 @@ import de.steamwar.fightsystem.utils.Region;
import net.md_5.bungee.api.ChatMessageType;
import org.bukkit.Bukkit;
import org.bukkit.GameMode;
import org.bukkit.block.Block;
import org.bukkit.entity.Player;
import org.bukkit.event.EventHandler;
import org.bukkit.event.Listener;
import org.bukkit.event.block.BlockPlaceEvent;
import org.bukkit.event.player.PlayerMoveEvent;
import org.bukkit.event.player.PlayerQuitEvent;
@ -64,13 +66,24 @@ public class TeamArea implements Listener {
realSpectator.remove(e.getPlayer());
}
@EventHandler
public void blockPlace(BlockPlaceEvent event) {
Player player = event.getPlayer();
Block block = event.getBlock();
if(Config.BlueExtendRegion.inRegion(block) || Config.RedExtendRegion.inRegion(block))
return;
event.setCancelled(true);
FightSystem.getMessage().sendPrefixless("NO_BLOCK_PLACE", player, ChatMessageType.ACTION_BAR);
}
private void checkInTeamRegion(PlayerMoveEvent event, FightTeam team, Player player, FightTeam playerTeam) {
boolean spectator = player.getGameMode() == GameMode.SPECTATOR;
if(!spectator && playerTeam != null && playerTeam.canPlayerEntern(player))
return; // Player can entern
Region region = team.getExtendRegion();
boolean inRegion = region.playerInRegion(event.getTo());
boolean inRegion = region.in2dRegion(event.getTo());
if(team == playerTeam) {
if(spectator) {
realSpectator(inRegion, player);
@ -80,7 +93,7 @@ public class TeamArea implements Listener {
return; // Always allowed in own region
}
if(inRegion) {
if(region.playerInRegion(event.getTo())) {
reset(event, "NO_TEAMAREA"); // Not allowed in region
if(team.getSchemRegion().playerInRegion(event.getTo()) && Config.PreperationArea >= 5){ // Preventing false positives due to small extension
player.kickPlayer(null);

Datei anzeigen

@ -41,6 +41,8 @@ public class ItemBuilder {
item = new ItemStack(matrial, amount);
meta = item.getItemMeta();
}
@SuppressWarnings("deprecation")
public ItemBuilder(Material matrial, short subid) {
item = new ItemStack(matrial, 1, subid);
meta = item.getItemMeta();

Datei anzeigen

@ -24,6 +24,7 @@
<configuration>
<source>1.8</source>
<target>1.8</target>
<compilerArgs>-Xlint</compilerArgs>
</configuration>
</plugin>
<plugin>