mirror of
https://github.com/EngineHub/WorldGuard.git
synced 2024-06-26 14:34:53 +02:00
Merge f0cebc4b10
into 0a9eb447d6
This commit is contained in:
commit
9fb1fad1fd
|
@ -37,6 +37,7 @@ public class BukkitConfigurationManager extends YamlConfigurationManager {
|
||||||
|
|
||||||
private boolean hasCommandBookGodMode;
|
private boolean hasCommandBookGodMode;
|
||||||
boolean extraStats;
|
boolean extraStats;
|
||||||
|
private boolean hasEssentialsGodMode;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Construct the object.
|
* Construct the object.
|
||||||
|
@ -124,4 +125,12 @@ public void updateCommandBookGodMode() {
|
||||||
public boolean hasCommandBookGodMode() {
|
public boolean hasCommandBookGodMode() {
|
||||||
return 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.Entities;
|
import com.sk89q.worldguard.bukkit.util.Entities;
|
||||||
import com.sk89q.worldguard.bukkit.util.Events;
|
import com.sk89q.worldguard.bukkit.util.Events;
|
||||||
import com.sk89q.worldguard.commands.GeneralCommands;
|
import com.sk89q.worldguard.commands.GeneralCommands;
|
||||||
|
import com.sk89q.worldguard.commands.GeneralCompatibleCommands;
|
||||||
import com.sk89q.worldguard.commands.ProtectionCommands;
|
import com.sk89q.worldguard.commands.ProtectionCommands;
|
||||||
import com.sk89q.worldguard.commands.ToggleCommands;
|
import com.sk89q.worldguard.commands.ToggleCommands;
|
||||||
import com.sk89q.worldguard.domains.registry.SimpleDomainRegistry;
|
import com.sk89q.worldguard.domains.registry.SimpleDomainRegistry;
|
||||||
|
@ -160,8 +161,13 @@ public void onEnable() {
|
||||||
reg.register(ToggleCommands.class);
|
reg.register(ToggleCommands.class);
|
||||||
reg.register(ProtectionCommands.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);
|
reg.register(GeneralCommands.class);
|
||||||
|
}else{
|
||||||
|
reg.register(GeneralCompatibleCommands.class);
|
||||||
}
|
}
|
||||||
|
|
||||||
getServer().getScheduler().scheduleSyncRepeatingTask(this, sessionManager, BukkitSessionManager.RUN_DELAY, BukkitSessionManager.RUN_DELAY);
|
getServer().getScheduler().scheduleSyncRepeatingTask(this, sessionManager, BukkitSessionManager.RUN_DELAY, BukkitSessionManager.RUN_DELAY);
|
||||||
|
@ -192,8 +198,6 @@ public void onEnable() {
|
||||||
(new DebuggingListener(this, WorldGuard.logger)).registerEvents();
|
(new DebuggingListener(this, WorldGuard.logger)).registerEvents();
|
||||||
}
|
}
|
||||||
|
|
||||||
platform.getGlobalStateManager().updateCommandBookGodMode();
|
|
||||||
|
|
||||||
if (getServer().getPluginManager().isPluginEnabled("CommandBook")) {
|
if (getServer().getPluginManager().isPluginEnabled("CommandBook")) {
|
||||||
getServer().getPluginManager().registerEvents(new WorldGuardCommandBookListener(this), this);
|
getServer().getPluginManager().registerEvents(new WorldGuardCommandBookListener(this), this);
|
||||||
}
|
}
|
||||||
|
|
|
@ -35,6 +35,10 @@ public void onPluginEnable(PluginEnableEvent event) {
|
||||||
if (event.getPlugin().getDescription().getName().equalsIgnoreCase("CommandBook")) {
|
if (event.getPlugin().getDescription().getName().equalsIgnoreCase("CommandBook")) {
|
||||||
getConfig().updateCommandBookGodMode();
|
getConfig().updateCommandBookGodMode();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if(event.getPlugin().getDescription().getName().equalsIgnoreCase("Essentials")){
|
||||||
|
getConfig().updateEssentialsGodMode();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@EventHandler
|
@EventHandler
|
||||||
|
@ -42,5 +46,9 @@ public void onPluginDisable(PluginDisableEvent event) {
|
||||||
if (event.getPlugin().getDescription().getName().equalsIgnoreCase("CommandBook")) {
|
if (event.getPlugin().getDescription().getName().equalsIgnoreCase("CommandBook")) {
|
||||||
getConfig().updateCommandBookGodMode();
|
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
|
# - If you want to check the format of this file before putting it
|
||||||
# into WorldGuard, paste it into http://yaml-online-parser.appspot.com/
|
# into WorldGuard, paste it into http://yaml-online-parser.appspot.com/
|
||||||
# and see if it gives "ERROR:".
|
# 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:
|
# WARNING:
|
||||||
# Remember to check the compatibility spreadsheet for WorldGuard to see
|
# Remember to check the compatibility spreadsheet for WorldGuard to see
|
||||||
|
|
|
@ -2,5 +2,5 @@ name: WorldGuard
|
||||||
main: com.sk89q.worldguard.bukkit.WorldGuardPlugin
|
main: com.sk89q.worldguard.bukkit.WorldGuardPlugin
|
||||||
version: "${internalVersion}"
|
version: "${internalVersion}"
|
||||||
depend: [WorldEdit]
|
depend: [WorldEdit]
|
||||||
softdepend: [CommandBook]
|
softdepend: [CommandBook, Essentials]
|
||||||
api-version: "1.20"
|
api-version: "1.20"
|
||||||
|
|
|
@ -39,7 +39,7 @@ public GeneralCommands(WorldGuard worldGuard) {
|
||||||
this.worldGuard = worldGuard;
|
this.worldGuard = worldGuard;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Command(aliases = {"god"}, usage = "[player]",
|
@Command(aliases = {"god", "wggod"}, usage = "[player]",
|
||||||
desc = "Enable godmode on a player", flags = "s", max = 1)
|
desc = "Enable godmode on a player", flags = "s", max = 1)
|
||||||
public void god(CommandContext args, Actor sender) throws CommandException, AuthorizationException {
|
public void god(CommandContext args, Actor sender) throws CommandException, AuthorizationException {
|
||||||
Iterable<? extends LocalPlayer> targets = null;
|
Iterable<? extends LocalPlayer> targets = null;
|
||||||
|
@ -84,7 +84,7 @@ public void god(CommandContext args, Actor sender) throws CommandException, Auth
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@Command(aliases = {"ungod"}, usage = "[player]",
|
@Command(aliases = {"ungod", "wgungod"}, usage = "[player]",
|
||||||
desc = "Disable godmode on a player", flags = "s", max = 1)
|
desc = "Disable godmode on a player", flags = "s", max = 1)
|
||||||
public void ungod(CommandContext args, Actor sender) throws CommandException, AuthorizationException {
|
public void ungod(CommandContext args, Actor sender) throws CommandException, AuthorizationException {
|
||||||
Iterable<? extends LocalPlayer> targets;
|
Iterable<? extends LocalPlayer> targets;
|
||||||
|
@ -127,7 +127,7 @@ public void ungod(CommandContext args, Actor sender) throws CommandException, Au
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@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 {
|
public void heal(CommandContext args, Actor sender) throws CommandException, AuthorizationException {
|
||||||
|
|
||||||
Iterable<? extends LocalPlayer> targets = null;
|
Iterable<? extends LocalPlayer> targets = null;
|
||||||
|
@ -171,7 +171,7 @@ public void heal(CommandContext args, Actor sender) throws CommandException, Aut
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@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 {
|
public void slay(CommandContext args, Actor sender) throws CommandException, AuthorizationException {
|
||||||
|
|
||||||
Iterable<? extends LocalPlayer> targets = Lists.newArrayList();
|
Iterable<? extends LocalPlayer> targets = Lists.newArrayList();
|
||||||
|
@ -212,7 +212,7 @@ public void slay(CommandContext args, Actor sender) throws CommandException, Aut
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@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"})
|
@CommandPermissions({"worldguard.locate"})
|
||||||
public void locate(CommandContext args, Actor sender) throws CommandException {
|
public void locate(CommandContext args, Actor sender) throws CommandException {
|
||||||
LocalPlayer player = worldGuard.checkPlayer(sender);
|
LocalPlayer player = worldGuard.checkPlayer(sender);
|
||||||
|
@ -229,7 +229,7 @@ public void locate(CommandContext args, Actor sender) throws CommandException {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@Command(aliases = {"stack", ";"}, usage = "", desc = "Stack items", max = 0)
|
@Command(aliases = {"stack", "wgstack", ";"}, usage = "", desc = "Stack items", max = 0)
|
||||||
@CommandPermissions({"worldguard.stack"})
|
@CommandPermissions({"worldguard.stack"})
|
||||||
public void stack(CommandContext args, Actor sender) throws CommandException {
|
public void stack(CommandContext args, Actor sender) throws CommandException {
|
||||||
LocalPlayer player = worldGuard.checkPlayer(sender);
|
LocalPlayer player = worldGuard.checkPlayer(sender);
|
||||||
|
@ -238,4 +238,6 @@ public void stack(CommandContext args, Actor sender) throws CommandException {
|
||||||
|
|
||||||
player.print("Items compacted into stacks!");
|
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
Block a user