mirror of
https://github.com/Multiverse/Multiverse-Core.git
synced 2024-11-22 18:47:20 +01:00
Add Config Migrate, clean up some logs.
This commit is contained in:
parent
0f10451269
commit
f06642a7ce
@ -63,7 +63,7 @@ public class MVConfigMigrator {
|
||||
oldConfig.load();
|
||||
List<String> keys = oldConfig.getKeys("worlds");
|
||||
if (keys == null) {
|
||||
this.core.log(Level.WARNING, "Migration FAILURE!");
|
||||
this.core.log(Level.SEVERE, "Migration FAILURE!");
|
||||
return false;
|
||||
}
|
||||
for (String key : keys) {
|
||||
|
@ -14,7 +14,6 @@ import org.bukkit.entity.Slime;
|
||||
import org.bukkit.event.entity.CreatureSpawnEvent;
|
||||
import org.bukkit.event.entity.CreatureSpawnEvent.SpawnReason;
|
||||
import org.bukkit.event.entity.EntityDamageByEntityEvent;
|
||||
import org.bukkit.event.entity.EntityDamageByProjectileEvent;
|
||||
import org.bukkit.event.entity.EntityDamageEvent;
|
||||
import org.bukkit.event.entity.EntityListener;
|
||||
import org.bukkit.event.entity.EntityRegainHealthEvent;
|
||||
@ -31,10 +30,7 @@ public class MVEntityListener extends EntityListener {
|
||||
}
|
||||
|
||||
/**
|
||||
* Event - When a Entity is Damaged, we first sort out whether it is of
|
||||
* importance to us, such as EntityVSEntity or EntityVSProjectile. Then we
|
||||
* grab the attacked and defender and check if its a player. Then deal with
|
||||
* the PVP Aspect.
|
||||
* Event - When a Entity is Damaged, we first sort out whether it is of importance to us, such as EntityVSEntity or EntityVSProjectile. Then we grab the attacked and defender and check if its a player. Then deal with the PVP Aspect.
|
||||
*/
|
||||
@Override
|
||||
public void onEntityDamage(EntityDamageEvent event) {
|
||||
@ -47,10 +43,6 @@ public class MVEntityListener extends EntityListener {
|
||||
EntityDamageByEntityEvent sub = (EntityDamageByEntityEvent) event;
|
||||
attacker = sub.getDamager();
|
||||
defender = sub.getEntity();
|
||||
} else if (event instanceof EntityDamageByProjectileEvent) {
|
||||
EntityDamageByProjectileEvent sub = (EntityDamageByProjectileEvent) event;
|
||||
attacker = sub.getDamager();
|
||||
defender = sub.getEntity();
|
||||
} else {
|
||||
return;
|
||||
}
|
||||
@ -62,7 +54,7 @@ public class MVEntityListener extends EntityListener {
|
||||
World w = player.getWorld();
|
||||
|
||||
if (!this.plugin.isMVWorld(w.getName())) {
|
||||
//if the world is not handled, we don't care
|
||||
// if the world is not handled, we don't care
|
||||
return;
|
||||
}
|
||||
MVWorld world = this.plugin.getMVWorld(w.getName());
|
||||
@ -70,7 +62,6 @@ public class MVEntityListener extends EntityListener {
|
||||
if (attacker != null && attacker instanceof Player) {
|
||||
Player pattacker = (Player) attacker;
|
||||
|
||||
|
||||
if (!world.getPvp() && this.plugin.getConfig().getBoolean("fakepvp", false)) {
|
||||
pattacker.sendMessage(ChatColor.RED + "PVP is disabled in this World.");
|
||||
event.setCancelled(true);
|
||||
|
@ -4,6 +4,7 @@ import java.util.logging.Level;
|
||||
|
||||
import org.bukkit.Location;
|
||||
import org.bukkit.entity.Entity;
|
||||
import org.bukkit.entity.Player;
|
||||
|
||||
import com.onarandombox.utils.BlockSafety;
|
||||
|
||||
@ -175,22 +176,29 @@ public class MVTeleport {
|
||||
l.setX(l.getBlockX() + .5);
|
||||
l.setZ(l.getBlockZ() + .5);
|
||||
e.teleport(l);
|
||||
//System.out.print("The first location you gave me was safe!");
|
||||
// System.out.print("The first location you gave me was safe!");
|
||||
return true;
|
||||
}
|
||||
Location safeLocation = this.getSafeLocation(l);
|
||||
if (safeLocation != null) {
|
||||
// Add offset to account for a vehicle on dry land!
|
||||
if(!this.bs.isEntitiyOnTrack(e, safeLocation)) {
|
||||
if (!this.bs.isEntitiyOnTrack(e, safeLocation)) {
|
||||
safeLocation.setY(safeLocation.getBlockY() + .5);
|
||||
}
|
||||
e.teleport(safeLocation);
|
||||
//System.out.print("Had to look for a bit, but I found a safe place for ya!" + safeLocation);
|
||||
// System.out.print("Had to look for a bit, but I found a safe place for ya!" + safeLocation);
|
||||
return true;
|
||||
}
|
||||
this.plugin.log(Level.WARNING, "Sorry champ, you're basically trying to teleport into a minefield. I should just kill you now.");
|
||||
if (e instanceof Player) {
|
||||
Player p = (Player) e;
|
||||
p.sendMessage("No safe locations found!");
|
||||
}
|
||||
else if (e.getPassenger() instanceof Player) {
|
||||
Player p = (Player) e.getPassenger();
|
||||
p.sendMessage("No safe locations found!");
|
||||
}
|
||||
this.plugin.log(Level.WARNING, "Sorry champ, you're(" + e.getEntityId() + ") basically trying to teleport into a minefield. I should just kill you now.");
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
@ -151,7 +151,7 @@ public class MultiverseCore extends JavaPlugin {
|
||||
|
||||
this.loadWorlds(true);
|
||||
} else {
|
||||
this.log(Level.WARNING, "Your configs were not loaded. Very little will function in MV.");
|
||||
this.log(Level.SEVERE , "Your configs were not loaded. Very little will function in Multiverse.");
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -0,0 +1,23 @@
|
||||
package com.onarandombox.MultiverseCore.event;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import org.bukkit.event.Event;
|
||||
|
||||
public class MVConfigMigrateEvent extends Event {
|
||||
private static final long serialVersionUID = 3647950355746345397L;
|
||||
private List<String> configsLoaded;
|
||||
|
||||
public MVConfigMigrateEvent(List<String> configsLoaded) {
|
||||
super("MVConfigMigrate");
|
||||
this.configsLoaded = configsLoaded;
|
||||
}
|
||||
|
||||
public void addConfig(String config) {
|
||||
this.configsLoaded.add(config);
|
||||
}
|
||||
|
||||
public List<String> getAllConfigsLoaded() {
|
||||
return this.configsLoaded;
|
||||
}
|
||||
}
|
Loading…
Reference in New Issue
Block a user