Hotfix kit creation breakout bugs
Signed-off-by: Lixfel <agga-games@gmx.de>
Dieser Commit ist enthalten in:
Ursprung
c7bc8163ed
Commit
043810bb14
@ -124,6 +124,11 @@ public class Fight {
|
||||
return;
|
||||
}
|
||||
|
||||
if(Config.event()){
|
||||
onlyPublicSchems = false;
|
||||
return;
|
||||
}
|
||||
|
||||
if(redTeam.getLeader() == null || redTeam.getLeader().getPlayer() == null ||
|
||||
blueTeam.getLeader() == null || blueTeam.getLeader().getPlayer() == null){
|
||||
onlyPublicSchems = false;
|
||||
|
@ -58,6 +58,20 @@ public class Kit {
|
||||
return memberAllowed;
|
||||
}
|
||||
|
||||
public boolean isStackInKit(ItemStack stack){
|
||||
for(ItemStack is : inventory){
|
||||
if(stack.equals(is))
|
||||
return true;
|
||||
}
|
||||
if(armor != null){
|
||||
for(ItemStack is : armor){
|
||||
if(stack.equals(is))
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
public void loadToPlayer(Player player) {
|
||||
player.getInventory().setContents(inventory);
|
||||
if(armor != null)
|
||||
|
@ -1,9 +1,12 @@
|
||||
package de.steamwar.fightsystem.utils;
|
||||
|
||||
import de.steamwar.core.Core;
|
||||
import de.steamwar.fightsystem.Config;
|
||||
import de.steamwar.fightsystem.FightSystem;
|
||||
import de.steamwar.fightsystem.fight.Fight;
|
||||
import de.steamwar.fightsystem.fight.FightPlayer;
|
||||
import de.steamwar.fightsystem.kit.Kit;
|
||||
import de.steamwar.fightsystem.kit.KitManager;
|
||||
import de.steamwar.sql.PersonalKit;
|
||||
import de.steamwar.sql.SteamwarUser;
|
||||
import org.bukkit.Bukkit;
|
||||
@ -21,6 +24,8 @@ import org.bukkit.inventory.ItemStack;
|
||||
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
import java.util.Objects;
|
||||
import java.util.logging.Level;
|
||||
|
||||
public class PersonalKitCreator implements Listener {
|
||||
|
||||
@ -68,8 +73,26 @@ public class PersonalKitCreator implements Listener {
|
||||
return;
|
||||
|
||||
//Deny bad items
|
||||
if(e.getCursor() != null && Config.ForbiddenItems.contains(e.getCursor().getType().name()))
|
||||
e.setCancelled(true);
|
||||
if(e.getCursor() != null){
|
||||
ItemStack stack = e.getCursor();
|
||||
if(Config.ForbiddenItems.contains(stack.getType().name())){
|
||||
e.setCancelled(true);
|
||||
return;
|
||||
}
|
||||
|
||||
Kit normal = KitManager.getKitByName(Config.MemberDefault);
|
||||
if(!normal.isStackInKit(stack)){
|
||||
if(stack.getEnchantments().size() > 0){
|
||||
e.setCancelled(true);
|
||||
return;
|
||||
}
|
||||
if(Core.getVersion() >= 14 && stack.hasItemMeta() && Objects.requireNonNull(stack.getItemMeta()).hasAttributeModifiers()){
|
||||
e.setCancelled(true);
|
||||
Bukkit.getLogger().log(Level.SEVERE, "Spieler " + player.getName() + " hat versucht ein Item mit einem Attribute-Modifier zu bekommen.");
|
||||
return;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//Check for clear
|
||||
if(e.getAction() != InventoryAction.PLACE_ALL)
|
||||
|
In neuem Issue referenzieren
Einen Benutzer sperren