Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- package com.MiracleM4n.InvinciWolf;
- import org.bukkit.ChatColor;
- import org.bukkit.entity.Entity;
- import org.bukkit.entity.Player;
- import org.bukkit.entity.Wolf;
- import org.bukkit.event.player.PlayerInteractEntityEvent;
- import org.bukkit.event.player.PlayerListener;
- public class IWPlayerListener extends PlayerListener {
- InvinciWolf plugin = null;
- public IWPlayerListener(InvinciWolf callbackPlugin) {
- plugin = callbackPlugin;
- }
- public void onPlayerInteractEntity(PlayerInteractEntityEvent event) {
- Player player = event.getPlayer();
- int wolves = 0;
- if (event.getRightClicked() instanceof Wolf) {
- System.out.println("Clicked Is Wolf");
- for (Entity entity : player.getWorld().getEntities()) {
- if ((entity instanceof Wolf) && (((Wolf) entity).isTamed() == true)) {
- System.out.println("Found All Tamed Wolves");
- if (((Wolf) entity).getOwner() == player) {
- System.out.println("Wolves Are Players");
- if (wolves > 10) {
- System.out.println("More Than 10");
- if ((InvinciWolf.Permissions == null && ((player.isOp())) ||
- (InvinciWolf.Permissions != null && InvinciWolf.Permissions.has(player, "invinciwolf.many")))) {
- System.out.println("Permissions Found");
- Wolf wolf = (Wolf) entity;
- System.out.println("Entity Identifier");
- wolf.setTamed(true);
- System.out.println("SetTamed");
- } else {
- player.sendMessage(ChatColor.RED + "[InvinciWolf] You can't own over 10 wolves.");
- Wolf wolf = (Wolf) entity;
- wolf.setTamed(false);
- }
- wolves++;
- }
- }
- }
- }
- }
- }
- }
Add Comment
Please, Sign In to add comment