SteamWar/BauSystem
Archiviert
13
0

Hotfix not existing exception (ugly)

Dieser Commit ist enthalten in:
Lixfel 2020-04-08 17:06:01 +02:00
Ursprung 0889b1313b
Commit 4ebe1f40f2

Datei anzeigen

@ -3,6 +3,7 @@ package de.steamwar.bausystem;
import de.steamwar.bausystem.commands.*; import de.steamwar.bausystem.commands.*;
import de.steamwar.bausystem.world.*; import de.steamwar.bausystem.world.*;
import de.steamwar.core.CommandRemover; import de.steamwar.core.CommandRemover;
import de.steamwar.core.Core;
import de.steamwar.scoreboard.SWScoreboard; import de.steamwar.scoreboard.SWScoreboard;
import de.steamwar.sql.SteamwarUser; import de.steamwar.sql.SteamwarUser;
import org.bukkit.Bukkit; import org.bukkit.Bukkit;
@ -20,8 +21,6 @@ import org.bukkit.event.player.PlayerQuitEvent;
import org.bukkit.inventory.ItemStack; import org.bukkit.inventory.ItemStack;
import org.bukkit.inventory.meta.ItemMeta; import org.bukkit.inventory.meta.ItemMeta;
import org.bukkit.plugin.java.JavaPlugin; import org.bukkit.plugin.java.JavaPlugin;
import org.bukkit.potion.PotionEffect;
import org.bukkit.potion.PotionEffectType;
import org.bukkit.scheduler.BukkitTask; import org.bukkit.scheduler.BukkitTask;
import java.io.File; import java.io.File;
@ -282,6 +281,16 @@ public class BauSystem extends JavaPlugin implements Listener {
} }
} }
Player p = (Player) e.getWhoClicked(); Player p = (Player) e.getWhoClicked();
Material material = stack.getType();
if (material == Material.POTION || material == Material.SPLASH_POTION || material == Material.LINGERING_POTION)
stack.setType(Material.MILK_BUCKET);
if(Core.getVersion() < 14){
e.setCurrentItem(stack);
return;
}
if (stack.getItemMeta().hasAttributeModifiers()) { if (stack.getItemMeta().hasAttributeModifiers()) {
ItemMeta meta = stack.getItemMeta(); ItemMeta meta = stack.getItemMeta();
for (Attribute a : Attribute.values()) for (Attribute a : Attribute.values())
@ -289,9 +298,6 @@ public class BauSystem extends JavaPlugin implements Listener {
stack.setItemMeta(meta); stack.setItemMeta(meta);
Bukkit.getLogger().log(Level.SEVERE, "Spieler " + p.getName() + " (" + p.getUniqueId().toString() + ") hat versucht ein Item mit einem Attribute-Modifier zu bekommen."); Bukkit.getLogger().log(Level.SEVERE, "Spieler " + p.getName() + " (" + p.getUniqueId().toString() + ") hat versucht ein Item mit einem Attribute-Modifier zu bekommen.");
} }
Material material = stack.getType();
if (material == Material.POTION || material == Material.SPLASH_POTION || material == Material.LINGERING_POTION)
stack.setType(Material.MILK_BUCKET);
e.setCurrentItem(stack); e.setCurrentItem(stack);
} }
} }