Resetting Kit creator with creative inventory clear, FightTeam nametag fix for 1.15 #122
@ -13,7 +13,7 @@ class FightTeam_10 {
|
|||||||
private FightTeam_10(){}
|
private FightTeam_10(){}
|
||||||
|
|
||||||
static void setTeamColor(Team team, ChatColor color) {
|
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){
|
static void replaceTeamColor(EditSession e, DyeColor c, int cornerX, int cornerY, int cornerZ){
|
||||||
|
@ -33,6 +33,7 @@ class FightTeam_12 {
|
|||||||
|
|
||||||
static void setTeamColor(Team team, ChatColor color){
|
static void setTeamColor(Team team, ChatColor color){
|
||||||
team.setColor(color);
|
team.setColor(color);
|
||||||
|
team.setOption(Team.Option.NAME_TAG_VISIBILITY, Team.OptionStatus.FOR_OWN_TEAM);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -39,6 +39,7 @@ class FightTeam_14 {
|
|||||||
|
|
||||||
static void setTeamColor(Team team, ChatColor color){
|
static void setTeamColor(Team team, ChatColor color){
|
||||||
team.setColor(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){
|
static void replaceTeamColor(EditSession e, DyeColor c, int cornerX, int cornerY, int cornerZ){
|
||||||
|
@ -14,6 +14,7 @@ class FightTeam_9 {
|
|||||||
|
|
||||||
static void setTeamColor(Team team, ChatColor color){
|
static void setTeamColor(Team team, ChatColor color){
|
||||||
FightTeam_8.setTeamColor(team, 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){
|
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 {
|
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);
|
return FightTeam_8.pasteSchematic(schematic, pasteX, pasteY, pasteZ, rotate);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -43,13 +43,13 @@ public class FreezeWorldStateListener extends BasicListener {
|
|||||||
|
|
||||||
@EventHandler
|
@EventHandler
|
||||||
public void onInventoryClick(InventoryClickEvent event) {
|
public void onInventoryClick(InventoryClickEvent event) {
|
||||||
if(!PersonalKitCreator.inKitCreator(event.getWhoClicked()))
|
if(PersonalKitCreator.notInKitCreator(event.getWhoClicked()))
|
||||||
event.setCancelled(true);
|
event.setCancelled(true);
|
||||||
}
|
}
|
||||||
|
|
||||||
@EventHandler
|
@EventHandler
|
||||||
public void onInventoryDrag(InventoryDragEvent event) {
|
public void onInventoryDrag(InventoryDragEvent event) {
|
||||||
if(!PersonalKitCreator.inKitCreator(event.getWhoClicked()))
|
if(PersonalKitCreator.notInKitCreator(event.getWhoClicked()))
|
||||||
event.setCancelled(true);
|
event.setCancelled(true);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -13,6 +13,7 @@ import org.bukkit.entity.Player;
|
|||||||
import org.bukkit.event.EventHandler;
|
import org.bukkit.event.EventHandler;
|
||||||
import org.bukkit.event.HandlerList;
|
import org.bukkit.event.HandlerList;
|
||||||
import org.bukkit.event.Listener;
|
import org.bukkit.event.Listener;
|
||||||
|
import org.bukkit.event.inventory.InventoryAction;
|
||||||
import org.bukkit.event.inventory.InventoryClickEvent;
|
import org.bukkit.event.inventory.InventoryClickEvent;
|
||||||
import org.bukkit.event.inventory.InventoryCloseEvent;
|
import org.bukkit.event.inventory.InventoryCloseEvent;
|
||||||
import org.bukkit.event.player.PlayerMoveEvent;
|
import org.bukkit.event.player.PlayerMoveEvent;
|
||||||
@ -57,14 +58,31 @@ public class PersonalKitCreator implements Listener {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public static boolean inKitCreator(HumanEntity player){
|
public static boolean notInKitCreator(HumanEntity player){
|
||||||
return openKitCreators.containsKey(player);
|
return !openKitCreators.containsKey(player);
|
||||||
}
|
}
|
||||||
|
|
||||||
@EventHandler
|
@EventHandler
|
||||||
public void onInventoryClick(InventoryClickEvent e){
|
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()))
|
if(e.getCursor() != null && Config.ForbiddenItems.contains(e.getCursor().getType().name()))
|
||||||
e.setCancelled(true);
|
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
|
@EventHandler
|
||||||
|
In neuem Issue referenzieren
Einen Benutzer sperren