mirror of
https://github.com/Multiverse/Multiverse-Core.git
synced 2025-02-02 13:41:22 +01:00
Start writing the Core API
This commit is contained in:
parent
4a634e8418
commit
2d112edee5
@ -9,6 +9,7 @@ package com.onarandombox.MultiverseCore;
|
||||
|
||||
import com.fernferret.allpay.AllPay;
|
||||
import com.fernferret.allpay.GenericBank;
|
||||
import com.onarandombox.MultiverseCore.api.Core;
|
||||
import com.onarandombox.MultiverseCore.api.MVPlugin;
|
||||
import com.onarandombox.MultiverseCore.commands.*;
|
||||
import com.onarandombox.MultiverseCore.configuration.DefaultConfig;
|
||||
@ -42,7 +43,7 @@ import java.util.HashMap;
|
||||
import java.util.logging.Level;
|
||||
import java.util.logging.Logger;
|
||||
|
||||
public class MultiverseCore extends JavaPlugin implements MVPlugin {
|
||||
public class MultiverseCore extends JavaPlugin implements MVPlugin, Core {
|
||||
|
||||
public static boolean outdatedPluginFound = false;
|
||||
private static int Protocol = 1;
|
||||
@ -64,6 +65,7 @@ public class MultiverseCore extends JavaPlugin implements MVPlugin {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getProtocolVersion() {
|
||||
return MultiverseCore.Protocol;
|
||||
}
|
||||
@ -356,13 +358,7 @@ public class MultiverseCore extends JavaPlugin implements MVPlugin {
|
||||
log(Level.INFO, "- Disabled");
|
||||
}
|
||||
|
||||
/**
|
||||
* Grab the players session if one exists, otherwise create a session then return it.
|
||||
*
|
||||
* @param player
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
@Override
|
||||
public MVPlayerSession getPlayerSession(Player player) {
|
||||
if (this.playerSessions.containsKey(player.getName())) {
|
||||
return this.playerSessions.get(player.getName());
|
||||
|
87
src/main/java/com/onarandombox/MultiverseCore/api/Core.java
Normal file
87
src/main/java/com/onarandombox/MultiverseCore/api/Core.java
Normal file
@ -0,0 +1,87 @@
|
||||
/******************************************************************************
|
||||
* 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;
|
||||
|
||||
import com.fernferret.allpay.GenericBank;
|
||||
import com.onarandombox.MultiverseCore.utils.MVMessaging;
|
||||
import com.onarandombox.MultiverseCore.utils.MVPermissions;
|
||||
import com.onarandombox.MultiverseCore.utils.MVPlayerSession;
|
||||
import com.onarandombox.MultiverseCore.utils.SafeTTeleporter;
|
||||
import com.pneumaticraft.commandhandler.CommandHandler;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.util.config.Configuration;
|
||||
|
||||
/**
|
||||
* Multiverse 2 Core API
|
||||
* <p/>
|
||||
* This api contains a bunch of useful things you can get out of Multiverse in general!
|
||||
*/
|
||||
public interface Core {
|
||||
/**
|
||||
* Gets the Multiverse config file.
|
||||
*
|
||||
* @return The Multiverse config file.
|
||||
*/
|
||||
public Configuration getConfig();
|
||||
|
||||
/**
|
||||
* Gets the Banking system that Multiverse-Core has hooked into.
|
||||
*
|
||||
* @return A {@link GenericBank} that can be used for payments.
|
||||
*/
|
||||
public GenericBank getBank();
|
||||
|
||||
/**
|
||||
* Reloads the Multiverse Configuration files:
|
||||
* worlds.yml and config.yml.
|
||||
*/
|
||||
public void loadConfigs();
|
||||
|
||||
/**
|
||||
* Gets the Multiverse message system. This allows you to send messages
|
||||
* to users at specified intervals.
|
||||
*
|
||||
* @return The loaded {@link MVMessaging}.
|
||||
*/
|
||||
public MVMessaging getMessaging();
|
||||
|
||||
/**
|
||||
* Gets the {@link MVPlayerSession} for the given player.
|
||||
* This will also create a player session if one does not exist
|
||||
* for a player.
|
||||
*
|
||||
* @param player The player's session to grab.
|
||||
*
|
||||
* @return The corresponding {@link MVPlayerSession}.
|
||||
*/
|
||||
public MVPlayerSession getPlayerSession(Player player);
|
||||
|
||||
/**
|
||||
* Gets the instantiated Safe-T-Teleporter for performing
|
||||
* safe teleports.
|
||||
*
|
||||
* @return A non-null {@link SafeTTeleporter}.
|
||||
*/
|
||||
public SafeTTeleporter getTeleporter();
|
||||
|
||||
/**
|
||||
* Multiverse uses an advanced permissions setup, this object
|
||||
* simplifies getting/setting permissions.
|
||||
*
|
||||
* @return A non-null {@link MVPermissions}.
|
||||
*/
|
||||
public MVPermissions getMVPerms();
|
||||
|
||||
/**
|
||||
* Multiverse uses {@link CommandHandler} to make adding and using commands
|
||||
* a piece of cake.
|
||||
*
|
||||
* @return A non-null {@link CommandHandler}.
|
||||
*/
|
||||
public CommandHandler getCommandHandler();
|
||||
}
|
Loading…
Reference in New Issue
Block a user