This commit is contained in:
Loki 2024-01-30 09:41:54 -05:00 committed by GitHub
commit 23c4f402d2
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
6 changed files with 23 additions and 10 deletions

View File

@ -20,8 +20,8 @@ configurations {
dependencies {
"api"(project(":worldguard-core"))
"compileOnly"("io.papermc.paper:paper-api:1.20-R0.1-SNAPSHOT")
"runtimeOnly"("org.spigotmc:spigot-api:1.20-R0.1-SNAPSHOT") {
"compileOnly"("io.papermc.paper:paper-api:1.20.1-R0.1-SNAPSHOT")
"runtimeOnly"("org.spigotmc:spigot-api:1.20.1-R0.1-SNAPSHOT") {
exclude("junit", "junit")
}
"api"("com.sk89q.worldedit:worldedit-bukkit:${Versions.WORLDEDIT}") { isTransitive = false }

View File

@ -34,8 +34,9 @@ public class BukkitConfigurationManager extends YamlConfigurationManager {
@Unreported private WorldGuardPlugin plugin;
@Unreported private ConcurrentMap<String, BukkitWorldConfiguration> worlds = new ConcurrentHashMap<>();
private boolean isFreshInstall;
private boolean hasCommandBookGodMode;
boolean disableGeneralCommands;
boolean extraStats;
/**
@ -56,6 +57,8 @@ public class BukkitConfigurationManager extends YamlConfigurationManager {
public void load() {
super.load();
this.extraStats = getConfig().getBoolean("custom-metrics-charts", true);
// Disable legacy commands for fresh installs
this.disableGeneralCommands = getConfig().getBoolean("disable-general-commands", isFreshInstall);
}
@Override
@ -66,7 +69,7 @@ public class BukkitConfigurationManager extends YamlConfigurationManager {
@Override
public void copyDefaults() {
// Create the default configuration file
plugin.createDefaultConfiguration(new File(plugin.getDataFolder(), "config.yml"), "config.yml");
isFreshInstall = plugin.createDefaultConfiguration(new File(plugin.getDataFolder(), "config.yml"), "config.yml");
}
@Override

View File

@ -160,7 +160,7 @@ public class WorldGuardPlugin extends JavaPlugin {
reg.register(ToggleCommands.class);
reg.register(ProtectionCommands.class);
if (!platform.getGlobalStateManager().hasCommandBookGodMode()) {
if (!platform.getGlobalStateManager().disableGeneralCommands && !platform.getGlobalStateManager().hasCommandBookGodMode()) {
reg.register(GeneralCommands.class);
}
@ -488,7 +488,7 @@ public class WorldGuardPlugin extends JavaPlugin {
* @param actual The destination file
* @param defaultName The name of the file inside the jar's defaults folder
*/
public void createDefaultConfiguration(File actual, String defaultName) {
public boolean createDefaultConfiguration(File actual, String defaultName) {
// Make parent directories
File parent = actual.getParentFile();
@ -497,7 +497,7 @@ public class WorldGuardPlugin extends JavaPlugin {
}
if (actual.exists()) {
return;
return false;
}
try (InputStream stream = getResource("defaults/" + defaultName)){
@ -506,7 +506,7 @@ public class WorldGuardPlugin extends JavaPlugin {
} catch (IOException e) {
getLogger().severe("Unable to read default configuration: " + defaultName);
}
return true;
}
private void copyDefaultConfig(InputStream input, File actual, String name) {

View File

@ -47,6 +47,7 @@ import com.sk89q.worldguard.bukkit.util.Materials;
import com.sk89q.worldguard.config.WorldConfiguration;
import com.sk89q.worldguard.protection.flags.Flags;
import io.papermc.lib.PaperLib;
import io.papermc.paper.event.player.PlayerOpenSignEvent;
import org.bukkit.Bukkit;
import org.bukkit.Effect;
import org.bukkit.GameMode;
@ -1266,5 +1267,13 @@ public class EventAbstractionListener extends AbstractListener {
public void onEntityTransform(EntityZapEvent event) {
Events.fireToCancel(event, new DamageEntityEvent(event, create(event.getBolt()), event.getEntity()));
}
@EventHandler(ignoreCancelled = true)
public void onSignOpen(PlayerOpenSignEvent event) {
if (event.getCause() == PlayerOpenSignEvent.Cause.INTERACT) {
// other cases are handled by other events
Events.fireToCancel(event, new UseBlockEvent(event, create(event.getPlayer()), event.getSign().getBlock()));
}
}
}
}

View File

@ -60,7 +60,7 @@ public class PlayerMoveListener extends AbstractListener {
}
}
@EventHandler
@EventHandler(priority = EventPriority.MONITOR)
public void onPlayerRespawn(PlayerRespawnEvent event) {
LocalPlayer player = getPlugin().wrapPlayer(event.getPlayer());

View File

@ -1343,7 +1343,8 @@ public final class Materials {
|| type == Material.DRAGON_EGG
|| Tag.FLOWER_POTS.isTagged(type)
|| Tag.CANDLES.isTagged(type)
|| Tag.CANDLE_CAKES.isTagged(type);
|| Tag.CANDLE_CAKES.isTagged(type)
|| Tag.ALL_SIGNS.isTagged(type);
}
/**