SteamWar/FightSystem
Archiviert
13
1

Merge branch 'master' into 1.15TechhiderFullChunk

Dieser Commit ist enthalten in:
Lixfel 2020-04-13 11:55:08 +02:00
Commit 26d8fe4451
3 geänderte Dateien mit 44 neuen und 2 gelöschten Zeilen

Datei anzeigen

@ -124,6 +124,11 @@ public class Fight {
return; return;
} }
if(Config.event()){
onlyPublicSchems = false;
return;
}
if(redTeam.getLeader() == null || redTeam.getLeader().getPlayer() == null || if(redTeam.getLeader() == null || redTeam.getLeader().getPlayer() == null ||
blueTeam.getLeader() == null || blueTeam.getLeader().getPlayer() == null){ blueTeam.getLeader() == null || blueTeam.getLeader().getPlayer() == null){
onlyPublicSchems = false; onlyPublicSchems = false;

Datei anzeigen

@ -58,6 +58,20 @@ public class Kit {
return memberAllowed; 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) { public void loadToPlayer(Player player) {
player.getInventory().setContents(inventory); player.getInventory().setContents(inventory);
if(armor != null) if(armor != null)

Datei anzeigen

@ -1,9 +1,12 @@
package de.steamwar.fightsystem.utils; package de.steamwar.fightsystem.utils;
import de.steamwar.core.Core;
import de.steamwar.fightsystem.Config; import de.steamwar.fightsystem.Config;
import de.steamwar.fightsystem.FightSystem; import de.steamwar.fightsystem.FightSystem;
import de.steamwar.fightsystem.fight.Fight; import de.steamwar.fightsystem.fight.Fight;
import de.steamwar.fightsystem.fight.FightPlayer; 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.PersonalKit;
import de.steamwar.sql.SteamwarUser; import de.steamwar.sql.SteamwarUser;
import org.bukkit.Bukkit; import org.bukkit.Bukkit;
@ -21,6 +24,8 @@ import org.bukkit.inventory.ItemStack;
import java.util.HashMap; import java.util.HashMap;
import java.util.Map; import java.util.Map;
import java.util.Objects;
import java.util.logging.Level;
public class PersonalKitCreator implements Listener { public class PersonalKitCreator implements Listener {
@ -68,8 +73,26 @@ public class PersonalKitCreator implements Listener {
return; return;
//Deny bad items //Deny bad items
if(e.getCursor() != null && Config.ForbiddenItems.contains(e.getCursor().getType().name())) if(e.getCursor() != null){
ItemStack stack = e.getCursor();
if(Config.ForbiddenItems.contains(stack.getType().name())){
e.setCancelled(true); 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 //Check for clear
if(e.getAction() != InventoryAction.PLACE_ALL) if(e.getAction() != InventoryAction.PLACE_ALL)