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 {
mavenLocal()
// mavenLocal()
maven {
url = uri("https://papermc.io/repo/repository/maven-public/")
}
@ -39,7 +39,7 @@ repositories {
}
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("com.github.NeumimTo:Pl3xMap:1.18-2")
testImplementation("org.junit.jupiter:junit-jupiter:5.7.0")
@ -51,7 +51,7 @@ dependencies {
group = "com.griefprevention"
version = "16.18-RC2-SNAPSHOT"
description = "GriefPrevention"
java.sourceCompatibility = JavaVersion.VERSION_16
java.sourceCompatibility = JavaVersion.VERSION_17
publishing {
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()))
{
Block earthBlock = placeEvent.getBlockAgainst();
if (earthBlock.getType() != Material.GRASS)
if (earthBlock.getType() != Material.SHORT_GRASS)
{
if (earthBlock.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;
}
static void banPlayer(Player player, String reason, String source)
{
if (GriefPrevention.instance.config_ban_useCommand)
{
Bukkit.getServer().dispatchCommand(
Bukkit.getConsoleSender(),
GriefPrevention.instance.config_ban_commandFormat.replace("%name%", player.getName()).replace("%reason%", reason));
}
else
{
BanList bans = Bukkit.getServer().getBanList(Type.NAME);
bans.addBan(player.getName(), reason, null, source);
//kick
if (player.isOnline())
{
player.kickPlayer(reason);
}
}
}
// static void banPlayer(Player player, String reason, String source)
// {
// if (GriefPrevention.instance.config_ban_useCommand)
// {
// Bukkit.getServer().dispatchCommand(
// Bukkit.getConsoleSender(),
// GriefPrevention.instance.config_ban_commandFormat.replace("%name%", player.getName()).replace("%reason%", reason));
// }
// else
// {
// BanList bans = Bukkit.getServer().getBanList(Type.NAME);
// bans.addBan(player.getName(), reason, null, source);
//
// //kick
// if (player.isOnline())
// {
// player.kickPlayer(reason);
// }
// }
// }
public ItemStack getItemInHand(Player player, EquipmentSlot hand)
{

View File

@ -1560,7 +1560,7 @@ class PlayerEventHandler implements Listener
}
else
{
allowedFillBlocks.add(Material.GRASS);
allowedFillBlocks.add(Material.SHORT_GRASS);
allowedFillBlocks.add(Material.DIRT);
allowedFillBlocks.add(Material.STONE);
allowedFillBlocks.add(Material.SAND);
@ -1624,7 +1624,7 @@ class PlayerEventHandler implements Listener
}
//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 (y == maxHeight)
@ -2066,7 +2066,7 @@ class PlayerEventHandler implements Listener
Material type = result.getType();
if (type != Material.AIR &&
(!passThroughWater || type != Material.WATER) &&
type != Material.GRASS &&
type != Material.SHORT_GRASS &&
type != Material.SNOW) return result;
}

View File

@ -1,71 +1,72 @@
/*
GriefPrevention Server Plugin for Minecraft
Copyright (C) 2012 Ryan Hamshire
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
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 General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
package me.ryanhamshire.GriefPrevention;
import me.ryanhamshire.GriefPrevention.events.PlayerKickBanEvent;
import org.bukkit.Bukkit;
import org.bukkit.entity.Player;
//kicks or bans a player
//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
class PlayerKickBanTask implements Runnable
{
//player to kick or ban
private final Player player;
//message to send player.
private final String reason;
//source of ban
private final String source;
//whether to ban
private final boolean ban;
public PlayerKickBanTask(Player player, String reason, String source, boolean ban)
{
this.player = player;
this.reason = reason;
this.source = source;
this.ban = ban;
}
@Override
public void run()
{
PlayerKickBanEvent kickBanEvent = new PlayerKickBanEvent(player, reason, source, ban);
Bukkit.getPluginManager().callEvent(kickBanEvent);
if (kickBanEvent.isCancelled())
{
return; // cancelled by a plugin
}
if (this.ban)
{
//ban
GriefPrevention.banPlayer(this.player, this.reason, this.source);
}
else if (this.player.isOnline())
{
this.player.kickPlayer(this.reason);
}
}
}
/*
GriefPrevention Server Plugin for Minecraft
Copyright (C) 2012 Ryan Hamshire
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
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 General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
package me.ryanhamshire.GriefPrevention;
import me.ryanhamshire.GriefPrevention.events.PlayerKickBanEvent;
import org.bukkit.Bukkit;
import org.bukkit.entity.Player;
//kicks or bans a player
//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
class PlayerKickBanTask implements Runnable
{
//player to kick or ban
private final Player player;
//message to send player.
private final String reason;
//source of ban
private final String source;
//whether to ban
private final boolean ban;
public PlayerKickBanTask(Player player, String reason, String source, boolean ban)
{
this.player = player;
this.reason = reason;
this.source = source;
this.ban = ban;
}
@Override
public void run()
{
PlayerKickBanEvent kickBanEvent = new PlayerKickBanEvent(player, reason, source, ban);
Bukkit.getPluginManager().callEvent(kickBanEvent);
if (kickBanEvent.isCancelled())
{
return; // cancelled by a plugin
}
if (this.ban)
{
//ban
// GriefPrevention.banPlayer(this.player, this.reason, this.source);
this.player.kickPlayer(this.reason);
}
else if (this.player.isOnline())
{
this.player.kickPlayer(this.reason);
}
}
}