Merge f0cebc4b10
into 0a9eb447d6
This commit is contained in:
commit
9fb1fad1fd
|
@ -37,6 +37,7 @@ public class BukkitConfigurationManager extends YamlConfigurationManager {
|
|||
|
||||
private boolean hasCommandBookGodMode;
|
||||
boolean extraStats;
|
||||
private boolean hasEssentialsGodMode;
|
||||
|
||||
/**
|
||||
* Construct the object.
|
||||
|
@ -124,4 +125,12 @@ public class BukkitConfigurationManager extends YamlConfigurationManager {
|
|||
public boolean hasCommandBookGodMode() {
|
||||
return hasCommandBookGodMode;
|
||||
}
|
||||
|
||||
public void updateEssentialsGodMode() {
|
||||
hasEssentialsGodMode = plugin.getServer().getPluginManager().isPluginEnabled("Essentials");
|
||||
}
|
||||
|
||||
public boolean hasEssentialsGodMode() {
|
||||
return hasEssentialsGodMode;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -63,6 +63,7 @@ import com.sk89q.worldguard.bukkit.util.ClassSourceValidator;
|
|||
import com.sk89q.worldguard.bukkit.util.Entities;
|
||||
import com.sk89q.worldguard.bukkit.util.Events;
|
||||
import com.sk89q.worldguard.commands.GeneralCommands;
|
||||
import com.sk89q.worldguard.commands.GeneralCompatibleCommands;
|
||||
import com.sk89q.worldguard.commands.ProtectionCommands;
|
||||
import com.sk89q.worldguard.commands.ToggleCommands;
|
||||
import com.sk89q.worldguard.domains.registry.SimpleDomainRegistry;
|
||||
|
@ -160,8 +161,13 @@ public class WorldGuardPlugin extends JavaPlugin {
|
|||
reg.register(ToggleCommands.class);
|
||||
reg.register(ProtectionCommands.class);
|
||||
|
||||
if (!platform.getGlobalStateManager().hasCommandBookGodMode()) {
|
||||
platform.getGlobalStateManager().updateCommandBookGodMode();
|
||||
platform.getGlobalStateManager().updateEssentialsGodMode();
|
||||
|
||||
if (!platform.getGlobalStateManager().hasCommandBookGodMode() && !platform.getGlobalStateManager().hasEssentialsGodMode()) {
|
||||
reg.register(GeneralCommands.class);
|
||||
}else{
|
||||
reg.register(GeneralCompatibleCommands.class);
|
||||
}
|
||||
|
||||
getServer().getScheduler().scheduleSyncRepeatingTask(this, sessionManager, BukkitSessionManager.RUN_DELAY, BukkitSessionManager.RUN_DELAY);
|
||||
|
@ -192,8 +198,6 @@ public class WorldGuardPlugin extends JavaPlugin {
|
|||
(new DebuggingListener(this, WorldGuard.logger)).registerEvents();
|
||||
}
|
||||
|
||||
platform.getGlobalStateManager().updateCommandBookGodMode();
|
||||
|
||||
if (getServer().getPluginManager().isPluginEnabled("CommandBook")) {
|
||||
getServer().getPluginManager().registerEvents(new WorldGuardCommandBookListener(this), this);
|
||||
}
|
||||
|
|
|
@ -35,6 +35,10 @@ public class WorldGuardServerListener extends AbstractListener {
|
|||
if (event.getPlugin().getDescription().getName().equalsIgnoreCase("CommandBook")) {
|
||||
getConfig().updateCommandBookGodMode();
|
||||
}
|
||||
|
||||
if(event.getPlugin().getDescription().getName().equalsIgnoreCase("Essentials")){
|
||||
getConfig().updateEssentialsGodMode();
|
||||
}
|
||||
}
|
||||
|
||||
@EventHandler
|
||||
|
@ -42,5 +46,9 @@ public class WorldGuardServerListener extends AbstractListener {
|
|||
if (event.getPlugin().getDescription().getName().equalsIgnoreCase("CommandBook")) {
|
||||
getConfig().updateCommandBookGodMode();
|
||||
}
|
||||
|
||||
if(event.getPlugin().getDescription().getName().equalsIgnoreCase("Essentials")){
|
||||
getConfig().updateEssentialsGodMode();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -12,7 +12,7 @@
|
|||
# - If you want to check the format of this file before putting it
|
||||
# into WorldGuard, paste it into http://yaml-online-parser.appspot.com/
|
||||
# and see if it gives "ERROR:".
|
||||
# - Lines starting with # are commentsand so they are ignored.
|
||||
# - Lines starting with # are comments and so they are ignored.
|
||||
#
|
||||
# WARNING:
|
||||
# Remember to check the compatibility spreadsheet for WorldGuard to see
|
||||
|
|
|
@ -2,5 +2,5 @@ name: WorldGuard
|
|||
main: com.sk89q.worldguard.bukkit.WorldGuardPlugin
|
||||
version: "${internalVersion}"
|
||||
depend: [WorldEdit]
|
||||
softdepend: [CommandBook]
|
||||
softdepend: [CommandBook, Essentials]
|
||||
api-version: "1.20"
|
||||
|
|
|
@ -39,7 +39,7 @@ public class GeneralCommands {
|
|||
this.worldGuard = worldGuard;
|
||||
}
|
||||
|
||||
@Command(aliases = {"god"}, usage = "[player]",
|
||||
@Command(aliases = {"god", "wggod"}, usage = "[player]",
|
||||
desc = "Enable godmode on a player", flags = "s", max = 1)
|
||||
public void god(CommandContext args, Actor sender) throws CommandException, AuthorizationException {
|
||||
Iterable<? extends LocalPlayer> targets = null;
|
||||
|
@ -84,7 +84,7 @@ public class GeneralCommands {
|
|||
}
|
||||
}
|
||||
|
||||
@Command(aliases = {"ungod"}, usage = "[player]",
|
||||
@Command(aliases = {"ungod", "wgungod"}, usage = "[player]",
|
||||
desc = "Disable godmode on a player", flags = "s", max = 1)
|
||||
public void ungod(CommandContext args, Actor sender) throws CommandException, AuthorizationException {
|
||||
Iterable<? extends LocalPlayer> targets;
|
||||
|
@ -127,7 +127,7 @@ public class GeneralCommands {
|
|||
}
|
||||
}
|
||||
|
||||
@Command(aliases = {"heal"}, usage = "[player]", desc = "Heal a player", flags = "s", max = 1)
|
||||
@Command(aliases = {"heal", "wgheal"}, usage = "[player]", desc = "Heal a player", flags = "s", max = 1)
|
||||
public void heal(CommandContext args, Actor sender) throws CommandException, AuthorizationException {
|
||||
|
||||
Iterable<? extends LocalPlayer> targets = null;
|
||||
|
@ -171,7 +171,7 @@ public class GeneralCommands {
|
|||
}
|
||||
}
|
||||
|
||||
@Command(aliases = {"slay"}, usage = "[player]", desc = "Slay a player", flags = "s", max = 1)
|
||||
@Command(aliases = {"slay", "wgslay"}, usage = "[player]", desc = "Slay a player", flags = "s", max = 1)
|
||||
public void slay(CommandContext args, Actor sender) throws CommandException, AuthorizationException {
|
||||
|
||||
Iterable<? extends LocalPlayer> targets = Lists.newArrayList();
|
||||
|
@ -212,7 +212,7 @@ public class GeneralCommands {
|
|||
}
|
||||
}
|
||||
|
||||
@Command(aliases = {"locate"}, usage = "[player]", desc = "Locate a player", max = 1)
|
||||
@Command(aliases = {"locate", "locate"}, usage = "[player]", desc = "Locate a player", max = 1)
|
||||
@CommandPermissions({"worldguard.locate"})
|
||||
public void locate(CommandContext args, Actor sender) throws CommandException {
|
||||
LocalPlayer player = worldGuard.checkPlayer(sender);
|
||||
|
@ -229,7 +229,7 @@ public class GeneralCommands {
|
|||
}
|
||||
}
|
||||
|
||||
@Command(aliases = {"stack", ";"}, usage = "", desc = "Stack items", max = 0)
|
||||
@Command(aliases = {"stack", "wgstack", ";"}, usage = "", desc = "Stack items", max = 0)
|
||||
@CommandPermissions({"worldguard.stack"})
|
||||
public void stack(CommandContext args, Actor sender) throws CommandException {
|
||||
LocalPlayer player = worldGuard.checkPlayer(sender);
|
||||
|
@ -238,4 +238,6 @@ public class GeneralCommands {
|
|||
|
||||
player.print("Items compacted into stacks!");
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
|
|
@ -0,0 +1,70 @@
|
|||
/*
|
||||
* WorldGuard, a suite of tools for Minecraft
|
||||
* Copyright (C) sk89q <http://www.sk89q.com>
|
||||
* Copyright (C) WorldGuard team and contributors
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify it
|
||||
* under the terms of the GNU Lesser General Public License as published by the
|
||||
* Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful, but WITHOUT
|
||||
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License
|
||||
* for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
package com.sk89q.worldguard.commands;
|
||||
|
||||
import com.sk89q.minecraft.util.commands.Command;
|
||||
import com.sk89q.minecraft.util.commands.CommandContext;
|
||||
import com.sk89q.minecraft.util.commands.CommandException;
|
||||
import com.sk89q.minecraft.util.commands.CommandPermissions;
|
||||
import com.sk89q.worldedit.extension.platform.Actor;
|
||||
import com.sk89q.worldedit.util.auth.AuthorizationException;
|
||||
import com.sk89q.worldguard.WorldGuard;
|
||||
|
||||
public class GeneralCompatibleCommands {
|
||||
private final GeneralCommands generalCommands;
|
||||
|
||||
public GeneralCompatibleCommands(WorldGuard worldGuard) {
|
||||
this.generalCommands = new GeneralCommands(worldGuard);
|
||||
}
|
||||
|
||||
@Command(aliases = {"wggod"}, usage = "[player]",
|
||||
desc = "Enable godmode on a player", flags = "s", max = 1)
|
||||
public void god(CommandContext args, Actor sender) throws CommandException, AuthorizationException {
|
||||
generalCommands.god(args, sender);
|
||||
}
|
||||
|
||||
@Command(aliases = {"wgungod"}, usage = "[player]",
|
||||
desc = "Disable godmode on a player", flags = "s", max = 1)
|
||||
public void ungod(CommandContext args, Actor sender) throws CommandException, AuthorizationException {
|
||||
generalCommands.ungod(args, sender);
|
||||
}
|
||||
|
||||
@Command(aliases = {"wgheal"}, usage = "[player]", desc = "Heal a player", flags = "s", max = 1)
|
||||
public void heal(CommandContext args, Actor sender) throws CommandException, AuthorizationException {
|
||||
generalCommands.heal(args, sender);
|
||||
}
|
||||
|
||||
@Command(aliases = {"wgslay"}, usage = "[player]", desc = "Slay a player", flags = "s", max = 1)
|
||||
public void slay(CommandContext args, Actor sender) throws CommandException, AuthorizationException {
|
||||
generalCommands.slay(args, sender);
|
||||
}
|
||||
|
||||
@Command(aliases = {"wglocate"}, usage = "[player]", desc = "Locate a player", max = 1)
|
||||
@CommandPermissions({"worldguard.locate"})
|
||||
public void locate(CommandContext args, Actor sender) throws CommandException {
|
||||
generalCommands.locate(args, sender);
|
||||
}
|
||||
|
||||
@Command(aliases = {"wgstack", ";"}, usage = "", desc = "Stack items", max = 0)
|
||||
@CommandPermissions({"worldguard.stack"})
|
||||
public void stack(CommandContext args, Actor sender) throws CommandException {
|
||||
generalCommands.stack(args, sender);
|
||||
}
|
||||
}
|
Loading…
Reference in New Issue