Merge branch 'development' into FS-452-not-fucked

This commit is contained in:
Ryan 2022-10-12 21:37:18 +01:00 committed by GitHub
commit 5246639608
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
13 changed files with 61 additions and 120 deletions

View File

@ -38,7 +38,7 @@ jobs:
uses: actions/checkout@v3 uses: actions/checkout@v3
- name: Setup Java JDK - name: Setup Java JDK
uses: actions/setup-java@v3.3.0 uses: actions/setup-java@v3.5.1
with: with:
# The Java version to make available on the path. Takes a whole or semver Java version, or 1.x syntax (e.g. 1.8 => Java 8.x). Early access versions can be specified in the form of e.g. 14-ea, 14.0.0-ea, or 14.0.0-ea.28 # The Java version to make available on the path. Takes a whole or semver Java version, or 1.x syntax (e.g. 1.8 => Java 8.x). Early access versions can be specified in the form of e.g. 14-ea, 14.0.0-ea, or 14.0.0-ea.28
java-version: 17 java-version: 17

View File

@ -17,10 +17,10 @@ jobs:
steps: steps:
# Step 1: run a standard checkout action, provided by github # Step 1: run a standard checkout action, provided by github
- name: Checkout main - name: Checkout current development branch
uses: actions/checkout@v3 uses: actions/checkout@v2
with: with:
ref: main ref: development
# submodules: 'recursive' ### may be needed in your situation # submodules: 'recursive' ### may be needed in your situation
# Step 2: run this sync action - specify the upstream repo, upstream branch to sync with, and target sync branch # Step 2: run this sync action - specify the upstream repo, upstream branch to sync with, and target sync branch

View File

@ -13,7 +13,7 @@ jobs:
# Java 16 Builds # Java 16 Builds
- name: Set up JDK 17 - name: Set up JDK 17
uses: actions/setup-java@v3.3.0 uses: actions/setup-java@v3.5.1
with: with:
java-version: 17 java-version: 17
distribution: 'adopt' distribution: 'adopt'

20
pom.xml
View File

@ -101,7 +101,6 @@
<url>https://repo.essentialsx.net/releases/</url> <url>https://repo.essentialsx.net/releases/</url>
</repository> </repository>
</repositories> </repositories>
<dependencies> <dependencies>
@ -128,8 +127,8 @@
</dependency> </dependency>
<dependency> <dependency>
<groupId>io.papermc.paper</groupId> <groupId>me.totalfreedom.scissors</groupId>
<artifactId>paper-api</artifactId> <artifactId>scissors-api</artifactId>
<version>1.17.1-R0.1-SNAPSHOT</version> <version>1.17.1-R0.1-SNAPSHOT</version>
<scope>provided</scope> <scope>provided</scope>
</dependency> </dependency>
@ -151,7 +150,7 @@
<dependency> <dependency>
<groupId>com.sk89q.worldedit</groupId> <groupId>com.sk89q.worldedit</groupId>
<artifactId>worldedit-bukkit</artifactId> <artifactId>worldedit-bukkit</artifactId>
<version>7.2.10</version> <version>7.2.12</version>
<scope>provided</scope> <scope>provided</scope>
</dependency> </dependency>
@ -193,7 +192,7 @@
<dependency> <dependency>
<groupId>net.essentialsx</groupId> <groupId>net.essentialsx</groupId>
<artifactId>EssentialsX</artifactId> <artifactId>EssentialsX</artifactId>
<version>2.19.4</version> <version>2.19.6</version>
<scope>provided</scope> <scope>provided</scope>
</dependency> </dependency>
@ -207,17 +206,10 @@
<dependency> <dependency>
<groupId>org.javassist</groupId> <groupId>org.javassist</groupId>
<artifactId>javassist</artifactId> <artifactId>javassist</artifactId>
<version>3.29.0-GA</version> <version>3.29.1-GA</version>
<scope>compile</scope> <scope>compile</scope>
</dependency> </dependency>
<dependency>
<groupId>me.totalfreedom</groupId>
<artifactId>tfguilds</artifactId>
<version>2021.06-RC2</version>
<scope>provided</scope>
</dependency>
<dependency> <dependency>
<groupId>org.jetbrains</groupId> <groupId>org.jetbrains</groupId>
<artifactId>annotations</artifactId> <artifactId>annotations</artifactId>
@ -235,7 +227,7 @@
<dependency> <dependency>
<groupId>org.junit.jupiter</groupId> <groupId>org.junit.jupiter</groupId>
<artifactId>junit-jupiter</artifactId> <artifactId>junit-jupiter</artifactId>
<version>5.8.2</version> <version>5.9.0</version>
<scope>compile</scope> <scope>compile</scope>
</dependency> </dependency>

View File

@ -136,7 +136,7 @@ public class ChatManager extends FreedomService
event.setFormat(format); event.setFormat(format);
// Send to discord // Send to discord
if (!ConfigEntry.ADMIN_ONLY_MODE.getBoolean() && !Bukkit.hasWhitelist() && !plugin.pl.getPlayer(player).isMuted() && !plugin.tfg.inGuildChat(player)) if (!ConfigEntry.ADMIN_ONLY_MODE.getBoolean() && !Bukkit.hasWhitelist() && !plugin.pl.getPlayer(player).isMuted())
{ {
plugin.dc.messageChatChannel(player.getName() + " \u00BB " + ChatColor.stripColor(message)); plugin.dc.messageChatChannel(player.getName() + " \u00BB " + ChatColor.stripColor(message));
} }

View File

@ -19,7 +19,6 @@ import me.totalfreedom.totalfreedommod.bridge.BukkitTelnetBridge;
import me.totalfreedom.totalfreedommod.bridge.CoreProtectBridge; import me.totalfreedom.totalfreedommod.bridge.CoreProtectBridge;
import me.totalfreedom.totalfreedommod.bridge.EssentialsBridge; import me.totalfreedom.totalfreedommod.bridge.EssentialsBridge;
import me.totalfreedom.totalfreedommod.bridge.LibsDisguisesBridge; import me.totalfreedom.totalfreedommod.bridge.LibsDisguisesBridge;
import me.totalfreedom.totalfreedommod.bridge.TFGuildsBridge;
import me.totalfreedom.totalfreedommod.bridge.WorldEditBridge; import me.totalfreedom.totalfreedommod.bridge.WorldEditBridge;
import me.totalfreedom.totalfreedommod.bridge.WorldGuardBridge; import me.totalfreedom.totalfreedommod.bridge.WorldGuardBridge;
import me.totalfreedom.totalfreedommod.caging.Cager; import me.totalfreedom.totalfreedommod.caging.Cager;
@ -128,7 +127,6 @@ public class TotalFreedomMod extends JavaPlugin
public EssentialsBridge esb; public EssentialsBridge esb;
public LibsDisguisesBridge ldb; public LibsDisguisesBridge ldb;
public CoreProtectBridge cpb; public CoreProtectBridge cpb;
public TFGuildsBridge tfg;
public WorldEditBridge web; public WorldEditBridge web;
public WorldGuardBridge wgb; public WorldGuardBridge wgb;
@ -342,7 +340,6 @@ public class TotalFreedomMod extends JavaPlugin
cpb = new CoreProtectBridge(); cpb = new CoreProtectBridge();
esb = new EssentialsBridge(); esb = new EssentialsBridge();
ldb = new LibsDisguisesBridge(); ldb = new LibsDisguisesBridge();
tfg = new TFGuildsBridge();
web = new WorldEditBridge(); web = new WorldEditBridge();
wgb = new WorldGuardBridge(); wgb = new WorldGuardBridge();
} }

View File

@ -71,7 +71,7 @@ public class BlockBlocker extends FreedomService
} }
case STRUCTURE_BLOCK: case STRUCTURE_BLOCK:
{ {
if (!ConfigEntry.ALLOW_STRUCTURE_BLOCKS.getBoolean()) if (!ConfigEntry.ALLOW_MASTERBLOCKS.getBoolean())
{ {
player.sendMessage(ChatColor.GRAY + "Structure blocks are disabled."); player.sendMessage(ChatColor.GRAY + "Structure blocks are disabled.");
player.getInventory().setItem(player.getInventory().getHeldItemSlot(), new ItemStack(Material.COOKIE, 1)); player.getInventory().setItem(player.getInventory().getHeldItemSlot(), new ItemStack(Material.COOKIE, 1));
@ -81,7 +81,7 @@ public class BlockBlocker extends FreedomService
} }
case JIGSAW: case JIGSAW:
{ {
if (!ConfigEntry.ALLOW_JIGSAWS.getBoolean()) if (!ConfigEntry.ALLOW_MASTERBLOCKS.getBoolean())
{ {
player.sendMessage(ChatColor.GRAY + "Jigsaws are disabled."); player.sendMessage(ChatColor.GRAY + "Jigsaws are disabled.");
player.getInventory().setItem(player.getInventory().getHeldItemSlot(), new ItemStack(Material.COOKIE, 1)); player.getInventory().setItem(player.getInventory().getHeldItemSlot(), new ItemStack(Material.COOKIE, 1));
@ -89,6 +89,16 @@ public class BlockBlocker extends FreedomService
} }
break; break;
} }
case REPEATING_COMMAND_BLOCK:
case CHAIN_COMMAND_BLOCK:
case COMMAND_BLOCK:
if (!ConfigEntry.ALLOW_MASTERBLOCKS.getBoolean())
{
player.sendMessage(ChatColor.GRAY + "Command blocks are disabled.");
player.getInventory().setItem(player.getInventory().getHeldItemSlot(), new ItemStack(Material.COOKIE, 1));
event.setCancelled(true);
}
break;
case GRINDSTONE: case GRINDSTONE:
{ {
if (!ConfigEntry.ALLOW_GRINDSTONES.getBoolean()) if (!ConfigEntry.ALLOW_GRINDSTONES.getBoolean())

View File

@ -4,7 +4,8 @@ import java.util.ArrayList;
import java.util.Arrays; import java.util.Arrays;
import java.util.List; import java.util.List;
import java.util.Objects; import java.util.Objects;
/* TODO This will have to be changed from com.github.atlasmediagroup.scissors to me.totalfreedom.scissors when we migrate to 1.19 */
import com.github.atlasmediagroup.scissors.event.block.MasterBlockFireEvent;
import io.papermc.paper.event.player.PlayerSignCommandPreprocessEvent; import io.papermc.paper.event.player.PlayerSignCommandPreprocessEvent;
import me.totalfreedom.totalfreedommod.FreedomService; import me.totalfreedom.totalfreedommod.FreedomService;
import me.totalfreedom.totalfreedommod.config.ConfigEntry; import me.totalfreedom.totalfreedommod.config.ConfigEntry;
@ -20,15 +21,7 @@ import org.bukkit.entity.FallingBlock;
import org.bukkit.entity.Tameable; import org.bukkit.entity.Tameable;
import org.bukkit.event.EventHandler; import org.bukkit.event.EventHandler;
import org.bukkit.event.EventPriority; import org.bukkit.event.EventPriority;
import org.bukkit.event.block.BlockBurnEvent; import org.bukkit.event.block.*;
import org.bukkit.event.block.BlockDispenseEvent;
import org.bukkit.event.block.BlockFromToEvent;
import org.bukkit.event.block.BlockGrowEvent;
import org.bukkit.event.block.BlockIgniteEvent;
import org.bukkit.event.block.BlockPhysicsEvent;
import org.bukkit.event.block.BlockPistonExtendEvent;
import org.bukkit.event.block.BlockPistonRetractEvent;
import org.bukkit.event.block.LeavesDecayEvent;
import org.bukkit.event.entity.EntityCombustEvent; import org.bukkit.event.entity.EntityCombustEvent;
import org.bukkit.event.entity.EntityDamageEvent; import org.bukkit.event.entity.EntityDamageEvent;
import org.bukkit.event.entity.EntityDeathEvent; import org.bukkit.event.entity.EntityDeathEvent;
@ -117,6 +110,28 @@ public class EventBlocker extends FreedomService
event.setRadius(ConfigEntry.EXPLOSIVE_RADIUS.getDouble().floatValue()); event.setRadius(ConfigEntry.EXPLOSIVE_RADIUS.getDouble().floatValue());
} }
@EventHandler(priority = EventPriority.HIGH)
public void onBlockExplode(BlockExplodeEvent event)
{
if (!ConfigEntry.ALLOW_EXPLOSIONS.getBoolean())
{
event.setCancelled(true);
return;
}
event.setYield(ConfigEntry.EXPLOSIVE_RADIUS.getDouble().floatValue());
}
@EventHandler(priority = EventPriority.HIGHEST)
public void onMasterBlockFire(MasterBlockFireEvent event)
{
if (!ConfigEntry.ALLOW_MASTERBLOCKS.getBoolean())
{
event.setCancelled(true);
event.getAt().getBlock().setType(Material.CAKE);
}
}
@EventHandler(priority = EventPriority.HIGH) @EventHandler(priority = EventPriority.HIGH)
public void onEntityCombust(EntityCombustEvent event) public void onEntityCombust(EntityCombustEvent event)
{ {

View File

@ -69,24 +69,17 @@ public class InteractBlocker extends FreedomService
private void handleRightClick(PlayerInteractEvent event) private void handleRightClick(PlayerInteractEvent event)
{ {
final Player player = event.getPlayer(); final Player player = event.getPlayer();
final Block clickedBlock = event.getClickedBlock();
if (event.getClickedBlock() != null) if (clickedBlock != null && clickedBlock.getType() == Material.RESPAWN_ANCHOR && !ConfigEntry.ALLOW_RESPAWN_ANCHORS.getBoolean())
{
if (event.getClickedBlock().getType().equals(Material.STRUCTURE_BLOCK) || event.getClickedBlock().getType().equals(Material.JIGSAW) || event.getClickedBlock().getType().equals(Material.RESPAWN_ANCHOR))
{ {
event.setCancelled(true); event.setCancelled(true);
event.getPlayer().closeInventory(); return;
}
} }
if (Groups.SPAWN_EGGS.contains(event.getMaterial())) if (Groups.SPAWN_EGGS.contains(event.getMaterial()))
{ {
event.setCancelled(true); event.setCancelled(true);
Block clickedBlock = event.getClickedBlock();
if (clickedBlock == null)
{
return;
}
EntityType eggType = null; EntityType eggType = null;
try try
{ {
@ -104,7 +97,7 @@ public class InteractBlocker extends FreedomService
{ {
// //
} }
if (eggType != null) if (eggType != null && clickedBlock != null)
{ {
clickedBlock.getWorld().spawnEntity(clickedBlock.getLocation().add(event.getBlockFace().getDirection()).add(0.5, 0.5, 0.5), eggType); clickedBlock.getWorld().spawnEntity(clickedBlock.getLocation().add(event.getBlockFace().getDirection()).add(0.5, 0.5, 0.5), eggType);
} }

View File

@ -1,58 +0,0 @@
package me.totalfreedom.totalfreedommod.bridge;
import me.totalfreedom.tfguilds.Common;
import me.totalfreedom.tfguilds.TFGuilds;
import me.totalfreedom.totalfreedommod.FreedomService;
import org.bukkit.entity.Player;
import org.bukkit.plugin.Plugin;
public class TFGuildsBridge extends FreedomService
{
public boolean enabled = false;
@Override
public void onStart()
{
}
@Override
public void onStop()
{
}
public boolean isTFGuildsEnabled()
{
if (enabled)
{
return true;
}
try
{
final Plugin tfGuilds = server.getPluginManager().getPlugin("TFGuilds");
if (tfGuilds != null && tfGuilds.isEnabled())
{
if (tfGuilds instanceof TFGuilds)
{
enabled = true;
return true;
}
}
}
catch (NoClassDefFoundError ex)
{
return false;
}
return false;
}
public boolean inGuildChat(Player player)
{
if (!isTFGuildsEnabled())
{
return false;
}
return Common.GUILD_CHAT.contains(player);
}
}

View File

@ -19,7 +19,7 @@ public class Command_toggle extends FreedomCommand
private final List<String> toggles = Arrays.asList( private final List<String> toggles = Arrays.asList(
"waterplace", "fireplace", "lavaplace", "fluidspread", "lavadmg", "firespread", "frostwalk", "waterplace", "fireplace", "lavaplace", "fluidspread", "lavadmg", "firespread", "frostwalk",
"firework", "prelog", "lockdown", "petprotect", "entitywipe", "nonuke [range] [count]", "firework", "prelog", "lockdown", "petprotect", "entitywipe", "nonuke [range] [count]",
"explosives [radius]", "unsafeenchs", "bells", "armorstands", "structureblocks", "jigsaws", "grindstones", "explosives [radius]", "unsafeenchs", "bells", "armorstands", "masterblocks", "grindstones",
"jukeboxes", "spawners", "4chan", "beehives", "respawnanchors", "autotp", "autoclear", "minecarts", "mp44", "jukeboxes", "spawners", "4chan", "beehives", "respawnanchors", "autotp", "autoclear", "minecarts", "mp44",
"landmines", "tossmob", "gravity"); "landmines", "tossmob", "gravity");
@ -193,15 +193,9 @@ public class Command_toggle extends FreedomCommand
break; break;
} }
case "structureblocks": case "masterblocks":
{ {
toggle("Structure blocks are", ConfigEntry.ALLOW_STRUCTURE_BLOCKS); toggle("Master blocks are", ConfigEntry.ALLOW_MASTERBLOCKS);
break;
}
case "jigsaws":
{
toggle("Jigsaws are", ConfigEntry.ALLOW_JIGSAWS);
break; break;
} }

View File

@ -25,8 +25,6 @@ public enum ConfigEntry
ALLOW_BELLS(Boolean.class, "allow.bells"), ALLOW_BELLS(Boolean.class, "allow.bells"),
ALLOW_ARMOR_STANDS(Boolean.class, "allow.armorstands"), ALLOW_ARMOR_STANDS(Boolean.class, "allow.armorstands"),
ALLOW_MINECARTS(Boolean.class, "allow.minecarts"), ALLOW_MINECARTS(Boolean.class, "allow.minecarts"),
ALLOW_STRUCTURE_BLOCKS(Boolean.class, "allow.structureblocks"),
ALLOW_JIGSAWS(Boolean.class, "allow.jigsaws"),
ALLOW_GRINDSTONES(Boolean.class, "allow.grindstones"), ALLOW_GRINDSTONES(Boolean.class, "allow.grindstones"),
ALLOW_JUKEBOXES(Boolean.class, "allow.jukeboxes"), ALLOW_JUKEBOXES(Boolean.class, "allow.jukeboxes"),
ALLOW_SPAWNERS(Boolean.class, "allow.spawners"), ALLOW_SPAWNERS(Boolean.class, "allow.spawners"),
@ -35,6 +33,7 @@ public enum ConfigEntry
AUTO_TP(Boolean.class, "allow.auto_tp"), AUTO_TP(Boolean.class, "allow.auto_tp"),
AUTO_CLEAR(Boolean.class, "allow.auto_clear"), AUTO_CLEAR(Boolean.class, "allow.auto_clear"),
ALLOW_GRAVITY(Boolean.class, "allow.gravity"), ALLOW_GRAVITY(Boolean.class, "allow.gravity"),
ALLOW_MASTERBLOCKS(Boolean.class, "allow.masterblocks"),
// //
BLOCKED_CHATCODES(String.class, "blocked_chatcodes"), BLOCKED_CHATCODES(String.class, "blocked_chatcodes"),
// //

View File

@ -224,8 +224,6 @@ allow:
minecarts: true minecarts: true
clearonjoin: false clearonjoin: false
tpronjoin: false tpronjoin: false
structureblocks: false
jigsaws: false
grindstones: true grindstones: true
jukeboxes: true jukeboxes: true
spawners: false spawners: false
@ -234,6 +232,7 @@ allow:
auto_tp: false auto_tp: false
auto_clear: false auto_clear: false
gravity: false gravity: false
masterblocks: false
blocked_commands: blocked_commands:
# #