Merge branch 'development' into development

This commit is contained in:
Ryan 2023-04-02 10:21:33 +01:00 committed by GitHub
commit 3735dcd405
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
6 changed files with 24 additions and 3 deletions

View File

@ -5,7 +5,7 @@
<groupId>me.totalfreedom</groupId> <groupId>me.totalfreedom</groupId>
<artifactId>TotalFreedomMod</artifactId> <artifactId>TotalFreedomMod</artifactId>
<version>2022.06</version> <version>2022.06.1</version>
<packaging>jar</packaging> <packaging>jar</packaging>
<properties> <properties>

View File

@ -171,6 +171,11 @@ public class InteractBlocker extends FreedomService
} }
case WRITTEN_BOOK: case WRITTEN_BOOK:
{ {
if (ConfigEntry.ALLOW_BOOKS.getBoolean())
{
break;
}
player.getInventory().clear(player.getInventory().getHeldItemSlot()); player.getInventory().clear(player.getInventory().getHeldItemSlot());
player.sendMessage(ChatColor.GRAY + "Books are currently disabled."); player.sendMessage(ChatColor.GRAY + "Books are currently disabled.");
event.setCancelled(true); event.setCancelled(true);

View File

@ -24,7 +24,7 @@ import org.bukkit.plugin.SimplePluginManager;
public class CommandBlocker extends FreedomService public class CommandBlocker extends FreedomService
{ {
private final Pattern whitespacePattern = Pattern.compile("^/?( +)(.*)?");
private final Pattern flagPattern = Pattern.compile("(:([0-9]){5,})"); private final Pattern flagPattern = Pattern.compile("(:([0-9]){5,})");
// //
private final Map<String, CommandBlockerEntry> entryList = Maps.newHashMap(); private final Map<String, CommandBlockerEntry> entryList = Maps.newHashMap();
@ -156,6 +156,14 @@ public class CommandBlocker extends FreedomService
// Format // Format
command = command.toLowerCase().trim(); command = command.toLowerCase().trim();
// Whitespaces
Matcher whitespaceMatcher = whitespacePattern.matcher(command);
if (whitespaceMatcher.matches() && whitespaceMatcher.groupCount() == 2)
{
command = whitespaceMatcher.group(2);
}
command = command.startsWith("/") ? command.substring(1) : command; command = command.startsWith("/") ? command.substring(1) : command;
// Check for plugin specific commands // Check for plugin specific commands

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", "masterblocks", "grindstones", "explosives [radius]", "unsafeenchs", "bells", "armorstands", "masterblocks", "books", "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");
@ -199,6 +199,12 @@ public class Command_toggle extends FreedomCommand
break; break;
} }
case "books":
{
toggle("Books are", ConfigEntry.ALLOW_BOOKS);
break;
}
case "grindstones": case "grindstones":
{ {
toggle("Grindstones are", ConfigEntry.ALLOW_GRINDSTONES); toggle("Grindstones are", ConfigEntry.ALLOW_GRINDSTONES);

View File

@ -34,6 +34,7 @@ public enum ConfigEntry
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"), ALLOW_MASTERBLOCKS(Boolean.class, "allow.masterblocks"),
ALLOW_BOOKS(Boolean.class, "allow.books"),
// //
BLOCKED_CHATCODES(String.class, "blocked_chatcodes"), BLOCKED_CHATCODES(String.class, "blocked_chatcodes"),
// //

View File

@ -220,6 +220,7 @@ allow:
auto_clear: false auto_clear: false
gravity: false gravity: false
masterblocks: false masterblocks: false
books: true
blocked_commands: blocked_commands:
# #