SteamWar/FightSystem
Archiviert
13
1

Merge branch 'kitreset' of SteamWar/FightSystem into master

Dieser Commit ist enthalten in:
Lixfel 2020-04-01 12:56:12 +02:00 committet von Gitea
Commit c7bc8163ed
6 geänderte Dateien mit 28 neuen und 5 gelöschten Zeilen

Datei anzeigen

@ -13,7 +13,7 @@ class FightTeam_10 {
private FightTeam_10(){}
static void setTeamColor(Team team, ChatColor color) {
FightTeam_8.setTeamColor(team, color);
FightTeam_9.setTeamColor(team, color);
}
static void replaceTeamColor(EditSession e, DyeColor c, int cornerX, int cornerY, int cornerZ){

Datei anzeigen

@ -33,6 +33,7 @@ class FightTeam_12 {
static void setTeamColor(Team team, ChatColor color){
team.setColor(color);
team.setOption(Team.Option.NAME_TAG_VISIBILITY, Team.OptionStatus.FOR_OWN_TEAM);
}

Datei anzeigen

@ -39,6 +39,7 @@ class FightTeam_14 {
static void setTeamColor(Team team, ChatColor color){
team.setColor(color);
team.setOption(Team.Option.NAME_TAG_VISIBILITY, Team.OptionStatus.FOR_OWN_TEAM);
}
static void replaceTeamColor(EditSession e, DyeColor c, int cornerX, int cornerY, int cornerZ){

Datei anzeigen

@ -14,6 +14,7 @@ class FightTeam_9 {
static void setTeamColor(Team team, ChatColor color){
FightTeam_8.setTeamColor(team, color);
team.setOption(Team.Option.NAME_TAG_VISIBILITY, Team.OptionStatus.FOR_OWN_TEAM);
}
static void replaceTeamColor(EditSession e, DyeColor c, int cornerX, int cornerY, int cornerZ){
@ -23,4 +24,6 @@ class FightTeam_9 {
static EditSession pasteSchematic(Schematic schematic, int pasteX, int pasteY, int pasteZ, boolean rotate) throws Schematic.WrongVersionException, IOException, NoClipboardException {
return FightTeam_8.pasteSchematic(schematic, pasteX, pasteY, pasteZ, rotate);
}
}

Datei anzeigen

@ -43,13 +43,13 @@ public class FreezeWorldStateListener extends BasicListener {
@EventHandler
public void onInventoryClick(InventoryClickEvent event) {
if(!PersonalKitCreator.inKitCreator(event.getWhoClicked()))
if(PersonalKitCreator.notInKitCreator(event.getWhoClicked()))
event.setCancelled(true);
}
@EventHandler
public void onInventoryDrag(InventoryDragEvent event) {
if(!PersonalKitCreator.inKitCreator(event.getWhoClicked()))
if(PersonalKitCreator.notInKitCreator(event.getWhoClicked()))
event.setCancelled(true);
}

Datei anzeigen

@ -13,6 +13,7 @@ import org.bukkit.entity.Player;
import org.bukkit.event.EventHandler;
import org.bukkit.event.HandlerList;
import org.bukkit.event.Listener;
import org.bukkit.event.inventory.InventoryAction;
import org.bukkit.event.inventory.InventoryClickEvent;
import org.bukkit.event.inventory.InventoryCloseEvent;
import org.bukkit.event.player.PlayerMoveEvent;
@ -57,14 +58,31 @@ public class PersonalKitCreator implements Listener {
}
}
public static boolean inKitCreator(HumanEntity player){
return openKitCreators.containsKey(player);
public static boolean notInKitCreator(HumanEntity player){
return !openKitCreators.containsKey(player);
}
@EventHandler
public void onInventoryClick(InventoryClickEvent e){
if(!player.equals(e.getWhoClicked()))
return;
//Deny bad items
if(e.getCursor() != null && Config.ForbiddenItems.contains(e.getCursor().getType().name()))
e.setCancelled(true);
//Check for clear
if(e.getAction() != InventoryAction.PLACE_ALL)
return;
ItemStack[] items = e.getWhoClicked().getInventory().getContents();
for(int i = 0; i < items.length; i++){
ItemStack stack = items[i];
if(stack != null && i != e.getSlot())
return;
}
FightPlayer fightPlayer = Fight.getFightPlayer(player);
assert fightPlayer != null;
Bukkit.getScheduler().runTaskLater(FightSystem.getPlugin(), () -> fightPlayer.getKit().loadToPlayer(player), 1);
}
@EventHandler