Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 15 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -25,4 +25,18 @@
- ArmorStands are no longer breakable and interactable
- Fix: if `spawn.timer` is 0, it will no longer check for movement (could not /spawn during freefall)
- DisabledWorlds no longer stops tracking if a world is reloaded
- Spawn timer no longer sends message if timer = 0
- Spawn timer no longer sends message if timer = 0

## [3.4.0] - 12-11-2025
- /spawn task now correctly plays sounds on Paper/Purpur
- actions_on_join bypass disabledworlds
- EnderBow now longer sends spammy console message while in debug mode
- Added debug logging to messagebuilder
- Added hide mode
- Tracks to see if players join, if in hide mode, will automatically hide players
- PlayerVisibilityItem now uses this logic
- Added `/hubbly pv` command (for toggling hide mode)
- `/hubbly pv show` to disable hide mode
- `/hubbly pv hide` to enable hide mode
- Added `playervisibility.hide` and `playervisibility.show` keys in the messages file
(available on github in english and portuguese)
2 changes: 1 addition & 1 deletion build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ dependencies {
}

group = "me.calrl"
version = "3.3.0"
version = "3.4.0"
description = "Hubbly"
java.sourceCompatibility = JavaVersion.VERSION_21

Expand Down
12 changes: 12 additions & 0 deletions src/main/java/me/calrl/hubbly/Hubbly.java
Original file line number Diff line number Diff line change
Expand Up @@ -22,11 +22,19 @@
import me.calrl.hubbly.functions.BossBarManager;
import me.calrl.hubbly.hooks.HookManager;
import me.calrl.hubbly.inventory.InventoryListener;
import me.calrl.hubbly.items.AoteItem;
import me.calrl.hubbly.items.EnderbowItem;
import me.calrl.hubbly.items.RodItem;
import me.calrl.hubbly.items.TridentItem;
import me.calrl.hubbly.listeners.ServerLoadListener;
import me.calrl.hubbly.listeners.chat.ChatListener;
import me.calrl.hubbly.listeners.chat.CommandBlockerListener;
import me.calrl.hubbly.listeners.items.ConfigItemListener;
import me.calrl.hubbly.listeners.items.PlayerVisibilityListener;
import me.calrl.hubbly.listeners.items.movement.AoteListener;
import me.calrl.hubbly.listeners.items.movement.EnderbowListener;
import me.calrl.hubbly.listeners.items.movement.RodListener;
import me.calrl.hubbly.listeners.items.movement.TridentListener;
import me.calrl.hubbly.listeners.player.*;
import me.calrl.hubbly.listeners.world.AntiWDL;
import me.calrl.hubbly.listeners.world.LaunchpadListener;
Expand Down Expand Up @@ -150,6 +158,10 @@ private void loadListeners() {
registerListener(new InventoryListener(this));
registerListener(new XPListener(this), "player.experience.enabled");
registerListener(new PlayerMoveListener(this));
registerListener(new TridentListener(this));
registerListener(new EnderbowListener(this));
registerListener(new AoteListener(this));
registerListener(new RodListener(this));
}

@Override
Expand Down
48 changes: 48 additions & 0 deletions src/main/java/me/calrl/hubbly/action/ActionManager.java
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@

import me.calrl.hubbly.Hubbly;
import me.calrl.hubbly.action.actions.*;
import me.calrl.hubbly.enums.Result;
import me.calrl.hubbly.events.ActionEvent;
import me.calrl.hubbly.managers.DisabledWorlds;
import me.calrl.hubbly.utils.MessageBuilder;
Expand Down Expand Up @@ -93,6 +94,53 @@ public void executeAction(Player player, String actionData) {
}
}

/**
* @param player the player
* @param actionData e.g. "[PLAYER] spawn"
* @param bypass the disabled world check
* @return
*/
public Result executeAction(Player player, String actionData, boolean bypass) {

if(!bypass) {
DisabledWorlds disabledWorldsManager = plugin.getDisabledWorldsManager();
boolean inDisabledWorld = disabledWorldsManager.inDisabledWorld(player.getLocation());

if(inDisabledWorld) return Result.DISABLED_WORLD;
}


if(!actionData.startsWith("[") || !actionData.contains("]")) {
return Result.INVALID_ARGS;
}

String identifier = this.getIdentifier(actionData);
String data = this.getData(actionData);

Action action = actions.get(identifier);
ActionEvent event = new ActionEvent(player, action, data);
Bukkit.getPluginManager().callEvent(event);

if (action == null) {
String errorMessage = new MessageBuilder(plugin)
.setKey("action.errors.null")
.setPlayer(Bukkit.getConsoleSender())
.build();

plugin.getLogger().warning(errorMessage);
return Result.NOT_FOUND;
}

plugin.getDebugMode().info("Checking if ActionEvent is cancelled...");
if(event.isCancelled()) {
return Result.CANCELLED;
}

plugin.getDebugMode().info("Executing action: " + identifier + " " + data);
action.execute(plugin, player, data);
return Result.SUCCESS;
}

public void executeActions(Player player, String actionData) {
if(actionData == null) {
new MessageBuilder(plugin).setKey("action.errors.null").setPlayer(Bukkit.getConsoleSender()).send();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,8 @@ public String getIdentifier() {

@Override
public void execute(Hubbly plugin, Player player, String data) {
new MessageBuilder(plugin, player)
new MessageBuilder(plugin)
.setPlayer(player)
.setMessage(data)
.send();
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ public Result execute(CommandSender sender, String[] args, int depth) {
}

private void loadNodes() {

addChild("items", new ItemsCommand(plugin));
}

@Override
Expand Down
31 changes: 31 additions & 0 deletions src/main/java/me/calrl/hubbly/commands/debug/ItemsCommand.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
package me.calrl.hubbly.commands.debug;

import me.calrl.hubbly.Hubbly;
import me.calrl.hubbly.enums.Permissions;
import me.calrl.hubbly.enums.Result;
import me.calrl.hubbly.managers.ItemsManager;
import me.calrl.hubbly.utils.CommandNode;
import org.bukkit.command.CommandSender;

import java.util.Set;
import java.util.stream.Collectors;

public class ItemsCommand extends CommandNode {
private final Hubbly plugin;
public ItemsCommand(Hubbly plugin) {
super("items");
this.plugin = plugin;
}

@Override
public Result execute(CommandSender sender, String[] args, int depth) {
ItemsManager manager = plugin.getItemsManager();
if(!sender.hasPermission(Permissions.COMMAND_DEBUG.getPermission())) {
return Result.NO_PERMISSION;
}
Set<String> set = manager.getItems().keySet();
String message = String.join(",", set);
sender.sendMessage(message);
return Result.SUCCESS;
}
}
29 changes: 29 additions & 0 deletions src/main/java/me/calrl/hubbly/commands/visibility/HideCommand.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
package me.calrl.hubbly.commands.visibility;

import me.calrl.hubbly.Hubbly;
import me.calrl.hubbly.enums.Result;
import me.calrl.hubbly.utils.CommandNode;
import me.calrl.hubbly.utils.MessageBuilder;
import org.bukkit.command.CommandSender;
import org.bukkit.entity.Player;

public class HideCommand extends CommandNode {
private final Hubbly plugin;
public HideCommand(Hubbly plugin) {
super("hide");
this.plugin = plugin;
}

@Override
public Result execute(CommandSender sender, String[] args, int depth) {
if (sender instanceof Player player) {
plugin.getManagerFactory().getPlayerVisibilityManager().setHideMode(player, true);
new MessageBuilder(plugin)
.setPlayer(player)
.setKey("playervisibility.show")
.send();
return Result.SUCCESS;
}
return Result.PLAYER_ONLY;
}
}
29 changes: 29 additions & 0 deletions src/main/java/me/calrl/hubbly/commands/visibility/ShowCommand.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
package me.calrl.hubbly.commands.visibility;

import me.calrl.hubbly.Hubbly;
import me.calrl.hubbly.enums.Result;
import me.calrl.hubbly.utils.CommandNode;
import me.calrl.hubbly.utils.MessageBuilder;
import org.bukkit.command.CommandSender;
import org.bukkit.entity.Player;

public class ShowCommand extends CommandNode {
private final Hubbly plugin;
public ShowCommand(Hubbly plugin) {
super("show");
this.plugin = plugin;
}

@Override
public Result execute(CommandSender sender, String[] args, int depth) {
if (sender instanceof Player player) {
plugin.getManagerFactory().getPlayerVisibilityManager().setHideMode(player, false);
new MessageBuilder(plugin)
.setPlayer(player)
.setKey("playervisibility.hide")
.send();
return Result.SUCCESS;
}
return Result.PLAYER_ONLY;
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
package me.calrl.hubbly.commands.visibility;

import me.calrl.hubbly.Hubbly;
import me.calrl.hubbly.enums.Permissions;
import me.calrl.hubbly.enums.Result;
import me.calrl.hubbly.utils.CommandNode;
import me.calrl.hubbly.utils.MessageBuilder;
import org.bukkit.command.CommandSender;
import org.bukkit.entity.Player;

import java.util.List;

public class VisibilityCommand extends CommandNode {
private final Hubbly plugin;
public VisibilityCommand(Hubbly plugin) {
super("pv");
this.plugin = plugin;
this.loadNodes();
}

private void loadNodes() {
this.addChild("show", new ShowCommand(plugin));
this.addChild("hide", new HideCommand(plugin));
}

@Override
public Result execute(CommandSender sender, String[] args, int depth) {
if(!(sender instanceof Player player)) {
new MessageBuilder(plugin).setKey("no_console").setPlayer(sender).send();
return Result.PLAYER_ONLY;
}
if(!player.hasPermission(Permissions.COMMAND_PLAYER_VISIBILITY.getPermission())) {
new MessageBuilder(plugin).setKey("no_permission_command").setPlayer(player).send();
return Result.NO_PERMISSION;
}

this.executeIfChildPresent(sender, args, depth);

return Result.SUCCESS;
}

@Override
public List<String> tabComplete(CommandSender sender, String[] args, int depth) {
return super.tabComplete(sender, args, depth);
}
}
1 change: 1 addition & 0 deletions src/main/java/me/calrl/hubbly/enums/Permissions.java
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@ public enum Permissions {
COMMAND_CONVERT("command.convert"),
COMMAND_MENU("command.menu"),
COMMAND_DEBUG("command.debug"),
COMMAND_PLAYER_VISIBILITY("command.playervisibility"),

COMMAND_WORLDS("commands.worlds"),
COMMAND_WORLDS_ADD("commands.worlds.add"),
Expand Down
15 changes: 14 additions & 1 deletion src/main/java/me/calrl/hubbly/enums/Result.java
Original file line number Diff line number Diff line change
Expand Up @@ -11,5 +11,18 @@ public enum Result {
COOLDOWN,
ALREADY_EXISTS,
NOTHING_TO_DO,
NO_CHILD
NO_CHILD,
// in disabled world
DISABLED_WORLD,
// event cancelled
CANCELLED,
NOT_FOUND;

public static Result from(boolean bool) {
if(bool) {
return Result.SUCCESS;
} else {
return Result.FAILURE;
}
}
}
Loading