first implimentation
Dieser Commit ist enthalten in:
Ursprung
64fdf9bf16
Commit
2ebaeca46b
@ -6,14 +6,22 @@ import de.steamwar.core.CommandRemover;
|
|||||||
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;
|
||||||
|
import org.bukkit.Material;
|
||||||
|
import org.bukkit.attribute.Attribute;
|
||||||
import org.bukkit.configuration.InvalidConfigurationException;
|
import org.bukkit.configuration.InvalidConfigurationException;
|
||||||
|
import org.bukkit.enchantments.Enchantment;
|
||||||
import org.bukkit.entity.Player;
|
import org.bukkit.entity.Player;
|
||||||
import org.bukkit.event.EventHandler;
|
import org.bukkit.event.EventHandler;
|
||||||
import org.bukkit.event.Listener;
|
import org.bukkit.event.Listener;
|
||||||
import org.bukkit.event.entity.PlayerDeathEvent;
|
import org.bukkit.event.entity.PlayerDeathEvent;
|
||||||
|
import org.bukkit.event.inventory.InventoryClickEvent;
|
||||||
import org.bukkit.event.player.PlayerLoginEvent;
|
import org.bukkit.event.player.PlayerLoginEvent;
|
||||||
import org.bukkit.event.player.PlayerQuitEvent;
|
import org.bukkit.event.player.PlayerQuitEvent;
|
||||||
|
import org.bukkit.inventory.ItemStack;
|
||||||
|
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;
|
||||||
@ -259,4 +267,34 @@ public class BauSystem extends JavaPlugin implements Listener {
|
|||||||
if(Bukkit.getOnlinePlayers().isEmpty() || (Bukkit.getOnlinePlayers().size() == 1 && Bukkit.getOnlinePlayers().contains(player)))
|
if(Bukkit.getOnlinePlayers().isEmpty() || (Bukkit.getOnlinePlayers().size() == 1 && Bukkit.getOnlinePlayers().contains(player)))
|
||||||
Bukkit.shutdown();
|
Bukkit.shutdown();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@EventHandler
|
||||||
|
public void onInventoryClick(InventoryClickEvent e) {
|
||||||
|
ItemStack stack = e.getCursor();
|
||||||
|
if (stack == null)
|
||||||
|
return;
|
||||||
|
if (!stack.hasItemMeta())
|
||||||
|
return;
|
||||||
|
if (stack.getItemMeta().hasEnchants()) {
|
||||||
|
for (Enchantment en : Enchantment.values()) {
|
||||||
|
if (stack.getEnchantmentLevel(en) > en.getMaxLevel())
|
||||||
|
stack.removeEnchantment(en);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
Player p = (Player) e.getWhoClicked();
|
||||||
|
if (stack.getItemMeta().hasAttributeModifiers()) {
|
||||||
|
ItemMeta meta = stack.getItemMeta();
|
||||||
|
for (Attribute a : Attribute.values())
|
||||||
|
meta.removeAttributeModifier(a);
|
||||||
|
meta.setDisplayName("We know, that you tried to cheat...");
|
||||||
|
System.out.println("Spieler " + p.getName() + " (UUID: " + p.getUniqueId().toString() + " ) hat versucht ein Item mit AttributeModifiers zu bekommen.");
|
||||||
|
stack.setItemMeta(meta);
|
||||||
|
}
|
||||||
|
Material material = stack.getType();
|
||||||
|
if (material == Material.POTION || material == Material.SPLASH_POTION || material == Material.LINGERING_POTION) {
|
||||||
|
p.addPotionEffect(new PotionEffect(PotionEffectType.NIGHT_VISION, 100000, 1, false, false));
|
||||||
|
stack.setType(Material.MILK_BUCKET);
|
||||||
|
}
|
||||||
|
e.setCurrentItem(stack);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
In neuem Issue referenzieren
Einen Benutzer sperren