mirror of
https://github.com/Multiverse/Multiverse-Core.git
synced 2025-02-16 20:41:59 +01:00
Add getHunger api. No implementation yet
This commit is contained in:
parent
f009ad6dd6
commit
eb0b83c507
@ -7,11 +7,6 @@
|
||||
|
||||
package com.onarandombox.MultiverseCore;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.logging.Level;
|
||||
|
||||
import org.bukkit.ChatColor;
|
||||
import org.bukkit.GameMode;
|
||||
import org.bukkit.Location;
|
||||
@ -22,6 +17,11 @@ import org.bukkit.permissions.Permission;
|
||||
import org.bukkit.permissions.PermissionDefault;
|
||||
import org.bukkit.util.config.Configuration;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.logging.Level;
|
||||
|
||||
enum EnglishChatColor {
|
||||
AQUA("AQUA", ChatColor.AQUA),
|
||||
BLACK("BLACK", ChatColor.BLACK),
|
||||
@ -99,9 +99,8 @@ public class MVWorld {
|
||||
private Double scaling; // How stretched/compressed distances are
|
||||
private Double price; // How much does it cost to enter this world
|
||||
private int currency = -1; // What is the currency
|
||||
/**
|
||||
* The generator as a string. This is used only for reporting. ex: BukkitFullOfMoon:GenID
|
||||
*/
|
||||
private boolean hunger = true;
|
||||
/** The generator as a string. This is used only for reporting. ex: BukkitFullOfMoon:GenID */
|
||||
private String generator;
|
||||
private Permission permission;
|
||||
private Permission exempt;
|
||||
@ -145,6 +144,7 @@ public class MVWorld {
|
||||
this.setMonsters(config.getBoolean("worlds." + this.name + ".monsters.spawn", true));
|
||||
this.setPrice(config.getDouble("worlds." + this.name + ".entryfee.amount", 0.0));
|
||||
this.setCurrency(config.getInt("worlds." + this.name + ".entryfee.currency", -1));
|
||||
this.setHunger(config.getBoolean("worlds." + this.name + ".hunger", true));
|
||||
this.getMobExceptions();
|
||||
|
||||
this.setGameMode(config.getString("worlds." + this.name + ".gamemode", GameMode.SURVIVAL.toString()));
|
||||
@ -169,7 +169,7 @@ public class MVWorld {
|
||||
}
|
||||
|
||||
private double getDefaultScale(Environment environment) {
|
||||
if(environment == Environment.NETHER) {
|
||||
if (environment == Environment.NETHER) {
|
||||
return 8.0;
|
||||
}
|
||||
return 1.0;
|
||||
@ -400,6 +400,7 @@ public class MVWorld {
|
||||
*
|
||||
* @param name
|
||||
* @param value
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
public boolean setVariable(String name, String value) {
|
||||
@ -693,6 +694,17 @@ public class MVWorld {
|
||||
return this.keepSpawnInMemory;
|
||||
}
|
||||
|
||||
private boolean setHunger(boolean hunger) {
|
||||
this.hunger = hunger;
|
||||
config.setProperty("worlds." + this.name + ".hunger", this.hunger);
|
||||
saveConfig();
|
||||
return true;
|
||||
}
|
||||
|
||||
public boolean getHunger() {
|
||||
return this.hunger;
|
||||
}
|
||||
|
||||
public boolean setSpawn(Location l) {
|
||||
this.getCBWorld().setSpawnLocation(l.getBlockX(), l.getBlockY(), l.getBlockZ());
|
||||
config.setProperty("worlds." + this.name + ".spawn.x", l.getX());
|
||||
|
@ -7,21 +7,18 @@
|
||||
|
||||
package com.onarandombox.MultiverseCore;
|
||||
|
||||
import java.io.BufferedReader;
|
||||
import java.io.DataInputStream;
|
||||
import java.io.File;
|
||||
import java.io.FileInputStream;
|
||||
import java.io.IOException;
|
||||
import java.io.InputStreamReader;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Arrays;
|
||||
import java.util.Collection;
|
||||
import java.util.HashMap;
|
||||
import java.util.logging.Level;
|
||||
import java.util.logging.Logger;
|
||||
|
||||
import com.onarandombox.MultiverseCore.listeners.*;
|
||||
import com.fernferret.allpay.AllPay;
|
||||
import com.fernferret.allpay.GenericBank;
|
||||
import com.onarandombox.MultiverseCore.commands.*;
|
||||
import com.onarandombox.MultiverseCore.configuration.DefaultConfig;
|
||||
import com.onarandombox.MultiverseCore.configuration.MVConfigMigrator;
|
||||
import com.onarandombox.MultiverseCore.configuration.MVCoreConfigMigrator;
|
||||
import com.onarandombox.MultiverseCore.listeners.MVEntityListener;
|
||||
import com.onarandombox.MultiverseCore.listeners.MVPlayerListener;
|
||||
import com.onarandombox.MultiverseCore.listeners.MVPluginListener;
|
||||
import com.onarandombox.MultiverseCore.listeners.MVWeatherListener;
|
||||
import com.onarandombox.utils.*;
|
||||
import com.pneumaticraft.commandhandler.CommandHandler;
|
||||
import org.bukkit.ChatColor;
|
||||
import org.bukkit.Location;
|
||||
import org.bukkit.World.Environment;
|
||||
@ -34,38 +31,13 @@ import org.bukkit.plugin.PluginManager;
|
||||
import org.bukkit.plugin.java.JavaPlugin;
|
||||
import org.bukkit.util.config.Configuration;
|
||||
|
||||
import com.fernferret.allpay.AllPay;
|
||||
import com.fernferret.allpay.GenericBank;
|
||||
import com.onarandombox.MultiverseCore.commands.ConfirmCommand;
|
||||
import com.onarandombox.MultiverseCore.commands.CoordCommand;
|
||||
import com.onarandombox.MultiverseCore.commands.CreateCommand;
|
||||
import com.onarandombox.MultiverseCore.commands.DebugCommand;
|
||||
import com.onarandombox.MultiverseCore.commands.DeleteCommand;
|
||||
import com.onarandombox.MultiverseCore.commands.EnvironmentCommand;
|
||||
import com.onarandombox.MultiverseCore.commands.GeneratorCommand;
|
||||
import com.onarandombox.MultiverseCore.commands.HelpCommand;
|
||||
import com.onarandombox.MultiverseCore.commands.ImportCommand;
|
||||
import com.onarandombox.MultiverseCore.commands.InfoCommand;
|
||||
import com.onarandombox.MultiverseCore.commands.ListCommand;
|
||||
import com.onarandombox.MultiverseCore.commands.ModifyAddCommand;
|
||||
import com.onarandombox.MultiverseCore.commands.ModifyClearCommand;
|
||||
import com.onarandombox.MultiverseCore.commands.ModifyCommand;
|
||||
import com.onarandombox.MultiverseCore.commands.ModifyRemoveCommand;
|
||||
import com.onarandombox.MultiverseCore.commands.ModifySetCommand;
|
||||
import com.onarandombox.MultiverseCore.commands.PurgeCommand;
|
||||
import com.onarandombox.MultiverseCore.commands.ReloadCommand;
|
||||
import com.onarandombox.MultiverseCore.commands.RemoveCommand;
|
||||
import com.onarandombox.MultiverseCore.commands.SetSpawnCommand;
|
||||
import com.onarandombox.MultiverseCore.commands.SpawnCommand;
|
||||
import com.onarandombox.MultiverseCore.commands.SpoutCommand;
|
||||
import com.onarandombox.MultiverseCore.commands.TeleportCommand;
|
||||
import com.onarandombox.MultiverseCore.commands.UnloadCommand;
|
||||
import com.onarandombox.MultiverseCore.commands.VersionCommand;
|
||||
import com.onarandombox.MultiverseCore.commands.WhoCommand;
|
||||
import com.onarandombox.MultiverseCore.configuration.DefaultConfig;
|
||||
import com.onarandombox.MultiverseCore.configuration.MVConfigMigrator;
|
||||
import com.onarandombox.MultiverseCore.configuration.MVCoreConfigMigrator;
|
||||
import com.pneumaticraft.commandhandler.CommandHandler;
|
||||
import java.io.*;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Arrays;
|
||||
import java.util.Collection;
|
||||
import java.util.HashMap;
|
||||
import java.util.logging.Level;
|
||||
import java.util.logging.Logger;
|
||||
|
||||
public class MultiverseCore extends JavaPlugin implements LoggablePlugin {
|
||||
|
||||
@ -208,7 +180,7 @@ public class MultiverseCore extends JavaPlugin implements LoggablePlugin {
|
||||
log.info(tag + " - Version " + this.getDescription().getVersion() + " was NOT ENABLED!!!");
|
||||
log.info(tag + " A plugin that has loaded before " + this.getDescription().getName() + " has an incompatible version of CommandHandler (an internal library)!");
|
||||
log.info(tag + " Please contact this plugin author!!!!!!!");
|
||||
log.info(tag + " This plugin needs CommandHandler v" + chversion + " or higher!");
|
||||
log.info(tag + " This plugin needs CommandHandler v" + chversion + " or higher!");
|
||||
return false;
|
||||
}
|
||||
|
||||
@ -222,9 +194,7 @@ public class MultiverseCore extends JavaPlugin implements LoggablePlugin {
|
||||
this.destFactory.registerDestinationType(BedDestination.class, "b");
|
||||
}
|
||||
|
||||
/**
|
||||
* Function to Register all the Events needed.
|
||||
*/
|
||||
/** Function to Register all the Events needed. */
|
||||
private void registerEvents() {
|
||||
PluginManager pm = getServer().getPluginManager();
|
||||
// pm.registerEvent(Event.Type.PLAYER_MOVE, playerListener, Priority.Highest, this); // Low so it acts above any other.
|
||||
@ -246,9 +216,7 @@ public class MultiverseCore extends JavaPlugin implements LoggablePlugin {
|
||||
pm.registerEvent(Event.Type.THUNDER_CHANGE, this.weatherListener, Priority.Normal, this);
|
||||
}
|
||||
|
||||
/**
|
||||
* Load the Configuration files OR create the default config files.
|
||||
*/
|
||||
/** Load the Configuration files OR create the default config files. */
|
||||
public void loadConfigs() {
|
||||
|
||||
// Call the defaultConfiguration class to create the config files if they don't already exist.
|
||||
@ -281,13 +249,11 @@ public class MultiverseCore extends JavaPlugin implements LoggablePlugin {
|
||||
this.messaging.setCooldown(this.configMV.getInt("messagecooldown", 5000));
|
||||
}
|
||||
|
||||
public MVMessaging getMessaging(){
|
||||
public MVMessaging getMessaging() {
|
||||
return this.messaging;
|
||||
}
|
||||
|
||||
/**
|
||||
* Register Multiverse-Core commands to Command Manager.
|
||||
*/
|
||||
/** Register Multiverse-Core commands to Command Manager. */
|
||||
private void registerCommands() {
|
||||
// Intro Commands
|
||||
this.commandHandler.registerCommand(new HelpCommand(this));
|
||||
@ -320,49 +286,40 @@ public class MultiverseCore extends JavaPlugin implements LoggablePlugin {
|
||||
this.commandHandler.registerCommand(new GeneratorCommand(this));
|
||||
}
|
||||
|
||||
/**
|
||||
* Deprecated, please use WorldManager.loadWorlds(Boolean forceLoad) now.
|
||||
*/
|
||||
/** Deprecated, please use WorldManager.loadWorlds(Boolean forceLoad) now. */
|
||||
@Deprecated
|
||||
public void loadWorlds(boolean forceLoad) {
|
||||
this.worldManager.loadWorlds(true);
|
||||
}
|
||||
|
||||
/**
|
||||
* Deprecated, please use WorldManager.addWorld(String name, Environment env, String seedString, String generator) now.
|
||||
* Deprecated, please use WorldManager.addWorld(String name, Environment env, String seedString, String generator)
|
||||
* now.
|
||||
*/
|
||||
@Deprecated
|
||||
public boolean addWorld(String name, Environment env, String seedString, String generator) {
|
||||
return this.worldManager.addWorld(name, env, seedString, generator);
|
||||
}
|
||||
|
||||
/**
|
||||
* Deprecated, please use WorldManager.removeWorldFromList(String name) now.
|
||||
*/
|
||||
/** Deprecated, please use WorldManager.removeWorldFromList(String name) now. */
|
||||
@Deprecated
|
||||
public boolean removeWorldFromList(String name) {
|
||||
return this.worldManager.removeWorldFromList(name);
|
||||
}
|
||||
|
||||
/**
|
||||
* Deprecated, please use WorldManager.removeWorldFromConfig(String name) now.
|
||||
*/
|
||||
/** Deprecated, please use WorldManager.removeWorldFromConfig(String name) now. */
|
||||
@Deprecated
|
||||
public boolean removeWorldFromConfig(String name) {
|
||||
return this.worldManager.removeWorldFromConfig(name);
|
||||
}
|
||||
|
||||
/**
|
||||
* Deprecated please use WorldManager.deleteWorld(String name) now.
|
||||
*/
|
||||
/** Deprecated please use WorldManager.deleteWorld(String name) now. */
|
||||
@Deprecated
|
||||
public Boolean deleteWorld(String name) {
|
||||
return this.worldManager.deleteWorld(name);
|
||||
}
|
||||
|
||||
/**
|
||||
* What happens when the plugin gets disabled...
|
||||
*/
|
||||
/** What happens when the plugin gets disabled... */
|
||||
public void onDisable() {
|
||||
debugLog.close();
|
||||
this.ph.setPermissions(null);
|
||||
@ -375,6 +332,7 @@ public class MultiverseCore extends JavaPlugin implements LoggablePlugin {
|
||||
* Grab the players session if one exists, otherwise create a session then return it.
|
||||
*
|
||||
* @param player
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
public MVPlayerSession getPlayerSession(Player player) {
|
||||
@ -395,9 +353,7 @@ public class MultiverseCore extends JavaPlugin implements LoggablePlugin {
|
||||
return new MVTeleport(this);
|
||||
}
|
||||
|
||||
/**
|
||||
* Grab the Permissions Handler for MultiVerse
|
||||
*/
|
||||
/** Grab the Permissions Handler for MultiVerse */
|
||||
public MVPermissions getPermissions() {
|
||||
return this.ph;
|
||||
}
|
||||
@ -407,9 +363,7 @@ public class MultiverseCore extends JavaPlugin implements LoggablePlugin {
|
||||
return this.worldManager.getWorldPurger();
|
||||
}
|
||||
|
||||
/**
|
||||
* onCommand
|
||||
*/
|
||||
/** onCommand */
|
||||
@Override
|
||||
public boolean onCommand(CommandSender sender, Command command, String commandLabel, String[] args) {
|
||||
if (!this.isEnabled()) {
|
||||
@ -422,7 +376,8 @@ public class MultiverseCore extends JavaPlugin implements LoggablePlugin {
|
||||
}
|
||||
|
||||
/**
|
||||
* Print messages to the server Log as well as to our DebugLog. 'debugLog' is used to seperate Heroes information from the Servers Log Output.
|
||||
* Print messages to the server Log as well as to our DebugLog. 'debugLog' is used to seperate Heroes information
|
||||
* from the Servers Log Output.
|
||||
*
|
||||
* @param level
|
||||
* @param msg
|
||||
@ -448,7 +403,8 @@ public class MultiverseCore extends JavaPlugin implements LoggablePlugin {
|
||||
}
|
||||
|
||||
/**
|
||||
* Print messages to the Debug Log, if the servers in Debug Mode then we also wan't to print the messages to the standard Server Console.
|
||||
* Print messages to the Debug Log, if the servers in Debug Mode then we also wan't to print the messages to the
|
||||
* standard Server Console.
|
||||
*
|
||||
* @param level
|
||||
* @param msg
|
||||
@ -493,6 +449,7 @@ public class MultiverseCore extends JavaPlugin implements LoggablePlugin {
|
||||
* This code should get moved somewhere more appropriate, but for now, it's here.
|
||||
*
|
||||
* @param env
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
public Environment getEnvFromString(String env) {
|
||||
@ -507,6 +464,7 @@ public class MultiverseCore extends JavaPlugin implements LoggablePlugin {
|
||||
env = "NORMAL";
|
||||
|
||||
try {
|
||||
// If the value wasn't found, maybe it's new, try checking the enum directly.
|
||||
return Environment.valueOf(env);
|
||||
} catch (IllegalArgumentException e) {
|
||||
return null;
|
||||
@ -549,16 +507,12 @@ public class MultiverseCore extends JavaPlugin implements LoggablePlugin {
|
||||
return this.pluginCount;
|
||||
}
|
||||
|
||||
/**
|
||||
* Increments the number of plugins that have specifically hooked into core.
|
||||
*/
|
||||
/** Increments the number of plugins that have specifically hooked into core. */
|
||||
public void incrementPluginCount() {
|
||||
this.pluginCount += 1;
|
||||
}
|
||||
|
||||
/**
|
||||
* Decrements the number of plugins that have specifically hooked into core.
|
||||
*/
|
||||
/** Decrements the number of plugins that have specifically hooked into core. */
|
||||
public void decrementPluginCount() {
|
||||
this.pluginCount -= 1;
|
||||
}
|
||||
|
@ -0,0 +1,15 @@
|
||||
/******************************************************************************
|
||||
* Multiverse 2 Copyright (c) the Multiverse Team 2011. *
|
||||
* Multiverse 2 is licensed under the BSD License. *
|
||||
* For more information please check the README.md file included *
|
||||
* with this project. *
|
||||
******************************************************************************/
|
||||
|
||||
package com.onarandombox.MultiverseCore.api;
|
||||
|
||||
/**
|
||||
* The API for a Multiverse Handled World.
|
||||
*/
|
||||
public interface MultiverseWorld {
|
||||
|
||||
}
|
@ -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
|
||||
alias, animals, monsters, pvp, scaling, aliascolor, color, respawn, currency, curr, price, scale, spawnmemory, memory, weather, storm, gamemode, mode, hunger
|
||||
}
|
||||
|
||||
public class ModifyCommand extends MultiverseCommand {
|
||||
|
Loading…
Reference in New Issue
Block a user