Przeglądaj źródła

Changed listener to Highest, reverting some stuff that doesn't work.

nossr50 13 lat temu
rodzic
commit
3d699e612a

+ 0 - 27
src/main/java/com/gmail/nossr50/datatypes/FakeEntityDamageEvent.java

@@ -1,27 +0,0 @@
-/*
-    This file is part of mcMMO.
-
-    mcMMO is free software: you can redistribute it and/or modify
-    it under the terms of the GNU General Public License as published by
-    the Free Software Foundation, either version 3 of the License, or
-    (at your option) any later version.
-
-    mcMMO is distributed in the hope that it will be useful,
-    but WITHOUT ANY WARRANTY; without even the implied warranty of
-    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-    GNU General Public License for more details.
-
-    You should have received a copy of the GNU General Public License
-    along with mcMMO.  If not, see <http://www.gnu.org/licenses/>.
-*/
-package com.gmail.nossr50.datatypes;
-
-import org.bukkit.entity.Entity;
-import org.bukkit.event.entity.EntityDamageEvent;
-
-public class FakeEntityDamageEvent extends EntityDamageEvent {
-    public FakeEntityDamageEvent(Entity damagee, DamageCause cause, int damage) {
-        super(damagee, cause, damage);
-    }
-    private static final long serialVersionUID = 1L;
-}

+ 1 - 0
src/main/java/com/gmail/nossr50/listeners/mcBlockListener.java

@@ -146,6 +146,7 @@ public class mcBlockListener implements Listener
     	ItemStack inhand = player.getItemInHand();
     	ItemStack inhand = player.getItemInHand();
     	if(event.isCancelled())
     	if(event.isCancelled())
     		return;
     		return;
+    	
     	if (event instanceof FakeBlockBreakEvent) 
     	if (event instanceof FakeBlockBreakEvent) 
     		return;
     		return;
     	
     	

+ 2 - 5
src/main/java/com/gmail/nossr50/listeners/mcEntityListener.java

@@ -53,13 +53,9 @@ public class mcEntityListener implements Listener
         this.plugin = plugin;
         this.plugin = plugin;
     }
     }
 
 
-    @EventHandler(priority = EventPriority.LOW)
+    @EventHandler(priority = EventPriority.HIGHEST)
     public void onEntityDamage(EntityDamageEvent event) 
     public void onEntityDamage(EntityDamageEvent event) 
     {
     {
-        //Pass around a fake event to see if any plugins cancel it
-        if(!m.EntityDamageEventSimulate(event.getEntity(), event.getCause(), event.getDamage()))
-            return;
-        
     	if(event.isCancelled())
     	if(event.isCancelled())
     		return;
     		return;
     	
     	
@@ -70,6 +66,7 @@ public class mcEntityListener implements Listener
     		if(eventb.getEntity() instanceof Player && eventb.getDamager() instanceof Player && !event.getEntity().getWorld().getPVP())
     		if(eventb.getEntity() instanceof Player && eventb.getDamager() instanceof Player && !event.getEntity().getWorld().getPVP())
     			return;
     			return;
     	}
     	}
+    	
     	/*
     	/*
     	 * CHECK FOR INVULNERABILITY
     	 * CHECK FOR INVULNERABILITY
     	 */
     	 */

+ 0 - 15
src/main/java/com/gmail/nossr50/m.java

@@ -26,10 +26,8 @@ import org.bukkit.Location;
 import org.bukkit.Material;
 import org.bukkit.Material;
 import org.bukkit.block.Block;
 import org.bukkit.block.Block;
 import org.bukkit.entity.*;
 import org.bukkit.entity.*;
-import org.bukkit.event.entity.EntityDamageEvent.DamageCause;
 import org.bukkit.inventory.ItemStack;
 import org.bukkit.inventory.ItemStack;
 import com.gmail.nossr50.config.*;
 import com.gmail.nossr50.config.*;
-import com.gmail.nossr50.datatypes.FakeEntityDamageEvent;
 import com.gmail.nossr50.datatypes.PlayerProfile;
 import com.gmail.nossr50.datatypes.PlayerProfile;
 import com.gmail.nossr50.datatypes.FakeBlockBreakEvent;
 import com.gmail.nossr50.datatypes.FakeBlockBreakEvent;
 import com.gmail.nossr50.datatypes.SkillType;
 import com.gmail.nossr50.datatypes.SkillType;
@@ -146,19 +144,6 @@ public class m
 			return false; //Return false if something went wrong
 			return false; //Return false if something went wrong
 		}
 		}
 	}
 	}
-	
-	public static boolean EntityDamageEventSimulate(Entity damagee, DamageCause cause, int damage)
-	{
-	    FakeEntityDamageEvent event = new FakeEntityDamageEvent(damagee, cause, damage);
-	    
-	    Bukkit.getServer().getPluginManager().callEvent(event);
-	    if(!event.isCancelled())
-        {
-            return true; //Return true if not cancelled
-        } else {
-            return false; //Return false if cancelled
-        }
-	}
 
 
 	public static void damageTool(Player player, short damage)
 	public static void damageTool(Player player, short damage)
 	{
 	{