mirror of
https://github.com/Multiverse/Multiverse-Core.git
synced 2024-11-22 18:47:20 +01:00
Fixed Hunger/Food setting Closes #119
This commit is contained in:
parent
ea6e94d99d
commit
d97bbfb1b1
@ -20,7 +20,6 @@ public class MVPlayerSession {
|
||||
private Long messageLast = 0L; // Timestamp for the Players last Alert Message.
|
||||
|
||||
private Configuration config; // Configuration file to find out Cooldown Timers.
|
||||
private int cachedHunger = 20;
|
||||
|
||||
public MVPlayerSession(Player player, Configuration config, MultiverseCore multiVerseCore) {
|
||||
this.player = player;
|
||||
@ -48,11 +47,4 @@ public class MVPlayerSession {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
public void setCachedHunger() {
|
||||
this.cachedHunger = this.player.getFoodLevel();
|
||||
}
|
||||
public int getCachedHunger() {
|
||||
return this.cachedHunger;
|
||||
}
|
||||
}
|
||||
|
@ -380,7 +380,7 @@ public class MVWorld {
|
||||
this.setMonsters(value);
|
||||
} else if (name.equalsIgnoreCase("memory") || name.equalsIgnoreCase("spawnmemory")) {
|
||||
this.setSpawnInMemory(value);
|
||||
} else if (name.equalsIgnoreCase("hunger")) {
|
||||
} else if ((name.equalsIgnoreCase("hunger")) || (name.equalsIgnoreCase("food"))){
|
||||
this.setHunger(value);
|
||||
}else if (name.equalsIgnoreCase("weather") || name.equalsIgnoreCase("storm")) {
|
||||
this.setEnableWeather(value);
|
||||
|
@ -208,6 +208,7 @@ public class MultiverseCore extends JavaPlugin implements LoggablePlugin {
|
||||
pm.registerEvent(Event.Type.ENTITY_REGAIN_HEALTH, this.entityListener, Priority.Normal, this);
|
||||
pm.registerEvent(Event.Type.ENTITY_DAMAGE, this.entityListener, Priority.Normal, this); // To Allow/Disallow fake PVP
|
||||
pm.registerEvent(Event.Type.CREATURE_SPAWN, this.entityListener, Priority.Normal, this); // To prevent all or certain animals/monsters from spawning.
|
||||
pm.registerEvent(Event.Type.FOOD_LEVEL_CHANGE, this.entityListener, Priority.Normal, this);
|
||||
|
||||
pm.registerEvent(Event.Type.PLUGIN_ENABLE, this.pluginListener, Priority.Monitor, this);
|
||||
pm.registerEvent(Event.Type.PLUGIN_DISABLE, this.pluginListener, Priority.Monitor, this);
|
||||
|
@ -126,6 +126,7 @@ public class InfoCommand extends MultiverseCommand {
|
||||
message = new ArrayList<FancyText>();
|
||||
message.add(new FancyHeader("More World Settings", colors));
|
||||
message.add(new FancyMessage("Weather: ", world.getWeatherEnabled() + "", colors));
|
||||
message.add(new FancyMessage("Players will get hungry: ", world.getHunger() + "", colors));
|
||||
message.add(new FancyMessage("Keep spawn in memory: ", world.getKeepSpawnInMemory() + "", colors));
|
||||
message.add(new FancyHeader("PVP Settings", colors));
|
||||
message.add(new FancyMessage("Multiverse Setting: ", world.getPvp().toString(), colors));
|
||||
|
@ -27,7 +27,7 @@ enum Action {
|
||||
|
||||
// Color == Aliascolor
|
||||
enum SetProperties {
|
||||
alias, animals, monsters, pvp, scaling, aliascolor, color, respawn, currency, curr, price, scale, spawnmemory, memory, weather, storm, gamemode, mode, hunger
|
||||
alias, animals, monsters, pvp, scaling, aliascolor, color, respawn, currency, curr, price, scale, spawnmemory, memory, weather, storm, gamemode, mode, hunger, food
|
||||
}
|
||||
|
||||
public class ModifyCommand extends MultiverseCommand {
|
||||
|
@ -136,15 +136,6 @@ public class MVPlayerListener extends PlayerListener {
|
||||
MVWorld fromWorld = this.worldManager.getMVWorld(event.getFrom().getWorld().getName());
|
||||
MVWorld toWorld = this.worldManager.getMVWorld(event.getTo().getWorld().getName());
|
||||
event.setCancelled(checkWorldPermissions(fromWorld, toWorld, event.getPlayer()));
|
||||
// Dunno If I like these... @fernferret
|
||||
// if (toWorld != null && !toWorld.getHunger() && fromWorld != null && fromWorld.getHunger() && !event.isCancelled()) {
|
||||
// // If to has hunger, and from doesn't, save the hunger
|
||||
// this.plugin.getPlayerSession(event.getPlayer()).setCachedHunger();
|
||||
// }
|
||||
// else if (toWorld != null && toWorld.getHunger() && fromWorld != null && !fromWorld.getHunger() && !event.isCancelled()) {
|
||||
// // If from has hunger, and to doesn't, restore the hunger
|
||||
// event.getPlayer().setFoodLevel(this.plugin.getPlayerSession(event.getPlayer()).getCachedHunger());
|
||||
// }
|
||||
}
|
||||
|
||||
@Override
|
||||
|
Loading…
Reference in New Issue
Block a user