mirror of
https://github.com/Multiverse/Multiverse-Core.git
synced 2025-02-16 20:41:59 +01:00
Add Version Event, Add MVPlugin Interface.
This commit is contained in:
parent
1e9a826999
commit
6c061f1116
@ -0,0 +1,7 @@
|
||||
package com.onarandombox.MultiverseCore;
|
||||
|
||||
public interface MVPlugin extends LoggablePlugin {
|
||||
public void dumpVersionInfo();
|
||||
public MultiverseCore getCore();
|
||||
public void setCore(MultiverseCore core);
|
||||
}
|
@ -86,7 +86,7 @@ public class MultiverseCore extends JavaPlugin implements LoggablePlugin {
|
||||
private final String tag = "[Multiverse-Core]";
|
||||
|
||||
// Multiverse Permissions Handler
|
||||
public MVPermissions ph;
|
||||
private MVPermissions ph;
|
||||
|
||||
// Configurations
|
||||
private Configuration configMV = null;
|
||||
|
@ -34,7 +34,7 @@ public class ListCommand extends MultiverseCommand {
|
||||
String output = ChatColor.LIGHT_PURPLE + "Worlds which you can view:\n";
|
||||
for (MVWorld world : this.plugin.getMVWorlds()) {
|
||||
|
||||
if (p != null && (!this.plugin.ph.canEnterWorld(p, world))) {
|
||||
if (p != null && (!this.plugin.getPermissions().canEnterWorld(p, world))) {
|
||||
continue;
|
||||
}
|
||||
|
||||
|
@ -8,6 +8,7 @@ import org.bukkit.entity.Player;
|
||||
import org.bukkit.permissions.PermissionDefault;
|
||||
|
||||
import com.onarandombox.MultiverseCore.MultiverseCore;
|
||||
import com.onarandombox.MultiverseCore.event.MVVersionRequestEvent;
|
||||
|
||||
public class VersionCommand extends MultiverseCommand {
|
||||
|
||||
@ -43,5 +44,6 @@ public class VersionCommand extends MultiverseCommand {
|
||||
this.plugin.log(Level.INFO, "fakepvp: " + this.plugin.getConfig().getString("fakepvp", "NOT SET"));
|
||||
this.plugin.log(Level.INFO, "fakepvp: " + this.plugin.getConfig().getString("fakepvp", "NOT SET"));
|
||||
this.plugin.log(Level.INFO, "Special Code: FRN001");
|
||||
this.plugin.getServer().getPluginManager().callEvent(new MVVersionRequestEvent());
|
||||
}
|
||||
}
|
||||
|
@ -0,0 +1,10 @@
|
||||
package com.onarandombox.MultiverseCore.event;
|
||||
|
||||
import org.bukkit.event.Event;
|
||||
|
||||
public class MVVersionRequestEvent extends Event {
|
||||
|
||||
public MVVersionRequestEvent() {
|
||||
super("MVVersion");
|
||||
}
|
||||
}
|
@ -86,7 +86,7 @@ public class MVPlayerListener extends PlayerListener {
|
||||
|
||||
@Override
|
||||
public void onPlayerJoin(PlayerJoinEvent event) {
|
||||
if (this.plugin.getMVWorlds().size() == 0 && this.plugin.ph.hasPermission(event.getPlayer(), "multiverse.core.import", true)) {
|
||||
if (this.plugin.getMVWorlds().size() == 0 && this.plugin.getPermissions().hasPermission(event.getPlayer(), "multiverse.core.import", true)) {
|
||||
event.getPlayer().sendMessage("You don't have any worlds imported into Multiverse!");
|
||||
event.getPlayer().sendMessage("You can import your current worlds with " + ChatColor.AQUA + "/mvimport");
|
||||
event.getPlayer().sendMessage("or you can create new ones with " + ChatColor.GOLD + "/mvcreate");
|
||||
|
@ -28,7 +28,7 @@ public class MVPluginListener extends ServerListener {
|
||||
* Check to see if Permissions was just enabled
|
||||
*/
|
||||
if (event.getPlugin().getDescription().getName().equals("Permissions")) {
|
||||
this.plugin.ph.setPermissions(((Permissions) this.plugin.getServer().getPluginManager().getPlugin("Permissions")).getHandler());
|
||||
this.plugin.getPermissions().setPermissions(((Permissions) this.plugin.getServer().getPluginManager().getPlugin("Permissions")).getHandler());
|
||||
this.plugin.log(Level.INFO, "- Attached to Permissions");
|
||||
}
|
||||
// Let AllPay handle all econ plugin loadings, only go for econ plugins we support
|
||||
@ -53,7 +53,7 @@ public class MVPluginListener extends ServerListener {
|
||||
*/
|
||||
if (event.getPlugin().getDescription().getName().equals("Permissions")) {
|
||||
this.plugin.log(Level.INFO, "Permissions disabled");
|
||||
this.plugin.ph.setPermissions(null);
|
||||
this.plugin.getPermissions().setPermissions(null);
|
||||
}
|
||||
// TODO: Disable econ when it disables.
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user