Update to 1.20.4

This commit is contained in:
Len 2024-01-05 19:15:43 +01:00
parent d26c6a8082
commit fc816340d5
6 changed files with 989 additions and 988 deletions

View File

@ -8,7 +8,7 @@ plugins {
} }
repositories { repositories {
mavenLocal() // mavenLocal()
maven { maven {
url = uri("https://papermc.io/repo/repository/maven-public/") url = uri("https://papermc.io/repo/repository/maven-public/")
} }
@ -39,7 +39,7 @@ repositories {
} }
dependencies { dependencies {
compileOnly("com.alttd:Galaxy-API:1.18.2-R0.1-SNAPSHOT") compileOnly("com.alttd:Galaxy-API:1.20.4-R0.1-SNAPSHOT")
compileOnly("de.keyle:mypet:3.11-SNAPSHOT") compileOnly("de.keyle:mypet:3.11-SNAPSHOT")
compileOnly("com.github.NeumimTo:Pl3xMap:1.18-2") compileOnly("com.github.NeumimTo:Pl3xMap:1.18-2")
testImplementation("org.junit.jupiter:junit-jupiter:5.7.0") testImplementation("org.junit.jupiter:junit-jupiter:5.7.0")
@ -51,7 +51,7 @@ dependencies {
group = "com.griefprevention" group = "com.griefprevention"
version = "16.18-RC2-SNAPSHOT" version = "16.18-RC2-SNAPSHOT"
description = "GriefPrevention" description = "GriefPrevention"
java.sourceCompatibility = JavaVersion.VERSION_16 java.sourceCompatibility = JavaVersion.VERSION_17
publishing { publishing {
publications.create<MavenPublication>("maven") { publications.create<MavenPublication>("maven") {

View File

@ -411,7 +411,7 @@ public class BlockEventHandler implements Listener
else if (Tag.SAPLINGS.isTagged(block.getType()) && GriefPrevention.instance.config_blockSkyTrees && GriefPrevention.instance.claimsEnabledForWorld(player.getWorld())) else if (Tag.SAPLINGS.isTagged(block.getType()) && GriefPrevention.instance.config_blockSkyTrees && GriefPrevention.instance.claimsEnabledForWorld(player.getWorld()))
{ {
Block earthBlock = placeEvent.getBlockAgainst(); Block earthBlock = placeEvent.getBlockAgainst();
if (earthBlock.getType() != Material.GRASS) if (earthBlock.getType() != Material.SHORT_GRASS)
{ {
if (earthBlock.getRelative(BlockFace.DOWN).getType() == Material.AIR || if (earthBlock.getRelative(BlockFace.DOWN).getType() == Material.AIR ||
earthBlock.getRelative(BlockFace.DOWN).getRelative(BlockFace.DOWN).getType() == Material.AIR) earthBlock.getRelative(BlockFace.DOWN).getRelative(BlockFace.DOWN).getType() == Material.AIR)

View File

@ -3239,26 +3239,26 @@ public class GriefPrevention extends JavaPlugin
return true; return true;
} }
static void banPlayer(Player player, String reason, String source) // static void banPlayer(Player player, String reason, String source)
{ // {
if (GriefPrevention.instance.config_ban_useCommand) // if (GriefPrevention.instance.config_ban_useCommand)
{ // {
Bukkit.getServer().dispatchCommand( // Bukkit.getServer().dispatchCommand(
Bukkit.getConsoleSender(), // Bukkit.getConsoleSender(),
GriefPrevention.instance.config_ban_commandFormat.replace("%name%", player.getName()).replace("%reason%", reason)); // GriefPrevention.instance.config_ban_commandFormat.replace("%name%", player.getName()).replace("%reason%", reason));
} // }
else // else
{ // {
BanList bans = Bukkit.getServer().getBanList(Type.NAME); // BanList bans = Bukkit.getServer().getBanList(Type.NAME);
bans.addBan(player.getName(), reason, null, source); // bans.addBan(player.getName(), reason, null, source);
//
//kick // //kick
if (player.isOnline()) // if (player.isOnline())
{ // {
player.kickPlayer(reason); // player.kickPlayer(reason);
} // }
} // }
} // }
public ItemStack getItemInHand(Player player, EquipmentSlot hand) public ItemStack getItemInHand(Player player, EquipmentSlot hand)
{ {

View File

@ -1560,7 +1560,7 @@ class PlayerEventHandler implements Listener
} }
else else
{ {
allowedFillBlocks.add(Material.GRASS); allowedFillBlocks.add(Material.SHORT_GRASS);
allowedFillBlocks.add(Material.DIRT); allowedFillBlocks.add(Material.DIRT);
allowedFillBlocks.add(Material.STONE); allowedFillBlocks.add(Material.STONE);
allowedFillBlocks.add(Material.SAND); allowedFillBlocks.add(Material.SAND);
@ -1624,7 +1624,7 @@ class PlayerEventHandler implements Listener
} }
//only replace air, spilling water, snow, long grass //only replace air, spilling water, snow, long grass
if (block.getType() == Material.AIR || block.getType() == Material.SNOW || (block.getType() == Material.WATER && ((Levelled) block.getBlockData()).getLevel() != 0) || block.getType() == Material.GRASS) if (block.getType() == Material.AIR || block.getType() == Material.SNOW || (block.getType() == Material.WATER && ((Levelled) block.getBlockData()).getLevel() != 0) || block.getType() == Material.SHORT_GRASS)
{ {
//if the top level, always use the default filler picked above //if the top level, always use the default filler picked above
if (y == maxHeight) if (y == maxHeight)
@ -2066,7 +2066,7 @@ class PlayerEventHandler implements Listener
Material type = result.getType(); Material type = result.getType();
if (type != Material.AIR && if (type != Material.AIR &&
(!passThroughWater || type != Material.WATER) && (!passThroughWater || type != Material.WATER) &&
type != Material.GRASS && type != Material.SHORT_GRASS &&
type != Material.SNOW) return result; type != Material.SNOW) return result;
} }

View File

@ -1,71 +1,72 @@
/* /*
GriefPrevention Server Plugin for Minecraft GriefPrevention Server Plugin for Minecraft
Copyright (C) 2012 Ryan Hamshire Copyright (C) 2012 Ryan Hamshire
This program is free software: you can redistribute it and/or modify This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or the Free Software Foundation, either version 3 of the License, or
(at your option) any later version. (at your option) any later version.
This program is distributed in the hope that it will be useful, This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details. GNU General Public License for more details.
You should have received a copy of the GNU General Public License You should have received a copy of the GNU General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>. along with this program. If not, see <http://www.gnu.org/licenses/>.
*/ */
package me.ryanhamshire.GriefPrevention; package me.ryanhamshire.GriefPrevention;
import me.ryanhamshire.GriefPrevention.events.PlayerKickBanEvent; import me.ryanhamshire.GriefPrevention.events.PlayerKickBanEvent;
import org.bukkit.Bukkit; import org.bukkit.Bukkit;
import org.bukkit.entity.Player; import org.bukkit.entity.Player;
//kicks or bans a player //kicks or bans a player
//need a task for this because async threads (like the chat event handlers) can't kick or ban. //need a task for this because async threads (like the chat event handlers) can't kick or ban.
//but they CAN schedule a task to run in the main thread to do that job //but they CAN schedule a task to run in the main thread to do that job
class PlayerKickBanTask implements Runnable class PlayerKickBanTask implements Runnable
{ {
//player to kick or ban //player to kick or ban
private final Player player; private final Player player;
//message to send player. //message to send player.
private final String reason; private final String reason;
//source of ban //source of ban
private final String source; private final String source;
//whether to ban //whether to ban
private final boolean ban; private final boolean ban;
public PlayerKickBanTask(Player player, String reason, String source, boolean ban) public PlayerKickBanTask(Player player, String reason, String source, boolean ban)
{ {
this.player = player; this.player = player;
this.reason = reason; this.reason = reason;
this.source = source; this.source = source;
this.ban = ban; this.ban = ban;
} }
@Override @Override
public void run() public void run()
{ {
PlayerKickBanEvent kickBanEvent = new PlayerKickBanEvent(player, reason, source, ban); PlayerKickBanEvent kickBanEvent = new PlayerKickBanEvent(player, reason, source, ban);
Bukkit.getPluginManager().callEvent(kickBanEvent); Bukkit.getPluginManager().callEvent(kickBanEvent);
if (kickBanEvent.isCancelled()) if (kickBanEvent.isCancelled())
{ {
return; // cancelled by a plugin return; // cancelled by a plugin
} }
if (this.ban) if (this.ban)
{ {
//ban //ban
GriefPrevention.banPlayer(this.player, this.reason, this.source); // GriefPrevention.banPlayer(this.player, this.reason, this.source);
} this.player.kickPlayer(this.reason);
else if (this.player.isOnline()) }
{ else if (this.player.isOnline())
this.player.kickPlayer(this.reason); {
} this.player.kickPlayer(this.reason);
} }
} }
}