mirror of
https://github.com/Multiverse/Multiverse-Core.git
synced 2025-01-22 08:11:45 +01:00
Add new param to the PTPE, Don't die if we don't find or can't access bukkit.yml
This commit is contained in:
parent
176e729a87
commit
3f93fb3648
@ -20,6 +20,7 @@ public class MVPlayerTouchedPortalEvent extends Event implements Cancellable {
|
||||
private Player p;
|
||||
private Location l;
|
||||
private boolean isCancelled;
|
||||
private boolean canUse = true;
|
||||
|
||||
public MVPlayerTouchedPortalEvent(Player p, Location l) {
|
||||
this.p = p;
|
||||
@ -60,6 +61,26 @@ public class MVPlayerTouchedPortalEvent extends Event implements Cancellable {
|
||||
return this.p;
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets whether or not the player in this event can use this portal.
|
||||
*
|
||||
* @return True if the player can use this portal.
|
||||
*/
|
||||
public boolean canUseThisPortal() {
|
||||
return this.canUse;
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets whether or not the player in this event can use this portal.
|
||||
* <p>
|
||||
* Setting this to false will cause the player to bounce back!
|
||||
*
|
||||
* @param canUse Whether or not the user can go through this portal.
|
||||
*/
|
||||
public void setCanUseThisPortal(boolean canUse) {
|
||||
this.canUse = canUse;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isCancelled() {
|
||||
return this.isCancelled;
|
||||
|
@ -113,13 +113,13 @@ public class MVEntityListener implements Listener {
|
||||
/**
|
||||
* Animal Handling
|
||||
*/
|
||||
if (event.getEntity() instanceof Animals || event.getEntity() instanceof Squid) {
|
||||
if (!event.isCancelled() && (event.getEntity() instanceof Animals || event.getEntity() instanceof Squid)) {
|
||||
event.setCancelled(shouldWeKillThisCreature(mvworld.getAnimalList(), mvworld.canAnimalsSpawn(), type.getName().toUpperCase()));
|
||||
}
|
||||
/**
|
||||
* Monster Handling
|
||||
*/
|
||||
if (event.getEntity() instanceof Monster || event.getEntity() instanceof Ghast || event.getEntity() instanceof Slime) {
|
||||
if (!event.isCancelled() && (event.getEntity() instanceof Monster || event.getEntity() instanceof Ghast || event.getEntity() instanceof Slime)) {
|
||||
event.setCancelled(shouldWeKillThisCreature(mvworld.getMonsterList(), mvworld.canMonstersSpawn(), type.getName().toUpperCase()));
|
||||
}
|
||||
}
|
||||
|
@ -238,7 +238,6 @@ public class MVPlayerListener implements Listener {
|
||||
*/
|
||||
@EventHandler(priority = EventPriority.LOWEST)
|
||||
public void playerPortalCheck(PlayerPortalEvent event) {
|
||||
this.plugin.log(Level.FINE, "CALLING CORE-ADJUST!!!");
|
||||
if (event.isCancelled() || event.getFrom() == null) {
|
||||
return;
|
||||
}
|
||||
|
@ -69,7 +69,7 @@ public class WorldManager implements MVWorldManager {
|
||||
return s.equalsIgnoreCase("bukkit.yml");
|
||||
}
|
||||
});
|
||||
if (files.length == 1) {
|
||||
if (files != null && files.length == 1) {
|
||||
FileConfiguration bukkitConfig = YamlConfiguration.loadConfiguration(files[0]);
|
||||
if (bukkitConfig.isConfigurationSection("worlds")) {
|
||||
Set<String> keys = bukkitConfig.getConfigurationSection("worlds").getKeys(false);
|
||||
@ -77,6 +77,8 @@ public class WorldManager implements MVWorldManager {
|
||||
defaultGens.put(key, bukkitConfig.getString("worlds." + key + ".generator", ""));
|
||||
}
|
||||
}
|
||||
} else {
|
||||
this.plugin.log(Level.WARNING, "Could not read 'bukkit.yml'. Any Default worldgenerators will not be loaded!");
|
||||
}
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user