Permalink
Browse files

Merge pull request #396 from Glitchfinder/master

Fixes and Patches
  • Loading branch information...
Glitchfinder committed Dec 31, 2012
2 parents eed8a57 + 905e92f commit e607e04af47e64067a61d7e205cba14d70ea0949
@@ -447,6 +447,10 @@ public int getPowerLevelCap() {
public double getMagmaCubeXP() { return config.getDouble("Experience.Combat.Multiplier.Magma_Cube", 2.0); }
public double getEnderDragonXP() { return config.getDouble("Experience.Combat.Multiplier.Ender_Dragon", 8.0); }
public double getIronGolemXP() { return config.getDouble("Experience.Combat.Multiplier.Iron_Golem", 2.0); }
+ public double getGiantXP() { return config.getDouble("Experience.Combat.Multiplier.Giant", 4.0); }
+ public double getWitherXP() { return config.getDouble("Experience.Combat.Multiplier.Wither", 7.0); }
+ public double getWitherSkeletonXP() { return config.getDouble("Experience.Combat.Multiplier.Wither_Skeleton", 4.0); }
+ public double getWitchXP() { return config.getDouble("Experience.Combat.Multiplier.Witch", 4.0); }
/* XP Formula Multiplier */
public int getFormulaMultiplierCurve() { return config.getInt("Experience.Formula.Curve_Modifier", 20); }
@@ -184,6 +184,8 @@ public void onEntityDeath(EntityDeathEvent event) {
entity.setFireTicks(0);
BleedTimer.remove(entity);
Archery.arrowRetrievalCheck(entity);
+ mcMMO.p.placeStore.removeSpawnedMob(((Entity) entity));
+ mcMMO.p.placeStore.removeSpawnedPet(((Entity) entity));
}
/**
@@ -196,7 +198,7 @@ public void onCreatureSpawn(CreatureSpawnEvent event) {
SpawnReason reason = event.getSpawnReason();
if ((reason.equals(SpawnReason.SPAWNER) || reason.equals(SpawnReason.SPAWNER_EGG)) && !Config.getInstance().getExperienceGainsMobspawnersEnabled()) {
- event.getEntity().setMetadata("mcmmoFromMobSpawner", new FixedMetadataValue(plugin, true));
+ mcMMO.p.placeStore.addSpawnedMob(((Entity) event.getEntity()));
}
}
@@ -397,7 +399,7 @@ public void onEntityTame(EntityTameEvent event) {
if(player.hasMetadata("NPC")) return; // Check if this player is a Citizens NPC
- if (Permissions.getInstance().taming(player) && !event.getEntity().hasMetadata("mcmmoSummoned")) {
+ if (Permissions.getInstance().taming(player) && !mcMMO.p.placeStore.isSpawnedPet((Entity) event.getEntity())) {
PlayerProfile profile = Users.getProfile(player);
EntityType type = event.getEntityType();
int xp = 0;
@@ -5,6 +5,7 @@
import org.bukkit.event.EventHandler;
import org.bukkit.event.Listener;
+import org.bukkit.event.world.ChunkLoadEvent;
import org.bukkit.event.world.ChunkUnloadEvent;
import org.bukkit.event.world.WorldInitEvent;
import org.bukkit.event.world.WorldSaveEvent;
@@ -46,4 +47,10 @@ public void onWorldSave(WorldSaveEvent event) {
public void onChunkUnload(ChunkUnloadEvent event) {
mcMMO.placeStore.chunkUnloaded(event.getChunk().getX(), event.getChunk().getZ(), event.getWorld());
}
+
+ @EventHandler
+ public void onChunkLoad(ChunkLoadEvent event) {
+ if(event.getChunk().getEntities().length > 0)
+ mcMMO.p.placeStore.loadChunk(event.getChunk().getX(), event.getChunk().getZ(), event.getWorld());
+ }
}
@@ -68,7 +68,7 @@ protected void spawnCreature() {
return;
LivingEntity entity = (LivingEntity) player.getWorld().spawnEntity(player.getLocation(), type);
- entity.setMetadata("mcmmoSummoned", new FixedMetadataValue(mcMMO.p, true));
+ mcMMO.p.placeStore.addSpawnedPet((Entity) entity);
((Tameable) entity).setOwner(player);
@@ -10,6 +10,7 @@
import org.bukkit.entity.IronGolem;
import org.bukkit.entity.LivingEntity;
import org.bukkit.entity.Player;
+import org.bukkit.entity.Skeleton;
import org.bukkit.entity.Tameable;
import org.bukkit.entity.Wolf;
import org.bukkit.event.entity.EntityDamageByEntityEvent;
@@ -398,14 +399,18 @@ public static void startGainXp(Player attacker, PlayerProfile profile, LivingEnt
baseXP = 20 * configInstance.getPlayerVersusPlayerXP();
}
}
- else if (!target.hasMetadata("mcmmoFromMobSpawner")) {
- if (target instanceof Animals && !target.hasMetadata("mcmmoSummoned")) {
+ else if (!mcMMO.p.placeStore.isSpawnedMob(((Entity) target))) {
+ if (target instanceof Animals && !mcMMO.p.placeStore.isSpawnedPet((Entity) target)) {
baseXP = configInstance.getAnimalsXP();
}
else {
EntityType type = target.getType();
switch (type) {
+ case BAT:
+ baseXP = configInstance.getAnimalsXP();
+ break;
+
case BLAZE:
baseXP = configInstance.getBlazeXP();
break;
@@ -430,6 +435,10 @@ else if (!target.hasMetadata("mcmmoFromMobSpawner")) {
baseXP = configInstance.getGhastXP();
break;
+ case GIANT:
+ baseXP = configInstance.getGiantXP();
+ break;
+
case MAGMA_CUBE:
baseXP = configInstance.getMagmaCubeXP();
break;
@@ -450,9 +459,14 @@ else if (!target.hasMetadata("mcmmoFromMobSpawner")) {
break;
case SKELETON:
- baseXP = configInstance.getSkeletonXP();
- break;
-
+ switch(((Skeleton) target).getSkeletonType()) {
+ case WITHER:
+ baseXP = configInstance.getWitherSkeletonXP();
+ break;
+ default:
+ baseXP = configInstance.getSkeletonXP();
+ break;
+ }
case SLIME:
baseXP = configInstance.getSlimeXP();
break;
@@ -461,6 +475,14 @@ else if (!target.hasMetadata("mcmmoFromMobSpawner")) {
baseXP = configInstance.getSpiderXP();
break;
+ case WITCH:
+ baseXP = configInstance.getWitchXP();
+ break;
+
+ case WITHER:
+ baseXP = configInstance.getWitherXP();
+ break;
+
case ZOMBIE:
baseXP = configInstance.getZombieXP();
break;
@@ -4,6 +4,7 @@
import org.bukkit.World;
import org.bukkit.block.Block;
+import org.bukkit.entity.Entity;
public interface ChunkManager {
public void closeAll();
@@ -165,4 +166,11 @@
* Delete any ChunkletStores that are empty
*/
public void cleanUp();
+
+ public boolean isSpawnedMob(Entity entity);
+ public boolean isSpawnedPet(Entity entity);
+ public void addSpawnedMob(Entity entity);
+ public void addSpawnedPet(Entity entity);
+ public void removeSpawnedMob(Entity entity);
+ public void removeSpawnedPet(Entity entity);
}
@@ -1,6 +1,8 @@
package com.gmail.nossr50.util.blockmeta.chunkmeta;
import java.io.Serializable;
+import java.util.List;
+import java.util.UUID;
import com.gmail.nossr50.util.blockmeta.ChunkletStore;
@@ -71,4 +73,15 @@
* @param otherStore Another ChunkletStore that this one should copy all data from
*/
public void copyFrom(ChunkletStore otherStore);
+
+ public boolean isSpawnedMob(UUID id);
+ public boolean isSpawnedPet(UUID id);
+ public void addSpawnedMob(UUID id);
+ public void addSpawnedPet(UUID id);
+ public void removeSpawnedMob(UUID id);
+ public void removeSpawnedPet(UUID id);
+ public void clearSpawnedMobs();
+ public void clearSpawnedPets();
+ public List<UUID> getSpawnedMobs();
+ public List<UUID> getSpawnedPets();
}
Oops, something went wrong.

0 comments on commit e607e04

Please sign in to comment.