mirror of
https://github.com/mcMMO-Dev/mcMMO.git
synced 2024-11-25 06:36:45 +01:00
Eggs no longer spawn chickens. :D
This commit is contained in:
parent
1b15828d08
commit
abe01a84e5
@ -1,5 +1,6 @@
|
|||||||
package com.gmail.nossr50.listeners;
|
package com.gmail.nossr50.listeners;
|
||||||
|
|
||||||
|
import org.bukkit.Location;
|
||||||
import org.bukkit.Material;
|
import org.bukkit.Material;
|
||||||
import org.bukkit.entity.Entity;
|
import org.bukkit.entity.Entity;
|
||||||
import org.bukkit.entity.EntityType;
|
import org.bukkit.entity.EntityType;
|
||||||
@ -164,13 +165,24 @@ public class mcEntityListener implements Listener {
|
|||||||
*
|
*
|
||||||
* @param event The event to monitor
|
* @param event The event to monitor
|
||||||
*/
|
*/
|
||||||
@EventHandler (priority = EventPriority.MONITOR)
|
@EventHandler (priority = EventPriority.LOW)
|
||||||
public void onCreatureSpawn(CreatureSpawnEvent event) {
|
public void onCreatureSpawn(CreatureSpawnEvent event) {
|
||||||
SpawnReason reason = event.getSpawnReason();
|
SpawnReason reason = event.getSpawnReason();
|
||||||
|
|
||||||
if ((reason.equals(SpawnReason.SPAWNER) || reason.equals(SpawnReason.SPAWNER_EGG)) && !LoadProperties.xpGainsMobSpawners) {
|
if ((reason.equals(SpawnReason.SPAWNER) || reason.equals(SpawnReason.SPAWNER_EGG)) && !LoadProperties.xpGainsMobSpawners) {
|
||||||
event.getEntity().setMetadata("mcmmoFromMobSpawner", new FixedMetadataValue(plugin, true));
|
event.getEntity().setMetadata("mcmmoFromMobSpawner", new FixedMetadataValue(plugin, true));
|
||||||
}
|
}
|
||||||
|
else if (event.getSpawnReason().equals(SpawnReason.EGG)) {
|
||||||
|
Location eLoc = event.getLocation();
|
||||||
|
|
||||||
|
for (Entity projectile : plugin.projectileTracker) {
|
||||||
|
Location pLoc = projectile.getLocation();
|
||||||
|
|
||||||
|
if (pLoc.getX() == eLoc.getX() && pLoc.getY() == eLoc.getY() && pLoc.getZ() == eLoc.getZ()) {
|
||||||
|
event.setCancelled(true);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -320,25 +332,13 @@ public class mcEntityListener implements Listener {
|
|||||||
/**
|
/**
|
||||||
* Monitor ProjectileHit events.
|
* Monitor ProjectileHit events.
|
||||||
*
|
*
|
||||||
* @param event The event to monitor
|
* @param event The event to watch
|
||||||
*/
|
*/
|
||||||
|
@EventHandler (priority = EventPriority.MONITOR)
|
||||||
public void onProjectileHit(ProjectileHitEvent event) {
|
public void onProjectileHit(ProjectileHitEvent event) {
|
||||||
if (!event.getEntity().hasMetadata("mcmmoFiredFromStaff")) {
|
Entity projectile = event.getEntity();
|
||||||
return;
|
if (plugin.projectileTracker.contains(projectile)) {
|
||||||
}
|
plugin.projectileTracker.remove(projectile);
|
||||||
|
|
||||||
switch (event.getEntityType()) {
|
|
||||||
case EGG:
|
|
||||||
break;
|
|
||||||
|
|
||||||
case FIREBALL:
|
|
||||||
break;
|
|
||||||
|
|
||||||
case SNOWBALL:
|
|
||||||
break;
|
|
||||||
|
|
||||||
default:
|
|
||||||
break;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -23,6 +23,7 @@ import java.io.FileWriter;
|
|||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
import java.io.InputStream;
|
import java.io.InputStream;
|
||||||
import java.util.HashMap;
|
import java.util.HashMap;
|
||||||
|
import java.util.HashSet;
|
||||||
|
|
||||||
import org.bukkit.Bukkit;
|
import org.bukkit.Bukkit;
|
||||||
import org.bukkit.OfflinePlayer;
|
import org.bukkit.OfflinePlayer;
|
||||||
@ -48,8 +49,11 @@ public class mcMMO extends JavaPlugin {
|
|||||||
|
|
||||||
//Alias - Command
|
//Alias - Command
|
||||||
public HashMap<String, String> aliasMap = new HashMap<String, String>();
|
public HashMap<String, String> aliasMap = new HashMap<String, String>();
|
||||||
|
|
||||||
|
//Various trackers
|
||||||
public HashMap<Entity, Integer> arrowTracker = new HashMap<Entity, Integer>();
|
public HashMap<Entity, Integer> arrowTracker = new HashMap<Entity, Integer>();
|
||||||
public HashMap<Integer, Player> tntTracker = new HashMap<Integer, Player>();
|
public HashMap<Integer, Player> tntTracker = new HashMap<Integer, Player>();
|
||||||
|
public HashSet<Entity> projectileTracker = new HashSet<Entity>();
|
||||||
|
|
||||||
public static Database database = null;
|
public static Database database = null;
|
||||||
|
|
||||||
|
@ -59,7 +59,7 @@ public class Staves {
|
|||||||
* @param plugin mcMMO plugin instance
|
* @param plugin mcMMO plugin instance
|
||||||
*/
|
*/
|
||||||
public static void altFire(Material type, Player attacker, mcMMO plugin) {
|
public static void altFire(Material type, Player attacker, mcMMO plugin) {
|
||||||
Projectile projectile = null;
|
Projectile projectile;
|
||||||
|
|
||||||
switch (type) {
|
switch (type) {
|
||||||
case BLAZE_ROD:
|
case BLAZE_ROD:
|
||||||
@ -75,9 +75,10 @@ public class Staves {
|
|||||||
break;
|
break;
|
||||||
|
|
||||||
default:
|
default:
|
||||||
break;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
plugin.projectileTracker.add(projectile);
|
||||||
projectile.setMetadata("mcmmoFiredFromStaff", new FixedMetadataValue(plugin, true));
|
projectile.setMetadata("mcmmoFiredFromStaff", new FixedMetadataValue(plugin, true));
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -119,6 +120,7 @@ public class Staves {
|
|||||||
duration = (TICKS_PER_SECOND * MAX_SPEED_DURATION_SECONDS);
|
duration = (TICKS_PER_SECOND * MAX_SPEED_DURATION_SECONDS);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
shooter.setLevel(shooter.getLevel() - 2);
|
||||||
target.addPotionEffect(new PotionEffect(type, duration, amplifier));
|
target.addPotionEffect(new PotionEffect(type, duration, amplifier));
|
||||||
|
|
||||||
if (type.equals(PotionEffectType.SLOW)) {
|
if (type.equals(PotionEffectType.SLOW)) {
|
||||||
|
Loading…
Reference in New Issue
Block a user